"Personal Options",
'url' => "$PHP_SELF?mod=options&action=personal",
'access' => "4",
),
array(
'name' => "Block IP's from posting comments",
'url' => "$PHP_SELF?mod=ipban",
'access' => "1",
),
array(
'name' => "System Configurations",
'url' => "$PHP_SELF?mod=options&action=syscon&rand=".time(),
'access' => "1",
),
array(
'name' => "Edit Templates",
'url' => "$PHP_SELF?mod=options&action=templates",
'access' => "1",
),
array(
'name' => "Add/Edit Users",
'url' => "$PHP_SELF?mod=editusers&action=list",
'access' => "1",
),
array(
'name' => "Archives Manager",
'url' => "$PHP_SELF?mod=tools&action=archive",
'access' => "1",
),
array(
'name' => "Manage Uploaded Images",
'url' => "$PHP_SELF?mod=images",
'access' => "1",
),
array(
'name' => "Backup Tool",
'url' => "$PHP_SELF?mod=tools&action=backup",
'access' => "1",
),
array(
'name' => "Edit Categories",
'url' => "$PHP_SELF?mod=categories",
'access' => "1",
),
);
//------------------------------------------------
// Cut the options for wich we don't have access
//------------------------------------------------
$count_options = count($options);
for($i=0; $i<$count_options; $i++){
if($member_db[1] > $options[$i]['access']){
unset($options[$i]);
}
}
echo'
';
echofooter();
}
// ********************************************************************************
// Show Personal Options
// ********************************************************************************
elseif($action == "personal")
{
echoheader("user","Personal Options");
$registrationdate = date("D, d F Y",$member_db[0]); //registration date
if($member_db[7] == 1){ $ifchecked = "Checked"; } //if user wants to hide his e-mail
foreach($member_db as $key=>$value){
$member_db[$key] = stripslashes(preg_replace(array("'\"'", "'\''"), array(""", "'"),$member_db[$key]));
}
echo"
";
echofooter();
}
// ********************************************************************************
// Save Personal Options
// ********************************************************************************
elseif($action == "dosavepersonal")
{
$editnickname = replace_comment("add",$editnickname);
$editmail = replace_comment("add",$editmail);
$edithidemail = replace_comment("add",$edithidemail);
$change_avatar = replace_comment("add",$change_avatar);
if($edithidemail){ $edithidemail = 1;}else{ $edithidemail = 0; }
$avatars = preg_replace(array("'\|'","'\n'","' '"), array("","","_"), $avatars);
$old_user_db = file("./data/users.db.php");
$new_user_db = fopen("./data/users.db.php", w);
$personal_success = FALSE;
foreach($old_user_db as $old_user_db_line){
$old_user_db_arr = explode("|", $old_user_db_line);
if(strtolower($username) != strtolower($old_user_db_arr[2])){
fwrite($new_user_db,"$old_user_db_line");
}
else{
if($editpassword != ""){
$old_user_db_arr[3] = md5($editpassword);
if($config_use_cookies == TRUE){ setcookie("md5_password", $old_user_db_arr[3]); }
$_SESSION['md5_password'] = $old_user_db_arr[3];
}
fwrite($new_user_db,"$old_user_db_arr[0]|$old_user_db_arr[1]|$old_user_db_arr[2]|$old_user_db_arr[3]|$editnickname|$editmail|$old_user_db_arr[6]|$edithidemail|$change_avatar|$old_user_db_arr[9]||\n");
$personal_success = TRUE;
}
}
fclose($new_user_db);
if($personal_success){ msg("info", "Changes Saved", "Your personal information was saved.", "$PHP_SELF?mod=options&action=personal"); }
else{ msg("error", "Error !!!", "Error while listing users, $username not found", "$PHP_SELF?mod=options&action=personal"); }
}
// ********************************************************************************
// Edit Templates
// ********************************************************************************
elseif($action == "templates")
{
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Detect all template packs we have
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$templates_list = array();
if(!$handle = opendir("./data")){ die("Can not open directory $cutepath/data "); }
while (false !== ($file = readdir($handle))){
if(eregi(".tpl", $file)){
$file_arr = explode(".", $file);
$templates_list[]= $file_arr[0];
}
}
closedir($handle);
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we want to create new template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "new"){
echoheader("options", "New Template");
echo"';
echofooter();
exit;
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do Create the new template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "donew"){
if(!eregi("^[a-z0-9_-]+$", $template_name)){ msg("error", "Error", "The name of the template must be only with letters and numbers", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
if(file_exists("./data/${template_name}.tpl")){ msg("error", "Error", "Template with this name already exists", "$PHP_SELF?mod=options&subaction=new&action=templates"); }
if($base_template != ""){ $base_file = "./data/${base_template}.tpl"; }
else{ $base_file = "./data/Default.tpl"; }
if (!copy($base_file, "./data/${template_name}.tpl")) {
msg("error", "Error", "Can not copy file $base_file to ./data/ folder with name ${template_name}.tpl");
}
@chmod("./data/${template_name}.tpl", 0777);
msg("info", "Template Created", "A new template was created with name ${template_name}
", "$PHP_SELF?mod=options&action=templates");
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Deleting template, preparation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "delete"){
if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); }
$msg = "";
msg("info", "Deleting Template", $msg);
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DO Deleting template
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($subaction == "dodelete"){
if(strtolower($do_template) == "default"){ msg("Error", "Error !!!", "You can not delete the default template", "$PHP_SELF?mod=options&action=templates"); }
$unlink = unlink("./data/${do_template}.tpl");
if(!$unlink){ msg("error", "Error", "Can not delete file ./data/${do_template}.tpl
maybe the is no permission from the server"); }
else{ msg("info", "Template Deleted", "The template ${do_template} was deleted.", "$PHP_SELF?mod=options&action=templates"); }
}
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Show The Template Manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
if($do_template == '' or !$do_template){
$do_template = 'Default';
$show_delete_link = '';
}elseif(strtolower($do_template) != 'default'){
$show_delete_link = "[delete this template]";
}
require("./data/${do_template}.tpl");
if(eregi("opera", $HTTP_USER_AGENT)){ $tr_hidden = ""; }
else{ $tr_hidden = " style='display:none'"; }
$templates_names = array("template_active", "template_comment", "template_form", "template_full", "template_prev_next", "template_comments_prev_next");
foreach($templates_names as $template)
{
$$template = preg_replace("/","<",$$template);
$$template = preg_replace("/>/",">",$$template);
}
echoheader("options","Templates");
echo'
Edit Template Parts';
echofooter();
}
// ********************************************************************************
// Do Save Changes to Templates
// ********************************************************************************
elseif($action == "dosavetemplates")
{
if($member_db[1] != 1){ msg("error", "Access Denied", "You don't have permissions for this type of action"); }
$templates_names = array("edit_active", "edit_comment", "edit_form", "edit_full", "edit_prev_next", "edit_comments_prev_next");
foreach($templates_names as $template)
{
$$template = stripslashes($$template);
}
if($do_template == "" or !$do_template){ $do_template = "Default"; }
$template_file = "./data/${do_template}.tpl";
$handle = fopen("$template_file","w");
fwrite($handle, "\n");
msg("info","Changes Saved","The changes to template $do_template were successfully saved.","$PHP_SELF?mod=options&action=templates&do_template=$do_template");
}
// ********************************************************************************
// System Configuration
// ********************************************************************************
elseif($action == "syscon")
{
echoheader("options", "System Configuration");
function showRow($title="", $description="", $field="")
{
global $i;
if( $i%2 == 0 and $title != ""){ $bg = "bgcolor=#F7F6F4"; }
echo"
$title
|
$field
|
|
$description
|
";
$bg = ""; $i++;
}
function makeDropDown($options, $name, $selected)
{
$output = "