includes/functions.php
changeset 377 bb3e6c3bd4f4
parent 376 66732bd4532c
child 378 c1c7fa6b329f
equal deleted inserted replaced
376:66732bd4532c 377:bb3e6c3bd4f4
    80   if ( isset($_GET['theme'] ) )
    80   if ( isset($_GET['theme'] ) )
    81   {
    81   {
    82     $flags .= $sep . 'theme='.$session->theme;
    82     $flags .= $sep . 'theme='.$session->theme;
    83     $sep = '&';
    83     $sep = '&';
    84   }
    84   }
    85   if ( isset($_GET['style'] ) ) {
    85   if ( isset($_GET['style'] ) )
       
    86   {
    86     $flags .= $sep . 'style='.$session->style;
    87     $flags .= $sep . 'style='.$session->style;
       
    88     $sep = '&';
       
    89   }
       
    90   if ( isset($_GET['lang']) && preg_match('/^[a-z0-9_]+$/', @$_GET['lang']) )
       
    91   {
       
    92     $flags .= $sep . 'lang=' . urlencode($_GET['lang']);
    87     $sep = '&';
    93     $sep = '&';
    88   }
    94   }
    89 
    95 
    90   $url = $session->append_sid(contentPath.$t.$flags);
    96   $url = $session->append_sid(contentPath.$t.$flags);
    91   if($query)
    97   if($query)
   131   if ( isset( $_GET['style'] ) )
   137   if ( isset( $_GET['style'] ) )
   132   {
   138   {
   133     $flags .= $sep . 'style='.$session->style;
   139     $flags .= $sep . 'style='.$session->style;
   134     $sep = '&';
   140     $sep = '&';
   135   }
   141   }
       
   142   if ( isset($_GET['lang']) && preg_match('/^[a-z0-9_]+$/', @$_GET['lang']) )
       
   143   {
       
   144     $flags .= $sep . 'lang=' . urlencode($_GET['lang']);
       
   145     $sep = '&';
       
   146   }
   136 
   147 
   137   if(defined('ENANO_BASE_CLASSES_INITIALIZED'))
   148   if(defined('ENANO_BASE_CLASSES_INITIALIZED'))
   138   {
   149   {
   139     $url = contentPath . $paths->nslist[$n] . $t . $flags;
   150     $url = contentPath . $paths->nslist[$n] . $t . $flags;
   140   }
   151   }
   197     $sep = '&';
   208     $sep = '&';
   198   }
   209   }
   199   if ( isset( $_GET['style'] ) )
   210   if ( isset( $_GET['style'] ) )
   200   {
   211   {
   201     $flags .= $sep . 'style='.$session->style;
   212     $flags .= $sep . 'style='.$session->style;
       
   213     $sep = '&';
       
   214   }
       
   215   if ( isset($_GET['lang']) && preg_match('/^[a-z0-9_]+$/', @$_GET['lang']) )
       
   216   {
       
   217     $flags .= $sep . 'lang=' . urlencode($_GET['lang']);
   202     $sep = '&';
   218     $sep = '&';
   203   }
   219   }
   204 
   220 
   205   if(defined('ENANO_BASE_CLASSES_INITIALIZED'))
   221   if(defined('ENANO_BASE_CLASSES_INITIALIZED'))
   206   {
   222   {
  2451 {
  2467 {
  2452   global $db, $session, $paths, $template, $plugins; // Common objects
  2468   global $db, $session, $paths, $template, $plugins; // Common objects
  2453   
  2469   
  2454   if ( isset($paths->nslist['User']) )
  2470   if ( isset($paths->nslist['User']) )
  2455   {
  2471   {
  2456     if ( preg_match('/^' . preg_quote($paths->nslist['User']) . '/', $page_id) )
  2472     if ( preg_match('/^' . str_replace('/', '\\/', preg_quote($paths->nslist['User'])) . '/', $page_id) )
  2457     {
  2473     {
  2458       $ip = preg_replace('/^' . preg_quote($paths->nslist['User']) . '/', '', $page_id);
  2474       $ip = preg_replace('/^' . str_replace('/', '\\/', preg_quote($paths->nslist['User'])) . '/', '', $page_id);
  2459       if ( is_valid_ip($ip) )
  2475       if ( is_valid_ip($ip) )
  2460       {
  2476       {
  2461         return $page_id;
  2477         return $page_id;
  2462       }
  2478       }
  2463     }
  2479     }