load_files(); } $e_sub_cat = 'download'; require_once(e_HANDLER."form_handler.php"); require_once(e_HANDLER."userclass_class.php"); require_once(e_HANDLER."file_class.php"); $fl = new e_file; // -------- Presets. ------------ require_once(e_HANDLER."preset_class.php"); $pst = new e_preset; $pst->form = array("myform","dlform"); // form id of the form that will have it's values saved. $pst->page = array("download.php?create","download.php?cat"); // display preset options on which page(s). $pst->id = array("admin_downloads","admin_dl_cat"); // ------------------------------- $download = new download; require_once("auth.php"); $pst->save_preset(); // unique name(s) for the presets - comma separated. /* One form example (no arrays needed) $pst->form = "myform"; // form id of the form that will have it's values saved. $pst->page = "download.php?create"; // display preset options on which page. $pst->save_preset("admin_downloads"); // unique name for the preset */ $rs = new form; if (e_QUERY) { $tmp = explode(".", e_QUERY); $action = $tmp[0]; $sub_action = $tmp[1]; $id = $tmp[2]; $from = ($tmp[3] ? $tmp[3] : 0); unset($tmp); } if(isset($_POST['delete'])) { $tmp = array_keys($_POST['delete']); list($delete, $del_id) = explode("_", $tmp[0]); unset($_POST['searchquery']); } $from = ($from ? $from : 0); $amount = 50; if($file_array = $fl->get_files(e_DOWNLOAD, "","standard",2)){ sort($file_array); } if ($sql->db_Select("rbinary")){ while ($row = $sql->db_Fetch()) { extract($row); $file_array[] = "Binary ".$binary_id."/".$binary_name; } } $reject = array('$.','$..','/','CVS','thumbs.db','*._$', 'index', 'null*'); if($image_array = $fl->get_files(e_FILE."downloadimages/", "",$reject,1)){ sort($image_array); } if($thumb_array = $fl->get_files(e_FILE."downloadthumbs/", "",$reject,1)){ sort($thumb_array); } if (isset($_POST['add_category'])) { $download->create_category($sub_action, $id); } if (isset($_POST['submit_download'])) { $download->submit_download($sub_action, $id); $action = "main"; unset($sub_action, $id); } if(isset($_POST['update_catorder'])){ foreach($_POST['catorder'] as $key=>$order){ if($_POST['catorder'][$key]){ $sql -> db_Update("download_category", "download_category_order='".intval($order)."' WHERE download_category_id='".intval($key)."'"); } } $ns->tablerender("", "
".LAN_UPDATED."
"); } if (isset($_POST['updateoptions'])) { $pref['download_php'] = $_POST['download_php']; $pref['download_view'] = $_POST['download_view']; $pref['download_sort'] = $_POST['download_sort']; $pref['download_order'] = $_POST['download_order']; $pref['agree_flag'] = $_POST['agree_flag']; $pref['download_email'] = $_POST['download_email']; $pref['agree_text'] = $tp->toDB($_POST['agree_text']); $pref['download_denied'] = $tp->toDB($_POST['download_denied']); save_prefs(); $message = DOWLAN_65; } if(isset($_POST['addlimit'])) { if($sql->db_Select('generic','gen_id',"gen_type = 'download_limit' AND gen_datestamp = {$_POST['newlimit_class']}")) { $message = DOWLAN_116; } else { if($sql->db_Insert('generic',"0, 'download_limit', '".intval($_POST['newlimit_class'])."', '".intval($_POST['new_bw_num'])."', '".intval($_POST['new_bw_days'])."', '".intval($_POST['new_count_num'])."', '".intval($_POST['new_count_days'])."'")) { $message = DOWLAN_117; } else { $message = DOWLAN_118; } } } if(isset($_POST['updatelimits'])) { if($pref['download_limits'] != $_POST['download_limits']) { $pref['download_limits'] = ($_POST['download_limits'] == 'on') ? 1 : 0; save_prefs(); $message .= DOWLAN_126."
"; } foreach(array_keys($_POST['count_num']) as $id) { if(!$_POST['count_num'][$id] && !$_POST['count_days'][$id] && !$_POST['bw_num'][$id] && !$_POST['bw_days'][$id]) { //All entries empty - Remove record if($sql->db_Delete('generic',"gen_id = {$id}")) { $message .= $id." - ".DOWLAN_119."
"; } else { $message .= $id." - ".DOWLAN_120."
"; } } else { $sql->db_Update('generic',"gen_user_id = '".intval($_POST['bw_num'][$id])."', gen_ip = '".intval($_POST['bw_days'][$id])."', gen_intdata = '".intval($_POST['count_num'][$id])."', gen_chardata = '".intval($_POST['count_days'][$id])."' WHERE gen_id = {$id}"); $message .= $id." - ".DOWLAN_121."
"; } } } if(isset($_POST['submit_mirror'])) { $download->submit_mirror($sub_action, $id); } if($action == "mirror") { $download -> show_existing_mirrors(); } if ($action == "dlm") { $action = "create"; $id = $sub_action; $sub_action = "dlm"; } if ($action == "create") { $download->create_download($sub_action, $id); } if ($delete == 'category') { if (admin_update($sql->db_Delete("download_category", "download_category_id='$del_id' "), 'delete', DOWLAN_49." #".$del_id." ".DOWLAN_36)) { $sql->db_Delete("download_category", "download_category_parent='{$del_id}' "); } } if ($action == "cat") { $download->show_categories($sub_action, $id); } if ($delete == 'main') { $result = admin_update($sql->db_Delete("download", "download_id='$del_id' "), 'delete', DOWLAN_35." #".$del_id." ".DOWLAN_36); if($result) { admin_purge_related("download", $del_id); } unset($sub_action, $id); } if (isset($message)) { $ns->tablerender("", "
".$message."
"); } if (!e_QUERY || $action == "main") { $download->show_existing_items($action, $sub_action, $id, $from, $amount); } if ($action == "opt") { global $pref, $ns; $agree_flag = $pref['agree_flag']; $agree_text = $pref['agree_text']; $text = "
\n
".DOWLAN_69." "; $c = $pref['download_php'] ? " checked = 'checked' " : ""; $text .= " ".DOWLAN_70."
".DOWLAN_55."
".DOWLAN_56."
".LAN_ORDER."
".DOWLAN_150." ". ($pref['download_email'] ? "" : "")."
".DOWLAN_100." ". ($agree_flag ? "" : "")."
".DOWLAN_101."
".DOWLAN_146."
"; $ns->tablerender(DOWLAN_54, $text); } if($action == 'limits') { if($sql->db_Select('userclass_classes','userclass_id, userclass_name')) { $classList = $sql->db_getList(); } if($sql->db_Select("generic", "gen_id as limit_id, gen_datestamp as limit_classnum, gen_user_id as limit_bw_num, gen_ip as limit_bw_days, gen_intdata as limit_count_num, gen_chardata as limit_count_days", "gen_type = 'download_limit'")) { while($row = $sql->db_Fetch()) { $limitList[$row['limit_classnum']] = $row; } } $txt = "
"; foreach($limitList as $row) { $txt .= " "; } $txt .= " "; $txt .= "
"; if($pref['download_limits'] == 1) { $chk = "checked = 'checked'"; } else { $chk = ""; } $txt .= " ".DOWLAN_125."
".DOWLAN_67." ".DOWLAN_113." ".DOWLAN_107." ".DOWLAN_108."
".$row['limit_id']." ".r_userclass_name($row['limit_classnum'])." ".DOWLAN_109." ".DOWLAN_110." ".DOWLAN_111." ".DOWLAN_109." ".DOWLAN_110."


