Changeset 2521 for trunk/include


Ignore:
Timestamp:
Sep 12, 2008, 4:17:35 AM (16 years ago)
Author:
rvelices
Message:
  • images.file categories.permalink old_permalinks.permalink - become binary
  • session security improvement: now the sessions are valid only for originating ip addr (with mask 255.255.0.0 to allow users behind load balancing proxies) -> stealing the session cookie is almost a non issue (with the exception of the 65536 machines in range)
  • metadata sync from the sync button does not overwrite valid data with empty metadata
  • other small fixes/enhancements:
    • added event get_category_image_orders
    • fix display issue with redirect.tpl (h1/h2 within h1)
    • fix known_script smarty function registration
    • query search form not submitted if q is empty
    • better admin css rules
    • some other minor changes (ws_core, rest_handler, functions_search...)
Location:
trunk/include
Files:
8 edited

Legend:

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

    r2505 r2521  
    748748  if (empty($msg))
    749749  {
    750     $redirect_msg = l10n('redirect_msg');
    751   }
    752   else
    753   {
    754     $redirect_msg = $msg;
    755   }
    756   $redirect_msg = nl2br($redirect_msg);
     750    $msg = nl2br(l10n('redirect_msg'));
     751  }
    757752
    758753  $refresh = $refresh_time;
     
    765760
    766761  $template->set_filenames( array( 'redirect' => 'redirect.tpl' ) );
     762  $template->assign('REDIRECT_MSG', $msg);
     763
    767764  $template->parse('redirect');
    768765
  • trunk/include/functions_category.inc.php

    r2517 r2521  
    259259{
    260260  global $conf, $page;
    261  
    262   return array(
     261
     262  return trigger_event('get_category_preferred_image_orders',
     263    array(
    263264    array(l10n('default_sort'), '', true),
    264265    array(l10n('Average rate'), 'average_rate DESC', $conf['rate']),
     
    270271      l10n('Rank'),
    271272      'rank ASC',
    272       ('categories' == $page['section'] and !isset($page['flat']))
     273      ('categories' == @$page['section'] and !isset($page['flat']))
    273274      )
    274     );
     275    ));
    275276}
    276277
  • trunk/include/functions_search.inc.php

    r2451 r2521  
    353353        else
    354354        {
     355          if ( strcspn($ch, '%_')==0)
     356          {// escape LIKE specials %_
     357            $ch = '\\'.$ch;
     358          }
    355359          $crt_token .= $ch;
    356360        }
     
    367371            break;
    368372          default:
     373            if ( strcspn($ch, '%_')==0)
     374            {// escape LIKE specials %_
     375                $ch = '\\'.$ch;
     376            }
    369377            $crt_token .= $ch;
    370378        }
  • trunk/include/functions_session.inc.php

    r2299 r2521  
    9191}
    9292
     93function get_remote_addr_session_hash()
     94{
     95        return vsprintf( "%02X%02X", explode('.',$_SERVER['REMOTE_ADDR']) );
     96}
     97
    9398/**
    9499 * this function returns
     
    103108SELECT data
    104109  FROM '.SESSIONS_TABLE.'
    105   WHERE id = \''.$session_id.'\'
     110  WHERE id = \''.get_remote_addr_session_hash().$session_id.'\'
    106111;';
    107112  $result = pwg_query($query);
     
    129134  SET expiration = now(),
    130135  data = \''.$data.'\'
    131   WHERE id = \''.$session_id.'\'
     136  WHERE id = \''.get_remote_addr_session_hash().$session_id.'\'
    132137;';
    133138  pwg_query($query);
     
    139144INSERT INTO '.SESSIONS_TABLE.'
    140145  (id,data,expiration)
    141   VALUES(\''.$session_id.'\',\''.$data.'\',now())
     146  VALUES(\''.get_remote_addr_session_hash().$session_id.'\',\''.$data.'\',now())
    142147;';
    143148  mysql_query($query);
     
    155160DELETE
    156161  FROM '.SESSIONS_TABLE.'
    157   WHERE id = \''.$session_id.'\'
     162  WHERE id = \''.get_remote_addr_session_hash().$session_id.'\'
    158163;';
    159164  pwg_query($query);
  • trunk/include/page_header.php

    r2299 r2521  
    7070// refresh
    7171if ( isset( $refresh ) and intval($refresh) >= 0
    72     and isset( $url_link ) and isset( $redirect_msg ) )
     72    and isset( $url_link ) )
    7373{
    7474  $template->assign(
    7575    array(
    76       'REDIRECT_MSG' => $redirect_msg,
    7776      'page_refresh' => array(
    7877            'TIME' => $refresh,
  • trunk/include/template.class.php

    r2513 r2521  
    6363    $this->smarty->register_modifier( 'explode', array('Template', 'mod_explode') );
    6464    $this->smarty->register_block('html_head', array(&$this, 'block_html_head') );
    65     $this->smarty->register_function('known_script', array(&$this, 'func_known_script'), false );
     65    $this->smarty->register_function('known_script', array(&$this, 'func_known_script') );
    6666    $this->smarty->register_prefilter( array('Template', 'prefilter_white_space') );
    6767    if ( $conf['compiled_template_cache_language'] )
  • trunk/include/ws_core.inc.php

    r2499 r2521  
    379379    if ( is_null($this->_responseEncoder) )
    380380    {
    381       set_status_header(500);
     381      set_status_header(400);
    382382      @header("Content-Type: text/plain");
    383383      echo ("Cannot process your request. Unknown response format.
    384 Request format: ".@$this->_requestFormat." handler:".$this->_requestHandler."
    385 Response format: ".@$this->_responseFormat." encoder:".$this->_responseEncoder."
    386     ");
     384Request format: ".@$this->_requestFormat." Response format: ".@$this->_responseFormat."\n");
    387385      var_export($this);
    388386      die(0);
     
    392390    {
    393391      $this->sendResponse(
    394         new PwgError(500, 'Unknown request format')
     392        new PwgError(400, 'Unknown request format')
    395393        );
    396394      return;
  • trunk/include/ws_protocols/rest_handler.php

    r2299 r2521  
    3131    foreach ($param_array as $name => $value)
    3232    {
    33       if ($name=='format' or $name=='partner')
     33      if ($name=='format')
    3434        continue; // ignore - special keys
    3535      if ($name=='method')
     
    4646    {
    4747      $service->sendResponse(
    48           new PwgError(400, 'Missing "method" name')
     48          new PwgError(WS_ERR_INVALID_METHOD, 'Missing "method" name')
    4949        );
    5050      return;
Note: See TracChangeset for help on using the changeset viewer.