예제 #1
0
/**
 * BoldKeywordInStr()
 * 
 * @param mixed $str
 * @param mixed $keyword
 * @return
 */
function BoldKeywordInStr($str, $keyword, $logic)
{
    global $db;
    $str = nv_br2nl($str);
    $str = nv_nl2br($str, " ");
    $str = nv_unhtmlspecialchars(strip_tags(trim($str)));
    $str = $db->unfixdb($str);
    $pos = false;
    if ($logic == 'AND') {
        $array_keyword = array($keyword, nv_EncString($keyword));
    } else {
        $keyword .= " " . nv_EncString($keyword);
        $array_keyword = explode(" ", $keyword);
        $array_keyword = array_unique($array_keyword);
    }
    foreach ($array_keyword as $k) {
        unset($matches);
        if (preg_match("/^(.*?)" . preg_quote($k) . "/uis", $str, $matches)) {
            $strlen = nv_strlen($str);
            $kstrlen = nv_strlen($k);
            $residual = $strlen - 300;
            if ($residual > 0) {
                $lstrlen = nv_strlen($matches[1]);
                $rstrlen = $strlen - $lstrlen - $kstrlen;
                $medium = round((300 - $kstrlen) / 2);
                if ($lstrlen <= $medium) {
                    $str = nv_clean60($str, 300);
                } elseif ($rstrlen <= $medium) {
                    $str = nv_substr($str, $residual, 300);
                    $str = nv_substr_clean($str, 'l');
                } else {
                    $str = nv_substr($str, $lstrlen - $medium, $strlen - $lstrlen + $medium);
                    $str = nv_substr($str, 0, 300);
                    $str = nv_substr_clean($str, 'lr');
                }
            }
            $pos = true;
            break;
        }
    }
    if (!$pos) {
        return nv_clean60($str, 300);
    }
    $pattern = array();
    foreach ($array_keyword as $k) {
        $pattern[] = "/(" . preg_quote($k) . ")/uis";
    }
    $str = preg_replace($pattern, "{\\1}", $str);
    $str = str_replace(array("{", "}"), array("<span class=\"keyword\">", "</span>"), $str);
    return $str;
}
예제 #2
0
/**
 * BoldKeywordInStr()
 *
 * @param mixed $str
 * @param mixed $keyword
 * @return
 */
function BoldKeywordInStr($str, $keyword, $logic)
{
    $str = nv_br2nl($str);
    $str = nv_nl2br($str, ' ');
    $str = nv_unhtmlspecialchars(strip_tags(trim($str)));
    $pos = false;
    if ($logic == 'AND') {
        $array_keyword = array($keyword, nv_EncString($keyword));
    } else {
        $keyword .= ' ' . nv_EncString($keyword);
        $array_keyword = explode(' ', $keyword);
        $array_keyword = array_unique($array_keyword);
    }
    foreach ($array_keyword as $k) {
        if (preg_match('/^(.*?)' . nv_preg_quote($k) . '/uis', $str, $matches)) {
            $strlen = nv_strlen($str);
            $kstrlen = nv_strlen($k);
            $residual = $strlen - 300;
            if ($residual > 0) {
                $lstrlen = nv_strlen($matches[1]);
                $rstrlen = $strlen - $lstrlen - $kstrlen;
                $medium = round((300 - $kstrlen) / 2);
                if ($lstrlen <= $medium) {
                    $str = nv_clean60($str, 300);
                } elseif ($rstrlen <= $medium) {
                    $str = nv_substr($str, $residual, 300);
                    $str = nv_substr_clean($str, 'l');
                } else {
                    $str = nv_substr($str, $lstrlen - $medium, $strlen - $lstrlen + $medium);
                    $str = nv_substr($str, 0, 300);
                    $str = nv_substr_clean($str, 'lr');
                }
            }
            $pos = true;
            break;
        }
    }
    if (!$pos) {
        return nv_clean60($str, 300);
    }
    $pattern = array();
    foreach ($array_keyword as $k) {
        $pattern[] = '/(' . nv_preg_quote($k) . ')/uis';
    }
    $str = preg_replace($pattern, '{\\1}', $str);
    $str = str_replace(array('{', '}'), array('<span class="keyword">', '</span>'), $str);
    return $str;
}
예제 #3
0
파일: copy.php 프로젝트: atarubi/nuke-viet
 $typelang = filter_text_input('typelang', 'post', '');
 if ($typelang == "-vi") {
     $typelang = "-";
     $replace_lang_vi = true;
 } else {
     $replace_lang_vi = false;
 }
 if (isset($language_array[$newslang])) {
     nv_admin_add_field_lang($newslang);
     if ($replace_lang_vi == true) {
         nv_copyfile(NV_ROOTDIR . "/js/language/vi.js", NV_ROOTDIR . "/js/language/" . $newslang . ".js");
         $db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "_file` SET `author_" . $newslang . "`=`author_vi`");
         $query = "SELECT `id`, `lang_vi` FROM `" . NV_LANGUAGE_GLOBALTABLE . "`";
         $result = $db->sql_query($query);
         while (list($id, $author_lang) = $db->sql_fetchrow($result)) {
             $author_lang = nv_EncString($author_lang);
             $db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "` SET `lang_" . $newslang . "` ='" . $author_lang . "' WHERE `id` = '" . $id . "'");
         }
     } elseif (isset($language_array[$typelang])) {
         nv_copyfile(NV_ROOTDIR . "/js/language/" . $typelang . ".js", NV_ROOTDIR . "/js/language/" . $newslang . ".js");
         $db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "_file` SET `author_" . $newslang . "`=`author_" . $typelang . "`");
         $db->sql_query("UPDATE `" . NV_LANGUAGE_GLOBALTABLE . "` SET `lang_" . $newslang . "`=`lang_" . $typelang . "`");
     }
     $nv_Request->set_Cookie('dirlang', $newslang, NV_LIVE_COOKIE_TIME);
     $xtpl->assign('URL', NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=interface");
     $xtpl->parse('copyok');
     $contents = $xtpl->text('copyok');
     include NV_ROOTDIR . "/includes/header.php";
     echo nv_admin_theme($contents);
     include NV_ROOTDIR . "/includes/footer.php";
 }
