[ Index ]

PHP Cross Reference of Textpattern 4.0.8

title

Body

[close]

/textpattern/ -> index.php (source)

   1  <?php
   2  
   3  /*
   4      This is Textpattern
   5  
   6      Copyright 2005 by Dean Allen
   7      www.textpattern.com
   8      All rights reserved
   9  
  10      Use of this software indicates acceptance of the Textpattern license agreement
  11  
  12  $HeadURL: https://textpattern.googlecode.com/svn/releases/4.0.8/source/textpattern/index.php $
  13  $LastChangedRevision: 3085 $
  14  
  15  */
  16      if (@ini_get('register_globals'))
  17          foreach ( $_REQUEST as $name => $value )
  18              unset($$name);
  19  
  20      define("txpath", dirname(__FILE__));
  21      define("txpinterface", "admin");
  22  
  23      $thisversion = '4.0.8';
  24      $txp_using_svn = false; // set false for releases
  25  
  26      ob_start(NULL, 2048);
  27      if (!@include './config.php') {
  28          ob_end_clean();
  29          include txpath.'/setup/index.php';
  30          exit();
  31      } else ob_end_clean();
  32  
  33      header("Content-type: text/html; charset=utf-8");
  34      if (isset($_POST['form_preview'])) {
  35          include txpath.'/publish.php';
  36          textpattern();
  37          exit;
  38      }
  39  
  40      error_reporting(E_ALL);
  41      @ini_set("display_errors","1");
  42  
  43      include_once txpath.'/lib/constants.php';
  44      include txpath.'/lib/txplib_misc.php';
  45      include txpath.'/lib/txplib_db.php';
  46      include txpath.'/lib/txplib_forms.php';
  47      include txpath.'/lib/txplib_html.php';
  48      include txpath.'/lib/admin_config.php';
  49  
  50      $microstart = getmicrotime();
  51  
  52       if ($connected && safe_query("describe `".PFX."textpattern`")) {
  53  
  54          $dbversion = safe_field('val','txp_prefs',"name = 'version'");
  55  
  56          $prefs = get_prefs();
  57          extract($prefs);
  58  
  59          if (empty($siteurl))
  60              $siteurl = $_SERVER['HTTP_HOST'] . rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'])), '/');
  61          if (empty($path_to_site))
  62              updateSitePath(dirname(dirname(__FILE__)));
  63  
  64          define("LANG",$language);
  65          //i18n: define("LANG","en-gb");
  66          define('txp_version', $thisversion);
  67  
  68          if (!defined('PROTOCOL')) {
  69              switch (serverSet('HTTPS')) {
  70                  case '':
  71                  case 'off': // ISAPI with IIS
  72                      define('PROTOCOL', 'http://');
  73                  break;
  74  
  75                  default:
  76                      define('PROTOCOL', 'https://');
  77                  break;
  78              }
  79          }
  80  
  81          define("hu",PROTOCOL.$siteurl.'/');
  82          // v1.0 experimental relative url global
  83          define("rhu",preg_replace("/https?:\/\/.+(\/.*)\/?$/U","$1",hu));
  84  
  85          if (!empty($locale)) setlocale(LC_ALL, $locale);
  86          $textarray = load_lang(LANG);
  87  
  88          include txpath.'/include/txp_auth.php';
  89          doAuth();
  90  
  91          $event = (gps('event') ? gps('event') : 'article');
  92          $step = gps('step');
  93  
  94          if (!$dbversion or ($dbversion != $thisversion) or $txp_using_svn)
  95          {
  96              define('TXP_UPDATE', 1);
  97              include txpath.'/update/_update.php';
  98          }
  99  
 100          if (!empty($admin_side_plugins) and gps('event') != 'plugin')
 101              load_plugins(1);
 102  
 103          include txpath.'/lib/txplib_head.php';
 104  
 105          // ugly hack, for the people that don't update their admin_config.php
 106          // Get rid of this when we completely remove admin_config and move privs to db
 107          if ($event == 'list')
 108              require_privs('article');
 109          else
 110              require_privs($event);
 111  
 112          callback_event($event, $step, 1);
 113  
 114          $inc = txpath . '/include/txp_'.$event.'.php';
 115          if (is_readable($inc))
 116              include($inc);
 117  
 118          callback_event($event, $step, 0);
 119  
 120          $microdiff = (getmicrotime() - $microstart);
 121          echo n.comment(gTxt('runtime').': '.substr($microdiff,0,6));
 122  
 123          end_page();
 124  
 125      } else {
 126          txp_die('DB-Connect was succesful, but the textpattern-table was not found.',
 127                  '503 Service Unavailable');
 128      }
 129  ?>


Generated: Thu May 21 23:03:01 2009 Cross-referenced by PHPXref 0.7