Exemplo n.º 1
0
 /**
  * Constructs ThinkUpController
  *
  *  Adds email address of currently logged in ThinkUp user, '' if not logged in, to view
  *  {$logged_in_user}
  *  @return ThinkUpController
  */
 public function __construct($session_started = false)
 {
     if (!$session_started) {
         session_start();
     }
     try {
         $config = Config::getInstance();
         $this->profiler_enabled = Profiler::isEnabled();
         if ($this->profiler_enabled) {
             $this->start_time = microtime(true);
         }
         $this->view_mgr = new SmartyThinkUp();
         $this->app_session = new Session();
         if ($this->isLoggedIn()) {
             $this->addToView('logged_in_user', $this->getLoggedInUser());
         }
         if ($this->isAdmin()) {
             $this->addToView('user_is_admin', true);
         }
         require THINKUP_WEBAPP_PATH . 'install/version.php';
         $this->addToView('thinkup_version', $THINKUP_VERSION);
     } catch (Exception $e) {
         Utils::defineConstants();
         $cfg_array = array('site_root_path' => THINKUP_BASE_URL, 'source_root_path' => THINKUP_ROOT_PATH, 'debug' => false, 'app_title' => "ThinkUp", 'cache_pages' => false);
         $this->view_mgr = new SmartyThinkUp($cfg_array);
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor
  * @param array $cfg_vals Optionally override config.inc.php vals; needs 'table_prefix', 'GMT_offset', 'db_type',
  * 'db_socket', 'db_name', 'db_host', 'db_user', 'db_password'
  * @return PDODAO
  */
 public function __construct($cfg_vals=null){
     $this->logger = Logger::getInstance();
     $this->config = Config::getInstance($cfg_vals);
     if(is_null(self::$PDO)) {
         $this->connect();
     }
     self::$prefix = $this->config->getValue('table_prefix');
     self::$gmt_offset = $this->config->getGMTOffset();
     $this->profiler_enabled = Profiler::isEnabled();
 }
Exemplo n.º 3
0
 public function testIsEnabledServerNotSet() {
     $config = Config::getInstance();
     $config->setValue('enable_profiler', true);
     $this->assertTrue(!Profiler::isEnabled());
 }
Exemplo n.º 4
0
 /**
  * Constructs ThinkUpController
  *
  *  Adds email address of currently logged in ThinkUp user, '' if not logged in, to view
  *  {$logged_in_user}
  *  @return ThinkUpController
  */
 public function __construct($session_started = false)
 {
     try {
         $config = Config::getInstance();
         $this->profiler_enabled = Profiler::isEnabled();
         if ($this->profiler_enabled) {
             $this->start_time = microtime(true);
         }
         if ($config->getValue('timezone')) {
             date_default_timezone_set($config->getValue('timezone'));
         }
         if (!$session_started) {
             SessionCache::init();
         }
         $this->view_mgr = new ViewManager();
         if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
             $this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
             $this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
         }
         if ($this->isLoggedIn()) {
             $this->addToView('logged_in_user', $this->getLoggedInUser());
         }
         if ($this->isAdmin()) {
             $this->addToView('user_is_admin', true);
         }
         $THINKUP_VERSION = $config->getValue('THINKUP_VERSION');
         $this->addToView('thinkup_version', $THINKUP_VERSION);
     } catch (Exception $e) {
         Loader::definePathConstants();
         //echo 'sending this to Smarty:'.THINKUP_WEBAPP_PATH.'data/';
         $cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => THINKUP_ROOT_PATH, 'datadir_path' => THINKUP_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
         $this->view_mgr = new ViewManager($cfg_array);
     }
 }
 /**
  * Constructs ThinkUpController
  *
  *  Adds email address of currently logged in ThinkUp user, '' if not logged in, to view
  *  {$logged_in_user}
  *  @return ThinkUpController
  */
 public function __construct($session_started = false)
 {
     if (!$session_started) {
         session_start();
     }
     try {
         $config = Config::getInstance();
         $this->profiler_enabled = Profiler::isEnabled();
         if ($this->profiler_enabled) {
             $this->start_time = microtime(true);
         }
         $this->view_mgr = new SmartyThinkUp();
         if ($this->isLoggedIn()) {
             $this->addToView('logged_in_user', $this->getLoggedInUser());
         }
         if ($this->isAdmin()) {
             $this->addToView('user_is_admin', true);
         }
         $THINKUP_VERSION = $config->getValue('THINKUP_VERSION');
         $this->addToView('thinkup_version', $THINKUP_VERSION);
         if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
             $this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
             $this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
             $this->addToView('logo_link', '?u=' . urlencode(SessionCache::get('selected_instance_username')) . '&n=' . urlencode(SessionCache::get('selected_instance_network')));
         }
     } catch (Exception $e) {
         Utils::defineConstants();
         $cfg_array = array('site_root_path' => THINKUP_BASE_URL, 'source_root_path' => THINKUP_ROOT_PATH, 'debug' => false, 'app_title' => "ThinkUp", 'cache_pages' => false);
         $this->view_mgr = new SmartyThinkUp($cfg_array);
     }
 }
 /**
  * Constructs ThinkUpController
  *
  *  Adds email address of currently logged in ThinkUp user, '' if not logged in, to view
  *  {$logged_in_user}
  *  @return ThinkUpController
  */
 public function __construct($session_started = false)
 {
     try {
         $config = Config::getInstance();
         $this->profiler_enabled = Profiler::isEnabled();
         if ($this->profiler_enabled) {
             $this->start_time = microtime(true);
         }
         if ($config->getValue('timezone')) {
             date_default_timezone_set($config->getValue('timezone'));
         }
         if (!$session_started) {
             SessionCache::init();
         }
         $this->view_mgr = new ViewManager();
         if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
             $this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
             $this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
         }
         if ($this->isLoggedIn()) {
             $this->addToView('logged_in_user', $this->getLoggedInUser());
         }
         if ($this->isAdmin()) {
             $this->addToView('user_is_admin', true);
         }
         $THINKUP_VERSION = $config->getValue('THINKUP_VERSION');
         $this->addToView('thinkup_version', $THINKUP_VERSION);
         if (Utils::isThinkUpLLC()) {
             $thinkupllc_endpoint = $config->getValue('thinkupllc_endpoint');
             $this->addToView('thinkupllc_endpoint', $thinkupllc_endpoint);
         }
         if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
             $this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
             $this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
         }
     } catch (Exception $e) {
         Loader::definePathConstants();
         //echo 'sending this to Smarty:'.THINKUP_WEBAPP_PATH.'data/';
         $cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => THINKUP_ROOT_PATH, 'datadir_path' => THINKUP_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
         $this->view_mgr = new ViewManager($cfg_array);
         $this->setErrorTemplateState();
         $this->addToView('error_type', get_class($e));
         $disable_xss = false;
         // if we are an installer exception, don't filter XSS, we have markup, and we trust this content
         if (get_class($e) == 'InstallerException') {
             $disable_xss = true;
         }
         $this->addErrorMessage($e->getMessage(), null, $disable_xss);
     }
 }
