[eGroupWare-svn] r55872 - in /trunk: calendar/inc/class.calendar_rrule.inc.php setup/inc/class.setup_cmd.inc.php wiki/lib/url.php

[email protected]
Newsgroups gmane.comp.web.egroupware.cvs
Message-ID <[email protected]>
Author: ralfbecker
Date: Wed Apr 27 09:10:04 2016
New Revision: 55872

URL: http://svn.stylite.de/viewvc/egroupware?rev=55872&view=rev
Log:
fix some ocurences with: <object> instanceof <phpgwapi-class>, which is no longer true, when object is from new Api, but old <phpgw-class> extends new Api class

Modified:
    trunk/calendar/inc/class.calendar_rrule.inc.php
    trunk/setup/inc/class.setup_cmd.inc.php
    trunk/wiki/lib/url.php

Modified: trunk/calendar/inc/class.calendar_rrule.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/calendar/inc/class.calendar_rrule.inc.php?rev=55872&r1=55871&r2=55872&view=diff
==============================================================================
--- trunk/calendar/inc/class.calendar_rrule.inc.php (original)
+++ trunk/calendar/inc/class.calendar_rrule.inc.php Wed Apr 27 09:10:04 2016
@@ -6,10 +6,12 @@
  * @package calendar
  * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
  * @author Joerg Lehrke <[email protected]>
- * @copyright (c) 2009-15 by RalfBecker-At-outdoor-training.de
+ * @copyright (c) 2009-16 by RalfBecker-At-outdoor-training.de
  * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
  * @version $Id$
  */
+
+use EGroupware\Api;
 
 /**
  * Recurrence rule iterator
@@ -182,14 +184,14 @@
 	/**
 	 * Starttime of series
 	 *
-	 * @var egw_time
+	 * @var Api\DateTime
 	 */
 	public $time;
 
 	/**
 	 * Current "position" / time
 	 *
-	 * @var egw_time
+	 * @var Api\DateTime
 	 */
 	public $current;
 
@@ -234,11 +236,11 @@
 				$this->lastdayofweek = self::SUNDAY;
 		}
 
-		$this->time = $time instanceof egw_time ? $time : new egw_time($time);
+		$this->time = $time instanceof Api\DateTime ? $time : new Api\DateTime($time);
 
 		if (!in_array($type,array(self::NONE, self::DAILY, self::WEEKLY, self::MONTHLY_MDAY, self::MONTHLY_WDAY, self::YEARLY)))
 		{
-			throw new egw_exception_wrong_parameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!");
+			throw new Api\Exception\WrongParameter(__METHOD__."($time,$type,$interval,$enddate,$weekdays,...) type $type is NOT valid!");
 		}
 		$this->type = $type;
 
@@ -350,7 +352,7 @@
 	private static function daysInMonth(DateTime $time)
 	{
 		list($year,$month) = explode('-',$time->format('Y-m'));
-		$last_day = new egw_time();
+		$last_day = new Api\DateTime();
 		$last_day->setDate($year,$month+1,0);
 
 		return (int)$last_day->format('d');
@@ -437,7 +439,7 @@
 				break;
 
 			default:
-				throw new egw_exception_assertion_failed(__METHOD__."() invalid type #$this->type !");
+				throw new Api\Exception\AssertionFailed(__METHOD__."() invalid type #$this->type !");
 		}
 	}
 
@@ -600,13 +602,13 @@
 			}
 			if ($this->enddate)
 			{
-				if ($this->enddate->getTimezone()->getName() != egw_time::$user_timezone->getName())
+				if ($this->enddate->getTimezone()->getName() != Api\DateTime::$user_timezone->getName())
 				{
-					$this->enddate->setTimezone(egw_time::$user_timezone);
+					$this->enddate->setTimezone(Api\DateTime::$user_timezone);
 				}
-				$str_extra[] = lang('ends').': '.lang($this->enddate->format('l')).', '.$this->enddate->format(egw_time::$user_dateformat);
-			}
-			if ($this->time->getTimezone()->getName() != egw_time::$user_timezone->getName())
+				$str_extra[] = lang('ends').': '.lang($this->enddate->format('l')).', '.$this->enddate->format(Api\DateTime::$user_dateformat);
+			}
+			if ($this->time->getTimezone()->getName() != Api\DateTime::$user_timezone->getName())
 			{
 				$str_extra[] = $this->time->getTimezone()->getName();
 			}
