本文整理汇总了PHP中to_utf8函数的典型用法代码示例。如果您正苦于以下问题:PHP to_utf8函数的具体用法?PHP to_utf8怎么用?PHP to_utf8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了to_utf8函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fenxi
public function fenxi()
{
$othernum = 0;
$str = '';
if (IS_POST) {
$arr = $this->importtext();
$data = array();
foreach ($arr as $val) {
$v = explode(',', $val);
$k = to_utf8(preg_replace('/(\\.\\w+)\\/.*/i', '$1', $v[1]));
$data[$k] = isset($data[$k]) ? ++$data[$k] : 1;
}
//去掉小于1的链接
foreach ($data as $key => $val) {
if ($val <= 1) {
$othernum++;
} else {
$str .= empty($str) ? "['{$key}({$val})', {$val}]" : ",['{$key}({$val})', {$val}]";
}
}
//$str.=(",['小于10的外链的站点总共 $othernum 个', $othernum]");
}
$this->assign('other', "小于10个外链的站点总共 {$othernum} 个,已过滤不显示。");
$this->assign('data', $str);
return $this->fetch('fenxi');
}
示例2: recode_header
function recode_header($header, $basecharset)
{
if (strpos($header, "=?") === false) {
return to_utf8($header, $basecharset);
}
return preg_replace_callback("/=\\?(.+?)\\?([qb])\\?(.+?)(\\?=|\$)/i", function ($m) {
return decode_header($m[1], $m[2], $m[3]);
}, $header);
}
示例3: index
public function index()
{
$position = I('position');
$keywords = to_utf8(I('keywords'));
if (!empty($position)) {
$map['_string'] = "find_in_set('{$position}',position)";
}
$map['title'] = array('like', '%' . $keywords . '%');
$list = $this->pages(array('model' => 'Article', 'where' => $map, 'rows' => 6, 'order' => 'create_time desc,article_id desc'));
$this->display();
}
示例4: str
function str($str, $amp = false)
{
global $vbulletin;
if ($amp) {
$str = str_replace('&', '&', $str);
}
$charset = vB_Template_Runtime::fetchStyleVar('charset');
if ($charset == '') {
$charset = 'ISO-8859-1';
}
return to_utf8($str, $charset);
}
示例5: initialize
/** обрабатываем входные параметры скрипта, определяем запрашиваемую страницу
*
*/
public static function initialize($deep = false)
{
if (!$deep && self::$initialized) {
return;
}
$headers = @apache_request_headers();
if (array_key_exists('X-Forwarded-For', $headers)) {
$hostname = $headers['X-Forwarded-For'];
} else {
$hostname = $_SERVER["REMOTE_ADDR"];
}
self::$ip = $hostname;
self::$path_history = '';
self::$initialized = true;
// принимаем uri
$e = explode('?', $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = $e[0];
if (isset($e[1])) {
parse_str($e[1], $d);
} else {
$d = array();
}
$prepared_get = array();
foreach ($d as $name => &$val) {
$val = to_utf8($val);
$prepared_get[$name] = stripslashes($val);
}
self::$get_normal = self::$get = $prepared_get;
$path_array = explode('/', self::processRuri($_SERVER['REQUEST_URI']));
// убиваем начальный слеш
array_shift($path_array);
// определяем, что из этого uri является страницей
self::$structureFile = self::getPage($path_array, $deep);
if (self::$real_path >= 0) {
self::$structureFile = 'errors/p404.xml';
}
//die(self::$structureFile);
// разбираем параметры
self::parse_parameters($path_array);
if (isset($_POST)) {
foreach ($_POST as $f => $v) {
if (!is_array($v)) {
self::$post[$f] = stripslashes($v);
} else {
self::$post[$f] = $v;
}
}
}
unset($_POST);
unset($_GET);
self::afterAll();
}
示例6: to_utf8
function to_utf8($in)
{
if (is_array($in)) {
foreach ($in as $key => $value) {
$out[to_utf8($key)] = to_utf8($value);
}
} elseif (is_string($in)) {
if (mb_detect_encoding($in) != "UTF-8") {
return utf8_encode($in);
} else {
return $in;
}
} else {
return $in;
}
return $out;
}
示例7: initialize
/** обрабатываем входные параметры скрипта, определяем запрашиваемую страницу
*
*/
public static function initialize($deep = false) {
if (!$deep && self::$initialized)
return;
self::$path_history = '';
self::$initialized = true;
// принимаем uri
$e = explode('?', $_SERVER['REQUEST_URI']);
$_SERVER['REQUEST_URI'] = $e[0];
if (isset($e[1]))
parse_str($e[1], $d);
else
$d = array();
$prepared_get = array();
foreach ($d as $name => &$val) {
$val = to_utf8($val);
$prepared_get[$name] = stripslashes($val);
}
self::$get_normal = self::$get = $prepared_get;
$path_array = explode('/', self::processRuri($_SERVER['REQUEST_URI']));
// убиваем начальный слеш
array_shift($path_array);
// определяем, что из этого uri является страницей
self::$structureFile = self::getPage($path_array, $deep);
if (self::$real_path >= 0) {
self::$structureFile = 'errors/p404.xml';
}
//die(self::$structureFile);
// разбираем параметры
self::parse_parameters($path_array);
if (isset($_POST))
foreach ($_POST as $f => $v) {
if (!is_array($v))
self::$post[$f] = stripslashes($v);
else
self::$post[$f] = $v;
}
unset($_POST);
unset($_GET);
}
示例8: processregistered
protected function processregistered(&$value, $charset)
{
global $VB_API_REQUESTS;
if (is_array($value)) {
foreach ($value as &$el) {
$this->processregistered($el, $charset);
}
}
if (is_string($value)) {
$value = to_utf8($value, $charset, true);
if ($VB_API_REQUESTS['api_version'] < 4) {
$value = unhtmlspecialchars($value, true);
}
}
if ($VB_API_REQUESTS['api_version'] > 1 and is_bool($value)) {
if ($value) {
$value = 1;
} else {
$value = 0;
}
}
}
示例9: read_dir_pic
function read_dir_pic($main_dir = "")
{
global $xoopsDB;
$pics = "";
$post_max_size = ini_get('post_max_size');
//$size_limit=intval($post_max_size) * 0.5 * 1024 * 1024;
if (substr($main_dir, -1) != '/') {
$main_dir = $main_dir . "/";
}
if ($dh = opendir($main_dir)) {
$total_size = 0;
$i = 1;
while (($file = readdir($dh)) !== false) {
if (substr($file, 0, 1) == ".") {
continue;
}
if (is_dir($main_dir . $file)) {
$pic = read_dir_pic($main_dir . $file);
$pics .= $pic['pics'];
$total_size += $pic['total_size'];
} else {
//讀取exif資訊
$result = exif_read_data($main_dir . $file, 0, true);
$creat_date = $result['IFD0']['DateTime'];
$dir = (empty($creat_date) or substr($creat_date, 0, 1) != "2") ? date("Y_m_d") : str_replace(":", "_", substr($result['IFD0']['DateTime'], 0, 10));
$exif = mk_exif($result);
$size = filesize($main_dir . $file);
$total_size += intval($size);
$size_txt = sizef($size);
$pic = getimagesize($main_dir . $file);
$width = $pic[0];
$height = $pic[1];
$subname = strtolower(substr($file, -3));
if ($subname == "jpg" or $subname == "peg") {
$type = "image/jpeg";
} elseif ($subname == "png") {
$type = "image/png";
} elseif ($subname == "gif") {
$type = "image/gif";
} else {
$type = $subname;
continue;
}
$sql = "select width,height from " . $xoopsDB->prefix("tad_gallery") . " where filename='{$file}' and size='{$size}'";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'], 3, mysql_error());
list($db_width, $db_height) = $xoopsDB->fetchRow($result);
if ($db_width == $width and $db_height == $height) {
$checked = "disabled='disabled'";
$upload = "0";
$status = _MD_TADGAL_IMPORT_EXIST;
//}elseif($total_size >= $size_limit){
// $checked="disabled='disabled'";
// $upload="1";
// $status=sprintf(_MD_TADGAL_IMPORT_OVER_SIZE,sizef($total_size),$post_max_size);
} else {
$checked = "checked='checked'";
$upload = "1";
$status = $type;
}
if (_CHARSET == "UTF-8") {
$file = to_utf8($file);
}
$pics .= "\n <tr>\n <td style='font-size:11px'>{$i}</td>\n <td style='font-size:11px'>\n <input type='hidden' name='all[{$i}]' value='" . $main_dir . $file . "'>\n <input type='checkbox' name='import[{$i}][upload]' value='1' {$checked}>\n {$file}\n <input type='hidden' name='import[{$i}][filename]' value='{$file}'></td>\n <td style='font-size:11px'>{$dir}<input type='hidden' name='import[{$i}][dir]' value='{$dir}'></td>\n <td style='font-size:11px'>{$width} x {$height}\n <input type='hidden' name='import[{$i}][post_date]' value='{$creat_date}'>\n <input type='hidden' name='import[{$i}][width]' value='{$width}'>\n <input type='hidden' name='import[{$i}][height]' value='{$height}'></td>\n <td style='font-size:11px'>{$size_txt}<input type='hidden' name='import[{$i}][size]' value='{$size}'></td>\n <td style='font-size:11px'>{$status}\n <input type='hidden' name='import[{$i}][exif]' value='{$exif}'>\n <input type='hidden' name='import[{$i}][type]' value='{$type}'></td>\n </tr>";
$i++;
}
}
closedir($dh);
}
$main['pics'] = $pics;
$main['total_size'] = $total_size;
return $main;
}
示例10: start
/**
* Starts the process of sending an email - preps it so it's fully ready to send.
* Call send() to actually send it.
*
* @param string $toemail Destination email address
* @param string $subject Email message subject
* @param string $message Email message body
* @param string $from Optional name/email to use in 'From' header
* @param string $uheaders Additional headers
* @param string $username Username of person sending the email
*
* @return boolean True on success, false on failure
*/
public function start($toemail, $subject, $message, $from = '', $uheaders = '', $username = '')
{
$toemail = $this->fetchFirstLine($toemail);
if (empty($toemail)) {
return false;
}
$delimiter =& $this->delimiter;
$vboptions = vB::getDatastore()->getValue('options');
$toemail = vB_String::unHtmlSpecialChars($toemail);
$subject = $this->fetchFirstLine($subject);
$message = preg_replace("#(\r\n|\r|\n)#s", $delimiter, trim($message));
if ((strtolower(vB_Template_Runtime::fetchStyleVar('charset')) == 'iso-8859-1' or vB_Template_Runtime::fetchStyleVar('charset') == '') and preg_match('/&[a-z0-9#]+;/i', $message)) {
$message = utf8_encode($message);
$subject = utf8_encode($subject);
$username = utf8_encode($username);
$encoding = 'UTF-8';
$unicode_decode = true;
} else {
if ($vboptions['utf8encode']) {
$message = to_utf8($message, vB_Template_Runtime::fetchStyleVar('charset'));
$subject = to_utf8($subject, vB_Template_Runtime::fetchStyleVar('charset'));
$username = to_utf8($username, vB_Template_Runtime::fetchStyleVar('charset'));
$encoding = 'UTF-8';
$unicode_decode = true;
} else {
// we know nothing about the message's encoding in relation to UTF-8,
// so we can't modify the message at all; just set the encoding
$encoding = vB_Template_Runtime::fetchStyleVar('charset');
$unicode_decode = false;
}
}
// theses lines may need to call convert_int_to_utf8 directly
$message = vB_String::unHtmlSpecialChars($message, $unicode_decode);
$subject = $this->encodeEmailHeader(vB_String::unHtmlSpecialChars($subject, $unicode_decode), $encoding, false, false);
$from = $this->fetchFirstLine($from);
if (empty($from)) {
$vbphrase = vB_Api::instanceInternal('phrase')->fetch(array('x_mailer'));
if (isset($vbphrase['x_mailer'])) {
$mailfromname = sprintf($this->fetchFirstLine($vbphrase['x_mailer']), $vboptions['bbtitle']);
} else {
$mailfromname = $vboptions['bbtitle'];
}
if ($unicode_decode == true) {
$mailfromname = utf8_encode($mailfromname);
}
$mailfromname = $this->encodeEmailHeader(vB_String::unHtmlSpecialChars($mailfromname, $unicode_decode), $encoding);
$headers = "From: {$mailfromname} <" . $vboptions['webmasteremail'] . '>' . $delimiter;
$headers .= 'Auto-Submitted: auto-generated' . $delimiter;
// Exchange (Oh Microsoft) doesn't respect auto-generated: http://www.vbulletin.com/forum/project.php?issueid=27687
if ($vboptions['usebulkheader']) {
$headers .= 'Precedence: bulk' . $delimiter;
}
} else {
if ($username) {
$mailfromname = "{$username} @ " . $vboptions['bbtitle'];
} else {
$mailfromname = $from;
}
if ($unicode_decode == true) {
$mailfromname = utf8_encode($mailfromname);
}
$mailfromname = $this->encodeEmailHeader(vB_String::unHtmlSpecialChars($mailfromname, $unicode_decode), $encoding);
$headers = "From: {$mailfromname} <{$from}>" . $delimiter;
$headers .= "Sender: " . $vboptions['webmasteremail'] . $delimiter;
}
$fromemail = empty($vboptions['bounceemail']) ? $vboptions['webmasteremail'] : $vboptions['bounceemail'];
$headers .= 'Return-Path: ' . $fromemail . $delimiter;
$http_host = vB::getRequest()->getVbHttpHost();
if (!$http_host) {
$http_host = substr(md5($message), 12, 18) . '.vb_unknown.unknown';
}
$msgid = '<' . gmdate('YmdHis') . '.' . substr(md5($message . microtime()), 0, 12) . '@' . $http_host . '>';
$headers .= 'Message-ID: ' . $msgid . $delimiter;
$headers .= preg_replace("#(\r\n|\r|\n)#s", $delimiter, $uheaders);
unset($uheaders);
$headers .= 'MIME-Version: 1.0' . $delimiter;
$headers .= 'Content-Type: text/plain' . iif($encoding, "; charset=\"{$encoding}\"") . $delimiter;
$headers .= 'Content-Transfer-Encoding: 8bit' . $delimiter;
$headers .= 'X-Priority: 3' . $delimiter;
$headers .= 'X-Mailer: vBulletin Mail via PHP' . $delimiter;
if (!empty($vboptions['extra_smtp_headers'])) {
$headers .= preg_replace("#\r[^\n]|[^r]\n#", $delimiter, $vboptions['extra_smtp_headers']) . $delimiter;
}
$this->toemail = $toemail;
$this->subject = $subject;
$this->message = $message;
$this->headers = $headers;
//.........这里部分代码省略.........
示例11: ids_array
}
if (empty($ticket)) {
//登录失败
echo '{status: "' . $client->status . '", "errorMsg":"' . $pageContents . '"}';
exit;
}
$buddy_online_ids = ids_array($pageData->buddies);
//在线好友列表ids
$clientnum = $pageData->clientnum;
$rooms_num = $pageData->roominfo;
if (is_object($rooms_num)) {
foreach ($rooms_num as $key => $value) {
$rooms[$key]['count'] = $value;
}
}
$output = array();
$output['buddy_online_ids'] = join(",", $buddy_online_ids);
$output['clientnum'] = $clientnum;
$output['server_time'] = microtime(true) * 1000;
$output['user'] = array('id' => $space['uid'], 'name' => to_utf8($name), 'pic_url' => avatar($space['uid'], 'small', true), 'status' => '', 'presence' => 'online', 'status_time' => '', 'url' => 'space.php?uid=' . $space['uid']);
//用户信息
$imserver = 'http://' . $_IMC['imsvr'] . ':' . $_IMC['impoll'];
$output['connection'] = array('domain' => $_IMC['domain'], 'ticket' => $ticket, 'server' => $imserver);
//服务器连接
$output['new_messages'] = $new_messages;
$output['buddies'] = find_buddy($buddy_ids);
$output['rooms'] = $rooms;
$output['histories'] = find_history($buddy_ids);
new_message_to_histroy();
//新消息转到历史记录
echo json_encode($output);
示例12: Pages
/**
* 通用分页列表数据集获取方法
*
* 可以通过url参数传递where条件,例如: index.html?name=asdfasdfasdfddds
* 可以通过url空值排序字段和方式,例如: index.html?_field=id&_order=asc
*/
protected function Pages($conf)
{
$model = @$conf['model'];
$whe = isset($conf['where']) ? $conf['where'] : '';
$join = isset($conf['join']) ? $conf['join'] : '';
$field = isset($conf['field']) ? $conf['field'] : '';
$order = isset($conf['order']) ? $conf['order'] : '';
$rows = isset($conf['rows']) ? $conf['rows'] : 15;
$url = isset($conf['url']) ? $conf['url'] : '';
$User = preg_match('/[a-zA-Z0-9]+View/', $model) ? D($model) : M($model);
$count = 0;
if (is_string($whe)) {
$whe = str_replace('__DB_PREFIX__', __DB_PREFIX__, $whe);
} else {
if (is_array($whe)) {
$temarr = array();
foreach ($whe as $key => $val) {
$temarr[str_replace('__DB_PREFIX__', __DB_PREFIX__, $key)] = $val;
}
$whe = $temarr;
}
}
$field = str_replace('__DB_PREFIX__', __DB_PREFIX__, $field);
$order = str_replace('__DB_PREFIX__', __DB_PREFIX__, $order);
if (is_array($join)) {
$join[0] = str_replace('__DB_PREFIX__', __DB_PREFIX__, $join[0]);
$join[1] = str_replace('__DB_PREFIX__', __DB_PREFIX__, $join[1]);
$count = $User->where($whe)->field($field)->order($order)->join($join[0])->join($join[1])->count();
// 查询满足要求的总记录数
} else {
$join = str_replace('__DB_PREFIX__', __DB_PREFIX__, $join);
$count = $User->where($whe)->field($field)->order($order)->join($join)->count();
// 查询满足要求的总记录数
}
$Page = new \Think\Page($count, $rows);
// 实例化分页类 传入总记录数和每页显示的记录数(25)
if (!empty($url)) {
$Page->url = $url;
}
//$Page->url=$pageurl;
$Page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
//分页跳转的时候保证查询条件
$mp = array_merge(I('post.'), I('get.'));
if (is_array($mp)) {
foreach ($mp as $key => $val) {
if (!is_array($val)) {
$Page->parameter[$key] = to_utf8($val);
}
}
}
$show = $Page->show();
// 分页显示输出
// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
if (is_array($join)) {
$list = $User->where($whe)->field($field)->order($order)->join($join[0])->join($join[1])->limit($Page->firstRow . ',' . $Page->listRows)->select();
} else {
$list = $User->where($whe)->field($field)->join($join)->order($order)->limit($Page->firstRow . ',' . $Page->listRows)->select();
}
$this->assign('_total', $count);
$this->assign('_page', $show);
// 赋值分页输出
$this->assign('_list', $list);
return $list;
}
示例13: indexscreen
function indexscreen($url, $reindex)
{
global $db_con, $mysql_table_prefix, $real_log, $debug, $conv_puny, $cyrillic, $curl, $include_dir;
/*
if ($conv_puny && strstr($url, "xn--")) {
require_once "$include_dir/idna_converter.php";
// Initialize the converter class
$IDN = new idna_convert(array('idn_version' => 2008));
// Decode it to its readable presentation
$url = $IDN->decode($url);
}
*/
$url = urldecode($url);
// get it readable
if ($cyrillic) {
$url = to_utf8($url);
// because of the bug in PHP function urldecode() we need special processing for CP1252 charset
}
$compurl = parse_url("" . $url);
// we will need all details of the URL
// https scheme requires cURL extension
if (!$curl && $compurl['scheme'] == "https") {
$message = "<p class='msg cntr'><br /><br /><span class='warnadmin'>Sorry, but in order to index URLs containing the https scheme,<br />you need to install the cURL extension on your server.</span><br /><br /><br /></p>";
echo "{$message}";
addsiteform();
exit;
}
$check = "";
$levelchecked = 'checked="checked"';
$spider_depth = 2;
if ($url == "") {
$url = "http://";
$url_crypt = "";
} else {
// prepare the URL for multiple & and + as part of the URL
$url_crypt = str_replace("&", "-_-", $url);
// crypt the & character
$url_crypt = str_replace("+", "_-_", $url_crypt);
// crypt the + character
$url_crypt = htmlentities($url_crypt, ENT_QUOTES);
$url_ent = htmlentities($url, ENT_QUOTES);
$advurl = $url;
$sql_query = "SELECT spider_depth, required, disallowed, can_leave_domain, use_prefcharset from " . $mysql_table_prefix . "sites " . "where url='{$url_ent}'";
$result = $db_con->query($sql_query);
if ($result->num_rows) {
$row = $result->fetch_array(MYSQLI_NUM);
$spider_depth = $row[0];
if ($spider_depth == -1) {
$fullchecked = 'checked="checked"';
$spider_depth = "";
$levelchecked = "";
}
$must = $row[1];
$mustnot = $row[2];
$canleave = $row[3];
$use_pref = $row[4];
}
}
echo "<br />\n ";
if ($must != "" || $mustnot != "" || $canleave == 1 || $use_pref) {
$_SESSION['index_advanced'] = 1;
}
if ($_SESSION['index_advanced'] == 1) {
echo "<form class='cntr sml' action='admin.php' method='post'>\n <input type='hidden' name='f' value='index' />\n <input type='hidden' name='adv' value='0' />\n <input type='hidden' name='url' value='{$url_crypt}' />\n <input class='cntr sbmt' type='submit' id='submit' value=' Hide advanced options ' title='Click to hide the advanced options in this menue' />\n </form>\n ";
} else {
echo "<form class='cntr sml' action='admin.php' method='post'>\n <input type='hidden' name='f' value='index' />\n <input type='hidden' name='adv' value='1' />\n <input type='hidden' name='url' value='{$url_crypt}' />\n <input class='cntr sbmt' type='submit' id='submit' value=' Show advanced options ' title='Click to show all the advanced options in this menue' />\n </form>\n ";
}
echo "<br />\n <div class='panel w75'>\n <form class='txt' action='spider.php' method='post'>\n <fieldset><legend>[ Basic Indexing Options ]</legend>\n <label class='em' for='url'>Address:</label>\n <input type='text' name='url' id='url' size='68' maxlength='1024' title='Enter new URL' value='{$url_crypt}' />\n <label class='em' for='soption'>Spidering options:</label>\n <input type='radio' name='soption' id='soption' title='Check box for Full indexing' value='full' {$fullchecked} /> Full<br />\n <input type='radio' name='soption' value='level' title='Check box to limit indexing depth' {$levelchecked} />\n Index depth:\n <input type='text' name='maxlevel' size='2' title='Enter indexing depth level' value='{$spider_depth}' />\n ";
if ($reindex == 1) {
$check = 'checked="checked"';
}
echo "<label class='em' for='reindex'>Re-index</label>\n <input type='checkbox' name='reindex' id='reindex' title='Check box to Re-index' value='1' {$check} /> Check to Re-index\n </fieldset>\n ";
if ($_SESSION['index_advanced'] == 1) {
if ($canleave == 1) {
$checkcan = 'checked="checked"';
}
if ($use_pref == 1) {
$use_pref = 'checked="checked"';
}
echo "<fieldset><legend>[ Advanced Indexing Options ]</legend>\n <label class='em' for='can_leave'>Spider can leave domain?</label>\n <input type='checkbox' name='can_leave' id='can_leave' value='1' title='Check box if Sphider can leave above domain' {$checkcan} /> Check for Yes\n <label class='em' for='use_pref'>Use preferred charset for indexing?</label>\n <input type='checkbox' name='use_pref' id=use_pref'' value='1' title='Check box if Sphider should use the preferred charset as defined in \"Settings\"' {$use_pref} /> Check for Yes\n <label class='em' for='reindex'>robots.txt</label>\n <input type='hidden' name='not_use_robot' value='0' />\n <input type='checkbox' name='not_use_robot' value='1' {$not_use_robot} /> Temporary ignore 'robots.txt'\n <label class='em' for='nofollow'>'nofollow' tags</label>\n <input type='hidden' name='not_use_nofollow' value='0' />\n <input type='checkbox' name='not_use_nofollow' value='1' {$not_use_nofollow} /> Temporary ignore 'nofollow' directive\n </fieldset>\n <fieldset><legend>[ Include/Exclude Options ]</legend>\n <label class='em' for='in'>URL Must include:</label>\n <textarea name='in' id='in' cols='35' rows='5' title='Enter URLs that Must be included, one per line'>{$must}</textarea>\n <label class='em' for='out'>URL must Not include:</label>\n <textarea name='out' id='out' cols='35' rows='5' title='Enter URLs that must Not be included, one per line'>{$mustnot}</textarea></fieldset>\n ";
}
echo "<fieldset><legend>[ Start Indexing ]</legend>\n ";
if ($real_log == '1') {
echo "\n <input class='cntr sbmt' type='submit' id='submit' value=' Start ' title='Click to start indexing process' onclick=\"window.open('real_log.php')\" />\n ";
} else {
echo "\n <input class='cntr sbmt' type='submit' id='submit' value=' Start ' title='Click to start indexing process' />\n ";
}
echo "\n </fieldset>\n </form>\n </div>\n ";
}
示例14: processregistered
private function processregistered(&$value, $charset)
{
global $VB_API_REQUESTS;
if (is_array($value)) {
foreach ($value as &$el) {
$this->processregistered($el, $charset);
}
}
if (is_string($value)) {
$value = preg_replace_callback('/&#([0-9]+);/siU', 'convert_int_to_utf8_callback', to_utf8($value, $charset, true));
$trimmed = trim($value);
if ($VB_API_REQUESTS['api_version'] > 1 and ($trimmed == 'checked="checked"' or $trimmed == 'selected="selected"')) {
$value = 1;
}
}
if ($VB_API_REQUESTS['api_version'] > 1 and is_bool($value)) {
if ($value) {
$value = 1;
} else {
$value = 0;
}
}
}
示例15: redirect_canonical_url
/**
* Redirects to our url if the given uri is not canonical.
*
* @param string $request_uri - The current uri to check
*/
public function redirect_canonical_url($request_uri)
{
// Never redirect a post
if ('GET' != $_SERVER['REQUEST_METHOD']) {
return;
}
// Allow hooks to handle non canonical urls
($hook = vBulletinHook::fetch_hook('friendlyurl_redirect_canonical')) ? eval($hook) : false;
// Check if canonical enforcement is enabled
if (self::CANON_OFF == $this->registry->options['friendlyurl_canonical'] or VB_API) {
return;
}
// Only redirect guests and search engines
if ($this->registry->userinfo['userid'] and !$this->registry->options['friendlyurl_canonical_registered']) {
return;
}
// Get the canonical uri
if (!isset($canonical_uri)) {
// Get the canonical uri
$canonical_uri = $this->get_uri(true);
}
// Whether the request was canonical
$canonical = true;
// Check Friendly URL method
if (FRIENDLY_URL != $this->registry->options['friendlyurl']) {
$canonical = false;
}
// Check URI
if ($canonical and self::CANON_STRICT == $this->registry->options['friendlyurl_canonical']) {
if ($request_uri != $canonical_uri) {
$canonical = false;
// request may have been in the current charset, try UTF-8.
if ($canonical_uri == to_utf8($request_uri, $this->registry->userinfo['lang_charset'])) {
$canonical = true;
}
// request may have been in UTF-8, try current charset
if ($request_uri == to_utf8($canonical_uri, $this->registry->userinfo['lang_charset'])) {
$canonical = true;
}
}
}
parse_str($_SERVER['QUERY_STRING'], $args);
if ($this->registry->options['friendlyurl'] != FRIENDLY_URL_OFF and (isset($args[$this->pagevar]) or isset($args[$this->idkey]))) {
$canonical = false;
}
if ($this->registry->options['friendlyurl'] == FRIENDLY_URL_OFF and !$canonical_uri) {
if (isset($this->pagevar)) {
$this->ignorelist[] = $this->pagevar;
if ($this->pagevar == 'page') {
$this->ignorelist[] = 'pagenumber';
}
}
if ($this->page > 1 and $args[$this->pagevar] != $this->page or $this->page == 1 and isset($args[$this->pagevar])) {
$canonical = false;
}
$canonical = ($canonical and !array_intersect(array_values($this->registry->input->shortvars), array_keys($args)));
}
// Redirect if incorrect
if (!$canonical) {
// add the request query string to the pageinfo
$this->consume_request_pageinfo();
// redirect url must be raw
$url = $this->get_url(false, true);
$code = 301;
// workaround for goto
if (defined('THREADNEXT')) {
$url = str_replace('&goto=nextnewest', '', str_replace('&goto=nextoldest', '', str_replace('?goto=nextnewest', '', str_replace('?goto=nextoldest', '', $url))));
$code = 303;
}
// if its pointing to a post, add the anchor.
if ($args['p']) {
$url .= '#post' . $args['p'];
}
// redirect to the correct url
exec_header_redirect($url, $code);
}
}