".r_userclass("newlimit_class", 0, "off", "guest, member, admin, classes, language")." ".DOWLAN_109." ".DOWLAN_110." ".DOWLAN_111." ".DOWLAN_109." ".DOWLAN_110."
"; $ns->tablerender(DOWLAN_112, $txt); require_once(e_ADMIN.'footer.php'); exit; } //$download->show_options($action); require_once("footer.php"); exit; class download { function show_existing_items($action, $sub_action, $id, $from, $amount) { global $sql, $rs, $ns, $tp, $mySQLdefaultdb,$pref; $text = "
"; $sortorder = ($pref['download_order']) ? $pref['download_order'] : "download_datestamp"; if(isset($_POST['searchdisp'])){ $pref['admin_download_disp'] = implode("|",$_POST['searchdisp']); save_prefs(); } if(!$pref['admin_download_disp']){ $search_display = array("download_name","download_class"); }else{ $search_display = explode("|",$pref['admin_download_disp']); } $query = "SELECT d.*, dc.* FROM #download AS d LEFT JOIN #download_category AS dc ON dc. download_category_id = d.download_category"; if (isset($_POST['searchquery']) && $_POST['searchquery'] != "") { $query .= " WHERE download_url REGEXP('".$_POST['searchquery']."') OR download_author REGEXP('".$_POST['searchquery']."') OR download_description REGEXP('".$_POST['searchquery']."') "; foreach($search_display as $disp){ $query .= " OR $disp REGEXP('".$_POST['searchquery']."') "; } $query .= " ORDER BY ".$sortorder." DESC"; } else { $query .= " ORDER BY ".($sub_action ? $sub_action : $sortorder)." ".($id ? $id : "DESC")." LIMIT $from, $amount"; } if ($sql->db_Select_gen($query)) { $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform")." "; // Search Display Column header.---------- foreach($search_display as $disp){ if($disp == "download_name"){ $text .= ""; }else{ $repl = array("download_","_"); $text .= ""; } } // ------------------------------ $text .=" "; while ($row = $sql->db_Fetch()) { extract($row); $text .= ""; // Display Chosen options ------------------------------------- $bolean_list = array("download_active","download_comment"); foreach($search_display as $disp){ $text .= ""; } // ------------------------------------------------------------- $text .= " "; } $text .= "
ID".DOWLAN_27."".ucwords(str_replace($repl," ",$disp))."".LAN_OPTIONS."
$download_id"; if($disp == "download_name"){ $text .= "$download_name"; }elseif($disp == "download_category"){ $text .= $row['download_category_name']." "; }elseif($disp == "download_datestamp"){ $text .= ($row[$disp]) ? strftime($pref['shortdate'],$row[$disp])." " : " "; }elseif($disp == "download_class" || $disp == "download_visible"){ $text .= r_userclass_name($row[$disp])." "; }elseif($disp == "download_filesize"){ $text .= ($row[$disp]) ? round(($row[$disp] / 1000))." Kb " : " "; }elseif($disp == "download_thumb"){ $text .= ($row[$disp]) ? "" : ""; }elseif($disp == "download_image"){ $text .= "".$row[$disp]." "; }elseif($disp == "download_description"){ $text .= $tp->toHTML($row[$disp],TRUE)." "; }elseif($disp == "download_active"){ if($row[$disp]== 1){ $text .= "\n"; } elseif($row[$disp]== 2){ $text .= "\n"; } else{ $text .= "\n"; } }elseif($disp == "download_comment"){ $text .= ($row[$disp]) ? ADMIN_TRUE_ICON : " "; }else{ $text .= $row[$disp]." "; } $text .= " ".ADMIN_EDIT_ICON." toJS(DOWLAN_33." [ID: $download_id ]")."') \" />
"; } else { $text .= "
".DOWLAN_6."
"; } $text .= "
"; // Next-Previous. ========================== $downloads = $sql->db_Count("download"); if ($downloads > $amount && !$_POST['searchquery']) { $parms = "{$downloads},{$amount},{$from},".e_SELF."?".(e_QUERY ? "$action.$sub_action.$id." : "main.download_id.desc.")."[FROM]"; $text .= "
".$tp->parseTemplate("{NEXTPREV={$parms}}"); } // Search & display options etc. =========================. $text .= "
\n

