Example #1
0
 /**
  * CONSTRUCTOR
  *
  * @return      @e void
  */
 public function __construct()
 {
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_lang'), 'syncApp');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $sqlPassed = FALSE;
     $classname = "db_driver_Mysql";
     $sync_DB = new $classname();
     $sync_DB->obj['sql_database'] = $this->settings['syncapp_realm_database'];
     $sync_DB->obj['sql_user'] = $this->settings['syncapp_mysql_user'];
     $sync_DB->obj['sql_pass'] = $this->settings['syncapp_mysql_password'];
     $sync_DB->obj['sql_host'] = $this->settings['syncapp_mysql_ip'];
     $sync_DB->return_die = true;
     if (!$sync_DB->connect()) {
         $fail = 1;
         return $fail;
         /* At this point we dont have a connection so ABORT! else database driver error */
     }
     if ($this->settings['syncapp_mysql_user'] || $this->settings['syncapp_mysql_password'] || $fail != 1) {
         $this->sqlPassed = TRUE;
         $this->registry->dbFunctions()->setDB('mysql', 'auth_DB', array('sql_database' => $this->settings['syncapp_realm_database'], 'sql_user' => $this->settings['syncapp_mysql_user'], 'sql_pass' => $this->settings['syncapp_mysql_password'], 'sql_host' => $this->settings['syncapp_mysql_ip']));
     } else {
         return;
     }
 }
Example #2
0
 /**
  * Method constructor
  *
  * @return	@e void
  */
 public function __construct()
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
 }
Example #3
0
 /**
  * CONSTRUCTOR
  *
  * @param	object	Registry
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make registry objects */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
 }
 /**
  * Constructor
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     //-----------------------------------------
     // Need to reset?
     //-----------------------------------------
     if ($this->memberData['msg_count_reset']) {
         $this->memberData['pconversation_filters'] = $this->resetMembersFolderCounts($this->memberData['member_id']);
         $this->resetMembersTotalTopicCount($this->memberData['member_id']);
         $this->resetMembersNewTopicCount($this->memberData['member_id']);
     }
     /* Load parser */
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/text/parser.php', 'classes_text_parser');
     $this->Parser = new $classToLoad();
     /* Set up parser */
     $this->Parser->set(array('memberData' => $this->memberData, 'parseBBCode' => 1, 'parseArea' => 'pms', 'parseHtml' => 0, 'parseEmoticons' => 1));
     //-----------------------------------------
     // INIT Folder contents
     //-----------------------------------------
     $folderContents = array();
     //-----------------------------------------
     // Do a little set up, do a litle dance, get
     // down tonight! *boogie*
     //-----------------------------------------
     $this->_dirData = $this->explodeFolderData($this->memberData['pconversation_filters']);
     //-----------------------------------------
     // Do we have VID?
     // No, it's just the way we walk! Haha, etc.
     //-----------------------------------------
     if ($this->request['folderID'] and $this->request['folderID']) {
         $this->_currentFolderID = $this->request['folderID'];
     } else {
         /* Got any new messages? If so, show that. If not, show myconvo
            I'm sure you could have figured that out without this silly comment...*/
         $this->_currentFolderID = $this->_dirData['new']['count'] ? 'new' : 'myconvo';
     }
     //-----------------------------------------
     // Print folder links
     //-----------------------------------------
     foreach ($this->_dirData as $id => $data) {
         if ($data['protected'] and $id != 'myconvo') {
             continue;
         }
         $folderContents[] = "<option value='move_{$id}'>{$data['real']}</option>";
     }
     if (count($folderContents) > 1) {
         $this->_jumpMenu = implode("\n", $folderContents);
     } else {
         $this->_jumpMenu = '';
     }
 }
Example #5
0
 /**
  * Returns details about the board
  * 
  * @param	string  $api_key  	Authentication Key
  * @param	string  $api_module  Module
  * @return	string	xml
  */
 public function fetchStats($api_key, $api_module)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $api_key = IPSText::md5Clean($api_key);
     $api_module = IPSText::parseCleanValue($api_module);
     //-----------------------------------------
     // Authenticate
     //-----------------------------------------
     if ($this->__authenticate($api_key, $api_module, 'fetchStats') !== FALSE) {
         //-----------------------------------------
         // Add log
         //-----------------------------------------
         $this->addLogging($api_key);
         $stats = $this->registry->cache()->getCache('stats');
         $most_time = ipsRegistry::getClass('class_localization')->getDate($stats['most_date'], 'LONG');
         $most_count = ipsRegistry::getClass('class_localization')->formatNumber($stats['most_count']);
         $total_posts = $stats['total_topics'] + $stats['total_replies'];
         $total_posts = ipsRegistry::getClass('class_localization')->formatNumber($total_posts);
         $mem_count = ipsRegistry::getClass('class_localization')->formatNumber($stats['mem_count']);
         $mem_last_id = $stats['last_mem_id'];
         $mem_last_name = $stats['last_mem_name'];
         //-----------------------------------------
         // Return info
         //-----------------------------------------
         $this->classApiServer->apiSendReply(array('users_most_online' => $most_count, 'users_most_date_formatted' => $most_time, 'users_most_data_unix' => $stats['most_date'], 'total_posts' => $total_posts, 'total_members' => $mem_count, 'last_member_id' => $mem_last_id, 'last_member_name' => $mem_last_name));
         exit;
     }
 }
