e107 = e107::getInstance();
$this->postInfo = array();
}
// Category ************************************************************************************
function sc_download_cat_main_name() {
global $tp, $dlrow;
return $tp->toHTML($dlrow['download_category_name'], FALSE, 'TITLE');
}
function sc_download_cat_main_description() {
global $tp, $dlrow;
return $tp->toHTML($dlrow['download_category_description'], TRUE, 'DESCRIPTION');
}
function sc_download_cat_main_icon() {
global $dlrow;
// Pass count as 1 to force non-empty icon
return $this->_sc_cat_icons($dlrow['download_category_icon'], 1, $dlrow['download_category_name']);
}
// Sub-Category ********************************************************************************
function sc_download_cat_sub_name() {
global $tp, $dlsubrow;
if ($dlsubrow['d_count'])
{
return "".$tp->toHTML($dlsubrow['download_category_name'], FALSE, 'TITLE')."";
}
else
{
return $tp->toHTML($dlsubrow['download_category_name'], FALSE, 'TITLE');
}
}
function sc_download_cat_sub_description() {
global $tp, $dlsubrow;
return $tp->toHTML($dlsubrow['download_category_description'], TRUE, 'DESCRIPTION');
}
function sc_download_cat_sub_icon() {
global $dlsubrow;
return $this->_sc_cat_icons($dlsubrow['download_category_icon'], $dlsubrow['d_count'], $dlsubrow['download_category_name']);
}
function sc_download_cat_sub_new_icon() {
global $dlsubrow;
return $this->_check_new_download($dlsubrow['d_last_subs']);
}
function sc_download_cat_sub_count() {
global $dlsubrow;
return $dlsubrow['d_count'];
}
function sc_download_cat_sub_size() {
global $e107, $dlsubrow;
return $this->e107->parseMemorySize($dlsubrow['d_size']);
}
function sc_download_cat_sub_downloaded() {
global $dlsubrow;
return intval($dlsubrow['d_requests']);
}
// Sub-Sub-Category ****************************************************************************
function sc_download_cat_subsub_name() {
global $tp, $dlsubsubrow;
if ($dlsubsubrow['d_count'])
{
return "".$tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE')."";
}
else
{
return $tp->toHTML($dlsubsubrow['download_category_name'], FALSE, 'TITLE');
}
}
function sc_download_cat_subsub_description() {
global $tp, $dlsubsubrow;
return $tp->toHTML($dlsubsubrow['download_category_description'], TRUE, 'DESCRIPTION');
}
function sc_download_cat_subsub_icon() {
global $dlsubsubrow;
return $this->_sc_cat_icons($dlsubsubrow['download_category_icon'], $dlsubsubrow['d_count'], $dlsubsubrow['download_category_name']);
}
function sc_download_cat_subsub_count() {
global $dlsubsubrow;
return $dlsubsubrow['d_count'];
}
function sc_download_cat_subsub_size() {
global $e107, $dlsubsubrow;
return $this->e107->parseMemorySize($dlsubsubrow['d_size']);
}
function sc_download_cat_subsub_downloaded() {
global $dlsubsubrow;
return intval($dlsubsubrow['d_requests']);
}
// List ****************************************************************************************
function sc_download_list_name()
{
global $dlrow,$tp,$pref,$parm;
if ($parm == "nolink"){
return $tp->toHTML($dlrow['download_name'],TRUE,'LINKTEXT');
}
if ($parm == "request"){
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
if ($dlrow['download_mirror_type']){
$text = ($pref['agree_flag'] ? "" : "");
}else{
$text = ($pref['agree_flag'] ? "" : "");
}
$text .= $tp->toHTML($dlrow['download_name'], FALSE, 'TITLE')."";
return $text;
}
return "".$tp->toHTML($dlrow['download_name'],TRUE,'LINKTEXT')."";
}
function sc_download_list_author()
{
global $dlrow;
return $dlrow['download_author'];
}
function sc_download_list_requested()
{
global $dlrow;
return $dlrow['download_requested'];
}
function sc_download_list_newicon()
{
global $dlrow;
return (USER && $dlrow['download_datestamp'] > USERLV ? "" : "");
}
function sc_download_list_recenticon()
{
global $dlrow, $pref;
// convert "recent_download_days" to seconds
return ($dlrow['download_datestamp'] > time()-($pref['recent_download_days']*86400) ? '
' : '');
}
function sc_download_list_filesize()
{
global $dlrow, $e107;
return $e107->parseMemorySize($dlrow['download_filesize']);
}
function sc_download_list_datestamp()
{
global $dlrow;
$gen = new convert;
return $gen->convert_date($dlrow['download_datestamp'], "short");
}
function sc_download_list_thumb()
{
global $dlrow,$parm;
$tp = e107::getParser();
$img = ($dlrow['download_thumb']) ? "
" : "";
if ($parm == "link" && $dlrow['download_thumb']){
return "".$img."";
}
else
{
return $img;
}
}
function sc_download_list_id()
{
global $dlrow;
return $dlrow['download_id'];
}
function sc_download_list_rating()
{
global $dlrow;
return e107::getForm()->rate("download", $dlrow['download_id']);
$rater = new rater();
$ratearray = $rater->getrating("download", $dlrow['download_id']);
if (!$ratearray[0]) {
return LAN_dl_13;
}
else
{
return ($ratearray[2] ? "{$ratearray[1]}.{$ratearray[2]}/{$ratearray[0]}" : "{$ratearray[1]}/{$ratearray[0]}");
}
}
function sc_download_list_link()
{
global $tp, $dlrow, $pref, $parm;
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
$img = "
";
if ($dlrow['download_mirror_type'])
{
return "{$img}";
}
else
{
return ($pref['agree_flag'] ? "{$img}" : "{$img}");
}
}
function sc_download_list_icon()
{
global $dlrow,$parm;
if ($parm == "link"){
return "".$img."";
}
else
{
return $img;
}
return;
}
function sc_download_list_imagefull()
{
global $dlrow,$parm;
$tp = e107::getParser();
$img = ($dlrow['download_image']) ? "
" : "";
if($parm == "link" && $dlrow['download_image'])
{
return "".$img."";
}
else
{
return $img;
}
}
function sc_download_list_nextprev()
{
global $nextprev_parms,$tp;
return $tp->parseTemplate("{NEXTPREV={$nextprev_parms}}");
}
function sc_download_list_total_amount() {
global $dltdownloads;
return $dltdownloads." ".LAN_dl_16;
}
function sc_download_list_total_files() {
global $dlft;
return $dlft." ".LAN_dl_17;
}
// View ****************************************************************************************
function sc_download_view_id()
{
global $dlrow;
return $dlrow['download_id'];
}
function sc_download_admin_edit()
{
global $dlrow;
return (ADMIN && getperms('6')) ? "
" : "";
}
function sc_download_category()
{
global $dlrow;
return $dlrow['download_category_name'];
}
function sc_download_category_description()
{
global $tp,$dl,$parm;
$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
if ($parm){
return substr($text,0,$parm);
}else{
return $text;
}
}
function sc_download_view_name()
{
global $dlrow,$parm;
$link['view'] = "".$dlrow['download_name']."";
$link['request'] = "".$dlrow['download_name']."";
if ($parm){
return $link[$parm];
}
return $dlrow['download_name'];
}
function sc_download_view_name_linked()
{
global $pref,$dl,$tp;
if ($pref['agree_flag'] == 1) {
return "toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."";
} else {
return "".$dl['download_name']."";
}
}
function sc_download_view_author()
{
global $dlrow;
return ($dlrow['download_author'] ? $dlrow['download_author'] : "");
}
function sc_download_view_authoremail()
{
global $tp,$dlrow;
return ($dlrow['download_author_email']) ? $tp -> toHTML($dlrow['download_author_email'], TRUE, 'LINKTEXT') : "";
}
function sc_download_view_authorwebsite()
{
global $tp,$dlrow;
return ($dlrow['download_author_website']) ? $tp -> toHTML($dlrow['download_author_website'], TRUE,'LINKTEXT') : "";
}
function sc_download_view_description()
{
global $tp,$dlrow,$parm;
$maxlen = ($parm ? intval($parm) : 0);
$text = ($dlrow['download_description'] ? $tp->toHTML($dlrow['download_description'], TRUE, 'DESCRIPTION') : "");
if ($maxlen){
return substr($text, 0, $maxlen);
}else{
return $text;
}
return $text;
}
function sc_download_view_date()
{
global $gen,$dlrow,$parm;
return ($dlrow['download_datestamp']) ? $gen->convert_date($dlrow['download_datestamp'], $parm) : "";
}
function sc_download_view_date_short()
{
// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
global $gen,$dlrow;
return ($dlrow['download_datestamp']) ? $gen->convert_date($dlrow['download_datestamp'], "short") : "";
}
function sc_download_view_date_long()
{
// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
global $gen,$dlrow;
return ($dlrow['download_datestamp']) ? $gen->convert_date($dlrow['download_datestamp'], "long") : "";
}
function sc_download_view_image()
{
global $dlrow;
$tp = e107::getParser();
if ($dlrow['download_thumb']) {
return ($dlrow['download_image'] ? "
" : "
");
}
else if ($dlrow['download_image']) {
return "".LAN_dl_40."";
}
else
{
return LAN_dl_75;
}
}
function sc_download_view_imagefull()
{
global $dlrow;
$tp = e107::getParser();
return ($dlrow['download_image']) ? "
" : "";
}
function sc_download_view_link()
{
global $pref,$dlrow,$tp;
$click = "";
if ($pref['agree_flag'] == 1) {
$click = " onclick='return confirm(\"".$tp->toJS($tp->toHTML($pref['agree_text'],true,'emotes, no_tags'))."\")'";
}
$dnld_link = "";
if ($dlrow['download_mirror'])
{
if ($dlrow['download_mirror_type'])
{
return "".LAN_dl_66."";
}
else
{
return $dnld_link."
";
}
}
else
{
return $dnld_link."
";
}
}
function sc_download_view_filesize()
{
global $dlrow, $e107;
return ($dlrow['download_filesize']) ? $e107->parseMemorySize($dlrow['download_filesize']) : "";
}
function sc_download_view_rating()
{
global $dlrow;
$frm = e107::getForm();
$options = array('label'=>' ','template'=>'RATE|VOTES|STATUS');
return $frm->rate("download", $dlrow['download_id'],$options);
require_once(e_HANDLER."rate_class.php");
$rater = new rater;
$text = "
";
if ($ratearray = $rater->getrating("download", $dlrow['download_id'])) {
for($c = 1; $c <= $ratearray[1]; $c++) {
$text .= "![]() ![]() | "; if (!$rater->checkrated("download", $dlrow['download_id']) && USER) { $text .= $rater->rateselect(" ".LAN_dl_14, "download", $dlrow['download_id']).""; } else if (!USER) { $text .= " "; } else { $text .= LAN_dl_15; } $text .= " |