[eGroupWare-svn] r56131 - in /trunk/egroupware/api/src: ./ Db/ Etemplate/ Header/ Mail/ Storage/ Vfs/ Vfs/Sqlfs/

[email protected] Wed, 11 May 2016 18:58:10 -0000
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Wed May 11 20:58:10 2016
New Revision: 56131

URL: http://svn.stylite.de/viewvc/egroupware?rev=56131&view=rev
Log:
use static Hooks methods

Modified:
    trunk/egroupware/api/src/Accounts.php
    trunk/egroupware/api/src/Auth.php
    trunk/egroupware/api/src/CalDAV.php
    trunk/egroupware/api/src/Categories.php
    trunk/egroupware/api/src/Contacts.php
    trunk/egroupware/api/src/Db/Backup.php
    trunk/egroupware/api/src/Etemplate.php
    trunk/egroupware/api/src/Etemplate/Widget.php
    trunk/egroupware/api/src/Header/ContentSecurityPolicy.php
    trunk/egroupware/api/src/Link.php
    trunk/egroupware/api/src/Mail/Types.php
    trunk/egroupware/api/src/Mailer.php
    trunk/egroupware/api/src/Session.php
    trunk/egroupware/api/src/Storage/Merge.php
    trunk/egroupware/api/src/Vfs.php
    trunk/egroupware/api/src/Vfs/Sqlfs/Utils.php
    trunk/egroupware/api/src/Vfs/StreamWrapper.php

Modified: trunk/egroupware/api/src/Accounts.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Accounts.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Accounts.php (original)
+++ trunk/egroupware/api/src/Accounts.php Wed May 11 20:58:10 2016
@@ -1057,7 +1057,7 @@
 		}
 		// call hook to notify interested apps about the new account
 		$GLOBALS['hook_values'] = $data;