Example #6
0
 /**
  * Method constructor
  *
  * @access	public
  * @param	string		Application
  * @return	@e void
  * 
  */
 public function __construct($app = 'core')
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Set local data */
     $this->setApp($app);
     /* Load application file */
     $this->_loadExtension();
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->lang->loadLanguageFile(array('public_profile'));
 }
Example #8
0
 /**
  * The JIT find file patcher.
  *
  * @param  object $loader The autloader instance.
  * @param  string $class  The fully-namespaced class name.
  * @param  string $file   The correponding finded file path.
  * @return string         The patched file path.
  */
 public function findFile($loader, $class, $file)
 {
     if ($file) {
         return $file;
     }
     $allowed = empty($this->_namespaces);
     foreach ($this->_namespaces as $ns) {
         if (strpos($class, $ns) === 0) {
             $allowed = true;
         }
     }
     if (!DummyClassPlugin::enabled() || !$allowed) {
         return $file;
     }
     $classpath = strtr($class, '\\', DS);
     return $loader->cache('/dummies/' . $classpath . '.php', static::generate(compact('class')));
 }
 /**
  * XMLRPC_server::newPost()
  *
  * Post a new entry.
  *
  * @access	public
  * @param	int		$blogid       	   			Blog ID
  * @param	string	$username					Username
  * @param	string	$password					Password
  * @param	array	$content					Post content
  * @param	bool	$publish					Publish?
  * @return	string	xml
  **/
 public function newPost($blogid, $username, $password, $content, $publish)
 {
     $this->registry->class_localization->loadLanguageFile(array('public_portal'), 'blog');
     //-----------------------------------------
     // Authenticate
     //-----------------------------------------
     if ($this->_authenticate($username, $password)) {
         if ($this->blog['blog_id'] != $blogid) {
             $this->classApiServer->apiSendError(100, $this->registry->class_localization->words['blogger_error_3']);
             exit;
         }
         //-----------------------------------------
         // return
         //-----------------------------------------
         if (!$this->_compilePost($content['description'], $publish)) {
             $this->classApiServer->apiSendError(100, $this->error);
             exit;
         }
         $this->registry->DB()->insert('blog_entries', $this->entry);
         $entry_id = $this->registry->DB()->getInsertId();
         $this->registry->blog_std->rebuildBlog($this->blog['blog_id']);
         //-----------------------------------------
         // Load and config POST class
         //-----------------------------------------
         require_once IPSLib::getAppDir('blog') . "/sources/lib/lib_post.php";
         require_once IPSLib::getAppDir('blog') . "/sources/lib/entry_new_entry.php";
         $this->lib_post = new postFunctions($this->registry);
         $this->lib_post->blog =& $this->blog;
         //-------------------------------------------------
         // If the entry is published, run the Blog tracker and pings
         //-------------------------------------------------
         $this->lib_post->blogTracker($entry_id, $this->entry['entry_name'], $this->entry['entry']);
         $this->lib_post->blogPings($entry_id, $this->entry);
         //-------------------------------------------------
         // Update the Blog stats
         //-------------------------------------------------
         $r = $this->registry->cache()->getCache('blog_stats');
         $r['blog_stats']['stats_num_entries']++;
         $this->registry->cache()->setCache('blog_stats', $r, array('array' => 1, 'deletefirst' => 0, 'donow' => 1));
         $this->classApiServer->apiSendReply($entry_id);
         exit;
     } else {
         $this->classApiServer->apiSendError(100, $this->error);
         exit;
     }
 }
Example #10
0
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @param	object		Parent bbcode class
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry, $_parent = null)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->_parentBBcode = $_parent;
     /* Retrieve bbcode data */
     $bbcodeCache = $this->cache->getCache('bbcode');
     $this->_bbcode = $bbcodeCache[$this->currentBbcode];
 }
