$this->jerrAuth();
}
return true;
-
-
+
}
- function get($id)
- {
+ function get($id, $opts = Array())
+ {
$ev = DB_DataObject::Factory('Events');
if (!$ev->get((int)$id)) {
$this->jerr("invalid id");
}
// verify if not admin, then they should
- $g = DB_DataObject::Factory('Group_Members');
- $grps = $g->listGroupMembership($this->authUser);
- //var_dump($grps);
- $isAdmin = $g->inAdmin;
-
- if (!$isAdmin && $ev->person_id != $this->authUser->id) {
- $this->jerrAuth();
+ $g = DB_DataObject::Factory('core_group_member');
+ if (is_a($g, 'DB_DataObject')) {
+ $grps = $g->listGroupMembership($this->authUser);
+ //var_dump($grps);
+ $isAdmin = $g->inAdmin;
+
+ if (!$isAdmin && $ev->person_id != $this->authUser->id) {
+ $this->jerrAuth();
+ }
}
+
+ echo '<PRE>'.htmlspecialchars(print_r($ev->toArray(),true))."</PRE>";
// we have 2 bits of data available at present:
// core_event_audit
// the event file..
$d= DB_DataObject::factory('core_event_audit');
- if (is_a($d,'DB_DataObject')) {
+ $d->event_id = $ev->id; // we can set that as the above returns error or dataobject..
+ if (is_a($d,'DB_DataObject') && $d->count()) {
echo "<H2>Changed Data:</H2>";
- $d->event_id = $ev->id;
+
foreach($d->fetchAll() as $d) {
echo "{$d->name} SET TO: " . htmlspecialchars($d->newvalue) . "<br/>\n";
}
}
- $fn = date('/Y/m/d/'). $ev->id . ".php";strtotime($ev->event_when);
+ echo "<HR><H2>Posted Data:</H2>";
- $eid = $e->insert();
+ $logdir = DB_DAtaObject::Factory('Events')->logDir();
+
+ if (!$logdir) {
+ echo "not available (Pman[storedir] not configured)";
+ exit;
+ }
+
+ $file = $logdir. date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".php";
+ if (file_exists($file)) {
+ echo '<PRE>' . htmlspecialchars(file_get_contents($file)). '</PRE>';
+
+ }
+
+ $file = $logdir. date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".json";
+ if (!file_exists($file)) {
+ echo "not available (missing file) $file";
+ exit;
+ }
+
+ echo '<PRE>' . htmlspecialchars(print_r(json_decode(file_get_contents($file)), true)) . '</PRE>';
+
+ if (!empty($ev->remarks)) {
+ echo "<HR><H2>Remarks:</H2>";
+ echo '<PRE>'. htmlspecialchars($ev->remarks) . '</PRE>';
+ }
- $wa = DB_DataObject::factory('core_watch');
- $wa->notifyEvent($e); // trigger any actions..
+ $json = json_decode($ev->remarks, JSON_PRETTY_PRINT);
- $ff = HTML_FlexyFramework::get();
- if (empty($ff->Pman['event_log_dir'])) {
- return $e;
+ if(json_last_error() == JSON_ERROR_NONE){
+ echo "<HR><H2>JSON DECODE Data:</H2>";
+ echo '<PRE>' . print_r($json, true) . '</PRE>';
}
- $file = $ff->Pman['event_log_dir']. date('/Y/m/d/'). $eid . ".php";
- if (!file_exists(dirname($file))) {
- mkdir(dirname($file),0700,true);
+ $filesJ = json_decode(file_get_contents($file));
+ if (!empty($filesJ->FILES )) {
+ echo "<HR><H2>Download files:</H2><ul>";
+
+
+ foreach($filesJ->FILES as $k=>$f){
+ $ip = $this->baseURL."/Images/events/". $ev->id . '/'. $f->tmp_name;
+
+ echo '<li><a target="_new" href="'.$ip.'/download">' . htmlspecialchars( $k . ' - ' . $f->name ) . '</a><br/>';
+ }
+ echo "</ul>";
+
}
- file_put_contents($file, var_export(array(
- 'REQUEST_URI' => empty($_SERVER['REQUEST_URI']) ? 'cli' : $_SERVER['REQUEST_URI'],
- 'GET' => empty($_GET) ? array() : $_GET,
- 'POST' => empty($_POST) ? array() : $_POST,
- ), true));
-
- if (file_exists())
+ exit;
}