mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
More downloads work
This commit is contained in:
@@ -60,12 +60,6 @@ $adminDownload = new adminDownload();
|
||||
new plugin_download_admin();
|
||||
require_once(e_ADMIN."auth.php");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$pst->save_preset(); // unique name(s) for the presets - comma separated.
|
||||
|
||||
/*
|
||||
@@ -275,7 +269,7 @@ if (isset($_POST['submit_mirror']))
|
||||
|
||||
if ($action == "mirror")
|
||||
{
|
||||
$adminDownload->show_existing_mirrors();
|
||||
//$adminDownload->show_existing_mirrors();
|
||||
}
|
||||
|
||||
|
||||
@@ -287,48 +281,6 @@ if ($action == "dlm")
|
||||
}
|
||||
|
||||
|
||||
if ($action == "create")
|
||||
{
|
||||
$adminDownload->create_download($subAction, $id);
|
||||
}
|
||||
|
||||
|
||||
if (isset($delete) && $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);
|
||||
$admin_log->log_event('DOWNL_04',$del_id,E_LOG_INFORMATIVE,'');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'cat')
|
||||
{
|
||||
$adminDownload->show_categories($subAction, $id);
|
||||
}
|
||||
|
||||
|
||||
if (isset($delete) && $delete == 'main')
|
||||
{
|
||||
$result = $sql->db_Delete('download', 'download_id='.$del_id);
|
||||
if ($result)
|
||||
{
|
||||
// Process triggers before calling admin_update so trigger messages can be shown
|
||||
$data = array('method'=>'delete', 'table'=>'download', 'id'=>$del_id, 'plugin'=>'download', 'function'=>'delete_download');
|
||||
$hooks = $e107->e_event->triggerHook($data);
|
||||
require_once(e_HANDLER."message_handler.php");
|
||||
$emessage = &eMessage::getInstance();
|
||||
$emessage->add($hooks, E_MESSAGE_SUCCESS);
|
||||
|
||||
admin_update($result, 'delete', DOWLAN_27." #".$del_id." ".DOWLAN_36);
|
||||
|
||||
$admin_log->log_event('DOWNL_07',$del_id,E_LOG_INFORMATIVE,'');
|
||||
admin_purge_related('download', $del_id);
|
||||
$e_event->trigger('dldelete', $del_id);
|
||||
}
|
||||
unset($subAction, $id);
|
||||
}
|
||||
|
||||
if (isset($message))
|
||||
{
|
||||
@@ -348,10 +300,10 @@ if ($from === "maint" && isset($_POST['submit_download']))
|
||||
|
||||
if (!e_QUERY || $action == "main")
|
||||
{
|
||||
$text = $emessage->render();
|
||||
$text .= $adminDownload->show_filter_form($action, $subAction, $id, $from, $amount);
|
||||
$text .= $adminDownload->show_existing_items($action, $subAction, $id, $from, $amount);
|
||||
$ns->tablerender(DOWLAN_7, $text);
|
||||
//$text = $emessage->render();
|
||||
//$text .= $adminDownload->show_filter_form($action, $subAction, $id, $from, $amount);
|
||||
//$text .= $adminDownload->show_existing_items($action, $subAction, $id, $from, $amount);
|
||||
//$ns->tablerender(DOWLAN_7, $text);
|
||||
}
|
||||
|
||||
|
||||
@@ -388,6 +340,8 @@ function showLimits()
|
||||
{
|
||||
$sql = e107::getDb();
|
||||
$ns = e107::getRender();
|
||||
$tp = e107::getParser();
|
||||
|
||||
global $pref;
|
||||
|
||||
if ($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
|
||||
@@ -491,6 +445,8 @@ function showMaint()
|
||||
global $pref;
|
||||
$ns = e107::getRender();
|
||||
$sql = e107::getDb();
|
||||
$frm = e107::getForm();
|
||||
$tp = e107::getParser();
|
||||
|
||||
if (isset($_POST['dl_maint'])) {
|
||||
switch ($_POST['dl_maint'])
|
||||
@@ -511,8 +467,9 @@ function showMaint()
|
||||
$currentURL = "";
|
||||
while($row = $sql->db_Fetch()) {
|
||||
if (!$foundSome) {
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<table class="adminlist">';
|
||||
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
|
||||
<table class="adminlist">';
|
||||
$text .= '<tr>';
|
||||
$text .= '<th>'.DOWLAN_13.'</th>';
|
||||
$text .= '<th>'.DOWLAN_67.'</th>';
|
||||
@@ -530,14 +487,14 @@ function showMaint()
|
||||
while($row = $sql2->db_Fetch()) {
|
||||
$text .= '<tr>';
|
||||
if ($currentURL != $row['download_url']) {
|
||||
$text .= '<td>'.$e107->tp->toHTML($row['download_url']).'</td>';
|
||||
$text .= '<td>'.$tp->toHTML($row['download_url']).'</td>';
|
||||
$currentURL = $row['download_url'];
|
||||
} else {
|
||||
$text .= '<td>*</td>';
|
||||
}
|
||||
$text .= '<td>'.$row['download_id'].'</td>';
|
||||
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
|
||||
$text .= '<td>'.$e107->tp->toHTML($row['download_category_name']).'</td>';
|
||||
$text .= '<td>'.$tp->toHTML($row['download_category_name']).'</td>';
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.duplicates">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
@@ -566,8 +523,9 @@ function showMaint()
|
||||
foreach($files as $file) {
|
||||
if (0 == $sql->db_Count('download', '(*)', " WHERE download_url='".$file['fname']."'")) {
|
||||
if (!$foundSome) {
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<table class="adminlist">';
|
||||
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
|
||||
<table class="adminlist">';
|
||||
$text .= '<tr>';
|
||||
$text .= '<th>'.DOWLAN_13.'</th>';
|
||||
$text .= '<th>'.DOWLAN_182.'</th>';
|
||||
@@ -579,7 +537,7 @@ function showMaint()
|
||||
$filesize = (is_readable(e_DOWNLOAD.$row['download_url']) ? $e107->parseMemorySize(filesize(e_DOWNLOAD.$file['fname'])) : DOWLAN_181);
|
||||
$filets = (is_readable(e_DOWNLOAD.$row['download_url']) ? $gen->convert_date(filectime(e_DOWNLOAD.$file['fname']), "long") : DOWLAN_181);
|
||||
$text .= '<tr>';
|
||||
$text .= '<td>'.$e107->tp->toHTML($file['fname']).'</td>';
|
||||
$text .= '<td>'.$tp->toHTML($file['fname']).'</td>';
|
||||
$text .= '<td>'.$filets.'</td>';
|
||||
$text .= '<td>'.$filesize.'</td>';
|
||||
//TODO $text .= '<td>
|
||||
@@ -609,9 +567,12 @@ function showMaint()
|
||||
if ($count) {
|
||||
while($row = $sql->db_Fetch()) {
|
||||
if (!is_readable(e_DOWNLOAD.$row['download_url'])) {
|
||||
if (!$foundSome) {
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<table class="adminlist">';
|
||||
if (!$foundSome)
|
||||
{
|
||||
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
|
||||
$text .= '<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
|
||||
<table class="adminlist">';
|
||||
$text .= '<tr>';
|
||||
$text .= '<th>'.DOWLAN_67.'</th>';
|
||||
$text .= '<th>'.DOWLAN_27.'</th>';
|
||||
@@ -623,9 +584,9 @@ function showMaint()
|
||||
}
|
||||
$text .= '<tr>';
|
||||
$text .= '<td>'.$row['download_id'].'</td>';
|
||||
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
|
||||
$text .= '<td>'.$e107->tp->toHTML($row['download_category_name']).'</td>';
|
||||
$text .= '<td>'.$e107->tp->toHTML($row['download_url']).'</td>';
|
||||
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name']).'</a></td>';
|
||||
$text .= '<td>'.$tp->toHTML($row['download_category_name']).'</td>';
|
||||
$text .= '<td>'.$tp->toHTML($row['download_url']).'</td>';
|
||||
$text .= '<td>
|
||||
<a href="'.e_SELF.'?create.edit.'.$row["download_id"].'.maint.missing">'.ADMIN_EDIT_ICON.'</a>
|
||||
<input type="image" title="'.LAN_DELETE.'" name="delete[main_'.$row["download_id"].']" src="'.ADMIN_DELETE_ICON_PATH.'" onclick=\'return jsconfirm("'.$tp->toJS(DOWLAN_33.' [ID: '.$row["download_id"].' ]').'") \'/>
|
||||
@@ -653,9 +614,11 @@ function showMaint()
|
||||
$foundSome = false;
|
||||
if ($count) {
|
||||
while($row = $sql->db_Fetch()) {
|
||||
if (!$foundSome) {
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<table class="adminlist">';
|
||||
if (!$foundSome)
|
||||
{
|
||||
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
|
||||
<table class="adminlist">';
|
||||
$text .= '<tr>';
|
||||
$text .= '<th>'.DOWLAN_67.'</th>';
|
||||
$text .= '<th>'.DOWLAN_27.'</th>';
|
||||
@@ -665,6 +628,7 @@ function showMaint()
|
||||
$text .= '</tr>';
|
||||
$foundSome = true;
|
||||
}
|
||||
|
||||
$text .= '<tr>';
|
||||
$text .= '<td>'.$row['download_id'].'</td>';
|
||||
$text .= "<td><a href='".e_PLUGIN."download/download.php?view.".$row['download_id']."'>".$e107->tp->toHTML($row['download_name']).'</a></td>';
|
||||
@@ -706,8 +670,10 @@ function showMaint()
|
||||
if ($count) {
|
||||
while($row = $sql->db_Fetch()) {
|
||||
if (!$foundSome) {
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<table class="adminlist">';
|
||||
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '
|
||||
<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
|
||||
<table class="adminlist">';
|
||||
$text .= '<tr>';
|
||||
$text .= '<th>'.DOWLAN_67.'</th>';
|
||||
$text .= '<th>'.DOWLAN_27.'</th>';
|
||||
@@ -759,8 +725,9 @@ function showMaint()
|
||||
$filesize = filesize(e_DOWNLOAD.$row['download_url']);
|
||||
if ($filesize <> $row['download_filesize']) {
|
||||
if (!$foundSome) {
|
||||
$text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<table class="adminlist">';
|
||||
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
|
||||
$text .= '<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
|
||||
<table class="adminlist">';
|
||||
$text .= '<tr>';
|
||||
$text .= '<th>'.DOWLAN_67.'</th>';
|
||||
$text .= '<th>'.DOWLAN_27.'</th>';
|
||||
@@ -878,7 +845,7 @@ function showMaint()
|
||||
// $ns->tablerender(DOWLAN_165.$title, $text);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
function admin_download_adminmenu($parms)
|
||||
{
|
||||
global $action,$subAction;
|
||||
@@ -911,4 +878,6 @@ function admin_download_adminmenu($parms)
|
||||
$var['uopt']['link'] = e_SELF."?uopt";
|
||||
e_admin_menu(DOWLAN_10, $action, $var);
|
||||
}
|
||||
*/
|
||||
|
||||
?>
|
@@ -522,7 +522,7 @@ class adminDownload extends download
|
||||
|
||||
|
||||
|
||||
function create_download($subAction, $id)
|
||||
function create_download($subAction='', $id='')
|
||||
{
|
||||
global $download, $e107, $cal, $tp, $sql, $fl, $rs, $ns, $file_array, $image_array, $thumb_array, $pst;
|
||||
require_once(e_PLUGIN.'download/download_shortcodes.php');
|
||||
@@ -572,9 +572,9 @@ class adminDownload extends download
|
||||
return;
|
||||
}
|
||||
$download_active = 1;
|
||||
if ($subAction == "edit" && !$_POST['submit'])
|
||||
if ($_GET['action'] == "edit" && !$_POST['submit'])
|
||||
{
|
||||
if ($sql->db_Select("download", "*", "download_id=".$id))
|
||||
if ($sql->db_Select("download", "*", "download_id=".intval($_GET['id'])))
|
||||
{
|
||||
$row = $sql->db_Fetch();
|
||||
extract($row);
|
||||
@@ -686,7 +686,7 @@ class adminDownload extends download
|
||||
// See if any mirrors to display
|
||||
if (!$sql -> db_Select("download_mirror"))
|
||||
{ // No mirrors defined here
|
||||
$text .= DOWLAN_144."</tr>";
|
||||
$text .= DOWLAN_144."</td></tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1986,7 +1986,7 @@ class adminDownload extends download
|
||||
<input class='tbox' type='text' id='mirror_image' name='mirror_image' size='60' value='{$mirror_image}' maxlength='200'/>
|
||||
|
||||
|
||||
<br/><input class='button' type ='button' style='cursor:pointer' size='30' value='".DOWLAN_42."' onclick='expandit(this)'/>
|
||||
<br /><input class='button' type ='button' style='cursor:pointer' size='30' value='".DOWLAN_42."' onclick='expandit(this)'/>
|
||||
<div id='imagefile' style='display:none;{head}'>";
|
||||
|
||||
$text .= DOWLAN_140."<br/>";
|
||||
|
@@ -112,6 +112,8 @@ class download_cat_ui extends e_admin_ui
|
||||
protected $table = "download_category";
|
||||
protected $pid = "download_category_id";
|
||||
protected $perPage = 0; //no limit
|
||||
protected $listOrder = 'download_category_order';
|
||||
// protected $defaultOrderField = 'download_category_parent,download_category_order';
|
||||
// protected $listQry = "SELECT * FROM #faq_info"; // without any Order or Limit.
|
||||
// protected $editQry = "SELECT * FROM #faq_info WHERE faq_info_id = {ID}";
|
||||
|
||||
@@ -121,9 +123,9 @@ class download_cat_ui extends e_admin_ui
|
||||
'download_category_id' => array('title'=> LAN_ID, 'type' => 'number', 'width' =>'5%', 'forced'=> TRUE),
|
||||
'download_category_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'),
|
||||
'download_category_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
|
||||
'download_category_parent' => array('title'=> 'Parent', 'type' => 'method', 'width' => '5%'),
|
||||
'download_category_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int'),
|
||||
'download_category_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'left' ),
|
||||
'download_category_parent' => array('title'=> 'Parent', 'type' => 'method', 'width' => '5%', 'batch' => TRUE, 'filter'=>TRUE),
|
||||
'download_category_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int', 'batch' => TRUE, 'filter'=>TRUE),
|
||||
'download_category_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => '5%', 'thclass' => 'right', 'class'=> 'right' ),
|
||||
'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'center last', 'class' => 'center')
|
||||
);
|
||||
|
||||
@@ -134,7 +136,7 @@ class download_cat_ui extends e_admin_ui
|
||||
$sql = e107::getDb();
|
||||
$sql -> db_Select_gen('SELECT * FROM #download_category ORDER BY download_category_order');
|
||||
$cats = array();
|
||||
$cats[0] = 'n/a';
|
||||
$cats[0] = $default;
|
||||
while($row = $sql->db_Fetch())
|
||||
{
|
||||
$cats[$row['download_category_id']] = $row['download_category_name'];
|
||||
@@ -342,10 +344,10 @@ class download_main_admin_ui extends e_admin_ui
|
||||
'download_author_website' => array('title'=> DOWLAN_17, 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
|
||||
'download_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'bbarea', 'width' => '30%', 'readParms' => 'expand=...&truncate=50&bb=1'), // Display name
|
||||
|
||||
'download_filesize' => array('title'=> DOWLAN_66, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => 'right'),
|
||||
'download_requested' => array('title'=> DOWLAN_29, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => 'center'),
|
||||
'download_category' => array('title'=> LAN_CATEGORY, 'type' => 'method', 'width' => '5%'),
|
||||
'download_active' => array('title'=> DOWLAN_21, 'type' => 'method', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
||||
'download_filesize' => array('title'=> DOWLAN_66, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => 'right', 'class' => 'right'),
|
||||
'download_requested' => array('title'=> DOWLAN_29, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'thclass' => 'right', 'class' => 'right'),
|
||||
'download_category' => array('title'=> LAN_CATEGORY, 'type' => 'dropdown', 'width' => '5%', 'batch' => TRUE, 'filter'=>TRUE),
|
||||
'download_active' => array('title'=> DOWLAN_21, 'type' => 'method', 'data' => 'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center', 'batch' => TRUE, 'filter'=>TRUE, 'noedit' => true),
|
||||
'download_datestamp' => array('title'=> LAN_DATE, 'type' => 'datestamp', 'data' => 'int', 'width' => 'auto', 'thclass' => '', 'readParms' => 'long', 'writeParms' => ''),
|
||||
|
||||
'download_thumb' => array('title'=> DOWLAN_20, 'type' => 'image', 'data' => 'str', 'width' => '10%', 'thclass' => 'center' ),
|
||||
@@ -410,6 +412,26 @@ $columnInfo = array(
|
||||
// optional
|
||||
public function init()
|
||||
{
|
||||
$categories = array();
|
||||
if(e107::getDb()->db_Select('download_category'))
|
||||
{
|
||||
//$categories[0] = LAN_SELECT;
|
||||
while ($row = e107::getDb()->db_Fetch())
|
||||
{
|
||||
$id = $row['download_category_id'];
|
||||
$categories[$id] = $row['download_category_name'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->fields['download_category']['writeParms'] = $categories;
|
||||
// DEPRECATED
|
||||
//$this->fields['fb_rendertype']['writeParms'] = array(FBLAN_23,FBLAN_24);
|
||||
//$this->fields['fb_mode']['writeParms'] = array(FBLAN_13,FBLAN_14);
|
||||
|
||||
$this->fields['download_category']['readParms'] = $categories;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function createPage()
|
||||
@@ -478,13 +500,14 @@ class download_main_admin_form_ui extends e_admin_form_ui
|
||||
|
||||
function download_active($curVal,$mode)
|
||||
{
|
||||
$download_status[0] = DOWLAN_122;
|
||||
$download_status[1] = DOWLAN_123;
|
||||
$download_status[0] = DOWLAN_122; // Inactive;
|
||||
$download_status[1] = DOWLAN_123; // Active
|
||||
$download_status[2] = DOWLAN_124;
|
||||
|
||||
if($mode == 'read')
|
||||
{
|
||||
return $download_status[$curVal];
|
||||
$status = array(ADMIN_FALSE_ICON,ADMIN_TRUE_ICON,ADMIN_WARNING_ICON);
|
||||
return $status[$curVal];
|
||||
}
|
||||
|
||||
if($mode == 'batch' || $mode == 'filter') // Custom Batch List for download_active
|
||||
@@ -492,7 +515,7 @@ class download_main_admin_form_ui extends e_admin_form_ui
|
||||
return $download_status;
|
||||
}
|
||||
|
||||
return "active?";
|
||||
return " ";
|
||||
}
|
||||
|
||||
function download_mirror_type($curVal,$mode)
|
||||
|
Reference in New Issue
Block a user