From: Javier B. <jb...@us...> - 2005-01-04 11:33:51
|
Update of /cvsroot/openbash-org/openbash-org/modules In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25501/modules Modified Files: Quote.php View.php Log Message: -sistema de auth funcionando correctamente -cambios en Quote.php, View.php y quote.php para no llamar a view dentro de quote Index: View.php =================================================================== RCS file: /cvsroot/openbash-org/openbash-org/modules/View.php,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** View.php 26 Dec 2004 22:57:19 -0000 1.19 --- View.php 4 Jan 2005 11:33:41 -0000 1.20 *************** *** 35,51 **** } ! function view_quote($id, $points, $quote, $author, $channel, $network, $ip) { global $quote_language;?> <p class="quote"> ! <a href="?page=quote&action=single&quote=<?=$id?>" title="<?=$quote_language['permalink']?>"><b>#<?=$id?></b></a> ! <a href="?page=quote&action=score&rox=<?=$id?>" class="qa">+</a> (<?=$points?>) ! <a href="?page=quote&action=score&sux=<?=$id?>" class="qa">-</a> ! <a href="?page=quote&action=score&rev=<?=$id?>" class="qa">[X]</a> <!-- ¿Queremos JavaScript? <a href="?page=quote&action=score&rev=<?=$id?>" onClick="return confirm('Flag quote for review?');" class="qa">[X]</a> --> </p> ! <p class="qt"><?=$quote?></p><?php } --- 35,51 ---- } ! function view_quote($data) { global $quote_language;?> <p class="quote"> ! <a href="?page=quote&action=single&quote=<?=$data['id']?>" title="<?=$quote_language['permalink']?>"><b>#<?=$data['id']?></b></a> ! <a href="?page=quote&action=score&rox=<?=$data['id']?>" class="qa">+</a> (<?=$data['points']?>) ! <a href="?page=quote&action=score&sux=<?=$data['id']?>" class="qa">-</a> ! <a href="?page=quote&action=score&rev=<?=$data['id']?>" class="qa">[X]</a> <!-- ¿Queremos JavaScript? <a href="?page=quote&action=score&rev=<?=$id?>" onClick="return confirm('Flag quote for review?');" class="qa">[X]</a> --> </p> ! <p class="qt"><?=$data['quote']?></p><?php } *************** *** 82,89 **** global $quote_language;?> <p><?=$quote_language['updated']?></p> - <!-- - NO JavaScript - <p><a href="javascript:;" onClick="history.back();"><?=$quote_language['back']?></a></p> - --> <p><a href="<?=$_SERVER['HTTP_REFERER']?>"><?=$quote_language['back']?></a></p> <?php --- 82,85 ---- *************** *** 101,104 **** --- 97,101 ---- global $quote_language;?> <p><?=$quote_language['score_twice']?></p> + <p><a href="<?=$_SERVER['HTTP_REFERER']?>"><?=$quote_language['back']?></a></p> <?php Index: Quote.php =================================================================== RCS file: /cvsroot/openbash-org/openbash-org/modules/Quote.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Quote.php 26 Dec 2004 22:57:18 -0000 1.18 --- Quote.php 4 Jan 2005 11:33:41 -0000 1.19 *************** *** 58,73 **** } ! function get_quote($id) { ! $view = new view(); ! $sql = "SELECT points,quote,author,channel,network,ip,pending FROM quote WHERE id='$id' AND deleted=0"; ! $quote = $this->bd->CacheExecute($this->expire_cache, $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(); } ! $quote->Close(); } --- 58,73 ---- } ! function get_quote($data) { ! $sql = "SELECT id,points,quote,author,channel,network,ip,pending FROM quote WHERE id='$data[id]' AND deleted=0"; ! $quote = $this->bd->Execute($sql); if($quote->RecordCount() == 1) { ! /* ! * return 1: valid / return 2: pending ! */ ! if ($quote->fields['pending'] == 1) return (1); ! return ($quote->fields); ! } ! return (0); } *************** *** 75,89 **** { $sql = "SELECT id FROM quote WHERE deleted=0 AND pending=0 ORDER BY id $order LIMIT $start,$end"; ! $ids = $this->bd->CacheExecute($this->expire_cache, $sql); if($ids->RecordCount()) { while (!$ids->EOF) { ! $this->get_quote($ids->fields['id']); ! $ids->MoveNext(); ! } ! $ids->Close(); ! } else { ! $ids->Close(); ! return (0); } } --- 75,91 ---- { $sql = "SELECT id FROM quote WHERE deleted=0 AND pending=0 ORDER BY id $order LIMIT $start,$end"; ! $ids = $this->bd->Execute($sql); if($ids->RecordCount()) { while (!$ids->EOF) { ! if (empty($ret)) { ! $ret = array($ids->fields); ! } else { ! array_push($ret, $ids->fields); ! } ! $ids->MoveNext(); } + return ($ret); + } + return (0); } *************** *** 94,105 **** if($ids->RecordCount()) { while (!$ids->EOF) { ! $this->get_quote($ids->fields['id']); $ids->MoveNext(); } ! $ids->Close(); ! } else { ! $ids->Close(); ! return (0); ! } } --- 96,109 ---- if($ids->RecordCount()) { while (!$ids->EOF) { ! if (empty($ret)) { ! $ret = array($ids->fields); ! } else { ! array_push($ret, $ids->fields); ! } $ids->MoveNext(); } ! return ($ret); ! } ! return (0); } *************** *** 110,124 **** default: $sql ="SELECT id FROM quote WHERE deleted=0 AND pending=0 ORDER BY RAND()"; break; } ! $ids = $this->bd->CacheExecute($this->expire_cache, $sql); if($ids->RecordCount()) { ! while (!$ids->EOF) { ! $this->get_quote($ids->fields['id']); $ids->MoveNext(); } ! $ids->Close(); ! } else { ! $ids->Close(); ! return (0); ! } } --- 114,137 ---- default: $sql ="SELECT id FROM quote WHERE deleted=0 AND pending=0 ORDER BY RAND()"; break; } ! ! /* ! * Not sure if random quotes can be cached. ! * If we do, then the random effect will be ! * refreshed only when the cache gets outdated. ! */ ! ! $ids = $this->bd->Execute($sql); if($ids->RecordCount()) { ! while (!$ids->EOF) { ! if (empty($ret)) { ! $ret = array($ids->fields); ! } else { ! array_push($ret, $ids->fields); ! } $ids->MoveNext(); } ! return ($ret); ! } ! return (0); } |