Author: cyb
Date: Wed Apr 25 14:52:19 2007
New Revision: 364

URL: http://svn.gna.org/viewcvs/phplinker?rev=364&view=rev
Log:
merged with url_search.php

Removed:
    trunk/www/admin/top1000.php

Removed: trunk/www/admin/top1000.php
URL: 
http://svn.gna.org/viewcvs/phplinker/trunk/www/admin/top1000.php?rev=363&view=auto
==============================================================================
--- trunk/www/admin/top1000.php (original)
+++ trunk/www/admin/top1000.php (removed)
@@ -1,330 +1,0 @@
-<?php
-/*
-    This file is part of PHPLinker.
-
-    PHPLinker 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.
-
-    PHPLinker 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 PHPLinker; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-*/
-$group="admin";
-$title="Url search";
-$header="<script type='text/javascript' 
src='/js/ask_confirmation.js'></script>";
-require("../includes/start.php");
-require("includes/auth.php");
-require("includes/header.php");
-require($linker_config['linker_php_pager']);
-if(isset($_GET["state"])){
-  $state = $_GET["state"];
- }else{
-  $state ="";
-  $_GET["state"]="";
- }
-if(isset($_GET["key"])){
-  $key = $_GET["key"];
- }else{
-  $key ="";
-  $_GET["key"]="";
- }
-if(isset($_GET["categorized"])){
-  $categorized = $_GET["categorized"];
- }else{
-  $categorized ="";
-  $_GET["categorized"]="";
- }
-if(isset($_GET["cat"])){
-  $cat = $_GET["cat"];
- }else{
-  $cat ="";
-  $_GET["cat"]="";
- }
-
-
-$test = $_SERVER["QUERY_STRING"];
-$img_url = "";
-$img_date = "";
-$img_hit = "";
-$img_desc = "";
-$img_visible = "";
-$category_name="";
-$img_state = "";
-$myData = array();
-$nbr = 0;
-$_SESSION['order'] = "test";
-
-if(isset($_GET['order'])){
-  switch($_GET['order']){
-  case "desc1":
-      $order_by=" ORDER BY description DESC";
-      $img_desc ="<img src='../imgs/down.png' border='0' alt='down'>";
-      break;
-  case"desc2":
-      $order_by=" ORDER BY description ASC";
-      $img_desc ="<img src='../imgs/up.png' border='0' alt='up'>";
-      break;
-  case "visible1":
-      $order_by=" ORDER BY state DESC";
-      $img_visible ="<img src='../imgs/down.png' border='0' alt='down'>";
-      break;
-  case"visible2":
-      $order_by=" ORDER BY state  ASC";
-      $img_visible ="<img src='../imgs/up.png' border='0' alt='up'>";
-      break;
-  case "state1":
-      $order_by=" ORDER BY state DESC";
-      $img_state ="<img src='../imgs/down.png' border='0' alt='down'>";
-      break;
-  case"state2":
-      $order_by=" ORDER BY state  ASC";
-      $img_state ="<img src='../imgs/up.png' border='0' alt='up'>";
-      break;
-  case "hits1":
-      $order_by=" ORDER BY hit DESC";
-      $img_hit ="<img src='../imgs/down.png' border='0' alt='down'>";
-      break;
-  case"hits2":
-      $order_by=" ORDER BY hit ASC";
-      $img_hit ="<img src='../imgs/up.png' border='0' alt='up'>";
-      break;
-  case"url1":
-      $order_by=" ORDER BY url DESC";
-      $img_url ="<img src='../imgs/down.png' border='0' alt='down'>";
-      break;
-  case"url2":
-      $order_by=" ORDER BY url ASC";
-      $img_url ="<img src='../imgs/up.png' border='0' alt='up'>";
-      break;
-  case"date1":
-      $order_by=" ORDER BY last_update DESC";
-      $img_date ="<img src='../imgs/down.png' border='0' alt='down'>";
-      break;
-  case "date2":
-      $img_date ="<img src='../imgs/up.png' border='0' alt='up'>";
-      $order_by=" ORDER BY last_update ASC";
-      break;
-}
- }else{
-  $order_by=" ORDER BY hit DESC";
- }
- $all="";
-   if (isset($_GET['state']))
-     $state = $_GET['state'];
-
-   if (isset($_GET['key']))
-     $key = $_GET['key'];
-
-
-   if (isset($_GET['categorized']))
-     $categorized = $_GET['categorized'];
-     $categorized = "";
-   if (isset($_GET['cat']))
-     $cat = $_GET['cat'];
- if($state==""){
-    $state_request = " AND 1=1";
- }elseif($state=="moderated"){
-      $state_request ="  AND state=\"".$state."\"";
-  }else{
-     $state_request ="  AND state != \"moderated\"";
-}
- if($key ==""){
-   $key_request = "";
- }else{
-   $key_request = " AND (url LIKE '%".$_GET['key']."%' OR `description` LIKE 
'%".$_GET['key']."%')";
- }
-  if($_GET['categorized']=="none"){
-    $categorized_request = " AND 2=2";
-  }elseif($_GET['categorized']==0){
-    $categorized_request =" AND id NOT IN ( SELECT id_url FROM url2category )";
-  }else{
-    $categorized_request="";
-    if($_GET['cat'] == "all"){
-      $categorized_request =" AND id IN ( SELECT id_url FROM url2category )";
-    }else{
-    $cat = $_GET['cat'];
-    $all = "(";
-    $categ_parents = linker_get_categories_tree_array();
-    $array_children=array();
-    $categ_children = linker_get_category_children($cat , $categ_parents, 
$array_children, 1, 1,true);
-    for ($i=0;$i<sizeof($categ_children);$i++) {
-      $req_boucle = sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT 
id_url FROM url2category WHERE id_category=". $categ_children[$i]['id']);
-      $id_categ = mysql_fetch_array($req_boucle);
-      if($i==0){
-       $all.= $id_categ['id_url'];
-      }else{
-       if(!empty($id_categ['id_url']))
-        $all.= ",".$id_categ['id_url'];
-      }
-    }
-    $all = $all.")";
-
-    if($all =="()"){
-      $all = " AND  1=2";
-      $categorized_request = $all;
-    }else{
-      $all = str_replace("(,","(",$all);
-      $all = " AND id IN".$all;
-      $categorized_request = $all;
-    }
-  }
-}
-//echo $all;
-   $simple_request = $state_request . $categorized_request . $key_request;
-//echo "SELECT id FROM url WHERE 1=1 " .$simple_request;
-if(empty($simple_request)){
-     $result_for_all ="Pas de resultat pour cette requette";
-  }elseif(!empty($simple_request) || ($_GET['state']=="" && 
$_GET['categorized']=="none")){
-   $qryCount = sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT id FROM 
url WHERE 1=1 " .$simple_request);
-   $nbr = mysql_num_rows($qryCount);
-   if(mysql_num_rows($qryCount)!=0){
-     $request1000 =  sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT id 
FROM url ORDER BY hit DESC LIMIT 1000");
-     $u = 0;
-     $u2="(";
-     while($blc=mysql_fetch_array($request1000)){
-       if($u==0)
-        $u2.= $blc["id"];
-       else
-        $u2.= ",".$blc["id"];
-       $u++;
-       }
-     $u2.=")";
-     if($u2 == "()")
-       $list ="";
-     else
-       $list = $u2;
-     while($id_loop = mysql_fetch_array($qryCount)){
-       $qryChange =  sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT 
id_url, id_category FROM url2category  WHERE `id_url`= ".$id_loop['id']) or 
die(mysql_query());
-       $arrayChange = mysql_fetch_array($qryChange);
-       $qryCount = sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT 
count(*) as nb FROM url WHERE  1=1" .$simple_request);
-       if ($titi = mysql_fetch_array($qryCount))
-        $res = $titi['nb'];
-       $page_next  = (isset($_GET['page_next'])) ? $_GET['page_next'] : 1;     
                       // la valeur 'page' ici doit être eq à la valeur de 
params['urlVar']
-       $pPage = (isset($_GET['setPerPage'])) ? $_GET['setPerPage'] : 5;        
       // la valeur 10 ici doit être eq à la valeur de params['perPage']
-       $debut = $page_next * $pPage - $pPage;
-       $qry =sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT id , url, 
hit , description , state , date_format(last_update,'%d-%m-%Y') as date_new 
FROM url WHERE id NOT IN ( SELECT id_url FROM url2category ) AND id IN ".$list 
.$simple_request." ".$order_by."  LIMIT ".$debut.",".$pPage);
-       //echo "SELECT id , url, hit , description , state , 
date_format(last_update,'%d-%m-%Y') as date_new FROM url WHERE id NOT IN ( 
SELECT id_url FROM url2category ) AND id IN ".$list .$simple_request." 
".$order_by."  LIMIT ".$debut.",".$pPage;
-       $loop_it = 0;
-       $Counter = 0;
-       $rang=1;
-       $result_wl = mysql_fetch_array($qry);
-       while ($res != $loop_it) {
-        // echo $Counter."<br>";
-        if ($loop_it >= $debut && $loop_it < ($debut+$pPage) && $Counter < 
$pPage) {
-          $id =  $result_wl["id"];
-          $url = $result_wl["url"];
-          $hit = $result_wl["hit"];
-          $description1 = $result_wl["description"];
-          $state =$result_wl["state"];
-          $state = str_replace("_"," ",$state);
-          $date = $result_wl["date_new"];
-          $qryChange = sql_query('die',__FILE__,__LINE__,__FUNCTION__,"SELECT 
id_url, id_category FROM url2category  WHERE `id_url`= ".$id) or 
die(mysql_query());
-          $arrayChange = mysql_fetch_array($qryChange);
-          $test_for_this = mysql_num_rows($qryChange);
-          if(isset($arrayChange["id_category"])){
-            if($test_for_this > 1){
-              for($x=0;$x<$test_for_this;$x++){
-                $category_name = $category_name . 
linker_path($arrayChange["id_category"])." <br> ";
-              }
-            }else{
-              $category_name = linker_path($arrayChange["id_category"]);
-            }
-          }else{
-            $category_name = "------";
-          }
-          if(isset($_GET['key'])){
-            $description1 = str_replace($_GET['key'], "<b><span 
style='font-size:12px;'>".$_GET['key']."</span></b>", $description1);
-            $url = str_replace($_GET['key'], "<b><span 
style='font-size:12px;'>".$_GET['key']."</span></b>", $url);
-          }
-
-          $court = linker_cut_char($description1,"150");
-          if($Counter%2==0){
-            $tr = "<tr class=\"row_odd\">";
-          }else{
-            $tr = "<tr class=\"row_even\">";
-          }
-          if($state == "moderated"){
-            $visible="OUI";
-          }else{
-            $visible="NON";
-          }
-          $myData[] = "
-       $tr
-    <td colspan=\"2\"><span>$rang</span></td>
-    <td colspan=\"2\"><span><a href=\"$url\" 
target=\"blank\">$url</a></span></td>
-    <td colspan=\"2\"><span>$court</span></td>
-    <td colspan=\"2\"><span>$category_name</td>
-    <td colspan=\"2\"><span>$visible</span></td>
-    <td colspan=\"2\"><span>$state</span></td>
-    <td colspan=\"2\" align=\"center\"><span>$hit</span></td>
-    <td colspan=\"2\"><span>$date</span></td>
-    <td colspan=\"2\"><a href='url_edit?id=$id''><img 
src=\"/imgs/icons/edit.png\" alt=\"Modifier\" /></a></td>
- </tr>";
-          $Counter++;
-        } else {
-          $myData[] = "";
-        }
-        $loop_it++;
-        $rang++;
-       }
-
-     }
-     $result_for_all = "";
-   }else{
-   $result_for_all = "Pas de resultat pour cette requette";
-   }
-  }
-
- // Initialisation de la variable $param avec les valeurs par défaut
-   $params = array(
-     'itemData' => $myData, // Les données à afficher
-     'perPage' => 5,       // Nombre de ligne par page par défaut
-     'delta' => 10,          // Nombre de numero de pages à afficher 
directement sur les liens de saut de page
-     'append' => true,
-     'clearIfVoid' => true,
-     'urlVar' => 'page_next',
-     'useSessions' => false,
-     'closeSession' => false,
-     'mode'  => 'Jumping',
-     'nextImg' => '&raquo;',
-     'prevImg' => '&laquo;',
-     'linkClass' => 'pager',
-     'curPageLinkClassName' => 'currpage'
-
-   );
-
-
-   $pager = & Pager::factory($params);
-   $page_data = $pager->getPageData(0);
-   $links = $pager->getLinks();
-   $selectBox = $pager->getPerPageSelectBox();
-   $link =  $links['all'];
-   linker_tpl("nbr" , $nbr);
-   linker_tpl("params" , $params);
-   linker_tpl("myData" , $myData);
-   linker_tpl("selectBox" , $selectBox);
-   linker_tpl("page_data" , $page_data);
-   linker_tpl("links" , $links);
-   linker_tpl("link" , $link);
-   linker_tpl("selectBox" , $selectBox);
-   linker_tpl("result_for_all" , $result_for_all);
-   linker_tpl("state" , $state);
-   linker_tpl("key" , $key);
-   linker_tpl("categorized" , $categorized);
-   linker_tpl("cat" , $cat);
-   linker_tpl("img_url" , $img_url);
-   linker_tpl("img_date" , $img_date);
-   linker_tpl("img_hit" , $img_hit);
-   linker_tpl("img_desc" , $img_desc);
-   linker_tpl("state" , $state);
-   linker_tpl("img_state" , $img_state);
-   linker_tpl("img_visible" , $img_visible);
-require("includes/footer.php");
-?>


_______________________________________________
PHPLinker-commits mailing list
[email protected]
https://mail.gna.org/listinfo/phplinker-commits

Reply via email to