pub / serci

Search the web with !keywords
git clone https://https://src.jayvii.de/pub/serci.git
Home | Log | Files | Exports | Refs | README | RSS

keywords.php (781B)


      1 <?php
      2 
      3 include("./config/config.php");
      4 
      5 /* Find duplicate keywords -------------------------------------------------- */
      6 
      7 $searchkeys = array();
      8 
      9 foreach (array_keys($searches) as $sid) {
     10     foreach ($searches[$sid]["keywords"] as $keyword) {
     11         if (array_key_exists($keyword, $searchkeys)) {
     12             array_push($searchkeys[$keyword], $sid);
     13         } else {
     14             $searchkeys[$keyword] = array($sid);
     15         }
     16 
     17         $assignments = count($searchkeys[$keyword]);
     18         if ($assignments > 1) {
     19             echo "[WARN] Keyword \"" . $keyword . "\" assigned multiple times:";
     20             for ($i = 0; $i < $assignments; $i++) {
     21                 echo " " . ($i + 1) . ". " . $searchkeys[$keyword][$i];
     22             }
     23             echo PHP_EOL;
     24         }
     25     }
     26 }
     27 
     28 ?>