phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] preferences preferences.php, 1.38 changeprofile.php,


From: powerstat
Subject: [Phpgroupware-cvs] preferences preferences.php, 1.38 changeprofile.php, 1.12 index.php, 1.33 changepassword.php, 1.43
Date: Sun, 17 Apr 2005 17:14:00 +0200

Update of preferences

Modified Files:
     Branch: MAIN
            preferences.php lines: +130 -29
            changeprofile.php lines: +19 -19
            index.php lines: +35 -13
            changepassword.php lines: +12 -12

Log Message:
Added phpdocs
checked with php -l and phpdocumentor.
Parses, but is still not complete.

Fixed one php -l syntax bug

====================================================
Index: preferences/preferences.php
diff -u preferences/preferences.php:1.37 preferences/preferences.php:1.38
--- preferences/preferences.php:1.37    Thu Dec 30 11:19:04 2004
+++ preferences/preferences.php Sun Apr 17 15:14:31 2005
@@ -1,15 +1,12 @@
 <?php
-       
/**************************************************************************\
-       * phpGroupWare - Preferences                                            
   *
-       * http://www.phpgroupware.org                                           
   *
-       * --------------------------------------------                          
   *
-       *  This program is free software; you can redistribute it and/or modify 
it *
-       *  under the terms of the GNU General Public License as published by 
the   *
-       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
-       *  option) any later version.                                           
   *
-       
\**************************************************************************/
-
-       /* $Id$ */
+       /**
+       * Preferences
+       *
+       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package preferences
+       * @version $Id$
+       */

        $GLOBALS['phpgw_info']['flags'] = array(
                'noheader'                => True,
@@ -18,6 +15,10 @@
                'currentapp'              => $_GET['appname'],
                'enable_nextmatchs_class' => True
        );
+
+       /**
+        * Include phpgroupware header
+        */
        include('../header.inc.php');

        if ($_POST['cancel'])
@@ -46,6 +47,13 @@

        /* Make things a little easier to follow */
        /* Some places we will need to change this if there in common */
+
+
+       /**
+        * Get application name
+        *
+        * @return string Application name
+        */
        function check_app()
        {
                if ($_GET['appname'] == 'preferences')
@@ -58,6 +66,13 @@
                }
        }

+       /**
+        *
+        *
+        * @param $_appname
+        * @param $preference_name
+        * @return boolean
+        */
        function is_forced_value($_appname,$preference_name)
        {
                if 
(isset($GLOBALS['phpgw']->preferences->forced[$_appname][$preference_name]) && 
$GLOBALS['type'] != 'forced')
@@ -70,6 +85,16 @@
                }
        }

+       /**
+        * Create password box
+        *
+        * @param string $label_name
+        * @param string $preference_name
+        * @param string $help
+        * @param $size
+        * @param $max_size
+        * @return boolean
+        */
        function 
create_password_box($label_name,$preference_name,$help='',$size = '',$max_size 
= '')
        {
                global $user,$forced,$default;
@@ -82,6 +107,18 @@
                
create_input_box($label_name,$preference_name.'][pw',$help,'',$size,$max_size,'password');
        }

+       /**
+        * Create input box
+        *
+        * @param string $label
+        * @param string $name
+        * @param string $help
+        * @param string $default
+        * @param $size
+        * @param $max_size
+        * @param $type
+        * @return boolean
+        */
        function create_input_box($label,$name,$help='',$default='',$size = 
'',$max_size = '',$type='',
                $run_lang=True)
        {
@@ -95,15 +132,15 @@

                if ($type)      // used to specify password
                {
-                       $options = " TYPE='$type'";
+                       $options = " type=\"$type\"";
                }
                if ($size)
                {
-                       $options .= " SIZE='$size'";
+                       $options .= " size=\"$size\"";
                }
                if ($maxsize)
                {
-                       $options .= " MAXSIZE='$maxsize'";
+                       $options .= " maxsize=\"$maxsize\"";
                }

                if (isset($prefs[$name]) || $GLOBALS['type'] != 'user')
@@ -119,15 +156,22 @@
                        {
                                $def_text = 
$GLOBALS['phpgw']->preferences->lang_notify($def_text,$notifys[$name]);
                        }
-                       $def_text = $def_text != '' ? ' <i><font 
size="-1">'.lang('default').':&nbsp;'.$def_text.'</font></i>' : '';
+                       $def_text = ($def_text != '') ? ' <i><font size="-1">' 
. lang('default') . ':&nbsp;' . $def_text . '</font></i>' : '';
                }
