/** * Constructor * * @access public * @param object ipsRegistry reference * @return @e void */ public function __construct(ipsRegistry $registry) { //----------------------------------------- // Make object references //----------------------------------------- $this->registry = $registry; $this->DB = $registry->DB(); $this->settings = $registry->settings(); $this->member = $registry->member(); $this->memberData =& $registry->member()->fetchMemberData(); $this->cache = $registry->cache(); $this->caches =& $registry->cache()->fetchCaches(); $this->request = $registry->request(); set_time_limit(0); if (strpos(strtolower(PHP_OS), 'win') === 0) { $this->dir_split = "\\"; } //----------------------------------------- // Known names //----------------------------------------- $KNOWN_NAMES = array(); require IPS_ROOT_PATH . 'sources/classes/virusChecker/lib_known_names.php'; /*noLibHook*/ $this->known_names = $KNOWN_NAMES; }
/** * Constructor * * @access public * @param object ipsRegistry reference * @return @e void */ public function __construct(ipsRegistry $registry) { $this->DB = $registry->DB(); $this->settings = $registry->settings(); $this->member = $registry->member(); $this->memberData =& $registry->member()->fetchMemberData(); $this->cache = $registry->cache(); $this->caches =& $registry->cache()->fetchCaches(); $this->request = $registry->request(); }
/** * Constructor * * @access public * @param object Registry reference * @return @e void */ public function __construct(ipsRegistry $registry) { //----------------------------------------- // Make shortcuts //----------------------------------------- $this->registry = $registry; $this->DB = $registry->DB(); $this->settings = $registry->fetchSettings(); $this->member = $registry->member(); $this->memberData =& $registry->member()->fetchMemberData(); $this->cache = $registry->cache(); $this->caches =& $registry->cache()->fetchCaches(); $this->request = $registry->fetchRequest(); $this->lang = $registry->class_localization; }
/** * Grab the RSS document content and return it * * @return string RSS document */ public function returnRSSDocument() { //----------------------------------------- // INIT //----------------------------------------- $member_id = intval(ipsRegistry::$request['member_id']); $secure_key = IPSText::md5Clean(ipsRegistry::$request['rss_key']); $rss_data = array(); $to_print = ''; if ($secure_key and $member_id) { if ($member_id == ipsRegistry::member()->getProperty('member_id')) { //----------------------------------------- // Get RSS export //----------------------------------------- $rss_data = ipsRegistry::DB()->buildAndFetch(array('select' => 'rss_cache', 'from' => 'rc_modpref', 'where' => "mem_id=" . $member_id . " AND rss_key='" . $secure_key . "'")); //----------------------------------------- // Got one? //----------------------------------------- if ($rss_data['rss_cache']) { return $rss_data['rss_cache']; } } //----------------------------------------- // Create a dummy one //----------------------------------------- ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_reports'), 'core'); $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classRss.php', 'classRss'); $rss = new $classToLoad(); $channel_id = $rss->createNewChannel(array('title' => ipsRegistry::getClass('class_localization')->words['rss_feed_title'], 'link' => ipsRegistry::$settings['board_url'], 'description' => ipsRegistry::getClass('class_localization')->words['reports_rss_desc'], 'pubDate' => $rss->formatDate(time()))); $rss->createRssDocument(); return $rss->rss_document; } }
/** * Constructor * * @access public * @param object Registry reference * @return void */ public function __construct(ipsRegistry $registry) { //----------------------------------------- // Make shortcuts //----------------------------------------- $this->registry = $registry; $this->DB = $registry->DB(); $this->settings = $registry->fetchSettings(); $this->member = $registry->member(); $this->cache = $registry->cache(); $this->caches =& $registry->cache()->fetchCaches(); $this->request = $registry->fetchRequest(); $this->lang = $registry->class_localization; if (IN_ACP) { //----------------------------------------- // Load HTML //----------------------------------------- $this->html = $this->registry->output->loadTemplate('cp_skin_blocks_feed'); //----------------------------------------- // Set up stuff //----------------------------------------- $this->form_code = $this->html->form_code = 'module=blocks&section=wizard'; $this->form_code_js = $this->html->form_code_js = 'module=blocks§ion=wizard'; } //----------------------------------------- // Get interface //----------------------------------------- require_once IPSLib::getAppDir('ccs') . '/sources/blocks/feed/feedInterface.php'; }
/** * Get Content URL * * @param array $warning Row from members_warn_logs * @return @e array array( url => URL to the content the warning came from, title => Title ) */ public function getContentUrl($warning) { ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_profile'), 'members'); if ($warning['wl_content_id1']) { $post = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'message_posts', 'where' => "msg_id=" . intval($warning['wl_content_id1']))); if (!empty($post['msg_topic_id'])) { $topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'message_topics', 'where' => "mt_id={$post['msg_topic_id']}")); if (!empty($topic['mt_id'])) { ipsRegistry::DB()->build(array('select' => '*', 'from' => 'message_topic_user_map', 'where' => "map_topic_id={$post['msg_topic_id']}")); ipsRegistry::DB()->execute(); while ($row = ipsRegistry::DB()->fetch()) { if ($row['map_user_id'] == ipsRegistry::member()->getProperty('member_id')) { return array('url' => ipsRegistry::getClass('output')->buildUrl("app=members&module=messaging&section=view&do=findMessage&topicID={$topic['mt_id']}&msgID={$post['msg_id']}"), 'title' => $topic['mt_title']); } } return array('url' => ipsRegistry::getClass('output')->buildUrl("app=core&module=reports§ion=reports&do=showMessage&topicID={$topic['mt_id']}&msg={$post['msg_id']}"), 'title' => $topic['mt_title']); } } } else { $member = IPSMember::load($warning['wl_member']); if (!empty($member['member_id'])) { return array('url' => ipsRegistry::getClass('output')->buildSEOUrl("showuser={$member['member_id']}", 'public', $member['members_seo_name'], 'showuser'), 'title' => ipsRegistry::getClass('class_localization')->words['warnings_profile']); } } }
/** * Constructor * * @access public * @param object Registry reference * @return void */ public function __construct(ipsRegistry $registry) { //----------------------------------------- // Make shortcuts //----------------------------------------- $this->registry = $registry; $this->DB = $registry->DB(); $this->settings = $registry->fetchSettings(); $this->member = $registry->member(); $this->cache = $registry->cache(); $this->caches =& $registry->cache()->fetchCaches(); $this->request = $registry->fetchRequest(); $this->lang = $registry->class_localization; if (IN_ACP) { //----------------------------------------- // Load HTML //----------------------------------------- $this->html = $this->registry->output->loadTemplate('cp_skin_blocks_custom'); //----------------------------------------- // Set up stuff //----------------------------------------- $this->form_code = $this->html->form_code = 'module=blocks&section=wizard'; $this->form_code_js = $this->html->form_code_js = 'module=blocks§ion=wizard'; } }
/** * Parse/format the online list data for the records * * @access public * @author Brandon Farber * @param array Online list rows to check against * @return array Online list rows parsed */ public function parseOnlineEntries($rows) { if (!is_array($rows) or !count($rows)) { return $rows; } $final = array(); foreach ($rows as $row) { if ($row['current_appcomponent'] == 'core') { if ($row['current_module'] == 'global') { if ($row['current_section'] == 'login') { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_login']; } } else { if ($row['current_module'] == 'search') { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_search']; } else { if ($row['current_module'] == 'reports') { $rcCache = ipsRegistry::cache()->getCache('report_cache'); if (is_array($rcCache)) { if ($rcCache['group_access'][ipsRegistry::member()->getProperty('member_group_id')] == true) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_reports']; } } } } } } $final[$row['id']] = $row; } return $final; }
/** * Returns sidebar links for this tab * You may return an empty array or FALSE to not have * any links show in the sidebar for this block. * * The links must have 'section=xxxxx&module=xxxxx[&do=xxxxxx]'. The rest of the URL * is added automatically. * * The image must be a full URL or blank to use a default image. * * Use the format: * $array[] = array( 'img' => '', 'url' => '', 'title' => '' ); * * @author Matt Mecham * @param array Member data * @return array Array of links */ public function getSidebarLinks($member = array()) { $array = array(); if ($member['failed_login_count']) { $array[] = array('img' => '', 'url' => "app=members&module=members&section=tools&do=do_locked&auth_key=" . ipsRegistry::member()->form_hash . "&mid_{$member['member_id']}=1&type=unlock", 'title' => ipsRegistry::getClass('class_localization')->words['reset_failed_logins']); } return $array; }
/** * Parse/format the online list data for the records * * @author Brandon Farber * @param array Online list rows to check against * @return array Online list rows parsed */ public function parseOnlineEntries($rows) { if (!is_array($rows) or !count($rows)) { return $rows; } $final = array(); $profiles = array(); $members = array(); //----------------------------------------- // Extract the topic/forum data //----------------------------------------- foreach ($rows as $row) { if ($row['current_appcomponent'] != 'members' or !$row['current_module']) { continue; } if ($row['current_module'] == 'profile') { $profiles[] = $row['location_1_id']; } } if (count($profiles)) { ipsRegistry::DB()->build(array('select' => 'member_id, members_display_name, members_seo_name, member_banned, members_bitoptions', 'from' => 'members', 'where' => 'member_id IN(' . implode(',', $profiles) . ')')); $pr = ipsRegistry::DB()->execute(); while ($r = ipsRegistry::DB()->fetch($pr)) { /* Setup bitwise option to check for banned/spammer members */ $r = IPSMember::buildBitWiseOptions($r); if (!IPSMember::isInactive($r) || ipsRegistry::member()->getProperty('g_is_supmod')) { $members[$r['member_id']] = array('members_display_name' => $r['members_display_name'], 'members_seo_name' => $r['members_seo_name']); } } } foreach ($rows as $row) { if ($row['current_appcomponent'] == 'members') { if ($row['current_module'] == 'online') { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_online']; } if ($row['current_module'] == 'list') { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_members']; } if ($row['current_module'] == 'messaging') { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_msg']; } if ($row['current_module'] == 'profile') { if (isset($members[$row['location_1_id']])) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_profile']; $row['where_line_more'] = $members[$row['location_1_id']]['members_display_name']; $row['where_link'] = 'showuser='******'location_1_id']; $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $members[$row['location_1_id']]['members_seo_name'], 'showuser'); } } } $final[$row['id']] = $row; } return $final; }
/** * Constructor * * @access public * @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->cache = $this->registry->cache(); $this->caches =& $this->registry->cache()->fetchCaches(); $this->lang = $this->registry->getClass('class_localization'); self::$Perms['memberData'] = is_array(self::$Perms['memberData']) ? self::$Perms['memberData'] : ipsRegistry::member()->fetchMemberData(); }
/** * Setup registry objects * * @access public * @param object ipsRegistry $registry * @return void */ public function __construct(ipsRegistry $registry) { $this->DB = $registry->DB(); $this->member = $registry->member(); $this->memberData =& $registry->member()->fetchMemberData(); $this->settings = $registry->settings(); $this->request = $registry->request(); /* Do we have the sphinxes? */ if (!file_exists('sphinxapi.php')) { $registry->output->showError('sphinx_api_missing', 10182); } /* Load Sphinx */ require 'sphinxapi.php'; $this->sphinxClient = new SphinxClient(); $this->sphinxClient->SetServer($this->settings['search_sphinx_server'], intval($this->settings['search_sphinx_port'])); $this->sphinxClient->SetMatchMode(SPH_MATCH_EXTENDED); $this->sphinxClient->SetLimits(0, 1000); /* We're going to need the regular app index plugin also */ require_once IPSLib::getAppDir(ipsRegistry::$request['search_app']) . '/extensions/searchPlugin.php'; $searchApp = 'search' . ucfirst($this->request['search_app']) . 'Plugin'; $this->appSearchPlugin = new $searchApp($registry); }
/** * Checks to see if the specified member group can view ads * * @access public * * @param integer $group_id Group to check * @return bool */ public function userCanViewAds() { /* Check to see if the system is globally disabled */ if (!ipsRegistry::$settings['ad_code_global_enabled']) { return false; } /* Check to see if this member group can view ads */ if (ipsRegistry::$settings['ad_code_exempt_groups']) { if (IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', ipsRegistry::$settings['ad_code_exempt_groups']))) { return false; } } return true; }
/** * Authenticate log in * * @access public * @param string Username (from $this->request) * @param string Password (from $this->request) * @return mixed TRUE if successful, string (message) if not */ public function authenticateLogIn($username, $password) { /* Log in type */ $loginType = $this->_fetchLogInType(); $where = $loginType == 'username' ? $this->DB->buildLower('m.name') . "='" . mb_strtolower($username) . "'" : "m.email='" . mb_strtolower($username) . "'"; /* Attempt to load member */ $this->DB->build(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => $where, 'add_join' => array(array('select' => 'g.*', 'from' => array('groups' => 'g'), 'where' => 'g.g_id=m.mgroup'), array('select' => 'c.*', 'from' => array('members_converge' => 'c'), 'where' => 'c.converge_email=m.email')))); $this->DB->execute(); $mem = $this->DB->fetch(); /* Check it out */ if (!$mem['id'] or !$mem['converge_pass_hash']) { return 'Пользователь не найден'; } if ($mem['converge_pass_hash'] != md5(md5($mem['converge_pass_salt']) . md5($password))) { return 'Неверный пароль'; } /* Test seconday groups */ $mem = ipsRegistry::member()->setUpSecondaryGroups($mem); if ($mem['g_access_cp'] != 1) { return 'У вас нет доступа к системе обновления'; } /* Set up _member */ $this->loadMemberData($mem['id']); /* Still here? */ return TRUE; }
function new_likes() { return (bool) (ipsRegistry::$settings['reputation_enabled'] and !in_array(ipsRegistry::member()->getProperty('member_group_id'), explode(',', ipsRegistry::$settings['reputation_protected_groups'])) and ipsRegistry::$settings['reputation_point_types'] == 'like'); }
/** * Setup registry objects * * @access public * @param object ipsRegistry $registry * @return void */ public function __construct(ipsRegistry $registry) { $this->registry = $registry; $this->DB = $registry->DB(); $this->member = $registry->member(); $this->memberData =& $registry->member()->fetchMemberData(); $this->settings =& $this->registry->fetchSettings(); }
/** * Get notification config file data * * @access public * @param bool If true, will check show_callback to see if user has permission * @return array */ public function getNotificationData($checkCallbacks = FALSE) { //----------------------------------------- // Already stored the data? //----------------------------------------- if (count($this->_notificationData)) { return $this->_notificationData; } //----------------------------------------- // Get for each application //----------------------------------------- foreach (IPSLib::getEnabledApplications(array(), TRUE) as $app_dir => $application) { $newLocation = IPSLib::getAppDir($app_dir) . '/extensions/notifications/config.php'; $oldLocation = IPSLib::getAppDir($app_dir) . '/extensions/notifications.php'; if (!is_file($newLocation)) { $newLocation = $oldLocation; } if (is_file($newLocation)) { $classToLoad = IPSLib::loadLibrary($newLocation, $app_dir . '_notifications', $app_dir); if (class_exists($classToLoad)) { $class = new $classToLoad(); $class->memberData = ipsRegistry::member()->fetchMemberData(); $_NOTIFY = $class->getConfiguration(); if ($checkCallbacks) { foreach ($_NOTIFY as $n) { $n['app'] = $app_dir; if ($n['show_callback'] and method_exists($class, $n['key'])) { if ($class->{$n}['key']($this->_member)) { $this->_notificationData[] = $n; } } else { $this->_notificationData[] = $n; } } } else { $_NEW = array(); foreach ($_NOTIFY as $notify) { $notify['app'] = $app_dir; $_NEW[] = $notify; } $_NOTIFY = $_NEW; $this->_notificationData = is_array($this->_notificationData) ? $this->_notificationData : array(); $this->_notificationData = array_merge($this->_notificationData, $_NOTIFY); } } } } return $this->_notificationData; }
/** * Retuns a string for use in the where condition of a query * * @access public * @param string [$alias] Alias of the permissiont able, p by default * @param string [$perm_column] Permission column to check against * @return string */ public function buildPermQuery($alias = 'p', $perm_column = 'perm_view') { return $this->registry->DB()->buildRegexp("{$alias}.{$perm_column}", ipsRegistry::member()->perm_id_array); }
/** * CONSTRUCTOR * * @return @e void */ public function __construct() { /* Shortcuts */ $this->DB = ipsRegistry::DB(); $this->cache_data = ipsRegistry::cache()->getCache('profilefields'); /* User Setup */ $this->member_id = ipsRegistry::member()->getProperty('member_id'); $this->admin = intval(ipsRegistry::member()->getProperty('g_access_cp')); $this->supmod = intval(ipsRegistry::member()->getProperty('g_is_supmod')); }
/** * Parse/format the online list data for the records * * @author Brandon Farber * @param array Online list rows to check against * @return array Online list rows parsed */ public function parseOnlineEntries($rows) { if (!is_array($rows) or !count($rows)) { return $rows; } //----------------------------------------- // Init //----------------------------------------- $forums_raw = array(); $forums = array(); $topics_raw = array(); $topics = array(); $posts_raw = array(); $posts = array(); $final = array(); //----------------------------------------- // Extract the topic/forum data //----------------------------------------- foreach ($rows as $row) { if ($row['current_appcomponent'] != 'forums' or !$row['current_module']) { continue; } if ($row['current_section'] == 'forums') { $forums_raw[$row['location_2_id']] = ''; } else { if ($row['current_section'] == 'topics') { $topics_raw[$row['location_1_id']] = $row['location_1_id']; } else { if ($row['current_section'] == 'post') { $forums_raw[$row['location_2_id']] = ''; $topics_raw[$row['location_1_id']] = $row['location_1_id']; } } } } //----------------------------------------- // Get the forums, if you dare //----------------------------------------- ipsRegistry::getAppClass('forums'); if (count($forums_raw)) { foreach (ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum) { if (isset($forums_raw[$fid])) { if (ipsRegistry::getClass('permissions')->check('view', $forum) !== false) { $forums[$fid] = $forum['name']; } } } } //----------------------------------------- // Get the topics, if you care //----------------------------------------- if (count($topics_raw)) { $_approved = ipsRegistry::getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.'); ipsRegistry::DB()->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => $_approved . ' AND t.tid IN(' . implode(',', $topics_raw) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'), 'add_join' => array(array('from' => array('permission_index' => 'p'), 'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'", 'type' => 'left')))); $tr = ipsRegistry::DB()->execute(); while ($r = ipsRegistry::DB()->fetch($tr)) { $_forum = ipsRegistry::getClass('class_forums')->getForumByid($r['forum_id']); if (count($_forum) and ipsRegistry::getClass('class_forums')->forumsCheckAccess($_forum['id'], false, 'topic', $r, true)) { if (ipsRegistry::getClass('permissions')->check('read', $_forum) !== false) { if ($_forum['password'] == '' or IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', $_forum['password_override'])) or IPSCookie::get("ipbforumpass_{$_forum['id']}") == md5($_forum['password'])) { $topics[$r['tid']] = $r['title']; } } } } } //----------------------------------------- // Put humpty dumpty together again //----------------------------------------- foreach ($rows as $row) { if ($row['current_appcomponent'] != 'forums') { $final[$row['id']] = $row; continue; } if (!$row['current_module']) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['board_index']; $final[$row['id']] = $row; continue; } if ($row['current_section'] == 'forums') { if (isset($forums[$row['location_2_id']])) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_sf']; $row['where_line_more'] = $forums[$row['location_2_id']]; $row['where_link'] = 'showforum=' . $row['location_2_id']; $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum'); } } else { if ($row['current_section'] == 'topics') { if (isset($topics[$row['location_1_id']])) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_st']; $row['where_line_more'] = $topics[$row['location_1_id']]; $row['where_link'] = 'showtopic=' . $row['location_1_id']; $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic'); } } else { if ($row['current_section'] == 'post') { if ($row['location_1_id']) { if (isset($topics[$row['location_1_id']])) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_postrep']; $row['where_line_more'] = $topics[$row['location_1_id']]; $row['where_link'] = 'showtopic=' . $row['location_1_id']; $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic'); } } else { if ($row['location_2_id']) { if (isset($forums[$row['location_2_id']])) { $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_postnew']; $row['where_line_more'] = $forums[$row['location_2_id']]; $row['where_link'] = 'showforum=' . $row['location_2_id']; $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum'); } } } } } } $final[$row['id']] = $row; } return $final; }
/** * Authenticate log in * * @access public * @param string Username (from $this->request) * @param string Password (from $this->request) * @return mixed TRUE if successful, string (message) if not */ public function authenticateLogIn($username, $password) { /* Log in type */ $loginType = $this->_fetchLogInType(); $where = $loginType == 'username' ? $this->DB->buildLower('m.name') . "='" . strtolower($username) . "'" : "m.email='" . strtolower($username) . "'"; /* Attempt to load member */ $this->DB->build(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => $where, 'add_join' => array(array('select' => 'g.*', 'from' => array('groups' => 'g'), 'where' => 'g.g_id=m.mgroup'), array('select' => 'c.*', 'from' => array('members_converge' => 'c'), 'where' => 'c.converge_email=m.email')))); $this->DB->execute(); $mem = $this->DB->fetch(); /* Check it out */ if (!$mem['id'] or !$mem['converge_pass_hash']) { return 'No user found by that username'; } if ($mem['converge_pass_hash'] != md5(md5($mem['converge_pass_salt']) . md5($password))) { return 'Password incorrect'; } /* Test seconday groups */ $mem = ipsRegistry::member()->setUpSecondaryGroups($mem); if ($mem['g_access_cp'] != 1) { return 'You do not have access to the upgrade system'; } /* Set up _member */ $this->loadMemberData($mem['id']); /* Still here? */ return TRUE; }
/** * Display a strip of share links * * @param string Document title (can be left blank and it will attempt to self-discover) * @param array Addition params: url, cssClass, group [string template group], bit [string template bit], skip [array of share_keys to skip] * @return string HAITHTEEEMEL */ public static function shareLinks($title = '', $params = array()) { $url = isset($params['url']) ? $params['url'] : ''; $cssClass = isset($params['cssClass']) ? $params['cssClass'] : 'topic_share left'; $group = isset($params['group']) ? $params['group'] : 'global'; $bit = isset($params['bit']) ? $params['bit'] : 'shareLinks'; $skip = isset($params['skip']) ? $params['skip'] : array(); $override = isset($params['overrideApp']) ? $params['overrideApp'] : ''; /* Disabled? */ if (!ipsRegistry::$settings['sl_enable']) { return ''; } /* Disable for bots */ if (ipsRegistry::member()->is_not_human) { return ''; } $canon = ipsRegistry::getClass('output')->fetchRootDocUrl(); $url = $url ? $url : ipsRegistry::$settings['this_url']; $raw = $url; $canon = IPSText::base64_encode_urlSafe($canon ? $canon : $url); $title = IPSText::base64_encode_urlSafe($title); $url = IPSText::base64_encode_urlSafe($url); $cache = ipsRegistry::cache()->getCache('sharelinks'); if (!$cache or !is_array($cache)) { ipsRegistry::cache()->rebuildCache('sharelinks', 'global'); $cache = ipsRegistry::cache()->getCache('sharelinks'); } /* Check for required canonical urls or not */ foreach ($cache as $key => $data) { if (is_array($skip) and in_array($key, $skip)) { unset($cache[$key]); } else { $cache[$key]['_rawUrl'] = $raw; $cache[$key]['overrideApp'] = $override; $cache[$key]['_url'] = $data['share_canonical'] ? $canon : $url; } } return ipsRegistry::getClass('output')->getTemplate($group)->{$bit}($cache, $title, $canon, $cssClass); }
/** * Log user in remotely if user is not logged in. * @param array Array of member data (member_id, etc) or Id */ public function logGuestInAsMember($member) { if (is_numeric($member)) { $member = IPSMember::load($member); } /* Check for existing session */ $ip = ipsRegistry::member()->ip_address; $_session = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'sessions', 'where' => "ip_address='{$ip}'")); if (!$_session['id'] or !$_session['member_id']) { $this->_getSessionClass()->convertGuestToMember($member, $member); } }
/** * Authenticate log in * * @access public * @param string Username (from $this->request) * @param string Password (from $this->request) * @return mixed TRUE if successful, string (message) if not */ public function authenticateLogIn($username, $password) { require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php'; $han_login = new han_login($this->registry); $han_login->is_admin_auth = 1; $han_login->init(); $email = ''; /* Is this a username or email address? */ if (IPSText::checkEmailAddress($username)) { $email = $username; $username = ''; } $han_login->loginAuthenticate($username, $email, $password); $mem = $han_login->member_data; if (!$mem['member_id'] or $han_login->return_code == 'NO_USER') { return 'No user found by that sign in name'; } if ($han_login->return_code == 'NO_ACCESS') { return 'You do not have access to the upgrade system'; } else { if ($han_login->return_code != 'SUCCESS') { return 'Password or sign in name incorrect'; } } /* Test seconday groups */ $mem = ipsRegistry::member()->setUpSecondaryGroups($mem); if ($mem['g_access_cp'] != 1) { return 'You do not have access to the upgrade system'; } /* Set up _member */ $this->loadMemberData($mem['member_id']); /* Still here? */ return TRUE; }
* Config file * Last Updated: $Date: 2013-04-15 17:26:30 -0400 (Mon, 15 Apr 2013) $ * </pre> * * @author $author$ * @copyright (c) 2001 - 2009 Invision Power Services, Inc. * @license http://www.invisionpower.com/company/standards.php#license * @package IP.Board * @subpackage Forums * @link http://www.invisionpower.com * @version $Rev: 12179 $ */ if (!defined('IN_IPB')) { print "<h1>Incorrect access</h1>You cannot access this file directly. If you have recently upgraded, make sure you upgraded all the relevant files."; exit; } $memberData = ipsRegistry::member()->fetchMemberData(); /* Can search with this app */ $CONFIG['can_search'] = $memberData['g_mem_info'] ? 1 : 0; /* Can view new content with this app */ $CONFIG['can_viewNewContent'] = $memberData['g_mem_info'] ? 1 : 0; $CONFIG['can_vnc_filter_by_followed'] = 0; $CONFIG['can_vnc_unread_content'] = 0; /* Can fetch user generated content */ $CONFIG['can_userContent'] = $memberData['g_mem_info'] ? 1 : 0; /* Content types, put the default one first */ if ($_REQUEST['do'] == 'user_activity') { $CONFIG['contentTypes'] = array('comments'); } else { $CONFIG['contentTypes'] = array('members', 'comments'); }
/** * Authenticate log in * * @access public * @param string Username (from $this->request) * @param string Password (from $this->request) * @return mixed TRUE if successful, string (message) if not */ public function authenticateLogIn($username, $password) { require_once IPS_ROOT_PATH . 'sources/handlers/han_login.php'; /*noLibHook*/ $han_login = new han_login($this->registry); $han_login->is_admin_auth = 1; $han_login->init(); $email = ''; /* Is this a username or email address? */ if (IPSText::checkEmailAddress($username)) { $email = $username; $username = ''; } $han_login->loginAuthenticate($username, $email, $password); $mem = $han_login->member_data; if (!$mem['member_id'] or $han_login->return_code == 'NO_USER') { return 'Пользователь не найден'; } if ($han_login->return_code == 'NO_ACCESS') { return 'У вас нет доступа к системе обновления'; } else { if ($han_login->return_code != 'SUCCESS') { return 'Имя пользователя или пароль неверны'; } } /* Test seconday groups */ $mem = ipsRegistry::member()->setUpSecondaryGroups($mem); if ($mem['g_access_cp'] != 1) { return 'У вас нет доступа к системе обновления'; } /* Set up _member */ $this->loadMemberData($mem['member_id']); /* Still here? */ return TRUE; }
/** * Sends a query to the IPS Spam Service * * @access public * @param string $email Email address to check/report * @param string [$ip] IP Address to check report, ipsRegistry::member()->ip_address will be used if the address is not specified * @param string [$type] Either register or markspam, register is default * @return string */ public static function querySpamService($email, $ip = '', $type = 'register', $test = 0) { /* Get the response */ $key = ipsRegistry::$settings['spam_service_api_key']; $domain = ipsRegistry::$settings['board_url']; $ip = ip2long($ip) ? $ip : ipsRegistry::member()->ip_address; $response = false; $testConn = $test ? '&debug_mode=1' : ''; /* Get the file managemnet class */ require_once IPS_KERNEL_PATH . 'classFileManagement.php'; $query = new classFileManagement(); $query->use_sockets = 1; $query->timeout = ipsRegistry::$settings['spam_service_timeout']; /* Query the service */ $response = $query->getFileContents("http://ips-spam-service.com/api/index.php?key={$key}&domain={$domain}&type={$type}&email={$email}&ip={$ip}{$testConn}"); if (!$response) { return 'timeout'; } $response = explode("\n", $response); $responseCode = $response[0]; $responseMsg = $response[1]; if ($test) { return $responseMsg; } /* Log Request */ if ($type == 'register') { ipsRegistry::DB()->insert('spam_service_log', array('log_date' => time(), 'log_code' => $responseCode, 'log_msg' => $responseMsg, 'email_address' => $email, 'ip_address' => $ip)); } return intval($responseCode); }
/** * Sends a query to the IPS Spam Service * * @param string $email Email address to check/report * @param string [$ip] IP Address to check report, ipsRegistry::member()->ip_address will be used if the address is not specified * @param string [$type] Either register or markspam, register is default * @return string */ public static function querySpamService($email, $ip = '', $type = 'register', $test = 0) { /* Get the response */ $key = trim(ipsRegistry::$settings['ipb_reg_number']); if (!$key) { return 0; } $domain = ipsRegistry::$settings['board_url']; $ip = ($ip and ip2long($ip)) ? $ip : ipsRegistry::member()->ip_address; $response = false; $testConn = $test ? '&debug_mode=1' : ''; /* Get the file managemnet class */ $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classFileManagement.php', 'classFileManagement'); $query = new $classToLoad(); $query->timeout = ipsRegistry::$settings['spam_service_timeout']; /* Query the service */ $response = 0; if (!$response) { return 'timeout'; } $response = explode("\n", $response); $responseCode = $response[0]; $responseMsg = $response[1]; if ($test) { return $responseMsg; } /* Log Request */ if ($type == 'register') { ipsRegistry::DB()->insert('spam_service_log', array('log_date' => time(), 'log_code' => $responseCode, 'log_msg' => $responseMsg, 'email_address' => $email, 'ip_address' => $ip)); } return intval($responseCode); }
/** * Process Results * * @param array Row from database using query specified in fetch() * @return array Same data with any additional processing necessary */ public function process($row) { /* Build poster's display data */ $member = $row['author_id'] ? IPSMember::load($row['author_id'], 'profile_portal,pfields_content,sessions,groups', 'id') : IPSMember::setUpGuest(); $row = array_merge($row, IPSMember::buildDisplayData($member, array('reputation' => 0, 'warn' => 0))); /* Get forum data (damn HTML >.<) */ $forumData = ipsRegistry::getClass('class_forums')->getForumById($row['forum_id']); /* Parse BBCode */ IPSText::getTextClass('bbcode')->parse_smilies = $row['use_emo']; IPSText::getTextClass('bbcode')->parse_html = ($forumData['use_html'] and $member['g_dohtml'] and $row['post_htmlstate']) ? 1 : 0; IPSText::getTextClass('bbcode')->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parsing_section = 'topics'; IPSText::getTextClass('bbcode')->parsing_mgroup = $member['member_group_id']; IPSText::getTextClass('bbcode')->parsing_mgroup_others = $member['mgroup_others']; $row['post'] = IPSText::getTextClass('bbcode')->preDisplayParse($row['post']); /* Parse attachments */ $messageHTML = array($row['pid'] => $row['post']); $attachHTML = $this->class_attach->renderAttachments($messageHTML, array($row['pid'])); if (is_array($attachHTML) and count($attachHTML)) { /* Get rid of any lingering attachment tags */ if (stristr($attachHTML[$row['pid']]['html'], "[attachment=")) { $attachHTML[$row['pid']]['html'] = IPSText::stripAttachTag($attachHTML[$row['pid']]['html']); } $row['post'] = $attachHTML[$row['pid']]['html'] . $attachHTML[$row['pid']]['attachmentHtml']; } /* Get rep buttons */ if ($row['repUserGiving'] == ipsRegistry::member()->getProperty('member_id')) { $row['has_given_rep'] = $row['rep_rating']; } $row['rep_points'] = ipsRegistry::getClass('repCache')->getRepPoints(array('app' => 'forums', 'type' => 'pid', 'type_id' => $row['pid'], 'rep_points' => $row['rep_points'])); $row['repButtons'] = ipsRegistry::getClass('repCache')->getLikeFormatted(array('app' => 'forums', 'type' => 'pid', 'id' => $row['pid'], 'rep_like_cache' => $row['rep_like_cache'])); /* Return */ return $row; }
/** * Constructor * * @access public * @param string [$lang] Language file to load, english by default * @return void */ public function __construct(ipsRegistry $registry) { /* Make objects */ $this->DB = $registry->DB(); $this->settings = $registry->fetchSettings(); $this->member = $registry->member(); $this->cache = $registry->cache(); $this->caches =& $registry->cache()->fetchCaches(); $this->request = $registry->fetchRequest(); $this->memberData =& $registry->member()->fetchMemberData(); /* Rebuild the cache if needed */ if (!$this->caches['lang_data']) { $this->rebuildLanguagesCache(); } /* Find the lang we need */ if ($this->caches['lang_data']) { foreach ($this->caches['lang_data'] as $_lang) { $this->languages[] = $_lang; if ($_lang['lang_default']) { $this->local = $_lang['lang_short']; $this->lang_id = $_lang['lang_id']; $this->language_dir = $_lang['lang_id']; /* Guests get the default */ if (!$this->memberData['member_id']) { $this->member->language_id = $this->lang_id; } } } } /* Got a guest cookie? */ if (!$this->memberData['member_id']) { $langCookie = IPSCookie::get('language'); if ($langCookie) { $this->member->language_id = trim(IPSText::parseCleanValue($langCookie)); } } /* Forcing Engrish? */ if ($forceCookie = IPSCookie::get('forceEnglish')) { if ($forceCookie) { $this->_forceEnglish = true; } } //----------------------------------------- // Time options //----------------------------------------- /* %b is month abbr %B is full month %d is date 01-31 %Y is 4 digit year %g is 2 digit year %I is hour 01-12 %H - hour as a decimal number using a 24-hour clock (range 00 to 23) %M is min 01-59 %p is am/pm */ $this->time_options = array('JOINED' => $this->settings['clock_joined'] ? $this->settings['clock_joined'] : '%d-%B %y', 'SHORT' => $this->settings['clock_short'] ? $this->settings['clock_short'] : '%b %d %Y %I:%M %p', 'LONG' => $this->settings['clock_long'] ? $this->settings['clock_long'] : '%d %B %Y - %I:%M %p', 'TINY' => $this->settings['clock_tiny'] ? $this->settings['clock_tiny'] : '%d %b %Y - %H:%M', 'DATE' => $this->settings['clock_date'] ? $this->settings['clock_date'] : '%d %b %Y', 'TIME' => 'h:i A', 'ACP' => '%d %B %Y, %H:%M', 'ACP2' => '%d %B %Y, %H:%M'); //-------------------------------- // Did we choose a language? //-------------------------------- if (isset($this->request['setlanguage']) and $this->request['setlanguage'] and $this->request['langid']) { /* Forcing english? */ if ($this->request['langid'] == '__english__') { IPSDebug::addMessage("forceEnglish cookie written"); IPSCookie::set('forceEnglish', 1, 0); $this->_forceEnglish = true; } else { if ($this->request['k'] == $this->member->form_hash and is_array(ipsRegistry::cache()->getCache('lang_data')) and count(ipsRegistry::cache()->getCache('lang_data'))) { foreach (ipsRegistry::cache()->getCache('lang_data') as $data) { if ($data['lang_id'] == $this->request['langid']) { if ($this->memberData['member_id']) { IPSMember::save($this->memberData['member_id'], array('core' => array('language' => $data['lang_id']))); } else { IPSCookie::set('language', $data['lang_id']); } $this->member->language_id = $data['lang_id']; $this->member->setProperty('language', $data['lang_id']); break; } } } } } //-------------------------------- // Now set it //-------------------------------- if ($this->member->language_id) { foreach ($this->caches['lang_data'] as $_lang) { if ($_lang['lang_id'] == $this->member->language_id) { $this->local = $_lang['lang_short']; $this->lang_id = $_lang['lang_id']; $this->language_dir = $_lang['lang_id']; break; } } } //----------------------------------------- // Set locale //----------------------------------------- setlocale(LC_ALL, $this->local); $this->local_data = localeconv(); //----------------------------------------- // Using in_dev override //----------------------------------------- if (IN_DEV and !$this->_forceEnglish) { if (is_dir(IPS_CACHE_PATH . 'cache/lang_cache/master_lang')) { $this->lang_id = 'master_lang'; } } }