includes/template.php
changeset 215 94db56b8124f
parent 212 30b857a6b811
child 226 0e6478521004
equal deleted inserted replaced
214:a6ed8b6cdbe1 215:94db56b8124f
   663     $parser = $this->makeParserText($tplvars['sidebar_button']);
   663     $parser = $this->makeParserText($tplvars['sidebar_button']);
   664     
   664     
   665     $parser->assign_vars(Array(
   665     $parser->assign_vars(Array(
   666         'HREF'=>makeUrlNS('Special', 'Logout'),
   666         'HREF'=>makeUrlNS('Special', 'Logout'),
   667         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { mb_logout(); return false; }"',
   667         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { mb_logout(); return false; }"',
   668         'TEXT'=>'Log out',
   668         'TEXT'=>$lang->get('sidebar_btn_logout'),
   669       ));
   669       ));
   670     
   670     
   671     $logout_link = $parser->run();
   671     $logout_link = $parser->run();
   672     
   672     
   673     $parser->assign_vars(Array(
   673     $parser->assign_vars(Array(
   674         'HREF'=>makeUrlNS('Special', 'Login/' . $paths->page),
   674         'HREF'=>makeUrlNS('Special', 'Login/' . $paths->page),
   675         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxStartLogin(); return false; }"',
   675         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxStartLogin(); return false; }"',
   676         'TEXT'=>'Log in',
   676         'TEXT'=>$lang->get('sidebar_btn_login'),
   677       ));
   677       ));
   678     
   678     
   679     $login_link = $parser->run();
   679     $login_link = $parser->run();
   680     
   680     
   681     $parser->assign_vars(Array(
   681     $parser->assign_vars(Array(
   682         'HREF'=>makeUrlNS('Special', 'ChangeStyle/'.$paths->page),
   682         'HREF'=>makeUrlNS('Special', 'ChangeStyle/'.$paths->page),
   683         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxChangeStyle(); return false; }"',
   683         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { ajaxChangeStyle(); return false; }"',
   684         'TEXT'=>'Change theme',
   684         'TEXT'=>$lang->get('sidebar_btn_changestyle'),
   685       ));
   685       ));
   686     
   686     
   687     $theme_link = $parser->run();
   687     $theme_link = $parser->run();
   688     
   688     
   689     $parser->assign_vars(Array(
   689     $parser->assign_vars(Array(
   690         'HREF'=>makeUrlNS('Special', 'Administration'),
   690         'HREF'=>makeUrlNS('Special', 'Administration'),
   691         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { void(ajaxStartAdminLogin()); return false; }"',
   691         'FLAGS'=>'onclick="if ( !KILL_SWITCH ) { void(ajaxStartAdminLogin()); return false; }"',
   692         'TEXT'=>'Administration',
   692         'TEXT'=>$lang->get('sidebar_btn_administration'),
   693       ));
   693       ));
   694     
   694     
   695     $admin_link = $parser->run();
   695     $admin_link = $parser->run();
   696     
   696     
   697     $SID = ($session->sid_super) ? $session->sid_super : '';
   697     $SID = ($session->sid_super) ? $session->sid_super : '';
   797   }
   797   }
   798   
   798   
   799   function header($simple = false) 
   799   function header($simple = false) 
   800   {
   800   {
   801     global $db, $session, $paths, $template, $plugins; // Common objects
   801     global $db, $session, $paths, $template, $plugins; // Common objects
       
   802     global $lang;
       
   803     
   802     ob_start();
   804     ob_start();
   803     
   805     
   804     if(!$this->theme_loaded)
   806     if(!$this->theme_loaded)
   805     {
   807     {
   806       $this->load_theme($session->theme, $session->style);
   808       $this->load_theme($session->theme, $session->style);
   823     }
   825     }
   824     if ( !$simple && $session->sw_timed_out )
   826     if ( !$simple && $session->sw_timed_out )
   825     {
   827     {
   826       $login_link = makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $session->user_level, true);
   828       $login_link = makeUrlNS('Special', 'Login/' . $paths->fullpage, 'level=' . $session->user_level, true);
   827       echo '<div class="usermessage">';
   829       echo '<div class="usermessage">';
   828       echo '<b>Your administrative session has timed out.</b> <a href="' . $login_link . '">Log in again</a>';
   830       echo $lang->get('user_msg_elev_timed_out', array( 'login_link' => $login_link ));
   829       echo '</div>';
   831       echo '</div>';
   830     }
   832     }
   831     if ( $this->site_disabled && $session->user_level >= USER_LEVEL_ADMIN && ( $paths->page != $paths->nslist['Special'] . 'Administration' ) )
   833     if ( $this->site_disabled && $session->user_level >= USER_LEVEL_ADMIN && ( $paths->page != $paths->nslist['Special'] . 'Administration' ) )
   832     {
   834     {
   833       $admin_link = makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'GeneralConfig', true);
   835       $admin_link = makeUrlNS('Special', 'Administration', 'module=' . $paths->nslist['Admin'] . 'GeneralConfig', true);
  1281    */
  1283    */
  1282   
  1284   
  1283   function tplWikiFormat($message, $filter_links = false, $filename = 'elements.tpl')
  1285   function tplWikiFormat($message, $filter_links = false, $filename = 'elements.tpl')
  1284   {
  1286   {
  1285     global $db, $session, $paths, $template, $plugins; // Common objects
  1287     global $db, $session, $paths, $template, $plugins; // Common objects
       
  1288     global $lang;
       
  1289     
  1286     $filter_links = false;
  1290     $filter_links = false;
  1287     $tplvars = $this->extract_vars($filename);
  1291     $tplvars = $this->extract_vars($filename);
  1288     if($session->sid_super) $as = htmlspecialchars(urlSeparator).'auth='.$session->sid_super;
  1292     if($session->sid_super) $as = htmlspecialchars(urlSeparator).'auth='.$session->sid_super;
  1289     else $as = '';
  1293     else $as = '';
  1290     error_reporting(E_ALL);
  1294     error_reporting(E_ALL);
  1409         else $c = $links[2][$i];
  1413         else $c = $links[2][$i];
  1410         $message = str_replace('{CONDITIONAL:'.$i.':'.$random_id.'}', $c, $message);
  1414         $message = str_replace('{CONDITIONAL:'.$i.':'.$random_id.'}', $c, $message);
  1411       }
  1415       }
  1412     }
  1416     }
  1413     
  1417     
       
  1418     preg_match_all('/\{lang:([a-z0-9]+_[a-z0-9_]+)\}/', $message, $matches);
       
  1419     foreach ( $matches[1] as $i => $string_id )
       
  1420     {
       
  1421       $string = $lang->get($string_id);
       
  1422       $string = str_replace('\\', '\\\\', $string);
       
  1423       $string = str_replace('\'', '\\\'', $string);
       
  1424       $message = str_replace_once($matches[0][$i], $string, $message);
       
  1425     }
       
  1426     
  1414     /*
  1427     /*
  1415      * HTML RENDERER
  1428      * HTML RENDERER
  1416      */
  1429      */
  1417      
  1430      
  1418     // Images
  1431     // Images