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

112 lines
2.5 KiB
PHP

<?php
/*
* e107 website system
*
* 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)
*
* Cron Administration
*
* $URL: https://e107.svn.sourceforge.net/svnroot/e107/trunk/e107_0.8/e107_admin/cron.php $
* $Id: cron.php 12492 2011-12-30 16:09:10Z e107steved $
*
*/
/**
*
* @package e107
* @subpackage frontend
* @version $Id: cron.php 12492 2011-12-30 16:09:10Z e107steved $
* Ultra-simple Image-Gallery
*/
/*
* THIS SCRIPT IS HIGHLY EXPERIMENTAL. USE AT OWN RISK.
*
*/
require_once("../../class2.php");
if (!plugInstalled('gallery'))
{
header('location:'.e_BASE.'index.php');
exit;
}
require_once(HEADERF);
class gallery
{
private $catList = array();
function __construct()
{
$this->catList = e107::getMedia()->getCategories('gallery');
if(($_GET['cat']) && isset($this->catList[$_GET['cat']]))
{
$this->showImages($_GET['cat']);
}
else
{
$this->listCategories();
}
}
function listCategories()
{
$template = e107::getTemplate('gallery');
$sc = e107::getScBatch('gallery',TRUE);
$text = "";
foreach($this->catList as $val)
{
$sc->setVars($val);
$text .= e107::getParser()->parseTemplate($template['CAT_ITEM'],TRUE);
}
$text = $template['CAT_START'].$text.$template['CAT_END'];
e107::getRender()->tablerender("Gallery",$text);
}
function showImages($cat)
{
$mes = e107::getMessage();
$tp = e107::getParser();
$template = e107::getTemplate('gallery');
$sc = e107::getScBatch('gallery',TRUE);
$sc->total = e107::getMedia()->countImages($cat);
$sc->amount = 12; // TODO Add Pref. amount per page.
$sc->curCat = $cat;
$sc->from = ($_GET['frm']) ? intval($_GET['frm']) : 0;
$list = e107::getMedia()->getImages($cat,$sc->from,$sc->amount);
$catname = $tp->toHtml($this->catList[$cat]['media_cat_title'],false,'defs');
$inner = "";
foreach($list as $row)
{
$sc->setVars($row);
$inner .= $tp->parseTemplate($template['LIST_ITEM'],TRUE);
}
$text = $tp->parseTemplate($template['LIST_START'],TRUE);
$text .= $inner;
$text .= $tp->parseTemplate($template['LIST_END'],TRUE);
e107::getRender()->tablerender("Gallery :: ".$catname,$mes->render().$text);
}
}
new gallery;
require_once(FOOTERF);
exit;
?>