Example #1
0
/**
 * nv_CreateXML_bannerPlan()
 *
 * @return
 */
function nv_CreateXML_bannerPlan()
{
    global $db, $global_config;
    $pattern = $global_config['idsite'] ? '/^site\\_' . $global_config['idsite'] . '\\_bpl\\_([0-9]+)\\.xml$/' : '/^bpl\\_([0-9]+)\\.xml$/';
    $files = nv_scandir(NV_ROOTDIR . '/' . NV_DATADIR, $pattern);
    if (!empty($files)) {
        foreach ($files as $file) {
            nv_deletefile(NV_ROOTDIR . '/' . NV_DATADIR . '/' . $file);
        }
    }
    $sql = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_plans WHERE act = 1';
    $result = $db->query($sql);
    while ($row = $result->fetch()) {
        $id = intval($row['id']);
        if ($global_config['idsite']) {
            $xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/site_' . $global_config['idsite'] . '_bpl_' . $id . '.xml';
        } else {
            $xmlfile = NV_ROOTDIR . '/' . NV_DATADIR . '/bpl_' . $id . '.xml';
        }
        $plan = array();
        $plan['id'] = $id;
        $plan['lang'] = $row['blang'];
        $plan['title'] = $row['title'];
        if (!empty($row['description'])) {
            $plan['description'] = $row['description'];
        }
        $plan['form'] = $row['form'];
        $plan['width'] = $row['width'];
        $plan['height'] = $row['height'];
        $query2 = 'SELECT * FROM ' . NV_BANNERS_GLOBALTABLE . '_rows WHERE pid = ' . $id . ' AND (exp_time > ' . NV_CURRENTTIME . ' OR exp_time = 0 ) AND act = 1';
        if ($row['form'] == 'sequential') {
            $query2 .= ' ORDER BY weight ASC';
        }
        $plan['banners'] = array();
        $result2 = $db->query($query2);
        while ($row2 = $result2->fetch()) {
            $plan['banners'][] = array('id' => $row2['id'], 'title' => $row2['title'], 'clid' => $row2['clid'], 'file_name' => $row2['file_name'], 'imageforswf' => $row2['imageforswf'], 'file_ext' => $row2['file_ext'], 'file_mime' => $row2['file_mime'], 'file_width' => $row2['width'], 'file_height' => $row2['height'], 'file_alt' => $row2['file_alt'], 'file_click' => $row2['click_url'], 'target' => $row2['target'], 'publ_time' => $row2['publ_time'], 'exp_time' => $row2['exp_time']);
        }
        if (sizeof($plan['banners'])) {
            $array2XML = new NukeViet\Xml\Array2XML();
            $array2XML->saveXML($plan, 'plan', $xmlfile, $encoding = $global_config['site_charset']);
        }
    }
}
Example #2
0
    $searchEngineName = $nv_Request->get_array('searchEngineName', 'post');
    $searchEngineValue = $nv_Request->get_array('searchEngineValue', 'post');
    $searchEngineActive = $nv_Request->get_array('searchEngineActive', 'post');
    foreach ($searchEngineName as $key => $name) {
        $name = trim(strip_tags($name));
        $value = trim(strip_tags($searchEngineValue[$key]));
        $active = intval($searchEngineActive[$key]);
        if (!empty($name) and !empty($value)) {
            $searchEngines['searchEngine'][] = array('name' => $name, 'value' => $value, 'active' => $active);
        }
    }
    if (file_exists($file_searchEngines)) {
        nv_deletefile($file_searchEngines);
    }
    if (!empty($searchEngines['searchEngine'])) {
        $array2XML = new NukeViet\Xml\Array2XML();
        $array2XML->saveXML($searchEngines, 'searchEngines', $file_searchEngines, $global_config['site_charset']);
    }
} else {
    if (file_exists($file_searchEngines)) {
        $mt = simplexml_load_file($file_searchEngines);
        $mt = nv_object2array($mt);
        if ($mt['searchEngine_item']) {
            if (isset($mt['searchEngine_item'][0])) {
                $searchEngines['searchEngine'] = $mt['searchEngine_item'];
            } else {
                $searchEngines['searchEngine'][] = $mt['searchEngine_item'];
            }
        }
    }
    if (!empty($searchEngines['searchEngine']) and $nv_Request->isset_request('ping', 'post')) {
Example #3
0
    $metaContents = $nv_Request->get_array('metaContents', 'post');
    foreach ($metaGroupsName as $key => $name) {
        if ($name == 'http-equiv' or $name == 'name' or $name == 'property') {
            $value = trim(strip_tags($metaGroupsValue[$key]));
            $content = trim(strip_tags($metaContents[$key]));
            $newArray = array('group' => $name, 'value' => $value, 'content' => $content);
            if (preg_match("/^[a-zA-Z0-9\\-\\_\\.\\:]+\$/", $value) and !in_array($value, $ignore) and preg_match("/^([^\\'\"]+)\$/", $content) and !in_array($newArray, $metatags['meta'])) {
                $metatags['meta'][] = $newArray;
            }
        }
    }
    if (file_exists($file_metatags)) {
        nv_deletefile($file_metatags);
    }
    if (!empty($metatags['meta'])) {
        $array2XML = new NukeViet\Xml\Array2XML();
        $array2XML->saveXML($metatags, 'metatags', $file_metatags, $global_config['site_charset']);
    }
    $metaTagsOgp = (int) $nv_Request->get_bool('metaTagsOgp', 'post');
    $description_length = $nv_Request->get_int('description_length', 'post');
    $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $metaTagsOgp . "' WHERE lang = 'sys' AND module = 'site' AND config_name = 'metaTagsOgp'");
    $db->query("UPDATE " . NV_CONFIG_GLOBALTABLE . " SET config_value = '" . $description_length . "' WHERE lang = 'sys' AND module = 'site' AND config_name = 'description_length'");
    $nv_Cache->delAll(false);
    Header('Location: ' . NV_BASE_ADMINURL . 'index.php?' . NV_LANG_VARIABLE . '=' . NV_LANG_DATA . '&' . NV_NAME_VARIABLE . '=' . $module_name . '&' . NV_OP_VARIABLE . '=' . $op . '&rand=' . nv_genpass());
    exit;
} else {
    if (!file_exists($file_metatags)) {
        $file_metatags = NV_ROOTDIR . '/' . NV_DATADIR . '/metatags.xml';
    }
    $mt = simplexml_load_file($file_metatags);
    $mt = nv_object2array($mt);