예제 #4
0
                 $xtpl->assign('SITE_NAME', $global_config['site_name']);
                 $xtpl->assign('SITE_SLOGAN', $global_config['site_description']);
                 $xtpl->assign('SITE_EMAIL', $global_config['site_email']);
                 $xtpl->assign('SITE_FONE', $global_config['site_phone']);
                 $xtpl->assign('SITE_URL', $global_config['site_url']);
                 $xtpl->assign('TITLE', $title);
                 $xtpl->assign('CONTENT', $mess);
                 $xtpl->assign('AUTHOR_SIG', $my_sig);
                 $xtpl->assign('AUTHOR_NAME', $admin_info['username']);
                 $xtpl->assign('AUTHOR_POS', $admin_info['position']);
                 $xtpl->assign('AUTHOR_EMAIL', $my_mail);
                 $xtpl->parse('main');
                 $content = $xtpl->text('main');
                 $from = array($admin_info['username'], $my_mail);
                 $to = $row_user['email'];
                 $send = nv_sendmail($from, $to, nv_EncString($title), $content);
                 if (!$send) {
                     nv_info_die($lang_global['error_info_caption'], $lang_global['site_info'], $lang_global['error_sendmail_admin'], 1);
                 }
             }
         }
         Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=suspend&id=" . $id);
     }
 } else {
     $adminpass = $new_reason = "";
     $clean_history = $sendmail = 0;
 }
 $contents['change_suspend']['new_suspend_caption'] = !empty($error) ? $error : $lang_module['chg_is_suspend' . $new_suspend];
 $contents['change_suspend']['new_suspend_is_error'] = !empty($error) ? 1 : 0;
 $contents['change_suspend']['new_suspend_action'] = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=suspend&amp;admin_id=" . $admin_id;
 $contents['change_suspend']['sendmail'] = array($lang_module['suspend_sendmail'], $sendmail);
예제 #5
0
/**
 * change_alias()
 *
 * @return
 */
function change_alias($alias)
{
    $alias = preg_replace('/[\\x{0300}\\x{0301}\\x{0303}\\x{0309}\\x{0323}]/u', '', $alias);
    // fix unicode consortium for Vietnamese
    $search = array('&amp;', '&#039;', '&quot;', '&lt;', '&gt;', '&#x005C;', '&#x002F;', '&#40;', '&#41;', '&#42;', '&#91;', '&#93;', '&#33;', '&#x3D;', '&#x23;', '&#x25;', '&#x5E;', '&#x3A;', '&#x7B;', '&#x7D;', '&#x60;', '&#x7E;');
    $alias = preg_replace(array('/[^a-zA-Z0-9]/', '/[ ]+/', '/^[\\-]+/', '/[\\-]+$/'), array(' ', '-', '', ''), str_replace($search, ' ', nv_EncString($alias)));
    return $alias;
}
예제 #6
0
 /**
  * upload::string_to_filename()
  * 
  * @param mixed $word
  * @return
  */
 function string_to_filename($word)
 {
     $word = nv_EncString($word);
     $word = preg_replace('/[^a-z0-9\\.\\-\\_ ]/i', '', $word);
     $word = preg_replace('/^\\W+|\\W+$/', '', $word);
     $word = preg_replace('/\\s+/', '-', $word);
     return strtolower(preg_replace('/\\W-/', '', $word));
 }
