Exemplo n.º 1
0
     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 ='******'";
         $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, '');
Exemplo n.º 2
0
/**
 * 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;
}
Exemplo n.º 3
0
        }
    }
    $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 . '&amp;' . NV_NAME_VARIABLE . '=' . $module_name . '&amp;' . 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)));
    }
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('&quot;', '&copy;', '&gt;', '&lt;', '&nbsp;'), " ", $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;
}
Exemplo n.º 5
0
     $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 . '&amp;' . NV_OP_VARIABLE . '=' . $_other['alias'] . $global_config['rewrite_exturl'];
         $other_links[$_other['id']] = $_other;
Exemplo n.º 6
0
            $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'])) != '') {
Exemplo n.º 7
0
     $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;
Exemplo n.º 8
0
/**
 * 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;
}
Exemplo n.º 9
0
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();
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 10
0
/**
 * 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) != '/') {
            $canonicalUrl = NV_BASE_SITEURL . $canonicalUrl;
        }
        $canonicalUrl = NV_MAIN_DOMAIN . $canonicalUrl;
    }
    //Open Graph protocol http://ogp.me
    if ($global_config['metaTagsOgp']) {
        if (empty($meta_property['og:title'])) {
            $meta_property['og:title'] = $page_title;
        }
        if (empty($meta_property['og:description'])) {
            $meta_property['og:description'] = $site_description;
        }
        if (empty($meta_property['og:type'])) {
            $meta_property['og:type'] = 'WebPage';
        }
        if (empty($meta_property['og:url'])) {
            $meta_property['og:url'] = $canonicalUrl;
        }
        $meta_property['og:site_name'] = $global_config['site_name'];
        foreach ($meta_property as $key => $value) {
            if (!empty($value)) {
                $return .= "<meta property=\"" . $key . "\" content=\"" . $value . "\" />\n";
            }
        }
    } else {
        foreach ($meta_property as $key => $value) {
            if (!preg_match('/^og\\:/', $key) and !empty($value)) {
                $return .= "<meta property=\"" . $key . "\" content=\"" . $value . "\" />\n";
            }
        }
    }
    //tài khoản Google+
    if ($id_profile_googleplus == 0) {
        $id_profile_googleplus = $module_info['gid'];
    }
    if ($id_profile_googleplus > 0) {
        $dbgoogleplus = nv_db_cache('SELECT gid, idprofile FROM ' . $db_config['prefix'] . '_googleplus', 'gid', 'seotools');
        if (isset($dbgoogleplus[$id_profile_googleplus]['idprofile'])) {
            $return .= "<link rel=\"author\" href=\"https://plus.google.com/" . $dbgoogleplus[$id_profile_googleplus]['idprofile'] . "/\" />\n";
        }
    }
    $return .= "<link rel=\"canonical\" href=\"" . $canonicalUrl . "\" />\n";
    return $return;
}
Exemplo n.º 11
0
/**
 * 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;
}
Exemplo n.º 12
0
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);
                        }
                    }
                }
            }
        }
    }
}
Exemplo n.º 13
0
 $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;
Exemplo n.º 14
0
 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;
 }
Exemplo n.º 15
0
    $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
Exemplo n.º 16
0
 }
 $seccode = $nv_Request->get_string('lostpass_seccode', 'session', '');
 $data['nv_seccode'] = $nv_Request->get_title('nv_seccode', 'post', '');
 if (empty($data['nv_seccode']) or !empty($data['nv_seccode']) and md5($data['nv_seccode']) != $seccode and !nv_capcha_txt($data['nv_seccode'])) {
     $nv_Request->set_Session('lostpass_seccode', '');
     die(json_encode(array('status' => 'error', 'input' => 'nv_seccode', 'step' => 'step1', 'mess' => $lang_global['securitycodeincorrect'])));
 }
 $data['userField'] = nv_substr($nv_Request->get_title('userField', 'post', '', 1), 0, 100);
 if (empty($data['userField'])) {
     $nv_Request->set_Session('lostpass_seccode', '');
     die(json_encode(array('status' => 'error', 'input' => 'userField', 'step' => 'step1', 'mess' => $lang_module['lostpass_no_info1'])));
 }
 $check_email = nv_check_valid_email($data['userField']);
 if (empty($check_email)) {
     $sql = 'SELECT * FROM ' . NV_MOD_TABLE . ' WHERE email= :userField AND active=1';
     $userField = nv_strtolower($data['userField']);
 } else {
     $sql = 'SELECT * FROM ' . NV_MOD_TABLE . ' WHERE md5username=:userField AND active=1';
     $userField = nv_md5safe($data['userField']);
 }
 $stmt = $db->prepare($sql);
 $stmt->bindParam(':userField', $userField, PDO::PARAM_STR);
 $stmt->execute();
 $row = $stmt->fetch();
 if (empty($row)) {
     $nv_Request->set_Session('lostpass_seccode', '');
     die(json_encode(array('status' => 'error', 'input' => 'userField', 'step' => 'step1', 'mess' => $lang_module['lostpass_no_info2'])));
 }
 if (empty($row['password'])) {
     $nv_Request->set_Session('lostpass_seccode', '');
     $url = NV_BASE_SITEURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=login';
Exemplo n.º 17
0
}
//Kich hoat thanh vien
if ($nv_Request->isset_request('act', 'get')) {
    $userid = $nv_Request->get_int('userid', 'get', 0);
    $sql = 'SELECT * FROM ' . NV_USERS_GLOBALTABLE . '_reg WHERE userid=' . $userid;
    $row = $db->query($sql)->fetch();
    if (empty($row)) {
        Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name);
        die;
    }
    $sql = "INSERT INTO " . NV_USERS_GLOBALTABLE . " (\n\t\tusername, md5username, password, email, first_name, last_name, gender, photo, birthday,\n\t\tregdate, question,\n\t\tanswer, passlostkey, view_mail, remember, in_groups, active, checknum,\n\t\tlast_login, last_ip, last_agent, last_openid, idsite\n\t\t) VALUES (\n\t\t:username,\n\t\t:md5_username,\n\t\t:password,\n\t\t:email,\n\t\t:first_name,\n\t\t:last_name,\n\t\t'', '', 0, " . $row['regdate'] . ",\n\t\t:question,\n\t\t:answer,\n\t\t'', 0, 0, '', 1, '', 0, '', '', '', " . $global_config['idsite'] . ")";
    $data_insert = array();
    $data_insert['username'] = $row['username'];
    $data_insert['md5_username'] = nv_md5safe($row['username']);
    $data_insert['password'] = $row['password'];
    $data_insert['email'] = nv_strtolower($row['email']);
    $data_insert['first_name'] = $row['first_name'];
    $data_insert['last_name'] = $row['last_name'];
    $data_insert['question'] = $row['question'];
    $data_insert['answer'] = $row['answer'];
    $userid = $db->insert_id($sql, 'userid', $data_insert);
    if ($userid) {
        // Luu vao bang OpenID
        if (!empty($row['openid_info'])) {
            $reg_attribs = unserialize(nv_base64_decode($row['openid_info']));
            $stmt = $db->prepare('INSERT INTO ' . NV_USERS_GLOBALTABLE . '_openid VALUES (' . $userid . ', :server, :opid , :email)');
            $stmt->bindParam(':server', $reg_attribs['server'], PDO::PARAM_STR);
            $stmt->bindParam(':opid', $reg_attribs['opid'], PDO::PARAM_STR);
            $stmt->bindParam(':email', $reg_attribs['email'], PDO::PARAM_STR);
            $stmt->execute();
        }
Exemplo n.º 18
0
 if (empty($site_timezone) or !empty($site_timezone) and (in_array($site_timezone, $timezone_array) or $site_timezone == 'byCountry')) {
     $array_config_global['site_timezone'] = $site_timezone;
 }
 $my_domains = $nv_Request->get_title('my_domains', 'post', '');
 $array_config_global['my_domains'] = array(NV_SERVER_NAME);
 if (!empty($my_domains)) {
     $my_domains = array_map('trim', explode(',', $my_domains));
     foreach ($my_domains as $dm) {
         $dm = preg_replace('/^(http|https|ftp|gopher)\\:\\/\\//', '', $dm);
         $dm = preg_replace('/^([^\\/]+)\\/*(.*)$/', '\\1', $dm);
         $_p = '';
         if (preg_match('/(.*)\\:([0-9]+)$/', $dm, $m)) {
             $dm = $m[1];
             $_p = ':' . $m[2];
         }
         $dm = nv_check_domain(nv_strtolower($dm));
         if (!empty($dm)) {
             $array_config_global['my_domains'][] = $dm . $_p;
         }
     }
 }
 $array_config_global['my_domains'] = array_unique($array_config_global['my_domains']);
 $array_config_global['my_domains'] = implode(',', $array_config_global['my_domains']);
 $array_config_global['ssl_https'] = $nv_Request->get_int('ssl_https', 'post');
 $array_config_global['gzip_method'] = $nv_Request->get_int('gzip_method', 'post');
 $array_config_global['lang_multi'] = $nv_Request->get_int('lang_multi', 'post');
 $array_config_global['optActive'] = $nv_Request->get_int('optActive', 'post');
 $array_config_global['notification_active'] = $nv_Request->get_int('notification_active', 'post');
 $array_config_global['notification_autodel'] = $nv_Request->get_int('notification_autodel', 'post', 15);
 if ($array_config_global['notification_active'] != $global_config['notification_active']) {
     $db->query('UPDATE ' . $db_config['dbsystem'] . '.' . NV_CRONJOBS_GLOBALTABLE . ' SET act=' . $array_config_global['notification_active'] . ', last_time=' . NV_CURRENTTIME . ', last_result=0 WHERE run_func="cron_notification_autodel"');
Exemplo n.º 19
0
 $array_config_global['error_set_logs'] = $nv_Request->get_int('error_set_logs', 'post', 0);
 $error_send_email = nv_substr($nv_Request->get_title('error_send_email', 'post', '', 1), 0, 255);
 if (nv_check_valid_email($error_send_email) == '') {
     $array_config_global['error_send_email'] = $error_send_email;
 }
 $array_config_global['cdn_url'] = '';
 $cdn_url = rtrim($nv_Request->get_string('cdn_url', 'post'), '/');
 if (!empty($cdn_url)) {
     $cdn_url = preg_replace('/^(http|https)\\:\\/\\//', '', $cdn_url);
     $cdn_url = preg_replace('/^([^\\/]+)\\/*(.*)$/', '\\1', $cdn_url);
     $_p = '';
     if (preg_match('/(.*)\\:([0-9]+)$/', $cdn_url, $m)) {
         $cdn_url = $m[1];
         $_p = ':' . $m[2];
     }
     $cdn_url = nv_check_domain(nv_strtolower($cdn_url));
     if (!empty($cdn_url)) {
         $array_config_global['cdn_url'] = $cdn_url . $_p;
     }
 }
 $sth = $db->prepare("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = :config_value WHERE lang = 'sys' AND module = 'global' AND config_name = :config_name");
 foreach ($array_config_global as $config_name => $config_value) {
     $sth->bindParam(':config_name', $config_name, PDO::PARAM_STR, 30);
     $sth->bindParam(':config_value', $config_value, PDO::PARAM_STR);
     $sth->execute();
 }
 nv_save_file_config_global();
 $array_config_rewrite = array('rewrite_optional' => $array_config_global['rewrite_optional'], 'rewrite_endurl' => $global_config['rewrite_endurl'], 'rewrite_exturl' => $global_config['rewrite_exturl'], 'rewrite_op_mod' => $array_config_global['rewrite_op_mod'], 'ssl_https' => $array_config_global['ssl_https']);
 $rewrite = nv_rewrite_change($array_config_rewrite);
 if (empty($rewrite[0])) {
     $errormess .= sprintf($lang_module['err_writable'], $rewrite[1]);
Exemplo n.º 20
0
        $weight = 0;
        while (list($key, $val) = $result->fetch(3)) {
            $row_field['field_choices'][$key] = $val;
        }
    }
    $array_field_config[] = $row_field;
}
$custom_fields = $nv_Request->get_array('custom_fields', 'post');
if (defined('NV_EDITOR')) {
    require_once NV_ROOTDIR . '/' . NV_EDITORSDIR . '/' . NV_EDITOR . '/nv.php';
}
$_user = array();
$userid = 0;
if ($nv_Request->isset_request('confirm', 'post')) {
    $_user['username'] = $nv_Request->get_title('username', 'post', '', 1);
    $_user['email'] = nv_strtolower($nv_Request->get_title('email', 'post', '', 1));
    $_user['password1'] = $nv_Request->get_title('password1', 'post', '', 0);
    $_user['password2'] = $nv_Request->get_title('password2', 'post', '', 0);
    $_user['question'] = nv_substr($nv_Request->get_title('question', 'post', '', 1), 0, 255);
    $_user['answer'] = nv_substr($nv_Request->get_title('answer', 'post', '', 1), 0, 255);
    $_user['first_name'] = nv_substr($nv_Request->get_title('first_name', 'post', '', 1), 0, 255);
    $_user['last_name'] = nv_substr($nv_Request->get_title('last_name', 'post', '', 1), 0, 255);
    $_user['gender'] = nv_substr($nv_Request->get_title('gender', 'post', '', 1), 0, 1);
    $_user['view_mail'] = $nv_Request->get_int('view_mail', 'post', 0);
    $_user['sig'] = $nv_Request->get_textarea('sig', '', NV_ALLOWED_HTML_TAGS);
    $_user['birthday'] = $nv_Request->get_title('birthday', 'post');
    $_user['in_groups'] = $nv_Request->get_typed_array('group', 'post', 'int');
    $_user['in_groups_default'] = $nv_Request->get_int('group_default', 'post', 0);
    $_user['photo'] = nv_substr($nv_Request->get_title('photo', 'post', '', 1), 0, 255);
    $_user['is_official'] = $nv_Request->get_int('is_official', 'post', 0);
    $md5username = nv_md5safe($_user['username']);
Exemplo n.º 21
0
/**
 * nv_html_meta_tags()
 *
 * @param bool $html
 * @return
 */
