/** * 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; } }
/** * This method is called after a member's account has been merged into another member's account * * @access public * @param array $member Member account being kept * @param array $member2 Member account being removed * @return void **/ public function onMerge($member, $member2) { IPSDebug::addLogMessage("Markers init done:", 'merge', $member); if ($this->registry->DB()->checkForTable('cal_events')) { $this->registry->DB()->update('cal_events', array('event_member_id' => intval($member['member_id'])), "event_member_id=" . $member2['member_id']); } }
/** * 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->member = $this->registry->member(); $this->memberData =& $this->registry->member()->fetchMemberData(); }
/** * 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(); }
/** * 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 = ''; } }
/** * Method constructor * * If you pass false as the key, it will not save out the imported GUIDs * @access public * @param string URL of feed * @param string Unique key for the app/page importing (blog-{member_id} for example) * @return @e void * */ public function __construct($url, $key = false) { $this->_url = trim($url); $this->_key = trim($key); /* Core classes */ if (!is_object($this->registry)) { $this->registry = ipsRegistry::instance(); $this->DB = $this->registry->DB(); } /* Load RSS Class */ if (!is_object($this->_rssClass)) { $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classRss.php', 'classRss'); $this->_rssClass = new $classToLoad(); $this->_rssClass->rss_max_show = 100; $this->_rssClass->orig_doc_type = IPS_DOC_CHAR_SET; } ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_global'), 'core'); /* Are we checking for external links */ $rels = array(); $rel = ''; if (ipsRegistry::$settings['posts_add_nofollow']) { $rels[] = "nofollow"; } if (ipsRegistry::$settings['links_external']) { $rels[] = "external"; } if (count($rels)) { $rel = " rel='" . implode(' ', $rels) . "'"; } $this->_settings['LinkBack'] = "<a href=\"{url}\" {$rel}>" . $this->registry->getClass('class_localization')->words['_rssimportsource'] . "</a>"; /* Reset class */ $this->_reset(); }
/** * Constructor * * @access public * @param object ipsRegistry * @return void */ public function __construct(ipsRegistry $registry) { $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(); $plugin = $this->settings['bot_antispam_type']; if (!file_exists(IPS_KERNEL_PATH . 'classCaptchaPlugin/' . $plugin . '.php')) { $plugin = 'default'; } require_once IPS_KERNEL_PATH . 'classCaptchaPlugin/' . $plugin . '.php'; $this->_plugInClass = new captchaPlugIn($registry); }
/** * 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 * * @param object ipsRegistry reference * @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(); //----------------------------------------- // Do not set member, memberData or lang // Causes issues with SSO implementations //----------------------------------------- }
/** * Constructor * * @param object Registry Object */ public function __construct(ipsRegistry $registry) { $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(); /* Settings */ $this->gd_version = $this->settings['gd_version']; $this->path_background = DOC_IPS_ROOT_PATH . 'public/style_captcha/captcha_backgrounds'; $this->path_fonts = DOC_IPS_ROOT_PATH . 'public/style_captcha/captcha_fonts'; }
/** * Constructor * * @access public * @param object Registry Object * @return void */ public function __construct(ipsRegistry $registry) { $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(); /* Settings */ $this->public_key = trim($this->settings['recaptcha_public_key']); $this->private_key = trim($this->settings['recaptcha_private_key']); $this->useSSL = $this->settings['logins_over_https']; }
/** * 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')); }
/** * 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]; }
/** * 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']; }
/** * 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; }
/** * Checks to see if the request is allowed * * @param string $api_key Authenticate Key * @param string $api_module Module * @param string $api_function Function * @return string Error message, if any */ protected function __authenticate($api_key, $api_module, $api_function) { //----------------------------------------- // Check //----------------------------------------- if ($this->api_user['api_user_id']) { $this->api_user['_permissions'] = unserialize(stripslashes($this->api_user['api_user_perms'])); if ($this->api_user['_permissions'][$api_module][$api_function] == 1) { return TRUE; } else { $this->registry->DB()->insert('api_log', array('api_log_key' => $api_key, 'api_log_ip' => $_SERVER['REMOTE_ADDR'], 'api_log_date' => time(), 'api_log_query' => $this->classApiServer->raw_request, 'api_log_allowed' => 0)); $this->classApiServer->apiSendError('200', "API Key {$api_key} does not have permission for {$api_module}/{$api_function}"); return FALSE; } } else { $this->registry->DB()->insert('api_log', array('api_log_key' => $api_key, 'api_log_ip' => $_SERVER['REMOTE_ADDR'], 'api_log_date' => time(), 'api_log_query' => $this->classApiServer->raw_request, 'api_log_allowed' => 0)); $this->classApiServer->apiSendError('100', "API Key {$api_key} does not have permission for {$api_module}/{$api_function}"); return FALSE; } }
/** * 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(); }
public function addModlog($mod_title) { $this->registry->DB()->insert('moderator_logs', array('member_id' => $this->memberData['member_id'], 'member_name' => $this->memberData['members_display_name'], 'ip_address' => $this->request['IP_ADDRESS'], 'http_referer' => my_getenv('HTTP_REFERER'), 'ctime' => time(), 'action' => $mod_title, 'query_string' => my_getenv('QUERY_STRING'))); }
/** * 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); }
/** * handshake_server::handshake_remove() * * Unconverges an application * * @access public * @param integer $reg_id Converge reg ID * @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS). * @return mixed xml / boolean false **/ public function handshakeRemove($reg_product_id = '', $reg_code = '') { //----------------------------------------- // INIT //----------------------------------------- $reg_product_id = intval($reg_product_id); $reg_code = IPSText::md5Clean($reg_code); //----------------------------------------- // Grab data from the DB //----------------------------------------- $converge = $this->registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'converge_local', 'where' => "converge_api_code='" . $reg_code . "' AND converge_product_id=" . $reg_product_id)); //----------------------------------------- // Check //----------------------------------------- if ($converge['converge_active']) { //----------------------------------------- // Remove app stuff //----------------------------------------- $this->registry->DB()->delete('converge_local', 'converge_product_id=' . intval($reg_product_id)); //----------------------------------------- // Switch over log in methods //----------------------------------------- $this->registry->DB()->update("login_methods", array("login_enabled" => 0), "login_folder_name='ipconverge'"); $cache = array(); $this->registry->DB()->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1')); $this->registry->DB()->execute(); while ($r = $this->registry->DB()->fetch()) { $cache[$r['login_id']] = $r; } ipsRegistry::cache()->setCache('login_methods', $cache, array('array' => 1, 'deletefirst' => 1)); $this->classApiServer->apiSendReply(array('handshake_removed' => 1)); } else { $this->classApiServer->apiSendReply(array('handshake_removed' => 0)); } }
/** * 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; } } }
/** * _authenticate() * * Authenticates the username and password * * This will return * - false (Failed) * - true (Succes) * * @access private * @param string $username Username * @param string $password Password * @return boolean **/ private function _authenticate($username, $password) { //----------------------------------------- // Are they banned? //----------------------------------------- if (is_array($this->caches['banfilters']) and count($this->caches['banfilters'])) { foreach ($this->caches['banfilters'] as $ip) { $ip = str_replace('\\*', '.*', preg_quote($ip, "/")); if (preg_match("/^{$ip}\$/", $this->request['IP_ADDRESS'])) { $this->error = $this->registry->class_localization->words['blogger_banned_msg']; return false; } } } //----------------------------------------- // load the member //----------------------------------------- $member = IPSMember::load(IPSText::parseCleanValue($username), 'extendedProfile', 'username'); if (!$member['member_id']) { $this->error = $this->registry->class_localization->words['blogger_unknown_user']; return false; } ips_MemberRegistry::setMember($member['member_id']); //-------------------------------- // Is the board offline? //-------------------------------- if (ipsRegistry::$settings['board_offline'] == 1) { if ($member['g_access_offline'] != 1) { $this->error = $this->registry->class_localization->words['blogger_board_offline']; return false; } } //----------------------------------------- // Temporarely banned? //----------------------------------------- if ($member['temp_ban']) { $this->error = $this->registry->class_localization->words['blogger_suspended']; return false; } //----------------------------------------- // Load the Blog //----------------------------------------- $this->registry->blog_std->buildPerms(); //----------------------------------------- // Users can have more than one blog - just // grab first one mysql returns //----------------------------------------- $blog = $this->registry->DB()->buildAndFetch(array('select' => 'blog_id, blog_name', 'from' => 'blog_blogs', 'where' => "member_id={$member['member_id']}")); if (!$blog['blog_id']) { $this->error = $this->registry->class_localization->words['blogger_noblog']; return false; } if (!($this->blog = $this->registry->blog_std->loadBlog($blog['blog_id'], 1))) { $this->error = $this->blog_std->error; return false; } //----------------------------------------- // Blog post permissions? //----------------------------------------- if (!$this->blog['allow_entry']) { $this->error = $this->registry->class_localization->words['blogger_nopost']; return false; } //----------------------------------------- // Validate password? //----------------------------------------- if (!ipsRegistry::$settings['blog_allow_xmlrpc'] or !$this->blog['blog_settings']['enable_xmlrpc']) { $this->error = $this->registry->class_localization->words['blogger_noxmlrpc']; return false; } if ($this->blog['blog_settings']['xmlrpc_password'] != md5(IPSText::parseCleanValue($password))) { if (isset($this->blog['blog_settings']['xmlrpc_failedattempts']) && $this->blog['blog_settings']['xmlrpc_failedattempts'] > 5) { $this->blog['blog_settings']['enable_xmlrpc'] = 0; $this->blog['blog_settings']['xmlrpc_failedattempts'] = 0; $blog_settings = serialize($this->blog['blog_settings']); $this->registry->DB()->update('blog_blogs', array('blog_settings' => $blog_settings), "blog_id = {$this->blog['blog_id']}"); } else { $this->blog['blog_settings']['xmlrpc_failedattempts'] = isset($this->blog['blog_settings']['xmlrpc_failedattempts']) ? intval($this->blog['blog_settings']['xmlrpc_failedattempts']) + 1 : 1; $blog_settings = serialize($this->blog['blog_settings']); $this->registry->DB()->update('blog_blogs', array('blog_settings' => $blog_settings), "blog_id = {$this->blog['blog_id']}"); } $this->error = $this->registry->class_localization->words['blogger_inv_pass']; return false; } else { if (isset($this->blog['blog_settings']['xmlrpc_failedattempts']) && $this->blog['blog_settings']['xmlrpc_failedattempts'] > 0) { $this->blog['blog_settings']['xmlrpc_failedattempts'] = 0; $blog_settings = serialize($this->blog['blog_settings']); $this->registry->DB()->update('blog_blogs', array('blog_settings' => $blog_settings), "blog_id = {$this->blog['blog_id']}"); } } //----------------------------------------- // Set the member data //----------------------------------------- $this->memberData = $member; return true; }
/** * 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'); } } }
/** * 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 * * @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'); } } }
/** * 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'); } }