本文整理汇总了PHP中nv_strtolower函数的典型用法代码示例。如果您正苦于以下问题:PHP nv_strtolower函数的具体用法?PHP nv_strtolower怎么用?PHP nv_strtolower使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了nv_strtolower函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: die
die(signin_result(array('status' => 'error', 'input' => 'nv_login', 'mess' => $lang_global['username_empty'])));
}
if (empty($nv_password)) {
die(signin_result(array('status' => 'error', 'input' => 'nv_password', 'mess' => $lang_global['password_empty'])));
}
if (defined('NV_IS_USER_FORUM')) {
$error = '';
require_once NV_ROOTDIR . '/' . DIR_FORUM . '/nukeviet/login.php';
if (!empty($error)) {
die(signin_result(array('status' => 'error', 'input' => 'nv_login', 'mess' => $error)));
}
} else {
$error1 = $lang_global['loginincorrect'];
if (nv_check_valid_email($nv_username) == '') {
// Email login
$nv_username = nv_strtolower($nv_username);
$sql = "SELECT * FROM " . NV_USERS_GLOBALTABLE . " WHERE email =" . $db->quote($nv_username);
$login_email = true;
} else {
// Username login
$sql = "SELECT * FROM " . NV_USERS_GLOBALTABLE . " WHERE md5username ='" . nv_md5safe($nv_username) . "'";
$login_email = false;
}
$row = $db->query($sql)->fetch();
if (!empty($row)) {
if (($row['username'] == $nv_username and $login_email == false or $row['email'] == $nv_username and $login_email == true) and $crypt->validate_password($nv_password, $row['password'])) {
if (!$row['active']) {
$error1 = $lang_module['login_no_active'];
} else {
$error1 = '';
validUserLog($row, 1, '');
示例2: nv_html_meta_tags
/**
* nv_html_meta_tags()
*
* @return
*/
function nv_html_meta_tags()
{
global $global_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl;
$return = "";
if ($home) {
$return .= "<meta name=\"description\" content=\"" . strip_tags($global_config['site_description']) . "\" />\n";
} else {
if (!empty($description)) {
$return .= "<meta name=\"description\" content=\"" . strip_tags($description) . "\" />\n";
} elseif (!empty($module_info['description'])) {
$return .= "<meta name=\"description\" content=\"" . strip_tags($module_info['description']) . "\" />\n";
} else {
$ds = array();
if (!empty($page_title)) {
$ds[] = $page_title;
}
if ($op != "main") {
$ds[] = $module_info['funcs'][$op]['func_custom_name'];
}
$ds[] = $module_info['custom_title'];
$ds[] = $client_info['selfurl'];
$return .= "<meta name=\"description\" content=\"" . strip_tags(implode(" - ", $ds)) . "\" />\n";
}
}
$kw = array();
if (!empty($key_words)) {
$kw[] = $key_words;
}
if (!empty($module_info['keywords'])) {
$kw[] = $module_info['keywords'];
}
if (!empty($global_config['site_keywords'])) {
$kw[] = $global_config['site_keywords'];
}
if (!empty($kw)) {
$kw = array_unique($kw);
$kw = implode(",", $kw);
$kw = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(",", ","), $kw);
$key_words = nv_strtolower(strip_tags($kw));
$return .= "<meta name=\"keywords\" content=\"" . $key_words . "\" />\n";
}
$return .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $global_config['site_charset'] . "\" />\n";
$file_metatags = NV_ROOTDIR . "/" . NV_DATADIR . "/metatags.xml";
if (file_exists($file_metatags)) {
$mt = file_get_contents($file_metatags);
$patters = array();
$patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language'];
$patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName'];
$patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name'];
$patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email'];
$mt = preg_replace(array_keys($patters), array_values($patters), $mt);
$mt = preg_replace("/\\{(.*)\\}/", "", $mt);
$mt = simplexml_load_string($mt);
$mt = nv_object2array($mt);
if ($mt['meta_item']) {
if (isset($mt['meta_item'][0])) {
$metatags = $mt['meta_item'];
} else {
$metatags[] = $mt['meta_item'];
}
foreach ($metatags as $meta) {
if (($meta['group'] == "http-equiv" or $meta['group'] == "name") and preg_match("/^[a-zA-Z0-9\\-\\_\\.]+\$/", $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) {
$return .= "<meta " . $meta['group'] . "=\"" . $meta['value'] . "\" content=\"" . $meta['content'] . "\" />\n";
}
}
}
}
$return .= "<meta name=\"generator\" content=\"NukeViet v3.x\" />\n";
if (defined('NV_IS_ADMIN')) {
$return .= "<meta http-equiv=\"refresh\" content=\"" . NV_ADMIN_CHECK_PASS_TIME . "\" />\n";
}
if (empty($canonicalUrl)) {
$canonicalUrl = $client_info['selfurl'];
}
if (substr($canonicalUrl, 0, 4) != "http") {
if (substr($canonicalUrl, 0, 1) != "/") {
$canonicalUrl = NV_BASE_SITEURL . $canonicalUrl;
}
$canonicalUrl = NV_MY_DOMAIN . $canonicalUrl;
}
$return .= "<link rel=\"canonical\" href=\"" . $canonicalUrl . "\" />\n";
return $return;
}
示例3: nv_md5safe
}
}
$md5_username = nv_md5safe($nv_username);
$stmt = $db->prepare('UPDATE ' . NV_USERS_GLOBALTABLE . ' SET username= :username, md5username= :md5username WHERE userid=' . $user_info['userid']);
$stmt->bindParam(':username', $nv_username, PDO::PARAM_STR);
$stmt->bindParam(':md5username', $md5_username, PDO::PARAM_STR);
$stmt->execute();
$name = $global_config['name_show'] ? array($row['first_name'], $row['last_name']) : array($row['last_name'], $row['first_name']);
$name = array_filter($name);
$name = implode(' ', $name);
$sitename = '<a href="' . NV_MY_DOMAIN . NV_BASE_SITEURL . '">' . $global_config['site_name'] . '</a>';
$message = sprintf($lang_module['edit_mail_content'], $name, $sitename, $lang_global['username'], $nv_username);
@nv_sendmail($global_config['site_email'], $row['email'], $lang_module['edit_mail_subject'], $message);
die(json_encode(array('status' => 'ok', 'input' => nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=editinfo/username', true), 'mess' => $lang_module['editinfo_ok'])));
} elseif ($checkss == $array_data['checkss'] and $array_data['type'] == 'email') {
$nv_email = nv_strtolower(nv_substr($nv_Request->get_title('email', 'post', '', 1), 0, 100));
$nv_password = $nv_Request->get_title('password', 'post', '');
$nv_verikeysend = (int) $nv_Request->get_bool('vsend', 'post', false);
if (empty($nv_password) or !$nv_Request->get_bool('verikey', 'session')) {
$nv_verikeysend = 1;
}
if ($nv_email == $row['email']) {
die(json_encode(array('status' => 'error', 'input' => 'email', 'mess' => $lang_module['email_not_change'])));
}
if (!empty($row['password']) and !$crypt->validate_password($nv_password, $row['password'])) {
die(json_encode(array('status' => 'error', 'input' => 'password', 'mess' => $lang_global['incorrect_password'])));
}
$checkemail = nv_check_email_change($nv_email);
if (!empty($checkemail)) {
die(json_encode(array('status' => 'error', 'input' => 'email', 'mess' => $checkemail)));
}
示例4: nv_content_keywords
function nv_content_keywords($content)
{
global $db, $db_config, $lang_module, $module_name, $op, $global_config, $sys_info;
$keywords = "n/a";
if ($content != "") {
$arrkw = array();
$memoryLimitMB = (int) ini_get('memory_limit');
if ($memoryLimitMB > 60 and file_exists(NV_ROOTDIR . "/includes/keywords/" . NV_LANG_DATA . ".txt")) {
require_once NV_ROOTDIR . "/includes/keywords/" . NV_LANG_DATA . ".txt";
}
$keywords_return = array();
if (!empty($arrkw)) {
//echo "test1";die;
nv_internal_encoding($global_config['site_charset']);
$content = nv_strtolower($content);
$content = str_replace(array('"', '©', '>', '<', ' '), " ", $content);
$content = str_replace(array(',', ')', '(', '.', "'", '"', '<', '>', ';', '!', '?', '/', '-', '_', '[', ']', ':', '+', '=', '#', '$', chr(10), chr(13), chr(9)), " ", $content);
$content = preg_replace('/ {2,}/si', " ", $content);
$content_array = explode(" ", $content);
$a = 0;
$b = count($content_array);
for ($i = 0; $i < $b - 3; $i++) {
$key3 = $content_array[$i] . " " . $content_array[$i + 1] . " " . $content_array[$i + 2];
$key2 = $content_array[$i] . " " . $content_array[$i + 1];
if (array_search($key3, $arrkw)) {
$keywords_return[] = $key3;
} elseif (array_search($key2, $arrkw)) {
$keywords_return[] = $key2;
}
$keywords_return = array_unique($keywords_return);
if (count($keywords_return) > 20) {
break;
}
}
$keywords = implode(", ", $keywords_return);
} else {
//echo "test2";die;
$keywords = nv_get_keywords($content);
if (empty($keywords)) {
$keywords = "n/a";
}
}
}
return $keywords;
}
示例5: nv_date
$imagesize = @getimagesize(NV_UPLOADS_REAL_DIR . '/' . $module_upload . '/' . $rowdetail['image']);
$rowdetail['image'] = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_upload . '/' . $rowdetail['image'];
$rowdetail['imageWidth'] = $imagesize[0] > 500 ? 500 : $imagesize[0];
}
$rowdetail['add_time'] = nv_date('H:i T l, d/m/Y', $rowdetail['add_time']);
$rowdetail['edit_time'] = nv_date('H:i T l, d/m/Y', $rowdetail['edit_time']);
$module_info['layout_funcs'][$op_file] = !empty($rowdetail['layout_func']) ? $rowdetail['layout_func'] : $module_info['layout_funcs'][$op_file];
if (!empty($rowdetail['keywords'])) {
$key_words = $rowdetail['keywords'];
} else {
$key_words = nv_get_keywords($rowdetail['bodytext']);
if (empty($key_words)) {
$key_words = nv_unhtmlspecialchars($rowdetail['title']);
$key_words = strip_punctuation($key_words);
$key_words = trim($key_words);
$key_words = nv_strtolower($key_words);
$key_words = preg_replace('/[ ]+/', ',', $key_words);
}
}
$page_title = $mod_title = $rowdetail['title'];
$description = $rowdetail['description'];
$id_profile_googleplus = $rowdetail['gid'];
// Hiển thị các bài liên quan mới nhất.
$other_links = array();
$related_articles = intval($page_config['related_articles']);
if ($related_articles) {
$db_slave->sqlreset()->select('*')->from(NV_PREFIXLANG . '_' . $module_data)->where('status=1 AND id !=' . $id)->order('weight ASC')->limit($related_articles);
$result = $db_slave->query($db_slave->sql());
while ($_other = $result->fetch()) {
$_other['link'] = $base_url . '&' . NV_OP_VARIABLE . '=' . $_other['alias'] . $global_config['rewrite_exturl'];
$other_links[$_other['id']] = $_other;
示例6: nv_substr
$row_field['field_choices'][$key] = $val;
}
}
$array_field_config[] = $row_field;
}
if (defined('NV_EDITOR')) {
require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$custom_fields = $nv_Request->get_array('custom_fields', 'post');
if ($checkss == $array_register['checkss']) {
$array_register['first_name'] = nv_substr($nv_Request->get_title('first_name', 'post', '', 1), 0, 255);
$array_register['last_name'] = nv_substr($nv_Request->get_title('last_name', 'post', '', 1), 0, 255);
$array_register['username'] = $nv_Request->get_title('username', 'post', '', 1);
$array_register['password'] = $nv_Request->get_title('password', 'post', '');
$array_register['re_password'] = $nv_Request->get_title('re_password', 'post', '');
$array_register['email'] = nv_strtolower(nv_substr($nv_Request->get_title('email', 'post', '', 1), 0, 100));
$array_register['question'] = $nv_Request->get_int('question', 'post', 0);
if (!isset($data_questions[$array_register['question']])) {
$array_register['question'] = 0;
}
$data_questions[$array_register['question']]['selected'] = ' selected="selected"';
$array_register['your_question'] = $nv_Request->get_title('your_question', 'post', '', 1);
$array_register['answer'] = nv_substr($nv_Request->get_title('answer', 'post', '', 1), 0, 255);
$array_register['agreecheck'] = $nv_Request->get_int('agreecheck', 'post', 0);
$nv_seccode = $nv_Request->get_title('nv_seccode', 'post', '');
$check_seccode = !$gfx_chk ? true : (nv_capcha_txt($nv_seccode) ? true : false);
$complete = '';
if (!$check_seccode) {
die(reg_result(array('status' => 'error', 'input' => 'nv_seccode', 'mess' => $lang_global['securitycodeincorrect'])));
}
if (($check_login = nv_check_username_reg($array_register['username'])) != '') {
示例7: array_unique
$array_playlist_fix[] = $playlist_id_i;
}
$array_playlist_fix = array_unique($array_playlist_fix);
foreach ($array_playlist_fix as $playlist_id_i) {
nv_news_fix_playlist($playlist_id_i, false);
}
if ($rowcontent['keywords'] != $rowcontent['keywords_old']) {
$keywords = explode(',', $rowcontent['keywords']);
$keywords = array_map('strip_punctuation', $keywords);
$keywords = array_map('trim', $keywords);
$keywords = array_diff($keywords, array(''));
$keywords = array_unique($keywords);
foreach ($keywords as $keyword) {
if (!in_array($keyword, $array_keywords_old)) {
$alias_i = $module_config[$module_name]['tags_alias'] ? change_alias($keyword) : str_replace(' ', '-', $keyword);
$alias_i = nv_strtolower($alias_i);
$sth = $db->prepare('SELECT tid, alias, description, keywords FROM ' . NV_PREFIXLANG . '_' . $module_data . '_tags where alias= :alias OR FIND_IN_SET(:keyword, keywords)>0');
$sth->bindParam(':alias', $alias_i, PDO::PARAM_STR);
$sth->bindParam(':keyword', $keyword, PDO::PARAM_STR);
$sth->execute();
list($tid, $alias, $keywords_i) = $sth->fetch(3);
if (empty($tid)) {
$array_insert = array();
$array_insert['alias'] = $alias_i;
$array_insert['keyword'] = $keyword;
$tid = $db->insert_id("INSERT INTO " . NV_PREFIXLANG . "_" . $module_data . "_tags (numnews, alias, description, image, keywords) VALUES (1, :alias, '', '', :keyword)", "tid", $array_insert);
} else {
if ($alias != $alias_i) {
if (!empty($keywords_i)) {
$keyword_arr = explode(',', $keywords_i);
$keyword_arr[] = $keyword;
示例8: nv_is_url
/**
* nv_is_url()
*
* @param string $url
* @return
*/
function nv_is_url($url)
{
if (!preg_match('/^(http|https|ftp|gopher)\\:\\/\\//', $url)) {
return false;
}
$url = nv_strtolower($url);
if (!($parts = @parse_url($url))) {
return false;
}
$domain = isset($parts['host']) ? nv_check_domain($parts['host']) : '';
if (empty($domain)) {
return false;
}
if (isset($parts['user']) and !preg_match('/^([0-9a-z\\-]|[\\_])*$/', $parts['user'])) {
return false;
}
if (isset($parts['pass']) and !preg_match('/^([0-9a-z\\-]|[\\_])*$/', $parts['pass'])) {
return false;
}
if (isset($parts['path']) and !preg_match('/^[0-9A-Za-z\\/\\_\\.\\@\\~\\-\\%\\s]*$/', $parts['path'])) {
return false;
}
if (isset($parts['query']) and !preg_match('/^[0-9a-z\\-\\_\\/\\?\\&\\=\\#\\.\\,\\;\\%\\s]*$/', $parts['query'])) {
return false;
}
return true;
}
示例9: nv_referer_update
function nv_referer_update()
{
global $nv_Request, $client_info, $global_config, $db, $prefix;
if ($client_info['is_myreferer'] == 0) {
$host = $nv_Request->referer_host;
$host = str_replace('www.', '', $host);
$host = explode('/', $host);
$host = reset($host);
$host = strtolower($host);
$log_path = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ref_logs';
if (!is_dir($log_path)) {
@nv_mkdir(NV_ROOTDIR . '/' . NV_LOGS_DIR, 'ref_logs', true);
}
$log_current = mktime(0, 0, 0, date('n', NV_CURRENTTIME), date('j', NV_CURRENTTIME), date('Y', NV_CURRENTTIME));
$content = '[' . date('r', NV_CURRENTTIME) . ']';
$content .= ' [' . NV_CLIENT_IP . ']';
$content .= ' [' . $client_info['referer'] . ']';
$content .= ' [' . $client_info['selfurl'] . ']';
$content .= "\r\n";
$md5 = md5($client_info['referer'] . $client_info['selfurl']);
$is_save = true;
$referer_blocker = array();
if (file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/referer_blocker.php')) {
include NV_ROOTDIR . '/' . NV_DATADIR . '/referer_blocker.php';
}
if (!empty($referer_blocker)) {
foreach ($referer_blocker as $blocker) {
if (preg_match('/' . preg_quote($blocker) . '/i', $host)) {
$is_save = false;
break;
}
}
}
if ($is_save) {
$tmp = $log_path . '/tmp.' . NV_LOGS_EXT;
if (file_exists($tmp)) {
$ct = file_get_contents($tmp);
if (!empty($ct)) {
$ct = trim($ct);
$ct = explode('|', $ct);
$p = NV_CURRENTTIME - 60;
if ($ct[0] > $p and $ct[1] == $md5) {
$is_save = false;
}
}
}
}
if ($is_save) {
file_put_contents($log_path . '/' . $log_current . '.' . NV_LOGS_EXT, $content, FILE_APPEND);
file_put_contents($tmp, NV_CURRENTTIME . '|' . $md5);
$_numrow = $db->query('SELECT COUNT(*) FROM ' . NV_REFSTAT_TABLE . ' WHERE host=' . $db->quote($host))->fetchColumn();
if ($_numrow > 0) {
$sth = $db->prepare('UPDATE ' . NV_REFSTAT_TABLE . ' SET
total=total+1,
month' . date('m', NV_CURRENTTIME) . '=month' . date('m', NV_CURRENTTIME) . '+1,
last_update=' . NV_CURRENTTIME . '
WHERE host= :host');
$sth->bindParam(':host', $host, PDO::PARAM_STR);
$sth->execute();
} else {
$sth = $db->prepare('INSERT INTO ' . NV_REFSTAT_TABLE . '
(host, total, month' . date('m', NV_CURRENTTIME) . ', last_update)
VALUES ( :host, 1, 1,' . NV_CURRENTTIME . ')');
$sth->bindParam(':host', $host, PDO::PARAM_STR);
$sth->execute();
}
unset($_numrow);
if (!empty($nv_Request->search_engine)) {
if (isset($global_config['engine_allowed'][$nv_Request->search_engine]['query_param']) and !empty($global_config['engine_allowed'][$nv_Request->search_engine]['query_param'])) {
$key = $global_config['engine_allowed'][$nv_Request->search_engine]['query_param'];
$key = !empty($nv_Request->referer_queries[$key]) ? $nv_Request->referer_queries[$key] : '';
$key = str_replace('+', ' ', $key);
$key = nv_strtolower($key);
$key = nv_substr($key, 0, 100);
$key = trim($key);
$id = md5($key);
if (!empty($key)) {
$sth = $db->prepare('UPDATE ' . NV_SEARCHKEYS_TABLE . ' SET total=total+1 WHERE id= :id AND search_engine= :search_engine');
$sth->bindParam(':id', $id, PDO::PARAM_STR);
$sth->bindParam(':search_engine', $nv_Request->search_engine, PDO::PARAM_STR);
$update = $sth->execute();
if (empty($update)) {
$sth = $db->prepare('INSERT INTO ' . NV_SEARCHKEYS_TABLE . ' VALUES ( :id, :key, 1, :search_engine)');
$sth->bindParam(':id', $id, PDO::PARAM_STR);
$sth->bindParam(':key', $key, PDO::PARAM_STR);
$sth->bindParam(':search_engine', $nv_Request->search_engine, PDO::PARAM_STR);
$sth->execute();
}
}
}
}
}
}
}
示例10: nv_html_meta_tags
/**
* nv_html_meta_tags()
*
* @return
*/
function nv_html_meta_tags()
{
global $global_config, $db_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl, $meta_property, $id_profile_googleplus;
$return = '';
$site_description = $home ? $global_config['site_description'] : (!empty($description) ? $description : (empty($module_info['description']) ? '' : $module_info['description']));
if (empty($site_description)) {
$ds = array();
if (!empty($page_title)) {
$ds[] = $page_title;
}
if ($op != 'main') {
$ds[] = $module_info['funcs'][$op]['func_custom_name'];
}
$ds[] = $module_info['custom_title'];
$ds[] = $client_info['selfurl'];
$site_description = implode(' - ', $ds);
} elseif ($site_description == 'no') {
$site_description = '';
}
if (!empty($site_description)) {
$site_description = preg_replace('/<[^>]*>/', ' ', $site_description);
// ----- remove HTML TAGs
$site_description = str_replace("\r", '', $site_description);
// --- replace with empty space
$site_description = str_replace("\n", ' ', $site_description);
// --- replace with space
$site_description = str_replace("\t", ' ', $site_description);
// --- replace with space
$site_description = trim(preg_replace('/[ ]+/', ' ', $site_description));
// ----- remove multiple spaces
if ($global_config['description_length']) {
$site_description = nv_clean60($site_description, $global_config['description_length'], true);
}
$return .= "<meta name=\"description\" content=\"" . $site_description . "\" />\n";
}
$kw = array();
if (!empty($key_words)) {
if ($key_words != 'no') {
$kw[] = $key_words;
}
} elseif (!empty($module_info['keywords'])) {
$kw[] = $module_info['keywords'];
}
if ($home and !empty($global_config['site_keywords'])) {
$kw[] = $global_config['site_keywords'];
}
if (!empty($kw)) {
$kw = array_unique($kw);
$key_words = implode(',', $kw);
$key_words = preg_replace(array("/[ ]*\\,[ ]+/", "/[\\,]+/"), array(", ", ", "), $key_words);
$key_words = nv_strtolower(strip_tags($key_words));
$return .= "<meta name=\"keywords\" content=\"" . $key_words . "\" />\n";
$return .= "<meta name=\"news_keywords\" content=\"" . $key_words . "\" />\n";
}
$return .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $global_config['site_charset'] . "\" />\n";
if ($global_config['idsite'] and file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml')) {
$file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_metatags.xml';
} else {
$file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml';
}
if (file_exists($file_metatags)) {
$mt = file_get_contents($file_metatags);
$patters = array();
$patters['/\\{CONTENT\\-LANGUAGE\\}/'] = $lang_global['Content_Language'];
$patters['/\\{LANGUAGE\\}/'] = $lang_global['LanguageName'];
$patters['/\\{SITE\\_NAME\\}/'] = $global_config['site_name'];
$patters['/\\{SITE\\_EMAIL\\}/'] = $global_config['site_email'];
$mt = preg_replace(array_keys($patters), array_values($patters), $mt);
$mt = preg_replace('/\\{(.*)\\}/', '', $mt);
$mt = simplexml_load_string($mt);
$mt = nv_object2array($mt);
if ($mt['meta_item']) {
if (isset($mt['meta_item'][0])) {
$metatags = $mt['meta_item'];
} else {
$metatags[] = $mt['meta_item'];
}
foreach ($metatags as $meta) {
if (($meta['group'] == 'http-equiv' or $meta['group'] == 'name' or $meta['group'] == 'property') and preg_match('/^[a-zA-Z0-9\\-\\_\\.\\:]+$/', $meta['value']) and preg_match("/^([^\\'\"]+)\$/", (string) $meta['content'])) {
$return .= "<meta " . $meta['group'] . "=\"" . $meta['value'] . "\" content=\"" . $meta['content'] . "\" />\n";
}
}
}
}
$return .= "<meta name=\"generator\" content=\"NukeViet v4.x\" />\n";
if (defined('NV_IS_ADMIN')) {
$return .= "<meta http-equiv=\"refresh\" content=\"" . $global_config['admin_check_pass_time'] . "\" />\n";
}
if ($home) {
$canonicalUrl = nv_url_rewrite(NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $global_config['site_home_module'], true);
} elseif (empty($canonicalUrl)) {
$canonicalUrl = str_replace(NV_MY_DOMAIN . '/', NV_MAIN_DOMAIN . '/', $client_info['selfurl']);
}
if (substr($canonicalUrl, 0, 4) != 'http') {
if (substr($canonicalUrl, 0, 1) != '/') {
//.........这里部分代码省略.........
示例11: nv_is_url
/**
* nv_is_url()
*
* @param string $url
* @return
*/
function nv_is_url($url)
{
if (empty($url)) {
return false;
}
$url = nv_strtolower($url);
if (!($parts = @parse_url($url))) {
return false;
}
if (!isset($parts['scheme']) or !isset($parts['host']) or !in_array($parts['scheme'], array('http', 'https', 'ftp', 'gopher'))) {
return false;
}
if (!preg_match("/^[0-9a-z]([\\-\\.]?[0-9a-z])*\\.(ac|ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|info|int|io|iq|ir|is|it|je|jm|jo|jobs|jp|ke|kg|kh|ki|km|kn|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mobi|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|travel|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw|xxx)\$/", $parts['host'])) {
if ($parts['host'] != 'localhost' and !filter_var($parts['host'], FILTER_VALIDATE_IP)) {
return false;
}
}
if (isset($parts['user']) and !preg_match("/^([0-9a-z\\-]|[\\_])*\$/", $parts['user'])) {
return false;
}
if (isset($parts['pass']) and !preg_match("/^([0-9a-z\\-]|[\\_])*\$/", $parts['pass'])) {
return false;
}
if (isset($parts['path']) and !preg_match("/^[0-9A-Za-z\\/\\_\\.\\@\\~\\-\\%\\s]*\$/", $parts['path'])) {
return false;
}
if (isset($parts['query']) and !preg_match("/^[0-9a-z\\-\\_\\/\\?\\&\\=\\#\\.\\,\\;\\%\\s]*\$/", $parts['query'])) {
return false;
}
return true;
}
示例12: nv_referer_update
function nv_referer_update()
{
global $nv_Request, $client_info, $global_config, $db, $prefix;
if ($client_info['is_myreferer'] == 0) {
$host = $nv_Request->referer_host;
$host = str_replace('www.', '', $host);
$host = explode('/', $host);
$host = reset($host);
$host = strtolower($host);
$log_path = NV_ROOTDIR . '/' . NV_LOGS_DIR . '/ref_logs';
if (!is_dir($log_path)) {
@nv_mkdir(NV_ROOTDIR . '/' . NV_LOGS_DIR, 'ref_logs', true);
}
$log_current = mktime(0, 0, 0, date("n", NV_CURRENTTIME), date("j", NV_CURRENTTIME), date("Y", NV_CURRENTTIME));
$content = '[' . date("r", NV_CURRENTTIME) . ']';
$content .= ' [' . $client_info['ip'] . ']';
$content .= ' [' . $client_info['referer'] . ']';
$content .= ' [' . $client_info['selfurl'] . ']';
$content .= "\r\n";
$md5 = md5($client_info['referer'] . $client_info['selfurl']);
$is_save = true;
$referer_blocker = array();
if (file_exists(NV_ROOTDIR . '/' . NV_DATADIR . '/referer_blocker.php')) {
include NV_ROOTDIR . '/' . NV_DATADIR . '/referer_blocker.php';
}
if (!empty($referer_blocker)) {
foreach ($referer_blocker as $blocker) {
if (preg_match("/" . preg_quote($blocker) . "/i", $host)) {
$is_save = false;
break;
}
}
}
if ($is_save) {
$tmp = $log_path . '/tmp.' . NV_LOGS_EXT;
if (file_exists($tmp)) {
$ct = file_get_contents($tmp);
if (!empty($ct)) {
$ct = trim($ct);
$ct = explode("|", $ct);
$p = NV_CURRENTTIME - 60;
if ($ct[0] > $p and $ct[1] == $md5) {
$is_save = false;
}
}
}
}
if ($is_save) {
file_put_contents($log_path . '/' . $log_current . '.' . NV_LOGS_EXT, $content, FILE_APPEND);
file_put_contents($tmp, NV_CURRENTTIME . '|' . $md5);
$sql = "UPDATE `" . NV_REFSTAT_TABLE . "` SET \n total=total+1, \n month" . date('m', NV_CURRENTTIME) . "=month" . date('m', NV_CURRENTTIME) . "+1, \n last_update=" . NV_CURRENTTIME . " \n WHERE `host`=" . $db->dbescape($host);
$db->sql_query($sql);
$mysql_info = @mysql_info();
unset($matches);
preg_match("/^\\D+(\\d+)/", $mysql_info, $matches);
if ($matches[1] == 0) {
$sql = "INSERT INTO `" . NV_REFSTAT_TABLE . "` \n (`host`, `total`, `month" . date('m', NV_CURRENTTIME) . "`, `last_update`) \n VALUES (" . $db->dbescape($host) . ",1, 1," . NV_CURRENTTIME . ")";
$db->sql_query($sql);
}
if (!empty($nv_Request->search_engine)) {
if (isset($global_config['engine_allowed'][$nv_Request->search_engine]['query_param']) and !empty($global_config['engine_allowed'][$nv_Request->search_engine]['query_param'])) {
$key = $global_config['engine_allowed'][$nv_Request->search_engine]['query_param'];
$key = $nv_Request->referer_queries[$key];
$key = str_replace("+", " ", $key);
$key = nv_strtolower($key);
$key = nv_substr($key, 0, 100);
$key = trim($key);
$id = md5($key);
if (!empty($key)) {
$sql = "UPDATE `" . NV_SEARCHKEYS_TABLE . "` \n SET total=total+1 WHERE `id`=" . $db->dbescape($id) . " \n AND `search_engine`=" . $db->dbescape($nv_Request->search_engine);
$db->sql_query($sql);
$mysql_info = @mysql_info();
unset($matches);
preg_match("/^\\D+(\\d+)/", $mysql_info, $matches);
if ($matches[1] == 0) {
$sql = "INSERT INTO `" . NV_SEARCHKEYS_TABLE . "` \n VALUES (" . $db->dbescape($id) . "," . $db->dbescape($key) . ",1," . $db->dbescape($nv_Request->search_engine) . ")";
$db->sql_query($sql);
}
}
}
}
}
}
}
示例13: ceil
$stmt->bindParam(':hitscm', $item['hitscm'], PDO::PARAM_INT);
$stmt->bindParam(':total_rating', $item['total_rating'], PDO::PARAM_INT);
$stmt->bindParam(':click_rating', $item['click_rating'], PDO::PARAM_INT);
$ec = $stmt->execute();
if ($ec) {
$tbhtml = ceil($item['id'] / 2000);
if (!in_array($tbhtml, $aray_table_bodyhtml)) {
$aray_table_bodyhtml[] = $tbhtml;
$db->query("CREATE TABLE IF NOT EXISTS " . NV_PREFIXLANG . "_" . $mod_data . "_bodyhtml_" . $tbhtml . " (id int(11) unsigned NOT NULL, bodyhtml longtext NOT NULL, sourcetext varchar(255) NOT NULL default '', imgposition tinyint(1) NOT NULL default '1', copyright tinyint(1) NOT NULL default '0', allowed_send tinyint(1) NOT NULL default '0', allowed_print tinyint(1) NOT NULL default '0', allowed_save tinyint(1) NOT NULL default '0', gid mediumint(9) NOT NULL DEFAULT '0', PRIMARY KEY (id)) ENGINE=MyISAM");
$db->query("INSERT " . NV_PREFIXLANG . "_" . $mod_data . "_bodyhtml_" . $tbhtml . " (`id`, `bodyhtml`, `sourcetext`, `imgposition`, `copyright`, `allowed_send`, `allowed_print`, `allowed_save`) SELECT `id`, `bodyhtml`, `sourcetext`, `imgposition`, `copyright`, `allowed_send`, `allowed_print`, `allowed_save` FROM " . NV_PREFIXLANG3 . "_" . $mod_data3 . "_bodyhtml_" . $tbhtml);
}
$catids = explode(',', $item['listcatid']);
foreach ($catids as $catid) {
$db->exec('INSERT INTO ' . NV_PREFIXLANG . '_' . $mod_data . '_' . $catid . ' SELECT * FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_rows WHERE id=' . $item['id']);
}
$keywords = explode(',', nv_strtolower($item['keywords']));
$keywords = array_map('strip_punctuation', $keywords);
$keywords = array_map('trim', $keywords);
$keywords = array_diff($keywords, array(''));
$keywords = array_unique($keywords);
foreach ($keywords as $keyword) {
if (!empty($keyword)) {
$alias_i = $module_config[$mod_name]['tags_alias'] ? change_alias($keyword) : str_replace(' ', '-', $keyword);
$sth = $db->prepare('SELECT tid, alias, description, keywords FROM ' . NV_PREFIXLANG . '_' . $mod_data . '_tags where alias= :alias OR FIND_IN_SET(:keyword, keywords)>0');
$sth->bindParam(':alias', $alias_i, PDO::PARAM_STR);
$sth->bindParam(':keyword', $keyword, PDO::PARAM_STR);
$sth->execute();
list($tid, $alias, $keywords_i) = $sth->fetch(3);
if (empty($tid)) {
$array_insert = array();
$array_insert['alias'] = $alias_i;
示例14: BoldKeywordInStr
public function BoldKeywordInStr($str, $keyword)
{
$tmp = explode(" ", $keyword);
foreach ($tmp as $k) {
$tp = nv_strtolower($k);
$str = str_replace($tp, "<span class=\"highlight\">" . $tp . "</span>", $str);
$tp = nv_strtoupper($k);
$str = str_replace($tp, "<span class=\"highlight\">" . $tp . "</span>", $str);
$k[0] = nv_strtoupper($k[0]);
$str = str_replace($k, "<span class=\"highlight\">" . $k . "</span>", $str);
}
return $str;
}
示例15: array
$row['gid'] = $nv_Request->get_int('gid', 'post', 0);
$_groups_post = $nv_Request->get_array('activecomm', 'post', array());
$row['activecomm'] = !empty($_groups_post) ? implode(',', nv_groups_post(array_intersect($_groups_post, array_keys($groups_list)))) : '';
if (empty($row['title'])) {
$error = $lang_module['empty_title'];
} elseif (strip_tags($row['bodytext']) == '') {
$error = $lang_module['empty_bodytext'];
} elseif (empty($row['layout_func']) or in_array('layout.' . $row['layout_func'] . '.tpl', $layout_array)) {
$row['alias'] = empty($row['alias']) ? change_alias($row['title']) : change_alias($row['alias']);
if (empty($row['keywords'])) {
$row['keywords'] = nv_get_keywords($row['title']);
if (empty($row['keywords'])) {
$row['keywords'] = nv_unhtmlspecialchars($row['keywords']);
$row['keywords'] = strip_punctuation($row['keywords']);
$row['keywords'] = trim($row['keywords']);
$row['keywords'] = nv_strtolower($row['keywords']);
$row['keywords'] = preg_replace('/[ ]+/', ',', $row['keywords']);
}
}
if ($id) {
$_sql = 'UPDATE ' . NV_PREFIXLANG . '_' . $module_data . ' SET title = :title, alias = :alias, image = :image, imagealt = :imagealt, imageposition = :imageposition, description = :description, bodytext = :bodytext, keywords = :keywords, socialbutton = :socialbutton, activecomm = :activecomm, layout_func = :layout_func, gid = :gid, admin_id = :admin_id, edit_time = ' . NV_CURRENTTIME . ' WHERE id =' . $id;
$publtime = $row['add_time'];
} else {
if ($page_config['news_first']) {
$weight = 1;
} else {
$weight = $db->query("SELECT MAX(weight) FROM " . NV_PREFIXLANG . "_" . $module_data)->fetchColumn();
$weight = intval($weight) + 1;
}
$_sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '
(title, alias, image, imagealt, imageposition, description, bodytext, keywords, socialbutton, activecomm, layout_func, gid, weight,admin_id, add_time, edit_time, status) VALUES