}
- 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');
+ $g = DB_DataObject::Factory('core_group_member');
if (is_a($g, 'DB_DataObject')) {
$grps = $g->listGroupMembership($this->authUser);
//var_dump($grps);
$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..
}
}
echo "<HR><H2>Posted Data:</H2>";
-
+ $logdir = DB_DAtaObject::Factory('Events')->logDir();
- $ff = HTML_FlexyFramework::get();
- if (empty($ff->Pman['event_log_dir'])) {
- echo "not available (not configured)";
+ if (!$logdir) {
+ echo "not available (Pman[storedir] not configured)";
exit;
}
- if (function_exists('posix_getpwuid')) {
- $uinfo = posix_getpwuid( posix_getuid () );
-
- $user = $uinfo['name'];
- } else {
- $user = getenv('USERNAME'); // windows.
- }
-
- $file = $ff->Pman['event_log_dir']. "/{$user}" . date('/Y/m/d/',strtotime($ev->event_when)). $ev->id . ".json";
+ $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 '<BR/><PRE>'. htmlspecialchars($ev->remarks) . '</PRE>';
+ $json = json_decode($ev->remarks, JSON_PRETTY_PRINT);
+
+ if(json_last_error() == JSON_ERROR_NONE){
+ echo "<HR><H2>JSON DECODE Data:</H2>";
+ echo '<PRE>' . print_r($json, true) . '</PRE>';
+ }
+
$filesJ = json_decode(file_get_contents($file));
- echo '<br /><PRE>Images Preview</PRE>';
+ echo '<br /><PRE>Download files</PRE>';
- foreach($filesJ->FILES as $f){
- $ip = $ff->baseURL."/Images/events/". $f->tmp_name;
- echo '<a href="'.$ip.'/download" ><img src="'.$ip.'" width="150"/></a>';
-
+ foreach($filesJ->FILES as $k=>$f){
+ $ip = $ff->baseURL."/Images/events/". $ev->id . '/'. $f->tmp_name;
+ echo '<a href="'.$ip.'/download">' . htmlspecialchars( $k . ' - ' . $f->name ) . '</a><br/>';
}