<?
// 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['sef_method'])) $sef_method = $_POST['sef_method']; else $sef_method = "yes";
if (isset($_POST['link_format'])) $link_format = $_POST['link_format']; else $link_format = "index.php/{READ}/{YYYY}/{MM}/{DD}/{TITLE}";
if (isset($_POST['custom_structure'])) $custom_structure = $_POST['custom_structure']; else $custom_structure = "";
if ( $sef_method == "yes" ) {
$sql = "UPDATE " .PREF_TBL." SET
setting = '$link_format' WHERE option_name = 'link_format'";
$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'].' !');
}
} elseif ($sef_method == "custom") {
$sql = "UPDATE " .PREF_TBL." SET
setting = '$custom_structure' WHERE option_name = 'link_format'";
$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'].' !');
}
}
$sql = "UPDATE " .PREF_TBL." SET
setting = '$sef_method' WHERE option_name = 'sef_method'";
$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['Permalink']."</a>",
));
$pref_data = pref_data();
}
if ($pref_data['sef_method'] != "yes" ) {
$template->assign_vars(array(
'SEFXSEF' => " checked=\"checked\"",
));
} else {
$template->assign_vars(array(
'SEFSEF' => " checked=\"checked\"",
));
}
if ($pref_data['link_format'] == "custom" ) {
$template->assign_vars(array(
'CCUSTOM' => " checked=\"checked\"",
));
}
$template->set_filenames(array( 'linkadmin' => 'admin/linkadmin.tpl' ));
$template->assign_vars(array(
'L_SETTINGS' => $lang['Manage_Permalink'],
'L_SUBMIT' => $lang['Submit'],
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_DESCRIPTION' => $lang['S_Description'],
'S_PERMALINK' => $lang['Permalink'],
'S_INSTRUCTIONS' => $lang['S_Instructions'],
'S_SEF_METHOD' => $lang['S_Sef_Method'],
'S_SEF_STRUCTURE' => $lang['S_Sef_Structure'],
'S_SEF_EXPLAIN' => $lang['S_Sef_Explain'],
'D_CUSTOM' => $pref_data['link_format'],
'SEFS1' => "index.php/{READ}/{YYYY}/{MM}/{DD}/{TITLE}",
'SEFS2' => "index.php/{READ}/{POST_ID}",
'SEFS3' => "index.php/{READ}/{TITLE}",
'CUSTOM' => $lang['Custom'],
'SET_CONF' => $lang['S_Confirmation'],
));
$template->pparse('linkadmin');
unset($pref_data);
}
?>