-		$GLOBALS['egw']->hooks->process($data+array(
+		Hooks::process($data+array(
 			'location' => 'addaccount',
 			// at login-time only the hooks from the following apps will be called
 			'order' => array('felamimail','fudforum'),

Modified: trunk/egroupware/api/src/Auth.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Auth.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Auth.php (original)
+++ trunk/egroupware/api/src/Auth.php Wed May 11 20:58:10 2016
@@ -260,7 +260,7 @@
 				'old_passwd'  => $old_passwd,
 				'new_passwd'  => $new_passwd,
 			);
-			$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
+			Hooks::process($GLOBALS['hook_values']+array(
 				'location' => 'changepassword'
 			),False,True);	// called for every app now, not only enabled ones)
 		}

Modified: trunk/egroupware/api/src/CalDAV.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/CalDAV.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/CalDAV.php (original)
+++ trunk/egroupware/api/src/CalDAV.php Wed May 11 20:58:10 2016
@@ -389,7 +389,7 @@
 
 			if ($path == '/')
 			{
-				$GLOBALS['egw']->hooks->process(array(
+				Hooks::process(array(
 					'location' => 'groupdav_root_props',
 					'props' => &$files['files'][0]['props'],
 					'options' => $options,

Modified: trunk/egroupware/api/src/Categories.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Categories.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Categories.php (original)
+++ trunk/egroupware/api/src/Categories.php Wed May 11 20:58:10 2016
@@ -626,11 +626,11 @@
 		);
 		if($this->is_global($cat_id, true))	// true = application global (otherwise eg. global addressbook categories call all apps)
 		{
-			$GLOBALS['egw']->hooks->process($GLOBALS['hook_values'],False,True);  // called for every app now, not only enabled ones)
+			Hooks::process($GLOBALS['hook_values'],False,True);  // called for every app now, not only enabled ones)
 		}
 		else
 		{
-			$GLOBALS['egw']->hooks->single($GLOBALS['hook_values'], self::id2name($cat_id,'appname'));
+			Hooks::single($GLOBALS['hook_values'], self::id2name($cat_id,'appname'));
 		}
 
 		$this->db->delete(self::TABLE,$where,__LINE__,__FILE__);

Modified: trunk/egroupware/api/src/Contacts.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Contacts.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Contacts.php (original)
+++ trunk/egroupware/api/src/Contacts.php Wed May 11 20:58:10 2016
@@ -992,7 +992,7 @@
 				$GLOBALS['egw']->accounts->cache_invalidate($contact['account_id']);
 				// call edit-accout hook, to let other apps know about changed account (names or email)
 				$GLOBALS['hook_values'] = $GLOBALS['egw']->accounts->read($contact['account_id']);
-				$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
+				Hooks::process($GLOBALS['hook_values']+array(
 					'location' => 'editaccount',
 				),False,True);	// called for every app now, not only enabled ones)
 			}
@@ -1000,7 +1000,7 @@
 			if (!$to_write['owner'] && $to_write['account_id'] && $isUpdate)
 			{
 				$to_write['location'] = 'editaccountcontact';
-				$GLOBALS['egw']->hooks->process($to_write,False,True);	// called for every app now, not only enabled ones));
+				Hooks::process($to_write,False,True);	// called for every app now, not only enabled ones));
 			}
 			// Notify linked apps about changes in the contact data
 			Link::notify_update('addressbook',  $contact['id'], $contact);

Modified: trunk/egroupware/api/src/Db/Backup.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Db/Backup.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Db/Backup.php (original)
+++ trunk/egroupware/api/src/Db/Backup.php Wed May 11 20:58:10 2016
@@ -487,7 +487,7 @@
 		Api\Cache::flush(Api\Cache::INSTANCE);
 
 		// search-and-register-hooks
-		$GLOBALS['egw']->hooks->register_all_hooks();
+		Api\Hooks::read(true);
 
 		return '';
 	}

Modified: trunk/egroupware/api/src/Etemplate.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Etemplate.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Etemplate.php (original)
+++ trunk/egroupware/api/src/Etemplate.php Wed May 11 20:58:10 2016
@@ -102,7 +102,7 @@
 	 */
 	function exec($method,array $content,array $sel_options=null,array $readonlys=null,array $preserv=null,$output_mode=0,$ignore_validation='',array $changes=null)
 	{
-		$hook_data = $GLOBALS['egw']->hooks->process(
+		$hook_data = Hooks::process(
 			array('hook_location'   => 'etemplate2_before_exec') +
 			array('location_name'   => $this->name) +
 			array('location_object' => &$this) +
@@ -351,7 +351,7 @@
 		// tell request call to remove request, if it is not modified eg. by call to exec in callback
 		self::$request->remove_if_not_modified();
 
-		foreach($GLOBALS['egw']->hooks->process(array(
+		foreach(Hooks::process(array(
 			'hook_location'   => 'etemplate2_before_process',
 			'location_name'   => $template->id,
 		) + self::complete_array_merge(self::$request->preserv, $validated)) as $extras)
@@ -374,7 +374,7 @@
 		$tcontent = is_array($content) ? $content :
 			self::complete_array_merge(self::$request->preserv, $validated);
 
-		$hook_data = $GLOBALS['egw']->hooks->process(
+		$hook_data = Hooks::process(
 			array(
 				'hook_location'   => 'etemplate2_after_process',
 				'location_name'   => $template->id

Modified: trunk/egroupware/api/src/Etemplate/Widget.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Etemplate/Widget.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Etemplate/Widget.php (original)
+++ trunk/egroupware/api/src/Etemplate/Widget.php Wed May 11 20:58:10 2016
@@ -323,7 +323,7 @@
 			}
 
 			// Use hook to load custom widgets from other apps
-			$widgets = $GLOBALS['egw']->hooks->process('etemplate2_register_widgets',array(),true);
+			$widgets = Api\Hooks::process('etemplate2_register_widgets',array(),true);
 			foreach($widgets as $list)
 			{
 				if (is_array($list))

Modified: trunk/egroupware/api/src/Header/ContentSecurityPolicy.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Header/ContentSecurityPolicy.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Header/ContentSecurityPolicy.php (original)
+++ trunk/egroupware/api/src/Header/ContentSecurityPolicy.php Wed May 11 20:58:10 2016
@@ -11,6 +11,8 @@
  */
 
 namespace EGroupware\Api\Header;
+
+use EGroupware\Api;
 
 /**
  * Content Security Policy headers
@@ -50,8 +52,8 @@
 			// set frame-src attrs of API and apps via hook
 			if ($source == 'frame-src' && !isset($attrs))
 			{
-				$attrs = array('manual.egroupware.org', 'www.egroupware.org');
-				if (($app_additional = $GLOBALS['egw']->hooks->process('csp-frame-src')))
+				$attrs = array('www.egroupware.org');
+				if (($app_additional = Api\Hooks::process('csp-frame-src')))
 				{
 					foreach($app_additional as $addtional)
 					{

Modified: trunk/egroupware/api/src/Link.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Link.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Link.php (original)
+++ trunk/egroupware/api/src/Link.php Wed May 11 20:58:10 2016
@@ -207,7 +207,7 @@
 		// for performance reasons, we do it only once / cache it in the session
 		if (!($search_link_hooks = Cache::getSession(__CLASS__, 'search_link_hooks')))
 		{
-			$search_link_hooks = $GLOBALS['egw']->hooks->process('search_link',array(), (bool)$GLOBALS['egw_info']['flags']['async-service']);
+			$search_link_hooks = Hooks::process('search_link',array(), (bool)$GLOBALS['egw_info']['flags']['async-service']);
 			Cache::setSession(__CLASS__, 'search_link_hooks', $search_link_hooks);
 		}
 		if (is_array($search_link_hooks))

Modified: trunk/egroupware/api/src/Mail/Types.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Mail/Types.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Mail/Types.php (original)
+++ trunk/egroupware/api/src/Mail/Types.php Wed May 11 20:58:10 2016
@@ -14,6 +14,8 @@
 
 namespace EGroupware\Api\Mail;
 
+use EGroupware\Api;
+
 class Types
 {
 	/**
@@ -26,7 +28,7 @@
 	static public function getSMTPServerTypes($extended=true)
 	{
 		$retData = self::server_types(false, $extended);
-		foreach($GLOBALS['egw']->hooks->process(array(
+		foreach(Api\Hooks::process(array(
 			'location' => 'smtp_server_types',
 			'extended' => $extended,
 		), array('managementserver'), true) as $app => $data)
@@ -56,7 +58,7 @@
 	static public function getIMAPServerTypes($extended=true)
 	{
 		$retData = self::server_types(true, $extended);
-		foreach($GLOBALS['egw']->hooks->process(array(
+		foreach(Api\Hooks::process(array(
 			'location' => 'imap_server_types',
 			'extended' => $extended,
 		), array('managementserver'), true) as $app => $data)

Modified: trunk/egroupware/api/src/Mailer.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Mailer.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Mailer.php (original)
+++ trunk/egroupware/api/src/Mailer.php Wed May 11 20:58:10 2016
@@ -503,7 +503,7 @@
 		}
 		$body_sha1 = null;	// skip sha1, it requires whole mail in memory, which we traing to avoid now
 
-		$mail_id = $GLOBALS['egw']->hooks->process(array(
+		$mail_id = Hooks::process(array(
 			'location' => 'send_mail',
 			'subject' => $subject=$this->getHeader('Subject'),
 			'from' => $this->getHeader('Return-Path') ? $this->getHeader('Return-Path') : $this->getHeader('From'),
@@ -578,7 +578,7 @@
 		}
 		catch (\Exception $e) {
 			// in case of errors/exceptions call hook again with previous returned mail_id and error-message to log
-			$GLOBALS['egw']->hooks->process(array(
+			Hooks::process(array(
 				'location' => 'send_mail',
 				'subject' => $subject,
 				'from' => $this->getHeader('Return-Path') ? $this->getHeader('Return-Path') : $this->getHeader('From'),

Modified: trunk/egroupware/api/src/Session.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Session.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Session.php (original)
+++ trunk/egroupware/api/src/Session.php Wed May 11 20:58:10 2016
@@ -566,7 +566,7 @@
 				$this->session_flags = 'N';
 			}
 
-			if (($hook_result = $GLOBALS['egw']->hooks->process(array(
+			if (($hook_result = Hooks::process(array(
 				'location'       => 'session_creation',
 				'sessionid'      => $this->sessionid,
 				'session_flags'  => $this->session_flags,
@@ -1042,7 +1042,7 @@
 				),__LINE__,__FILE__)->fetchColumn();
 		}
 
-		$GLOBALS['egw']->hooks->process(array(
+		Hooks::process(array(
 			'location'  => 'session_destroyed',
 			'sessionid' => $sessionid,
 		),'',true);	// true = run hooks from all apps, not just the ones the current user has perms to run

Modified: trunk/egroupware/api/src/Storage/Merge.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Storage/Merge.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Storage/Merge.php (original)
+++ trunk/egroupware/api/src/Storage/Merge.php Wed May 11 20:58:10 2016
@@ -500,7 +500,7 @@
 			$exportLimitStore[$app] = $GLOBALS['egw_info']['server']['export_limit'];
 			if ($app !='common')
 			{
-				$app_limit = $GLOBALS['egw']->hooks->single('export_limit',$app);
+				$app_limit = Api\Hooks::single('export_limit',$app);
 				if ($app_limit) $exportLimitStore[$app] = $app_limit;
 			}
 			//error_log(__METHOD__.__LINE__.' building cache for app:'.$app.' -> '.$exportLimitStore[$app]);

Modified: trunk/egroupware/api/src/Vfs.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Vfs.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Vfs.php (original)
+++ trunk/egroupware/api/src/Vfs.php Wed May 11 20:58:10 2016
@@ -1768,7 +1768,7 @@
 			$extra[] = $extra_info;
 		}
 
-		if (($vfs_extra = $GLOBALS['egw']->hooks->process(array(
+		if (($vfs_extra = Hooks::process(array(
 			'location' => 'vfs_extra',
 			'path' => $path,
 			'content' => $content,

Modified: trunk/egroupware/api/src/Vfs/Sqlfs/Utils.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Vfs/Sqlfs/Utils.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Vfs/Sqlfs/Utils.php (original)
+++ trunk/egroupware/api/src/Vfs/Sqlfs/Utils.php Wed May 11 20:58:10 2016
@@ -125,7 +125,7 @@
 			if ($check_msgs) $msgs = array_merge($msgs, $check_msgs);
 		}
 
-		foreach ($GLOBALS['egw']->hooks->process(array(
+		foreach (Api\Hooks::process(array(
 			'location' => 'fsck',
 			'check_only' => $check_only)
 		) as $app_msgs)

Modified: trunk/egroupware/api/src/Vfs/StreamWrapper.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Vfs/StreamWrapper.php?rev=56131&r1=56130&r2=56131&view=diff
==============================================================================
--- trunk/egroupware/api/src/Vfs/StreamWrapper.php (original)
+++ trunk/egroupware/api/src/Vfs/StreamWrapper.php Wed May 11 20:58:10 2016
@@ -360,7 +360,7 @@
 
 		if (isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
 		{
-			$GLOBALS['egw']->hooks->process(array(
+			Api\Hooks::process(array(
 				'location' => str_replace('b','',$this->opened_stream_mode) == 'r' ? 'vfs_read' :
 					($this->opened_stream_is_new ? 'vfs_added' : 'vfs_modified'),
 				'path' => $this->opened_stream_path,
@@ -507,7 +507,7 @@
 		// call "vfs_unlink" hook only after successful unlink, with data from (not longer possible) stat call
 		if ($ok && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
 		{
-			$GLOBALS['egw']->hooks->process(array(
+			Api\Hooks::process(array(
 				'location' => 'vfs_unlink',
 				'path' => $path[0] == '/' ? $path : self::parse_url($path, PHP_URL_PATH),
 				'url'  => $url,
@@ -560,7 +560,7 @@
 		// call "vfs_rename" hook
 		if ($ret && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
 		{
-			$GLOBALS['egw']->hooks->process(array(
+			Api\Hooks::process(array(
 				'location' => 'vfs_rename',
 				'from' => $path_from[0] == '/' ? $path_from : self::parse_url($path_from, PHP_URL_PATH),
 				'to' => $path_to[0] == '/' ? $path_to : self::parse_url($path_to, PHP_URL_PATH),
@@ -593,7 +593,7 @@
 		// call "vfs_mkdir" hook
 		if ($ret && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
 		{
-			$GLOBALS['egw']->hooks->process(array(
+			Api\Hooks::process(array(
 				'location' => 'vfs_mkdir',
 				'path' => $path[0] == '/' ? $path : self::parse_url($path, PHP_URL_PATH),
 				'url' => $url,
@@ -631,7 +631,7 @@
 		// call "vfs_rmdir" hook, only after successful rmdir
 		if ($ok && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
 		{
-			$GLOBALS['egw']->hooks->process(array(
+			Api\Hooks::process(array(
 				'location' => 'vfs_rmdir',
 				'path' => $path[0] == '/' ? $path : self::parse_url($path, PHP_URL_PATH),
 				'url' => $url,


------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j