\n\n\n

"; $text .= "
".LAN_DISPLAYOPT."
"; $text .= "
\n
"; // ====================== $ns->tablerender(DOWLAN_7, $text); } function show_options($action) { if ($action == "") { $action = "main"; } $var['main']['text'] = DOWLAN_29; $var['main']['link'] = e_SELF; $var['create']['text'] = DOWLAN_30; $var['create']['link'] = e_SELF."?create"; $var['cat']['text'] = DOWLAN_31; $var['cat']['link'] = e_SELF."?cat"; $var['cat']['perm'] = "Q"; $var['opt']['text'] = LAN_OPTIONS; $var['opt']['link'] = e_SELF."?opt"; $var['limits']['text'] = DOWLAN_112; $var['limits']['link'] = e_SELF."?limits"; $var['mirror']['text'] = DOWLAN_128; $var['mirror']['link'] = e_SELF."?mirror"; show_admin_menu(DOWLAN_32, $action, $var); } function create_download($sub_action, $id) { global $cal,$tp, $sql, $rs, $ns, $file_array, $image_array, $thumb_array,$pst; $download_status[0] = DOWLAN_122; $download_status[1] = DOWLAN_123; $download_status[2] = DOWLAN_124; $preset = $pst->read_preset("admin_downloads"); // read preset values into array extract($preset); if (!$sql->db_Select("download_category")) { $ns->tablerender(ADLAN_24, "
".DOWLAN_5."
"); return; } $download_active = 1; if ($sub_action == "edit" && !$_POST['submit']) { if ($sql->db_Select("download", "*", "download_id='$id' ")) { $row = $sql->db_Fetch(); extract($row); if($download_mirror) { $mirrorTArray = explode(chr(1), $download_mirror); $mirrorArray = array(); $count=0; foreach($mirrorTArray as $mirror) { if($mirror) { list($mid, $murl) = explode(",", $mirror); $mirrorArray[$count]['id'] = $mid; $mirrorArray[$count]['url'] = $murl; $count++; } } } } } if ($sub_action == "dlm" && !$_POST['submit']) { if ($sql->db_Select("upload", "*", "upload_id='$id' ")) { $row = $sql->db_Fetch(); extract($row); $download_category = $upload_category; $download_name = $upload_name.($upload_version ? " v" . $upload_version : ""); $download_url = $upload_file; $download_author_email = $upload_email; $download_author_website = $upload_website; $download_description = $upload_description; $download_image = $upload_ss; $download_filesize = $upload_filesize; $image_array[] = $upload_ss; $download_author = substr($upload_poster, (strpos($upload_poster, ".")+1)); } } $text = "
"; } else { $text .= DOWLAN_132."
"; $mirrorList = $sql -> db_getList(); $m_count = (count($mirrorArray) ? count($mirrorArray) : 1); for($count = 1; $count <= $m_count; $count++){ $opt = ($count==1) ? "id='mirror'" : ""; $text .=" "; $text .= "
"; } $text .="

