}
- 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>";
- $fn =
+ $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 '<PRE>' . htmlspecialchars(file_get_contents($file)) . '</PRE>';
+ echo '<PRE>' . htmlspecialchars(print_r(json_decode(file_get_contents($file)), true)) . '</PRE>';
echo '<BR/><PRE>'. htmlspecialchars($ev->remarks) . '</PRE>';
- $filesJ = json_decode(file_get_contents($file));
- echo '<br /><PRE>Images Preview</PRE>';
-
- // should be change to event dir
- $path = $ff->baseURL. "/Images/Thumb/150/{$ev->on_id}";
- foreach($filesJ->FILES as $f){
- $ip = $ff->Pman['event_log_dir']. "/{$user}" . date('/Y/m/d/',strtotime($ev->event_when)). $f->tmp_name;
- $img = getimagesize($ip);
-// header("Content-type: image/jpeg");
- //readfile($ip);
-// addslashes($ip);
- echo "<img src=\"$path\" />";
- //$path = $ff->baseURL. "Images/Thumb/150/$ff->Pman['event_log_dir']. "/{$user}" . date('/Y/m/d/',strtotime($ev->event_when)). $f->tmp_name;
- //echo '<img src="'.$path.'" />';
- print_r($ip);
+ $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>Download files</PRE>';
- exit;
+ foreach($filesJ->FILES as $k=>$f){
+ $ip = $this->baseURL."/Images/events/". $ev->id . '/'. $f->tmp_name;
+ echo '<a href="'.$ip.'/download">' . htmlspecialchars( $k . ' - ' . $f->name ) . '</a><br/>';
+ }
- }
-
- function readImage(){
- $url= str_replace('.jpg','',$url);
- $bits = explode('/', $url);
- $opts = PEAR::getStaticProperty('Hebe','options');
-
- if ( $bits[0] != 'members') {
- $bits[1] = $bits[0] . '/'.$bits[1];
- $bits[0] = 'members';
- }
- if (!isset($opts[$bits[0].'_photo_dir'])) {
- echo "NO OPT SET?";
- exit;
- }
- $file = $ff->Pman['event_log_dir']. "/{$user}" . date('/Y/m/d/',strtotime($ev->event_when)). $f->tmp_name;
-
- if (!file_exists($file)) {
- echo "NO FILE? $file";
- exit;
- }
+ exit;
- header ('Content-Type: image/jpeg');
- $fh = fopen($file,'r');
- echo fread($fh,filesize($file));
}