phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] comic/inc functions.inc.php hook_home.inc.php


From: Dave Hall
Subject: [Phpgroupware-cvs] comic/inc functions.inc.php hook_home.inc.php
Date: Thu, 28 Dec 2006 04:29:52 +0000

CVSROOT:        /sources/phpgroupware
Module name:    comic
Changes by:     Dave Hall <skwashd>     06/12/28 04:29:52

Modified files:
        inc            : functions.inc.php hook_home.inc.php 

Log message:
        noitices and formatting - still a WIP

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/comic/inc/functions.inc.php?cvsroot=phpgroupware&r1=1.20&r2=1.21
http://cvs.savannah.gnu.org/viewcvs/comic/inc/hook_home.inc.php?cvsroot=phpgroupware&r1=1.10&r2=1.11

Patches:
Index: functions.inc.php
===================================================================
RCS file: /sources/phpgroupware/comic/inc/functions.inc.php,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- functions.inc.php   5 May 2005 16:33:09 -0000       1.20
+++ functions.inc.php   28 Dec 2006 04:29:52 -0000      1.21
@@ -10,37 +10,46 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-  /* $Id: functions.inc.php,v 1.20 2005/05/05 16:33:09 powerstat Exp $ */
+  /* $Id: functions.inc.php,v 1.21 2006/12/28 04:29:52 skwashd Exp $ */
 
-define("COMIC_STATIC",  0);
-define("COMIC_SNARFED", 1);
+define('COMIC_STATIC',  0);
+define('COMIC_SNARFED', 1);
 
-define("STD_SUCCESS",   0);
-define("STD_ERROR",     1);
-define("STD_WARNING",   2);
-define("STD_FORBIDDEN", 3);
-define("STD_CENSOR",    4);
-define("STD_NOREMOTE",  5);
-define("STD_CURRENT",   6);
-define("STD_TEMPLATE",  7);
-
-define("COMIC_LEFT",    1);
-define("COMIC_RIGHT",   0);
-
-$g_censor_level = array(0 => 'G',
+define('STD_SUCCESS',   0);
+define('STD_ERROR',     1);
+define('STD_WARNING',   2);
+define('STD_FORBIDDEN', 3);
+define('STD_CENSOR',    4);
+define('STD_NOREMOTE',  5);
+define('STD_CURRENT',   6);
+define('STD_TEMPLATE',  7);
+
+define('COMIC_LEFT',    1);
+define('COMIC_RIGHT',   0);
+
+$g_censor_level = array
+(
+       0 => 'G',
                         1 => 'PG',
-                        2 => 'R');
+       2 => 'R'
+);
 
-$g_image_source = array(0 => 'Remote',
-                        1 => 'Local');
-                       
-$g_dayofweek    = array(Mon => 1,
-                        Tue => 2,
-                        Wed => 3,
-                        Thu => 4,
-                        Fri => 5,
-                        Sat => 6,
-                        Sun => 7);
+$g_image_source = array
+(
+       0 => 'Remote',
+       1 => 'Local'
+);
+                       
+$g_dayofweek = array
+(
+       'Mon' => 1,
+       'Tue' => 2,
+       'Wed' => 3,
+       'Thu' => 4,
+       'Fri' => 5,
+       'Sat' => 6,
+       'Sun' => 7
+);
 
 function comic_admin_data(&$image, &$censor, &$override, &$remote, &$filesize)
 {
@@ -68,8 +77,8 @@
        $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)."' "
+                     .' data_date=' . date('Ymd') . ','
+                     ." data_imageurl='" 
.$GLOBALS['phpgw']->db->db_addslashes($comic_url).'"'
                      .' WHERE data_id='.intval($data_id), __LINE__, __FILE__);
        
        $GLOBALS['phpgw']->db->unlock();
@@ -81,22 +90,22 @@
     $status = STD_SUCCESS;
 
     /**************************************************************************
-     * check to see if already "snarfed" today
+     * check to see if already 'snarfed' today
      *************************************************************************/
-    if ($GLOBALS['phpgw']->db->f("data_date") == (int)date("Ymd"))
+    if ($GLOBALS['phpgw']->db->f('data_date') == (int)date('Ymd'))
     {
         $status = STD_CURRENT;
-        $comic_url = $GLOBALS['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 ($GLOBALS['phpgw']->db->f("data_linkurl") == "")
+        if ($GLOBALS['phpgw']->db->f('data_linkurl') == '')
         {
-            $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);
+            $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);
             
         }