"; } $text .= ""; $text .= " "; if ($sub_action == "dlm") { $text .= " "; } $text .= "
".DOWLAN_11." "; $sql->db_Select("download_category", "*", "download_category_parent !=0"); $text .= "
".DOWLAN_12.": toForm($download_name)."\" maxlength='200' />
".DOWLAN_13.":
".DOWLAN_131."  
".DOWLAN_149."
".DOWLAN_128.": "; if(!$sql -> db_Select("download_mirror")) { $text .= DOWLAN_144."
Mirror display type: show mirror list, allow user to choose mirror
use random mirror - no user choice
".DOWLAN_15.":
".DOWLAN_16.":
".DOWLAN_17.":
".DOWLAN_18.":
".DOWLAN_19.":
".DOWLAN_20.":
".LAN_DATESTAMP.": "; if(!$download_datestamp){ $download_datestamp = time(); } $cal_options['firstDay'] = 0; $cal_options['showsTime'] = false; $cal_options['showOthers'] = false; $cal_options['weekNumbers'] = false; $cal_options['ifFormat'] = "%d/%m/%Y %H:%M:%S"; $cal_options['timeFormat'] = "24"; $cal_attrib['class'] = "tbox"; $cal_attrib['size'] = "12"; $cal_attrib['name'] = "download_datestamp"; $cal_attrib['value'] = date("d/m/Y H:i:s", $download_datestamp); $text .= $cal->make_input_field($cal_options, $cal_attrib); $update_checked = ($_POST['update_datestamp']) ? "checked='checked'" : ""; $text .= "  ".DOWLAN_148."
".DOWLAN_21.": "; $text .= "
".DOWLAN_102.": "; if ($download_comment == "0") { $text .= LAN_YES.": ".LAN_NO.": "; } else { $text .= LAN_YES.": ".LAN_NO.": "; } $text .= "
".DOWLAN_145.": ".r_userclass('download_visible', $download_visible, 'off', 'public, nobody, member, admin, classes, language')."
".DOWLAN_106.": ".r_userclass('download_class', $download_class, 'off', 'public, nobody, member, admin, classes, language')."
".DOWLAN_103.":
"; if ($id && $sub_action == "edit") { $text .= " "; } else { $text .= ""; } $text .= "
"; $ns->tablerender(ADLAN_24, $text); } function show_message($message) { global $ns; $ns->tablerender("", "
".$message."
"); } function submit_download($sub_action, $id) { global $tp, $sql, $DOWNLOADS_DIRECTORY, $e_event; if($sub_action == 'edit') { if($_POST['download_url_external'] == '') { $_POST['download_filesize_external'] = FALSE; } } if ($_POST['download_url_external'] && $_POST['download_url'] == '') { $durl = $_POST['download_url_external']; $filesize = $_POST['download_filesize_external']; } else { $durl = $_POST['download_url']; if($_POST['download_filesize_external']) { $filesize = $_POST['download_filesize_external']; } else { if (strpos($DOWNLOADS_DIRECTORY, "/") === 0 || strpos($DOWNLOADS_DIRECTORY, ":") >= 1) { $filesize = filesize($DOWNLOADS_DIRECTORY.$durl); } else { $filesize = filesize(e_BASE.$DOWNLOADS_DIRECTORY.$durl); } } } if (!$filesize) { if($sql->db_Select("upload", "upload_filesize", "upload_file='$durl'")) { $row = $sql->db_Fetch(); $filesize = $row['upload_filesize']; } } $_POST['download_description'] = $tp->toDB($_POST['download_description']); $_POST['download_name'] = $tp->toDB($_POST['download_name']); $_POST['download_author'] = $tp->toDB($_POST['download_author']); if (preg_match("#(.*?)/(.*?)/(.*?) (.*?):(.*?):(.*?)$#", $_POST['download_datestamp'], $matches)){ $_POST['download_datestamp'] = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[1], $matches[3]); }else{ $_POST['download_datestamp'] = time(); } if($_POST['update_datestamp']){ $_POST['download_datestamp'] = time(); } $mirrorStr = ""; $mirrorReq = ""; if($_POST['download_mirror_name'][0]) { $mirrors = count($_POST['download_mirror_name']); for($a=0; $a<$mirrors; $a++) { $mirror_id = $_POST['download_mirror_name'][$a]; $mirror_url = $_POST['download_mirror'][$a]; $mirrorStr .= $mirror_id.",".$mirror_url.",0".chr(1); } } if ($id) { admin_update($sql->db_Update("download", "download_name='".$_POST['download_name']."', download_url='".$durl."', download_author='".$_POST['download_author']."', download_author_email='".$_POST['download_author_email']."', download_author_website='".$_POST['download_author_website']."', download_description='".$_POST['download_description']."', download_filesize='".$filesize."', download_category='".intval($_POST['download_category'])."', download_active='".intval($_POST['download_active'])."', download_datestamp='".intval($_POST['download_datestamp'])."', download_thumb='".$_POST['download_thumb']."', download_image='".$_POST['download_image']."', download_comment='".intval($_POST['download_comment'])."', download_class = '{$_POST['download_class']}', download_mirror='$mirrorStr', download_mirror_type='".intval($_POST['download_mirror_type'])."' , download_visible='".$_POST['download_visible']."' WHERE download_id=".intval($id)), 'update', DOWLAN_2); } else { if (admin_update($download_id = $sql->db_Insert("download", "0, '".$_POST['download_name']."', '".$durl."', '".$_POST['download_author']."', '".$_POST['download_author_email']."', '".$_POST['download_author_website']."', '".$_POST['download_description']."', '".$filesize."', '0', '".intval($_POST['download_category'])."', '".intval($_POST['download_active'])."', '".intval($_POST['download_datestamp'])."', '".$_POST['download_thumb']."', '".$_POST['download_image']."', '".intval($_POST['download_comment'])."', '{$_POST['download_class']}', '$mirrorStr', '".intval($_POST['download_mirror_type'])."', '".$_POST['download_visible']."' "), 'insert', DOWLAN_1)) { $dlinfo = array("download_id" => $download_id, "download_name" => $_POST['download_name'], "download_url" => $durl, "download_author" => $_POST['download_author'], "download_author_email" => $_POST['download_author_email'], "download_author_website" => $_POST['download_author_website'], "download_description" => $_POST['download_description'], "download_filesize" => $filesize, "download_category" => $_POST['download_category'], "download_active" => $_POST['download_active'], "download_datestamp" => $time, "download_thumb" => $_POST['download_thumb'], "download_image" => $_POST['download_image'], "download_comment" => $_POST['download_comment'] ); $e_event->trigger("dlpost", $dlinfo); if ($_POST['remove_upload']) { $sql->db_Update("upload", "upload_active='1' WHERE upload_id='".$_POST['remove_id']."'"); $mes = "
".$_POST['download_name']." ".DOWLAN_104; $mes .= "

