Changeset 2095


Ignore:
Timestamp:
Sep 19, 2007, 5:23:19 AM (17 years ago)
Author:
rvelices
Message:

merge -r 2094 from branch-1_7 to trunk

  • fix: quick search error if the query term contained " or '
  • optimized sql query in sync_users (called every time on admin page) - a lot faster when #user_cache_categories is big
  • added function Template->delete_block_vars (opposite of assign_block_vars)
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/include/functions.php

    r2065 r2095  
    11601160  {
    11611161    $query = '
    1162 SELECT user_id
     1162SELECT DISTINCT user_id
    11631163  FROM '.$table.'
    11641164;';
  • trunk/include/category_cats.inc.php

    r2091 r2095  
    386386
    387387    $template->assign_var_from_handle('CATEGORIES', 'thumbnails');
    388     unset( $template->_tpldata['thumbnails.'] );//maybe write a func for that
     388    $template->delete_block_vars('thumbnails', true); // category_default reuse them
    389389  }
    390390  trigger_action('loc_end_index_category_thumbnails', $categories);
  • trunk/include/template.php

    r2058 r2095  
    297297
    298298  /**
     299   * Block-level variable deletion. Deletes the last block iteration.
     300   * if all is true - all blocks are removed
     301   * return true if a deletion occured
     302   */
     303  function delete_block_vars($blockname, $all=false)
     304    {
     305      $blocks = explode('.', $blockname);
     306      $blockcount = count($blocks);
     307      $str = '$this->_tpldata';
     308      for ($i = 0; $i < $blockcount; $i++)
     309      {
     310        $str .= '[\'' . $blocks[$i] . '.\']';
     311        eval('$lastiteration = isset('.$str.') ? sizeof('.$str.')-1:-1;');
     312        if ($lastiteration==-1)
     313        {
     314          return false;
     315        }
     316        if ($i==$blockcount-1)
     317        {
     318          break;
     319        }
     320        $str .= '[' . $lastiteration . ']';
     321      }
     322
     323      if ($all==true or $lastiteration==0)
     324      {
     325        $str ='unset('.$str.');';
     326      }
     327      else
     328      {
     329        $str ='unset('.$str.'['.$lastiteration.']);';
     330      }
     331      eval($str);
     332      return true;
     333    }
     334
     335  /**
    299336   * Root-level variable assignment. Adds to current assignments, overriding
    300337   * any existing variable assignment with the same name.
  • trunk/qsearch.php

    r1900 r2095  
    4444  (rules, last_seen)
    4545  VALUES
    46   (\''.serialize($search).'\', NOW() )
     46  (\''.addslashes(serialize($search)).'\', NOW() )
    4747;';
    4848pwg_query($query);
Note: See TracChangeset for help on using the changeset viewer.