Location: PHPKode > projects > Bloggie Lite > admin/settings.php
<?

// Copyright (C) Bloggie Lite Written by : Sean
// http://www.mywebland.com , http://mybloggie.mywebland.com

// You are requested to retain this copyright notice in order to use
// this software.

//This program is free software; you can redistribute it and/or
//modify it under the terms of the GNU General Public License
//as published by the Free Software Foundation; either version 2
//of the License, or (at your option) any later version.

//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU General Public License for more details.

//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

if ( !defined('IN_BLOGGIE') )
  {
    die("You are not allowed to access this page directly !");
  }

if (!authenticate()) {
    error($lang['Error'], "Request terminated due to abnormal operations");
}

if ($userlevel==1){



if ( isset($_POST['submit']) ) {
unset($pref_data);
if (!isset($_POST['bloggie_path'])) { error($lang['Error'] ,$lang['Path_Error']) ;}
if (isset($_POST['blog_name'])) $blog_name = $_POST['blog_name'] ;  else $blog_name  = "Your Blog's Name";
if (isset($_POST['default_style'])) $default_style  = $_POST['default_style'];  else $default_style  = "mylite";
if (isset($_POST['language'])) $language = $_POST['language'];  else $language  = "lang_eng.php";
if (isset($_POST['encoding'])) $encoding = $_POST['encoding']; else  $encoding    = "utf-8";
if (isset($_POST['bloggie_path'])) $bloggie_path = $_POST['bloggie_path'];  else  $bloggie_path = "";
if (isset($_POST['gmt'])) $gmt = $_POST['gmt'];   else  $gmt  = 0;
if (isset($_POST['blog_limit'])) $blog_limit = $_POST['blog_limit'];    else $blog_limit   = "5";
if (isset($_POST['recent_limit'])) $recent_limit = $_POST['recent_limit'];    else $recent_limit   = "5";
if (isset($_POST['archive_limit'])) $archive_limit = $_POST['archive_limit'];   else  $archive_limit   = "5";
if (isset($_POST['email'])) $email  = $_POST['email'];   else $email   = "";
if (isset($_POST['reply_to'])) $reply_to = $_POST['reply_to'];  else  $reply_to = "";
if (isset($_POST['flood_interval'])) $flood_interval = $_POST['flood_interval'];    else $flood_interval  = "360";
if (isset($_POST['post_html_safe'])) $post_html_safe = $_POST['post_html_safe'];    else $post_html_safe   = 1 ;
if (isset($_POST['comment_html_safe'])) $comment_html_safe = $_POST['comment_html_safe'];  else $comment_html_safe  = 1;
if (isset($_POST['moderate_comment'])) $moderate_comment = $_POST['moderate_comment'];   else  $moderate_comment = 1;
if (isset($_POST['enable_comment'])) $enable_comment = $_POST['enable_comment'];   else $enable_comment    = 1;
if (isset($_POST['email_notification'])) $email_notification = $_POST['email_notification'];  else $email_notification  = 1;
//if (isset($_POST['guest_gravatar'])) $guest_gravatar = $_POST['guest_gravatar'];  else  $guest_gravatar   = "" ;
if (isset($_POST['font_family'])) $font_family = $_POST['font_family'];  else  $font_family  = "Verdana";
if (isset($_POST['cookie_name'])) {$cookie_name = $_POST['cookie_name']; $cookie_name = str_replace('.', '_', $cookie_name); }  else { $cookie_name    = "";  }



$option_name = array('blog_name', 'default_style', 'language', 'encoding','bloggie_path', 'gmt','blog_limit' ,'recent_limit', 'archive_limit',
'email', 'reply_to', 'flood_interval', 'post_html_safe', 'comment_html_safe', 'moderate_comment', 'enable_comment', 'email_notification',
'cookie_name', 'font_family');

for ($i=0; $i<count($option_name); $i++) {  $setting  = $$option_name[$i] ;
$sql = "UPDATE " .PREF_TBL." SET
setting = '$setting' WHERE option_name = '$option_name[$i]'";
//echo $setting ." ". $option_name[$i] ."<br />";

$result = $db->sql_query($sql);
if( !($result = $db->sql_query($sql)) )
   {
      $sql_error = $db->sql_error();
       error($lang['Error'], 'SQL Query Error : '.$sql_error['message'].' !');
    }
}
$template->assign_block_vars('status', array(
               'STATUS'          => $lang['S_Setting_changed']." <a href=\"http://". $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']."\">".$lang['Settings']."</a>",
));
$pref_data = pref_data();
}

if ($pref_data['post_html_safe'] == 1 ) {
   $template->assign_vars(array(
     'PCHECKED1'             => " checked=\"checked\"",
     'PCHECKED0'             => "",
     ));
} else {
   $template->assign_vars(array(
     'PCHECKED0'             => " checked=\"checked\"",
     'PCHECKED1'             => "",
     ));
}
if ($pref_data['comment_html_safe'] == 1 ) {
   $template->assign_vars(array(
     'CCHECKED1'             => " checked=\"checked\"",
     'CCHECKED0'             => "",
     ));
} else {
   $template->assign_vars(array(
     'CCHECKED0'             => " checked=\"checked\"",
     'CCHECKED1'             => "",
     ));
}
if ($pref_data['enable_comment'] == 1 ) {
   $template->assign_vars(array(
     'ECCHECKED1'             => " checked=\"checked\"",
     'ECCHECKED0'             => "",
     ));
} else {
   $template->assign_vars(array(
     'ECCHECKED0'             => " checked=\"checked\"",
     'ECCHECKED1'             => "",
     ));
}
if ($pref_data['moderate_comment'] == 1 ) {
   $template->assign_vars(array(
     'MCCHECKED1'             => " checked=\"checked\"",
     'MCCHECKED0'             => "",
     ));
} else {
   $template->assign_vars(array(
     'MCCHECKED0'             => " checked=\"checked\"",
     'MCCHECKED1'             => "",
     ));
}
if ($pref_data['email_notification'] == 1 ) {
   $template->assign_vars(array(
     'ENCHECKED1'             => " checked=\"checked\"",
     'ENCHECKED0'             => "",
     ));
} else {
   $template->assign_vars(array(
     'ENCHECKED0'             => " checked=\"checked\"",
     'ENCHECKED1'             => "",
     ));
}


$template->set_filenames(array( 'settings'   => 'admin/settings.tpl' ));
   $template->assign_vars(array(
     'L_SETTINGS'            => $lang['Settings'],
     'L_SUBMIT'              => $lang['Submit'],
     'L_YES'                 => $lang['Yes'],
     'L_NO'                  => $lang['No'],
     'S_DESCRIPTION'         => $lang['S_Description'],
     'S_SETTING_DATA'        => $lang['S_Setting_Data'],
     'S_INSTRUCTIONS'        => $lang['S_Instructions'],
     'S_STYLE'               => $lang['S_Style'],
     'S_BLOG_NAME'           => $lang['S_Blog_Name'],
     'S_BLOG_LIMIT'          => $lang['S_Post_Per_Page'],
     'S_LANGUAGE'            => $lang['S_Language'],
     'S_TIME_ZONE'           => $lang['S_Time_Zone'],
     'S_ENCODING'            => $lang['S_Encoding'],
     'S_FONT_FAMILY'         => $lang['S_Font_Family'],
     'S_BLOGGIE_URL'         => $lang['S_Bloggie_URL'],
     'S_TIME_ZONE'           => $lang['S_Time_Zone'],
     'S_EMAIL'               => $lang['S_Email'],
     'S_COOKIE_NAME'         => $lang['S_Cookie_Name'],
     'S_RECENT_LIMIT'        => $lang['S_Recent_Limit'],
     'S_ARCHIVE_LIMIT'       => $lang['S_Archive_Limit'],
     'S_FLOOD_INTERVAL'      => $lang['S_Flood_Interval'],
     'S_PHTML_SAFE'          => $lang['S_Post_Html_Safe'],
     'S_CHTML_SAFE'          => $lang['S_Comment_Html_Safe'],
     'S_ENABLE_COMMENTS'     => $lang['S_Enable_Comment'],
     'S_MODERATE_COMMENTS'   => $lang['S_Moderate_Comment'],
     'S_EMAIL_NOTIFICATION'  => $lang['S_Email_Notification'],
     'S_SEF_METHOD'          => $lang['S_Sef_Method'],
     'D_STYLE'               => $pref_data['default_style'],
     'D_BLOG_NAME'           => $pref_data['blog_name'],
     'D_LANGUAGE'            => $pref_data['language'],
     'D_TIME_ZONE'           => $pref_data['gmt'],
     'D_ENCODING'            => $pref_data['encoding'],
     'D_FONT_FAMILY'            => $pref_data['font_family'],
     'D_BLOGGIE_URL'         => $pref_data['bloggie_path'],
     'D_EMAIL'               => $pref_data['email'],
     'D_COOKIE_NAME'         => $pref_data['cookie_name'],
     'D_BLOG_LIMIT'          => $pref_data['blog_limit'],
     'D_RECENT_LIMIT'        => $pref_data['recent_limit'],
     'D_ARCHIVE_LIMIT'       => $pref_data['archive_limit'],
     'D_FLOOD_INTERVAL'      => $pref_data['flood_interval'],
     'D_PHTML_SAFE'          => $pref_data['post_html_safe'],
     'D_CHTML_SAFE'          => $pref_data['comment_html_safe'],
     'D_ENABLE_COMMENTS'     => $pref_data['enable_comment'],
     'D_MODERATE_COMMENTS'   => $pref_data['moderate_comment'],
     'D_EMAIL_NOTIFICATION'  => $pref_data['email_notification'],
     'SET_CONF'              => $lang['S_Confirmation'],

/**
     'CCHECKED1'             => ,
     'CCHECKED0'             => ,
     'MCHECKED1'             => ,
     'MCHECKED0'             => ,
     'ECCHECKED1'            => ,
     'ECCHECKED0'            => ,
**/
));


$template->pparse('settings');
unset($pref_data);

}
?>
Return current item: Bloggie Lite