-               $t->set_var('row_value',"<input 
name=\"${GLOBALS[type]}[$name]\" 
value=\"".htmlentities($default)."\"$options>$def_text");
+               $t->set_var('row_value',"<input 
name=\"${GLOBALS[type]}[$name]\" value=\"" . htmlentities($default) . 
"\"$options />$def_text");
                $t->set_var('row_name',lang($label));
                $GLOBALS['phpgw']->nextmatchs->template_alternate_row_color($t);

                $t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 
'row',True);
        }

+       /**
+        *
+        *
+        * @param $help
+        * @param boolean $run_lang
+        * @return boolean
+        */
        function process_help($help,$run_lang=True)
        {
                global $t,$show_help,$has_help;
@@ -146,6 +190,14 @@
                return False;
        }

+       /**
+        * Create checkbox
+        *
+        * @param string $label
+        * @param string $name
+        * @param string $help
+        * @param $default
+        */
        function create_check_box($label,$name,$help='',$default='')
        {
                // checkboxes itself can't be use as they return nothing if 
uncheckt !!!
@@ -166,6 +218,13 @@
                ),$help,$default);
        }

+       /**
+        * Create option
+        *
+        * @param string $selected
+        * @param string $values
+        * @return string String with HTML option
+        */
        function create_option_string($selected,$values)
        {
                while (is_array($values) && list($var,$value) = each($values))
@@ -173,13 +232,22 @@
                        $s .= '<option value="' . $var . '"';
                        if ("$var" == "$selected")      // the "'s are 
necessary to force a string-compare
                        {
-                               $s .= ' selected';
+                               $s .= ' selected="selected"';
                        }
                        $s .= '>' . $value . '</option>';
                }
                return $s;
        }

+       /**
+        * Create selectbox
+        *
+        * @param string $label
+        * @param string $name
+        * @param $values
+        * @param string $help
+        * @param string $default
+        */
        function create_select_box($label,$name,$values,$help='',$default='')
        {
                global $t,$prefs;
@@ -220,16 +288,17 @@
                $t->fp('rows',process_help($help) ? 'help_row' : 'row',True);
        }

-       /*!
-       @function create_notify
-       @abstract creates text-area or inputfield with subtitution-variables
-       @syntax 
create_notify($label,$name,$rows,$cols,$help='',$default='',$vars2='')
-       @param $label untranslated label
-       @param $name name of the pref
-       @param $rows, $cols of the textarea or input-box ($rows==1)
-       @param $help untranslated help-text
-       @param $default default-value
-       @param $vars2 array with extra substitution-variables of the form key 
=> help-text
+       /**
+       * Create text-area or inputfield with subtitution-variables
+       *
+       * @param string $label Untranslated label
+       * @param string $name Name of the preference
+       * @param $rows Row of the textarea or input-box ($rows==1)
+       * @param $cols Column of the textarea or input-box
+       * @param string $help Untranslated help-text
+       * @param string $default Default-value
+       * @param $vars2 array with extra substitution-variables of the form key 
=> help-text
+       * @param boolean $subst_help
        */
        function 
create_notify($label,$name,$rows,$cols,$help='',$default='',$vars2='',$subst_help=True)
        {
@@ -251,7 +320,7 @@
                        foreach($vars as $var => $var_help)
                        {
                                $lname = ($lname = lang($var)) == $var.'*' ? 
$var : $lname;
-                               $help .= "<br>\n".'<b>$$'.$lname.'$$</b>: 
'.$var_help;
+                               $help .= "<br />\n" . '<b>$$' . $lname . 
'$$</b>: ' . $var_help;
                        }
                        $help .= "</p>\n";
                }
@@ -265,6 +334,18 @@
                }
        }

+       /**
+        * Create textarea
+        *
+        * @param string $label
+        * @param string $name
+        * @param $rows
+        * @param $cols
+        * @param string $help
+        * @param string $default
+        * @param boolean $run_lang
+        * @return boolean
+        */
        function 
create_text_area($label,$name,$rows,$cols,$help='',$default='',$run_lang=True)
        {
                global $t,$prefs,$notifys;
@@ -297,6 +378,15 @@
                $t->fp('rows',process_help($help,$run_lang) ? 'help_row' : 
'row',True);
        }

