[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] comic/inc/functions.inc.php, 1.19
From: |
nomail |
Subject: |
[Phpgroupware-cvs] comic/inc/functions.inc.php, 1.19 |
Date: |
Wed, 21 Jul 2004 01:51:54 +0200 |
Update of /comic/inc
Modified Files:
Branch:
functions.inc.php
date: 2004/07/20 23:51:54; author: skwashd; state: Exp; lines: +155 -173
Log Message:
merge from 16 and image clean up
=====================================================================
Index: comic/inc/functions.inc.php
diff -u comic/inc/functions.inc.php:1.18 comic/inc/functions.inc.php:1.19
--- comic/inc/functions.inc.php:1.18 Tue Apr 22 20:24:17 2003
+++ comic/inc/functions.inc.php Tue Jul 20 23:51:54 2004
@@ -33,6 +33,7 @@
$g_image_source = array(0 => 'Remote',
1 => 'Local');
+
$g_dayofweek = array(Mon => 1,
Tue => 2,
Wed => 3,
@@ -43,61 +44,59 @@
function comic_admin_data(&$image, &$censor, &$override, &$remote, &$filesize)
{
- global $phpgw;
-
- $phpgw->db->query("select * from phpgw_comic_admin");
- if (!$phpgw->db->num_rows())
- {
- $phpgw->db->query("insert into phpgw_comic_admin values "
- ."(0,0,0,0,120000)");
-
- $phpgw->db->query("select * from phpgw_comic_admin");
- }
- $phpgw->db->next_record();
-
- $image = $phpgw->db->f("admin_imgsrc");
- $censor = $phpgw->db->f("admin_censorlvl");
- $override = $phpgw->db->f("admin_coverride");
- $remote = $phpgw->db->f("admin_rmtenabled");
- $filesize = $phpgw->db->f("admin_filesize");
+ $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_comic_admin',
__LINE__, __FILE__);
+
+ if (!$GLOBALS['phpgw']->db->num_rows())
+ {
+ $GLOBALS['phpgw']->db->query('INSERT INTO phpgw_comic_admin'
+ . ' VALUES(0,0,0,0,120000)', __LINE__, __FILE__);
+
+ $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_comic_admin',
__LINE__, __FILE__);
+ }
+
+ $GLOBALS['phpgw']->db->next_record();
+
+ $image = $GLOBALS['phpgw']->db->f('admin_imgsrc');
+ $censor = $GLOBALS['phpgw']->db->f('admin_censorlvl');
+ $override = $GLOBALS['phpgw']->db->f('admin_coverride');
+ $remote = $GLOBALS['phpgw']->db->f('admin_rmtenabled');
+ $filesize = $GLOBALS['phpgw']->db->f('admin_filesize');
}
function comic_flag_success($comic_url, $data_id)
{
- global $phpgw;
-
- $phpgw->db->lock("phpgw_comic_data");
- $phpgw->db->query("update phpgw_comic_data set "
- ."data_date='".(int)date("Ymd")."', "
- ."data_imageurl='".$comic_url."' "
- ."WHERE data_id='".$data_id."'");
- $phpgw->db->unlock();
+ $GLOBALS['phpgw']->db->lock('phpgw_comic_data');
+
+ $GLOBALS['phpgw']->db->query('UPDATE phpgw_comic_data SET'
+ .' data_date='.intval(date("Ymd")).','
+ ."
data_imageurl='".$GLOBALS['phpgw']->db->db_addslashes($comic_url)."' "
+ .' WHERE data_id='.intval($data_id), __LINE__, __FILE__);
+
+ $GLOBALS['phpgw']->db->unlock();
}
-function comic_resolve_url($remote_enabled, &$fetch_url,
- &$comic_url, &$comic_day)
+function comic_resolve_url($remote_enabled, &$fetch_url, &$comic_url,
&$comic_day)
{
- global $phpgw;
$status = STD_SUCCESS;
/**************************************************************************
* check to see if already "snarfed" today
*************************************************************************/
- if ($phpgw->db->f("data_date") == (int)date("Ymd"))
+ if ($GLOBALS['phpgw']->db->f("data_date") == (int)date("Ymd"))
{
$status = STD_CURRENT;
- $comic_url = $phpgw->db->f("data_imageurl");
+ $comic_url = $GLOBALS['phpgw']->db->f("data_imageurl");
/**********************************************************************
* need to generate resolve type links without going to the web
* and not putting them in the database
*********************************************************************/
- if ($phpgw->db->f("data_linkurl") == "")
+ if ($GLOBALS['phpgw']->db->f("data_linkurl") == "")
{
- $fetch_url = $phpgw->db->f("data_baseurl")
- .$phpgw->db->f("data_parseurl");
- $comic_time = time() - ($phpgw->db->f("data_daysold")*3600*24);
+ $fetch_url = $GLOBALS['phpgw']->db->f("data_baseurl")
+ .$GLOBALS['phpgw']->db->f("data_parseurl");
+ $comic_time = time() -
($GLOBALS['phpgw']->db->f("data_daysold")*3600*24);
comic_resolver(&$fetch_url, $comic_time);
}
@@ -108,7 +107,7 @@
/**********************************************************************
* resolve our comic url, link url and comic day
*********************************************************************/
- switch ($phpgw->db->f("data_resolve"))
+ switch ($GLOBALS['phpgw']->db->f("data_resolve"))
{
case "Static":
$status = comic_resolve_static(&$comic_url, &$comic_day);
@@ -125,8 +124,6 @@
function comic_resolve_linkurl($status, $fetch_url, &$link_url, &$comment)
{
- global $phpgw;
-
$link_tgt = "_blank";
if ($status != STD_CENSOR)
@@ -134,7 +131,7 @@
/**********************************************************************
* ultimately want to go where DB says
*********************************************************************/
- $link_url = $phpgw->db->f("data_linkurl");
+ $link_url = $GLOBALS['phpgw']->db->f("data_linkurl");
/**********************************************************************
* if can't then see if we built a url where we got the image from
@@ -148,14 +145,14 @@
*****************************************************************/
if ($link_url == "")
{
- $link_url = $phpgw->db->f("data_baseurl");
+ $link_url = $GLOBALS['phpgw']->db->f("data_baseurl");
/**************************************************************
* everything else is failing so let's link self
*************************************************************/
if ($link_url == "")
{
- $link_url = $phpgw->link("/comic/index.php");
+ $link_url = $GLOBALS['phpgw']->link("/comic/index.php");
$link_tgt = "_self";
}
@@ -167,7 +164,7 @@
/**********************************************************************
* need to break the link url
*********************************************************************/
- $link_url = $phpgw->link("/comic/index.php");
+ $link_url = $GLOBALS['phpgw']->link("/comic/index.php");
$link_tgt = "_self";
}
@@ -177,12 +174,10 @@
function comic_resolve_static(&$comic_url, &$comic_day)
{
- global $phpgw;
-
$status = STD_SUCCESS;
- $comic_url = $phpgw->db->f("data_baseurl");
- $comic_time = time() - ($phpgw->db->f("data_daysold")*3600*24);
+ $comic_url = $GLOBALS['phpgw']->db->f("data_baseurl");
+ $comic_time = time() -
($GLOBALS['phpgw']->db->f("data_daysold")*3600*24);
$comic_day = substr(date("D", $comic_time),0,2);
/**************************************************************************
@@ -194,46 +189,43 @@
return $status;
}
-function comic_resolve_remote($remote_enabled, &$fetch_url,
- &$comic_url, &$comic_day)
+function comic_resolve_remote($remote_enabled, &$fetch_url, &$comic_url,
&$comic_day)
{
- global $phpgw;
-
$status = STD_SUCCESS;
$unresolved = True;
- $comic_time = time() - ($phpgw->db->f("data_daysold")*3600*24);
+ $comic_time = time() -
($GLOBALS['phpgw']->db->f("data_daysold")*3600*24);
/**************************************************************************
* generate the resolver components
*************************************************************************/
- switch ($phpgw->db->f("data_parser"))
+ switch ($GLOBALS['phpgw']->db->f("data_parser"))
{
case "Comics":
case "Comiczone7":
case "Comiczone10":
case "United":
$baseurl = "http://www.comics.com";
- $parseurl = "/comics/".$phpgw->db->f("data_name")."/index.html";
+ $parseurl =
"/comics/".$GLOBALS['phpgw']->db->f("data_name")."/index.html";
$parse_expr = "/comics/"
- .$phpgw->db->f("data_name")
+ .$GLOBALS['phpgw']->db->f("data_name")
."/archive/images/"
- .$phpgw->db->f("data_name")
+ .$GLOBALS['phpgw']->db->f("data_name")
."[0-9]*.(gif|jpg)";
break;
case "King":
/*
- if ($phpgw->db->f("data_daysold") == 0)
+ if ($GLOBALS['phpgw']->db->f("data_daysold") == 0)
{
$comic_time = time() - (14*3600*24);
}
$baseurl = "http://est.rbma.com/content/";
- $parseurl = $phpgw->db->f("data_prefix")."?date={Ymd}";
+ $parseurl = $GLOBALS['phpgw']->db->f("data_prefix")."?date={Ymd}";
comic_resolver(&$parseurl, $comic_time);
$fetch_url = "http://www.kingfeatures.com/comics/".
- $phpgw->db->f("data_name");
+ $GLOBALS['phpgw']->db->f("data_name");
$comic_url = $baseurl.$parseurl;
@@ -243,11 +235,11 @@
case "Toonville":
$baseurl = "http://aolsvc.toonville.aol.com";
- $parseurl = "/main.asp?fnum=".$phpgw->db->f("data_comicid");
+ $parseurl =
"/main.asp?fnum=".$GLOBALS['phpgw']->db->f("data_comicid");
$parse_expr = "/[cC]*ontent1/"
- .$phpgw->db->f("data_name")
+ .$GLOBALS['phpgw']->db->f("data_name")
."/"
- .$phpgw->db->f("data_prefix")
+ .$GLOBALS['phpgw']->db->f("data_prefix")
."[0-9]*"
."[g]*.(jpg|gif)";
@@ -255,24 +247,24 @@
break;
case "Creators":
$baseurl = "http://www.comics.com";
- $parseurl = "/creators/".$phpgw->db->f("data_name")."/index.html";
+ $parseurl =
"/creators/".$GLOBALS['phpgw']->db->f("data_name")."/index.html";
$parse_expr = "/creators/"
- .$phpgw->db->f("data_name")
+ .$GLOBALS['phpgw']->db->f("data_name")
."/archive/images/"
- .$phpgw->db->f("data_name")
+ .$GLOBALS['phpgw']->db->f("data_name")
."[0-9]*.(gif|jpg)";
break;
case "ComicsPage":
- if ($phpgw->db->f("data_daysold") == 0)
+ if ($GLOBALS['phpgw']->db->f("data_daysold") == 0)
{
$comic_time = time() - (7*3600*24);
}
$baseurl = "http://www.comicspage.com";
- $parseurl = "/".$phpgw->db->f("data_name")."/index.html";
+ $parseurl = "/".$GLOBALS['phpgw']->db->f("data_name")."/index.html";
$parse_expr = "/daily/"
- .$phpgw->db->f("data_prefix")
+ .$GLOBALS['phpgw']->db->f("data_prefix")
."/{Ymd}"
- .$phpgw->db->f("data_prefix")
+ .$GLOBALS['phpgw']->db->f("data_prefix")
."-a.gif";
comic_resolver(&$parse_expr, $comic_time);
@@ -285,22 +277,22 @@
case "Ucomics":
$baseurl = "http://images.ucomics.com";
$parseurl = "/comics/"
- .$phpgw->db->f("data_prefix")
+ .$GLOBALS['phpgw']->db->f("data_prefix")
."/{Y}/"
- .$phpgw->db->f("data_prefix")
+ .$GLOBALS['phpgw']->db->f("data_prefix")
."{ymd}.gif";
comic_resolver(&$parseurl, $comic_time);
- $fetch_url = $phpgw->db->f("data_linkurl");
+ $fetch_url = $GLOBALS['phpgw']->db->f("data_linkurl");
$comic_url = $baseurl.$parseurl;
$unresolved = False;
break;
default:
- $baseurl = $phpgw->db->f("data_baseurl");
- $parseurl = $phpgw->db->f("data_parseurl");
- $parse_expr = $phpgw->db->f("data_parsexpr");
+ $baseurl = $GLOBALS['phpgw']->db->f("data_baseurl");
+ $parseurl = $GLOBALS['phpgw']->db->f("data_parseurl");
+ $parse_expr = $GLOBALS['phpgw']->db->f("data_parsexpr");
$status = comic_resolver(&$parseurl, $comic_time);
@@ -407,14 +399,12 @@
function comic_parser($baseurl, $fetch_url, $parse_expr, &$comic_url)
{
- global $phpgw;
-
$status = STD_SUCCESS;
/**************************************************************************
* get the file to parse
*************************************************************************/
- if ($file = $phpgw->network->gethttpsocketfile($fetch_url))
+ if ($file = $GLOBALS['phpgw']->network->gethttpsocketfile($fetch_url))
{
$lines = count($file);
@@ -446,16 +436,14 @@
function comic_snarf(&$comic_url, $filesize)
{
- global $phpgw, $phpgw_info;
-
$status = STD_SUCCESS;
- $filename = "images/" . $phpgw->db->f("data_name") .
substr($comic_url,-4);
+ $filename = "images/" . $GLOBALS['phpgw']->db->f("data_name") .
substr($comic_url,-4);
$filename_w = PHPGW_SERVER_ROOT."/comic/".$filename;
/**************************************************************************
* get our image or fail
*************************************************************************/
- // if($file = $phpgw->network->gethttpsocketfile($comic_url))
+ // if($file = $GLOBALS['phpgw']->network->gethttpsocketfile($comic_url))
if($fpread = @fopen($comic_url, 'r'))
{
@@ -485,7 +473,7 @@
fclose($fp);
- $comic_url = $phpgw_info["server"]["webserver_url"]
+ $comic_url = $GLOBALS['phpgw_info']["server"]["webserver_url"]
."/comic/"
.$filename;
}
@@ -506,8 +494,6 @@
function comic_error($image_location, $status, &$comic_url)
{
- global $phpgw_info;
-
/**************************************************************************
* the image should either be a side or center
*************************************************************************/
@@ -540,8 +526,8 @@
/**************************************************************************
* compose the error comic url
*************************************************************************/
- $comic_url = $phpgw_info["server"]["webserver_url"]
- ."/".$phpgw_info["flags"]["currentapp"]
+ $comic_url = $GLOBALS['phpgw_info']["server"]["webserver_url"]
+ ."/".$GLOBALS['phpgw_info']["flags"]["currentapp"]
."/images/template"
.$label
.$image_size
@@ -551,8 +537,6 @@
function comic_match_bar($start, $end, $indexlimit,
$comics_displayed, &$matchs_c)
{
- global $phpgw, $phpgw_info;
-
switch ($indexlimit)
{
case 0:
@@ -573,18 +557,18 @@
break;
}
- $matchs_tpl = $phpgw->template;
+ $matchs_tpl = $GLOBALS['phpgw']->template;
$matchs_tpl->set_unknowns("remove");
$matchs_tpl->set_file(matchs, "matchs.comic.tpl");
$matchs_tpl->
set_var
(array(next_matchs_left =>
-
$phpgw->nextmatchs->left("/comic/index.php",$start,$indexlimit,""),
+
$GLOBALS['phpgw']->nextmatchs->left("/comic/index.php",$start,$indexlimit,""),
next_matchs_label => $showstring,
next_matchs_right =>
-
$phpgw->nextmatchs->right("/comic/index.php",$start,$indexlimit,""),
- navbar_bg => $phpgw_info["theme"]["navbar_bg"],
- navbar_text => $phpgw_info["theme"]["navbar_text"]));
+
$GLOBALS['phpgw']->nextmatchs->right("/comic/index.php",$start,$indexlimit,""),
+ navbar_bg =>
$GLOBALS['phpgw_info']["theme"]["navbar_bg"],
+ navbar_text =>
$GLOBALS['phpgw_info']["theme"]["navbar_text"]));
$matchs_tpl->parse(MATCHS, "matchs");
$matchs_c = $matchs_tpl->get("MATCHS");
}
@@ -593,8 +577,6 @@
$user_censorlvl, $start, &$comic_left_c,
&$comic_right_c, &$comic_center_c, &$matchs_c)
{
- global $phpgw, $phpgw_info;
-
$sideno = COMIC_LEFT;
/**************************************************************************
@@ -624,7 +606,7 @@
/**********************************************************************
* start our template
*********************************************************************/
- $comic_tpl = $phpgw->template;
+ $comic_tpl = $GLOBALS['phpgw']->template;
$comic_tpl->set_unknowns("remove");
$comic_tpl->set_file(
array(tableleft => "table.left.tpl",
@@ -656,14 +638,13 @@
/******************************************************************
* get the comic data
*****************************************************************/
- $phpgw->db->query("select * from phpgw_comic_data "
- ."WHERE data_id='"
- .$comic_list[$index]."' AND "
- ."data_enabled='T'");
+ $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_comic_data'
+ .' WHERE data_id='.intval($comic_list[$index])
+ ." AND data_enabled='T'", __LINE__, __FILE__);
- if ($phpgw->db->next_record())
+ if ($GLOBALS['phpgw']->db->next_record())
{
- $comic_censorlvl = $phpgw->db->f("data_censorlvl");
+ $comic_censorlvl = $GLOBALS['phpgw']->db->f("data_censorlvl");
$comic_day = substr(date("D", time()),0,2); /* today */
$comic_url = "";
$fetch_url = "";
@@ -699,7 +680,7 @@
/**************************************************************
* if comic_day is not in days allowed flag error
*************************************************************/
- if (!strstr($phpgw->db->f("data_pubdays"), $comic_day))
+ if (!strstr($GLOBALS['phpgw']->db->f("data_pubdays"),
$comic_day))
{
$status = STD_WARNING;
$end++;
@@ -718,11 +699,11 @@
*************************************************************/
if ($comic_day == "Su")
{
- $image_width = $phpgw->db->f("data_swidth");
+ $image_width = $GLOBALS['phpgw']->db->f("data_swidth");
}
else
{
- $image_width = $phpgw->db->f("data_width");
+ $image_width = $GLOBALS['phpgw']->db->f("data_width");
}
if ( $image_width <= 300)
{
@@ -799,8 +780,8 @@
}
$name = lang("%1 by %2 (%3)",
- $phpgw->db->f("data_title"),
- $phpgw->db->f("data_author"),
+ $GLOBALS['phpgw']->db->f("data_title"),
+ $GLOBALS['phpgw']->db->f("data_author"),
$index+1);
$comic_tpl->
@@ -812,8 +793,8 @@
link_tgt => $link_tgt,
comment => $comment,
name => $name,
- th_bg => $phpgw_info["theme"]["th_bg"],
- th_text => $phpgw_info["theme"]["th_text"]));
+ th_bg =>
$GLOBALS['phpgw_info']["theme"]["th_bg"],
+ th_text =>
$GLOBALS['phpgw_info']["theme"]["th_text"]));
$comic_tpl->parse($side."_part", "row", TRUE);
$comics_displayed++;
@@ -854,21 +835,19 @@
/**********************************************************************
* finish out the template with the next matchs bar
*********************************************************************/
- $temp = $phpgw_info["user"]["preferences"]["common"]["maxmatchs"];
- $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]
+ $temp =
$GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"];
+ $GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"]
= $comic_perpage;
comic_match_bar($start, $end, $indexlimit,
$comics_displayed,
&$matchs_c);
- $phpgw_info["user"]["preferences"]["common"]["maxmatchs"]
+ $GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"]
= $temp;
}
}
function comic_display_frontpage($data_id, $scale, $censor_level)
{
- global $phpgw, $phpgw_info;
-
/**************************************************************************
* get the admin settings
*************************************************************************/
@@ -891,9 +870,9 @@
if ($data_id == 0)
{
$match_str =
- "WHERE data_censorlvl <= '".$censor_level."' AND ".
- " data_pubdays LIKE '%".$comic_day."%' AND "
- ."data_enabled='T'";
+ 'WHERE data_censorlvl <= '.intval($censor_level)
+ . " AND data_pubdays LIKE
'%".$GLOBALS['phpgw']->db->db_addslashes($comic_day)."%'"
+ . " AND data_enabled='T'";
}
/**************************************************************************
@@ -902,15 +881,15 @@
else
{
$match_str =
- "WHERE data_id='".$data_id."' AND "
- ."data_enabled='T'";
+ 'WHERE data_id='.intval($data_id)
+ . " AND data_enabled='T'";
}
/**************************************************************************
* get the comic data
*************************************************************************/
- $phpgw->db->query("select * from phpgw_comic_data "
- .$match_str);
+ $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_comic_data '
+ .$match_str, __LINE__, __FILE__);
/**************************************************************************
* of the potentially valid returns...lets try to shake it up a bit and
@@ -919,11 +898,11 @@
if ($data_id == 0)
{
srand((double)microtime()*1000000);
- $randval = rand(1,$phpgw->db->num_rows());
+ $randval = rand(1,$GLOBALS['phpgw']->db->num_rows());
for ($index = 1; $index < $randval; $index++)
{
- $phpgw->db->next_record();
+ $GLOBALS['phpgw']->db->next_record();
}
}
@@ -931,9 +910,9 @@
/**************************************************************************
* process valid comic data
*************************************************************************/
- if ($phpgw->db->next_record())
+ if ($GLOBALS['phpgw']->db->next_record())
{
- $comic_censorlvl = $phpgw->db->f("data_censorlvl");
+ $comic_censorlvl = $GLOBALS['phpgw']->db->f("data_censorlvl");
$comic_url = "";
$fetch_url = "";
@@ -968,7 +947,7 @@
/**********************************************************************
* if comic_day is not in days allowed flag error
*********************************************************************/
- if (!strstr($phpgw->db->f("data_pubdays"), $comic_day))
+ if (!strstr($GLOBALS['phpgw']->db->f("data_pubdays"), $comic_day))
{
$status = STD_WARNING;
$end++;
@@ -987,11 +966,11 @@
*********************************************************************/
if ($comic_day == "Su")
{
- $image_width = $phpgw->db->f("data_swidth");
+ $image_width = $GLOBALS['phpgw']->db->f("data_swidth");
}
else
{
- $image_width = $phpgw->db->f("data_width");
+ $image_width = $GLOBALS['phpgw']->db->f("data_width");
}
if ( $image_width <= 300)
{
@@ -1045,14 +1024,14 @@
}
$name = lang("%1 by %2",
- $phpgw->db->f("data_title"),
- $phpgw->db->f("data_author"));
+ $GLOBALS['phpgw']->db->f("data_title"),
+ $GLOBALS['phpgw']->db->f("data_author"));
/******************************************************************
* our template
*****************************************************************/
$comic_tpl = CreateObject('phpgwapi.Template',
- $phpgw->common->get_tpl_dir('comic'));
+
$GLOBALS['phpgw']->common->get_tpl_dir('comic'));
$comic_tpl->set_unknowns("remove");
$comic_tpl->set_file(
array(table => "table.front.tpl",
@@ -1066,8 +1045,8 @@
link_tgt => $link_tgt,
comment => $comment,
name => $name,
- th_bg => $phpgw_info["theme"]["th_bg"],
- th_text => $phpgw_info["theme"]["th_text"]));
+ th_bg => $GLOBALS['phpgw_info']["theme"]["th_bg"],
+ th_text => $GLOBALS['phpgw_info']["theme"]["th_text"]));
$comic_tpl->parse("center_part", "row");
$comic_tpl->parse(TABLE, "table");
@@ -1085,11 +1064,9 @@
function template_options($app_template, &$options_c, &$images_c)
{
- global $phpgw, $phpgw_info;
-
- $appname = $phpgw_info["flags"]["currentapp"];
+ $appname = $GLOBALS['phpgw_info']["flags"]["currentapp"];
- $directory = opendir(PHPGW_APP_TPL);
+ $directory = opendir(PHPGW_SERVER_ROOT . SEP. $appname . SEP . 'templates'
. SEP . 'default' . SEP);
$index=0;
@@ -1113,65 +1090,70 @@
$template_name["$template_id"] = $tname[0];
}
- asort($template_name);
-
/**************************************************************************
* start our template
*************************************************************************/
- $image_tpl = $phpgw->template;
+ $image_tpl = $GLOBALS['phpgw']->template;
$image_tpl->set_unknowns("remove");
$image_tpl->set_file(
array(options => "option.common.tpl",
rows => "row.images.tpl",
cells => "cell.images.tpl"));
- while (list($value, $name) = each($template_name))
+ if(count($template_name))
{
- $selected = "";
- if ((int)$value == $app_template)
- {
- $selected = "selected";
- }
-
- $image_tpl->set_var(array(OPTION_SELECTED => $selected,
- OPTION_VALUE => (int)$value,
- OPTION_NAME => $name));
+ asort($template_name);
+ while (list($value, $name) = each($template_name))
+ {
+ $selected = "";
+ if ((int)$value == $app_template)
+ {
+ $selected = "selected";
+ }
+
+ $image_tpl->set_var(array(OPTION_SELECTED => $selected,
+ OPTION_VALUE => (int)$value,
+ OPTION_NAME => $name));
- $image_tpl->parse(option_list, "options", TRUE);
+ $image_tpl->parse(option_list, "options", TRUE);
+ }
}
$options_c = $image_tpl->get("option_list");
- reset($template_name);
- $counter = 0;
-
- while (list($value, $name) = each($template_name))
+ if(count($template_name))
{
- $index--;
+ reset($template_name);
+ $counter = 0;
+
+ while (list($value, $name) = each($template_name))
+ {
+ $index--;
- $imgname = $name.".gif";
+ $imgname = $name.".gif";
- $filename_f =
- $phpgw->common->get_image_dir($appname)."/".$imgname;
- $filename_a =
- $phpgw->common->get_image_path($appname)."/".$imgname;
+ $filename_f =
+ $GLOBALS['phpgw']->common->get_image_dir($appname)."/".$imgname;
+ $filename_a =
+
$GLOBALS['phpgw']->common->get_image_path($appname)."/".$imgname;
- if (file_exists($filename_f))
- {
- $counter++;
+ if (file_exists($filename_f))
+ {
+ $counter++;
- $image_tpl->set_var(array(image_number => $name,
+ $image_tpl->set_var(array(image_number => $name,
image_url => $filename_a));
- $image_tpl->parse(image_row, "cells", TRUE);
- }
+ $image_tpl->parse(image_row, "cells", TRUE);
+ }
- if (($counter == 5) || ($index == 0))
- {
- $cells_c = $image_tpl->get("image_row");
+ if (($counter == 5) || ($index == 0))
+ {
+ $cells_c = $image_tpl->get("image_row");
- $image_tpl->set_var(image_cells, $cells_c);
- $image_tpl->parse(IMAGE_ROWS, rows, TRUE);
+ $image_tpl->set_var(image_cells, $cells_c);
+ $image_tpl->parse(IMAGE_ROWS, rows, TRUE);
- $counter = 0;
+ $counter = 0;
+ }
}
}
$images_c = $image_tpl->get("IMAGE_ROWS");
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] comic/inc/functions.inc.php, 1.19,
nomail <=