cvs: php-master-web /manage user-notes.php

From: Date: Fri, 18 Apr 2008 15:51:05 +0000
Subject: cvs: php-master-web /manage user-notes.php
Groups: php.webmaster 
Request: Send a blank email to php-webmaster+get-1567@lists.php.net to get a copy of this message
felipe Fri Apr 18 15:51:05 2008 UTC Modified files: /php-master-web/manage user-notes.php Log: - Added new functionalities: - Search for first notes - Search for minor notes http://cvs.php.net/viewvc.cgi/php-master-web/manage/user-notes.php?r1=1.64&r2=1.65&diff_format=u Index: php-master-web/manage/user-notes.php diff -u php-master-web/manage/user-notes.php:1.64 php-master-web/manage/user-notes.php:1.65 --- php-master-web/manage/user-notes.php:1.64 Mon Jun 18 17:38:38 2007 +++ php-master-web/manage/user-notes.php Fri Apr 18 15:51:05 2008 @@ -1,5 +1,5 @@ <?php -// $Id: user-notes.php,v 1.64 2007/06/18 17:38:38 bjori Exp $ +// $Id: user-notes.php,v 1.65 2008/04/18 15:51:05 felipe Exp $ // Force login before action can be taken include_once 'login.inc'; @@ -70,10 +70,22 @@ } $sql .= ' LIMIT 20'; } else { - $page = (int)$_REQUEST["page"]; + $page = (int)$_REQUEST["page"]; + $type = isset($_REQUEST["type"]) ? $_REQUEST["type"] : 0; + if($page < 0) { $page = 0; } $limit = $page * 10; $page++; - $sql = "SELECT *, UNIX_TIMESTAMP(ts) AS ts FROM note ORDER BY id DESC LIMIT $limit, 10"; + + /* First notes */ + if ($type == 1) { + $sql = "SELECT *, UNIX_TIMESTAMP(ts) AS ts FROM note ORDER BY id ASC LIMIT $limit, 10"; + /* Minor notes */ + } else if ($type == 2) { + $sql = "SELECT *, UNIX_TIMESTAMP(ts) AS ts FROM note ORDER BY LENGTH(note) ASC LIMIT $limit, 10"; + /* Last notes */ + } else { + $sql = "SELECT *, UNIX_TIMESTAMP(ts) AS ts FROM note ORDER BY id DESC LIMIT $limit, 10"; + } } if ($result = db_query($sql)) { @@ -95,7 +107,7 @@ "<hr />"; } if(isset($_REQUEST["view"])) { - echo "<p><a href=\"?view=1&page=$page\">Next 10</a>"; + echo "<p><a href=\"?view=1&page=$page&type=$type\">Next 10</a>"; } } else { echo "no results<br />"; @@ -120,7 +132,9 @@ </form> <p><a href="<?php echo $_SERVER['PHP_SELF'];?>?action=mass">Mass change of sections</a></p> -<p><a href="<?php echo $_SERVER['PHP_SELF'];?>?view=notes">View last 10 notes</a></p> +<p><a href="<?php echo $_SERVER['PHP_SELF'];?>?view=notes&type=0">View last 10 notes</a></p> +<p><a href="<?php echo $_SERVER['PHP_SELF'];?>?view=notes&type=1">View first 10 notes</a></p> +<p><a href="<?php echo $_SERVER['PHP_SELF'];?>?view=notes&type=2">View minor 10 notes</a></p> <?php foot(); exit;

« previous php.webmaster (#1567) next »