Example #11
0
 /**
  * CONSTRUCTOR
  *
  * @param	object	Registry
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make registry objects */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Just to be sure */
     $this->setBypassPermissionCheck(false);
     /* Just for now */
     $this->settings['su_parse_url'] = 1;
     $this->settings['tc_parse_tags'] = 1;
     $this->settings['tc_parse_names'] = 1;
 }
 /**
  * Constructor
  *
  * @param	object		Registry object
  * @param	string		Parsing method to use
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry, $method = 'normal')
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->pre_edit_parse_method = $method;
     /* Initialize our bbcode class */
     $this->_loadClasses();
     /* And some default properties */
     $this->bypass_badwords = $this->memberData ? intval($this->memberData['g_bypass_badwords']) : 0;
     $this->strip_quotes = $this->settings['strip_quotes'];
 }
 /**
  * Method constructor
  *
  * @access	public
  * @param	object		Registry Object
  * @param	array 		Array of settings:
  *						[ 'sqlPrimaryID'	(the SQL table field for the item ID)
  *						  'sqlParentID'  	(the SQL table field for the parent ID)
  *						  'sqlFolderFlag'	(the SQL table field that tells if the row is a folder or not *Optional)
  *						  'sqlTitle'		(the SQL table field for the item title)
  *						  'sqlOrder'		(the SQL table field(s) to order on or by)
  *						  'sqlTable'		(the SQL table name)
  *						  'sqlWhere'		(Any additional 'where' information *Optional) ]
  * @return	void
  */
 public function __construct(ipsRegistry $registry, $settings)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Sort out settings */
     $this->_sqlPrimaryID = isset($settings['sqlPrimaryID']) ? $settings['sqlPrimaryID'] : '';
     $this->_sqlParentID = isset($settings['sqlParentID']) ? $settings['sqlParentID'] : '';
     $this->_sqlFolderFlag = isset($settings['sqlFolderFlag']) ? $settings['sqlFolderFlag'] : '';
     $this->_sqlTitle = isset($settings['sqlTitle']) ? $settings['sqlTitle'] : '';
     $this->_sqlOrder = isset($settings['sqlOrder']) ? $settings['sqlOrder'] : '';
     $this->_sqlTable = isset($settings['sqlTable']) ? $settings['sqlTable'] : '';
     $this->_sqlWhere = isset($settings['sqlWhere']) ? $settings['sqlWhere'] : '';
     /* Build the tiers */
     $this->_buildTiers();
 }
 /**
  * Initialize class
  *
  * @access	public
  * @return	void
  */
 public function init()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     require_once IPS_PATH_CUSTOM_LOGIN . '/login_core.php';
     require_once IPS_PATH_CUSTOM_LOGIN . '/login_interface.php';
     $classes = array();
     $configs = array();
     $methods = array();
     //-----------------------------------------
     // Do we have cache?
     //-----------------------------------------
     $cache = $this->registry->cache()->getCache('login_methods');
     if (is_array($cache) and count($cache)) {
         foreach ($cache as $login_method) {
             if ($login_method['login_enabled']) {
                 if (file_exists(IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php')) {
                     $classes[$login_method['login_order']] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php';
                     $configs[$login_method['login_order']] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/conf.php';
                     $this->login_methods[$login_method['login_order']] = $login_method;
                     $this->login_confs[$login_method['login_order']] = array();
                     if (file_exists($configs[$login_method['login_order']])) {
                         $LOGIN_CONF = array();
                         require $configs[$login_method['login_order']];
                         $this->login_confs[$login_method['login_order']] = $LOGIN_CONF;
                     }
                     $classname = "login_" . $login_method['login_folder_name'];
                     require_once $classes[$login_method['login_order']];
                     $this->modules[$login_method['login_order']] = new $classname($this->registry, $login_method, $this->login_confs[$login_method['login_order']]);
                 }
             }
         }
     } else {
         $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
         $this->DB->execute();
         while ($login_method = $this->DB->fetch()) {
             if (file_exists(IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php')) {
                 $classes[$login_method['login_order']] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php';
                 $configs[$login_method['login_order']] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/conf.php';
                 $this->login_methods[$login_method['login_order']] = $login_method;
                 if (file_exists($configs[$login_method['login_order']])) {
                     $LOGIN_CONF = array();
                     require $configs[$login_method['login_order']];
                     $this->login_confs[$login_method['login_order']] = $LOGIN_CONF;
                 }
                 $classname = "login_" . $login_method['login_folder_name'];
                 require_once $classes[$login_method['login_order']];
                 $this->modules[$login_method['login_order']] = new $classname($this->registry, $login_method, $this->login_confs[$login_method['login_order']]);
             }
         }
     }
     //-----------------------------------------
     // Got nothing?
     //-----------------------------------------
     if (!count($classes)) {
         $login_method = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'login_methods', 'where' => "login_folder_name='internal'"));
         if ($login_method['login_id']) {
             $classes[0] = IPS_PATH_CUSTOM_LOGIN . '/internal/auth.php';
             $this->login_methods[0] = $login_method;
             $this->login_confs[0] = array();
             $classname = "login_internal";
             require_once $classes[0];
             $this->modules[0] = new $classname($this->registry, $login_method, array());
         }
     }
     //-----------------------------------------
     // If we're here, there is no enabled login
     // handler and internal was deleted
     //-----------------------------------------
     if (!count($this->modules)) {
         $this->registry->output->showError($this->lang->words['no_login_methods'], 4000);
     }
     //-----------------------------------------
     // Pass of some data
     //-----------------------------------------
     foreach ($this->modules as $k => $obj_reference) {
         $obj_reference->is_admin_auth = $this->is_admin_auth;
         $obj_reference->login_method = $this->login_methods[$k];
         $obj_reference->login_conf = $this->login_confs[$k];
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     //require_once( IPS_ROOT_PATH . 'sources/interfaces/interface_bbcode.php' );
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->initOurBbcodes();
     IPSDebug::setMemoryDebugFlag("BBCodes initialized", $_NOW);
     /* Check for emoticons */
     if (!is_array($this->caches['emoticons']) or !count($this->caches['emoticons'])) {
         $this->cache->rebuildCache('emoticons', 'global');
     }
 }
 /**
  * Initialize class
  *
  * @return	@e void
  */
 public function init()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     require_once IPS_PATH_CUSTOM_LOGIN . '/login_core.php';
     /*noLibHook*/
     require_once IPS_PATH_CUSTOM_LOGIN . '/login_interface.php';
     /*noLibHook*/
     $classes = array();
     $configs = array();
     $methods = array();
     //-----------------------------------------
     // Do we have cache?
     //-----------------------------------------
     $cache = $this->registry->cache()->getCache('login_methods');
     if (is_array($cache) and count($cache)) {
         foreach ($cache as $login_method) {
             if ($login_method['login_enabled']) {
                 if (is_file(IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php')) {
                     $classes[$login_method['login_order']] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php';
                     $this->login_methods[$login_method['login_order']] = $login_method;
                     $this->login_confs[$login_method['login_order']] = $login_method['login_custom_config'] ? @unserialize($login_method['login_custom_config']) : array();
                     $classname = IPSLib::loadLibrary($classes[$login_method['login_order']], 'login_' . $login_method['login_folder_name']);
                     $this->modules[$login_method['login_order']] = new $classname($this->registry, $login_method, $this->login_confs[$login_method['login_order']]);
                 }
             }
         }
     } else {
         $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
         $this->DB->execute();
         while ($login_method = $this->DB->fetch()) {
             if (is_file(IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php')) {
                 $classes[$login_method['login_order']] = IPS_PATH_CUSTOM_LOGIN . '/' . $login_method['login_folder_name'] . '/auth.php';
                 $this->login_methods[$login_method['login_order']] = $login_method;
                 $this->login_confs[$login_method['login_order']] = $login_method['login_custom_config'] ? @unserialize($login_method['login_custom_config']) : array();
                 $classToLoad = IPSLib::loadLibrary($classes[$login_method['login_order']], 'login_' . $login_method['login_folder_name']);
                 $this->modules[$login_method['login_order']] = new $classToLoad($this->registry, $login_method, $this->login_confs[$login_method['login_order']]);
             }
         }
     }
     //-----------------------------------------
     // Got nothing?
     //-----------------------------------------
     if (!count($classes)) {
         $login_method = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'login_methods', 'where' => "login_folder_name='internal'"));
         if ($login_method['login_id']) {
             $classes[0] = IPS_PATH_CUSTOM_LOGIN . '/internal/auth.php';
             $this->login_methods[0] = $login_method;
             $this->login_confs[0] = array();
             $classToLoad = IPSLib::loadLibrary($classes[0], 'login_internal');
             $this->modules[0] = new $classToLoad($this->registry, $login_method, array());
         }
     }
     //-----------------------------------------
     // If we're here, there is no enabled login
     // handler and internal was deleted
     //-----------------------------------------
     if (!count($this->modules)) {
         $this->registry->output->showError($this->registry->getClass('class_localization')->words['no_login_methods'], 4000);
     }
     //-----------------------------------------
     // Pass of some data
     //-----------------------------------------
     foreach ($this->modules as $k => $obj_reference) {
         $obj_reference->is_admin_auth = $this->is_admin_auth;
         $obj_reference->login_method = $this->login_methods[$k];
         $obj_reference->login_conf = $this->login_confs[$k];
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     foreach ($this->cache->getCache('bbcode') as $bbcode) {
         if ($bbcode['bbcode_tag'] == $this->currentBbcode) {
             $this->_bbcode = $bbcode;
             break;
         }
     }
 }
