コード例 #1
0
 /**
  * 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&section=wizard';
     }
     //-----------------------------------------
     // Get interface
     //-----------------------------------------
     require_once IPSLib::getAppDir('ccs') . '/sources/blocks/feed/feedInterface.php';
 }
コード例 #2
0
 /**
  * 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&section=wizard';
     }
 }
コード例 #3
0
ファイル: example.php プロジェクト: Advanture/Online-RolePlay
 /**
  * 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();
 }
コード例 #4
0
 /**
  * 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;
 }
コード例 #5
0
 /**
  * @desc			Loads and checks different vars when class is initiating
  * @author			Matthias Reuter
  * @since			2.0
  * @ignore
  */
 public function __construct()
 {
     // check for DB prefix
     if (ipbwi_DB_prefix == '') {
         define('ipbwi_DB_prefix', 'ipbwi_');
     }
     if (defined('ipbwi_LANG')) {
         self::setLang(ipbwi_LANG);
     } else {
         self::setLang('en');
     }
     // initialize IP.board Interface
     require_once ipbwi_ROOT_PATH . 'lib/ips_wrapper.inc.php';
     if (!defined('IPBWI_INCORRECT_BOARD_PATH')) {
         $this->ips_wrapper = new ipbwi_ips_wrapper();
         if (defined('ipbwi_COOKIE_DOMAIN')) {
             $this->board['cookie_domain'] = ipbwi_COOKIE_DOMAIN;
             $this->ips_wrapper->settings['cookie_domain'] = ipbwi_COOKIE_DOMAIN;
             ipsRegistry::$settings['cookie_domain'] = ipbwi_COOKIE_DOMAIN;
         }
         ipsRegistry::cache()->updateCacheWithoutSaving('settings', ipsRegistry::$settings);
         // retrieve common vars
         $this->board = $this->ips_wrapper->settings;
         $this->board['version'] = $this->ips_wrapper->caches['app_cache']['core']['app_version'];
         $this->board['version_long'] = $this->ips_wrapper->caches['app_cache']['core']['app_long_version'];
         $this->board['url'] = str_replace('?', '', $this->ips_wrapper->settings['board_url']) . '/';
         $this->board['name'] = $this->ips_wrapper->settings['board_name'];
         $this->board['basedir'] = ipbwi_BOARD_PATH;
         $this->board['upload_dir'] = $this->ips_wrapper->settings['upload_dir'] . '/';
         $this->board['upload_url'] = $this->ips_wrapper->settings['upload_url'] . '/';
         $this->board['home_name'] = $this->ips_wrapper->settings['home_name'];
         $this->board['home_url'] = $this->ips_wrapper->settings['home_url'] . '/';
         $this->board['emo_url'] = str_replace('<#EMO_DIR#>', 'default', $this->ips_wrapper->settings['emoticons_url']) . '/';
     }
 }
 /**
  * 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;
 }
コード例 #7
0
ファイル: rssOutput.php プロジェクト: mover5/imobackup
 /**
  * Grab the RSS document content and return it
  * 
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cal_id = intval(ipsRegistry::$request['id']);
     $rss_data = array();
     $to_print = '';
     $this->expires = time();
     $_calendarCache = ipsRegistry::cache()->getCache('calendars');
     //-----------------------------------------
     // Get RSS export
     //-----------------------------------------
     $rss_data = $_calendarCache[$cal_id];
     //-----------------------------------------
     // Got one?
     //-----------------------------------------
     if ($rss_data['cal_id'] and $rss_data['cal_rss_export']) {
         //-----------------------------------------
         // Correct expires time
         //-----------------------------------------
         $this->expires = $rss_data['cal_rss_update_last'] + $rss_data['cal_rss_update'] * 60;
         //-----------------------------------------
         // Need to recache?
         //-----------------------------------------
         if (!$rss_data['cal_rss_cache'] or time() - $rss_data['cal_rss_update'] * 60 > $rss_data['cal_rss_update_last']) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('calendar') . '/sources/cache.php', 'calendar_cache', 'calendar');
             $rss_export = new $classToLoad(ipsRegistry::instance());
             return $rss_export->rebuildCalendarRSSCache($rss_data['cal_id']);
         } else {
             return $rss_data['cal_rss_cache'];
         }
     }
 }
コード例 #8
0
ファイル: permissionsSync.php プロジェクト: mover5/imobackup
 /**
  * Constructor
  *
  * @param	object		$registry		Registry object
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Make shortcuts
     //-----------------------------------------
     $this->cache = $registry->cache();
 }
コード例 #9
0
 public function __construct()
 {
     $this->settings = ipsRegistry::fetchSettings();
     $this->lang = ipsRegistry::getClass('class_localization');
     $this->caches =& ipsRegistry::cache()->fetchCaches();
     $this->cache = ipsRegistry::cache();
     $this->DB = ipsRegistry::DB();
 }
コード例 #10
0
ファイル: emailLists.php プロジェクト: mover5/imobackup
 /**
  * Get Form Data
  *
  * @return	array
  */
 public function getFormData($current)
 {
     /* Get groups */
     $groups = array();
     foreach (ipsRegistry::cache()->getCache('group_cache') as $g) {
         $groups[] = array($g['g_id'], $g['g_title']);
     }
     /* Return */
     return array('group' => array("Is in group", ipsRegistry::getClass('output')->formMultiDropdown('members-group[]', $groups, empty($current) ? array() : $current['group'])), 'last_visit' => array("Last Visit Was", ipsRegistry::getClass('output')->formDropdown('members-last_visit_1', array(array('l', "Less Than"), array('e', "Equal to"), array('g', "Greater Than")), empty($current) ? 'l' : $current['last_visit_1']) . ipsRegistry::getClass('output')->formSimpleInput('members-last_visit_2', empty($current) ? '' : $current['last_visit_2']) . " days ago"), 'joined' => array("Joined", ipsRegistry::getClass('output')->formDropdown('members-joined_1', array(array('l', "Less Than"), array('e', "Equal to"), array('g', "Greater Than")), empty($current) ? 'l' : $current['joined_1']) . ipsRegistry::getClass('output')->formSimpleInput('members-joined_2', empty($current) ? '' : $current['joined_2']) . " days ago"));
 }
コード例 #11
0
ファイル: cleanout.php プロジェクト: mover5/imobackup
 /**
  * Constructor
  *
  * @param	object		$registry		Registry object
  * @param	object		$class			Task manager class object
  * @param	array		$task			Array with the task data
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry, $class, $task)
 {
     /* Make registry objects */
     $this->registry = $registry;
     $this->DB = $this->registry->DB();
     $this->settings =& $this->registry->fetchSettings();
     $this->lang = $this->registry->getClass('class_localization');
     $this->caches =& ipsRegistry::cache()->fetchCaches();
     $this->cache = ipsRegistry::cache();
     $this->class = $class;
     $this->task = $task;
 }
コード例 #12
0
 /**
  * Check service is available
  */
 public function check($return = FALSE)
 {
     $ok = FALSE;
     $licenseData = ipsRegistry::cache()->getCache('licenseData');
     if (isset($licenseData['ipbMain'])) {
         foreach ($licenseData['ipbMain'] as $service) {
             if ($service['name'] == 'Spam Monitoring Service' and $service['status'] == 'Ok') {
                 $ok = TRUE;
                 break;
             }
         }
     }
     if ($return) {
         return $ok;
     }
     if (!$ok) {
         ipsRegistry::getClass('output')->showError(ipsRegistry::getClass('class_localization')->words['enhancements_spammonitoring_error']);
     }
 }
コード例 #13
0
ファイル: attach.php プロジェクト: mover5/imobackup
 /**
  * Get the actual output.
  * This is abstracted so that the AJAX routine can load and execute this function
  *
  * @param	array 		Topic and attachment data
  * @return	string		HTML output
  */
 public function getAttachments($topic)
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $attach_cache = ipsRegistry::cache()->getCache('attachtypes');
     //-----------------------------------------
     // Get forum skin and lang
     //-----------------------------------------
     $this->registry->getClass('class_localization')->loadLanguageFile(array('public_forums', 'public_topic'), 'forums');
     //-----------------------------------------
     // aight.....
     //-----------------------------------------
     $_queued = !$this->registry->getClass('class_forums')->canQueuePosts($topic['forum_id']) ? ' AND ' . $this->registry->class_forums->fetchPostHiddenQuery(array('visible'), 'p.') : '';
     $_st = $this->request['st'] > 0 ? intval($this->request['st']) : 0;
     $_limit = 50;
     $_pages = '';
     $_count = $this->DB->buildAndFetch(array('select' => 'COUNT(*) as attachments', 'from' => array('posts' => 'p'), 'where' => 'a.attach_id IS NOT NULL AND p.topic_id=' . $topic['tid'] . $_queued, 'add_join' => array(array('from' => array('attachments' => 'a'), 'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'", 'type' => 'left'))));
     if ($_count['attachments'] > $_limit) {
         $_pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $_count['attachments'], 'itemsPerPage' => $_limit, 'currentStartValue' => $_st, 'baseUrl' => "app=forums&amp;module=forums&amp;section=attach&amp;tid={$topic['tid']}"));
     }
     $this->DB->build(array('select' => 'p.pid, p.topic_id', 'from' => array('posts' => 'p'), 'where' => 'a.attach_id IS NOT NULL AND p.topic_id=' . $topic['tid'] . $_queued, 'order' => 'p.pid ASC, a.attach_id ASC', 'limit' => array($_st, $_limit), 'add_join' => array(array('select' => 'a.*', 'from' => array('attachments' => 'a'), 'where' => "a.attach_rel_id=p.pid AND a.attach_rel_module='post'", 'type' => 'left'))));
     $this->DB->execute();
     while ($row = $this->DB->fetch()) {
         if (IPSMember::checkPermissions('read', $topic['forum_id']) != TRUE) {
             continue;
         }
         if (!$row['attach_id']) {
             continue;
         }
         $row['image'] = str_replace('folder_mime_types', 'mime_types', $attach_cache[$row['attach_ext']]['atype_img']);
         $row['short_name'] = IPSText::truncate($row['attach_file'], 30);
         $row['attach_date'] = $this->registry->getClass('class_localization')->getDate($row['attach_date'], 'SHORT');
         $row['real_size'] = IPSLib::sizeFormat($row['attach_filesize']);
         $rows[] = $row;
     }
     $this->output .= $this->registry->getClass('output')->getTemplate('forum')->forumAttachments($topic['title'], $rows, $_pages);
     return $this->output;
 }
コード例 #14
0
 /**
  * Log the user out
  *
  * @param	string		Message to show on the form
  * @return	@e void
  */
 public function loginForm($message = '')
 {
     //-----------------------------------------
     // Hang on, do we need the upgrader?
     //-----------------------------------------
     if (!IN_DEV and (!defined('SKIP_UPGRADE_CHECK') or !SKIP_UPGRADE_CHECK)) {
         require_once IPS_ROOT_PATH . 'setup/sources/base/setup.php';
         /*noLibHook*/
         foreach (ipsRegistry::$applications as $app_dir => $app) {
             $_a = ($app_dir == 'forums' or $app_dir == 'members') ? 'core' : $app_dir;
             $numbers = IPSSetUp::fetchAppVersionNumbers($_a);
             if ($numbers['latest'][0] and $numbers['latest'][0] > $numbers['current'][0]) {
                 $this->registry->output->silentRedirect($this->settings['base_acp_url'] . '/upgrade/index.php?_acpRedirect=1');
                 return;
             }
         }
     }
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $message = $message ? $message : $this->member->sessionClass()->getMessage();
     //-------------------------------------------------------
     // Remove all out of date sessions, like a good boy. Woof.
     //-------------------------------------------------------
     $cut_off_stamp = time() - 60 * 60 * 2;
     $this->DB->delete('core_sys_cp_sessions', "session_running_time < {$cut_off_stamp}");
     //------------------------------------------------------
     // Start form
     //------------------------------------------------------
     $qs = str_replace('&amp;', '&', IPSText::parseCleanValue(urldecode(my_getenv('QUERY_STRING'))));
     $qs = str_replace('adsess=', 'old_adsess=', $qs);
     $qs = str_replace('module=menu', '', $qs);
     $additional_data = $this->han_login->additionalFormHTML();
     $replace = false;
     $data = array();
     if (!is_null($additional_data) and is_array($additional_data) and count($additional_data)) {
         $replace = $additional_data[0];
         $data = $additional_data[1];
     }
     $uses_name = false;
     $uses_email = false;
     foreach (ipsRegistry::cache()->getCache('login_methods') as $method) {
         $login_methods[$method['login_folder_name']] = $method['login_folder_name'];
         if ($method['login_user_id'] == 'username' or $method['login_user_id'] == 'either') {
             $uses_name = true;
         }
         if ($method['login_user_id'] == 'email' or $method['login_user_id'] == 'either') {
             $uses_email = true;
         }
     }
     if ($uses_name and $uses_email) {
         $this->lang->words['gl_signinname'] = $this->lang->words['enter_name_and_email'];
     } else {
         if ($uses_email) {
             $this->lang->words['gl_signinname'] = $this->lang->words['enter_useremail'];
         } else {
             $this->lang->words['gl_signinname'] = $this->lang->words['enter_username'];
         }
     }
     ipsRegistry::getClass('output')->html_title = $this->lang->words['ipb_login'];
     ipsRegistry::getClass('output')->html_main = ipsRegistry::getClass('output')->global_template->log_in_form($qs, $message, $replace == 'replace' ? true : false, $data);
     ipsRegistry::getClass('output')->html_main = str_replace('<%TITLE%>', ipsRegistry::getClass('output')->html_title, ipsRegistry::getClass('output')->html_main);
     @header("Content-type: text/html");
     print ipsRegistry::getClass('output')->html_main;
     exit;
 }
コード例 #15
0
 /**
  * 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));
     }
 }
コード例 #16
0
ファイル: login.php プロジェクト: ConnorChristie/GrabViews
 /**
  * Updates cache store record
  *
  * @return	boolean		Cache store updated successfully
  */
 public function loginsRecache()
 {
     $cache = array();
     $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1', 'order' => 'login_order ASC'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         $cache[$r['login_id']] = $r;
     }
     ipsRegistry::cache()->setCache('login_methods', $cache, array('array' => 1));
 }
