mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
"prevent that anyone switches the global db object to an app != 'phpgwapi' (you have to clone it before doing that)"
This commit is contained in:
parent
b550aeecf5
commit
eb2303adc8
@ -1405,6 +1405,18 @@ class egw_db
|
||||
{
|
||||
$this->column_definitions=$column_definitions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Application name used by the API
|
||||
*
|
||||
*/
|
||||
const API_APPNAME = 'phpgwapi';
|
||||
/**
|
||||
* Default app, if no app specified in select, insert, delete, ...
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $app=self::API_APPNAME;
|
||||
|
||||
/**
|
||||
* Sets the application in which the db-class looks for table-defintions
|
||||
@ -1416,6 +1428,11 @@ class egw_db
|
||||
*/
|
||||
function set_app($app)
|
||||
{
|
||||
if ($this === $GLOBALS['egw']->db && $app != self::API_APPNAME)
|
||||
{
|
||||
// prevent that anyone switches the global db object to an other app
|
||||
throw new egw_exception_wrong_parameter('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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user