".DOWLAN_105.""; $this->show_message($mes); } } } } function show_categories($sub_action, $id) { global $sql, $rs, $ns, $tp, $pst; if (!is_object($sql2)) { $sql2 = new db; } $text = $rs->form_open("post", e_SELF."?".e_QUERY, "myform"); $text .= "
"; $qry = " SELECT dc.*, COUNT(d.download_id) AS filecount FROM #download_category AS dc LEFT JOIN #download AS d ON d.download_category = dc.download_category_id GROUP BY dc.download_category_id ORDER BY dc.download_category_order "; if($sql->db_Select_gen($qry)) { $categories = $sql->db_getList(); foreach($categories as $cat) { $cat_array[$cat['download_category_parent']][] = $cat; } $text .= " "; //Start displaying parent categories foreach($cat_array[0] as $parent) { if(strstr($parent['download_category_icon'], chr(1))) { list($parent['download_category_icon'], $parent['download_category_icon_empty']) = explode(chr(1), $parent['download_category_icon']); } $text .= " "; //Show main categories if(is_array($cat_array[$parent['download_category_id']])) { foreach($cat_array[$parent['download_category_id']] as $main) { if(strstr($main['download_category_icon'], chr(1))) { list($main['download_category_icon'], $main['download_category_icon_empty']) = explode(chr(1), $main['download_category_icon']); } $text .= ""; //Show sub categories if(is_array($cat_array[$main['download_category_id']])) { foreach($cat_array[$main['download_category_id']] as $sub) { if(strstr($sub['download_category_icon'], chr(1))) { list($sub['download_category_icon'], $sub['download_category_icon_empty']) = explode(chr(1), $sub['download_category_icon']); } $text .= ""; } } } } } $text .= "
  ".DOWLAN_11." ".DOWLAN_52." ".LAN_ORDER." ".LAN_OPTIONS."