function nv_html_meta_tags($html = true)
{
    global $global_config, $db_config, $lang_global, $key_words, $description, $module_info, $home, $client_info, $op, $page_title, $canonicalUrl, $meta_property;
    $return = array();
    $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(array('/<[^>]*>/', '/[\\r\\n\\t]+/'), ' ', $site_description);
        $site_description = trim(preg_replace('/[ ]+/', ' ', $site_description));
        if ($global_config['description_length']) {
            $site_description = nv_clean60($site_description, $global_config['description_length'], true);
        }
        $return[] = array('name' => 'name', 'value' => 'description', 'content' => $site_description);
    }
    $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[] = array('name' => 'name', 'value' => 'keywords', 'content' => $key_words);
        $return[] = array('name' => 'name', 'value' => 'news_keywords', 'content' => $key_words);
    }
    $return[] = array('name' => 'http-equiv', 'value' => 'Content-Type', 'content' => "text/html; charset=" . $global_config['site_charset']);
    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[] = array('name' => $meta['group'], 'value' => $meta['value'], 'content' => $meta['content']);
                }
            }
        }
    }
    $return[] = array('name' => 'name', 'value' => 'generator', 'content' => 'NukeViet v4.0');
    if (defined('NV_IS_ADMIN')) {
        $return[] = array('name' => 'http-equiv', 'value' => 'refresh', 'content' => $global_config['admin_check_pass_time']);
    }
    if ($global_config['current_theme_type'] == 'r') {
        $return[] = array('name' => 'name', 'value' => 'viewport', 'content' => "width=device-width, initial-scale=1");
    }
    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) != '/') {
            $canonicalUrl = NV_BASE_SITEURL . $canonicalUrl;
        }
        $canonicalUrl = NV_MAIN_DOMAIN . $canonicalUrl;
    }
    //Open Graph protocol http://ogp.me
    if ($global_config['metaTagsOgp']) {
        if (empty($meta_property['og:title'])) {
            $meta_property['og:title'] = $page_title;
        }
        if (empty($meta_property['og:description'])) {
            $meta_property['og:description'] = $site_description;
        }
        if (empty($meta_property['og:type'])) {
            $meta_property['og:type'] = 'website';
        }
        if (empty($meta_property['og:url'])) {
            $meta_property['og:url'] = $canonicalUrl;
        }
        $meta_property['og:site_name'] = $global_config['site_name'];
        foreach ($meta_property as $key => $value) {
            if (is_array($value)) {
                foreach ($value as $value_i) {
                    if (!empty($value_i)) {
                        $return[] = array('name' => 'property', 'value' => $key, 'content' => $value_i);
                    }
                }
            } elseif (!empty($value)) {
                $return[] = array('name' => 'property', 'value' => $key, 'content' => $value);
            }
        }
    } else {
        foreach ($meta_property as $key => $value) {
            if (!preg_match('/^og\\:/', $key) and !empty($value)) {
                $return[] = array('name' => 'property', 'value' => $key, 'content' => $value);
            }
        }
    }
    if (!$html) {
        return $return;
    }
    $res = "";
    foreach ($return as $link) {
        $res .= "<meta " . $link['name'] . "=\"" . $link['value'] . "\" content=\"" . $link['content'] . "\" />" . PHP_EOL;
    }
    return $res;
}
Exemplo n.º 22
0
/**
 * nv_html_meta_tags()
 * 
 * @return
 */
