本文整理汇总了PHP中strxlen函数的典型用法代码示例。如果您正苦于以下问题:PHP strxlen函数的具体用法?PHP strxlen怎么用?PHP strxlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strxlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
}
}
if (array_empty($boards)) {
$boards = $slog->getBoards();
}
$sql_where = $slog->sqlinboards('r.board', 1, $boards) . " ";
if (count($used) > 0) {
$sql_where .= "({$sql_where_like}) ";
}
if (empty($rname) == false) {
if (count($used) > 0) {
$sql_where .= "AND ";
}
$sql_where .= "r.name = '{$rname}' ";
}
if (strxlen($name) >= $config['searchminlength']) {
$used[] = $name;
} else {
$ignored[] = $name;
}
$having = '';
$temp = $gpc->get('temp', int);
$temp2 = $gpc->get('temp2', int);
if ($temp > 0 && $temp < 366) {
$sql_where .= "AND t.last ";
if ($temp2 == 1) {
$sql_where .= '<=';
} else {
$sql_where .= '>=';
}
$timestamp = time() - 60 * 60 * 24 * $temp;
示例2: highlight
function highlight($text)
{
if (isset($this->profile['highlight']) && count($this->profile['highlight']) > 0) {
$class = $this->profile['highlight_class'];
foreach ($this->profile['highlight'] as $token) {
if (strxlen($token) > 2) {
$text = str_replace('\\"', '"', substr(preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "preg_replace('#\\b(" . $token . ")\\b#i', '<span class=\"" . $class . "\">\\\\1</span>', '\\0')", '>' . $text . '<'), 1, -1));
}
}
}
return $text;
}
示例3: while
$result = $db->query("SELECT id, answer FROM {$db->pre}vote WHERE tid = '{$info['id']}' ORDER BY id", __LINE__, __FILE__);
while ($row = $db->fetch_assoc($result)) {
$data['answer'][$row['id']] = $row['answer'];
$data['original'][$row['id']] = $row['answer'];
}
$data[0] = '';
}
$i = 0;
echo $tpl->parse("menu");
echo $tpl->parse("admin/topic/vote_edit");
} elseif ($action == "vote_edit2") {
$error = array();
if (strxlen($_POST['question']) > $config['maxtitlelength']) {
$error[] = $lang->phrase('question_too_long');
}
if (strxlen($_POST['question']) < $config['mintitlelength']) {
$error[] = $lang->phrase('question_too_short');
}
if (count_filled($_POST['notice']) < 2) {
$error[] = $lang->phrase('min_replies_vote');
}
if (count_filled($_POST['notice']) > 50) {
$error[] = $lang->phrase('max_replies_vote');
}
if (count($error) > 0) {
$data = array('question' => $_POST['question'], 'answer' => $_POST['notice']);
$fid = save_error_data($data);
error($error, 'managetopic.php?action=vote_edit&id=' . $_GET['id'] . "&fid=" . $fid . SID2URL_x);
} else {
$db->query("UPDATE {$db->pre}topics SET vquestion = '{$_POST['question']}' WHERE id = '{$_GET['id']}' LIMIT 1", __LINE__, __FILE__);
$result = $db->query("SELECT id, answer FROM {$db->pre}vote WHERE tid = '{$info['id']}' ORDER BY id", __LINE__, __FILE__);
示例4: array
if (double_udata('mail', $_POST['email']) == false) {
$error[] = $lang->phrase('email_already_used');
}
if (strxlen($_POST['name']) > $config['maxnamelength']) {
$error[] = $lang->phrase('name_too_long');
}
if (strxlen($_POST['name']) < $config['minnamelength']) {
$error[] = $lang->phrase('name_too_short');
}
if (strxlen($_POST['pw']) > $config['maxpwlength']) {
$error[] = $lang->phrase('pw_too_long');
}
if (strxlen($_POST['pw']) < $config['minpwlength']) {
$error[] = $lang->phrase('pw_too_short');
}
if (strxlen($_POST['email']) > 200) {
$error[] = $lang->phrase('email_too_long');
}
if (check_mail($_POST['email']) == false) {
$error[] = $lang->phrase('illegal_mail');
}
if ($_POST['pw'] != $_POST['pwx']) {
$error[] = $lang->phrase('pw_comparison_failed');
}
// Custom profile fields
$upquery = array();
$query = $db->query("SELECT * FROM {$db->pre}profilefields WHERE editable != '0' AND required = '1' ORDER BY disporder");
while ($profilefield = $db->fetch_assoc($query)) {
$profilefield['type'] = $gpc->prepare($profilefield['type']);
$thing = explode("\n", $profilefield['type'], 2);
$type = $thing[0];
示例5: explode
$bbcode->setReplace($config['wordstatus']);
if ($topic['status'] == 2) {
$row['comment'] = $bbcode->ReplaceTextOnce($row['comment'], 'moved');
}
$text = $bbcode->parse($row['comment'], 'plain');
if (!empty($my->notice)) {
$notes = explode('[VSEP]', $my->notice);
if (!is_array($notes)) {
$notes = array($notes);
}
} else {
$notes = array();
}
$setnotice = $lang->get_text('notice');
$notes[] = str_replace('[VSEP]', '[VSEP]', $setnotice);
if (strxlen(implode('', $notes)) > $config['maxnoticelength']) {
error($lang->phrase('notices_too_long'));
}
$db->query("UPDATE {$db->pre}user SET notice = '" . implode('[VSEP]', $notes) . "' WHERE id = '" . $my->id . "'", __LINE__, __FILE__);
ok($lang->phrase('text_to_notice_success'));
} else {
$breadcrumb->ResetUrl();
echo $tpl->parse("header");
echo $tpl->parse("menu");
echo $tpl->parse("editprofile/index");
$mymodules->load('editprofile_index_bottom');
}
$slog->updatelogged();
$zeitmessung = t2();
echo $tpl->parse("footer");
$phpdoc->Out();
示例6: elseif
} elseif ($_GET['action'] == "profile2") {
$_POST['hp'] = trim($_POST['hp']);
if (strtolower(substr($_POST['hp'], 0, 4)) == 'www.') {
$_POST['hp'] = "http://{$_POST['hp']}";
}
$error = array();
if (check_mail($_POST['email']) == false) {
$error[] = $lang->phrase('illegal_mail');
}
if ($my->mail != $_POST['email'] && double_udata('mail', $_POST['email']) == false) {
$error[] = $lang->phrase('email_already_used');
}
if ($config['changename_allowed'] == 1 && strxlen($_POST['name']) > $config['maxnamelength']) {
$error[] = $lang->phrase('name_too_long');
}
if ($config['changename_allowed'] == 1 && strxlen($_POST['name']) < $config['minnamelength']) {
$error[] = $lang->phrase('name_too_short');
}
if ($config['changename_allowed'] == 1 && strtolower($my->name) != strtolower($_POST['name']) && double_udata('name', $_POST['name']) == false) {
$error[] = $lang->phrase('username_registered');
}
if (strlen($_POST['email']) > 200) {
$error[] = $lang->phrase('email_too_long');
}
if (strlen($_POST['hp']) > 255) {
$error[] = $lang->phrase('editprofile_homepage_too_long');
}
if (!check_hp($_POST['hp'])) {
$_POST['hp'] = '';
}
if (strlen($_POST['location']) > 50) {
示例7: eval
$pnameid = $my->id;
$pid = $my->id;
}
if (flood_protect() == FALSE) {
$error[] = $lang->phrase('flood_control');
}
if (strxlen($_POST['comment']) > $config['maxpostlength']) {
$error[] = $lang->phrase('comment_too_long');
}
if (strxlen($_POST['comment']) < $config['minpostlength']) {
$error[] = $lang->phrase('comment_too_short');
}
if (strxlen($_POST['topic']) > $config['maxtitlelength']) {
$error[] = $lang->phrase('title_too_long');
}
if (strxlen($_POST['topic']) < $config['mintitlelength']) {
$error[] = $lang->phrase('title_too_short');
}
($code = $plugins->load('addreply_save_errorhandling')) ? eval($code) : null;
BBProfile($bbcode);
$_POST['topic'] = $bbcode->parseTitle($_POST['topic']);
if (count($error) > 0 || !empty($_POST['Preview'])) {
$data = array('topic' => $_POST['topic'], 'comment' => $_POST['comment'], 'dosmileys' => $_POST['dosmileys'], 'dowords' => $_POST['dowords'], 'id' => $_POST['id'], 'digest' => $digest, 'guest' => 0, 'human' => $human);
if (!$my->vlogin) {
if ($config['guest_email_optional'] == 0 && empty($_POST['email'])) {
$data['email'] = '';
} else {
$data['email'] = $_POST['email'];
}
$data['guest'] = 1;
$data['name'] = $_POST['name'];
示例8: strtolower
if ($im == true) {
$colspan++;
}
$_GET['order'] = strtolower($_GET['order']);
if ($_GET['order'] != 'desc') {
$_GET['order'] = 'asc';
}
$_GET['sort'] = strtolower($_GET['sort']);
if ($_GET['sort'] != 'hp' && $_GET['sort'] != 'online' && $_GET['sort'] != 'posts' && $_GET['sort'] != 'regdate' && $_GET['sort'] != 'location' && $_GET['sort'] != 'gender' && $_GET['sort'] != 'birthday' && $_GET['sort'] != 'lastvisit') {
$sqlorderby = "name {$_GET['order']}";
} else {
$sqlorderby = "{$_GET['sort']} {$_GET['order']}, name {$_GET['order']}";
}
$sqlwhere = array();
$_GET['letter'] = $gpc->get('letter', db_esc);
if (strxlen($_GET['letter']) == 1) {
if ($_GET['letter'] == '#') {
$sqlwhere[] = "LEFT(name, 1) REGEXP '^[^" . implode('', $available) . "]'";
} else {
$sqlwhere[] = "LEFT(name, 1) = '{$_GET['letter']}'";
}
}
if ($config['mlist_showinactive'] == 0) {
$sqlwhere[] = "confirm = '11'";
}
$groups = array();
$g = $gpc->get('g', arr_int);
if ($config['mlist_filtergroups'] > 0) {
$group_cache = $scache->load('groups');
$statusdata = $group_cache->status();
foreach ($statusdata as $id => $row) {
示例9: editprofile_customsave
function editprofile_customsave($editable, $uid)
{
global $db, $lang, $gpc;
$error = array();
$upquery = array();
$query = $db->query("SELECT * FROM {$db->pre}profilefields WHERE editable = '{$editable}' ORDER BY disporder");
while ($profilefield = $db->fetch_assoc($query)) {
$thing = explode("\n", $profilefield['type'], 2);
$type = $thing[0];
$field = "fid{$profilefield['fid']}";
$value = $gpc->get($field, none);
if ($profilefield['required'] == 1 && (empty($value) || is_array($value) && count($value) == 0)) {
$error[] = $lang->phrase('error_missingrequiredfield');
}
if ($profilefield['maxlength'] > 0 && (is_string($value) && strxlen($value) > $profilefield['maxlength'] || is_array($value) && count($value) > $profilefield['maxlength'])) {
$error[] = $lang->phrase('error_customfieldtoolong');
}
if (($type == "multiselect" || $type == "checkbox") && is_array($value)) {
if (is_array($value)) {
$options = implode("\n", $value);
} else {
$options = '';
}
} else {
$options = $value;
}
$upquery[$field] = $gpc->save_str($options);
}
if (count($error) == 0 && count($upquery) > 0) {
$query = $db->query("SELECT * FROM {$db->pre}userfields WHERE ufid='{$uid}'");
if ($db->num_rows($query) == 0) {
$fields = $db->list_fields("{$db->pre}userfields");
$sqldata = array();
foreach ($fields as $field) {
if (isset($upquery[$field])) {
$sqldata[$field] = "'{$upquery[$field]}'";
} else {
$sqldata[$field] = "''";
}
}
$sqldata['ufid'] = "'{$uid}'";
$fields = implode(', ', $fields);
$sqldata = implode(', ', $sqldata);
$db->query("INSERT INTO {$db->pre}userfields ({$fields}) VALUES ({$sqldata})", __LINE__, __FILE__);
} else {
$sqldata = array();
foreach ($upquery as $field => $value) {
$sqldata[] = "{$field} = '{$value}'";
}
$sqldata = implode(', ', $sqldata);
$db->query("UPDATE {$db->pre}userfields SET {$sqldata} WHERE ufid = '{$uid}' LIMIT 1", __LINE__, __FILE__);
}
}
return $error;
}
示例10:
if (double_udata('name',$_POST['name']) == false) {
$error[] = $lang->phrase('username_registered');
}
if (double_udata('mail',$_POST['email']) == false) {
$error[] = $lang->phrase('email_already_used');
}
if (strxlen($_POST['name']) > $config['maxnamelength']) {
$error[] = $lang->phrase('name_too_long');
}
if (strxlen($_POST['name']) < $config['minnamelength']) {
$error[] = $lang->phrase('name_too_short');
}
if (strxlen($_POST['pw']) > $config['maxpwlength']) {
$error[] = $lang->phrase('pw_too_long');
}
if (strxlen($_POST['pw']) < $config['minpwlength']) {
$error[] = $lang->phrase('pw_too_short');
}
if (strlen($_POST['email']) > 200) {
$error[] = $lang->phrase('email_too_long');
}
if (check_mail($_POST['email']) == false) {
$error[] = $lang->phrase('illegal_mail');
}
if ($_POST['pw'] != $_POST['pwx']) {
$error[] = $lang->phrase('pw_comparison_failed');
}
// Custom profile fields
$custom = addprofile_customprepare();
$error = array_merge($error, $custom['error']);
示例11: highlight
function highlight($text)
{
if (isset($this->profile['highlight']) && count($this->profile['highlight']) > 0) {
$class = htmlspecialchars($this->profile['highlight_class'], ENT_QUOTES);
foreach ($this->profile['highlight'] as $token) {
if (strxlen($token) > 2) {
$token = preg_quote($token, '#');
$text = str_replace('\\"', '"', substr(preg_replace('#(\\>(((?>([^><]+|(?R)))*)\\<))#se', "preg_replace('#\\b({$token})\\b#i', '<span class=\"{$class}\">\\\\1</span>', '\\0')", ">{$text}<"), 1, -1));
}
}
}
return $text;
}
示例12: editprofile_customsave
function editprofile_customsave($editable, $uid)
{
global $db, $lang, $gpc;
$error = array();
$upquery = array();
$query = $db->query("SELECT * FROM {$db->pre}profilefields WHERE editable = '{$editable}' ORDER BY disporder");
while ($profilefield = $db->fetch_assoc($query)) {
$profilefield['type'] = $gpc->prepare($profilefield['type']);
$thing = explode("\n", $profilefield['type'], 2);
$type = $thing[0];
$field = "fid{$profilefield['fid']}";
$value = $gpc->get($field, none);
if ($profilefield['required'] == 1 && (is_string($value) && strlen($value) == 0 || is_array($value) && count($value) == 0)) {
$error[] = $lang->phrase('error_missingrequiredfield');
}
if ($profilefield['maxlength'] > 0 && (is_string($value) && strxlen($value) > $profilefield['maxlength'] || is_array($value) && count($value) > $profilefield['maxlength'])) {
$error[] = $lang->phrase('error_customfieldtoolong');
}
if (($type == "multiselect" || $type == "checkbox") && is_array($value)) {
if (is_array($value)) {
$options = implode("\n", $value);
} else {
$options = '';
}
} else {
$options = $value;
}
$options = $gpc->save_str($options);
$upquery[] = "`{$field}` = '{$options}'";
}
if (count($error) == 0 && count($upquery) > 0) {
$query = $db->query("SELECT * FROM {$db->pre}userfields WHERE ufid='{$uid}'");
if ($db->num_rows($query) == 0) {
$db->query("INSERT INTO {$db->pre}userfields (ufid) VALUES ('{$uid}')");
}
$db->query("UPDATE {$db->pre}userfields SET " . implode(', ', $upquery) . " WHERE ufid = '{$uid}' LIMIT 1");
}
return $error;
}
示例13: cb_table
function cb_table($text, $tag)
{
$length = array();
$lines = explode("\n", $text);
$char = chr(7);
foreach ($lines as $line) {
if (empty($line)) {
continue;
}
$i = 0;
$td = explode("\t", $line);
foreach ($td as $cell) {
$cell = strip_tags($cell);
$tab_pos = strxlen($cell);
$min = $tab_pos / 4 - floor($tab_pos / 4);
$tab = (1 - $min) * 4;
if ($tab < 1) {
$tab = 4;
}
$line = strlen($cell) + $tab;
if (!isset($result[$i]) || $line > $result[$i]) {
$result[$i] = $line;
}
$i++;
}
}
$table = array();
foreach ($lines as $line) {
if (empty($line)) {
continue;
}
$i = 0;
$td = explode("\t", $line);
$line = '';
foreach ($td as $cell) {
$spaces = $result[$i];
$length = strxlen(strip_tags($cell));
$min = $spaces - $length;
$tab = str_repeat($char, $min);
$line .= $cell . $tab;
$i++;
}
$table[] = $line;
}
$text = str_replace($char, ' ', implode("\n", $table));
return "<{$tag} class=\"bb_table\">{$text}</{$tag}>";
}
示例14: BoardSelect
function BoardSelect($board = 0)
{
global $config, $my, $tpl, $db, $gpc, $lang, $scache, $plugins, $slog;
$found = false;
$sub_cache = $forum_cache = $last_cache = $forums = $cat = array();
$categories_obj = $scache->load('categories');
$cat_cache = $categories_obj->get();
$memberdata_obj = $scache->load('memberdata');
$memberdata = $memberdata_obj->get();
$index_moderators = $scache->load('index_moderators');
$mod_cache = $index_moderators->get();
$prefix_obj = $scache->load('prefix');
$prefix = $prefix_obj->get();
($code = $plugins->load('forums_query')) ? eval($code) : null;
// Fetch Forums
$result = $db->query("\n\tSELECT\n\t\tf.id, f.name, f.description, f.opt, f.optvalue, f.parent, f.topics, f.replies, f.last_topic, f.invisible,\n\t\tt.topic as l_topic, t.prefix AS l_prefix, t.id as l_tid, t.last as l_date, u.name AS l_uname, t.last_name AS l_name, f.id AS l_bid\n\tFROM {$db->pre}forums AS f\n\t\tLEFT JOIN {$db->pre}topics AS t ON f.last_topic=t.id\n\t\tLEFT JOIN {$db->pre}user AS u ON t.last_name=u.id\n\tORDER BY f.parent, f.position\n\t");
$keys = array('l_prefix' => null, 'l_topic_full' => null, 'l_topic' => null, 'l_tid' => null, 'l_date' => null, 'l_uname' => null, 'l_name' => null, 'l_bid' => null);
while ($row = $db->fetch_assoc($result)) {
$row['name'] = $gpc->prepare($row['name']);
$row['l_uname'] = $gpc->prepare($row['l_uname']);
$row['l_name'] = $gpc->prepare($row['l_name']);
$row['bid'] = $cat_cache[$row['parent']]['parent'];
// Caching for Subforums
if (!empty($row['bid'])) {
$sub_cache[$row['bid']][] = $row;
}
// Caching the Forums
if ($row['bid'] == $board) {
$forum_cache[$row['parent']][] = $row;
}
$last_cache[$row['id']] = $row;
($code = $plugins->load('forums_caching')) ? eval($code) : null;
}
$cats = array();
$hidden = 0;
// Work with the chached data!
foreach ($cat_cache as $cat) {
$cat['forums'] = array();
if (isset($forum_cache[$cat['id']]) == false) {
continue;
}
foreach ($forum_cache[$cat['id']] as $forum) {
$found = true;
$forum['new'] = false;
$forum['show'] = true;
// Subforendaten vererben (Letzter Beitrag, Markierung)
if (isset($sub_cache[$forum['id']])) {
$substats = SubStats($forum['topics'], $forum['replies'], $forum['id'], $sub_cache);
$forum['topics'] = $substats[0];
$forum['replies'] = $substats[1];
}
// Letzter Beitrag
$last = $last_cache[$forum['id']];
if (isset($sub_cache[$forum['id']])) {
foreach ($substats[2] as $last_bid) {
$sub = $last_cache[$last_bid];
if ($last['l_date'] < $sub['l_date'] && check_forumperm($sub)) {
$last = $sub;
}
}
}
$forum = array_merge($forum, array_intersect_key($last, $keys));
if (is_id($forum['l_name']) && isset($memberdata[$forum['l_name']])) {
$forum['l_name'] = array($forum['l_uname'], $forum['l_name']);
} else {
$forum['l_name'] = array($forum['l_name'], 0);
}
// Rechte und Gelesensystem
if ($forum['opt'] != 're') {
if (!check_forumperm($forum)) {
if ($forum['invisible'] != 0) {
$forum['show'] = false;
}
$forum['foldimg'] = $tpl->img('cat_locked');
$forum['state'] = BOARD_STATE_LOCKED;
$forum['topics'] = '-';
$forum['replies'] = '-';
$forum['l_topic'] = false;
$forum['l_topic_full'] = '';
} else {
if ($slog->isForumRead($forum['id'], $forum['l_date']) || $forum['topics'] < 1) {
$forum['foldimg'] = $tpl->img('cat_open');
$forum['state'] = BOARD_STATE_OLD;
} else {
$forum['foldimg'] = $tpl->img('cat_red');
$forum['state'] = BOARD_STATE_NEW;
$forum['new'] = true;
}
if (!empty($forum['l_topic'])) {
if (isset($prefix[$forum['id']][$forum['l_prefix']]) && $forum['l_prefix'] > 0) {
$lang->assign('prefix', $prefix[$forum['id']][$forum['l_prefix']]['value']);
$forum['l_prefix'] = $lang->phrase('showtopic_prefix_title');
} else {
$forum['l_prefix'] = '';
}
if (strxlen($forum['l_topic']) > $config['lasttopic_chars']) {
$forum['l_topic_full'] = $forum['l_prefix'] . $forum['l_topic'];
$forum['l_topic'] = subxstr($forum['l_topic'], 0, $config['lasttopic_chars']);
$forum['l_topic'] .= "...";
} else {
//.........这里部分代码省略.........
示例15: str_replace
$row->name = $row->uname;
} else {
$row->email = $row->gmail;
$row->name = $row->gname;
}
$bbcode->setSmileys(0);
if ($config['wordstatus'] == 0) {
$row->dowords = 0;
}
$bbcode->setReplace($row->dowords);
if ($row->status == 2) {
$row->comment = $bbcode->ReplaceTextOnce($row->comment, 'moved');
}
$row->comment = $bbcode->parse($row->comment, 'plain');
$row->comment = str_replace("\n", ' ', $row->comment);
if (strxlen($row->comment) > $config['rsschars']) {
$row->comment = FeedCreator::iTrunc($row->comment, $config['rsschars']);
}
$item = new FeedItem();
$item->title = $row->topic;
$item->link = $config['furl'] . "/showtopic.php?id=" . $row->id;
$item->source = $config['furl'] . "/showforum.php?id=" . $row->board;
$item->description = $row->comment;
$item->date = $row->date;
$item->author = $row->name;
if ($config['syndication_insert_email'] == 1) {
$item->authorEmail = $row->email;
} else {
$item->authorEmail = '';
}
$item->pubDate = $row->date;