From: Mutwin K. <mu...@us...> - 2004-11-07 12:02:58
|
Update of /cvsroot/fuwiki/fuwiki_1_0/FWiki In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31202/FWiki Added Files: Images.php Log Message: nearing rc2 --- NEW FILE: Images.php --- <?PHP /* fuwiki - A free Wiki Software * * Copyright (C) 2002-2004 The fuwiki Project * Copyright (C) 2002-2004 Mutwin Kraus and Lukas Bombach * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ function gen_header($header, $n) { return "<a href=\"index.php?FWikiImages&order=".$n."\">".$header."</a>"; } function FWikiMain() { global $WikiIO, $WikiUser, $_POST, $_GET; if(!empty($_GET["gallery"])) { $cond = " WHERE id=".$_GET["gallery"]; } else if(!empty($_POST["search_pagename"])) { $cond = " WHERE pagename LIKE '%".$_POST["search"]."%'"; } else if(!empty($_POST["search_name"])) { $cond = " WHERE name LIKE '%".$_POST["search"]."%'"; } if(!empty($_GET["order"])) { if($_GET["order"] == 1) $order = " ORDER BY name"; if($_GET["order"] == 2) $order = " ORDER BY pagename"; if($_GET["order"] == 3) $order = " ORDER BY uploader_id DESC"; if($_GET["order"] == 4) $order = " ORDER BY upload_time DESC"; } else $order = " ORDER BY upload_time DESC"; $head = "<h2>"._FWI_TITLE."</h2><br />\n"; $head .= "<form action=\"index.php?FWikiImages\" method=\"post\">\n"; $head .= " <input name=\"search\"><br />\n"; $head .= "<input type=\"submit\" name=\"search_pagename\" value=\""._FWI_SEARCH_PAGENAME."\"><input type=\"submit\" name=\"search_name\" value=\""._FWI_SEARCH_NAME."\"></form><br />\n"; $num = 0; $query = "SELECT * FROM images".$cond.$order.";"; $res = $WikiIO->query($query); if(!empty($_GET["gallery"])) { $a = mysql_fetch_array($res); $gallery = $_GET["gallery"]; $out = "<a href=\"index.php?FWikiImages&gallery=".($gallery-1)."\"><<</a> <a href=\"index.php?FWikiImages&gallery=".($gallery+1)."\">>></a><br />\n"; $out .= "<a href=\"index.php?".$a["pagename"]."\">".$a["pagename"]."</a>" . " : ".$a["name"]."<br />"; $out .= "<img src=\"upload/".$a["id"].".".get_file_extension($a["name"])."\"><br />\n"; $out .= $WikiUser->get_user_name($a["uploader_id"]). " (".timestamp_pattern($a["upload_time"]).")<br />\n"; } else { $out = "<table>\n<tr><td>".gen_header(_FWI_FILENAME, 1)."</td><td>".gen_header(_FWI_PAGENAME, 2)."</td><td>".gen_header(_FWI_UPLOADER, 3)."</td><td>".gen_header(_FWI_UPLOADTIME, 4)."</td><td> </td></tr>\n"; while ($a = mysql_fetch_array($res)) { $out .= "<tr><td>".$a["name"]."</td><td>".$a["pagename"]."</td><td>".$WikiUser->get_user_name($a["uploader_id"])."</td><td>".timestamp_pattern($a["upload_time"])."</td>"; $out .= "<td><a href=\"index.php?FWikiImages&gallery=".$a["id"]."\">"._FWI_VIEW."</a></td></tr>\n"; $num++; } } $out .= "</table>\n"; return $head. ($num > 0 ? _FWI_NUMSHOWN." ". $num : "")."<br />\n".$out; } ?> |