Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, November 12, 2026

Diff for Metafox/db.inc.php between version 1.32 and 1.33

version 1.32, 2007/02/18 21:30:28 version 1.33, 2007/02/24 19:27:03
Line 17 
Line 17 
  * http://platon.sk/projects/Metafox/   * http://platon.sk/projects/Metafox/
  */   */
   
 /* $Platon: Metafox/db.inc.php,v 1.31 2006-10-01 14:34:32 nepto Exp $ */  /* $Platon: Metafox/db.inc.php,v 1.32 2007-02-18 21:30:28 nepto Exp $ */
   
 /*  /*
  * updates: 23/5/2001, 29/7/2001, 11/10/2001, 2/11/2001, 11/1/2002, 23/7/2002   * updates: 23/5/2001, 29/7/2001, 11/10/2001, 2/11/2001, 11/1/2002, 23/7/2002
Line 54  function ezin_validate_IDs($ar) /* {{{ *
Line 54  function ezin_validate_IDs($ar) /* {{{ *
         $c_message     = ! empty($ar['message_id'])          $c_message     = ! empty($ar['message_id'])
                 && ! is_array($ar['message_id'])                  && ! is_array($ar['message_id'])
                 && intval($ar['message_id']) > 0;                  && intval($ar['message_id']) > 0;
           $conditions  = array();
           $tables      = array();
           $select_cols = array();
   
         if ($c_author || $c_section || $c_article || $c_message) {          if ($c_author || $c_section || $c_article || $c_message) {
                 if ($c_author) {                  if ($c_author) {
                         $conditions  = array();                          if ($c_article) {
                         $tables      = array($ezin_authors);                                  $tables[]      = $ezin_articles;
                         $select_cols = array(                                  $select_cols[] = $ezin_articles.'.author_id AS author_id';
                                         $ezin_authors.'.id AS author_id',                                  $select_cols[] = $ezin_articles.'.id AS article_id';
                                         $ezin_authors.'.access_key AS author_access_key'                                  $select_cols[] = $ezin_articles.'.access_key AS article_access_key';
                                         );                                  //      $conditions[]  = $ezin_articles.'.author_id = '.$ezin_authors.'.id';
                         if (intval($ar['author_id']) > 0) {  
                                 $conditions[] = $ezin_authors.'.id = '.intval($ar['author_id']);  
                         } else {                          } else {
                                 $conditions[] = $ezin_authors.'.access_key = "'.addslashes($ar['author_id']).'"';                                  $tables[]      = $ezin_authors;
                                   $select_cols[] = $ezin_authors.'.id AS author_id';
                                   $select_cols[] = $ezin_authors.'.access_key AS author_access_key';
                                   if (intval($ar['author_id']) > 0) {
                                           $conditions[] = $ezin_authors.'.id = '.intval($ar['author_id']);
                                   } else {
                                           $conditions[] = $ezin_authors.'.access_key = "'.addslashes($ar['author_id']).'"';
                                   }
                         }                          }
                 } else {                  } else {
                         $conditions  = array();  
                         $tables      = array($ezin_sections);                          $tables      = array($ezin_sections);
                         $select_cols = array(                          $select_cols[] = $ezin_sections.'.id AS section_id';
                                         $ezin_sections.'.id AS section_id',                          $select_cols[] = $ezin_sections.'.access_key AS section_access_key';
                                         $ezin_sections.'.access_key AS section_access_key',                          $select_cols[] = $ezin_sections.'.bind_lang AS section_bind_lang';
                                         $ezin_sections.'.bind_lang AS section_bind_lang',                          $select_cols[] = $ezin_sections.'.lang AS lang';
                                         $ezin_sections.'.lang AS lang'  
                                         );  
   
                         if ($c_article || $c_message) {                          if ($c_article || $c_message) {
                                 $tables[]      = $ezin_articles;                                  $tables[]      = $ezin_articles;
Line 98  function ezin_validate_IDs($ar) /* {{{ *
Line 103  function ezin_validate_IDs($ar) /* {{{ *
                                 $conditions[]  = $ezin_messages.'.id = '.intval($ar['message_id']);                                  $conditions[]  = $ezin_messages.'.id = '.intval($ar['message_id']);
                                 $id_included   = 1;                                  $id_included   = 1;
                         }                          }
                   }
   
                         if (! $id_included && $c_article) {                  if (! $id_included && $c_article) {
                                 if (intval($ar['article_id']) > 0) {                          if (intval($ar['article_id']) > 0) {
                                         $conditions[] = $ezin_articles.'.id = '.intval($ar['article_id']);                                  $conditions[] = $ezin_articles.'.id = '.intval($ar['article_id']);
                                 } else {                          } else {
                                         $conditions[] = $ezin_articles.'.access_key = "'.addslashes($ar['article_id']).'"';                                  $conditions[] = $ezin_articles.'.access_key = "'.addslashes($ar['article_id']).'"';
                                 }  
                                 $id_included   = 1;  
                         }                          }
                           $id_included   = 1;
                   }
   
                         if (! $id_included && $c_section) {                  if (! $id_included && $c_section) {
                                 $conditions[] = $ezin_sections.'.type IN ("normal", "global", "hidden", "hidden2")'; // )                          $conditions[] = $ezin_sections.'.type IN ("normal", "global", "hidden", "hidden2")'; // )
                                 if (intval($ar['section_id']) > 0) {                          if (intval($ar['section_id']) > 0) {
                                         $conditions[] = $ezin_sections.'.id = '.intval($ar['section_id']);                                  $conditions[] = $ezin_sections.'.id = '.intval($ar['section_id']);
                                 } else {                          } else {
                                         $conditions[] = $ezin_sections.'.access_key = "'.addslashes($ar['section_id']).'"';                                  $conditions[] = $ezin_sections.'.access_key = "'.addslashes($ar['section_id']).'"';
                                 }  
                                 $id_included   = 1;  
                         }                          }
                           $id_included   = 1;
                 }                  }
   
                 $query = sprintf('SELECT %s FROM %s WHERE %s',// LIMIT 1',                  $query = sprintf('SELECT %s FROM %s WHERE %s',// LIMIT 1',
                                 join(', ', $select_cols),                                  join(', ', $select_cols),
                                 join(', ', $tables),                                  join(', ', $tables),
                                 join(' AND ', $conditions));                                  join(' AND ', $conditions));
                 //echo $query.'<hr>';                  //echo $query;exit;
                 $result = @mysql_query($query, $ezin_db_handle)                  $result = @mysql_query($query, $ezin_db_handle)
                         or ezin_db_error('ezin_validate_IDs()');                          or ezin_db_error('ezin_validate_IDs()');
                 $first   = true;                  $first   = true;
Line 162  function ezin_validate_IDs($ar) /* {{{ *
Line 167  function ezin_validate_IDs($ar) /* {{{ *
                 $ar['section_bind_lang'] = 0;                  $ar['section_bind_lang'] = 0;
                 $ar['article_bind_lang'] = 0;                  $ar['article_bind_lang'] = 0;
         }          }
   
         return $ar;          return $ar;
 } /* }}} */  } /* }}} */
   

Legend:
Removed from v.1.32  
changed lines
  Added in v.1.33

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top