コード例 #17
0
 /**
  * Check to see if a member is banned (or not)
  *
  * @access	public
  * @param	string		Type of ban check (ip/ipAddress, name, email)
  * @param	string		String to check
  * @return	boolean		TRUE (banned) - FALSE (not banned)
  */
 public static function isBanned($type, $string)
 {
     /* Try and be helpful */
     switch (strtolower($type)) {
         case 'ip':
             $type = 'ipAddress';
             break;
         case 'emailaddress':
             $type = 'email';
             break;
         case 'username':
         case 'displayname':
             $type = 'name';
             break;
     }
     if ($type == 'ipAddress') {
         $banCache = ipsRegistry::cache()->getCache('banfilters');
     } else {
         if (!is_array(self::$_banFiltersCache)) {
             self::$_banFiltersCache = array();
             /* Load Ban Filters */
             ipsRegistry::DB()->build(array('select' => '*', 'from' => 'banfilters'));
             ipsRegistry::DB()->execute();
             while ($r = ipsRegistry::DB()->fetch()) {
                 self::$_banFiltersCache[$r['ban_type']][] = $r['ban_content'];
             }
         }
         $banCache = self::$_banFiltersCache[$type];
     }
     if (is_array($banCache) and count($banCache)) {
         foreach ($banCache as $entry) {
             $ip = str_replace('\\*', '.*', preg_quote(trim($entry), "/"));
             if ($ip and preg_match("/^{$ip}\$/", $string)) {
                 return TRUE;
             }
         }
     }
     return FALSE;
 }
コード例 #18
0
 /**
  * Check if there is a skin hook registered here and 
  * if so overload the skin file with this hook
  *
  * @access	protected
  * @param	string		Skin group name
  * @param	string		Class name
  * @param	integer		Skin ID
  * @return	string		Class name to instantiate
  */
 protected function _getSkinHooks($name, $classname, $id)
 {
     /* Hooks: Are we overloading this class? */
     $hooksCache = ipsRegistry::cache()->getCache('hooks');
     if (isset($hooksCache['skinHooks']) && is_array($hooksCache['skinHooks']) && count($hooksCache['skinHooks'])) {
         foreach ($hooksCache['skinHooks'] as $hook) {
             foreach ($hook as $classOverloader) {
                 /* Hooks: Do we have a hook that extends this class? */
                 if ($classOverloader['classToOverload'] == $name) {
                     if (file_exists(DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'])) {
                         if (!class_exists($classOverloader['className'])) {
                             /* Hooks: Do we have the hook file? */
                             $thisContents = file_get_contents(DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename']);
                             $thisContents = str_replace("(~id~)", "_{$id}", $thisContents);
                             ob_start();
                             eval($thisContents);
                             ob_end_clean();
                         }
                         if (class_exists($classOverloader['className'])) {
                             /* Hooks: We have the hook file and the class exists - reset the classname to load */
                             $classname = $classOverloader['className'];
                         }
                     }
                 }
             }
         }
     }
     return $classname;
 }
コード例 #19
0
 /**
  * Displays the registration form
  *
  * @param	array 	$form_errors
  * @return	@e void
  */
 public function registerForm($form_errors = array())
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $final_errors = array();
     $coppa = IPSCookie::get('coppa');
     $step = $this->request['step'] ? intval($this->request['step']) : 1;
     $this->settings['username_errormsg'] = str_replace('{chars}', $this->settings['username_characters'], $this->settings['username_errormsg']);
     if ($coppa == 'yes') {
         $this->registry->output->showError('awaiting_coppa', 10124);
     }
     $this->_resetMember();
     //-----------------------------------------
     // COPPA swapout
     //-----------------------------------------
     if ($this->settings['use_coppa']) {
         $this->lang->words['confirm_over_thirteen'] = str_replace("<#FORM_LINK#>", "{$this->settings['base_url']}app=core&amp;module=global&amp;section=register&amp;do=12", $this->lang->words['confirm_over_thirteen']);
     }
     //-----------------------------------------
     // T & C
     //-----------------------------------------
     $cache = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'core_sys_conf_settings', 'where' => "conf_key='reg_rules'"));
     $text = $cache['conf_value'] ? $cache['conf_value'] : $cache['conf_default'];
     IPSText::getTextClass('bbcode')->parse_smilies = 1;
     IPSText::getTextClass('bbcode')->parse_html = 1;
     IPSText::getTextClass('bbcode')->parse_nl2br = 1;
     IPSText::getTextClass('bbcode')->parse_bbcode = 1;
     IPSText::getTextClass('bbcode')->parsing_section = 'global';
     $this->settings['_termsAndConditions'] = IPSText::getTextClass('bbcode')->preDisplayParse($text);
     //-----------------------------------------
     // Page title / navigation
     //-----------------------------------------
     $this->registry->output->setTitle($this->lang->words['registration_form'] . ' - ' . ipsRegistry::$settings['board_name']);
     $this->registry->output->addNavigation($this->lang->words['registration_form'], '');
     //-----------------------------------------
     // If Nexus is installed, that is the first step
     //-----------------------------------------
     if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) {
         //-----------------------------------------
         // We just submitted the form
         //-----------------------------------------
         if ($this->request['nexus_pass']) {
             $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('nexus') . '/sources/hooks.php', 'nexusHooks', 'nexus');
             $hookGateway = new $classToLoad($this->registry);
             //-----------------------------------------
             // Check for errors
             //-----------------------------------------
             if ($this->settings['nexus_reg_force'] and !IPSCookie::get('cm_reg') and empty($this->request['cm_package'])) {
                 $nexusError = $this->lang->words['forceby_no_sel'];
             }
         }
         //-----------------------------------------
         // If no errors, create invoice and set cookie
         //-----------------------------------------
         if (!$nexusError and $this->request['nexus_pass']) {
             //-----------------------------------------
             // Did we buy a package?
             //-----------------------------------------
             $chosenPackages = ipsRegistry::$request['cm_package'];
             if (!empty($chosenPackages)) {
                 foreach ($chosenPackages as $itemID) {
                     require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php';
                     /*noLibHook*/
                     $package = package::load($itemID);
                     $shippingData = $package->shippingData();
                     $renewTerm = $package->renewalTerms();
                     $items[] = array('act' => 'new', 'app' => 'nexus', 'type' => $package->data['p_type'], 'cost' => $package->price($this->memberData['member_id'], FALSE), 'tax' => $package->data['p_tax'], 'renew_term' => $renewTerm['term'], 'renew_units' => $renewTerm['unit'], 'renew_cost' => $renewTerm['price'], 'physical' => is_null($shippingData) ? FALSE : TRUE, 'shipping' => is_null($shippingData) ? array() : $shippingData['shipping'], 'weight' => is_null($shippingData) ? 0 : $shippingData['weight'], 'itemName' => $package->data['p_name'], 'itemID' => $package->data['p_id'], 'groupRenewals' => $package->data['p_group_renewals'], 'methods' => $package->data['p_methods'] ? explode(',', $package->data['p_methods']) : array());
                 }
                 // Generate it
                 require_once IPSLib::getAppDir('nexus') . '/sources/nexusApi.php';
                 /*noLibHook*/
                 $invoiceID = nexusApi::generateInvoice(NULL, $this->memberData['member_id'], $items);
                 IPSCookie::set('cm_reg', $invoiceID);
             }
         } else {
             //-----------------------------------------
             // "step 1" if Nexus is set to show packages on registration
             //-----------------------------------------
             require_once IPSLib::getAppDir('nexus') . '/sources/packageCore.php';
             /*noLibHook*/
             $packages = array();
             $this->DB->build(array('select' => '*', 'from' => 'nexus_packages', 'where' => 'p_reg=1', 'order' => 'p_position'));
             $e = $this->DB->execute();
             while ($row = $this->DB->fetch($e)) {
                 $packages[$row['p_id']] = package::load($row['p_id'])->buildDisplayData();
             }
             if (!empty($packages)) {
                 if (isset($this->request['cm_package'])) {
                     foreach ($this->request['cm_package'] as $packageID) {
                         $packages[$packageID]['checked'] = "checked='checked'";
                     }
                 }
                 $this->output .= $this->registry->output->getTemplate('nexus_payments')->regForm32($packages, $nexusError);
                 return;
             } else {
                 $this->settings['nexus_reg_show'] = false;
             }
         }
     }
     //-----------------------------------------
     // Send to an alternate registration URL?
     //-----------------------------------------
     $this->DB->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
     $this->DB->execute();
     while ($r = $this->DB->fetch()) {
         if ($r['login_register_url']) {
             $this->registry->output->silentRedirect($r['login_register_url']);
         }
     }
     //-----------------------------------------
     // Adjust text as needed based on validation type
     //-----------------------------------------
     if ($this->settings['reg_auth_type']) {
         if ($this->settings['reg_auth_type'] == 'admin_user' or $this->settings['reg_auth_type'] == 'user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['email_validate_text'];
         }
         /* User then admin? */
         if ($this->settings['reg_auth_type'] == 'admin_user') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['user_admin_validation'];
         }
         if ($this->settings['reg_auth_type'] == 'admin') {
             $this->lang->words['std_text'] .= "<br />" . $this->lang->words['just_admin_validation'];
         }
     }
     //-----------------------------------------
     // Captcha / Q&A
     //-----------------------------------------
     $captchaHTML = '';
     $qandaHTML = '';
     $question = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'question_and_answer', 'order' => $this->DB->buildRandomOrder(), 'limit' => array(1)));
     if ($question and count($question)) {
         $qandaHTML = $this->registry->output->getTemplate('global_other')->questionAndAnswer($question);
     }
     if ($this->settings['bot_antispam_type'] != 'none') {
         $captchaHTML = $this->registry->getClass('class_captcha')->getTemplate();
     }
     //-----------------------------------------
     // Custom fields
     //-----------------------------------------
     $custom_fields_out = array('required', 'optional');
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $custom_fields = new $classToLoad();
     $custom_fields->member_data = $this->memberData;
     $custom_fields->initData('edit', 0, array('tabindex' => 6));
     $custom_fields->parseToEdit('register');
     if (count($custom_fields->out_fields)) {
         foreach ($custom_fields->out_fields as $id => $form_element) {
             if ($custom_fields->cache_data[$id]['pf_not_null'] == 1) {
                 $ftype = 'required';
             } else {
                 $ftype = 'optional';
             }
             $custom_fields_out[$ftype][] = array('name' => $custom_fields->field_names[$id], 'desc' => $custom_fields->field_desc[$id], 'field' => $form_element, 'id' => $id, 'error' => '', 'type' => $custom_fields->cache_data[$id]['pf_type']);
         }
     }
     //-----------------------------------------
     // If Nexus is installed, also add billing information
     //-----------------------------------------
     $nexusFields = array();
     $nexusStates = array();
     if (IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online']) {
         ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_countries'), 'nexus');
         $fields = array();
         $_fields = ipsRegistry::cache()->getCache('customer_fields');
         if (is_array($_fields) and count($_fields)) {
             foreach ($_fields['reg'] as $k) {
                 $nexusFields[] = $_fields['fields'][$k];
             }
         }
         $nexusStates = customer::generateStateDropdown(TRUE);
     }
     //-----------------------------------------
     // Got errors to show?
     //-----------------------------------------
     $final_errors = array('dname' => NULL, 'password' => NULL, 'email' => NULL, 'tos' => NULL);
     foreach (array('dname', 'password', 'email', 'tos') as $thing) {
         if (isset($form_errors[$thing]) and is_array($form_errors[$thing]) and count($form_errors[$thing])) {
             $final_errors[$thing] = implode("<br />", $form_errors[$thing]);
         }
     }
     $this->request['PassWord'] = $this->request['PassWord'] ? $this->request['PassWord'] : '';
     $this->request['EmailAddress'] = $this->request['EmailAddress'] ? $this->request['EmailAddress'] : '';
     $this->request['EmailAddress_two'] = $this->request['EmailAddress_two'] ? $this->request['EmailAddress_two'] : '';
     $this->request['PassWord_Check'] = $this->request['PassWord_Check'] ? $this->request['PassWord_Check'] : '';
     $this->request['members_display_name'] = $this->request['members_display_name'] ? $this->request['members_display_name'] : '';
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : '';
     //-----------------------------------------
     // Create time zone dropdown array
     //-----------------------------------------
     $this->registry->class_localization->loadLanguageFile(array('public_usercp'), 'core');
     $time_select = array();
     foreach ($this->lang->words as $k => $v) {
         if (strpos($k, "time_") === 0) {
             $k = str_replace("time_", '', $k);
             if (preg_match('/^[\\-\\d\\.]+$/', $k)) {
                 $time_select[$k] = $v;
             }
         }
     }
     ksort($time_select);
     $this->request['time_offset'] = $this->request['time_offset'] ? $this->request['time_offset'] : $this->settings['time_offset'];
     //-----------------------------------------
     // Start output
     //-----------------------------------------
     $this->output .= $this->registry->output->getTemplate('register')->registerForm($form_errors['general'], array('TEXT' => $this->lang->words['std_text'], 'coppa_user' => $coppa, 'captchaHTML' => $captchaHTML, 'qandaHTML' => $qandaHTML, 'showCOPPA' => $this->settings['use_coppa'] and !(IPSLib::appIsInstalled('nexus') and $this->settings['nexus_reg_show'] and $this->settings['nexus_store_online'])), $final_errors, $time_select, $custom_fields_out, $nexusFields, $nexusStates);
     //-----------------------------------------
     // Member sync module
     //-----------------------------------------
     IPSLib::runMemberSync('onRegisterForm');
 }