+       /**
+        *
+        *
+        * @param $repository
+        * @param $array
+        * @param $notifys
+        * @param $prefix
+        * @return boolean
+        */
        function process_array(&$repository,$array,$notifys,$prefix='')
        {
                $_appname = check_app();
@@ -367,6 +457,12 @@

        /* Makes the ifs a little nicer, plus ... this will change once the ACL 
manager is in place */
        /* and is able to create less powerfull admins.  This will handle the 
ACL checks for that (jengo) */
+
+       /**
+        * Test if user is admin
+        *
+        * @return boolean True when user is admin otherwise false
+        */
        function is_admin()
        {
                global $prefix;
@@ -381,6 +477,11 @@
                }
        }

+       /**
+        *
+        *
+        * @param string $header
+        */
        function show_list($header = '&nbsp;')
        {
                global $t,$list_shown;
@@ -543,7 +644,7 @@
        $t->set_var('lang_cancel', lang('cancel'));
        $t->set_var('show_help',intval($show_help));
        $t->set_var('help_button',$has_help ? '<input type="submit" 
name="toggle_help" value="'.
-               ($show_help ? lang('help off') : lang('help')).'">' : '');
+               ($show_help ? lang('help off') : lang('help')).'" />' : '');

        if (!$list_shown)
        {

====================================================
Index: preferences/changeprofile.php
diff -u preferences/changeprofile.php:1.11 preferences/changeprofile.php:1.12
--- preferences/changeprofile.php:1.11  Thu Dec 30 11:19:04 2004
+++ preferences/changeprofile.php       Sun Apr 17 15:14:31 2005
@@ -1,23 +1,24 @@
 <?php
-  /**************************************************************************\
-  * phpGroupWare - preferences                                               *
-  * http://www.phpgroupware.org                                              *
-  * Written by Joseph Engo <address@hidden>                          *
-  * --------------------------------------------                             *
-  *  This program is free software; you can redistribute it and/or modify it *
-  *  under the terms of the GNU General Public License as published by the   *
-  *  Free Software Foundation; either version 2 of the License, or (at your  *
-  *  option) any later version.                                              *
-  \**************************************************************************/
-
-  /* $Id$ */
+       /**
+       * Preferences - change profile
+       *
+       * @author Joseph Engo <address@hidden>
+       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package preferences
+       * @version $Id$
+       */

        Header('Cache-Control: no-cache');
        Header('Pragma: no-cache');
-       //Header('Expires: Sat, Jan 01 2000 01:01:01 GMT');
+       // Header('Expires: Sat, Jan 01 2000 01:01:01 GMT');

        $phpgw_info = array();
        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'preferences';
+
+       /**
+        * Include phpgroupware header
+        */
        include('../header.inc.php');

        if ($GLOBALS['phpgw_info']['user']['permissions']['anonymous'])
@@ -70,7 +71,7 @@
        $GLOBALS['phpgw']->db->next_record();
 ?>

-  <form method="POST" ENCTYPE="multipart/form-data" action="<?php echo 
$GLOBALS['phpgw']->link('/preferences/changeprofile.php'); ?>">
+  <form method="post" enctype="multipart/form-data" action="<?php echo 
$GLOBALS['phpgw']->link('/preferences/changeprofile.php'); ?>">
    <table border="0">
     <tr>
      <td colspan="2"><?php echo 
$GLOBALS['phpgw']->common->display_fullname($GLOBALS['phpgw_info']['user']['userid'],$GLOBALS['phpgw_info']['user']['firstname'],$GLOBALS['phpgw_info']['user']['lastname']);
 ?></td>
@@ -80,13 +81,13 @@
      <td>Title:</td>
      <td><input name="title" value="<?php echo 
$GLOBALS['phpgw']->db->f('title'); ?>"></td>
      <td rowspan="2">
-      <img src="<?php echo $GLOBALS['phpgw']->link('/hr/view_image.php','con=' 
. $GLOBALS['phpgw_info']['user']['con']); ?>" width="100" height="120">
+      <img src="<?php echo $GLOBALS['phpgw']->link('/hr/view_image.php','con=' 
. $GLOBALS['phpgw_info']['user']['con']); ?>" width="100" height="120" />
      </td>
     </tr>

     <tr>
      <td>Phone number:</td>
-     <td><input name="phone_number" value="<?php echo 
$GLOBALS['phpgw']->db->f('phone_number'); ?>"></td>
+     <td><input name="phone_number" value="<?php echo 
$GLOBALS['phpgw']->db->f('phone_number'); ?>" /></td>
     </tr>

     <tr>
