Coppermine PHP Cross Reference Image Galleries

Source: /keyword_create_dict.php - 67 lines - 2271 bytes - Summary - Text - Print

   1  <?php
   2  /*************************

   3    Coppermine Photo Gallery

   4    ************************

   5    Copyright (c) 2003-2014 Coppermine Dev Team

   6    v1.0 originally written by Gregory Demar

   7  

   8    This program is free software; you can redistribute it and/or modify

   9    it under the terms of the GNU General Public License version 3

  10    as published by the Free Software Foundation.

  11  

  12    ********************************************

  13    Coppermine version: 1.5.28

  14    $HeadURL: https://svn.code.sf.net/p/coppermine/code/trunk/cpg1.5.x/keyword_create_dict.php $

  15    $Revision: 8683 $

  16  **********************************************/
  17  
  18  define('IN_COPPERMINE', true);
  19  define('EDITPICS_PHP', true);
  20  
  21  require ('include/init.inc.php');
  22  
  23  if (!GALLERY_ADMIN_MODE) {
  24      cpg_die(ERROR, $lang_errors['access_denied'], __FILE__, __LINE__);
  25  }
  26  
  27  $output = ($CPG_REFERER != 'keyword_select.php');
  28  if ($output) { pageheader_mini($lang_gallery_admin_menu['key_lnk']); }
  29  
  30  $query = "SELECT keywords FROM {$CONFIG['TABLE_PICTURES']} WHERE keywords <> ''";
  31  $result = cpg_db_query($query);
  32  $i = 0;
  33  if (mysql_num_rows($result)) {
  34  
  35      if ($output) { starttable('100%', $lang_gallery_admin_menu['key_lnk']); }
  36  
  37      cpg_db_query("TRUNCATE TABLE {$CONFIG['TABLE_DICT']}");
  38      while ($row = mysql_fetch_assoc($result)) {
  39          $keyArr = explode($CONFIG['keyword_separator'], $row['keywords']);
  40          foreach ($keyArr as $keyword) {
  41              $keyword = trim($keyword);
  42              if (empty($keyword)) {
  43                  continue;
  44              }
  45              $query = "SELECT null FROM {$CONFIG['TABLE_DICT']} WHERE keyword = '$keyword'";
  46              $result2 = cpg_db_query($query);
  47              if (!mysql_num_rows($result2)) {
  48                  $query = "INSERT INTO {$CONFIG['TABLE_DICT']} (keyword) VALUES ('$keyword')";
  49                  cpg_db_query($query);
  50                  if ($output) { echo '<tr><td class="tableh2">' . $keyword . '</td></tr>'; }
  51                  $i++ ;
  52              }
  53          }
  54          mysql_free_result($result2);
  55      }
  56      if ($output) { endtable(); }
  57      mysql_free_result($result);
  58  }
  59  
  60  if ($output) {
  61      echo "<p>{$lang_editpics_php['new_keywords']}: $i</p>";
  62      pagefooter_mini();
  63  } else {
  64      header("Location: $CPG_REFERER");
  65  }
  66  
  67  ?>

title

Description

title

Description

title

Description

title

title

Body