fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9030] registration


From: Sigurd Nes
Subject: [Fmsystem-commits] [9030] registration
Date: Sat, 24 Mar 2012 20:11:29 +0000

Revision: 9030
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9030
Author:   sigurdne
Date:     2012-03-24 20:11:29 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
registration

Modified Paths:
--------------
    trunk/registration/inc/class.bomanagefields.inc.php
    trunk/registration/inc/class.boreg.inc.php
    trunk/registration/inc/class.somanagefields.inc.php
    trunk/registration/inc/class.soreg.inc.php
    trunk/registration/inc/class.uireg.inc.php
    trunk/registration/setup/phpgw_no.lang

Modified: trunk/registration/inc/class.bomanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.bomanagefields.inc.php 2012-03-22 14:27:06 UTC 
(rev 9029)
+++ trunk/registration/inc/class.bomanagefields.inc.php 2012-03-24 20:11:29 UTC 
(rev 9030)
@@ -125,18 +125,14 @@
                        $fields = $this->so->get_field_list();
 
                        $rarray = array();
-                       if (is_array ($fields))
+                       foreach ($fields as $num => $field_info)
                        {
-                               reset ($fields);
-                               while (list ($num, $field_info) = each 
($fields))
-                               {
-                                       /* Convert the stored database values 
into comma delimited form */
+                               /* Convert the stored database values into 
comma delimited form */
 
-                                       $field_values = unserialize 
(base64_decode ($field_info['field_values']));
-                                       $fields[$num]['field_values'] = 
$field_values;
+                               $field_values = unserialize (base64_decode 
($field_info['field_values']));
+                               $fields[$num]['field_values'] = $field_values;
 
-                                       $rarray[$field_info['field_name']] = 
$fields[$num];
-                               }
+                               $rarray[$field_info['field_name']] = 
$fields[$num];
                        }
 
                        return $rarray;

Modified: trunk/registration/inc/class.boreg.inc.php
===================================================================
--- trunk/registration/inc/class.boreg.inc.php  2012-03-22 14:27:06 UTC (rev 
9029)
+++ trunk/registration/inc/class.boreg.inc.php  2012-03-24 20:11:29 UTC (rev 
9030)
@@ -117,6 +117,19 @@
                                $missing_fields[] = 'passwd_confirm';
                        }
 
+                       if($r_reg['passwd'])
+                       {
+                               $account        = new phpgwapi_user();
+                               try
+                               {
+                                       
$account->validate_password($r_reg['passwd']);
+                               }
+                               catch(Exception $e)
+                               {
+                                       $errors[] = $e->getMessage();
+                               }
+                       }
+
                        reset ($this->fields);
 
                        foreach ( $this->fields as $field_name => $field_info )

Modified: trunk/registration/inc/class.somanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.somanagefields.inc.php 2012-03-22 14:27:06 UTC 
(rev 9029)
+++ trunk/registration/inc/class.somanagefields.inc.php 2012-03-24 20:11:29 UTC 
(rev 9030)
@@ -28,27 +28,15 @@
 
                function update_field ($field_info)
                {
+
                        if ($field_info['field_values'])
                        {
                                $field_info['field_values'] = base64_encode 
(serialize ($field_info['field_values']));
                        }
 
-                       $sql = "UPDATE phpgw_reg_fields SET ";
+                       $value_set      = 
$this->db->validate_update($field_info);
 
-                       reset ($this->db_fields);
-                       foreach ( $this->db_fields as $num => $field )
-                       {
-                               if ($num)
-                               {
-                                       $sql .= ", ";
-                               }
-                               $sql .= "$field='$field_info[$field]'";
-                       }
-
-                       $sql .= " WHERE field_name='$field_info[field_name]'";
-                       $rv = $this->db->query ($sql);
-
-                       return $rv;
+                       return $this->db->query("UPDATE phpgw_reg_fields SET 
{$value_set} WHERE field_name='{$field_info[field_name]}'",__LINE__,__FILE__);
                }
 
                function insert_field ($field_info)
@@ -58,34 +46,15 @@
                                $field_info['field_values'] = base64_encode 
(serialize ($field_info['field_values']));
                        }
 
