Esempio n. 1
0
 /**
  *  Create the URL for database used.
  */
 function init($user, $pass, $host, $dbase)
 {
     $retval = true;
     /*
      *  Initialize trace object
      */
     if (defined('__SP_TRACE')) {
         $this->_trace = CSpTrace::getInstance();
     }
     $this->addTrace(__FUNCTION__);
     $this->_dbHost = $host;
     $this->_dbUser = $user;
     $this->_dbPass = $pass;
     $this->_dbName = $dbase;
     $this->_dbObj = new mysqli($this->_dbHost, $this->_dbUser, $this->_dbPass, $this->_dbName);
     if (mysqli_connect_errno()) {
         $this->addTrace("[" . mysqli_connect_error() . "] " . mysqli_connect_error());
         $retval = false;
     }
     return $retval;
 }
Esempio n. 2
0
 /**
  *  Actual initilization of theme object
  */
 public function init($theme)
 {
     $retval = true;
     /*
      *  Initialize trace object
      */
     if (defined('__SP_TRACE')) {
         $this->_trace = CSpTrace::getInstance();
     }
     $this->addTrace(__FUNCTION__);
     /*
      *  Detect the browser type
      */
     if (strpos($_SERVER["HTTP_USER_AGENT"], 'Mozilla') == true) {
         $this->_browser = BROWSER_FIREFOX;
     } else {
         if (strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') == true) {
             $this->_browser = BROWSER_IE;
         } else {
             if (strpos($_SERVER["HTTP_USER_AGENT"], 'Opera') == true) {
                 $this->_browser = BROWSER_OPERA;
             } else {
                 $this->_browser = BROWSER_OTHER;
             }
         }
     }
     /*
      *  Load information from specified theme
      */
     $this->addTrace('Load information from the theme.');
     if (is_dir('./themes/' . $theme)) {
         if (is_file('./themes/' . $theme . '/interface.php')) {
             require_once './themes/' . $theme . '/interface.php';
         } else {
             $retval = false;
             $this->addTrace('Theme - ' . $theme . ' - does not publish necessary interface.');
         }
     } else {
         $retval = false;
         $this->addTrace('Theme - ' . $theme . ' - does not exist.');
     }
     /*
      *  Initialize Smarty template engine
      */
     $this->addTrace('Create Smarty object.');
     $this->_tpl =& new Smarty();
     if (is_null($this->_tpl)) {
         $retval = false;
         $this->addTrace('ERR: Unable to create a Smarty object.');
     } else {
         $this->_tpl->template_dir = $this->_dir . '/templates';
         $this->_tpl->compile_dir = $this->_dir . '/templates_c';
         $this->_tpl->config_dir = $this->_dir . '/configs';
         $this->_tpl->cache_dir = $this->_dir . '/cache';
     }
     return $retval;
 }
Esempio n. 3
0
 /**
  * Initialize trace object.
  */
 private function _initTrace()
 {
     if (defined('__SP_TRACE')) {
         $this->_trace = CSpTrace::getInstance();
     }
 }
Esempio n. 4
0
 /**
  *  Restore the state of this singleton object from session variables.
  */
 private static function _loadSession()
 {
     self::$_count = $_SESSION[__CLASS__ . '_count'];
     self::$_cache = $_SESSION[__CLASS__ . '_cache'];
     /*
      *  Clear session variables to ensure that this function is
      *  not called again.
      */
     unset($_SESSION[__CLASS__ . '_count']);
     unset($_SESSION[__CLASS__ . '_cache']);
     unset($_SESSION['TRACE']);
     /*
      *  Add divider between sessions
      */
     self::$_cache[] = "::::::::::::::::::::::::::::::::::::::::";
 }
Esempio n. 5
0
//  ============================================================================
session_start();
//  ----------------------------------------------------------------------------
//  Initialize Globals
//  ----------------------------------------------------------------------------
$GLOBALS['Trace'] = null;
$GLOBALS['App'] = null;
$GLOBALS['ArrCategories'] = array();
$GLOBALS['ArrBookmarks'] = array();
$GLOBALS['CurCategory'] = null;
$GLOBALS['SelCategory'] = null;
$GLOBALS['SelBookmark'] = null;
//  ----------------------------------------------------------------------------
//  Instantiate the trace object
//  ----------------------------------------------------------------------------
$GLOBALS['Trace'] = CSpTrace::getInstance();
$GLOBALS['Trace']->Add('Begin [' . date('M d, Y h:i:s A') . ']');
//  ----------------------------------------------------------------------------
//  Default category ID (Can be defined via configuration)
//  ----------------------------------------------------------------------------
$GLOBALS['Trace']->Add('Initialize curCategory');
$GLOBALS['CurCategory'] = 0;
//  ----------------------------------------------------------------------------
//  Initialize theme
//  ----------------------------------------------------------------------------
if (defined('__SP_USE_THEME')) {
    $UseTheme = __SP_USE_THEME;
} else {
    define('__SP_USE_THEME', 'default');
}
//  ----------------------------------------------------------------------------