".($parent['download_category_icon'] ? "" : " ")." {$parent['download_category_name']} ".ADMIN_EDIT_ICON." "; if(!is_array($cat_array[$parent['download_category_id']])) { $text .= "toJS(DOWLAN_34." [ID: {$parent['download_category_id']} ]")."') \"/>"; } $text .= "
".($main['download_category_icon'] ? "" : " ")." {$main['download_category_name']}
{$main['download_category_description']}
{$main['filecount']} ".ADMIN_EDIT_ICON.""; if(!is_array($cat_array[$main['download_category_id']]) && !$main['filecount']) { $text .= "toJS(DOWLAN_34." [ID: {$main['download_category_id']} ]")."') \"/>"; } $text .= "
".($sub['download_category_icon'] ? "" : " ")."     ".DOWLAN_53.": {$sub['download_category_name']}
    {$sub['download_category_description']}
{$sub['filecount']} ".ADMIN_EDIT_ICON." "; if(!$sub['filecount']) { $text .= "toJS(DOWLAN_34." [ID: {$sub['download_category_id']} ]")."') \"/>"; } $text .= "
"; $text .= "
"; } else { $text .= "
".DOWLAN_38."
"; } $text .= ""; $ns->tablerender(DOWLAN_37, $text); unset($download_category_id, $download_category_name, $download_category_description, $download_category_parent, $download_category_icon, $download_category_class); $handle = opendir(e_IMAGE."icons"); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && $file != "/" && $file != "CVS") { $iconlist[] = $file; } } closedir($handle); if ($sub_action == "edit" && !$_POST['add_category']) { if ($sql->db_Select("download_category", "*", "download_category_id=$id")) { $row = $sql->db_Fetch(); extract($row); $main_category_parent = $download_category_parent; if(strstr($download_category_icon, chr(1))) { list($download_category_icon, $download_category_icon_empty) = explode(chr(1), $download_category_icon); } else { $download_category_icon_empty = ""; } } } $preset = $pst->read_preset("admin_dl_cat"); // read preset values into array extract($preset); $frm_action = (isset($_POST['add_category'])) ? e_SELF."?cat" : e_SELF."?".e_QUERY; $text = "
"; $text .= "
".DOWLAN_37.": "; if (!$download_cats = $sql->db_Select("download_category")) { $text .= " \n"; } else { $text .= " "; } $text .= "
".DOWLAN_12.":
".DOWLAN_18.":
".DOWLAN_41.":
".DOWLAN_147.":
".DOWLAN_43.":
(".DOWLAN_44.")
".r_userclass("download_category_class", $download_category_class, 'off', 'public, nobody, member, admin, classes, language')."
"; if ($id && $sub_action == "edit" && !isset($_POST['add_category'])) { $text .= " "; } else { $text .= ""; } $text .= "
"; $ns->tablerender(DOWLAN_39, $text); } function create_category($sub_action, $id) { global $sql, $tp; $download_category_name = $tp->toDB($_POST['download_category_name']); $download_category_description = $tp->toDB($_POST['download_category_description']); $download_category_icon = $tp->toDB($_POST['download_category_icon']); if(isset($_POST['download_category_icon_empty']) && $_POST['download_category_icon_empty'] != ""){ $download_category_icon .= trim(chr(1).$tp->toDB($_POST['download_category_icon_empty'])); } if ($id) { admin_update($sql->db_Update("download_category", "download_category_name='$download_category_name', download_category_description='$download_category_description', download_category_icon ='$download_category_icon', download_category_parent= '".intval($_POST['download_category_parent'])."', download_category_class='".$_POST['download_category_class']."' WHERE download_category_id='$id'"), 'update', DOWLAN_48); } else { admin_update($sql->db_Insert("download_category", "0, '$download_category_name', '$download_category_description', '$download_category_icon', '".intval($_POST['download_category_parent'])."', '".$_POST['download_category_class']."', 0 "), 'insert', DOWLAN_47); } if ($sub_action == "sn") { $sql->db_Delete("tmp", "tmp_time='$id' "); } } function show_existing_mirrors() { global $sql, $ns, $tp, $sub_action, $id, $delete, $del_id; if($delete == "mirror") { admin_update($sql -> db_Delete("download_mirror", "mirror_id=".$del_id), delete, DOWLAN_135); } if(!$sql -> db_Select("download_mirror")) { $text = "
".DOWLAN_144."
"; // No mirrors defined yet } else { $text = "
"; $mirrorList = $sql -> db_getList(); foreach($mirrorList as $mirror) { extract($mirror); $text .= " "; } $text .= "
ID ".DOWLAN_12." ".DOWLAN_136." ".LAN_OPTIONS."
$mirror_id ".$tp -> toHTML($mirror_name)." ".($mirror_image ? "" : "None")." ".ADMIN_EDIT_ICON."
"; } $ns -> tablerender(DOWLAN_138, $text); require_once(e_HANDLER."file_class.php"); $fl = new e_file; $rejecthumb = array('$.','$..','/','CVS','thumbs.db','*._$',"thumb_", 'index', 'null*'); $imagelist = $fl->get_files(e_FILE."downloadimages/","",$rejecthumb); if($sub_action == "edit" && !defined("SUBMITTED")) { $sql -> db_Select("download_mirror", "*", "mirror_id=".$id); $row = $sql -> db_Fetch(); extract($mirror); $edit = TRUE; } else { unset($mirror_name, $mirror_url, $mirror_image, $mirror_location, $mirror_description); $edit = FALSE; } $text = "
\n
".DOWLAN_12."
".DOWLAN_139."
".DOWLAN_136."
".DOWLAN_141."
".DOWLAN_18."
".($edit ? "" : "")."
"; $caption = ($edit ? DOWLAN_142 : DOWLAN_143); $ns -> tablerender($caption, $text); } function submit_mirror() { global $tp, $sql; define("SUBMITTED", TRUE); if(isset($_POST['mirror_name']) && isset($_POST['mirror_url'])) { $name = $tp -> toDB($_POST['mirror_name']); $url = $tp -> toDB($_POST['mirror_url']); $location = $tp -> toDB($_POST['mirror_location']); $description = $tp -> toDB($_POST['mirror_description']); if (isset($_POST['id'])){ admin_update($sql -> db_Update("download_mirror", "mirror_name='$name', mirror_url='$url', mirror_image='".$_POST['mirror_image']."', mirror_location='$location', mirror_description='$description' WHERE mirror_id=".$_POST['id']), 'update', DOWLAN_133); } else { admin_update($sql -> db_Insert("download_mirror", "0, '$name', '$url', '".$_POST['mirror_image']."', '$location', '$description', 0"), 'insert', DOWLAN_134); } } } } function download_adminmenu($parms) { global $download; global $action; $download->show_options($action); } ?>