[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8973] registration: make it work
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8973] registration: make it work |
Date: |
Mon, 12 Mar 2012 18:36:00 +0000 |
Revision: 8973
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8973
Author: sigurdne
Date: 2012-03-12 18:35:59 +0000 (Mon, 12 Mar 2012)
Log Message:
-----------
registration: make it work
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.uimanagefields.inc.php
trunk/registration/inc/class.uireg.inc.php
trunk/registration/main.php
trunk/registration/setup/setup.inc.php
trunk/registration/templates/base/config.tpl
trunk/registration/templates/base/fields.tpl
Added Paths:
-----------
trunk/registration/inc/class.menu.inc.php
trunk/registration/inc/hook_config.inc.php
Modified: trunk/registration/inc/class.bomanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.bomanagefields.inc.php 2012-03-10 10:50:48 UTC
(rev 8972)
+++ trunk/registration/inc/class.bomanagefields.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
@@ -28,12 +28,12 @@
function bomanagefields()
{
$this->so = CreateObject
('registration.somanagefields');
- $this->fields = $this->get_field_list ();
+ $this->fields = $this->get_field_list();
}
function save_fields ($fields)
{
- $current_fields = $this->get_field_list ();
+ $current_fields = $this->get_field_list();
$name_transforms = array (
'email' => 'email',
@@ -120,11 +120,11 @@
}
}
- function get_field_list ()
+ function get_field_list()
{
- $fields = $this->so->get_field_list ();
+ $fields = $this->so->get_field_list();
- $rarray = array ();
+ $rarray = array();
if (is_array ($fields))
{
reset ($fields);
Modified: trunk/registration/inc/class.boreg.inc.php
===================================================================
--- trunk/registration/inc/class.boreg.inc.php 2012-03-10 10:50:48 UTC (rev
8972)
+++ trunk/registration/inc/class.boreg.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
@@ -20,8 +20,9 @@
{
var $template;
var $bomanagefields;
- var $fields;
+ var $fields = array();
var $so;
+ var $config;
var $public_functions = array(
'step1' => True,
'step2' => True,
@@ -35,12 +36,16 @@
{
$this->so = createobject ('registration.soreg');
$this->bomanagefields = createobject
('registration.bomanagefields');
- $this->fields = $this->bomanagefields->get_field_list
();
+ $this->fields = $this->bomanagefields->get_field_list();
+ $c = createobject('phpgwapi.config','registration');
+ $c->read();
+ $this->config = $c->config_data;
}
function step1()
{
- global $config, $r_reg;
+ $r_reg = phpgw::get_var('r_reg');
+ $o_reg = phpgw::get_var('o_reg');
$so = createobject('registration.soreg');
@@ -68,20 +73,29 @@
function step2()
{
- global $config, $r_reg, $o_reg, $PHP_AUTH_USER,
$PHP_AUTH_PW;
+ if(!$r_reg = phpgw::get_var('r_reg'))
+ {
+ $r_reg = array();
+ }
+ if(!$o_reg = phpgw::get_var('o_reg'))
+ {
+ $o_reg = array();
+ }
+ $fields = array();
+
//echo '<pre>'; print_r($r_reg); echo '</pre>';
- if ($config['password_is'] == 'http')
+ if ($this->config['password_is'] == 'http')
{
- $r_reg['passwd'] = $r_reg['passwd_confirm'] =
$PHP_AUTH_PW;
+ $r_reg['passwd'] = $r_reg['passwd_confirm'] =
$_SERVER['PHP_AUTH_PW'];
}
- if (($config['display_tos']) && ! $r_reg['tos_agree'])
+ if (($this->config['display_tos']) && !
$r_reg['tos_agree'])
{
$missing_fields[] = 'tos_agree';
}
- while (list($name,$value) = each($r_reg))
+ foreach ( $r_reg as $name => $value )
{
if (! $value)
{
@@ -104,7 +118,8 @@
}
reset ($this->fields);
- while (list (,$field_info) = each ($this->fields))
+
+ foreach ( $this->fields as $field_name => $field_info )
{
$name = $field_info['field_name'];
$text = $field_info['field_text'];
@@ -208,8 +223,8 @@
function step4()
{
- global $reg_id;
-
+// global $reg_id;
+ $reg_id = phpgw::get_var('reg_id');
$so = createobject('registration.soreg');
$ui = createobject('registration.uireg');
$reg_info = $so->valid_reg($reg_id);
@@ -233,8 +248,7 @@
//
function lostpw1()
{
- global $r_reg;
-
+ $r_reg = phpgw::get_var('r_reg');
$so = createobject('registration.soreg');
if (! $r_reg['loginid'])
@@ -249,7 +263,7 @@
if(! is_array($errors))
{
- $error = $so->lostpw1($r_reg['loginid']);
+ $error = $so->lostpw1($r_reg['loginid']);
if($error)
{
$errors[] = $error;
@@ -273,7 +287,8 @@
//
function lostpw2()
{
- global $reg_id;
+// global $reg_id;
+ $reg_id = phpgw::get_var('reg_id');
$so = createobject('registration.soreg');
$ui = createobject('registration.uireg');
@@ -296,19 +311,20 @@
//
function lostpw3()
{
- global $r_reg;
+// global $r_reg;
+ $r_reg = phpgw::get_var('r_reg');
$lid =
$GLOBALS['phpgw']->session->appsession('loginid','registration');
if(!$lid) {
$error[] = lang('Wrong session');
}
- if ($r_reg[passwd] != $r_reg[passwd_2])
+ if ($r_reg['passwd'] != $r_reg['passwd_2'])
{
$errors[] = lang('The two passwords are not the
same');
}
- if (! $r_reg[passwd])
+ if (! $r_reg['passwd'])
{
$errors[] = lang('You must enter a password');
}
@@ -316,7 +332,7 @@
if(! is_array($errors))
{
$so = createobject('registration.soreg');
- $so->lostpw3($lid, $r_reg[passwd]);
+ $so->lostpw3($lid, $r_reg['passwd']);
}
$ui = createobject('registration.uireg');
@@ -333,40 +349,36 @@
return True;
}
- function check_select_username ()
+ function check_select_username()
{
- global $config, $PHP_AUTH_USER;
-
- if ($config['username_is'] == 'choice')
+ if ($this->config['username_is'] == 'choice')
{
return True;
}
- elseif ($config['username_is'] == 'http')
+ elseif ($this->config['username_is'] == 'http')
{
- if (!$PHP_AUTH_USER)
+ if (!$_SERVER['PHP_AUTH_USER'])
{
return "HTTP username is not set";
}
else
{
- $GLOBALS['phpgw']->redirect
($GLOBALS['phpgw']->link ('/registration/main.php',
'menuaction=registration.boreg.step1&r_reg[loginid]=' . $PHP_AUTH_USER));
+ $GLOBALS['phpgw']->redirect
($GLOBALS['phpgw']->link ('/registration/main.php',
'menuaction=registration.boreg.step1&r_reg[loginid]=' .
$_SERVER['PHP_AUTH_USER']));
}
}
return True;
}
- function check_select_password ()
+ function check_select_password()
{
- global $config, $PHP_AUTH_PW;
-
- if ($config['password_is'] == 'choice')
+ if ($this->config['password_is'] == 'choice')
{
return True;
}
- elseif ($config['password_is'] == 'http')
+ elseif ($this->config['password_is'] == 'http')
{
- if (!$PHP_AUTH_PW)
+ if (!$_SERVER['PHP_AUTH_PW'])
{
return "HTTP password is not set";
}
Added: trunk/registration/inc/class.menu.inc.php
===================================================================
--- trunk/registration/inc/class.menu.inc.php (rev 0)
+++ trunk/registration/inc/class.menu.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
@@ -0,0 +1,54 @@
+<?php
+ /**
+ * phpGroupWare - registration
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2003-2005 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
+ * @package registration
+ * @subpackage core
+ * @version $Id: class.menu.inc.php 4683 2010-01-30 17:16:00Z sigurd $
+ */
+
+ /**
+ * Description
+ * @package registration
+ */
+
+ class registration_menu
+ {
+ /**
+ * Get the menus for the registration
+ *
+ * @return array available menus for the current user
+ */
+ public function get_menu()
+ {
+ $incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
'registration';
+
+ $menus['toolbar'] = array();
+
+ if ( $GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin')
+ || $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'registration'))
+ {
+ $menus['admin'] = array
+ (
+ 'index' => array
+ (
+ 'text' =>
lang('Configuration'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'registration') )
+ ),
+ 'fields' => array
+ (
+ 'text' =>
$GLOBALS['phpgw']->translation->translate('Manage Fields', array(), true),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'registration.uimanagefields.admin') )
+ )
+ );
+ }
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
+ return $menus;
+ }
+ }
Modified: trunk/registration/inc/class.somanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.somanagefields.inc.php 2012-03-10 10:50:48 UTC
(rev 8972)
+++ trunk/registration/inc/class.somanagefields.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
@@ -21,7 +21,7 @@
function somanagefields()
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db = & $GLOBALS['phpgw']->db;
$this->db_fields = array ('field_name', 'field_text',
'field_type', 'field_values', 'field_required', 'field_order');
}
@@ -36,7 +36,7 @@
$sql = "UPDATE phpgw_reg_fields SET ";
reset ($this->db_fields);
- while (list ($num, $field) = each ($this->db_fields))
+ foreach ( $this->db_fields as $num => $field )
{
if ($num)
{
@@ -92,6 +92,7 @@
function get_field_list ()
{
+ $rarray = array();
$sql = "SELECT ";
reset ($this->db_fields);
@@ -114,4 +115,3 @@
return $rarray;
}
}
-?>
Modified: trunk/registration/inc/class.soreg.inc.php
===================================================================
--- trunk/registration/inc/class.soreg.inc.php 2012-03-10 10:50:48 UTC (rev
8972)
+++ trunk/registration/inc/class.soreg.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
@@ -5,6 +5,7 @@
* This application written by Joseph Engo <address@hidden> *
* Modified by Jason Wies (Zone) <address@hidden> *
* Modified by Loic Dachary <address@hidden>
*
+ * Modified by Sigurd Nes <address@hidden>
*
* --------------------------------------------
*
* Funding for this program was provided by http://www.checkwithmom.com
*
* --------------------------------------------
*
@@ -20,31 +21,32 @@
{
var $reg_id;
var $db;
+ var $config;
- function soreg()
+ function __construct()
{
- $this->db = $GLOBALS['phpgw']->db;
+ $this->db = & $GLOBALS['phpgw']->db;
+ $c = createobject('phpgwapi.config','registration');
+ $c->read();
+ $this->config = $c->config_data;
}
function account_exists($account_lid)
{
- $this->db->lock('phpgw_reg_accounts');
- $this->db->query("select count(*) as cnt from
phpgw_reg_accounts where reg_lid='$account_lid'",__LINE__,__FILE__);
+ $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();
- $GLOBALS['phpgw']->db->lock('phpgw_accounts');
if ($GLOBALS['phpgw']->accounts->exists($account_lid)
|| $this->db->f('cnt'))
{
- $GLOBALS['phpgw']->db->unlock();
- $this->db->unlock();
+ $this->db->transaction_commit();
return True;
}
else
{
- $GLOBALS['phpgw']->db->unlock();
// To prevent race conditions, reserve the
account_lid
$this->db->query("insert into
phpgw_reg_accounts values ('','$account_lid','','" . time() .
"')",__LINE__,__FILE__);
- $this->db->unlock();
+ $this->db->transaction_commit();
$GLOBALS['phpgw']->session->appsession('loginid','registration',$account_lid);
return False;
}
@@ -52,20 +54,14 @@
function step2($fields)
{
- global $config, $SERVER_NAME;
-
$smtp = createobject('phpgwapi.send');
- // We are not going to use link(), because we may not
have the same sessionid by that time
- // If we do, it will not affect it
- $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . "/registration/main.php";
-
$this->reg_id = md5(time() . $account_lid .
$GLOBALS['phpgw']->common->randomstring(32));
$account_lid =
$GLOBALS['phpgw']->session->appsession('loginid','registration');
- $GLOBALS['phpgw']->db->query("update phpgw_reg_accounts
set reg_id='" . $this->reg_id . "', reg_dla='"
+ $this->db->query("UPDATE phpgw_reg_accounts SET
reg_id='" . $this->reg_id . "', reg_dla='"
. time() . "', reg_info='" .
base64_encode(serialize($fields))
- . "' where
reg_lid='$account_lid'",__LINE__,__FILE__);
+ . "' WHERE
reg_lid='$account_lid'",__LINE__,__FILE__);
$GLOBALS['phpgw']->template->set_file(array(
'message' => 'confirm_email.tpl'
@@ -81,18 +77,20 @@
$GLOBALS['phpgw']->template->set_var
('lastname', $fields['n_family'] . ' ');
}
- $GLOBALS['phpgw']->template->set_var
('activate_url',$url . '?menuaction=registration.boreg.step4®_id='.
$this->reg_id);
- if ($config['support_email'])
+ $url =
$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>
'registration.boreg.step4', 'reg_id'=> $this->reg_id),false,true);
+
$GLOBALS['phpgw']->template->set_var('activate_url',"</br><a
href='$url'>Link.</a></br>");
+
+ if ($this->config['support_email'])
{
$GLOBALS['phpgw']->template->set_var
('support_email_text', lang ('Report all problems and abuse to'));
- $GLOBALS['phpgw']->template->set_var
('support_email', $config['support_email']);
+ $GLOBALS['phpgw']->template->set_var
('support_email', $this->config['support_email']);
}
- $subject = $config['subject_confirm'] ?
lang($config['subject_confirm']) : lang('Account registration');
- $noreply = $config['mail_nobody'] ? ('No reply <' .
$config['mail_nobody'] . '>') : ('No reply <noreply@' . $SERVER_NAME . '>');
+ $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);
+
$smtp->msg('email',$fields['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply,'','html');
return $this->reg_id;
}
@@ -102,45 +100,70 @@
//
function lostpw1($account_lid)
{
- global $SERVER_NAME, $config;
-
- $url =
$GLOBALS['phpgw_info']['server']['webserver_url'] . "/registration/main.php";
-
$error = '';
-
//
// Remember md5 string sent by mail
//
$reg_id = md5(time() . $account_lid .
$GLOBALS['phpgw']->common->randomstring(32));
- $this->db->query("insert into phpgw_reg_accounts values
('$reg_id','$account_lid','','" . time() . "')",__LINE__,__FILE__);
+ $this->db->query("INSERT INTO phpgw_reg_accounts VALUES
('$reg_id','$account_lid','','" . time() . "')",__LINE__,__FILE__);
//
// Send the mail that will allow to change the password
//
- $GLOBALS['phpgw']->db->query("select * from
phpgw_accounts, phpgw_addressbook where account_lid='$account_lid' and
phpgw_addressbook.lid='*$account_lid*'",__LINE__,__FILE__);
- $GLOBALS['phpgw']->db->next_record();
+ $user_id =
$GLOBALS['phpgw']->accounts->name2id($account_lid);
+ $account_info =
$GLOBALS['phpgw']->accounts->get($user_id);
+
+ $contacts = CreateObject('phpgwapi.contacts');
+
+ $qcols = array
+ (
+ 'n_given' => 'n_given',
+ 'n_family' => 'n_family',
+ 'tel_work' => 'tel_work',
+ 'tel_home' => 'tel_home',
+ 'tel_cell' => 'tel_cell',
+ 'title' => 'title',
+ 'email' => 'email',
+ 'email_home' => 'email_home',
+ );
+
+ $fields =
$contacts->are_users($account_info->person_id, $qcols);
+
+ $this->boaddressbook =
CreateObject('addressbook.boaddressbook');
+ $comms =
$this->boaddressbook->get_comm_contact_data($fields[0]['contact_id']);
+
+ if(is_array($comms) &&
isset($comms[$fields[0]['contact_id']]) )
+ {
+ $fields[0]['tel_work'] =
$comms[$fields[0]['contact_id']]['work phone'];
+ $fields[0]['tel_home'] =
$comms[$fields[0]['contact_id']]['home phone'];
+ $fields[0]['tel_cell'] =
$comms[$fields[0]['contact_id']]['mobile (cell) phone'];
+ $fields[0]['email_home'] =
$comms[$fields[0]['contact_id']]['home email'];
+ }
+
$info = array(
- 'firstname' =>
$GLOBALS['phpgw']->db->f('account_firstname'),
- 'lastname' =>
$GLOBALS['phpgw']->db->f('account_lastname'),
- 'email' => $GLOBALS['phpgw']->db->f('email')
+ 'firstname' => $account_info->firstname,
+ 'lastname' => $account_info->lastname,
+ 'email' =>
$comms[$account_info->person_id]['work email']
);
- if ($GLOBALS['phpgw']->db->f('account_lid'))
+ if ($info['email'])
{
$smtp = createobject('phpgwapi.send');
$GLOBALS['phpgw']->template->set_file(array(
'message' => 'lostpw_email.tpl'
));
+
+ $url =
$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>
'registration.boreg.lostpw2', 'reg_id'=> $reg_id),false,true);
$GLOBALS['phpgw']->template->set_var('firstname',$info['firstname']);
$GLOBALS['phpgw']->template->set_var('lastname',$info['lastname']);
-
$GLOBALS['phpgw']->template->set_var('activate_url',$url .
'?menuaction=registration.boreg.lostpw2®_id=' . $reg_id);
+
$GLOBALS['phpgw']->template->set_var('activate_url',"</br><a
href='$url'>Link.</a></br>");
- $subject = $config['subject_lostpw'] ?
lang($config['subject_lostpw']) : lang('Account password retrieval');
- $noreply = $config['mail_nobody'] ? ('No reply
<' . $config['mail_nobody'] . '>') : ('No reply <noreply@' . $SERVER_NAME .
'>');
+ $subject = $this->config['subject_lostpw'] ?
lang($this->config['subject_lostpw']) : lang('Account password retrieval');
+ $noreply = $this->config['mail_nobody'] ? ('No
reply <' . $this->config['mail_nobody'] . '>') : ('No reply <noreply@' .
$GLOBALS['phpgw_info']['server']['hostname'] . '>');
-
$smtp->msg('email',$info['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply);
+
$smtp->msg('email',$info['email'],$subject,$GLOBALS['phpgw']->template->fp('out','message'),'','','',$noreply,'',
'html');
}
else
{
@@ -155,9 +178,9 @@
//
function lostpw2($account_lid)
{
- $GLOBALS['phpgw']->db->query("select account_id from
phpgw_accounts where account_lid='$account_lid'",__LINE__,__FILE__);
- $GLOBALS['phpgw']->db->next_record();
- $account_id = $GLOBALS['phpgw']->db->f('account_id');
+ $this->db->query("SELECT account_id FROM phpgw_accounts
WHERE account_lid='$account_lid'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $account_id = $this->db->f('account_id');
$GLOBALS['phpgw']->session->appsession('loginid','registration',$account_lid);
$GLOBALS['phpgw']->session->appsession('id','registration',$account_id);
@@ -171,21 +194,21 @@
$auth = createobject('phpgwapi.auth');
$auth->change_password('supposed to be old password',
$passwd, $GLOBALS['phpgw']->session->appsession('id','registration'));
- $GLOBALS['phpgw']->db->query("delete from
phpgw_reg_accounts where reg_lid='$account_lid'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM phpgw_reg_accounts WHERE
reg_lid='$account_lid'",__LINE__,__FILE__);
}
function valid_reg($reg_id)
{
- $GLOBALS['phpgw']->db->query("select * from
phpgw_reg_accounts where reg_id='$reg_id'",__LINE__,__FILE__);
- $GLOBALS['phpgw']->db->next_record();
+ $this->db->query("SELECT * FROM phpgw_reg_accounts
WHERE reg_id='$reg_id'",__LINE__,__FILE__);
+ $this->db->next_record();
- if ($GLOBALS['phpgw']->db->f('reg_id'))
+ if ($this->db->f('reg_id'))
{
return array(
- 'reg_id' =>
$GLOBALS['phpgw']->db->f('reg_id'),
- 'reg_lid' =>
$GLOBALS['phpgw']->db->f('reg_lid'),
- 'reg_info' =>
$GLOBALS['phpgw']->db->f('reg_info'),
- 'reg_dla' =>
$GLOBALS['phpgw']->db->f('reg_dla')
+ 'reg_id' => $this->db->f('reg_id'),
+ 'reg_lid' => $this->db->f('reg_lid'),
+ 'reg_info' => $this->db->f('reg_info'),
+ 'reg_dla' => $this->db->f('reg_dla')
);
}
else
@@ -196,34 +219,52 @@
function delete_reg_info($reg_id)
{
- $this->db->query("delete from phpgw_reg_accounts where
reg_id='$reg_id'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM phpgw_reg_accounts WHERE
reg_id='$reg_id'",__LINE__,__FILE__);
}
function create_account($account_lid,$_reg_info)
{
- global $config, $reg_info;
-
$fields =
unserialize(base64_decode($_reg_info));
- $fields['lid'] = "*$account_lid*";
- $reg_info['lid'] = $account_lid;
- $reg_info['fields'] = $fields;
+ $fields['lid'] = "*$account_lid*";
- $account_id =
$GLOBALS['phpgw_info']['user']['account_id'] =
$GLOBALS['phpgw']->accounts->auto_add($account_lid,$fields['passwd'],True,False,0,'A');
+ $default_group_id = $this->config['default_group_id'];
+
+ $group_id = $default_group_id ? $default_group_id :
$GLOBALS['phpgw']->accounts->name2id('default');
+ if (!$GLOBALS['phpgw']->accounts->exists($account_lid) )
+ {
+ $account = new
phpgwapi_user();
+ $account->lid = $account_lid;
+ $account->firstname = $fields['n_given'];
+ $account->lastname = $fields['n_family'];
+ $account->passwd = $fields['passwd'];
+ $account->enabled = true;
+
+ if ($this->config['trial_accounts'])
+ {
+ $account->expires = time() + ((60 * 60)
* ($this->config['days_until_trial_account_expires'] * 24));
+ }
+ else
+ {
+ $account->expires = -1;
+ }
+
+ $account_id =
$GLOBALS['phpgw']->accounts->create($account, array($group_id), array(),
array());
+ if($account_id)
+ {
+
$GLOBALS['phpgw']->log->write(array('text'=>'I-Notification, user created
%1','p1'=> $account_lid));
+ }
+ }
+
if (!$account_id)
{
return False;
}
- $accounts =
createobject('phpgwapi.accounts',$account_id);
$contacts = createobject('phpgwapi.contacts');
$GLOBALS['phpgw']->db->transaction_begin();
- $accounts->read();
- $accounts->data['firstname'] = $fields['n_given'];
- $accounts->data['lastname'] = $fields['n_family'];
- $accounts->save_repository();
$contact_fields = $fields;
@@ -249,22 +290,13 @@
}
}
+ $contact_fields['work email'] =
$contact_fields['email'];
+ $contact_fields['mobile (cell) phone'] =
$contact_fields['tel_work'];
+
$contacts->add($account_id,$contact_fields,0,'P');
-
+ //$contacts->add_person($contact_fieldl, $account_id);
$GLOBALS['phpgw']->db->transaction_commit();
- $accounts->read();
- if ($config['trial_accounts'])
- {
- $accounts->data['expires'] = time() + ((60 *
60) * ($config['days_until_trial_account_expires'] * 24));
- }
- else
- {
- $accounts->data['expires'] = -1;
- }
- $accounts->data['status'] = 'A';
- $accounts->save_repository();
-
if(@stat(PHPGW_SERVER_ROOT .
'/messenger/inc/hook_registration.inc.php'))
{
include(PHPGW_SERVER_ROOT .
'/messenger/inc/hook_registration.inc.php');
Modified: trunk/registration/inc/class.uimanagefields.inc.php
===================================================================
--- trunk/registration/inc/class.uimanagefields.inc.php 2012-03-10 10:50:48 UTC
(rev 8972)
+++ trunk/registration/inc/class.uimanagefields.inc.php 2012-03-12 18:35:59 UTC
(rev 8973)
@@ -38,18 +38,20 @@
unset ($GLOBALS['phpgw_info']['flags']['noheader']);
unset ($GLOBALS['phpgw_info']['flags']['nonavbar']);
$GLOBALS['phpgw_info']['flags']['noappfooter'] = True;
- $GLOBALS['phpgw']->common->phpgw_header ();
+ $GLOBALS['phpgw']->common->phpgw_header();
+ echo parse_navbar();
$p = $GLOBALS['phpgw']->template;
+ $p->set_root(PHPGW_APP_TPL);
$p->set_file(Array('fields'=>'fields.tpl'));
if (!isset ($message))
{
- $message = get_var('messages',Array('GET'));
+ $message = phpgw::get_var('message',
'string', 'GET');
}
$var = array (
- 'action_url' => $GLOBALS['phpgw']->link
($this->base_url, 'menuaction=registration.uimanagefields.submit'),
+ 'action_url' => $GLOBALS['phpgw']->link
($this->base_url, array('menuaction' => 'registration.uimanagefields.submit')),
'message' => $message,
'lang_current_fields' => lang ('Current
fields:'),
'lang_name_and_shortdesc' => lang ('Name (blank
unless Text, Textarea, Dropdown, Checkbox; else alphanumeric only)'),
@@ -129,7 +131,7 @@
);
$p->set_var ($var);
- $p->parse ('info_list', 'info', True);
+ $p->parse('info_list', 'info', True);
}
/* Add an empty entry line */
@@ -169,7 +171,7 @@
{
$this->bo->check_admin ();
- $post_vars = $GLOBALS['HTTP_POST_VARS'];
+ $post_vars = $_POST;
unset($GLOBALS['phpgw_info']['flags']['noheader']);
unset($GLOBALS['phpgw_info']['flags']['nonavbar']);
@@ -177,7 +179,6 @@
$this->bo->submit ($post_vars);
- Header ('Location: ' . $GLOBALS['phpgw']->link
($this->base_url,
'menuaction=registration.uimanagefields.admin&message=Updated'));
+ $GLOBALS['phpgw']->redirect_link($this->base_url,
array('menuaction'=>'registration.uimanagefields.admin', 'message'=>'Updated'));
}
}
-?>
Modified: trunk/registration/inc/class.uireg.inc.php
===================================================================
--- trunk/registration/inc/class.uireg.inc.php 2012-03-10 10:50:48 UTC (rev
8972)
+++ trunk/registration/inc/class.uireg.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
@@ -22,6 +22,7 @@
var $bomanagefields;
var $fields;
var $bo;
+ var $config;
var $public_functions = array(
'step1' => True,
'step2' => True,
@@ -38,7 +39,8 @@
$this->template = $GLOBALS['phpgw']->template;
$this->bo = createobject ('registration.boreg');
$this->bomanagefields = createobject
('registration.bomanagefields');
- $this->fields = $this->bomanagefields->get_field_list
();
+ $this->fields = $this->bomanagefields->get_field_list();
+ $this->config = $this->bo->config;
}
function set_header_footer_blocks()
@@ -53,7 +55,7 @@
function header()
{
$this->set_header_footer_blocks();
-
$this->template->set_var('lang_header',lang('phpGroupWare - Account
registration'));
+ $this->template->set_var('lang_header',
$GLOBALS['phpgw_info']['server']['system_name'] . ' - ' . lang('Account
registration'));
$this->template->pfp('out','header');
}
@@ -64,16 +66,14 @@
function step1($errors = '',$r_reg = '',$o_reg = '')
{
- global $config;
-
- if ($errors && $config['username_is'] == 'http')
+ if ($errors && $this->config['username_is'] == 'http')
{
$this->simple_screen ('error_general.tpl',
$GLOBALS['phpgw']->common->error_list ($errors));
}
$show_username_prompt = True;
- /* Note that check_select_username () may not return */
- $select_username = $this->bo->check_select_username ();
+ /* Note that check_select_username() may not return */
+ $select_username = $this->bo->check_select_username();
if (!$select_username || is_string ($select_username))
{
$this->simple_screen ('error_general.tpl',
$GLOBALS['phpgw']->common->error_list (array ($select_username)));
@@ -90,7 +90,7 @@
$this->template->set_var('errors',$GLOBALS['phpgw']->common->error_list($errors));
}
-
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php','menuaction=registration.boreg.step1'));
+
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.step1')));
$this->template->set_var('lang_username',lang('Username'));
$this->template->set_var('lang_submit',lang('Submit'));
@@ -101,10 +101,8 @@
function step2($errors = '',$r_reg = '',$o_reg =
'',$missing_fields='')
{
- global $config;
-
$show_password_prompt = True;
- $select_password = $this->bo->check_select_password ();
+ $select_password = $this->bo->check_select_password();
if (is_string ($select_password))
{
$this->simple_screen ('error_general.tpl',
$select_password);
@@ -152,7 +150,7 @@
}
}
-
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php','menuaction=registration.boreg.step2'));
+
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.step2')));
$this->template->set_var('lang_password',lang('Password'));
$this->template->set_var('lang_reenter_password',lang('Re-enter password'));
$this->template->set_var('lang_submit',lang('Submit'));
@@ -181,7 +179,7 @@
$this->template->parse ('other_fields_list',
'other_fields_proto', True);
}
- if ($config['display_tos'])
+ if ($this->config['display_tos'])
{
$this->template->set_var('tos_link',$GLOBALS['phpgw']->link('/registration/main.php',
array('menuaction' => 'registration.uireg.tos')));
$this->template->set_var('lang_tos_agree',lang('I have
read the terms and conditions and agree by them.'));
@@ -215,7 +213,7 @@
$this->template->set_var('errors',$GLOBALS['phpgw']->common->error_list($errors));
}
-
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php','menuaction=registration.boreg.lostpw1'));
+
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.lostpw1')));
$this->template->set_var('lang_explain',lang('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.'));
$this->template->set_var('lang_username',lang('Username'));
$this->template->set_var('lang_submit',lang('Submit'));
@@ -240,7 +238,7 @@
$this->template->set_var('errors',$GLOBALS['phpgw']->common->error_list($errors));
}
-
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php','menuaction=registration.boreg.lostpw3'));
+
$this->template->set_var('form_action',$GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.lostpw3')));
$this->template->set_var('value_username', $lid);
$this->template->set_var('lang_changepassword',lang("Change password for
user"));
$this->template->set_var('lang_enter_password',lang('Enter your new password'));
@@ -268,7 +266,7 @@
function get_input_field ($field_info, $post_values)
{
- global $r_regs, $o_regs;
+// global $r_regs, $o_regs;
$post_value = $post_values[$field_info['field_name']];
@@ -355,12 +353,12 @@
if ($type == 'state')
{
- $rstring = $sbox->list_states ($a . '[' . $name
. ']', $post_value);
+// $rstring = $sbox->list_states ($a . '[' . $name
. ']', $post_value);
}
if ($type == 'country')
{
- $rstring = $sbox->form_select ($post_value, $a
. '[' . $name . ']');
+ $rstring = $sbox->country_select($post_value,
$a . '[' . $name . ']');
}
if ($type == 'birthday')
@@ -392,16 +390,17 @@
function ready_to_activate()
{
- global $config, $reg_id;
+// global $reg_id;
+ $reg_id = phpgw::get_var('reg_id');
- if ($config['activate_account'] == 'email')
+ if ($this->config['activate_account'] == 'email')
{
$this->simple_screen('confirm_email_sent.tpl');
}
else
{
- /* ($config['activate_account'] ==
'immediately') */
-
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/registration/main.php','menuaction=registration.boreg.step4®_id='
. $reg_id));
+ /* ($this->config['activate_account'] ==
'immediately') */
+
$GLOBALS['phpgw']->redirect($GLOBALS['phpgw']->link('/registration/main.php',array('menuaction'=>'registration.boreg.step4',
'reg_id' => $reg_id)));
}
}
Added: trunk/registration/inc/hook_config.inc.php
===================================================================
--- trunk/registration/inc/hook_config.inc.php (rev 0)
+++ trunk/registration/inc/hook_config.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
@@ -0,0 +1,58 @@
+<?php
+ /**
+ * Property - configuration hook
+ *
+ * @author Sigurd Nes <address@hidden>
+ * @copyright Copyright (C) 2012 Free Software Foundation, Inc.
http://www.fsf.org/
+ * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
+ * @package phpgroupware
+ * @subpackage property
+ * @category hooks
+ * @version $Id: hook_config.inc.php 8281 2011-12-13 09:24:03Z sigurdne $
+ */
+
+ /*
+ 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.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+ /**
+ * Get HTML listbox with workorder status that are to be set when
invoice is processed
+ *
+ * @param $config
+ * @return string HTML checkboxes to be placed in a table
+ */
+ function default_group($config)
+ {
+ $groups = $GLOBALS['phpgw']->accounts->get_list('groups');
+
+ $_selected = isset($config['default_group_id']) ?
$config['default_group_id'] : '';
+
+ $out = '<option value="">' . lang('none selected') .
'</option>' . "\n";
+ foreach ( $groups as $group => $label)
+ {
+ $selected = '';
+ if ( $_selected == $group)
+ {
+ $selected = 'selected = "selected"';
+ }
+
+ $out .= <<<HTML
+ <option value='{$group}'{$selected}>{$label}</option>
+HTML;
+ }
+
+ return $out;
+ }
+
Modified: trunk/registration/main.php
===================================================================
--- trunk/registration/main.php 2012-03-10 10:50:48 UTC (rev 8972)
+++ trunk/registration/main.php 2012-03-12 18:35:59 UTC (rev 8973)
@@ -1,192 +1,236 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - Registration
*
- * http://www.phpgroupware.org
*
- * This application written by Joseph Engo <address@hidden> *
- * --------------------------------------------
*
- * Funding for this program was provided by http://www.checkwithmom.com
*
- * --------------------------------------------
*
- * 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$ */
-
- /*
- ** This program is non-standard, we will create and manage our sessions
manually.
- ** We don't want users to be kicked out half way through, and we really
don't need a true
- ** session for it.
- */
-
- $GLOBALS['sessionid'] = get_var('sessionid',Array('COOKIE','GET'));
-
- // Note: This is current not a drop in install, it requires some manual
installation
- // Take a look at the README file
- $domain = 'default';
- $template_set = 'checkwithmom';
-
- if ($menuaction)
- {
- list($app,$class,$method) = explode('.',$menuaction);
- if (! $app || ! $class || ! $method)
- {
- $invaild_data = True;
- }
- }
- else
- {
- $app = 'registration';
- $invaild_data = True;
- }
-
- $phpgw_info['flags'] = array(
- 'noheader' => True,
- 'nonavbar' => True,
- 'noapi' => True,
- 'currentapp' => $app
- );
- include('../header.inc.php');
-
- function CreateObject($classname, $constructor_param = '')
- {
- global $phpgw, $phpgw_info, $phpgw_domain;
- $classpart = explode (".", $classname);
- $appname = $classpart[0];
- $classname = $classpart[1];
- if (!isset($phpgw_info['flags']['included_classes'][$classname])
- || !$phpgw_info['flags']['included_classes'][$classname])
- {
- $phpgw_info['flags']['included_classes'][$classname] =
True;
-
include(PHPGW_INCLUDE_ROOT.'/'.$appname.'/inc/class.'.$classname.'.inc.php');
- }
- if ($constructor_param == '')
- {
- $obj = new $classname;
- }
- else
- {
- $obj = new $classname($constructor_param);
- }
- return $obj;
- }
-
- /*!
- @function lang
- @abstract function to deal with multilanguage support
- */
- function lang($key, $m1='', $m2='', $m3='', $m4='', $m5='', $m6='',
$m7='', $m8='', $m9='', $m10='')
- {
- global $phpgw;
- $vars = array($m1,$m2,$m3,$m4,$m5,$m6,$m7,$m8,$m9,$m10);
- $value = $phpgw->translation->translate($key,$vars);
- return $value;
- }
-
- function get_account_id($account_id = '',$default_id = '')
- {
- global $phpgw, $phpgw_info;
-
- if (gettype($account_id) == 'integer')
- {
- return $account_id;
- }
- elseif ($account_id == '')
- {
- if ($default_id == '')
- {
- return $phpgw_info['user']['account_id'];
- }
- elseif (gettype($default_id) == 'string')
- {
- return $phpgw->accounts->name2id($default_id);
- }
- return intval($default_id);
- }
- elseif (gettype($account_id) == 'string')
- {
- if($phpgw->accounts->exists(intval($account_id)) ==
True)
- {
- return intval($account_id);
- }
- else
- {
- return $phpgw->accounts->name2id($account_id);
- }
- }
- }
-
- $phpgw_info['server'] = $phpgw_domain[$domain];
- $phpgw = createobject('phpgwapi.phpgw');
- $phpgw->db = createobject('phpgwapi.db');
- $phpgw->db->Host = $phpgw_info['server']['db_host'];
- $phpgw->db->Type = $phpgw_info['server']['db_type'];
- $phpgw->db->Database = $phpgw_info['server']['db_name'];
- $phpgw->db->User = $phpgw_info['server']['db_user'];
- $phpgw->db->Password = $phpgw_info['server']['db_pass'];
-
- /* Fill phpgw_info["server"] array */
- $phpgw->db->query("select * from phpgw_config WHERE
config_app='phpgwapi'",__LINE__,__FILE__);
- while ($phpgw->db->next_record())
- {
- $phpgw_info['server'][$phpgw->db->f('config_name')] =
stripslashes($phpgw->db->f('config_value'));
- }
- $phpgw_info['server']['template_set'] = $template_set;
-
- $phpgw->common = createobject('phpgwapi.common');
- $phpgw->auth = createobject('phpgwapi.auth');
- $phpgw->accounts = createobject('phpgwapi.accounts');
- $phpgw->acl = createobject('phpgwapi.acl');
- $phpgw->preferences = createobject('phpgwapi.preferences');
- $phpgw->applications = createobject('phpgwapi.applications');
- $phpgw->hooks = createobject('phpgwapi.hooks');
- $phpgw->session = createobject('phpgwapi.sessions');
-
- $phpgw->common->key = md5($GLOBALS['kp3'] . $GLOBALS['sessionid'] .
$phpgw_info['server']['encryptkey']);
- $phpgw->common->iv = $phpgw_info['server']['mcrypt_iv'];
-
- $cryptovars[0] = $phpgw->common->key;
- $cryptovars[1] = $phpgw->common->iv;
- $phpgw->crypto = createobject('phpgwapi.crypto', $cryptovars);
-
- define('PHPGW_APP_ROOT', $phpgw->common->get_app_dir());
- define('PHPGW_APP_INC', $phpgw->common->get_inc_dir());
- define('PHPGW_APP_TPL', $phpgw->common->get_tpl_dir());
- define('PHPGW_IMAGES', $phpgw->common->get_image_path());
- define('PHPGW_IMAGES_DIR', $phpgw->common->get_image_dir());
-
- $phpgw->template = createobject('phpgwapi.Template',PHPGW_APP_TPL);
- $phpgw->translation = createobject('phpgwapi.translation');
-
- $c = createobject('phpgwapi.config','registration');
- $c->read();
- $config = $c->config_data;
-
- if (! $sessionid)
- {
- $sessionid = $phpgw->session->create($config['anonymous_user']
. '@' . $domain,$config['anonymous_pass']);
- }
- else
- {
- if (! $phpgw->session->verify())
- {
- // Lets hope this works
- $sessionid =
$phpgw->session->create($config['anonymous_user'] . '@' .
$domain,$config['anonymous_pass']);
- }
- }
-
- if ($app && $class)
- {
- $obj = createobject(sprintf('%s.%s',$app,$class));
-
- if ((is_array($obj->public_functions) &&
$obj->public_functions[$method]) && ! $invalid_data)
- {
- eval("\$obj->$method();");
- }
- }
- else
- {
- $_obj = createobject('registration.uireg');
- $_obj->step1();
- }
+<?php
+
/**************************************************************************\
+ * phpGroupWare - Registration
*
+ * http://www.phpgroupware.org
*
+ * This application written by Joseph Engo <address@hidden> *
+ * --------------------------------------------
*
+ * Funding for this program was provided by http://www.checkwithmom.com
*
+ * --------------------------------------------
*
+ * 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$ */
+
+ /*
+ ** This program is non-standard, we will create and manage our sessions
manually.
+ ** We don't want users to be kicked out half way through, and we really
don't need a true
+ ** session for it.
+ */
+
+ // Note: This is current not a drop in install, it requires some manual
installation
+ // Take a look at the README file
+ $domain = 'default';
+ $template_set = 'checkwithmom';
+
+
+ $_GET['domain'] = $domain;
+
+ $GLOBALS['phpgw_info']['flags'] = array(
+ 'noheader' => true,
+ 'nonavbar' => true,
+ 'currentapp' => 'login',
+ 'noapi' => true // this stops header.inc.php to
include phpgwapi/inc/function.inc.php
+ );
+
+ $GLOBALS['phpgw_info']['flags']['session_name'] = 'registration_session';
+ $GLOBALS['phpgw_remote_user_fallback'] = 'sql';
+ include_once('../header.inc.php');
+
+ unset($GLOBALS['phpgw_info']['flags']['noapi']);
+
+ $_domain_info = isset($GLOBALS['phpgw_domain'][$_GET['domain']]) ?
$GLOBALS['phpgw_domain'][$_GET['domain']] : '';
+
+ if(!$_domain_info)
+ {
+ echo "not a valid domain\n";
+ die();
+ }
+ else
+ {
+ $GLOBALS['phpgw_domain'] = array();
+ $GLOBALS['phpgw_domain'][$_GET['domain']] = $_domain_info;
+ }
+
+ include(PHPGW_API_INC.'/functions.inc.php');
+
+
+ // Make sure we're always logged in
+ if (!phpgw::get_var(session_name()) ||
!$GLOBALS['phpgw']->session->verify())
+ {
+
+ $c = createobject('phpgwapi.config','registration');
+ $c->read();
+ $config = $c->config_data;
+//_debug_array($config);die();
+
+ $login = $c->config_data['anonymous_user'];
+ $passwd = $c->config_data['anonymous_pass'];
+ $_POST['submitit'] = "";
+
+ $GLOBALS['sessionid'] =
$GLOBALS['phpgw']->session->create($login, $passwd);
+ if(!$GLOBALS['sessionid'])
+ {
+ $lang_denied = lang('Anonymous access not correctly
configured');
+ if($GLOBALS['phpgw']->session->reason)
+ {
+ $lang_denied =
$GLOBALS['phpgw']->session->reason;
+ }
+ echo <<<HTML
+ <div class="error">$lang_denied</div>
+HTML;
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ }
+ }
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = 'registration';
+
+
/////////////////////////////////////////////////////////////////////////////
+// BEGIN Stuff copied from functions.inc.php
+/////////////////////////////////////////////////////////////////////////////
+
+
if(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['lang']) &&
$GLOBALS['phpgw_info']['user']['preferences']['common']['lang'] !='en')
+ {
+
$GLOBALS['phpgw']->translation->set_userlang($GLOBALS['phpgw_info']['user']['preferences']['common']['lang'],
true);
+ }
+
+ /* A few hacker resistant constants that will be used throught
the program */
+ define('PHPGW_TEMPLATE_DIR',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir', 'phpgwapi'));
+ define('PHPGW_IMAGES_DIR',
ExecMethod('phpgwapi.phpgw.common.get_image_path', 'phpgwapi'));
+ define('PHPGW_IMAGES_FILEDIR',
ExecMethod('phpgwapi.phpgw.common.get_image_dir', 'phpgwapi'));
+ define('PHPGW_APP_ROOT',
ExecMethod('phpgwapi.phpgw.common.get_app_dir'));
+ define('PHPGW_APP_INC',
ExecMethod('phpgwapi.phpgw.common.get_inc_dir'));
+ define('PHPGW_APP_TPL',
ExecMethod('phpgwapi.phpgw.common.get_tpl_dir'));
+ define('PHPGW_IMAGES',
ExecMethod('phpgwapi.phpgw.common.get_image_path'));
+ define('PHPGW_APP_IMAGES_DIR',
ExecMethod('phpgwapi.phpgw.common.get_image_dir'));
+
+
/************************************************************************\
+ * Load the menuaction
*
+
\************************************************************************/
+ $GLOBALS['phpgw_info']['menuaction'] =
phpgw::get_var('menuaction');
+ if(!$GLOBALS['phpgw_info']['menuaction'])
+ {
+ unset($GLOBALS['phpgw_info']['menuaction']);
+ }
+
+ /********* This sets the user variables *********/
+ $GLOBALS['phpgw_info']['user']['private_dir'] =
$GLOBALS['phpgw_info']['server']['files_dir']
+ . '/users/'.$GLOBALS['phpgw_info']['user']['userid'];
+
+ /* This will make sure that a user has the basic default prefs.
If not it will add them */
+ $GLOBALS['phpgw']->preferences->verify_basic_settings();
+
+ /********* Optional classes, which can be disabled for
performance increases *********/
+ while ($phpgw_class_name =
each($GLOBALS['phpgw_info']['flags']))
+ {
+ if (ereg('enable_', $phpgw_class_name[0]))
+ {
+ $enable_class = str_replace('enable_', '',
$phpgw_class_name[0]);
+ $enable_class = str_replace('_class', '',
$enable_class);
+ $GLOBALS['phpgw']->$enable_class =
createObject("phpgwapi.{$enable_class}");
+ }
+ }
+ unset($enable_class);
+ reset($GLOBALS['phpgw_info']['flags']);
+
+
/*************************************************************************\
+ * These lines load up the templates class
*
+
\*************************************************************************/
+ if (
!isset($GLOBALS['phpgw_info']['flags']['disable_Template_class'])
+ ||
!$GLOBALS['phpgw_info']['flags']['disable_Template_class'] )
+ {
+ $GLOBALS['phpgw']->template =
createObject('phpgwapi.Template',PHPGW_APP_TPL);
+ $GLOBALS['phpgw']->xslttpl =
createObject('phpgwapi.xslttemplates',PHPGW_APP_TPL);
+ }
+
+
/*************************************************************************\
+ * Verify that the users session is still active otherwise kick
them out *
+
\*************************************************************************/
+ if ($GLOBALS['phpgw_info']['flags']['currentapp'] != 'home' &&
$GLOBALS['phpgw_info']['flags']['currentapp'] != 'about')
+ {
+ if (!$GLOBALS['phpgw']->acl->check('run',
PHPGW_ACL_READ, $GLOBALS['phpgw_info']['flags']['currentapp']))
+ {
+ $GLOBALS['phpgw']->common->phpgw_header(true);
+
$GLOBALS['phpgw']->log->write(array('text'=>'W-Permissions, Attempted to access
%1','p1'=>$GLOBALS['phpgw_info']['flags']['currentapp']));
+
+ $lang_denied = lang('Access not permitted');
+ echo <<<HTML
+ <div class="error">$lang_denied</div>
+
+HTML;
+ $GLOBALS['phpgw']->common->phpgw_exit(True);
+ }
+ }
+
+ // Already called from sessions::verify
+ // $GLOBALS['phpgw']->applications->read_installed_apps(); // to
get translated app-titles
+
+
/*************************************************************************\
+ * Load the header unless the developer turns it off
*
+
\*************************************************************************/
+ if ( !isset($GLOBALS['phpgw_info']['flags']['noheader']) ||
!$GLOBALS['phpgw_info']['flags']['noheader'] )
+ {
+ $inc_navbar =
!isset($GLOBALS['phpgw_info']['flags']['nonavbar']) ||
!$GLOBALS['phpgw_info']['flags']['nonavbar'];
+ $GLOBALS['phpgw']->common->phpgw_header($inc_navbar);
+ unset($inc_navbar);
+ }
+
+
/*************************************************************************\
+ * Load the app include files if the exists
*
+
\*************************************************************************/
+ /* Then the include file */
+ if (! preg_match ("/phpgwapi/i", PHPGW_APP_INC) &&
file_exists(PHPGW_APP_INC . '/functions.inc.php') &&
!isset($GLOBALS['phpgw_info']['menuaction']))
+ {
+ include_once(PHPGW_APP_INC . '/functions.inc.php');
+ }
+ if (address@hidden'phpgw_info']['flags']['noheader'] &&
+ address@hidden'phpgw_info']['flags']['noappheader'] &&
+ file_exists(PHPGW_APP_INC . '/header.inc.php') &&
!isset($GLOBALS['phpgw_info']['menuaction']))
+ {
+ include_once(PHPGW_APP_INC . '/header.inc.php');
+ }
+
+/////////////////////////////////////////////////////////////////////////////
+// END Stuff copied from functions.inc.php
+/////////////////////////////////////////////////////////////////////////////
+
+ if (isset($_GET['menuaction']))
+ {
+ list($app,$class,$method) = explode('.',$_GET['menuaction']);
+ }
+ else
+ {
+ $app = 'registration';
+ $class = 'uireg';
+ $method = 'step1';
+ }
+ $GLOBALS[$class] = CreateObject("{$app}.{$class}");
+
+ $invalid_data = false; //FIXME consider whether this should be computed
as in the main index.php
+ if ( !$invalid_data
+ && is_object($GLOBALS[$class])
+ && isset($GLOBALS[$class]->public_functions)
+ && is_array($GLOBALS[$class]->public_functions)
+ && isset($GLOBALS[$class]->public_functions[$method])
+ && $GLOBALS[$class]->public_functions[$method] )
+
+ {
+ if ( phpgw::get_var('X-Requested-With', 'string', 'SERVER') ==
'XMLHttpRequest'
+ // deprecated
+ || phpgw::get_var('phpgw_return_as', 'string', 'GET')
== 'json' )
+ {
+ // comply with RFC 4627
+ header('Content-Type: application/json');
+ $return_data = $GLOBALS[$class]->$method();
+ echo json_encode($return_data);
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw']->common->phpgw_exit();
+ }
+ else
+ {
+ $GLOBALS[$class]->$method();
+ $GLOBALS['phpgw']->common->phpgw_footer();
+ }
+ }
+
Modified: trunk/registration/setup/setup.inc.php
===================================================================
--- trunk/registration/setup/setup.inc.php 2012-03-10 10:50:48 UTC (rev
8972)
+++ trunk/registration/setup/setup.inc.php 2012-03-12 18:35:59 UTC (rev
8973)
@@ -28,13 +28,17 @@
);
/* The hooks this app includes, needed for hooks registration */
- $setup_info['registration']['hooks'][] = 'admin';
- $setup_info['registration']['hooks'][] = 'logout';
+ $setup_info['registration']['hooks'] = array
+ (
+ 'menu' => 'registration.menu.get_menu',
+ 'config',
+ 'logout'
+ );
+
/* Dependencies for this app to work */
$setup_info['registration']['depends'][] = array
(
'appname' => 'phpgwapi',
'versions' => Array('0.9.16', '0.9.17', '0.9.18')
);
-?>
Modified: trunk/registration/templates/base/config.tpl
===================================================================
--- trunk/registration/templates/base/config.tpl 2012-03-10 10:50:48 UTC
(rev 8972)
+++ trunk/registration/templates/base/config.tpl 2012-03-12 18:35:59 UTC
(rev 8973)
@@ -37,6 +37,14 @@
</td>
</tr>
<tr>
+ <tr class="row_on">
+ <td>{lang_default_group}:</td>
+ <td>
+ <select name="newsettings[default_group_id]">
+ {hook_default_group}
+ </select>
+ </td>
+ </tr>
<tr bgcolor="{row_off}">
<td>{lang_Activate_account}:</td>
<td>
Modified: trunk/registration/templates/base/fields.tpl
===================================================================
--- trunk/registration/templates/base/fields.tpl 2012-03-10 10:50:48 UTC
(rev 8972)
+++ trunk/registration/templates/base/fields.tpl 2012-03-12 18:35:59 UTC
(rev 8973)
@@ -6,10 +6,10 @@
<!-- BEGIN list -->
<table border="0" align="center" width="75%">
- <tr bgcolor="{row_on}">
+ <tr class="{row_on}">
<td colspan="7">{lang_current_fields}</td>
</tr>
- <tr bgcolor="{row_off}">
+ <tr class="{row_off}">
<td width=5%>{lang_name_and_shortdesc}</td>
<td>{lang_text}</td>
<td>{lang_type}</td>
@@ -20,7 +20,7 @@
</tr>
<!-- BEGIN info -->
- <tr bgcolor="{row_off}">
+ <tr class="{row_off}">
<td><input type="text" name="{field_short_name}_name" size="10"
value="{field_name}"></td>
<td><input type="text" name="{field_short_name}_text"
value="{field_text}"></td>
<td><select name="{field_short_name}_type">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8973] registration: make it work,
Sigurd Nes <=