1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

More work on admin->downloads. Now uses media-manager for images.

This commit is contained in:
CaMer0n
2012-04-20 07:28:53 +00:00
parent e74000fb1c
commit f1cc288878
11 changed files with 2513 additions and 737 deletions

View File

@@ -209,7 +209,7 @@ class news_shortcodes extends e_shortcode
if (ADMIN && getperms('H'))
{
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."admin_images/edit_16.png");
return " <a href='".e_ADMIN_ABS."newspost.php?create.edit.".$this->news_item['news_id']."'><img src='".$adop_icon."' alt='".LAN_NEWS_25."' class='icon' /></a>\n";
return " <a href='".e_ADMIN_ABS."newspost.php?action=create&amp;sub=edit&amp;id=".$this->news_item['news_id']."'><img src='".$adop_icon."' alt='".LAN_NEWS_25."' class='icon' /></a>\n";
}
else
{

View File

@@ -114,7 +114,7 @@ class page_shortcodes extends e_shortcode
* @see eHelper::scDualParams()
* @see eHelper::scParams()
*/
function sc_cpagehumbnail($parm = '')
function sc_cpagethumbnail($parm = '')
{
$parms = eHelper::scDualParams($parm);
if(empty($parms[1])) return '';
@@ -144,6 +144,17 @@ class page_shortcodes extends e_shortcode
break;
}
}
// For Future Use..
function sc_cpageimage($parm = '')
{
list($num,$size) = explode("|",$parm);
if($this->page['page_images'])
{
$img = explode(",",$this->page['page_images']);
}
}
function sc_cpagelink($parm)
{

View File

@@ -799,6 +799,69 @@ class eMessage
}
throw new Exception('Method eMessage::'.$method.' does not exist!');//FIXME - e107Exception handler
}
/**
* Automate DB system messages
* NOTE: default value of $output parameter will be changed to false (no output by default) in the future
*
* @param integer|bool $update return result of db::db_Query
* @param string $type update|insert|update
* @param string $success forced success message
* @param string $failed forced error message
* @param bool $output false suppress any function output
* @return integer|bool db::db_Query result
*/
// TODO - This function often needs to be available BEFORE header.php is loaded.
// It has been copied from admin_update() in e107_admin/header.php
public function autoMessage($update, $type = 'update', $success = false, $failed = false, $output = false)
{
if (($type == 'update' && $update) || ($type == 'insert' && $update !== false))
{
$this->add(($success ? $success : ($type == 'update' ? LAN_UPDATED : LAN_CREATED)), E_MESSAGE_SUCCESS);
}
elseif ($type == 'delete' && $update)
{
$this->add(($success ? $success : LAN_DELETED), E_MESSAGE_SUCCESS);
}
elseif (!mysql_errno())
{
if ($type == 'update')
{
$this->add(LAN_NO_CHANGE.' '.LAN_TRY_AGAIN, E_MESSAGE_INFO);
}
elseif ($type == 'delete')
{
$this->add(LAN_DELETED_FAILED.' '.LAN_TRY_AGAIN, E_MESSAGE_INFO);
}
}
else
{
switch ($type)
{
case 'insert':
$msg = LAN_CREATED_FAILED;
break;
case 'delete':
$msg = LAN_DELETED_FAILED;
break;
default:
$msg = LAN_UPDATED_FAILED;
break;
}
$text = ($failed ? $failed : $msg." - ".LAN_TRY_AGAIN)."<br />".LAN_ERROR." ".mysql_errno().": ".mysql_error();
$this->add($text, E_MESSAGE_ERROR);
}
if ($output) echo $this->render();
return $update;
}
}

View File

