1
0
mirror of https://github.com/e107inc/e107.git synced 2025-03-14 01:19:44 +01:00

Initial work on Download SEF Urls

This commit is contained in:
Cameron 2013-12-24 02:33:14 -08:00
parent 2e7232aa9a
commit 86be4773f4
7 changed files with 308 additions and 69 deletions

View File

@ -70,10 +70,13 @@ if (!e107::isInstalled('download'))
}
}
$texts = $dl->render(); // Load before header.
require_once (HEADERF);
echo $texts;
require_once (FOOTERF);

View File

@ -38,25 +38,27 @@ class download_shortcodes extends e_shortcode
{
$tp = e107::getParser();
$frm = e107::getForm();
$url = e107::getUrl();
$breadcrumb = array();
switch ($this->qry['action'])
{
case 'mirror':
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => e_SELF."?action=list&id=".$this->var['download_category_id']);
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => e_SELF."?action=view&id=".$this->var['download_id']);
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => $url->create('download/index'));
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => $url->create('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef']))); // e_SELF."?action=list&id=".$this->var['download_category_id']);
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => $url->create('download/view/item', array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']))); // e_SELF."?action=view&id=".$this->var['download_id']);
$breadcrumb[] = array('text' => LAN_dl_67, 'url' => null);
break;
case 'maincats':
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => $url->create('download/index'));
break;
default:
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => e_SELF);
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? e_SELF."?action=list&id=".$this->var['download_category_id'] : null);
$breadcrumb[] = array('text' => LAN_dl_18, 'url' => $url->create('download/index'));
$breadcrumb[] = array('text' => $this->var['download_category_name'], 'url' => ($this->var['download_category_id']) ? $url->create('download/list/category', array('id'=>$this->var['download_category_id'],'name'=>$this->var['download_category_sef'])) : null);
$breadcrumb[] = array('text' => $this->var['download_name'], 'url' => null);
break;
}
@ -95,7 +97,11 @@ class download_shortcodes extends e_shortcode
if ($this->dlsubrow['d_count'])
{
return "<a class='".$class."' href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubrow['download_category_id']."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
$url = e107::getUrl()->create('download/list/category',array('id'=>$this->dlsubrow['download_category_id'], 'name'=>$this->dlsubrow['download_category_sef']));
return "<a class='".$class."' href='".$url."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
// return "<a class='".$class."' href='".e_PLUGIN_ABS."download/download.php?action=list&id=".$this->dlsubrow['download_category_id']."'>".$tp->toHTML($this->dlsubrow['download_category_name'], FALSE, 'TITLE')."</a>";
}
else
{
@ -265,7 +271,11 @@ class download_shortcodes extends e_shortcode
return $text;
}
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
$url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
return "<a href='".$url."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$tp->toHTML($this->var['download_name'],TRUE,'LINKTEXT')."</a>";
}
function sc_download_list_author()
@ -310,7 +320,9 @@ class download_shortcodes extends e_shortcode
if ($parm == "link" && $this->var['download_thumb'])
{
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
$url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
return "<a href='".$url."'>".$img."</a>";
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
}
else
{
@ -348,16 +360,21 @@ class download_shortcodes extends e_shortcode
}
else
{
return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
$url = e107::getUrl()->create('download/request/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_dl_32."' href='".$url."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_dl_32."' href='".$url."' >{$img}</a>");
// return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_dl_32."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
}
}
function sc_download_list_icon($parm='')
function sc_download_list_icon($parm='') //XXX FIXME $img.
{
if ($parm == "link")
{
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."' >".$img."</a>";
$url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
return "<a href='".$url."' >".$img."</a>";
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."' >".$img."</a>";
}
else
{
@ -373,7 +390,10 @@ class download_shortcodes extends e_shortcode
if($parm == "link" && $this->var['download_image'])
{
return "<a title=\"".LAN_dl_53."\" href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
$url = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
return "<a title=\"".LAN_dl_53."\" href='".$url."'>".$img."</a>";
// return "<a title=\"".LAN_dl_53."\" href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
}
else
{
@ -435,16 +455,23 @@ class download_shortcodes extends e_shortcode
function sc_download_view_name($parm='')
{
$tp = e107::getParser();
$viewUrl = e107::getUrl()->create('download/view/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
$requestUrl = e107::getUrl()->create('download/request/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
$link['view'] = "<a href='".$viewUrl."'>".$this->var['download_name']."</a>";
$link['request'] = "<a href='".$requestUrl."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
// $link['view'] = "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$this->var['download_name']."</a>";
// $link['request'] = "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
$link['view'] = "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$this->var['download_name']."</a>";
$link['request'] = "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' title='".LAN_dl_46."'>".$this->var['download_name']."</a>";
if ($parm)
{
return $tp->toHTML($link[$parm],true, 'TITLE');
}
if ($parm)
{
return $tp->toHTML($link[$parm],true, 'TITLE');
}
return $this->var['download_name'];
return $this->var['download_name'];
}
function sc_download_view_name_linked()
@ -452,14 +479,18 @@ class download_shortcodes extends e_shortcode
global $dl;
$tp = e107::getParser();
$pref = e107::getPref();
$url = e107::getUrl()->create('download/request/item',array('id'=>$dl['download_id'], 'name'=>$dl['download_sef']));
if ($pref['agree_flag'] == 1)
{
return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
return "<a href='".$url."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
}
else
{
return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
return "<a href='".$url."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
// return "<a href='".e_PLUGIN_ABS."download/request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
}
}
@ -558,7 +589,9 @@ class download_shortcodes extends e_shortcode
{
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],true,'emotes, no_tags'))."\")'";
}
$dnld_link = "<a href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."'{$click}>";
$url = e107::getUrl()->create('download/request/item',array('id'=>$this->var['download_id'], 'name'=>$this->var['download_sef']));
$dnld_link = "<a href='".$url."'{$click}>";
if ($this->var['download_mirror'])
{
@ -781,7 +814,11 @@ class download_shortcodes extends e_shortcode
{
$dlrowrow = $sql->fetch();
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>&lt;&lt; ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
$url = e107::getUrl()->create('download/view/item',array('id'=>$dlrowrow['download_id'], 'name'=>$dlrowrow['download_sef']));
return "<a href='".$url ."'>&lt;&lt; ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>&lt;&lt; ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
}
else
{
@ -797,9 +834,12 @@ class download_shortcodes extends e_shortcode
if ($sql->select("download", "*", "download_category='".intval($this->var['download_category_id'])."' AND download_id > {$dlrow_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC LIMIT 1"))
{
$dlrowrow = $sql->fetch();
extract($dlrowrow);
return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." &gt;&gt;</a>\n";
extract($dlrowrow);
$url = e107::getUrl()->create('download/view/item', array('id'=>$dlrowrow['download_id'], 'name'=>$dlrowrow['download_sef']));
return "<a href='".$url."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." &gt;&gt;</a>\n";
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." &gt;&gt;</a>\n";
}
else
{

View File

@ -5,6 +5,7 @@ CREATE TABLE download (
download_id int(10) unsigned NOT NULL auto_increment,
download_name varchar(100) NOT NULL default '',
download_url varchar(255) NOT NULL default '',
download_sef varchar(255) NOT NULL default '',
download_author varchar(100) NOT NULL default '',
download_author_email varchar(200) NOT NULL default '',
download_author_website varchar(200) NOT NULL default '',
@ -38,6 +39,7 @@ CREATE TABLE download_category (
download_category_parent int(10) unsigned NOT NULL default '0',
download_category_class varchar(255) NOT NULL default '0',
download_category_order int(10) unsigned NOT NULL default '0',
download_category_sef varchar(255) NOT NULL default '',
PRIMARY KEY (download_category_id)
) ENGINE=MyISAM;
# --------------------------------------------------------

View File

@ -122,10 +122,12 @@ class download_cat_ui extends e_admin_ui
'checkboxes' => array('title'=> '', 'type' => null, 'width' =>'5%', 'forced'=> TRUE, 'thclass'=>'center', 'class'=>'center'),
'download_category_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '5%', 'thclass' => 'center','class'=>'center' ),
'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_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'inline' => true, 'width' => 'auto', 'thclass' => 'left'),
'download_category_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline' => true, '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%', 'batch' => TRUE, 'filter'=>TRUE),
'download_category_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'data' => 'int', 'batch' => TRUE, 'filter'=>TRUE),
'download_category_class' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'inline' => true, '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')
);
@ -135,10 +137,10 @@ class download_cat_ui extends e_admin_ui
{
// TODO get faq category tree
$sql = e107::getDb();
$sql -> db_Select_gen('SELECT * FROM #download_category ORDER BY download_category_order');
$sql -> gen('SELECT * FROM #download_category ORDER BY download_category_order');
$cats = array();
$cats[0] = $default;
while($row = $sql->db_Fetch())
while($row = $sql->fetch())
{
$cats[$row['download_category_id']] = $row['download_category_name'];
}
@ -215,6 +217,8 @@ class download_main_admin_ui extends e_admin_ui
'download_id' => array('title'=> ID, 'type' => 'number', 'data' => 'int', 'width'=>'5%', 'thclass' => '', 'forced'=> TRUE, 'primary'=>TRUE/*, 'noedit'=>TRUE*/), //Primary ID is not editable
'download_name' => array('title'=> LAN_TITLE, 'type' => 'text', 'data' => 'str', 'inline'=>true, 'width' => 'auto', 'thclass' => ''),
'download_url' => array('title'=> DOWLAN_13, 'type' => 'url', 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
'download_sef' => array('title'=> LAN_SEFURL, 'type' => 'text', 'inline'=>true, 'data' => 'str', 'width'=>'auto', 'thclass' => '', 'batch' => TRUE, 'filter'=>TRUE),
'download_author' => array('title'=> LAN_AUTHOR, 'type' => 'user', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
'download_author_email' => array('title'=> DOWLAN_16, 'type' => 'email', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
'download_author_website' => array('title'=> DOWLAN_17, 'type' => 'url', 'data' => 'str', 'width' => 'auto', 'thclass' => 'left'),
@ -334,10 +338,10 @@ $columnInfo = array(
$categories = array();
if(e107::getDb()->db_Select('download_category'))
if(e107::getDb()->select('download_category'))
{
//$categories[0] = LAN_SELECT;
while ($row = e107::getDb()->db_Fetch())
while ($row = e107::getDb()->fetch())
{
$id = $row['download_category_id'];
$categories[$id] = $row['download_category_name'];
@ -394,9 +398,9 @@ $columnInfo = array(
$sql = e107::getDb();
$count = array();
if ($sql->db_Select_gen("SELECT * FROM `#download` ORDER BY download_id"))
if ($sql->gen("SELECT * FROM `#download` ORDER BY download_id"))
{
while($row = $sql->db_Fetch())
while($row = $sql->fetch())
{
if (!is_readable(e_DOWNLOAD.$row['download_url']))
{
@ -500,13 +504,13 @@ $columnInfo = array(
//global $pref;
if ($sql->db_Select('userclass_classes','userclass_id, userclass_name'))
if ($sql->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'"))
if ($sql->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())
while($row = $sql->fetch())
{
$limitList[$row['limit_classnum']] = $row;
}
@ -620,11 +624,11 @@ $columnInfo = array(
HAVING COUNT(d.download_id) > 1
';
$text = "";
$count = $sql->db_Select_gen($query);
$count = $sql->gen($query);
$foundSome = false;
if ($count) {
$currentURL = "";
while($row = $sql->db_Fetch()) {
while($row = $sql->fetch()) {
if (!$foundSome) {
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
$text .= '<form method="post" action="'.e_SELF.'?'.e_QUERY.'" id="myform">
@ -642,8 +646,8 @@ $columnInfo = array(
LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category
WHERE download_id IN (".$row['gc'].")
ORDER BY download_id ASC";
$count = $sql2->db_Select_gen($query);
while($row = $sql2->db_Fetch()) {
$count = $sql2->gen($query);
while($row = $sql2->fetch()) {
$text .= '<tr>';
if ($currentURL != $row['download_url']) {
$text .= '<td>'.$tp->toHTML($row['download_url']).'</td>';
@ -721,10 +725,10 @@ $columnInfo = array(
$title = DOWLAN_168;
$text = "";
$query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category";
$count = $sql->db_Select_gen($query);
$count = $sql->gen($query);
$foundSome = false;
if ($count) {
while($row = $sql->db_Fetch()) {
while($row = $sql->fetch()) {
if (!is_readable(e_DOWNLOAD.$row['download_url'])) {
if (!$foundSome)
{
@ -769,10 +773,10 @@ $columnInfo = array(
$title = DOWLAN_169;
$text = "";
$query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category WHERE download_active=0";
$count = $sql->db_Select_gen($query);
$count = $sql->gen($query);
$foundSome = false;
if ($count) {
while($row = $sql->db_Fetch()) {
while($row = $sql->fetch()) {
if (!$foundSome)
{
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
@ -824,10 +828,10 @@ $columnInfo = array(
$title = DOWLAN_178;
$text = "";
$query = "SELECT * FROM `#download` WHERE download_category=0";
$count = $sql->db_Select_gen($query);
$count = $sql->gen($query);
$foundSome = false;
if ($count) {
while($row = $sql->db_Fetch()) {
while($row = $sql->fetch()) {
if (!$foundSome) {
// $text .= $rs->form_open("post", e_SELF."?".e_QUERY, "myform");
$text .= '
@ -876,10 +880,10 @@ $columnInfo = array(
$title = DOWLAN_66;
$text = "";
$query = "SELECT d.*, dc.* FROM `#download` AS d LEFT JOIN `#download_category` AS dc ON dc.download_category_id=d.download_category WHERE d.download_url<>''";
$count = $sql->db_Select_gen($query);
$count = $sql->gen($query);
$foundSome = false;
if ($count) {
while($row = $sql->db_Fetch()) {
while($row = $sql->fetch()) {
if (is_readable(e_DOWNLOAD.$row['download_url'])) {
$filesize = filesize(e_DOWNLOAD.$row['download_url']);
if ($filesize <> $row['download_filesize']) {
@ -1071,9 +1075,9 @@ $columnInfo = array(
$file_array[] = str_replace(e_UPLOAD,"",$val);
}
}
/* if ($sql->db_Select("rbinary")) //TODO Remove me.
/* if ($sql->select("rbinary")) //TODO Remove me.
{
while ($row = $sql->db_Fetch())
while ($row = $sql->fetch())
{
extract($row);
$file_array[] = "Binary ".$binary_id."/".$binary_name;
@ -1096,7 +1100,7 @@ $columnInfo = array(
$download_status[1] = DOWLAN_123;
$download_status[2] = DOWLAN_124;
if (!$sql->db_Select("download_category"))
if (!$sql->select("download_category"))
{
//$ns->tablerender(ADLAN_24, "<div style='text-align:center'>".DOWLAN_5."</div>");
$mes->addInfo(DOWLAN_5);
@ -1105,9 +1109,9 @@ $columnInfo = array(
$download_active = 1;
if ($_GET['action'] == "edit" && !$_POST['submit'])
{
if ($sql->db_Select("download", "*", "download_id=".intval($_GET['id'])))
if ($sql->select("download", "*", "download_id=".intval($_GET['id'])))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
extract($row);
$mirrorArray = $this->makeMirrorArray($row['download_mirror']);
@ -1117,9 +1121,9 @@ $columnInfo = array(
if ($subAction == "dlm" && !$_POST['submit'])
{
require_once(e_PLUGIN.'download/download_shortcodes.php');
if ($sql->db_Select("upload", "*", "upload_id=".$id))
if ($sql->select("upload", "*", "upload_id=".$id))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$download_category = $row['upload_category'];
$download_name = $row['upload_name'].($row['upload_version'] ? " v" . $row['upload_version'] : "");
@ -1222,7 +1226,7 @@ $columnInfo = array(
<td style='width:80%'>";
// See if any mirrors to display
if (!$sql -> db_Select("download_mirror"))
if (!$sql -> select("download_mirror"))
{ // No mirrors defined here
$text .= DOWLAN_144."</td></tr>";
}
@ -1295,7 +1299,7 @@ $columnInfo = array(
<tr>
<td >".DOWLAN_12."</td>
<td style='width:80%'>
<input class='tbox' type='text' name='download_name' size='60' value=\"".$tp->toForm($download_name)."\" maxlength='200'/>
<input class='tbox input-xxlarge' type='text' name='download_name' size='60' value=\"".$tp->toForm($download_name)."\" maxlength='200'/>
</td>
</tr>
<tr>
@ -1392,6 +1396,14 @@ $columnInfo = array(
$text .= "
</td>
</tr>
<tr>
<td >".LAN_SEFURL."</td>
<td style='width:80%'>
<input class='tbox input-xxlarge' type='text' name='download_sef' size='60' value=\"".$tp->toForm($download_sef)."\" maxlength='250'/>
</td>
</tr>
<tr>
<td style='width:20%'>".DOWLAN_21."</td>
<td style='width:80%'>
@ -1546,9 +1558,9 @@ $columnInfo = array(
if (!$filesize)
{
if ($sql->db_Select("upload", "upload_filesize", "upload_file='{$dlInfo['download_url']}'"))
if ($sql->select("upload", "upload_filesize", "upload_file='{$dlInfo['download_url']}'"))
{
$row = $sql->db_Fetch();
$row = $sql->fetch();
$filesize = $row['upload_filesize'];
}
}
@ -1595,6 +1607,7 @@ $columnInfo = array(
$dlInfo['download_description'] = $tp->toDB($_POST['download_description']);
$dlInfo['download_name'] = $tp->toDB($_POST['download_name']);
$dlInfo['download_sef'] = vartrue($_POST['download_sef']) ? eHelper::secureSef($_POST['download_sef']) : eHelper::title2sef($_POST['download_name']);
$dlInfo['download_author'] = $tp->toDB($_POST['download_author']);
$dlInfo['download_author_email'] = $tp->toDB($_POST['download_author_email']);
$dlInfo['download_author_website'] = $tp->toDB($_POST['download_author_website']);
@ -1636,9 +1649,9 @@ $columnInfo = array(
$mirrors = count($_POST['download_mirror_name']);
$mirrorArray = array();
$newMirrorArray = array();
if ($id && $sql->db_Select('download','download_mirror', 'download_id = '.$id)) // Get existing download stats
if ($id && $sql->select('download','download_mirror', 'download_id = '.$id)) // Get existing download stats
{
if ($row = $sql->db_Fetch())
if ($row = $sql->fetch())
{
$mirrorArray = $this->makeMirrorArray($row['download_mirror'], TRUE);
}
@ -1762,7 +1775,7 @@ $columnInfo = array(
}
if (!$sql -> db_Select("download_mirror"))
if (!$sql -> select("download_mirror"))
{
$mes->addInfo(DOWLAN_144);
// $text = "<div style='text-align:center;'>".DOWLAN_144."</div>"; // No mirrors defined yet
@ -1810,8 +1823,8 @@ $columnInfo = array(
if ($subAction == "edit" && !defined("SUBMITTED"))
{
$sql -> db_Select("download_mirror", "*", "mirror_id='".intval($id)."' ");
$mirror = $sql -> db_Fetch();
$sql -> select("download_mirror", "*", "mirror_id='".intval($id)."' ");
$mirror = $sql -> fetch();
extract($mirror);
$edit = TRUE;
}

View File

@ -1,5 +1,8 @@
<?php
require_once("../../class2.php");
if (!defined('e107_INIT'))
{
require_once("../../class2.php");
}
include_lan(e_PLUGIN."download/languages/".e_LANGUAGE."/download.php");
$log = e107::getAdminLog();

View File

@ -0,0 +1,63 @@
<?php
/**
* Copyright (C) e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* Custom page routing config
*/
if (!defined('e107_INIT')){ exit; }
class plugin_download_sef_url extends eUrlConfig
{
public function config()
{
return array(
'config' => array(
'allowMain' => true,
'legacy' => '{e_PLUGIN}download/download.php', // [optional] default empty; if it's a legacy module (no single entry point support) - URL to the entry point script
'format' => 'path', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
'defaultRoute' => 'list/index',// [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
'urlSuffix' => '', // [optional] default empty; string to append to the URL (e.g. .html)
// 'mapVars' => array(
// 'download_id' => 'id',
// 'download_sef' => 'name',
// ),
'allowVars' => false
),
'rules' => array(
'/' => array('list/index', 'legacyQuery' => '', ),
'Category/<id:{number}>/<name:{sefsecure}>' => array('list/category', 'legacyQuery' => 'list.{id}.{page}', ),
'<id:{number}>/<name:{sefsecure}>' => array('view/item', 'legacyQuery' => 'view.{id}' ),
'Get/<id:{number}>/<name:{sefsecure}>' => array('request/item', 'legacy'=> '{e_PLUGIN}download/request.php', 'legacyQuery' => 'view.{id}' ),
) // rule set array
);
}
/**
* Admin callback
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
*/
public function admin()
{
// static may be used for performance
static $admin = array(
'labels' => array(
'name' => LAN_PLUGIN_DOWNLOAD_NAME, // Module name
'label' => LAN_EURL_FRIENDLY, // Current profile name
'description' => '', //
'examples' => array("{SITEURL}download/view/download-name")
),
'generate' => array('table'=> 'download', 'primary'=>'download_id', 'input'=>'download_name', 'output'=>'download_sef'),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
);
return $admin;
}
}

View File

@ -0,0 +1,115 @@
<?php
/*
* Copyright (C) 2008-2011 e107 Inc (e107.org), Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
* $Id$
*
* PM Default URL configuration
* TODO - SEF URL configuration
*/
if (!defined('e107_INIT')){ exit; }
class plugin_download_url extends eUrlConfig
{
public function config()
{
return array(
'config' => array(
'noSingleEntry' => true, // [optional] default false; disallow this module to be shown via single entry point when this config is used
'legacy' => '{e_PLUGIN}download/download.php', // this config won't work in single entry point mod (legacy not used at all), so just set this to default plugin file to notify router it's legacy module
'format' => 'get', // get|path - notify core for the current URL format, if set to 'get' rules will be ignored
'selfCreate' => true, // [optional] default false; use only this->create() method, no core routine URL creating
'defaultRoute' => 'list', // [optional] default empty; route (no leading module) used when module is found with no additional controller/action information e.g. /news/
),
// rule set array
'rules' => array()
);
}
/**
* Describe all pm routes.
* Routes vs legacy queries:
* list/ -> {no query}
* list/category -> download.php?action=list&id={category-id}
* view/item -> download.php?action=view&id={download-id}
* request/item -> request.php?{download-id}
*/
public function create($route, $params = array(), $options = array())
{
if(is_string($route)) $route = explode('/', $route, 2);
if(!varset($route[0]) || 'index' == $route[0]) $route[0] = 'list';
$base = e107::getInstance()->getFolder('plugins').'download/';
// var_dump($options, $route, $params);
// print_a($route);
if($route[0] == 'list')
{
if(!isset($params['id']) && isset($params['download_category_id'])) $params['id'] = $params['download_category_id'];
switch($route[1])
{
case 'index':
$this->legacyQueryString = '';
return $base.'download.php';
break;
case 'category':
$this->legacyQueryString = 'action=list&id='.$params['id'];
return $base.'download.php?action=list&id='.$params['id'];
break;
}
}
elseif($route[0] == 'view')
{
if(!isset($params['id']) && isset($params['download_id']))
{
$params['id'] = $params['download_id'];
}
switch($route[1])
{
case 'item':
$this->legacyQueryString = 'action=view&id='.$params['id'];
return $base.'download.php?action=view&id='.$params['id'];
break;
}
}
elseif($route[0] == 'request')
{
$this->legacyQueryString = $params['id'];
return $base.'request.php?'.$params['id'];
}
return false;
}
/**
* Admin callback
* Language file not loaded as all language data is inside the lan_eurl.php (loaded by default on administration URL page)
*/
public function admin()
{
// static may be used for performance
static $admin = array(
'labels' => array(
'name' => LAN_PLUGIN_DOWNLOAD_NAME, // Module name
'label' => "Legacy", // Current profile name
'description' => LAN_PLUGIN_PM_URL_DEFAULT_DESCR, //
'examples' => array("{e_PLUGIN_ABS}download/download.php")
),
'form' => array(), // Under construction - additional configuration options
'callbacks' => array(), // Under construction - could be used for e.g. URL generator functionallity
);
return $admin;
}
}