@@ -725,8 +727,8 @@
 	{
 		if (!is_array($event)  || !isset($event['tzid'])) return false;
 		if (!$to_tz) $to_tz = $event['tzid'];
-		$timestamp_tz = $usertime ? egw_time::$user_timezone : egw_time::$server_timezone;
-		$time = is_a($event['start'],'DateTime') ? $event['start'] : new egw_time($event['start'],$timestamp_tz);
+		$timestamp_tz = $usertime ? Api\DateTime::$user_timezone : Api\DateTime::$server_timezone;
+		$time = is_a($event['start'],'DateTime') ? $event['start'] : new Api\DateTime($event['start'],$timestamp_tz);
 
 		if (!isset(self::$tz_cache[$to_tz]))
 		{
@@ -739,13 +741,13 @@
 
 		if ($event['recur_enddate'])
 		{
-			$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new egw_time($event['recur_enddate'],$timestamp_tz);
+			$enddate = is_a($event['recur_enddate'],'DateTime') ? $event['recur_enddate'] : new Api\DateTime($event['recur_enddate'],$timestamp_tz);
 		}
 		if (is_array($event['recur_exception']))
 		{
 			foreach($event['recur_exception'] as $exception)
 			{
-				$exceptions[] = is_a($exception,'DateTime') ? $exception : new egw_time($exception,$timestamp_tz);
+				$exceptions[] = is_a($exception,'DateTime') ? $exception : new Api\DateTime($exception,$timestamp_tz);
 			}
 		}
 		return new calendar_rrule($time,$event['recur_type'],$event['recur_interval'],$enddate,$event['recur_data'],$exceptions);
@@ -796,7 +798,7 @@
 		}
 
 		$time = is_a($starttime,'DateTime') ?
-			$starttime : new egw_time($starttime, egw_time::$server_timezone);
+			$starttime : new Api\DateTime($starttime, Api\DateTime::$server_timezone);
 		$time->setTimezone(self::$tz_cache[$event['tzid']]);
 		$remote = clone $time;
 		$remote->setTimezone(self::$tz_cache[$to_tz]);
@@ -832,13 +834,11 @@
 	error_reporting(E_ALL & ~E_NOTICE);
 	function lang($str) { return $str; }
 	$GLOBALS['egw_info']['user']['preferences']['common']['tz'] = $_REQUEST['user-tz'] ? $_REQUEST['user-tz'] : 'Europe/Berlin';
-	require_once('../../phpgwapi/inc/class.egw_time.inc.php');
-	require_once('../../phpgwapi/inc/class.html.inc.php');
-	require_once('../../phpgwapi/inc/class.egw_exception.inc.php');
+	require_once('../../api/src/autoload.php');
 
 	if (!isset($_REQUEST['time']))
 	{
-		$now = new egw_time('now',new DateTimeZone($_REQUEST['tz'] = 'UTC'));
+		$now = new Api\DateTime('now',new DateTimeZone($_REQUEST['tz'] = 'UTC'));
 		$_REQUEST['time'] = $now->format();
 		$_REQUEST['type'] = calendar_rrule::WEEKLY;
 		$_REQUEST['interval'] = 2;
@@ -847,31 +847,31 @@
 		$_REQUEST['user-tz'] = 'Europe/Berlin';
 	}
 	echo "<html>\n<head>\n\t<title>Test calendar_rrule class</title>\n</head>\n<body>\n<form method='GET'>\n";
-	echo "<p>Date+Time: ".html::input('time',$_REQUEST['time']).
-		html::select('tz',$_REQUEST['tz'],egw_time::getTimezones())."</p>\n";
-	echo "<p>Type: ".html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n".
-		"Interval: ".html::input('interval',$_REQUEST['interval'])."</p>\n";
+	echo "<p>Date+Time: ".Api\Html::input('time',$_REQUEST['time']).
+		Api\Html::select('tz',$_REQUEST['tz'],Api\DateTime::getTimezones())."</p>\n";
+	echo "<p>Type: ".Api\Html::select('type',$_REQUEST['type'],calendar_rrule::$types)."\n".
+		"Interval: ".Api\Html::input('interval',$_REQUEST['interval'])."</p>\n";
 	echo "<table><tr><td>\n";
-	echo "Weekdays:<br />".html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n";
+	echo "Weekdays:<br />".Api\Html::checkbox_multiselect('weekdays',$_REQUEST['weekdays'],calendar_rrule::$days,false,'','7',false,'height: 150px;')."\n";
 	echo "</td><td>\n";
-	echo "<p>Exceptions:<br />".html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n";
+	echo "<p>Exceptions:<br />".Api\Html::textarea('exceptions',$_REQUEST['exceptions'],'style="height: 150px;"')."\n";
 	echo "</td></tr></table>\n";
-	echo "<p>Enddate: ".html::input('enddate',$_REQUEST['enddate'])."</p>\n";
-	echo "<p>Display recurances in ".html::select('user-tz',$_REQUEST['user-tz'],egw_time::getTimezones())."</p>\n";
-	echo "<p>".html::submit_button('calc','Calculate')."</p>\n";
+	echo "<p>Enddate: ".Api\Html::input('enddate',$_REQUEST['enddate'])."</p>\n";
+	echo "<p>Display recurances in ".Api\Html::select('user-tz',$_REQUEST['user-tz'],Api\DateTime::getTimezones())."</p>\n";
+	echo "<p>".Api\Html::submit_button('calc','Calculate')."</p>\n";
 	echo "</form>\n";
 
 	$tz = new DateTimeZone($_REQUEST['tz']);
-	$time = new egw_time($_REQUEST['time'],$tz);
-	if ($_REQUEST['enddate']) $enddate = new egw_time($_REQUEST['enddate'],$tz);
+	$time = new Api\DateTime($_REQUEST['time'],$tz);
+	if ($_REQUEST['enddate']) $enddate = new Api\DateTime($_REQUEST['enddate'],$tz);
 	$weekdays = 0; foreach((array)$_REQUEST['weekdays'] as $mask) { $weekdays |= $mask; }
-	if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new egw_time($exception); }
+	if ($_REQUEST['exceptions']) foreach(preg_split("/[,\r\n]+ ?/",$_REQUEST['exceptions']) as $exception) { $exceptions[] = new Api\DateTime($exception); }
 
 	$rrule = new calendar_rrule($time,$_REQUEST['type'],$_REQUEST['interval'],$enddate,$weekdays,$exceptions);
 	echo "<h3>".$time->format('l').', '.$time.' ('.$tz->getName().') '.$rrule."</h3>\n";
 	foreach($rrule as $rtime)
 	{
-		$rtime->setTimezone(egw_time::$user_timezone);
+		$rtime->setTimezone(Api\DateTime::$user_timezone);
 		echo ++$n.': '.$rtime->format('l').', '.$rtime."<br />\n";
 	}
 	echo "</body>\n</html>\n";

