* - authentication reset password ?? MOVEME?
* ?? arrayClean.. what's it doing here?!? ;)
*
- *
+ * Usefull implemetors
+ * DB_DataObject*:*toEventString (for logging - this is generically prefixed to all database operations.)
+ * - any data object where this method exists, the result will get prefixed to the log remarks
*/
class Pman extends HTML_FlexyFramework_Page
return $au->hasPerm($name,$lvl);
}
+
+ function modules()
+ {
+ // appModules/appDisable contain a comma limited list of
+ // both modules and components that can be enabled/disabled..
+ $boot = HTML_FlexyFramework::get();
+
+ // the modules call just lists the modules
+ $enabled = array('Core' => true);
+ $am = !empty($boot->enable) ? explode(',', $boot->enable) : array();
+ foreach($am as $k) {
+ if (strpos( $k ,'.') ) {
+ continue;
+ }
+ $enabled[$k] = true;
+ }
+
+
+ $disabled = !empty($boot->disable) ? explode(',', $boot->disable) : array();
+ foreach($disabled as $k) {
+ if ( strpos( $k ,'.') ) {
+ continue;
+ }
+ if (isset($enabled[$k])) {
+ unset($enabled[$k]);
+ }
+ }
+ //echo '<PRE>'; var_Dump($enabled);
+
+ return array_keys($enabled);
+ }
+
function hasModule($name)
{
$this->init();
if (!strpos( $name,'.') ) {
// use enable / disable..
-
-
- $enabled = array('Core') ;
- $enabled = !empty($this->appModules) ?
- array_merge($enabled, explode(',', $this->appModules)) :
- $enabled;
- $disabled = explode(',', $this->appDisable ? $this->appDisable: '');
-
- //print_R($opts);
-
- return in_array($name, $enabled) && !in_array($name, $disabled);
+ return in_array($name, $this->modules());
}
$x = DB_DataObject::factory('Group_Rights');
require_once 'Services/JSON.php';
$json = new Services_JSON();
+ // log all errors!!!
+ $this->addEvent("ERROR", false, $str);
+
if (!empty($_REQUEST['returnHTML']) ||
(isset($_SERVER['CONTENT_TYPE']) && preg_match('#multipart/form-data#i', $_SERVER['CONTENT_TYPE']))
) {
echo $json->encodeUnsafe(array(
'success'=> false,
'errorMsg' => $str,
- 'message' => $str, // compate with exeption / loadexception.
+ 'message' => $str, // compate with exeption / loadexception.
'errors' => $errors ? $errors : true, // used by forms to flag errors.
'authFailure' => !empty($errors['authFailure']),
echo "</BODY></HTML>";
exit;
}
-
+
echo $json->encode(array(
'success'=> false,
'data'=> array(),
{
$mods = explode(',', $this->appModules);
- array_unshift($mods, 'Core');
- $mods = array_unique($mods);
-
+ if (in_array('Core',$mods)) { // core has to be the first modules loaded as it contains Pman.js
+ array_unshift($mods, 'Core');
+ }
+ $mods = array_unique($mods);
+
$disabled = explode(',', $this->appDisable ? $this->appDisable: '');
foreach($mods as $mod) {
{
$au = $this->getAuthUser();
$e = DB_DataObject::factory('Events');
-
- if (is_a($e, 'PEAR_Error')) {
- return; // no event table!
- }
- $e->person_name = $au ? $au->name : '';
- $e->person_id = $au ? $au->id : '';
- $e->ipaddr = isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : 'cli';
- $e->action = $act;
- $e->on_table = $obj ? $obj->tableName() : '';
- $pk = $obj ? $obj->keys() : false;
- $e->on_id = $obj && $pk ? $obj->{$pk[0]}: 0;
- $e->remarks = $remarks;
+ $e->init($act,$obj,$remarks);
if ($e->find(true)) {
return;
}
{
$au = $this->getAuthUser();
$e = DB_DataObject::factory('Events');
-
- if (is_a($e, 'PEAR_Error')) {
- return; // no event table!
- }
- $e->person_name = $au ? $au->name : '';
- $e->person_id = $au ? $au->id : '';
+ $e->init($act,$obj,$remarks);
+
$e->event_when = date('Y-m-d H:i:s');
- $e->ipaddr = isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : 'cli';
- $e->action = $act;
- $e->on_table = $obj ? $obj->tableName() : '';
- $pk = $obj ? $obj->keys() : false;
-
- $e->on_id = $obj && $pk ? $obj->{$pk[0]}: 0;
- $e->remarks = $remarks;
$eid = $e->insert();
$ff = HTML_FlexyFramework::get();
if (empty($ff->Pman['event_log_dir'])) {
mkdir(dirname($file),0700,true);
}
file_put_contents($file, var_export(array(
- 'REQUEST_URI' => $_SERVER['REQUEST_URI'],
+ 'REQUEST_URI' => empty($_SERVER['REQUEST_URI']) ? 'cli' : $_SERVER['REQUEST_URI'],
'GET' => empty($_GET) ? array() : $_GET,
'POST' => empty($_POST) ? array() : $_POST,
), true));