1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-16 20:28:28 +01:00

Basic e_upload.php file added. Work-in-progress.

This commit is contained in:
Cameron 2016-03-06 00:42:15 -08:00
parent 3ecd19b88c
commit 35b5957b24
4 changed files with 140 additions and 7 deletions

View File

@ -2052,7 +2052,7 @@ class e_form
{
if(is_array($label))
{
$text .= $this->optgroup($value,$label,$selected,$options, 1);
$text .= $this->optgroup($value,$label,$selected,$options, 0);
}
else

View File

@ -0,0 +1,122 @@
<?php
/*
* e107 website system
*
* Copyright (C) 2008-2016 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Chatbox e_search addon
*/
if (!defined('e107_INIT')) { exit; }
// v2 e_search addon.
// Removes the need for search_parser.php, search_advanced.php and in most cases search language files.
class download_upload
{
/*function config()
{
$cron = array();
$cron[] = array(
'name' => "Prune Download Log older than 12 months", // Prune downloads history
'function' => "pruneLog",
'category' => '',
'description' => "Non functional at the moment"
);
return $cron;
}*/
/**
* Compile Array Structure
*/
private function compile(&$inArray, &$outArray, $pid = 0)
{
if(!is_array($inArray) || !is_array($outArray)){ return array(); }
foreach($inArray as $key => $val)
{
if($val['download_category_parent'] == $pid)
{
$val['download_category_sub'] = (!empty($val['download_category_sub'])) ? $val['download_category_sub'] : array();
if($val['download_category_id'] != $pid)
{
$this->compile($inArray, $val['download_category_sub'], $val['download_category_id']);
}
$id = $val['download_category_id'];
$outArray[$id] = $val;
}
}
return $outArray;
}
/**
* Sent to 'Category' dropdown menu in upload.php form.
* @return array
*/
function category()
{
$sql = e107::getDb();
$qry = "SELECT download_category_id,download_category_name,download_category_parent FROM `#download_category` WHERE download_category_class IN (".USERCLASS_LIST.") ORDER BY download_category_order, download_category_parent";
if (!$data = $sql->retrieve($qry,true))
{
return array();
}
$outArray = array();
$ret = $this->compile($data,$outArray);
$arr = array();
foreach($ret as $k=>$v)
{
$id = $v['download_category_name'];
foreach($v['download_category_sub'] as $row)
{
$id2 = $row['download_category_name'];
$arr[$id] = array($row['download_category_id']=>$id2);
if(!empty($row['download_category_sub']))
{
foreach($row['download_category_sub'] as $key=>$val)
{
$subid = $val['download_category_name'];
$arr[$id][$subid] = array($val['download_category_id']=>$subid);
}
}
}
}
return $arr;
}
// TODO
function copy($row)
{
}
}

View File

@ -258,4 +258,11 @@ box-shadow: 0px 1px 0px rgba(255, 255, 255, 0.2) inset, 0px 1px 2px rgba(0, 0, 0
}
#search-results li { margin-top:5px; padding: 10px 0; }
#search-results li h4 { margin-bottom:0 !important }
#search-results li h4 { margin-bottom:0 !important }
optgroup.level-1 { padding-left:0.1em }
optgroup.level-2 { padding-left:0.7em }
optgroup.level-3 { padding-left:2em }
optgroup.level-4 { padding-left:3em }
optgroup.level-5 { padding-left:4em }

View File

@ -248,10 +248,14 @@ class userUpload
<td class='forumheader3'>".DOWLAN_11.":</td>
<td class='forumheader3'>";
require_once(e_CORE."shortcodes/batch/download_shortcodes.php");
$dlparm = (isset($download_category)) ? $download_category : "";
$text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}",true,$download_shortcodes); //FIXME - move to e_upload.php
// require_once(e_CORE."shortcodes/batch/download_shortcodes.php");
// $dlparm = (isset($download_category)) ? $download_category : "";
// $text .= $tp->parseTemplate("{DOWNLOAD_CATEGORY_SELECT={$dlparm}}",true,$download_shortcodes);
$optArray = e107::getAddonConfig('e_upload','','category');
$text .= e107::getForm()->select('category', $optArray, $_POST['category'], array('default'=>''));
$text .= "</td>
</tr>
@ -337,7 +341,7 @@ class userUpload
</tr>
<tr>
<td class='forumheader3'>".LAN_412."</td>
<td class='forumheader3'>".LAN_IMAGE."/".LAN_SCREENSHOT."</td>
<td class='forumheader3'><input class='tbox' style='width:90%' name='file_userfile[]' type='file' size='47' /></td>
</tr>