Example #18
0
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     /* Make object */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $this->initOurBbcodes();
     IPSDebug::setMemoryDebugFlag("BBCodes initialized", $_NOW);
     /* Check for emoticons */
     if (!$this->cache->exists('emoticons')) {
         $emoticons = $this->cache->getCache('emoticons');
         /* Fallback on recache */
         if (!is_array($emoticons) or !count($emoticons)) {
             $this->cache->rebuildCache('emoticons', 'global');
         }
     }
 }
 /**
  * 分析并加载视图缓存
  *
  * @access public
  *
  * @param string $cacheId 页面文件的缓存ID
  * @param integer $expire 页面缓存的生存周期
  *
  * @return mixed
  */
 public function cache($cacheId = null, $expire = null)
 {
     return self::$_viewObject->cache($cacheId, $expire);
 }
Example #20
0
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry object
  * @return	@e void
  */
 public function __construct()
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->lang = $this->registry->getClass('class_localization');
     $this->member = $this->registry->member();
     $this->memberData =& $this->registry->member()->fetchMemberData();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     /* Load and init BBCodes */
     foreach ($this->cache->getCache('bbcode') as $bbcode) {
         /* Allowed this BBCode? */
         if ($bbcode['bbcode_sections'] != 'all' && parent::$Perms['parseArea'] != 'global') {
             $pass = false;
             $sections = explode(',', $bbcode['bbcode_sections']);
             foreach ($sections as $section) {
                 if ($section == parent::$Perms['parseArea']) {
                     $pass = true;
                     break;
                 }
             }
             if (!$pass) {
                 continue;
             }
         }
         /* Cheat a bit */
         if (in_array($bbcode['bbcode_tag'], array('code', 'acronym', 'img'))) {
             $bbcode['bbcode_no_auto_url_parse'] = 1;
         }
         /* Store */
         $this->_bbcodes[$bbcode['bbcode_tag']] = $bbcode;
     }
     /* Can we parse URLs */
     if (isset($this->_bbcodes['url'])) {
         /* Allowed to use this? */
         if ($this->_bbcodes['url']['bbcode_groups'] != 'all' and parent::$Perms['memberData']['member_group_id']) {
             $pass = false;
             $groups = array_diff(explode(',', $this->_bbcodes['url']['bbcode_groups']), array(''));
             $mygroups = array(parent::$Perms['memberData']['member_group_id']);
             if (parent::$Perms['memberData']['mgroup_others']) {
                 $mygroups = array_diff(array_merge($mygroups, explode(',', IPSText::cleanPermString(parent::$Perms['memberData']['mgroup_others']))), array(''));
             }
             foreach ($groups as $g_id) {
                 if (in_array($g_id, $mygroups)) {
                     $pass = true;
                     break;
                 }
             }
             if (!$pass) {
                 $this->_urlsEnabled = false;
             }
         }
     }
     /* Check for emoticons */
     if (!$this->cache->exists('emoticons')) {
         $emoticons = $this->cache->getCache('emoticons');
         /* Fallback on recache */
         if (!is_array($emoticons) or !count($emoticons)) {
             $this->cache->rebuildCache('emoticons', 'global');
         }
     }
 }