コード例 #20
0
 /**
  * Retreive the command
  *
  * @access	public
  * @param	object		ipsRegistry reference
  * @return	object
  */
 public function getCommand(ipsRegistry $registry)
 {
     $_NOW = IPSDebug::getMemoryDebugFlag();
     $module = ipsRegistry::$current_module;
     $section = ipsRegistry::$current_section;
     $filepath = IPSLib::getAppDir(IPS_APP_COMPONENT) . '/' . self::$modules_dir . '/' . $module . '/';
     /* Got a section? */
     if (!$section) {
         if (file_exists($filepath . 'defaultSection.php')) {
             $DEFAULT_SECTION = '';
             require $filepath . 'defaultSection.php';
             if ($DEFAULT_SECTION) {
                 $section = $DEFAULT_SECTION;
             }
         }
     }
     $classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_' . $section;
     if (file_exists($filepath . 'manualResolver.php')) {
         require_once $filepath . 'manualResolver.php';
         $classname = self::$class_dir . '_' . IPS_APP_COMPONENT . '_' . $module . '_manualResolver';
     } else {
         if (file_exists($filepath . $section . '.php')) {
             require_once $filepath . $section . '.php';
         }
     }
     /* Hooks: Are we overloading this class? */
     $hooksCache = ipsRegistry::cache()->getCache('hooks');
     if (isset($hooksCache['commandHooks']) and is_array($hooksCache['commandHooks']) and count($hooksCache['commandHooks'])) {
         foreach ($hooksCache['commandHooks'] as $hook) {
             foreach ($hook as $classOverloader) {
                 /* Hooks: Do we have a hook that extends this class? */
                 if ($classOverloader['classToOverload'] == $classname) {
                     if (file_exists(DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'])) {
                         /* Hooks: Do we have the hook file? */
                         require_once DOC_IPS_ROOT_PATH . 'hooks/' . $classOverloader['filename'];
                         if (class_exists($classOverloader['className'])) {
                             /* Hooks: We have the hook file and the class exists - reset the classname to load */
                             $classname = $classOverloader['className'];
                         }
                     }
                 }
             }
         }
     }
     IPSDebug::setMemoryDebugFlag("Controller getCommand executed", $_NOW);
     if (class_exists($classname)) {
         $cmd_class = new ReflectionClass($classname);
         if ($cmd_class->isSubClassOf(self::$base_cmd)) {
             return $cmd_class->newInstance();
         } else {
             throw new Exception("{$section} in {$module} does not exist!");
         }
     }
     # Fudge it to return just the default object
     return clone self::$default_cmd;
 }
コード例 #21
0
ファイル: links.php プロジェクト: ConnorChristie/GrabViews
 /**
  * Share the link.
  *
  * @access	public
  * @param	string		Document title
  * @param	string		Document URL
  */
 public function share($title, $url)
 {
     /* Disabled? */
     if (!$this->settings['sl_enable']) {
         return false;
     }
     /* Permission Check */
     $cache = isset($this->caches['sharelinks']) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
     if ($cache[$this->_pluginKey]['share_groups'] != '*' and !IPSMember::isInGroup($this->memberData, explode(',', $cache[$this->_pluginKey]['share_groups']))) {
         return false;
     }
     /* Ensure title is correctly de-html-ized */
     $title = IPSText::UNhtmlspecialchars($title);
     if (is_object($this->_plugin)) {
         /* Grab URL details */
         $data = $this->deconstructUrl($url);
         /* Requires a permission check? */
         if ($data['data_app'] and method_exists($this->_plugin, 'requiresPermissionCheck')) {
             if ($this->_plugin->requiresPermissionCheck($data) !== false) {
                 $_file = IPSLib::getAppDir($data['data_app']) . '/extensions/coreExtensions.php';
                 $_result = false;
                 /* Check for the file */
                 if (is_file($_file)) {
                     /* Get the file */
                     $_class = IPSLib::loadLibrary($_file, $data['data_app'] . 'ShareLinks', $data['data_app']);
                     /* Check for the class */
                     if (class_exists($_class)) {
                         /* Create an object */
                         $_obj = new $_class();
                         /* Check for the module */
                         if (method_exists($_obj, 'permissionCheck')) {
                             if ($_obj->permissionCheck($data) !== false) {
                                 $_result = true;
                             }
                         }
                     }
                 }
                 if ($_result === false) {
                     $this->registry->getClass('output')->showError('no_permission');
                 }
             }
         }
         /* Log it */
         $this->log($url, $title, $data);
         /* In almost all cases, there is no data to return as the plugin
            redirects or posts an action */
         $this->_plugin->share($title, $url);
     }
     return false;
 }
コード例 #22
0
 /**
  * Authorize
  *
  * @access	public
  * @return	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();
     //--------------------------------------------
     // Got a cookie wookey?
     //--------------------------------------------
     $_adsess = ipsRegistry::$request['adsess'];
     $_time_out_mins = defined('IPB_ACP_SESSION_TIME_OUT') ? IPB_ACP_SESSION_TIME_OUT : 60;
     //-----------------------------------------
     // If the cookie doesn't match URL... use URL?
     //-----------------------------------------
     if ($_adsess) {
         $this->session_type = 'url';
         ipsRegistry::$request['adsess'] = $_adsess;
     }
     //--------------------------------------------
     // Continue...
     //--------------------------------------------
     if (!ipsRegistry::$request['adsess']) {
         //--------------------------------------------
         // No URL adsess found, lets log in.
         //--------------------------------------------
         return $this->_response(0, '');
     } else {
         //--------------------------------------------
         // We have a URL adsess, lets verify...
         //--------------------------------------------
         $this->DB->build(array('select' => '*', 'from' => 'core_sys_cp_sessions', 'where' => "session_id='" . IPSText::md5clean(ipsRegistry::$request['adsess']) . "'"));
         $this->DB->execute();
         $session_data = $this->DB->fetch();
         $_tab_data = unserialize($session_data['session_app_data']);
         $_tab_data = is_array($_tab_data) ? $_tab_data : array();
         if ($session_data['session_id'] == "") {
             //--------------------------------------------
             // Fail-safe, no DB record found, lets log in..
             //--------------------------------------------
             return $this->_response(0, '');
         } else {
             if ($session_data['session_member_id'] == "") {
                 //--------------------------------------------
                 // No member ID is stored, log in!
                 //--------------------------------------------
                 return $this->_response(0, 'session_nomemberid');
             } else {
                 //--------------------------------------------
                 // Key is good, check the member details
                 //--------------------------------------------
                 $this->DB->build(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => "member_id=" . intval($session_data['session_member_id']), 'add_join' => array(0 => array('select' => 'g.*', 'from' => array('groups' => 'g'), 'where' => 'm.member_group_id=g.g_id', 'type' => 'left'), 1 => array('select' => 's.*', 'from' => array('core_sys_login' => 's'), 'where' => 's.sys_login_id = m.member_id', 'type' => 'left'))));
                 $this->DB->execute();
                 self::$data_store = $this->DB->fetch();
                 self::$data_store = self::instance()->setUpSecondaryGroups(self::$data_store);
                 //--------------------------------------------
                 // Get perms
                 //--------------------------------------------
                 if (self::$data_store['member_id'] == "") {
                     //--------------------------------------------
                     // Ut-oh, no such member, log in!
                     //--------------------------------------------
                     return $this->_response(0, 'session_invalidmid');
                 } else {
                     //--------------------------------------------
                     // Member found, check passy
                     //--------------------------------------------
                     //if ( $session_data['session_member_login_key'] != self::$data_store['member_login_key'] )
                     //{
                     //	//--------------------------------------------
                     //	// Passys don't match..
                     //	//--------------------------------------------
                     //
                     //	return $this->_response( 0, 'Session member password mismatch' );
                     //}
                     //else
                     //{
                     //--------------------------------------------
                     // Do we have admin access?
                     //--------------------------------------------
                     if (self::$data_store['g_access_cp'] != 1) {
                         return $this->_response(0, 'session_noaccess');
                     } else {
                         $this->_validated = TRUE;
                     }
                     //}
                 }
             }
         }
     }
     //--------------------------------------------
     // If we're here, we're valid...
     //--------------------------------------------
     if ($this->_validated === TRUE) {
         if ($session_data['session_running_time'] < time() - $_time_out_mins * 60) {
             $this->_validated = FALSE;
             return $this->_response(0, 'session_timeout');
         } else {
             if (IPB_ACP_IP_MATCH) {
                 $first_ip = preg_replace("/^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})/", "\\1.\\2.\\3", $session_data['session_ip_address']);
                 $second_ip = preg_replace("/^([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})\\.([0-9]{1,3})/", "\\1.\\2.\\3", self::instance()->ip_address);
                 if ($first_ip != $second_ip) {
                     $this->_validated = FALSE;
                     return $this->_response(0, 'session_mismatchip');
                 }
             }
         }
         self::setMember(self::$data_store['member_id']);
         //-----------------------------------------
         // Fix up secondary groups
         //-----------------------------------------
         if (self::$data_store['mgroup_others']) {
             $groups_id = explode(',', self::$data_store['mgroup_others']);
             $masks = array();
             $cache = ipsRegistry::cache()->getCache('group_cache');
             if (count($groups_id)) {
                 foreach ($groups_id as $pid) {
                     if (!isset($cache[$pid]['g_id']) or !$cache[$pid]['g_id']) {
                         continue;
                     }
                     //-----------------------------------------
                     // Got masks?
                     //-----------------------------------------
                     if ($cache[$pid]['g_perm_id']) {
                         self::$data_store['g_perm_id'] .= ',' . $cache[$pid]['g_perm_id'];
                     }
                 }
             }
         }
         //-----------------------------------------
         // Current Location, used for online list
         //-----------------------------------------
         $module = ipsRegistry::$request['module'] != 'ajax' ? ipsRegistry::$request['module'] : $session_data['session_location'];
         $location = $session_data['session_url'];
         if (IPS_APP_COMPONENT && ipsRegistry::$request['module'] != 'ajax') {
             $location = str_ireplace("login=yes", "", ipsRegistry::$settings['query_string_safe']);
             $location = ltrim($location, '?');
             $location = preg_replace("!adsess=(\\w){32}!", "", $location);
             $location = preg_replace("!&mshow=(.+?)*!i", "", $location);
             $location = preg_replace("!&st=(.+?)*!i", "", $location);
             $location = preg_replace("!&messageinabottleacp=(.+?)*!i", "", $location);
         }
         /* Compare user-agent stuff */
         $session_data['_session_app_data'] = unserialize($session_data['session_app_data']);
         if (is_array($session_data['_session_app_data']) and $session_data['_session_app_data']['uagent_key']) {
             if ($session_data['_session_app_data']['uagent_raw'] != self::instance()->user_agent) {
                 $session_data['_session_app_data'] = self::_processUserAgent();
                 $session_data['_session_app_data']['uagent_raw'] = self::instance()->user_agent;
             }
         } else {
             $session_data['_session_app_data'] = self::_processUserAgent();
             $session_data['_session_app_data']['uagent_raw'] = self::instance()->user_agent;
         }
         //-----------------------------------------
         // Done...
         //-----------------------------------------
         $this->DB->update('core_sys_cp_sessions', array('session_running_time' => time(), 'session_location' => $module, 'session_url' => $location, 'session_app_data' => serialize($session_data['_session_app_data']), 'session_member_name' => self::$data_store['members_display_name']), 'session_member_id=' . intval(self::$data_store['member_id']) . " and session_id='" . ipsRegistry::$request['adsess'] . "'");
         return $this->_response(1, '', $session_data['_session_app_data']);
     }
 }
