2009-01-13 00:47:13 +00:00
< ? php
/*
2009-11-17 13:27:14 +00:00
* e107 website system
*
2009-11-18 01:06:08 +00:00
* Copyright ( C ) 2008 - 2009 e107 Inc ( e107 . org )
2009-11-17 13:27:14 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
*
*
* $Source : / cvs_backup / e107_0 . 8 / e107_plugins / download / download_shortcodes . php , v $
2010-02-10 18:18:01 +00:00
* $Revision $
* $Date $
* $Author $
2009-11-17 13:27:14 +00:00
*/
2009-01-13 00:47:13 +00:00
if ( ! defined ( 'e107_INIT' )) { exit ; }
2009-02-11 21:41:54 +00:00
/**
* download_shortcodes
*/
2013-06-22 18:24:43 -07:00
class download_shortcodes extends e_shortcode
2009-01-13 00:47:13 +00:00
{
2013-06-23 19:06:46 -07:00
public $qry ;
public $dlsubrow ;
public $dlsubsubrow ;
public $mirror ;
2009-02-11 21:41:54 +00:00
/**
* download_shortcodes constructor
*/
2013-06-22 18:24:43 -07:00
function __construct ()
2009-01-13 00:47:13 +00:00
{
2013-06-23 19:06:46 -07:00
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_breadcrumb ( $parm = '' )
{
$tp = e107 :: getParser ();
$frm = e107 :: getForm ();
2013-12-24 02:33:14 -08:00
$url = e107 :: getUrl ();
2013-06-23 19:06:46 -07:00
2013-06-22 18:24:43 -07:00
$breadcrumb = array ();
2013-06-23 03:46:27 -07:00
switch ( $this -> qry [ 'action' ])
{
case 'mirror' :
2015-01-22 22:05:25 -08:00
$breadcrumb [] = array ( 'text' => LAN_PLUGIN_DOWNLOAD_NAME , 'url' => $url -> create ( 'download/index' ));
2013-12-24 02:33:14 -08:00
$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']);
2013-06-23 19:06:46 -07:00
$breadcrumb [] = array ( 'text' => LAN_dl_67 , 'url' => null );
break ;
case 'maincats' :
2015-01-22 22:05:25 -08:00
$breadcrumb [] = array ( 'text' => LAN_PLUGIN_DOWNLOAD_NAME , 'url' => $url -> create ( 'download/index' ));
2013-06-23 03:46:27 -07:00
break ;
default :
2015-01-22 22:05:25 -08:00
$breadcrumb [] = array ( 'text' => LAN_PLUGIN_DOWNLOAD_NAME , 'url' => $url -> create ( 'download/index' ));
2013-12-24 02:33:14 -08:00
$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 );
2013-06-23 19:06:46 -07:00
$breadcrumb [] = array ( 'text' => $this -> var [ 'download_name' ], 'url' => null );
2013-06-23 03:46:27 -07:00
break ;
}
2013-06-25 16:03:00 -07:00
2013-06-22 18:24:43 -07:00
return $frm -> breadcrumb ( $breadcrumb );
}
2009-02-11 21:41:54 +00:00
// Category ************************************************************************************
2013-06-23 19:06:46 -07:00
function sc_download_cat_main_name ()
{
$tp = e107 :: getParser ();
return $tp -> toHTML ( $this -> var [ 'download_category_name' ], FALSE , 'TITLE' );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_main_description ()
{
$tp = e107 :: getParser ();
return $tp -> toHTML ( $this -> var [ 'download_category_description' ], TRUE , 'DESCRIPTION' );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_main_icon ()
{
2009-02-11 21:41:54 +00:00
// Pass count as 1 to force non-empty icon
2013-06-23 19:06:46 -07:00
return $this -> _sc_cat_icons ( $this -> var [ 'download_category_icon' ], 1 , $this -> var [ 'download_category_name' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-02-11 21:41:54 +00:00
// Sub-Category ********************************************************************************
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_name ()
{
$tp = e107 :: getParser ();
2013-06-25 16:03:00 -07:00
$class = 'category-name' ;
$class .= $this -> isNewDownload ( $this -> dlsubrow [ 'd_last' ]) ? ' new' : '' ;
2013-06-23 19:06:46 -07:00
if ( $this -> dlsubrow [ 'd_count' ])
2009-02-11 21:41:54 +00:00
{
2013-12-24 02:33:14 -08:00
2014-01-21 06:40:46 -08:00
$url = e107 :: getUrl () -> create ( 'download/list/category' , array ( 'id' => $this -> dlsubrow [ 'download_category_id' ], 'name' => vartrue ( $this -> dlsubrow [ 'download_category_sef' ], '--sef-not-set--' )));
2013-12-24 02:33:14 -08:00
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>";
2009-02-11 21:41:54 +00:00
}
else
{
2013-06-23 19:06:46 -07:00
return $tp -> toHTML ( $this -> dlsubrow [ 'download_category_name' ], FALSE , 'TITLE' );
2009-02-11 21:41:54 +00:00
}
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_description ()
{
$tp = e107 :: getParser ();
return $tp -> toHTML ( $this -> dlsubrow [ 'download_category_description' ], TRUE , 'DESCRIPTION' );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_icon ()
{
return $this -> _sc_cat_icons ( $this -> dlsubrow [ 'download_category_icon' ], $this -> dlsubrow [ 'd_count' ], $this -> dlsubrow [ 'download_category_name' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_new_icon ()
{
2013-06-25 16:03:00 -07:00
return ( $this -> isNewDownload ( $this -> dlsubrow [ 'd_last_subs' ])) ? $this -> renderNewIcon () : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_count ()
{
return $this -> dlsubrow [ 'd_count' ];
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_size ()
{
return eHelper :: parseMemorySize ( $this -> dlsubrow [ 'd_size' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_sub_downloaded ()
{
return intval ( $this -> dlsubrow [ 'd_requests' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
// Sub-Sub-Category ****************************************************************************
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_cat_subsub_name ()
{
2013-06-25 16:03:00 -07:00
// isNewDownload
$class = 'category-name' ;
$class .= $this -> isNewDownload ( $this -> dlsubsubrow [ 'd_last' ]) ? ' new' : '' ;
2013-06-23 19:06:46 -07:00
$tp = e107 :: getParser ();
if ( $this -> dlsubsubrow [ 'd_count' ])
2009-02-11 21:41:54 +00:00
{
2013-06-25 16:03:00 -07:00
return " <a class=' " . $class . " ' href=' " . e_PLUGIN_ABS . " download/download.php?action=list&id= " . $this -> dlsubsubrow [ 'download_category_id' ] . " '> " . $tp -> toHTML ( $this -> dlsubsubrow [ 'download_category_name' ], FALSE , 'TITLE' ) . " </a> " ;
2009-02-11 21:41:54 +00:00
}
else
{
2013-06-23 19:06:46 -07:00
return $tp -> toHTML ( $this -> dlsubsubrow [ 'download_category_name' ], FALSE , 'TITLE' );
2009-02-11 21:41:54 +00:00
}
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_cat_subsub_description ()
{
return e107 :: getParser () -> toHTML ( $this -> dlsubsubrow [ 'download_category_description' ], TRUE , 'DESCRIPTION' );
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_cat_subsub_icon ()
{
return $this -> _sc_cat_icons ( $this -> dlsubsubrow [ 'download_category_icon' ], $this -> dlsubsubrow [ 'd_count' ], $this -> dlsubsubrow [ 'download_category_name' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2014-05-20 09:41:43 +02:00
function sc_download_cat_subsub_new_icon ()
{
return ( $this -> isNewDownload ( $this -> dlsubsubrow [ 'd_last' ])) ? $this -> renderNewIcon () : " " ;
}
2013-06-23 19:06:46 -07:00
function sc_download_cat_subsub_count ()
{
return $this -> dlsubsubrow [ 'd_count' ];
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_cat_subsub_size ()
{
return eHelper :: parseMemorySize ( $this -> dlsubsubrow [ 'd_size' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_cat_subsub_downloaded ()
{
return intval ( $this -> dlsubsubrow [ 'd_requests' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
// List ****************************************************************************************
2013-06-22 18:24:43 -07:00
function sc_download_list_caption ( $parm = '' )
{
$qry = $this -> qry ;
$qry [ 'sort' ] = ( $qry [ 'sort' ] == 'asc' ) ? 'desc' : 'asc' ; // reverse.
switch ( $parm )
{
case 'name' :
$qry [ 'order' ] = 'name' ;
2015-07-02 18:46:36 +01:00
$text = LAN_NAME ;
2013-06-22 18:24:43 -07:00
break ;
case 'datestamp' :
$qry [ 'order' ] = 'datestamp' ;
2015-07-02 18:46:36 +01:00
$text = LAN_DATE ;
2013-06-22 18:24:43 -07:00
break ;
case 'author' :
$qry [ 'order' ] = 'author' ;
2015-07-02 18:46:36 +01:00
$text = LAN_AUTHOR ;
2013-06-22 18:24:43 -07:00
break ;
case 'filesize' :
$qry [ 'order' ] = 'filesize' ;
2015-07-02 18:46:36 +01:00
$text = LAN_SIZE ;
2013-06-22 18:24:43 -07:00
break ;
case 'requested' :
$qry [ 'order' ] = 'requested' ;
$text = LAN_dl_29 ;
break ;
case 'rating' :
2015-07-02 18:46:36 +01:00
$text = LAN_RATING ;
2013-06-22 18:24:43 -07:00
break ;
case 'link' :
$text = LAN_dl_8 ;
break ;
default :
$text = " Missing LAN Column " ; // debug.
break ;
}
return " <a href=' " . e_REQUEST_SELF . " ? " . http_build_query ( $qry ) . " '> " . $text . " </a> " ;
}
2013-06-23 19:06:46 -07:00
function sc_download_list_name ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
$tp = e107 :: getParser ();
$pref = e107 :: getPref ();
if ( $parm == " nolink " )
{
return $tp -> toHTML ( $this -> var [ 'download_name' ], TRUE , 'LINKTEXT' );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
if ( $parm == " request " )
{
2009-02-11 21:41:54 +00:00
$agreetext = $tp -> toJS ( $tp -> toHTML ( $pref [ 'agree_text' ], FALSE , 'DESCRIPTION' ));
2013-06-23 19:06:46 -07:00
if ( $this -> var [ 'download_mirror_type' ])
{
2015-07-02 18:46:36 +01:00
$text = ( $pref [ 'agree_flag' ] ? " <a href=' " . e_PLUGIN_ABS . " download/download.php?mirror. " . $this -> var [ 'download_id' ] . " ' onclick= \" return confirm(' { $agreetext } '); \" > " : " <a href=' " . e_PLUGIN_ABS . " download/download.php?mirror. " . $this -> var [ 'download_id' ] . " ' title=' " . LAN_DOWNLOAD . " '> " );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
else
{
2015-07-02 18:46:36 +01:00
$text = ( $pref [ 'agree_flag' ] ? " <a href=' " . e_PLUGIN_ABS . " download/request.php? " . $this -> var [ 'download_id' ] . " ' onclick= \" return confirm(' { $agreetext } '); \" > " : " <a href=' " . e_PLUGIN_ABS . " download/request.php? " . $this -> var [ 'download_id' ] . " ' title=' " . LAN_DOWNLOAD . " '> " );
2013-06-23 19:06:46 -07:00
}
$text .= $tp -> toHTML ( $this -> var [ 'download_name' ], FALSE , 'TITLE' ) . " </a> " ;
2009-02-11 21:41:54 +00:00
return $text ;
}
2013-12-24 02:33:14 -08:00
$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>";
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_list_author ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_author' ];
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_list_requested ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_requested' ];
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_list_newicon ()
2009-02-11 21:41:54 +00:00
{
2013-06-25 16:03:00 -07:00
return $this -> isNewDownload ( $this -> var [ 'download_datestamp' ]) ? $this -> renderNewIcon () : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_list_recenticon ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
$pref = e107 :: getPref ();
2009-02-11 21:41:54 +00:00
// convert "recent_download_days" to seconds
2013-06-25 16:03:00 -07:00
return ( $this -> var [ 'download_datestamp' ] > time () - ( $pref [ 'recent_download_days' ] * 86400 ) ? $this -> renderNewIcon () : '' );
2009-02-11 21:41:54 +00:00
}
2013-02-23 03:04:45 -08:00
2009-07-21 07:10:25 +00:00
function sc_download_list_filesize ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return eHelper :: parseMemorySize ( $this -> var [ 'download_filesize' ]);
2009-02-11 21:41:54 +00:00
}
2013-02-23 03:04:45 -08:00
2009-07-21 07:10:25 +00:00
function sc_download_list_datestamp ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
2013-06-22 18:24:43 -07:00
$tp = e107 :: getParser ();
2013-06-23 19:06:46 -07:00
return $tp -> toDate ( $this -> var [ 'download_datestamp' ], " short " );
2009-02-11 21:41:54 +00:00
}
2013-02-23 03:04:45 -08:00
2013-06-23 19:06:46 -07:00
function sc_download_list_thumb ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
2012-04-20 07:28:53 +00:00
$tp = e107 :: getParser ();
2014-02-07 17:57:06 -08:00
$img = ( $this -> var [ 'download_thumb' ]) ? " <img class='download-thumb img-responsive' src=' " . $tp -> thumbUrl ( $this -> var [ 'download_thumb' ]) . " ' alt= \" " . $this -> var [ 'download_name' ] . " \" /> " : " " ;
2013-06-23 19:06:46 -07:00
if ( $parm == " link " && $this -> var [ 'download_thumb' ])
{
2013-12-24 02:33:14 -08:00
$url = e107 :: getUrl () -> create ( 'download/view/item' , array ( 'id' => $this -> var [ 'download_id' ], 'name' => $this -> var [ 'download_sef' ]));
2014-02-07 17:57:06 -08:00
return " <a href=' " . $url . " '> " . $img . " </a> " ;
2013-12-24 02:33:14 -08:00
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$this->var['download_id']."'>".$img."</a>";
2009-02-11 21:41:54 +00:00
}
else
{
return $img ;
}
}
2013-02-23 03:04:45 -08:00
2009-07-21 07:10:25 +00:00
function sc_download_list_id ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_id' ];
2009-02-11 21:41:54 +00:00
}
2013-02-23 03:04:45 -08:00
2009-07-21 07:10:25 +00:00
function sc_download_list_rating ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return e107 :: getForm () -> rate ( " download " , $this -> var [ 'download_id' ]);
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_list_link ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
$tp = e107 :: getParser ();
$pref = e107 :: getPref ();
2009-02-11 21:41:54 +00:00
2013-06-23 19:06:46 -07:00
$agreetext = $tp -> toJS ( $tp -> toHTML ( $pref [ 'agree_text' ], FALSE , 'DESCRIPTION' ));
2015-07-02 18:46:36 +01:00
$img = " <img src=' " . IMAGE_DOWNLOAD . " ' alt=' " . LAN_DOWNLOAD . " ' title=' " . LAN_DOWNLOAD . " ' /> " ;
2013-06-23 19:06:46 -07:00
if ( deftrue ( 'BOOTSTRAP' ))
{
2013-12-25 01:59:00 -08:00
$img = e107 :: getParser () -> toGlyph ( 'icon-download.glyph' , false );
// $img = '<i class="icon-download"></i>';
2013-06-23 19:06:46 -07:00
}
if ( $this -> var [ 'download_mirror_type' ])
2009-02-11 21:41:54 +00:00
{
2015-07-02 18:46:36 +01:00
return " <a class='e-tip' title=' " . LAN_DOWNLOAD . " ' href=' " . e_PLUGIN_ABS . " download/download.php?mirror. " . $this -> var [ 'download_id' ] . " '> { $img } </a> " ;
2009-02-11 21:41:54 +00:00
}
else
{
2013-12-24 02:33:14 -08:00
$url = e107 :: getUrl () -> create ( 'download/request/item' , array ( 'id' => $this -> var [ 'download_id' ], 'name' => $this -> var [ 'download_sef' ]));
2015-07-02 18:46:36 +01:00
return ( $pref [ 'agree_flag' ] ? " <a class='e-tip' title=' " . LAN_DOWNLOAD . " ' href=' " . $url . " ' onclick= \" return confirm(' { $agreetext } '); \" > { $img } </a> " : " <a class='e-tip' title=' " . LAN_DOWNLOAD . " ' href=' " . $url . " ' > { $img } </a> " );
2013-12-24 02:33:14 -08:00
2015-07-02 18:46:36 +01:00
// return ($pref['agree_flag'] ? "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' onclick= \"return confirm('{$agreetext}');\">{$img}</a>" : "<a class='e-tip' title='".LAN_DOWNLOAD."' href='".e_PLUGIN_ABS."download/request.php?".$this->var['download_id']."' >{$img}</a>");
2009-02-11 21:41:54 +00:00
}
}
2012-04-20 07:28:53 +00:00
2013-12-24 02:33:14 -08:00
function sc_download_list_icon ( $parm = '' ) //XXX FIXME $img.
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
if ( $parm == " link " )
{
2013-12-24 02:33:14 -08:00
$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>";
2009-02-11 21:41:54 +00:00
}
else
{
return $img ;
}
return ;
}
2012-04-20 07:28:53 +00:00
2013-06-23 19:06:46 -07:00
function sc_download_list_imagefull ( $parm = '' )
2012-04-20 07:28:53 +00:00
{
2013-06-23 19:06:46 -07:00
2014-02-07 17:57:06 -08:00
$img = ( $this -> var [ 'download_image' ]) ? " <img class='download-image dl_image img-responsive' src=' " . e107 :: getParser () -> thumbUrl ( $this -> var [ 'download_image' ]) . " ' alt= \" " . $this -> var [ 'download_name' ] . " \" /> " : " " ;
2012-04-20 07:28:53 +00:00
2013-06-23 19:06:46 -07:00
if ( $parm == " link " && $this -> var [ 'download_image' ])
2012-04-20 07:28:53 +00:00
{
2013-12-24 02:33:14 -08:00
$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>";
2012-04-20 07:28:53 +00:00
}
else
{
return $img ;
}
}
2009-07-21 07:10:25 +00:00
function sc_download_list_nextprev ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
global $nextprev_parms ;
return e107 :: getParser () -> parseTemplate ( " { NEXTPREV= { $nextprev_parms } } " );
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_list_total_amount ()
{
2009-02-11 21:41:54 +00:00
global $dltdownloads ;
2013-06-22 18:24:43 -07:00
return intval ( $dltdownloads ) . " " . LAN_dl_16 ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_list_total_files ()
{
2009-02-11 21:41:54 +00:00
global $dlft ;
2015-07-02 18:46:36 +01:00
return intval ( $dlft ) . " " . strtolower ( LAN_FILES );
2009-02-11 21:41:54 +00:00
}
2012-04-20 07:28:53 +00:00
2013-06-22 18:24:43 -07:00
2012-04-20 07:28:53 +00:00
2009-02-11 21:41:54 +00:00
// View ****************************************************************************************
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_id ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_id' ];
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_admin_edit ()
2009-02-11 21:41:54 +00:00
{
2014-02-07 17:57:06 -08:00
$icon = ( deftrue ( 'BOOTSTRAP' )) ? e107 :: getParser () -> toGlyph ( 'edit' ) : " <img src=' " . e_IMAGE_ABS . " generic/edit.png' alt='*' style='padding:0px;border:0px' /> " ;
$url = e_PLUGIN_ABS . " download/admin_download.php?action=edit&id= " . $this -> var [ 'download_id' ];
2016-05-04 11:54:55 +01:00
return ( ADMIN && getperms ( '6' )) ? " <a class='e-tip btn btn-default hidden-print' href=' " . $url . " ' title=' " . LAN_EDIT . " '> " . $icon . " </a> " : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_category ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_category_name' ];
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_category_description ()
2009-02-11 21:41:54 +00:00
{
global $tp , $dl , $parm ;
2013-06-23 19:06:46 -07:00
2009-02-11 21:41:54 +00:00
$text = $tp -> toHTML ( $dl [ 'download_category_description' ], TRUE , 'DESCRIPTION' );
if ( $parm ){
return substr ( $text , 0 , $parm );
} else {
return $text ;
}
}
2013-06-23 19:06:46 -07:00
function sc_download_view_name ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
$tp = e107 :: getParser ();
2013-12-24 02:33:14 -08:00
$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>";
2013-06-23 19:06:46 -07:00
2013-12-24 02:33:14 -08:00
if ( $parm )
{
return $tp -> toHTML ( $link [ $parm ], true , 'TITLE' );
}
2013-06-23 19:06:46 -07:00
2013-12-24 02:33:14 -08:00
return $this -> var [ 'download_name' ];
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_name_linked ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
global $dl ;
$tp = e107 :: getParser ();
$pref = e107 :: getPref ();
2013-12-24 02:33:14 -08:00
$url = e107 :: getUrl () -> create ( 'download/request/item' , array ( 'id' => $dl [ 'download_id' ], 'name' => $dl [ 'download_sef' ]));
2013-06-23 19:06:46 -07:00
if ( $pref [ 'agree_flag' ] == 1 )
{
2013-12-24 02:33:14 -08:00
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>";
2013-06-23 19:06:46 -07:00
}
else
{
2013-12-24 02:33:14 -08:00
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>";
2009-02-11 21:41:54 +00:00
}
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_author ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_author' ] ? $this -> var [ 'download_author' ] : " " );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_authoremail ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_author_email' ]) ? e107 :: getParser () -> toHTML ( $this -> var [ 'download_author_email' ], TRUE , 'LINKTEXT' ) : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_authorwebsite ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_author_website' ]) ? e107 :: getParser () -> toHTML ( $this -> var [ 'download_author_website' ], TRUE , 'LINKTEXT' ) : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
function sc_download_view_description ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
$maxlen = ( $parm ? intval ( $parm ) : 0 );
2013-06-23 19:06:46 -07:00
$text = ( $this -> var [ 'download_description' ] ? e107 :: getParser () -> toHTML ( $this -> var [ 'download_description' ], TRUE , 'DESCRIPTION' ) : " " );
if ( $maxlen )
{
2009-02-11 21:41:54 +00:00
return substr ( $text , 0 , $maxlen );
2013-06-23 19:06:46 -07:00
}
else
{
2009-02-11 21:41:54 +00:00
return $text ;
}
2013-06-23 19:06:46 -07:00
2009-02-11 21:41:54 +00:00
return $text ;
}
2013-06-23 19:06:46 -07:00
function sc_download_view_date ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_datestamp' ]) ? e107 :: getParser () -> toDate ( $this -> var [ 'download_datestamp' ], $parm ) : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
/**
* @ Deprecated DOWNLOAD_VIEW_DATE should be used instead .
*/
2009-07-21 07:10:25 +00:00
function sc_download_view_date_short ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> sc_download_view_date ( 'short' );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
/**
* @ Deprecated DOWNLOAD_VIEW_DATE should be used instead .
*/
2009-07-21 07:10:25 +00:00
function sc_download_view_date_long ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> sc_download_view_date ( 'long' );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_image ()
2009-02-11 21:41:54 +00:00
{
2012-04-20 07:28:53 +00:00
$tp = e107 :: getParser ();
2013-06-23 19:06:46 -07:00
if ( $this -> var [ 'download_thumb' ])
{
2014-02-07 17:57:06 -08:00
return ( $this -> var [ 'download_image' ] ? " <a href=' " . e_PLUGIN_ABS . " download/request.php?download. " . $this -> var [ 'download_id' ] . " '><img class='download-image dl_image img-responsive' src=' " . $tp -> thumbUrl ( $this -> var [ 'download_thumb' ]) . " ' alt='*' /></a> " : " <img class='download-image dl_image img-responsive' src=' " . $tp -> thumbUrl ( $this -> var [ 'download_thumb' ]) . " ' alt='*' /> " );
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
elseif ( $this -> var [ 'download_image' ])
{
return " <a href=' " . e_PLUGIN_ABS . " download/request.php?download. " . $this -> var [ 'download_id' ] . " '> " . LAN_dl_40 . " </a> " ;
2009-02-11 21:41:54 +00:00
}
else
{
return LAN_dl_75 ;
}
}
2014-02-07 17:57:06 -08:00
/**
* { DOWNLOAD_VIEW_LINK : class = thumbnail }
*/
function sc_download_view_imagefull ( $parm )
2009-02-11 21:41:54 +00:00
{
2012-04-20 07:28:53 +00:00
$tp = e107 :: getParser ();
2014-02-07 17:57:06 -08:00
return ( $this -> var [ 'download_image' ]) ? " <img class='download-image dl_image download-view-image img-responsive " . vartrue ( $parm [ 'class' ]) . " ' src=' " . $tp -> thumbUrl ( $this -> var [ 'download_image' ]) . " ' alt='*' /> " : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-23 19:06:46 -07:00
2014-02-07 17:57:06 -08:00
/**
* { DOWNLOAD_VIEW_LINK : size = 2 x }
*/
function sc_download_view_link ( $parm )
2013-06-23 19:06:46 -07:00
{
$tp = e107 :: getParser ();
$pref = e107 :: getPref ();
$click = " " ;
2015-07-02 18:46:36 +01:00
$img = " <img src=' " . IMAGE_DOWNLOAD . " ' alt=' " . LAN_DOWNLOAD . " ' title=' " . LAN_DOWNLOAD . " ' /> " ;
2013-06-23 19:06:46 -07:00
if ( deftrue ( 'BOOTSTRAP' ))
{
2014-02-07 17:57:06 -08:00
$img = e107 :: getParser () -> toGlyph ( 'download' , $parm ); // '<i class="icon-download"></i>';
2013-06-23 19:06:46 -07:00
}
if ( $pref [ 'agree_flag' ] == 1 )
{
$click = " onclick='return confirm( \" " . $tp -> toJS ( $tp -> toHTML ( $pref [ 'agree_text' ], true , 'emotes, no_tags' )) . " \" )' " ;
}
2013-12-24 02:33:14 -08:00
$url = e107 :: getUrl () -> create ( 'download/request/item' , array ( 'id' => $this -> var [ 'download_id' ], 'name' => $this -> var [ 'download_sef' ]));
2014-02-07 17:57:06 -08:00
if ( varset ( $parm [ 'type' ]) == 'href' )
{
return $url ;
}
2013-12-24 02:33:14 -08:00
$dnld_link = " <a href=' " . $url . " ' { $click } > " ;
2013-06-23 19:06:46 -07:00
if ( $this -> var [ 'download_mirror' ])
{
if ( $this -> var [ 'download_mirror_type' ])
{
return " <a href=' " . e_PLUGIN_ABS . " download/download.php?mirror. " . $this -> var [ 'download_id' ] . " '> " . LAN_dl_66 . " </a> " ;
}
else
{
return $dnld_link . $img . " </a> " ;
}
}
else
{
return $dnld_link . $img . " </a> " ;
}
}
function sc_download_view_filesize ()
{
return ( $this -> var [ 'download_filesize' ]) ? eHelper :: parseMemorySize ( $this -> var [ 'download_filesize' ]) : " " ;
}
function sc_download_view_rating ()
{
2012-05-27 10:42:16 +00:00
$frm = e107 :: getForm ();
$options = array ( 'label' => ' ' , 'template' => 'RATE|VOTES|STATUS' );
2013-06-23 19:06:46 -07:00
return $frm -> rate ( " download " , $this -> var [ 'download_id' ], $options );
2012-05-27 10:42:16 +00:00
2013-06-23 19:06:46 -07:00
/*
2009-02-11 21:41:54 +00:00
require_once ( e_HANDLER . " rate_class.php " );
$rater = new rater ;
2012-05-27 10:42:16 +00:00
2009-02-11 21:41:54 +00:00
$text = "
< table style = 'width:100%' >
< tr >
< td style = 'width:50%' > " ;
2013-06-23 19:06:46 -07:00
if ( $ratearray = $rater -> getrating ( " download " , $this -> var [ 'download_id' ])) {
2009-02-11 21:41:54 +00:00
for ( $c = 1 ; $c <= $ratearray [ 1 ]; $c ++ ) {
2009-07-07 07:33:00 +00:00
$text .= " <img src=' " . e_IMAGE . " rate/star.png' alt='*' /> " ;
2009-02-11 21:41:54 +00:00
}
if ( $ratearray [ 2 ]) {
2009-07-07 07:33:00 +00:00
$text .= " <img src=' " . e_IMAGE . " rate/ " . $ratearray [ 2 ] . " .png' alt='*' /> " ;
2009-02-11 21:41:54 +00:00
}
if ( $ratearray [ 2 ] == " " ) {
$ratearray [ 2 ] = 0 ;
}
$text .= " " . $ratearray [ 1 ] . " . " . $ratearray [ 2 ] . " - " . $ratearray [ 0 ] . " " ;
$text .= ( $ratearray [ 0 ] == 1 ? LAN_dl_43 : LAN_dl_44 );
} else {
$text .= LAN_dl_13 ;
}
$text .= " </td><td style='width:50%; text-align:right'> " ;
2013-06-23 19:06:46 -07:00
if ( ! $rater -> checkrated ( " download " , $this -> var [ 'download_id' ]) && USER ) {
$text .= $rater -> rateselect ( " <b> " . LAN_dl_14 , " download " , $this -> var [ 'download_id' ]) . " </b> " ;
2009-02-11 21:41:54 +00:00
}
else if ( ! USER ) {
$text .= " " ;
} else {
2015-07-02 18:46:36 +01:00
$text .= LAN_THANK_YOU ;
2009-02-11 21:41:54 +00:00
}
$text .= " </td></tr></table> " ;
return $text ;
2013-06-23 19:06:46 -07:00
*/
}
function sc_download_report_link ()
{
$pref = e107 :: getPref ();
return ( check_class ( $pref [ 'download_reportbroken' ])) ? " <a href=' " . e_PLUGIN_ABS . " download/download.php?action=report&id= " . $this -> var [ 'download_id' ] . " '> " . LAN_dl_45 . " </a> " : " " ;
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_view_caption ()
{
$text = $this -> var [ 'download_category_name' ];
$text .= ( $this -> var [ 'download_category_description' ]) ? " [ " . $this -> var [ 'download_category_description' ] . " ] " : " " ;
return $text ;
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
// Mirror **************************************************************************************
2013-06-22 18:24:43 -07:00
function sc_download_mirror_request ()
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_name' ];
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_request_icon ()
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_thumb' ] ? " <img src=' " . e107 :: getParser () -> replaceConstants ( $this -> var [ 'download_thumb' ]) . " ' alt='*'/> " : " " );
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_name ()
{
2013-06-23 19:06:46 -07:00
return " <a href=' { $this -> mirror [ 'dlmirror' ][ 'mirror_url' ] } ' rel='external'> " . $this -> mirror [ 'dlmirror' ][ 'mirror_name' ] . " </a> " ;
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_image ()
{
2012-04-20 07:28:53 +00:00
$tp = e107 :: getParser ();
2013-06-23 19:06:46 -07:00
return ( $this -> mirror [ 'dlmirror' ][ 'mirror_image' ] ? " <a href=' { $this -> mirror [ 'dlmirror' ][ 'mirror_url' ] } ' rel='external'><img src=' " . $tp -> replaceConstants ( $this -> mirror [ 'dlmirror' ][ 'mirror_image' ]) . " ' alt='*'/></a> " : " " );
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-23 19:06:46 -07:00
function sc_download_mirror_location ()
{
return ( $this -> mirror [ 'dlmirror' ][ 'mirror_location' ] ? $this -> mirror [ 'dlmirror' ][ 'mirror_location' ] : " " );
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_description ()
{
2013-06-23 19:06:46 -07:00
return ( $this -> mirror [ 'dlmirror' ][ 'mirror_description' ] ? e107 :: getParser () -> toHTML ( $this -> mirror [ 'dlmirror' ][ 'mirror_description' ], TRUE ) : " " );
2009-01-13 00:47:13 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_filesize ()
{
2013-06-23 19:06:46 -07:00
return eHelper :: parseMemorySize ( $this -> mirror [ 'dlmirrorfile' ][ 3 ]);
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_link ()
{
2013-06-23 19:06:46 -07:00
$tp = e107 :: getParser ();
$pref = e107 :: getPref ();
$click = " onclick='return confirm( \" " . $tp -> toJS ( $tp -> toHTML ( $pref [ 'agree_text' ], FALSE , 'DESCRIPTION' )) . " \" )' " ;
2015-07-02 18:46:36 +01:00
$img = " <img src=' " . IMAGE_DOWNLOAD . " ' alt=' " . LAN_DOWNLOAD . " ' title=' " . LAN_DOWNLOAD . " ' /> " ;
2013-06-23 19:06:46 -07:00
if ( deftrue ( 'BOOTSTRAP' ))
{
$img = '<i class="icon-download"></i>' ;
}
2015-07-02 18:46:36 +01:00
return " <a href=' " . e_PLUGIN_ABS . " download/download.php?mirror. { $this -> var [ 'download_id' ] } . { $this -> mirror [ 'dlmirrorfile' ][ 0 ] } ' title=' " . LAN_DOWNLOAD . " ' { $click } > " . $img . " </a> " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_mirror_requests ()
{
2013-06-23 19:06:46 -07:00
return ( ADMIN ? LAN_dl_73 . $this -> mirror [ 'dlmirrorfile' ][ 2 ] : " " );
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
function sc_download_total_mirror_requests ()
{
2013-06-23 19:06:46 -07:00
return ( ADMIN ? LAN_dl_74 . $this -> mirror [ 'dlmirror' ][ 'mirror_count' ] : " " );
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
// --------- Download View Lans -----------------------------
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_author_lan ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
2015-07-02 18:46:36 +01:00
return ( $this -> var [ 'download_author' ]) ? LAN_AUTHOR : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_authoremail_lan ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_author_email' ]) ? LAN_dl_30 : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_authorwebsite_lan ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return ( $this -> var [ 'download_author_website' ]) ? LAN_dl_31 : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_date_lan ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
2015-07-02 18:46:36 +01:00
return ( $this -> var [ 'download_datestamp' ]) ? LAN_DATE : " " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_image_lan ()
2009-02-11 21:41:54 +00:00
{
2015-07-02 18:46:36 +01:00
return LAN_IMAGE ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_requested ()
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
return $this -> var [ 'download_requested' ];
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_rating_lan ()
2009-02-11 21:41:54 +00:00
{
2015-07-02 18:46:36 +01:00
return LAN_RATING ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_filesize_lan ()
2009-02-11 21:41:54 +00:00
{
2015-07-02 18:46:36 +01:00
return LAN_SIZE ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_description_lan ()
2009-02-11 21:41:54 +00:00
{
2015-07-02 18:46:36 +01:00
return LAN_DESCRIPTION ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_requested_lan ()
2009-02-11 21:41:54 +00:00
{
return LAN_dl_77 ;
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_view_link_lan ()
2009-02-11 21:41:54 +00:00
{
2015-07-02 18:46:36 +01:00
return LAN_DOWNLOAD ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
// ----------- Download View : Previous and Next ---------------
2014-02-07 17:57:06 -08:00
/**
* { DOWNLOAD_VIEW_PREV : x = y }
*/
function sc_download_view_prev ( $parm = '' )
2009-02-11 21:41:54 +00:00
{
2013-06-23 19:06:46 -07:00
$sql = e107 :: getDb ();
2014-02-07 17:57:06 -08:00
$tp = e107 :: getParser ();
2013-06-23 19:06:46 -07:00
$dlrow_id = intval ( $this -> var [ 'download_id' ]);
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 DESC LIMIT 1 " ))
{
$dlrowrow = $sql -> fetch ();
2013-12-24 02:33:14 -08:00
$url = e107 :: getUrl () -> create ( 'download/view/item' , array ( 'id' => $dlrowrow [ 'download_id' ], 'name' => $dlrowrow [ 'download_sef' ]));
2014-02-07 17:57:06 -08:00
$icon = ( deftrue ( 'BOOTSTRAP' )) ? $tp -> toGlyph ( 'chevron-left' ) : '<<' ;
2015-04-08 14:51:06 -07:00
return " <a class='e-tip' href=' " . $url . " ' title= \" " . $dlrowrow [ 'download_name' ] . " \" > " . $icon . " " . LAN_PREVIOUS . " </a> \n " ;
2013-12-24 02:33:14 -08:00
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'><< ".LAN_dl_33." [".$dlrowrow['download_name']."]</a>\n";
2013-06-23 19:06:46 -07:00
}
else
{
2009-02-11 21:41:54 +00:00
return " " ;
}
}
2013-06-22 18:24:43 -07:00
2014-02-07 17:57:06 -08:00
/**
* { DOWNLOAD_VIEW_NEXT : x = y }
*/
function sc_download_view_next ( $parm = '' )
2013-06-23 19:06:46 -07:00
{
$sql = e107 :: getDb ();
2014-02-07 17:57:06 -08:00
$tp = e107 :: getParser ();
2013-06-23 19:06:46 -07:00
$dlrow_id = intval ( $this -> var [ 'download_id' ]);
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 ();
2013-12-24 02:33:14 -08:00
extract ( $dlrowrow );
$url = e107 :: getUrl () -> create ( 'download/view/item' , array ( 'id' => $dlrowrow [ 'download_id' ], 'name' => $dlrowrow [ 'download_sef' ]));
2014-02-07 17:57:06 -08:00
$icon = ( deftrue ( 'BOOTSTRAP' )) ? $tp -> toGlyph ( 'chevron-right' ) : '>>' ;
2015-04-08 14:51:06 -07:00
return " <a class='e-tip' href=' " . $url . " ' title= \" " . $dlrowrow [ 'download_name' ] . " \" > " . LAN_NEXT . " " . $icon . " </a> \n " ;
2013-12-24 02:33:14 -08:00
// return "<a href='".e_PLUGIN_ABS."download/download.php?action=view&id=".$dlrowrow['download_id']."'>[".$dlrowrow['download_name']."] ".LAN_dl_34." >></a>\n";
2013-06-23 19:06:46 -07:00
}
else
{
2009-02-11 21:41:54 +00:00
return " " ;
}
2013-06-23 19:06:46 -07:00
}
2013-06-22 18:24:43 -07:00
2014-02-07 17:57:06 -08:00
/**
* { DOWNLOAD_BACK_TO_LIST : x = y }
*/
function sc_download_back_to_list ( $parm )
2009-02-11 21:41:54 +00:00
{
2014-02-07 17:57:06 -08:00
$url = e107 :: getUrl () -> create ( 'download/list/category' , array ( 'id' => $this -> var [ 'download_category_id' ], 'name' => $this -> var [ 'download_category_sef' ]));
// e_PLUGIN_ABS."download/download.php?action=list&id=".$this->var['download_category']
$title = " Back to [x] " ;
return " <a class='e-tip' title= \" " . e107 :: getParser () -> lanVars ( $title , array ( 'x' => $this -> var [ 'download_category_name' ])) . " \" href=' " . $url . " '> " . LAN_BACK . " </a> " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_back_to_category_list ()
2009-02-11 21:41:54 +00:00
{
2013-12-30 03:17:20 -08:00
return " <a class='btn btn-default btn-xs btn-mini' href=' " . e_SELF . " '> " . LAN_dl_9 . " </a> " ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
// Misc stuff ---------------------------------------------------------------------------------
2009-07-21 07:10:25 +00:00
function sc_download_cat_newdownload_text ()
2009-02-11 21:41:54 +00:00
{
2013-06-25 16:03:00 -07:00
return $this -> renderNewIcon () . " " . LAN_dl_36 ;
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2009-07-21 07:10:25 +00:00
function sc_download_cat_search ()
2009-02-11 21:41:54 +00:00
{
2016-04-16 22:43:35 +01:00
$tp = e107 :: getParser ();
2014-01-05 11:26:19 -08:00
$text = " <form class='form-search form-inline' method='get' action=' " . e_BASE . " search.php'> " ;
$text .= '<div><div class="input-group">' ;
2015-07-02 18:46:36 +01:00
$text .= " <input class='tbox form-control search-query' type='text' name='q' size='30' value='' placeholder= \" " . LAN_SEARCH . " \" maxlength='50' />
2014-01-05 11:26:19 -08:00
< input type = 'hidden' name = 'r' value = '0' />
2014-11-03 15:41:21 +02:00
< input type = 'hidden' name = 't' value = 'download' />
2014-01-05 11:26:19 -08:00
" ;
$text .= '
< span class = " input-group-btn " >
2016-04-16 22:43:35 +01:00
< button class = " btn btn-default " type = " submit " name = " s " value = " 1 " > ' ;
$text .= $tp -> toIcon ( 'glyphicon-search.glyph' );
$text .= ' </ button >
2014-01-05 11:26:19 -08:00
</ span >
</ div ><!-- / input - group -->
</ div ></ form > ' ;
return $text ;
return " <form class='form-search form-inline' method='get' action=' " . e_BASE . " search.php'>
< div class = 'input-group' >
2015-07-02 18:46:36 +01:00
< input class = 'tbox form-control search-query' type = 'text' name = 'q' size = '30' value = '' placeholder = \ " " . LAN_SEARCH . " \" maxlength='50' />
2014-01-05 11:26:19 -08:00
< button class = 'btn btn-primary button' type = 'submit' name = 's' value = '1' /> " .LAN_GO. " </ button >
2009-02-11 21:41:54 +00:00
< input type = 'hidden' name = 'r' value = '0' />
2014-01-05 11:26:19 -08:00
</ div >
2009-02-11 21:41:54 +00:00
</ form > " ;
}
2013-06-22 18:24:43 -07:00
2009-02-11 21:41:54 +00:00
/**
* @ private
*/
2009-07-21 07:10:25 +00:00
function _sc_cat_icons ( $source , $count , $alt )
2009-02-11 21:41:54 +00:00
{
if ( ! $source ) return " " ;
2013-12-30 03:56:27 -08:00
// list($ret[TRUE],$ret[FALSE]) = explode(chr(1), $source.chr(1)); //XXX ???
// if (!$ret[FALSE]) $ret[FALSE] = $ret[TRUE]; //XXX ???
2014-01-15 04:02:05 -08:00
$parms = array ( 'legacy' => e_IMAGE . " icons/ " );
return e107 :: getParser () -> toIcon ( $source , $parms );
2013-12-30 03:56:27 -08:00
//return "<img src='".e_IMAGE."icons/{$ret[($count!=0)]}' alt='*'/>";
2009-02-11 21:41:54 +00:00
}
2013-06-22 18:24:43 -07:00
2013-06-25 16:03:00 -07:00
private function isNewDownload ( $last_val )
2009-02-11 21:41:54 +00:00
{
if ( USER && ( $last_val > USERLV ))
{
2013-06-25 16:03:00 -07:00
return true ;
2009-02-11 21:41:54 +00:00
}
else
{
2013-06-25 16:03:00 -07:00
return false ;
2009-02-11 21:41:54 +00:00
}
}
2013-06-25 16:03:00 -07:00
private function renderNewIcon ()
{
2014-01-05 11:26:19 -08:00
if ( strstr ( IMAGE_NEW , '<i ' ) || strstr ( IMAGE_NEW , '<span' ))
2013-06-25 16:03:00 -07:00
{
return IMAGE_NEW ;
}
2014-01-05 11:26:19 -08:00
return e107 :: getParser () -> toIcon ( IMAGE_NEW );
2013-06-25 16:03:00 -07:00
2014-01-05 11:26:19 -08:00
// return "<img src='".IMAGE_NEW."' alt='*' style='vertical-align:middle' />";
2013-06-25 16:03:00 -07:00
}
2009-02-11 21:41:54 +00:00
}
2014-05-20 09:41:43 +02:00
?>