sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Content'"));
$row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
$admins = explode(",", $row['admins']);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($row2['name'] == "$admins[$i]" AND $row['admins'] != "") {
$auth_user = 1;
}
}
if ($row2['radminsuper'] == 1 || $auth_user == 1) {
/*********************************************************/
/* Sections Manager Functions */
/*********************************************************/
@require_once("includes/nbbcode.php");
function contentpreview($subtitle, $page_header ,$text, $page_footer="") {
$text = decode_bbcode(set_smilies($text),1);
echo "Sneak Preview: $subtitle $page_header $text $page_footer ";
}
function shownews_edit($text) {
$story_bbtable = bbcode_table("text", "postnews", 1);
echo ""._STORYTEXT." $story_bbtable"
." ";
}
function content() {
global $prefix, $db, $language, $multilingual, $bgcolor2, $admin_file;
@include("header.php");
GraphicAdmin();
title(""._CONTENTMANAGER."");
OpenTable();
echo "
"
.""._TITLE." "._CURRENTSTATUS." "._CATEGORY." "._FUNCTIONS." ";
$result = $db->sql_query("select * from ".$prefix."_pages order by pid");
while($mypages = $db->sql_fetchrow($result)) {
if ($mypages[cid] == "0" OR $mypages[cid] == "") {
$cat_title = _NONE;
} else {
$mypages[cid] = intval($mypages[cid]);
$res = $db->sql_query("select title from ".$prefix."_pages_categories where cid='$mypages[cid]'");
list($cat_title) = $db->sql_fetchrow($res);
}
if ($mypages[active] == 1) {
$status = _ACTIVE;
$status_chng = _DEACTIVATE;
$active = 1;
} else {
$status = ""._INACTIVE." ";
$status_chng = _ACTIVATE;
$active = 0;
}
echo "$mypages[title] $status $cat_title [ "._EDIT." | $status_chng | "._DELETE." ] ";
}
echo "
";
CloseTable();
echo " ";
OpenTable();
echo ""._ADDCATEGORY." "
."";
CloseTable();
$rescat = $db->sql_query("select cid, title from ".$prefix."_pages_categories order by title");
if ($db->sql_numrows($rescat) > 0) {
echo " ";
OpenTable();
echo ""._EDITCATEGORY." "
.""
.""._CATEGORY.": "
."";
while (list($cid, $cat_title) = $db->sql_fetchrow($rescat)) {
echo "$cat_title ";
}
echo " "
." "
." "
." ";
CloseTable();
}
echo " ";
OpenTable();
$res = $db->sql_query("select cid, title from ".$prefix."_pages_categories order by title");
echo ""._ADDANEWPAGE." "
.""
.""._TITLE.": "
." ";
if ($db->sql_numrows($res) > 0) {
echo ""._CATEGORY.": "
.""
.""._NONE." ";
while(list($cid, $cat_title) = $db->sql_fetchrow($res)) {
echo "$cat_title ";
}
echo " ";
} else {
echo " ";
}
echo ""._CSUBTITLE.": "
." "
.""._HEADERTEXT.": "
." "
.""._PAGETEXT.": "
.""._PAGEBREAK." ";
shownews_edit($text);
echo ""._FOOTERTEXT.": "
." "
.""._SIGNATURE.": "
." ";
if ($multilingual == 1) {
echo ""._LANGUAGE.": "
."";
$handle=opendir('language');
while ($file = readdir($handle)) {
if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
$langFound = $matches[1];
$languageslist .= "$langFound ";
}
}
closedir($handle);
$languageslist = explode(" ", $languageslist);
sort($languageslist);
for ($i=0; $i < sizeof($languageslist); $i++) {
if($languageslist[$i]!="") {
echo "".ucfirst($languageslist[$i])." \n";
}
}
echo " ";
} else {
echo " ";
}
// contentpreview($subtitle, $page_header, $text, $page_footer);
echo ""._ACTIVATEPAGE." "
." "._YES."  "._NO." "
." "
." "
." ";
CloseTable();
@include("footer.php");
}
function add_category($cat_title, $description) {
global $prefix, $db, $admin_file;
$db->sql_query("insert into ".$prefix."_pages_categories values (NULL, '$cat_title', '$description')");
Header("Location: ".$admin_file.".php?op=content");
}
function edit_category($cid) {
global $prefix, $db, $admin_file;
@include("header.php");
GraphicAdmin();
title(""._CONTENTMANAGER."");
OpenTable();
$cid = intval($cid);
$result = $db->sql_query("select title, description from ".$prefix."_pages_categories where cid='$cid'");
list($title, $description) = $db->sql_fetchrow($result);
echo ""._EDITCATEGORY." "
.""
.""._TITLE." "
." "
.""._DESCRIPTION." : "
."$description "
." "
." "
." "
."[ "._DELETE." ]"
." ";
CloseTable();
@include("footer.php");
}
function save_category($cid, $cat_title, $description) {
global $prefix, $db, $admin_file;
$cid = intval($cid);
$db->sql_query("update ".$prefix."_pages_categories set title='$cat_title', description='$description' where cid='$cid'");
Header("Location: ".$admin_file.".php?op=content");
}
function del_content_cat($cid, $ok=0) {
global $prefix, $db, $admin_file;
if ($ok==1) {
$cid = intval($cid);
$db->sql_query("delete from ".$prefix."_pages_categories where cid='$cid'");
$result = $db->sql_query("select pid from ".$prefix."_pages where cid='$cid'");
while (list($pid) = $db->sql_fetchrow($result)) {
$pid = intval($pid);
$db->sql_query("update ".$prefix."_pages set cid='0' where pid='$pid'");
}
Header("Location: ".$admin_file.".php?op=content");
} else {
@include("header.php");
GraphicAdmin();
title(""._CONTENTMANAGER."");
$cid = intval($cid);
$result = $db->sql_query("select title from ".$prefix."_pages_categories where cid='$cid'");
list($title) = $db->sql_fetchrow($result);
OpenTable();
//@RJR-Pwmg@Rncvkpwo@-@Eqratkijv@(e)@VgejIHZ.eqo
echo ""._DELCATEGORY.": $title "
.""._DELCONTENTCAT." "
."[ "._NO." | "._YES." ] ";
CloseTable();
@include("footer.php");
}
}
function content_edit($pid) {
global $prefix, $db, $language, $multilingual, $bgcolor2, $admin_file;
@include("header.php");
GraphicAdmin();
title(""._CONTENTMANAGER."");
$pid = intval($pid);
$result = $db->sql_query("select pid,cid,title,subtitle,active,page_header,text,page_footer,signature,date,counter,clanguage from ".$prefix."_pages WHERE pid='$pid'");
$mypages = list($pid ,$cid,$title,$subtitle,$active,$page_header,$text,$page_footer,$signature,$date,$counter,$clanguage) = $db->sql_fetchrow($result); if ($active == 1) {
$sel1 = "checked";
$sel2 = "";
} else {
$sel1 = "";
$sel2 = "checked";
}
OpenTable();
echo ""._EDITPAGECONTENT." "
.""
.""._TITLE.": "
." ";
$res = $db->sql_query("select cid, title from ".$prefix."_pages_categories");
if ($db->sql_numrows($res) > 0) {
echo ""._CATEGORY.": "
."";
if ($mypages[cid] == 0) {
$sel = "selected";
} else {
$sel = "";
}
echo ""._NONE." ";
while(list($cid, $cat_title) = $db->sql_fetchrow($res)) {
if ($mypages[cid] == $cid) {
$sel = "selected";
} else {
$sel = "";
}
echo "$cat_title ";
}
echo " ";
} else {
echo " ";
}
echo ""._CSUBTITLE.": "
." "
.""._HEADERTEXT.": "
."$page_header "
.""._PAGETEXT.": "
.""._PAGEBREAK." ";
shownews_edit($text);
echo ""._FOOTERTEXT.": "
."$page_footer "
.""._SIGNATURE.": "
."$signature ";
if ($multilingual == 1) {
echo ""._LANGUAGE.": "
."";
$handle=opendir('language');
while ($file = readdir($handle)) {
if (preg_match("/^lang\-(.+)\.php/", $file, $matches)) {
$langFound = $matches[1];
$languageslist .= "$langFound ";
}
}
closedir($handle);
$languageslist = explode(" ", $languageslist);
sort($languageslist);
for ($i=0; $i < sizeof($languageslist); $i++) {
if($languageslist[$i]!="") {
echo "".ucfirst($languageslist[$i])." \n";
}
}
echo " ";
} else {
echo " ";
}
contentpreview($subtitle, $page_header, $text, $page_footer);
echo ""._ACTIVATEPAGE." "
." "._YES."  "._NO." "
." "
." "
." "
." ";
CloseTable();
@include("footer.php");
}
function content_save($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid) {
global $prefix, $db, $admin_file;
$text = stripslashes(FixQuotes($text));
$title = stripslashes(FixQuotes($title));
$subtitle = stripslashes(FixQuotes($subtitle));
$db->sql_query("insert into ".$prefix."_pages values (NULL, '$cid', '$title', '$subtitle', '$active', '$page_header', '$text', '$page_footer', '$signature', now(), '0', '$clanguage')");
Header("Location: ".$admin_file.".php?op=content");
}
function content_save_edit($pid, $title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid) {
global $prefix, $db, $admin_file;
$text = stripslashes(FixQuotes($text));
$title = stripslashes(FixQuotes($title));
$subtitle = stripslashes(FixQuotes($subtitle));
$pid = intval($pid);
$db->sql_query("update ".$prefix."_pages set cid='$cid', title='$title', subtitle='$subtitle', active='$active', page_header='$page_header', text='$text', page_footer='$page_footer', signature='$signature', clanguage='$clanguage' where pid='$pid'");
Header("Location: ".$admin_file.".php?op=content");
}
function content_change_status($pid, $active) {
global $prefix, $db, $admin_file;
if ($active == 1) {
$new_active = 0;
} elseif ($active == 0) {
$new_active = 1;
}
$pid = intval($pid);
$db->sql_query("update ".$prefix."_pages set active='$new_active' WHERE pid='$pid'");
Header("Location: ".$admin_file.".php?op=content");
}
function content_delete($pid, $ok=0) {
global $prefix, $db, $admin_file;
$pid = intval($pid);
if ($ok==1) {
$db->sql_query("delete from ".$prefix."_pages where pid='$pid'");
Header("Location: ".$admin_file.".php?op=content");
} else {
@include("header.php");
GraphicAdmin();
title(""._CONTENTMANAGER."");
$result = $db->sql_query("select title from ".$prefix."_pages where pid='$pid'");
list($title) = $db->sql_fetchrow($result);
OpenTable();
echo ""._DELCONTENT.": $title "
.""._DELCONTWARNING." $title? "
."[ "._NO." | "._YES." ] ";
CloseTable();
@include("footer.php");
}
}
switch ($op) {
case "content":
content();
break;
case "content_edit":
content_edit($pid);
break;
case "content_delete":
content_delete($pid, $ok);
break;
case "content_review":
content_review($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active);
break;
case "content_save":
content_save($title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid);
break;
case "content_save_edit":
content_save_edit($pid, $title, $subtitle, $page_header, $text, $page_footer, $signature, $clanguage, $active, $cid);
break;
case "content_change_status":
content_change_status($pid, $active);
break;
case "add_category":
add_category($cat_title, $description);
break;
case "edit_category":
edit_category($cid);
break;
case "save_category":
save_category($cid, $cat_title, $description);
break;
case "del_content_cat":
del_content_cat($cid, $ok);
break;
}
} else {
@include("header.php");
GraphicAdmin();
OpenTable();
echo ""._ERROR." You do not have administration permission for module \"$module_name\" ";
CloseTable();
@include("footer.php");
}
?>