Textpattern PHP Cross Reference Content Management Systems

Source: /textpattern/lib/txplib_head.php - 278 lines - 6790 bytes - Summary - Text - Print

   1  <?php
   2  
   3  /*
   4  $HeadURL: https://textpattern.googlecode.com/svn/releases/4.5.4/source/textpattern/lib/txplib_head.php $
   5  $LastChangedRevision: 3989 $
   6  */
   7  
   8  // -------------------------------------------------------------
   9  	function pagetop($pagetitle,$message="")
  10      {
  11          global $siteurl, $sitename, $txp_user, $event, $step, $app_mode, $theme;
  12  
  13          if ($app_mode == 'async') return;
  14  
  15          $area = gps('area');
  16          $event = (!$event) ? 'article' : $event;
  17          $bm = gps('bm');
  18  
  19          $privs = safe_field("privs", "txp_users", "name = '".doSlash($txp_user)."'");
  20  
  21          $GLOBALS['privs'] = $privs;
  22  
  23          $areas = areas();
  24          $area = false;
  25  
  26          foreach ($areas as $k => $v)
  27          {
  28              if (in_array($event, $v))
  29              {
  30                  $area = $k;
  31                  break;
  32              }
  33          }
  34  
  35          if (gps('logout'))
  36          {
  37              $body_id = 'page-logout';
  38          }
  39  
  40          elseif (!$txp_user)
  41          {
  42              $body_id = 'page-login';
  43          }
  44  
  45          else
  46          {
  47              $body_id = 'page-'.txpspecialchars($event);
  48          }
  49  
  50          header('X-Frame-Options: '.X_FRAME_OPTIONS);
  51  
  52      ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  53      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo LANG; ?>" lang="<?php echo LANG; ?>" dir="<?php echo txpspecialchars(gTxt('lang_dir')); ?>">
  54      <head>
  55      <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  56      <meta name="robots" content="noindex, nofollow" />
  57      <title><?php echo escape_title($pagetitle) ?> - <?php echo txpspecialchars($sitename) ?> &#124; Textpattern CMS</title>
  58      <script type="text/javascript" src="jquery.js"></script>
  59      <?php
  60      echo script_js(
  61          'var textpattern = {
  62          event: "'.txpspecialchars($event).'",
  63          step: "'.txpspecialchars($step).'",
  64          _txp_token: "'.txpspecialchars(form_token()).'",
  65          ajax_timeout: '.txpspecialchars(AJAX_TIMEOUT).',
  66          ajaxally_challenged: '.(AJAXALLY_CHALLENGED ? 'true' : 'false').',
  67          textarray: {},
  68          do_spellcheck: "'.txpspecialchars(
  69                              get_pref('do_spellcheck', '#page-article #body, #page-article #title,'.
  70                                                      '#page-image #alt-text, #page-image #caption,'.
  71                                                      '#page-file #description,'.
  72                                                      '#page-link #link-title, #page-link #link-description')
  73                              ).'"};'
  74      );
  75      gTxtScript(array('form_submission_error', 'are_you_sure'));
  76      ?>
  77      <script type="text/javascript" src="textpattern.js"></script>
  78      <script type="text/javascript">
  79      <!--
  80          var cookieEnabled = checkCookies();
  81  
  82          if (!cookieEnabled)
  83          {
  84              confirm('<?php echo trim(gTxt('cookies_must_be_enabled')); ?>');
  85          }
  86  
  87  		function poweredit(elm)
  88          {
  89              var something = elm.options[elm.selectedIndex].value;
  90  
  91              // Add another chunk of HTML
  92              var pjs = document.getElementById('js');
  93  
  94              if (pjs == null)
  95              {
  96                  var br = document.createElement('br');
  97                  elm.parentNode.appendChild(br);
  98  
  99                  pjs = document.createElement('P');
 100                  pjs.setAttribute('id','js');
 101                  elm.parentNode.appendChild(pjs);
 102              }
 103  
 104              if (pjs.style.display == 'none' || pjs.style.display == '')
 105              {
 106                  pjs.style.display = 'block';
 107              }
 108  
 109              if (something != '')
 110              {
 111                  switch (something)
 112                  {
 113                      default:
 114                          pjs.style.display = 'none';
 115                          break;
 116                  }
 117              }
 118  
 119              return false;
 120          }
 121  
 122          addEvent(window, 'load', cleanSelects);
 123      -->
 124      </script>
 125      <?php // Mandatory un-themable Textpattern core styles ?>
 126      <style type="text/css">
 127          .not-ready .doc-ready, .not-ready form.async input[type="submit"], .not-ready a.async {
 128              visibility: hidden;
 129          }
 130      </style>
 131      <?php
 132      echo $theme->html_head();
 133      callback_event('admin_side', 'head_end');
 134      ?>
 135      </head>
 136      <body id="<?php echo $body_id; ?>" class="not-ready <?php echo $area; ?>">
 137      <div class="txp-header">
 138      <?php callback_event('admin_side', 'pagetop');
 139          $theme->set_state($area, $event, $bm, $message);
 140          echo pluggable_ui('admin_side', 'header', $theme->header());
 141          callback_event('admin_side', 'pagetop_end');
 142          echo '</div><!-- /txp-header --><div class="txp-body">';
 143      }
 144  
 145  // -------------------------------------------------------------
 146  // Is this used any more?
 147  	function areatab($label,$event,$tarea,$area)
 148      {
 149          $tc = ($area == $event) ? 'tabup' : 'tabdown';
 150          $atts=' class="'.$tc.'"';
 151          $hatts=' href="?event='.$tarea.'"';
 152          return tda(tag($label,'a',$hatts),$atts);
 153      }
 154  
 155  // -------------------------------------------------------------
 156  	function tabber($label,$tabevent,$event)
 157      {
 158          $tc = ($event==$tabevent) ? 'tabup' : 'tabdown2';
 159          $out = '<td class="'.$tc.'"><a href="?event='.$tabevent.'">'.$label.'</a></td>';
 160          return $out;
 161      }
 162  
 163  // -------------------------------------------------------------
 164  
 165  	function tabsort($area, $event)
 166      {
 167          if ($area)
 168          {
 169              $areas = areas();
 170  
 171              $out = array();
 172  
 173              foreach ($areas[$area] as $a => $b)
 174              {
 175                  if (has_privs($b))
 176                  {
 177                      $out[] = tabber($a, $b, $event, 2);
 178                  }
 179              }
 180  
 181              return ($out) ? join('', $out) : '';
 182          }
 183  
 184          return '';
 185      }
 186  
 187  // -------------------------------------------------------------
 188  	function areas()
 189      {
 190          global $privs, $plugin_areas;
 191  
 192          $areas['start'] = array(
 193          );
 194  
 195          $areas['content'] = array(
 196              gTxt('tab_organise') => 'category',
 197              gTxt('tab_write')    => 'article',
 198              gTxt('tab_list')     =>  'list',
 199              gTxt('tab_image')    => 'image',
 200              gTxt('tab_file')     => 'file',
 201              gTxt('tab_link')     => 'link',
 202              gTxt('tab_comments') => 'discuss'
 203          );
 204  
 205          $areas['presentation'] = array(
 206              gTxt('tab_sections') => 'section',
 207              gTxt('tab_pages')    => 'page',
 208              gTxt('tab_forms')    => 'form',
 209              gTxt('tab_style')    => 'css'
 210          );
 211  
 212          $areas['admin'] = array(
 213              gTxt('tab_diagnostics') => 'diag',
 214              gTxt('tab_preferences') => 'prefs',
 215              gTxt('tab_site_admin')  => 'admin',
 216              gTxt('tab_logs')        => 'log',
 217              gTxt('tab_plugins')     => 'plugin',
 218              gTxt('tab_import')      => 'import'
 219          );
 220  
 221          $areas['extensions'] = array(
 222          );
 223  
 224          if (is_array($plugin_areas))
 225              $areas = array_merge_recursive($areas, $plugin_areas);
 226  
 227          return $areas;
 228      }
 229  
 230  // -------------------------------------------------------------
 231  
 232  	function navPop($inline = '')
 233      {
 234          $areas = areas();
 235  
 236          $out = array();
 237  
 238          foreach ($areas as $a => $b)
 239          {
 240              if (!has_privs( 'tab.'.$a))
 241              {
 242                  continue;
 243              }
 244  
 245              if (count($b) > 0)
 246              {
 247                  $out[] = n.t.'<optgroup label="'.gTxt('tab_'.$a).'">';
 248  
 249                  foreach ($b as $c => $d)
 250                  {
 251                      if (has_privs($d))
 252                      {
 253                          $out[] = n.t.t.'<option value="'.$d.'">'.$c.'</option>';
 254                      }
 255                  }
 256  
 257                  $out[] = n.t.'</optgroup>';
 258              }
 259          }
 260  
 261          if ($out)
 262          {
 263              return '<form method="get" action="index.php" class="navpop">'.
 264                  n.'<select name="event" onchange="submit(this.form);">'.
 265                  n.t.'<option>'.gTxt('go').'&#8230;</option>'.
 266                  join('', $out).
 267                  n.'</select>'.
 268                  n.'</form>';
 269          }
 270      }
 271  
 272  // -------------------------------------------------------------
 273      # DEPRECATED?? Has this ever been used?
 274  	function button($label,$link)
 275      {
 276          return '<span style="margin-right:2em"><a href="?event='.$link.'">'.$label.'</a></span>';
 277      }
 278  ?>

title

Description

title

Description

title

Description

title

title

Body