コード例 #23
0
 /**
  * Generate context-menu filter boxes
  * Pass &_nosave=1 to not store / read from a cookie
  *
  * @access	private
  * @author	Matt Mecham
  * @since	IPB 3.0.0
  * @return	void		[Outputs to screen]
  * @todo 	[Future] Allow multiple filter fields
  */
 private function _generateFilterBoxes()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $form = array();
     $custom_fields = array();
     # Filter: Customer contains
     $member_contains = $this->request['f_member_contains'] ? trim($this->request['f_member_contains']) : '';
     $member_contains_type = $this->request['f_member_contains_type'] ? trim($this->request['f_member_contains_type']) : '';
     $member_contains_text = $this->request['f_member_contains_text'] ? trim($this->request['f_member_contains_text']) : '';
     $_member_contains = array(0 => array('members_display_name', $this->lang->words['m_f_display']), 1 => array('name', $this->lang->words['m_f_login']), 2 => array('member_id', $this->lang->words['m_f_id']), 3 => array('email', $this->lang->words['m_f_email']), 4 => array('ip_address', $this->lang->words['m_f_ip']), 5 => array('signature', $this->lang->words['m_f_sig']));
     $_member_contains_type = array(0 => array('contains', $this->lang->words['m_f_contains']), 1 => array('equals', $this->lang->words['m_f_equals']), 2 => array('begins', $this->lang->words['m_f_begins']), 3 => array('ends', $this->lang->words['m_f_ends']));
     # Order by
     $order_by = '';
     $order_by = $this->request['order_by'] ? $this->request['order_by'] : 'members_l_display_name';
     $_order_by = array(0 => array('joined', $this->lang->words['m_f_joined']), 1 => array('members_l_username', $this->lang->words['m_f_slogin']), 2 => array('members_l_display_name', $this->lang->words['m_f_sdisplay']), 3 => array('email', $this->lang->words['m_f_email']));
     # Order direction
     $order_direction = $this->request['order_direction'] ? $this->request['order_direction'] : 'ASC';
     $_order_direction = array(0 => array('asc', $this->lang->words['m_f_orderaz']), 1 => array('desc', $this->lang->words['m_f_orderza']));
     # Filter: member type
     $member_type = $this->request['f_member_type'] ? trim($this->request['f_member_type']) : '';
     $_member_type = array(0 => array('all', $this->lang->words['m_f_showall']), 1 => array('suspended', $this->lang->words['m_f_showsusp']), 2 => array('notsuspended', $this->lang->words['m_f_showunsusp']));
     # Filter: banned type
     $banned_type = $this->request['f_banned_type'] ? trim($this->request['f_banned_type']) : '';
     $_banned_type = array(0 => array('all', $this->lang->words['m_f_showall']), 1 => array('banned', $this->lang->words['m_f_showbanned']), 2 => array('notbanned', $this->lang->words['m_f_shownotbanned']));
     # Filter: SPAM status type
     $spam_type = $this->request['f_spam_type'] ? trim($this->request['f_spam_type']) : '';
     $_spam_type = array(0 => array('all', $this->lang->words['m_f_showall']), 1 => array('spam', $this->lang->words['m_f_showspam']), 2 => array('notspam', $this->lang->words['m_f_shownotspam']));
     # Type of search
     $search_type = $this->request['f_search_type'] ? $this->request['f_search_type'] : 'normal';
     $_search_type = array(0 => array('normal', $this->lang->words['m_f_toedit']));
     if ($this->registry->getClass('class_permissions')->checkPermission('member_delete')) {
         $_search_type[1] = array('delete', $this->lang->words['m_f_todelete']);
     }
     if ($this->registry->getClass('class_permissions')->checkPermission('member_move')) {
         $_search_type[2] = array('move', $this->lang->words['m_f_tomove']);
     }
     # Date Ranges
     $date_reg_from = $this->request['f_date_reg_from'] ? trim($this->request['f_date_reg_from']) : '';
     $date_reg_to = $this->request['f_date_reg_to'] ? trim($this->request['f_date_reg_to']) : '';
     $date_post_from = $this->request['f_date_post_from'] ? trim($this->request['f_date_post_from']) : '';
     $date_post_to = $this->request['f_date_post_to'] ? trim($this->request['f_date_post_to']) : '';
     $date_active_from = $this->request['f_date_active_from'] ? trim($this->request['f_date_active_from']) : '';
     $date_active_to = $this->request['f_date_active_to'] ? trim($this->request['f_date_active_to']) : '';
     $primary_group = $this->request['f_primary_group'] ? trim($this->request['f_primary_group']) : 0;
     $secondary_group = $this->request['f_secondary_group'] ? trim($this->request['f_secondary_group']) : 0;
     $_primary_group = array(0 => array('0', $this->lang->words['m_f_primany']));
     $_secondary_group = array(0 => array('0', $this->lang->words['m_f_secany']));
     $post_count = $this->request['f_post_count'] ? trim($this->request['f_post_count']) : '';
     $post_count_type = $this->request['f_post_count_type'] ? trim($this->request['f_post_count_type']) : '';
     $_post_count_types = array(0 => array('lt', $this->lang->words['pc_lt']), 1 => array('gt', $this->lang->words['pc_gt']), 3 => array('eq', $this->lang->words['pc_eq']));
     foreach (ipsRegistry::cache()->getCache('group_cache') as $_gid => $_gdata) {
         $_primary_group[] = array($_gdata['g_id'], $_gdata['g_title']);
         $_secondary_group[] = array($_gdata['g_id'], $_gdata['g_title']);
     }
     /* Reset Fitlers */
     if ($this->request['reset_filters']) {
         ipsRegistry::getClass('adminFunctions')->staffSaveCookie('memberFilter', array());
     }
     //-----------------------------------------
     // Not posted, so er.. get the cookie
     //-----------------------------------------
     $custom_field_data = array();
     $filters_preset = 0;
     if (!$this->request['__update'] and !$this->request['_nosave']) {
         $_cookie_array = ipsRegistry::getClass('adminFunctions')->staffGetCookie('memberFilter');
         if ($_cookie_array) {
             if (is_array($_cookie_array) and count($_cookie_array)) {
                 $member_type = substr($_cookie_array['c_member_type'], 0, 10);
                 $banned_type = substr($_cookie_array['c_banned_type'], 0, 10);
                 $spam_type = substr($_cookie_array['c_spam_type'], 0, 10);
                 $member_contains = substr($_cookie_array['c_member_contains'], 0, 20);
                 $member_contains_type = substr($_cookie_array['c_member_contains_type'], 0, 20);
                 $member_contains_text = substr($_cookie_array['c_member_contains_text'], 0, 50);
                 $post_count = trim(IPSText::alphanumericalClean($_cookie_array['c_post_count']));
                 $post_count_type = trim(IPSText::alphanumericalClean($_cookie_array['c_post_count_type']));
                 $order_by = trim(IPSText::alphanumericalClean($_cookie_array['c_order_by']));
                 $order_direction = trim(IPSText::alphanumericalClean($_cookie_array['c_order_direction']));
                 $date_reg_from = trim(IPSText::alphanumericalClean($_cookie_array['c_date_reg_from'], '/-'));
                 $date_reg_to = trim(IPSText::alphanumericalClean($_cookie_array['c_date_reg_to'], '/-'));
                 $date_post_from = trim(IPSText::alphanumericalClean($_cookie_array['c_date_post_from'], '/-'));
                 $date_post_to = trim(IPSText::alphanumericalClean($_cookie_array['c_date_post_to'], '/-'));
                 $date_active_from = trim(IPSText::alphanumericalClean($_cookie_array['c_date_active_from'], '/-'));
                 $date_active_to = trim(IPSText::alphanumericalClean($_cookie_array['c_date_active_to'], '/-'));
                 $primary_group = trim(IPSText::alphanumericalClean($_cookie_array['c_primary_group'], '/-'));
                 $secondary_group = trim(IPSText::alphanumericalClean($_cookie_array['c_secondary_group'], '/-'));
                 $custom_field_cookie = explode('||', $_cookie_array['c_custom_fields']);
                 if ($member_type || $member_contains || $member_contains_type || $member_contains_text || $order_by || $order_direction || $date_reg_from || $date_reg_to || $date_post_from || $date_post_to || $date_active_from || $date_active_to || $primary_group || $secondary_group || $post_count || $post_count_type) {
                     $filters_preset = 1;
                 }
                 if (is_array($custom_field_cookie) and count($custom_field_cookie)) {
                     foreach ($custom_field_cookie as $field) {
                         $data = explode('==', $field);
                         $custom_field_data['field_' . $data[0]] = $data[1];
                         ipsRegistry::$request['field_' . $data[0]] = $data[1];
                         if ($data[1]) {
                             $filters_preset = 1;
                         }
                     }
                 }
             }
         }
     }
     $custom_field_data = count($custom_field_data) ? $custom_field_data : $_POST;
     foreach ($custom_field_data as $k => $v) {
         if (strpos($k, 'ignore_field_') === 0) {
             $key = substr($k, 13);
             $custom_field_data['field_' . $key] = '';
         }
     }
     //-----------------------------------------
     // Get custom profile information
     //-----------------------------------------
     require_once IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php';
     $fields = new customProfileFields();
     $fields->member_data = $custom_field_data;
     $fields->initData('edit', 1);
     $fields->parseToEdit();
     //-----------------------------------------
     // Finish forms...
     //-----------------------------------------
     $form['_member_contains'] = $this->registry->output->formDropdown('f_member_contains', $_member_contains, $member_contains);
     $form['_member_contains_type'] = $this->registry->output->formDropdown('f_member_contains_type', $_member_contains_type, $member_contains_type);
     $form['_member_contains_text'] = $this->registry->output->formSimpleInput('f_member_contains_text', $member_contains_text, 15);
     $form['_member_type'] = $this->registry->output->formDropdown('f_member_type', $_member_type, $member_type);
     $form['_banned_type'] = $this->registry->output->formDropdown('f_banned_type', $_banned_type, $banned_type);
     $form['_spam_type'] = $this->registry->output->formDropdown('f_spam_type', $_spam_type, $spam_type);
     $form['_order_by'] = $this->registry->output->formDropdown('order_by', $_order_by, preg_replace("#.*\\.(.*)\$#", "\\1", $order_by));
     $form['_order_direction'] = $this->registry->output->formDropdown('order_direction', $_order_direction, $order_direction);
     $form['_search_type'] = $this->registry->output->formDropdown('f_search_type', $_search_type, $search_type);
     $form['_post_count'] = $this->registry->output->formSimpleInput('f_post_count', $post_count, 10);
     $form['_post_count_type'] = $this->registry->output->formDropdown('f_post_count_type', $_post_count_types, $post_count_type);
     $form['_date_reg_from'] = $this->registry->output->formSimpleInput('f_date_reg_from', $date_reg_from, 10);
     $form['_date_reg_to'] = $this->registry->output->formSimpleInput('f_date_reg_to', $date_reg_to, 10);
     $form['_date_post_from'] = $this->registry->output->formSimpleInput('f_date_post_from', $date_post_from, 10);
     $form['_date_post_to'] = $this->registry->output->formSimpleInput('f_date_post_to', $date_post_to, 10);
     $form['_date_active_from'] = $this->registry->output->formSimpleInput('f_date_active_from', $date_active_from, 10);
     $form['_date_active_to'] = $this->registry->output->formSimpleInput('f_date_active_to', $date_active_to, 10);
     $form['_primary_group'] = $this->registry->output->formDropdown('f_primary_group', $_primary_group, $primary_group);
     $form['_secondary_group'] = $this->registry->output->formDropdown('f_secondary_group', $_secondary_group, $secondary_group);
     //-----------------------------------------
     // Set custom field data for cookie
     //-----------------------------------------
     $custom_field_data_imploded = array();
     foreach ($custom_field_data as $k => $v) {
         if (strpos($k, 'field_') === 0) {
             $custom_field_data_imploded[] = substr($k, 6) . '==' . $v;
         }
     }
     $custom_field_data_imploded = implode('||', $custom_field_data_imploded);
     //-----------------------------------------
     // Store the cooookie
     //-----------------------------------------
     if (!$this->request['_nosave']) {
         $_cookie = array('c_member_type' => $member_type, 'c_banned_type' => $banned_type, 'c_spam_type' => $spam_type, 'c_member_contains' => $member_contains, 'c_member_contains_type' => $member_contains_type, 'c_member_contains_text' => $member_contains_text, 'c_order_by' => preg_replace("#.*\\.(.*)\$#", "\\1", $__order_by), 'c_order_direction' => $__order_direction, 'c_post_count' => $post_count, 'c_post_count_type' => $post_count_type, 'c_date_reg_from' => $date_reg_from, 'c_date_reg_to' => $date_reg_to, 'c_date_post_from' => $date_post_from, 'c_date_post_to' => $date_post_to, 'c_date_active_from' => $date_active_from, 'c_date_active_to' => $date_active_to, 'c_primary_group' => $primary_group, 'c_secondary_group' => $secondary_group, 'c_custom_fields' => $custom_field_data_imploded);
         ipsRegistry::getClass('adminFunctions')->staffSaveCookie('memberFilter', $_cookie);
     }
     //-----------------------------------------
     // Create filter boxes
     //-----------------------------------------
     $this->registry->output->html .= $this->html->member_list_context_menu_filters($form, $fields, $filters_preset);
     //-----------------------------------------
     // Return data
     //-----------------------------------------
     $_return = array('custom_fields' => '');
     if (is_array($fields->out_fields) and count($fields->out_fields)) {
         foreach ($fields->out_fields as $id => $data) {
             $_return['custom_fields'][$id] = $fields->in_fields[$id];
         }
     }
     foreach (array_keys($form) as $_key) {
         $__key = substr($_key, 1);
         $_return[$__key] = ${$__key};
     }
     return $_return;
 }
