本文整理匯總了PHP中IPSText::makeSeoTitle方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::makeSeoTitle方法的具體用法?PHP IPSText::makeSeoTitle怎麽用?PHP IPSText::makeSeoTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::makeSeoTitle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createAdminAccount
/**
* 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));
}
示例2: getContentUrl
/**
* 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;
}
示例3: addProfile
/**
* Sort out profile fields
*
* @return @e void
*/
public function addProfile()
{
/* INIT */
$fields = array();
$prefix = $this->registry->dbFunctions()->getPrefix();
$sourceFile = '';
/* Get DB driver file */
require_once IPSLib::getAppDir('core') . '/setup/versions/upg_30001/' . strtolower($this->registry->dbFunctions()->getDriverType()) . '_version_upgrade.php';
/*noLibHook*/
/* First off, move all current profile fields to group ID 3 */
$this->DB->update('pfields_data', array('pf_group_id' => 3), 'pf_group_id=0');
/* Grab all custom fields */
$this->DB->build(array('select' => '*', 'from' => 'pfields_data'));
$this->DB->execute();
while ($row = $this->DB->fetch()) {
$fields[$row['pf_id']] = $row;
}
foreach ($fields as $id => $data) {
/* Now add any missing content fields */
if (!$this->DB->checkForField("field_{$id}", 'pfields_content')) {
$this->DB->addField('pfields_content', "field_{$id}", 'text');
}
}
$this->DB->optimize('pfields_content');
/* Now make add a key */
$this->DB->build(array('select' => '*', 'from' => 'pfields_data', 'where' => 'pf_group_id=3'));
$o = $this->DB->execute();
while ($row = $this->DB->fetch($o)) {
/* Attempt basic conversion of data */
if ($row['pf_topic_format']) {
if ($row['pf_topic_format'] == '{title}: {content}<br />') {
$row['pf_topic_format'] = '<span class="ft">{title}:</span><span class="fc">{content}</span>';
} else {
if ($row['pf_topic_format'] == '{title}: {key}<br />') {
$row['pf_topic_format'] = '<span class="ft">{title}:</span><span class="fc">{key}</span>';
}
}
}
/* 2.3.x used 'text', 3.0.0 uses 'input'... */
$row['pf_type'] = $row['pf_type'] == 'text' ? 'input' : $row['pf_type'];
$this->DB->update('pfields_data', array('pf_type' => $row['pf_type'], 'pf_topic_format' => $row['pf_topic_format'], 'pf_key' => IPSText::makeSeoTitle($row['pf_title'])), 'pf_id=' . $row['pf_id']);
}
/* Now, move profile data into the correct fields */
foreach (array('aim_name' => 'aim', 'icq_number' => 'icq', 'website' => 'website', 'yahoo' => 'yahoo', 'interests' => 'interests', 'msnname' => 'msn', 'location' => 'location') as $old => $new) {
$field = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'pfields_data', 'where' => 'pf_key=\'' . $new . '\''));
$query = SQLVC::UpdateOne($old, $field);
if (is_null($query)) {
continue;
}
if (IPSSetUp::getSavedData('man')) {
$query = trim($query);
/* Ensure the last character is a semi-colon */
if (substr($query, -1) != ';') {
$query .= ';';
}
$output .= $query . "\n\n";
} else {
$this->DB->query($query);
if ($this->DB->error) {
$this->registry->output->addError($query . "<br /><br />" . $this->DB->error);
} else {
$this->registry->output->addMessage("Конвертирование поля: {$old}....");
}
}
}
/* Update gender */
$gender = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'pfields_data', 'where' => 'pf_key=\'gender\''));
if ($gender['pf_id']) {
$queries = array(SQLVC::UpdateTwo($gender), SQLVC::UpdateThree($gender));
foreach ($queries as $query) {
if (IPSSetUp::getSavedData('man')) {
$query = trim($query);
/* Ensure the last character is a semi-colon */
if (substr($query, -1) != ';') {
$query .= ';';
}
$output .= $query . "\n\n";
} else {
$this->DB->query($query);
if ($this->DB->error) {
$this->registry->output->addError($query . "<br /><br />" . $this->DB->error);
} else {
$this->registry->output->addMessage("Конвертирование поля «Пол»....");
}
}
}
}
if (IPSSetUp::getSavedData('man') and $output) {
/* Create source file */
if ($this->registry->dbFunctions()->getDriverType() == 'mysql') {
$sourceFile = IPSSetUp::createSqlSourceFile($output, '30001', 'pf');
}
$this->_output = $this->registry->output->template()->upgrade_manual_queries($output, $sourceFile);
}
/* Next Page */
//.........這裏部分代碼省略.........
示例4: calendarGetEventsSQL
/**
* Generates the sql to query events
*
* @param integer $month Month to get events from
* @param integer $year Year to get events from
* @param array [$presets] Load based on specific timestamps
* @return @e void
*/
public function calendarGetEventsSQL($month = 0, $year = 0, $presets = array())
{
//-----------------------------------------
// Init
//-----------------------------------------
$minimal = (isset($presets['minimal']) and $presets['minimal']) ? true : false;
if (isset($presets['timenow'])) {
$prev_month = $this->calendarGetPreviousMonth(gmstrftime("%m", $presets['timenow']), gmstrftime("%Y", $presets['timenow']));
} else {
$prev_month = $this->calendarGetPreviousMonth($month, $year);
}
if (isset($presets['timethen'])) {
$next_month = $this->calendarGetNextMonth(gmstrftime("%m", $presets['timethen']), gmstrftime("%Y", $presets['timethen']));
} else {
$next_month = $this->calendarGetNextMonth($month, $year);
}
$start_date = gmstrftime("%Y-%m-%d", isset($presets['timenow']) ? $presets['timenow'] : gmmktime(0, 0, 1, $prev_month['month_id'], 1, $prev_month['year_id']));
$end_date = gmstrftime("%Y-%m-%d", isset($presets['timethen']) ? $presets['timethen'] : gmmktime(0, 0, 1, $next_month['month_id'], date('t', mktime(0, 0, 0, $next_month['month_id'], 1, $next_month['year_id'])), $next_month['year_id']));
$getcached = (count($presets) and (!isset($presets['honor_permissions']) or !$presets['honor_permissions'])) ? 1 : 0;
list($_endYear, $_endMonth, $_endDay) = explode('-', $end_date);
//-----------------------------------------
// Get the events (if we haven't already)
//-----------------------------------------
if (!array_key_exists($month, $this->events)) {
$this->events[$month] = array();
if ($getcached) {
$where = (!empty($presets['cal_id']) ? "e.event_calendar_id=" . intval($presets['cal_id']) . " AND " : '') . "e.event_approved=1";
} else {
$where = "e.event_calendar_id={$this->calendar['cal_id']} AND " . ($this->memberData['g_is_supmod'] ? "e.event_approved IN (0,1)" : "e.event_approved=1");
}
//-----------------------------------------
// Query DB for events and loop
//-----------------------------------------
if (!$minimal) {
$_joins = array(array('select' => 'm.*', 'from' => array('members' => 'm'), 'where' => 'm.member_id=e.event_member_id', 'type' => 'left'), array('select' => 'pp.*', 'from' => array('profile_portal' => 'pp'), 'where' => 'm.member_id=pp.pp_member_id', 'type' => 'left'));
if ($this->settings['reputation_enabled']) {
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/class_reputation_cache.php', 'classReputationCache');
$this->registry->setClass('repCache', new $classToLoad());
$_joins[] = $this->registry->getClass('repCache')->getTotalRatingJoin('event_id', 'e.event_id', 'calendar');
$_joins[] = $this->registry->getClass('repCache')->getUserHasRatedJoin('event_id', 'e.event_id', 'calendar');
}
}
$this->DB->build(array('select' => 'e.*', 'from' => $minimal ? 'cal_events e' : array('cal_events' => 'e'), 'add_join' => $_joins, 'where' => $where . " AND ( \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( e.event_start_date <= '{$end_date}' AND e.event_end_date >= '{$start_date}' ) OR\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( ( e.event_end_date " . $this->DB->buildIsNull(true) . " OR e.event_end_date='0000-00-00 00:00:00' ) AND e.event_start_date >= '{$start_date}' AND e.event_start_date <= '{$end_date}' ) OR \r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t( e.event_recurring=3 AND " . $this->DB->buildDateFormat('event_start_date', '%c') . "={$month} AND e.event_end_date <= '{$end_date}' ) )"));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
//-----------------------------------------
// Exclude private events
//-----------------------------------------
if ($r['event_private'] and !$getcached) {
if (!$this->memberData['member_id'] or $this->memberData['member_id'] != $r['event_member_id']) {
continue;
}
}
//-----------------------------------------
// Check event permissions
//-----------------------------------------
if ($r['event_perms'] != '*' and !$getcached) {
$permissionGroups = explode(',', IPSText::cleanPermString($r['event_perms']));
if (!IPSMember::isInGroup($this->memberData, $permissionGroups)) {
continue;
}
}
//-----------------------------------------
// Dynamically fix missing SEO titles
//-----------------------------------------
if (!$r['event_title_seo']) {
$r['event_title_seo'] = IPSText::makeSeoTitle($r['event_title']);
$this->DB->update('cal_events', array('event_title_seo' => $r['event_title_seo']), 'event_id=' . $r['event_id']);
}
//-----------------------------------------
// Create time info for PHP date functions
//-----------------------------------------
$_startTime = strtotime($r['event_start_date']);
$_endTime = ($r['event_end_date'] and $r['event_end_date'] != '0000-00-00 00:00:00') ? strtotime($r['event_end_date']) : 0;
if (!$r['event_all_day'] and !$presets['no_date_convert']) {
if ($this->memberData['member_id'] and $this->memberData['time_offset']) {
$_startTime = $_startTime + $this->memberData['time_offset'] * 3600;
} else {
if (!$this->memberData['member_id'] and $this->settings['time_offset']) {
$_startTime = $_startTime + $this->settings['time_offset'] * 3600;
}
}
if ($this->memberData['member_id'] and $this->memberData['time_offset']) {
$_endTime = $_endTime ? $_endTime + $this->memberData['time_offset'] * 3600 : 0;
} else {
if (!$this->memberData['member_id'] and $this->settings['time_offset']) {
$_endTime = $_endTime ? $_endTime + $this->settings['time_offset'] * 3600 : 0;
}
}
}
$r['event_start_date'] = gmstrftime("%Y-%m-%d %H:%M:%S", $_startTime);
$r['event_end_date'] = gmstrftime("%Y-%m-%d %H:%M:%S", $_endTime);
//.........這裏部分代碼省略.........
示例5: convert_posts
/**
* Convert Posts
*
* @access private
* @return void
**/
private function convert_posts()
{
//---------------------------
// Primary Key
//---------------------------
$this->lib->useKey('postID');
//---------------------------
// Set up
//---------------------------
$main = array('select' => '*', 'from' => $this->pb . 'post', 'order' => 'postID ASC');
$loop = $this->lib->load('posts', $main);
//-----------------------------------------
// Prepare for reports conversion
//-----------------------------------------
$this->lib->prepareReports('post');
$new = $this->DB->buildAndFetch(array('select' => 'status', 'from' => 'rc_status', 'where' => 'is_new=1'));
//---------------------------
// Loop
//---------------------------
while ($row = ipsRegistry::DB('hb')->fetch($this->lib->queryRes)) {
$save = array('topic_id' => $row['threadID'], 'author_id' => $row['userID'], 'author_name' => $row['username'], 'post' => $this->fixPostData($row['message']), 'post_date' => $row['time'], 'use_emo' => $row['enableSmilies'], 'post_htmlstate' => $row['enableHtml'], 'use_sig' => $row['showSignature'], 'ip_address' => $row['ipAddress']);
$this->lib->convertPost($row['postID'], $save);
$this->lib->setLastKeyValue($row['postID']);
//-----------------------------------------
// Report Center
//-----------------------------------------
$link = $this->lib->getLink($row['threadID'], 'topics');
if (!$link) {
continue;
}
$rc = $this->DB->buildAndFetch(array('select' => 'com_id', 'from' => 'rc_classes', 'where' => "my_class='post'"));
$forum = $this->DB->buildAndFetch(array('select' => 'forum_id, title', 'from' => 'topics', 'where' => 'tid=' . $link));
$rs = array('select' => '*', 'from' => $this->pb . 'post_report', 'order' => 'reportID ASC', 'where' => 'postID=' . $row['postID']);
ipsRegistry::DB('hb')->build($rs);
$res = ipsRegistry::DB('hb')->execute();
$reports = array();
while ($rget = ipsRegistry::DB('hb')->fetch($res)) {
$report = array('id' => $rget['reportID'], 'title' => "Reported post #{$row['postID']}", 'status' => $new['status'], 'rc_class' => $rc['com_id'], 'updated_by' => $rget['userID'], 'date_updated' => $rget['reportTime'], 'date_created' => $rget['reportTime'], 'exdat1' => $forum['forum_id'], 'exdat2' => $row['threadID'], 'exdat3' => $row['postID'], 'num_reports' => '1', 'num_comments' => '0', 'seoname' => IPSText::makeSeoTitle($forum['title']));
$reports = array(array('id' => $rget['reportID'], 'report' => $rget['report'], 'report_by' => $rget['userID'], 'date_reported' => $rget['reportTime']));
$this->lib->convertReport('post', $report, $reports, false);
}
}
$this->lib->next();
}
示例6: parseTopicData
/**
* Parase Topic Data
*
* @access public
* @param array $topic Topic data
* @param bool $last_time_default Use default "last read time"
* @return array
**/
public function parseTopicData($topic, $last_time_default = true)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$topic['real_tid'] = $topic['tid'];
$topic['_last_post'] = $topic['last_post'];
//-----------------------------------------
// Do we have an SEO title?
//-----------------------------------------
$_hasSEOTitle = false;
if ($topic['title_seo']) {
$_hasSEOTitle = true;
}
$topic['title_seo'] = $topic['title_seo'] ? $topic['title_seo'] : IPSText::makeSeoTitle($topic['title']);
/**
* Here we'll take the one query hit to update in order to speed it up in the future
*/
if (!$_hasSEOTitle and $this->settings['use_friendly_urls']) {
$this->DB->update('topics', array('title_seo' => $topic['title_seo'] ? $topic['title_seo'] : '-'), 'tid=' . $topic['tid']);
}
//-----------------------------------------
// Need to update this topic?
//-----------------------------------------
if ($topic['state'] == 'open') {
if (!$topic['topic_open_time'] or $topic['topic_open_time'] < $topic['topic_close_time']) {
if ($topic['topic_close_time'] and ($topic['topic_close_time'] <= time() and (time() >= $topic['topic_open_time'] or !$topic['topic_open_time']))) {
$topic['state'] = 'closed';
$this->update_topics_close[] = $topic['real_tid'];
}
} else {
if ($topic['topic_open_time'] or $topic['topic_open_time'] > $topic['topic_close_time']) {
if ($topic['topic_close_time'] and ($topic['topic_close_time'] <= time() and time() <= $topic['topic_open_time'])) {
$topic['state'] = 'closed';
$this->update_topics_close[] = $topic['real_tid'];
}
}
}
} else {
if ($topic['state'] == 'closed') {
if (!$topic['topic_close_time'] or $topic['topic_close_time'] < $topic['topic_open_time']) {
if ($topic['topic_open_time'] and ($topic['topic_open_time'] <= time() and (time() >= $topic['topic_close_time'] or !$topic['topic_close_time']))) {
$topic['state'] = 'open';
$this->update_topics_open[] = $topic['real_tid'];
}
} else {
if ($topic['topic_close_time'] or $topic['topic_close_time'] > $topic['topic_open_time']) {
if ($topic['topic_open_time'] and ($topic['topic_open_time'] <= time() and time() <= $topic['topic_close_time'])) {
$topic['state'] = 'open';
$this->update_topics_open[] = $topic['real_tid'];
}
}
}
}
}
//-----------------------------------------
// For polls we check last vote instead
// @todo [Future] Show a diff icon for new vote + new reply, new vote + no new reply, etc.
// Bug 16598: Need separate checks for icon vs getnewpost link
//-----------------------------------------
if ($topic['poll_state'] and $topic['last_vote'] > $topic['last_post']) {
$is_read = $this->registry->classItemMarking->isRead(array('forumID' => $topic['forum_id'], 'itemID' => $topic['tid'], 'itemLastUpdate' => $topic['last_vote']), 'forums');
$gotonewpost = $this->registry->classItemMarking->isRead(array('forumID' => $topic['forum_id'], 'itemID' => $topic['tid'], 'itemLastUpdate' => $topic['last_post']), 'forums');
} else {
$is_read = $this->registry->classItemMarking->isRead(array('forumID' => $topic['forum_id'], 'itemID' => $topic['tid'], 'itemLastUpdate' => $topic['last_post']), 'forums');
$gotonewpost = $is_read;
}
//-----------------------------------------
// Yawn
//-----------------------------------------
$topic['last_poster'] = $topic['last_poster_id'] ? IPSLib::makeProfileLink($topic['last_poster_name'], $topic['last_poster_id'], $topic['seo_last_name']) : $this->settings['guest_name_pre'] . $topic['last_poster_name'] . $this->settings['guest_name_suf'];
$topic['starter'] = $topic['starter_id'] ? IPSLib::makeProfileLink($topic['starter_name'], $topic['starter_id'], $topic['seo_first_name']) : $this->settings['guest_name_pre'] . $topic['starter_name'] . $this->settings['guest_name_suf'];
$topic['prefix'] = $topic['poll_state'] ? $this->registry->getClass('output')->getTemplate('forum')->topicPrefixWrap($this->settings['pre_polls']) : '';
$show_dots = "";
if ($this->memberData['member_id'] and (isset($topic['author_id']) and $topic['author_id'])) {
$show_dots = 1;
}
$topic['folder_img'] = $this->registry->getClass('class_forums')->fetchTopicFolderIcon($topic, $show_dots, $is_read);
/* SKINNOTE: Change these so that the link is built in the skin, not here */
$topic['topic_icon'] = $topic['icon_id'] ? '<img src="' . $this->settings['mime_img'] . '/style_extra/post_icons/icon' . $topic['icon_id'] . '.gif" border="0" alt="" />' : ' ';
$topic['topic_icon'] = $topic['pinned'] ? '<{B_PIN}>' : $topic['topic_icon'];
$topic['start_date'] = $this->registry->getClass('class_localization')->getDate($topic['start_date'], 'LONG');
//-----------------------------------------
// Pages 'n' posts
//-----------------------------------------
$pages = 1;
$topic['PAGES'] = "";
if ($this->memberData['is_mod']) {
$topic['posts'] += intval($topic['topic_queuedposts']);
}
if ($topic['posts']) {
$mode = IPSCookie::get('topicmode');
//.........這裏部分代碼省略.........
示例7: updateName
/**
* Updates member's DB row name or members_display_name
*
* @todo [Future] Separate out forum specific stuff (moderators, etc) and move into hooks
* @access public
* @param string Member id
* @param string New name
* @param string Field to update (name or display name)
* @return mixed True if update successful, otherwise exception or false
* Error Codes:
* NO_USER Could not load the user
* NO_PERMISSION This user cannot change their display name at all
* NO_MORE_CHANGES The user cannot change their display name again in this time period
* NO_NAME No display name (or shorter than 3 chars was given)
* ILLEGAL_CHARS The display name contains illegal characters
* USER_NAME_EXISTS The username already exists
*/
public function updateName($member_id, $name, $field = 'members_display_name')
{
//-----------------------------------------
// Load the member
//-----------------------------------------
$member = IPSMember::load($member_id);
$_seoName = IPSText::makeSeoTitle($name);
if (!$member['member_id']) {
throw new Exception("NO_USER");
}
//-----------------------------------------
// Make sure name does not exist
//-----------------------------------------
try {
if ($this->checkNameExists($name, $member, $field) === TRUE) {
throw new Exception("USER_NAME_EXISTS");
} else {
if ($field == 'members_display_name') {
$this->DB->force_data_type = array('dname_previous' => 'string', 'dname_current' => 'string');
$this->DB->insert('dnames_change', array('dname_member_id' => $member_id, 'dname_date' => time(), 'dname_ip_address' => $member['ip_address'], 'dname_previous' => $member['members_display_name'], 'dname_current' => $name));
//-----------------------------------------
// Still here? Change it then
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('members_display_name' => $name, 'members_l_display_name' => strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->force_data_type = array('last_poster_name' => 'string', 'seo_last_name' => 'string');
$this->DB->update('forums', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->force_data_type = array('member_name' => 'string', 'seo_name' => 'string');
$this->DB->update('sessions', array('member_name' => $name, 'seo_name' => $_seoName), "member_id=" . $member['member_id']);
$this->DB->force_data_type = array('starter_name' => 'string', 'seo_first_name' => 'string');
$this->DB->update('topics', array('starter_name' => $name, 'seo_first_name' => $_seoName), "starter_id=" . $member['member_id']);
$this->DB->force_data_type = array('last_poster_name' => 'string', 'seo_last_name' => 'string');
$this->DB->update('topics', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
} else {
//-----------------------------------------
// If one gets here, one can assume that the new name is correct for one, er...one.
// So, lets do the converteroo
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('name' => $name, 'members_l_username' => strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->force_data_type = array('member_name' => 'string');
$this->DB->update('moderators', array('member_name' => $name), "member_id=" . $member['member_id']);
if (!$this->settings['auth_allow_dnames']) {
//-----------------------------------------
// Not using sep. display names?
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('members_display_name' => $name, 'members_l_display_name' => strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->force_data_type = array('last_poster_name' => 'string', 'seo_last_name' => 'string');
$this->DB->update('forums', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->force_data_type = array('member_name' => 'string', 'seo_name' => 'string');
$this->DB->update('sessions', array('member_name' => $name, 'seo_name' => $_seoName), "member_id=" . $member['member_id']);
$this->DB->force_data_type = array('starter_name' => 'string', 'seo_first_name' => 'string');
$this->DB->update('topics', array('starter_name' => $name, 'seo_first_name' => $_seoName), "starter_id=" . $member['member_id']);
$this->DB->force_data_type = array('last_poster_name' => 'string', 'seo_last_name' => 'string');
$this->DB->update('topics', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
}
}
//-----------------------------------------
// Recache moderators
//-----------------------------------------
$this->registry->cache()->rebuildCache('moderators', 'forums');
//-----------------------------------------
// Recache announcements
//-----------------------------------------
$this->registry->cache()->rebuildCache('announcements', 'forums');
//-----------------------------------------
// Stats to Update?
//-----------------------------------------
$this->registry->cache()->rebuildCache('stats', 'core');
IPSLib::runMemberSync('onNameChange', $member['member_id'], $name);
return TRUE;
}
} catch (Exception $error) {
throw new Exception($error->getMessage());
}
}
示例8: registerProcessForm
//.........這裏部分代碼省略.........
$this->settings['reg_auth_type'] = '';
break;
/* Deny registration */
/* Deny registration */
case 4:
$this->registry->output->showError('spam_denied_account', '100x001', FALSE, '', 200);
break;
}
}
//-----------------------------------------
// Create the account
//-----------------------------------------
$member = IPSMember::create(array('members' => $member, 'pfields_content' => $custom_fields->out_fields), FALSE, FALSE, FALSE);
//-----------------------------------------
// Login handler create account callback
//-----------------------------------------
$this->han_login->createAccount(array('member_id' => $member['member_id'], 'email' => $member['email'], 'joined' => $member['joined'], 'password' => $in_password, 'ip_address' => $this->member->ip_address, 'username' => $member['members_display_name'], 'name' => $member['name'], 'members_display_name' => $member['members_display_name']));
//-----------------------------------------
// We'll just ignore if this fails - it shouldn't hold up IPB anyways
//-----------------------------------------
/*if ( $han_login->return_code AND ( $han_login->return_code != 'METHOD_NOT_DEFINED' AND $han_login->return_code != 'SUCCESS' ) )
{
$this->registry->output->showError( 'han_login_create_failed', 2017, true );
}*/
//-----------------------------------------
// Validation
//-----------------------------------------
$validate_key = md5(IPSMember::makePassword() . time());
$time = time();
if ($coppa != 1) {
if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin' or $this->settings['reg_auth_type'] == 'admin_user') {
//-----------------------------------------
// We want to validate all reg's via email,
// after email verificiation has taken place,
// we restore their previous group and remove the validate_key
//-----------------------------------------
$this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address'], 'spam_flag' => $_spamFlag));
if ($this->settings['reg_auth_type'] == 'user' or $this->settings['reg_auth_type'] == 'admin_user') {
/* Send out the email. */
$message = array('THE_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=auto_validate&uid=" . urlencode($member['member_id']) . "&aid=" . urlencode($validate_key), 'publicNoSession', 'false'), 'NAME' => $member['members_display_name'], 'MAN_LINK' => $this->registry->getClass('output')->buildSEOUrl("app=core&module=global§ion=register&do=05", 'publicNoSession', 'false'), 'EMAIL' => $member['email'], 'ID' => $member['member_id'], 'CODE' => $validate_key);
IPSText::getTextClass('email')->setPlainTextTemplate(IPSText::getTextClass('email')->getTemplate("reg_validate", $this->member->language_id));
IPSText::getTextClass('email')->buildPlainTextContent($message);
IPSText::getTextClass('email')->buildHtmlContent($message);
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $member['email'];
IPSText::getTextClass('email')->sendMail();
$this->output = $this->registry->output->getTemplate('register')->showAuthorize($member);
} else {
if ($this->settings['reg_auth_type'] == 'admin') {
$this->output = $this->registry->output->getTemplate('register')->showPreview($member);
}
}
/* Only send new registration email if the member wasn't banned */
if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
$date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
IPSText::getTextClass('email')->getTemplate('admin_newuser');
IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $this->settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
$this->registry->output->setTitle($this->lang->words['reg_success'] . ' - ' . ipsRegistry::$settings['board_name']);
$this->registry->output->addNavigation($this->lang->words['nav_reg'], '');
} else {
/* We don't want to preview, or get them to validate via email. */
$stat_cache = $this->cache->getCache('stats');
if ($member['members_display_name'] and $member['member_id'] and !$this->caches['group_cache'][$member['member_group_id']]['g_hide_online_list']) {
$stat_cache['last_mem_name'] = $member['members_display_name'];
$stat_cache['last_mem_name_seo'] = IPSText::makeSeoTitle($member['members_display_name']);
$stat_cache['last_mem_id'] = $member['member_id'];
}
$stat_cache['mem_count'] += 1;
$this->cache->setCache('stats', $stat_cache, array('array' => 1));
/* Only send new registration email if the member wasn't banned */
if ($this->settings['new_reg_notify'] and !$member['member_banned']) {
$date = $this->registry->class_localization->getDate(time(), 'LONG', 1);
IPSText::getTextClass('email')->getTemplate('admin_newuser');
IPSText::getTextClass('email')->buildMessage(array('DATE' => $date, 'LOG_IN_NAME' => $member['name'], 'EMAIL' => $member['email'], 'IP' => $member['ip_address'], 'DISPLAY_NAME' => $member['members_display_name']));
IPSText::getTextClass('email')->subject = sprintf($this->lang->words['new_registration_email1'], $this->settings['board_name']);
IPSText::getTextClass('email')->to = $this->settings['email_in'];
IPSText::getTextClass('email')->sendMail();
}
IPSCookie::set('pass_hash', $member['member_login_key'], 1);
IPSCookie::set('member_id', $member['member_id'], 1);
//-----------------------------------------
// Fix up session
//-----------------------------------------
$privacy = $member['g_hide_online_list'] || empty($this->settings['disable_anonymous']) && !empty($this->request['Privacy']) ? 1 : 0;
# Update value for onCompleteAccount call
$member['login_anonymous'] = $privacy . '&1';
$this->member->sessionClass()->convertGuestToMember(array('member_name' => $member['members_display_name'], 'member_id' => $member['member_id'], 'member_group' => $member['member_group_id'], 'login_type' => $privacy));
IPSLib::runMemberSync('onCompleteAccount', $member);
$this->registry->output->silentRedirect($this->settings['base_url'] . '&app=core&module=global§ion=login&do=autologin&fromreg=1');
}
} else {
/* This is a COPPA user, so lets tell them they registered OK and redirect to the form. */
$this->DB->insert('validating', array('vid' => $validate_key, 'member_id' => $member['member_id'], 'real_group' => $this->settings['member_group'], 'temp_group' => $this->settings['auth_group'], 'entry_date' => $time, 'coppa_user' => $coppa, 'new_reg' => 1, 'ip_address' => $member['ip_address']));
$this->registry->output->redirectScreen($this->lang->words['cp_success'], $this->settings['base_url'] . 'app=core&module=global&section=register&do=12');
}
}
示例9: fixSeoTitles
/**
* Set the SEO titles
*
* @param int
* @return @e void
*/
public function fixSeoTitles()
{
/* Init */
$st = intval($this->request['st']);
$did = 0;
$each = 200;
/* If this is the first pass, do the cal_calendars table too */
if (!$st) {
$this->DB->build(array('select' => 'cal_id, cal_title', 'from' => 'cal_calendars'));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$this->DB->update('cal_calendars', array('cal_title_seo' => IPSText::makeSeoTitle($r['cal_title'])), 'cal_id=' . $r['cal_id']);
}
$this->registry->output->addMessage('Calendar FURL titles rebuilt');
}
/* Build event FURL titles */
$this->DB->build(array('select' => 'event_id, event_title', 'from' => 'cal_events', 'order' => 'event_id ASC', 'limit' => array($st, $each)));
$outer = $this->DB->execute();
while ($r = $this->DB->fetch($outer)) {
$did++;
$this->DB->update('cal_events', array('event_title_seo' => IPSText::makeSeoTitle($r['event_title'])), 'event_id=' . $r['event_id']);
}
/* Show message and redirect */
if ($did > 0) {
$this->request['st'] = $st + $did;
$this->request['workact'] = 'fixtitles';
$this->registry->output->addMessage("Up to {$this->request['st']} event FURL titles rebuilt so far...");
} else {
$this->request['st'] = 0;
$this->request['workact'] = '';
$this->registry->output->addMessage("All event FURL titles rebuilt...");
}
/* Next Page */
return;
}
示例10: updateName
/**
* Updates member's DB row name or members_display_name
*
* @todo [Future] Separate out forum specific stuff (moderators, etc) and move into hooks
*
* @param string Member id
* @param string New name
* @param string Field to update (name or display name)
* @return mixed True if update successful, otherwise exception or false
*
* Error Codes:
* NO_USER Could not load the user
* NO_PERMISSION This user cannot change their display name at all
* NO_MORE_CHANGES The user cannot change their display name again in this time period
* NO_NAME No display name (or shorter than 3 chars was given)
* ILLEGAL_CHARS The display name contains illegal characters
* USER_NAME_EXISTS The username already exists
*/
public function updateName($member_id, $name, $field = 'members_display_name', $discount = FALSE)
{
//-----------------------------------------
// Load the member
//-----------------------------------------
$member = IPSMember::load($member_id);
$_seoName = IPSText::makeSeoTitle($name);
if (!$member['member_id']) {
throw new Exception("NO_USER");
}
//-----------------------------------------
// Make sure name does not exist
//-----------------------------------------
try {
if ($this->checkNameExists($name, $member, $field) === TRUE) {
throw new Exception("USER_NAME_EXISTS");
} else {
if ($field == 'members_display_name') {
$this->DB->setDataType(array('dname_previous', 'dname_current'), 'string');
if ($member['members_display_name'] != $name) {
$this->DB->insert('dnames_change', array('dname_member_id' => $member_id, 'dname_date' => time(), 'dname_ip_address' => $member['ip_address'], 'dname_previous' => $member['members_display_name'], 'dname_current' => $name, 'dname_discount' => $discount ? 1 : 0));
}
//-----------------------------------------
// Still here? Change it then
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('members_display_name' => $name, 'members_l_display_name' => mb_strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('forums', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->setDataType(array('member_name', 'seo_name'), 'string');
$this->DB->update('sessions', array('member_name' => $name, 'seo_name' => $_seoName), "member_id=" . $member['member_id']);
$this->DB->setDataType(array('starter_name', 'seo_first_name'), 'string');
$this->DB->update('topics', array('starter_name' => $name, 'seo_first_name' => $_seoName), "starter_id=" . $member['member_id']);
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('topics', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->update('posts', array('author_name' => $name), "author_id=" . $member['member_id']);
/* Update archived posts */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/writer.php', 'classes_archive_writer');
$archiveWriter = new $classToLoad();
$archiveWriter->setApp('forums');
$archiveWriter->update(array('archive_author_name' => $name), 'archive_author_id=' . $member['member_id']);
} else {
//-----------------------------------------
// If one gets here, one can assume that the new name is correct for one, er...one.
// So, lets do the converteroo
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('name' => $name, 'members_l_username' => mb_strtolower($name))));
$this->DB->setDataType('member_name', 'string');
$this->DB->update('moderators', array('member_name' => $name), "member_id=" . $member['member_id']);
if (!$this->settings['auth_allow_dnames']) {
//-----------------------------------------
// Not using sep. display names?
//-----------------------------------------
IPSMember::save($member['member_id'], array('core' => array('members_display_name' => $name, 'members_l_display_name' => mb_strtolower($name), 'members_seo_name' => $_seoName)));
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('forums', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->setDataType(array('member_name', 'seo_name'), 'string');
$this->DB->update('sessions', array('member_name' => $name, 'seo_name' => $_seoName), "member_id=" . $member['member_id']);
$this->DB->setDataType(array('starter_name', 'seo_first_name'), 'string');
$this->DB->update('topics', array('starter_name' => $name, 'seo_first_name' => $_seoName), "starter_id=" . $member['member_id']);
$this->DB->setDataType(array('last_poster_name', 'seo_last_name'), 'string');
$this->DB->update('topics', array('last_poster_name' => $name, 'seo_last_name' => $_seoName), "last_poster_id=" . $member['member_id']);
$this->DB->update('posts', array('author_name' => $name), "author_id=" . $member['member_id']);
/* Update archived posts */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/archive/writer.php', 'classes_archive_writer');
$archiveWriter = new $classToLoad();
$archiveWriter->setApp('forums');
$archiveWriter->update(array('archive_author_name' => $name), 'archive_author_id=' . $member['member_id']);
}
}
//-----------------------------------------
// Recache moderators
//-----------------------------------------
$this->registry->cache()->rebuildCache('moderators', 'forums');
//-----------------------------------------
// Recache announcements
//-----------------------------------------
$this->registry->cache()->rebuildCache('announcements', 'forums');
//-----------------------------------------
// Stats to Update?
//-----------------------------------------
$this->registry->cache()->rebuildCache('stats', 'core');
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
//.........這裏部分代碼省略.........
示例11: convertImage
/**
* Convert an image
*
* @access public
* @param integer Foreign ID number
* @param array Data to insert to table
* @param string Path to where images are stores
* @param array Custom field data to insert to table
* @param boolean If true, loads file data from database, rather than move file
* @return boolean Success or fail
**/
public function convertImage($id, $info, $path, $custom_fields, $db = false)
{
// Check we have a path
if (!$this->settings['gallery_images_path']) {
$this->logError($id, 'Your IP.Gallery uploads path has not been configured');
return false;
}
//-----------------------------------------
// Make sure we have everything we need
//-----------------------------------------
if (!$id) {
$this->logError($id, 'No ID number provided');
return false;
}
// Need image path if was not stored in database
if (!$path and !$db) {
$this->logError($id, 'No path provided');
return false;
}
// Be sure to have member id
if (!$info['member_id']) {
$this->logError($id, 'No member ID provided');
return false;
}
// Need to store in either category or album
if (!$info['category_id'] and !$info['album_id']) {
$this->logError($id, 'No category or album ID provided');
return false;
}
// Check if a masked name was provided. If not, just use the filename.
$info['masked_file_name'] = $info['masked_file_name'] ? $info['masked_file_name'] : $info['file_name'];
if (!$db and !$info['masked_file_name']) {
$this->logError($id, 'No filename provided');
return false;
}
// Make sure image data was provided if stored in database.
if ($db && !$info['data']) {
$this->logError($id, 'No file data provided');
return false;
}
if (isset($info['directory']) && $info['directory'] != '') {
$path = $path . '/' . trim($info['directory'], '/');
}
// Check the file actually exists
if (!$db && !file_exists($path . '/' . $info['masked_file_name'])) {
$this->logError($id, 'Could not locate file ' . $path . '/' . $info['masked_file_name']);
return false;
}
//-----------------------------------------
// Set up array
//-----------------------------------------
$imageArray = array('member_id' => $this->getLink($info['member_id'], 'members', false, $this->useLocalLink), 'category_id' => $info['category_id'] ? $this->getLink($info['category_id'], 'gallery_categories') : 0, 'album_id' => $info['album_id'] ? $this->getLink($info['album_id'], 'gallery_albums') : 0, 'caption' => $info['caption'] ? $info['caption'] : 'No caption', 'file_size' => $info['file_size'] ? $info['file_size'] : 2, 'description' => $info['description'], 'directory' => '', 'file_name' => $info['file_name'], 'approved' => $info['approved'], 'thumbnail' => $info['thumbnail'], 'views' => intval($info['views']), 'comments' => intval($info['comments']), 'idate' => intval($info['idate']), 'ratings_total' => intval($info['ratings_total']), 'ratings_count' => intval($info['ratings_count']), 'caption_seo' => IPSText::makeSeoTitle($info['caption']), 'image_notes' => $info['image_notes'], 'rating' => intval($info['ratings_total']) > 0 ? intval($info['ratings_total']) / intval($info['ratings_count']) : 0);
// Fields still required = array( 'file_name', 'file_type', 'masked_file_name', 'medium_file_name');
// Fields optional = array( 'file_size', 'pinned', 'media', 'credit_info', 'metadata', 'media_thumb');
$_file = IPSLib::getAppDir('gallery') . '/app_class_gallery.php';
$_name = 'app_class_gallery';
$galleryLibObject;
if (file_exists($_file)) {
$classToLoad = IPSLib::loadLibrary($_file, $_name);
$galleryLibObject = new $classToLoad($this->registry);
}
$this->_loadMediaCache();
require_once IPS_KERNEL_PATH . 'classUpload.php';
$upload = new classUpload();
$allowed_ext = array();
foreach ($this->media_thumb_cache as $k => $v) {
if (!$v['allowed']) {
continue;
}
if ($v['default_type'] == 0 and !$allow_media) {
continue;
}
$allowed_ext[] = str_replace(".", "", $k);
}
$dir = "";
if ($this->settings['gallery_dir_images']) {
$dir = $this->DB->buildAndFetch(array('select' => 'directory', 'from' => 'gallery_images', 'order' => "id DESC", 'limit' => array(0, 1)));
$dir = $dir['directory'];
if (!is_dir($this->settings['gallery_images_path'] . '/' . $dir)) {
$dir = '';
}
$total = $this->DB->buildAndFetch(array('select' => 'COUNT(directory) AS files', 'from' => 'gallery_images', 'where' => "directory='{$dir}'"));
if ($total['files'] >= $this->settings['gallery_dir_images'] || !$total['files']) {
$dir = time();
@mkdir($this->settings['gallery_images_path'] . '/' . $dir, 0777);
@chmod($this->settings['gallery_images_path'] . '/' . $dir, 0777);
@touch($this->settings['gallery_images_path'] . '/' . $dir . '/index.html');
}
$dir = $dir ? "{$dir}/" : "";
//.........這裏部分代碼省略.........
示例12: convertGuestToMember
/**
* Converts a guest session to a member session
*
* @access public
* @param array Array of incoming data (member_id, member_name, member_group, login_type)
* @return string Current session ID
*/
public function convertGuestToMember($data)
{
/* Delete old sessions */
$this->_destroySessions("ip_address='" . $this->_member->ip_address . "' AND id != '{$this->session_id}'");
/* Fetch member */
$member = IPSMember::load($data['member_id'], 'core');
/* Update this session directly */
$this->DB->update('sessions', array('member_name' => $data['member_name'], 'seo_name' => IPSText::makeSeoTitle($data['member_name']), 'member_id' => $data['member_id'], 'running_time' => time(), 'member_group' => $data['member_group'], 'login_type' => $data['login_type']), "id='" . $this->session_id . "'", TRUE);
/* Remove from update and delete array */
unset($this->_sessionsToSave[$this->session_id]);
unset($this->_sessionsToKill[$this->session_id]);
$update = array('last_activity' => time());
if ($member['last_activity']) {
$update['last_visit'] = $member['last_activity'];
} else {
$update['last_visit'] = time();
}
/* Make sure last activity and last visit are up to date */
IPSMember::save($data['member_id'], array('core' => $update));
/* Set cookie */
IPSCookie::set("session_id", $this->session_id, -1);
IPSDebug::addLogMessage("convertGuestToMember: {$data['member_id']}, {$this->session_id} " . serialize($data), 'sessions-' . $this->_memberData['member_id']);
/* Set type */
self::$data_store['_sessionType'] = 'update';
return $this->session_id;
}
示例13: _fetchSeoTitle_forum
/**
* Return the SEO title for a topic
*
* @access public
* @return string The SEO friendly name
*/
public function _fetchSeoTitle_forum()
{
$forum = $this->DB->buildAndFetch(array('select' => 'id, name_seo, name', 'from' => 'forums', 'where' => 'id=' . intval($this->_id)));
if ($forum['id']) {
/* Check permission */
if (!$this->registry->getClass('class_forums')->forumsCheckAccess($forum['id'], 0, 'forum', array(), TRUE)) {
return FALSE;
}
return $forum['name_seo'] ? $forum['name_seo'] : IPSText::makeSeoTitle($forum['name']);
}
return FALSE;
}
示例14: parseOnlineEntries
/**
* Parse/format the online list data for the records
*
* @author Brandon Farber
* @param array Online list rows to check against
* @return array Online list rows parsed
*/
public function parseOnlineEntries($rows)
{
if (!is_array($rows) or !count($rows)) {
return $rows;
}
//-----------------------------------------
// Init
//-----------------------------------------
$forums_raw = array();
$forums = array();
$topics_raw = array();
$topics = array();
$posts_raw = array();
$posts = array();
$final = array();
//-----------------------------------------
// Extract the topic/forum data
//-----------------------------------------
foreach ($rows as $row) {
if ($row['current_appcomponent'] != 'forums' or !$row['current_module']) {
continue;
}
if ($row['current_section'] == 'forums') {
$forums_raw[$row['location_2_id']] = '';
} else {
if ($row['current_section'] == 'topics') {
$topics_raw[$row['location_1_id']] = $row['location_1_id'];
} else {
if ($row['current_section'] == 'post') {
$forums_raw[$row['location_2_id']] = '';
$topics_raw[$row['location_1_id']] = $row['location_1_id'];
}
}
}
}
//-----------------------------------------
// Get the forums, if you dare
//-----------------------------------------
ipsRegistry::getAppClass('forums');
if (count($forums_raw)) {
foreach (ipsRegistry::getClass('class_forums')->forum_by_id as $fid => $forum) {
if (isset($forums_raw[$fid])) {
if (ipsRegistry::getClass('permissions')->check('view', $forum) !== false) {
$forums[$fid] = $forum['name'];
}
}
}
}
//-----------------------------------------
// Get the topics, if you care
//-----------------------------------------
if (count($topics_raw)) {
$_approved = ipsRegistry::getClass('class_forums')->fetchTopicHiddenQuery(array('visible'), 't.');
ipsRegistry::DB()->build(array('select' => 't.*', 'from' => array('topics' => 't'), 'where' => $_approved . ' AND t.tid IN(' . implode(',', $topics_raw) . ') AND ' . ipsRegistry::getClass('permissions')->buildPermQuery('p'), 'add_join' => array(array('from' => array('permission_index' => 'p'), 'where' => "p.perm_type_id=t.forum_id AND p.app='forums' AND p.perm_type='forum'", 'type' => 'left'))));
$tr = ipsRegistry::DB()->execute();
while ($r = ipsRegistry::DB()->fetch($tr)) {
$_forum = ipsRegistry::getClass('class_forums')->getForumByid($r['forum_id']);
if (count($_forum) and ipsRegistry::getClass('class_forums')->forumsCheckAccess($_forum['id'], false, 'topic', $r, true)) {
if (ipsRegistry::getClass('permissions')->check('read', $_forum) !== false) {
if ($_forum['password'] == '' or IPSMember::isInGroup(ipsRegistry::member()->fetchMemberData(), explode(',', $_forum['password_override'])) or IPSCookie::get("ipbforumpass_{$_forum['id']}") == md5($_forum['password'])) {
$topics[$r['tid']] = $r['title'];
}
}
}
}
}
//-----------------------------------------
// Put humpty dumpty together again
//-----------------------------------------
foreach ($rows as $row) {
if ($row['current_appcomponent'] != 'forums') {
$final[$row['id']] = $row;
continue;
}
if (!$row['current_module']) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['board_index'];
$final[$row['id']] = $row;
continue;
}
if ($row['current_section'] == 'forums') {
if (isset($forums[$row['location_2_id']])) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_sf'];
$row['where_line_more'] = $forums[$row['location_2_id']];
$row['where_link'] = 'showforum=' . $row['location_2_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showforum=" . $row['location_2_id'], 'public'), IPSText::makeSeoTitle($forums[$row['location_2_id']]), 'showforum');
}
} else {
if ($row['current_section'] == 'topics') {
if (isset($topics[$row['location_1_id']])) {
$row['where_line'] = ipsRegistry::getClass('class_localization')->words['WHERE_st'];
$row['where_line_more'] = $topics[$row['location_1_id']];
$row['where_link'] = 'showtopic=' . $row['location_1_id'];
$row['_whereLinkSeo'] = ipsRegistry::getClass('output')->formatUrl(ipsRegistry::getClass('output')->buildUrl("showtopic=" . $row['location_1_id'], 'public'), IPSText::makeSeoTitle($topics[$row['location_1_id']]), 'showtopic');
//.........這裏部分代碼省略.........
示例15: rebuildPostNames
/**
* Rebuild Post Names
*
* @return @e void
*/
public function rebuildPostNames()
{
//-----------------------------------------
// Set up
//-----------------------------------------
$done = 0;
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
$end = intval($this->request['pergo']) ? intval($this->request['pergo']) : 100;
$dis = $end + $start;
$output = array();
//-----------------------------------------
// Got any more?
//-----------------------------------------
$tmp = $this->DB->buildAndFetch(array('select' => 'member_id', 'from' => 'members', 'limit' => array($dis, 1)));
$max = intval($tmp['member_id']);
//-----------------------------------------
// Avoid limit...
//-----------------------------------------
$this->DB->build(array('select' => 'member_id, members_display_name', 'from' => 'members', 'order' => 'member_id ASC', 'limit' => array($start, $end)));
$outer = $this->DB->execute();
//-----------------------------------------
// Process...
//-----------------------------------------
while ($r = $this->DB->fetch($outer)) {
$seoName = IPSText::makeSeoTitle($r['members_display_name']);
$this->DB->update('topics', array('starter_name' => $r['members_display_name'], 'seo_first_name' => $seoName), "starter_id=" . $r['member_id']);
$this->DB->update('topics', array('last_poster_name' => $r['members_display_name'], 'seo_last_name' => $seoName), "last_poster_id=" . $r['member_id']);
$done++;
}
//-----------------------------------------
// Finish - or more?...
//-----------------------------------------
if (!$done and !$max) {
//-----------------------------------------
// Done..
//-----------------------------------------
$text = $this->lang->words['re_rebuildcomp'] . '<br />' . implode("<br />", $output);
$url = "{$this->settings['base_url']}{$this->form_code}";
} else {
//-----------------------------------------
// More..
//-----------------------------------------
$thisgoeshere = sprintf($this->lang->words['re_thisgoeshere'], $dis);
$text = $thisgoeshere . '<br />' . implode("<br />", $output);
$url = "{$this->settings['base_url']}{$this->form_code}&do={$this->request['do']}&pergo={$this->request['pergo']}&st={$dis}";
}
//-----------------------------------------
// Bye....
//-----------------------------------------
$this->_specialRedirect($url, $text);
}