function nv_html_meta_tags()
{
    global $global_config, $lang_global, $key_words, $description, $module_info;
    $return = "<meta http-equiv=\"Content-Language\" content=\"" . $lang_global['Content_Language'] . "\" />\n";
    $return .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $global_config['site_charset'] . "\" />\n";
    if (defined('NV_IS_ADMIN')) {
        $return .= "<meta http-equiv=\"refresh\" content=\"" . NV_ADMIN_CHECK_PASS_TIME . "\" />\n";
    }
    $return .= "<meta name=\"language\" content=\"" . $lang_global['LanguageName'] . "\" />\n";
    $return .= "<meta name=\"author\" content=\"" . $global_config['site_name'] . "\" />\n";
    $return .= "<meta name=\"copyright\" content=\"" . $global_config['site_name'] . " [" . $global_config['site_email'] . "]\" />\n";
    $ds = !empty($description) ? $description : $global_config['site_description'];
    $return .= !empty($ds) ? "<meta name=\"description\" content=\"" . strip_tags($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 = implode(",", $kw);
        $kw = preg_replace("/\\,\\s+/", ",", $kw);
        $key_words = nv_strtolower(strip_tags($kw));
        $return .= "<meta name=\"keywords\" content=\"" . $key_words . "\" />\n";
    }
    $return .= "<meta name=\"generator\" content=\"Nukeviet v3.0\" />\n";
    return $return;
}