Пример #1
0
 /**
  * Get Content URL
  *
  * @param	array		$warning		Row from members_warn_logs
  * @return	@e array	array( url => URL to the content the warning came from, title => Title )
  */
 public function getContentUrl($warning)
 {
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_profile'), 'members');
     if ($warning['wl_content_id1']) {
         $post = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'message_posts', 'where' => "msg_id=" . intval($warning['wl_content_id1'])));
         if (!empty($post['msg_topic_id'])) {
             $topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'message_topics', 'where' => "mt_id={$post['msg_topic_id']}"));
             if (!empty($topic['mt_id'])) {
                 ipsRegistry::DB()->build(array('select' => '*', 'from' => 'message_topic_user_map', 'where' => "map_topic_id={$post['msg_topic_id']}"));
                 ipsRegistry::DB()->execute();
                 while ($row = ipsRegistry::DB()->fetch()) {
                     if ($row['map_user_id'] == ipsRegistry::member()->getProperty('member_id')) {
                         return array('url' => ipsRegistry::getClass('output')->buildUrl("app=members&module=messaging&section=view&do=findMessage&topicID={$topic['mt_id']}&msgID={$post['msg_id']}"), 'title' => $topic['mt_title']);
                     }
                 }
                 return array('url' => ipsRegistry::getClass('output')->buildUrl("app=core&module=reports&section=reports&do=showMessage&topicID={$topic['mt_id']}&msg={$post['msg_id']}"), 'title' => $topic['mt_title']);
             }
         }
     } else {
         $member = IPSMember::load($warning['wl_member']);
         if (!empty($member['member_id'])) {
             return array('url' => ipsRegistry::getClass('output')->buildSEOUrl("showuser={$member['member_id']}", 'public', $member['members_seo_name'], 'showuser'), 'title' => ipsRegistry::getClass('class_localization')->words['warnings_profile']);
         }
     }
 }
Пример #2
0
 /**
  * This method is called after a member account has been removed
  *
  * @param	string	$ids	SQL IN() clause
  * @return	@e void
  */
 public function onDelete($mids)
 {
     /* Delete Status Updates - note, we can't do this via memberStatus class, since we no longer have the member data */
     ipsRegistry::DB()->delete('member_status_updates', "status_member_id" . $mids);
     ipsRegistry::DB()->delete('member_status_actions', "action_member_id" . $mids);
     ipsRegistry::DB()->delete('member_status_replies', "reply_member_id" . $mids);
 }
Пример #3
0
 /**
  * Grab the RSS document content and return it
  *
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $member_id = intval(ipsRegistry::$request['member_id']);
     $secure_key = IPSText::md5Clean(ipsRegistry::$request['rss_key']);
     $rss_data = array();
     $to_print = '';
     if ($secure_key and $member_id) {
         if ($member_id == ipsRegistry::member()->getProperty('member_id')) {
             //-----------------------------------------
             // Get RSS export
             //-----------------------------------------
             $rss_data = ipsRegistry::DB()->buildAndFetch(array('select' => 'rss_cache', 'from' => 'rc_modpref', 'where' => "mem_id=" . $member_id . " AND rss_key='" . $secure_key . "'"));
             //-----------------------------------------
             // Got one?
             //-----------------------------------------
             if ($rss_data['rss_cache']) {
                 return $rss_data['rss_cache'];
             }
         }
         //-----------------------------------------
         // Create a dummy one
         //-----------------------------------------
         ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_reports'), 'core');
         $classToLoad = IPSLib::loadLibrary(IPS_KERNEL_PATH . 'classRss.php', 'classRss');
         $rss = new $classToLoad();
         $channel_id = $rss->createNewChannel(array('title' => ipsRegistry::getClass('class_localization')->words['rss_feed_title'], 'link' => ipsRegistry::$settings['board_url'], 'description' => ipsRegistry::getClass('class_localization')->words['reports_rss_desc'], 'pubDate' => $rss->formatDate(time())));
         $rss->createRssDocument();
         return $rss->rss_document;
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	object		Registry reference
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     //-----------------------------------------
     // Make shortcuts
     //-----------------------------------------
     $this->registry = $registry;
     $this->DB = $registry->DB();
     $this->settings = $registry->fetchSettings();
     $this->member = $registry->member();
     $this->cache = $registry->cache();
     $this->caches =& $registry->cache()->fetchCaches();
     $this->request = $registry->fetchRequest();
     $this->lang = $registry->class_localization;
     if (IN_ACP) {
         //-----------------------------------------
         // Load HTML
         //-----------------------------------------
         $this->html = $this->registry->output->loadTemplate('cp_skin_blocks_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';
     }
 }
 /**
  * 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';
 }
Пример #6
0
 public function runTask()
 {
     ipsRegistry::DB()->build(array('select' => '*', 'from' => 'members'));
     $members_vip = $this->DB->execute();
     while ($m = $this->DB->fetch($members_vip)) {
         $vipValido = false;
         ipsRegistry::DB()->build(array('select' => '*', 'from' => 'vips'));
         $vips = ipsRegistry::DB()->execute();
         while ($vip = $this->DB->fetch($vips)) {
             if ($vip['nome'] == $m['name']) {
                 if ($vip[$vip['usando']] > 0) {
                     if ($m['member_group_id'] != $this->settings['pxvip_GrupoVip']) {
                         $this->DB->update('members', array('member_group_id' => $this->settings['pxvip_GrupoVip']), 'member_id=' . $m['member_id']);
                     }
                     $vipValido = true;
                 }
             }
         }
         if ($vipValido == false && $m['member_group_id'] == $this->settings['pxvip_GrupoVip']) {
             $this->DB->update('members', array('member_group_id' => 3), 'member_id=' . $m['member_id']);
         }
     }
     $this->class->appendTaskLog($this->task, $this->lang->words['my_task_log_lang_string']);
     $this->class->unlockTask($this->task);
 }
Пример #7
0
 /**
  * Database Query to get results
  *
  * @param	string	'given' if we want to return items as user has liked
  *					'received' if we want to fetch items a user has posted that others have liked
  *					NULL to get highest rated
  * @param	array	Member this applies to
  *					NULL to get highest rated
  *
  * @return	array	Parameters to pass to ipsRegistry::DB()->build
  *					Must return at least the data from reputation_index
  *					limit and order will be applied automatically
  */
 public function fetch($type = NULL, $member = NULL)
 {
     //-----------------------------------------
     // Get our allowed calendars
     //-----------------------------------------
     $allowedCalendarIds = array();
     ipsRegistry::DB()->build(array('select' => 'perm_type_id as calendar_id', 'from' => 'permission_index', 'where' => "app='calendar' AND " . ipsRegistry::DB()->buildRegexp("perm_view", ipsRegistry::member()->perm_id_array)));
     ipsRegistry::DB()->execute();
     while ($r = ipsRegistry::DB()->fetch()) {
         $allowedCalendarIds[] = $r['calendar_id'];
     }
     //-----------------------------------------
     // Return query
     //-----------------------------------------
     $userGiving = 'r';
     $extraWhere = '';
     $extraJoin = array();
     if ($type == 'most') {
         return array('type' => 'event_id', 'inner' => array('select' => 'e.event_id', 'from' => array('cal_events' => 'e'), 'where' => empty($allowedCalendarIds) ? '1=0' : ipsRegistry::DB()->buildWherePermission($allowedCalendarIds, 'e.event_calendar_id', FALSE)), 'joins' => array(array('select' => 'rc.*', 'from' => array('reputation_cache' => 'rc'), 'where' => "rc.app='calendar' AND rc.type='event_id' AND rc.type_id=r.type_id"), array('select' => 'c.*', 'from' => array('cal_event_comments' => 'c'), 'where' => 'r.type="comment_id" AND r.type_id=c.comment_id', 'type' => 'left'), array('select' => 'e.*', 'from' => array('cal_events' => 'e'), 'where' => 'e.event_id = IFNULL(c.comment_eid, r.type_id)')));
     } else {
         if ($type !== NULL) {
             $extraWhere = ($type == 'given' ? "r.member_id={$member['member_id']}" : "( ( r.type='event_id' AND e.event_member_id={$member['member_id']} ) OR ( r.type='comment_id' AND c.comment_mid={$member['member_id']} ) )") . ' AND ';
         } else {
             $userGiving = 'r2';
             $extraJoin = array(array('from' => array('reputation_index' => 'r2'), 'where' => "r2.app=r.app AND r2.type=r.type AND r2.type_id=r.type_id AND r2.member_id=" . ipsRegistry::member()->getProperty('member_id')));
         }
         return array('select' => "r.*, rc.*, {$userGiving}.member_id as repUserGiving, e.*, c.*", 'from' => array('reputation_index' => 'r'), 'add_join' => array_merge($extraJoin, array(array('from' => array('reputation_cache' => 'rc'), 'where' => "rc.app=r.app AND rc.type=r.type AND rc.type_id=r.type_id"), array('from' => array('cal_event_comments' => 'c'), 'where' => 'r.type="comment_id" AND r.type_id=c.comment_id', 'type' => 'left'), array('from' => array('cal_events' => 'e'), 'where' => 'e.event_id = IFNULL(c.comment_eid, r.type_id)', 'type' => 'left'))), 'where' => "r.app='calendar' AND " . $extraWhere . " e.event_id<>0 AND " . (empty($allowedCalendarIds) ? '1=0' : ipsRegistry::DB()->buildWherePermission($allowedCalendarIds, 'e.event_calendar_id', FALSE)));
     }
 }
