fixed more namespace issues found by doc/check_namespace.php I wrote and forgot about it ;-)

This commit is contained in:
Ralf Becker 2016-03-21 21:21:40 +00:00
parent 51951d55d5
commit 77c5102792
17 changed files with 45 additions and 36 deletions

View File

@ -74,6 +74,11 @@ function et2_createWidget(_name, _attrs, _parent)
_attrs = {}; _attrs = {};
} }
if (typeof _attrs != "object")
{
_attrs = {};
}
if (typeof _parent == "undefined") if (typeof _parent == "undefined")
{ {
_parent = null; _parent = null;

View File

@ -214,7 +214,7 @@ class Ads
if ($set_if_empty && ($dn = $this->id2name(-self::DOMAIN_USERS_GROUP, 'account_dn'))) if ($set_if_empty && ($dn = $this->id2name(-self::DOMAIN_USERS_GROUP, 'account_dn')))
{ {
$dn = preg_replace('/^CN=.*?,(CN|OU)=/i', '$1=', $dn); $dn = preg_replace('/^CN=.*?,(CN|OU)=/i', '$1=', $dn);
config::save_value(self::ADS_CONTEXT, $this->frontend->config[self::ADS_CONTEXT]=$dn, 'phpgwapi'); Api\Config::save_value(self::ADS_CONTEXT, $this->frontend->config[self::ADS_CONTEXT]=$dn, 'phpgwapi');
} }
else else
{ {
@ -522,7 +522,7 @@ class Ads
public function user_active(array $data) public function user_active(array $data)
{ {
$user = $this->_ldap2user($data); $user = $this->_ldap2user($data);
$active = accounts::is_active($user); $active = Api\Accounts::is_active($user);
//error_log(__METHOD__."(cn={$data['cn'][0]}, useraccountcontrol={$data['useraccountcontrol'][0]}, accountexpires={$data['accountexpires'][0]}) user=".array2string($user)." returning ".array2string($active)); //error_log(__METHOD__."(cn={$data['cn'][0]}, useraccountcontrol={$data['useraccountcontrol'][0]}, accountexpires={$data['accountexpires'][0]}) user=".array2string($user)." returning ".array2string($active));
return $active; return $active;
} }
@ -562,7 +562,7 @@ class Ads
protected static function _when2ts($_when) protected static function _when2ts($_when)
{ {
static $utc=null; static $utc=null;
if (!isset($utc)) $utc = new DateTimeZone('UTC'); if (!isset($utc)) $utc = new \DateTimeZone('UTC');
list($when) = explode('.', $_when); // remove .0Z not understood by createFromFormat list($when) = explode('.', $_when); // remove .0Z not understood by createFromFormat
$datetime = Api\DateTime::createFromFormat(self::WHEN_FORMAT, $when, $utc); $datetime = Api\DateTime::createFromFormat(self::WHEN_FORMAT, $when, $utc);
@ -778,8 +778,8 @@ class Ads
break; break;
case 'account_lastpwd_change': case 'account_lastpwd_change':
// Samba4 does not understand -1 for current time, but Win2008r2 only allows to set -1 (beside 0) // Samba4 does not understand -1 for current time, but Win2008r2 only allows to set -1 (beside 0)
// call auth_ads::setLastPwdChange with true to get correct modification for both // call Api\Auth\Ads::setLastPwdChange with true to get correct modification for both
$ldap = array_merge($ldap, auth_ads::setLastPwdChange($data['account_lid'], null, $data[$egw], true)); $ldap = array_merge($ldap, Api\Auth\Ads::setLastPwdChange($data['account_lid'], null, $data[$egw], true));
break; break;
default: default:
$attributes[$adldap] = $data[$egw]; $attributes[$adldap] = $data[$egw];
@ -910,7 +910,7 @@ class Ads
{ {
continue; continue;
} }
$account['account_fullname'] = common::display_fullname($account['account_lid'],$account['account_firstname'],$account['account_lastname'],$account['account_id']); $account['account_fullname'] = Api\Accounts::format_username($account['account_lid'],$account['account_firstname'],$account['account_lastname'],$account['account_id']);
$accounts[$account_id] = $account; $accounts[$account_id] = $account;
} }
} }

View File

@ -23,6 +23,7 @@ use EGroupware\Api;
// explicitly reference classes still in phpgwapi or old structure // explicitly reference classes still in phpgwapi or old structure
use common; // next_id use common; // next_id
use setup_cmd_ldap;
/** /**
* LDAP Backend for accounts * LDAP Backend for accounts
@ -595,7 +596,7 @@ class Ldap
{ {
if (preg_match('/^[a-f0-9]{32}$/', $data['account_passwd'])) // md5 --> ldap md5 if (preg_match('/^[a-f0-9]{32}$/', $data['account_passwd'])) // md5 --> ldap md5
{ {
$data['account_passwd'] = setup_cmd_Api\Ldap::hash_sql2ldap($data['account_passwd']); $data['account_passwd'] = setup_cmd_ldap::hash_sql2ldap($data['account_passwd']);
} }
elseif (!preg_match('/^\\{[a-z5]{3,5}\\}.+/i',$data['account_passwd'])) // if it's not already entcrypted, do so now elseif (!preg_match('/^\\{[a-z5]{3,5}\\}.+/i',$data['account_passwd'])) // if it's not already entcrypted, do so now
{ {

View File

@ -158,7 +158,7 @@ class Ads extends Ldap
// we cant use ldap::quote() for win2008r2 hex GUID, as it contains backslashes // we cant use ldap::quote() for win2008r2 hex GUID, as it contains backslashes
if (!preg_match('/^[0-9A-Fa-f-]+/', $contact_id)) if (!preg_match('/^[0-9A-Fa-f-]+/', $contact_id))
{ {
throw new egw_exception_assertion_failed("'$contact_id' is NOT a valid GUID!"); throw new Api\Exception\AssertionFailed("'$contact_id' is NOT a valid GUID!");
} }
// samba4 can only search by string representation of objectGUID, while win2008r2 requires hex representation // samba4 can only search by string representation of objectGUID, while win2008r2 requires hex representation

View File

@ -909,7 +909,7 @@ class Storage
$sql_contacts = new Sql(); $sql_contacts = new Sql();
// we need an admin connection // we need an admin connection
$ds = $GLOBALS['egw']->ldap->ldapConnect(); $ds = $GLOBALS['egw']->ldap->ldapConnect();
$ldap_contacts = new addressbook_ldap(null, $ds); $ldap_contacts = new Ldap(null, $ds);
if (!is_array($type)) $type = explode(',', $type); if (!is_array($type)) $type = explode(',', $type);

View File

@ -12,6 +12,8 @@
namespace EGroupware\Api\Contacts; namespace EGroupware\Api\Contacts;
use EGroupware\Api\Accounts;
/** /**
* Univention backend for addressbook * Univention backend for addressbook
* *
@ -22,7 +24,7 @@ class Univention extends Ldap
function __construct($ldap_config = null, $ds = null) function __construct($ldap_config = null, $ds = null)
{ {
$this->schema2egw['univentionmail'] = array( $this->schema2egw['univentionmail'] = array(
'email' => accounts_univention::MAIL_ATTR, 'email' => Accounts\Univention::MAIL_ATTR,
); );
parent::__construct($ldap_config, $ds); parent::__construct($ldap_config, $ds);
} }

View File

@ -167,7 +167,7 @@ class DateTime extends \DateTime
} }
// fall through // fall through
default: default:
throw new egw_exception_assertion_failed("Not implemented for type ($type)$time!"); throw new Exception\AssertionFailed("Not implemented for type ($type)$time!");
} }
} }
@ -483,7 +483,6 @@ class DateTime extends \DateTime
* @param string $tz timezone, eg. 'Europe/Berlin' or 'UTC' * @param string $tz timezone, eg. 'Europe/Berlin' or 'UTC'
* @param string $dateformat ='' eg. 'Y-m-d' or 'd.m.Y' * @param string $dateformat ='' eg. 'Y-m-d' or 'd.m.Y'
* @param string|int $timeformat ='' integer 12, 24, or format string eg. 'H:i' * @param string|int $timeformat ='' integer 12, 24, or format string eg. 'H:i'
* @throws egw_exception_wrong_userinput if invalid $tz parameter
* @return DateTimeZone * @return DateTimeZone
*/ */
public static function setUserPrefs($tz,$dateformat='',$timeformat='') public static function setUserPrefs($tz,$dateformat='',$timeformat='')
@ -508,7 +507,7 @@ class DateTime extends \DateTime
try { try {
self::$user_timezone = new DateTimeZone($tz); self::$user_timezone = new DateTimeZone($tz);
} }
catch(Exception $e) catch(\Exception $e)
{ {
unset($e); unset($e);
// silently use server timezone, as we have no means to report the wrong timezone to the user from this class // silently use server timezone, as we have no means to report the wrong timezone to the user from this class

View File

@ -1562,7 +1562,7 @@ class Db
if ($this === $GLOBALS['egw']->db && $app != self::API_APPNAME) if ($this === $GLOBALS['egw']->db && $app != self::API_APPNAME)
{ {
// prevent that anyone switches the global db object to an other app // prevent that anyone switches the global db object to an other app
throw new Api\Exception\WrongParameter('You are not allowed to call set_app for $GLOBALS[egw]->db or a refence to it, you have to clone it!'); throw new Exception\WrongParameter('You are not allowed to call set_app for $GLOBALS[egw]->db or a refence to it, you have to clone it!');
} }
$this->app = $app; $this->app = $app;
} }
@ -1735,7 +1735,7 @@ class Db
$inputarr = false; $inputarr = false;
if (isset($data[0]) && is_array($data[0])) // multiple data rows if (isset($data[0]) && is_array($data[0])) // multiple data rows
{ {
if ($where) throw new Api\Exception\WrongParameter('Can NOT use $where together with multiple data rows in $data!'); if ($where) throw new Exception\WrongParameter('Can NOT use $where together with multiple data rows in $data!');
$sql = "$cmd INTO $table "; $sql = "$cmd INTO $table ";
foreach($data as $k => $d) foreach($data as $k => $d)

View File

@ -313,11 +313,11 @@ class Backup
*/ */
function saveConfig($minCount,$backupFiles=null) function saveConfig($minCount,$backupFiles=null)
{ {
Config::save_value('backup_mincount',$this->backup_mincount=(int)$minCount,'phpgwapi'); Api\Config::save_value('backup_mincount',$this->backup_mincount=(int)$minCount,'phpgwapi');
if (!is_null($backupFiles)) if (!is_null($backupFiles))
{ {
Config::save_value('backup_files',$this->backup_files=(boolean)$backupFiles,'phpgwapi'); Api\Config::save_value('backup_files',$this->backup_files=(boolean)$backupFiles,'phpgwapi');
} }
} }
@ -426,7 +426,7 @@ class Backup
if ($convert_to_system_charset) // store the changed charset if ($convert_to_system_charset) // store the changed charset
{ {
$this->db->insert(Config::TABLE, array( $this->db->insert(Api\Config::TABLE, array(
'config_value' => $this->schema_proc->system_charset, 'config_value' => $this->schema_proc->system_charset,
),array( ),array(
'config_app' => 'phpgwapi', 'config_app' => 'phpgwapi',
@ -918,7 +918,7 @@ class Backup
{ {
$zippresent = true; $zippresent = true;
//echo '-> is_object($zip); '.$filename.'<br>'; // ! //echo '-> is_object($zip); '.$filename.'<br>'; // !
$res = $zip->open($filename, ZIPARCHIVE::CREATE); $res = $zip->open($filename, ZipArchive::CREATE);
if($res !== TRUE) if($res !== TRUE)
{ {
//echo ' -> !$res<br>'; // ! //echo ' -> !$res<br>'; // !

View File

@ -119,7 +119,7 @@ class Deprecated extends Api\Db
{ {
if (!$this->Query_ID) if (!$this->Query_ID)
{ {
throw new Exception\Db('next_record called with no query pending.'); throw new Exception('next_record called with no query pending.');
} }
if ($this->Row) // first row is already fetched if ($this->Row) // first row is already fetched
{ {
@ -174,7 +174,7 @@ class Deprecated extends Api\Db
{ {
if (!$this->Query_ID || !$this->Query_ID->Move($this->Row = $pos)) if (!$this->Query_ID || !$this->Query_ID->Move($this->Row = $pos))
{ {
throw new Exception\Db("seek($pos) failed: resultset has " . $this->num_rows() . " rows"); throw new Exception("seek($pos) failed: resultset has " . $this->num_rows() . " rows");
} }
return True; return True;
} }

View File

@ -124,7 +124,7 @@ class Contact extends Entry
*/ */
public function get_contact_fields() public function get_contact_fields()
{ {
ApiTranslation::add_app('addressbook'); Api\Translation::add_app('addressbook');
$this->contacts->__construct(); $this->contacts->__construct();
$options = $this->contacts->contact_fields; $options = $this->contacts->contact_fields;

View File

@ -130,10 +130,8 @@ class Customfields extends Transformer
} }
// if we are in the etemplate editor or the app has no cf's, load the cf's from the app the tpl belongs too // if we are in the etemplate editor or the app has no cf's, load the cf's from the app the tpl belongs too
if ($app && $app != 'stylite' && $app != $GLOBALS['egw_info']['flags']['currentapp'] && !isset($customfields) && ( if ($app && $app != 'stylite' && $app != $GLOBALS['egw_info']['flags']['currentapp'] && !isset($customfields) &&
$GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate' || !$this->attrs['customfields'] || ($GLOBALS['egw_info']['flags']['currentapp'] == 'etemplate' || !$this->attrs['customfields']) || !isset($customfields))
Etemplate::$hooked
) || !isset($customfields))
{ {
// app changed // app changed
$customfields =& Api\Storage\Customfields::get($app); $customfields =& Api\Storage\Customfields::get($app);

View File

@ -1133,7 +1133,7 @@ egw_LAB.wait(function() {
$html .= "<script type='text/javascript'>\n"; $html .= "<script type='text/javascript'>\n";
$html .= "var $tree;"; $html .= "var $tree;";
$html .= "egw_LAB.wait(function() {"; $html .= "egw_LAB.wait(function() {";
$html .= "$tree = new dhtmlXTreeObject('$tree','100%','100%',0);\n"; $html .= "$tree = new"." dhtmlXTreeObject('$tree','100%','100%',0);\n";
$html .= "$tree.parentObject.style.overflow='auto';\n"; // dhtmlXTree constructor has hidden hardcoded $html .= "$tree.parentObject.style.overflow='auto';\n"; // dhtmlXTree constructor has hidden hardcoded
if (Translation::charset() == 'utf-8') $html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n"; if (Translation::charset() == 'utf-8') $html .= "if ($tree.setEscapingMode) $tree.setEscapingMode('utf8');\n";
$html .= "$tree.setImagePath('$folderImageDir/dhtmlxtree/');\n"; $html .= "$tree.setImagePath('$folderImageDir/dhtmlxtree/');\n";

View File

@ -11,8 +11,12 @@
*/ */
namespace EGroupware\Api\Html; namespace EGroupware\Api\Html;
use EGroupware\Api; use EGroupware\Api;
use translation;
// explicitly name old, not yet converted api classes
use translation; // mail specific stuff not in Api\Translation
use emailadmin_imapbase;
require_once(__DIR__.'/htmLawed/htmLawed.php'); require_once(__DIR__.'/htmLawed/htmLawed.php');

View File

@ -791,7 +791,7 @@ class Link extends Link\Storage
else else
{ {
// if there is no object or no method, give a more explaining error message // if there is no object or no method, give a more explaining error message
throw new egw_exception_assertion_failed("Object has no method '$reg[query]'!"); throw new Exception\AssertionFailed("Object has no method '$reg[query]'!");
} }
if (!isset($options['total'])) if (!isset($options['total']))
@ -1073,7 +1073,7 @@ class Link extends Link\Storage
} }
else else
{ {
throw new egw_exception_assertion_failed("Missing 'mime_id' or 'mime_url' for mime-type '$type'!"); throw new Exception\AssertionFailed("Missing 'mime_id' or 'mime_url' for mime-type '$type'!");
} }
unset($data['mime_popup']); unset($data['mime_popup']);
} }
@ -1473,10 +1473,10 @@ class Link extends Link\Storage
{ {
self::notify('update',$link['app'],$link['id'],$app,$id,$link_id,$data); self::notify('update',$link['app'],$link['id'],$app,$id,$link_id,$data);
} }
if($data[Link::OLD_LINK_TITLE] && Api\Json\Response::isJSONResponse()) if($data[Link::OLD_LINK_TITLE] && Json\Response::isJSONResponse())
{ {
// Update client side with new title // Update client side with new title
Api\Json\Response::get()->apply('egw.link_title_callback',array(array($app => array($id => self::title($app, $id))))); Json\Response::get()->apply('egw.link_title_callback',array(array($app => array($id => self::title($app, $id)))));
} }
} }

View File

@ -1089,7 +1089,7 @@ class Base
// ToDo: Implement that as an iterator, as $rs is also an interator and we could return one instead of an array // ToDo: Implement that as an iterator, as $rs is also an interator and we could return one instead of an array
if ($this->search_return_iterator) if ($this->search_return_iterator)
{ {
return new so_sql_db2data_iterator($this,$rs); return new Db2DataIterator($this,$rs);
} }
$arr = array(); $arr = array();
$n = 0; $n = 0;

View File

@ -43,8 +43,8 @@ class Utils extends StreamWrapper
$stmt->bindColumn(1,$fs_id); $stmt->bindColumn(1,$fs_id);
$stmt->bindColumn(2,$fs_name); $stmt->bindColumn(2,$fs_name);
$stmt->bindColumn(3,$fs_size); $stmt->bindColumn(3,$fs_size);
$stmt->bindColumn(4,$fs_content,PDO::PARAM_LOB); $stmt->bindColumn(4,$fs_content,\PDO::PARAM_LOB);
$stmt->bindValue(':offset', $n, PDO::PARAM_INT); $stmt->bindValue(':offset', $n, \PDO::PARAM_INT);
while ($stmt->execute()) while ($stmt->execute())
{ {
@ -88,7 +88,7 @@ class Utils extends StreamWrapper
} }
if (!$n) break; // just in case nothing is found, statement will execute just fine if (!$n) break; // just in case nothing is found, statement will execute just fine
$stmt->bindValue(':offset', $n, PDO::PARAM_INT); $stmt->bindValue(':offset', $n, \PDO::PARAM_INT);
} }
unset($row); // not used, as we access bound variables unset($row); // not used, as we access bound variables
unset($stmt); unset($stmt);