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.62 and 1.63

version 1.62, 2012/05/02 16:13:02 version 1.63, 2012/05/14 14:53:43
Line 17 
Line 17 
  * http://platon.sk/projects/Metafox/   * http://platon.sk/projects/Metafox/
  */   */
   
 /* $Platon: Metafox/db.inc.php,v 1.61 2012-05-02 12:58:15 igor Exp $ */  /* $Platon: Metafox/db.inc.php,v 1.62 2012-05-02 16:13:02 igor 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 1425  function ezin_get_sources($section_id =
Line 1425  function ezin_get_sources($section_id =
 }  }
   
 /*  /*
    * Boxes for actual theme
    */
   function ezin_get_boxes($box_names = array()) {
           if (!is_array($box_names)
                   && strlen($box_names) > 0)
           {
                   $box_names[0] = $box_names;
           }
           if (count($box_names) <= 0) {
                   return array();
           }
           global $ezin_sys;
           global $ezin_cfg;
           global $ezin_db_handle;
   
           $cond = '';
           foreach($box_names as $name) {
                   if (strlen($cond) > 0) {
                           $cond .= 'OR ';
                   }
                   $cond .= 'name = "'.$name.'" ';
           }
   
           $query = sprintf('SELECT *'
                                   .' FROM %s'
                                   .' WHERE theme = "%s"'
                                   .' AND (%s)',
                                   $ezin_sys['db']['tables']['boxes'],
                                   $ezin_cfg['theme']['name'],
                                   $cond);
   
           $result = @mysql_query($query, $ezin_db_handle)
                           or ezin_db_error('ezin_get_boxes()');
           $array = array();
           for ($k = 0; ($array[$k] = @mysql_fetch_array($result, MYSQL_ASSOC)); $k++)
                   ;
           unset($array[$k]);
           @mysql_free_result($result);
   
           return $array;
   }
   
   function ezin_get_box($box_id) {
           if (is_null($box_id)
                   || strlen($box_id) <= 0)
           {
                   return null;
           }
           global $ezin_sys;
           global $ezin_cfg;
           global $ezin_db_handle;
   
           $query = sprintf('SELECT *'
                                   .' FROM %s'
                                   .' WHERE id = %d'
                                   .' LIMIT 1',
                                   $ezin_sys['db']['tables']['boxes'],
                                   intval($box_id));
   
           $result = @mysql_query($query, $ezin_db_handle)
                           or ezin_db_error('ezin_get_box_name()');
           $ret = @mysql_fetch_array($result, MYSQL_ASSOC);
           @mysql_free_result($result);
   
           return $ret;
   }
   
   function ezin_insert_boxes() {
           global $ezin_sys;
           global $ezin_cfg;
           global $ezin_user;
           global $ezin_db_handle;
   
           $box_prefix = 'box_';
           $files = ezin_get_template_files();
           $boxes = array();
           foreach ($files as $file) {
                   echo $file.'<br>';
                   $tmpl = new HTML_Template_Platon($file);
                   $vars = $tmpl->getVars();
                   foreach($vars as $var) {
                           if (substr($var, 0, strlen($box_prefix)) == $box_prefix) {
                                   $box_name = substr($var, strlen($box_prefix));
                                   if (!in_array($box_name, $boxes)) {
                                           $boxes[] = $box_name;
                                   }
                           }
                   }
           }
   
           foreach($boxes as $box) {
                   $query = sprintf('INSERT IGNORE INTO %s'
                                           .' (theme, name, created_id, created_by, created_dt)'
                                           .' VALUES'
                                           .' ("%s", "%s", %d, "%s", "%s")',
                                           $ezin_sys['db']['tables']['boxes'],
                                           $ezin_cfg['theme']['name'],
                                           $box,
                                           $ezin_user['id'],
                                           $ezin_user['username'],
                                           date('Y-m-d H:i:s')
                                           );
                   $result = @mysql_query($query, $ezin_db_handle)
                           or ezin_db_error('ezin_insert_boxes()');
           }
           @mysql_free_result($result);
           return true;
   }
   
   /*
  * MESSAGES RELATED FUNCTION   * MESSAGES RELATED FUNCTION
  */   */
   

Legend:
Removed from v.1.62  
changed lines
  Added in v.1.63

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