From: Javier B. <jb...@us...> - 2004-11-16 17:23:50
|
Update of /cvsroot/openbash-org/openbash-org/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10959/modules Modified Files: Quote.php View.php Log Message: anyadidas vistas para varios tipos de quote y modificadas algunas rutinas Index: View.php =================================================================== RCS file: /cvsroot/openbash-org/openbash-org/modules/View.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** View.php 16 Nov 2004 16:20:20 -0000 1.2 --- View.php 16 Nov 2004 17:23:40 -0000 1.3 *************** *** 30,34 **** global $quote_language;?> <p class="quote"> ! <a href="?page=quote&action=single&id=<?=$id?>" title="<?=$quote_language['permalink']?>"><b>#<?=$id?></b></a> <a href="rox=312" class="qa">+</a>(<?=$points?>) <a href="sux=312" class="qa">-</a> --- 30,34 ---- global $quote_language;?> <p class="quote"> ! <a href="?page=quote&action=single&quote=<?=$id?>" title="<?=$quote_language['permalink']?>"><b>#<?=$id?></b></a> <a href="rox=312" class="qa">+</a>(<?=$points?>) <a href="sux=312" class="qa">-</a> *************** *** 37,39 **** --- 37,67 ---- <p class="qt"><?=$quote?></p><?php } + + function view_pending_quote() + { + global $quote_language;?> + <p class="quote"><?=$quote_language['pending']?></p> + <?php + } + + function view_non_existent_quote() + { + global $quote_language;?> + <p class="quote"><?=$quote_language['non_existent']?></p> + <?php + } + + function inserted_quote($url) + { + global $quote_language;?> + <p class="quote"><?=$quote_language['inserted']?></p> + <?php $this->redirect($url); + } + + function redirect($url) + { ?> + <meta http-equiv=Refresh CONTENT="8; URL=<?=$url?>"> + <?php + } + } Index: Quote.php =================================================================== RCS file: /cvsroot/openbash-org/openbash-org/modules/Quote.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Quote.php 16 Nov 2004 16:20:20 -0000 1.5 --- Quote.php 16 Nov 2004 17:23:40 -0000 1.6 *************** *** 11,14 **** --- 11,15 ---- { include ("config.php"); + $view = new view(); $quote = nl2br(variable_clean($quote)); //$author = check_email($author); *************** *** 16,23 **** $network = variable_clean($network); //$ip = check_ipv4($ip); ! $purge = 0; // by default the quote is not purged, of course xD $pending = 1; // by default quote gets marked as pending until an admin validates it $sql = "INSERT INTO quote ! (`id`,`points`,`quote`,`purge`,`author`,`channel`,`network`,`pending`,`ip`) VALUES ( '', --- 17,24 ---- $network = variable_clean($network); //$ip = check_ipv4($ip); ! $deleted = 0; // by default the quote is not purged, of course xD $pending = 1; // by default quote gets marked as pending until an admin validates it $sql = "INSERT INTO quote ! (`id`,`points`,`deleted`,`purge`,`author`,`channel`,`network`,`pending`,`ip`) VALUES ( '', *************** *** 33,36 **** --- 34,39 ---- $ins = $bd->_Execute($sql); $this->mail_warning($author, $quote, $ip); + $url = '?page=quote&action=single&quote='.$bd->Insert_ID(); + $view->inserted_quote($url); } *************** *** 39,47 **** include ("config.php"); $view = new view(); ! $sql = "SELECT points,quote,author,channel,network,ip FROM quote WHERE id='$id' AND quote.purge=0 AND pending=0"; $quote = $bd->_Execute($sql); if($quote->RecordCount() == 1) { ! $view->view_quote($id, $quote->fields['points'], $quote->fields['quote'], $quote->fields['author'], $quote->fields['channel'], $quote->fields['network'], $quote->fields['ip']); ! } else { return (0); } } --- 42,53 ---- include ("config.php"); $view = new view(); ! $sql = "SELECT points,quote,author,channel,network,ip,pending FROM quote WHERE id='$id' AND deleted=0"; $quote = $bd->_Execute($sql); if($quote->RecordCount() == 1) { ! switch($quote->fields['pending']) { ! case '0': $view->view_quote($id, $quote->fields['points'], $quote->fields['quote'], $quote->fields['author'], $quote->fields['channel'], $quote->fields['network'], $quote->fields['ip']); break; ! case '1': $view->view_pending_quote(); break; ! } ! } else { $view->view_non_existent_quote(); } } *************** *** 49,53 **** { include ("config.php"); ! $sql = "SELECT id FROM quote WHERE quote.purge=0 AND pending=0 ORDER BY id $order LIMIT $start,$end"; $ids = $bd->_Execute($sql); if($ids->RecordCount()) { --- 55,59 ---- { include ("config.php"); ! $sql = "SELECT id FROM quote WHERE deleted=0 AND pending=0 ORDER BY id $order LIMIT $start,$end"; $ids = $bd->_Execute($sql); if($ids->RecordCount()) { *************** *** 59,63 **** { include ("config.php"); ! $sql = "SELECT id FROM quote WHERE quote.purge=0 AND pending=0 ORDER BY points DESC LIMIT $top"; $ids = $bd->_Execute($sql); if($ids->RecordCount()) { --- 65,69 ---- { include ("config.php"); ! $sql = "SELECT id FROM quote WHERE deleted=0 AND pending=0 ORDER BY points DESC LIMIT $top"; $ids = $bd->_Execute($sql); if($ids->RecordCount()) { *************** *** 80,84 **** by: $author ($ip) ! * Please visit the admin page to validate: http://$_SERVER[SERVER_NAME]/?page=admin"; $from = "From: webmaster@$_SERVER[SERVER_NAME]\nReply-To: $email\nX-Mailer: VLog MSG Alert System"; mail($rcpt, $subject, $body, $from); --- 86,90 ---- by: $author ($ip) ! * Please visit the admin page to validate: http://$_SERVER[SERVER_NAME]/$_SERVER[SCRIPT_NAME]?page=admin"; $from = "From: webmaster@$_SERVER[SERVER_NAME]\nReply-To: $email\nX-Mailer: VLog MSG Alert System"; mail($rcpt, $subject, $body, $from); |