Exemplo n.º 1
0
 $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'];
         }
     }
 }