@@ -26,7 +26,10 @@ if (!getperms("P") || !plugInstalled('download'))
include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/download.php');
include_lan(e_PLUGIN.'download/languages/'.e_LANGUAGE.'/admin_download.php');
require_once(e_PLUGIN.'download/handlers/adminDownload_class.php');
// require_once(e_PLUGIN.'download/handlers/adminDownload_class.php');
require_once(e_PLUGIN.'download/handlers/download_class.php');
require_once(e_HANDLER.'upload_handler.php');
require_once(e_HANDLER.'xml_class.php');
require_once(e_HANDLER."form_handler.php");
require_once(e_HANDLER."ren_help.php");
require_once(e_HANDLER."calendar/calendar_class.php");
@@ -55,12 +58,14 @@ $pst->id = array("admin_downloads","admin_dl_cat");
// -------------------------------
$download = new download();
$adminDownload = new adminDownload();
// $adminDownload = new adminDownload();
$pst->save_preset(); // unique name(s) for the presets - comma separated.
new plugin_download_admin();
require_once(e_ADMIN."auth.php");
$pst->save_preset(); // unique name(s) for the presets - comma separated.
/*
One form example (no arrays needed)
@@ -68,6 +73,7 @@ $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;
$subAction = '';
@@ -82,7 +88,7 @@ if (e_QUERY)
unset($tmp);
}
$adminDownload->observer();
// $adminDownload->observer();
require_once (e_HANDLER.'message_handler.php');
$emessage = &eMessage::getInstance();
@@ -95,17 +101,18 @@ $amount = varset($pref['download_view'], 50);
if (isset($_POST))
{
$e107cache->clear("download_cat");
}
}*/
/*
if (isset($_POST['submit_download']))
{
$adminDownload->submit_download($subAction, $id);
$action = "main";
unset($subAction, $id);
}
*/
if (isset($_POST['update_catorder']))
{
@@ -119,6 +126,7 @@ if (isset($_POST['update_catorder']))
$admin_log->log_event('DOWNL_08',implode(',',array_keys($_POST['catorder'])),E_LOG_INFORMATIVE,'');
$ns->tablerender("", "<div style='text-align:center'><b>".LAN_UPDATED."</b></div>");
}
/*
if (isset($_POST['updatedownlaodoptions']))
{
@@ -149,6 +157,8 @@ if (isset($_POST['updatedownlaodoptions']))
}
}
*/
if (isset($_POST['updateuploadoptions']))
{
unset($temp);
@@ -239,10 +249,15 @@ if (isset($_POST['updatelimits']))
}
if (isset($_POST['submit_mirror']))
{
$adminDownload->submit_mirror($subAction, $id);
}
//download/includes/admin.php is auto-loaded.
e107::getAdminUI()->runPage();
require_once(e_ADMIN."footer.php");
exit;
/*
if ($action == "mirror")
@@ -272,9 +287,10 @@ if ($from === "maint" && isset($_POST['submit_download']))
$action = $from;
$subAction = $maintPage;
}
*/
e107::getAdminUI()->runPage();
/*
if (!e_QUERY || $action == "main")
{
@@ -309,9 +325,9 @@ if ($action == "uopt")
{
$adminDownload->show_upload_options();
}
*/
require_once(e_ADMIN."footer.php");
exit;
function showLimits()
@@ -825,6 +841,456 @@ function showMaint() // Deprecated.
// $ns->tablerender(DOWLAN_165.$title, $text);
}
// UNUSED
function show_upload_list() {
global $ns, $sql, $gen, $e107, $tp;
$frm = new e_form(true); //enable inner tabindex counter
$imgd = e_BASE.$IMAGES_DIRECTORY;
$columnInfo = array(
"checkboxes" => array("title" => "", "forced"=> TRUE, "width" => "3%", "thclass" => "center first", "toggle" => "dl_selected"),
"upload_id" => array("title"=>DOWLAN_67, "type"=>"", "width"=>"auto", "thclass"=>"", "forced"=>true),
"upload_date" => array("title"=>DOWLAN_78, "type"=>"", "width"=>"auto", "thclass"=>""),
"upload_uploader" => array("title"=>DOWLAN_79, "type"=>"", "width"=>"auto", "thclass"=>""),
"upload_name" => array("title"=>DOWLAN_12, "type"=>"", "width"=>"auto", "thclass"=>""),
"upload_file_name" => array("title"=>DOWLAN_59, "type"=>"", "width"=>"auto", "thclass"=>""),
"upload_size" => array("title"=>DOWLAN_66, "type"=>"", "width"=>"auto", "thclass"=>"right"),
"options" => array("title"=>LAN_OPTIONS,"width"=>"15%", "thclass"=>"center last", "forced"=>true)
);
//TODO $filterColumns = ($user_pref['admin_download_disp'] ? $user_pref['admin_download_disp'] : array("download_name","download_class"));
$filterColumns = array("upload_id","upload_date","upload_uploader","upload_name","upload_file_name","upload_size");
$text = "
<fieldset id='core-download-upload1'>
<div>
<table style='".ADMIN_WIDTH."' class='adminlist'>"
.$frm->colGroup($columnInfo,$filterColumns)
.$frm->thead($columnInfo,$filterColumns,"main.[FIELD].[ASC].[FROM]")."
<tbody>
<tr>
<td class='center' colspan='".(count($filterColumns)+2)."'>";
if (!$active_uploads = $sql->db_Select("upload", "*", "upload_active=0 ORDER BY upload_id ASC"))
{
$text .= DOWLAN_19.".</td></tr>";
}
else
{
$activeUploads = $sql -> db_getList();
$text .= DOWLAN_80." ".($active_uploads == 1 ? DOWLAN_81 : DOWLAN_82)." ".$active_uploads." ".($active_uploads == 1 ? DOWLAN_83 : DOWLAN_84);
$text .= "</td></tr>";
foreach($activeUploads as $row)
{
$post_author_id = substr($row['upload_poster'], 0, strpos($row['upload_poster'], "."));
$post_author_name = substr($row['upload_poster'], (strpos($row['upload_poster'], ".")+1));
$poster = (!$post_author_id ? "<b>".$post_author_name."</b>" : "<a href='".e_BASE."user.php?id.".$post_author_id."'><b>".$post_author_name."</b></a>");
$upload_datestamp = $gen->convert_date($row['upload_datestamp'], "short");
$text .= "
<tr>
<td class='center'>".$frm->checkbox("dl_selected[".$row["upload_id"]."]", $row['upload_id'])."</td>
<td class='center'>".$row['upload_id']."</td>
<td>".$upload_datestamp."</td>
<td>".$poster."</td>
<td><a href='".e_SELF."?ulist.".$row['upload_id']."'>".$row['upload_name']."</a></td>
<td>".$row['upload_file']."</td>
<td class='right'>".$e107->parseMemorySize($row['upload_filesize'])."</td>
<td class='center'>
<form action='".e_SELF."?dis.{$upload_id}' id='uploadform_{$upload_id}' method='post'>
<div>
<a href='".e_SELF."?dlm.".$row['upload_id']."'><img src='".e_IMAGE."admin_images/downloads_32.png' alt='".DOWLAN_91."' title='".DOWLAN_91."' style='border:0'/></a>
<a href='".e_ADMIN."newspost.php?create.upload.1.".$row['upload_id']."'><img src='".e_IMAGE."admin_images/news_32.png' alt='".DOWLAN_162."' title='".DOWLAN_162."' style='border:0'/></a>
<input type='image' title='".LAN_DELETE."' name='updelete[upload_".$row['upload_id']."]' src='".ADMIN_DELETE_ICON_PATH."' onclick=\"return jsconfirm('".$tp->toJS(" [ ".$row['upload_name']." ] ".DOWLAN_33)."') \"/>
</div>
</form>
</td>
</tr>";
}
}
$text .= "</tbody></table></div></fieldset>";
$ns->tablerender(DOWLAN_22, $text);
}
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 .= "
<script type='text/javascript'>
</script>
<form method='post' action='".e_SELF."' class='e-show-if-js e-filter-form' id='jstarget-downloads-list'>
<div id='download_search'>
<fieldset>
<legend class='e-hideme'>".DOWLAN_194."</legend>
<table class='adminlist'>
<tr>
<td>".DOWLAN_198." ".$frm->text('download-search-text', $this->searchField, 50, array('size'=>50, 'class' => 'someclass'))."&nbsp;<a href='#download_search#download_advanced_search' class='e-swapit'>Switch to Advanced-Search</a></td>
</tr>
</table>
";
// Filter should use ajax to filter the results automatically after typing.
/* $text .= "
<div class='buttons-bar center'>
<button type='submit' class='update' name='download_search_submit' value='no-value'><span>".DOWLAN_51."</span></button>
<br/>
</div>";*/
$text.= "
</fieldset>
</div>
</form>
";
// Advanced search fields
$text .= "
<form method='post' action='".e_SELF."'>
<div id='download_advanced_search' class='e-hideme'>
<fieldset>
<legend class='e-hideme'>".DOWLAN_183."</legend>
<table class='adminform'>
<colgroup>
<col style='width:15%;'/>
<col style='width:35%;'/>
<col style='width:15%;'/>
<col style='width:35%;'/>
</colgroup>
<tr>
<td>".DOWLAN_12."</td>
<td><input class='tbox' type='text' name='download_advanced_search[name]' size='30' value='{$this->advancedSearchFields['name']}' maxlength='50'/></td>
<td>".DOWLAN_18."</td>
<td><input class='tbox' type='text' name='download_advanced_search[description]' size='50' value='{$this->advancedSearchFields['description']}' maxlength='50'/></td>
</tr>
<tr>
<td>".DOWLAN_11."</td>
<td>".$this->getCategorySelectList($this->advancedSearchFields['category'], true, false, '&nbsp;', 'download_advanced_search[category]');
$text .= " </td>
<td>".DOWLAN_149."</td>
<td><input class='tbox' type='text' name='download_advanced_search[url]' size='50' value='{$this->advancedSearchFields['url']}' maxlength='50'/></td>
</tr>
<tr>
<td>".DOWLAN_182."</td>
<td>
";
$text .= $this->_getConditionList('download_advanced_search[date_condition]', $this->advancedSearchFields['date_condition']);
//TODO $text .= $frm->datepicker('download_advanced_search[date]', $this->advancedSearchFields['date']);
$text .= "//TODO";
$text .= "
</td>
<td>".DOWLAN_21."</td>
<td>
<select name='download_advanced_search[status]' class='tbox'>";
$text .= $this->_getStatusList('download_advanced_search[status]', $this->advancedSearchFields['status']);
$text .= " </select>
</td>
</tr>
<tr>
<td>".DOWLAN_66."</td>
<td>
";
$text .= $this->_getConditionList('download_advanced_search[filesize_condition]', $this->advancedSearchFields['filesize_condition']);
$text .= "
<input class='tbox' type='text' name='download_advanced_search[filesize]' size='10' value='{$this->advancedSearchFields['filesize']}'/>
<select name='download_advanced_search[filesize_units]' class='tbox'>
<option value='1' ".($this->advancedSearchFields['filesize_units'] == '' ? " selected='selected' " : "")." >b</option>
<option value='1024' ".($this->advancedSearchFields['filesize_units'] == '1024' ? " selected='selected' " : "")." >Kb</option>
<option value='1048576' ".($this->advancedSearchFields['filesize_units'] == '1048576' ? " selected='selected' " : "")." >Mb</option>
</select>
</td>
<td>".DOWLAN_43."</td>
<td>".$frm->uc_select('download_advanced_search[visible]', $this->advancedSearchFields['visible'], $this->userclassOptions)."</td>
</tr>
<tr>
<td>".DOWLAN_29."</td>
<td>
";
$text .= $this->_getConditionList('download_advanced_search[requested_condition]', $this->advancedSearchFields['requested_condition']);
$text .= " <input class='tbox' type='text' name='download_advanced_search[requested]' size='6' value='{$this->advancedSearchFields['requested']}' maxlength='6'/> times
</td>
<td>".DOWLAN_113."</td>
<td>
";
$text .= $frm->uc_select('download_advanced_search[class]', $this->advancedSearchFields['class'], $this->userclassOptions);
$text .= "
</td>
</tr>
<tr>
<td>".DOWLAN_15."</td>
<td><input class='tbox' type='text' name='download_advanced_search[author]' size='30' value='{$this->advancedSearchFields['author']}' maxlength='50'/></td>
<td>".DOWLAN_16."</td>
<td><input class='tbox' type='text' name='download_advanced_search[author_email]' size='30' value='{$this->advancedSearchFields['author']}' maxlength='50'/></td>
</tr>
<tr>
<td>".DOWLAN_17."</td>
<td><input class='tbox' type='text' name='download_advanced_search[author_website]' size='30' value='{$this->advancedSearchFields['author']}' maxlength='50'/></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<div class='buttons-bar center'>
<span class='e-show-if-js f-left'><a href='#download_advanced_search#download_search' class='e-swapit'>Simple search</a></span>
<button type='submit' class='update' name='download_advanced_search_submit' value='no-value'><span>".DOWLAN_51."</span></button>
</div>
</fieldset>
</div>
</form>";
return $text;
}
function show_upload_filetypes() {
global $ns;
//TODO is there an e107:: copy of this
if (!is_object($e_userclass))
{
$e_userclass = new user_class;
}
if(!getperms("0")) exit; //TODO still needed?
$definition_source = DOWLAN_71;
$source_file = '';
$edit_upload_list = varset($_POST['upload_do_edit'], false);
if (isset($_POST['generate_filetypes_xml']))
{ // Write back edited data to filetypes_.xml
$file_text = "<e107Filetypes>\n";
foreach ($_POST['file_class_select'] as $k => $c)
{
if (!isset($_POST['file_line_delete_'.$c]) && varsettrue($_POST['file_type_list'][$k]))
{
$file_text .= " <class name='{$c}' type='{$_POST['file_type_list'][$k]}' maxupload='".varsettrue($_POST['file_maxupload'][$k],ini_get('upload_max_filesize'))."'/>\n";
}
}
$file_text .= "</e107Filetypes>";
if ((($handle = fopen(e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES,'wt')) == FALSE)
|| (fwrite($handle,$file_text) == FALSE)
|| (fclose($handle) == FALSE))
{
$text = DOWLAN_88.e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES;
}
else
{
$text = DOWLAN_86.e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES.'<br/>'.DOWLAN_87.e_ADMIN.e_READ_FILETYPES.'<br/>';
}
$ns->tablerender(DOWLAN_49, $text);
}
$current_perms = array();
if (($edit_upload_list && is_readable(e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES)) || (!$edit_upload_list && is_readable(e_ADMIN.e_READ_FILETYPES)))
{
require_once(e_HANDLER.'xml_class.php');
$xml = new xmlClass;
$xml->setOptArrayTags('class');
$source_file = $edit_upload_list ? e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES : e_ADMIN.e_READ_FILETYPES;
$temp_vars = $xml->loadXMLfile($source_file, true, false);
if ($temp_vars === FALSE)
{
echo "Error parsing XML file!";
}
else
{
foreach ($temp_vars['class'] as $v1)
{
$v = $v1['@attributes'];
$current_perms[$v['name']] = array('type' => $v['type'],'maxupload' => $v['maxupload']);
}
}
}
elseif (is_readable(e_ADMIN.'filetypes.php'))
{
$source_file = 'filetypes.php';
$current_perms[e_UC_MEMBER] = array('type' => implode(',',array_keys(get_allowed_filetypes('filetypes.php', ''))),'maxupload' => '2M');
if (is_readable(e_ADMIN.'admin_filetypes.php'))
{
$current_perms[e_UC_ADMIN] = array('type' => implode(',',array_keys(get_allowed_filetypes('admin_filetypes.php', ''))),'maxupload' => '2M');
$source_file .= ' + admin_filetypes.php';
}
}
else
{ // Set a default
$current_perms[e_UC_MEMBER] = array('type' => 'zip,tar,gz,jpg,png','maxupload' => '2M');
}
$frm = new e_form(true); //enable inner tabindex counter
$columnInfo = array(
"ftypes_userclass" => array("title"=>DOWLAN_73, "type"=>"", "width"=>"auto", "thclass"=>"", "forced"=>true),
"ftypes_extension" => array("title"=>DOWLAN_74, "type"=>"", "width"=>"auto", "thclass"=>""),
"ftypes_max_size" => array("title"=>DOWLAN_75, "type"=>"", "width"=>"auto", "thclass"=>""),
"ftypes_confirm_del" => array("title"=>DOWLAN_76, "type"=>"", "width"=>"auto", "thclass"=>"last"),
);
$filterColumns = array("ftypes_userclass", "ftypes_extension", "ftypes_max_size", "ftypes_confirm_del");
$text = "
<form method='post' action='".e_SELF."?filetypes'>
<fieldset id='core-download-upload1'>
<div>
<div>
<input type='hidden' name='upload_do_edit' value='1'/><p>".
str_replace(array('--SOURCE--', '--DEST--'),array(e_UPLOAD_TEMP_DIR.e_SAVE_FILETYPES,e_ADMIN.e_READ_FILETYPES),DOWLAN_85)
."</p><p>".
DOWLAN_72.$source_file."
</p></div>
<table style='".ADMIN_WIDTH."' class='adminlist'>"
.$frm->colGroup($columnInfo)
.$frm->thead($columnInfo,$filterColumns)."
<tbody>
";
foreach ($current_perms as $uclass => $uinfo)
{
$text .= "
<tr>
<td>
<select name='file_class_select[]' class='tbox'>
".$e_userclass->vetted_tree('file_class_select',array($e_userclass,'select'), $uclass,'member,main,classes,admin')."
</select>
</td>
<td><input type='text' name='file_type_list[]' value='{$uinfo['type']}' class='tbox' size='40'/></td>
<td><input type='text' name='file_maxupload[]' value='{$uinfo['maxupload']}' class='tbox' size='10'/></td>
<td><input type='checkbox' value='1' name='file_line_delete_{$uclass}'/></td>
</tr>
";
}
// Now put up a box to add a new setting
$text .= "
<tr>
<td colspan='".count($columnInfo)."'>".DOWLAN_90."</td>
</tr>
<tr>
<td><select name='file_class_select[]' class='tbox'>
".$e_userclass->vetted_tree('file_class_select',array($e_userclass,'select'), '','member,main,classes,admin,blank')."
</select></td>
<td><input type='text' name='file_type_list[]' value='' class='tbox' size='40'/></td>
<td colspan='2'><input type='text' name='file_maxupload[]' value='".ini_get('upload_max_filesize')."' class='tbox' size='10'/></td>
</tr>
</tbody>
</table>
</div>
</fieldset>
<div class='buttons-bar center'>
<input class='button' type='submit' name='generate_filetypes_xml' value='".DOWLAN_77."'/>
</div>
</form>
";
$ns->tablerender(DOWLAN_23, $text);
}
function show_upload_options() {
global $pref, $ns;
require_once(e_HANDLER."form_handler.php");
$frm = new e_form(true); //enable inner tabindex counter
$text = "
<form method='post' action='".e_SELF."?".e_QUERY."'>
<fieldset id='core-download-upload1'>
<div>
<table style='".ADMIN_WIDTH."' class='adminlist'>
<colgroup>
<col style='width:30%'/>
<col style='width:70%'/>
</colgroup>
<tr>
<td>".DOWLAN_26."</td>
<td>"
.$frm->radio_switch('upload_enabled', $pref['upload_enabled'])
."<div class='field-help'>"
.$frm->label(DOWLAN_51, 'upload_enabled', '1')
."</div>"
."</td>
</tr>
<tr>
<td>".DOWLAN_35."</td>
<td>"
.$frm->text('upload_maxfilesize', $pref['upload_maxfilesize'], '4', array('size'=>'10'))
."<div class='field-help'>"
.$frm->label(str_replace(array("%1", "%2"), array(ini_get('upload_max_filesize'), ini_get('post_max_size')), DOWLAN_58), 'upload_maxfilesize', '1')
."</div>"
."</td>
</tr>
<tr>
<td>".DOWLAN_61."</td>
<td>"
.r_userclass("upload_class", $pref['upload_class'])
."<div class='field-help'>"
.$frm->label(DOWLAN_60, 'upload_class', '1')
."</div>"
."</td>
</tr>
</table>
</div>
</fieldset>
<div class='buttons-bar center'>
<input class='button' type='submit' name='updateuploadoptions' value='".DOWLAN_64."'/>
</div>
</form>
";
$ns->tablerender(LAN_DL_OPTIONS, $text);
}
/**
*
* @private
*/
function _getConditionList($name, $value) {
$text .= "
<select name='{$name}' class='tbox'>
<option value='>=' ".($value == '>=' ? " selected='selected' " : "")." >&gt;=</option>
<option value='=' ".($value == '=' ? " selected='selected' " : "")." >==</option>
<option value='<=' ".($value == '<=' ? " selected='selected' " : "")." >&lt;=</option>
</select>
";
return $text;
}
/**
*
* @private
*/
function _getStatusList($name, $value) {
$download_status[99]= '&nbsp;';
$download_status[0] = DOWLAN_122;
$download_status[1] = DOWLAN_123;
$download_status[2] = DOWLAN_124;
$text = "";
foreach($download_status as $key=>$val){
$sel = ($value == $key && $value != null) ? " selected='selected'" : "";
$text .= "<option value='{$key}'{$sel}>{$val}</option>\n";
}
return $text;
}
/*
function admin_download_adminmenu($parms)
{

View File

@@ -149,9 +149,9 @@ else
if (isset($order) && !in_array($order,$order_options)) unset($order);
if (isset($sort) && !in_array($sort,$sort_options)) unset($sort);
if (!isset($order)) $order = varset($pref['download_order'],'download_datestamp');
if (!isset($sort)) $sort = varset($pref['download_sort'], 'DESC');
if (!isset($view)) $view = varset($pref['download_view'], '10');
if (!isset($order)) $order = vartrue($pref['download_order'],'download_datestamp');
if (!isset($sort)) $sort = vartrue($pref['download_sort'], 'DESC');
if (!isset($view)) $view = vartrue($pref['download_view'], '10');
//--------------------------------------------------
// GENERATE DISPLAY TEXT

View File

@@ -2,7 +2,7 @@
/*
* e107 website system
*
* Copyright (C) 2008-2009 e107 Inc (e107.org)
* Copyright (C) 2008-2012 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
@@ -17,6 +17,7 @@
class download_setup
{
function install_pre($var)
{
// print_a($var);
@@ -38,12 +39,60 @@ class download_setup
// $mes->add("custom uninstall 'pre' function.", E_MESSAGE_SUCCESS);
}
function upgrade_post($var)
// IMPORTANT : This function below is for modifying the CONTENT of the tables only, NOT the table-structure.
// To Modify the table-structure, simply modify your {plugin}_sql.php file and an update will be detected automatically.
/*
* @var $needed - true when only a check for a required update is being performed.
* Return: Reason the upgrade is required, otherwise set it to return FALSE.
*/
function upgrade_post($needed)
{
$sql = e107::getDb();
$mes = eMessage::getInstance();
// $mes->add("custom upgrade 'post' function.", E_MESSAGE_SUCCESS);
$mes = e107::getMessage();
$qry = "SELECT * FROM #download WHERE download_image !='' AND SUBSTRING(download_image, 1, 3) != '{e_' LIMIT 2";
if($sql->db_Select_gen($qry))
{
if($needed == TRUE){ return "Incorrect download image paths"; } // Signal that an update is required.
if($sql->db_Update("download","download_image = CONCAT('{e_FILE}downloadimages/',download_image) WHERE download_image !='' "))
{
$mes->addSuccess("Updated Download-Image paths");
}
else
{
$mes->addError("Failed to update Download-Image paths");
}
if($sql->db_Update("download"," download_thumb = CONCAT('{e_FILE}downloadthumbs/',download_thumb) WHERE download_thumb !='' "))
{
$mes->addSuccess("Updated Download-Thumbnail paths");
}
else
{
$mes->addError("Failed to update Download-Thumbnail paths");
}
}
$qry = "SELECT * FROM #download_category WHERE download_category_icon !='' AND SUBSTRING(download_category_icon, 1, 3) != '{e_' LIMIT 2";
if($sql->db_Select_gen($qry))
{
// Signal that an update is required.
if($needed == TRUE){ return "Downloads-Category icon paths need updating"; } // Must have a value if an update is needed. Text used for debug purposes.
if($sql->db_Update("download_category","download_category_icon = CONCAT('{e_IMAGE}icons/',download_category_icon) WHERE download_category_icon !='' "))
{
$mes->addSuccess("Updated Download-Image paths");
}
else
{
$mes->addError("Failed to update Download-Image paths");
}
}
if($needed == TRUE){ return FALSE; }
//if(version_compare($var['current_plug']['plugin_version'], "1.2", "<"))
//{
// $qry = "ALTER TABLE #download ADD download_postclass TINYINT( 3 ) UNSIGNED DEFAULT '0' NOT NULL ;";

View File

@@ -171,7 +171,9 @@ class download_shortcodes
function sc_download_list_thumb()
{
global $dlrow,$parm;
$img = ($dlrow['download_thumb']) ? "<img src='".e_FILE."downloadthumbs/".$dlrow['download_thumb']."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
$tp = e107::getParser();
$img = ($dlrow['download_thumb']) ? "<img src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
if ($parm == "link" && $dlrow['download_thumb']){
return "<a href='".e_PLUGIN."download/download.php?view.".$dlrow['download_id']."'>".$img."</a>";
}
@@ -213,6 +215,8 @@ class download_shortcodes
return ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$dlrow['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a href='".e_BASE."request.php?".$dlrow['download_id']."' >{$img}</a>");
}
}
function sc_download_list_icon()
{
global $dlrow,$parm;
@@ -225,6 +229,25 @@ class download_shortcodes
}
return;
}
function sc_download_list_imagefull()
{
global $dlrow,$parm;
$tp = e107::getParser();
$img = ($dlrow['download_image']) ? "<img class='dl_image' src='".$tp->replaceConstants($dlrow['download_image'])."' alt='' style='".DL_IMAGESTYLE."' />" : "";
if($parm == "link" && $dlrow['download_image'])
{
return "<a href='".e_BASE."download.php?view.".$dlrow['download_id']."'>".$img."</a>";
}
else
{
return $img;
}
}
function sc_download_list_nextprev()
{
global $nextprev_parms,$tp;
@@ -238,6 +261,12 @@ class download_shortcodes
global $dlft;
return $dlft." ".LAN_dl_17;
}
// View ****************************************************************************************
function sc_download_view_id()
{
@@ -330,8 +359,10 @@ class download_shortcodes
function sc_download_view_image()
{
global $dlrow;
$tp = e107::getParser();
if ($dlrow['download_thumb']) {
return ($dlrow['download_image'] ? "<a href='".e_BASE."request.php?download.".$dlrow['download_id']."'><img class='dl_image' src='".e_FILE."downloadthumbs/".$dlrow['download_thumb']."' alt='*' style='".DL_IMAGESTYLE."' /></a>" : "<img class='dl_image' src='".e_FILE."downloadthumbs/".$dlrow['download_thumb']."' alt='*' style='".DL_IMAGESTYLE."' />");
return ($dlrow['download_image'] ? "<a href='".e_BASE."request.php?download.".$dlrow['download_id']."'><img class='dl_image' src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' /></a>" : "<img class='dl_image' src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*' style='".DL_IMAGESTYLE."' />");
}
else if ($dlrow['download_image']) {
return "<a href='".e_BASE."request.php?download.".$dlrow['download_id']."'>".LAN_dl_40."</a>";
@@ -344,7 +375,8 @@ class download_shortcodes
function sc_download_view_imagefull()
{
global $dlrow;
return ($dlrow['download_image']) ? "<img class='dl_image' src='".e_FILE."downloadimages/".$dlrow['download_image']."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
$tp = e107::getParser();
return ($dlrow['download_image']) ? "<img class='dl_image' src='".$tp->replaceConstants($dlrow['download_image'])."' alt='*' style='".DL_IMAGESTYLE."' />" : "";
}
function sc_download_view_link()
{
@@ -430,7 +462,8 @@ class download_shortcodes
}
function sc_download_mirror_request_icon() {
global $dlrow;
return ($dlrow['download_thumb'] ? "<img src='".e_FILE."downloadthumbs/".$dlrow['download_thumb']."' alt='*'/>" : "");
$tp = e107::getParser();
return ($dlrow['download_thumb'] ? "<img src='".$tp->replaceConstants($dlrow['download_thumb'])."' alt='*'/>" : "");
}
function sc_download_mirror_name() {
global $dlmirror;
@@ -438,7 +471,8 @@ class download_shortcodes
}
function sc_download_mirror_image() {
global $dlrow, $dlmirror;
return ($dlmirror['mirror_image'] ? "<a href='{$dlmirror['mirror_url']}' rel='external'><img src='".e_FILE."downloadimages/".$dlmirror['mirror_image']."' alt='*'/></a>" : "");
$tp = e107::getParser();
return ($dlmirror['mirror_image'] ? "<a href='{$dlmirror['mirror_url']}' rel='external'><img src='".$tp->replaceConstants($dlmirror['mirror_image'])."' alt='*'/></a>" : "");
}
function sc_download_mirror_location() {
global $dlmirror;

View File

@@ -14,8 +14,8 @@ CREATE TABLE download (
download_category int(10) unsigned NOT NULL default '0',
download_active tinyint(3) unsigned NOT NULL default '0',
download_datestamp int(10) unsigned NOT NULL default '0',
download_thumb varchar(150) NOT NULL default '',
download_image varchar(150) NOT NULL default '',
download_thumb text NOT NULL,
download_image text NOT NULL,
download_comment tinyint(3) unsigned NOT NULL default '0',
download_class varchar(255) NOT NULL default '0',
download_mirror text NOT NULL,

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,12 @@ class download
}
function displayCategoryList() {
}
function getBreadcrumb($arr)
{
$dlbreadcrumb = array();
@@ -44,6 +50,11 @@ class download
$dlbreadcrumb['fieldlist'] = implode(",", array_keys($dlbreadcrumb));
return $dlbreadcrumb;
}
function getCategorySelectList($currentID=0, $incSubSub=true, $groupOnMain=true, $blankText="&nbsp;", $name="download_category")
{
global $sql,$parm;

File diff suppressed because it is too large Load Diff