Пример #8
0
 /**
  * Construct
  *
  * @param	string		Application (or aai key)
  * @param	string		Area
  * @return	string
  */
 public static function run($app = null, $area = null)
 {
     if (strlen($app) == 32 and $area === null) {
         $test = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'core_tags', 'where' => 'tag_aai_lookup=\'' . ipsRegistry::DB()->addSlashes($app) . '\'', 'limit' => array(0, 1)));
         if ($test['tag_meta_app'] && $test['tag_meta_area']) {
             $app = $test['tag_meta_app'];
             $area = $test['tag_meta_area'];
         }
     }
     if ($app === null or $area === null) {
         trigger_error("App or area missing from classes_like", E_USER_WARNING);
     }
     /* Pointless comment! */
     $_file = IPSLib::getAppDir($app) . '/extensions/tags/' . $area . '.php';
     $_key = $app && $area ? md5($app . $area) : 'default';
     /* Get from cache if already cached */
     if (isset(self::$apps[$_key])) {
         return self::$apps[$_key];
     }
     /* Get other classes */
     require_once IPS_ROOT_PATH . 'sources/classes/tags/abstract.php';
     /*noLibHook*/
     if ($app && $area) {
         /* Otherwise create object and cache */
         if (is_file($_file)) {
             $classToLoad = IPSLib::loadLibrary($_file, 'tags_' . $app . '_' . $area, $app);
             if (class_exists($classToLoad)) {
                 self::$apps[$_key] = new $classToLoad();
                 self::$apps[$_key]->setApp($app);
                 self::$apps[$_key]->setArea($area);
                 self::$apps[$_key]->init();
             } else {
                 throw new Exception("No tags class available for {$app} - {$area}");
             }
         } else {
             /* Allow an application to worry about the 'area' */
             if (is_file(IPSLib::getAppDir($app) . '/extensions/tags/default.php')) {
                 $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir($app) . '/extensions/tags/default.php', 'tags_' . $app . '_default', $app);
                 if (class_exists($classToLoad)) {
                     self::$apps[$_key] = new $classToLoad();
                     self::$apps[$_key]->setApp($app);
                     self::$apps[$_key]->setArea($area);
                     self::$apps[$_key]->init();
                 } else {
                     throw new Exception("No tags class available for {$app} - {$area}");
                 }
             } else {
                 throw new Exception("No tags class available for {$app} - {$area}");
             }
         }
     } else {
         $classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/tags/extensions/default.php', 'tags_default');
         self::$apps[$_key] = new $classToLoad();
         self::$apps[$_key]->setApp($app);
         self::$apps[$_key]->setArea($area);
         self::$apps[$_key]->init();
     }
     return self::$apps[$_key];
 }
 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
 /**
  * Constructor
  *
  * @return	@e void
  */
 public function __construct(ipsRegistry $registry)
 {
     $this->registry = $registry;
     $this->DB = $registry->DB();
     $this->settings =& $registry->fetchSettings();
     $this->cache = $this->registry->cache();
     $this->caches =& $this->registry->cache()->fetchCaches();
 }
Пример #11
0
 /**
  * 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 = $registry->DB();
     $this->lang = $this->registry->getClass('class_localization');
     $this->class = $class;
     $this->task = $task;
 }
Пример #12
0
 /**
  * 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();
 }
Пример #13
0
 /**
  * Parse/format the online list data for the records
  *
  * @author	Brandon Farber
  * @param	array 			Online list rows to check against
  * @return	array 			Online list rows parsed
  */
 public function parseOnlineEntries($rows)
 {
     if (!is_array($rows) or !count($rows)) {
         return $rows;
     }
     $final = array();
     $profiles = array();
     $members = array();
     //-----------------------------------------
     // Extract the topic/forum data
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'members' or !$row['current_module']) {
             continue;
         }
         if ($row['current_module'] == 'profile') {
             $profiles[] = $row['location_1_id'];
         }
     }
     if (count($profiles)) {
         ipsRegistry::DB()->build(array('select' => 'member_id, members_display_name, members_seo_name, member_banned, members_bitoptions', 'from' => 'members', 'where' => 'member_id IN(' . implode(',', $profiles) . ')'));
         $pr = ipsRegistry::DB()->execute();
         while ($r = ipsRegistry::DB()->fetch($pr)) {
             /* Setup bitwise option to check for banned/spammer members */
             $r = IPSMember::buildBitWiseOptions($r);
             if (!IPSMember::isInactive($r) || ipsRegistry::member()->getProperty('g_is_supmod')) {
                 $members[$r['member_id']] = array('members_display_name' => $r['members_display_name'], 'members_seo_name' => $r['members_seo_name']);
             }
         }
     }
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] == 'members') {
             if ($row['current_module'] == 'online') {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_online'];
             }
             if ($row['current_module'] == 'list') {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_members'];
             }
             if ($row['current_module'] == 'messaging') {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_msg'];
             }
             if ($row['current_module'] == 'profile') {
                 if (isset($members[$row['location_1_id']])) {
                     $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_profile'];
                     $row['where_line_more'] = $members[$row['location_1_id']]['members_display_name'];
                     $row['where_link'] = 'showuser='******'location_1_id'];
                     $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $members[$row['location_1_id']]['members_seo_name'], 'showuser');
                 }
             }
         }
         $final[$row['id']] = $row;
     }
     return $final;
 }