コード例 #24
0
 /**
  * Check if there is a skin hook registered here and 
  * if so overload the skin file with this hook
  *
  * @access	protected
  * @param	string		Skin group name
  * @param	string		Class name
  * @param	integer		Skin ID
  * @return	string		Class name to instantiate
  */
 protected function _getSkinHooks($name, $classname, $id)
 {
     /* Hooks: Are we overloading this class? */
     $hooksCache = ipsRegistry::cache()->getCache('hooks');
     if (isset($hooksCache['skinHooks'][$name]) && is_array($hooksCache['skinHooks'][$name]) && count($hooksCache['skinHooks'][$name])) {
         foreach ($hooksCache['skinHooks'][$name] as $classOverloader) {
             if (is_file(IPS_HOOKS_PATH . $classOverloader['filename'])) {
                 if (!class_exists($classOverloader['className'])) {
                     /* Hooks: Do we have the hook file? */
                     $thisContents = file_get_contents(IPS_HOOKS_PATH . $classOverloader['filename']);
                     $thisContents = str_replace($name . "(~id~)", $classname, $thisContents);
                     ob_start();
                     eval($thisContents);
                     ob_end_clean();
                 }
                 if (class_exists($classOverloader['className'])) {
                     /* Hooks: We have the hook file and the class exists - reset the classname to load */
                     $classname = $classOverloader['className'];
                 }
             }
         }
     }
     return $classname;
 }
