phpslash-commit Mailing List for phpSlash (Page 105)
Brought to you by:
joestewart,
nhruby
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(11) |
Nov
(59) |
Dec
(60) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(52) |
Feb
(77) |
Mar
(118) |
Apr
(76) |
May
(106) |
Jun
(145) |
Jul
(9) |
Aug
(15) |
Sep
(78) |
Oct
(83) |
Nov
(105) |
Dec
(51) |
2003 |
Jan
(105) |
Feb
(100) |
Mar
(111) |
Apr
(149) |
May
(95) |
Jun
(56) |
Jul
(8) |
Aug
(2) |
Sep
|
Oct
(22) |
Nov
(117) |
Dec
(6) |
2004 |
Jan
(1) |
Feb
|
Mar
(3) |
Apr
(25) |
May
|
Jun
(11) |
Jul
(26) |
Aug
(85) |
Sep
(119) |
Oct
(312) |
Nov
(271) |
Dec
(5) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(12) |
May
(7) |
Jun
(8) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2009 |
Jan
(5) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Joe S. <joe...@us...> - 2001-12-17 22:42:40
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv1899/phpslash-ft/class Modified Files: slashPerm.class Author.class Log Message: perms html formatted in authorNew.tpl Index: slashPerm.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/slashPerm.class,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** slashPerm.class 2001/11/07 21:35:34 1.2 --- slashPerm.class 2001/12/17 22:42:37 1.3 *************** *** 54,57 **** --- 54,70 ---- return $ret; } + + /** + * getPerms just returns an array of the Perms list + * + */ + function getPerms() { + reset($this->permissions); + while(list($k, $v) = each($this->permissions)) { + $ret[] .= $k; + } + return $ret; + } + } ?> Index: Author.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Author.class,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Author.class 2001/12/17 18:20:16 1.13 --- Author.class 2001/12/17 22:42:37 1.14 *************** *** 80,84 **** PASSWORD => $this->db->f("password"), COUNT => $count, - PERMSEL => $this->perm->perm_sel("permission[$count]", $this->db->f("perms")), AMP => $this->psl['amp'] )); --- 80,83 ---- *************** *** 242,248 **** titlebar("100%","Add a new Author"); $this->author_templ->set_var(array( ACTION_URL => $this->psl['phpself'], - PERMSEL => $this->perm->perm_sel("permission", $this->db->f("perms")), AUTHOR_ID => "", NAME => "", --- 241,255 ---- titlebar("100%","Add a new Author"); + $this->author_templ->set_block("newauthor","perm_row","perm_rows"); + $this->author_templ->set_block("newauthor","permhave_row","permhave_rows"); + + $allperms_ary = $this->perm->getPerms(); + for( $i=0; $i < count($allperms_ary); $i++) { + $this->author_templ->set_var( PERM, $allperms_ary[$i]); + $this->author_templ->parse("perm_rows","perm_row",true); + } + $this->author_templ->set_var(array( ACTION_URL => $this->psl['phpself'], AUTHOR_ID => "", NAME => "", *************** *** 284,287 **** --- 291,307 ---- $author_id = $this->db->Record[author_id]; + $author_perms = $this->db->Record[perms]; + $this->author_templ->set_block("newauthor","perm_row","perm_rows"); + $this->author_templ->set_block("newauthor","permhave_row","permhave_rows"); + + $allperms_ary = $this->perm->getPerms(); + while(list($k, $v) = each($allperms_ary)) { + $this->author_templ->set_var( PERM, $v); + if ($this->perm->perm_islisted($author_perms,$v)) { + $this->author_templ->parse("perm_rows","permhave_row",true); + } else { + $this->author_templ->parse("perm_rows","perm_row",true); + } + } $this->author_templ->set_var(array( *************** *** 296,300 **** SECLEV => $this->db->f("seclev"), COUNT => $count, - PERMSEL => $this->perm->perm_sel("permission", $this->db->f("perms")), AMP => $this->psl['amp'] )); --- 316,319 ---- |
From: Joe S. <joe...@us...> - 2001-12-17 22:42:39
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv1899/phpslash-ft Modified Files: CHANGES Log Message: perms html formatted in authorNew.tpl Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.352 retrieving revision 1.353 diff -C2 -d -r1.352 -r1.353 *** CHANGES 2001/12/17 18:20:16 1.352 --- CHANGES 2001/12/17 22:42:36 1.353 *************** *** 13,16 **** --- 13,22 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-17 4:40PM CST Joe Stewart <jo...@be...> + [F] - slashPerm.class - new function getPerms just returns and array of + the perms. + [T] - authorNew.tpl, Author.class - all formatting for permissions is in + the template now. + 2001-Dec-17 12:20PM CST Joe Stewart <jo...@be...> [B] - Author.class::deleteAuthor was not checking for stories assigned to |
From: Joe S. <joe...@us...> - 2001-12-17 18:20:19
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv24679/phpslash-ft/class Modified Files: Author.class Log Message: deleteAuthor now checks for stories Index: Author.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Author.class,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Author.class 2001/12/16 21:33:40 1.12 --- Author.class 2001/12/17 18:20:16 1.13 *************** *** 173,183 **** } ! /** * deleteAuthor - deletes the author info to the DB * ! * Given the author_id, it deletes that from the author table. The ! * psl_author_lut and psl_author_submission_lut table must be cleaned ! * first by updating all the stories to point to different authors. It ! * will also check and make sure there are NO stories/submissions * associated with this author before deleting it. Returns true if * author is deleted, false if not. --- 173,181 ---- } ! /** * deleteAuthor - deletes the author info to the DB * ! * Given the author_id, it deletes that from the author table. ! * It will also check and make sure there are NO stories * associated with this author before deleting it. Returns true if * author is deleted, false if not. *************** *** 198,212 **** return false; } ! $q = "DELETE ! FROM psl_author ! WHERE author_id = '$author_id_to_delete'"; $this->db->query($q); ! if ($this->db->affected_rows() > 0) { ! return true; ! } else { return false; ! }; } /** --- 196,232 ---- return false; } + + // prevent deletion of an author with stories + $go_ahead = true; ! $q = "SELECT title, ! story_id ! FROM psl_story ! WHERE user_id = '$author_id_to_delete' "; $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $section_name = $this->db->Record["section_name"]; ! error("$title($story_id)"); ! } ! ! if (!$go_ahead) { return false; ! } else { ! ! $q = "DELETE ! FROM psl_author ! WHERE author_id = '$author_id_to_delete'"; ! $this->db->query($q); ! if ($this->db->affected_rows() > 0) { ! return true; ! } else { ! return false; ! } ! } } + /** |
From: Joe S. <joe...@us...> - 2001-12-17 18:20:19
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv24679/phpslash-ft Modified Files: CHANGES Log Message: deleteAuthor now checks for stories Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.351 retrieving revision 1.352 diff -C2 -d -r1.351 -r1.352 *** CHANGES 2001/12/16 22:56:45 1.351 --- CHANGES 2001/12/17 18:20:16 1.352 *************** *** 13,16 **** --- 13,20 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-17 12:20PM CST Joe Stewart <jo...@be...> + [B] - Author.class::deleteAuthor was not checking for stories assigned to + the author. + 2001-Dec-16 12:00PM MET Lars Heuer <he...@qu...> [T] - article.php3, article-pf.tpl |
From: Lars H. <lh...@us...> - 2001-12-16 22:56:48
|
Update of /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default In directory usw-pr-cvs1:/tmp/cvs-serv4271/phpslash-ft/public_html/templates/en/default Modified Files: article-pf.tpl Log Message: article.php3, article-pf.tpl - Inserted a story link into the template Index: article-pf.tpl =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default/article-pf.tpl,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** article-pf.tpl 2000/10/19 16:23:09 1.2 --- article-pf.tpl 2001/12/16 22:56:45 1.3 *************** *** 29,34 **** </tr> </table> ! <font size="1" color="black" face="arial,helvetica">Copyright ! ©2000 and Licensed under GPL.</font> <!-- END article-pf.tpl --> </body> --- 29,34 ---- </tr> </table> ! <font size="2" color="black" face="Arial, Helvetica, sans-serif"><p>This article comes from {SITENAME}<br />URL: <a href="{STORY_URL}">{STORY_URL}</a></p></font> ! <font size="1" color="black" face="arial,helvetica">{SITENAME} is powered by <a href="http://www.phpslash.org/">phpslash</a> - Copyright © 2001 and Licensed under the <a href="http://www.gnu.org/copyleft/gpl.html">GPL</a> - No warranty is, has, or will be given in any way whatsoever to anyone.</p></font> <!-- END article-pf.tpl --> </body> |
From: Lars H. <lh...@us...> - 2001-12-16 22:56:48
|
Update of /cvsroot/phpslash/phpslash-ft/public_html In directory usw-pr-cvs1:/tmp/cvs-serv4271/phpslash-ft/public_html Modified Files: article.php3 Log Message: article.php3, article-pf.tpl - Inserted a story link into the template Index: article.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/article.php3,v retrieving revision 1.52 retrieving revision 1.53 diff -C2 -d -r1.52 -r1.53 *** article.php3 2001/12/14 22:14:36 1.52 --- article.php3 2001/12/16 22:56:45 1.53 *************** *** 57,60 **** --- 57,62 ---- $t->set_file(article, "article-pf.tpl"); $t->set_var(array( + STORY_URL => "".$_PSL[rooturl].$_PSL[phpself]."?story_id=".$story_id."", + SITENAME => $_PSL[site_name], PAGETITLE => $pagetitle, TITLE => $ttitle, |
From: Lars H. <lh...@us...> - 2001-12-16 22:56:48
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv4271/phpslash-ft Modified Files: CHANGES Log Message: article.php3, article-pf.tpl - Inserted a story link into the template Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.350 retrieving revision 1.351 diff -C2 -d -r1.350 -r1.351 *** CHANGES 2001/12/16 21:33:40 1.350 --- CHANGES 2001/12/16 22:56:45 1.351 *************** *** 13,16 **** --- 13,20 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-16 12:00PM MET Lars Heuer <he...@qu...> + [T] - article.php3, article-pf.tpl + Inserted a Story Link into the template + 2001-Dec-16 10:30PM MET Lars Heuer <he...@qu...> [F] - Author.class |
From: Lars H. <lh...@us...> - 2001-12-16 21:33:42
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv18377/phpslash-ft/class Modified Files: Author.class Log Message: inserted an array in Author::getAuthors which would limit the view to special authors Index: Author.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Author.class,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Author.class 2001/12/14 03:58:18 1.11 --- Author.class 2001/12/16 21:33:40 1.12 *************** *** 1,357 **** ! <?php ! ! /* $Id$ */ ! ! /** ! * Provides an API to the PHPSlash Author Management. ! * ! * This object is how we do anything with authors. ! * ! */ ! class Author { ! var $author_templ, $db, $perm, $psl; ! ! /** ! * The Author Constructor ! * ! * sets up the local version of the global _PSL array, the templates ! * and a few other things ! * @access private ! */ ! ! function Author () { ! ! global $perm, $_PSL; ! ! $this->db = new slashDB; ! $this->perm = $perm; ! $this->psl = $_PSL; ! ! /* Templates */ ! $this->author_templ = new Template($this->psl['templatedir'], "remove"); ! $this->author_templ->debug = 0; ! $this->author_templ->set_file(array( ! listauthor => "authorList.tpl", ! newauthor => "authorNew.tpl" ! )); ! ! $this->author_templ->set_var( array( ! ROOTDIR => $this->psl['rootur'], ! IMAGEDIR => $this->psl['imageurl'] ! )); ! } ! ! /* ! * METHODS ! */ ! ! /** ! * listAuthor - list all Authors ! * ! * displays the complete list of authors ! * Used only by admin ! * @access public ! */ ! function listAuthor() { ! ! $q = "SELECT * ! FROM psl_author ! ORDER BY author_name"; ! $this->db->query($q); ! ! titlebar("100%","Existing Authors"); ! ! $this->author_templ->set_block("listauthor","row","rows"); ! ! $count = 0; ! ! while ($this->db->next_record()) { ! ! $author_id = $this->db->Record[author_id]; ! ! $this->author_templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], ! AUTHOR_ID => $author_id, ! NAME => $this->db->f("author_name"), ! REALNAME => $this->db->f("author_realname"), ! EMAIL => $this->db->f("email"), ! URL => $this->db->f("url"), ! QUOTE => $this->db->f("quote"), ! PASSWORD => $this->db->f("password"), ! COUNT => $count, ! PERMSEL => $this->perm->perm_sel("permission[$count]", $this->db->f("perms")), ! AMP => $this->psl['amp'] ! )); ! $this->author_templ->parse("rows","row",true); ! $count++; ! }; ! $this->author_templ->parse(OUT,array("listauthor")); ! $this->author_templ->p(OUT); ! } ! ! /** ! * saveAuthor - save the author info to the DB ! * ! * Saves the author in the $ary array to the DB ! * Obligatory fields: author_name, image, width, height, alt_text ! * Optional fields: author_id (only if this author is already in the DB), ! * onlinkbar (if blank, defaults to 0) ! * Returns true if sucessful (author added or updated), false on error ! * Used only by admin ! * ! * @param array $ary ! * ! * @access public ! */ ! function saveAuthor($ary) { ! ! if ($ary[author_name] == "") { ! error("There is no author_name in Author.class::saveAuthor"); ! return false; ! } ! if ($ary[password] == "") { ! error("There is no password in Author.class::saveAuthor"); ! return false; ! } ! if (!is_array($ary[permission]) or (count($ary[permission]) < 1)) { ! error("You need to select some permissions in Author.class::saveAuthor"); ! return false; ! } ! ! /* addslashes for the (') AND str_replace for the (") */ ! ! $ary["quote"] = clean($ary["quote"]); ! $ary[author_name] = addslashes(str_replace('\"',""",stripslashes($ary["author_name"]))); ! // $ary[author_name] = str_replace(" "," ",stripslashes($ary["author_name"])); ! $ary[author_realname] = addslashes(str_replace('\"',""",stripslashes( ! $ary["author_realname"]))); ! ! /* if a record exists, then we update, else we insert a new author! */ ! ! $this->db->query("SELECT author_id ! FROM psl_author ! WHERE author_id = '$ary[author_id]'"); ! ! $joined_perms = join(',',$ary[permission]); ! if ($this->db->next_record()) { ! $q = "UPDATE psl_author ! SET author_name = '$ary[author_name]', ! author_realname = '$ary[author_realname]', ! url = '$ary[url]', ! email = '$ary[email]', ! quote = '$ary[quote]', ! password = '$ary[password]', ! perms = '$joined_perms' ! WHERE author_id = '$ary[author_id]'"; ! } else { ! $ary[author_id] = generateID("psl_author_seq"); ! ! $q = "INSERT INTO psl_author ! (author_id, ! author_name, ! author_realname, ! url, ! email, ! quote, ! password, ! seclev, ! perms) ! VALUES ('$ary[author_id]', ! '$ary[author_name]', ! '$ary[author_realname]', ! '$ary[url]', ! '$ary[email]', ! '$ary[quote]', ! '$ary[password]', ! '$ary[seclev]', ! '$joined_perms')"; ! } ! ! # echo "<BR><PRE><B>QUERY: $q</B></PRE><BR>\n"; ! $this->db->query($q); ! return true; ! } ! ! /** ! * deleteAuthor - deletes the author info to the DB ! * ! * Given the author_id, it deletes that from the author table. The ! * psl_author_lut and psl_author_submission_lut table must be cleaned ! * first by updating all the stories to point to different authors. It ! * will also check and make sure there are NO stories/submissions ! * associated with this author before deleting it. Returns true if ! * author is deleted, false if not. ! * ! * @param integer author_id_to_delete ! * @param string author_id ! * ! * @access public ! */ ! function deleteAuthor($author_id_to_delete, $author_id="") { ! ! if ($author_id_to_delete == $author_id) { ! echo "<BR><BR>You can't delete yourself! Create another user, log in as he/she and then delete this account.<BR><BR>"; ! return false; ! }; ! ! if (!$author_id_to_delete) { ! return false; ! } ! ! $q = "DELETE ! FROM psl_author ! WHERE author_id = '$author_id_to_delete'"; ! $this->db->query($q); ! if ($this->db->affected_rows() > 0) { ! return true; ! } else { ! return false; ! }; ! } ! ! /** ! * newAuthor - spits out a blank form for input ! * ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! * ! * @access public ! */ ! function newAuthor() { ! ! titlebar("100%","Add a new Author"); ! ! $this->author_templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], ! PERMSEL => $this->perm->perm_sel("permission", $this->db->f("perms")), ! AUTHOR_ID => "", ! NAME => "", ! REALNAME => $this->author_id, ! EMAIL => "", ! URL => "", ! QUOTE => "", ! PASSWORD => "", ! SECLEV => "" ! )); ! ! $this->author_templ->parse(OUT,array("newauthor")); ! $this->author_templ->p(OUT); ! ! } ! ! /** ! * editAuthor - spits out a form for updating author info ! * ! * Just prints out the "form" with the user's info and ! * points the user to the "save" method ! * Used only by admin ! * ! * @param integer id ! * @access public ! */ ! function editAuthor($id) { ! ! titlebar("100%","Update Author ($id)"); ! ! $q = "SELECT * ! FROM psl_author ! WHERE author_id = '$id' "; ! $this->db->query($q); ! ! ! ! while ($this->db->next_record()) { ! ! $author_id = $this->db->Record[author_id]; ! ! $this->author_templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], ! AUTHOR_ID => $author_id, ! NAME => $this->db->f("author_name"), ! REALNAME => $this->db->f("author_realname"), ! EMAIL => $this->db->f("email"), ! URL => $this->db->f("url"), ! QUOTE => $this->db->f("quote"), ! PASSWORD => $this->db->f("password"), ! SECLEV => $this->db->f("seclev"), ! COUNT => $count, ! PERMSEL => $this->perm->perm_sel("permission", $this->db->f("perms")), ! AMP => $this->psl['amp'] ! )); ! }; ! ! $this->author_templ->parse(OUT,array("newauthor")); ! $this->author_templ->p(OUT); ! ! } ! ! /** ! * getName - return name assign to id ! * ! * when given a author id, getName returns the name ! * ! * @param integer id ! * @access public ! * return author_name ! */ ! function getName($id) { ! if (!$id) { ! return false; ! } else { ! $q = "SELECT author_name ! FROM psl_author ! WHERE author_id = $id"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("author_name"); ! }; ! } ! ! /** ! * getId - return id assign to name ! * ! * when given a name, getId returns the id ! * ! * @param string name ! * @access public ! * return author_id ! */ ! ! function getId($name) { ! if (!$name) { ! return false; ! } else { ! $q = "SELECT author_id ! FROM psl_author ! WHERE author_name = $name"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("author_id"); ! }; ! } ! ! ! /** ! * getAuthors - returns array with author ids and names ! * ! * ! * @access public ! * return author_array(id, name) ! */ ! function getAuthors() { ! ! $q = "SELECT author_id, author_name ! FROM psl_author ! ORDER BY author_name"; ! $this->db->query($q); ! ! while ($this->db->next_record()) { ! $author_array[] = array( ! "id" => $this->db->f("author_id"), ! "name" => $this->db->f("author_name") ! ); ! } ! return $author_array; ! } ! } /* end of Author.class */ ! ?> --- 1,362 ---- ! <?php ! ! /* $Id$ */ ! ! /** ! * Provides an API to the PHPSlash Author Management. ! * ! * This object is how we do anything with authors. ! * ! */ ! class Author { ! var $author_templ, $db, $perm, $psl; ! ! /** ! * The Author Constructor ! * ! * sets up the local version of the global _PSL array, the templates ! * and a few other things ! * @access private ! */ ! ! function Author () { ! ! global $perm, $_PSL; ! ! $this->db = new slashDB; ! $this->perm = $perm; ! $this->psl = $_PSL; ! ! /* Templates */ ! $this->author_templ = new Template($this->psl['templatedir'], "remove"); ! $this->author_templ->debug = 0; ! $this->author_templ->set_file(array( ! listauthor => "authorList.tpl", ! newauthor => "authorNew.tpl" ! )); ! ! $this->author_templ->set_var( array( ! ROOTDIR => $this->psl['rootur'], ! IMAGEDIR => $this->psl['imageurl'] ! )); ! } ! ! /* ! * METHODS ! */ ! ! /** ! * listAuthor - list all Authors ! * ! * displays the complete list of authors ! * Used only by admin ! * @access public ! */ ! function listAuthor() { ! ! $q = "SELECT * ! FROM psl_author ! ORDER BY author_name"; ! $this->db->query($q); ! ! titlebar("100%","Existing Authors"); ! ! $this->author_templ->set_block("listauthor","row","rows"); ! ! $count = 0; ! ! while ($this->db->next_record()) { ! ! $author_id = $this->db->Record[author_id]; ! ! $this->author_templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], ! AUTHOR_ID => $author_id, ! NAME => $this->db->f("author_name"), ! REALNAME => $this->db->f("author_realname"), ! EMAIL => $this->db->f("email"), ! URL => $this->db->f("url"), ! QUOTE => $this->db->f("quote"), ! PASSWORD => $this->db->f("password"), ! COUNT => $count, ! PERMSEL => $this->perm->perm_sel("permission[$count]", $this->db->f("perms")), ! AMP => $this->psl['amp'] ! )); ! $this->author_templ->parse("rows","row",true); ! $count++; ! }; ! $this->author_templ->parse(OUT,array("listauthor")); ! $this->author_templ->p(OUT); ! } ! ! /** ! * saveAuthor - save the author info to the DB ! * ! * Saves the author in the $ary array to the DB ! * Obligatory fields: author_name, image, width, height, alt_text ! * Optional fields: author_id (only if this author is already in the DB), ! * onlinkbar (if blank, defaults to 0) ! * Returns true if sucessful (author added or updated), false on error ! * Used only by admin ! * ! * @param array $ary ! * ! * @access public ! */ ! function saveAuthor($ary) { ! ! if ($ary[author_name] == "") { ! error("There is no author_name in Author.class::saveAuthor"); ! return false; ! } ! if ($ary[password] == "") { ! error("There is no password in Author.class::saveAuthor"); ! return false; ! } ! if (!is_array($ary[permission]) or (count($ary[permission]) < 1)) { ! error("You need to select some permissions in Author.class::saveAuthor"); ! return false; ! } ! ! /* addslashes for the (') AND str_replace for the (") */ ! ! $ary["quote"] = clean($ary["quote"]); ! $ary[author_name] = addslashes(str_replace('\"',""",stripslashes($ary["author_name"]))); ! // $ary[author_name] = str_replace(" "," ",stripslashes($ary["author_name"])); ! $ary[author_realname] = addslashes(str_replace('\"',""",stripslashes( ! $ary["author_realname"]))); ! ! /* if a record exists, then we update, else we insert a new author! */ ! ! $this->db->query("SELECT author_id ! FROM psl_author ! WHERE author_id = '$ary[author_id]'"); ! ! $joined_perms = join(',',$ary[permission]); ! if ($this->db->next_record()) { ! $q = "UPDATE psl_author ! SET author_name = '$ary[author_name]', ! author_realname = '$ary[author_realname]', ! url = '$ary[url]', ! email = '$ary[email]', ! quote = '$ary[quote]', ! password = '$ary[password]', ! perms = '$joined_perms' ! WHERE author_id = '$ary[author_id]'"; ! } else { ! $ary[author_id] = generateID("psl_author_seq"); ! ! $q = "INSERT INTO psl_author ! (author_id, ! author_name, ! author_realname, ! url, ! email, ! quote, ! password, ! seclev, ! perms) ! VALUES ('$ary[author_id]', ! '$ary[author_name]', ! '$ary[author_realname]', ! '$ary[url]', ! '$ary[email]', ! '$ary[quote]', ! '$ary[password]', ! '$ary[seclev]', ! '$joined_perms')"; ! } ! ! # echo "<BR><PRE><B>QUERY: $q</B></PRE><BR>\n"; ! $this->db->query($q); ! return true; ! } ! ! /** ! * deleteAuthor - deletes the author info to the DB ! * ! * Given the author_id, it deletes that from the author table. The ! * psl_author_lut and psl_author_submission_lut table must be cleaned ! * first by updating all the stories to point to different authors. It ! * will also check and make sure there are NO stories/submissions ! * associated with this author before deleting it. Returns true if ! * author is deleted, false if not. ! * ! * @param integer author_id_to_delete ! * @param string author_id ! * ! * @access public ! */ ! function deleteAuthor($author_id_to_delete, $author_id="") { ! ! if ($author_id_to_delete == $author_id) { ! echo "<BR><BR>You can't delete yourself! Create another user, log in as he/she and then delete this account.<BR><BR>"; ! return false; ! }; ! ! if (!$author_id_to_delete) { ! return false; ! } ! ! $q = "DELETE ! FROM psl_author ! WHERE author_id = '$author_id_to_delete'"; ! $this->db->query($q); ! if ($this->db->affected_rows() > 0) { ! return true; ! } else { ! return false; ! }; ! } ! ! /** ! * newAuthor - spits out a blank form for input ! * ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! * ! * @access public ! */ ! function newAuthor() { ! ! titlebar("100%","Add a new Author"); ! ! $this->author_templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], ! PERMSEL => $this->perm->perm_sel("permission", $this->db->f("perms")), ! AUTHOR_ID => "", ! NAME => "", ! REALNAME => $this->author_id, ! EMAIL => "", ! URL => "", ! QUOTE => "", ! PASSWORD => "", ! SECLEV => "" ! )); ! ! $this->author_templ->parse(OUT,array("newauthor")); ! $this->author_templ->p(OUT); ! ! } ! ! /** ! * editAuthor - spits out a form for updating author info ! * ! * Just prints out the "form" with the user's info and ! * points the user to the "save" method ! * Used only by admin ! * ! * @param integer id ! * @access public ! */ ! function editAuthor($id) { ! ! titlebar("100%","Update Author ($id)"); ! ! $q = "SELECT * ! FROM psl_author ! WHERE author_id = '$id' "; ! $this->db->query($q); ! ! ! ! while ($this->db->next_record()) { ! ! $author_id = $this->db->Record[author_id]; ! ! $this->author_templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], ! AUTHOR_ID => $author_id, ! NAME => $this->db->f("author_name"), ! REALNAME => $this->db->f("author_realname"), ! EMAIL => $this->db->f("email"), ! URL => $this->db->f("url"), ! QUOTE => $this->db->f("quote"), ! PASSWORD => $this->db->f("password"), ! SECLEV => $this->db->f("seclev"), ! COUNT => $count, ! PERMSEL => $this->perm->perm_sel("permission", $this->db->f("perms")), ! AMP => $this->psl['amp'] ! )); ! }; ! ! $this->author_templ->parse(OUT,array("newauthor")); ! $this->author_templ->p(OUT); ! ! } ! ! /** ! * getName - return name assign to id ! * ! * when given a author id, getName returns the name ! * ! * @param integer id ! * @access public ! * return author_name ! */ ! function getName($id) { ! if (!$id) { ! return false; ! } else { ! $q = "SELECT author_name ! FROM psl_author ! WHERE author_id = $id"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("author_name"); ! }; ! } ! ! /** ! * getId - return id assign to name ! * ! * when given a name, getId returns the id ! * ! * @param string name ! * @access public ! * return author_id ! */ ! ! function getId($name) { ! if (!$name) { ! return false; ! } else { ! $q = "SELECT author_id ! FROM psl_author ! WHERE author_name = $name"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("author_id"); ! }; ! } ! ! ! /** ! * getAuthors - returns array with author ids and names ! * ! * ! * @access public ! * @param $ary - permission array for futute use ! * @return author_array(id, name) ! */ ! function getAuthors($ary = "") { ! ! $q = "SELECT DISTINCT author_id, author_name ! FROM psl_author "; ! if ( !$ary[mode] == "all") { ! $q .= ", psl_story ! WHERE psl_story.user_id = psl_author.author_id "; ! } ! $q .= " ORDER BY author_name"; ! $this->db->query($q); ! ! while ($this->db->next_record()) { ! $author_array[] = array( ! "id" => $this->db->f("author_id"), ! "name" => $this->db->f("author_name") ! ); ! } ! return $author_array; ! } ! } /* end of Author.class */ ! ?> |
From: Lars H. <lh...@us...> - 2001-12-16 21:33:42
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv18377/phpslash-ft Modified Files: CHANGES Log Message: inserted an array in Author::getAuthors which would limit the view to special authors Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.349 retrieving revision 1.350 diff -C2 -d -r1.349 -r1.350 *** CHANGES 2001/12/16 20:54:51 1.349 --- CHANGES 2001/12/16 21:33:40 1.350 *************** *** 1,780 **** ! $Id$ ! ! Changes Legend... ! ! B - Bugfix ! F - Feature Added ! E - Experimental ! T - Template changed ! D - Documentation ! S - Database Schema [...1536 lines suppressed...] ! ! 2001-Apr-05 09:15 CDT Joe Stewart <jo...@be...> ! o [B] - bugfix - #404001 - Full text search of articles - search.php3. ! One more time. Full body text enabled and bug closed. ! ! 2001-Apr-05 09:15 CDT Joe Stewart <jo...@be...> ! o [B] - bugfix - #404001 - Full text search of articles - search.php3. ! argh. Commented out because of comments in bug report. ! ! 2001-Apr-05 09:15 CDT Joe Stewart <jo...@be...> ! o [CPT] - stories can now be scheduled for publication by "god" ! level user. ! affected files: Story.class, storyNew.tpl, ! search.php3, Block_render_cal.class. ! - The author realname field now accepts entry. The name displayed ! on article display is the real_name by default. ! affected files: Author.class, authorAdmin.php3, authorNew.tpl, ! authorList.tpl, and Story.class. ! ! Moved everything to another changes file... |
From: Lars H. <lh...@us...> - 2001-12-16 20:54:55
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv9895/phpslash-ft Modified Files: CHANGES Log Message: moved the require(MailingList.class) statement from mailinglist.php3 and mailinglistAdmin.php3 to config.php3 Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.348 retrieving revision 1.349 diff -C2 -d -r1.348 -r1.349 *** CHANGES 2001/12/14 22:13:02 1.348 --- CHANGES 2001/12/16 20:54:51 1.349 *************** *** 1,776 **** ! $Id$ ! ! Changes Legend... ! ! B - Bugfix ! F - Feature Added ! E - Experimental ! T - Template changed ! D - Documentation ! S - Database Schema [...1527 lines suppressed...] ! ! 2001-Apr-05 09:15 CDT Joe Stewart <jo...@be...> ! o [B] - bugfix - #404001 - Full text search of articles - search.php3. ! One more time. Full body text enabled and bug closed. ! ! 2001-Apr-05 09:15 CDT Joe Stewart <jo...@be...> ! o [B] - bugfix - #404001 - Full text search of articles - search.php3. ! argh. Commented out because of comments in bug report. ! ! 2001-Apr-05 09:15 CDT Joe Stewart <jo...@be...> ! o [CPT] - stories can now be scheduled for publication by "god" ! level user. ! affected files: Story.class, storyNew.tpl, ! search.php3, Block_render_cal.class. ! - The author realname field now accepts entry. The name displayed ! on article display is the real_name by default. ! affected files: Author.class, authorAdmin.php3, authorNew.tpl, ! authorList.tpl, and Story.class. ! ! Moved everything to another changes file... |
From: Lars H. <lh...@us...> - 2001-12-16 20:54:55
|
Update of /cvsroot/phpslash/phpslash-ft/public_html/admin In directory usw-pr-cvs1:/tmp/cvs-serv9895/phpslash-ft/public_html/admin Modified Files: mailinglistAdmin.php3 Log Message: moved the require(MailingList.class) statement from mailinglist.php3 and mailinglistAdmin.php3 to config.php3 Index: mailinglistAdmin.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/admin/mailinglistAdmin.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mailinglistAdmin.php3 2001/05/15 22:45:26 1.1 --- mailinglistAdmin.php3 2001/12/16 20:54:51 1.2 *************** *** 6,12 **** $xsiteobject = "Administration"; // Defines The META TAG Page Type - require('../config.php3'); - require($classdir . '/MailingList.class'); page_open(array("sess"=>"slashSess","auth"=>"slashAuth","perm"=>"slashPerm")); --- 6,10 ---- |
From: Lars H. <lh...@us...> - 2001-12-16 20:54:55
|
Update of /cvsroot/phpslash/phpslash-ft/public_html In directory usw-pr-cvs1:/tmp/cvs-serv9895/phpslash-ft/public_html Modified Files: mailinglist.php3 config.php3 Log Message: moved the require(MailingList.class) statement from mailinglist.php3 and mailinglistAdmin.php3 to config.php3 Index: mailinglist.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/mailinglist.php3,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** mailinglist.php3 2001/05/16 19:19:17 1.1 --- mailinglist.php3 2001/12/16 20:54:51 1.2 *************** *** 8,12 **** require('config.php3'); - require($classdir . '/MailingList.class'); page_open(array("sess"=>"slashSess","auth"=>"slashAuth","perm"=>"slashPerm")); --- 8,11 ---- Index: config.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/config.php3,v retrieving revision 1.119 retrieving revision 1.120 diff -C2 -d -r1.119 -r1.120 *** config.php3 2001/12/07 21:23:25 1.119 --- config.php3 2001/12/16 20:54:51 1.120 *************** *** 383,386 **** --- 383,389 ---- require($_PSL[classdir] . "/Glossary.class"); } + if ($_PSL[module][MailingList]) { + require($_PSL[classdir] . "/MailingList.class"); + } |
From: Lars H. <lh...@us...> - 2001-12-14 22:14:38
|
Update of /cvsroot/phpslash/phpslash-ft/public_html In directory usw-pr-cvs1:/tmp/cvs-serv8580/phpslash-ft/public_html Modified Files: article.php3 search.php3 index.php3 indextpl3col.php3 about.php3 login.php3 Log Message: removed some global variables Index: article.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/article.php3,v retrieving revision 1.51 retrieving revision 1.52 diff -C2 -d -r1.51 -r1.52 *** article.php3 2001/11/13 22:01:27 1.51 --- article.php3 2001/12/14 22:14:36 1.52 *************** *** 34,38 **** $story_html = $story->getStory($story_id, "full", $ary); ! $t = new Template($templatedir, "remove"); if ($story_html) { --- 34,38 ---- $story_html = $story->getStory($story_id, "full", $ary); ! $t = new Template($_PSL[templatedir], "remove"); if ($story_html) { *************** *** 102,106 **** STORY_ID => $story_id, ARROWS => $arrows, ! IMAGEDIR => $imagedir, FOOTER => $footer )); --- 102,106 ---- STORY_ID => $story_id, ARROWS => $arrows, ! IMAGEDIR => $_PSL[imageurl], FOOTER => $footer )); Index: search.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/search.php3,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** search.php3 2001/11/24 14:02:12 1.39 --- search.php3 2001/12/14 22:14:36 1.40 *************** *** 142,146 **** /* Templates */ ! $templ = new Template ("$templatedir"); $templ->debug = false; $templ->set_file (searchpage, "searchPage.tpl"); --- 142,146 ---- /* Templates */ ! $templ = new Template ($_PSL[templatedir]); $templ->debug = false; $templ->set_file (searchpage, "searchPage.tpl"); *************** *** 154,163 **** $templ->set_var (array ( ! TOPIC_IMAGE_SRC => "$imagedir/topics/$topic_image_name", TOPIC_WIDTH => $topic_image_width, TOPIC_HEIGHT => $topic_image_height, TOPIC_ALT_TEXT => $topic_alttext, QUERY_STRING => $query, ! ACTION_URL => $PHP_SELF )); --- 154,163 ---- $templ->set_var (array ( ! TOPIC_IMAGE_SRC => $_PSL[imageurl]."/topics/$topic_image_name", TOPIC_WIDTH => $topic_image_width, TOPIC_HEIGHT => $topic_image_height, TOPIC_ALT_TEXT => $topic_alttext, QUERY_STRING => $query, ! ACTION_URL => $_PSL[phpself] )); *************** *** 170,174 **** )); if ($search_topic_id == "") { ! $templ->set_var (TOPIC_SELECTED, "selected"); } else { $templ->set_var (TOPIC_SELECTED, ""); --- 170,174 ---- )); if ($search_topic_id == "") { ! $templ->set_var (TOPIC_SELECTED, "selected=\"selected\""); } else { $templ->set_var (TOPIC_SELECTED, ""); *************** *** 189,193 **** if ($search_topic_id == $sl_q->Record[topic_id]) { ! $templ->set_var (TOPIC_SELECTED, "selected"); } else { $templ->set_var (TOPIC_SELECTED, ""); --- 189,193 ---- if ($search_topic_id == $sl_q->Record[topic_id]) { ! $templ->set_var (TOPIC_SELECTED, "selected=\"selected\""); } else { $templ->set_var (TOPIC_SELECTED, ""); *************** *** 204,208 **** )); if ($search_section_id == "") { ! $templ->set_var (SECTION_SELECTED, "selected"); } else { $templ->set_var (SECTION_SELECTED, ""); --- 204,208 ---- )); if ($search_section_id == "") { ! $templ->set_var (SECTION_SELECTED, "selected=\"selected\""); } else { $templ->set_var (SECTION_SELECTED, ""); *************** *** 223,227 **** if ($search_section_id == $sl_q->Record[section_id]) { ! $templ->set_var (SECTION_SELECTED, "selected"); } else { $templ->set_var (SECTION_SELECTED, ""); --- 223,227 ---- if ($search_section_id == $sl_q->Record[section_id]) { ! $templ->set_var (SECTION_SELECTED, "selected=\"selected\""); } else { $templ->set_var (SECTION_SELECTED, ""); *************** *** 238,242 **** )); if ($search_author_id == "") { ! $templ->set_var (AUTHOR_SELECTED, "selected"); } else { $templ->set_var (AUTHOR_SELECTED, ""); --- 238,242 ---- )); if ($search_author_id == "") { ! $templ->set_var (AUTHOR_SELECTED, "selected=\"selected\""); } else { $templ->set_var (AUTHOR_SELECTED, ""); *************** *** 257,261 **** if ($search_author_id == $sl_q->Record[author_id]) { ! $templ->set_var (AUTHOR_SELECTED, "selected"); } else { $templ->set_var (AUTHOR_SELECTED, ""); --- 257,261 ---- if ($search_author_id == $sl_q->Record[author_id]) { ! $templ->set_var (AUTHOR_SELECTED, "selected=\"selected\""); } else { $templ->set_var (AUTHOR_SELECTED, ""); *************** *** 387,391 **** $templ->set_file (more_matches_file, "searchMoreMatches.tpl"); $templ->parse (more_matches, more_matches_file); ! $more_matches_url = "$PHP_SELF?min=$min"; /* Only put the necessary stuff on the query URL */ --- 387,391 ---- $templ->set_file (more_matches_file, "searchMoreMatches.tpl"); $templ->parse (more_matches, more_matches_file); ! $more_matches_url = $_PSL[phpself]."?min=$min"; /* Only put the necessary stuff on the query URL */ Index: index.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/index.php3,v retrieving revision 1.49 retrieving revision 1.50 diff -C2 -d -r1.49 -r1.50 *** index.php3 2001/11/28 17:49:56 1.49 --- index.php3 2001/12/14 22:14:36 1.50 *************** *** 44,48 **** $allblocks = $block->getBlocks($ary); ! $template = new Template($templatedir); $template->debug = 0; $template->set_file(array( --- 44,48 ---- $allblocks = $block->getBlocks($ary); ! $template = new Template($_PSL[templatedir]); $template->debug = 0; $template->set_file(array( Index: indextpl3col.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/indextpl3col.php3,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** indextpl3col.php3 2001/11/28 17:49:56 1.11 --- indextpl3col.php3 2001/12/14 22:14:36 1.12 *************** *** 41,45 **** $rightblocks = $block->getBlocks($ary, "right" ); ! $template = new Template($templatedir); $template->debug = 0; $template->set_file(array( --- 41,45 ---- $rightblocks = $block->getBlocks($ary, "right" ); ! $template = new Template($_PSL[templatedir]); $template->debug = 0; $template->set_file(array( *************** *** 49,53 **** $template->set_var(array( ROOTDIR => $_PSL[rootdir], ! IMAGEDIR => $_PSL[imagedir], BREADCRUMB => $breadcrumb, STORY_COLUMN => $allstories, --- 49,53 ---- $template->set_var(array( ROOTDIR => $_PSL[rootdir], ! IMAGEDIR => $_PSL[imageurl], BREADCRUMB => $breadcrumb, STORY_COLUMN => $allstories, Index: about.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/about.php3,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** about.php3 2001/09/06 17:18:22 1.12 --- about.php3 2001/12/14 22:14:36 1.13 *************** *** 12,16 **** $footer = getFooter(); ! $about_templ = new Template($templatedir); $about_templ->set_file(array( main => "about.tpl" --- 12,16 ---- $footer = getFooter(); ! $about_templ = new Template($_PSL[templatedir]); $about_templ->set_file(array( main => "about.tpl" Index: login.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/login.php3,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** login.php3 2001/10/17 17:11:27 1.9 --- login.php3 2001/12/14 22:14:36 1.10 *************** *** 1,86 **** ! <?php ! // $Id$ ! ! $pagetitle = "Administration"; # The name to be displayed in the header ! $xsiteobject = "Administration"; # Defines The META TAG Page Type ! require("config.php3"); ! ! page_open(array("sess"=>"slashSess","auth"=>"slashAuth","perm"=>"slashPerm")); ! ! if ($logout) { ! ! # $auth->unauth(); ! # $auth->auth_loginform(); ! $username = $auth->auth['uname']; ! $auth->auth["error"] = sprintf(pslgetText("%s logged out."), $username); ! $auth->auth[uid] = "nobody"; ! $auth->auth[perm] = ""; ! // slashhead($pagetitle,$xsiteobject); ! // $debug = true; ! // debug("Auth",$auth->auth); ! // $login = "yes"; ! // $auth->login_if($login); ! $auth->auth_loginform(); ! ! } elseif ($perm->have_perm("user")) { ! ! $story = new Story; ! $block = new Block_i; ! ! /* parse cmd line variables into array */ ! while ( list($key, $val) = each($HTTP_GET_VARS )) { ! $ary[$key] = $val; ! } ! ! /* defaults for main "index" page */ ! if ((!$section) AND (!$section_id)){ ! $section = $_PSL[site_homesection]; ! if(!$section) { ! $section = "Home"; ! } ! $ary[section] = $section; ! } else { ! $pagetitle .= " - $section"; ! } ! ! ! slashhead($pagetitle,$xsiteobject); ! titlebar("100%","Welcome to the Administration Screen"); ! ! $ary = $auth->auth; ! /* ! while (list($key,$val) = each($auth->auth)) { ! echo "KEY: $key => VAL: $val<BR>\n"; ! ! } ! */ ! $allstories = breadcrumb( $ary); ! ! $allstories = "<BR><BR>A bunch of cool things like latest site activity and stats should go here. <BR> But until they do, just pick something from the NavBar and go about your duties...<BR><BR>\n"; ! $ary['section'] = "Admin"; ! $allblocks = $block->getBlocks($ary); ! ! $template = new Template($templatedir); ! $template->debug = 0; ! $template->set_file(array( ! index => "index.tpl" ! )); ! ! $template->set_var(array( ! ROOTDIR => $_PSL[rooturl], ! IMAGEDIR => $_PSL[imageurl], ! STORY_COLUMN => $allstories, ! BLOCK_COLUMN => $allblocks ! )); ! ! $template->parse(OUT,"index"); ! $template->p(OUT); ! ! slashfoot(); ! ! } else { ! Header("Location: " . $_PSL[rooturl]); ! } ! page_close(); ! ! ?> --- 1,86 ---- ! <?php ! // $Id$ ! ! $pagetitle = "Administration"; # The name to be displayed in the header ! $xsiteobject = "Administration"; # Defines The META TAG Page Type ! require("config.php3"); ! ! page_open(array("sess"=>"slashSess","auth"=>"slashAuth","perm"=>"slashPerm")); ! ! if ($logout) { ! ! # $auth->unauth(); ! # $auth->auth_loginform(); ! $username = $auth->auth['uname']; ! $auth->auth["error"] = sprintf(pslgetText("%s logged out."), $username); ! $auth->auth[uid] = "nobody"; ! $auth->auth[perm] = ""; ! // slashhead($pagetitle,$xsiteobject); ! // $debug = true; ! // debug("Auth",$auth->auth); ! // $login = "yes"; ! // $auth->login_if($login); ! $auth->auth_loginform(); ! ! } elseif ($perm->have_perm("user")) { ! ! $story = new Story; ! $block = new Block_i; ! ! /* parse cmd line variables into array */ ! while ( list($key, $val) = each($HTTP_GET_VARS )) { ! $ary[$key] = $val; ! } ! ! /* defaults for main "index" page */ ! if ((!$section) AND (!$section_id)){ ! $section = $_PSL[site_homesection]; ! if(!$section) { ! $section = "Home"; ! } ! $ary[section] = $section; ! } else { ! $pagetitle .= " - $section"; ! } ! ! ! slashhead($pagetitle,$xsiteobject); ! titlebar("100%","Welcome to the Administration Screen"); ! ! $ary = $auth->auth; ! /* ! while (list($key,$val) = each($auth->auth)) { ! echo "KEY: $key => VAL: $val<BR>\n"; ! ! } ! */ ! $allstories = breadcrumb( $ary); ! ! $allstories = "<BR><BR>A bunch of cool things like latest site activity and stats should go here. <BR> But until they do, just pick something from the NavBar and go about your duties...<BR><BR>\n"; ! $ary['section'] = "Admin"; ! $allblocks = $block->getBlocks($ary); ! ! $template = new Template($_PSL[templatedir]); ! $template->debug = 0; ! $template->set_file(array( ! index => "index.tpl" ! )); ! ! $template->set_var(array( ! ROOTDIR => $_PSL[rooturl], ! IMAGEDIR => $_PSL[imageurl], ! STORY_COLUMN => $allstories, ! BLOCK_COLUMN => $allblocks ! )); ! ! $template->parse(OUT,"index"); ! $template->p(OUT); ! ! slashfoot(); ! ! } else { ! Header("Location: " . $_PSL[rooturl]); ! } ! page_close(); ! ! ?> |
From: Lars H. <lh...@us...> - 2001-12-14 22:13:04
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv8133/phpslash-ft Modified Files: CHANGES Log Message: removed some global variables Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.347 retrieving revision 1.348 diff -C2 -d -r1.347 -r1.348 *** CHANGES 2001/12/14 21:19:40 1.347 --- CHANGES 2001/12/14 22:13:02 1.348 *************** *** 13,16 **** --- 13,26 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-14 11:00PM MET Lars Heuer <he...@qu...> + [B] - about.php3, article.php3, index.php3, index3col.php3, + login.php3, search.php3, + Removed $templatedir with $_PSL[templatedir] + Removed $PHP_SELF with $_PSL[phpself] + index3col.php3: Removed $_PSL[imagedir] with $_PSL[imageurl] + search.php3: changed 'selected' to 'selected="selected"' + for XHTML compatibility + + 2001-Dec-14 3:15PM CST Joe Stewart <jo...@be...> [T] - storyNew.tpl - Removed duplicate AUTHOR_ID. |
From: Joe S. <joe...@us...> - 2001-12-14 21:19:43
|
Update of /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default In directory usw-pr-cvs1:/tmp/cvs-serv27310/phpslash-ft/public_html/templates/en/default Modified Files: storyNew.tpl Log Message: bugfix - storNew.tpl had two different AUTHOR_ID values Index: storyNew.tpl =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default/storyNew.tpl,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** storyNew.tpl 2001/09/26 22:30:47 1.9 --- storyNew.tpl 2001/12/14 21:19:40 1.10 *************** *** 1,5 **** <!-- storyNew.tpl --> <FORM ACTION="{ACTION_URL}" METHOD=POST> - <INPUT TYPE=HIDDEN NAME="author_id" VALUE="{AUTHOR_ID}"> <INPUT TYPE=HIDDEN NAME="story_id" VALUE="{STORY_ID}"> --- 1,4 ---- |
From: Joe S. <joe...@us...> - 2001-12-14 21:19:43
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv27310/phpslash-ft Modified Files: CHANGES Log Message: bugfix - storNew.tpl had two different AUTHOR_ID values Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.346 retrieving revision 1.347 diff -C2 -d -r1.346 -r1.347 *** CHANGES 2001/12/14 18:00:22 1.346 --- CHANGES 2001/12/14 21:19:40 1.347 *************** *** 13,16 **** --- 13,19 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-14 3:15PM CST Joe Stewart <jo...@be...> + [T] - storyNew.tpl - Removed duplicate AUTHOR_ID. + 2001-Dec-14 7:00PM MET Lars Heuer <he...@qu...> [W] - de.php3 |
From: Lars H. <lh...@us...> - 2001-12-14 18:00:28
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv9619/phpslash-ft Modified Files: CHANGES Log Message: de.php3 - corrected some type errors Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.345 retrieving revision 1.346 diff -C2 -d -r1.345 -r1.346 *** CHANGES 2001/12/14 14:14:57 1.345 --- CHANGES 2001/12/14 18:00:22 1.346 *************** *** 13,16 **** --- 13,20 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-14 7:00PM MET Lars Heuer <he...@qu...> + [W] - de.php3 + Corrected some type errors + 2001-Dec-14 3:10PM MET Lars Heuer <he...@qu...> [W] - functions.inc |
From: Lars H. <lh...@us...> - 2001-12-14 17:59:50
|
Update of /cvsroot/phpslash/phpslash-ft/class/locale In directory usw-pr-cvs1:/tmp/cvs-serv9440/phpslash-ft/class/locale Modified Files: de.php3 Log Message: corrected some type errors Index: de.php3 =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/locale/de.php3,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** de.php3 2001/12/14 12:02:49 1.4 --- de.php3 2001/12/14 17:59:46 1.5 *************** *** 1,5 **** <?php /* ! * en_US ( US English) Language file for PHPSlash * translations named using POSIX locale conventions ( en, es, de, etc) */ --- 1,5 ---- <?php /* ! * de (German) Language file for PHPSlash * translations named using POSIX locale conventions ( en, es, de, etc) */ *************** *** 114,118 **** // submisson.php3 "Thanks for this submission. We have it and will set our fearless editorial staff upon it right this second." => ! "Danke f&uer diesen Beitrag. Wir haben ihn bekommen und werden ihn uns gleich ansehen.", "Something broke, I'm not sure what though??" => --- 114,118 ---- // submisson.php3 "Thanks for this submission. We have it and will set our fearless editorial staff upon it right this second." => ! "Danke für diesen Beitrag. Wir haben ihn erhalten und werden ihn uns gleich ansehen.", "Something broke, I'm not sure what though??" => *************** *** 129,133 **** "Sorry. You do not have the necessary privilege to view this page.\n" => ! "Leider hast Du nicht die notwendigen Privilegien um diese Seite anzuzeigen.\n", // blockadmin.php3 --- 129,133 ---- "Sorry. You do not have the necessary privilege to view this page.\n" => ! "Leider hast Du nicht die notwendigen Privilegien um diese Seite aufzurufen.\n", // blockadmin.php3 *************** *** 247,251 **** "Thank you. for your subscription to our site. If there is anything we can do to improve our service, please let us know!" => ! "Danke f&umml;r Dein Interesse an unserer Website. Wenn wir etwas tun können um den Service zu verbessern, lasse es uns bitte wissen.", "You've been removed from the mailing list, but there was a problem sending out the <B>final</B> email." => --- 247,251 ---- "Thank you. for your subscription to our site. If there is anything we can do to improve our service, please let us know!" => ! "Danke für Dein Interesse an unserer Website. Wenn wir etwas tun können um den Service zu verbessern, schreib uns bitte.", "You've been removed from the mailing list, but there was a problem sending out the <B>final</B> email." => *************** *** 259,263 **** "Sending mail to the following users:" => ! "Die E-Mail wurde an folgende Personen versendet:", "Mail Sent Successfully!" => --- 259,263 ---- "Sending mail to the following users:" => ! "Die E-Mail wurde an folgende Personen verschickt:", "Mail Sent Successfully!" => *************** *** 319,323 **** // Variable.class ! ) ?> --- 319,323 ---- // Variable.class ! ); ?> |
From: Joe S. <joe...@us...> - 2001-12-14 03:58:21
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv24795/phpslash-ft/class Modified Files: Author.class Section.class Story.class Topic.class Log Message: Moved the select boxes of storylist.tpl to the template Index: Author.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Author.class,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Author.class 2001/12/12 11:37:04 1.10 --- Author.class 2001/12/14 03:58:18 1.11 *************** *** 331,363 **** } /** ! * authorSelect - spit out author select box * * - * @param string varname - * @param string selected * @access public ! * return output */ ! function authorSelect($varname,$selected) { $q = "SELECT author_id, author_name ! FROM psl_author"; $this->db->query($q); ! $output = "<SELECT NAME=\"$varname\">\n"; ! $output .= " <OPTION VALUE=\"\">All</OPTION>\n"; while ($this->db->next_record()) { ! $id = $this->db->f("author_id"); ! $name = $this->db->f("author_name"); ! $output .= " <OPTION VALUE=\"$id\" "; ! if ($id == $selected) { ! $output .= " SELECTED"; ! } ! $output .= ">$name</OPTION>\n"; } ! $output .= "</SELECT>\n"; ! return $output; } - } /* end of Author.class */ ?> --- 331,357 ---- } + /** ! * getAuthors - returns array with author ids and names * * * @access public ! * return author_array(id, name) */ ! function getAuthors() { $q = "SELECT author_id, author_name ! FROM psl_author ! ORDER BY author_name"; $this->db->query($q); ! while ($this->db->next_record()) { ! $author_array[] = array( ! "id" => $this->db->f("author_id"), ! "name" => $this->db->f("author_name") ! ); } ! return $author_array; } } /* end of Author.class */ ?> Index: Section.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Section.class,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Section.class 2001/12/12 11:37:48 1.7 --- Section.class 2001/12/14 03:58:18 1.8 *************** *** 1,266 **** ! <?php ! ! /* $Id$ */ ! ! ! /** ! * Provides an API to the PHPSlash Section Management. ! * ! */ ! class Section { ! var $sec_templ,$db,$psl; ! ! /** ! * Section class constructor ! * @access private ! */ ! function Section () { ! ! global $_PSL; ! ! $this->db = new slashDB; ! $this->psl = $_PSL; ! ! /* Templates */ ! $this->sec_templ = new Template($this->psl[templatedir]); ! $this->sec_templ->debug = 0; ! $this->sec_templ->set_file(array( ! listsection => "sectionList.tpl", ! newsection => "sectionNew.tpl" ! )); ! ! } ! ! /** ! * listSection - list all Section ! * ! * displays the complete list of sections ! * Used only by admin ! * @access public ! */ ! function listSection() { ! ! $q = "SELECT * ! FROM psl_section ! ORDER BY section_name"; ! $this->db->query($q); ! ! titlebar("100%","Edit Sections"); ! ! $this->sec_templ->set_block("listsection","row","rows"); ! ! while ($this->db->next_record()) { ! $this->sec_templ->set_var(array( ! ACTION_URL => $this->psl[phpself], ! SECTION_ID => $this->db->Record[section_id], ! SECTION_NAME => $this->db->Record[section_name], ! SECTION_DESC => $this->db->Record[description] ! )); ! $this->sec_templ->parse("rows","row",true); ! }; ! $this->sec_templ->parse(OUT,array("listsection")); ! $this->sec_templ->p(OUT); ! } ! ! /** ! * saveSection - save the section info to the DB ! * ! * Used only by admin ! * ! * @param array $ary ! * ! * @access public ! */ ! ! function saveSection($ary) { ! ! /* we need to check for the stuff to add in the DB before we actually ! * add anything. And yes, I know it looks like I just passed my ! * "Intro to C++ Programming" class. --ajay ! */ ! ! if ($ary[section_name] == "") { ! error("There is no section_name in Section.class::saveSection"); ! return; ! } ! if ($ary[description] == "") { ! error("There is no description in Section.class::saveSection"); ! return; ! } ! ! /* addslashes for the (') AND str_replace for the (") */ ! ! $ary["description"] = addslashes(str_replace('\"',""",stripslashes($ary["description"]))); ! $ary["section_name"] = addslashes(str_replace('\"',""",$ary["section_name"])); ! $ary["section_name"] = str_replace(" "," ",$ary["section_name"]); ! ! /* if a record exists, then we update, else we insert a new section! */ ! $q = "SELECT section_id ! FROM psl_section ! WHERE section_id = '$ary[section_id]'"; ! $this->db->query($q); ! if ($this->db->next_record()) { ! $q = "UPDATE psl_section ! SET section_name = '$ary[section_name]', ! description = '$ary[description]' ! WHERE section_id = '$ary[section_id]'"; ! } else { ! ! $ary[section_id] = generateID("psl_section_seq"); ! ! $q = "INSERT INTO psl_section "; ! $q .= "(section_id,section_name,description) "; ! $q .= "VALUES ('$ary[section_id]','$ary[section_name]','$ary[description]')"; ! } ! ! # echo "<BR><BR><B>QUERY: $q</B><BR><BR>\n"; ! return $this->db->query($q); ! } ! ! /** ! * deleteSection - deletes a section and is somewhat idiot-proof ! * ! * @param integer section_id ! * @access public ! */ ! function deleteSection($section_id) { ! ! $go_ahead = true; ! ! $q = "SELECT psl_story.title, ! psl_story.story_id ! FROM psl_story, ! psl_section_lut ! WHERE psl_story.story_id = psl_section_lut.story_id ! AND psl_section_lut.section_id = '$section_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $section_name = $this->db->Record["section_name"]; ! echo "<FONT COLOR=RED>STORY</FONT>: '$title'<BR>\n"; ! } ! ! $q = "SELECT psl_submission.title, ! psl_submission.story_id ! FROM psl_submission, ! psl_section_submission_lut ! WHERE psl_submission.story_id = psl_section_submission_lut.story_id ! AND psl_section_submission_lut.section_id = '$section_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $section_name = $this->db->Record["section_name"]; ! #echo "<FONT COLOR=RED>SUBMISSION</FONT>: '$title'<BR>\n"; ! } ! ! if (!$go_ahead) { ! return false; ! } else { ! $q = "DELETE FROM psl_section where section_id = '$section_id'"; ! $this->db->query($q); ! return true; ! } ! } ! ! /** ! * newSection - spits out a blank form for input ! * ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! * ! * @access public ! */ ! function newSection() { ! ! titlebar("100%","New Section"); ! $this->sec_templ->set_var(array( ! ACTION_URL => $this->psl[phpself], ! SECTION_NAME => "", ! SECTION_DESC => "" ! )); ! ! $this->sec_templ->parse(OUT,array("newsection")); ! $this->sec_templ->p(OUT); ! ! } ! ! /** ! * getName - return name assign to id ! * ! * when given a section id, getName returns the name ! * ! * @param integer id ! * @access public ! * return section_name ! */ ! function getName($id) { ! if (!$id) { ! return false; ! } else { ! $q = "SELECT section_name ! FROM psl_section ! WHERE section_id = '$id'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("section_name"); ! }; ! } ! ! /** ! * getId - return id assign to name ! * ! * when given a name, getId returns the id ! * ! * @param string name ! * @access public ! * return section_id ! */ ! function getId($name) { ! if (!$name) { ! return false; ! } else { ! $q = "SELECT section_id ! FROM psl_section ! WHERE section_name = '$name'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("section_id"); ! }; ! } ! ! /** ! * sectionSelect - spit out section select box ! * ! * ! * @param string varname ! * @param string selected ! * @access public ! * return output ! */ ! function sectionSelect($varname,$selected) { ! ! $q = "SELECT section_id, section_name ! FROM psl_section"; ! $this->db->query($q); ! $output = "<SELECT NAME=\"$varname\">\n"; ! $output .= " <OPTION VALUE=\"\">All</OPTION>\n"; ! while ($this->db->next_record()) { ! $id = $this->db->f("section_id"); ! $name = $this->db->f("section_name"); ! $output .= " <OPTION VALUE=\"$id\" "; ! if ($id == $selected) { ! $output .= " SELECTED"; ! } ! $output .= ">$name</OPTION>\n"; ! } ! $output .= "</SELECT>\n"; ! return $output; ! } ! ! } /* end of Section.class */ ! ?> --- 1,262 ---- ! <?php ! ! /* $Id$ */ ! ! ! /** ! * Provides an API to the PHPSlash Section Management. ! * ! */ ! class Section { ! var $sec_templ,$db,$psl; ! ! /** ! * Section class constructor ! * @access private ! */ ! function Section () { ! ! global $_PSL; ! ! $this->db = new slashDB; ! $this->psl = $_PSL; ! ! /* Templates */ ! $this->sec_templ = new Template($this->psl[templatedir]); ! $this->sec_templ->debug = 0; ! $this->sec_templ->set_file(array( ! listsection => "sectionList.tpl", ! newsection => "sectionNew.tpl" ! )); ! ! } ! ! /** ! * listSection - list all Section ! * ! * displays the complete list of sections ! * Used only by admin ! * @access public ! */ ! function listSection() { ! ! $q = "SELECT * ! FROM psl_section ! ORDER BY section_name"; ! $this->db->query($q); ! ! titlebar("100%","Edit Sections"); ! ! $this->sec_templ->set_block("listsection","row","rows"); ! ! while ($this->db->next_record()) { ! $this->sec_templ->set_var(array( ! ACTION_URL => $this->psl[phpself], ! SECTION_ID => $this->db->Record[section_id], ! SECTION_NAME => $this->db->Record[section_name], ! SECTION_DESC => $this->db->Record[description] ! )); ! $this->sec_templ->parse("rows","row",true); ! }; ! $this->sec_templ->parse(OUT,array("listsection")); ! $this->sec_templ->p(OUT); ! } ! ! /** ! * saveSection - save the section info to the DB ! * ! * Used only by admin ! * ! * @param array $ary ! * ! * @access public ! */ ! ! function saveSection($ary) { ! ! /* we need to check for the stuff to add in the DB before we actually ! * add anything. And yes, I know it looks like I just passed my ! * "Intro to C++ Programming" class. --ajay ! */ ! ! if ($ary[section_name] == "") { ! error("There is no section_name in Section.class::saveSection"); ! return; ! } ! if ($ary[description] == "") { ! error("There is no description in Section.class::saveSection"); ! return; ! } ! ! /* addslashes for the (') AND str_replace for the (") */ ! ! $ary["description"] = addslashes(str_replace('\"',""",stripslashes($ary["description"]))); ! $ary["section_name"] = addslashes(str_replace('\"',""",$ary["section_name"])); ! $ary["section_name"] = str_replace(" "," ",$ary["section_name"]); ! ! /* if a record exists, then we update, else we insert a new section! */ ! $q = "SELECT section_id ! FROM psl_section ! WHERE section_id = '$ary[section_id]'"; ! $this->db->query($q); ! if ($this->db->next_record()) { ! $q = "UPDATE psl_section ! SET section_name = '$ary[section_name]', ! description = '$ary[description]' ! WHERE section_id = '$ary[section_id]'"; ! } else { ! ! $ary[section_id] = generateID("psl_section_seq"); ! ! $q = "INSERT INTO psl_section "; ! $q .= "(section_id,section_name,description) "; ! $q .= "VALUES ('$ary[section_id]','$ary[section_name]','$ary[description]')"; ! } ! ! # echo "<BR><BR><B>QUERY: $q</B><BR><BR>\n"; ! return $this->db->query($q); ! } ! ! /** ! * deleteSection - deletes a section and is somewhat idiot-proof ! * ! * @param integer section_id ! * @access public ! */ ! function deleteSection($section_id) { ! ! $go_ahead = true; ! ! $q = "SELECT psl_story.title, ! psl_story.story_id ! FROM psl_story, ! psl_section_lut ! WHERE psl_story.story_id = psl_section_lut.story_id ! AND psl_section_lut.section_id = '$section_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $section_name = $this->db->Record["section_name"]; ! echo "<FONT COLOR=RED>STORY</FONT>: '$title'<BR>\n"; ! } ! ! $q = "SELECT psl_submission.title, ! psl_submission.story_id ! FROM psl_submission, ! psl_section_submission_lut ! WHERE psl_submission.story_id = psl_section_submission_lut.story_id ! AND psl_section_submission_lut.section_id = '$section_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $section_name = $this->db->Record["section_name"]; ! #echo "<FONT COLOR=RED>SUBMISSION</FONT>: '$title'<BR>\n"; ! } ! ! if (!$go_ahead) { ! return false; ! } else { ! $q = "DELETE FROM psl_section where section_id = '$section_id'"; ! $this->db->query($q); ! return true; ! } ! } ! ! /** ! * newSection - spits out a blank form for input ! * ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! * ! * @access public ! */ ! function newSection() { ! ! titlebar("100%","New Section"); ! $this->sec_templ->set_var(array( ! ACTION_URL => $this->psl[phpself], ! SECTION_NAME => "", ! SECTION_DESC => "" ! )); ! ! $this->sec_templ->parse(OUT,array("newsection")); ! $this->sec_templ->p(OUT); ! ! } ! ! /** ! * getName - return name assign to id ! * ! * when given a section id, getName returns the name ! * ! * @param integer id ! * @access public ! * return section_name ! */ ! function getName($id) { ! if (!$id) { ! return false; ! } else { ! $q = "SELECT section_name ! FROM psl_section ! WHERE section_id = '$id'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("section_name"); ! }; ! } ! ! /** ! * getId - return id assign to name ! * ! * when given a name, getId returns the id ! * ! * @param string name ! * @access public ! * return section_id ! */ ! function getId($name) { ! if (!$name) { ! return false; ! } else { ! $q = "SELECT section_id ! FROM psl_section ! WHERE section_name = '$name'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("section_id"); ! }; ! } ! ! ! /** ! * getSections - returns array with ids and names ! * ! * ! * @access public ! * return section_array(id, name) ! */ ! function getSections() { ! ! $q = "SELECT section_id, section_name ! FROM psl_section ! ORDER BY section_name"; ! $this->db->query($q); ! ! while ($this->db->next_record()) { ! $section_array[] = array( ! "id" => $this->db->f("section_id"), ! "name" => $this->db->f("section_name") ! ); ! } ! ! return $section_array; ! } ! ! } /* end of Section.class */ ! ?> Index: Story.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Story.class,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Story.class 2001/12/11 15:33:21 1.25 --- Story.class 2001/12/14 03:58:18 1.26 *************** *** 1,1161 **** ! <?php ! ! /* $Id$ */ ! ! /* ! * Class: Story ! * ! * Layer: Final (Builder) ! * Desc.: A Builder class for Story ! * [...2358 lines suppressed...] ! AUTHOR_NAME => $this->db->Record[author_name] ! )); ! $this->template->set_var(AUTHOR_SELECTED,""); ! if ($this->db->Record[author_id] == $user_id ){ ! $this->template->set_var(AUTHOR_SELECTED,"SELECTED"); ! } ! ! $this->template->parse("author_rows","author_row",true); ! } ! ! } ! $description = sprintf( "%s (%s) added new story %s as userid %s", $this->auth->auth['uname'], $this->auth->auth['uid'], $story_id, $user_id); ! logwrite("Story Admin", $description); ! $this->template->parse(OUT,array("newstory")); ! $this->template->p(OUT); ! ! } ! ! } ! ?> Index: Topic.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Topic.class,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Topic.class 2001/12/12 11:38:30 1.8 --- Topic.class 2001/12/14 03:58:18 1.9 *************** *** 1,462 **** ! <?php ! ! /* $Id$ */ ! ! /** ! * Provides an API to the PHPSlash Topic Management. ! * ! * This object is how we do anything with topics. ! * ! */ ! ! class Topic { ! var $topic_templ; /* the template object */ ! var $db; /* the db object */ ! var $perm; /* our local version of the perm object */ ! var $psl; /* our local version of the _PSL array */ ! ! /** ! * The Section Constructor ! * ! * sets up the local version of the global _PSL array, the templates ! * and a few other things ! * @access private ! */ ! function Topic () { ! ! global $perm, $_PSL, $amp; ! ! $this->db = new slashDB; ! $this->perm = $perm; ! $this->psl = $_PSL; ! ! ! /* Templates */ ! $this->topic_templ = new Template($this->psl[templatedir]); ! $this->topic_templ->debug = 0; ! $this->topic_templ->set_file(array( ! listtopic => "topicList.tpl", ! newtopic => "topicNew.tpl" ! )); ! } ! ! /* ! * METHODS ! */ ! ! /** ! * listTopic - list all Topics ! * ! * displays the complete list of topics ! * Used only by admin ! * @access public ! */ ! function listTopic() { ! ! $q = "SELECT * ! FROM psl_topic ! ORDER BY topic_name"; ! $this->db->query($q); ! ! titlebar("100%","Change existing Topics"); ! ! $this->topic_templ->set_block("listtopic","row","rows"); ! ! while ($this->db->next_record()) { ! ! $image = $this->psl[topicimageurl] . "/" . $this->db->Record[image]; ! $topic_id = $this->db->Record[topic_id]; ! if ($this->perm->have_perm("topic,root")) { ! $admin = "<A HREF=\"" . $this->psl[phpself] . "?submit=edit" . $this->psl[amp] . "topic_id=$topic_id\">[Edit]</A>"; ! $admin .= " <A HREF=\"" . $this->psl[phpself] . "?submit=delete" . $this->psl[amp] . "topic_id=$topic_id\">[Delete]</A>"; ! ! } else { ! $admin = " <A HREF=\"" . $this->psl[phpself] . "?submit=delete" . $this->psl[amp] . "topic_id=$topic_id\">[Delete]</A>"; ! } ! $this->topic_templ->set_var(array( ! IMAGE_SRC => $image, ! TOPIC_NAME => $this->db->Record[topic_name], ! WIDTH => $this->db->Record[width], ! HEIGHT => $this->db->Record[height], ! IMAGE => $this->db->Record[image], ! ONLINKBAR => $this->db->Record[onlinkbar], ! ALT_TEXT => $this->db->Record[alt_text], ! TOPIC_ID => $topic_id, ! ACTION_URL => $this->psl[phpself], ! ADMIN => $admin ! )); ! $this->topic_templ->parse("rows","row",true); ! }; ! $this->topic_templ->parse(OUT,array("listtopic")); ! $this->topic_templ->p(OUT); ! } ! ! ! /** ! * saveTopic - save the topic info to the DB ! * ! * Saves the topic in the $ary array to the DB ! * Obligatory fields: topic_name, image, width, height, alt_text ! * Optional fields: topic_id (only if this topic is already in the DB), ! * onlinkbar (if blank, defaults to 0) ! * Returns true if sucessful (topic added or updated), false on error ! * Used only by admin ! * ! * @param array $ary ! * ! * @access public ! */ ! function saveTopic($ary) { ! ! /* we need to check for the stuff to add in the DB before we actually ! * add anything. And yes, I know it looks like I just passed my ! * "Intro to C++ Programming" class. --ajay ! */ ! ! // debug("Topic.class::saveTopic::ary", $ary); ! ! /* We don't test for topic_id because no topic_id means, that ! this is a new topic. */ ! if ($ary[topic_name] == "") { ! error("There is no topic_name in Topic.class::saveTopic"); ! return false; ! } ! if ($ary[image] == "") { ! error("There is no image in Topic.class::saveTopic"); ! return false; ! } ! ! /* calculate height and width */ ! $imagesize = getimagesize( $this->psl[topicimagedir] . "/" . $ary[image]); ! $ary[width] = $imagesize[0]; ! $ary[height] = $imagesize[1]; ! ! ! if ($ary[alt_text] == "") { ! error("There is no alt_text in Topic.class::saveTopic"); ! return false; ! } ! /* doesn't error out anymore. Just defaults 'onlinkbar ! to zero */ ! if ($ary[onlinkbar] == "") { ! $ary[onlinkbar] = "0"; ! } ! ! $ary = clean($ary); ! ! /* if a record exists, then we update, else we insert a new topic! */ ! ! $q = "SELECT topic_id ! FROM psl_topic ! WHERE topic_id = '$ary[topic_id]'"; ! $this->db->query($q); ! if ($this->db->next_record()) { ! $q = "UPDATE psl_topic ! SET topic_name = '$ary[topic_name]', ! image = '$ary[image]', ! width = '$ary[width]', ! height = '$ary[height]', ! alt_text = '$ary[alt_text]', ! onlinkbar = '$ary[onlinkbar]' ! WHERE topic_id = '$ary[topic_id]'"; ! } else { ! ! $ary[topic_id] = generateID("psl_topic_seq"); ! ! $q = "INSERT INTO psl_topic ! (topic_id, ! topic_name, ! image, ! alt_text, ! width, ! height, ! onlinkbar) ! VALUES ('$ary[topic_id]', ! '$ary[topic_name]', ! '$ary[image]', ! '$ary[alt_text]', ! '$ary[width]', ! '$ary[height]', ! '$ary[onlinkbar]')"; ! } ! ! // echo "<BR><B>QUERY: $q</B><BR>\n"; ! $this->db->query($q); ! return true; ! } ! ! ! /** ! * deleteTopic - deletes the topic info from the db ! * ! * Given the topic_id, it deletes that from the topic table. The ! * psl_topic_lut and psl_topic_submission_lut table must be cleaned ! * first by updating all the stories to point to different topics. It ! * will also check and make sure there are NO stories/submissions ! * associated with this topic before deleting it. Returns true if ! * topic is deleted, false if not. ! * ! * @param integer topic_id ! * ! * @access public ! */ ! function deleteTopic($topic_id) { ! ! $go_ahead = true; /* go ahead and assume this topic should be smoked */ ! ! if (!$topic_id) { ! return false; ! } ! ! /* check for any stories that are associated with this topic */ ! ! $q = "SELECT psl_story.title, ! psl_story.story_id ! FROM psl_story, ! psl_topic_lut ! WHERE psl_story.story_id = psl_topic_lut.story_id ! AND psl_topic_lut.topic_id = '$topic_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $topic_name = $this->db->Record["topic_name"]; ! echo "Sorry, ths story is assigned to this topic:"; ! echo "<FONT COLOR=RED>'$title'</FONT><BR>\n"; ! } ! ! /* check for any submissions that are associated with this topic */ ! ! $q = "SELECT psl_submission.title, ! psl_submission.story_id ! FROM psl_submission, ! psl_topic_submission_lut ! WHERE psl_submission.story_id = psl_topic_submission_lut.story_id ! AND psl_topic_submission_lut.topic_id = '$topic_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $topic_name = $this->db->Record["topic_name"]; ! echo "Sorry, this submission is assigned to this topic:"; ! echo "<FONT COLOR=RED>'$title'</FONT><BR>\n"; ! } ! ! if (!$go_ahead) { ! return false; ! } else { ! $q = "DELETE ! FROM psl_topic ! WHERE topic_id = '$topic_id'"; ! $this->db->query($q); ! echo "<i>Topic deleted</i>"; ! ! return true; ! } ! } ! ! /** ! * newTopic - spits out a blank form for input ! * ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! * ! * @param array ary ! * @access public ! */ ! function newTopic($ary="") { ! ! if($ary["topic_id"] == "") { ! titlebar("100%","Add a new Topic"); ! $this->topic_templ->set_var(array( ! TOPICIMAGESDIR => $this->psl[topicimagedir], ! TOPIC_ID => "", ! TOPIC_NAME => "", ! ALT_TEXT => "", ! ONLINKBAR => "", ! ACTION_URL => $this->psl[phpself] ! )); ! ! } else { ! titlebar("100%","Edit Topic"); ! $q = "SELECT topic_id, ! topic_name, ! image, ! alt_text, ! onlinkbar ! FROM psl_topic ! WHERE topic_id = '$ary[topic_id]'"; ! $this->db->query($q); ! $this->db->next_record(); ! $this->topic_templ->set_var(array( ! IMAGE_SRC => $image, ! TOPICIMAGESDIR => $this->psl[topicimagedir], ! TOPIC_ID => $this->db->Record["topic_id"], ! TOPIC_NAME => $this->db->Record["topic_name"], ! ALT_TEXT => $this->db->Record["alt_text"], ! ONLINKBAR => $this->db->Record["onlinkbar"], ! ACTION_URL => $this->psl[phpself] ! )); ! } ! ! $this->topic_templ->set_block("newtopic","image_row","image_rows"); ! ! $fulldirlist = dir($this->psl[topicimagedir]); ! while( $eachfile = $fulldirlist->read()) { ! $each = $this->psl[topicimagedir] . "/" . $eachfile; ! if( (is_file($each)) AND ! ( $each != ".") AND ! ( $each != "..") AND ! ( $each != "CVS") ) { ! $this->topic_templ->set_var(array( ! IMAGE => $eachfile ! )); ! $this->topic_templ->set_var(IMAGE_SELECTED,""); ! if ($this->db->Record[image] == $eachfile ){ ! $this->topic_templ->set_var(IMAGE_SELECTED,"SELECTED"); ! } ! ! $this->topic_templ->parse("image_rows","image_row",true); ! } ! } ! ! $this->topic_templ->parse(OUT,array("newtopic")); ! $this->topic_templ->p(OUT); ! ! } ! ! /** ! * displayTopics - display a list of all available topic images ! * ! * displays the complete list of available topic images ! * Used only by admin ! * ! * @param string option ! * @access public ! */ ! function displayTopics($option="") { ! ! $this->topic_templ = new Template($this->psl[templatedir]); ! $this->topic_templ->debug = 0; ! $this->topic_templ->set_file(array( ! displaytopics => "topicsDisplay.tpl" ! )); ! ! titlebar("100%","Display Topic Images"); ! ! if( $option != "all") { ! echo "<A HREF=" . $this->psl[phpself] . "?submit=display" . $this->psl[amp] . "option=all>[Display all possible topic images]</A>"; ! } else { ! ! $this->topic_templ->set_block("displaytopics","row","rows"); ! ! $fulldirlist = dir($this->psl[topicimagedir]); ! while( $eachfile = $fulldirlist->read()) { ! $each = $this->psl[topicimagedir] . "/" . $eachfile; ! if( (is_file($each)) AND ! ( $each != ".") AND ! ( $each != "..") AND ! ( $each != "CVS") ) { ! ! /* calculate height and width */ ! $imagesize = getimagesize($this->psl[topicimagedir] . "/" . $eachfile); ! $width = $imagesize[0]; ! $height = $imagesize[1]; ! ! $imageurlpath = $this->psl[topicimageurl] . "/" . $eachfile; ! ! $this->topic_templ->set_var(array( ! IMAGE_SRC => $imageurlpath, ! IMAGE => $eachfile, ! WIDTH => $width, ! HEIGHT => $height ! )); ! ! $this->topic_templ->parse("rows","row",true); ! } ! } ! ! $this->topic_templ->parse(OUT,array("displaytopics")); ! $this->topic_templ->p(OUT); ! } ! } ! ! /** ! * getName - return name assign to id ! * ! * when given a topic id, getName returns the name ! * ! * @param integer id ! * @access public ! * return author_name ! */ ! function getName($id) { ! if (!$id) { ! return false; ! } else { ! $q = "SELECT topic_name ! FROM psl_topic ! WHERE topic_id = '$id'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("topic_name"); ! }; ! } ! ! /** ! * getId - return id assign to name ! * ! * when given a name, getId returns the id ! * ! * @param string name ! * @access public ! * return topic_id ! */ ! function getId($name) { ! if (!$name) { ! return false; ! } else { ! $q = "SELECT topic_id ! FROM psl_topic ! WHERE topic_name = '$name'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("topic_id"); ! }; ! } ! ! /** ! * topicSelect - spit out topic select box ! * ! * ! * @param string varname ! * @param string selected ! * @access public ! * return output ! */ ! function topicSelect($varname,$selected) { ! ! $q = "SELECT topic_id, topic_name ! FROM psl_topic"; ! $this->db->query($q); ! $output = "<SELECT NAME=\"$varname\">\n"; ! $output .= " <OPTION VALUE=\"\">All</OPTION>\n"; ! while ($this->db->next_record()) { ! $id = $this->db->f("topic_id"); ! $name = $this->db->f("topic_name"); ! $output .= " <OPTION VALUE=\"$id\" "; ! if ($id == $selected) { ! $output .= " SELECTED"; ! } ! $output .= ">$name</OPTION>\n"; ! } ! $output .= "</SELECT>\n"; ! return $output; ! } ! ! ! } /* end of Topic.class */ ! ?> --- 1,457 ---- ! <?php ! ! /* $Id$ */ ! ! /** ! * Provides an API to the PHPSlash Topic Management. ! * ! * This object is how we do anything with topics. ! * ! */ ! ! class Topic { ! var $topic_templ; /* the template object */ ! var $db; /* the db object */ ! var $perm; /* our local version of the perm object */ ! var $psl; /* our local version of the _PSL array */ ! ! /** ! * The Section Constructor ! * ! * sets up the local version of the global _PSL array, the templates ! * and a few other things ! * @access private ! */ ! function Topic () { ! ! global $perm, $_PSL, $amp; ! ! $this->db = new slashDB; ! $this->perm = $perm; ! $this->psl = $_PSL; ! ! ! /* Templates */ ! $this->topic_templ = new Template($this->psl[templatedir]); ! $this->topic_templ->debug = 0; ! $this->topic_templ->set_file(array( ! listtopic => "topicList.tpl", ! newtopic => "topicNew.tpl" ! )); ! } ! ! /* ! * METHODS ! */ ! ! /** ! * listTopic - list all Topics ! * ! * displays the complete list of topics ! * Used only by admin ! * @access public ! */ ! function listTopic() { ! ! $q = "SELECT * ! FROM psl_topic ! ORDER BY topic_name"; ! $this->db->query($q); ! ! titlebar("100%","Change existing Topics"); ! ! $this->topic_templ->set_block("listtopic","row","rows"); ! ! while ($this->db->next_record()) { ! ! $image = $this->psl[topicimageurl] . "/" . $this->db->Record[image]; ! $topic_id = $this->db->Record[topic_id]; ! if ($this->perm->have_perm("topic,root")) { ! $admin = "<A HREF=\"" . $this->psl[phpself] . "?submit=edit" . $this->psl[amp] . "topic_id=$topic_id\">[Edit]</A>"; ! $admin .= " <A HREF=\"" . $this->psl[phpself] . "?submit=delete" . $this->psl[amp] . "topic_id=$topic_id\">[Delete]</A>"; ! ! } else { ! $admin = " <A HREF=\"" . $this->psl[phpself] . "?submit=delete" . $this->psl[amp] . "topic_id=$topic_id\">[Delete]</A>"; ! } ! $this->topic_templ->set_var(array( ! IMAGE_SRC => $image, ! TOPIC_NAME => $this->db->Record[topic_name], ! WIDTH => $this->db->Record[width], ! HEIGHT => $this->db->Record[height], ! IMAGE => $this->db->Record[image], ! ONLINKBAR => $this->db->Record[onlinkbar], ! ALT_TEXT => $this->db->Record[alt_text], ! TOPIC_ID => $topic_id, ! ACTION_URL => $this->psl[phpself], ! ADMIN => $admin ! )); ! $this->topic_templ->parse("rows","row",true); ! }; ! $this->topic_templ->parse(OUT,array("listtopic")); ! $this->topic_templ->p(OUT); ! } ! ! ! /** ! * saveTopic - save the topic info to the DB ! * ! * Saves the topic in the $ary array to the DB ! * Obligatory fields: topic_name, image, width, height, alt_text ! * Optional fields: topic_id (only if this topic is already in the DB), ! * onlinkbar (if blank, defaults to 0) ! * Returns true if sucessful (topic added or updated), false on error ! * Used only by admin ! * ! * @param array $ary ! * ! * @access public ! */ ! function saveTopic($ary) { ! ! /* we need to check for the stuff to add in the DB before we actually ! * add anything. And yes, I know it looks like I just passed my ! * "Intro to C++ Programming" class. --ajay ! */ ! ! // debug("Topic.class::saveTopic::ary", $ary); ! ! /* We don't test for topic_id because no topic_id means, that ! this is a new topic. */ ! if ($ary[topic_name] == "") { ! error("There is no topic_name in Topic.class::saveTopic"); ! return false; ! } ! if ($ary[image] == "") { ! error("There is no image in Topic.class::saveTopic"); ! return false; ! } ! ! /* calculate height and width */ ! $imagesize = getimagesize( $this->psl[topicimagedir] . "/" . $ary[image]); ! $ary[width] = $imagesize[0]; ! $ary[height] = $imagesize[1]; ! ! ! if ($ary[alt_text] == "") { ! error("There is no alt_text in Topic.class::saveTopic"); ! return false; ! } ! /* doesn't error out anymore. Just defaults 'onlinkbar ! to zero */ ! if ($ary[onlinkbar] == "") { ! $ary[onlinkbar] = "0"; ! } ! ! $ary = clean($ary); ! ! /* if a record exists, then we update, else we insert a new topic! */ ! ! $q = "SELECT topic_id ! FROM psl_topic ! WHERE topic_id = '$ary[topic_id]'"; ! $this->db->query($q); ! if ($this->db->next_record()) { ! $q = "UPDATE psl_topic ! SET topic_name = '$ary[topic_name]', ! image = '$ary[image]', ! width = '$ary[width]', ! height = '$ary[height]', ! alt_text = '$ary[alt_text]', ! onlinkbar = '$ary[onlinkbar]' ! WHERE topic_id = '$ary[topic_id]'"; ! } else { ! ! $ary[topic_id] = generateID("psl_topic_seq"); ! ! $q = "INSERT INTO psl_topic ! (topic_id, ! topic_name, ! image, ! alt_text, ! width, ! height, ! onlinkbar) ! VALUES ('$ary[topic_id]', ! '$ary[topic_name]', ! '$ary[image]', ! '$ary[alt_text]', ! '$ary[width]', ! '$ary[height]', ! '$ary[onlinkbar]')"; ! } ! ! // echo "<BR><B>QUERY: $q</B><BR>\n"; ! $this->db->query($q); ! return true; ! } ! ! ! /** ! * deleteTopic - deletes the topic info from the db ! * ! * Given the topic_id, it deletes that from the topic table. The ! * psl_topic_lut and psl_topic_submission_lut table must be cleaned ! * first by updating all the stories to point to different topics. It ! * will also check and make sure there are NO stories/submissions ! * associated with this topic before deleting it. Returns true if ! * topic is deleted, false if not. ! * ! * @param integer topic_id ! * ! * @access public ! */ ! function deleteTopic($topic_id) { ! ! $go_ahead = true; /* go ahead and assume this topic should be smoked */ ! ! if (!$topic_id) { ! return false; ! } ! ! /* check for any stories that are associated with this topic */ ! ! $q = "SELECT psl_story.title, ! psl_story.story_id ! FROM psl_story, ! psl_topic_lut ! WHERE psl_story.story_id = psl_topic_lut.story_id ! AND psl_topic_lut.topic_id = '$topic_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $topic_name = $this->db->Record["topic_name"]; ! echo "Sorry, ths story is assigned to this topic:"; ! echo "<font color=\"red\">'$title'</font><br />\n"; ! } ! ! /* check for any submissions that are associated with this topic */ ! ! $q = "SELECT psl_submission.title, ! psl_submission.story_id ! FROM psl_submission, ! psl_topic_submission_lut ! WHERE psl_submission.story_id = psl_topic_submission_lut.story_id ! AND psl_topic_submission_lut.topic_id = '$topic_id'"; ! $this->db->query($q); ! while ($this->db->next_record()) { ! $go_ahead = false; ! $title = $this->db->Record["title"]; ! $story_id = $this->db->Record["story_id"]; ! $topic_name = $this->db->Record["topic_name"]; ! echo "Sorry, this submission is assigned to this topic:"; ! echo "<font color=\"red\">'$title'</font><br />\n"; ! } ! ! if (!$go_ahead) { ! return false; ! } else { ! $q = "DELETE ! FROM psl_topic ! WHERE topic_id = '$topic_id'"; ! $this->db->query($q); ! echo "<i>Topic deleted</i>"; ! ! return true; ! } ! } ! ! /** ! * newTopic - spits out a blank form for input ! * ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! * ! * @param array ary ! * @access public ! */ ! function newTopic($ary="") { ! ! if($ary["topic_id"] == "") { ! titlebar("100%","Add a new Topic"); ! $this->topic_templ->set_var(array( ! TOPICIMAGESDIR => $this->psl[topicimagedir], ! TOPIC_ID => "", ! TOPIC_NAME => "", ! ALT_TEXT => "", ! ONLINKBAR => "", ! ACTION_URL => $this->psl[phpself] ! )); ! ! } else { ! titlebar("100%","Edit Topic"); ! $q = "SELECT topic_id, ! topic_name, ! image, ! alt_text, ! onlinkbar ! FROM psl_topic ! WHERE topic_id = '$ary[topic_id]'"; ! $this->db->query($q); ! $this->db->next_record(); ! $this->topic_templ->set_var(array( ! IMAGE_SRC => $image, ! TOPICIMAGESDIR => $this->psl[topicimagedir], ! TOPIC_ID => $this->db->Record["topic_id"], ! TOPIC_NAME => $this->db->Record["topic_name"], ! ALT_TEXT => $this->db->Record["alt_text"], ! ONLINKBAR => $this->db->Record["onlinkbar"], ! ACTION_URL => $this->psl[phpself] ! )); ! } ! ! $this->topic_templ->set_block("newtopic","image_row","image_rows"); ! ! $fulldirlist = dir($this->psl[topicimagedir]); ! while( $eachfile = $fulldirlist->read()) { ! $each = $this->psl[topicimagedir] . "/" . $eachfile; ! if( (is_file($each)) AND ! ( $each != ".") AND ! ( $each != "..") AND ! ( $each != "CVS") ) { ! $this->topic_templ->set_var(array( ! IMAGE => $eachfile ! )); ! $this->topic_templ->set_var(IMAGE_SELECTED,""); ! if ($this->db->Record[image] == $eachfile ){ ! $this->topic_templ->set_var(IMAGE_SELECTED,"SELECTED"); ! } ! ! $this->topic_templ->parse("image_rows","image_row",true); ! } ! } ! ! $this->topic_templ->parse(OUT,array("newtopic")); ! $this->topic_templ->p(OUT); ! ! } ! ! /** ! * displayTopics - display a list of all available topic images ! * ! * displays the complete list of available topic images ! * Used only by admin ! * ! * @param string option ! * @access public ! */ ! function displayTopics($option="") { ! ! $this->topic_templ = new Template($this->psl[templatedir]); ! $this->topic_templ->debug = 0; ! $this->topic_templ->set_file(array( ! displaytopics => "topicsDisplay.tpl" ! )); ! ! titlebar("100%","Display Topic Images"); ! ! if( $option != "all") { ! echo "<A HREF=" . $this->psl[phpself] . "?submit=display" . $this->psl[amp] . "option=all>[Display all possible topic images]</A>"; ! } else { ! ! $this->topic_templ->set_block("displaytopics","row","rows"); ! ! $fulldirlist = dir($this->psl[topicimagedir]); ! while( $eachfile = $fulldirlist->read()) { ! $each = $this->psl[topicimagedir] . "/" . $eachfile; ! if( (is_file($each)) AND ! ( $each != ".") AND ! ( $each != "..") AND ! ( $each != "CVS") ) { ! ! /* calculate height and width */ ! $imagesize = getimagesize($this->psl[topicimagedir] . "/" . $eachfile); ! $width = $imagesize[0]; ! $height = $imagesize[1]; ! ! $imageurlpath = $this->psl[topicimageurl] . "/" . $eachfile; ! ! $this->topic_templ->set_var(array( ! IMAGE_SRC => $imageurlpath, ! IMAGE => $eachfile, ! WIDTH => $width, ! HEIGHT => $height ! )); ! ! $this->topic_templ->parse("rows","row",true); ! } ! } ! ! $this->topic_templ->parse(OUT,array("displaytopics")); ! $this->topic_templ->p(OUT); ! } ! } ! ! /** ! * getName - return name assign to id ! * ! * when given a topic id, getName returns the name ! * ! * @param integer id ! * @access public ! * return author_name ! */ ! function getName($id) { ! if (!$id) { ! return false; ! } else { ! $q = "SELECT topic_name ! FROM psl_topic ! WHERE topic_id = '$id'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("topic_name"); ! }; ! } ! ! /** ! * getId - return id assign to name ! * ! * when given a name, getId returns the id ! * ! * @param string name ! * @access public ! * return topic_id ! */ ! function getId($name) { ! if (!$name) { ! return false; ! } else { ! $q = "SELECT topic_id ! FROM psl_topic ! WHERE topic_name = '$name'"; ! $this->db->query($q); ! $this->db->next_record(); ! return $this->db->f("topic_id"); ! }; ! } ! ! ! /** ! * getTopics - returns array with topic ids and names ! * ! * ! * @access public ! * return topic_array(id, name) ! */ ! function getTopics() { ! ! $q = "SELECT topic_id, topic_name ! FROM psl_topic ! ORDER BY topic_name"; ! $this->db->query($q); ! ! while ($this->db->next_record()) { ! $topic_array[] = array( ! "id" => $this->db->f("topic_id"), ! "name" => $this->db->f("topic_name") ! ); ! } ! ! return $topic_array; ! } ! ! } /* end of Topic.class */ ! ?> |
From: Joe S. <joe...@us...> - 2001-12-14 03:58:21
|
Update of /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default In directory usw-pr-cvs1:/tmp/cvs-serv24795/phpslash-ft/public_html/templates/en/default Modified Files: storyList.tpl Log Message: Moved the select boxes of storylist.tpl to the template Index: storyList.tpl =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default/storyList.tpl,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** storyList.tpl 2001/10/17 17:11:27 1.4 --- storyList.tpl 2001/12/14 03:58:18 1.5 *************** *** 1,51 **** ! <!-- STORYLIST.TPL --> ! <FORM ACTION="{ACTION_URL}" METHOD="POST"> ! <INPUT TYPE="submit" NAME="submit" VALUE="new"> ! ! <BR> ! ! {AUTHOR_SELECT} ! {TOPIC_SELECT} ! {SECTION_SELECT} ! <INPUT TYPE="submit" NAME="submit" VALUE="modify"> ! ! <BR> ! ! <TABLE CELLPADDING=2 CELLSPACING=1 BORDER=0> ! <TR> ! <TH>CNT</TH> ! <TH>Title</TH> ! <TH>Author</TH> ! <TH>Hits / Comments</TH> ! <TH>Date</TH> ! <TH>Admin</TH> ! </TR> ! ! <!-- BEGIN row --> ! <TR> ! <TD ALIGN=CENTER> ! <FONT SIZE=2><B>{COUNT}</B></FONT> ! </TD> ! <TD> ! {TITLE} ! </TD> ! <TD> ! by <B>{AUTHOR}</B> ! </TD> ! <TD ALIGN=CENTER> ! ({HITS}/{COMMENTCOUNT}) ! </TD> ! <TD> ! <FONT FACE=courier>{DATE}</FONT> ! </TD> ! <TD> ! <A HREF="{MODIFYURL}">Modify</A> || <A HREF="{VIEWURL}">View</A> || <A HREF="{DELETEURL}">Delete</A> ! </TD> ! </TR> ! <!-- END row --> ! ! </TABLE> ! <P><B>{MORE_LINK}</B> ! ! </FORM> ! <!-- STORYLIST.TPL --> --- 1,65 ---- ! <!-- STORYLIST.TPL --> ! <FORM ACTION="{ACTION_URL}" METHOD="POST"> ! <INPUT TYPE="submit" NAME="submit" VALUE="new"> ! ! <BR> ! ! <select name="author_id"> ! <!-- BEGIN each_author --> ! <option value="{AUTHOR_ID}" {SELECTED}>{AUTHOR_NAME}</option> ! <!-- END each_author --> ! </select> ! ! <select name="topic_id"> ! <!-- BEGIN each_topic --> ! <option value="{TOPIC_ID}" {SELECTED}>{TOPIC_NAME}</option> ! <!-- END each_topic --> ! </select> ! ! <select name="section_id"> ! <!-- BEGIN each_section --> ! <option value="{SECTION_ID}" {SELECTED}>{SECTION_NAME}</option> ! <!-- END each_section --> ! </select> ! <INPUT TYPE="submit" NAME="submit" VALUE="modify"> ! ! <BR> ! ! <TABLE CELLPADDING=2 CELLSPACING=1 BORDER=0> ! <TR> ! <TH>CNT</TH> ! <TH>Title</TH> ! <TH>Author</TH> ! <TH>Hits / Comments</TH> ! <TH>Date</TH> ! <TH>Admin</TH> ! </TR> ! ! <!-- BEGIN row --> ! <TR> ! <TD ALIGN=CENTER> ! <FONT SIZE=2><B>{COUNT}</B></FONT> ! </TD> ! <TD> ! {TITLE} ! </TD> ! <TD> ! by <B>{AUTHOR}</B> ! </TD> ! <TD ALIGN=CENTER> ! ({HITS}/{COMMENTCOUNT}) ! </TD> ! <TD> ! <FONT FACE=courier>{DATE}</FONT> ! </TD> ! <TD> ! <A HREF="{MODIFYURL}">Modify</A> || <A HREF="{VIEWURL}">View</A> || <A HREF="{DELETEURL}">Delete</A> ! </TD> ! </TR> ! <!-- END row --> ! ! </TABLE> ! <P><B>{MORE_LINK}</B> ! ! </FORM> ! <!-- STORYLIST.TPL --> |
From: Joe S. <joe...@us...> - 2001-12-11 15:33:24
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv10154/phpslash-ft/class Modified Files: Infolog.class functions.inc Story.class Log Message: infolog uses _PSL now Index: Infolog.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Infolog.class,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Infolog.class 2001/05/15 22:36:15 1.1 --- Infolog.class 2001/12/11 15:33:21 1.2 *************** *** 11,22 **** class Infolog { ! var $templ; ! var $db; ! /* * CONSTRUCTORS */ function Infolog () { ! global $basedir,$rootdir, $templatedir; /* Start a db */ --- 11,23 ---- class Infolog { ! var $templ, $db, $psl; ! /* * CONSTRUCTORS */ function Infolog () { ! global $_PSL; ! ! $this->psl = $_PSL; /* Start a db */ *************** *** 24,28 **** /* Templates */ ! $this->templ = new Template($templatedir); $this->templ->debug = 0; $this->templ->set_file(array( --- 25,29 ---- /* Templates */ ! $this->templ = new Template($this->psl['templatedir']); $this->templ->debug = 0; $this->templ->set_file(array( *************** *** 36,40 **** function pageOut() { - global $PHP_SELF; $this->templ->set_block("infolog","row","rows"); --- 37,40 ---- *************** *** 42,46 **** while ($this->db->next_record()) { $this->templ->set_var(array( ! ACTION_URL => $PHP_SELF, INFOLOG_ID => $this->db->Record[id], INFOLOG_TIME => $this->db->Record[time], --- 42,46 ---- while ($this->db->next_record()) { $this->templ->set_var(array( ! ACTION_URL => $this->psl['phpself'], INFOLOG_ID => $this->db->Record[id], INFOLOG_TIME => $this->db->Record[time], *************** *** 51,55 **** } $this->templ->set_var(array( ! ACTION_URL => $PHP_SELF )); $this->templ->parse(OUT,array("infolog")); --- 51,55 ---- } $this->templ->set_var(array( ! ACTION_URL => $this->psl['phpself'] )); $this->templ->parse(OUT,array("infolog")); Index: functions.inc =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/functions.inc,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** functions.inc 2001/12/06 20:16:44 1.83 --- functions.inc 2001/12/11 15:33:21 1.84 *************** *** 241,247 **** Function : logwrite() Use: : Logs actions for admin evaluation later (adds time to entry) ! Parameters : $description => A short description of the loged data (ie: Admin Login, Story Added) ! $data => The actualt data to log (ie: admin login by $author_name ($author_id) (ie: Story $story_title added by $author_name) --- 241,247 ---- Function : logwrite() Use: : Logs actions for admin evaluation later (adds time to entry) ! Parameters : $description => A short description of the logged data (ie: Admin Login, Story Added) ! $data => The actual data to log (ie: admin login by $author_name ($author_id) (ie: Story $story_title added by $author_name) *************** *** 249,255 **** function logwrite($description,$data) { ! global $infolog_enable; ! if ($infolog_enable) { // Init vars (we don't like warnings :) $fdate = date("Y-m-d H:i:s",time()); --- 249,255 ---- function logwrite($description,$data) { ! global $_PSL; ! if ($_PSL[use_infolog]) { // Init vars (we don't like warnings :) $fdate = date("Y-m-d H:i:s",time()); Index: Story.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Story.class,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Story.class 2001/12/07 21:23:25 1.24 --- Story.class 2001/12/11 15:33:21 1.25 *************** *** 1151,1156 **** } ! ! logwrite("Story Admin", "$author_name ($author_id) added new story $story_id"); $this->template->parse(OUT,array("newstory")); $this->template->p(OUT); --- 1151,1156 ---- } ! $description = sprintf( "%s (%s) added new story %s as userid %s", $this->auth->auth['uname'], $this->auth->auth['uid'], $story_id, $user_id); ! logwrite("Story Admin", $description); $this->template->parse(OUT,array("newstory")); $this->template->p(OUT); |
From: Joe S. <joe...@us...> - 2001-12-11 15:33:24
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv10154/phpslash-ft Modified Files: CHANGES Log Message: infolog uses _PSL now Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.339 retrieving revision 1.340 diff -C2 -d -r1.339 -r1.340 *** CHANGES 2001/12/10 21:42:36 1.339 --- CHANGES 2001/12/11 15:33:21 1.340 *************** *** 13,16 **** --- 13,20 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-11 9:30AM CST Joe Stewart <jo...@be...> + [B] - Infolog.class, functions,inc - removed globals. + Story.class - corrected logwrite to show user name and id. + 2001-Dec-10 4:350PM CST Joe Stewart <jo...@be...> [T] - Glossary.class, glossarySearch.tpl - patched in Lars Heuers changes |
From: Joe S. <joe...@us...> - 2001-12-10 21:45:39
|
Update of /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default In directory usw-pr-cvs1:/tmp/cvs-serv19828 Modified Files: glossarySearch.tpl Log Message: bugfix - moved Glossaryt color defs to template Index: glossarySearch.tpl =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/public_html/templates/en/default/glossarySearch.tpl,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** glossarySearch.tpl 2000/10/27 20:20:11 1.1 --- glossarySearch.tpl 2001/12/10 21:45:37 1.2 *************** *** 1,27 **** ! <!-- start glossarySearch.tpl --> ! <p> ! <b><a href="{ACTION_URL}">The Full Glossary</a></b> ! <p> ! ! <FORM action="{ACTION_URL}" method="get"> ! <b>Glossary:</b> ! <INPUT type="TEXT" size="11" name="search" value="{SEARCH}"> ! <INPUT type="SUBMIT" value="Search"> ! </FORM> ! ! <TABLE BORDER=1 CELLPADDING=1 CELLSPACING=0 WIDTH="100%" BORDERCOLOR="#5B69A6"> ! <TR> ! <TD bgcolor=#ECECFF><b>Term</b></td> ! <TD bgcolor=#ECECFF><b>Definition</b> ! </TR> ! ! <!-- BEGIN row --> ! <TR> ! <TD bgcolor="{CELL_COLOR}"><B>{TERM}</B></TD> ! <TD bgcolor="{CELL_COLOR}">{DEF}</TD> ! </TR> ! <!-- END row --> ! ! </TABLE> ! ! <!-- end glossarySearch.tpl --> --- 1,30 ---- ! <!-- glossarySearch.tpl BEGIN --> ! <p> ! <b><a href="{ACTION_URL}">The Full Glossary</a></b> ! </p> ! <p> ! </p> ! <form action="{ACTION_URL}" method="get"> ! <b>Glossary:</b> ! <input type="TEXT" size="11" name="search" value="{SEARCH}" /> ! <input type="SUBMIT" value="Search" /> ! </form> ! <table border="1" cellpadding="1" cellspacing="0" width="100%" bordercolor="#5B69A6"> ! <tr bgcolor="#ECECFF"> ! <td><b>Term</b></td> ! <td><b>Definition</b></td> ! </tr> ! <!-- BEGIN first_row --> ! <tr bgcolor="#ECECFF"> ! <td><b>{FIRST_TERM}</b></td> ! <td>{FIRST_DEF}</td> ! </tr> ! <!-- END first_row --> ! <!-- BEGIN second_row --> ! <tr bgcolor="#F7F7F7"> ! <td><b>{SECOND_TERM}</b></td> ! <td>{SECOND_DEF}</td> ! </tr> ! <!-- END second_row --> ! </table> ! <!-- glossarySearch.tpl END --> |
From: Joe S. <joe...@us...> - 2001-12-10 21:42:39
|
Update of /cvsroot/phpslash/phpslash-ft/class In directory usw-pr-cvs1:/tmp/cvs-serv19006/phpslash-ft/class Modified Files: Glossary.class Log Message: bugfix - moved Glossaryt color defs to template Index: Glossary.class =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/class/Glossary.class,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Glossary.class 2001/11/23 18:00:44 1.5 --- Glossary.class 2001/12/10 21:42:36 1.6 *************** *** 1,208 **** ! <?php ! ! /* $Id$ */ ! ! /* ! * Class: Glossary ! * ! * Layer: All ! * Desc.: ! * ! */ ! class Glossary { ! var $templ,$db,$cell_color_1,$cell_color_2,$psl; ! ! /* ! * CONSTRUCTORS ! */ ! function Glossary () { ! ! global $_PSL; ! ! $this->db = new slashDB; ! $this->psl = $_PSL; ! ! $this->cell_color_1 = "#ECECFF"; ! $this->cell_color_2 = "#F7F7F7"; ! ! /* Templates */ ! $this->templ = new Template($this->psl[templatedir]); ! $this->templ->debug = 0; ! $this->templ->set_file(array( ! listglossary => "glossaryList.tpl", ! searchglossary => "glossarySearch.tpl", ! newglossary => "glossaryNew.tpl" ! )); ! ! } ! ! /* ! * METHODS ! */ ! ! /* ! * Just prints the form with the list of existing glossarys ! * Used only by admin ! */ ! function listGlossary() { ! ! $q = "SELECT * ! FROM psl_glossary ! ORDER BY term"; ! $this->db->query($q); ! ! titlebar("100%","Glossary Edit"); ! ! $this->templ->set_block("listglossary","row","rows"); ! ! while ($this->db->next_record()) { ! $this->templ->set_var(array( ! ACTION_URL => $this->psl[phpself], ! ID => $this->db->f("id"), ! TERM => $this->db->f("term"), ! DEF => $this->db->f("def") ! )); ! $this->templ->parse("rows","row",true); ! }; ! $this->templ->parse(OUT,array("listglossary")); ! $this->templ->p(OUT); ! } ! ! /* ! * Saves the glossary in the $ary array to the DB ! * Obligatory fields: ! * Optional fields: ! * ! * Returns true if sucessful (glossary added or updated), false on error ! * Used only by admin ! */ ! function saveGlossary($ary) { ! ! /* we need to check for the stuff to add in the DB before we actually ! * add anything. And yes, I know it looks like I just passed my ! * "Intro to C++ Programming" class. --ajay ! */ ! ! /* We don't test for id because no id means, that this is a new term. */ ! if ($ary[term] == "") { ! error("There is no term in Glossary.class::saveGlossary"); ! return false; ! } ! if ($ary[def] == "") { ! error("There is no def in Glossary.class::saveGlossary"); ! return false; ! } ! ! $ary = clean($ary); ! ! /* if a record exists, then we update, else we insert a new glossary! */ ! ! $q = "SELECT id ! FROM psl_glossary ! WHERE id = '$ary[id]'"; ! # echo "QUERY: $q<BR>\n"; ! $this->db->query($q); ! if ($this->db->next_record()) { ! ! echo "updating RECORD: " . $ary[id] . "<BR><BR>"; ! ! $q = "UPDATE psl_glossary ! SET term = '$ary[term]', ! def = '$ary[def]' ! WHERE id = '$ary[id]'"; ! } else { ! ! $ary[id] = generateID("psl_glossary_seq"); ! ! $q = "INSERT INTO psl_glossary ! (id, ! term, ! def) ! VALUES ('$ary[id]', ! '$ary[term]', ! '$ary[def]')"; ! } ! ! # echo "<BR><B>QUERY: $q</B><BR>\n"; ! $this->db->query($q); ! return true; ! } ! ! /* Given the glossary_id, it deletes that term from the glossary table. */ ! function deleteGlossary($glossary_id) { ! ! if (!$glossary_id) { ! return false; ! } else { ! $q = "DELETE ! FROM psl_glossary ! WHERE id = '$glossary_id'"; ! $this->db->query($q); ! return true; ! } ! } ! ! /* ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! */ ! function newGlossary() { ! ! titlebar("100%",pslgetText("Add a new Term")); ! ! $this->templ->set_var(array( ! ACTION_URL => $this->psl[phpself] ! )); ! ! $this->templ->parse(OUT,array("newglossary")); ! $this->templ->p(OUT); ! ! } ! ! function searchGlossary($search) { ! ! titlebar("100%",pslgetText("Glossary")); ! ! $this->templ->set_var(array( ! ACTION_URL => $this->psl[phpself] ! )); ! ! clean($search); ! ! if ($search == "") { ! $q = "SELECT * ! FROM psl_glossary"; ! } else { ! $q = "SELECT * ! FROM psl_glossary ! WHERE term LIKE '%$search%' ! OR def LIKE '%$search%'"; ! } ! $q .= " ORDER by term"; ! ! $this->db->query($q); ! ! $this->templ->set_block("searchglossary" , "row" , "rows"); ! $i = 0; ! while ($this->db->next_record()) { ! if ($i%2 == 0) { ! $cellcolor = $this->cell_color_1; ! } else { ! $cellcolor = $this->cell_color_2; ! } ! $i++; ! ! $this->templ->set_var(array( ! TERM => $this->db->f("term"), ! DEF => $this->db->f("def"), ! CELL_COLOR => $cellcolor ! )); ! ! $this->templ->parse("rows","row",true); ! } ! $this->templ->parse(OUT,array("searchglossary")); ! $this->templ->p(OUT); ! ! } ! ! }; /* end of Glossary.class */ --- 1,208 ---- ! <?php ! ! /* $Id$ */ ! ! /* ! * Class: Glossary ! * ! * Layer: All ! * Desc.: ! * ! */ ! class Glossary { ! var $templ,$db, $psl; ! ! /* ! * CONSTRUCTORS ! */ ! function Glossary () { ! ! global $_PSL; ! ! $this->db = new slashDB; ! $this->psl = $_PSL; ! ! /* Templates */ ! $this->templ = new Template($this->psl[templatedir]); ! $this->templ->debug = 0; ! $this->templ->set_file(array( ! listglossary => "glossaryList.tpl", ! searchglossary => "glossarySearch.tpl", ! newglossary => "glossaryNew.tpl" ! )); ! ! } ! ! /* ! * METHODS ! */ ! ! /* ! * Just prints the form with the list of existing glossarys ! * Used only by admin ! */ ! function listGlossary() { ! ! $q = "SELECT * ! FROM psl_glossary ! ORDER BY term"; ! $this->db->query($q); ! ! titlebar("100%","Glossary Edit"); ! ! $this->templ->set_block("listglossary","row","rows"); ! ! while ($this->db->next_record()) { ! $this->templ->set_var(array( ! ACTION_URL => $this->psl[phpself], ! ID => $this->db->f("id"), ! TERM => $this->db->f("term"), ! DEF => $this->db->f("def") ! )); ! $this->templ->parse("rows","row",true); ! }; ! $this->templ->parse(OUT,array("listglossary")); ! $this->templ->p(OUT); ! } ! ! /* ! * Saves the glossary in the $ary array to the DB ! * Obligatory fields: ! * Optional fields: ! * ! * Returns true if sucessful (glossary added or updated), false on error ! * Used only by admin ! */ ! function saveGlossary($ary) { ! ! /* we need to check for the stuff to add in the DB before we actually ! * add anything. And yes, I know it looks like I just passed my ! * "Intro to C++ Programming" class. --ajay ! */ ! ! /* We don't test for id because no id means, that this is a new term. */ ! if ($ary[term] == "") { ! error("There is no term in Glossary.class::saveGlossary"); ! return false; ! } ! if ($ary[def] == "") { ! error("There is no def in Glossary.class::saveGlossary"); ! return false; ! } ! ! $ary = clean($ary); ! ! /* if a record exists, then we update, else we insert a new glossary! */ ! ! $q = "SELECT id ! FROM psl_glossary ! WHERE id = '$ary[id]'"; ! # echo "QUERY: $q<BR>\n"; ! $this->db->query($q); ! if ($this->db->next_record()) { ! ! echo "updating RECORD: " . $ary[id] . "<BR><BR>"; ! ! $q = "UPDATE psl_glossary ! SET term = '$ary[term]', ! def = '$ary[def]' ! WHERE id = '$ary[id]'"; ! } else { ! ! $ary[id] = generateID("psl_glossary_seq"); ! ! $q = "INSERT INTO psl_glossary ! (id, ! term, ! def) ! VALUES ('$ary[id]', ! '$ary[term]', ! '$ary[def]')"; ! } ! ! # echo "<BR><B>QUERY: $q</B><BR>\n"; ! $this->db->query($q); ! return true; ! } ! ! /* Given the glossary_id, it deletes that term from the glossary table. */ ! function deleteGlossary($glossary_id) { ! ! if (!$glossary_id) { ! return false; ! } else { ! $q = "DELETE ! FROM psl_glossary ! WHERE id = '$glossary_id'"; ! $this->db->query($q); ! return true; ! } ! } ! ! /* ! * Just prints out the "form" and points the user to the "save" method ! * Used only by admin ! */ ! function newGlossary() { ! ! titlebar("100%",pslgetText("Add a new Term")); ! ! $this->templ->set_var(array( ! ACTION_URL => $this->psl[phpself] ! )); ! ! $this->templ->parse(OUT,array("newglossary")); ! $this->templ->p(OUT); ! ! } ! ! function searchGlossary($search) { ! ! titlebar("100%",pslgetText("Glossary")); ! ! $this->templ->set_var(array( ! ACTION_URL => $this->psl[phpself] ! )); ! ! clean($search); ! ! if ($search == "") { ! $q = "SELECT * ! FROM psl_glossary"; ! } else { ! $q = "SELECT * ! FROM psl_glossary ! WHERE term LIKE '%$search%' ! OR def LIKE '%$search%'"; ! } ! $q .= " ORDER by term"; ! ! $this->db->query($q); ! ! $this->templ->set_block("searchglossary" , "first_row" , "f_rows"); ! $this->templ->set_block("searchglossary" , "second_row" , "s_rows"); ! $i = 0; ! while ($this->db->next_record()) { ! if ($i%2 == 0) { ! $this->templ->set_var(array( ! FIRST_TERM => $this->db->f("term"), ! FIRST_DEF => $this->db->f("def") ! )); ! $this->templ->parse("f_rows","first_row",true); ! } ! else { ! $this->templ->set_var(array( ! SECOND_TERM => $this->db->f("term"), ! SECOND_DEF => $this->db->f("def") ! )); ! $this->templ->parse("f_rows","second_row",true); ! } ! ++$i; ! } ! $this->templ->parse(OUT,array("searchglossary")); ! $this->templ->p(OUT); ! ! } ! ! } /* end of Glossary.class */ ! ?> \ No newline at end of file |
From: Joe S. <joe...@us...> - 2001-12-10 21:42:39
|
Update of /cvsroot/phpslash/phpslash-ft In directory usw-pr-cvs1:/tmp/cvs-serv19006/phpslash-ft Modified Files: CHANGES Log Message: bugfix - moved Glossaryt color defs to template Index: CHANGES =================================================================== RCS file: /cvsroot/phpslash/phpslash-ft/CHANGES,v retrieving revision 1.338 retrieving revision 1.339 diff -C2 -d -r1.338 -r1.339 *** CHANGES 2001/12/10 17:29:12 1.338 --- CHANGES 2001/12/10 21:42:36 1.339 *************** *** 13,16 **** --- 13,20 ---- 9 - Removal of something (kill -9 :) + 2001-Dec-10 4:350PM CST Joe Stewart <jo...@be...> + [T] - Glossary.class, glossarySearch.tpl - patched in Lars Heuers changes + to move the colors to the templates. + 2001-Dec-10 11:30AM CST Joe Stewart <jo...@be...> [B] - Author.class didn't have a closing php tag ( corrected by Lars Heuer) |