Пример #14
0
 public function change_group($member)
 {
     $vips = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'vips'));
     $isVip = false;
     foreach ($vips as $vip) {
         if ($vip = $member['members_display_name']) {
             $isVip = true;
         }
     }
     if ($isVip) {
         $this->DB->update('members', array('member_group_id' => $this->settings['pxvip_GrupoVip']), 'member_id=' . $member['member_id']);
     }
 }
 /**
  * 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;
 }
 /**
  * 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();
     $profiles = array();
     $names = array();
     //-----------------------------------------
     // Extract the topic/forum data
     //-----------------------------------------
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] != 'members' or !$row['current_module']) {
             continue;
         }
         if ($row['current_module'] == 'profile') {
             $profiles[] = $row['location_1_id'];
         }
     }
     if (count($profiles)) {
         ipsRegistry::DB()->build(array('select' => 'member_id, members_display_name, members_seo_name', 'from' => 'members', 'where' => 'member_id IN(' . implode(',', $profiles) . ')'));
         $pr = ipsRegistry::DB()->execute();
         while ($r = ipsRegistry::DB()->fetch($pr)) {
             $names[$r['member_id']] = array('members_display_name' => $r['members_display_name'], 'members_seo_name' => $r['members_seo_name']);
         }
     }
     foreach ($rows as $row) {
         if ($row['current_appcomponent'] == 'members') {
             if ($row['current_module'] == 'online') {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_online'];
             }
             if ($row['current_module'] == 'list') {
                 $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_members'];
             }
             if ($row['current_module'] == 'profile') {
                 if (isset($names[$row['location_1_id']])) {
                     $row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_profile'];
                     $row['where_line_more'] = $names[$row['location_1_id']]['members_display_name'];
                     $row['where_link'] = 'showuser='******'location_1_id'];
                     $row['_whereLinkSeo'] = ipsRegistry::getClass('output')->buildSEOUrl($row['where_link'], 'public', $names[$row['location_1_id']]['members_seo_name'], 'showuser');
                 }
             }
         }
         $final[$row['id']] = $row;
     }
     return $final;
 }
Пример #17
0
 /**
  * Create admin account
  *
  * @access	public
  * @return	@e void
  */
 public static function createAdminAccount()
 {
     /* Build Entry */
     $_mke_time = ipsRegistry::$settings['login_key_expire'] ? time() + intval(ipsRegistry::$settings['login_key_expire']) * 86400 : 0;
     $salt = IPSMember::generatePasswordSalt(5);
     $passhash = IPSMember::generateCompiledPasshash($salt, md5(IPSSetUp::getSavedData('admin_pass')));
     $_dname = IPSSetUp::getSavedData('admin_user');
     $member = array('name' => $_dname, 'members_l_username' => strtolower($_dname), 'members_display_name' => $_dname, 'members_l_display_name' => strtolower($_dname), 'members_seo_name' => IPSText::makeSeoTitle($_dname), 'member_login_key' => IPSMember::generateAutoLoginKey(), 'member_login_key_expire' => $_mke_time, 'title' => 'Administrator', 'email' => IPSSetUp::getSavedData('admin_email'), 'member_group_id' => 4, 'posts' => 1, 'joined' => time(), 'last_visit' => time(), 'last_activity' => time(), 'ip_address' => my_getenv('REMOTE_ADDR'), 'view_sigs' => 1, 'restrict_post' => 0, 'msg_show_notification' => 1, 'msg_count_total' => 0, 'msg_count_new' => 0, 'coppa_user' => 0, 'language' => IPSLib::getDefaultLanguage(), 'members_auto_dst' => 1, 'member_uploader' => 'flash', 'allow_admin_mails' => 0, 'members_pass_hash' => $passhash, 'members_pass_salt' => $salt, 'has_blog' => '', 'fb_token' => '', 'ignored_users' => '', 'members_cache' => '', 'failed_logins' => '', 'bday_day' => 0, 'bday_month' => 0, 'bday_year' => 0);
     /* Insert: MEMBERS */
     ipsRegistry::DB()->setDataType(array('name', 'members_display_name', 'members_l_username', 'members_l_display_name'), 'string');
     ipsRegistry::DB()->insert('members', $member);
     $member_id = ipsRegistry::DB()->getInsertId();
     $member['member_id'] = $member_id;
     /* Insert into the custom profile fields DB */
     ipsRegistry::DB()->insert('pfields_content', array('member_id' => $member_id));
     /* Insert into pp */
     ipsRegistry::DB()->insert('profile_portal', array('pp_member_id' => $member_id, 'pp_setting_count_friends' => 1, 'signature' => '', 'pconversation_filters' => '', 'pp_setting_count_comments' => 1, 'pp_setting_count_visitors' => 1));
 }