コード例 #25
0
 /**
  * Fetch emoticons as JSON for editors, etc
  *
  * @param	mixed		Number of emoticons to fetch (false to fetch all, or an int limit)
  * @return	string		JSON
  */
 public function fetchEmoticons($fetchFirstX = false)
 {
     $emoDir = IPSText::getEmoticonDirectory();
     $emoString = '';
     $smilie_id = 0;
     $total = 0;
     foreach (ipsRegistry::cache()->getCache('emoticons') as $elmo) {
         if ($elmo['emo_set'] != $emoDir) {
             continue;
         }
         $total++;
         if ($fetchFirstX !== false && $smilie_id + 1 > $fetchFirstX) {
             continue;
         }
         // -----------------------------------------
         // Make single quotes as URL's with html entites in them
         // are parsed by the browser, so ' causes JS error :o
         // -----------------------------------------
         if (strstr($elmo['typed'], "&#39;")) {
             $in_delim = '"';
         } else {
             $in_delim = "'";
         }
         $emoArray[$smilie_id] = array('src' => $elmo['image'], 'text' => addslashes($elmo['typed']));
         $smilie_id++;
     }
     return array('total' => $total, 'count' => $smilie_id, 'emoticons' => $emoArray);
 }
コード例 #26
0
 /**
  * Show the form
  *
  * @return	@e void		[Outputs to screen]
  */
 protected function show()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $name = trim(IPSText::alphanumericalClean($this->request['name']));
     $member_id = intval($this->request['member_id']);
     $output = '';
     //-----------------------------------------
     // Load language and skin
     //-----------------------------------------
     $html = $this->registry->output->loadTemplate('cp_skin_member_form');
     $this->lang->loadLanguageFile(array('admin_member'));
     //-----------------------------------------
     // Get member data
     //-----------------------------------------
     $member = IPSMember::load($member_id, 'extendedProfile,customFields');
     //-----------------------------------------
     // Got a member?
     //-----------------------------------------
     if (!$member['member_id']) {
         $this->returnJsonError($this->lang->words['m_noid']);
     }
     //-----------------------------------------
     // Return the form
     //-----------------------------------------
     if (method_exists($html, $name)) {
         $output = $html->{$name}($member);
     } else {
         $save_to = '';
         $div_id = '';
         $form_field = '';
         $text = '';
         $description = '';
         $method = '';
         switch ($name) {
             case 'inline_ban_member':
                 if (!$this->registry->getClass('class_permissions')->checkPermission('member_ban', 'members', 'members')) {
                     $this->returnJsonError($this->lang->words['m_noban']);
                 }
                 if ($member['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_ban_admin', 'members', 'members')) {
                     $this->returnJsonError($this->lang->words['m_noban']);
                 }
                 //-----------------------------------------
                 // INIT
                 //-----------------------------------------
                 $ban_filters = array('email' => array(), 'name' => array(), 'ip' => array());
                 $email_banned = false;
                 $ip_banned = array();
                 $name_banned = false;
                 //-----------------------------------------
                 // Grab existing ban filters
                 //-----------------------------------------
                 $this->DB->build(array('select' => '*', 'from' => 'banfilters'));
                 $this->DB->execute();
                 while ($r = $this->DB->fetch()) {
                     $ban_filters[$r['ban_type']][] = $r['ban_content'];
                 }
                 //-----------------------------------------
                 // Check name and email address
                 //-----------------------------------------
                 if (in_array($member['email'], $ban_filters['email'])) {
                     $email_banned = true;
                 }
                 if (in_array($member['name'], $ban_filters['name'])) {
                     $name_banned = true;
                 }
                 //-----------------------------------------
                 // Retrieve IP addresses
                 //-----------------------------------------
                 $ip_addresses = IPSMember::findIPAddresses($member['member_id']);
                 //-----------------------------------------
                 // Start form fields
                 //-----------------------------------------
                 $form['member'] = ipsRegistry::getClass('output')->formCheckbox("ban__member", $member['member_banned']);
                 $form['email'] = ipsRegistry::getClass('output')->formCheckbox("ban__email", $email_banned);
                 $form['name'] = ipsRegistry::getClass('output')->formCheckbox("ban__name", $name_banned);
                 $form['note'] = ipsRegistry::getClass('output')->formCheckbox("ban__note", 0);
                 $form['note_field'] = ipsRegistry::getClass('output')->formTextarea("ban__note_field");
                 $form['ips'] = array();
                 //-----------------------------------------
                 // What about IPs?
                 //-----------------------------------------
                 if (is_array($ip_addresses) and count($ip_addresses)) {
                     foreach ($ip_addresses as $ip_address => $count) {
                         if (in_array($ip_address, $ban_filters['ip'])) {
                             $form['ips'][$ip_address] = ipsRegistry::getClass('output')->formCheckbox("ban__ip_" . str_replace('.', '_', $ip_address), true);
                         } else {
                             $form['ips'][$ip_address] = ipsRegistry::getClass('output')->formCheckbox("ban__ip_" . str_replace('.', '_', $ip_address), false);
                         }
                     }
                 }
                 $member_groups = array();
                 foreach (ipsRegistry::cache()->getCache('group_cache') as $group) {
                     if ($group['g_id'] == $member['member_group_id']) {
                         $member['_group_title'] = $group['g_title'];
                     }
                     /* If it's an admin group, make sure the admin banning can promote to this group */
                     if ($group['g_access_cp'] and !$this->registry->getClass('class_permissions')->checkPermission('member_move_admin2')) {
                         continue;
                     }
                     $member_groups[] = array($group['g_id'], $group['g_title']);
                 }
                 $form['groups_confirm'] = ipsRegistry::getClass('output')->formCheckbox("ban__group_change", 0);
                 $form['groups'] = ipsRegistry::getClass('output')->formDropdown("ban__group", $member_groups, $member['member_group_id']);
                 $output = $html->inline_ban_member_form($member, $form);
                 break;
         }
         if (!$output and $method and method_exists($html, $method)) {
             $output = $html->{$method}($member, $save_to, $div_id, $form_field, $text, $description);
         }
     }
     //-----------------------------------------
     // Print...
     //-----------------------------------------
     $this->returnHtml($output);
 }
コード例 #27
0
 /**
  * Update the task's next run timestamp
  *
  * @access	public
  * @return	@e void
  */
 public function saveNextRunStamp()
 {
     /* Query the task rund ate */
     $this_task = $this->DB->buildAndFetch(array('select' => 'task_next_run', 'from' => 'task_manager', 'where' => 'task_enabled = 1', 'order' => 'task_next_run ASC', 'limit' => array(0, 1)));
     /* Get the cache */
     $task_cache = $this->caches['systemvars'];
     /* Fail safe */
     if (!$this_task['task_next_run']) {
         $this_task['task_next_run'] = $this->time_now + 3600;
     }
     /* Set new date */
     $task_cache['task_next_run'] = $this_task['task_next_run'];
     /* Save Cache */
     ipsRegistry::cache()->setCache('systemvars', $task_cache, array('array' => 1, 'donow' => 1));
 }
コード例 #28
0
 /**
  * Build the secondary menu
  *
  * @access	private
  * @return	string		Menu HTML
  */
 private function _buildSubMenu()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $clean_module = IPSText::alphanumericalClean(ipsRegistry::$current_module);
     $this->menu = array();
     $_nav_main_done = 0;
     /* Fetch fke apps */
     $fakeApps = $this->registry->output->fetchFakeApps();
     $inFakeApp = FALSE;
     $fakeApp = '';
     //-----------------------------------------
     // In a fake app?
     //-----------------------------------------
     foreach ($fakeApps as $_app => $_fdata) {
         foreach ($_fdata as $__fdata) {
             if (ipsRegistry::$current_application == $__fdata['app'] and $__fdata['module'] == ipsRegistry::$current_module) {
                 $fakeApp = $_app;
                 $inFakeApp = TRUE;
                 break 2;
             }
         }
     }
     //-----------------------------------------
     // Got a cache?
     //-----------------------------------------
     if (IN_DEV) {
         ipsRegistry::cache()->updateCacheWithoutSaving('app_menu_cache', array());
     }
     if (!is_array(ipsRegistry::cache()->getCache('app_menu_cache')) or !count(ipsRegistry::cache()->getCache('app_menu_cache'))) {
         $this->cache->rebuildCache('app_menu_cache', 'global');
     }
     //-----------------------------------------
     // Get child XML tabs
     //-----------------------------------------
     if (ipsRegistry::$current_application and $clean_module) {
         //-----------------------------------------
         // Do stuff
         //-----------------------------------------
         foreach (ipsRegistry::cache()->getCache('app_menu_cache') as $app_dir => $data) {
             if (!ipsRegistry::$applications[$app_dir]['app_enabled']) {
                 continue;
             }
             /* Not in this app? */
             if ($app_dir != ipsRegistry::$current_application) {
                 continue;
             }
             foreach ($data as $_current_module => $module_data) {
                 $skip = TRUE;
                 $__current_module = $_current_module;
                 $_current_module = preg_replace('/^\\d+?_(.*)$/', "\\1", $_current_module);
                 /* Fake app content? If so.. remove.. */
                 foreach ($fakeApps as $_app => $_fdata) {
                     foreach ($_fdata as $__fdata) {
                         /* If the fake app matches the menu we're gonna show... */
                         if ($__fdata['app'] == $app_dir and $__fdata['module'] == $_current_module) {
                             if ($inFakeApp === TRUE && $_app == $fakeApp) {
                                 $skip = FALSE;
                             }
                         } else {
                             /* If we're in a fake app, skip non fake apps */
                             if ($inFakeApp !== TRUE) {
                                 $skip = FALSE;
                             }
                         }
                     }
                 }
                 if ($skip === TRUE) {
                     continue;
                 }
                 if ($app_dir == ipsRegistry::$request['app'] and !stristr($this->settings['query_string_safe'], 'module=')) {
                     $this->settings['query_string_safe'] = $this->settings['query_string_safe'] . '&amp;module=' . $clean_module;
                 }
                 foreach ($module_data['items'] as $id => $item) {
                     //-----------------------------------------
                     // Permission mask?
                     //-----------------------------------------
                     if ($item['rolekey']) {
                         ipsRegistry::getClass('class_permissions')->return = 1;
                         if (ipsRegistry::getClass('class_permissions')->checkPermission($item['rolekey'], $app_dir, $_current_module) !== TRUE) {
                             //print '<pre>';print $app_dir . ' '. $_current_module.'<br>';print_r($module_data);print_r($item);
                             continue;
                         }
                     }
                     //-----------------------------------------
                     // Force a module/section parameter into the input array
                     //-----------------------------------------
                     if ($app_dir == ipsRegistry::$current_application and ipsRegistry::$current_module == $item['module'] and !ipsRegistry::$request['section'] and $item['section']) {
                         ipsRegistry::$request['section'] = $item['section'];
                     }
                     //-----------------------------------------
                     // Add to nav?
                     //-----------------------------------------
                     if ($app_dir == ipsRegistry::$current_application and ipsRegistry::$request['section'] and ipsRegistry::$request['section'] == $item['section'] and ipsRegistry::$current_module == $item['module']) {
                         //-----------------------------------------
                         // Sure?
                         //-----------------------------------------
                         $_ok = 1;
                         $__sub_item_url = $item['url'] ? '&amp;' . $item['url'] : '';
                         if (!$_nav_main_done) {
                             if (!$this->ignoreCoreNav) {
                                 $this->core_nav[] = array($this->settings['base_url'] . 'module=' . $_current_module . '&amp;section=' . $item['section'], $module_data['title']);
                             }
                             $_nav_main_done = 1;
                             //-----------------------------------------
                             // Sort out do param?
                             //-----------------------------------------
                             if ($item['url'] and !isset($_GET['do'])) {
                                 $_do = str_replace("do=", "", $item['url']);
                                 ipsRegistry::$request['do'] = $_do;
                                 if (!stristr($this->settings['query_string_safe'], 'section=')) {
                                     $this->settings['query_string_safe'] = $this->settings['query_string_safe'] . '&amp;section=' . ipsRegistry::$request['section'];
                                 }
                                 $this->settings['query_string_safe'] = '&amp;do=' . $_do;
                             }
                         }
                         if ($item['url']) {
                             /* Reset */
                             $_ok = 0;
                             /* Trying something a little different with the nav */
                             $_url = explode('=', $item['url']);
                             /* Now we're first going to check for an exact do match */
                             $_ok = $_url[1] == ipsRegistry::$request['do'];
                             /* No?  Check the Query string then */
                             if (!$_ok) {
                                 $_n = str_replace('&amp;', '&', strtolower($item['url']));
                                 $_h = str_replace('&amp;', '&', strtolower(my_getenv('QUERY_STRING')));
                                 if (strstr($_h, $_n)) {
                                     $_ok = 1;
                                 }
                             }
                         }
                         if (!$this->ignoreCoreNav and $_ok) {
                             $this->core_nav[] = array($this->settings['base_url'] . 'module=' . $_current_module . '&amp;section=' . $item['section'] . $__sub_item_url, $item['title']);
                         }
                     }
                     //-----------------------------------------
                     // Continue...
                     //-----------------------------------------
                     if ($item['title'] and $item['section']) {
                         $this->menu[$app_dir][$__current_module]['items'][] = array('title' => $item['title'], 'module' => $_current_module, 'section' => $item['section'], 'url' => $item['url'], 'redirect' => $item['redirect']);
                         $this->menu[$app_dir][$__current_module]['title'] = count($this->menu[$app_dir][$__current_module]['items']) > 1 ? $module_data['title'] : $item['title'];
                     }
                 }
             }
         }
     }
     //print_r($this->menu);
     if (isset($this->menu) && count($this->menu)) {
         return $this->global_template->menu_sub_navigation($this->menu);
     }
 }
