userclassOptions = 'blank,nobody,guest,public,main,admin,member,classes'; // Save basic search string if (isset($_POST['download-search-text'])) { $this->searchField = $_POST['download-search-text']; } // Save advanced search criteria if (isset($_POST['download_advanced_search_submit'])) { $this->advancedSearchFields = $_POST['download_advanced_search']; } } /* function show_filter_form($action, $subAction, $id, $from, $amount) { global $e107, $mySQLdefaultdb, $pref, $user_pref; $frm = new e_form(); $filterColumns = ($user_pref['admin_download_disp'] ? $user_pref['admin_download_disp'] : array("download_name","download_class")); // $url = $e107->url->getUrl('forum', 'thread', array('func' => 'view', 'id' => 123)); $url = "admin_download.php"; // Search field $text .= "
"; // Advanced search fields $text .= " "; return $text; } */ /* function show_existing_items($action, $subAction, $id, $from, $amount) { global $sql, $rs, $ns, $tp, $mySQLdefaultdb, $pref, $user_pref; $frm = new e_form(); $sortorder = $subAction ? $subAction : $pref['download_order']; $sortdirection = $id=="asc" ? "asc" : "desc"; $amount = 10; if(!$sortorder) { $sortorder = "download_id"; } $sort_link = $sortdirection == 'asc' ? 'desc' : 'asc'; $columnInfo = array( "checkboxes" => array("title" => "", "forced"=> TRUE, "width" => "3%", "thclass" => "center first", "toggle" => "dl_selected"), "download_id" => array("title"=>DOWLAN_67, "type"=>"", "width"=>"auto", "thclass"=>"", "forced"=>true), "download_name" => array("title"=>DOWLAN_12, "type"=>"", "width"=>"auto", "thclass"=>""), "download_url" => array("title"=>DOWLAN_13, "type"=>"", "width"=>"auto", "thclass"=>""), "download_author" => array("title"=>DOWLAN_15, "type"=>"", "width"=>"auto", "thclass"=>""), "download_author_email" => array("title"=>DOWLAN_16, "type"=>"", "width"=>"auto", "thclass"=>""), "download_author_website" => array("title"=>DOWLAN_17, "type"=>"", "width"=>"auto", "thclass"=>""), "download_description" => array("title"=>DOWLAN_18, "type"=>"", "width"=>"auto", "thclass"=>""), "download_filesize" => array("title"=>DOWLAN_66, "type"=>"", "width"=>"auto", "thclass"=>"right"), "download_requested" => array("title"=>DOWLAN_29, "type"=>"", "width"=>"auto", "thclass"=>"center"), "download_category" => array("title"=>DOWLAN_11, "type"=>"", "width"=>"auto", "thclass"=>""), "download_active" => array("title"=>DOWLAN_21, "type"=>"", "width"=>"auto", "thclass"=>"center"), "download_datestamp" => array("title"=>DOWLAN_182, "type"=>"", "width"=>"auto", "thclass"=>""), "download_thumb" => array("title"=>DOWLAN_20, "type"=>"", "width"=>"auto", "thclass"=>"center"), "download_image" => array("title"=>DOWLAN_19, "type"=>"", "width"=>"auto", "thclass"=>""), "download_comment" => array("title"=>DOWLAN_102, "type"=>"", "width"=>"auto", "thclass"=>"center"), "download_class" => array("title"=>DOWLAN_113, "type"=>"", "width"=>"auto", "thclass"=>""), "download_mirror" => array("title"=>DOWLAN_128, "type"=>"", "width"=>"auto", "thclass"=>""), "download_mirror_type" => array("title"=>DOWLAN_195, "type"=>"", "width"=>"auto", "thclass"=>""), "download_visible" => array("title"=>DOWLAN_43, "type"=>"", "width"=>"auto", "thclass"=>""), "options" => array("title"=>LAN_OPTIONS, "width"=>"10%", "thclass"=>"center last", "forced"=>true) ); $filterColumns = ($user_pref['admin_download_disp']) ? $user_pref['admin_download_disp'] : array("download_name","download_class"); $query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc. download_category_id=d.download_category"; if ($this->searchField) { $where = array(); array_push($where, "download_name REGEXP('".$this->searchField."')"); array_push($where, "download_description REGEXP('".$this->searchField."')"); array_push($where, "download_author REGEXP('".$this->searchField."')"); array_push($where, "download_author_email REGEXP('".$this->searchField."')"); array_push($where, "download_author_website REGEXP('".$this->searchField."')"); $where = " WHERE ".implode(" OR ", $where); $query .= "$where ORDER BY {$sortorder} {$sortdirection}"; } else if ($this->advancedSearchFields) { $where = array(); if (strlen($this->advancedSearchFields['name']) > 0) { array_push($where, "download_name REGEXP('".$this->advancedSearchFields['name']."')"); } if (strlen($this->advancedSearchFields['url']) > 0) { array_push($where, "download_url REGEXP('".$this->advancedSearchFields['url']."')"); } if (strlen($this->advancedSearchFields['author']) > 0) { array_push($where, "download_author REGEXP('".$this->advancedSearchFields['author']."')"); } if (strlen($this->advancedSearchFields['description']) > 0) { array_push($where, "download_description REGEXP('".$this->advancedSearchFields['description']."')"); } if (strlen($this->advancedSearchFields['category']) != 0) { array_push($where, "download_category=".$this->advancedSearchFields['category']); } if (strlen($this->advancedSearchFields['filesize']) > 0) { array_push($where, "download_filesize".$this->advancedSearchFields['filesize_condition'].($this->advancedSearchFields['filesize']*$this->advancedSearchFields['filesize_units'])); } if ($this->advancedSearchFields['status'] != 99) { array_push($where, "download_active=".$this->advancedSearchFields['status']); } if (strlen($this->advancedSearchFields['date']) > 0) { switch ($this->advancedSearchFields['date_condition']) { case "<=" : { array_push($where, "download_datestamp".$this->advancedSearchFields['date_condition'].($this->advancedSearchFields['date']+86400)); break; } case "=" : { array_push($where, "(download_datestamp>=".$this->advancedSearchFields['date']." AND download_datestamp<=".($this->advancedSearchFields['date']+86399).")"); break; } case ">=" : { array_push($where, "download_datestamp".$this->advancedSearchFields['date_condition'].$this->advancedSearchFields['date']); break; } } } if (strlen($this->advancedSearchFields['requested']) > 0) { array_push($where, "download_requested".$this->advancedSearchFields['requested_condition'].$this->advancedSearchFields['requested']); } if ($this->advancedSearchFields['visible']) { array_push($where, "download_visible=".$this->advancedSearchFields['visible']); } if ($this->advancedSearchFields['class']) { array_push($where, "download_class=".$this->advancedSearchFields['class']); } $where = (count($where) > 0 ? " WHERE ".implode(" AND ", $where) : ""); $query .= "$where ORDER BY {$sortorder} {$sortdirection}"; } else { $query .= " ORDER BY ".($subAction ? $subAction : $sortorder)." ".($id ? $id : $sortdirection)." LIMIT $from, $amount"; } $text .= ""; return $text; } */ // --------------------------------------------------------------------------- /* function batch_options() { $frm = new e_form(); $classes = get_userclass_list(); return $frm->batchoptions( array('delete_selected'=>LAN_DELETE), array( 'userclass' =>array('Assign userclass...',$classes), 'visibility'=>array('Assign Visibility..',$classes) ) ); } function _observe_processBatch() { list($type,$tmp,$uclass) = explode("_",$_POST['execute_batch']); $method = "batch_".$type; if ((method_exists($this,$method) || $type='visibility') && isset ($_POST['dl_selected'])) { if($type=='userclass' || $type=='visibility') { $mode = ($type=='userclass') ? 'download_class' : 'download_visible'; $this->batch_userclass($_POST['dl_selected'],$uclass,$mode); } else { $this->$method($_POST['dl_selected']); } } } function batch_userclass($download_ids,$uclass,$mode='download_class') { $emessage = &eMessage::getInstance(); if(e107::getDb() -> db_Update("download", $mode." ='{$uclass}' WHERE download_id IN (".implode(",",$download_ids).") ")) { $emessage->add("It Worked", E_MESSAGE_SUCCESS); } else { $emessage->add("It Failed", E_MESSAGE_ERROR); } }*/ // Given the string which is stored in the DB, turns it into an array of mirror entries // If $byID is true, the array index is the mirror ID. Otherwise its a simple array /* function makeMirrorArray($source, $byID = FALSE) { $ret = array(); if ($source) { $mirrorTArray = explode(chr(1), $source); $count = 0; foreach($mirrorTArray as $mirror) { if ($mirror) { list($mid, $murl, $mreq, $msize) = explode(",", $mirror); $ret[$byID ? $mid : $count] = array('id' => $mid, 'url' => $murl, 'requests' => $mreq, 'filesize' => $msize); $count++; } } } return $ret; } */ /* // Turn the array into a string which can be stored in the DB function compressMirrorArray($source) { if (!is_array($source) || !count($source)) return ''; $inter = array(); foreach ($source as $s) { $inter[] = $s['id'].','.$s['url'].','.$s['requests'].','.$s['filesize']; } return implode(chr(1),$inter); }*/ /* function create_download($subAction='', $id='') { global $download, $e107, $cal, $tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array; require_once(e_PLUGIN.'download/download_shortcodes.php'); require_once(e_HANDLER."form_handler.php"); if ($file_array = $fl->get_files(e_DOWNLOAD, "","standard",5)) { sort($file_array); } if ($public_array = $fl->get_files(e_UPLOAD)) { foreach($public_array as $key=>$val) { $file_array[] = str_replace(e_UPLOAD,"",$val); } } */ /* if ($sql->db_Select("rbinary")) //TODO Remove me. { while ($row = $sql->db_Fetch()) { extract($row); $file_array[] = "Binary ".$binary_id."/".$binary_name; } } */ /* if ($image_array = $fl->get_files(e_FILE.'downloadimages/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2)) { sort($image_array); } if ($thumb_array = $fl->get_files(e_FILE.'downloadthumbs/', '\.gif$|\.jpg$|\.png$|\.GIF$|\.JPG$|\.PNG$','standard',2)) { sort($thumb_array); } $frm = new e_form(); $mirrorArray = array(); $download_status[0] = DOWLAN_122; $download_status[1] = DOWLAN_123; $download_status[2] = DOWLAN_124; if (!$sql->db_Select("download_category")) { $ns->tablerender(ADLAN_24, "".DOWLAN_11." | ".DOWLAN_52." | ".LAN_ORDER." | ".LAN_OPTIONS." | |
---|---|---|---|---|
".($parent['download_category_icon'] ? " |
";
$text .= $tp->toHTML($parent['download_category_name']);
$text .= " "; $text .= $tp->toHTML($parent['download_category_description']); $text .= " |
".ADMIN_EDIT_ICON." "; if (!is_array($cat_array[$parent['download_category_id']])) { $text .= "toJS(DOWLAN_34." [ID: {$parent['download_category_id']} ]")."') \"/>"; } $text .= " | ||
".($subcat['download_category_icon'] ? " |
";
$text .= $tp->toHTML($subcat['download_category_name']);
$text .= "
"; $text .= $tp->toHTML($subcat['download_category_description']); $text .= " |
{$subcat['filecount']} | ".ADMIN_EDIT_ICON.""; if (!is_array($cat_array[$subcat['download_category_id']]) && !$subcat['filecount']) { $text .= "toJS(DOWLAN_34." [ID: {$subcat['download_category_id']} ]")."') \"/>"; } $text .= " | |
".($subsubcat['download_category_icon'] ? " |
";
$text .= $tp->toHTML($subsubcat['download_category_name']);
$text .= "
"; $text .= $tp->toHTML($subsubcat['download_category_description']); $text .= " |
{$subsubcat['filecount']} | ".ADMIN_EDIT_ICON." "; if (!$subsubcat['filecount']) { $text .= "toJS(DOWLAN_34." [ID: {$subsubcat['download_category_id']} ]")."') \"/>"; } $text .= " |