示例#1
0
 * @Copyright (C) 2010 VINADES.,JSC. All rights reserved
 * @Createdate 7-17-2010 14:43
 */
if (!defined('NV_IS_ALBUMS_ADMIN')) {
    die('Stop!!!');
}
$page_title = $lang_module['list_img_title'];
$idb = $nv_Request->get_int('idb', 'get', 0);
$adb = new albumdb();
$xtpl = new XTemplate("listimg.tpl", NV_ROOTDIR . "/themes/" . $global_config['module_theme'] . "/modules/" . $module_name);
$xtpl->assign('LANG', $lang_module);
$xtpl->assign('LINK_ADD', "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=add_img&idb=" . $idb);
$xtpl->assign('URL_DEL_BACK', "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=listimg");
$xtpl->assign('URL_DEL', "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=del_limgs");
$xtpl->assign('URL_RE', "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=listimg&idb=");
$result = $adb->getAllalbums();
$i = 0;
while ($rs = $db->sql_fetchrow($result)) {
    if ($i == 0 && $idb == 0) {
        $idb = $rs['albumid'];
    }
    $xtpl->assign('id', $rs['albumid']);
    $xtpl->assign('name', $rs['name']);
    $select = $idb == $rs['albumid'] ? "selected=\"selected\"" : "";
    $xtpl->assign('SELECT', $select);
    $xtpl->parse('main.albums');
    $i++;
}
$link_del_one = "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=del_imgs";
$link_edit = "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=add_img";
$per_page = 20;
示例#2
0
 $alias = change_alias($data['name']);
 $data['description'] = filter_text_textarea('description', '', NV_ALLOWED_HTML_TAGS);
 $data['path_img'] = filter_text_input('pic_path', 'post', '', 0);
 $data['active'] = filter_text_input('active', 'post', '0', 0);
 if (!nv_is_url($data['path_img']) and is_file(NV_DOCUMENT_ROOT . $data['path_img'])) {
     $lu = nv_strlen(NV_BASE_SITEURL . NV_UPLOADS_DIR . "/" . $module_name);
     $data['path_img'] = substr($data['path_img'], $lu);
 } elseif (!empty($data['path_img']) and !nv_is_url($data['path_img'])) {
     $data['path_img'] = "";
     $error = $lang_module['wrong_path'];
 }
 if (empty($data['name'])) {
     $error = $lang_module['err_null_name'];
 } elseif (empty($error)) {
     if ($id == 0) {
         $num_ab = $db->sql_numrows($adb->getAllalbums());
         if ($adb->addNewAlbum($num_ab + 1, $data['name'], $data['description'], $data['path_img'], $alias, $data['active'])) {
             $adb->freeResult();
             Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "");
             die;
         } else {
             $error = $lang_module['err_save'];
         }
     } else {
         if ($adb->updatealbum($id, $data['name'], $data['description'], $data['path_img'], $alias, $data['active'])) {
             $adb->freeResult();
             Header("Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "");
             die;
         } else {
             $error = $lang_module['err_save'];
         }