-                       $sql = "INSERT INTO phpgw_reg_fields (";
-                       $sql2 = "(";
+                       $sql = "INSERT INTO phpgw_reg_fields (" . implode(', ', 
array_keys($field_info)) .  ') VALUES (' . 
$this->db->validate_insert(array_values($field_info)) . ')';
+                       $rv = $this->db->query($sql,__LINE__,__FILE__);
 
-                       reset ($this->db_fields);
-                       while (list ($num, $field) = each ($this->db_fields))
-                       {
-                               if ($num)
-                               {
-                                       $sql .= ', ';
-                                       $sql2 .= ', ';
-                               }
-                               $sql .= $field;
-                               $sql2 .= "'$field_info[$field]'";
-                       }
-
-                       $sql  .= ') VALUES ';
-                       $sql2 .= ')';
-
-                       $sql .= $sql2;
-
-                       $rv = $this->db->query ($sql);
-
                        return $rv;
                }
 
                function remove_field ($field_info)
                {
-                       $rv = $this->db->query ("DELETE FROM phpgw_reg_fields 
WHERE field_name='$field_info[field_name]'");
+                       $rv = $this->db->query ("DELETE FROM phpgw_reg_fields 
WHERE field_name='{$field_info[field_name]}'");
 
                        return $rv;
                }
@@ -93,19 +62,7 @@
                function get_field_list ()
                {
                        $rarray = array();
-                       $sql = "SELECT ";
-
-                       reset ($this->db_fields);
-                       while (list ($num, $db_field_name) = each 
($this->db_fields))
-                       {
-                               if ($num)
-                               {
-                                       $sql .= ', ';
-                               }
-                               $sql .= $db_field_name;
-                       }
-
-                       $sql .= " FROM phpgw_reg_fields ORDER BY field_order";
+                       $sql = 'SELECT  ' . implode(', ', $this->db_fields) . ' 
FROM phpgw_reg_fields ORDER BY field_order';
                        $this->db->query ($sql);
                        while ($this->db->next_record ())
                        {

Modified: trunk/registration/inc/class.soreg.inc.php
===================================================================
--- trunk/registration/inc/class.soreg.inc.php  2012-03-22 14:27:06 UTC (rev 
9029)
+++ trunk/registration/inc/class.soreg.inc.php  2012-03-24 20:11:29 UTC (rev 
9030)
@@ -34,13 +34,16 @@
                function account_exists($account_lid)
                {
                        $this->db->transaction_begin();
-                       $this->db->query("SELECT count(*) as cnt FROM 
phpgw_reg_accounts WHERE reg_lid='$account_lid'",__LINE__,__FILE__);
-                       $this->db->next_record();
+                       $this->db->query("SELECT reg_lid FROM 
phpgw_reg_accounts WHERE reg_lid='$account_lid'",__LINE__,__FILE__);
+                       if($this->db->next_record())
+                       {
+                               return true;
+                       }
 
                        if ($GLOBALS['phpgw']->accounts->exists($account_lid) 
|| $this->db->f('cnt'))
                        {
                                $this->db->transaction_commit();
-                               return True;
+                               return true;
                        }
                        else
                        {
@@ -48,7 +51,7 @@
                                $this->db->query("insert into 
phpgw_reg_accounts values ('','$account_lid','','" . time() . 
"')",__LINE__,__FILE__);
                                $this->db->transaction_commit();
                                
$GLOBALS['phpgw']->session->appsession('loginid','registration',$account_lid);
-                               return False;
+                               return false;
                        }
                }
 
@@ -90,7 +93,15 @@
                        $subject = $this->config['subject_confirm'] ? 
lang($this->config['subject_confirm']) : lang('Account registration');
                        $noreply = $this->config['mail_nobody'] ? ('No reply <' 
. $this->config['mail_nobody'] . '>') : ('No reply <noreply@' . 
$GLOBALS['phpgw_info']['server']['hostname'] . '>');
 
-                       
$smtp->msg('email',$fields['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply,'','html');
+                       try
+                       {
+                               
$smtp->msg('email',$fields['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply,'','html');
+                       }
+                       catch(Exception $e)
+                       {
+                                //won't show because of redirect...
+                                //_debug_array($e->getMessage());
+                       }
 
                        return $this->reg_id;
                }

Modified: trunk/registration/inc/class.uireg.inc.php
===================================================================
--- trunk/registration/inc/class.uireg.inc.php  2012-03-22 14:27:06 UTC (rev 
9029)
+++ trunk/registration/inc/class.uireg.inc.php  2012-03-24 20:11:29 UTC (rev 
9030)
@@ -209,16 +209,15 @@
                        }
 
                        $this->template->set_block ('form', 
'other_fields_proto', 'other_fields_list');
-
                        reset ($this->fields);
-                       while (list ($num, $field_info) = each ($this->fields))
+                       foreach ($this->fields as $num => $field_info)
                        {
                                $input_field = $this->get_input_field 
($field_info, $post_values);
                                $var = array (
                                        'missing_indicator' => 
$missing[$field_info['field_name']] ? '<font color="#CC0000">*</font>' : '',
                                        'bold_start'  => 
$field_info['field_required'] == 'Y' ? '<b>' : '',
                                        'bold_end'    => 
$field_info['field_required'] == 'Y' ? '</b>' : '',
-                                       'lang_displayed_text' => lang 
($field_info['field_text']),
+                                       'lang_displayed_text' => ltrim(lang 
($field_info['field_text']),'!'),
                                        'input_field' => $input_field
                                );
 
@@ -314,8 +313,6 @@
 
                function get_input_field ($field_info, $post_values)
                {
-//                     global $r_regs, $o_regs;
-
                        $post_value = $post_values[$field_info['field_name']];
 
                        $name = $field_info['field_name'];
@@ -368,11 +365,11 @@
                                else
                                {
                                        $rstring = '<select name="' . $a . '[' 
. $name . ']"><option value=""> </option>';
-                                       while (list (,$value) = each ($values))
+                                       foreach ($values as $value)
                                        {
                                                $value = trim ($value);
 
-                                               unset ($selected);
+                                               $selected = '';
                                                if ($value == $post_value)
                                                {
                                                        $selected = "selected";

Modified: trunk/registration/setup/phpgw_no.lang
===================================================================
--- trunk/registration/setup/phpgw_no.lang      2012-03-22 14:27:06 UTC (rev 
9029)
+++ trunk/registration/setup/phpgw_no.lang      2012-03-24 20:11:29 UTC (rev 
9030)
@@ -2,8 +2,11 @@
 account registration   registration    no      Ny bruker
 address        registration    no      Adresse
 after you enter your username, instructions to change your password will be 
sent to you by e-mail to the address you gave when you registered. registration 
   no      Etter at du angir ditt brukernavn, vil du få en e-post til den 
adressen du oppga ved registrering for å resette passordet
+Birthday       registration    no      Fødselsdag
 change password for user       registration    no      Bytt passord for user
 checkbox       registration    no      Checkbox
+City   registration    no      Poststed
+Country        registration    no      Land
 current fields:        registration    no      Gjeldende felt:
 dropdown       registration    no      Dropdown
 enter your new password        registration    no      Skriv inn ditt nye 
passord
@@ -24,8 +27,9 @@
 textarea       registration    no      Tekstfelt
 the passwords you entered don't match  registration    no      Passordene du 
anga er ikke like
 the two passwords are not the same     registration    no      Passordene er 
ikke de samme
+Select One     registration    no      Velg fra liste
 type   registration    no      Type
-update/add     registration    no      Update/Add
+update/add     registration    no      Oppdater/Legg til
 Username       registration    no      Brukernavn
 values (for dropdown only; comma separated)    registration    no      Verdi 
(bare for Dropdown; comma separert)
 wrong session  registration    no      Feil session




reply via email to

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