@@ -96,14 +97,13 @@

     <tr>
      <td>Picture:</td>
-     <td><input type="file" name="picture"><br>Note: Pictures will be resized 
to 100x120.</td>
+     <td><input type="file" name="picture" /><br />Note: Pictures will be 
resized to 100x120.</td>
     </tr>

     <tr>
-     <td colspan="3" align="center"><input type="submit" name="submit" 
value="Submit">
+     <td colspan="3" align="center"><input type="submit" name="submit" 
value="Submit" />
     </tr>
    </table>
-
   </form>
 <?php
        $GLOBALS['phpgw']->common->phpgw_footer();

====================================================
Index: preferences/index.php
diff -u preferences/index.php:1.32 preferences/index.php:1.33
--- preferences/index.php:1.32  Thu Dec 30 11:19:04 2004
+++ preferences/index.php       Sun Apr 17 15:14:31 2005
@@ -1,19 +1,20 @@
 <?php
-       
/**************************************************************************\
-       * phpGroupWare - preferences                                            
   *
-       * http://www.phpgroupware.org                                           
   *
-       * Written by Joseph Engo <address@hidden>                          *
-       * --------------------------------------------                          
   *
-       *  This program is free software; you can redistribute it and/or modify 
it *
-       *  under the terms of the GNU General Public License as published by 
the   *
-       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
-       *  option) any later version.                                           
   *
-       
\**************************************************************************/
-
-       /* $Id$ */
+       /**
+       * Preferences
+       *
+       * @author Joseph Engo <address@hidden>
+       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package preferences
+       * @version $Id$
+       */

        $phpgw_info = array();
        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'preferences';
+
+       /**
+        * Include phpgroupware header
+        */
        include('../header.inc.php');

        $pref_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL);
@@ -74,7 +75,12 @@
                
$pref_tpl->set_var('tabs',$GLOBALS['phpgw']->common->create_tabs($tabs,$selected));
        }

-       // This func called by the includes to dump a row header
+       /**
+        * Dump a row header
+        *
+        * @param $appname=''
+        * @param $icon
+        */
        function section_start($appname='',$icon='')
        {
                global $pref_tpl;
@@ -94,6 +100,12 @@
                }
        }

+       /**
+        *
+        *
+        * @param string $pref_link
+        * @param string $pref_text
+        */
        function section_item($pref_link='',$pref_text='')
        {
                global $pref_tpl;
@@ -112,6 +124,9 @@
                $pref_tpl->parse('rows','link_row',True);
        }

+       /**
+        *
+        */
        function section_end()
        {
                global $pref_tpl;
@@ -119,6 +134,13 @@
                $pref_tpl->parse('rows','spacer_row',True);
        }

+       /**
+        *
+        *
+        * @param $appname
+        * @param $file
+        * @param $file2
+        */
        function display_section($appname,$file,$file2=False)
        {
                if ($file2)

====================================================
Index: preferences/changepassword.php
diff -u preferences/changepassword.php:1.42 preferences/changepassword.php:1.43
--- preferences/changepassword.php:1.42 Thu Dec 30 11:19:04 2004
+++ preferences/changepassword.php      Sun Apr 17 15:14:31 2005
@@ -1,16 +1,13 @@
 <?php
-       
/**************************************************************************\
-       * phpGroupWare - preferences                                            
   *
-       * http://www.phpgroupware.org                                           
   *
-       * Written by Joseph Engo <address@hidden>                          *
-       * --------------------------------------------                          
   *
-       *  This program is free software; you can redistribute it and/or modify 
it *
-       *  under the terms of the GNU General Public License as published by 
the   *
-       *  Free Software Foundation; either version 2 of the License, or (at 
your  *
-       *  option) any later version.                                           
   *
-       
\**************************************************************************/
-
-       /* $Id$ */
+       /**
+       * Preferences - change password
+       *
+       * @author Joseph Engo <address@hidden>
+       * @copyright Copyright (C) 2000-2005 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @package preferences
+       * @version $Id$
+       */

        $GLOBALS['phpgw_info']['flags'] = array(
                'noheader'   => True,
@@ -18,6 +15,9 @@
                'currentapp' => 'preferences'
        );

+       /**
+        * Include phpgroupware header
+        */
        include('../header.inc.php');

        $n_passwd   = $_POST['n_passwd'];






reply via email to

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