コード例 #29
0
 /**
  * Generate context-menu filter boxes. 
  * Pass &_nosave=1 to not store / read from a cookie
  *
  * @author	Matt Mecham
  * @since	IPB 3.0.0
  * @return	array
  */
 public function generateFilterBoxes()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     static $_return = array();
     if (count($_return)) {
         return $_return;
     }
     $form = array();
     $custom_field_data = array();
     $filters_preset = 0;
     //-----------------------------------------
     // Custom filtering
     //-----------------------------------------
     $member_string = $this->request['string'] ? trim($this->request['string']) : '';
     $member_contains = $this->request['f_member_contains'] ? trim($this->request['f_member_contains']) : '';
     $member_contains_type = $this->request['f_member_contains_type'] ? trim($this->request['f_member_contains_type']) : '';
     $member_contains_text = $this->request['f_member_contains_text'] ? trim($this->request['f_member_contains_text']) : '';
     $_member_contains = array(0 => array('members_display_name', $this->lang->words['m_f_display']), 1 => array('name', $this->lang->words['m_f_login']), 2 => array('member_id', $this->lang->words['m_f_id']), 3 => array('email', $this->lang->words['m_f_email']), 4 => array('ip_address', $this->lang->words['m_f_ip']), 5 => array('signature', $this->lang->words['m_f_sig']));
     $_member_contains_type = array(0 => array('contains', $this->lang->words['m_f_contains']), 1 => array('equals', $this->lang->words['m_f_equals']), 2 => array('begins', $this->lang->words['m_f_begins']), 3 => array('ends', $this->lang->words['m_f_ends']));
     //-----------------------------------------
     // Order by
     //-----------------------------------------
     $order_by = '';
     $order_by = $this->request['order_by'] ? $this->request['order_by'] : 'joined';
     $_order_by = array(0 => array('joined', $this->lang->words['m_f_joined']), 1 => array('members_l_username', $this->lang->words['m_f_slogin']), 2 => array('members_l_display_name', $this->lang->words['m_f_sdisplay']), 3 => array('email', $this->lang->words['m_f_email']), 4 => array('posts', $this->lang->words['m_f_posts']));
     $order_direction = $this->request['order_direction'] ? strtolower($this->request['order_direction']) : 'desc';
     $_order_direction = array(0 => array('asc', $this->lang->words['m_f_orderaz']), 1 => array('desc', $this->lang->words['m_f_orderza']));
     //-----------------------------------------
     // Member status type
     //-----------------------------------------
     $member_status = ($this->request['type'] and in_array($this->request['type'], array('all', 'banned', 'spam', 'validating', 'incomplete', 'locked'))) ? $this->request['type'] : 'all';
     $_member_status = array(0 => array('all', $this->lang->words['m_f_sall']), 1 => array('banned', $this->lang->words['m_f_sbanned']), 2 => array('spam', $this->lang->words['m_f_sspam']), 3 => array('validating', $this->lang->words['m_f_svalidating']), 4 => array('incomplete', $this->lang->words['m_f_simpcomplete']), 5 => array('locked', $this->lang->words['m_f_slocked']));
     //-----------------------------------------
     // Search type
     //-----------------------------------------
     $search_type = $this->request['f_search_type'] ? $this->request['f_search_type'] : 'normal';
     $_search_type = array(0 => array('normal', $this->lang->words['m_f_toedit']));
     if ($this->registry->getClass('class_permissions')->checkPermission('member_delete')) {
         $_search_type[1] = array('delete', $this->lang->words['m_f_todelete']);
     }
     if ($this->registry->getClass('class_permissions')->checkPermission('member_move')) {
         $_search_type[2] = array('move', $this->lang->words['m_f_tomove']);
     }
     //-----------------------------------------
     // Date ranges
     //-----------------------------------------
     $date_reg_from = $this->request['f_date_reg_from'] ? trim($this->request['f_date_reg_from']) : '';
     $date_reg_to = $this->request['f_date_reg_to'] ? trim($this->request['f_date_reg_to']) : '';
     $date_post_from = $this->request['f_date_post_from'] ? trim($this->request['f_date_post_from']) : '';
     $date_post_to = $this->request['f_date_post_to'] ? trim($this->request['f_date_post_to']) : '';
     $date_active_from = $this->request['f_date_active_from'] ? trim($this->request['f_date_active_from']) : '';
     $date_active_to = $this->request['f_date_active_to'] ? trim($this->request['f_date_active_to']) : '';
     //-----------------------------------------
     // Groups
     //-----------------------------------------
     $primary_group = $this->request['f_primary_group'] ? trim($this->request['f_primary_group']) : 0;
     $secondary_group = $this->request['f_secondary_group'] ? trim($this->request['f_secondary_group']) : 0;
     $include_secondary = $this->request['f_inc_secondary'] ? 1 : 0;
     IPSDebug::fireBug('info', array('Включая вторичные группы: ' . var_export($include_secondary, true)));
     $_primary_group = array(0 => array('0', $this->lang->words['m_f_primany']));
     $_secondary_group = array(0 => array('0', $this->lang->words['m_f_secany']));
     foreach (ipsRegistry::cache()->getCache('group_cache') as $_gdata) {
         $_primary_group[] = array($_gdata['g_id'], $_gdata['g_title']);
         $_secondary_group[] = array($_gdata['g_id'], $_gdata['g_title']);
     }
     //-----------------------------------------
     // Post counts
     //-----------------------------------------
     $post_count = $this->request['f_post_count'] || $this->request['f_post_count'] == '0' ? trim($this->request['f_post_count']) : '';
     $post_count_type = $this->request['f_post_count_type'] ? trim($this->request['f_post_count_type']) : '';
     $_post_count_types = array(0 => array('lt', $this->lang->words['pc_lt']), 1 => array('gt', $this->lang->words['pc_gt']), 2 => array('eq', $this->lang->words['pc_eq']));
     //-----------------------------------------
     // Reset filters if set to
     //-----------------------------------------
     if ($this->request['reset_filters']) {
         ipsRegistry::getClass('adminFunctions')->staffSaveCookie('memberFilter', array());
     }
     //-----------------------------------------
     // Retrieve filter from "cookie"
     //-----------------------------------------
     /* Commented out nosave - @link http://community.invisionpower.com/resources/bugs.html/_/ip-board/acp-member-search-pagination-r40480 */
     if (!$this->request['__update']) {
         $_cookie_array = ipsRegistry::getClass('adminFunctions')->staffGetCookie('memberFilter');
         if (is_array($_cookie_array) and count($_cookie_array)) {
             $member_contains = substr($_cookie_array['c_member_contains'], 0, 20);
             $member_contains_type = substr($_cookie_array['c_member_contains_type'], 0, 20);
             $member_contains_text = substr($_cookie_array['c_member_contains_text'], 0, 50);
             $member_status = trim(IPSText::alphanumericalClean($_cookie_array['c_member_status']));
             $member_string = trim($_cookie_array['c_member_string']);
             $post_count = trim(IPSText::alphanumericalClean($_cookie_array['c_post_count']));
             $post_count_type = trim(IPSText::alphanumericalClean($_cookie_array['c_post_count_type']));
             if (!isset($this->request['order_by'])) {
                 $order_by = trim(IPSText::alphanumericalClean($_cookie_array['c_order_by']));
             }
             if (!isset($this->request['order_direction'])) {
                 $order_direction = trim(IPSText::alphanumericalClean($_cookie_array['c_order_direction']));
             }
             $date_reg_from = trim(IPSText::alphanumericalClean($_cookie_array['c_date_reg_from'], '/-'));
             $date_reg_to = trim(IPSText::alphanumericalClean($_cookie_array['c_date_reg_to'], '/-'));
             $date_post_from = trim(IPSText::alphanumericalClean($_cookie_array['c_date_post_from'], '/-'));
             $date_post_to = trim(IPSText::alphanumericalClean($_cookie_array['c_date_post_to'], '/-'));
             $date_active_from = trim(IPSText::alphanumericalClean($_cookie_array['c_date_active_from'], '/-'));
             $date_active_to = trim(IPSText::alphanumericalClean($_cookie_array['c_date_active_to'], '/-'));
             $primary_group = trim(IPSText::alphanumericalClean($_cookie_array['c_primary_group'], '/-'));
             $include_secondary = trim(IPSText::alphanumericalClean($_cookie_array['c_include_secondary'], '/-'));
             $secondary_group = trim(IPSText::alphanumericalClean($_cookie_array['c_secondary_group'], '/-'));
             $custom_field_cookie = explode('||', $_cookie_array['c_custom_fields']);
             if ($member_contains || $member_contains_type || $member_contains_text || $order_by || $order_direction || $date_reg_from || $date_reg_to || $date_post_from || $date_post_to || $date_active_from || $date_active_to || $primary_group || $secondary_group || $post_count || $post_count_type || $include_secondary || $member_status || $member_string) {
                 $filters_preset = 1;
             }
             if (is_array($custom_field_cookie) and count($custom_field_cookie)) {
                 foreach ($custom_field_cookie as $field) {
                     $data = explode('==', $field);
                     $custom_field_data['field_' . $data[0]] = $data[1];
                     ipsRegistry::$request['field_' . $data[0]] = $data[1];
                     if ($data[1]) {
                         $filters_preset = 1;
                     }
                 }
             }
         }
     }
     //-----------------------------------------
     // Get custom profile information
     //-----------------------------------------
     $custom_field_data = count($custom_field_data) ? $custom_field_data : $_REQUEST;
     foreach ($custom_field_data as $k => $v) {
         if (strpos($k, 'ignore_field_') === 0) {
             $key = substr($k, 13);
             $custom_field_data['field_' . $key] = '';
         }
     }
     $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/customfields/profileFields.php', 'customProfileFields');
     $fields = new $classToLoad();
     $fields->member_data = $custom_field_data;
     $fields->initData('edit', 1);
     $fields->parseToEdit();
     $custom_field_data_imploded = array();
     foreach ($custom_field_data as $k => $v) {
         if (strpos($k, 'field_') === 0 and $v) {
             if (is_array($v)) {
                 $v = implode(',', array_keys($v));
             }
             $custom_field_data_imploded[] = substr($k, 6) . '==' . $v;
         }
     }
     $custom_field_data_imploded = implode('||', $custom_field_data_imploded);
     //-----------------------------------------
     // Generate form data
     //-----------------------------------------
     $form['_member_contains'] = $this->registry->output->formDropdown('f_member_contains', $_member_contains, $member_contains);
     $form['_member_contains_type'] = $this->registry->output->formDropdown('f_member_contains_type', $_member_contains_type, $member_contains_type);
     $form['_member_contains_text'] = $this->registry->output->formInput('f_member_contains_text', $member_contains_text, 'f_member_contains_text', 15, '', ' no_width');
     $form['_member_status'] = $this->registry->output->formDropdown('type', $_member_status, $member_status);
     $form['_member_string'] = $this->registry->output->formSimpleInput('string', $member_string, 15);
     $form['_order_by'] = $this->registry->output->formDropdown('order_by', $_order_by, preg_replace("#.*\\.(.*)\$#", "\\1", $order_by));
     $form['_order_direction'] = $this->registry->output->formDropdown('order_direction', $_order_direction, $order_direction);
     $form['_search_type'] = $this->registry->output->formDropdown('f_search_type', $_search_type, $search_type);
     $form['_post_count'] = $this->registry->output->formSimpleInput('f_post_count', $post_count, 10);
     $form['_post_count_type'] = $this->registry->output->formDropdown('f_post_count_type', $_post_count_types, $post_count_type);
     $form['_date_reg_from'] = $this->registry->output->formInput('f_date_reg_from', $date_reg_from, 'f_date_reg_from', 15, 'text', '', ' no_width');
     $form['_date_reg_to'] = $this->registry->output->formInput('f_date_reg_to', $date_reg_to, 'f_date_reg_to', 15, 'text', '', ' no_width');
     $form['_date_post_from'] = $this->registry->output->formInput('f_date_post_from', $date_post_from, 'f_date_post_from', 15, 'text', '', ' no_width');
     $form['_date_post_to'] = $this->registry->output->formInput('f_date_post_to', $date_post_to, 'f_date_post_to', 15, 'text', '', ' no_width');
     $form['_date_active_from'] = $this->registry->output->formInput('f_date_active_from', $date_active_from, 'f_date_active_from', 15, 'text', '', ' no_width');
     $form['_date_active_to'] = $this->registry->output->formInput('f_date_active_to', $date_active_to, 'f_date_active_to', 15, 'text', '', ' no_width');
     $form['_primary_group'] = $this->registry->output->formDropdown('f_primary_group', $_primary_group, $primary_group);
     $form['_secondary_group'] = $this->registry->output->formDropdown('f_secondary_group', $_secondary_group, $secondary_group);
     $form['_include_secondary'] = $this->registry->output->formCheckbox('f_inc_secondary', $include_secondary);
     //-----------------------------------------
     // Store the cooookie
     // @see http://community.invisionpower.com/tracker/issue-19031-acp-members-page-always-thinks-its-being-filtered/
     //-----------------------------------------
     if (($this->request['__update'] or $this->request['f_search_type']) and !$this->request['_nosave']) {
         $_cookie = array('c_member_status' => $member_status, 'c_member_string' => $member_string, 'c_member_contains' => $member_contains, 'c_member_contains_type' => $member_contains_type, 'c_member_contains_text' => $member_contains_text, 'c_order_by' => preg_replace("#.*\\.(.*)\$#", "\\1", $order_by), 'c_order_direction' => $order_direction, 'c_post_count' => $post_count, 'c_post_count_type' => $post_count_type, 'c_date_reg_from' => $date_reg_from, 'c_date_reg_to' => $date_reg_to, 'c_date_post_from' => $date_post_from, 'c_date_post_to' => $date_post_to, 'c_date_active_from' => $date_active_from, 'c_date_active_to' => $date_active_to, 'c_primary_group' => $primary_group, 'c_secondary_group' => $secondary_group, 'c_include_secondary' => $include_secondary, 'c_custom_fields' => $custom_field_data_imploded);
         ipsRegistry::getClass('adminFunctions')->staffSaveCookie('memberFilter', $_cookie);
     } elseif ((isset($this->request['order_by']) or isset($this->request['order_direction'])) and !$this->request['_nosave']) {
         $_cookie = ipsRegistry::getClass('adminFunctions')->staffGetCookie('memberFilter');
         $_cookie['c_order_by'] = preg_replace("#.*\\.(.*)\$#", "\\1", $order_by);
         $_cookie['c_order_direction'] = $order_direction;
         ipsRegistry::getClass('adminFunctions')->staffSaveCookie('memberFilter', $_cookie);
     }
     //-----------------------------------------
     // Create filter boxes
     //-----------------------------------------
     $this->htmlPresets = array('form' => $form, 'fields' => $fields, 'presets' => $filters_preset);
     //-----------------------------------------
     // Return data
     //-----------------------------------------
     $_return['custom_fields'] = '';
     if (is_array($fields->out_fields) and count($fields->out_fields)) {
         foreach ($fields->out_fields as $id => $data) {
             $_return['custom_fields'][$id] = $fields->in_fields[$id];
         }
     }
     foreach (array_keys($form) as $_key) {
         $__key = substr($_key, 1);
         $_return[$__key] = ${$__key};
     }
     return $_return;
 }