Пример #18
0
 /**
  * Get Content URL
  *
  * @param	array		$warning		Row from members_warn_logs
  * @return	@e array	array( url => URL to the content the warning came from, title => Title )
  */
 public function getContentUrl($warning)
 {
     if (is_numeric($warning['wl_content_id1'])) {
         $post = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'posts', 'where' => "pid={$warning['wl_content_id1']}"));
         if (!empty($post['topic_id'])) {
             $topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid={$post['topic_id']}"));
             if (!empty($topic['tid'])) {
                 return array('url' => ipsRegistry::getClass('output')->buildSEOUrl("showtopic={$topic['tid']}&findpost={$post['pid']}", 'public', $topic['title_seo'], 'showtopic'), 'title' => $topic['title']);
             }
         }
     } elseif ($warning['wl_content_id1'] == 'announcement') {
         $announcement = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'announcements', 'where' => "announce_id=" . intval($warning['wl_content_id2'])));
         if (!empty($announcement['announce_id'])) {
             return array('url' => ipsRegistry::getClass('output')->buildSEOUrl("showannouncement={$announcement['announce_id']}", 'public', IPSText::makeSeoTitle($announcement['announce_title']), 'showannouncement'), 'title' => $announcement['announce_title']);
         }
     }
     return NULL;
 }
 /**
  * Grab the RSS document content and return it
  *
  * @access	public
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $rss_export_id = intval(ipsRegistry::$request['id']);
     $rss_data = array();
     $to_print = '';
     $this->expires = time();
     //-----------------------------------------
     // Get RSS export
     //-----------------------------------------
     $rss_data = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'rss_export', 'where' => 'rss_export_id=' . $rss_export_id));
     //-----------------------------------------
     // Got one?
     //-----------------------------------------
     if ($rss_data['rss_export_id'] and $rss_data['rss_export_enabled']) {
         //-----------------------------------------
         // Correct expires time
         //-----------------------------------------
         $this->expires += $rss_data['rss_export_cache_time'] * 60;
         //-----------------------------------------
         // Need to recache?
         //-----------------------------------------
         $time_check = time() - $rss_data['rss_export_cache_time'] * 60;
         if (!$rss_data['rss_export_cache_content'] or $time_check > $rss_data['rss_export_cache_last']) {
             //-----------------------------------------
             // Yes
             //-----------------------------------------
             define('IN_ACP', 1);
             require_once IPSLib::getAppDir('forums') . '/app_class_forums.php';
             $app_class_forums = new app_class_forums(ipsRegistry::instance());
             require_once IPSLib::getAppDir('forums') . '/modules_admin/rss/export.php';
             $rss_export = new admin_forums_rss_export();
             $rss_export->makeRegistryShortcuts(ipsRegistry::instance());
             return $rss_export->rssExportRebuildCache($rss_data['rss_export_id'], 0);
         } else {
             //-----------------------------------------
             // No
             //-----------------------------------------
             return $rss_data['rss_export_cache_content'];
         }
     }
 }
Пример #20
0
 /**
  * CONSTRUCTOR
  *
  * @access	public
  * @return	void
  **/
 public function __construct()
 {
     if (defined('CONVERT')) {
         return true;
     }
     $this->registry = ipsRegistry::instance();
     /////////////////////////////////////////////////////////////////
     /*print_r(ipsRegistry::$settings);
     
             $this->db =& ipsRegistry::DB();
     		$this->db->obj['sql_tbl_prefix'] = 'dddd';
     		
     		print_r(ipsRegistry::$settings);exit;*/
     ///////////////////////////////////////////////////////////
     require_once dirname(__FILE__) . "/dbconfig.php";
     require_once dirname(__FILE__) . "/dle_config.php";
     if (!defined('COLLATE')) {
         define('COLLATE', 'cp1251');
     }
     if (ipsRegistry::$settings['sql_host'] === DBHOST && ipsRegistry::$settings['sql_user'] === DBUSER && ipsRegistry::$settings['sql_pass'] === DBPASS) {
         if (ipsRegistry::$settings['sql_database'] === DBNAME) {
             $this->connect_method = 'none';
         } else {
             $this->connect_method = 'use';
         }
         $this->db = ipsRegistry::DB();
     } else {
         if (!class_exists('dbMain')) {
             require_once IPS_KERNEL_PATH . 'classDb.php';
             require_once IPS_KERNEL_PATH . 'class_db_' . ucwords(ipsRegistry::$settings['sql_driver']) . ".php";
         }
         $classname = "db_driver_" . ipsRegistry::$settings['sql_driver'];
         $this->db = new $classname();
         $this->db->obj['sql_database'] = DBNAME;
         $this->db->obj['sql_user'] = DBUSER;
         $this->db->obj['sql_pass'] = DBPASS;
         $this->db->obj['sql_host'] = DBHOST;
         $this->db->obj['sql_port'] = '';
         $this->db->obj['sql_tbl_prefix'] = USERPREFIX;
         $this->db->obj['use_shutdown'] = 0;
         $this->db->obj['force_new_connection'] = 1;
     }
 }
 /**
  * Grab the RSS document content and return it
  *
  * @access	public
  * @return	string		RSS document
  */
 public function returnRSSDocument()
 {
     //-----------------------------------------
     // INIT
     //-----------------------------------------
     $cal_id = intval(ipsRegistry::$request['id']);
     $rss_data = array();
     $to_print = '';
     $this->expires = time();
     //-----------------------------------------
     // Get RSS export
     //-----------------------------------------
     $rss_data = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'cal_calendars', 'where' => 'cal_id=' . $cal_id));
     //-----------------------------------------
     // Got one?
     //-----------------------------------------
     if ($rss_data['cal_id'] and $rss_data['cal_rss_export']) {
         //-----------------------------------------
         // Correct expires time
         //-----------------------------------------
         $this->expires = $this->expires + $rss_data['cal_rss_update'] * 60;
         //-----------------------------------------
         // Need to recache?
         //-----------------------------------------
         $time_check = time() - $rss_data['cal_rss_update'] * 60;
         if (!$rss_data['cal_rss_cache'] or $time_check > $rss_data['cal_rss_update_last']) {
             //-----------------------------------------
             // Yes
             //-----------------------------------------
             define('IN_ACP', 1);
             require_once IPSLib::getAppDir('calendar') . '/modules_admin/calendar/calendars.php';
             $rss_export = new admin_calendar_calendar_calendars();
             $rss_export->makeRegistryShortcuts(ipsRegistry::instance());
             return $rss_export->calendarRSSCache($rss_data['cal_id'], 0);
         } else {
             //-----------------------------------------
             // No
             //-----------------------------------------
             return $rss_data['cal_rss_cache'];
         }
     }
 }
Пример #22
0
 /**
  * Get Content URL
  *
  * @param	array		$warning		Row from members_warn_logs
  * @return	@e array	array( url => URL to the content the warning came from, title => Title )
  */
 public function getContentUrl($warning)
 {
     ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_profile'), 'members');
     if ($warning['wl_content_id1'] == 'mreport') {
         $report = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'rc_reports_index', 'where' => "id=" . intval($warning['wl_content_id2'])));
         if (!empty($report['id'])) {
             return array('url' => ipsRegistry::getClass('output')->buildUrl("app=core&module=reports&do=show_report&rid={$report['id']}"), 'title' => $report['title']);
         }
     } elseif ($warning['wl_content_id1'] == 'core-reports') {
         $exploded = explode('-', $warning['wl_content_id2']);
         require_once IPS_ROOT_PATH . 'sources/classes/comments/bootstrap.php';
         /*noLibHook*/
         $comments = classes_comments_bootstrap::controller($warning['wl_content_id1']);
         $parent = $comments->fetchParent($exploded[0]);
         if (!is_null($parent)) {
             $parent = $comments->remapFromLocal($parent, 'parent');
             return array('url' => ipsRegistry::getClass('output')->buildUrl("app=core&module=global&section=comments&fromApp={$warning['wl_content_id1']}&do=findComment&parentId={$exploded[0]}&comment_id={$exploded[1]}"), 'title' => $parent['parent_title']);
         }
     }
     return NULL;
 }
 /**
  * Setup registry objects
  *
  * @access	public
  * @param	object	ipsRegistry $registry
  * @return	void
  */
 public function __construct(ipsRegistry $registry)
 {
     $this->DB = $registry->DB();
     $this->member = $registry->member();
     $this->memberData =& $registry->member()->fetchMemberData();
     $this->settings = $registry->settings();
     $this->request = $registry->request();
     /* Do we have the sphinxes? */
     if (!file_exists('sphinxapi.php')) {
         $registry->output->showError('sphinx_api_missing', 10182);
     }
     /* Load Sphinx */
     require 'sphinxapi.php';
     $this->sphinxClient = new SphinxClient();
     $this->sphinxClient->SetServer($this->settings['search_sphinx_server'], intval($this->settings['search_sphinx_port']));
     $this->sphinxClient->SetMatchMode(SPH_MATCH_EXTENDED);
     $this->sphinxClient->SetLimits(0, 1000);
     /* We're going to need the regular app index plugin also */
     require_once IPSLib::getAppDir(ipsRegistry::$request['search_app']) . '/extensions/searchPlugin.php';
     $searchApp = 'search' . ucfirst($this->request['search_app']) . 'Plugin';
     $this->appSearchPlugin = new $searchApp($registry);
 }
