[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] admin/inc class.socommon.inc.php
From: |
Sigurd Nes |
Subject: |
[Phpgroupware-cvs] admin/inc class.socommon.inc.php |
Date: |
Fri, 13 Oct 2006 21:03:25 +0000 |
CVSROOT: /sources/phpgroupware
Module name: admin
Changes by: Sigurd Nes <sigurdne> 06/10/13 21:03:25
Removed files:
inc : class.socommon.inc.php
Log message:
obsolete
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/admin/inc/class.socommon.inc.php?cvsroot=phpgroupware&r1=1.2&r2=0
Patches:
Index: class.socommon.inc.php
===================================================================
RCS file: class.socommon.inc.php
diff -N class.socommon.inc.php
--- class.socommon.inc.php 5 Sep 2006 10:04:01 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,280 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @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 property
- * @subpackage core
- * @version $Id: class.socommon.inc.php,v 1.2 2006/09/05 10:04:01
skwashd Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class socommon
- {
- function socommon($currentapp='')
- {
- if($currentapp)
- {
- $this->currentapp = $currentapp;
- }
- else
- {
- $this->currentapp =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- }
-
- $this->db =& $GLOBALS['phpgw']->db;
-
- $this->account =
$GLOBALS['phpgw_info']['user']['account_id'];
-
- $this->join = $this->db->join;
- $this->like = $this->db->like;
- }
-
- function create_preferences($app='',$user_id='')
- {
- $prefs = createObject('phpgwapi.preferences');
- $vals = $prefs->read_repository();
- return $vals[$app];
- /*
- $this->db->query("SELECT preference_value FROM
phpgw_preferences where preference_app = '$app' AND
preference_owner=".(int)$user_id );
- $this->db->next_record();
- $value=
unserialize($this->db->f('preference_value'));
- return $value;
- */
- }
-
- //FIXME This won't work with non sql accounts :( - skwashd
apr2006
- function get_user_list_right($right='',$acl_location='')
- {
- $acl2 =
CreateObject($this->currentapp.'.acl2','##DEFAULT##','##DEFAULT##');
- $myaccounts = CreateObject('phpgwapi.accounts');
-
- while($my_memberships && list($key,$group) =
each($my_memberships))
- {
- $security .= "," . $group['account_id'];
- }
-
- $sql = "SELECT * FROM phpgw_accounts $this->join
fm_acl2 on phpgw_accounts.account_id=fm_acl2.acl_account WHERE account_status =
'A' AND acl_location $this->like '%$acl_location%' order by account_lastname
ASC";
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $active_accounts[] = array(
- 'acl_account' =>
$this->db->f('acl_account'),
- 'account_id' =>
$this->db->f('account_id'),
- 'account_type' =>
$this->db->f('account_type'),
- );
- }
-
- foreach ($active_accounts as $entry)
- {
-
if($acl2->check($acl_location,$right,$entry['acl_account']))
- {
- if($entry['account_type']=='g')
- {
- $members =
$myaccounts->member($entry['account_id']);
- if (isset($members) AND
is_array($members))
- {
- foreach($members as
$user)
- {
-
$accounts[$user['account_id']] = array($user['account_id']);
- }
- unset($members);
- }
- }
- else
- {
-
$accounts[$entry['acl_account']] = array($entry['acl_account']);
- }
- }
- }
-
- unset($active_accounts);
- unset($myaccounts);
-
- $sql = "SELECT account_id FROM phpgw_accounts WHERE
account_status = 'I'";
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- unset($accounts[$this->db->f('account_id')]);
- }
-
- if (isset($accounts) AND is_array($accounts))
- {
- foreach($accounts as $account_id)
- {
- $i=0;
-
if(!$acl2->check($acl_location,$right,$account_id[0]))
- {
-
unset($accounts[$account_id[0]]);
- }
-
- $i++;
- }
- }
-
- address@hidden($accounts);
- $k=count($accounts);
-
- for ($i=0;$i<$k;$i++)
- {
- $in_list[] = $accounts[$i];
- }
-
- if($in_list)
- {
- $sql = 'SELECT * FROM phpgw_accounts where
account_id in ('. implode(',',$in_list) . ') order by account_lastname';
- $this->db->query($sql,__LINE__,__FILE__);
- while ($this->db->next_record())
- {
- $employees[] = Array(
- 'account_id' =>
$this->db->f('account_id'),
- 'account_lid' =>
$this->db->f('account_lid'),
- 'account_type' =>
$this->db->f('account_type'),
- 'account_firstname' =>
$this->db->f('account_firstname'),
- 'account_lastname' =>
$this->db->f('account_lastname'),
- 'account_status' =>
$this->db->f('account_status'),
- 'account_expires' =>
$this->db->f('account_expires')
- );
-
- }
- }
-/* for ($i=0;$i<$k;$i++)
- {
- $sql = 'SELECT * FROM phpgw_accounts where
account_id=' . (int)$accounts[$i];
- $this->db->query($sql,__LINE__,__FILE__);
- $this->db->next_record();
- $employees[] = Array(
- 'account_id' =>
$this->db->f('account_id'),
- 'account_lid' =>
$this->db->f('account_lid'),
- 'account_type' =>
$this->db->f('account_type'),
- 'account_firstname' =>
$this->db->f('account_firstname'),
- 'account_lastname' =>
$this->db->f('account_lastname'),
- 'account_status' =>
$this->db->f('account_status'),
- 'account_expires' =>
$this->db->f('account_expires')
- );
- }
-*/
- return $employees;
- }
-
- function next_id($table='',$key='')
- {
- if(is_array($key))
- {
- while (is_array($key) && list($column,$value) =
each($key))
- {
- if($value)
- {
- $condition[] = $column . "='" .
$value . "'";
- }
- }
-
- $where=' WHERE ' . implode(" AND ", $condition);
- }
-
- $this->db->query("SELECT max(id) as maximum FROM $table
$where",__LINE__,__FILE__);
- $this->db->next_record();
- $next_id = $this->db->f('maximum')+1;
- return "$next_id";
- }
-
- function get_lookup_entity($location)
- {
- $this->db->query("SELECT entity_id,name FROM
fm_entity_lookup $this->join fm_entity on
fm_entity_lookup.entity_id=fm_entity.id WHERE type='lookup' AND
location='$location' ");
-
- $i = 0;
-
- while ($this->db->next_record())
- {
- $entity[$i]['id']
= $this->db->f('entity_id');
- $entity[$i]['name']
= $this->db->f('name');
- $i++;
- }
- return $entity;
- }
-
- function get_start_entity($location)
- {
- $this->db->query("SELECT entity_id,name FROM
fm_entity_lookup $this->join fm_entity on
fm_entity_lookup.entity_id=fm_entity.id WHERE type='start' AND
location='$location' ");
-
- $i = 0;
- while ($this->db->next_record())
- {
- $entity[$i]['id']
= $this->db->f('entity_id');
- $entity[$i]['name']
= $this->db->f('name');
- $i++;
- }
-
- return $entity;
- }
-
- function increment_id($name)
- {
- $this->db->query("SELECT value FROM fm_idgenerator
WHERE name='$name'");
- $this->db->next_record();
- $next_id=$this->db->f('value') +1;
-
- $this->db->query("update fm_idgenerator set value =
$next_id WHERE name = 'workorder'");
- return $next_id;
- }
-
- // TODO work out if this is really needed
- function new_db()
- {
- if ( isset($GLBOALS['phpgw']->db) &&
is_object($GLBOALS['phpgw']->db) )
- {
- return clone($GLOBALS['phpgw']->db);
- }
-
- $db = CreateObject('phpgwapi.db');
- if($GLOBALS['phpgw_info']['server']['db_name'])
- {
- $db->Host =
$GLOBALS['phpgw_info']['server']['db_host'];
- $db->Type =
$GLOBALS['phpgw_info']['server']['db_type'];
- $db->Database =
$GLOBALS['phpgw_info']['server']['db_name'];
- $db->User =
$GLOBALS['phpgw_info']['server']['db_user'];
- $db->Password =
$GLOBALS['phpgw_info']['server']['db_pass'];
- }
- else
- {
- $ConfigDomain = $_REQUEST['ConfigDomain'];
- $phpgw_domain = $GLOBALS['phpgw_domain'];
- $db->Host =
$phpgw_domain[$ConfigDomain]['db_host'];
- $db->Database =
$phpgw_domain[$ConfigDomain]['db_name'];
- $db->User =
$phpgw_domain[$ConfigDomain]['db_user'];
- $db->Password =
$phpgw_domain[$ConfigDomain]['db_pass'];
- }
- return $db;
- }
-
- function get_max_location_level()
- {
- $this->db->query("SELECT COUNT(*) as level FROM
fm_location_type ");
- $this->db->next_record();
- return $this->db->f('level');
- }
-
- // FIXME won't work for non sql accounts
- function active_group_members($group_id = '')
- {
- $this->db->query("SELECT phpgw_accounts.account_id,
phpgw_accounts.account_lid FROM phpgw_acl $this->join phpgw_accounts on
phpgw_acl.acl_account = phpgw_accounts.account_id"
- . " WHERE phpgw_acl.acl_location = $group_id
AND phpgw_acl.acl_appname = 'phpgw_group' AND account_status = 'A'");
-
- while ($this->db->next_record())
- {
- $members[] = array (
- 'account_id' => $this->db->f('account_id'),
- 'account_name' => $this->db->f('account_lid')
- );
- }
- return $members;
- }
- }
-?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] admin/inc class.socommon.inc.php,
Sigurd Nes <=