本文整理匯總了PHP中IPSText::parseCleanValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP IPSText::parseCleanValue方法的具體用法?PHP IPSText::parseCleanValue怎麽用?PHP IPSText::parseCleanValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPSText
的用法示例。
在下文中一共展示了IPSText::parseCleanValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: doExecute
/**
* Class entry point
*
* @access public
* @param object Registry reference
* @return void [Outputs to screen]
*/
public function doExecute(ipsRegistry $registry)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$info = array();
$id = intval($this->memberData['member_id']);
//-----------------------------------------
// Get HTML and skin
//-----------------------------------------
$this->registry->class_localization->loadLanguageFile(array('public_profile'), 'members');
//-----------------------------------------
// Can we access?
//-----------------------------------------
if (!$this->memberData['g_mem_info'] or $this->memberData['gbw_no_status_update']) {
$this->returnJsonError($this->lang->words['status_off']);
}
if (!$id) {
$this->returnJsonError($this->lang->words['status_off']);
}
$newStatus = trim(IPSText::getTextClass('bbcode')->stripBadWords(IPSText::parseCleanValue($_POST['new_status'])));
IPSMember::save($id, array('extendedProfile' => array('pp_status' => $newStatus, 'pp_status_update' => time())));
$this->returnJsonArray(array('status' => 'success', 'new_status' => $newStatus));
exit;
}
示例2: convertAndMakeSafe
/**
* Convert and make safe an incoming string
*
* @access public
* @param string Raw input string
* @param boolean Run through parse_incoming routine
* @return string Cleaned string
*/
public function convertAndMakeSafe($value, $parse_incoming = true)
{
$value = rawurldecode($value);
$value = $this->convertUnicode($value);
$value = $this->convertHtmlEntities($value);
if ($parse_incoming) {
$value = IPSText::parseCleanValue($value);
}
return $value;
}
示例3: checkEmail
/**
* Check the email address
*
* @return @e void [Outputs to screen]
*/
public function checkEmail()
{
//-----------------------------------------
// INIT
//-----------------------------------------
$email = '';
$banfilters = array();
if (is_string($_REQUEST['email'])) {
$email = strtolower(IPSText::parseCleanValue(rawurldecode($_REQUEST['email'])));
}
if (!$email) {
$this->returnString('found');
}
if (!IPSText::checkEmailAddress($email)) {
$this->returnString('found');
}
//-----------------------------------------
// Got the member?
//-----------------------------------------
if (!IPSMember::checkByEmail($email)) {
//-----------------------------------------
// Load ban filters
//-----------------------------------------
$this->DB->build(array('select' => '*', 'from' => 'banfilters'));
$this->DB->execute();
while ($r = $this->DB->fetch()) {
$banfilters[$r['ban_type']][] = $r['ban_content'];
}
//-----------------------------------------
// Are they banned [EMAIL]?
//-----------------------------------------
if (is_array($banfilters['email']) and count($banfilters['email'])) {
foreach ($banfilters['email'] as $memail) {
$memail = str_replace("*", '.*', preg_quote($memail, "/"));
if (preg_match("/^{$memail}\$/", $email)) {
$this->returnString('banned');
break;
}
}
}
//-----------------------------------------
// Load handler...
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/handlers/han_login.php', 'han_login');
$han_login = new $classToLoad($this->registry);
$han_login->init();
$han_login->emailExistsCheck($email);
if ($han_login->return_code and $han_login->return_code != 'METHOD_NOT_DEFINED' and $han_login->return_code != 'EMAIL_NOT_IN_USE') {
$this->returnString('found');
}
$this->returnString('notfound');
} else {
$this->returnString('found');
}
}
示例4: _recurse
/**
* Recursively parse stuff
*/
private function _recurse(&$data, $input = array(), $iteration = 0)
{
if ($iteration >= 20) {
return $input;
}
if (is_array($data)) {
foreach ($data as $k => $v) {
if (is_array($v)) {
$input[$k] = $this->_recurse($data[$k], array(), $iteration + 1);
} else {
$v = self::convert($k, $v);
$input[$k] = IPSText::parseCleanValue($v, true);
}
}
}
return $input;
}
示例5: doExecute
/**
* Class entry point
*
* @param object Registry reference
* @return @e void [Outputs to screen/redirects]
*/
public function doExecute(ipsRegistry $registry)
{
/* Disabled? */
if (!$this->settings['sl_enable']) {
$this->registry->output->showError('forward_turned_off', 103240.1);
}
/* Permission Check */
$cache = isset($this->caches['sharelinks']) ? $this->caches['sharelinks'] : ipsRegistry::cache()->getCache('sharelinks');
if ($cache['email']['share_groups'] != '*' and !IPSMember::isInGroup($this->memberData, explode(',', $cache['email']['share_groups']))) {
$this->registry->output->showError('forward_turned_off', 103240.2);
}
//-----------------------------------------
// Grab skin and lang stuff
//-----------------------------------------
ipsRegistry::getClass('class_localization')->loadLanguageFile(array('public_emails'), 'core');
/* Via URL and topic title? */
if ($this->request['url'] and $this->request['title']) {
$this->page['url'] = IPSText::parseCleanValue(IPSText::base64_decode_urlSafe($this->request['url']));
$this->page['title'] = IPSText::parseCleanValue(urldecode($this->request['title']));
} else {
//-----------------------------------------
// Check the input
//-----------------------------------------
$this->request['t'] = intval($this->request['t']);
$this->request['f'] = intval($this->request['f']);
if (!$this->request['t']) {
$this->registry->output->showError('forward_no_tid', 10321);
}
//-----------------------------------------
// Get the topic details
//-----------------------------------------
$this->topic = $this->DB->buildAndFetch(array('select' => '*', 'from' => 'topics', 'where' => "tid=" . $this->request['t']));
$this->forum = ipsRegistry::getClass('class_forums')->forum_by_id[$this->topic['forum_id']];
//-----------------------------------------
// Error out if we can not find the forum
//-----------------------------------------
if (!$this->forum['id']) {
$this->registry->output->showError('forward_no_fid', 10322);
}
//-----------------------------------------
// Error out if we can not find the topic
//-----------------------------------------
if (!$this->topic['tid']) {
$this->registry->output->showError('forward_no_tid', 10323);
}
//-----------------------------------------
// Check viewing permissions, private forums,
// password forums, etc
//-----------------------------------------
if (!$this->memberData['member_id']) {
$this->registry->output->showError('forward_only_members', 10324);
}
ipsRegistry::getClass('class_forums')->forumsCheckAccess($this->forum['id']);
}
/* last check */
if (!$this->topic['tid'] and !$this->page['url']) {
$this->registry->output->showError('forward_no_tid', 10323.2);
}
/* Ok, I lied. Is this share entry enabled? */
$cache = ipsRegistry::cache()->getCache('sharelinks');
if (!is_array($cache['email']) or !$cache['email']['share_enabled']) {
$this->registry->output->showError('forward_turned_off', 103240);
}
//-----------------------------------------
// What to do?
//-----------------------------------------
if ($this->request['do'] == '01') {
$this->_sendEmail();
} else {
$this->_showForm();
}
}
示例6: _view
/**
* View all logs for a given admin
*
* @return @e void [Outputs to screen]
*/
protected function _view()
{
///----------------------------------------
// Basic init
//-----------------------------------------
$start = intval($this->request['st']) >= 0 ? intval($this->request['st']) : 0;
///----------------------------------------
// No mid or search string?
//-----------------------------------------
if (!$this->request['search_string'] and !$this->request['mid']) {
$this->registry->output->global_message = $this->lang->words['alog_nostring'];
$this->_listCurrent();
return;
}
$this->request['mid'] = $this->request['mid'] == 'zero' ? 0 : $this->request['mid'];
///----------------------------------------
// mid?
//-----------------------------------------
if (!$this->request['search_string']) {
$row = $this->DB->buildAndFetch(array('select' => 'COUNT(id) as count', 'from' => 'admin_logs', 'where' => "member_id=" . intval($this->request['mid'])));
$query = "{$this->form_code}&mid=" . ($this->request['mid'] ? $this->request['mid'] : 'zero') . "&do=view";
$this->DB->build(array('select' => 'm.*', 'from' => array('admin_logs' => 'm'), 'where' => 'm.member_id=' . intval($this->request['mid']), 'order' => 'm.ctime DESC', 'limit' => array($start, 20), 'add_join' => array(array('select' => 'mem.members_display_name', 'from' => array('members' => 'mem'), 'where' => 'mem.member_id=m.member_id', 'type' => 'left'))));
$this->DB->execute();
} else {
$this->request['search_string'] = IPSText::parseCleanValue(urldecode($this->request['search_string']));
if (!$this->DB->checkForField($this->request['search_type'], 'admin_logs')) {
$this->registry->output->showError($this->lang->words['alog_whatfield'], 4110, true);
}
if ($this->request['search_type'] == 'member_id') {
$dbq = "m." . $this->request['search_type'] . "='" . $this->request['search_string'] . "'";
} else {
$dbq = "m." . $this->request['search_type'] . " LIKE '%" . $this->request['search_string'] . "%'";
}
$row = $this->DB->buildAndFetch(array('select' => 'COUNT(m.member_id) as count', 'from' => 'admin_logs m', 'where' => $dbq));
$query = "{$this->form_code}&do=view&search_type=" . $this->request['search_type'] . "&search_string=" . urlencode($this->request['search_string']);
$this->DB->build(array('select' => 'm.*', 'from' => array('admin_logs' => 'm'), 'where' => $dbq, 'order' => 'm.ctime DESC', 'limit' => array($start, 20), 'add_join' => array(array('select' => 'mem.members_display_name', 'from' => array('members' => 'mem'), 'where' => 'mem.member_id=m.member_id', 'type' => 'left'))));
$this->DB->execute();
}
///----------------------------------------
// Page links
//-----------------------------------------
$links = $this->registry->output->generatePagination(array('totalItems' => $row['count'], 'itemsPerPage' => 20, 'currentStartValue' => $start, 'baseUrl' => $this->settings['base_url'] . $query));
///----------------------------------------
// Get db results
//-----------------------------------------
while ($row = $this->DB->fetch()) {
if (!$row['member_id']) {
$row['member_id'] = 'zero';
}
if (!$row['members_display_name']) {
$row['members_display_name'] = $this->lang->words['noname_availabl'];
}
$row['_time'] = $this->registry->class_localization->getDate($row['ctime'], 'LONG');
$rows[] = $row;
}
///----------------------------------------
// And output
//-----------------------------------------
$this->registry->output->html .= $this->html->adminlogsView($rows, $links);
}
示例7: fetchTopics
/**
* Returns topics based on request params
*
* @param string $api_key Authentication Key
* @param string $api_module Module
* @param string $forum_ids Comma separated list of forum ids
* @param string $order_field DB field to order by
* @param string $order_by One of "asc" or "desc"
* @param integer $offset Start point offset for results
* @param integer $limit Number of results to pull
* @param bool $view_as_guest Treat user as a guest
* @return string xml
*/
public function fetchTopics($api_key, $api_module, $forum_ids, $order_field, $order_by, $offset, $limit, $view_as_guest, $parse_display)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$api_key = IPSText::md5Clean($api_key);
$api_module = IPSText::parseCleanValue($api_module);
$forum_ids = IPSText::parseCleanValue($forum_ids);
$order_field = IPSText::parseCleanValue($order_field);
$order_by = strtolower($order_by) == 'asc' ? 'asc' : 'desc';
$offset = intval($offset);
$limit = intval($limit);
$view_as_guest = intval($view_as_guest);
$parse_display = intval($parse_display);
//-----------------------------------------
// Authenticate
//-----------------------------------------
if ($this->__authenticate($api_key, $api_module, 'fetchTopics') !== FALSE) {
//-----------------------------------------
// Add log
//-----------------------------------------
$this->addLogging($api_key);
//-----------------------------------------
// Get API classes
//-----------------------------------------
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . '/api/forums/api_topic_view.php', 'apiTopicView');
$topic_view = new $classToLoad();
//-----------------------------------------
// Fetch topic list
//-----------------------------------------
$topic_view->topic_list_config['order_field'] = $order_field;
$topic_view->topic_list_config['order_by'] = $order_by;
$topic_view->topic_list_config['forums'] = $forum_ids;
$topic_view->topic_list_config['offset'] = $offset;
$topic_view->topic_list_config['limit'] = $limit;
$topics = $topic_view->return_topic_list_data($view_as_guest, $parse_display);
//-----------------------------------------
// Return the data
//-----------------------------------------
$this->classApiServer->apiSendReply($topics);
exit;
}
}
示例8: handshakeEnd
/**
* handshake_server::handshake_end()
*
* Returns all data...
*
* @access public
* @param integer $reg_id Converge reg ID
* @param string $reg_code Converge API Code (MUST BE PRESENT IN ALL RETURNED API REQUESTS).
* @param integer $reg_date Unix stamp of converge request start time
* @param integer $reg_product_id Converge product ID (MUST BE PRESENT IN ALL RETURNED API REQUESTS)
* @param string $converge_url Converge application base url (no slashes or paths)
* @param integer $handshake_completed All done flag
* @return mixed xml / boolean false
**/
public function handshakeEnd($reg_id = '', $reg_code = '', $reg_date = '', $reg_product_id = '', $converge_url = '', $handshake_completed = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$reg_id = intval($reg_id);
$reg_code = IPSText::md5Clean($reg_code);
$reg_date = intval($reg_date);
$reg_product_id = intval($reg_product_id);
$converge_url = IPSText::parseCleanValue($converge_url);
$handshake_completed = intval($handshake_completed);
$this->registry->getClass('class_localization')->loadLanguageFile(array('api_langbits'), 'core');
//-----------------------------------------
// Grab data from the DB
//-----------------------------------------
$converge = $this->registry->DB()->buildAndFetch(array('select' => '*', 'from' => 'converge_local', 'where' => "converge_api_code='" . $reg_code . "' AND converge_product_id=" . $reg_product_id));
//-----------------------------------------
// Got it?
//-----------------------------------------
if ($converge['converge_api_code']) {
$this->registry->DB()->update('converge_local', array('converge_active' => 0));
$this->registry->DB()->update('converge_local', array('converge_active' => 1), "converge_api_code = '" . $reg_code . "'");
//-----------------------------------------
// Update log in methods
//-----------------------------------------
$this->registry->DB()->update("login_methods", array("login_enabled" => 1, "login_login_url" => '', "login_maintain_url" => '', 'login_user_id' => 'email', "login_logout_url" => '', "login_register_url" => ''), "login_folder_name='ipconverge'");
$cache = array();
$this->registry->DB()->build(array('select' => '*', 'from' => 'login_methods', 'where' => 'login_enabled=1'));
$this->registry->DB()->execute();
while ($r = $this->registry->DB()->fetch()) {
$cache[$r['login_id']] = $r;
}
ipsRegistry::cache()->setCache('login_methods', $cache, array('array' => 1, 'deletefirst' => 1));
$this->classApiServer->apiSendReply(array('handshake_updated' => 1));
} else {
$this->classApiServer->apiSendError(500, $this->lang->words['no_handshake']);
return false;
}
}
示例9: _sendNewPersonalTopic
/**
* Sends the PM
*
* @access private
* @return void, or HTML form
*/
private function _sendNewPersonalTopic()
{
//-----------------------------------------
// INIT
//-----------------------------------------
if ($this->messengerFunctions->checkHasHitMax()) {
$this->registry->getClass('output')->showError('maxperday_hit', 10272);
}
$msgTitle = IPSText::getTextClass('bbcode')->stripBadWords(trim(IPSText::parseCleanValue($_POST['msg_title'])));
$authKey = $this->request['auth_key'];
$sendToName = $this->request['entered_name'];
$sendToID = intval($this->request['toMemberID']);
$sendType = trim($this->request['sendType']);
$_inviteUsers = trim($this->request['inviteUsers']);
$msgContent = $_POST['Post'];
$topicID = $this->request['topicID'];
$inviteUsers = array();
$draft = $this->request['save'] ? TRUE : FALSE;
//-----------------------------------------
// Error checking
//-----------------------------------------
if (IPSText::mbstrlen(trim($msgTitle)) < 2) {
return $this->_showNewTopicForm($this->lang->words['err_no_title']);
}
if (IPSText::mbstrlen(trim(IPSText::br2nl($_POST['Post']))) < 3) {
return $this->_showNewTopicForm($this->lang->words['err_no_msg']);
}
if ($this->request['auth_key'] != $this->member->form_hash) {
$this->registry->getClass('output')->_showNewTopicForm('messenger_bad_key', 2024);
}
if ($sendToID and $sendToName == "") {
return $this->_showNewTopicForm($this->lang->words['err_no_chosen_member']);
}
//-----------------------------------------
// Invite Users
//-----------------------------------------
if ($this->memberData['g_max_mass_pm'] and $_inviteUsers) {
$_tmp = array();
foreach (explode(',', $_inviteUsers) as $name) {
$name = trim($name);
if ($name) {
$inviteUsers[] = $name;
}
}
}
//-----------------------------------------
// Grab member ID
//-----------------------------------------
$toMember = $sendToID ? IPSMember::load($sendToID, 'core') : IPSMember::load($sendToName, 'core', 'displayname');
if (!$toMember['member_id']) {
return $this->_showNewTopicForm($this->lang->words['err_no_chosen_member']);
}
//-----------------------------------------
// Send .. or.. save...
//-----------------------------------------
try {
$this->messengerFunctions->sendNewPersonalTopic($toMember['member_id'], $this->memberData['member_id'], $inviteUsers, $msgTitle, $msgContent, array('isDraft' => $draft, 'topicID' => $topicID, 'sendMode' => $sendType, 'postKey' => $this->_postKey));
} catch (Exception $error) {
$msg = $error->getMessage();
if (strstr($msg, 'BBCODE_')) {
$msg = str_replace('BBCODE_', '', $msg);
return $this->_showNewTopicForm($this->lang->words[$msg]);
} else {
if (isset($this->lang->words['err_' . $msg])) {
$_msgString = $this->lang->words['err_' . $msg];
$_msgString = str_replace('#NAMES#', implode(",", $this->messengerFunctions->exceptionData), $_msgString);
$_msgString = str_replace('#TONAME#', $toMember['members_display_name'], $_msgString);
$_msgString = str_replace('#FROMNAME#', $this->memberData['members_display_name'], $_msgString);
$_msgString = str_replace('#DATE#', $this->messengerFunctions->exceptionData[0], $_msgString);
} else {
$_msgString = $this->lang->words['err_UNKNOWN'] . ' ' . $msg;
}
}
return $this->_showNewTopicForm($_msgString);
}
//-----------------------------------------
// Swap and serve...
//-----------------------------------------
if ($draft !== TRUE) {
$text = str_replace("<#FROM_MEMBER#>", $this->memberData['members_display_name'], $this->lang->words['sent_text']);
$text = str_replace("<#MESSAGE_TITLE#>", $msgTitle, $text);
} else {
$text = "Your message has been saved as a draft";
}
$this->registry->getClass('output')->redirectScreen($text, $this->settings['base_url'] . 'app=members&module=messaging&section=view&do=inbox');
}
示例10: rssImportRebuildCache
//.........這裏部分代碼省略.........
}
$count++;
}
/* Anything left? */
if (!count($final_items)) {
continue;
}
/* Figure out MID */
$member = $this->DB->buildAndFetch(array('select' => 'member_id, name, members_display_name, ip_address', 'from' => 'members', 'where' => "member_id={$row['rss_import_mid']}"));
if (!$member['member_id']) {
continue;
}
/* Set member in post class */
$this->post->setAuthor($member['member_id']);
$this->post->setForumData($this->registry->getClass('class_forums')->forum_by_id[$row['rss_import_forum_id']]);
$this->post->setBypassPermissionCheck(true);
$this->post->setForumID($row['rss_import_forum_id']);
/* Make 'dem posts */
$affected_forum_ids[] = $row['rss_import_forum_id'];
/* Get editor */
$classToLoad = IPSLib::loadLibrary(IPS_ROOT_PATH . 'sources/classes/editor/composite.php', 'classes_editor_composite');
$editor = new $classToLoad();
/* Force RTE */
$editor->setForceRte(true);
$editor->setRteEnabled(true);
$editor->setLegacyMode(false);
foreach ($final_items as $topic_item) {
/* Fix & */
$topic_item['title'] = str_replace('&', '&', $topic_item['title']);
$topic_item['title'] = str_replace(array("\r", "\n"), ' ', $topic_item['title']);
$topic_item['title'] = str_replace(array("<br />", "<br>"), ' ', $topic_item['title']);
$topic_item['title'] = trim($topic_item['title']);
$topic_item['title'] = strip_tags($topic_item['title']);
$topic_item['title'] = IPSText::parseCleanValue($topic_item['title']);
/* Fix up &reg; */
$topic_item['title'] = str_replace('&reg;', '®', $topic_item['title']);
if ($row['rss_import_topic_pre']) {
$topic_item['title'] = str_replace(' ', ' ', str_replace('&nbsp;', ' ', $row['rss_import_topic_pre'])) . ' ' . $topic_item['title'];
}
$this->post->setTopicTitle(IPSText::mbsubstr($topic_item['title'], 0, $this->settings['topic_title_max_len']));
$this->post->setDate($topic_item['unixdate']);
$this->post->setPublished($row['rss_import_topic_hide'] ? false : true);
$this->post->setPublishedRedirectSkip(true);
/* Clean up.. */
$topic_item['content'] = preg_replace("#<br />(\r)?\n#is", "<br />", $topic_item['content']);
if (!$row['rss_import_allow_html']) {
$topic_item['content'] = stripslashes($topic_item['content']);
$post_content = $editor->process($topic_item['content']);
} else {
$post_content = stripslashes($topic_item['content']);
}
/* Add in Show link... */
if ($row['rss_import_showlink'] and $topic_item['link']) {
$the_link = str_replace('{url}', trim($topic_item['link']), $row['rss_import_showlink']);
$the_link = "<br /><br />" . stripslashes($the_link);
$post_content .= $the_link;
}
/* Make sure HTML mode is enabled correctly */
$this->request['post_htmlstatus'] = 1;
/* Prevent invalid img extensions from breaking */
$_hack = $this->settings['img_ext'];
$_zack = $this->settings['max_quotes_per_post'];
$this->settings['img_ext'] = null;
$this->settings['max_quotes_per_post'] = 500;
$tmpForum = $this->post->getForumData();
$tmpAuthor = $this->post->getAuthor();
示例11: track
/**
* Track
*
* @param string HTTP Referrer
* @param string Query string
* @param int Member ID
*/
public static function track($referrer, $queryString, $memberId)
{
foreach (self::$engines as $engine) {
if (preg_match($engine['match'], $referrer)) {
$obj = new self();
$keywords = trim($obj->{$engine['parser']}($referrer));
if (!empty($keywords)) {
ipsRegistry::DB()->allow_sub_select = 1;
ipsRegistry::DB()->loadCacheFile(IPSLib::getAppDir('core') . '/sql/' . ips_DBRegistry::getDriverType() . '_seo_queries.php', 'core_seo_queries');
ipsRegistry::DB()->buildFromCache('ipseo_increment_keyword_count', IPSText::parseCleanValue($keywords), 'core_seo_queries');
ipsRegistry::DB()->allow_sub_select = 1;
ipsRegistry::DB()->execute();
ipsRegistry::DB()->insert('search_visitors', array('date' => time(), 'member' => intval($memberId), 'engine' => $engine['name'], 'keywords' => $keywords, 'url' => $queryString));
}
break;
}
}
}
示例12: get
/**
* Get a cookie.
* Abstract layer allows us to do some checking, etc
*
* @access public
* @param string Cookie name
* @return mixed
* @since 2.0
*/
public static function get($name)
{
/* Check internal data first */
if (isset(self::$_cookiesSet[$name])) {
return self::$_cookiesSet[$name];
} else {
if (isset($_COOKIE[ipsRegistry::$settings['cookie_id'] . $name])) {
$_value = $_COOKIE[ipsRegistry::$settings['cookie_id'] . $name];
if (substr($_value, 0, 2) == 'a:') {
return unserialize(stripslashes(urldecode($_value)));
} else {
return IPSText::parseCleanValue(urldecode($_value));
}
} else {
return FALSE;
}
}
}
示例13: _search
/**
* Search. Do it.
*
* @param string Any error text
* @return string returns HTML
*/
protected function _search($error = '')
{
//-----------------------------------------
// INIT
//-----------------------------------------
$start = intval($this->request['st']);
$p_end = $this->settings['show_max_msg_list'] > 0 ? $this->settings['show_max_msg_list'] : 50;
$searchFor_TAINTED = IPSText::parseCleanValue(urldecode($_REQUEST['searchFor']));
$searchIn = '';
/* Got an error? */
if ($error) {
$this->_errorString = $error;
}
/* Search for owt? */
if (!$searchFor_TAINTED) {
$error = $this->lang->words['search_convo_no_keywords'];
} else {
if ($this->settings['min_search_word'] && strlen($searchFor_TAINTED) < $this->settings['min_search_word']) {
$error = sprintf($this->lang->words['search_term_short'], $this->settings['min_search_word']);
} else {
$searchResults = $this->messengerFunctions->searchMessages($this->memberData['member_id'], $searchFor_TAINTED, $start, $p_end, array());
$totalMsg = $searchResults['totalMatches'];
$messages = $searchResults['results'];
/* Got anything? */
if (!$totalMsg or !count($messages)) {
$error = $this->lang->words['search_convo_no_results'];
}
}
}
//-----------------------------------------
// Generate Pagination
//-----------------------------------------
$pages = $this->registry->getClass('output')->generatePagination(array('totalItems' => $totalMsg, 'itemsPerPage' => $p_end, 'currentStartValue' => $start, 'baseUrl' => "app=members&module=messaging&section=search&do=search&searchFor=" . urlencode($searchFor_TAINTED)));
//-----------------------------------------
// Set title
//-----------------------------------------
$this->_title = $this->lang->words['t_welcome'] . ' ' . $this->lang->words['search_results_pt'];
//-----------------------------------------
// Set navigation
//-----------------------------------------
//$this->_navigation[] = array( $this->messengerFunctions->_dirData[ $this->messengerFunctions->_currentFolderID ]['real'], $this->settings['base_url']."app=members&module=messaging&section=view&do=showFolder&folderID=".$this->messengerFunctions->_currentFolderID."&sort=".$this->request['sort'] );
//-----------------------------------------
// Done...
//-----------------------------------------
return $this->registry->getClass('output')->getTemplate('messaging')->showSearchResults($messages, $pages, $error);
}
示例14: uploadPhoto
/**
* Upload personal photo function
* Assumes all security checks have been performed by this point
*
* @access public
* @param integer [Optional] member id instead of current member
* @return array [ error (error message), status (status message [ok/fail] ) ]
*/
public function uploadPhoto($member_id = 0)
{
//-----------------------------------------
// INIT
//-----------------------------------------
$return = array('error' => '', 'status' => '', 'final_location' => '', 'final_width' => '', 'final_height' => '', 't_final_location' => '', 't_final_width' => '', 't_final_height' => '');
$member_id = $member_id ? intval($member_id) : intval($this->memberData['member_id']);
$memberData = IPSMember::load($member_id);
$real_name = '';
$upload_dir = '';
$t_real_name = '';
$p_max = $memberData['photoMaxKb'];
if (IN_ACP) {
$p_max = 10000;
}
if (!$member_id) {
return array('status' => 'cannot_find_member');
}
/* Fix up upload directory */
$paths = $this->_getProfileUploadPaths();
$upload_path = $paths['path'];
$upload_dir = $paths['dir'];
/* Check for an upload */
if ($_FILES['upload_photo']['name'] != "" and $_FILES['upload_photo']['name'] != "none") {
if (!IPSMember::canUploadPhoto($memberData)) {
$return['status'] = 'fail';
$return['error'] = 'no_photo_upload_permission';
return $return;
}
$real_name = 'photo-' . $member_id;
/* Fetch library */
require_once IPS_KERNEL_PATH . 'classUpload.php';
/*noLibHook*/
$upload = new classUpload();
/* Bit of set up */
$upload->out_file_name = 'photo-' . $member_id;
$upload->out_file_dir = $upload_path;
$upload->max_file_size = $p_max * 1024;
$upload->upload_form_field = 'upload_photo';
/* Set up our allowed types */
$upload->allowed_file_ext = array('gif', 'png', 'jpg', 'jpeg');
/* http://community.invisionpower.com/resources/bugs.html/_/ip-board/problem-change-avatar-too-large-r42679 This is not ideal but is no longer an issue in 4.x - the alternative is a lot of refactoring of classUpload */
$filename = IPSText::parseCleanValue(str_replace(array('<', '>'), '-', $_FILES['upload_photo']['name']));
$extension = $upload->_getFileExtension($filename);
if ($_FILES['upload_photo']['size'] <= $upload->max_file_size && in_array($extension, $upload->allowed_file_ext)) {
/* Remove any current photos - http://community.invisionpower.com/resources/bugs.html/_/ip-board/profile-picture-not-removed-on-replacement-r41405 */
$this->removeUploadedPhotos($member_id, $upload_path);
}
/* Upload */
$upload->process();
/* Oops, what happened? */
if ($upload->error_no) {
switch ($upload->error_no) {
case 1:
// No upload
$return['status'] = 'fail';
$return['error'] = 'upload_failed';
break;
case 2:
// Invalid file ext
$return['status'] = 'fail';
$return['error'] = 'invalid_file_extension';
break;
case 3:
// Too big...
$return['status'] = 'fail';
$return['error'] = 'upload_to_big';
break;
case 4:
// Cannot move uploaded file
$return['status'] = 'fail';
$return['error'] = 'upload_failed';
break;
case 5:
// Possible XSS attack (image isn't an image)
$return['status'] = 'fail';
$return['error'] = 'upload_failed';
break;
}
return $return;
}
/* We got this far.. */
$real_name = $upload->parsed_file_name;
$t_real_name = $upload->parsed_file_name;
/* Now build sized copies */
$return = $this->buildSizedPhotos($upload->parsed_file_name, $member_id);
}
return $return;
}
示例15: define
if ($row["members_pass_hash"] == "ffffffffffffffffffffffffffffffff") {
if (!defined('IPS_ENFORCE_ACCESS')) {
define('IPS_ENFORCE_ACCESS', true);
}
if (!defined('IPB_THIS_SCRIPT')) {
define('IPB_THIS_SCRIPT', 'public');
}
if (!isset($THIS_BASEPATH) || empty($THIS_BASEPATH)) {
$THIS_BASEPATH = dirname(__FILE__);
}
require_once $THIS_BASEPATH . '/ipb/initdata.php';
require_once IPS_ROOT_PATH . 'sources/base/ipsRegistry.php';
require_once IPS_ROOT_PATH . 'sources/base/ipsController.php';
$registry = ipsRegistry::instance();
$registry->init();
$password = IPSText::parseCleanValue(urldecode(trim($pwd)));
$ipbhash = md5(md5($row["members_pass_salt"]) . md5($password));
$salt = pass_the_salt(5);
$rehash = md5(md5($salt) . md5($password));
IPSMember::save($row["ipb_fid"], array("members" => array("member_login_key" => "", "member_login_key_expire" => "0", "members_pass_hash" => "{$rehash}", "members_pass_salt" => "{$salt}")));
set_ipb_cookie($row["ipb_fid"]);
} else {
set_ipb_cookie($row["ipb_fid"]);
}
}
if (isset($_GET["returnto"])) {
$url = urldecode($_GET["returnto"]);
} else {
$url = "index.php";
}
//Invalid Login System Hack