Пример #24
0
 /**
  * Get Query Data
  *
  * @param	array	Rules
  * @return	array	Query Data
  */
 public function getQueryData($rules)
 {
     $return = array();
     /* Member Group */
     if (!empty($rules['group'])) {
         $return['where'][] = ipsRegistry::DB()->buildWherePermission($rules['group'], 'members.member_group_id', FALSE);
     }
     /* Last Visit */
     if ($rules['last_visit_2'] !== '') {
         switch ($rules['last_visit_1']) {
             case 'l':
                 $return['where'][] = "( members.last_visit<{$rules['last_visit_2']} )";
                 break;
             case 'g':
                 $return['where'][] = "( members.last_visit>{$rules['last_visit_2']} )";
                 break;
             case 'w':
                 $return['where'][] = "( members.last_visit={$rules['last_visit_2']} )";
                 break;
         }
     }
     /* Join Date */
     if ($rules['joined_2'] !== '') {
         switch ($rules['joined_1']) {
             case 'l':
                 $return['where'][] = "( members.joined<{$rules['joined_2']} )";
                 break;
             case 'g':
                 $return['where'][] = "( members.joined>{$rules['joined_2']} )";
                 break;
             case 'w':
                 $return['where'][] = "( members.joined={$rules['joined_2']} )";
                 break;
         }
     }
     return $return;
 }
Пример #25
0
 /**
  * Retuns the html for displaying the forum category filter on the advanced search page
  *
  * @return	string	Filter HTML
  */
 public function getHtml()
 {
     /* Make sure class_forums is setup */
     if (ipsRegistry::isClassLoaded('class_forums') !== TRUE) {
         $classToLoad = IPSLib::loadLibrary(IPSLib::getAppDir('forums') . "/sources/classes/forums/class_forums.php", 'class_forums', 'forums');
         ipsRegistry::setClass('class_forums', new $classToLoad(ipsRegistry::instance()));
     }
     ipsRegistry::getClass('class_forums')->strip_invisible = 1;
     ipsRegistry::getClass('class_forums')->forumsInit();
     /* Got any archived content? */
     $canSearchArchives = false;
     if ($this->settings['archive_on']) {
         $canSearchArchives = true;
         if (($this->settings['search_method'] == 'traditional' || $this->settings['search_method'] == 'sql') && $this->settings['archive_remote_sql_database']) {
             $canSearchArchives = false;
         }
     }
     $topic = NULL;
     if ($this->request['cType'] == 'topic') {
         $this->request['cId'] = intval($this->request['cId']);
         $topic = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid={$this->request['cId']}"));
     }
     return array('title' => IPSLib::getAppTitle('forums'), 'html' => ipsRegistry::getClass('output')->getTemplate('search')->forumAdvancedSearchFilters(ipsRegistry::getClass('class_forums')->buildForumJump(0, 1, 0, (isset($this->request['cId']) and $this->request['cType'] == 'forum') ? array($this->request['cId']) : array()), $canSearchArchives, $topic));
 }
<?php

