13 var $thumb_filename;
\r
23 var $previousthumbfilename;
\r
24 var $nextthumbfilename;
\r
26 function PICTURE($id) {
\r
30 $data = $this->get_data($id);
\r
32 $this->id = $data->pictureid;
\r
33 $this->title = $data->title;
\r
34 $this->description = $data->description;
\r
35 $this->ownerid = $data->ownerid;
\r
36 $this->ownername = $data->mname;
\r
37 $this->modified = $data->modified;
\r
38 $this->albumid = $data->albumid;
\r
39 $this->filename = $data->filename;
\r
40 $this->int_filename = $data->int_filename;
\r
41 $this->thumb_filename = $data->thumb_filename;
\r
42 $this->views = $data->views;
\r
43 $this->albumtitle = $data->albumtitle;
\r
44 $this->keywords = $data->keywords;
\r
48 $this->ownerid = $member->getID();
\r
52 function settemplate($template) {
\r
53 $this->template = & $template;
\r
57 //not present so add new to database
\r
59 $this->title = stripslashes($this->title);
\r
60 $this->title = addslashes($this->title);
\r
61 $this->description = stripslashes($this->description);
\r
62 $this->description = addslashes($this->description);
\r
63 sql_query("insert into ".sql_table('plug_gallery_picture')
\r
64 ." values (NULL, '{$this->title}' , '{$this->description}' , ".intval($this->ownerid)." , "
\r
65 ."NULL , ".intval($this->albumid)." , '".addslashes($this->filename)."' , '".addslashes($this->int_filename)."' , '".addslashes($this->thumb_filename)."', '".addslashes($this->keywords)."' )" );
\r
67 //picture id of most recently added -- could be referenced by calling fuction (or PICTURE->getID()
\r
68 $this->id = mysql_insert_id();
\r
70 //increment album number of images -- consider rewrite as an album method that actually counts number of images?
\r
71 sql_query("update ".sql_table('plug_gallery_album')." set numberofimages = numberofimages + 1 where albumid = ".intval($this->albumid));
\r
73 //present, so just update values
\r
75 $this->title = stripslashes($this->title);
\r
76 $this->title = addslashes($this->title);
\r
77 $this->description = stripslashes($this->description);
\r
78 $this->description = addslashes($this->description);
\r
79 sql_query("update ".sql_table('plug_gallery_picture')
\r
80 ." set title='".$this->title."', "
\r
81 ."description='".$this->description."', "
\r
82 ."keywords='".addslashes($this->keywords)."',"
\r
83 ."albumid=".intval($this->albumid)." "
\r
84 ."where pictureid=".intval($this->id) );
\r
89 function get_data($id) {
\r
90 $result = sql_query("select a.*, b.mname from ".sql_table('plug_gallery_picture').' as a left join '.sql_table('member')." as b on a.ownerid=b.mnumber where a.pictureid=".intval($id) );
\r
91 if(mysql_num_rows($result)) {
\r
92 if(mysql_num_rows($result)){
\r
93 $data = mysql_fetch_object($result);
\r
94 if(!$data->mname) $data->mname = 'guest';
\r
96 //get number of views
\r
97 $res = sql_query('select views from '.sql_table('plug_gallery_views').' where vpictureid = '.intval($data->pictureid));
\r
98 if(mysql_num_rows($res)) {
\r
99 $row = mysql_fetch_object($res);
\r
100 $data->views = $row->views;
\r
102 else $data->views = 0;
\r
104 //get albumtitle for breadcrumb
\r
105 $res = sql_query('select title from '.sql_table('plug_gallery_album').' where albumid='.intval($data->albumid));
\r
106 if(mysql_num_rows($res)) {
\r
107 $row = mysql_fetch_object($res);
\r
108 $data->albumtitle = $row->title;
\r
110 else $data->albumtitle = 'No Album Title';
\r
112 else $data->pictureid = 0;
\r
114 //else die('mysql error in picture::getdata -- '.mysql_error());
\r
120 function add_new($albumid, $filename, $title, $description, $intfilename, $thumbfilename,$keywords) {
\r
122 global $NPG_CONF, $gmember;
\r
124 //need to validate data -- if okay, then add, if not delete files and display error
\r
125 if(!$albumid) die('Error: albumid is blank');
\r
127 //put picture data into database
\r
128 $this->title = $title;
\r
129 $this->filename = $filename;
\r
130 $this->int_filename = $intfilename;
\r
131 $this->thumb_filename = $thumbfilename;
\r
132 $this->keywords = $keywords;
\r
133 $this->description = $description;
\r
134 $this->ownerid = $gmember->getID();
\r
135 $this->albumid = $albumid;
\r
136 $this->id = 0; //this will be changed by the write method to the id of the picture
\r
140 //return id of picture added -- set during $this->write() method to the id of the picture just added.
\r
145 function setTitle($title) {$this->title = $title;}
\r
146 function setDescription($description) {$this->description = $description;}
\r
147 function setAlbumID($id) { if($id) $this->albumid = $id;}
\r
148 function setalbumtitle($title) {$this->albumtitle = $title;}
\r
149 function setkeywords($keywords){$this->keywords = $keywords;}
\r
151 function setqueryold($query ='') {
\r
152 $pid = requestVar('id');
\r
154 $defaultorder = $NPG_CONF['defaultorder'];
\r
155 $sorting = array('title'=>'title',
\r
156 'desc'=>'description',
\r
157 'owner'=>'ownername',
\r
158 'date'=>'modified',
\r
160 'desca'=>'description',
\r
161 'ownera'=>'ownername',
\r
162 'datea'=>'modified',
\r
163 'filenamea'=>'filename',
\r
164 'filename'=>'filename');
\r
165 $sortingascdesc = array('title'=>'ASC',
\r
173 'filenamea'=>'ASC',
\r
174 'filename'=>'DESC');
\r
175 if ($sortingascdesc[$sort]=='ASC'){$oppositeorder = 'DESC';}
\r
176 if ($sortingascdesc[$sort]=='DESC'){$oppositeorder = 'ASC';};
\r
177 $sort = requestVar('sort');
\r
179 $so = 'order by '.$sorting[$sort].', pictureid DESC';
\r
182 $so = 'order by '.$sorting[$defaultorder].', pictureid DESC';
\r
184 if(!$query) $this->query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid='.intval($this->albumid).$so;
\r
185 else $this->query = $query;
\r
187 //sql_query('create temporary table temptableview (tempid int unsigned not null auto_increment primary key) '.$this->query);
\r
189 //$result = sql_query('select tempid from temptableview where pictureid='.intval($this->id));
\r
190 //$tid = mysql_fetch_object($result);
\r
196 $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where pictureid > '.intval($pid).' '.$so.' '.$sortingascdesc[$sort].' and albumid = '.intval($this->albumid).' limit 0,1';
\r
198 $result = sql_query($query);
\r
199 if(!mysql_num_rows($result))
\r
202 $row = mysql_fetch_object($result);
\r
203 $this->nextthumbfilename = $row->thumb_filename;
\r
204 $this->nextid = $row->pictureid;
\r
207 $result = sql_query('select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where pictureid < '.intval($pid).' '.$so.' '.$oppositeorder.' and albumid = '.intval($albumid).' limit 0,1');
\r
208 if(!mysql_num_rows($result))
\r
209 $this->previous = 0;
\r
211 $row = mysql_fetch_object($result);
\r
212 $this->previousthumbfilename = $row->thumb_filename;
\r
213 $this->previousid = $row->pictureid;
\r
218 function setquery($query ='') {
\r
219 global $manager,$NPG_CONF;
\r
220 $defaultorder = $NPG_CONF['defaultorder'];
\r
221 $sort = requestVar('sort');
\r
222 if (!$sort){$sort = $defaultorder;}
\r
223 $sorting = array('title'=>'title',
\r
224 'desc'=>'description',
\r
225 'owner'=>'ownername',
\r
226 'date'=>'modified',
\r
228 'desca'=>'description',
\r
229 'ownera'=>'ownername',
\r
230 'datea'=>'modified',
\r
231 'filenamea'=>'filename',
\r
232 'filename'=>'filename');
\r
233 $order = array('title'=>' ASC',
\r
241 'filenamea'=>' ASC',
\r
242 'filename'=>' DESC');
\r
243 if ($order[$sort]==' ASC'){$oppositeorder = ' DESC';}
\r
244 if ($order[$sort]==' DESC'){$oppositeorder = ' ASC';};
\r
246 //if someone can figure out a better way of doing this, please do it!
\r
248 //getting forward offset
\r
249 $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.intval($this->albumid).' order by '.$sorting[$sort].$order[$sort];
\r
250 $result = sql_query($query);
\r
252 while ($row = mysql_fetch_object($result)){
\r
254 if($row->pictureid==$this->id){$offset = $i;}
\r
259 $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.intval($this->albumid).' order by '.$sorting[$sort].$order[$sort].' limit '.intval($offset).',1';
\r
260 $result = sql_query($query);
\r
263 if(!mysql_num_rows($result))
\r
266 $row = mysql_fetch_object($result);
\r
267 $this->nextthumbfilename = $row->thumb_filename;
\r
268 $this->nextid = $row->pictureid;
\r
270 //getting backwards offset
\r
271 $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.intval($this->albumid).' order by '.$sorting[$sort].$oppositeorder;
\r
272 $result = sql_query($query);
\r
274 while ($row = mysql_fetch_object($result)){
\r
276 if($row->pictureid==$this->id){$offset = $i;}
\r
281 $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.intval($this->albumid).' order by '.$sorting[$sort].$oppositeorder.' limit '.intval($offset).',1';
\r
283 $result = sql_query($query);
\r
284 if(!mysql_num_rows($result))
\r
285 $this->previous = 0;
\r
287 $row = mysql_fetch_object($result);
\r
288 $this->previousthumbfilename = $row->thumb_filename;
\r
289 $this->previousid = $row->pictureid;
\r
294 function getTitle() {return $this->title;}
\r
295 function getDescription() {return $this->description;}
\r
296 function getAlbumId() {return $this->albumid;}
\r
297 function getOwnerName() { return $this->ownername;}
\r
299 function getOwnerId() {return $this->ownerid;}
\r
300 function getLastModified() {return $this->modified;}
\r
301 function getID() {return $this->id;}
\r
302 function getFilename() {return $this->filename; }
\r
303 function getIntFilename() {return $this->int_filename; }
\r
304 function getThumbFilename() {return $this->thumb_filename; }
\r
305 function getViews() {return $this->views; }
\r
306 function getAlbumTitle() {return $this->albumtitle;}
\r
307 function getpreviousid() { return $this->previousid; }
\r
308 function getnextid() {return $this->nextid; }
\r
309 function getpreviousthumbfilename() {return $this->previousthumbfilename;}
\r
310 function getnextthumbfilename() {return $this->nextthumbfilename;}
\r
311 function getsets() {return $this->keywords;}
\r
313 function delete($id) {
\r
314 global $NP_BASE_DIR;
\r
317 $returnval['status'] = 'error';
\r
318 $returnval['message'] = 'ID is null in PICTURE::delete';
\r
321 $query = 'select * from '.sql_table('plug_gallery_picture').' where pictureid='.intval($id);
\r
322 $result = mysql_query($query);
\r
324 $returnval['status'] = 'error';
\r
325 $returnval['message'] = mysql_error().':'.$query;
\r
328 if(!mysql_num_rows($result)) {
\r
329 $returnval['status'] = 'error';
\r
330 $returnval['message'] = 'Picture not deleted because it was not found in database';
\r
334 $row = mysql_fetch_object($result);
\r
335 if(@ !unlink($NP_BASE_DIR.$row->filename)) echo 'file: '.$row->filename.' could not be deleted<br/>';
\r
336 if(@ !unlink($NP_BASE_DIR.$row->int_filename)) echo 'file: '.$row->int_filename.' could not be deleted<br/>';
\r
337 if(@ !unlink($NP_BASE_DIR.$row->thumb_filename)) echo 'file: '.$row->thumb_filename.' could not be deleted<br/>';
\r
338 $query = 'delete from '.sql_table('plug_gallery_picture').' where pictureid='.intval($row->pictureid);
\r
339 $result2 = mysql_query($query);
\r
341 $returnval['status'] = 'error';
\r
342 $returnval['message'] = mysql_error();
\r
345 ALBUM::decreaseNumberByOne($row->albumid);
\r
346 $returnval['status'] = 'success';
\r
347 $returnval['albumid'] = $row->albumid;
\r
353 function deletepromoposts($id) {
\r
356 $manager->loadClass('ITEM');
\r
358 $query = 'select * from '.sql_table('plug_gallery_promo').' where ppictureid='.intval($id);
\r
359 $result = mysql_query($query);
\r
361 $returnval['status'] = 'error';
\r
362 $returnval['message'] = mysql_error().':$query';
\r
366 if(!mysql_num_rows($result)) {
\r
367 $returnval['status'] = 'error';
\r
368 $returnval['message'] = 'No promo posts associated with this picture';
\r
372 while ($row = mysql_fetch_object($result) ){
\r
373 ITEM::delete($row->pblogitemid);
\r
375 sql_query('delete from '.sql_table('plug_gallery_promo').' where ppictureid='.intval($id));
\r
376 $returnval['status'] = 'success';
\r
381 function tagaccept($left,$top,$width,$height,$text){
\r
382 sql_query("INSERT INTO ".sql_table('plug_gallery_picturetag')." ( `pictureid` , `top` , `left` , `height` , `width` , `text` )
\r
383 VALUES ( '" . addslashes($this->id) ." ', '" .addslashes($top)."', '" .addslashes($left)." ' , '" .addslashes($height)."' , '" .addslashes($width)."' , '" .addslashes($text)."' ); ");
\r
384 echo "<SCRIPT LANGUAGE=\"JavaScript\">
\r
385 window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $this->id . "\"" .
\r
389 function tagdelete(){
\r
390 sql_query("DELETE FROM ".sql_table('plug_gallery_picturetag'). " WHERE `pictureid` = '" . intval($this->id) . "' LIMIT 1; ");
\r
391 echo "<SCRIPT LANGUAGE=\"JavaScript\">
\r
392 window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $this->id . " \"" .
\r
398 function display($startstop,$sliderunning) {
\r
399 global $NPG_CONF,$manager;
\r
401 if(!$this->template) {
\r
402 if(!$NPG_CONF['template']) $NPG_CONF['template'] = 1;
\r
403 $this->template = & new NPG_TEMPLATE($NPG_CONF['template']);
\r
406 if(!$this->query ) $this->setquery();
\r
408 $template_header = $this->template->section['ITEM_HEADER'];
\r
409 $template_SLIDESHOWC = $this->template->section['ITEM_SLIDESHOWC'];
\r
410 $template_SLIDESHOWT = $this->template->section['ITEM_SLIDESHOWT'];
\r
411 $template_body = $this->template->section['ITEM_BODY'];
\r
412 $template_footer = $this->template->section['ITEM_FOOTER'];
\r
413 $template_TOOLTIPSHEADER = $this->template->section['ITEM_TOOLTIPSHEADER'];
\r
414 $template_TOOLTIPSFOOTER = $this->template->section['ITEM_TOOLTIPSFOOTER'];
\r
415 $template_NEXTPREVTHUMBS = $this->template->section['ITEM_NEXTPREVTHUMBS'];
\r
417 if(!$this->getID() ) echo 'Nothing to display';
\r
418 //echo $sliderunning;
\r
420 //if the slideshow start/stop button was pressed, check if the slideshow if running
\r
421 //if its running, stop it, if its not running, start it
\r
422 if (!$sliderunning){$sliderunning='false';}
\r
423 if ($startstop=='true'){
\r
424 //echo 'startstop='.$startstop;
\r
425 if ($sliderunning=='false') $sliderunning= 'true'; //echo 'sliderunning='.$sliderunning;
\r
426 else $sliderunning= 'false';
\r
428 //if the slideshow was running, let it continue
\r
429 if($sliderunning=='true'){
\r
430 //echo 'sliderunning='.$sliderunning;
\r
431 $actions = new PICTURE_ACTIONS($this);
\r
432 $parser = new PARSER($actions->getDefinedActions(), $actions);
\r
433 $actions->setparser($parser);
\r
434 $manager->notify('NPgPrePicture',array('picture',&$this));
\r
436 $template_SLIDESHOWC = $this->template->section['ITEM_SLIDESHOWC'];
\r
437 $template_SLIDESHOWT = $this->template->section['ITEM_SLIDESHOWT'];
\r
438 $parser->parse($template_SLIDESHOWC);
\r
439 $parser->parse($template_SLIDESHOWT);
\r
441 // if the slideshow wasnt running, do the normal thing.
\r
442 if($sliderunning=='false'){
\r
443 //echo 'sliderunning1'.$sliderunning;
\r
444 $actions = new PICTURE_ACTIONS($this);
\r
445 $parser = new PARSER($actions->getDefinedActions(), $actions);
\r
446 $actions->setparser($parser);
\r
447 $manager->notify('NPgPrePicture',array('picture',&$this));
\r
449 $parser->parse($template_TOOLTIPSHEADER);
\r
450 $parser->parse($template_SLIDESHOWC);
\r
451 $parser->parse($template_header);
\r
452 $parser->parse($template_body);
\r
453 $parser->parse($template_TOOLTIPSFOOTER);
\r
454 $parser->parse($template_NEXTPREVTHUMBS);
\r
455 $parser->parse($template_footer);
\r
459 function _views() {
\r
462 $remoteip = ServerVar('REMOTE_ADDR');
\r
463 $pictureid = $this->getID();
\r
465 if(!$NPG_CONF['viewtime']) $NPG_CONF['viewtime'] = 30 ;
\r
466 $cuttime = $NPG_CONF['viewtime'];
\r
467 //first test for duplicates
\r
468 $query = 'select * from '.sql_table('plug_gallery_views')." where vpictureid = ".intval($pictureid);
\r
469 //$result = mysql_query($query);
\r
470 //print_r($result);
\r
471 //$numrows= mysql_num_rows($result);
\r
473 if(@mysql_num_rows($result)>1){
\r
474 //if theres more than one
\r
475 $query= 'DELETE FROM '.sql_table('plug_gallery_views').' WHERE vpictureid = '.intval($pictureid).' ORDER BY views LIMIT 1' ;
\r
476 mysql_query($query);
\r
479 $query = 'select time from '.sql_table('plug_gallery_views_log')." where ip = '".addslashes($remoteip)."' and vlpictureid = ".intval($pictureid);
\r
480 $result = sql_query($query);
\r
481 if(mysql_num_rows($result)) {
\r
482 $row = mysql_fetch_object($result);
\r
483 $query2 = 'update '.sql_table('plug_gallery_views_log')." set time = NOW() where ip = '".addslashes($remoteip)."' and vlpictureid = ".intval($pictureid);
\r
484 $result2 = sql_query($query2);
\r
485 if( ($curtime - (intval($NPG_CONF['viewtime']) * 60) ) > converttimestamp($row->time) ) {
\r
486 $query3 = 'select * from '.sql_table('plug_gallery_views')." where vpictureid = ".intval($pictureid);
\r
487 $result3 = mysql_query($query3);
\r
488 if(mysql_num_rows($result3))
\r
489 sql_query('update '.sql_table('plug_gallery_views')." set views = views + 1 where vpictureid = ".intval($pictureid));
\r
490 else sql_query('insert into '.sql_table('plug_gallery_views')." (vpictureid, views) values (".intval($pictureid).", 1)");
\r
493 $query3 = 'select * from '.sql_table('plug_gallery_views')." where vpictureid = ".intval($pictureid);
\r
494 $result3 = mysql_query($query3);
\r
495 if(mysql_num_rows($result3))
\r
496 sql_query('update '.sql_table('plug_gallery_views')." set views = views + 1 where vpictureid = ".intval($pictureid));
\r
497 else sql_query('insert into '.sql_table('plug_gallery_views')." (vpictureid, views) values (".intval($pictureid).", 1)");
\r
498 sql_query('insert into '.sql_table('plug_gallery_views_log')." (vlpictureid, ip, time) values (".intval($pictureid).", '".addslashes($remoteip)."', NULL)");
\r
504 class PICTURE_ACTIONS extends BaseActions {
\r
506 var $CurrentPicture;
\r
510 function PICTURE_ACTIONS(& $currentpic) {
\r
511 $this->BaseActions();
\r
512 $this->CurrentPicture = & $currentpic;
\r
513 $this->knownactions = array( 'addcomment','editPicture','deletePicture','item','album' );
\r
516 function getdefinedActions() {
\r
523 'intermediatepicture',
\r
530 'deletepicturelink',
\r
533 'nextthumbfilename',
\r
534 'previousthumbfilename',
\r
549 function setParser(&$parser) {$this->parser =& $parser; }
\r
550 function settemplate(&$template) {$this->template = & $template; }
\r
552 function parse_breadcrumb($sep = '>') {
\r
553 //echo getBreadcrumb('item', $this->CurrentPicture->getID());
\r
555 echo generateLink('list');
\r
556 echo '">'.__NPG_BREADCRUMB_GALLERY.'</a> '.$sep.' ';
\r
558 $this->parse_albumlink();
\r
560 $this->parse_albumtitle();
\r
561 echo '</a> '.$sep.' ';
\r
562 $this->parse_title();
\r
565 function parse_title() {
\r
566 echo $this->CurrentPicture->getTitle();
\r
569 function parse_albumlink() {
\r
570 $type = requestvar('type');
\r
571 if(in_array($type,$this->knownactions)) {
\r
572 $extra['id'] = $this->CurrentPicture->getalbumid();
\r
576 $allowed = array('limit');
\r
577 foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
\r
579 echo NP_gallery::MakeLink($type,$extra);
\r
582 function parse_albumtitle() {
\r
583 echo $this->CurrentPicture->getAlbumTitle();
\r
586 function parse_description() {echo $this->CurrentPicture->getDescription(); }
\r
587 function parse_fullsizelink() {
\r
589 echo $CONF['IndexURL'].$this->CurrentPicture->getFilename(); }
\r
590 function parse_intermediatepicture() {
\r
592 echo $CONF['IndexURL'].$this->CurrentPicture->getIntFilename(); }
\r
593 function parse_height($offset = 15) {
\r
594 global $NP_BASE_DIR;
\r
595 $image_size = getimagesize($NP_BASE_DIR.$this->CurrentPicture->getFilename());
\r
596 echo ($image_size[1] + $offset);
\r
598 function parse_width($offset = 15) {
\r
599 global $NP_BASE_DIR;
\r
600 $image_size = getimagesize($NP_BASE_DIR.$this->CurrentPicture->getFilename());
\r
601 echo ($image_size[0] + $offset);
\r
603 function parse_owner() { echo $this->CurrentPicture->getOwnerName(); }
\r
604 function parse_date($format = 'l jS of F Y h:i:s A') {
\r
605 $d = $this->CurrentPicture->getLastModified();
\r
606 $d = converttimestamp($d);
\r
607 $d = date($format,$d);
\r
610 function parse_editpicturelink() { echo generateLink('editPictureF', $this->CurrentPicture->getID());}
\r
611 function parse_deletepicturelink() {echo generateLink('deletePictureF', $this->CurrentPicture->getID());}
\r
612 function parse_nextthumbfilename() {global $CONF;echo $CONF['IndexURL'].$this->CurrentPicture->getnextthumbfilename();}
\r
613 function parse_previousthumbfilename() {global $CONF;echo $CONF['IndexURL'].$this->CurrentPicture->getpreviousthumbfilename();}
\r
614 function parse_nextlink() {
\r
615 $next = $this->CurrentPicture->getnextid();
\r
617 $type = requestvar('type');
\r
618 if(in_array($type, $this->knownactions)) $type = 'item';
\r
619 if(!$type) $type = 'item';
\r
621 $extra['id'] = $next;
\r
622 $allowed = array('limit');
\r
623 foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
\r
624 echo NP_gallery::MakeLink($type,$extra);
\r
629 function parse_previouslink() {
\r
630 $prev = $this->CurrentPicture->getpreviousid();
\r
632 $type = requestvar('type');
\r
633 if(!$type) $type = 'item';
\r
635 $extra['id'] = $prev;
\r
636 $allowed = array('limit');
\r
637 foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
\r
638 echo NP_gallery::MakeLink($type,$extra);
\r
639 //echo generateLink($type, $next);
\r
644 function parse_tooltip() {
\r
645 //get picture tag infor
\r
646 $gid = requestVar('id');
\r
647 $res = sql_query('select * from '.sql_table('plug_gallery_picturetag').' where pictureid= '. intval($gid) .' ');
\r
648 $numrows = @mysql_num_rows($res);
\r
649 echo "<div id=\"tooltip2\">";
\r
650 for ($i=0 ; $i<$numrows;$i++) {
\r
651 $row = mysql_fetch_array($res);
\r
652 $data->top = $row[top];
\r
653 $data->left = $row[left];
\r
654 $data->height = $row[height];
\r
655 $data->width = $row[width];
\r
656 $data->text = $row[text];
\r
657 echo "<div style=\"display:block;position:absolute;border-width:0px;float:left;z-index:5;width:0px;height:0px\">
\r
658 <div class=\"tooltip2div\" style=\"display:block;position:relative;top:" .
\r
659 $data->top . "px;left:" .
\r
660 $data->left ."px;width:" .
\r
661 $data->width ."px;height:" .
\r
662 $data->height. "px\">" .
\r
663 "<span style=\"position:relative;top:" .
\r
664 $data->height . "px\"> " .
\r
665 $data->text . "</span></div></div>";
\r
669 function parse_pictureid() {
\r
670 $pictureid = $this->CurrentPicture->getID();
\r
674 function parse_intvalsecs() {
\r
675 $intval = requestvar(intvalsecs);
\r
679 function parse_nextid() {
\r
680 $nextid = $this->CurrentPicture->getnextid();
\r
684 function parse_previousid() {
\r
685 $previousid = $this->CurrentPicture->getpreviousid();
\r
688 function parse_keywords(){
\r
689 $keywords = $this->CurrentPicture->getsets();
\r
693 function doForm($filename) {
\r
694 global $DIR_NUCLEUS;
\r
696 array_push($this->parser->actions,'formdata','text','callback','errordiv','itemid');
\r
697 $oldIncludeMode = PARSER::getProperty('IncludeMode');
\r
698 $oldIncludePrefix = PARSER::getProperty('IncludePrefix');
\r
699 PARSER::setProperty('IncludeMode','normal');
\r
700 PARSER::setProperty('IncludePrefix','');
\r
701 $this->parse_parsedinclude($DIR_NUCLEUS . 'forms/' . $filename . '.template');
\r
702 PARSER::setProperty('IncludeMode',$oldIncludeMode);
\r
703 PARSER::setProperty('IncludePrefix',$oldIncludePrefix);
\r
704 array_pop($this->parser->actions); // itemid
\r
705 array_pop($this->parser->actions); // errordiv
\r
706 array_pop($this->parser->actions); // callback
\r
707 array_pop($this->parser->actions); // text
\r
708 array_pop($this->parser->actions); // formdata
\r
712 function parse_comments() {
\r
715 $comments =& new NPG_COMMENTS($this->CurrentPicture->getID());
\r
716 //$comments->setItemActions($actions);
\r
717 $comments->showComments($this->CurrentPicture->template, -1, 1); // shows ALL comments
\r
721 function parse_commentform($destinationurl = '') {
\r
722 global $member, $CONF, $DIR_LIBS, $errormessage;
\r
725 $actionurl = $CONF['ActionURL'];
\r
727 //$destinationurl = '?action=plugin&name=gallery&type=addcomment';
\r
729 // values to prefill
\r
730 $user = cookieVar($CONF['CookiePrefix'] .'comment_user');
\r
731 if (!$user) $user = postVar('user');
\r
732 $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');
\r
733 if (!$userid) $userid = postVar('userid');
\r
734 $body = postVar('body');
\r
736 $this->formdata = array(
\r
737 'destinationurl' => htmlspecialchars($destinationurl),
\r
738 'actionurl' => htmlspecialchars($actionurl),
\r
739 'itemid' => $this->CurrentPicture->getID(),
\r
740 'user' => htmlspecialchars($user),
\r
741 'userid' => htmlspecialchars($userid),
\r
743 'membername' => $member->getDisplayName(),
\r
744 'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''
\r
747 if (!$member->isLoggedIn()) {
\r
748 $this->doForm('../plugins/gallery/include/commentform-notloggedin');
\r
750 $this->doForm('../plugins/gallery/include/commentform-loggedin');
\r
754 function parse_callback($eventName, $type) {
\r
756 $manager->notify($eventName, array('type' => $type));
\r
759 function parse_errordiv() {}
\r
760 function parse_text($which) {
\r
762 if (defined($which)) {
\r
763 eval("echo $which;");
\r
770 function parse_itemid() {echo $this->CurrentPicture->getID();}
\r
772 function parse_formdata($what) {
\r
773 echo $this->formdata[$what];
\r
776 function parse_if($field, $name = '', $value = '') {
\r
777 global $gmember,$NPG_CONF;
\r
781 case 'caneditpicture':
\r
782 $condition = $gmember->canModifyPicture($this->CurrentPicture->getID() );
\r
784 case 'commentsallowed':
\r
785 $condition = ALBUM::commentsallowed($this->CurrentPicture->getID());
\r
788 $condition = $this->CurrentPicture->getnextid();
\r
791 $condition = $this->CurrentPicture->getpreviousid();
\r
794 $tooltips = $NPG_CONF['tooltips'];
\r
795 if ($tooltips == 'yes'){$condition = 1;}
\r
797 case 'nextprevthumb' :
\r
798 $nextprevthumb = $NPG_CONF['nextprevthumb'];
\r
799 if ($nextprevthumb == 'yes'){$condition = 1;}
\r
800 case 'slideshowson' :
\r
801 $slideshowson = $NPG_CONF['slideshowson'];
\r
802 if ($slideshowson == 'yes'){$condition = 1;}
\r
807 $this->_addIfCondition($condition);
\r