Exemplo n.º 7
0
 /**
  * Constructs EFCController
  *
  *  Adds email address of currently logged in EFC user, '' if not logged in, to view
  *  {$logged_in_user}
  *  @return EFCController
  */
 public function __construct($session_started = false)
 {
     try {
         //$this->baseMem = memory_get_usage(true);
         $this->redis = new Redis();
         $this->redis->connect('127.0.0.1', 6379);
         $this->memcache = new Memcache();
         $this->memcache->connect('127.0.0.1', 11211);
         $config = Config::getInstance();
         $this->profiler_enabled = Profiler::isEnabled();
         if ($this->profiler_enabled) {
             $this->start_time = microtime(true);
         }
         if ($config->getValue('timezone')) {
             date_default_timezone_set($config->getValue('timezone'));
         }
         if (!$session_started) {
             SessionCache::init();
         }
         $this->view_mgr = new ViewManager();
         $this->facebook = new Facebook\Facebook(['app_id' => $config->getValue('fb_app_id'), 'app_secret' => $config->getValue('fb_app_secret'), 'default_graph_version' => 'v2.2']);
         if ($this->isLoggedIn()) {
             $this->addToView('logged_in_user', $this->getLoggedInUser());
         }
         if ($this->isSuperAdmin()) {
             $this->addToView('user_is_admin', true);
         }
         $EFC_VERSION = $config->getValue('EFC_VERSION');
         $this->addToView('EFC_VERSION', $EFC_VERSION);
         if (Utils::isEmpoddyLabs()) {
             $empoddy_endpoint = $config->getValue('empoddy_endpoint');
             $this->addToView('empoddy_endpoint', $empoddy_endpoint);
         }
         if (SessionCache::isKeySet('selected_instance_network') && SessionCache::isKeySet('selected_instance_username')) {
             $this->addToView('selected_instance_network', SessionCache::get('selected_instance_network'));
             $this->addToView('selected_instance_username', SessionCache::get('selected_instance_username'));
         }
     } catch (Exception $e) {
         Loader::definePathConstants();
         //echo 'sending this to Smarty:'.EFC_WEBAPP_PATH.'data/';
         $cfg_array = array('site_root_path' => Utils::getSiteRootPathFromFileSystem(), 'source_root_path' => EFC_ROOT_PATH, 'datadir_path' => EFC_WEBAPP_PATH . 'data/', 'debug' => false, 'app_title_prefix' => "", 'cache_pages' => false);
         $this->view_mgr = new ViewManager($cfg_array);
         $this->setErrorTemplateState();
         $this->addToView('error_type', get_class($e));
         $disable_xss = false;
         // if we are an installer exception, don't filter XSS, we have markup, and we trust this content
         if (get_class($e) == 'InstallerException') {
             $disable_xss = true;
         }
         $this->addErrorMessage($e->getMessage(), null, $disable_xss);
     }
 }