Example #21
0
 /**
  * Constructor :: Authorizes the session
  *
  * @param	boolean		$noAutoParsingSessions		No auto parsing of sessions - set as true when using API-like methods
  * @return	@e mixed	Void normally, but can print error message
  */
 public function __construct($noAutoParsingSessions = false)
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->_member = self::instance();
     $this->_memberData =& self::instance()->fetchMemberData();
     /* Delete immediately */
     $this->_deleteNow = true;
     /**
      * If the sso.php file is present in this folder, we'll load it.
      * This file can be used to easily integrate single-sign on in
      * situations where you need to check session data
      */
     if (is_file(IPS_ROOT_PATH . '/sources/classes/session/sso.php')) {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/sources/classes/session/sso.php', 'ssoSessionExtension');
         if (class_exists($classToLoad)) {
             $this->sso = new $classToLoad($this->registry);
         }
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cookie = array();
     $this->_userAgent = substr($this->_member->user_agent, 0, 200);
     //-----------------------------------------
     // Fix up app / section / module
     //-----------------------------------------
     $this->current_appcomponent = IPS_APP_COMPONENT;
     $this->current_module = IPSText::alphanumericalClean($this->request['module']);
     $this->current_section = IPSText::alphanumericalClean($this->request['section']);
     $this->settings['session_expiration'] = $this->settings['session_expiration'] ? $this->settings['session_expiration'] : 3600;
     //-----------------------------------------
     // Return as guest if running a task
     //-----------------------------------------
     if (IPS_IS_TASK) {
         self::$data_store = IPSMember::setUpGuest();
         self::$data_store['last_activity'] = time();
         self::$data_store['last_visit'] = time();
         return true;
     }
     /* Not auto parsing sessions? */
     if ($noAutoParsingSessions === true) {
         return true;
     }
     //-----------------------------------------
     // no new headers if we're simply viewing an attachment..
     //-----------------------------------------
     if ($this->request['section'] == 'attach') {
         $this->settings['no_print_header'] = 1;
     }
     //-----------------------------------------
     // no new headers if we're updating chat
     //-----------------------------------------
     if (IPS_IS_AJAX && ($this->request['section'] != 'login' && $this->request['section'] != 'skin') or $this->request['section'] == 'attach' or $this->request['section'] == 'captcha') {
         $this->settings['no_print_header'] = 1;
         $this->do_update = 0;
     }
     //-----------------------------------------
     // IPS Connect
     //-----------------------------------------
     $ipsConnectEnabled = FALSE;
     foreach ($this->caches['login_methods'] as $k => $data) {
         if ($data['login_folder_name'] == 'ipsconnect' and $data['login_enabled']) {
             $ipsConnectEnabled = TRUE;
             $ipsConnectSettings = unserialize($data['login_custom_config']);
         }
     }
     //-----------------------------------------
     // Continue!
     //-----------------------------------------
     $cookie['session_id'] = IPSCookie::get('session_id');
     $cookie['member_id'] = IPSCookie::get('member_id');
     $cookie['pass_hash'] = IPSCookie::get('pass_hash');
     if ($cookie['session_id'] && empty($this->request['_nsc'])) {
         $this->getSession($cookie['session_id']);
         $this->session_type = 'cookie';
     } elseif (!empty($this->request['s'])) {
         $this->getSession($this->request['s']);
         $this->session_type = 'url';
     } else {
         $this->session_id = 0;
         $this->session_type = 'url';
     }
     //-----------------------------------------
     // Do we have a valid session ID?
     //-----------------------------------------
     if ($this->session_id) {
         $haveMember = FALSE;
         $forceNoMember = FALSE;
         /* Check we're not specifically logged out of IPS Connect */
         if ($ipsConnectEnabled and isset($_COOKIE['ipsconnect_' . md5($ipsConnectSettings['master_url'])]) and !$_COOKIE['ipsconnect_' . md5($ipsConnectSettings['master_url'])]) {
             $forceNoMember = TRUE;
         }
         /* Check Local */
         if (!empty($this->session_user_id) and !$forceNoMember) {
             self::setMember($this->session_user_id);
             if (self::$data_store['member_id'] and self::$data_store['member_id'] != 0) {
                 $haveMember = TRUE;
             }
         }
         /* Check IPS Connect */
         if (!$haveMember and !$forceNoMember) {
             if ($ipsConnectEnabled and isset($_COOKIE['ipsconnect_' . md5($ipsConnectSettings['master_url'])])) {
                 if ($_COOKIE['ipsconnect_' . md5($ipsConnectSettings['master_url'])]) {
                     require_once IPS_KERNEL_PATH . 'classFileManagement.php';
                     $cfm = new classFileManagement();
                     $return = $cfm->getFileContents($ipsConnectSettings['master_url'] . '?' . http_build_query(array('act' => 'cookies', 'data' => json_encode($_COOKIE))));
                     if ($return = @json_decode($return, TRUE)) {
                         if ($return['connect_status'] == 'SUCCESS') {
                             $this->_handleIpsConnect($return);
                             $haveMember = TRUE;
                         }
                     }
                 }
             }
         }
         /* Handle */
         if ($haveMember) {
             $this->_updateMemberSession();
             /**
              * If we have an SSO object, run it for the update member call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForMember')) {
                 $this->sso->checkSSOForMember('update');
             }
         } else {
             $this->_updateGuestSession();
             /**
              * If we have an SSO object, run it for the update guest session call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                 $this->sso->checkSSOForGuest('update');
             }
         }
     } else {
         //-----------------------------------------
         // We didn't have a session, or the session didn't validate
         // Do we have cookies stored?
         //-----------------------------------------
         $haveMember = FALSE;
         if ($ipsConnectEnabled and isset($_COOKIE['ipsconnect_' . md5($ipsConnectSettings['master_url'])])) {
             if ($_COOKIE['ipsconnect_' . md5($ipsConnectSettings['master_url'])]) {
                 require_once IPS_KERNEL_PATH . 'classFileManagement.php';
                 $cfm = new classFileManagement();
                 $return = $cfm->getFileContents($ipsConnectSettings['master_url'] . '?' . http_build_query(array('act' => 'cookies', 'data' => json_encode($_COOKIE))));
                 if ($return = @json_decode($return, TRUE)) {
                     if ($return['connect_status'] == 'SUCCESS') {
                         $this->_handleIpsConnect($return);
                         $haveMember = TRUE;
                     }
                 }
             }
         } elseif ($cookie['member_id'] != "" and $cookie['pass_hash'] != "") {
             self::setMember($cookie['member_id']);
             if (self::$data_store['member_id'] and self::$data_store['member_login_key'] == $cookie['pass_hash'] and (!$this->settings['login_key_expire'] or time() <= self::$data_store['member_login_key_expire'])) {
                 $haveMember = TRUE;
             }
         }
         //-----------------------------------------
         // Handle
         //-----------------------------------------
         if ($haveMember) {
             $this->_createMemberSession();
             /**
              * If we have an SSO object, run it for the create member call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForMember')) {
                 $this->sso->checkSSOForMember('create');
             }
         } else {
             self::setMember(0);
             $this->_createGuestSession();
             /**
              * If we have an SSO object, run it for the create guest call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                 $this->sso->checkSSOForGuest('create');
             }
         }
     }
     //-----------------------------------------
     // Knock out Google Web Accelerator
     //-----------------------------------------
     if (ipsRegistry::$settings['disable_prefetching']) {
         if (my_getenv('HTTP_X_MOZ') and strstr(strtolower(my_getenv('HTTP_X_MOZ')), 'prefetch') and self::$data_store['member_id']) {
             if (isset($_SERVER['SERVER_PROTOCOL']) and strstr($_SERVER['SERVER_PROTOCOL'], '/1.0')) {
                 @header('HTTP/1.0 403 Forbidden');
             } else {
                 @header('HTTP/1.1 403 Forbidden');
             }
             @header("Cache-Control: no-cache, must-revalidate, max-age=0");
             @header("Expires: 0");
             @header("Pragma: no-cache");
             print "Prefetching or precaching is not allowed. If you have Google Accelerator enabled, please disable";
             exit;
         }
     }
     //-----------------------------------------
     // Still no member id and not a bot?
     //-----------------------------------------
     if (empty(self::$data_store['member_id']) and !$this->_member->is_not_human) {
         self::setMember(0);
         self::$data_store['last_activity'] = time();
         $this->request['last_visit'] = time();
     }
     //-----------------------------------------
     // Set a session ID cookie
     //-----------------------------------------
     $this->_member->session_type = $this->session_type;
     $this->_member->session_id = $this->session_id;
     IPSCookie::set("session_id", $this->session_id, -1);
 }
 /**
  * Constructor :: Authorizes the session
  *
  * @access	public
  * @return	mixed		Void normally, but can print error message
  */
 public function __construct()
 {
     /* Make object */
     $this->registry = ipsRegistry::instance();
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->request =& $this->registry->fetchRequest();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
     $this->_member = self::instance();
     $this->_memberData =& self::instance()->fetchMemberData();
     /* Delete immediately */
     $this->_deleteNow = true;
     /**
      * If the sso.php file is present in this folder, we'll load it.
      * This file can be used to easily integrate single-sign on in
      * situations where you need to check session data
      */
     if (file_exists(IPS_ROOT_PATH . '/sources/classes/session/sso.php')) {
         require_once IPS_ROOT_PATH . '/sources/classes/session/sso.php';
         if (class_exists("ssoSessionExtension")) {
             $this->sso = new ssoSessionExtension($this->registry);
         }
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cookie = array();
     $this->_userAgent = substr($this->_member->user_agent, 0, 200);
     //-----------------------------------------
     // Fix up app / section / module
     //-----------------------------------------
     $this->current_appcomponent = IPS_APP_COMPONENT;
     $this->current_module = IPSText::alphanumericalClean($this->request['module']);
     $this->current_section = IPSText::alphanumericalClean($this->request['section']);
     $this->settings['session_expiration'] = $this->settings['session_expiration'] ? $this->settings['session_expiration'] : 3600;
     //-----------------------------------------
     // Return as guest if running a task
     //-----------------------------------------
     if (IPS_IS_TASK) {
         self::$data_store = IPSMember::setUpGuest();
         self::$data_store['last_activity'] = time();
         self::$data_store['last_visit'] = time();
         return true;
     }
     //-----------------------------------------
     // no new headers if we're simply viewing an attachment..
     //-----------------------------------------
     if ($this->request['section'] == 'attach') {
         $this->settings['no_print_header'] = 1;
     }
     //-----------------------------------------
     // no new headers if we're updating chat
     //-----------------------------------------
     if (IPS_IS_AJAX && $this->request['section'] != 'login' or $this->request['section'] == 'attach' or $this->request['section'] == 'captcha') {
         $this->settings['no_print_header'] = 1;
         $this->do_update = 0;
     }
     //-----------------------------------------
     // Continue!
     //-----------------------------------------
     $cookie['session_id'] = IPSCookie::get('session_id');
     $cookie['member_id'] = IPSCookie::get('member_id');
     $cookie['pass_hash'] = IPSCookie::get('pass_hash');
     if ($cookie['session_id']) {
         $this->getSession($cookie['session_id']);
         $this->session_type = 'cookie';
     } elseif (isset($this->request['s']) and $this->request['s']) {
         $this->getSession($this->request['s']);
         $this->session_type = 'url';
     } else {
         $this->session_id = 0;
     }
     //-----------------------------------------
     // Do we have a valid session ID?
     //-----------------------------------------
     if ($this->session_id) {
         //-----------------------------------------
         // We've checked the IP addy and browser, so we can assume that this is
         // a valid session.
         //-----------------------------------------
         if ($this->session_user_id != 0 and !empty($this->session_user_id)) {
             //-----------------------------------------
             // It's a member session, so load the member.
             //-----------------------------------------
             self::setMember($this->session_user_id);
             //-----------------------------------------
             // Did we get a member?
             //-----------------------------------------
             if (!self::$data_store['member_id'] or self::$data_store['member_id'] == 0) {
                 $this->_updateGuestSession();
                 /**
                  * If we have an SSO object, run it for the update guest session call
                  */
                 if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                     $this->sso->checkSSOForGuest('update');
                 }
             } else {
                 $this->_updateMemberSession();
                 /**
                  * If we have an SSO object, run it for the update member call
                  */
                 if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForMember')) {
                     $this->sso->checkSSOForMember('update');
                 }
             }
         } else {
             $this->_updateGuestSession();
             /**
              * If we have an SSO object, run it for the update guest call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                 $this->sso->checkSSOForGuest('update');
             }
         }
     } else {
         //-----------------------------------------
         // We didn't have a session, or the session didn't validate
         // Do we have cookies stored?
         //-----------------------------------------
         if ($cookie['member_id'] != "" and $cookie['pass_hash'] != "") {
             //-----------------------------------------
             // Load member
             //-----------------------------------------
             self::setMember($cookie['member_id']);
             //-----------------------------------------
             // INIT log in key stuff
             //-----------------------------------------
             $_ok = 1;
             $_days = 0;
             $_sticky = 1;
             $_time = $this->settings['login_key_expire'] ? time() + intval($this->settings['login_key_expire']) * 86400 : 0;
             if (!self::$data_store['member_id'] or self::$data_store['member_id'] == 0) {
                 $this->_createGuestSession();
                 /**
                  * If we have an SSO object, run it for the create guest call
                  */
                 if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                     $this->sso->checkSSOForGuest('create');
                 }
             } else {
                 if (self::$data_store['member_login_key'] == $cookie['pass_hash']) {
                     //-----------------------------------------
                     // Key expired?
                     //-----------------------------------------
                     if ($this->settings['login_key_expire']) {
                         $_sticky = 0;
                         $_days = $this->settings['login_key_expire'];
                         if (time() > self::$data_store['member_login_key_expire']) {
                             $_ok = 0;
                         }
                     }
                     if ($_ok == 1) {
                         $this->_createMemberSession();
                         /**
                          * If we have an SSO object, run it for the create member call
                          */
                         if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForMember')) {
                             $this->sso->checkSSOForMember('create');
                         }
                         //-----------------------------------------
                         // Change the log in key to make each authentication
                         // use a unique token. This means that if a cookie is
                         // stolen, the hacker can only use the auth once.
                         //-----------------------------------------
                         if ($this->settings['login_change_key']) {
                             self::$data_store['member_login_key'] = IPSMember::generateAutoLoginKey();
                             IPSMember::save(self::$data_store['member_id'], array('core' => array('member_login_key' => self::$data_store['member_login_key'], 'member_login_key_expire' => $_time)));
                             IPSCookie::set("pass_hash", self::$data_store['member_login_key'], $_sticky, $_days);
                         }
                     } else {
                         self::setMember(0);
                         $this->_createGuestSession();
                         /**
                          * If we have an SSO object, run it for the create guest call
                          */
                         if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                             $this->sso->checkSSOForGuest('create');
                         }
                     }
                 } else {
                     self::setMember(0);
                     $this->_createGuestSession();
                     /**
                      * If we have an SSO object, run it for the create guest call
                      */
                     if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                         $this->sso->checkSSOForGuest('create');
                     }
                 }
             }
         } else {
             $this->_createGuestSession();
             /**
              * If we have an SSO object, run it for the create guest call
              */
             if (is_object($this->sso) and method_exists($this->sso, 'checkSSOForGuest')) {
                 $this->sso->checkSSOForGuest('create');
             }
         }
     }
     //-----------------------------------------
     // Knock out Google Web Accelerator
     //-----------------------------------------
     if (ipsRegistry::$settings['disable_prefetching']) {
         if (my_getenv('HTTP_X_MOZ') and strstr(strtolower(my_getenv('HTTP_X_MOZ')), 'prefetch') and self::$data_store['member_id']) {
             if (IPB_PHP_SAPI == 'cgi-fcgi' or IPB_PHP_SAPI == 'cgi') {
                 @header('Status: 403 Forbidden');
             } else {
                 @header('HTTP/1.1 403 Forbidden');
             }
             @header("Cache-Control: no-cache, must-revalidate, max-age=0");
             @header("Expires: 0");
             @header("Pragma: no-cache");
             print "Prefetching or precaching is not allowed. If you have Google Accelerator enabled, please disable";
             exit;
         }
     }
     //-----------------------------------------
     // Still no member id and not a bot?
     //-----------------------------------------
     if (!self::$data_store['member_id'] and !$this->_member->is_not_human) {
         self::setMember(0);
         self::$data_store['last_activity'] = time();
         $this->request['last_visit'] = time();
     }
     //-----------------------------------------
     // Set a session ID cookie
     //-----------------------------------------
     $this->_member->session_type = $this->session_type;
     $this->_member->session_id = $this->session_id;
     IPSCookie::set("session_id", $this->session_id, -1);
 }