コード例 #30
0
 /**
  * Set up a member
  *
  * @return	@e void
  */
 protected static function setUpMember()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cache = ipsRegistry::cache()->getCache('group_cache');
     //-----------------------------------------
     // Unpack cache
     //-----------------------------------------
     if (isset(self::$data_store['members_cache'])) {
         self::$data_store['_cache'] = IPSMember::unpackMemberCache(self::$data_store['members_cache']);
     } else {
         self::$data_store['_cache'] = array();
     }
     if (!isset(self::$data_store['_cache']['friends']) or !is_array(self::$data_store['_cache']['friends'])) {
         self::$data_store['_cache']['friends'] = array();
     }
     //-----------------------------------------
     // Unpack ignored users
     //-----------------------------------------
     if (isset(self::$data_store['ignored_users'])) {
         self::$data_store['_ignoredUsers'] = @unserialize(self::$data_store['ignored_users']);
     } else {
         self::$data_store['_ignoredUsers'] = array();
     }
     //-----------------------------------------
     // Set up main 'display' group
     //-----------------------------------------
     if (is_array($cache[self::$data_store['member_group_id']])) {
         self::$data_store = array_merge(self::$data_store, $cache[self::$data_store['member_group_id']]);
     }
     //-----------------------------------------
     // Work out permissions
     //-----------------------------------------
     self::$data_store = self::instance()->setUpSecondaryGroups(self::$data_store);
     /* Ensure we don't have a ,, string */
     self::$data_store['org_perm_id'] = IPSText::cleanPermString(self::$data_store['org_perm_id']);
     self::instance()->perm_id = !empty(self::$data_store['org_perm_id']) ? self::$data_store['org_perm_id'] : self::$data_store['g_perm_id'];
     self::instance()->perm_id_array = explode(",", self::instance()->perm_id);
     //-----------------------------------------
     // Synchronise the last visit and activity times if
     // we have some in the member profile
     //-----------------------------------------
     if (!self::$data_store['last_activity']) {
         self::$data_store['last_activity'] = IPS_UNIX_TIME_NOW;
     }
     //-----------------------------------------
     // If there hasn't been a cookie update in 2 hours,
     // we assume that they've gone and come back
     //-----------------------------------------
     if (!self::$data_store['last_visit']) {
         //-----------------------------------------
         // No last visit set, do so now!
         //-----------------------------------------
         ipsRegistry::DB()->update('members', array('last_visit' => self::$data_store['last_activity'], 'last_activity' => IPS_UNIX_TIME_NOW), "member_id=" . self::$data_store['member_id'], true);
         self::$data_store['last_visit'] = self::$data_store['last_activity'];
     } else {
         if (IPS_UNIX_TIME_NOW - self::$data_store['last_activity'] > 300) {
             //-----------------------------------------
             // If the last click was longer than 5 mins ago and this is a member
             // Update their profile.
             //-----------------------------------------
             $be_anon = IPSMember::isLoggedInAnon(self::$data_store);
             ipsRegistry::DB()->update('members', array('login_anonymous' => "{$be_anon}&1", 'last_activity' => IPS_UNIX_TIME_NOW), 'member_id=' . self::$data_store['member_id'], true);
         }
     }
     //-----------------------------------------
     // Group promotion based on time since joining
     //-----------------------------------------
     /* Are we checking for auto promotion? */
     if (self::$data_store['g_promotion'] != '-1&-1') {
         /* Are we checking for post based auto incrementation? 0 is post based, 1 is date based, so...  */
         if (self::$data_store['gbw_promote_unit_type']) {
             list($gid, $gdate) = explode('&', self::$data_store['g_promotion']);
             if ($gid > 0 and $gdate > 0) {
                 if (self::$data_store['joined'] <= time() - $gdate * 86400) {
                     IPSMember::save(self::$data_store['member_id'], array('core' => array('member_group_id' => $gid)));
                     /* Now reset the members group stuff */
                     self::$data_store = array_merge(self::$data_store, $cache[$gid]);
                     self::$data_store = self::instance()->setUpSecondaryGroups(self::$data_store);
                     self::instance()->perm_id = !empty(self::$data_store['org_perm_id']) ? self::$data_store['org_perm_id'] : self::$data_store['g_perm_id'];
                     self::instance()->perm_id_array = explode(",", self::instance()->perm_id);
                 }
             }
         }
     }
 }