[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/core_functions.inc.php, 1.1.1.1.2.23
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/core_functions.inc.php, 1.1.1.1.2.23 |
Date: |
Sun, 23 May 2004 16:03:49 -0000 |
Update of /api
Modified Files:
Branch: proposal-branch
core_functions.inc.php
date: 2004/05/08 06:04:43; author: jengo; state: Exp; lines: +43 -35
Log Message:
Added support to call execMethod like notes.base.view.1 which will pass the 1
as the first and only parameter. This only works if its a number and there are
no other parameters passed. This is mainly going to be used in datamine
=====================================================================
Index: api/core_functions.inc.php
diff -u api/core_functions.inc.php:1.1.1.1.2.22
api/core_functions.inc.php:1.1.1.1.2.23
--- api/core_functions.inc.php:1.1.1.1.2.22 Mon May 3 07:20:43 2004
+++ api/core_functions.inc.php Sat May 8 06:04:43 2004
@@ -23,7 +23,10 @@
/* $Id$ */
/* $Source$ */
-
+
+ define('NOMETHOD','##NOMETHOD##');
+ define('PRIVATE_METHOD','##PRIVATE_METHOD##');
+
/**************************************************************************\
* Direct functions which are not part of the API classes
*
* because they are required to be available at the lowest level.
*
@@ -32,7 +35,6 @@
@collection_start direct functions
@abstract Direct functions which are not part of the API classes
because they are required to be available at the lowest level.
*/
-
function phpgw_exit()
{
if(!defined('PHPGW_FINISHED') && is_object($GLOBALS['phpgw']))
@@ -199,7 +201,7 @@
trigger_error($class.' '.$msg,E_USER_WARNING);
}
/* If method didnt exist */
- return '##NOMETHOD##';
+ return NOMETHOD;
}
function saveObject(&$obj, $var_name = NULL)
@@ -241,7 +243,7 @@
{
$args = new safe_args();
$args->set('function', REQUIRED);
- $args->set('inputs',NOTSET);
+ $args->set('inputs',NOVAR);
$args->set('silent',false);
extract($args->get(func_get_args()));
@@ -253,21 +255,21 @@
$GLOBALS['performance_timer']->stop($function_name);
return;
}
-
- list($appname,$classname,$methodname) = explode('.', $function);
+
+ list($appname,$classname,$methodname,$id) =
explode('.',$function);
if (substr($methodname,0,2) == '__')
{
trigger_error('Attempted access for a private method: '
. $function,E_USER_ERROR);
$GLOBALS['performance_timer']->stop($function_name);
- return '##PRIVATE_METHOD##';
+ return PRIVATE_METHOD;
}
-
+
if (! validate($appname,'alphanumeric') &&
validate($classname,'alphanumeric') && validate($methodname,'alphanumeric'))
{
$GLOBALS['performance_timer']->stop($function_name);
return;
}
-
+
$filename = PHPGW_ROOT.SEP.$appname.SEP.'constructor.inc.php';
if(file_exists($filename))
{
@@ -275,13 +277,18 @@
}
$class = $appname.'_'.$classname;
- $obj = createObject($class, NOTSET, $silent);
+ $obj = createObject($class, NOVAR, $silent);
if (method_exists($obj,$methodname))
{
- if ($inputs == NOTSET)
+ if (validate($id,'number'))
+ {
+ $v_id = $id;
+ }
+
+ if ($inputs == NOVAR)
{
$GLOBALS['performance_timer']->stop($function_name);
- $result = $obj->$methodname();
+ $result = $obj->$methodname(($v_id ? $v_id :
NULL));
return $result;
}
@@ -289,7 +296,7 @@
$result = $obj->$methodname($inputs);
return $result;
}
-
+
if(!$silent)
{
$msg = 'does not exist';
@@ -302,7 +309,7 @@
// If method didnt exist
$GLOBALS['performance_timer']->stop($function);
- return '##NOMETHOD##';
+ return NOMETHOD;
}
/*!
@@ -837,27 +844,28 @@
}
break;
case 'htmlsafe':
- $pattern[0] = '/\&/';
- $pattern[1] = '/</';
- $pattern[2] = "/>/";
- $pattern[3] = '/\n/';
- $pattern[4] = '/"/';
- $pattern[5] = "/'/";
- $pattern[6] = "/%/";
- $pattern[7] = '/\(/';
- $pattern[8] = '/\)/';
- $pattern[9] = '/\+/';
+ $pattern[0] = '/\&/';
+ $pattern[1] = '/</';
+ $pattern[2] = "/>/";
+ $pattern[3] = '/\n/';
+ $pattern[4] = '/"/';
+ $pattern[5] = "/'/";
+ $pattern[6] = "/%/";
+ $pattern[7] = '/\(/';
+ $pattern[8] = '/\)/';
+ $pattern[9] = '/\+/';
$pattern[10] = '/-/';
- $replacement[0] = '&';
- $replacement[1] = '<';
- $replacement[2] = '>';
- $replacement[3] = '<br>';
- $replacement[4] = '"';
- $replacement[5] = ''';
- $replacement[6] = '%';
- $replacement[7] = '(';
- $replacement[8] = ')';
- $replacement[9] = '+';
+
+ $replacement[0] = '&';
+ $replacement[1] = '<';
+ $replacement[2] = '>';
+ $replacement[3] = '<br>';
+ $replacement[4] = '"';
+ $replacement[5] = ''';
+ $replacement[6] = '%';
+ $replacement[7] = '(';
+ $replacement[8] = ')';
+ $replacement[9] = '+';
$replacement[10] = '-';
$result = preg_replace($pattern, $replacement,
$input);
break;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/core_functions.inc.php, 1.1.1.1.2.23,
nomail <=