/*
+--------------------------------------------------------------------------
|   IP.Board v3.4.5
|   ========================================
|   by Matthew Mecham
|   (c) 2001 - 2009 Invision Power Services
|   http://www.invisionpower.com
|   ========================================
|   Web: http://www.invisionboard.com
|   Email: matt@invisionpower.com
|   Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
*/
$PRE = trim(ipsRegistry::dbFunctions()->getPrefix());
$DB = ipsRegistry::DB();
$TABLE = 'dnames_change';
$SQL[] = "ALTER TABLE dnames_change CHANGE dname_ip_address dname_ip_address VARCHAR( 46 ) NOT NULL;";
Пример #27
0
 /**
  * Diagnose table structure
  *
  * @param	array 	$sql_statements		Array of create table/columns statements to check
  * @param	string 	$issues_to_fix		String of the issue to fix, can be set to 'all' to fix everything
  * @return	@e array
  *
  * <b>Example Usage:</b>
  * @code
  * // Retrieve results
  * $results = $this->dbTableDiag( $sql_statements );
  * // Retrieve results and fix a table/column
  * $results = $this->dbTableDiag( $sql_statements, $issues_to_fix );
  * // Retrieve results and fix all tables/columns
  * $results = $this->dbTableDiag( $sql_statements, 'all' );
  * @endcode
  */
 public function dbTableDiag($sql_statements, $issues_to_fix = '')
 {
     //-----------------------------------------
     // Init
     //-----------------------------------------
     $queries_needed = array();
     $tables_needed = array();
     $table_definitions = array();
     $error_count = 0;
     $_tablesFull = array();
     $_tablesAlter = array();
     //-----------------------------------------
     // Do we have any statements?
     //-----------------------------------------
     if (is_array($sql_statements) && count($sql_statements)) {
         //-----------------------------------------
         // Loop over those statements
         //-----------------------------------------
         foreach ($sql_statements as $the_table) {
             $expected_columns = array();
             $missing_columns = array();
             /* Remove backticks */
             $the_table = $this->_sqlStripTicks($the_table);
             $the_table = preg_replace("#CREATE\\s+TABLE\\s+IF\\s+NOT\\s+EXISTS\\s+#i", "CREATE TABLE ", $the_table);
             //-----------------------------------------
             // Is this a create table statement?
             //-----------------------------------------
             if (preg_match("#CREATE\\s+TABLE\\s+?(.+?)\\s+?\\(#ie", $the_table, $definition)) {
                 $tableName = ipsRegistry::$settings['sql_tbl_prefix'] . $definition[1];
                 //-----------------------------------------
                 // Store the entire table definition
                 //-----------------------------------------
                 $table_definitions[$tableName] = str_replace($definition[1], $tableName, $the_table);
                 $_tablesFull[] = $tableName;
                 //-----------------------------------------
                 // Get the columns
                 //-----------------------------------------
                 $columns_array = explode("\n", $the_table);
                 //-----------------------------------------
                 // Get rid of first row ("CREATE TABLE ...")
                 //-----------------------------------------
                 array_shift($columns_array);
                 //-----------------------------------------
                 // Get rid of the junk at the end of each line
                 //-----------------------------------------
                 if (strpos(end($columns_array), ");") === 0 or strpos(end($columns_array), ")") === 0 or strpos(end($columns_array), ";") === 0) {
                     array_pop($columns_array);
                 }
                 reset($columns_array);
                 //-----------------------------------------
                 // Loop over each supposed "column"
                 //-----------------------------------------
                 foreach ($columns_array as $col) {
                     //-----------------------------------------
                     // Find the column name
                     //-----------------------------------------
                     $temp = preg_split("/[\\s]+/", trim($col));
                     $columnName = $temp[0];
                     //-----------------------------------------
                     // Ignore custom profile fields
                     // @link	http://community.invisionpower.com/tracker/issue-27495-database-checker-find-removed-custom-profile-fields
                     //-----------------------------------------
                     if ($tableName == 'pfields_content' and strpos($columnName, 'field_') === 0) {
                         continue;
                     }
                     //-----------------------------------------
                     // If this is a real column, map it
                     //-----------------------------------------
                     if (!in_array($columnName, array("PRIMARY", "KEY", "INDEX", "UNIQUE", "", "(", ";", ");"))) {
                         $expected_columns[] = $columnName;
                         $this->_mapping[$tableName][$columnName] = trim(str_replace(',', ';', $col));
                     }
                 }
             } elseif (preg_match("#ALTER\\s+TABLE\\s+([a-z_]*)\\s+ADD\\s+([a-z_]*)\\s+#is", $the_table, $definition)) {
                 //-----------------------------------------
                 // If this is truly adding a new column, map it
                 //-----------------------------------------
                 if ($definition[1] and $definition[2] and $definition[2] != 'INDEX' and strpos($definition[2], 'TYPE') === false and strpos($definition[2], 'ENGINE') === false) {
                     $tableName = ipsRegistry::$settings['sql_tbl_prefix'] . trim($definition[1]);
                     $columnName = trim($definition[2]);
                     $_tablesAlter[] = $tableName;
                     $expected_columns[] = $columnName;
                     $this->_mapping[$tableName][$columnName] = $definition[2] . ' ' . str_replace($definition[0], '', $the_table) . ";";
                 }
             } else {
                 continue;
             }
             //-----------------------------------------
             // Don't die on me sarge!
             //-----------------------------------------
             ipsRegistry::DB()->return_die = 1;
             $tableNoPrefix = preg_replace('#^' . ipsRegistry::$settings['sql_tbl_prefix'] . '(.+?)#', "\\1", $tableName);
             //-----------------------------------------
             // If table is missing entirely, we need to build it
             //-----------------------------------------
             if (!ipsRegistry::DB()->checkForTable($tableNoPrefix)) {
                 //-----------------------------------------
                 // Are we fixing now?
                 //-----------------------------------------
                 if (preg_replace('#^' . ipsRegistry::$settings['sql_tbl_prefix'] . '(.+?)#', "\\1", $issues_to_fix) == $tableNoPrefix or $issues_to_fix == 'all') {
                     if (ipsRegistry::$settings['sql_tbl_prefix']) {
                         $the_table = preg_replace("#^CREATE TABLE(?:\\s+?)?(\\S+)#is", "CREATE TABLE " . ipsRegistry::$settings['sql_tbl_prefix'] . "\\1 ", $the_table);
                     }
                     $r = ipsRegistry::DB()->query($the_table);
                     $output['ran'][] = array('q' => $the_table, 'status' => $r);
                     continue;
                 }
                 $output[$tableName] = array('key' => $tableNoPrefix, 'table' => $tableName, 'status' => 'error_table', 'fixsql' => array($table_definitions[$tableName]));
                 //-----------------------------------------
                 // Increment error counter
                 //-----------------------------------------
                 $error_count++;
                 //-----------------------------------------
                 // Reset failed status
                 //-----------------------------------------
                 ipsRegistry::DB()->failed = 0;
             } else {
                 //-----------------------------------------
                 // Loop over all the columns
                 //-----------------------------------------
                 foreach ($expected_columns as $trymeout) {
                     //-----------------------------------------
                     // Does column exist?
                     //-----------------------------------------
                     if (!ipsRegistry::DB()->checkForField($trymeout, $tableNoPrefix)) {
                         //-----------------------------------------
                         // Missing - create "ALTER TABLE" query
                         //-----------------------------------------
                         $query_needed = "ALTER TABLE " . $tableName . " ADD " . $this->_mapping[$tableName][$trymeout];
                         //-----------------------------------------
                         // If this is an autoincrement column, we need
                         // to add the primary key, since it won't exist
                         //-----------------------------------------
                         if (strpos($query_needed, "auto_increment;") !== false) {
                             //-----------------------------------------
                             // Cut off the ";", add primary key bit
                             //-----------------------------------------
                             $query_needed = substr($query_needed, 0, -1) . ", ADD PRIMARY KEY( " . $trymeout . ");";
                         }
                         //-----------------------------------------
                         // Are we fixing now?
                         //-----------------------------------------
                         if (preg_replace('#^' . ipsRegistry::$settings['sql_tbl_prefix'] . '(.+?)#', "\\1", $issues_to_fix) == $tableNoPrefix or $issues_to_fix == 'all') {
                             $r = ipsRegistry::DB()->query($query_needed);
                             $output['ran'][] = array('q' => $query_needed, 'status' => $r);
                             continue;
                         }
                         $missing_columns[] = $trymeout;
                         //-----------------------------------------
                         // We only do this once
                         //-----------------------------------------
                         if (!isset($output[$tableName]) or !count($output[$tableName])) {
                             $output[$tableName] = array('key' => $tableNoPrefix, 'table' => $tableName, 'status' => 'error_column');
                         }
                         //-----------------------------------------
                         // But with each error, add the query
                         //-----------------------------------------
                         $output[$tableName]['fixsql'][] = $query_needed;
                         //-----------------------------------------
                         // Increment error count
                         //-----------------------------------------
                         $error_count++;
                     }
                 }
                 //-----------------------------------------
                 // If nothing was wrong, show ok message
                 //-----------------------------------------
                 if (!count($missing_columns)) {
                     $output[] = array('key' => $tableNoPrefix, 'table' => $tableName, 'column' => in_array($tableName, $_tablesFull) ? '' : $trymeout, 'status' => 'ok', 'fixsql' => '');
                 }
             }
         }
     }
     return array('error_count' => $error_count, 'results' => $output);
 }
