irandoct
Hangin' Around

Joined: Dec 01, 2003
Posts: 39
|
Posted:
Sat Dec 25, 2004 1:31 am |
|
I have addes multilingual feature to downloads / web_links modules.
My problem is in admin area. when i try to creat sub category or a new link in the language selection list i see Arreyenglish instead of english !
What's the reason .
this is mt web_links admin/index file :
[code:1:754f88241e]<?php
/************************************************************************/
/* PHP-NUKE: Web Portal System */
/* =========================== */
/* */
/* Copyright (c) 2002 by Francisco Burzi */
/* http://phpnuke.org */
/* */
/* Based on Journey Links Hack */
/* Copyright (c) 2000 by James Knickelbein */
/* Journey Milwaukee (http://www.journeymilwaukee.com) */
/* */
/* 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. */
/* */
/************************************************************************/
/* Additional security & Abstraction layer conversion */
/* 2003 chatserv */
/* http://www.nukefixes.com -- http://www.nukeresources.com */
/************************************************************************/
if ( !defined('ADMIN_FILE') )
{
die("Illegal File Access");
}
global $prefix, $db, $admin_file;
if (!stristr($_SERVER['SCRIPT_NAME'], "".$admin_file.".php")) { die ("Access Denied"); }
$aid = substr("$aid", 0,25);
$row = $db->sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Web_Links'"));
$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) {
/*********************************************************/
/* Links Modified Web Links */
/*********************************************************/
function getparent($parentid,$title) {
global $prefix,$db, $language, $multilingual, $currentlang;
if ($multilingual == 1) {
$querylang = "(clanguage='$currentlang' OR clanguage='')";
}
$parentid = intval($parentid);
$row = $db->sql_fetchrow($db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories where cid='$parentid' AND $querylang"));
$cid = intval($row['cid']);
$ptitle = $row['title'];
$pparentid = intval($row['parentid']);
$db->sql_freeresult($result);
if ($ptitle!="") $title=$ptitle."/".$title;
if ($pparentid!=0) {
$title=getparent($pparentid,$title);
}
return $title;
}
function links() {
global $prefix, $db, $admin_file, $language, $multilingual, $currentlang, $fdir;
if ($multilingual == 1) {
$querylang = "WHERE clanguage='$currentlang' OR clanguage=''";
}
include ("header.php");
GraphicAdmin();
OpenTable();
$ThemeSel = get_theme();
if (file_exists("themes/$ThemeSel/images/link-logo.gif")) {
echo "<center><a href=\"links.html\"><img src=\"themes/$ThemeSel/images/link-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
} else {
echo "<center><a href=\"links.html\"><img src=\"modules/Web_Links/images/link-logo.gif\" border=\"0\" alt=\"\"></a><br><br>";
}
$result = $db->sql_query("SELECT * from " . $prefix . "_links_links");
$numrows = $db->sql_numrows($result);
echo "<font class=\"content\">" . _THEREARE . " <b>$numrows</b> " . _LINKSINDB . "</font></center>";
CloseTable();
echo "<br>";
/* Temporarily 'homeless' links functions (to be revised in admin.php breakup) */
$result2 = $db->sql_query("SELECT requestid,lid,cid,title,url,description,modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='1'");
$totalbrokenlinks = $db->sql_numrows($result2);
$result3 = $db->sql_query("SELECT requestid,lid,cid,title,url,description,modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='0'");
$totalmodrequests = $db->sql_numrows($result3);
OpenTable();
echo "<center><font class=\"content\">[ <a href=\"".$admin_file.".php?op=LinksCleanVotes\">" . _CLEANLINKSDB . "</a> | "
."<a href=\"".$admin_file.".php?op=LinksListBrokenLinks\">" . _BROKENLINKSREP . " ($totalbrokenlinks)</a> | "
."<a href=\"".$admin_file.".php?op=LinksListModRequests\">" . _LINKMODREQUEST . " ($totalmodrequests)</a> | "
."<a href=\"".$admin_file.".php?op=LinksLinkCheck\">" . _VALIDATELINKS . "</a> ]</font></center>";
CloseTable();
echo "<br>";
/* List Links waiting for validation */
$result4 = $db->sql_query("SELECT lid, cid, sid, llanguage, title, url, description, name, email, submitter from " . $prefix . "_links_newlink order by lid");
$numrows = $db->sql_numrows($result4);
if ($numrows>0) {
OpenTable();
echo "<center><font class=\"option\"><b>" . _LINKSWAITINGVAL . "</b></font></center><br><br>";
while($row4 = $db->sql_fetchrow($result4)) {
$lid = intval($row4['lid']);
$cid = intval($row4['cid']);
$sid = intval($row4['sid']);
$llanguage = $row4['llanguage'];
$title = stripslashes($row4['title']);
$url = $row4['url'];
$description = stripslashes($row4['description']);
$name = $row4['name'];
$email = $row4['email'];
$submitter = $row4['submitter'];
if ($submitter == "") {
$submitter = _NONE;
}
echo "<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>" . _LINKID . ": $lid</b><br><br>"
."" . _SUBMITTER . ": $submitter<br>"
."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\" dir=\"$fdir\"> [ <a href=\"index.php?url=$url\" target=\"_blank\">" . _VISIT . "</a> ]<br>"
."" . _DESCRIPTION . ": <br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br>";
if ($multilingual == 1) {
echo "<b>"._LANGUAGE."</b>:<br>"
."<select name=\"llanguage\">";
$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 "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$llanguage) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
if ($llanguage != "") {
$sel3 = "";
} else {
$sel3 = "selected";
}
echo "<option value=\"\" $sel3>"._ALL."</option></select><br><br>";
} else {
echo "<input type=\"hidden\" name=\"llanguage\" value=\"\">";
}
echo "" . _NAME . ": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\"> "
."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\" dir=\"$fdir\"><br>";
echo "<input type=\"hidden\" name=\"new\" value=\"1\">";
echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
echo "" . _CATEGORY . ": <select name=\"cat\">";
$result5 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories $querylang order by title");
while ($row5 = $db->sql_fetchrow($result5)) {
$cid2 = intval($row5['cid']);
$ctitle2 = stripslashes($row5['title']);
$parentid2 = intval($row5['parentid']);
if ($cid2==$cid) {
$sel = "selected";
} else {
$sel = "";
}
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
}
echo "<input type=\"hidden\" name=\"submitter\" value=\"$submitter\">";
echo "</select><input type=\"hidden\" name=\"op\" value=\"LinksAddLink\"><input type=\"submit\" value=" . _ADD . "> [ <a href=\"".$admin_file.".php?op=LinksDelNew&lid=$lid\">" . _DELETE . "</a> ]</form><br><hr noshade><br>";
}
CloseTable();
echo "<br>";
} else {
}
/* Add a New Main Category */
OpenTable();
echo "<form method=\"post\" action=\"".$admin_file.".php\">"
."<font class=\"option\"><b>" . _ADDMAINCATEGORY . "</b></font><br><br>"
."" . _NAME . ": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"><br>"
."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\"></textarea><br>";
if ($multilingual == 1) {
echo ""._LANGUAGE.":<br>"
."<select name=\"clanguage\">";
$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 "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$currentlang) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
echo "<option value=\"\">"._ALL."</option></select><br><br>";
} else {
echo "<input type=\"hidden\" name=\"clanguage\" value=\"\">";
}
echo"<input type=\"hidden\" name=\"op\" value=\"LinksAddCat\">"
."<input type=\"submit\" value=\"" . _ADD . "\"><br>"
."</form>";
CloseTable();
echo "<br>";
// Add a New Sub-Category
$result6 = $db->sql_query("SELECT * from " . $prefix . "_links_categories $querylang");
$numrows = $db->sql_numrows($result6);
if ($numrows>0) {
OpenTable();
echo "<form method=\"post\" action=\"".$admin_file.".php\">"
."<font class=\"option\"><b>" . _ADDSUBCATEGORY . "</b></font><br><br>"
."" . _NAME . ": <input type=\"text\" name=\"title\" size=\"30\" maxlength=\"100\"> " . _IN . " ";
$result7 = $db->sql_query("SELECT cid, clanguage, title, parentid from " . $prefix . "_links_categories $querylang order by parentid,title");
echo "<select name=\"cid\">";
while($row7 = $db->sql_fetchrow($result7)) {
$cid2 = intval($row7['cid']);
$ctitle2 = stripslashes($row7['title']);
$parentid2 = intval($row7['parentid']);
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\">$ctitle2</option>";
}
echo "</select><br>"
."" . _DESCRIPTION . ":<br><textarea name=\"cdescription\" cols=\"60\" rows=\"10\"></textarea><br>";
if ($multilingual == 1) {
echo ""._LANGUAGE.":<br>"
."<select name=\"clanguage\">";
$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 "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$currentlang) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
echo "<option value=\"\">"._ALL."</option></select><br><br>";
} else {
echo "<input type=\"hidden\" name=\"clanguage\" value=\"\">";
}
echo "<input type=\"hidden\" name=\"op\" value=\"LinksAddSubCat\">"
."<input type=\"submit\" value=\"" . _ADD . "\"><br>"
."</form>";
CloseTable();
echo "<br>";
} else {
}
// Add a New Link to Database
$result8 = $db->sql_query("SELECT cid, title from " . $prefix . "_links_categories $querylang");
$numrows = $db->sql_numrows($result8);
if ($numrows>0) {
OpenTable();
echo "<form method=\"post\" action=\"".$admin_file.".php\">"
."<font class=\"option\"><b>" . _ADDNEWLINK . "</b></font><br><br>"
."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" size=\"50\" maxlength=\"100\"><br>"
."" . _PAGEURL . ": <input type=\"text\" name=\"url\" size=\"50\" maxlength=\"100\" value=\"http://\" dir=\"$fdir\"><br>";
$result9 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories $querylang order by title");
echo "" . _CATEGORY . ": <select name=\"cat\">";
while($row9 = $db->sql_fetchrow($result9)) {
$cid2 = intval($row9['cid']);
$ctitle2 = stripslashes($row9['title']);
$parentid2 = intval($row9['parentid']);
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\">$ctitle2</option>";
}
echo "</select><br><br><br>"
."" . _DESCRIPTION255 . "<br><textarea name=\"description\" cols=\"60\" rows=\"5\"></textarea><br><br><br>";
if ($multilingual == 1) {
echo ""._LANGUAGE.":<br>"
."<select name=\"llanguage\">";
$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 "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$currentlang) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
echo "<option value=\"\">"._ALL."</option></select><br><br>";
} else {
echo "<input type=\"hidden\" name=\"llanguage\" value=\"\">";
}
echo "" . _NAME . ": <input type=\"text\" name=\"name\" size=\"30\" maxlength=\"60\"><br>"
."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"60\" dir=\"$fdir\"><br><br>"
."<input type=\"hidden\" name=\"op\" value=\"LinksAddLink\">"
."<input type=\"hidden\" name=\"new\" value=\"0\">"
."<input type=\"hidden\" name=\"lid\" value=\"0\">"
."<center><input type=\"submit\" value=\"" . _ADDURL . "\"><br>"
."</form>";
CloseTable();
echo "<br>";
} else {
}
// Modify Category
$result10 = $db->sql_query("SELECT * from " . $prefix . "_links_categories");
$numrows = $db->sql_numrows($result10);
if ($numrows>0) {
OpenTable();
echo "<form method=\"post\" action=\"".$admin_file.".php\">"
."<font class=\"option\"><b>" . _MODCATEGORY . "</b></font><br><br>";
$result11 = $db->sql_query("SELECT cid, clanguage, title, parentid from " . $prefix . "_links_categories $querylang order by title");
echo "" . _CATEGORY . ": <select name=\"cat\">";
while($row11 = $db->sql_fetchrow($result11)) {
$cid2 = intval($row11['cid']);
$clanguage2 = $row11['clanguage'];
$ctitle2 = stripslashes($row11['title']);
$parentid2 = intval($row11['parentid']);
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\">$ctitle2</option>";
}
echo "</select>"
."<input type=\"hidden\" name=\"op\" value=\"LinksModCat\">"
."<input type=\"submit\" value=\"" . _MODIFY . "\">"
."</form>";
CloseTable();
echo "<br>";
} else {
}
// Modify Links
$result12 = $db->sql_query("SELECT * from " . $prefix . "_links_links");
$numrows = $db->sql_numrows($result12);
if ($numrows>0) {
OpenTable();
echo "<form method=\"post\" action=\"".$admin_file.".php\">"
."<font class=\"option\"><b>" . _MODLINK . "</b><br><br>"
."" . _LINKID . ": <input type=\"text\" name=\"lid\" size=\"12\" maxlength=\"11\" dir=\"$fdir\"> "
."<input type=\"hidden\" name=\"op\" value=\"LinksModLink\">"
."<input type=\"submit\" value=\"" . _MODIFY . "\">"
."</form>";
CloseTable();
echo "<br>";
} else {
}
// Transfer Categories
$result13 = $db->sql_query("SELECT * from " . $prefix . "_links_links");
$numrows = $db->sql_numrows($result13);
if ($numrows>0) {
OpenTable();
echo "<form method=\"post\" action=\"".$admin_file.".php\">"
."<font class=\"option\"><b>" . _EZTRANSFERLINKS . "</b></font><br><br>"
."" . _CATEGORY . ": "
."<select name=\"cidfrom\">";
$result14 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by parentid,title");
while($row14 = $db->sql_fetchrow($result14)) {
$cid2 = intval($row14['cid']);
$ctitle2 = stripslashes($row14['title']);
$parentid2 = intval($row14['parentid']);
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\">$ctitle2</option>";
}
echo "</select><br>"
."" . _IN . " " . _CATEGORY . ": ";
$result15 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by parentid,title");
echo "<select name=\"cidto\">";
while($row15 = $db->sql_fetchrow($result15)) {
$cid2 = intval($row15['cid']);
$ctitle2 = stripslashes($row15['title']);
$parentid2 = $row15['parentid'];
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\">$ctitle2</option>";
}
echo "</select><br>"
."<input type=\"hidden\" name=\"op\" value=\"LinksTransfer\">"
."<input type=\"submit\" value=\"" . _EZTRANSFER . "\"><br>"
."</form>";
CloseTable();
echo "<br>";
} else {
}
include ("footer.php");
}
function LinksTransfer($cidfrom,$cidto) {
global $prefix, $db, $admin_file;
// begin old categories
// (uncomment lines to transfer existing datas)
/*
$cat = explode("-", $cidfrom);
if ($cat[1]=="") {
$cat[1] = 0;
}
$db->sql_query("update " . $prefix . "_links_links set cid='$cidto', sid='0' where cid='$cat[0]' AND sid='$cat[1]'");
*/
// end old categories
// begin new categories
// (comment lines to transfer existing datas)
$db->sql_query("update " . $prefix . "_links_links set cid=$cidto where cid='$cidfrom'");
// end new categorie
Header("Location: ".$admin_file.".php?op=Links");
}
function LinksModLink($lid) {
global $prefix, $db, $admin_file, $language, $multilingual, $currentlang, $fdir;
include ("header.php");
GraphicAdmin();
global $anonymous;
$lid = intval($lid);
$result = $db->sql_query("SELECT cid, llanguage, title, url, description, name, email, hits from " . $prefix . "_links_links where lid='$lid'");
OpenTable();
echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>" . _MODLINK . "</b></font></center><br><br>";
while($row = $db->sql_fetchrow($result)) {
$cid = intval($row['cid']);
$llanguage = $row['llanguage'];
$title = stripslashes($row['title']);
$url = $row['url'];
$description = stripslashes($row['description']);
$name = $row['name'];
$email = $row['email'];
$hits = intval($row['hits']);
echo "<form action=".$admin_file.".php method=post>"
."" . _LINKID . ": <b>$lid</b><br>"
."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\" dir=\"$fdir\"> [ <a href=\"$url\">Visit</a> ]<br>"
."" . _DESCRIPTION . ":<br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br>";
if ($multilingual == 1) {
echo ""._LANGUAGE.":<br>"
."<select name=\"llanguage\">";
$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 "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$llanguage) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
if ($llanguage != "") {
$sel3 = "";
} else {
$sel3 = "selected";
}
echo "<option value=\"\" $sel3>"._ALL."</option></select><br><br>";
} else {
echo "<input type=\"hidden\" name=\"llanguage\" value=\"\">";
}
echo "" . _NAME . ": <input type=\"text\" name=\"name\" size=\"50\" maxlength=\"100\" value=\"$name\"><br>"
."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"50\" maxlength=\"100\" value=\"$email\" dir=\"$fdir\"><br>"
."" . _HITS . ": <input type=\"text\" name=\"hits\" value=\"$hits\" size=\"12\" maxlength=\"11\" dir=\"$fdir\"><br>";
echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">"
."" . _CATEGORY . ": <select name=\"cat\">";
$result2 = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
while($row2 = $db->sql_fetchrow($result2)) {
$cid2 = intval($row2['cid']);
$ctitle2 = stripslashes($row2['title']);
$parentid2 = $row2['parentid'];
if ($cid2==$cid) {
$sel = "selected";
} else {
$sel = "";
}
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
}
echo "</select>"
."<input type=\"hidden\" name=\"op\" value=\"LinksModLinkS\">"
."<input type=\"submit\" value=\"" . _MODIFY . "\"> [ <a href=\"".$admin_file.".php?op=LinksDelLink&lid=$lid\">" . _DELETE . "</a> ]</form><br>";
CloseTable();
echo "<br>";
/* Modify or Add Editorial */
$resulted2 = $db->sql_query("SELECT adminid, editorialtimestamp, editorialtext, editorialtitle from " . $prefix . "_links_editorials where linkid='$lid'");
$recordexist = $db->sql_numrows($resulted2);
OpenTable();
/* if returns 'bad query' status 0 (add editorial) */
if ($recordexist == 0) {
echo "<center><font class=\"option\"><b>" . _ADDEDITORIAL . "</b></font></center><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."<input type=\"hidden\" name=\"linkid\" value=\"$lid\">"
."" . _EDITORIALTITLE . ":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
."" . _EDITORIALTEXT . ":<br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\">$editorialtext</textarea><br>"
."</select><input type=\"hidden\" name=\"op\" value=\"LinksAddEditorial\"><input type=\"submit\" value=\"Add\">";
} else {
/* if returns 'cool' then status 1 (modify editorial) */
while($row3 = $db->sql_fetchrow($resulted2)) {
$editorialtimestamp = $row3['editorialtimestamp'];
$editorialtext = stripslashes($row3['editorialtext']);
$editorialtitle = stripslashes($row3['editorialtitle']);
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $editorialtimestamp, $editorialtime);
$editorialtime = strftime("%F",mktime($editorialtime[4],$editorialtime[5],$editorialtime[6],$editorialtime[2],$editorialtime[3],$editorialtime[1]));
$date_array = explode("-", $editorialtime);
$timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]);
$formatted_date = date("F j, Y", $timestamp);
echo "<center><font class=\"option\"><b>Modify Editorial</b></font></center><br><br>"
."<form action=\"".$admin_file.".php\" method=\"post\">"
."" . _AUTHOR . ": $adminid<br>"
."" . _DATEWRITTEN . ": $formatted_date<br><br>"
."<input type=\"hidden\" name=\"linkid\" value=\"$lid\">"
."" . _EDITORIALTITLE . ":<br><input type=\"text\" name=\"editorialtitle\" value=\"$editorialtitle\" size=\"50\" maxlength=\"100\"><br>"
."" . _EDITORIALTEXT . ":<br><textarea name=\"editorialtext\" cols=\"60\" rows=\"10\">$editorialtext</textarea><br>"
."</select><input type=\"hidden\" name=\"op\" value=\"LinksModEditorial\"><input type=\"submit\" value=\"" . _MODIFY . "\"> [ <a href=\"".$admin_file.".php?op=LinksDelEditorial&linkid=$lid\">" . _DELETE . "</a> ]";
}
}
CloseTable();
echo "<br>";
OpenTable();
/* Show Comments */
$result4 = $db->sql_query("SELECT ratingdbid, ratinguser, ratingcomments, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratingcomments != '' ORDER BY ratingtimestamp DESC");
$totalcomments = $db->sql_numrows($result4);
echo "<table valign=top width=100%>";
echo "<tr><td colspan=7><b>Link Comments (total comments: $totalcomments)</b><br><br></td></tr>";
echo "<tr><td width=20 colspan=1><b>User </b></td><td colspan=5><b>Comment </b></td><td><b><center>Delete</center></b></td><br></tr>";
if ($totalcomments == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Comments<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
while($row4 = $db->sql_fetchrow($result4)) {
$ratingdbid = intval($row4['ratingdbid']);
$ratinguser = $row4['ratinguser'];
$ratingcomments = stripslashes($row4['ratingcomments']);
$ratingtimestamp = $row4['ratingtimestamp'];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
$date_array = explode("-", $ratingtime);
$timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]);
$formatted_date = date("F j, Y", $timestamp);
echo "<tr><td valign=top bgcolor=$colorswitch>$ratinguser</td><td valign=top colspan=5 bgcolor=$colorswitch>$ratingcomments</td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelComment&lid=$lid&rid=$ratingdbid>X</a></b></center></td><br></tr>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
}
// Show Registered Users Votes
$result5 = $db->sql_query("SELECT ratingdbid, ratinguser, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratinguser != 'outside' AND ratinguser != '$anonymous' ORDER BY ratingtimestamp DESC");
$totalvotes = $db->sql_numrows($result5);
echo "<tr><td colspan=7><br><br><b>Registered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
echo "<tr><td><b>User </b></td><td><b>IP Address </b></td><td><b>Rating </b></td><td><b>User AVG Rating </b></td><td><b>Total Ratings </b></td><td><b>Date </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Registered User Votes<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
while($row5 = $db->sql_fetchrow($result5)) {
$ratingdbid = intval($row5['ratingdbid']);
$ratinguser = $row5['ratinguser'];
$rating = intval($row5['rating']);
$ratinghostname = $row5['ratinghostname'];
$ratingtimestamp = $row5['ratingtimestamp'];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
$date_array = explode("-", $ratingtime);
$timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]);
$formatted_date = date("F j, Y", $timestamp);
//Individual user information
$result6 = $db->sql_query("SELECT rating FROM " . $prefix . "_links_votedata WHERE ratinguser = '$ratinguser'");
$usertotalcomments = $db->sql_numrows($result6);
$useravgrating = 0;
while($row6 = $db->sql_fetchrow($result6)) $useravgrating = $useravgrating + $rating2;
$useravgrating = $useravgrating / $usertotalcomments;
$useravgrating = number_format($useravgrating, 1);
echo "<tr><td bgcolor=$colorswitch>$ratinguser</td><td bgcolor=$colorswitch>$ratinghostname</td><td bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$useravgrating</td><td bgcolor=$colorswitch>$usertotalcomments</td><td bgcolor=$colorswitch>$formatted_date </font></b></td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
}
// Show Unregistered Users Votes
$result7 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratinguser = '$anonymous' ORDER BY ratingtimestamp DESC");
$totalvotes = $db->sql_numrows($result7);
echo "<tr><td colspan=7><b><br><br>Unregistered User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
echo "<tr><td colspan=2><b>IP Address </b></td><td colspan=3><b>Rating </b></td><td><b>Date </b></font></td><td><b><center>Delete</center></b></td><br></tr>";
if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Unregistered User Votes<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
while($row7 = $db->sql_fetchrow($result7)) {
$ratingdbid = intval($row7['ratingdbid']);
$rating = intval($row7['rating']);
$ratinghostname = $row7['ratinghostname'];
$ratingtimestamp = $row7['ratingtimestamp'];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
$date_array = explode("-", $ratingtime);
$timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]);
$formatted_date = date("F j, Y", $timestamp);
echo "<td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date </font></b></td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
}
// Show Outside Users Votes
$result8 = $db->sql_query("SELECT ratingdbid, rating, ratinghostname, ratingtimestamp FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid' AND ratinguser = 'outside' ORDER BY ratingtimestamp DESC");
$totalvotes = $db->sql_numrows($result8);
echo "<tr><td colspan=7><b><br><br>Outside User Votes (total votes: $totalvotes)</b><br><br></td></tr>";
echo "<tr><td colspan=2><b>IP Address </b></td><td colspan=3><b>Rating </b></td><td><b>Date </b></td></font></b><td><b><center>Delete</center></b></td><br></tr>";
if ($totalvotes == 0) echo "<tr><td colspan=7><center><font color=cccccc>No Votes from Outside $sitename<br></font></center></td></tr>";
$x=0;
$colorswitch="dddddd";
while($row8 = $db->sql_fetchrow($result8)) {
$ratingdbid = intval($row8['ratingdbid']);
$rating = intval($row8['rating']);
$ratinghostname = $row8['ratinghostname'];
$ratingtimestamp = $row8['ratingtimestamp'];
ereg ("([0-9]{4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})", $ratingtimestamp, $ratingtime);
$ratingtime = strftime("%F",mktime($ratingtime[4],$ratingtime[5],$ratingtime[6],$ratingtime[2],$ratingtime[3],$ratingtime[1]));
$date_array = explode("-", $ratingtime);
$timestamp = mktime(0, 0, 0, $date_array["1"], $date_array["2"], $date_array["0"]);
$formatted_date = date("F j, Y", $timestamp);
echo "<tr><td colspan=2 bgcolor=$colorswitch>$ratinghostname</td><td colspan=3 bgcolor=$colorswitch>$rating</td><td bgcolor=$colorswitch>$formatted_date </font></b></td><td bgcolor=$colorswitch><center><b><a href=".$admin_file.".php?op=LinksDelVote&lid=$lid&rid=$ratingdbid>X</a></b></center></td></tr><br>";
$x++;
if ($colorswitch=="dddddd") $colorswitch="ffffff";
else $colorswitch="dddddd";
}
echo "<tr><td colspan=6><br></td></tr>";
echo "</table>";
}
echo "</form>";
CloseTable();
echo "<br>";
include ("footer.php");
}
function LinksDelComment($lid, $rid) {
global $prefix, $db, $admin_file;
$rid = intval($rid);
$lid = intval($lid);
$db->sql_query("UPDATE " . $prefix . "_links_votedata SET ratingcomments='' WHERE ratingdbid = '$rid'");
$db->sql_query("UPDATE " . $prefix . "_links_links SET totalcomments = (totalcomments - 1) WHERE lid = '$lid'");
Header("Location: ".$admin_file.".php?op=LinksModLink&lid=$lid");
}
function LinksDelVote($lid, $rid) {
global $prefix, $db, $admin_file;
$rid = intval($rid);
$lid = intval($lid);
$db->sql_query("delete from " . $prefix . "_links_votedata where ratingdbid=$rid");
$voteresult = $db->sql_query("SELECT rating, ratinguser, ratingcomments FROM " . $prefix . "_links_votedata WHERE ratinglid = '$lid'");
$totalvotesDB = $db->sql_numrows($voteresult);
include ("voteinclude.php");
$db->sql_query("UPDATE " . $prefix . "_links_links SET linkratingsummary='$finalrating', totalvotes='$totalvotesDB', totalcomments='$truecomments' WHERE lid = '$lid'");
Header("Location: ".$admin_file.".php?op=LinksModLink&lid=$lid");
}
function LinksEditBrokenLinks($lid) {
global $prefix, $db, $admin_file, $language, $multilingual, $currentlang, $fdir;
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"option\"><b>" . _EZBROKENLINKS . "</b></font></center><br><br>";
$row = $db->sql_fetchrow($db->sql_query("SELECT requestid, lid, cid, llanguage, title, url, description, modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='1' order by requestid"));
$requestid = intval($row['requestid']);
$lid = intval($row['lid']);
$cid = intval($row['cid']);
$llanguage = $row['llanguage'];
$title = stripslashes($row['title']);
$url = $row['url'];
$description = stripslashes($row['description']);
$modifysubmitter = $row['modifysubmitter'];
$row2 = $db->sql_fetchrow($db->sql_query("SELECT name,email,hits from " . $prefix . "_links_links where lid='$lid'"));
$name = $row2['name'];
$email = $row2['email'];
$hits = intval($row2['hits']);
echo "<form action=\"".$admin_file.".php\" method=\"post\">"
."<b>" . _LINKID . ": $lid</b><br><br>"
."" . _SUBMITTER . ": $modifysubmitter<br>"
."" . _PAGETITLE . ": <input type=\"text\" name=\"title\" value=\"$title\" size=\"50\" maxlength=\"100\"><br>"
."" . _PAGEURL . ": <input type=\"text\" name=\"url\" value=\"$url\" size=\"50\" maxlength=\"100\" dir=\"$fdir\"> [ <a href=\"index.php?url=$url\" target=\"_blank\">" . _VISIT . "</a> ]<br>"
."" . _DESCRIPTION . ": <br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br>";
if ($multilingual == 1) {
echo ""._LANGUAGE.":<br>"
."<select name=\"llanguage\">";
$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 "<option value=\"$languageslist[$i]\" ";
if($languageslist[$i]==$llanguage) echo "selected";
echo ">".ucfirst($languageslist[$i])."</option>\n";
}
}
if ($llanguage != "") {
$sel3 = "";
} else {
$sel3 = "selected";
}
echo "<option value=\"\" $sel3>"._ALL."</option></select><br><br>";
} else {
echo "<input type=\"hidden\" name=\"llanguage\" value=\"\">";
}
echo "" . _NAME . ": <input type=\"text\" name=\"name\" size=\"20\" maxlength=\"100\" value=\"$name\"> "
."" . _EMAIL . ": <input type=\"text\" name=\"email\" size=\"20\" maxlength=\"100\" value=\"$email\" dir=\"$fdir\"><br>";
echo "<input type=\"hidden\" name=\"lid\" value=\"$lid\">";
echo "<input type=\"hidden\" name=\"hits\" value=\"$hits\">";
echo "" . _CATEGORY . ": <select name=\"cat\">";
$result = $db->sql_query("SELECT cid, title, parentid from " . $prefix . "_links_categories order by title");
while ($row = $db->sql_fetchrow($result)) {
$cid2 = intval($row['cid']);
$ctitle2 = $row['title'];
$parentid2 = intval($row['parentid']);
if ($cid2==$cid) {
$sel = "selected";
} else {
$sel = "";
}
if ($parentid2!=0) $ctitle2=getparent($parentid2,$ctitle2);
echo "<option value=\"$cid2\" $sel>$ctitle2</option>";
}
echo "</select><input type=\"hidden\" name=\"op\" value=\"LinksModLinkS\"><input type=\"submit\" value=" . _MODIFY . "> [ <a href=\"".$admin_file.".php?op=LinksDelNew&lid=$lid\">" . _DELETE . "</a> ]</form><br><hr noshade><br>";
CloseTable();
echo "<br>";
include("footer.php");
}
function LinksListBrokenLinks() {
global $bgcolor1, $bgcolor2, $prefix, $db, $user_prefix, $admin_file;
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
$result = $db->sql_query("SELECT requestid, lid, modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='1' order by requestid");
$totalbrokenlinks = $db->sql_numrows($result);
echo "<center><font class=\"option\"><b>" . _USERREPBROKEN . " ($totalbrokenlinks)</b></font></center><br><br><center>"
."" . _IGNOREINFO . "<br>"
."" . _DELETEINFO . "</center><br><br><br>"
."<table align=\"center\" width=\"450\">";
if ($totalbrokenlinks==0) {
echo "<center><font class=\"option\">" . _NOREPORTEDBROKEN . "</font></center><br><br><br>";
} else {
$colorswitch = $bgcolor2;
echo "<tr>"
."<td><b>" . _LINK . "</b></td>"
."<td><b>" . _SUBMITTER . "</b></td>"
."<td><b>" . _LINKOWNER . "</b></td>"
."<td><b>" . _EDIT . "</b></td>"
."<td><b>" . _IGNORE . "</b></td>"
."<td><b>" . _DELETE . "</b></td>"
."</tr>";
while($row = $db->sql_fetchrow($result)) {
$requestid = intval($row['requestid']);
$lid = intval($row['lid']);
$modifysubmitter = $row['modifysubmitter'];
$result2 = $db->sql_query("SELECT title, url, submitter from " . $prefix . "_links_links where lid='$lid'");
if ($modifysubmitter != '$anonymous') {
$row3 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$modifysubmitter'"));
$email = stripslashes($row3['user_email']);
}
$row2 = $db->sql_fetchrow($result2);
$title = stripslashes($row2['title']);
$url = $row2['url'];
$owner = $row2['submitter'];
$row4 = $db->sql_fetchrow($db->sql_query("SELECT user_email from " . $user_prefix . "_users where username='$owner'"));
$owneremail = stripslashes($row4['user_email']);
echo "<tr>"
."<td bgcolor=\"$colorswitch\"><a href=\"index.php?url=$url\">$title</a>"
."</td>";
if ($email=='') {
echo "<td bgcolor=\"$colorswitch\">$modifysubmitter";
} else {
echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$email\">$modifysubmitter</a>";
}
echo "</td>";
if ($owneremail=='') {
echo "<td bgcolor=\"$colorswitch\">$owner";
} else {
echo "<td bgcolor=\"$colorswitch\"><a href=\"mailto:$owneremail\">$owner</a>";
}
echo "</td>"
."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=LinksEditBrokenLinks&lid=$lid\">X</a></center>"
."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=LinksIgnoreBrokenLinks&lid=$lid\">X</a></center>"
."</td>"
."<td bgcolor=\"$colorswitch\"><center><a href=\"".$admin_file.".php?op=LinksDelBrokenLinks&lid=$lid\">X</a></center>"
."</td>"
."</tr>";
if ($colorswitch == $bgcolor2) {
$colorswitch = $bgcolor1;
} else {
$colorswitch = $bgcolor2;
}
}
}
echo "</table>";
CloseTable();
include ("footer.php");
}
function LinksDelBrokenLinks($lid) {
global $prefix, $db, $admin_file;
$lid = intval($lid);
$db->sql_query("delete from " . $prefix . "_links_modrequest where lid='$lid'");
$db->sql_query("delete from " . $prefix . "_links_links where lid='$lid'");
Header("Location: ".$admin_file.".php?op=LinksListBrokenLinks");
}
function LinksIgnoreBrokenLinks($lid) {
global $prefix, $db, $admin_file;
$db->sql_query("delete from " . $prefix . "_links_modrequest where lid='$lid' and brokenlink='1'");
Header("Location: ".$admin_file.".php?op=LinksListBrokenLinks");
}
function LinksListModRequests() {
global $bgcolor2, $prefix, $db, $user_prefix, $admin_file, $ralign;
include ("header.php");
GraphicAdmin();
OpenTable();
echo "<center><font class=\"title\"><b>" . _WEBLINKSADMIN . "</b></font></center>";
CloseTable();
echo "<br>";
OpenTable();
$result = $db->sql_query("SELECT requestid, lid, cid, sid, title, url, description, modifysubmitter from " . $prefix . "_links_modrequest where brokenlink='0' order by requestid");
$totalmodrequests = $db->sql_numrows($result);
echo "<center><font class=\"option\"><b>" . _USERMODREQUEST . " ($totalmodrequests)</b></font></center><br><br><br>";
echo "<table width=\"95%\"><tr><td>";
while($row = $db->sql_fetchrow($result)) {
$requestid = intval($row['requestid']);
$lid = intval($row['lid']);
$cid = intval($row['cid']);
$sid = intval($row['sid']);
$title = stripslashes($row['title']);
$url = $row['url'];
$description = stripslashes($row['description']);
$xdescription = eregi_re |
|
|