Author: ralfbecker
New Revision: 55658
URL: http://svn.stylite.de/viewvc/egroupware?rev=55658&view=rev
Log:
moving client-data urls to api
Added:
trunk/egroupware/api/categories.php
- copied, changed from r55642, trunk/phpgwapi/categories.php
trunk/egroupware/api/config.php
- copied, changed from r55642, trunk/phpgwapi/config.php
trunk/egroupware/api/images.php
- copied, changed from r55642, trunk/phpgwapi/images.php
trunk/egroupware/api/lang.php
- copied, changed from r55642, trunk/phpgwapi/lang.php
trunk/egroupware/api/user.php
- copied, changed from r55642, trunk/phpgwapi/user.php
Removed:
trunk/phpgwapi/categories.php
trunk/phpgwapi/config.php
trunk/phpgwapi/images.php
trunk/phpgwapi/lang.php
trunk/phpgwapi/user.php
Modified:
trunk/egroupware/api/src/Categories.php
trunk/phpgwapi/inc/class.egw_framework.inc.php
trunk/phpgwapi/js/jsapi/egw_images.js
trunk/phpgwapi/js/jsapi/egw_lang.js
— trunk/phpgwapi/categories.php (original)
+++ trunk/egroupware/api/categories.php Wed Apr 6 21:57:40 2016
@@ -2,21 +2,23 @@
/**
- API: loading categories and setting styles
-
-
- Usage: /egroupware/phpgwapi/categories.php[?app=calendar]
-
- Usage: /egroupware/api/categories.php[?app=calendar]
-
-
@link www.egroupware.org
-
@author Nathan Gray
+use EGroupware\Api;
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
ini_set(‘zlib.output_compression’, 0);
$GLOBALS[‘egw_info’] = array(
‘flags’ => array(
// Get appname
-$appname = $_GET[‘app’] && $GLOBALS[‘egw_info’][‘apps’][$_GET[‘app’]] ? $_GET[‘app’] : categories::GLOBAL_APPNAME;
+$appname = $_GET[‘app’] && $GLOBALS[‘egw_info’][‘apps’][$_GET[‘app’]] ? $_GET[‘app’] : Api\Categories::GLOBAL_APPNAME;
-$cats = new categories(’’, $appname);
-$categories = $cats->return_array(‘all’,0, false, ‘’, ‘ASC’,’’,$appname==categories::GLOBAL_APPNAME);
+$cats = new Api\Categories(’’, $appname);
+$categories = $cats->return_array(‘all’,0, false, ‘’, ‘ASC’,’’,$appname==Api\Categories::GLOBAL_APPNAME);
$content = “/* Category CSS for $appname */\n\n”;
@@ -50,7 +52,7 @@
$etag = ‘"’.md5($content).’"’;
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
-egw_session::cache_control(86400); // cache for 1 day
+Api\Session::cache_control(86400); // cache for 1 day
Header(‘Content-Type: text/css; charset=utf-8’);
Header('ETag: '.$etag);
@@ -58,7 +60,7 @@
if (isset($_SERVER[‘HTTP_IF_NONE_MATCH’]) && $_SERVER[‘HTTP_IF_NONE_MATCH’] == $etag)
{
header(“HTTP/1.1 304 Not Modified”);
// we run our own gzip compression, to set a correct Content-Length of the encoded content
— trunk/phpgwapi/config.php (original)
+++ trunk/egroupware/api/config.php Wed Apr 6 21:57:40 2016
@@ -1,22 +1,24 @@
<?php
/**
- * API: loading translation from from browser
+ * API: loading configuratino from server
*
- * Usage: /egroupware/phpgwapi/lang.php?app=infolog&lang=de
+ * Usage: /egroupware/api/config.php
*
* @link www.egroupware.org
* @author Ralf Becker
- * @package addressbook
+ * @package api
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
ini_set('zlib.output_compression', 0);
$GLOBALS['egw_info'] = array(
'flags' => array(
- 'currentapp' => 'home',
+ 'currentapp' => 'api',
'noheader' => true,
'nocachecontrol' => true,
)
@@ -25,12 +27,12 @@
include '../header.inc.php';
// use an etag over config and link-registry
-$config = json_encode(config::clientConfigs());
-$link_registry = egw_link::json_registry();
+$config = json_encode(Api\Config::clientConfigs());
+$link_registry = Api\Link::json_registry();
$etag = '"'.md5($config.$link_registry).'"';
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
-egw_session::cache_control(86400); // cache for one day
+Api\Session::cache_control(86400); // cache for one day
Header('Content-Type: text/javascript; charset=utf-8');
Header('ETag: '.$etag);
@@ -38,7 +40,7 @@
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
{
header("HTTP/1.1 304 Not Modified");
- common::egw_exit();
+ exit;
}
$content = 'egw.set_configs('.$config.", egw && egw.window !== window);\n";
Copied: trunk/egroupware/api/images.php (from r55642, trunk/phpgwapi/images.php)
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/images.php?p2=trunk/egroupware/api/images.php&p1=trunk/phpgwapi/images.php&r1=55642&r2=55658&rev=55658&view=diff
==============================================================================
--- trunk/phpgwapi/images.php (original)
+++ trunk/egroupware/api/images.php Wed Apr 6 21:57:40 2016
@@ -2,21 +2,23 @@
/**
* API: loading available images by application and image-name (without extension)
*
- * Usage: /egroupware/phpgwapi/images.php?template=idots
+ * Usage: /egroupware/api/images.php?template=idots
*
* @link www.egroupware.org
* @author Ralf Becker
- * @package phpgwapi
+ * @package api
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
ini_set('zlib.output_compression', 0);
$GLOBALS['egw_info'] = array(
'flags' => array(
- 'currentapp' => 'home',
+ 'currentapp' => 'api',
'noheader' => true,
'nocachecontrol' => true,
)
@@ -24,13 +26,13 @@
include '../header.inc.php';
-$content = json_encode(common::image_map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null, $_GET['svg']));
+$content = json_encode(Api\Image::map(preg_match('/^[a-z0-9_-]+$/i',$_GET['template']) ? $_GET['template'] : null, $_GET['svg']));
// use an etag over the image mapp
$etag = '"'.md5($content).'"';
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
-egw_session::cache_control(86400); // cache for one day
+Api\Session::cache_control(86400); // cache for one day
Header('Content-Type: text/javascript; charset=utf-8');
Header('ETag: '.$etag);
@@ -38,7 +40,7 @@
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
{
header("HTTP/1.1 304 Not Modified");
- common::egw_exit();
+ exit;
}
$content = 'egw.set_images('.$content.", egw && egw.window !== window);\n";
Copied: trunk/egroupware/api/lang.php (from r55642, trunk/phpgwapi/lang.php)
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/lang.php?p2=trunk/egroupware/api/lang.php&p1=trunk/phpgwapi/lang.php&r1=55642&r2=55658&rev=55658&view=diff
==============================================================================
--- trunk/phpgwapi/lang.php (original)
+++ trunk/egroupware/api/lang.php Wed Apr 6 21:57:40 2016
@@ -1,15 +1,17 @@
<?php
/**
- * API: loading translation from from browser
+ * API: loading translation from server
*
- * Usage: /egroupware/phpgwapi/lang.php?app=infolog&lang=de
+ * Usage: /egroupware/api/lang.php?app=infolog&lang=de
*
* @link www.egroupware.org
* @author Ralf Becker
- * @package addressbook
+ * @package api
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
// just to be sure, noone tries something nasty ...
if (!preg_match('/^[a-z0-9_]+$/i', $_GET['app'])) die('No valid application-name given!');
@@ -20,7 +22,7 @@
$GLOBALS['egw_info'] = array(
'flags' => array(
- 'currentapp' => 'home',
+ 'currentapp' => 'api',
'noheader' => true,
'load_translations' => false, // do not automatically load translations
'nocachecontrol' => true,
@@ -31,16 +33,16 @@
{
include('../header.inc.php');
}
-catch (egw_exception_no_permission_app $e)
+catch (\EGroupware\Api\Exception\NoPermission\App $e)
{
// ignore missing run rights for an app, as translations of other apps are loaded sometimes without run rights
}
// use an etag with app, lang and a hash over the creation-times of all lang-files
-$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'.translation::etag($_GET['app'], $_GET['lang']).'"';
+$etag = '"'.$_GET['app'].'-'.$_GET['lang'].'-'. Api\Translation::etag($_GET['app'], $_GET['lang']).'"';
// headers to allow caching, we specify etag on url to force reload, even with Expires header
-egw_session::cache_control(864000); // cache for 10 days
+Api\Session::cache_control(864000); // cache for 10 days
Header('Content-Type: text/javascript; charset=utf-8');
Header('ETag: '.$etag);
@@ -48,18 +50,18 @@
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
{
header("HTTP/1.1 304 Not Modified");
- common::egw_exit();
+ exit;
}
-translation::init(false);
-translation::add_app($_GET['app'], $_GET['lang']);
-if (!count(translation::$lang_arr))
+Api\Translation::init(false);
+Api\Translation::add_app($_GET['app'], $_GET['lang']);
+if (!count(Api\Translation::$lang_arr))
{
- translation::add_app($_GET['app'], 'en');
+ Api\Translation::add_app($_GET['app'], 'en');
}
// fix for phrases containing \n
-$content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(translation::$lang_arr)).', egw && egw.window !== window);';
+$content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(Api\Translation::$lang_arr)).', egw && egw.window !== window);';
// we run our own gzip compression, to set a correct Content-Length of the encoded content
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))
Modified: trunk/egroupware/api/src/Categories.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/src/Categories.php?rev=55658&r1=55657&r2=55658&view=diff
==============================================================================
--- trunk/egroupware/api/src/Categories.php (original)
+++ trunk/egroupware/api/src/Categories.php Wed Apr 6 21:57:40 2016
@@ -1039,7 +1039,7 @@
$cats = new Categories('',$appname);
$last_mod = $cats->return_array('all',0,1,'','DESC','last_mod', $appname == self::GLOBAL_APPNAME);
$time = count($last_mod) ? $last_mod[0]['last_mod'] : time();
- $path = '/phpgwapi/categories.php?app='.$appname.'&'.$time;
+ $path = '/api/categories.php?app='.$appname.'&'.$time;
egw_framework::includeCSS($path);
return $path;
Copied: trunk/egroupware/api/user.php (from r55642, trunk/phpgwapi/user.php)
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/user.php?p2=trunk/egroupware/api/user.php&p1=trunk/phpgwapi/user.php&r1=55642&r2=55658&rev=55658&view=diff
==============================================================================
--- trunk/phpgwapi/user.php (original)
+++ trunk/egroupware/api/user.php Wed Apr 6 21:57:40 2016
@@ -2,21 +2,23 @@
/**
* API: loading user preferences and data
*
- * Usage: /egroupware/phpgwapi/lang.php?user=123
+ * Usage: /egroupware/api/user.php?user=123
*
* @link www.egroupware.org
* @author Ralf Becker
- * @package addressbook
+ * @package api
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
// switch evtl. set output-compression off, as we cant calculate a Content-Length header with transparent compression
ini_set('zlib.output_compression', 0);
$GLOBALS['egw_info'] = array(
'flags' => array(
- 'currentapp' => 'home',
+ 'currentapp' => 'api',
'noheader' => true,
'nocachecontrol' => true,
)
@@ -31,7 +33,7 @@
$etag = '"'.md5($preferences.$ab_preferences.$user).'"';
// headers to allow caching, egw_framework specifies etag on url to force reload, even with Expires header
-egw_session::cache_control(86400); // cache for 1 day
+Api\Session::cache_control(86400); // cache for 1 day
Header('Content-Type: text/javascript; charset=utf-8');
Header('ETag: '.$etag);
@@ -39,7 +41,7 @@
if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $etag)
{
header("HTTP/1.1 304 Not Modified");
- common::egw_exit();
+ exit;
}
$content = 'egw.set_preferences('.$preferences.", 'common', egw && egw.window !== window);\n";
Modified: trunk/phpgwapi/inc/class.egw_framework.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/inc/class.egw_framework.inc.php?rev=55658&r1=55657&r2=55658&view=diff
==============================================================================
--- trunk/phpgwapi/inc/class.egw_framework.inc.php (original)
+++ trunk/phpgwapi/inc/class.egw_framework.inc.php Wed Apr 6 21:57:40 2016
@@ -1425,15 +1425,15 @@
// specifying etag in url to force reload, as we send expires header
if ($GLOBALS['egw_info']['flags']['js_link_registry'])
{
- self::validate_file('/phpgwapi/config.php', array(
+ self::validate_file('/api/config.php', array(
'etag' => md5(json_encode(config::clientConfigs()).egw_link::json_registry()),
));
- self::validate_file('/phpgwapi/images.php', array(
+ self::validate_file('/api/images.php', array(
'template' => $GLOBALS['egw_info']['server']['template_set'],
'etag' => md5(json_encode(common::image_map($GLOBALS['egw_info']['server']['template_set']))),
'svg' => html::$ua_mobile, // always load non-svg image map, ATM we use svg icons only for mobile theme
));
- self::validate_file('/phpgwapi/user.php', array(
+ self::validate_file('/api/user.php', array(
'user' => $GLOBALS['egw_info']['user']['account_lid'],
'lang' => $GLOBALS['egw_info']['user']['preferences']['common']['lang'],
// add etag on url, so we can set an expires header
Modified: trunk/phpgwapi/js/jsapi/egw_images.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/js/jsapi/egw_images.js?rev=55658&r1=55657&r2=55658&view=diff
==============================================================================
--- trunk/phpgwapi/js/jsapi/egw_images.js (original)
+++ trunk/phpgwapi/js/jsapi/egw_images.js Wed Apr 6 21:57:40 2016
@@ -44,7 +44,7 @@
return {
/**
- * Set imagemap, called from /phpgwapi/images.php
+ * Set imagemap, called from /api/images.php
*
* @param {array|object} _images
* @param {boolean} _need_clone _images need to be cloned, as it is from different window context
Modified: trunk/phpgwapi/js/jsapi/egw_lang.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/phpgwapi/js/jsapi/egw_lang.js?rev=55658&r1=55657&r2=55658&view=diff
==============================================================================
--- trunk/phpgwapi/js/jsapi/egw_lang.js (original)
+++ trunk/phpgwapi/js/jsapi/egw_lang.js Wed Apr 6 21:57:40 2016
@@ -147,7 +147,7 @@
if (typeof lang_arr[_apps[i].app] === "undefined")
{
jss.push(this.webserverUrl +
- '/phpgwapi/lang.php?app=' + _apps[i].app +
+ '/api/lang.php?app=' + _apps[i].app +
'&lang=' + _apps[i].lang +
'&etag=' + (_apps[i].etag || this.config('max_lang_time')));
}
------------------------------------------------------------------------------
_______________________________________________
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs