phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] comic/preferences.php, 1.9


From: nomail
Subject: [Phpgroupware-cvs] comic/preferences.php, 1.9
Date: Wed, 21 Jul 2004 01:51:54 +0200

Update of /comic
Modified Files:
        Branch: 
          preferences.php

date: 2004/07/20 23:51:54;  author: skwashd;  state: Exp;  lines: +73 -48

Log Message:
merge from 16 and image clean up
=====================================================================
Index: comic/preferences.php
diff -u comic/preferences.php:1.8 comic/preferences.php:1.9
--- comic/preferences.php:1.8   Sat Mar 10 08:28:38 2001
+++ comic/preferences.php       Tue Jul 20 23:51:54 2004
@@ -12,9 +12,14 @@
 
     /* $Id$ */
 {
-    $phpgw_info["flags"]["currentapp"] = "comic";
+    $GLOBALS['phpgw_info']['flags']['currentapp'] = 'comic';
 
-    include("../header.inc.php");
+    include('../header.inc.php');
+
+    if(!$GLOBALS['phpgw_info']['user']['apps']['preferences'])
+    {
+       Header('Location: ' . $GLOBALS['phpgw']->link('/home.php') );
+    }
 
     $title             = lang("Daily Comic Preferences");
     $layout_label      = lang("Display Layout");
@@ -31,13 +36,31 @@
     $done_label        = lang("Done");
     $comic_size        = 8;
     
-    $actionurl         = $phpgw->link('/comic/preferences.php');
-    $doneurl           = $phpgw->link('/preferences/index.php');
+    $actionurl         = $GLOBALS['phpgw']->link('/comic/preferences.php');
+    $doneurl           = $GLOBALS['phpgw']->link('/preferences/index.php') . 
'#comic';
     $message           = "";
     
-    if ($submit)
+    $scale_enabled     = intval($_POST['scale_enabled']);
+    $perpage           = intval($_POST['perpage']);
+    $frontpage         = intval($_POST['frontpage']);
+    $fpscale_enabled   = intval($_POST['fpscale_enabled']);
+    $censor_level      = intval($_POST['censor_level']);
+    $comic_template    = intval($_POST['comic_template']);
+    $comic_id          = intval($_POST['comic_id']);
+    
+    if( isset($_POST['data_ids']) && count($_POST['data_ids']) )
+    {
+               foreach($_POST['data_ids'] as $id)
+               {
+                       $data_ids[] = intval($id);
+               }
+    }
+
+
+    
+    if ($_POST['submit'])
     {
-        $message = lang("Comic Preferences Updated");
+       $message = lang("Comic Preferences Updated");
 
         if ($data_ids)
         {
@@ -48,42 +71,44 @@
             $data_ids = "";
         }
         
-        $phpgw->db->lock("phpgw_comic");
-        $phpgw->db->query("update phpgw_comic set "
-                          ."comic_list='".$data_ids."', "
-                          ."comic_scale='".$scale_enabled."', "
-                          ."comic_perpage='".$perpage."', "
-                          ."comic_frontpage='".$frontpage."', "
-                          ."comic_fpscale='".$fpscale_enabled."', "
-                          ."comic_censorlvl='".$censor_level."', "
-                          ."comic_template='".$comic_template."' "
-                          ."WHERE comic_id='".$comic_id."'");
-        $phpgw->db->unlock();
+        $sql = 'UPDATE phpgw_comic SET'
+               . " comic_list='" . $data_ids . "',"
+               . ' comic_scale=' . $scale_enabled . ','
+               . ' comic_perpage=' . $perpage . ','
+               . ' comic_frontpage=' . $frontpage . ','
+               . ' comic_fpscale=' . $fpscale_enabled . ','
+               . ' comic_censorlvl=' . $censor_level . ','
+               . ' comic_template=' . $comic_template
+               . ' WHERE comic_id=' . $comic_id;
+       
+       $GLOBALS['phpgw']->db->lock('phpgw_comic');
+       $GLOBALS['phpgw']->db->query($sql, __LINE__, __FILE__);
+        $GLOBALS['phpgw']->db->unlock();
     }
 
-    $phpgw->db->query("select * from phpgw_comic "
+    $GLOBALS['phpgw']->db->query("select * from phpgw_comic "
                       ."WHERE comic_owner='"
-                      .$phpgw_info["user"]["account_id"]."'");
+                      .$GLOBALS['phpgw_info']["user"]["account_id"]."'");
 
-    if ($phpgw->db->num_rows() == 0)
+    if ($GLOBALS['phpgw']->db->num_rows() == 0)
     {
-        $phpgw->db->query("insert into phpgw_comic (comic_owner) values ".
-                          "('".$phpgw_info["user"]["account_id"]."')");
-        $phpgw->db->query("select * from phpgw_comic "
+        $GLOBALS['phpgw']->db->query("insert into phpgw_comic (comic_owner) 
values ".
+                          
"('".$GLOBALS['phpgw_info']["user"]["account_id"]."')");
+        $GLOBALS['phpgw']->db->query("select * from phpgw_comic "
                           ."WHERE comic_owner='"
-                          .$phpgw_info["user"]["account_id"]."'");
+                          .$GLOBALS['phpgw_info']["user"]["account_id"]."'");
     }
 
-    $phpgw->db->next_record();
+    $GLOBALS['phpgw']->db->next_record();
 
-    $comic_id        = $phpgw->db->f("comic_id");
-    $data_ids        = explode(":", $phpgw->db->f("comic_list"));
-    $scale_enabled   = $phpgw->db->f("comic_scale");
-    $perpage         = $phpgw->db->f("comic_perpage");
-    $frontpage       = $phpgw->db->f("comic_frontpage");
-    $fpscale_enabled = $phpgw->db->f("comic_fpscale");
-    $censor_level    = $phpgw->db->f("comic_censorlvl");
-    $comic_template  = $phpgw->db->f("comic_template");
+    $comic_id        = $GLOBALS['phpgw']->db->f("comic_id");
+    $data_ids        = explode(":", $GLOBALS['phpgw']->db->f("comic_list"));
+    $scale_enabled   = $GLOBALS['phpgw']->db->f("comic_scale");
+    $perpage         = $GLOBALS['phpgw']->db->f("comic_perpage");
+    $frontpage       = $GLOBALS['phpgw']->db->f("comic_frontpage");
+    $fpscale_enabled = $GLOBALS['phpgw']->db->f("comic_fpscale");
+    $censor_level    = $GLOBALS['phpgw']->db->f("comic_censorlvl");
+    $comic_template  = $GLOBALS['phpgw']->db->f("comic_template");
     
     $indexlimit = count($data_ids);
 
@@ -99,7 +124,7 @@
 
     template_options($comic_template, &$t_options_c, &$t_images_c);
     
-    $prefs_tpl = $phpgw->template;
+    $prefs_tpl = $GLOBALS['phpgw']->template;
     $prefs_tpl->set_unknowns("remove");
     $prefs_tpl->set_file(
         array(message   => "message.common.tpl",
@@ -163,30 +188,30 @@
         $prefs_tpl->parse(fpage_list, "frontpage", TRUE);
     }
 
-    $phpgw->db->query("select * from phpgw_comic_data "
+    $GLOBALS['phpgw']->db->query("select * from phpgw_comic_data "
                       ."where data_enabled='T' order by data_name");
 
     $index = 0;
     
     asort($data_ids);
     
-    while ($phpgw->db->next_record())
+    while ($GLOBALS['phpgw']->db->next_record())
     {
         $selected = "";
-        if ($phpgw->db->f("data_id") == $frontpage)
+        if ($GLOBALS['phpgw']->db->f("data_id") == $frontpage)
         {
             $selected = "selected";
         }
 
         $prefs_tpl->set_var
             (array(OPTION_SELECTED => $selected,
-                   OPTION_VALUE    => $phpgw->db->f("data_id"),
-                   OPTION_NAME     => $phpgw->db->f("data_title")));
+                   OPTION_VALUE    => $GLOBALS['phpgw']->db->f("data_id"),
+                   OPTION_NAME     => $GLOBALS['phpgw']->db->f("data_title")));
         $prefs_tpl->parse(fpage_list, "frontpage", TRUE);
 
 
         $selected = "";
-        if ($phpgw->db->f("data_id") == $data_ids[$index])
+        if ($GLOBALS['phpgw']->db->f("data_id") == $data_ids[$index])
         {
             $index++;
             
@@ -194,12 +219,12 @@
         }
 
         $name = sprintf("%s - %s",
-                        $phpgw->db->f("data_resolve"),
-                        $phpgw->db->f("data_title"));
+                        $GLOBALS['phpgw']->db->f("data_resolve"),
+                        $GLOBALS['phpgw']->db->f("data_title"));
         
         $prefs_tpl->set_var
             (array(OPTION_SELECTED => $selected,
-                   OPTION_VALUE    => $phpgw->db->f("data_id"),
+                   OPTION_VALUE    => $GLOBALS['phpgw']->db->f("data_id"),
                    OPTION_NAME     => $name));
         $prefs_tpl->parse(comic_list, "comic", TRUE);
     }
@@ -235,8 +260,8 @@
                  censor_options   => $censor_c,
                  comic_options    => $comic_c,
                  comic_id         => $comic_id,
-                 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"]));
 
     $prefs_tpl->parse(message_part, "message");
     $message_c = $prefs_tpl->get("message_part");
@@ -247,7 +272,7 @@
     /**************************************************************************
      * pull it all together
      *************************************************************************/
-    $body_tpl = $phpgw->template;
+    $body_tpl = $GLOBALS['phpgw']->template;
     $body_tpl->set_unknowns("remove");
     $body_tpl->set_file(body, "prefs.common.tpl");
     $body_tpl->set_var(array(preferences_message => $message_c,
@@ -255,7 +280,7 @@
     $body_tpl->parse(BODY, "body");
     $body_tpl->p("BODY");
 
-    $phpgw->common->phpgw_footer();
+    $GLOBALS['phpgw']->common->phpgw_footer();
 }
 
 ?>




reply via email to

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