Пример #28
0
 /**
  * Shows the editor
  * print $editor->show( 'message', 'reply-topic-1244' );
  * @param	string	Field
  * @param	array   Options: Auto save key, a unique key for the page. If supplied, editor will auto-save at regular intervals. Works for logged in members only
  * @param	string	Optional content
  */
 public function show($fieldName, $options = array(), $content = '')
 {
     $showEditor = TRUE;
     /* Have we forced RTE? */
     if (!empty($this->request['isRte'])) {
         $options['isRte'] = intval($this->request['isRte']);
     }
     $_autoSaveKeyOrig = !empty($options['autoSaveKey']) ? $options['autoSaveKey'] : '';
     $options['editorName'] = !empty($options['editorName']) ? $options['editorName'] : $this->_fetchEditorName();
     $options['autoSaveKey'] = $_autoSaveKeyOrig && $this->memberData['member_id'] ? $this->_generateAutoSaveKey($_autoSaveKeyOrig) : '';
     $options['type'] = !empty($options['type']) && $options['type'] == 'mini' ? 'mini' : 'full';
     $options['minimize'] = intval($options['minimize']);
     $options['height'] = intval($options['height']);
     $options['isTypingCallBack'] = !empty($options['isTypingCallBack']) ? $options['isTypingCallBack'] : '';
     $options['noSmilies'] = !empty($options['noSmilies']) ? true : false;
     $options['delayInit'] = !empty($options['delayInit']) ? 1 : 0;
     $options['smilies'] = $this->fetchEmoticons();
     $options['bypassCKEditor'] = !empty($options['bypassCKEditor']) ? 1 : ($this->getRteEnabled() ? 0 : 1);
     $options['legacyMode'] = !empty($options['legacyMode']) ? $options['legacyMode'] : 'on';
     $html = '';
     /* Fetch disabled tags */
     $parser = $this->_newParserObject();
     $options['disabledTags'] = $parser->getDisabledTags();
     $this->setLegacyMode($options['legacyMode'] == 'on' ? true : false);
     if (isset($options['recover'])) {
         $content = $_POST['Post'];
     }
     /* Try and sniff out entered HTML */
     if (IN_ACP and empty($options['isHtml'])) {
         $options['isHtml'] = intval($this->_tryAndDetermineHtmlStatusTheHackyWay($content ? $content : $this->getContent()));
     }
     if (!empty($options['isHtml'])) {
         $this->setIsHtml(true);
         if (IN_ACP) {
             $options['type'] = 'ipsacp';
         }
     } else {
         if ($this->getIsHtml()) {
             $options['isHtml'] = 1;
         }
     }
     /* inline content */
     if ($content) {
         $this->setContent($this->getLegacyMode() ? str_replace('\\\'', '\'', $content) : $content);
     }
     /* Is this legacy bbcode?  If we are using RTE, we need to send HTML.
     			@link http://community.invisionpower.com/resources/bugs.html/_/ip-board/old-style-image-links-do-not-parse-in-editor-r42078 */
     if ($parser->isBBCode($this->getContent())) {
         $this->setContent($parser->htmlToEditor($this->getContent()));
     }
     /* Store last editor ID in case calling scripts need it */
     $this->settings['_lastEditorId'] = $options['editorName'];
     if (IN_ACP) {
         $html = $this->registry->getClass('output')->global_template->editor($fieldName, $this->getContent(), $options, $this->getAutoSavedContent($_autoSaveKeyOrig));
     } else {
         $warningInfo = '';
         $acknowledge = FALSE;
         //-----------------------------------------
         // Warnings
         //-----------------------------------------
         if (isset($options['warnInfo']) and $this->memberData['member_id']) {
             $message = '';
             /* Have they been restricted from posting? */
             if ($this->memberData['restrict_post']) {
                 $data = IPSMember::processBanEntry($this->memberData['restrict_post']);
                 if ($data['date_end']) {
                     if (time() >= $data['date_end']) {
                         IPSMember::save($this->memberData['member_id'], array('core' => array('restrict_post' => 0)));
                     } else {
                         $message = sprintf($this->lang->words['warnings_restrict_post_temp'], $this->lang->getDate($data['date_end'], 'JOINED'));
                     }
                 } else {
                     $message = $this->lang->words['warnings_restrict_post_perm'];
                 }
                 if ($this->memberData['unacknowledged_warnings']) {
                     $warn = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->memberData['member_id']} AND wl_rpa<>0", 'order' => 'wl_date DESC', 'limit' => 1));
                     if ($warn['wl_id']) {
                         $moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} )'>{$this->lang->words['warnings_moreinfo']}</a>";
                     }
                 }
                 if ($options['warnInfo'] == 'full') {
                     $this->registry->getClass('output')->showError("{$message} {$moredetails}", 103126, null, null, 403);
                 } else {
                     $showEditor = FALSE;
                 }
             }
             /* Nope? - Requires a new if in case time restriction got just removed */
             if (empty($message)) {
                 /* Do they have any warnings they have to acknowledge? */
                 if ($this->memberData['unacknowledged_warnings']) {
                     $unAcknowledgedWarns = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->memberData['member_id']} AND wl_acknowledged=0", 'order' => 'wl_date DESC', 'limit' => 1));
                     if ($unAcknowledgedWarns['wl_id']) {
                         if ($options['warnInfo'] == 'full') {
                             $this->registry->getClass('output')->silentRedirect($this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=warnings&amp;do=acknowledge&amp;id={$unAcknowledgedWarns['wl_id']}"));
                         } else {
                             $this->lang->loadLanguageFile('public_profile', 'members');
                             $acknowledge = $unAcknowledgedWarns['wl_id'];
                         }
                     }
                 }
                 /* No? Are they on mod queue? */
                 if ($this->memberData['mod_posts']) {
                     $data = IPSMember::processBanEntry($this->memberData['mod_posts']);
                     if ($data['date_end']) {
                         if (time() >= $data['date_end']) {
                             IPSMember::save($this->memberData['member_id'], array('core' => array('mod_posts' => 0)));
                         } else {
                             $message = sprintf($this->lang->words['warnings_modqueue_temp'], $this->lang->getDate($data['date_end'], 'JOINED'));
                         }
                     } else {
                         $message = $this->lang->words['warnings_modqueue_perm'];
                     }
                     if ($message) {
                         $warn = ipsRegistry::DB()->buildAndFetch(array('select' => '*', 'from' => 'members_warn_logs', 'where' => "wl_member={$this->memberData['member_id']} AND wl_mq<>0", 'order' => 'wl_date DESC', 'limit' => 1));
                         if ($warn['wl_id']) {
                             if ($this->registry->output->getAsMobileSkin()) {
                                 $moredetails = "<a href='{$this->registry->getClass('output')->buildUrl("app=members&amp;module=profile&amp;section=warnings")}'>{$this->lang->words['warnings_moreinfo']}</a>";
                             } else {
                                 $moredetails = "<a href='javascript:void(0);' onclick='warningPopup( this, {$warn['wl_id']} )'>{$this->lang->words['warnings_moreinfo']}</a>";
                             }
                         }
                     }
                 }
                 /* How about our group? - Requires a new if in case mod queue restriction got just removed */
                 if (empty($message) && $this->memberData['g_mod_preview']) {
                     /* Do we only limit for x posts/days? */
                     if ($this->memberData['g_mod_post_unit']) {
                         if ($this->memberData['gbw_mod_post_unit_type']) {
                             /* Days.. .*/
                             if ($this->memberData['joined'] > time() - 86400 * $this->memberData['g_mod_post_unit']) {
                                 $message = sprintf($this->lang->words['ms_mod_q'] . ' ' . $this->lang->words['ms_mod_q_until'], $this->lang->getDate($this->memberData['joined'] + 86400 * $this->memberData['g_mod_post_unit'], 'long'));
                             }
                         } else {
                             /* Posts */
                             if ($this->memberData['posts'] < $this->memberData['g_mod_post_unit']) {
                                 $message = sprintf($this->lang->words['ms_mod_q'] . ' ' . $this->lang->words['ms_mod_q_until_posts'], $this->memberData['g_mod_post_unit'] - $this->memberData['posts']);
                             }
                         }
                     } else {
                         /* No limit, but still checking moderating */
                         $message = $this->lang->words['ms_mod_q'];
                     }
                 } elseif ($options['modAll'] and !$this->memberData['g_avoid_q']) {
                     $message = $this->lang->words['ms_mod_q'];
                 }
             }
             if ($message) {
                 $warningInfo = "{$message} {$moredetails}";
             }
         }
         //-----------------------------------------
         // Show the editor
         //-----------------------------------------
         $parser = new class_text_parser_legacy();
         $this->passSettings($parser);
         /* Mobile skin / app? */
         if ($this->_canWeRte(true) !== true || $this->registry->output->getAsMobileSkin()) {
             $content = $this->toPlainTextArea($this->getContent());
         } else {
             /* CKEditor decodes HTML entities */
             $content = str_replace('&', '&amp;', $this->getContent());
             /* Take a stab at fixing up manually entered CODE tag */
             //$content = $this->_fixManuallyEnteredCodeBoxesIntoRte( $content );
             /* Convert to BBCode for non JS peoples */
             $content = $parser->htmlToEditor($content);
         }
         $bbcodeVersion = '';
         if ($content) {
             $bbcodeVersion = $this->toPlainTextArea($parser->postEditor($content));
         }
         $html = $this->registry->getClass('output')->getTemplate('editors')->editor($fieldName, $content, $options, $this->getAutoSavedContent($_autoSaveKeyOrig), $warningInfo, $acknowledge, $bbcodeVersion, $showEditor);
     }
     return $html;
 }
 function step_17()
 {
     if (!ipsRegistry::DB()->checkForTable('pfields_content')) {
         $SQL[] = "CREATE TABLE " . ipsRegistry::dbFunctions()->getPrefix() . "pfields_content ( member_id mediumint(8) NOT NULL default 0,   PRIMARY KEY  (member_id) );";
     }
     if (!ipsRegistry::DB()->checkForTable('pfields_data')) {
         $SQL[] = "CREATE TABLE " . ipsRegistry::dbFunctions()->getPrefix() . "pfields_data (\r\n\t\t\t\t\t\t  pf_id smallint(5) NOT NULL auto_increment,\r\n\t\t\t\t\t\t  pf_title varchar(250) NOT NULL default '',\r\n\t\t\t\t\t\t  pf_desc varchar(250) NOT NULL default '',\r\n\t\t\t\t\t\t  pf_content text,\r\n\t\t\t\t\t\t  pf_type varchar(250) NOT NULL default '',\r\n\t\t\t\t\t\t  pf_not_null tinyint(1) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_member_hide tinyint(1) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_max_input smallint(6) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_member_edit tinyint(1) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_position smallint(6) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_show_on_reg tinyint(1) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_input_format text,\r\n\t\t\t\t\t\t  pf_admin_only tinyint(1) NOT NULL default 0,\r\n\t\t\t\t\t\t  pf_topic_format text,\r\n\t\t\t\t\t\t  pf_group_id mediumint(4) unsigned NOT NULL,\r\n\t\t\t\t\t\t  pf_icon varchar(255) default NULL,\r\n\t\t\t\t\t\t  pf_key varchar(255) default NULL,\r\n\t\t\t\t\t\t  pf_search_type varchar(5) NOT NULL default 'loose',\r\n\t\t\t\t\t\t  pf_filtering TINYINT( 1 ) NOT NULL DEFAULT '0',\r\n\t\t\t\t\t\t  PRIMARY KEY  (pf_id)\r\n\t\t\t\t\t\t);";
     }
     if (!ipsRegistry::DB()->checkForTable('warn_logs')) {
         $SQL[] = "CREATE TABLE " . ipsRegistry::dbFunctions()->getPrefix() . "warn_logs (\r\n\t\t\t  wlog_id int(10) NOT NULL auto_increment,\r\n\t\t\t  wlog_mid mediumint(8) NOT NULL default 0,\r\n\t\t\t  wlog_notes text,\r\n\t\t\t  wlog_contact varchar(250) NOT NULL default 'none',\r\n\t\t\t  wlog_contact_content text,\r\n\t\t\t  wlog_date int(10) NOT NULL default 0,\r\n\t\t\t  wlog_type varchar(6) NOT NULL default 'pos',\r\n\t\t\t  wlog_addedby mediumint(8) NOT NULL default 0,\r\n\t\t\t  PRIMARY KEY  (wlog_id),\r\n\t\t\t  KEY wlog_mid (wlog_mid, wlog_date)\r\n\t\t\t);";
     }
     $SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "groups add g_attach_per_post int(10) NOT NULL default '0';";
     $SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "topic_mmod add topic_approve tinyint(1) NOT NULL default '0';";
     $SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "groups add g_can_msg_attach tinyint(1) NOT NULL default '0';";
     $SQL[] = "alter table " . ipsRegistry::dbFunctions()->getPrefix() . "pfields_data\r\n\t\t\t\tchange fid pf_id smallint(5) NOT NULL auto_increment,\r\n\t\t\t\tchange ftitle pf_title varchar(250) NOT NULL default '',\r\n\t\t\t\tchange fdesc pf_desc varchar(250) NOT NULL default '',\r\n\t\t\t\tchange fcontent pf_content text NULL,\r\n\t\t\t\tchange ftype pf_type varchar(250) NOT NULL default '',\r\n\t\t\t\tchange freq pf_not_null tinyint(1) NOT NULL default '0',\r\n\t\t\t\tchange fhide pf_member_hide tinyint(1) NOT NULL default '0',\r\n\t\t\t\tchange fmaxinput pf_max_input smallint(6) NOT NULL default '0',\r\n\t\t\t\tchange fedit pf_member_edit tinyint(1) NOT NULL default '0',\r\n\t\t\t\tchange forder pf_position smallint(6) NOT NULL default '0',\r\n\t\t\t\tchange fshowreg pf_show_on_reg tinyint(1) NOT NULL default '0',\r\n\t\t\t\tadd pf_input_format text NULL,\r\n\t\t\t\tadd pf_admin_only tinyint(1) NOT NULL default '0',\r\n\t\t\t\tadd pf_topic_format text NULL;";
     $this->error = array();
     $this->sqlcount = 0;
     $this->DB->return_die = 1;
     foreach ($SQL as $query) {
         $this->DB->allow_sub_select = 1;
         $this->DB->error = '';
         $this->DB->query($query);
         if ($this->DB->error) {
             $this->registry->output->addError($query . "<br /><br />" . $this->DB->error);
         } else {
             $this->sqlcount++;
         }
     }
     $this->registry->output->addMessage("Other tables altered, inserting data next...<br /><br />{$this->sqlcount} queries ran....");
     $this->request['workact'] = 'step_18';
 }
Пример #30
0
 /**
  * Account is validated
  *
  * @param	int		ID number
  * @param	string	md5( IPS Connect Key (see login method) . ID number )
  */
 public function validate($id, $key)
 {
     if ($key != md5($this->masterKey . $id)) {
         $this->_return(base64_encode($this->settings['board_url']), array('status' => 'BAD_KEY'));
     }
     $member = IPSMember::load(intval($id), 'none', 'id');
     if (!$member['member_id']) {
         $this->_return($redirect, array('status' => 'NO_USER'));
     }
     if ($member['member_group_id'] == ipsRegistry::$settings['auth_group']) {
         IPSMember::save($member['member_id'], array('members' => array('member_group_id' => ipsRegistry::$settings['member_group'], 'ipsconnect_revalidate_url' => '')));
     }
     ipsRegistry::DB()->delete('validating', "member_id={$member['member_id']} and new_reg=1");
     $this->_return($redirect, array('status' => 'SUCCESS'));
 }