@@ -107,12 +116,12 @@
         /**********************************************************************
          * resolve our comic url, link url and comic day
          *********************************************************************/
-        switch ($GLOBALS['phpgw']->db->f("data_resolve"))
+        switch ($GLOBALS['phpgw']->db->f('data_resolve'))
         {       
-          case "Static":
+          case 'Static':
             $status = comic_resolve_static($comic_url, $comic_day);
             break;
-          case "Remote":
+          case 'Remote':
             $status = comic_resolve_remote($remote_enabled, $fetch_url,
                                            $comic_url, $comic_day);
             break;
@@ -124,36 +133,36 @@
 
 function comic_resolve_linkurl($status, $fetch_url, &$link_url, &$comment)
 {
-    $link_tgt = "_blank";
+    $link_tgt = '_blank';
     
     if ($status != STD_CENSOR)
     {
         /**********************************************************************
          * ultimately want to go where DB says
          *********************************************************************/
-        $link_url = $GLOBALS['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
          *********************************************************************/
-        if ($link_url == "")
+        if ($link_url == '')
         {
             $link_url = $fetch_url;
         
             /******************************************************************
              * still no good, try the base url
              *****************************************************************/
-            if ($link_url == "")
+            if ($link_url == '')
             {
-                $link_url = $GLOBALS['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 == "")
+                if ($link_url == '')
                 {
-                    $link_url = $GLOBALS['phpgw']->link("/comic/index.php");
-                    $link_tgt = "_self";
+                    $link_url = $GLOBALS['phpgw']->link('/comic/index.php');
+                    $link_tgt = '_self';
                 }
                 
             }
@@ -164,11 +173,11 @@
         /**********************************************************************
          * need to break the link url
          *********************************************************************/
-        $link_url = $GLOBALS['phpgw']->link("/comic/index.php");
-        $link_tgt = "_self";
+        $link_url = $GLOBALS['phpgw']->link('/comic/index.php');
+        $link_tgt = '_self';
     }
 
-    $comment =  lang("Visit %1", $link_url);
+    $comment =  lang('Visit %1', $link_url);
     return $link_tgt;
 }
                     
@@ -176,9 +185,9 @@
 {
     $status       = STD_SUCCESS;
 
-    $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);
+    $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);
 
     /**************************************************************************
      * rather straight forward resolve of the url
@@ -194,38 +203,38 @@
     $status       = STD_SUCCESS;
     $unresolved   = True;
     
-    $comic_time   = time() - 
($GLOBALS['phpgw']->db->f("data_daysold")*3600*24);
+    $comic_time   = time() - 
($GLOBALS['phpgw']->db->f('data_daysold')*3600*24);
 
     /**************************************************************************
      * generate the resolver components
      *************************************************************************/
-    switch ($GLOBALS['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/".$GLOBALS['phpgw']->db->f("data_name")."/index.html";
-        $parse_expr = "/comics/"
-            .$GLOBALS['phpgw']->db->f("data_name")
-            ."/archive/images/"
-            .$GLOBALS['phpgw']->db->f("data_name")
-            ."[0-9]*.(gif|jpg)";
+      case 'Comics':
+      case 'Comiczone7':
+      case 'Comiczone10':
+      case 'United':
+        $baseurl    = 'http://www.comics.com';
+        $parseurl   = 
'/comics/'.$GLOBALS['phpgw']->db->f('data_name').'/index.html';
+        $parse_expr = '/comics/'
+            .$GLOBALS['phpgw']->db->f('data_name')
+            .'/archive/images/'
+            .$GLOBALS['phpgw']->db->f('data_name')
+            .'[0-9]*.(gif|jpg)';
         break;
-      case "King":
+      case 'King':
 /*
-        if ($GLOBALS['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 = $GLOBALS['phpgw']->db->f("data_prefix")."?date={Ymd}";
+        $baseurl  = 'http://est.rbma.com/content/';
+        $parseurl = $GLOBALS['phpgw']->db->f('data_prefix').'?date={Ymd}';
 
         comic_resolver(&$parseurl, $comic_time);
 
-        $fetch_url = "http://www.kingfeatures.com/comics/";.
-            $GLOBALS['phpgw']->db->f("data_name");
+        $fetch_url = 'http://www.kingfeatures.com/comics/'.
+            $GLOBALS['phpgw']->db->f('data_name');
 
         $comic_url = $baseurl.$parseurl;
         
@@ -233,39 +242,39 @@
 */
         break;
         
-      case "Toonville":
-        $baseurl    = "http://aolsvc.toonville.aol.com";;
-        $parseurl   = 
"/main.asp?fnum=".$GLOBALS['phpgw']->db->f("data_comicid");
-        $parse_expr = "/[cC]*ontent1/"
-            .$GLOBALS['phpgw']->db->f("data_name")
-            ."/"
-            .$GLOBALS['phpgw']->db->f("data_prefix")
-            ."[0-9]*"
-            ."[g]*.(jpg|gif)";
+      case 'Toonville':
+        $baseurl    = 'http://aolsvc.toonville.aol.com';
+        $parseurl   = 
'/main.asp?fnum='.$GLOBALS['phpgw']->db->f('data_comicid');
+        $parse_expr = '/[cC]*ontent1/'
+            .$GLOBALS['phpgw']->db->f('data_name')
+            .'/'
+            .$GLOBALS['phpgw']->db->f('data_prefix')
+            .'[0-9]*'
+            .'[g]*.(jpg|gif)';
 
         comic_resolver($parse_expr, $comic_time);
         break;
-      case "Creators":
-        $baseurl    = "http://www.comics.com";;
-        $parseurl   = 
"/creators/".$GLOBALS['phpgw']->db->f("data_name")."/index.html";
-        $parse_expr = "/creators/"
-            .$GLOBALS['phpgw']->db->f("data_name")
-            ."/archive/images/"
-            .$GLOBALS['phpgw']->db->f("data_name")
-            ."[0-9]*.(gif|jpg)";
+      case 'Creators':
+        $baseurl    = 'http://www.comics.com';
+        $parseurl   = 
'/creators/'.$GLOBALS['phpgw']->db->f('data_name').'/index.html';
+        $parse_expr = '/creators/'
+            .$GLOBALS['phpgw']->db->f('data_name')
+            .'/archive/images/'
+            .$GLOBALS['phpgw']->db->f('data_name')
+            .'[0-9]*.(gif|jpg)';
         break;
-      case "ComicsPage":
-        if ($GLOBALS['phpgw']->db->f("data_daysold") == 0)
+      case 'ComicsPage':
+        if ($GLOBALS['phpgw']->db->f('data_daysold') == 0)
         {
             $comic_time = time() - (7*3600*24);
         }
-        $baseurl    = "http://www.comicspage.com";;
-        $parseurl   = "/".$GLOBALS['phpgw']->db->f("data_name")."/index.html";
-        $parse_expr = "/daily/"
-            .$GLOBALS['phpgw']->db->f("data_prefix")
-            ."/{Ymd}"
-            .$GLOBALS['phpgw']->db->f("data_prefix")
-            ."-a.gif";
+        $baseurl    = 'http://www.comicspage.com';
+        $parseurl   = '/'.$GLOBALS['phpgw']->db->f('data_name').'/index.html';
+        $parse_expr = '/daily/'
+            .$GLOBALS['phpgw']->db->f('data_prefix')
+            .'/{Ymd}'
+            .$GLOBALS['phpgw']->db->f('data_prefix')
+            .'-a.gif';
         comic_resolver($parse_expr, $comic_time);
 
         $fetch_url  = $baseurl.$parseurl;
@@ -274,25 +283,25 @@
 
         $unresolved = False;
         break;
-      case "Ucomics":
-        $baseurl    = "http://images.ucomics.com";;
-        $parseurl   = "/comics/"
-            .$GLOBALS['phpgw']->db->f("data_prefix")
-            ."/{Y}/"
-            .$GLOBALS['phpgw']->db->f("data_prefix")
-            ."{ymd}.gif";
+      case 'Ucomics':
+        $baseurl    = 'http://images.ucomics.com';
+        $parseurl   = '/comics/'
+            .$GLOBALS['phpgw']->db->f('data_prefix')
+            .'/{Y}/'
+            .$GLOBALS['phpgw']->db->f('data_prefix')
+            .'{ymd}.gif';
         comic_resolver($parseurl, $comic_time);
 
-        $fetch_url  = $GLOBALS['phpgw']->db->f("data_linkurl");
+        $fetch_url  = $GLOBALS['phpgw']->db->f('data_linkurl');
 
         $comic_url  = $baseurl.$parseurl;
 
         $unresolved = False;
         break;
       default:
-        $baseurl      = $GLOBALS['phpgw']->db->f("data_baseurl");
-        $parseurl     = $GLOBALS['phpgw']->db->f("data_parseurl");
-        $parse_expr   = $GLOBALS['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);
 
@@ -321,7 +330,7 @@
         }
     }
     
-    $comic_day    = substr(date("D", $comic_time),0,2);
+    $comic_day    = substr(date('D', $comic_time),0,2);
     
     return $status;
 }
@@ -335,47 +344,47 @@
     /**************************************************************************
      * get all of our resolver fields
      *************************************************************************/
-    if (preg_match_all("/{[A-Za-z0-9\-]*}/", $myurl, $strings))
+    if (preg_match_all('/{[A-Za-z0-9\-]*}/', $myurl, $strings))
     {
         /**********************************************************************
          * replace matches
          *********************************************************************/
         for ($loop = 0; $loop < sizeof($strings[0]); $loop++)
         {
-            $repl_str = "";
+            $repl_str = '';
             
             switch($strings[0][$loop])
             {
               /****************************************************************
                * date components of the url
                ***************************************************************/
-              case "{y}":
-                $repl_str  = date("y", $comic_time);
+              case '{y}':
+                $repl_str  = date('y', $comic_time);
                 break;
-              case "{m}":
-                $repl_str  = date("m", $comic_time);
+              case '{m}':
+                $repl_str  = date('m', $comic_time);
                 break;
-              case "{d}":
-                $repl_str  = date("d", $comic_time);
+              case '{d}':
+                $repl_str  = date('d', $comic_time);
                 break;
-              case "{Ml}":
-                $repl_str = date("M", $comic_time);
+              case '{Ml}':
+                $repl_str = date('M', $comic_time);
                 $repl_str = strtolower($repl_str);
                 break;
-              case "{Y}":
-                $repl_str = date("Y", $comic_time);
+              case '{Y}':
+                $repl_str = date('Y', $comic_time);
                 break;
-              case "{ym}":
-                $repl_str = date("ym", $comic_time);
+              case '{ym}':
+                $repl_str = date('ym', $comic_time);
                 break;
-              case "{ymd}":
-                $repl_str = date("ymd", $comic_time);
+              case '{ymd}':
+                $repl_str = date('ymd', $comic_time);
                 break;
-              case "{Ymd}":
-                $repl_str = date("Ymd", $comic_time);
+              case '{Ymd}':
+                $repl_str = date('Ymd', $comic_time);
                 break;
-              case "{day}":
-                $day = date("D", $comic_time);
+              case '{day}':
+                $day = date('D', $comic_time);
                 $repl_str = $g_dayofweek[$day];
                 break;
                 
@@ -413,7 +422,7 @@
          *********************************************************************/
         for($index=0;($index < $lines && (!$status));$index++)
         {
-            if (eregi("forbidden", $file[$index]))
+            if (eregi('forbidden', $file[$index]))
             {
                 $status = STD_FORBIDDEN;
                 break;
@@ -437,8 +446,8 @@
 function comic_snarf(&$comic_url, $filesize)
 {
     $status = STD_SUCCESS;
-    $filename   = "images/" . $GLOBALS['phpgw']->db->f("data_name") . 
substr($comic_url,-4);
-    $filename_w = PHPGW_SERVER_ROOT."/comic/".$filename;
+    $filename   = 'images/' . $GLOBALS['phpgw']->db->f('data_name') . 
substr($comic_url,-4);
+    $filename_w = PHPGW_SERVER_ROOT.'/comic/'.$filename;
     
     /**************************************************************************
      * get our image or fail
@@ -454,7 +463,7 @@
          *********************************************************************/
         // for($index=0;($index < 10 && (!$status));$index++)
         // {
-            // if (eregi("forbidden", $file[$index]))
+            // if (eregi('forbidden', $file[$index]))
             // {
                 // $status = STD_FORBIDDEN;
             // }
@@ -467,14 +476,14 @@
             /******************************************************************
              * if succeed, put it in our local file
              *****************************************************************/
-            if ($fp = fopen($filename_w,"w"))
+            if ($fp = fopen($filename_w,'w'))
             {
                 fwrite($fp, $file);
                 
                 fclose($fp);
             
-                $comic_url = $GLOBALS['phpgw_info']["server"]["webserver_url"]
-                    ."/comic/"
+                $comic_url = $GLOBALS['phpgw_info']['server']['webserver_url']
+                    .'/comic/'
                     .$filename;
             }
             else
@@ -500,10 +509,10 @@
     switch ($image_location)
     {
       case 'S':
-        $image_size = "_sm";
+        $image_size = '_sm';
         break;
       default:
-        $image_size = "";
+        $image_size = '';
         break;
     }
 
@@ -513,25 +522,25 @@
     switch ($status)
     {
       case STD_CENSOR:
-        $label = "_censor";
+        $label = '_censor';
         break;
       case STD_FORBIDDEN:
-        $label = "_forbid";
+        $label = '_forbid';
         break;
       default:
-        $label = "";
+        $label = '';
         break;
     }
     
     /**************************************************************************
      * compose the error comic url
      *************************************************************************/
-    $comic_url = $GLOBALS['phpgw_info']["server"]["webserver_url"]
-        ."/".$GLOBALS['phpgw_info']["flags"]["currentapp"]
-        ."/images/template"
+    $comic_url = $GLOBALS['phpgw_info']['server']['webserver_url']
+        .'/'.$GLOBALS['phpgw_info']['flags']['currentapp']
+        .'/images/template'
         .$label
         .$image_size
-        .".png";
+        .'.png';
 }
 
 function comic_match_bar($start, $end, $indexlimit,
@@ -543,14 +552,14 @@
       case 1:
         {
             $showstring =
-                lang("showing %1", $comics_displayed);
+                lang('showing %1', $comics_displayed);
         }
         break;
 
       default:
         {
             $showstring =
-                lang("showing %1 (%2 - %3 of %4)",
+                lang('showing %1 (%2 - %3 of %4)',
                      $comics_displayed,
                      ($start + 1), $end, $indexlimit);
         }
@@ -558,19 +567,19 @@
     }
 
     $matchs_tpl = $GLOBALS['phpgw']->template;
-    $matchs_tpl->set_unknowns("remove");
-    $matchs_tpl->set_file(matchs, "matchs.comic.tpl");
+    $matchs_tpl->set_unknowns('remove');
+    $matchs_tpl->set_file(matchs, 'matchs.comic.tpl');
     $matchs_tpl->
         set_var
         (array(next_matchs_left  =>
-               
$GLOBALS['phpgw']->nextmatchs->left("/comic/index.php",$start,$indexlimit,""),
+               
$GLOBALS['phpgw']->nextmatchs->left('/comic/index.php',$start,$indexlimit,''),
                next_matchs_label => $showstring,
                next_matchs_right =>
-               
$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");
+               
$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');
 }
 
 function comic_display($comic_list, $comic_scale, $comic_perpage,
@@ -607,12 +616,12 @@
          * start our template
          *********************************************************************/
         $comic_tpl = $GLOBALS['phpgw']->template;
-        $comic_tpl->set_unknowns("remove");
+        $comic_tpl->set_unknowns('remove');
         $comic_tpl->set_file(
-            array(tableleft   => "table.left.tpl",
-                  tableright  => "table.right.tpl",
-                  tablecenter => "table.center.tpl",
-                  row         => "row.common.tpl"));
+            array(tableleft   => 'table.left.tpl',
+                  tableright  => 'table.right.tpl',
+                  tablecenter => 'table.center.tpl',
+                  row         => 'row.common.tpl'));
         
         /**********************************************************************
          * where to start and end
@@ -644,10 +653,10 @@
 
             if ($GLOBALS['phpgw']->db->next_record())
             {
-                $comic_censorlvl = $GLOBALS['phpgw']->db->f("data_censorlvl");
-                $comic_day       = substr(date("D", time()),0,2);   /* today */
-                $comic_url       = "";
-                $fetch_url       = "";
+                $comic_censorlvl = $GLOBALS['phpgw']->db->f('data_censorlvl');
+                $comic_day       = substr(date('D', time()),0,2);   /* today */
+                $comic_url       = '';
+                $fetch_url       = '';
 
                 /**************************************************************
                  * if user meets censorship criteria
@@ -680,7 +689,7 @@
                 /**************************************************************
                  * if comic_day is not in days allowed flag error
                  *************************************************************/
-                if (!strstr($GLOBALS['phpgw']->db->f("data_pubdays"), 
$comic_day))
+                if (!strstr($GLOBALS['phpgw']->db->f('data_pubdays'), 
$comic_day))
                 {
                     $status = STD_WARNING;
                     $end++;
@@ -697,13 +706,13 @@
                 /**************************************************************
                  * need to determine image size & location
                  *************************************************************/
-                if ($comic_day == "Su")
+                if ($comic_day == 'Su')
                 {
-                    $image_width = $GLOBALS['phpgw']->db->f("data_swidth");
+                    $image_width = $GLOBALS['phpgw']->db->f('data_swidth');
                 }
                 else
                 {
-                    $image_width = $GLOBALS['phpgw']->db->f("data_width");
+                    $image_width = $GLOBALS['phpgw']->db->f('data_width');
                 }
                 if ( $image_width <= 300)
                 {
@@ -741,17 +750,17 @@
                         switch ($image_location)
                         {
                           case 'S':
-                            $image_width   = "280";
+                            $image_width   = '280';
                             break;
                           default:
-                            $image_width   = "580";
+                            $image_width   = '580';
                             break;
                         }
                         break;
                       default:
                         if ($image_width <= 0)
                         {
-                            $image_width   = "100%";
+                            $image_width   = '100%';
                         }
                         break;
                     }
@@ -766,22 +775,22 @@
                         {
                           case COMIC_RIGHT:
                             $sideno = COMIC_LEFT;
-                            $side = "right";
+                            $side = 'right';
                             break;
                           case COMIC_LEFT:
                             $sideno = COMIC_RIGHT;
-                            $side = "left";
+                            $side = 'left';
                             break;
                         }
                         break;
                       default:
-                        $side = "center";
+                        $side = 'center';
                         break;
                     }
                     
-                    $name = lang("%1 by %2 (%3)",
-                                 $GLOBALS['phpgw']->db->f("data_title"),
-                                 $GLOBALS['phpgw']->db->f("data_author"),
+                    $name = lang('%1 by %2 (%3)',
+                                 $GLOBALS['phpgw']->db->f('data_title'),
+                                 $GLOBALS['phpgw']->db->f('data_author'),
                                  $index+1);
                     
                     $comic_tpl->
@@ -793,9 +802,9 @@
                           link_tgt    => $link_tgt,
                           comment     => $comment,
                           name        => $name,
-                          th_bg       => 
$GLOBALS['phpgw_info']["theme"]["th_bg"],
-                          th_text     => 
$GLOBALS['phpgw_info']["theme"]["th_text"]));
-                    $comic_tpl->parse($side."_part", "row", TRUE);
+                          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++;
 
@@ -820,12 +829,12 @@
         /**********************************************************************
          * get the template body
          *********************************************************************/
-        $comic_tpl->parse(TABLELEFT,   "tableleft");
-        $comic_tpl->parse(TABLERIGHT,  "tableright");
-        $comic_tpl->parse(TABLECENTER, "tablecenter");
-        $comic_left_c   = $comic_tpl->get("TABLELEFT");
-        $comic_right_c  = $comic_tpl->get("TABLERIGHT");
-        $comic_center_c = $comic_tpl->get("TABLECENTER");
+        $comic_tpl->parse(TABLELEFT,   'tableleft');
+        $comic_tpl->parse(TABLERIGHT,  'tableright');
+        $comic_tpl->parse(TABLECENTER, 'tablecenter');
+        $comic_left_c   = $comic_tpl->get('TABLELEFT');
+        $comic_right_c  = $comic_tpl->get('TABLERIGHT');
+        $comic_center_c = $comic_tpl->get('TABLECENTER');
         
         if ($end > $indexlimit)
         {
@@ -835,13 +844,13 @@
         /**********************************************************************
          * finish out the template with the next matchs bar
          *********************************************************************/
-        $temp = 
$GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"];
-        $GLOBALS['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);
-        $GLOBALS['phpgw_info']["user"]["preferences"]["common"]["maxmatchs"]
+        $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']
             = $temp;
     }
 }
@@ -860,7 +869,7 @@
     /**************************************************************************
      * determine what comic to get
      *************************************************************************/
-    $comic_day = substr(date("D", time()),0,2);   /* today */
+    $comic_day = substr(date('D', time()),0,2);   /* today */
 
     /**************************************************************************
      * try to successfully get a random comic match...
@@ -910,11 +919,12 @@
     /**************************************************************************
      * process valid comic data
      *************************************************************************/
+       $end = 0;
     if ($GLOBALS['phpgw']->db->next_record())
     {
-        $comic_censorlvl = $GLOBALS['phpgw']->db->f("data_censorlvl");
-        $comic_url       = "";
-        $fetch_url       = "";
+        $comic_censorlvl = $GLOBALS['phpgw']->db->f('data_censorlvl');
+        $comic_url       = '';
+        $fetch_url       = '';
         
         /**********************************************************************
          * if user meets censorship criteria
@@ -947,10 +957,10 @@
         /**********************************************************************
          * if comic_day is not in days allowed flag error
          *********************************************************************/
-        if (!strstr($GLOBALS['phpgw']->db->f("data_pubdays"), $comic_day))
+        if (!strstr($GLOBALS['phpgw']->db->f('data_pubdays'), $comic_day))
         {
             $status = STD_WARNING;
-            $end++;
+            ++$end;
         }
                 
         /**********************************************************************
@@ -964,13 +974,13 @@
         /**********************************************************************
          * need to determine image size & location
          *********************************************************************/
-        if ($comic_day == "Su")
+        if ($comic_day == 'Su')
         {
-            $image_width = $GLOBALS['phpgw']->db->f("data_swidth");
+            $image_width = $GLOBALS['phpgw']->db->f('data_swidth');
         }
         else
         {
-            $image_width = $GLOBALS['phpgw']->db->f("data_width");
+            $image_width = $GLOBALS['phpgw']->db->f('data_width');
         }
         if ( $image_width <= 300)
         {
@@ -1008,34 +1018,34 @@
                 switch ($image_location)
                 {
                   case 'S':
-                    $image_width   = "350";
+                    $image_width   = '350';
                     break;
                   default:
-                    $image_width   = "700";
+                    $image_width   = '700';
                     break;
                 }
                 break;
               default:
                 if ($image_width <= 0)
                 {
-                    $image_width   = "100%";
+                    $image_width   = '100%';
                 }
                 break;
             }
 
-            $name = lang("%1 by %2",
-                         $GLOBALS['phpgw']->db->f("data_title"),
-                         $GLOBALS['phpgw']->db->f("data_author"));
+            $name = lang('%1 by %2',
+                         $GLOBALS['phpgw']->db->f('data_title'),
+                         $GLOBALS['phpgw']->db->f('data_author'));
 
             /******************************************************************
              * our template
              *****************************************************************/
             $comic_tpl = CreateObject('phpgwapi.Template',
                                       
$GLOBALS['phpgw']->common->get_tpl_dir('comic'));
-            $comic_tpl->set_unknowns("remove");
+            $comic_tpl->set_unknowns('remove');
             $comic_tpl->set_file(
-                array(table       => "table.front.tpl",
-                      row         => "row.common.tpl"));
+                array(table       => 'table.front.tpl',
+                      row         => 'row.common.tpl'));
             $comic_tpl->
                 set_var
                 (array
@@ -1045,10 +1055,10 @@
                   link_tgt    => $link_tgt,
                   comment     => $comment,
                   name        => $name,
-                  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");
+                  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');
             
             /******************************************************************
              * put the url and date in the database
@@ -1064,7 +1074,7 @@
 
 function template_options($app_template, &$options_c, &$images_c)
 {
-    $appname = $GLOBALS['phpgw_info']["flags"]["currentapp"];
+    $appname = $GLOBALS['phpgw_info']['flags']['currentapp'];
     
     $directory = opendir(PHPGW_SERVER_ROOT . SEP. $appname . SEP . 'templates' 
. SEP . 'default' . SEP);
 
@@ -1072,7 +1082,7 @@
 
     while ($filename = readdir($directory))
     {
-        if (eregi("format[0-9]{2}.$appname.tpl", $filename, $match))
+        if (eregi('format[0-9]{2}.$appname.tpl', $filename, $match))
         {
             $file_ar[$index] = $match[0];
             $index++;
@@ -1083,42 +1093,42 @@
 
     for ($loop=0; $loop < $index; $loop++)
     {
-        eregi("[0-9]{2}", $file_ar[$loop], $tid);
-        eregi("format[0-9]{2}", $file_ar[$loop], $tname);
+        eregi('[0-9]{2}', $file_ar[$loop], $tid);
+        eregi('format[0-9]{2}', $file_ar[$loop], $tname);
 
-        $template_id = "$tid[0]";
-        $template_name["$template_id"] = $tname[0];
+        $template_id = '$tid[0]';
+        $template_name['$template_id'] = $tname[0];
     }
 
     /**************************************************************************
      * start our template
      *************************************************************************/
     $image_tpl = $GLOBALS['phpgw']->template;
-    $image_tpl->set_unknowns("remove");
+    $image_tpl->set_unknowns('remove');
     $image_tpl->set_file(
-        array(options => "option.common.tpl",
-              rows    => "row.images.tpl",
-              cells   => "cell.images.tpl"));
+        array(options => 'option.common.tpl',
+              rows    => 'row.images.tpl',
+              cells   => 'cell.images.tpl'));
 
     if(count($template_name))
     {
        asort($template_name);
          while (list($value, $name) = each($template_name))
          {
-             $selected = "";
+             $selected = '';
              if ((int)$value == $app_template)
              {
-                 $selected = "selected";
+                 $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");
+    $options_c = $image_tpl->get('option_list');
     
     if(count($template_name))
     {
@@ -1129,12 +1139,12 @@
        {
            $index--;
         
-           $imgname = $name.".gif";
+           $imgname = $name.'.gif';
 
            $filename_f =
-               $GLOBALS['phpgw']->common->get_image_dir($appname)."/".$imgname;
+               $GLOBALS['phpgw']->common->get_image_dir($appname).'/'.$imgname;
            $filename_a =
-               
$GLOBALS['phpgw']->common->get_image_path($appname)."/".$imgname;
+               
$GLOBALS['phpgw']->common->get_image_path($appname).'/'.$imgname;
 
            if (file_exists($filename_f))
            {
@@ -1142,12 +1152,12 @@
 
                $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");
+               $cells_c = $image_tpl->get('image_row');
             
                $image_tpl->set_var(image_cells, $cells_c);
                $image_tpl->parse(IMAGE_ROWS, rows, TRUE);
@@ -1156,7 +1166,7 @@
            }
         }
     }
-    $images_c = $image_tpl->get("IMAGE_ROWS");
+    $images_c = $image_tpl->get('IMAGE_ROWS');
 }
 
 ?>

Index: hook_home.inc.php
===================================================================
RCS file: /sources/phpgroupware/comic/inc/hook_home.inc.php,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- hook_home.inc.php   20 Jul 2004 23:51:55 -0000      1.10
+++ hook_home.inc.php   28 Dec 2006 04:29:52 -0000      1.11
@@ -9,19 +9,13 @@
   *  option) any later version.                                              *
   \**************************************************************************/
 
-       /* $Id: hook_home.inc.php,v 1.10 2004/07/20 23:51:55 skwashd Exp $ */
+       /* $Id: hook_home.inc.php,v 1.11 2006/12/28 04:29:52 skwashd Exp $ */
 {
-       $d1 = strtolower(substr(PHPGW_APP_INC,0,3));
-       if($d1 == 'htt' || $d1 == 'ftp' )
-       {
-               echo "Failed attempt to break in via an old Security 
Hole!<br>\n";
-               $GLOBALS['phpgw']->common->phpgw_exit();
-       } unset($d1);
 
        $tmp_app_inc = $GLOBALS['phpgw']->common->get_inc_dir('comic');
 
        $GLOBALS['phpgw']->db->query('SELECT * FROM phpgw_comic'
-                               . ' WHERE 
comic_owner='.$GLOBALS['phpgw_info']["user"]["account_id"], __LINE__, __FILE__);
+                               . ' WHERE comic_owner = ' . (int) 
$GLOBALS['phpgw_info']['user']['account_id'], __LINE__, __FILE__);
 
        if ($GLOBALS['phpgw']->db->num_rows())
        {
@@ -33,17 +27,11 @@
 
                if ($data_id != -1)
                {
-                       $title = '<font 
color="#FFFFFF">'.lang('Comic').'</font>';
+                       $title = lang('Comic');
 
                        $portalbox = CreateObject('phpgwapi.listbox',
                                Array(
                                        'title' => $title,
-                                       'primary'       => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                                       'secondary'     => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                                       'tertiary'      => 
$GLOBALS['phpgw_info']['theme']['navbar_bg'],
-                                       'width' => '100%',
-                                       'outerborderwidth'      => '0',
-                                       'header_background_image'       => 
$GLOBALS['phpgw']->common->image('phpgwapi','bg_filler','.png', False)
                                )
                        );
                        $app_id = 
$GLOBALS['phpgw']->applications->name2id('comic');
@@ -56,11 +44,11 @@
                                'edit'          => Array('url'  => 
'/set_box.php', 'app'        => $app_id)
                        );
 
-                       while(list($key,$value) = each($var))
+                       foreach($var as $key => $value)
                        {
                                $portalbox->set_controls($key,$value);
                        }
-                       include($tmp_app_inc . '/functions.inc.php');
+                       include_once($tmp_app_inc . '/functions.inc.php');
                        echo "\r\n".'<!-- start Comic info -->'."\r\n"
                                
.$portalbox->draw(comic_display_frontpage($data_id, $scale, $censor_level))
                                .'<!-- ends Comic info -->'."\r\n";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]