Trubador

|
Posted:
Sat Jul 01, 2006 8:04 am |
|
I've installed Ravens 7.6 2.02.02 Distro. You do not need to login as the weblinks module is accessable to all.
http://www.yrfkids.com/modules.php?name=Web_Links&l_op=viewlink&cid=2
You will notice that "Alateen" is the first link in there and has now got an editorial link.
Editorials for links can be added to any weblink via ACP - "Modify a Link". this is the only way an editorial can be added. You can not add an editorial through ACP - "Add a New Link". It has to be done when you Modify one.
My other site uses RP Web_Links but has the same problem and the same code to produce and view the Editorial, so if the Basic module can be fixed I'll also be able to fix the other
I've found two functions in modules/weblinks/index.php
The first for displaying the current editorial
Quote: |
function viewlinkeditorial($lid, $ttitle) {
global $prefix, $db, $admin, $module_name;
include("header.php");
include("modules/$module_name/l_config.php");
menu(1);
$lid = intval(trim($lid));
$result = $db->sql_query("SELECT adminid, editorialtimestamp, editorialtext, editorialtitle FROM ".$prefix."_links_editorials WHERE linkid = '$lid'");
$recordexist = $db->sql_numrows($result);
$ttitle = htmlentities($ttitle);
$transfertitle = ereg_replace ("_", " ", $ttitle);
$displaytitle = $transfertitle;
echo "<br>";
OpenTable();
echo "<center><font class=\"option\"><b>"._LINKPROFILE.": ".htmlentities($displaytitle)."</b></font><br>";
linkinfomenu($lid, $ttitle);
if ($recordexist != 0) {
while($row = $db->sql_fetchrow($result)) {
$adminid = intval($row['adminid']);
$editorialtimestamp = $row['editorialtimestamp'];
$editorialtext = stripslashes($row['editorialtext']);
$editorialtitle = stripslashes(check_html($row['editorialtitle'], "nohtml"));
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 "<br><br>";
OpenTable2();
echo "<center><font class=\"option\"><b>'$editorialtitle'</b></font></center>"
."<center><font class=\"tiny\">"._EDITORIALBY." $adminid - $formatted_date</font></center><br><br>"
."$editorialtext";
CloseTable2();
}
} else {
echo "<br><br><center><font class=\"option\"><b>"._NOEDITORIAL."</b></font></center>";
}
echo "<br><br><center>";
linkfooter($lid,$ttitle);
echo "</center>";
CloseTable();
include("footer.php");
} |
Which is fine as it is displaying the data given in ACP as $adminid from _links_editorials
The weblinks/admin/index.php has this code to enter the admin id.
Quote: | function LinksModLink($lid) {
global $prefix, $db, $admin_file, $bgcolor1, $bgcolor2;
include("header.php");
GraphicAdmin();
global $anonymous;
$lid = intval($lid);
$result = $db->sql_query("SELECT cid, 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']);
$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\"> [ <a href=\"$url\">Visit</a> ]<br>"
."" . _DESCRIPTION . ":<br><textarea name=\"description\" cols=\"60\" rows=\"10\">$description</textarea><br>"
."" . _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\"><br>"
."" . _HITS . ": <input type=\"text\" name=\"hits\" value=\"$hits\" size=\"12\" maxlength=\"11\"><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(); |
and the second for updating the database with the new/modified editorial.
Quote: | function LinksAddEditorial($linkid, $editorialtitle, $editorialtext) {
global $aid, $prefix, $db, $admin_file;
$editorialtext = stripslashes(FixQuotes($editorialtext));
$db->sql_query("insert into " . $prefix . "_links_editorials values ('$linkid', '$aid', now(), '$editorialtext', '$editorialtitle')");
include("header.php");
GraphicAdmin();
OpenTable();
echo "<center><br>"
."<font class=option>"
."" . _EDITORIALADDED . "<br><br>"
."[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]<br><br>";
echo "$linkid $adminid, $editorialtitle, $editorialtext";
CloseTable();
include("footer.php");
}
function LinksModEditorial($linkid, $editorialtitle, $editorialtext) {
global $prefix, $db, $admin_file;
$linkid = intval($linkid);
$editorialtext = stripslashes(FixQuotes($editorialtext));
$db->sql_query("update " . $prefix . "_links_editorials set editorialtext='$editorialtext', editorialtitle='$editorialtitle' where linkid='$linkid'");
include("header.php");
GraphicAdmin();
OpenTable();
echo "<br><center>"
."<font class=\"option\">"
."" . _EDITORIALMODIFIED . "<br><br>"
."[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]<br><br>";
CloseTable();
include("footer.php");
}
function LinksDelEditorial($linkid) {
global $prefix, $db, $admin_file;
$linkid = intval($linkid);
$db->sql_query("delete from " . $prefix . "_links_editorials where linkid='$linkid'");
include("header.php");
GraphicAdmin();
OpenTable();
echo "<br><center>"
."<font class=\"option\">"
."" . _EDITORIALREMOVED . "<br><br>"
."[ <a href=\"".$admin_file.".php?op=Links\">" . _WEBLINKSADMIN . "</a> ]<br><br>";
CloseTable();
include("footer.php");
} |
Im just really unsure on where to edit the second function to update $adminid and whether this will show ID number or Admin Username.
Your help much apprieciated as my sql knowledge is poor.
Trub
P.s. This also applies to Nuke 7.4 as well. Looks like a common error that none have noticed  |
|
|