Modified: trunk/setup/inc/class.setup_cmd.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/setup/inc/class.setup_cmd.inc.php?rev=55872&r1=55871&r2=55872&view=diff
==============================================================================
--- trunk/setup/inc/class.setup_cmd.inc.php (original)
+++ trunk/setup/inc/class.setup_cmd.inc.php Wed Apr 27 09:10:04 2016
@@ -5,10 +5,12 @@
  * @link http://www.egroupware.org
  * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
  * @package setup
- * @copyright (c) 2007-14 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
+ * @copyright (c) 2007-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
  * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
  * @version $Id$
  */
+
+use EGroupware\Api\Egw;
 
 /**
  * setup command: abstract baseclass for all setup commands, extending admin_cmd
@@ -85,7 +87,7 @@
 	/**
 	 * Saving the object to the database, reimplemented to not do it in setup context
 	 *
-	 * @param boolean $set_modifier=true set the current user as modifier or 0 (= run by the system)
+	 * @param boolean $set_modifier =true set the current user as modifier or 0 (= run by the system)
 	 * @return boolean true on success, false otherwise
 	 */
 	function save($set_modifier=true)
@@ -120,7 +122,7 @@
 		self::$egw_setup->ConfigDomain = $domain;
 
 		if (isset($GLOBALS['egw_info']['server']['header_admin_user']) && !isset($GLOBALS['egw_domain']) &&
-			is_object($GLOBALS['egw']) && $GLOBALS['egw'] instanceof egw)
+			is_object($GLOBALS['egw']) && $GLOBALS['egw'] instanceof Egw)
 		{
 			// we run inside eGW, not setup --> read egw_domain array from the header via the showheader cmd
 			$cmd = new setup_cmd_showheader(null);	// null = only header, no db stuff, no hashes
@@ -172,7 +174,7 @@
 	 *
 	 * @param string $user
 	 * @param string $pw
-	 * @param string $domain=null if given we also check agains config user/pw
+	 * @param string $domain =null if given we also check agains config user/pw
 	 * @throws egw_exception_no_permission(lang('Access denied: wrong username or password for manage-header !!!'),21);
 	 * @throws egw_exception_no_permission(lang("Access denied: wrong username or password to configure the domain '%1(%2)' !!!",$domain,$GLOBALS['egw_domain'][$domain]['db_type']),40);
 	 */
@@ -219,9 +221,9 @@
 	 *
 	 * Sets self::$apps_to_update and self::$apps_to_install for the last/only domain only!
 	 *
-	 * @param string $domain='' domain to check, default '' = all
-	 * @param int/array $stop=0 stop checks before given exit-code(s), default 0 = all checks
-	 * @param boolean $verbose=false echo messages as they happen, instead returning them
+	 * @param string $domain ='' domain to check, default '' = all
+	 * @param int/array $stop =0 stop checks before given exit-code(s), default 0 = all checks
+	 * @param boolean $verbose =false echo messages as they happen, instead returning them
 	 * @return array with translated messages
 	 */
 	static function check_installed($domain='',$stop=0,$verbose=false)

Modified: trunk/wiki/lib/url.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/wiki/lib/url.php?rev=55872&r1=55871&r2=55872&view=diff
==============================================================================
--- trunk/wiki/lib/url.php (original)
+++ trunk/wiki/lib/url.php Wed Apr 27 09:10:04 2016
@@ -1,23 +1,24 @@
 <?php
 /* $Id$ */
 
+use EGroupware\Api\Egw;
+
 // Under EGroupware these URL's are NOT configurable, you can set the webserver_url in setup
-if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof egw))
+if (is_object($GLOBALS['egw']) && ($GLOBALS['egw'] instanceof Egw))
 {
-	if (!method_exists($GLOBALS['egw'], 'link')) throw new egw_exception_assertion_failed('undefined method egw::link()!');
-	$ScriptBase = $GLOBALS['egw']->link('/wiki/index.php');
+	$ScriptBase = Egw::link('/wiki/index.php');
 	$ScriptBase .= strpos($ScriptBase,'?') !== false ? '&' : '?';
 
 	$AdminScript = $ScriptBase . 'action=admin';
 
 	//if(!isset($ViewBase))
-		{ $ViewBase    = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'wiki.wiki_ui.view')). '&page='; }
+		{ $ViewBase    = Egw::link('/index.php',array('menuaction'=>'wiki.wiki_ui.view')). '&page='; }
 	//if(!isset($EditBase))
-		{ $EditBase    = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'wiki.wiki_ui.edit')).'&page='; }
+		{ $EditBase    = Egw::link('/index.php',array('menuaction'=>'wiki.wiki_ui.edit')).'&page='; }
 	//if(!isset($HistoryBase))
 		{ $HistoryBase = $ScriptBase . 'action=history&page='; }
 	//if(!isset($FindScript))
-		{ $FindScript  = $GLOBALS['egw']->link('/index.php',array('menuaction'=>'wiki.wiki_ui.search')); }
+		{ $FindScript  = Egw::link('/index.php',array('menuaction'=>'wiki.wiki_ui.search')); }
 	//if(!isset($FindBase))
 		{ $FindBase    = $FindScript . '&search='; }
 	//if(!isset($SaveBase))
@@ -110,5 +111,3 @@
 		return $SaveBase . urlencode($page);
 	}
 }
-
-?>


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.