예제 #7
0
    $numrows = $db->sql_numrows($result);
    if ($numrows != 1) {
        Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name);
        die;
    }
    $row = $db->sql_fetchrow($result);
    $sql = "INSERT INTO `" . NV_USERS_GLOBALTABLE . "` (\n    `userid`, `username`, `md5username`, `password`, `email`, `full_name`, `gender`, `photo`, `birthday`, \n    `regdate`, `website`, `location`, `yim`, `telephone`, `fax`, `mobile`, `question`, \n    `answer`, `passlostkey`, `view_mail`, `remember`, `in_groups`, `active`, `checknum`, \n    `last_login`, `last_ip`, `last_agent`, `last_openid`\n    ) VALUES (\n    NULL, \n    " . $db->dbescape($row['username']) . ", \n    " . $db->dbescape(md5($row['username'])) . ", \n    " . $db->dbescape($row['password']) . ", \n    " . $db->dbescape($row['email']) . ", \n    " . $db->dbescape($row['full_name']) . ", \n    '', '', 0, " . $row['regdate'] . ", '', '', '', '', '', '', \n    " . $db->dbescape($row['question']) . ", \n    " . $db->dbescape($row['answer']) . ", \n    '', 0, 0, '', 1, '', 0, '', '', '')";
    $userid = $db->sql_query_insert_id($sql);
    if ($userid) {
        $db->sql_query("DELETE FROM `" . NV_USERS_GLOBALTABLE . "_reg` WHERE `userid`=" . $row['userid']);
        nv_insert_logs(NV_LANG_DATA, $module_name, $lang_module['active_users'], 'userid: ' . $userid . ' - username: '******'username'], $admin_info['userid']);
        $full_name = !empty($row['full_name']) ? $row['full_name'] : $row['username'];
        $subject = $lang_module['adduser_register'];
        $message = sprintf($lang_module['adduser_register_info'], $full_name, $global_config['site_name'], NV_MY_DOMAIN . NV_BASE_SITEURL . "index.php?" . NV_LANG_VARIABLE . "=" . NV_LANG_DATA . "&" . NV_NAME_VARIABLE . "=" . $module_name, $row['username']);
        $message .= "<br /><br />------------------------------------------------<br /><br />";
        $message .= nv_EncString($message);
        @nv_sendmail($global_config['site_email'], $row['email'], $subject, $message);
    }
    Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=user_waiting");
    die;
}
$page_title = $table_caption = $lang_module['member_wating'];
$sql = "FROM `" . NV_USERS_GLOBALTABLE . "_reg`";
$base_url = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=user_waiting";
$methods = array('userid' => array('key' => 'userid', 'value' => $lang_module['search_id'], 'selected' => ''), 'username' => array('key' => 'username', 'value' => $lang_module['search_account'], 'selected' => ''), 'full_name' => array('key' => 'full_name', 'value' => $lang_module['search_name'], 'selected' => ''), 'email' => array('key' => 'email', 'value' => $lang_module['search_mail'], 'selected' => ''));
$method = $nv_Request->isset_request('method', 'post') ? $nv_Request->get_string('method', 'post', '') : ($nv_Request->isset_request('method', 'get') ? urldecode($nv_Request->get_string('method', 'get', '')) : '');
$methodvalue = $nv_Request->isset_request('value', 'post') ? $nv_Request->get_string('value', 'post') : ($nv_Request->isset_request('value', 'get') ? urldecode($nv_Request->get_string('value', 'get', '')) : '');
$orders = array('userid', 'username', 'full_name', 'email', 'regdate');
$orderby = $nv_Request->get_string('sortby', 'get', '');
$ordertype = $nv_Request->get_string('sorttype', 'get', '');
if ($ordertype != "ASC") {
/**
 * nv_string_to_filename()
 * 
 * @param mixed $word
 * @return
 */
function nv_string_to_filename($word)
{
    $word = nv_EncString($word);
    $word = preg_replace('/[^a-z0-9\\.\\-\\_ ]/i', '', $word);
    $word = preg_replace('/\\s+/', '_', $word);
    return preg_replace('/\\W-/', '', $word);
}
예제 #9
0
function alias($alias)
{
    $alias = nv_EncString($alias);
    //thêm trường hợp các kí tự đặc biệt
    $alias = preg_replace("/(!|\"|#|\$|%|'|̣)/", '', $alias);
    $alias = preg_replace("/(̀|́|̉|\$|>)/", '', $alias);
    $alias = preg_replace("'<[\\/\\!]*?[^<>]*?>'si", "", $alias);
    $alias = str_replace("----", " ", $alias);
    $alias = str_replace("---", " ", $alias);
    $alias = str_replace("--", " ", $alias);
    $alias = preg_replace('/(\\W+)/i', '-', $alias);
    $alias = str_replace(array('-8220-', '-8221-', '-7776-'), '-', $alias);
    $alias = preg_replace('/[^a-zA-Z0-9\\-]+/e', '', $alias);
    $alias = str_replace(array('dAg', 'DAg', 'uA', 'iA', 'yA', 'dA', '--', '-8230'), array('dong', 'Dong', 'uon', 'ien', 'yen', 'don', '-', ''), $alias);
    $alias = preg_replace('/(\\-)$/', '', $alias);
    $alias = preg_replace('/^(\\-)/', '', $alias);
    return $alias;
}
$base_url = NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&amp;" . NV_OP_VARIABLE . "=groups_search_users&amp;group_id=" . $group_id;
$search_option = $nv_Request->get_int('search_option', 'get', 0);
$search_query = rawurldecode(filter_text_input('search_query', 'get'));
if (!empty($search_query)) {
    $search_query = nv_substr($search_query, 0, 60);
}
if (!empty($search_query)) {
    switch ($search_option) {
        case 1:
            $query .= " WHERE `email` LIKE '%" . $db->dblikeescape($search_query) . "%'";
            break;
        case 2:
            $query .= " WHERE `userid` LIKE '%" . intval($search_query) . "%'";
            break;
        default:
            $search_query = preg_replace('/\\s+/', '_', nv_EncString($search_query));
            $search_query = $db->dblikeescape(strtolower($search_query));
            $query .= " WHERE (`username` LIKE '%" . $search_query . "%' OR `full_name` LIKE '%" . $search_query . "%')";
    }
    $base_url .= "&amp;search_option=" . $search_option . "&amp;search_query=" . rawurlencode($search_query);
}
if (!empty($users)) {
    $query .= !empty($search_query) ? " AND" : " WHERE";
    $query .= " `userid` NOT IN (" . $users . ")";
}
$result = $db->sql_query($query);
$all_page = $db->sql_numrows($result);
if (empty($all_page)) {
    die(error_info_theme($lang_module['search_not_result']));
}
$page = $nv_Request->get_int('page', 'get', 0);
예제 #11
0
/**
 * change_alias()
 * 
 * @return
 */
function change_alias($alias)
{
    $alias = nv_EncString($alias);
    $search = array('&amp;', '&#039;', '&quot;', '&lt;', '&gt;', '&#x005C;', '&#x002F;', '&#40;', '&#41;', '&#42;', '&#91;', '&#93;', '&#33;', '&#x3D;', '&#x23;', '&#x25;', '&#x5E;', '&#x3A;', '&#x7B;', '&#x7D;', '&#x60;', '&#x7E;');
    $alias = str_replace($search, " ", $alias);
    $alias = preg_replace("/([^a-z0-9-\\s])/is", "", $alias);
    $alias = preg_replace("/[\\s]+/", " ", $alias);
    $alias = preg_replace("/\\s/", "-", $alias);
    $alias = preg_replace('/(\\-)$/', '', $alias);
    $alias = preg_replace('/^(\\-)/', '', $alias);
    $alias = preg_replace('/[\\-]+/', '-', $alias);
    return $alias;
}
예제 #12
0
/**
 * change_alias()
 * 
 * @return
 */
function change_alias($alias)
{
    $search = array('&amp;', '&#039;', '&quot;', '&lt;', '&gt;', '&#x005C;', '&#x002F;', '&#40;', '&#41;', '&#42;', '&#91;', '&#93;', '&#33;', '&#x3D;', '&#x23;', '&#x25;', '&#x5E;', '&#x3A;', '&#x7B;', '&#x7D;', '&#x60;', '&#x7E;');
    $alias = preg_replace(array("/[^a-zA-Z0-9]/", '/[ ]+/', "/^[\\-]+/", "/[\\-]+\$/"), array(" ", "-", "", ""), str_replace($search, " ", nv_EncString($alias)));
    return $alias;
}