• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-plugins: Commit

Nucleus CMS日本語版用プラグインのうち、日本語版開発者がサポートしているもの


Commit MetaInfo

Revision73d0bf16e56272fad82a8f694b9aa572ce5444c3 (tree)
Time2010-06-05 05:50:28
Authorkmorimatsu <kmorimatsu@1ca2...>
Commiterkmorimatsu

Log Message

NP_gallery 0.94

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/plugin@1055 1ca29b6e-896d-4ea0-84a5-967f57386b96

Change Summary

Incremental Difference

--- /dev/null
+++ b/NP_gallery/trunk/NP_gallery.php
@@ -0,0 +1,696 @@
1+<?php
2+/*
3+NP_Gallery
4+Gallery Plugin for nucleus cms http://nucleuscms.org
5+
6+
7+*/
8+
9+
10+global $DIR_NUCLEUS;
11+include_once($DIR_NUCLEUS.'/plugins/gallery/config.php');
12+
13+class NP_gallery extends NucleusPlugin {
14+
15+ /*
16+ var $currentPage;
17+ var $currentPageID;
18+ var $currentPageOpt;
19+*/
20+
21+ function getName() {return 'Nucleus Image Gallery';}
22+ function getAuthor() { return 'John Bradshaw, Gene Cambridge Tsai'; }
23+ function getURL() { return 'http://www.sircambridge.net/nucleus/index.php?itemid=57'; }
24+ function getVersion() { return '0.94'; }
25+ function getDescription() { return 'Image Gallery for Nucleus CMS'; }
26+ function supportsFeature($what) { switch($what) {
27+ case 'SqlTablePrefix': return 1; break;
28+ case 'HelpPage': return 1; break;
29+ default: return 0; break;
30+ }
31+ }
32+
33+ function getTableList() {
34+ return array(sql_table('plug_gallery_album'),
35+ sql_table('plug_gallery_picture'),
36+ sql_table('plug_gallery_template'),
37+ sql_table('plug_gallery_config'),
38+ sql_table('plug_gallery_comment'),
39+ sql_table('plug_gallery_album_team'),
40+ sql_table('plug_gallery_member'),
41+ sql_table('plug_gallery_promo'),
42+ sql_table('plug_gallery_views'),
43+ sql_table('plug_gallery_views_log'),
44+ sql_table('plug_gallery_picturetags') );
45+ }
46+
47+ function getEventList() {
48+ return array('QuickMenu','PreItem');
49+ }
50+
51+ function hasAdminArea() {
52+ return 1;
53+ }
54+
55+ function event_QuickMenu(&$data) {
56+ global $member;
57+
58+ if (!($member->isLoggedIn() )) return;
59+ array_push(
60+ $data['options'],
61+ array(
62+ 'title' => 'gallery',
63+ 'url' => $this->getAdminURL(),
64+ 'tooltip' => 'NP Gallery admin'
65+ )
66+ );
67+ }
68+
69+ function event_PreItem(&$data) {
70+
71+ $actions = new NPG_EXT_ITEM_ACTIONS();
72+ $parser = new NPG_PREPARSER($actions->getdefinedActions(),$actions);
73+ $actions->setparser($parser);
74+
75+ //pre-parse item body
76+ ob_start();
77+ $parser->parse($data['item']->body);
78+ $data['item']->body = ob_get_contents();
79+ ob_end_clean();
80+
81+ //pre-parse item more
82+ ob_start();
83+ $parser->parse($data['item']->more);
84+ $data['item']->more = ob_get_contents();
85+ ob_end_clean();
86+
87+ }
88+
89+
90+ function install() {
91+ global $NPG_CONF,$DIR_NUCLEUS;
92+
93+ $this->createOption('deletetables',__NPG_OPT_DONT_DELETE_TABLES,'yesno','no');
94+
95+ //create tables
96+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_album').' ( '.
97+ 'albumid int unsigned not null auto_increment PRIMARY KEY, '.
98+ 'title varchar(255), '.
99+ 'description varchar(255), '.
100+ 'ownerid int unsigned , '.
101+ 'modified TIMESTAMP, '.
102+ 'numberofimages int unsigned, '.
103+ "thumbnail varchar(100), ".
104+ 'commentsallowed tinyint DEFAULT 1 ) ';
105+ sql_query($query);
106+ // code to update table to have publicalbum field
107+ $query = 'SHOW COLUMNS FROM '.sql_table('plug_gallery_album').' LIKE "publicalbum"';
108+ $result = sql_query($query);
109+ if (mysql_num_rows($result) == 0){
110+ //if it doesnt exist, add it (there must be a better way to do this via SQL syntax, but i couldnt figure it out)
111+ $query = 'ALTER TABLE '. sql_table('plug_gallery_album').
112+ ' ADD COLUMN publicalbum tinyint DEFAULT 1 AFTER commentsallowed';
113+ sql_query($query);
114+ }
115+
116+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_picture').' ( '.
117+ 'pictureid int unsigned not null auto_increment PRIMARY KEY, '.
118+ 'title varchar(255), '.
119+ 'description varchar(255), '.
120+ 'ownerid int unsigned , '.
121+ 'modified TIMESTAMP, '.
122+ 'albumid int unsigned, '.
123+ 'filename varchar(255), '.
124+ 'int_filename varchar(255), '.
125+ 'thumb_filename varchar(255) ) ';
126+ sql_query($query);
127+
128+ //add the picturesets column after thumb_filename for people upgrading
129+ //first test if the picturesets column exists
130+ $query = 'SHOW COLUMNS FROM '.sql_table('plug_gallery_picture').' LIKE "keywords"';
131+ $result = sql_query($query);
132+ if (mysql_num_rows($result) == 0){
133+ //if it doesnt exist, add it (there must be a better way to do this via SQL syntax, but i couldnt figure it out)
134+ $query = 'ALTER TABLE '. sql_table('plug_gallery_picture').
135+ ' ADD COLUMN keywords varchar(255) AFTER thumb_filename';
136+ sql_query($query);
137+ }
138+ // this is to change the descriptions to have text up to 64k characters instead of 255 characters.
139+ //had to put it here in case someone is upgrading.
140+ $query = 'ALTER TABLE '. sql_table('plug_gallery_picture').
141+ ' MODIFY description TEXT';
142+ sql_query($query);
143+
144+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_template').' ( '.
145+ 'tdesc int unsigned, '.
146+ 'name varchar(20), '.
147+ 'content text ) ';
148+ sql_query($query);
149+
150+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_template_desc').' ( '.
151+ 'tdid int unsigned not null auto_increment PRIMARY KEY, '.
152+ 'tdname varchar(20), '.
153+ 'tddesc varchar(200) )';
154+ sql_query($query);
155+
156+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_config').' ( '.
157+ 'oname varchar(20), ovalue varchar(60) )';
158+ sql_query($query);
159+
160+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_album_team').' ( '.
161+ 'tmemberid int unsigned not null, '.
162+ 'talbumid int unsigned not null, '.
163+ 'tadmin tinyint DEFAULT 0 )';
164+ sql_query($query);
165+
166+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_member').' ( '.
167+ 'memberid int unsigned not null PRIMARY KEY, '.
168+ 'addalbum tinyint DEFAULT 0 )';
169+ sql_query($query);
170+
171+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_comment').' ( '.
172+ 'commentid int unsigned not null auto_increment PRIMARY KEY, '.
173+ 'cbody text, '.
174+ 'cuser varchar(40), '.
175+ 'cmail varchar(100), '.
176+ 'chost varchar(60), '.
177+ 'cip varchar(15), '.
178+ 'cmemberid int unsigned default 0, '.
179+ 'ctime timestamp, '.
180+ 'cpictureid int not null )';
181+ sql_query($query);
182+
183+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_promo').' ( '.
184+ 'ppictureid int unsigned not null, '.
185+ 'pblogitemid int unsigned not null )';
186+ sql_query($query);
187+
188+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_views').' ( '.
189+ 'vpictureid int unsigned not null PRIMARY KEY, '.
190+ 'views int unsigned )';
191+ sql_query($query);
192+
193+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_views_log').' ( '.
194+ 'vlpictureid int unsigned not null, '.
195+ 'ip varchar(20), '.
196+ 'time timestamp )';
197+ sql_query($query);
198+
199+ $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_picturetag').' ( '.
200+ '`pictureid` VARCHAR( 255 ) NOT NULL , '.
201+ '`top` VARCHAR( 255 ) NOT NULL ,'.
202+ '`left` VARCHAR( 255 ) NOT NULL ,'.
203+ '`height` VARCHAR( 255 ) NOT NULL ,'.
204+ '`width` VARCHAR( 255 ) NOT NULL ,'.
205+ '`text` VARCHAR( 255 ) NOT NULL )';
206+ sql_query($query);
207+
208+ //set default options
209+ $NPG_CONF = getNPGconfig();
210+
211+ if(!$NPG_CONF['viewtime']) setNPGoption('viewtime', 30);
212+ setNPGoption('currentversion',94);
213+
214+ if(!$NPG_CONF['im_path']) setNPGoption('im_path','/usr/local/bin/'); // currently needs to have trailing slash, need to change to be consistent
215+ if(!$NPG_CONF['im_options']) setNPGoption('im_options', '-filter Lanczos');
216+ if(!$NPG_CONF['im_quality']) setNPGoption('im_quality', '80');
217+ if(!$NPG_CONF['graphics_library']) {
218+ if (GDisPresent()) {
219+ setNPGoption('graphics_library', 'gd');
220+ } else if (IMisPresent()) {
221+ setNPGoption('graphics_library', 'im');
222+ setNPGoption('im_version', getIMversion());
223+ } else {
224+ setNPGoption('graphics_library', 'not configured');
225+ setNPGoption('configured', false);
226+ }
227+ }
228+
229+
230+ if(!$NPG_CONF['galleryDir']) setNPGoption('galleryDir', 'media/gallery'); //when adding, need to make sure that no trailing slash
231+ if(!$NPG_CONF['thumbwidth']) setNPGoption('thumbwidth', '100');
232+ if(!$NPG_CONF['thumbheight']) setNPGoption('thumbheight', '100');
233+ if(!$NPG_CONF['maxwidth']) setNPGoption('maxwidth', '600');
234+ if(!$NPG_CONF['maxheight']) setNPGoption('maxheight', '600');
235+ if(!$NPG_CONF['int_prefix']) setNPGoption('int_prefix', 'int_');
236+ if(!$NPG_CONF['thumb_prefix']) setNPGoption('thumb_prefix', 'thumb_');
237+
238+ if(!$NPG_CONF['max_filesize']) setNPGOption('max_filesize', '2000000');
239+ if(!$NPG_CONF['add_album']) setNPGOption('add_album', 'admin_only');
240+ if(!$NPG_CONF['batch_add_num']) setNPGOption('batch_add_num', '10');
241+ if(!$NPG_CONF['dateorrandom']) setNPGOption('dateorrandom', 'randomprefix');
242+ if(!$NPG_CONF['tooltips']) setNPGOption('tooltips', 'no');
243+ if(!$NPG_CONF['nextprevthumb']) setNPGOption('nextprevthumb', 'no');
244+ if(!$NPG_CONF['defaultorder']) setNPGOption('defaultorder', 'aesc');
245+ if(!$NPG_CONF['setorpromo']) setNPGOption('setorpromo', 'promo');
246+ if(!$NPG_CONF['slideshowson']) setNPGOption('slideshowson', 'no');
247+ if(!$NPG_CONF['thumborlist']) setNPGOption('thumborlist', 'list');
248+
249+
250+
251+
252+
253+
254+
255+ $chk = checkgalleryconfig();
256+ if($chk['configured'] == false) setNPGoption('configured',false); else setNPGoption('configured',true);
257+
258+ //?create skin NPGallery or make user do it
259+
260+ //set default templates
261+ //include($DIR_NUCLEUS.'/plugins/gallery/update/default_templates_076.inc');
262+ //include($DIR_NUCLEUS.'/plugins/gallery/update/default_templates_080.inc');
263+ //include($DIR_NUCLEUS.'/plugins/gallery/update/default_templates_090.inc');
264+ include($DIR_NUCLEUS.'/plugins/gallery/update/default_templates_094.inc');
265+ }
266+
267+ function unInstall() {
268+ if ($this->getOption('deletetables') == 'yes') {
269+
270+ //delete promo posts
271+ $query = 'select pictureid from '.sql_table('plug_gallery_picture');
272+ $res = sql_query($query);
273+ while($row = mysql_fetch_object($res)) {
274+ PICTURE::deletepromoposts($res->pictureid);
275+ }
276+
277+ sql_query('DROP TABLE '.sql_table('plug_gallery_album'));
278+ sql_query('DROP TABLE '.sql_table('plug_gallery_picture'));
279+ sql_query('DROP TABLE '.sql_table('plug_gallery_template'));
280+ sql_query('DROP TABLE '.sql_table('plug_gallery_template_desc'));
281+ sql_query('DROP TABLE '.sql_table('plug_gallery_config'));
282+ sql_query('DROP TABLE '.sql_table('plug_gallery_album_team'));
283+ sql_query('DROP TABLE '.sql_table('plug_gallery_member'));
284+ sql_query('DROP TABLE '.sql_table('plug_gallery_comment'));
285+ sql_query('DROP TABLE '.sql_table('plug_gallery_promo'));
286+ sql_query('DROP TABLE '.sql_table('plug_gallery_views'));
287+ sql_query('DROP TABLE '.sql_table('plug_gallery_views_log'));
288+ sql_query('DROP TABLE '.sql_table('plug_gallery_picturetag'));
289+
290+ }
291+ }
292+
293+ function doAction($type) {
294+ global $gmember, $CONF, $NPG_CONF;
295+ global $skinid,$manager,$blog,$blogid;
296+
297+ switch($type) {
298+ /*
299+ //display -- these are done in doSkinVar
300+ case 'mostviewed':
301+ case 'album':
302+ case 'item':
303+ case 'deletePictureF':
304+ case 'editPictureF':
305+ case 'addPictF':
306+ $this->currentPage = $type;
307+ $this->currentPageID = requestVar('id');
308+ break;
309+ case 'list':
310+ $this->currentPage = $type;
311+ $this->currentPageOpt = requestVar('sort');
312+ break;
313+ case 'addAlbumF':
314+ $this->currentPage = $type;
315+ break;
316+ */
317+ //these are the actions, done here, then currentpage is set and skin called to display something
318+ case 'addcomment':
319+ global $CONF;
320+
321+ $post['itemid'] = intPostVar('itemid');
322+ $post['user'] = postVar('user');
323+ $post['userid'] = postVar('userid');
324+ $post['body'] = postVar('body');
325+
326+ // set cookies when required
327+ $remember = intPostVar('remember');
328+ if ($remember == 1) {
329+ $lifetime = time()+2592000;
330+ setcookie($CONF['CookiePrefix'] . 'comment_user',$post['user'],$lifetime,'/','',0);
331+ setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'],$lifetime,'/','',0);
332+ }
333+
334+ $comments = new NPG_COMMENTS($post['itemid']);
335+
336+ $errormessage = $comments->addComment($post);
337+
338+ //need to add code to display the error
339+ if ($errormessage == '1') {
340+ $_POST['id'] = $post['itemid'];
341+ }
342+ /*
343+ else {
344+ $this->currentPage = 'list';
345+ $this->currentPageOpt = 'date';
346+ }
347+ */
348+ break;
349+ case 'addAlbum':
350+ if($gmember->canAddAlbum() ){
351+ $NPG_vars['ownerid'] = $gmember->getID();
352+ $NPG_vars['title'] = requestVar('title');
353+ $NPG_vars['description'] = requestVar('desc');
354+ $NPG_vars['publicalbum'] = requestVar('publicalbum');
355+ ALBUM::add_new($NPG_vars);
356+ }
357+ break;
358+ case 'finaldeletepicture':
359+ $id = requestVar('id');
360+ $delpromo = requestVar('delpromo');
361+ if($gmember->canModifyPicture($id)) {
362+
363+ $manager->notify('NPgPreDeletePicture', array('pictureid' => $id));
364+ $result = PICTURE::delete($id);
365+
366+ if($result['status'] == 'error') {
367+ echo $result['message'];
368+ }
369+ else {
370+ $manager->notify('NPgPostDeletePicture', array('pictureid' => $id));
371+
372+ if($delpromo == 'yes') {
373+ $result2 = PICTURE::deletepromoposts($id);
374+ if($result2['status'] == 'error') echo $result2['message'];
375+ }
376+ else {
377+ $_POST['id'] = $result['albumid'];
378+ }
379+ }
380+ } else echo 'No permission to delete picture<br/>';
381+ break;
382+ case 'editPicture':
383+ $id = requestVar('id');
384+ if($gmember->canModifyPicture($id)) {
385+ $pict = new PICTURE($id);
386+ $pict->setTitle(requestVar('ptitle'));
387+ $pict->setDescription(requestVar('pdesc'));
388+ $pict->setkeywords(requestVar('keywords'));
389+ $aid = requestVar('aid');
390+ if($aid && $gmember->canAddPicture($aid)) {
391+ ALBUM::decreaseNumberByOne($pict->getAlbumID());
392+ ALBUM::increaseNumberByOne($aid);
393+ $pict->setAlbumID($aid);
394+ }
395+ $pict->write();
396+ echo "<SCRIPT LANGUAGE=\"JavaScript\">
397+ window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $id . "\"" .
398+ "</script>";
399+ break;
400+ $manager->notify('NPgPostUpdatePicture',array('picture', &$pict));
401+ }
402+ case 'tagaccept' :
403+ $Pos1x = requestVar('Pos1x');
404+ $Pos1y = requestVar('Pos1y');
405+ $Pos2x = requestVar('Pos2x');
406+ $Pos2y = requestVar('Pos2y');
407+ $RelX = requestVar('RelX');
408+ $pictureid = requestVar('pictureid');
409+ $RelY = requestVar('RelY');
410+ $desc = requestVar('desc');
411+ $left = $Pos1x - $RelX;
412+ $top = $Pos1y - $RelY;
413+ $width = $Pos2x - $Pos1x;
414+ $height = $Pos2y - $Pos1y;
415+ $text = $desc;
416+ //these lines should be moved into picture_class.php
417+ sql_query("INSERT INTO ".sql_table('plug_gallery_picturetag')." ( `pictureid` , `top` , `left` , `height` , `width` , `text` )
418+ VALUES ( '" . $pictureid ." ', '" .$top."', '" .$left." ' , '" .$height."' , '" .$width."' , '" .$text."' ); ");
419+ echo "<SCRIPT LANGUAGE=\"JavaScript\">
420+ window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $pictureid . "\"" .
421+ "</script>";
422+ break;
423+ case 'tagdelete' :
424+ $pictureid = requestVar('pictureid');
425+ //these lines should be moved into picture_class.php
426+ sql_query("DELETE FROM ".sql_table('plug_gallery_picturetag'). " WHERE `pictureid` = '" . $pictureid . "' LIMIT 1; ");
427+ echo "<SCRIPT LANGUAGE=\"JavaScript\">
428+ window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $pictureid . " \"" .
429+ "</script>";
430+ break;
431+ // this is done in editpicture now.
432+ //case 'updatesets':
433+ //$id = requestVar('id');
434+ //$setname = requestVar('setname');
435+ //$pict = new PICTURE($id);
436+ //$pict->addtoset($id,$setname);
437+ //$pict->write();
438+ //$manager->notify('NPgPostUpdatePicture',array('picture', &$pict));
439+ //break;
440+ default:
441+ break;
442+ }
443+
444+ if (!$blogid)
445+ $blogid = $CONF['DefaultBlog'];
446+
447+ $b =& $manager->getBlog($blogid);
448+ $blog = $b;
449+
450+ selectSkin('NPGallery');
451+
452+ $skin =& new SKIN($skinid);
453+ $skin->parse('index');
454+ }
455+
456+
457+ function doSkinVar() {
458+ global $NPG_CONF, $gmember, $manager;
459+
460+ $params = func_get_args();
461+ $numargs = func_num_args();
462+ $skinType = $params[0];
463+
464+ $type = requestvar('type');
465+ $id = requestvar('id');
466+ $startstop = requestvar('startstop');
467+ $sliderunning = requestvar('sliderunning');
468+
469+ $defaulttoitem = array('editPicture','addcomment');
470+ $defaulttolist = array('addAlbum');
471+ $defaulttoalbum = array('finaldeletepicture');
472+ if(in_array($type,$defaulttoitem)) $type = 'item';
473+
474+ switch($params[1]) {
475+ case 'link':
476+ if($numargs >= 3) {
477+ switch($params[2]) {
478+ case 'picture': echo generatelink('item',$params[3]); break;
479+ case 'album': echo generateLink('album',$params[3]); break;
480+ default: echo generateLink('list'); break;
481+ }
482+ } else echo generateLink('list');
483+ break;
484+ default:
485+ //things to display
486+
487+ if(!$NPG_CONF['configured']) {
488+ echo __NPG_ERR_GALLLERY_NOT_CONFIG;
489+ break;
490+ }
491+
492+ //plugin hook for collections
493+ $hookquery = '';
494+ $hooktitle = '';
495+ $manager->notify('NPgCollectionDisplay', array('type' => $type, 'query' => &$hookquery , 'title' => &$hooktitle) );
496+ if($hookquery) {
497+ if ($id == 0) {
498+ $collection = new ALBUM();
499+ $collection->setquery($hookquery);
500+ $collection->set_title($hooktitle);
501+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
502+ $collection->settemplate($t);
503+ $collection->display();
504+ }
505+ else {
506+ $pict = new PICTURE($id);
507+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
508+ $pict->setalbumtitle($hooktitle);
509+ $pict->settemplate($t);
510+ $pict->setquery($hookquery);
511+ $pict->display();
512+ }
513+ $type = 'nothing';
514+ }
515+
516+ //other pages
517+ switch($type) {
518+ case 'album':
519+ $alb = new ALBUM($id);
520+ if($alb->getID()) {
521+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
522+ $alb->settemplate($t);
523+ $alb->display(requestVar('sort'));
524+ }
525+ else echo __NPG_ERR_NOSUCHTHING.'<br/>';
526+ break;
527+ //case 'set':
528+ // $setid = $id;
529+ // $alb = new ALBUM($setid);
530+ //this should work, but not sure what $alb->getID() does...
531+ // if($alb->getID()) {
532+ // $t = new NPG_TEMPLATE($NPG_CONF['template']);
533+ // $alb->settemplate($t);
534+ // $alb->displayset(requestVar('sort'));
535+ // }
536+ // else echo __NPG_ERR_NOSUCHTHING.'<br/>';
537+ // break;
538+ case 'item':
539+ $pict = new PICTURE($id);
540+ if($pict->getID()) {
541+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
542+ $pict->settemplate($t);
543+ $pict->display($startstop,$sliderunning);
544+ }
545+ else echo __NPG_ERR_NOSUCHTHING.'<br/>';
546+ break;
547+ case 'list':
548+ $l = new GALLERY_LIST();
549+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
550+ $l->settemplate($t);
551+ $l->display(requestVar('sort'));
552+ break;
553+ case 'addAlbumF':
554+ addAlbumForm();
555+ break;
556+ case 'editAlbumF':
557+ editAlbumForm($id);
558+ break;
559+ case 'editPictureF':
560+ editPictureForm($id);
561+ break;
562+ case 'deletePictureF':
563+ deletePictureForm($id);
564+ break;
565+ case 'addPictF':
566+ addPictureForm($id);
567+ break;
568+ case 'nothing':
569+ break;
570+ default:
571+ $l = new GALLERY_LIST();
572+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
573+ $l->settemplate($t);
574+ $l->display(requestvar('sort'));
575+ break;
576+ }
577+
578+ break;
579+ }
580+ }
581+
582+ function MakeLink($type, $extraparams = array()) {
583+ global $CONF;
584+
585+ if($CONF['URLMode'] == 'pathinfo') {
586+ //fancy URLs having problems, so I changed it to revert back to regular URLS.
587+ //$base = '/gallery/';
588+ //$sep1 = '/';
589+ //$sep2 = '/';
590+ $base = 'action.php?action=plugin&name=gallery&type=';
591+ $sep1 = '&';
592+ $sep2 = '=';
593+ }
594+ else {
595+ $base = 'action.php?action=plugin&name=gallery&type=';
596+ $sep1 = '&';
597+ $sep2 = '=';
598+ }
599+ //if extraparams is assoc array
600+ if(is_array($extraparams) && array_keys($extraparams)!==range(0,sizeof($extraparams)-1)) {
601+ foreach($extraparams as $key => $value)
602+ $extra = $extra . $sep1 . $key . $sep2 . $value;
603+ }
604+ return $base.$type.$extra;
605+
606+
607+ }
608+
609+ function MakeLinkRaw($base, $extraparams = '') {
610+ global $CONF;
611+
612+ if($CONF['URLMode'] == 'pathinfo') {
613+ $sep1 = '/';
614+ $sep2 = '/';
615+ }
616+ else {
617+ $sep1 = '&amp;';
618+ $sep2 = '=';
619+ }
620+ foreach($extraparams as $key => $value) $extra = $extra . $sep1 . $key . $sep2 .$value;
621+ return $base.$extra;
622+ }
623+}
624+
625+class NPG_PREPARSER extends PARSER {
626+
627+ function doAction($action) {
628+ if (!$action) return;
629+ $action_raw = '<%'.$action.'%>';
630+
631+ // split into action name + arguments
632+ if (strstr($action,'(')) {
633+ $paramStartPos = strpos($action, '(');
634+ $params = substr($action, $paramStartPos + 1, strlen($action) - $paramStartPos - 2);
635+ $action = substr($action, 0, $paramStartPos);
636+ $params = explode ($this->pdelim, $params);
637+ $params = array_map('trim',$params);
638+ } else {
639+ $params = array();
640+ }
641+
642+ $actionlc = strtolower($action);
643+
644+ if (in_array($actionlc, $this->actions) || $this->norestrictions ) {
645+ call_user_func_array(array(&$this->handler,'parse_' . $actionlc), $params);
646+ } else {
647+ echo $action_raw;
648+ }
649+
650+ }
651+
652+
653+}
654+
655+class NPG_EXT_ITEM_ACTIONS extends BaseActions {
656+ var $parser;
657+
658+ function NPG_EXT_ACTIONS() {
659+ $this->BaseActions();
660+ }
661+
662+ function getdefinedActions() {
663+ return array( 'gallery' );
664+ }
665+
666+ function setParser(&$parser) {$this->parser =& $parser; }
667+
668+ function parse_gallery($param1, $param2, $param3) {
669+ if($param1 == 'link') {
670+ if($param2 == 'picture') {
671+ $param3 = intval($param3);
672+ echo generatelink('item',$param3);
673+ }
674+ else if($param2 == 'album') {
675+ $param3 = intval($param3);
676+ echo generatelink('album',$param3);
677+ }
678+ else echo '<b>NOT HERE</b>';
679+ }
680+ if($param1 == 'keywords') {
681+ $setid = $param2;
682+ $splitdata = explode(' and ',$setid);
683+ $sort = $param3;
684+ //$alb = new ALBUM($id);
685+ //if($alb->getID()) {
686+ //$t = new NPG_TEMPLATE($NPG_CONF['template']);
687+ //$alb->settemplate($t);
688+ //$alb->display(requestVar('sort'));
689+ $thisset = new ALBUM;
690+ $t = new NPG_TEMPLATE($NPG_CONF['template']);
691+ $thisset->settemplate($t);
692+ $thisset->displayset($splitdata,$sort);
693+ }
694+ }
695+}
696+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/FAQ.html
@@ -0,0 +1,94 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+<html xmlns="http://www.w3.org/1999/xhtml">
3+<head>
4+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5+<title>Untitled Document</title>
6+</head>
7+
8+<body>
9+<p>Q1. My &quot;Today&quot; and &quot;Archive&quot; links stop working when I am in the NP_gallery photo gallery!</p>
10+<p>A1. the solution will have to be a hack, because of the way np_gallery works,
11+np_gallery is a SEPERATE blog, so as any seperate blog would do, it would have a &quot;today&quot; page. but in the context of NP_gallery, &quot;today&quot; doesnt make any sense. you will have to go into the skin template (like header.inc) and edit the links to be static instead of &lt;% ... %&gt; like nucleus would like.</p>
12+<p>Q2. I and error that looks like this:</p>
13+<p> mySQL error with query create temporary table temptableview (tempid int unsigned not null auto_increment primary key) select pictureid, thumb_filename from nucleus_plug_gallery_picture where albumid=2 order by pictureid ASC: Access denied for user: 'u1000855_phalcon@' to database 'db1000855_phalcon' <br />
14+mySQL error with query select tempid from temptableview where pictureid=2: Table 'db1000855_phalcon.temptableview' doesn't exist </p>
15+<p>A2. Find the line </p>
16+<p>sql_query('create temporary table temptableview (tempid int unsigned not null auto_increment primary key) '.$this-&gt;query);</p>
17+<p>in picture_class.php and change to (around line 157) </p>
18+<p>sql_query('create table temptableview (tempid int unsigned not null auto_increment primary key) '.$this-&gt;query); </p>
19+<p>this is due to your server having temporary SQL tables turned off. this fix simply makes the table not temporary and would leave a trash table in your database, but its okay, it gets overwritten everytime its needed again. </p>
20+<p>Q3. why is there an empty space where my sidebar used to be on my photo gallery pages?</p>
21+<p>A3. this is a common problem when you use a skin with a sidebar such as leaf. what is happening is that even though you removed the sidebar from the main index template, the container and content are sell leaving room for a side bar. <br />
22+</p>
23+<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%">
24+ <tbody>
25+ <tr>
26+ <td>Quote:</td>
27+ </tr>
28+ <tr>
29+ <td>#container{ <br />
30+ width: 100%; <br />
31+ float: left; <br />
32+ margin-right: -230px; <br />
33+ } <br />
34+ #content{ <br />
35+ margin-right: 230px; <br />
36+ padding: 25px 0; <br />
37+ } <br />
38+ #sidebar{ <br />
39+ width: 230px; <br />
40+ float: right; <br />
41+ padding: 25px 0; <br />
42+ text-align: left; <br />
43+ }</td>
44+ </tr>
45+ </tbody>
46+</table>
47+<p> what you can do to fix this is put in an inline css style to override the css file. ( you dont want to change the css file because that would screw up the rest of your site, naturally) <br />
48+ <br />
49+ so go into the NPGallery skin (the clone you made of leaf) find the main index template, and take a look at the code I made below <br />
50+ <br />
51+</p>
52+<table align="center" border="0" cellpadding="3" cellspacing="1" width="90%">
53+ <tbody>
54+ <tr>
55+ <td>Code:</td>
56+ </tr>
57+ <tr>
58+ <td>&lt;%parsedinclude(head.inc)%&gt; <br />
59+ &lt;!--header.inc--&gt; <br />
60+ &lt;%parsedinclude(header.inc)%&gt; <br />
61+ &lt;!--Start Main Index--&gt; <br />
62+ &lt;div id=&quot;container&quot;&gt; <br />
63+ &nbsp; &lt;div id=&quot;content&quot; style=&quot;width:700px&quot;&gt; <br />
64+ &nbsp; &nbsp; &lt;div class=&quot;contentdiv&quot; style=&quot;width:700px&quot;&gt; <br />
65+ &nbsp; &nbsp; &lt;h2 class=&quot;weblog&quot;&gt;Weblog&lt;/h2&gt; <br />
66+ &nbsp; &nbsp; &nbsp; &lt;div class=&quot;divweblog&quot;&gt; <br />
67+ &lt;!--Database Generated Content--&gt; <br />
68+ &lt;%gallery(gnoo/short,10)%&gt; <br />
69+ &lt;!--End Database Generated Content--&gt; <br />
70+ &nbsp; &nbsp; &nbsp; &lt;/div&gt; <br />
71+ &nbsp; &nbsp; &lt;/div&gt; <br />
72+ &nbsp; &lt;/div&gt; <br />
73+ &lt;/div&gt; <br />
74+ &lt;!--sidebar.inc--&gt; <br />
75+ <br />
76+ &lt;!--footer.inc--&gt; <br />
77+ &lt;%parsedinclude(footer.inc)%&gt;</td>
78+ </tr>
79+ </tbody>
80+</table>
81+<p><br />
82+ <br />
83+notice the two inline styles for contentdiv and content <br />
84+<br />
85+style=&quot;width:700px&quot; <br />
86+<br />
87+go and add that to the main index template of your NPGallery skin (change the 700px to the actual width for your skin, I think it is actually 700px for leaf, but you can make it a little smaller, like 690px to avoid some IE6 bugs. keep tweaking it until its just right because its different for everyone)</p>
88+<p>&nbsp;</p>
89+<p>Q4. I've enabled fancyurls on my blog and everything works fine except the gallery. </p>
90+<p>A4. fancy URLs dont work unless your nucleus site root is the same at the site root. </p>
91+<p>&nbsp; </p>
92+</body>
93+
94+</html>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/Install notes.txt
@@ -0,0 +1,135 @@
1+NP_gallery
2+johnkbradshaw@yahoo.com
3+
4+See bottom for version history.
5+Current release is 0.77 (5-4-05)
6+
7+To Upgrade:
8+ -- To upgrade from 0.61, run np_gallery_update061.php in your base nucleus directory
9+ -- To upgrade from 0.75, run np_gallery_update075.php
10+ -- Delete both np_gallery_update files
11+
12+To install:
13+1. make a skin called NPGallery with a call to <%gallery%> in it. For example mine looks like this:
14+ <%ExtraSkin(header2)%>
15+ <div id="contents">
16+ <%gallery%>
17+ </div>
18+ <%ExtraSkin(menu2)%>
19+ <%ExtraSkin(footer2)%>
20+
21+2. Create a link to the gallery in another skin with the skinvar <%gallery(link)%>, i.e. with this code: <a href="<%gallery(link)%>">Gallery</a>.
22+
23+3. upload the files in the zip to your webserver into the base directory (add_picture.php should be in the same directory as your index.php)
24+
25+4. create the folder media/gallery and make it writable (chmod 0777 or 0755)
26+
27+5. add the following to your CSS file:
28+ #NPG_gallery {
29+ margin-top: 5px;
30+ margin-bottom: 5px;
31+ padding-left: 5px;
32+ padding-right: 5px;
33+ position:relative;
34+ }
35+
36+ /*thumbnails are displayed as a 'list'*/
37+ ul.thumbnail {list-style: none;}
38+
39+ ul.thumbnail li {
40+ float: left;
41+ width: 115px;
42+ height: 140px;
43+ padding: 10px;
44+ margin: 10px;
45+ background-color: rgb(225,225,225);
46+ }
47+
48+ /*thumbnail container*/
49+ #NPG_thumbnail {
50+ margin-top: 5px;
51+ margin-bottom: 5px;
52+ padding-left: 5px;
53+ padding-right: 5px;
54+ position:relative;
55+ }
56+ /*footer container -- used so that the footer contents are actually displayed below the thumbnails, without clear:both the footer is displayed under the thumbnails*/
57+ #NPG_footer {
58+ clear:both;
59+ }
60+
61+
62+6. install the plugin
63+
64+7. play around with it and let me know what you think.
65+
66+version history:
67+--NP_gallery v0.4 alpha 3-8-2005: first alpha release
68+--NP_gallery v0.45 alpha 3-9-2005:
69+ fixed bugs with permission system
70+ changed the way albums are modified (moved to admin area)
71+ added preliminary album team support
72+ other bug fixes
73+--NP_gallery v0.5 alpha 3-9-2005:
74+ album teams (in admin area)
75+ delete album (in admin area)
76+ delete picture
77+ can now select add album permission level
78+ next, previous nav links on picture view
79+ move picture to different album
80+ bug fixes
81+--NP_gallery v0.55 alpha 3-17-2005:
82+ changed the default media directory style -- used to be something like ./foo/, now it is just foo/
83+ (previous change will mean that you should uninstall the plugin and delete the pictures in your gallery folder and reinstall them)
84+ thumbnail size can be changed
85+ rethumb (which resizes the thumbnails and intermediate pictures) function in admin area
86+ some bug fixes to address base_redirect
87+--NP_gallery v0.56 alpha 3-19-2005:
88+ fixed so that the plugin will work with 3.2
89+ couple other bug fixes
90+--NP_gallery v0.6 alpha 3-21-2005:
91+ new feature: promote to blog
92+ please configure this option in the admin area before using
93+ I need to do cosmetic cleanup for the forms and the post, but wanted to try out the concept
94+ bug fixes to re-thumb admin function
95+--NP_gallery v0.61 alpha 3-22-2005
96+ *changes made in this release require uninstall/reinstall
97+ added title template var -- displays title under thumbnail by default
98+ updated default css class: ul.thumbnail li (see above for change)
99+ fixed message after adding promo post
100+ fixed sql error when adding pictures
101+ when deleting a picture, there is an option to delete promo post associated with the picture
102+ number of picture upload slots is now an option in the admin area
103+ removed reference to a file in album_class.php that was triggering open_basedir problems
104+ added allowable tag to item body: <%gallery(link,picture|album,#)%>
105+ added cancel promo post
106+ promo post now uses bookmarklet.php edititem form
107+ fixed another bug with the rethumb function -- now works (on my system) with gd or imagemagick
108+--NP_gallery v0.75 4-6-2005
109+ moved to a class to handle admin page (like nucleus)
110+ started the move to allowing for translation to other languages (see english.php)
111+ added album template vars: centeredtopmargin(height, offset) and pictureviews
112+ centeredtopmargin inserts a margin-top that will vertically align a thumbnail using inline css (ie <img style="<%centeredtopmargin(140,-7)%>" src= ...)
113+ pictureviews displays the number of time a picture has been viewed
114+ comment system
115+ multiple templates
116+--NP_gallery v0.76 4-12-2005
117+ comment system works with np_captcha plugin
118+ new templatevars:
119+ <%albumdescription%> and <%picturedescription%> in album view
120+ <%if(next)%>, <%if(prev)%>, <%description%> in picture view
121+ <%if(commentsallowed)%> in picture view
122+ <%albumthumbnail%> in gallery list view
123+ album option for thumbnail
124+ album option for comments allowed or not
125+ plugin hooks: NPgPrePicture, NPgPostAddPicture, NPgPostUpdatePicture, NPgPostDeletePicture, NPgAddPictureFormExtras, NPgEditPictureFormExtras
126+ new default templates
127+ pictures are now prefixed by a random string
128+--NP_gallery v0.77 5-4-2005
129+ plugin hooks: NPgCollectionDisplay
130+ included NP_GalleryMostViewed
131+ bug fixes:
132+ problems with templates
133+ absolute filenames for pictures and links
134+ modified <%breadcrumb%> tag to have an option for a different separator: <%breadcrumb(separator)%>, default is >
135+ the word 'Gallery' as part of the breadcrumb is now defined in english.php
\ No newline at end of file
--- /dev/null
+++ b/NP_gallery/trunk/gallery/NP_gallery.css
@@ -0,0 +1,81 @@
1+
2+.thumbnailoutside {
3+ width:158px !important;
4+ height:170px !important;
5+ float:left ;
6+ text-align:center !important;
7+}
8+/*this is for a taller box*/
9+.thumbnailoutside2 {
10+ width:155px !important;
11+ height:180px !important;
12+ float:left !important;
13+ text-align:center !important;
14+}
15+
16+.alpha-shadow {
17+ float:left;
18+ background: url(/nucleus/plugins/gallery/update/shadow1.gif) no-repeat bottom right;
19+ margin: 0px 0 0 10px !important;
20+ margin: 10px 0 0 10px;
21+ z-index:3;
22+ padding: 0px;
23+ }
24+
25+.alpha-shadow div {
26+ background: url(/nucleus/plugins/gallery/update/shadow2.png) no-repeat left top !important;
27+ background: url(/nucleus/plugins/gallery/update/shadow2.gif) no-repeat left top;
28+ float: left;
29+ margin-top: 0px;
30+ padding: 0px 6px 6px 0px;
31+ }
32+
33+.alpha-shadow img {
34+ background-color: #fff;
35+ border: 1px solid #a9a9a9;
36+ padding: 4px !important;
37+ }
38+
39+.tooltip2 {
40+ background-image:none !important;
41+ width:0px;
42+ display:none;
43+}
44+
45+#tooltip2 div.tooltip2div {
46+border-style:dotted;
47+border-color:#CCCCCC;
48+ border-width:1px;
49+float:left;
50+ background-image:url(/nucleus/plugins/gallery/transparent.gif)!important;
51+ padding:0px !important;}
52+#tooltip2 div.tooltip2div span {display:none;}
53+#tooltip2 div.tooltip2div:hover {border-style:solid;border-color:#FFFFFF;float:left}
54+#tooltip2 div.tooltip2div:hover span {display:block;background-color:white;padding-left:10px;padding-right:10px}
55+#tooltip2 div.over {border-style:none;display:block;float:left;border-color:#FFFFFF;float:left}
56+#tooltip2 div.over span {float:left;display:block;background-color:white;padding-left:10px;padding-right:10px}
57+
58+/* had to put float:left here because firefox before 1.0.5 has a bug with javascript element.stlye.float (fixed in 1.0.6)*/
59+
60+.drawingbox {
61+border-style:solid;
62+position:absolute;
63+border-width:1px;
64+border-color:#FFFFFF;
65+float:left;
66+display:block;
67+z-index:5;
68+}
69+
70+/* had to put float:left here because firefox before 1.0.5 has a bug with javascript element.stlye.float (fixed in 1.0.6)*/
71+
72+.captionformdiv {
73+position:absolute;
74+float:left;
75+background-color:#FFFFFF;
76+display:block;
77+border-style:solid;
78+border-color:#FFFFFF;
79+}
80+
81+
--- /dev/null
+++ b/NP_gallery/trunk/gallery/NP_gallery.js
@@ -0,0 +1,294 @@
1+// Detect if the browser is IE or not.
2+// If it is not IE, we assume that the browser is NS/mozilla.
3+var IE = document.all?true:false
4+
5+// If NS -- that is, !IE -- then set up for mouse movement and click capture
6+if (!IE) document.captureEvents(Event.MOUSEMOVE)
7+if (!IE) document.captureEvents(Event.MOUSEDOWN)
8+
9+// Temporary variables to hold mouse x-y pos.s
10+var tempX = 0
11+var tempY = 0
12+var check = 0
13+var Pos1x = 0
14+var Pos1y = 0
15+var Pos2x = 0
16+var Pos2y = 0
17+var RelX = 0
18+var RelY = 0
19+
20+//start is the trigger that starts the box creation.
21+function start() {
22+ //assign click as the event handler if there is a click.
23+ document.onmousedown = click
24+ return true
25+}
26+
27+function click(e){
28+ if (check == 2){return;//prevent multiple box drawing, or catching a third click.
29+ }
30+ if (check == 0) { //first click
31+ if (IE) { // grab the x-y pos.s if browser is IE
32+ // have to use document.documentElement instead of document.body
33+ // because for some reason IE6 reassigns when in standards complient mode
34+ // http://www.quirksmode.org/js/doctypes.html
35+ tempX = event.clientX + document.documentElement.scrollLeft
36+ tempY = event.clientY + document.documentElement.scrollTop
37+ } else { // grab the x-y pos.s if browser is NS/mozilla
38+ tempX = e.pageX
39+ tempY = e.pageY
40+ }
41+ //write temporary position 1(top left corner)
42+ Pos1x = tempX
43+ Pos1y = tempY
44+ //getting the check variable ready for the second click
45+ check = check + 1
46+ //create the drawingbox and insert it into the DOM tree at the first mouse click location
47+ createbox()
48+ //run the function that updates the mouse postion and update the box size on mousemove
49+ document.onmousemove = getMouseXY
50+ return false;
51+ }
52+ //second click
53+ if (check == 1) {
54+ //save second click location(bottem right) to submit to php for calculation
55+ Pos2x = tempX
56+ Pos2y = tempY
57+ check = check + 1 // makes check = 2 to prevent additional boxes being drawn, or variables being written
58+ //disable mouseevents
59+ document.onmousedown = null
60+ document.onmousemove = null
61+ //create the box for the caption
62+ createcaptionbox()
63+ return false;
64+ }
65+ return false;
66+}
67+
68+// Main function to retrieve mouse x-y pos.s and update box size.
69+function getMouseXY(e) {
70+ if (IE) { // grab the x-y pos.s if browser is IE
71+ // have to use document.documentElement instead of document.body
72+ // because for some reason IE6 reassigns when in standards complient mode
73+ // http://www.quirksmode.org/js/doctypes.html
74+ tempX = event.clientX + document.documentElement.scrollLeft
75+ tempY = event.clientY + document.documentElement.scrollTop
76+ } else { // grab the x-y pos.s if browser is NS/mozilla
77+ tempX = e.pageX
78+ tempY = e.pageY
79+ }
80+ // catch possible negative values in NS4
81+ if (tempX < 0){tempX = 0}
82+ if (tempY < 0){tempY = 0}
83+ //while the mouse is moving,create and update the size of the drawingbox
84+ var box = document.getElementById('drawingbox')
85+ //update the size of the box everytime the mouse moves a pixel
86+ boxwidth =(tempX - Pos1x) //these calculations have to be
87+ boxheight = (tempY - Pos1y) //seperate because IE chokes
88+ box.style.width = boxwidth + 'px' //update box width and height
89+ box.style.height = boxheight + 'px'
90+ return true;
91+}
92+
93+function createcaptionbox() {
94+ //the insert caption box is really a form inside a div
95+ //these lines generate a form, and puts in inputs
96+ //Pos1x,Pos1y,Po2x,Pos2y,RelX,RelY,pictureid,description
97+ //the form has to be created here because IE can not accept
98+ //two forms with the same name (firefox does)
99+ //otherwise it would be easier to generate the
100+ //form from the nucleus template
101+ var captionformdiv = document.createElement('div')
102+ var captionform = document.createElement('form')
103+ captionform.setAttribute('name','Show')
104+ captionform.setAttribute('method','POST')
105+ captionform.setAttribute('action','/action.php?action=plugin&name=gallery&type=tagaccept')
106+ captionform.style.border
107+ captionform.style.font
108+ captionform.style.padding
109+ var inputPos1x = document.createElement('input')
110+ inputPos1x.setAttribute('name','Pos1x')
111+ inputPos1x.setAttribute('value',Pos1x)
112+ inputPos1x.setAttribute('type','hidden')
113+ captionform.appendChild(inputPos1x)
114+ var inputPos1y = document.createElement('input')
115+ inputPos1y.setAttribute('name','Pos1y')
116+ inputPos1y.setAttribute('value',Pos1y)
117+ inputPos1y.setAttribute('type','hidden')
118+ captionform.appendChild(inputPos1y)
119+ var inputPos2x = document.createElement('input')
120+ inputPos2x.setAttribute('name','Pos2x')
121+ inputPos2x.setAttribute('value',Pos2x)
122+ inputPos2x.setAttribute('type','hidden')
123+ captionform.appendChild(inputPos2x)
124+ var inputPos2y = document.createElement('input')
125+ inputPos2y.setAttribute('name','Pos2y')
126+ inputPos2y.setAttribute('value',Pos2y)
127+ inputPos2y.setAttribute('type','hidden')
128+ captionform.appendChild(inputPos2y)
129+ var inputRelX = document.createElement('input')
130+ inputRelX.setAttribute('name','RelX')
131+ inputRelX.setAttribute('value',RelX)
132+ inputRelX.setAttribute('type','hidden')
133+ captionform.appendChild(inputRelX)
134+ var inputRelY = document.createElement('input')
135+ inputRelY.setAttribute('name','RelY')
136+ inputRelY.setAttribute('value',RelY)
137+ inputRelY.setAttribute('type','hidden')
138+ captionform.appendChild(inputRelY)
139+ var inputdesc = document.createElement('input')
140+ inputdesc.setAttribute('name','desc')
141+ inputdesc.setAttribute('value','enter caption')
142+ inputdesc.setAttribute('size','30')
143+ inputdesc.style.fontSize = '10px'
144+ inputdesc.style.border = '0px'
145+ inputdesc.setAttribute('onClick','erasedesc();')
146+ captionform.appendChild(inputdesc)
147+ var inputpictureid = document.createElement('input')
148+ inputpictureid.setAttribute('name','pictureid')
149+ inputpictureid.setAttribute('value',pictureid )
150+ inputpictureid.setAttribute('type','hidden')
151+ captionform.appendChild(inputpictureid)
152+ var inputsubmit = document.createElement('input')
153+ inputsubmit.setAttribute('name','Submit')
154+ inputsubmit.setAttribute('type','submit')
155+ inputsubmit.style.fontFamily = 'Verdana'
156+ inputsubmit.style.fontSize = '10px'
157+ inputsubmit.style.backgroundColor = '#cccccc'
158+ inputsubmit.style.border ='1px'
159+ inputsubmit.setAttribute('value','Tagit!')
160+ captionform.appendChild(inputsubmit)
161+ //give the div that wraps the form some attributes.
162+ captionformdiv.style.position = 'absolute'
163+ captionformdiv.style.left = Pos1x +'px'
164+ captionformdiv.style.top = Pos2y +'px'
165+ captionformdiv.style.width = tempX - Pos1x - 5 +'px'
166+ captionformdiv.style.backgroundColor = '#FFFFFF'
167+ captionformdiv.style.display = 'block'
168+ captionformdiv.style.borderStyle = 'solid'
169+ captionformdiv.style.borderColor = '#FFFFFF'
170+ //put the captionform into the captionbox into the wrapper div
171+ captionformdiv.appendChild(captionform)
172+ document.getElementById('container').appendChild(captionformdiv)
173+
174+
175+}
176+
177+function createbox(){
178+ // initialize the box with zero width and height, inserted at the first mouse click location (tempX,tempY)
179+ var drawingbox = document.createElement('div')
180+ drawingboxwidth = Pos2x - RelX
181+ drawingbox.style.position = 'absolute'
182+ drawingbox.setAttribute('id','drawingbox')
183+ drawingbox.setAttribute('class','drawingbox')
184+ drawingbox.style.borderStyle = 'solid'
185+ drawingbox.style.borderColor = '#FFFFFF'
186+ drawingbox.style.borderWidth = '1px'
187+ drawingbox.style.left = tempX +'px'
188+ drawingbox.style.top = tempY +'px'
189+ drawingbox.style.height = "0px"
190+ drawingbox.style.width = "0px"
191+ drawingbox.style.display = 'block'
192+ drawingbox.style.zIndex = '5'
193+ //where to insert the box in the DOM tree.
194+ document.getElementById('container').appendChild(drawingbox);
195+ }
196+
197+//find actual location of an element in the DOM tree(in this case the image).
198+//this function is called as a onMouseover event from the browser. code from quirksmode.org
199+function findPosX(obj)
200+{
201+ var curleft = 0;
202+ if (obj.offsetParent)
203+ {
204+ while (obj.offsetParent)
205+ {
206+ curleft += obj.offsetLeft
207+ obj = obj.offsetParent;
208+ }
209+ }
210+ else if (obj.x)
211+ curleft += obj.x;
212+ return curleft;
213+}
214+
215+function findPosY(obj)
216+{
217+ var curtop = 0;
218+ var printstring = '';
219+ if (obj.offsetParent)
220+ {
221+ while (obj.offsetParent)
222+ {
223+ printstring += ' element ' + obj.tagName + ' has ' + obj.offsetTop;
224+ curtop += obj.offsetTop
225+ obj = obj.offsetParent;
226+ }
227+ }
228+ else if (obj.y)
229+ curtop += obj.y;
230+ window.status = printstring;
231+ return curtop;
232+}
233+
234+// on mouseover the image, executes this to assign its absolute position and save it(RelX,RelY)
235+// for relative div position calculating purposes in the php tagaccept file.
236+function setLyr(obj,lyr)
237+{
238+ RelX = findPosX(obj);
239+ RelY = findPosY(obj);
240+
241+}
242+
243+//on mouseout (NS) or mouseleave (IE), hide the tooltip boxes
244+function hidetipdivs() {
245+
246+ navRoot = document.getElementById("tooltip2");
247+ for (i=0; i<navRoot.childNodes.length; i++) {
248+ navRoot.childNodes[i].style.display = 'none' ;
249+ }
250+ }
251+
252+//on mouseover (NS) or on mouseenter (IE) show tipdivs
253+function showtipdivs() {
254+navRoot = document.getElementById("tooltip2");
255+for (i=0; i<navRoot.childNodes.length; i++) {
256+ navRoot.childNodes[i].style.display = '' ;
257+ }
258+ }
259+
260+function erasedesc(){
261+ document.Show.desc.value=null
262+ document.Show.desc.value=''
263+ }
264+
265+
266+//hide the boxes initially, to avoid confusion where the mouse is initially in the image, or not in the image.
267+//hidetipdivs();
268+// this had to be moved to after the picture loads, because for some reason
269+// if you insert javascript from an external file, IE6 loads the file AFTER everything else is loaded
270+// if it is a relative URL, and BEFORE everything is loaded if it is a absolute URL containing http://
271+// so IE6 tries to remove the hover captions but there are no hover captions to remove so IE6 crashes.
272+
273+function startList() {
274+if (document.all && document.getElementById) { //check if its IE
275+navRoot = document.getElementById("tooltip2");
276+for (i=0; i<navRoot.childNodes.length; i++) {
277+ node = navRoot.childNodes[i];
278+ if (node.nodeName=="DIV") {
279+ node.onmouseover=function() {
280+ this.className+=" over";
281+ }
282+ node.onmouseout=function() {
283+ this.className=this.className.replace
284+ (" over", "");
285+ }
286+ }
287+ }
288+ }
289+}
290+window.onload=startList;
291+
292+
293+
294+
--- /dev/null
+++ b/NP_gallery/trunk/gallery/add_picture.php
@@ -0,0 +1,469 @@
1+<style type="text/css">
2+<!--
3+body,td,th {
4+ font-family: Courier New, Courier, monospace;
5+ font-size: 12px;
6+ color: #000000;
7+}
8+body {
9+ margin-left: 20px;
10+ margin-top: 20px;
11+}
12+-->
13+</style>
14+<?php
15+
16+//add_picture.php
17+include('../../../config.php');
18+include_once('config.php'); //gallery config
19+include_once($DIR_LIBS . 'ITEM.php');
20+
21+
22+class NPG_PROMO_ACTIONS extends BaseActions {
23+
24+ var $parser;
25+ var $thumbnails;
26+ var $template;
27+ var $CurrentThumb;
28+
29+ function NPG_PROMO_ACTIONS() {
30+ $this->BaseActions();
31+ }
32+
33+ function getdefinedActions() {
34+ return array(
35+ 'images',
36+ 'thumbnail',
37+ 'centeredtopmargin',
38+ 'picturelink',
39+ 'description'
40+ );
41+ }
42+
43+ function setTemplate(&$template) {$this->template = &$template;}
44+ function setParser(&$parser) {$this->parser =& $parser; }
45+ function setCurrentThumb(&$CurrentThumb) {$this->CurrentThumb = &$CurrentThumb;}
46+
47+ function addimagethumbnail($thumbnails) {$this->thumbnails = $this->thumbnails . $thumbnails;}
48+ function needtoaddpromo() {if($this->thumbnails <> '') return true; return false;}
49+
50+ function parse_images() { echo $this->thumbnails; }
51+ function parse_description() {echo $this->CurrentThumb->getdescription(); }
52+ function parse_thumbnail() {echo $this->CurrentThumb->getthumbfilename();}
53+ function parse_picturelink() {echo '<%gallery(link,picture,'.$this->CurrentThumb->getID().')%>';}
54+ function parse_centeredtopmargin($height = 140,$adjustment = 0) {
55+ $image_size = getimagesize($this->CurrentThumb->getthumbfilename());
56+ $topmargin = ((intval($height) - intval($image_size[1])) / 2) + intval($adjustment);
57+ echo 'margin-top: '.$topmargin.'px;';
58+ }
59+}
60+
61+//globals for add_picture.php
62+global $NPG_CONF,$gmember,$manager,$NP_BASE_DIR;
63+
64+if(!$NPG_CONF['temp_table']) {
65+ $NPG_CONF['temp_table'] = 'gallery_temp';
66+ setNPGoption('temp_table','gallery_temp');
67+}
68+
69+if(!$NPG_CONF['batch_add_num']) $NPG_CONF['batch_add_num'] = 10;
70+
71+//todo: display header
72+
73+
74+$type = requestvar('type');
75+switch($type) {
76+ case 'firststage':
77+ $exist_temp_table = mysql_query('SELECT 1 FROM '.$NPG_CONF['temp_table'].' LIMIT 0');
78+ if ($exist_temp_table) sql_query('drop table '. $NPG_CONF['temp_table']);
79+ if(requestVar('id')) $albumid = requestVar('id'); else $albumid = 0;
80+ $number_of_uploads=$NPG_CONF['batch_add_num'];
81+ addPictureForm($albumid, $number_of_uploads);
82+ break;
83+ case 'secondstage':
84+ if(requestVar('id')) $albumid = requestVar('id'); else $albumid = 0;
85+ $result = mysql_query('create table '.$NPG_CONF['temp_table']
86+ .'(tempid int unsigned not null auto_increment PRIMARY KEY, '
87+ .'memberid int unsigned, '
88+ .'albumid int unsigned, '
89+ .'filename varchar(60), '
90+ .'intfilename varchar(60), '
91+ .'thumbfilename varchar(60), '
92+ .'title varchar(40), '
93+ .'description varchar(255), '
94+ .'promote tinyint unsigned default 0, '
95+ .'error varchar(60) default NULL)' );
96+
97+ $i=0;
98+ while ($uploadInfo = postFileInfo('uploadpicture'.$i)) {
99+ if ($filename = $uploadInfo['name']) {
100+ $filetype = $uploadInfo['type'];
101+ $filesize = $uploadInfo['size'];
102+ $filetempname = $uploadInfo['tmp_name'];
103+ //this gets picasa captions from ITPC metadata
104+ $size = getimagesize($filetempname, $info);
105+ if (isset($info["APP13"])) {
106+ $iptc = iptcparse($info["APP13"]);
107+ $description = $iptc["2#120"][0];
108+ }
109+ //adds a picture to the temp table so user can add description, etc before actually adding to database
110+ add_temp($albumid, $filename, $filetype, $filesize, $filetempname,$description);
111+ }
112+ $i++;
113+ }
114+ addTempPictureForm($albumid);
115+ break;
116+ case 'massupload' :
117+ //if the referring address is not this page, drop the table.
118+ if(!stristr($_SERVER['HTTP_REFERER'],'add_picture.php')) {
119+ $exist_temp_table = mysql_query('SELECT 1 FROM '.$NPG_CONF['temp_table'].' LIMIT 0');
120+ if ($exist_temp_table) sql_query('drop table '. $NPG_CONF['temp_table']);
121+ echo 'starting a fresh massupload batch </br>';
122+ }
123+ else echo '...continuing a massupload batch </br>';
124+ //create a table (if the table is already there, mysql just adds to the table)
125+ if(requestVar('id')) $albumid = requestVar('id'); else $albumid = 0;
126+ $result = mysql_query('create table '.$NPG_CONF['temp_table']
127+ .'(tempid int unsigned not null auto_increment PRIMARY KEY, '
128+ .'memberid int unsigned, '
129+ .'albumid int unsigned, '
130+ .'filename varchar(60), '
131+ .'intfilename varchar(60), '
132+ .'thumbfilename varchar(60), '
133+ .'title varchar(40), '
134+ .'description varchar(255), '
135+ .'promote tinyint unsigned default 0, '
136+ .'error varchar(60) default NULL)' );
137+ //checks to see how many files are in the upload directory
138+ if ($handle = opendir($NP_BASE_DIR.'upload')) {
139+ while (false !== ($filename = readdir($handle))) {
140+ if (stristr($filename,'jpeg') or stristr($filename,'jpg')){
141+ $scandir[] = $filename;
142+ }
143+ }
144+ closedir($handle);
145+ $numpics = count($scandir);
146+
147+ echo 'there are ' . $numpics .' pictures(jpg) left in the upload directory </br>';
148+ echo 'the massupload script will loop though '.$NPG_CONF['batch_add_num'].' pictures per time to prevent timeouts</br>';
149+ //if there are more than 10 files, remember to refresh,
150+ //this is to solve the incomplete database writes when scripts timeout
151+ //have to reopen the directory so it starts from the first file again
152+ $handle = opendir($NP_BASE_DIR.'upload');
153+ for ( $i=0; false !==($file=readdir($handle)) and $i<=$NPG_CONF['batch_add_num']; $i++ ) {
154+ if (stristr($file,'jpeg') or stristr($file,'jpg')){
155+ $filename = $file;
156+ //echo $filename . 'uploaded </br>';
157+ $filetype = filetype($NP_BASE_DIR.'upload/' . $file);
158+ $filesize = filesize($NP_BASE_DIR.'upload/' . $file);
159+ $filetempname = $NP_BASE_DIR.'upload/' . $file;
160+ $size = getimagesize($filetempname, $info);
161+ //this gets picasa captions from ITPC metadata
162+ if (isset($info["APP13"])) {
163+ $iptc = iptcparse($info["APP13"]);
164+ $description = $iptc["2#120"][0];
165+ $description = addslashes($description);
166+ }
167+ //adds a picture to the temp table so user can add description, etc before actually adding to database
168+ echo 'creating thumbnail for ';
169+ echo $filename;
170+ add_temp($albumid, $filename, $filetype, $filesize, $filetempname,$description);
171+ echo '.... done. </br>';
172+ }
173+ }
174+ closedir($handle);
175+ }
176+ //if there were more than 10 files, refresh, else proceed.
177+ if($numpics > $NPG_CONF['batch_add_num']){
178+ echo "<SCRIPT LANGUAGE=\"JavaScript\">window.location=\" ".$_SERVER['SCRIPT_NAME']."?type=massupload&id=".$albumid." \";</script>";
179+ }
180+ addTempPictureForm($albumid);
181+ break;
182+
183+ case 'addpictures':
184+ $i=0;
185+ $promoallowed = postvar('promopost');
186+ $promo_ids = array();
187+ $setorpromo = $NPG_CONF['setorpromo'];
188+
189+ if(!$NPG_CONF['template']) $NPG_CONF['template'] = 1;
190+ $template = & new NPG_TEMPLATE($NPG_CONF['template']);
191+
192+ $actions = new NPG_PROMO_ACTIONS();
193+ $parser = new PARSER($actions->getdefinedActions(),$actions);
194+ $actions->setparser($parser);
195+ $actions->settemplate($template);
196+
197+ while($tempid = postvar('tid'.$i)) {
198+ $title = postvar('title'.$i);
199+ $description = postvar('description'.$i);
200+ $promote = postvar('promote'.$i);
201+ $albumid = postvar('album'.$i);
202+
203+ $filename = $NPG_CONF['galleryDir'].'/'.postvar('filename'.$i);
204+ $int_filename = postvar('intfilename'.$i);
205+ $thumb_filename = postvar('thumbfilename'.$i);
206+ $keywords = postvar('keywords'.$i);
207+
208+ //check permissions to add
209+ if($gmember->canAddPicture($albumid)) {
210+ $pict = new PICTURE(0);
211+ $newid = $pict->add_new($albumid, $filename, $title, $description, $int_filename, $thumb_filename,$keywords);
212+ echo "$filename added<br/>";
213+
214+ //promotion post
215+ if ($promoallowed == '1' && $promote == 'yes') {
216+ ob_start();
217+ $actions->setCurrentThumb($pict);
218+ $parser->parse($template->section['PROMO_IMAGES']);
219+ $capt = ob_get_contents();
220+ ob_end_clean();
221+ $actions->addimagethumbnail($capt);
222+ array_push($promo_ids, $newid);
223+ }
224+ unset($pict);
225+
226+ $manager->notify('NPgPostAddPicture',array('pictureid' => $newid));
227+ }
228+ else {
229+ echo "$filename not added due to bad album permissions<br/>";
230+ //delete files
231+ if(file_exists($galleryDir.'/'.$filename)) unlink($galleryDir.'/'.$filename);
232+ if(file_exists($int_filename)) unlink($int_filename);
233+ if(file_exists($thumb_filename)) unlink($thumb_filename);
234+
235+ }
236+
237+ $i++;
238+ }
239+
240+ if ($promoallowed == '1' && $actions->needtoaddpromo() ) {
241+
242+ $today = getdate();
243+ $hour = $today['hours'];
244+ $minutes = $today['minutes'];
245+ $day = $today['mday'];
246+ $month = $today['mon'];
247+ $year = $today['year'];
248+
249+
250+ ob_start();
251+ $parser->parse($template->section['PROMO_TITLE']);
252+ $title = ob_get_contents();
253+ ob_end_clean();
254+ if ($setorpromo=='promo'){
255+ ob_start();
256+ $parser->parse($template->section['PROMO_BODY']);
257+ $body = ob_get_contents();
258+ ob_end_clean();
259+ }
260+ if ($setorpromo=='sets'){
261+ $body = '<%gallery(keywords,'.$promokeywords.',desc)%>';
262+ }
263+
264+ ?>
265+ <br/><hr/><br/>
266+ <form><input type="button" value="<?php echo __NPG_PROMO_FORM_CANCEL; ?>" onclick="window.close()"/></form>
267+ <form method="post" action="add_picture.php"><div>
268+ <input type="hidden" name="type" value="promopost" />
269+ <input type="hidden" name="catid" value="<?php echo $NPG_CONF['blog_cat']; ?>" />
270+ <input type="hidden" name="hour" value="<?php echo $hour; ?>" />
271+ <input type="hidden" name="minutes" value="<?php echo $minutes; ?>" />
272+ <input type="hidden" name="day" value="<?php echo $day; ?>" />
273+ <input type="hidden" name="year" value="<?php echo $year; ?>" />
274+ <input type="hidden" name="month" value="<?php echo $month; ?>" />
275+ <input type="hidden" name="ids" value="<?php echo implode(",",$promo_ids); ?>" />
276+
277+ <p><label for "title_f"><?php echo __NPG_PROMO_FORM_TITLE.'<br/>'; ?></label>
278+ <input type="text" name="title" id="title_f" value="<?php echo $title; ?>" /></p>
279+
280+ <p><label for "body_f"><?php echo __NPG_PROMO_FORM_BODY.'<br/>'; ?></label>
281+ <textarea rows="10" cols="50" name="body" id="body_f" >
282+ <?php echo $body; ?></textarea></p>
283+ <input type="submit" value="<?php echo __NPG_PROMO_FORM_SUBMIT; ?>" />
284+ <br/>
285+
286+ <?php
287+
288+ }
289+ else {
290+ echo '<br/><hr/><br/>';
291+ echo '<form><input type="button" value="'.__NPG_PROMO_FORM_CLOSE.'" onclick="window.close()"/></form>';
292+ }
293+
294+
295+ $exist_temp_table = mysql_query('SELECT 1 FROM '.$NPG_CONF['temp_table'].' LIMIT 0');
296+ if ($exist_temp_table) sql_query('drop table '. $NPG_CONF['temp_table']);
297+
298+ break;
299+
300+ case 'promopost':
301+ global $manager;
302+ $ids = explode(",", postvar('ids'));
303+ $result = ITEM::createFromRequest();
304+ if ($result['status'] == 'error')
305+ echo $result['message'];
306+ else {
307+ $j=0;
308+ while($ids[$j]) {
309+ $query = 'insert into '.sql_table('plug_gallery_promo').' values ('.$ids[$j].', '.$result['itemid'].')';
310+ sql_query($query);
311+ $j++;
312+ }
313+ echo __NPG_PROMO_FORM_SUCCESS.'<br/>';
314+ echo '<form><input type="button" value="' . __NPG_PROMO_FORM_CLOSE . '" onclick="window.close()"/></form>';
315+
316+ }
317+ break;
318+
319+ case 'picasa' :
320+ if(requestVar('id')) $albumid = requestVar('id'); else $albumid = 0;
321+ $result = mysql_query('create temporary table '.$NPG_CONF['temp_table']
322+ .'(tempid int unsigned not null auto_increment PRIMARY KEY, '
323+ .'memberid int unsigned, '
324+ .'albumid int unsigned, '
325+ .'filename varchar(60), '
326+ .'intfilename varchar(60), '
327+ .'thumbfilename varchar(60), '
328+ .'title varchar(40), '
329+ .'description varchar(255), '
330+ .'promote tinyint unsigned default 0, '
331+ .'error varchar(60) default NULL)' );
332+ //creates an xml parser and puts the xml into an array
333+ $p = xml_parser_create();
334+ if (!($fp = fopen($NP_BASE_DIR."upload/index.xml", "r"))) {die("unable to open XML");}
335+ $contents = fread($fp, filesize($NP_BASE_DIR."upload/index.xml"));
336+ xml_parse_into_struct($p,$contents,$vals,$index);
337+ fclose($fp);
338+ xml_parser_free($p);
339+ //get album item count and loop through the pictures, putting filename and description into the temp database
340+ $count = $index["ALBUMITEMCOUNT"][0];
341+ $albumitemcount = $vals[$count]["value"];
342+ for ($i=0; $i<$albumitemcount;$i++) {
343+ $count = $index["ITEMNAME"][$i];
344+ $filename = $vals[$count]["value"];
345+ $count = $index["ITEMCAPTION"][$i];
346+ $description = $vals[$count]["value"];
347+ $filename = trim($filename);
348+ $filetempname = $NP_BASE_DIR.'upload/images/' . $filename ;
349+ $filetype = filetype($filetempname);
350+ $filesize = filesize($filetempname);
351+ //adds a picture to the temp table so user can add description, etc before actually adding to database
352+ add_temp($albumid, $filename, $filetype, $filesize, $filetempname, $description);
353+
354+ }
355+
356+
357+ default:
358+ break;
359+}
360+
361+
362+
363+
364+//adds a picture to the temp table so user can add description, etc before actually adding to database
365+
366+function add_temp($albumid = 0, $filename, $filetype, $filesize, $filetempname, $description = '') {
367+ global $NPG_CONF, $gmember, $NP_BASE_DIR,$manager;
368+ $memberid = $gmember->getID();
369+ $temp_table = $NPG_CONF['temp_table'];
370+ $int_filename = '';
371+ $thumb_filename = '';
372+ $error = '';
373+ $defaulttitle = $filename;
374+ $NPG_CONF['randomprefix'] = 6;
375+
376+ //add prefix to filename -- from http://www.phpdig.net/ref/rn22re349.html
377+ //or add current date to filename , option set in plugin admin
378+ $dateorrandom = $NPG_CONF['dateorrandom'];
379+
380+ if ($dateorrandom == 'randomprefix'){
381+ $str = "";
382+ for ($i = 0; $i < $NPG_CONF['randomprefix']; ++$i) {
383+ $str .= chr(rand() % 26 + 97);
384+ }
385+ $filename = $str . $filename;
386+ }
387+ if ($dateorrandom == 'dateprefix'){
388+ $str = "";
389+ $str = date('Y-m-d');
390+ $filename = $str . $filename;
391+ }
392+ //check filesize
393+
394+ if ($filesize > $NPG_CONF['max_filesize'])
395+ $error = 'FILE_TOO_BIG';
396+ else {
397+ //check filetype -- currently only jpeg supported
398+ if (eregi("\.jpeg$",$filename)) $ok = 1;
399+ if (eregi("\.jpg$",$filename)) $ok = 1;
400+ if (!$ok)
401+ $error='BADFILETYPE';
402+ else {
403+ //check if gallery directory exists, try to create if it doesn't, check write permssions
404+ $mediadir = $NPG_CONF['galleryDir'];
405+ if (!@is_dir($NP_BASE_DIR.$mediadir)) {
406+ $error = 'Disallowed';
407+ $oldumask = umask(0000);
408+ if (!@mkdir($NP_BASE_DIR.$mediadir, 0777)) $error='Cannot create gallery directory';
409+ else {
410+ $error = NULL;
411+ umask($oldumask);
412+ }
413+ }
414+ else {
415+ if (!is_writeable($NP_BASE_DIR.$mediadir)) $error = 'Gallery directory not writable';
416+ else {
417+ // add trailing slash (don't add it earlier since it causes mkdir to fail on some systems)
418+ $mediadir .= '/';
419+ //check if file already exists -- todo:if it does, add it to the database?
420+ if (file_exists($NP_BASE_DIR.$mediadir . $filename)) $error = 'UPLOADDUPLICATE';
421+ else {
422+ //move file : courtesy of Leslie Holmes www.CyberSparrow.com
423+ if (is_file($filetempname)) {
424+ if (@rename($filetempname,$NP_BASE_DIR. $mediadir . $filename)){
425+ // it worked, no problems
426+ } elseif (copy($filetempname,$NP_BASE_DIR. $mediadir . $filename)){
427+ // rename didn't work, so we tried copy and it worked, now delete original upload file
428+ unlink($filetempname);
429+ } else {
430+ // neither method worked, so report error
431+ $error = 'ERROR_UPLOADCOPY,ERROR_UPLOADMOVE' ;
432+ }
433+ }
434+ //chmod file
435+ $oldumask = umask(0000);
436+ @chmod($NP_BASE_DIR.$mediadir . $filename, 0644);
437+ umask($oldumask);
438+
439+ if(($NPG_CONF['graphics_library']=='gd' && GDisPresent()) || ($NPG_CONF['graphics_library']=='im' && IMisPresent()) ) {
440+ //make intermediate file and thumbnail
441+ $int_filename = resizeImage($mediadir.$filename, $NPG_CONF['maxwidth'], $NPG_CONF['maxheight'], $mediadir.$NPG_CONF['int_prefix'].$filename);
442+ $thumb_filename = resizeImage($mediadir.$filename, $NPG_CONF['thumbwidth'], $NPG_CONF['thumbheight'], $mediadir.$NPG_CONF['thumb_prefix'].$filename);
443+ }
444+ else {
445+ $error = 'Graphics library not configured properly';
446+ }
447+ }
448+ }
449+ }
450+ }
451+ }
452+
453+
454+
455+
456+
457+ $query = 'insert into '
458+ .$temp_table
459+ .'(tempid,memberid,albumid,filename,intfilename,thumbfilename,title,description,promote,error)'
460+ ." values (NULL, $memberid, $albumid, '$filename', '$int_filename', '$thumb_filename', '$defaulttitle', '$description', 0, '$error') ";
461+ //echo $query.'<br/>';
462+ $result = sql_query($query);
463+
464+
465+
466+}
467+
468+
469+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/admin.php
@@ -0,0 +1,1251 @@
1+<?php
2+
3+//NP_Gallery admin class
4+
5+class NPG_ADMIN {
6+
7+ var $action;
8+ var $tabs;
9+
10+ function NPG_ADMIN() {
11+ global $manager;
12+
13+ //admin tabs
14+ $this->tabs = array();
15+ array_push($this->tabs, array('action' => 'albumlist', 'active' =>'albums', 'user' => 1, 'title'=>__NPG_ADMIN_TAB_ALBUMS));
16+ array_push($this->tabs, array('action' => 'comments', 'active' =>'comments', 'user' => 1, 'title'=>__NPG_ADMIN_TAB_COMMENTS));
17+ array_push($this->tabs, array('action' => 'config', 'active' =>'config', 'title'=>__NPG_ADMIN_TAB_CONFIG));
18+ if($NPG_CONF['add_album'] == 'select') array_push($this->tabs, array('action' => 'users', 'active' =>'users', 'title'=>__NPG_ADMIN_TAB_USERS));
19+ array_push($this->tabs, array('action' => 'templates', 'active' =>'templates', 'title'=>__NPG_ADMIN_TAB_TEMPLATES));
20+ array_push($this->tabs, array('action' => 'functions', 'active' =>'admin', 'title'=>__NPG_ADMIN_TAB_ADMIN));
21+
22+ $manager->notify('NPgAdminTab', array('tabs' => &$this->tabs ));
23+ }
24+
25+ function action($action) {
26+ global $gmember, $NPG_CONF, $manager;
27+
28+ $alias = array(
29+ 'login' => 'albumlist',
30+ '' => 'albumlist'
31+ );
32+
33+ if ($alias[$action])
34+ $action = $alias[$action];
35+
36+ $methodName = 'action_' . $action;
37+
38+ $this->action = strtolower($action);
39+
40+ //if nucleus version 3.2, check ticket
41+ /*
42+ if(getNucleusVersion() >= 320) {
43+ $aActionsNotToCheck = array();
44+
45+ if (!in_array($this->action, $aActionsNotToCheck))
46+ {
47+ if (!$manager->checkTicket())
48+ $this->error(_ERROR_BADTICKET);
49+ }
50+
51+ }
52+ */
53+ if (method_exists($this, $methodName))
54+ call_user_func(array(&$this, $methodName));
55+ else
56+ $this->error(_BADACTION . " ($action)");
57+
58+
59+ }
60+
61+ function error($msg) {
62+ ?>
63+ <h2>Error!</h2>
64+ <?php echo $msg;
65+ echo "<br />";
66+ echo "<a href='index.php' onclick='history.back()'>"._BACK."</a>";
67+ exit;
68+ }
69+
70+
71+ function display_tabs($active = 'albumlist') {
72+ global $gmember, $NPG_CONF, $galleryaction;
73+
74+ echo '<ul id="tabmenu">';
75+ foreach($this->tabs as $tab) {
76+ if($tab['user'] || $gmember->isAdmin() ) {
77+ echo '<li><a ';
78+ if( $active == $tab['active'] ) echo 'class="active" ';
79+ echo 'href="'.$galleryaction;
80+ if($tab['action']) echo '?action='.$tab['action'];
81+ echo '">'.$tab['title'].'</a></li>';
82+ }
83+ }
84+ echo '</ul>';
85+
86+ }
87+
88+ function display_selectusers() {
89+ global $galleryaction,$gmember;
90+
91+ $result = mysql_query('select a.*, b.mname as membername from '.sql_table('plug_gallery_member').' as a, '.sql_table('member').' as b where mnumber=memberid');
92+ if(!$result) {
93+ echo mysql_error();
94+ return;
95+ }
96+
97+ echo '<h3>'.__NPG_ADMIN_PERMITTED_USERS.'</h3>';
98+ echo '<div class="half"><table>';
99+ echo '<thead><tr><th>'.__NPG_FORM_NAME.'</th><th>'.__NPG_FORM_ACTIONS.'</th></thead><tbody>';
100+ while($row=mysql_fetch_object($result)) {
101+ echo "<tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>";
102+ echo '<td>'.$row->membername.'</td>';
103+ echo '<td><a href="'.$galleryaction.'?action=removeselectuser&amp;userid='.$row->memberid.'">'.__NPG_ADMIN_REMOVE_SELECT_USER.'</td></tr>';
104+ }
105+ echo '</tbody></table></div>';
106+
107+ //query for list of users not already assigned in plug_gallery_member and not site admins (they can always add)
108+ $result = mysql_query('select * from '.sql_table('member').' as a left join '.sql_table('plug_gallery_member').' as b on mnumber=memberid where madmin=0 and memberid is NULL');
109+ if(!$result) {
110+ echo mysql_error();
111+ return;
112+ }
113+ if(mysql_num_rows($result)) {
114+ ?>
115+ <form method="post" action="<?php echo $galleryaction; ?>"><div>
116+ <input type="hidden" name="action" value="addselectuser" />
117+
118+ <h3><?php echo(__NPG_ADMIN_GIVE_ADD_PERM); ?></h3>
119+ <?php echo(__NPG_GEN_USER); ?>: <select name="userid">
120+ <?php
121+ while($row=mysql_fetch_object($result)) {
122+ echo '<option value="'.$row->mnumber.'">'.$row->mname;
123+ }
124+ ?>
125+ </select>
126+ <input type="submit" value="<?php echo (__NPG_ADMIN_ADD_TO_LIST); ?>" />
127+ </div></form>
128+ <?php
129+ }
130+
131+ }
132+
133+ function display_options() {
134+ global $NPG_CONF,$galleryaction;
135+
136+ $galleryconfig = checkgalleryconfig();
137+
138+ if(!$galleryconfig['configured']) {
139+ setNPGoption('configured', false);
140+ echo '<div class="error">'.$galleryconfig['message'].'</div>';
141+ }
142+ else setNPGoption('configured', true);
143+
144+ $NPG_CONF = getNPGConfig();
145+
146+ if(!$NPG_CONF['configured']) echo '<div class="error">'.__NPG_ERR_GALLLERY_NOT_CONFIG . '</div><br/><br/>';
147+
148+ echo '<form method="post" action="'.$galleryaction.'?action=editoptions" ><div>';
149+ echo '<fieldset>';
150+ echo '<legend>'.__NPG_ADMIN_GEN_OPTIONS.'</legend>';
151+ echo '<p>';
152+ echo '<label for="addlevel">'.__NPG_ADMIN_ADD_LEVEL.':</label>';
153+ echo '<select name="addalbumlevel" id="addlevel">';
154+ echo '<option value="admin" ';
155+ if($NPG_CONF['add_album'] == 'admin' ) echo 'selected';
156+ echo '>'.__NPG_ADMIN_ONLY_ADMIN;
157+ echo '<option value="member" ';
158+ if($NPG_CONF['add_album'] == 'member' ) echo 'selected';
159+ echo '>'.__NPG_ADMIN_ONLY_REGUSERS;
160+ echo '<option value="guest" ';
161+ if($NPG_CONF['add_album'] == 'guest' ) echo 'selected';
162+ echo '>'.__NPG_ADMIN_ANYONE;
163+ echo '<option value="select" ';
164+ if($NPG_CONF['add_album'] == 'select' ) echo 'selected';
165+ echo '>'.__NPG_ADMIN_SELECTEDUSERS;
166+ echo '</select></p>';
167+
168+ if($NPG_CONF['add_album'] == 'select' ) {
169+ echo __NPG_ADMIN_PERMITTED_USERS.': ';
170+ $result = mysql_query('select a.mname from '.sql_table('member').' as a, '.sql_table('plug_gallery_member').' as b where b.memberid=a.mnumber and b.addalbum=1');
171+ if(!$result) echo 'sql error'.mysql_error().'<br/>';
172+ $num_rows = mysql_num_rows($result);
173+ if(!$num_rows) echo __NPG_ADMIN_NOSELECT;
174+ $i=0;
175+ while ($row = mysql_fetch_object($result)) {
176+ if($i) echo ', ';
177+ echo $row->mname;
178+ $i++;
179+ }
180+ echo '<br/><br/>';
181+ }
182+
183+ echo '<p><label for="promo">'.__NPG_ADMIN_PROMOBLOG.': </label>';
184+ echo '<select name="promocatid" id="promo">';
185+ echo '<option value="0"';
186+ if ($NPG_CONF['blog_cat'] == 0) echo ' selected ';
187+ echo '>'.__NPG_ADMIN_NOPROMO;
188+ $query = 'select bshortname, cname, catid from ' . sql_table('blog').', '.sql_table('category').' where cblog=bnumber';
189+ $result = mysql_query($query);
190+ if(!$result) echo 'sql error! '.mysql_error().'<br/>';
191+ while($row = mysql_fetch_object($result)) {
192+ echo '<option value="'.$row->catid.'"';
193+ if ($NPG_CONF['blog_cat'] == $row->catid) echo ' selected';
194+ echo '>'.$row->cname.' in '.$row->bshortname;
195+ }
196+ echo '</select></p>';
197+
198+ echo '<p><label for="templatef">'.__NPG_ADMIN_ACTIVETEMPLATE.': </label>';
199+ echo '<select name="template" id="templatef">';
200+ $query = 'select * from '.sql_table('plug_gallery_template_desc');
201+ $result = sql_query($query);
202+ while($row=mysql_fetch_object($result)) {
203+ echo '<option value="'.$row->tdid.'"';
204+ if ($NPG_CONF['template'] == $row->tdid) echo ' selected';
205+ echo '>'.$row->tdname;
206+ }
207+ echo '</select></p>';
208+
209+ echo '<p><label for="views">'.__NPG_ADMIN_VIEWTIME.': </label>';
210+ echo '<input type="text" name="viewtime" id="views" value="'.$NPG_CONF['viewtime'].'" size="3" /></p>';
211+
212+ echo '<p><label for="batch">number of batch upload slots/pictures to loop in massupload: </label>';
213+ echo '<input type="text" name="batchnumber" id="batch" value="'.$NPG_CONF['batch_add_num'].'" size="3" /></p>';
214+
215+ echo '<p><label for="dir">'.__NPG_ADMIN_IMAGE_DIR.': </label>';
216+ echo '<input type="text" name="galleryDir" id="dir" value="'.$NPG_CONF['galleryDir'].'" size="20" /></p>';
217+
218+ echo '<p><label for="maxi">'.__NPG_ADMIN_MAX_INT_DIM.': </label>';
219+ echo '<input type="text" id="maxi" name="maxheight" value="'.$NPG_CONF['maxheight'].'" size="3" /> x <input type="text" name="maxwidth" value="'.$NPG_CONF['maxwidth'].'" size="3" /></p>';
220+
221+ echo '<p><label for="maxt">'.__NPG_ADMIN_THUMB_DIM.': </label>';
222+ echo '<input type="text" id="maxt" name="thumbheight" value="'.$NPG_CONF['thumbheight'].'" size="3" /> x <input type="text" name="thumbwidth" value="'.$NPG_CONF['thumbwidth'].'" size="3" /></p>';
223+
224+ //AdminCommentsPerPage, ThumbnailsPerPage
225+ echo '<p><label for="acperpage">'.__NPG_ADMIN_COMMENTSPERPAGE.': </label>';
226+ echo '<input type="text" id="acperpage" name="AdminCommentsPerPage" value="'.$NPG_CONF['AdminCommentsPerPage'].'" size="3" /></p>';
227+
228+ echo '<p><label for="tbperpage">'.__NPG_ADMIN_THUMBSPERPAGE.': </label>';
229+ echo '<input type="text" id="tbperpage" name="ThumbnailsPerPage" value="'.$NPG_CONF['ThumbnailsPerPage'].'" size="3" /></p>';
230+ echo '<p>';
231+ echo '<label for="dateorrandom">random file prefix or current date as file prefix?:</label>';
232+ echo '<select name="dateorrandom" id="dateorrandom">';
233+ echo '<option value="randomprefix" ';
234+ if($NPG_CONF['dateorrandom'] == 'randomprefix' ) echo 'selected';
235+ echo '>random prefix';
236+ echo '<option value="dateprefix" ';
237+ if($NPG_CONF['dateorrandom'] == 'dateprefix' ) echo 'selected';
238+ echo '>date prefix';
239+ echo '</select></p>';
240+
241+ echo '<p>';
242+ echo '<label for="tooltips">use tooltip captions:</label>';
243+ echo '<select name="tooltips" id="tooltips">';
244+ echo '<option value="yes" ';
245+ if($NPG_CONF['tooltips'] == 'yes' ) echo 'selected';
246+ echo '>yes';
247+ echo '<option value="no" ';
248+ if($NPG_CONF['tooltips'] == 'no' ) echo 'selected';
249+ echo '>no';
250+ echo '</select></p>';
251+
252+ echo '<p>';
253+ echo '<label for="nextprevthumb">use next and previoud album thumbnails:</label>';
254+ echo '<select name="nextprevthumb" id="nextprevthumb">';
255+ echo '<option value="yes" ';
256+ if($NPG_CONF['nextprevthumb'] == 'yes' ) echo 'selected';
257+ echo '>yes';
258+ echo '<option value="no" ';
259+ if($NPG_CONF['nextprevthumb'] == 'no' ) echo 'selected';
260+ echo '>no';
261+ echo '</select></p>';
262+
263+ echo '<p>';
264+ echo '<label for="defaultorder">default order for albums:</label>';
265+ echo '<select name="defaultorder" id="defaultorder">';
266+ $sortoptions = array('title','desc','owner','date','titlea','desca','ownera','datea','filename','filenamea');
267+ foreach ($sortoptions as $value){
268+ echo '<option value="'.$value.'" ';
269+ if($NPG_CONF['defaultorder'] == $value ) echo 'selected';
270+ echo '>'.$value;
271+ }
272+ echo '</select></p>';
273+ //these needed to be added to the list (it would be nice)
274+ //'title','desc','owner','date','titlea','desca','ownera','datea'
275+
276+
277+ echo '<p>';
278+ echo '<label for="setorpromo">use keyword sets or static promoposts:</label>';
279+ echo '<select name="setorpromo" id="setorpromo">';
280+ echo '<option value="promo" ';
281+ if($NPG_CONF['setorpromo'] == 'promo' ) echo 'selected';
282+ echo '>promo';
283+ echo '<option value="sets" ';
284+ if($NPG_CONF['setorpromo'] == 'sets' ) echo 'selected';
285+ echo '>sets';
286+ echo '</select></p>';
287+
288+ echo '<p>';
289+ echo '<label for="slideshowson">enable slideshows:</label>';
290+ echo '<select name="slideshowson" id="slideshowson">';
291+ echo '<option value="yes" ';
292+ if($NPG_CONF['slideshowson'] == 'yes' ) echo 'selected';
293+ echo '>yes';
294+ echo '<option value="no" ';
295+ if($NPG_CONF['slideshowson'] == 'no' ) echo 'selected';
296+ echo '>no';
297+ echo '</select></p>';
298+ echo '<p>';
299+ echo '<label for="thumborlist">Gallery as list or thumbnails:</label>';
300+ echo '<select name="thumborlist" id="thumborlist">';
301+ echo '<option value="list" ';
302+ if($NPG_CONF['thumborlist'] == 'list' ) echo 'selected';
303+ echo '>list';
304+ echo '<option value="thumb" ';
305+ if($NPG_CONF['thumborlist'] == 'thumb' ) echo 'selected';
306+ echo '>thumb';
307+ echo '</select></p>';
308+
309+
310+ echo '</fieldset>';
311+
312+ echo '<fieldset>';
313+ echo '<legend>'.__NPG_ADMIN_GRAPHICS_OPTIONS.'</legend>';
314+ echo '<p><label for="engine">'.__NPG_ADMIN_GRAPHICS_ENGINE.':</label>';
315+ echo '<select id="engine" name="graphicslibrary">';
316+ if(GDispresent()) {
317+ echo '<option value="gd" ';
318+ if($NPG_CONF['graphics_library']=='gd') echo 'selected';
319+ echo '>GD v2 or greater';
320+ }
321+ if ($NPG_CONF['im_version'] = getIMversion()) {
322+ echo '<option value="im" ';
323+ if($NPG_CONF['graphics_library']=='im') echo 'selected ';
324+ echo '>ImageMagick';
325+ }
326+ echo '</select></p>';
327+
328+ //test for GD
329+ if(GDispresent()) echo __NPG_ADMIN_GD_INSTALLED.'<br />';
330+ else echo __NPG_ADMIN_GD_NOT_INSTALLED.'<br />';
331+ if($NPG_CONF['im_version'] = getIMversion()) echo __NPG_ADMIN_IM_INSTALLED.'<br/>';
332+ else echo __NPG_ADMIN_IM_NOT_INSTALLED.'<br/>';
333+ echo '<br/>';
334+
335+ echo '<p><label for="path">'.__NPG_ADMIN_IM_PATH.':</label>';
336+ echo '<input type="text" id="path" name="impath" value="'.$NPG_CONF['im_path'].'" size="20" /></p>';
337+
338+ echo '<p><label for="options">'.__NPG_ADMIN_IM_OPTIONS.':</label>';
339+ echo '<input type="text" id="options" name="imoptions" value="'.$NPG_CONF['im_options'].'" size="20" /></p>';
340+
341+ echo '<p><label for="quality">'.__NPG_ADMIN_IM_QUALITY.':</label>';
342+ echo '<input type="text" id="quality" name="imquality" value="'.$NPG_CONF['im_quality'].'" size="2" /></p>';
343+
344+ echo '</fieldset>';
345+ echo '<br /><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" />';
346+ echo '</div></form>';
347+
348+ }
349+
350+ function display_albums() {
351+ global $NPG_CONF, $galleryaction, $gmember;
352+
353+ $albums = $gmember->getallowedalbums();
354+ $memberid = $gmember->getID();
355+
356+ if(!$albums && !$gmember->isAdmin() ) {
357+ echo __NPG_ERR_NO_ALBUMS.'<br/>';
358+ return;
359+ }
360+
361+ echo '<table>';
362+ echo '<thead><tr><th>'.__NPG_FORM_ALBUM_TITLE.'</th><th>'.__NPG_FORM_ALBUM_DESC.'</th><th>'.Images.'</th><th>'.Owner.'</th><th colspan="2" >'.__NPG_FORM_ACTIONS.'</th></tr></thead>';
363+ $j=0;
364+ while($albums[$j]) {
365+ echo '<tr onmouseover=\'focusRow(this);\' onmouseout=\'blurRow(this);\'>';
366+ echo '<td>'.$albums[$j]->title.'</td>';
367+ echo '<td>'.$albums[$j]->description.'</td>';
368+ echo '<td>'.$albums[$j]->numberofimages.'</td>';
369+ echo '<td>'.$albums[$j]->mname.'</td>';
370+ if($gmember->canmodifyalbum($albums[$j]->albumid) ) {
371+ echo '<td><a href="'.$galleryaction.'?action=album&amp;id='.$albums[$j]->albumid.'">'.__NPG_FORM_SETTINGS.'</a></td>';
372+ echo '<td><a href="'.$galleryaction.'?action=deletealbum&amp;id='.$albums[$j]->albumid.'">'.__NPG_FORM_DELETE.'</a></td>';
373+ }
374+ else echo '<td>'.__NPG_FORM_SETTINGS.'</td><td>'.__NPG_FORM_DELETE.'</td>';
375+ echo '</tr>';
376+ $j++;
377+ }
378+ echo '</table>';
379+ }
380+
381+ function display_comments() {
382+ global $gmember,$galleryaction,$NPG_CONF,$CONF,$NP_BASE_DIR;
383+
384+ $amount = requestvar('amount');
385+ $page = requestvar('page');
386+ if($amount) $NPG_CONF['AdminCommentsPerPage'] = intval($amount);
387+
388+ if (!$NPG_CONF['AdminCommentsPerPage']) {
389+ setNPGOption('AdminCommentsPerPage',25);
390+ $NPG_CONF['AdminCommentsPerPage'] = 25;
391+ }
392+ $offset = intval($page - 1) * $NPG_CONF['AdminCommentsPerPage'];
393+ if ($offset <= 0) $offset = '0';
394+
395+ if(!$page) $page='1';
396+
397+ $query = 'select * from '.sql_table('plug_gallery_comment').' as a left join '.sql_table('member').' as b on a.cmemberid=b.mnumber left join '.sql_table('plug_gallery_picture').' as c on a.cpictureid=c.pictureid limit '.$offset.', '.($NPG_CONF['AdminCommentsPerPage']+1);
398+ $res = sql_query($query);
399+ $nrows = mysql_num_rows($res);
400+
401+ //navigation
402+ echo "\n".'<div><table class="navigation"><tr><td style="width:15%;">';
403+ if(intval($page) > 1) {
404+ echo '<form method="post" action="'.$galleryaction.'"><div>';
405+ echo '<input type="hidden" name="action" value="comments" />';
406+ echo '<input type="hidden" name="page" value="'.(intval($page - 1)).'" />';
407+ echo '<input type="submit" value="&lt; &lt; '._LISTS_PREV.'" />';
408+ if($amount) echo '<input type="hidden" name="amount" value="'.$amount.'" />';
409+ echo '</div></form></td>';
410+ }
411+ else echo '&lt; &lt; '._LISTS_PREV.'</td>';
412+
413+ echo '<td style="text-align:center;">'.__NPG_PAGE.': '.$page.'</td>';
414+
415+ echo '<td style="text-align:right; width:15%;">';
416+ if($nrows > $NPG_CONF['AdminCommentsPerPage']) {
417+ echo '<form method="post" action="'.$galleryaction.'"><div>';
418+ echo '<input type="hidden" name="action" value="comments" />';
419+ echo '<input type="hidden" name="page" value="'.(intval($page + 1)).'" />';
420+ echo '<input type="submit" value="'._LISTS_NEXT.' &gt; &gt;" />';
421+ if($amount) echo '<input type="hidden" name="amount" value="'.$amount.'" />';
422+ echo '</div></form>';
423+ }
424+ else echo _LISTS_NEXT.' &gt; &gt;';
425+ echo '</td></tr></table></div>'."\n";
426+
427+
428+ //echo '<h3>'.__NPG_ADMIN_COMMENTS.'</h3>';
429+ echo '<table><thead><tr><th>'.__NPG_COMMENT.'</th><th>'.__NPG_AUTHOR.'</th><th>'.__NPG_TIME.'</th><th>'.__NPG_PICTUREID.'</th><th colspan=\'2\'>'.__NPG_FORM_ACTIONS.'</th></tr></thead><tbody>';
430+
431+ $format = 'M j, h:i';
432+
433+ $i=0;
434+ while ($row = mysql_fetch_object($res) and $i < $NPG_CONF['AdminCommentsPerPage']) {
435+ echo '<tr onmouseover=\'focusRow(this);\' onmouseout=\'blurRow(this);\'>';
436+ echo '<td>'.$row->cbody.'</td>';
437+ echo '<td>';
438+ if($row->cuser) echo $row->cuser; else echo $row->mname;
439+ echo '</td>';
440+
441+ $d = converttimestamp($row->ctime);
442+ $d = date($format,$d);
443+ echo '<td>'.$d.'</td>';
444+
445+ if($row->int_filename) {
446+ $picturelink = $CONF['IndexURL'].$row->int_filename;
447+ $image_size = getimagesize($NP_BASE_DIR.$row->int_filename);
448+ $pictureheight = $image_size[1]+15;
449+ $picturewidth = $image_size[0]+15;
450+ echo '<td><a href="'.$picturelink.'" onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=auto,resizable=yes,width='.$picturewidth.',height='.$pictureheight.'\');return false;">'.$row->title.'</td>';
451+ } else {
452+ echo '<td>Picture deleted</td>';
453+ }
454+
455+ echo '<td><a href="'.$galleryaction.'?action=editcommentF&amp;id='.$row->commentid.'">'.__NPG_FORM_EDIT.'</a></td>';
456+ echo '<td><a href="'.$galleryaction.'?action=deletecomment&amp;id='.$row->commentid.'">'.__NPG_FORM_DELETE.'</td></tr>';
457+ echo "\n";
458+ $i++;
459+ }
460+ echo '</tbody></table>';
461+
462+ }
463+
464+ function display_templates() {
465+ global $NPG_CONF, $galleryaction;
466+
467+ echo '<h3>'.__NPG_ADMIN_TEMPLATES.'</h3>';
468+ echo '<table><thead><tr><th>'.__NPG_FORM_NAME.'</th><th>'.__NPG_FORM_DESC.'</th><th colspan=\'3\' >'.__NPG_FORM_ACTIONS.'</th></tr></thead><tbody>';
469+ $query = 'select * from '.sql_table('plug_gallery_template_desc');
470+ $result = sql_query($query);
471+ while ($row = mysql_fetch_object($result)) {
472+ echo '<tr onmouseover=\'focusRow(this);\' onmouseout=\'blurRow(this);\'>';
473+ echo '<td>'.$row->tdname.'</td>';
474+ echo '<td>'.$row->tddesc.'</td>';
475+ echo '<td><a href="'.$galleryaction.'?action=edittemplateF&amp;id='.$row->tdid.'">'.__NPG_FORM_EDIT.'</a></td>';
476+ echo '<td><a href="'.$galleryaction.'?action=clonetemplate&amp;id='.$row->tdid.'">'.__NPG_FORM_CLONE.'</td>';
477+ echo '<td><a href="'.$galleryaction.'?action=deletetemplate&amp;id='.$row->tdid.'">'.__NPG_FORM_DELETE.'</td></tr>';
478+ }
479+
480+ echo '</tbody></table>';
481+
482+ $this->display_newtemplate();
483+
484+ }
485+
486+ function display_newtemplate() {
487+ global $galleryaction;
488+
489+ echo '<h3>'.__NPG_FORM_NEWTEMPLATE.'</h3>';
490+ echo '<form method="post" action="'.$galleryaction.'?action=addtemplate"><table>';
491+ echo '<tr><td>'.__NPG_FORM_TEMPLATE_NAME.'</td><td><input name="tname" maxlength="20" size="20" /></td></tr>';
492+ echo '<tr><td>'.__NPG_FORM_TEMPLATE_DESC.'</td><td><input name="tdesc" maxlength="200" size="50" /></td></tr>';
493+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_CREATENEWTEMPLATE.'" /></table></form>';
494+ }
495+
496+ function display_adminfunctions() {
497+ global $galleryaction;
498+
499+ echo '<h3>'.__NPG_ADMIN_ADMIN_FUNCTIONS.'</h3>';
500+
501+ echo '<table>';
502+ echo '<tr><td><input type="button" value="'.__NPG_ADMIN_CLEANUP.'" ';
503+ echo 'onclick="window.location.href=\''.$galleryaction.'?action=admin&amp;function=cleanup\'"/>';
504+ echo '</td><td>'.__NPG_ADMIN_CLEANUP_DESC.'</td></tr>';
505+
506+ echo '<tr><td>';
507+ echo '<form method="post" action="'.$galleryaction.'">';
508+ echo '<input type="hidden" name="action" value="admin" />';
509+ echo '<input type="hidden" name="function" value="rethumb" />';
510+ echo '<input type="submit" value="'.__NPG_ADMIN_RETHUMB.'" />';
511+
512+ $query = 'select * from '.sql_table('plug_gallery_album');
513+ $res = sql_query($query);
514+ echo '<select name="albumtorethumb">';
515+ echo '<option value="0">'.__NPG_ADMIN_ALLALBUMS;
516+ while ($row=mysql_fetch_object($res)) {
517+ echo '<option value="'.$row->albumid.'">'.$row->title;
518+ }
519+ echo '</select></form>';
520+ echo '</td><td>'.__NPG_ADMIN_RETHUMB_DESC.'</td></tr>';
521+
522+ echo '<tr><td>';
523+ echo '<form method="post" action="'.$galleryaction.'">';
524+ echo '<input type="hidden" name="action" value="admin" />';
525+ echo '<input type="hidden" name="function" value="massupload" />';
526+ echo '<input type="submit" value="'.__NPG_ADMIN_MASSUPLOAD.'" />';
527+ mysql_data_seek($res,0);
528+ echo '<select name="uploadalbum">';
529+ echo '<option value="-1">'.__NPG_ADMIN_NEWALBUM;
530+ while ($row=mysql_fetch_object($res)) {
531+ echo '<option value="'.$row->albumid.'">'.$row->title;
532+ }
533+ echo '</select></form>';
534+ echo '</td><td>'.__NPG_ADMIN_MASSUPLOAD_DESC.'</td></tr>';
535+
536+ echo '</table>';
537+
538+ }
539+
540+
541+ function action_edittemplateF() {
542+ global $gmember,$galleryaction;
543+
544+ $id = $_GET['id'];
545+ if($gmember->isAdmin() && $id) {
546+ $query = 'select * from '.sql_table('plug_gallery_template')." where tdesc = $id";
547+ $result = sql_query($query);
548+ if(mysql_num_rows($result)) {
549+ while ($row = mysql_fetch_object($result)) {
550+ $section[$row->name] = stripslashes($row->content);
551+ }
552+ }
553+
554+ $query2 = 'select * from '.sql_table('plug_gallery_template_desc')." where tdid = $id";
555+ $result2 = sql_query($query2);
556+ if(!mysql_num_rows($result2)) {
557+ echo __NPG_ERR_BAD_TEMPLATE.'<br/>';
558+ return false;
559+ }
560+ $row = mysql_fetch_object($result2);
561+ $section['name'] = stripslashes($row->tdname);
562+ $section['desc'] = stripslashes($row->tddesc);
563+
564+ echo '<h3>'.__NPG_FORM_EDIT_TEMPLATE.': '.$section['name'].'</h3>';
565+ echo '<br/><a href="'.$galleryaction.'">'.__NPG_ADMIN_RETURN.'</a>';
566+ echo '<form method="post" action="'.$galleryaction.'?action=edittemplate"><div>';
567+ echo '<input type="hidden" name="id" value="'.$id.'" />';
568+ echo '<table><thead><tr><th colspan="2" >'.__NPG_FORM_TEMPLATE_SETTINGS.'</th></tr></thead>';
569+ echo '<tbody>';
570+ echo '<tr><td class="left">'.__NPG_FORM_TEMPLATE_NAME.'</td>';
571+ echo '<td><input name="tname" size="20" maxlength="20" value="';
572+ echo htmlspecialchars($section['name']);
573+ echo '" /></td></tr>';
574+ echo '<tr><td class="left">'.__NPG_FORM_TEMPLATE_DESC.'</td>';
575+ echo '<td><input name="tdesc" size="50" maxlength="200" value="';
576+ echo htmlspecialchars($section['desc']);
577+ echo '" /></td></tr>';
578+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" /></td></tr>';
579+ echo '</tbody></table>';
580+
581+ echo '<table><thead><tr><th colspan="2" >'.__NPG_FORM_TEMPLATE_LIST.'</th></tr></thead>';
582+ echo '<tbody>';
583+ $tags = allowedTemplateTags('LIST_HEADER');
584+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_HEADER.'<br/></td>';
585+ echo '<td><textarea class="templateedit" name="LIST_HEADER" cols="50" rows="5">';
586+ echo htmlspecialchars($section['LIST_HEADER']);
587+ echo '</textarea></td></tr><tr><td colspan="2">'.$tags.'</td></tr>';
588+ $tags = allowedTemplateTags('LIST_BODY');
589+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_BODY.'<br/></td>';
590+ echo '<td><textarea class="templateedit" name="LIST_BODY" cols="50" rows="8">';
591+ echo htmlspecialchars($section['LIST_BODY']);
592+ echo '</textarea></td></tr><tr><td colspan="2">'.$tags.'</td></tr>';
593+ $tags = allowedTemplateTags('LIST_THUM');
594+ echo '<tr><td class="left" >LIST_THUM<br/></td>';
595+ echo '<td><textarea class="templateedit" name="LIST_THUM" cols="50" rows="8">';
596+ echo htmlspecialchars($section['LIST_THUM']);
597+ echo '</textarea></td></tr><tr><td colspan="2">'.$tags.'</td></tr>';
598+ $tags = allowedTemplateTags('LIST_FOOTER');
599+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_FOOTER.'<br/></td>';
600+ echo '<td><textarea class="templateedit" name="LIST_FOOTER" cols="50" rows="5">';
601+ echo htmlspecialchars($section['LIST_FOOTER']);
602+ echo '</textarea></td></tr><tr><td colspan="2">'.$tags.'</td></tr>';
603+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" /></td></tr>';
604+ echo '</tbody></table>';
605+
606+ echo '<table><thead><tr><th colspan="2" >'.__NPG_FORM_TEMPLATE_ALBUM.'</th></tr></thead>';
607+ echo '<tbody>';
608+ $tags = allowedTemplateTags('ALBUM_HEADER');
609+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_HEADER.'<br/></td>';
610+ echo '<td><textarea class="templateedit" name="ALBUM_HEADER" cols="50" rows="5">';
611+ echo htmlspecialchars($section['ALBUM_HEADER']);
612+ echo '</textarea><br/>'.$tags.'</td></tr>';
613+ $tags = allowedTemplateTags('ALBUM_BODY');
614+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_BODY.'<br/></td>';
615+ echo '<td><textarea class="templateedit" name="ALBUM_BODY" cols="50" rows="8">';
616+ echo htmlspecialchars($section['ALBUM_BODY']);
617+ echo '</textarea><br/>'.$tags.'</td></tr>';
618+ $tags = allowedTemplateTags('ALBUM_FOOTER');
619+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_FOOTER.'<br/></td>';
620+ echo '<td><textarea class="templateedit" name="ALBUM_FOOTER" cols="50" rows="5">';
621+ echo htmlspecialchars($section['ALBUM_FOOTER']);
622+ echo '</textarea><br/>'.$tags.'</td></tr>';
623+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" /></td></tr>';
624+ echo '</tbody></table>';
625+
626+ echo '<table><thead><tr><th colspan="2" >'.__NPG_FORM_TEMPLATE_PICTURE.'</th></tr></thead>';
627+ echo '<tbody>';
628+ $tags = allowedTemplateTags('ITEM_HEADER');
629+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_HEADER.'<br/></td>';
630+ echo '<td><textarea class="templateedit" name="ITEM_HEADER" cols="50" rows="5">';
631+ echo htmlspecialchars($section['ITEM_HEADER']);
632+ echo '</textarea><br/>'.$tags.'</td></tr>';
633+ echo '<tr><td class="left" >ITEM_TOOLTIPSHEADER<br/></td>';
634+ echo '<td><textarea class="templateedit" name="ITEM_TOOLTIPSHEADER" cols="50" rows="5">';
635+ echo htmlspecialchars($section['ITEM_TOOLTIPSHEADER']);
636+ echo '</textarea><br/>'.$tags.'</td></tr>';
637+ $tags = allowedTemplateTags('ITEM_BODY');
638+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_BODY.'<br/></td>';
639+ echo '<td><textarea class="templateedit" name="ITEM_BODY" cols="50" rows="8">';
640+ echo htmlspecialchars($section['ITEM_BODY']);
641+ echo '</textarea><br/>'.$tags.'</td></tr>';
642+
643+ echo '<tr><td class="left" >ITEM_TOOLTIPSFOOTER<br/></td>';
644+ echo '<td><textarea class="templateedit" name="ITEM_TOOLTIPSFOOTER" cols="50" rows="8">';
645+ echo htmlspecialchars($section['ITEM_TOOLTIPSFOOTER']);
646+ echo '</textarea><br/>'.$tags.'</td></tr>';
647+
648+ echo '<tr><td class="left" >ITEM_SLIDESHOWC<br/></td>';
649+ echo '<td><textarea class="templateedit" name="ITEM_SLIDESHOWC" cols="50" rows="8">';
650+ echo htmlspecialchars($section['ITEM_SLIDESHOWC']);
651+ echo '</textarea><br/>'.$tags.'</td></tr>';
652+
653+
654+ echo '<tr><td class="left" >ITEM_SLIDESHOWT<br/></td>';
655+ echo '<td><textarea class="templateedit" name="ITEM_SLIDESHOWT" cols="50" rows="8">';
656+ echo htmlspecialchars($section['ITEM_SLIDESHOWT']);
657+ echo '</textarea><br/>'.$tags.'</td></tr>';
658+
659+ echo '<tr><td class="left" >ITEM_NEXTPREVTHUMBS<br/></td>';
660+ echo '<td><textarea class="templateedit" name="ITEM_NEXTPREVTHUMBS" cols="50" rows="8">';
661+ echo htmlspecialchars($section['ITEM_NEXTPREVTHUMBS']);
662+ echo '</textarea><br/>'.$tags.'</td></tr>';
663+
664+ $tags = allowedTemplateTags('ITEM_FOOTER');
665+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_FOOTER.'<br/></td>';
666+ echo '<td><textarea class="templateedit" name="ITEM_FOOTER" cols="50" rows="5">';
667+ echo htmlspecialchars($section['ITEM_FOOTER']);
668+ echo '</textarea><br/>'.$tags.'</td></tr>';
669+
670+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" /></td></tr>';
671+ echo '</tbody></table>';
672+
673+ echo '<table><thead><tr><th colspan="2" >'.__NPG_FORM_TEMPLATE_COMMENTS.'</th></tr></thead>';
674+ echo '<tbody>';
675+ $tags = allowedTemplateTags('COMMENT_HEADER');
676+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_HEADER.'<br/></td>';
677+ echo '<td><textarea class="templateedit" name="COMMENT_HEADER" cols="50" rows="5">';
678+ echo htmlspecialchars($section['COMMENT_HEADER']);
679+ echo '</textarea><br/>'.$tags.'</td></tr>';
680+ $tags = allowedTemplateTags('COMMENT_BODY');
681+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_BODY.'<br/></td>';
682+ echo '<td><textarea class="templateedit" name="COMMENT_BODY" cols="50" rows="8">';
683+ echo htmlspecialchars($section['COMMENT_BODY']);
684+ echo '</textarea><br/>'.$tags.'</td></tr>';
685+ $tags = allowedTemplateTags('COMMENT_FOOTER');
686+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_FOOTER.'<br/></td>';
687+ echo '<td><textarea class="templateedit" name="COMMENT_FOOTER" cols="50" rows="5">';
688+ echo htmlspecialchars($section['COMMENT_FOOTER']);
689+ echo '</textarea><br/>'.$tags.'</td></tr>';
690+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" /></td></tr>';
691+ echo '</tbody></table>';
692+
693+ echo '<table><thead><tr><th colspan="2" >'.__NPG_FORM_TEMPLATE_PROMO.'</th></tr></thead>';
694+ echo '<tbody>';
695+ $tags = allowedTemplateTags('PROMO_TITLE');
696+ echo '<tr><td class="left" >'.__NPG_PROMO_FORM_TITLE.'<br/></td>';
697+ echo '<td><input type="text" name="PROMO_TITLE" cols="50" value="';
698+ echo htmlspecialchars($section['PROMO_TITLE']);
699+ echo '"/>';
700+ echo '<br/>'.$tags.'</td></tr>';
701+ $tags = allowedTemplateTags('PROMO_BODY');
702+ echo '<tr><td class="left" >'.__NPG_PROMO_FORM_BODY.'<br/></td>';
703+ echo '<td><textarea class="templateedit" name="PROMO_BODY" cols="50" rows="8">';
704+ echo htmlspecialchars($section['PROMO_BODY']);
705+ echo '</textarea><br/>'.$tags.'</td></tr>';
706+ $tags = allowedTemplateTags('PROMO_IMAGES');
707+ echo '<tr><td class="left" >'.__NPG_FORM_TEMPLATE_PROMOIMAGES.'<br/></td>';
708+ echo '<td><textarea class="templateedit" name="PROMO_IMAGES" cols="50" rows="4">';
709+ echo htmlspecialchars($section['PROMO_IMAGES']);
710+ echo '</textarea><br/>'.$tags.'</td></tr>';
711+ echo '<tr><td></td><td><input type="submit" value="'.__NPG_FORM_SUBMIT_CHANGES.'" /></td></tr>';
712+ echo '</tbody></table>';
713+ echo '</div></form>';
714+ }
715+ }
716+
717+ function action_addtemplate() {
718+ global $gmember;
719+
720+ $name = addslashes(postvar('tname'));
721+ $desc = addslashes(postvar('tdesc'));
722+ if($gmember->isAdmin() && $name && $desc) {
723+ $query = 'insert into '.sql_table('plug_gallery_template_desc')." (tdid, tdname, tddesc) values (NULL,'$name','$desc')";
724+ sql_query($query);
725+ }
726+
727+ $this->action_templates();
728+ }
729+
730+ function action_clonetemplate() {
731+ global $gmember;
732+
733+ //get postvars: templateid from template to clone
734+ $id = requestvar('id');
735+ if($id && $gmember->isAdmin()) {
736+ //get template data from plg_gallery_template_desc and plug_gallery_template
737+ $origtemplate = new NPG_TEMPLATE($id);
738+
739+ //write data to database tables, generating a new tdid for the same data
740+ $newtemplate = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('cln_'.$origtemplate->getname(), 'Clone of '.$origtemplate->getdesc()));
741+ foreach($origtemplate->section as $name => $content)
742+ $newtemplate->settemplate($name,$content);
743+ }
744+
745+ $this->action_templates();
746+ }
747+
748+ function action_deletetemplate() {
749+ global $gmember;
750+ $id = requestvar('id');
751+
752+ //don't delete if it's the only template in the database -- you need at least one
753+ $query = 'select count(*) from '.sql_table('plug_gallery_template_desc');
754+ $res = sql_query($query);
755+ $nr = mysql_fetch_row($res);
756+ if ($nr[0] > 1 && $id && NPG_TEMPLATE::existsID($id) && $gmember->isAdmin()) {
757+ $query = 'delete from '.sql_table('plug_gallery_template_desc').' where tdid='.$id;
758+ sql_query($query);
759+ $query = 'delete from '.sql_table('plug_gallery_template').' where tdesc='.$id;
760+ sql_query($query);
761+ }
762+
763+ $this->action_templates();
764+
765+ }
766+
767+
768+
769+ function action_edittemplate() {
770+ global $gmember;
771+
772+ $id = $_POST['id'];
773+ if($gmember->isAdmin() && $id) {
774+ $t = new NPG_TEMPLATE($id);
775+
776+ if(isset($_POST['tname']) && isset($_POST['tdesc'])) {
777+ $t->updategeneralinfo($_POST['tname'],$_POST['tdesc']);
778+ }
779+
780+ $vars = array('LIST_HEADER','LIST_BODY','LIST_THUM','LIST_FOOTER','ALBUM_HEADER','ALBUM_BODY','ALBUM_SETDISPLAY','ALBUM_FOOTER','ITEM_HEADER','ITEM_TOOLTIPSHEADER','ITEM_BODY','ITEM_SLIDESHOWT','ITEM_SLIDESHOWC','ITEM_FOOTER','ITEM_TOOLTIPSFOOTER','ITEM_NEXTPREVTHUMBS','COMMENT_HEADER','COMMENT_BODY','COMMENT_FOOTER','PROMO_TITLE','PROMO_BODY','PROMO_IMAGES');
781+ foreach($vars as $j) {
782+ if(isset($_POST[$j])) {
783+ $t->update($j,$_POST[$j]);
784+ }
785+ }
786+
787+ //if($success) echo __NPG_ADMIN_UPDATE_TEMPLATE.'<br />'; else echo __NPG_ERR_NO_UPD_TEMPLATE.'<br/>';
788+
789+ //else echo _ERROR_DISALLOWED;
790+ }
791+
792+ $this->action_templates();
793+ }
794+
795+ function action_comments() {
796+ global $gmember;
797+
798+ $this->display_tabs('comments');
799+ $this->display_comments();
800+ }
801+
802+ function action_editcommentF() {
803+ global $galleryaction;
804+
805+ $id = intval(requestvar('id'));
806+ $query = 'select * from '.sql_table('plug_gallery_comment').' as a left join '.sql_table('member').' as b on a.cmemberid=b.mnumber where a.commentid='.$id;
807+ $res = sql_query($query);
808+ $row = mysql_fetch_object($res);
809+
810+ ?>
811+ <h2><?php echo _EDITC_TITLE; ?></h2>
812+
813+ <form action="<?php echo $galleryaction; ?>" method="post"><div>
814+ <input type="hidden" name="action" value="editcomment" />
815+ <input type="hidden" name="id" value="<?php echo $id;?>" />
816+ <?php
817+ echo '<table><tr>';
818+ echo '<th colspan="2">'._EDITC_TITLE.'</th>';
819+ echo '</tr><tr>';
820+ echo '<td>'._EDITC_WHO.'</td><td>';
821+ if($row->cuser) echo $row->cuser; else echo $row->mname.' ('._EDITC_MEMBER.')';
822+ echo '</td></tr><tr>';
823+ echo '<td>'._EDITC_WHEN.'</td><td>';
824+ echo $row->ctime;
825+ echo '</td></tr><tr>';
826+ echo '<td>'._EDITC_HOST.'</td><td>';
827+ echo $row->chost;
828+ echo '</td></tr><tr>';
829+ echo '<td>'._EDITC_TEXT.'</td><td>';
830+ echo '<textarea name="body" rows="10" cols="50">';
831+ echo htmlspecialchars($row->cbody);
832+ echo '</textarea>';
833+ echo '</td></tr><tr>';
834+ echo '<td>'._EDITC_EDIT.'</td><td>';
835+ echo '<input type="submit" value="'._EDITC_EDIT.'" />';
836+ echo '</td></tr></table></div></form>';
837+ }
838+
839+ function action_editcomment() {
840+ global $gmember;
841+
842+ $id = intval(requestvar('id'));
843+ $body = addslashes(requestvar('body'));
844+
845+ if( $gmember->canModifyComment($id) ) {
846+ sql_query('update '.sql_table('plug_gallery_comment').' set cbody = "'.$body.'" where commentid='.$id);
847+ }
848+
849+ $this->action_comments();
850+
851+ }
852+
853+ function action_deletecomment() {
854+ global $gmember,$galleryaction;
855+
856+ $id = intval(requestvar('id'));
857+ $query = 'select * from '.sql_table('plug_gallery_comment').' as a left join '.sql_table('member').' as b on a.cmemberid=b.mnumber where a.commentid='.$id;
858+ $res = sql_query($query);
859+ if(mysql_num_rows($res)) {
860+ $row = mysql_fetch_object($res);
861+ } else {
862+ echo __NPG_ADMIN_NO_COMMENT.'<br/>';
863+ return;
864+ }
865+
866+ if($gmember->canModifyComment($id) ) {
867+ echo '<h2>'._DELETE_CONFIRM.'</h2>';
868+ echo '<p>'._CONFIRMTXT_COMMENT.'</p>';
869+ echo '<div class="note">';
870+ echo '<b>'._EDITC_WHO.': </b>';
871+ if($row->cuser) echo $row->cuser; else echo $row->mname;
872+ echo '<br/><b>'._EDITC_TEXT.': </b>';
873+ echo htmlspecialchars($row->cbody);
874+ echo '</div>';
875+ echo '<form method="post" action="'.$galleryaction.'"><div>';
876+ echo '<input type="hidden" name="action" value="deletecommentfinal" />';
877+ echo '<input type="hidden" name="id" value="'.$id.'" />';
878+ echo '<input type="submit" value="'._DELETE_CONFIRM_BTN.'" />';
879+ echo '</div></form>';
880+ }
881+ else {
882+ echo __NPG_ADMIN_NO_DEL_PERMISSION.'<br/>';
883+ }
884+ }
885+
886+ function action_deletecommentfinal() {
887+ global $gmember,$galleryaction;
888+
889+ $id = intval(requestvar('id'));
890+ if($gmember->canModifyComment($id) ) {
891+ $res = sql_query('delete from '.sql_table('plug_gallery_comment').' where commentid='.$id);
892+ //if(!mysql_num_rows($res)) echo __NPG_ADMIN_NOTDELETED.'<br/>'; else echo __NPG_ADMIN_DELETED.'<br/>';
893+ }
894+
895+ $this->action_comments();
896+ }
897+
898+ function action_templates() {
899+ global $gmember;
900+
901+ $this->display_tabs('templates');
902+ if($gmember->isAdmin()) {
903+ echo '<div id="admin_content">';
904+ $this->display_templates();
905+ echo '</div>';
906+ }
907+ else echo _ERROR_DISALLOWED;
908+ }
909+
910+
911+ function action_admin() {
912+ global $gmember,$DIR_NUCLEUS,$galleryaction,$CONF;
913+
914+ $funct = requestvar('function');
915+
916+ if (isset($funct)) {
917+ if($gmember->isAdmin()) {
918+ switch ($funct) {
919+ case 'cleanup':
920+ database_cleanup();
921+ echo __NPG_ADMIN_SUCCESS_CLEANUP.'<br/>';
922+ break;
923+ case 'rethumb':
924+ $album = intval(requestvar('albumtorethumb'));
925+ rethumb($album);
926+ break;
927+ case 'massupload':
928+ $album = intval(requestvar('uploadalbum'));
929+ $stop = true;
930+ if ($album == -1) {
931+
932+ $title = requestvar('title');
933+ $desc = requestvar('desc');
934+
935+ if(!$title && !$desc) {
936+ ?>
937+ <h3><?php echo __NPG_FORM_ADDALBUM; ?></h3>
938+ <?php echo __NPG_FORM_MASSUPLOAD_NEWALBUM; ?><br/>
939+ <form method="post" action="<?php echo $galleryaction; ?>"><div>
940+ <input type="hidden" name="function" value="massupload" />
941+ <input type="hidden" name="action" value="admin" />
942+ <input type="hidden" name="uploadalbum" value="-1" />
943+
944+ <?php addAlbumFormFields(); ?>
945+ </div></form>
946+
947+ <?php
948+ }
949+ else {
950+ $NPG_vars['ownerid'] = $gmember->getID();
951+ $NPG_vars['title'] = $title;
952+ $NPG_vars['description'] = $desc;
953+ $album = ALBUM::add_new($NPG_vars);
954+ }
955+
956+ }
957+
958+ if($album > 0) {
959+ //are you sure? this may timeout if too big?
960+ echo '<h3>'.__NPG_FORM_MASSUPLOAD_CONFIRM.'</h3>';
961+ ?>
962+ <form name="massuploadokay" method="post" action="<?php echo $CONF['PluginURL'].'gallery/add_picture.php'; ?>" ONSUBMIT="openTarget(this, 'width=600,height=600,resizable=1,scrollbars=1'); return true;" target="newpopup"><div>
963+ <input type="hidden" name="type" value="massupload" />
964+ <input type="hidden" name="id" value="<?php echo $album; ?>" />
965+ <input type="submit" value="<?php echo __NPG_FORM_MASSUPLOAD_SUBMIT; ?>" />
966+ </div></form>
967+ <?php
968+ }
969+ break;
970+
971+ default:
972+ echo __NPG_ERR_BAD_FUNCTION.'<br/>';
973+ break;
974+ }
975+ } else echo __NPG_ERR_NOT_ADMIN.'<br/>';
976+ }
977+ if(!$stop) $this->action_functions();
978+ }
979+
980+ function action_functions() {
981+ global $gmember;
982+
983+ $this->display_tabs('admin');
984+ if($gmember->isAdmin()) {
985+ echo '<div id="admin_content">';
986+ $this->display_adminfunctions();
987+ echo '</div>';
988+ }
989+ else echo _ERROR_DISALLOWED;
990+ }
991+
992+ function action_editoptions() {
993+ //need more error checking here
994+ if (isset($_POST['addalbumlevel'])) {
995+ //$allowedoptions = array("admin","guest","select","member");
996+ //if (in_array($_POST['addalbumlevel'], $allowedoptions))
997+ setNPGoption('add_album', $_POST['addalbumlevel']);
998+ }
999+ if (isset($_POST['promocatid'])) {
1000+ setNPGoption('blog_cat', $_POST['promocatid']);
1001+ }
1002+ /*
1003+ if (isset($_POST['template'])) {
1004+ setNPGoption('template', $_POST['template']);
1005+ }
1006+ if (isset($_POST['viewtime'])) {
1007+ setNPGoption('viewtime', $_POST['viewtime']);
1008+ }
1009+ */
1010+ if (isset($_POST['batchnumber'])) {
1011+ setNPGoption('batch_add_num', $_POST['batchnumber']);
1012+ }
1013+/*
1014+ if (isset($_POST['galleryDir'])) {
1015+ setNPGoption('galleryDir', $_POST['galleryDir']);
1016+ }
1017+ if (isset($_POST['maxheight'])) {
1018+ setNPGoption('maxheight', $_POST['maxheight']);
1019+ }
1020+ if (isset($_POST['maxwidth'])) {
1021+ setNPGoption('maxwidth', $_POST['maxwidth']);
1022+ }
1023+ if (isset($_POST['thumbheight'])) {
1024+ setNPGoption('thumbheight', $_POST['thumbheight']);
1025+ }
1026+ if (isset($_POST['thumbwidth'])) {
1027+ setNPGoption('thumbwidth', $_POST['thumbwidth']);
1028+ }
1029+ */
1030+ $t = $_POST['graphicslibrary'];
1031+ if (isset($t)) {
1032+ if (($t == 'im') or ($t == 'gd')) {
1033+ setNPGoption('graphics_library', $_POST['graphicslibrary']);
1034+ }
1035+ }
1036+ if (isset($_POST['impath'])) {
1037+ setNPGoption('im_path', $_POST['impath']);
1038+ }
1039+ if (isset($_POST['imoptions'])) {
1040+ setNPGoption('im_options', $_POST['imoptions']);
1041+ }
1042+ if (isset($_POST['imquality'])) {
1043+ setNPGoption('im_quality', $_POST['imquality']);
1044+ }
1045+
1046+ $allowedoptions = array('template', 'viewtime', 'galleryDir', 'maxheight', 'maxwidth', 'thumbheight','thumbwidth','AdminCommentsPerPage','ThumbnailsPerPage','dateorrandom','tooltips','nextprevthumb','defaultorder','setorpromo','slideshowson','thumborlist' );
1047+ foreach($allowedoptions as $option) if(isset($_POST[$option])) setNPGoption($option, $_POST[$option]);
1048+
1049+
1050+ $this->action_config();
1051+ }
1052+
1053+ function action_config() {
1054+ global $gmember;
1055+
1056+ $NPG_CONF = getNPGConfig();
1057+
1058+ $this->display_tabs('config');
1059+ if($gmember->isAdmin()) {
1060+ echo '<div id="admin_content">';
1061+ $this->display_options();
1062+ echo '</div>';
1063+ }
1064+ }
1065+
1066+ function action_removeselectuser() {
1067+ global $gmember;
1068+
1069+ $mid = requestvar('userid');
1070+ if($mid) {
1071+ $query='delete from '.sql_table('plug_gallery_member')." where memberid=$mid";
1072+ if($gmember->isAdmin()) $result = mysql_query($query);
1073+ }
1074+ $this->action_users();
1075+ }
1076+
1077+ function action_addselectuser() {
1078+ global $gmember;
1079+
1080+ $mid = requestvar('userid');
1081+ if($mid) {
1082+ $query = 'insert into '.sql_table('plug_gallery_member')." values ('$mid',1) ";
1083+ if($gmember->isAdmin()) $result = mysql_query($query);
1084+ }
1085+ $this->action_users();
1086+ }
1087+
1088+ function action_uers() {
1089+ global $gmember, $NPG_CONF;
1090+
1091+ $this->display_tabs('users');
1092+ if($gmember->isAdmin() && $NPG_CONF['add_album'] == 'select') {
1093+ echo '<div id="admin_content">';
1094+ $this->display_selectusers();
1095+ echo '</div>';
1096+ }
1097+ else echo _ERROR_DISALLOWED;
1098+ }
1099+
1100+ function action_editalbumtitle() {
1101+ global $gmember,$galleryaction;
1102+
1103+ $id = requestVar('id');
1104+ if($gmember->canModifyAlbum($id)) {
1105+ $alb = new ALBUM($id);
1106+ $alb->set_title(addslashes(requestVar('title')));
1107+ $alb->set_description(addslashes(requestVar('desc')));
1108+ $alb->set_commentsallowed(requestvar('commentsallowed'));
1109+ $alb->set_publicalbum(requestvar('publicalbum'));
1110+ $alb->set_thumbnail(requestvar('thumbnail'));
1111+ $alb->write();
1112+ echo __NPG_ADMIN_SUCCESS_ALBUM_UPDATE.'<br/>';
1113+ }
1114+ else echo __NPG_ERR_ALBUM_UPDATE.'<br/>';
1115+ echo '<br/><a href="'.$galleryaction.'">'.__NPG_ADMIN_RETURN.'</a>';
1116+ }
1117+
1118+ function action_editalbumteam() { }
1119+
1120+ function action_deltmember() {
1121+ global $gmember,$galleryaction;
1122+
1123+ $aid = requestvar('aid');
1124+ $mid = requestvar('mid');
1125+ if($aid && $mid)
1126+ if($gmember->canModifyAlbum($aid)) {
1127+ $query = 'delete from '.sql_table('plug_gallery_album_team')." where tmemberid=$mid and talbumid=$aid";
1128+ $result = sql_query($query);
1129+ echo __NPG_ADMIN_SUCCESS_TEAM_UPDATE.'<br/>';
1130+ }
1131+ else echo __NPG_ERR_TEAM_UPDATE.'<br/>';
1132+ echo '<br/><a href="'.$galleryaction.'?action=album&amp;id='.$aid.'">'.__NPG_ADMIN_RETURN.'</a>';
1133+ }
1134+
1135+ function action_toggleadmin() {
1136+ global $gmember,$galleryaction;
1137+
1138+ $aid = requestvar('aid');
1139+ $mid = requestvar('mid');
1140+ if($aid && $mid)
1141+ if($gmember->canModifyAlbum($aid)) {
1142+ $query = 'update '.sql_table('plug_gallery_album_team')." set tadmin=abs(tadmin-1) where tmemberid=$mid and talbumid=$aid";
1143+ $result = mysql_query($query);
1144+ if(!$result) echo mysql_error().'<br/>';
1145+ echo __NPG_ADMIN_SUCCESS_TEAM_UPDATE.'<br/>';
1146+ }
1147+ else echo __NPG_ERR_TEAM_UPDATE.'<br/>';
1148+ echo '<br/><a href="'.$galleryaction.'?action=album&amp;id='.$aid.'">'.__NPG_ADMIN_RETURN.'</a>';
1149+ }
1150+
1151+
1152+ function action_addalbumteam() {
1153+ global $gmember,$galleryaction;
1154+
1155+ $id = requestvar('id');
1156+ $tmember = requestvar('tmember');
1157+ $admin = requestvar('admin');
1158+ if($id && $tmember) {
1159+ if(!$admin) $admin = 0;
1160+ if($gmember->canModifyAlbum($id)) {
1161+ $result = mysql_query('select * from '.sql_table('plug_gallery_album_team')." where tmemberid=$tmember");
1162+ if(!$result) echo mysql_error().'<br/>';
1163+ if(!mysql_num_rows($result))
1164+ $result2 = mysql_query('insert into '.sql_table('plug_gallery_album_team')." values ('$tmember', '$id', $admin)");
1165+ echo __NPG_ADMIN_SUCCESS_TEAM_UPDATE.'<br/>';
1166+ }
1167+ else echo __NPG_ERR_TEAM_UPDATE.'<br/>';
1168+ echo '<br/><a href="'.$galleryaction.'?action=album&amp;id='.$id.'">'.__NPG_ADMIN_RETURN.'</a>';
1169+ }
1170+ }
1171+
1172+
1173+ function action_deletealbum() {
1174+ $id = requestVar('id');
1175+ if($id) {
1176+ deletealbum($id);
1177+ }
1178+ }
1179+
1180+
1181+ function action_album() {
1182+ global $gmember;
1183+ $id = requestVar('id');
1184+
1185+ if($id && $gmember->canmodifyalbum($id)) {
1186+ editalbumform($id);
1187+ }
1188+ }
1189+
1190+
1191+ function action_finaldeletealbum() {
1192+ global $gmember;
1193+
1194+ $ok = true;
1195+ $id = requestVar('id');
1196+ $option = requestVar('deleteoption');
1197+ if($id && $option && $gmember->canmodifyalbum($id)) {
1198+ if($option == '-1') { //delete pictures
1199+ $query = 'select * from '.sql_table('plug_gallery_picture').' where albumid='.$id;
1200+ $result = mysql_query($query);
1201+ if(!$result) echo mysql_error().":$query<br/>";
1202+ while($row = mysql_fetch_object($result)) {
1203+ $delresult = PICTURE::delete($row->pictureid);
1204+ if($delresult['status'] == 'error') {
1205+ echo $delresult['message'];
1206+ $ok = false;
1207+ }
1208+ else {
1209+ $delresult = PICTURE::deletepromoposts($row->pictureid);
1210+ $query2 = 'delete from '.sql_table('plug_gallery_picture').' where pictureid='.$row->pictureid;
1211+ $result2 = mysql_query($query2);
1212+ if(!$result2) echo mysql_error().":$query<br/>";
1213+ }
1214+ }
1215+ if($ok) {
1216+ $query = 'delete from '.sql_table('plug_gallery_album').' where albumid='.$id;
1217+ $result = mysql_query($query);
1218+ if(!$result) echo mysql_error().":$query<br/>";
1219+ }
1220+
1221+ }
1222+ else {
1223+ if($gmember->canaddpicture($option)) {
1224+ $query = 'update '.sql_table('plug_gallery_picture').' set albumid='.$option.' where albumid='.$id;
1225+ $result = mysql_query($query);
1226+ if(!$result) echo mysql_error().'<br/>';
1227+ ALBUM::fixnumberofimages($option);
1228+ $query = 'delete from '.sql_table('plug_gallery_album').' where albumid='.$id;
1229+ $result = mysql_query($query);
1230+ if(!$result) echo mysql_error().'<br/>';
1231+ }
1232+ else {
1233+ echo __NPG_ERR_DA_MOVE_PICTURE.'<br/>';
1234+ }
1235+ }
1236+ }
1237+ $this->action_albumlist();
1238+ }
1239+
1240+
1241+ function action_albumlist() {
1242+ $this->display_tabs('albums');
1243+ $this->display_albums();
1244+ }
1245+
1246+
1247+
1248+
1249+}
1250+
1251+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/album_class.php
@@ -0,0 +1,494 @@
1+<?php
2+
3+class ALBUM {
4+ var $id;
5+ var $setid;
6+ var $title;
7+ var $description;
8+ var $ownerid;
9+ var $modified;
10+ var $noi;
11+ var $ownername;
12+ var $thumbnail;
13+ var $options;
14+
15+ var $totalpictures;
16+ var $displayoffset;
17+ var $pageamount;
18+
19+ var $template;
20+ var $query;
21+
22+
23+ function ALBUM($id = 0){
24+ //check if exists, populate variables, etc.
25+ if($id) {
26+ $data = $this->get_data($id);
27+ $this->id = $data->albumid;
28+ $this->title = $data->title;
29+ $this->description = $data->description;
30+ $this->ownerid = $data->ownerid;
31+ $this->modified = $data->modified;
32+ $this->noi = $data->numberofimages;
33+ $this->ownername = $data->name;
34+ $this->thumbnail = $data->thumbnail;
35+ $this->options['commentsallowed'] = $data->commentsallowed;
36+ $this->options['publicalbum'] = $data->publicalbum;
37+ }
38+
39+ }
40+
41+ function getIDfromPictureID($pictureid) {
42+
43+ }
44+
45+ function commentsallowed($pictureid) {
46+ $query = 'select a.commentsallowed from '.sql_table('plug_gallery_album').' as a, '.sql_table('plug_gallery_picture').' as b where a.albumid=b.albumid and pictureid='.$pictureid;
47+ $res = sql_query($query);
48+ $row = mysql_fetch_object($res);
49+ return $row->commentsallowed;
50+
51+ }
52+
53+ function settemplate($template) {
54+ $this->template = & $template;
55+ }
56+
57+ function setquery($query) {
58+ $this->query = & $query;
59+ }
60+
61+ function add_new($data) {
62+ $atitle = addslashes($data['title']);
63+ $adescription = addslashes($data['description']);
64+ $aowner = $data['ownerid'];
65+ $apublicalbum = $data['publicalbum'];
66+ if(!$aowner) $aowner = 0; //make the owner guest
67+ $query = "insert into ".sql_table('plug_gallery_album')." (albumid, title, description, ownerid, modified, numberofimages, commentsallowed, publicalbum) values ".
68+ "(NULL, '$atitle','$adescription',$aowner,NULL,0,1,'$apublicalbum')";
69+ sql_query($query);
70+ return mysql_insert_id();
71+ }
72+
73+ function get_data($id) {
74+ $result = sql_query("select a.*,b.mname as name from ".sql_table('plug_gallery_album').' as a left join '.sql_table('member')." as b on a.ownerid=b.mnumber where a.albumid=$id" );
75+ if(mysql_num_rows($result)) $data = mysql_fetch_object($result);
76+ else {
77+ $data->albumid = 0;
78+ return $data;
79+ }
80+
81+ if(!$data->name) $data->name='guest';
82+
83+ //default album thumbnail if thumbnail is blank
84+ if(!$data->thumbnail) {
85+ $query = 'select thumb_filename from '.sql_table('plug_gallery_picture').' where albumid='.$data->albumid.' LIMIT 1';
86+ $result = sql_query($query);
87+ if(mysql_num_rows($result) ){
88+ $row = mysql_fetch_object($result);
89+ $data->thumbnail = $row->thumb_filename;
90+ sql_query('update '.sql_table('plug_gallery_album').' set thumbnail=\''.$row->thumb_filename.'\' where albumid='.$data->albumid);
91+ }
92+ }
93+ return $data;
94+ }
95+
96+ function get_team($id) {
97+ $result = sql_query("select a.*, b.mname from ".sql_table('member').' as b, '.sql_table('plug_gallery_album_team')." as a where a.talbumid=$id and a.tmemberid=b.mnumber");
98+ if(!mysql_num_rows($result)) return false;
99+ $j=0;
100+ while ($team[$j] = mysql_fetch_object($result)) {
101+ $j++;
102+ }
103+ return $team;
104+ }
105+
106+ function get_pictures($id = 0,$so) {
107+ if($this->query == '' && $id == 0) return null;
108+ if($this->query == '') $this->query = "select * from ".sql_table('plug_gallery_picture')." where albumid=$id $so";
109+ $result = sql_query($this->query);
110+ $i=0;
111+ while ($row = mysql_fetch_object($result)) {
112+ $data[$i] = $row;
113+ $res = sql_query('select views from '.sql_table('plug_gallery_views').' where vpictureid = '.$row->pictureid);
114+ if(mysql_num_rows($res)) {
115+ $row2 = mysql_fetch_object($res);
116+ $data[$i]->views = $row2->views;
117+ }
118+ else $data[$i]->views = 0;
119+ mysql_free_result($res);
120+ $i++;
121+ }
122+ $this->totalpictures = $i;
123+
124+ return $data;
125+ }
126+
127+ function get_set_pictures($splitdata,$so) {
128+ if($splitdata == '') return null;
129+ $j=0;
130+ $i=0;
131+ $limit = sizeof($splitdata);
132+ //echo $limit;
133+ //print_r($splitdata);
134+ while ($j<$limit){
135+ $keyword = $splitdata[$j];
136+ //echo $keyword;
137+ $this->query = "select * from ".sql_table('plug_gallery_picture')." WHERE keywords like '%".$keyword."%' ";
138+ $result = sql_query($this->query);
139+ while ($row = @mysql_fetch_object($result)) {
140+ $data[$i] = $row;
141+ $res = sql_query('select views from '.sql_table('plug_gallery_views').' where vpictureid = '.$row->pictureid);
142+ if(mysql_num_rows($res)) {
143+ $row2 = mysql_fetch_object($res);
144+ $data[$i]->views = $row2->views;
145+ }
146+ else $data[$i]->views = 0;
147+ mysql_free_result($res);
148+ $i++;
149+ }
150+ $j++;
151+ }
152+ $this->totalpictures = $i;
153+
154+ return $data;
155+ }
156+
157+ function increaseNumberByOne($id) {
158+ if(!$id) $id = $this->id;
159+ $result = sql_query("update ".sql_table('plug_gallery_album')." set numberofimages = numberofimages + 1 where albumid =$id");
160+ }
161+
162+ function decreaseNumberByOne($id) {
163+ if(!$id) $id = $this->id;
164+ $result = sql_query("update ".sql_table('plug_gallery_album')." set numberofimages = numberofimages - 1 where albumid =$id");
165+ }
166+
167+ function fixnumberofimages($id) {
168+ if(!$id) {
169+ $id = $this->id;
170+ $numberofimages = $this->numberofimages;
171+ }
172+ else {
173+ $result = sql_query('select numberofimages from '.sql_table('plug_gallery_album'). " where albumid=$id");
174+ $row = mysql_fetch_object($result);
175+ $numberofimages = $row->numberofimages;
176+ }
177+ $result = sql_query('select count(*) as noi from '.sql_table('plug_gallery_picture')." where albumid=$id");
178+ $row = mysql_fetch_object($result);
179+ $noi = $row->noi;
180+ if($noi <> $numberofimages) {
181+ sql_query("update ".sql_table('plug_gallery_album')." set numberofimages=$noi where albumid=$id");
182+ }
183+ }
184+ function write() {
185+ $query = "update ".sql_table('plug_gallery_album')
186+ ." set title='{$this->title}', "
187+ ." commentsallowed= {$this->option['commentsallowed']}, "
188+ ." thumbnail='{$this->thumbnail}', "
189+ ." description='{$this->description}', "
190+ ." publicalbum= {$this->option['publicalbum']}"
191+ ." where albumid={$this->id}";
192+ sql_query($query);
193+ }
194+
195+ function getId() { return $this->id; }
196+ function getName() {return $this->name;}
197+ function getDescription() {return $this->description;}
198+ function getNoi() {return $this->noi;}
199+ function getOwnerName() {}
200+ function getOwnerid() {return $this->ownerid;}
201+ function getLastModified() {return $this->modified;}
202+ function getOptions() {return $this->options; }
203+ function getTitle() {return $this->title;}
204+
205+ function set_title($title) { $this->title = $title;}
206+ function set_description($description) { $this->description = $description; }
207+ function set_thumbnail($thumbnail) { $this->thumbnail = $thumbnail; }
208+ function set_commentsallowed($value) {$this->option['commentsallowed'] = intval($value);}
209+ function set_publicalbum($value) {$this->option['publicalbum'] = intval($value);}
210+
211+ function display($sort) {
212+ global $NPG_CONF,$manager;
213+ $defaultorder = $NPG_CONF['defaultorder'];
214+ $sorting = array('title'=>'title ASC',
215+ 'desc'=>'description ASC',
216+ 'owner'=>'ownername ASC',
217+ 'date'=>'modified DESC',
218+ 'titlea'=>'title DESC',
219+ 'desca'=>'description DESC',
220+ 'ownera'=>'ownername DESC',
221+ 'datea'=>'modified ASC',
222+ 'filenamea'=>'filename ASC',
223+ 'filename'=>'filename DESC');
224+
225+
226+ if(array_key_exists($sort,$sorting)){
227+ $so = 'order by '.$sorting[$sort].', pictureid DESC';
228+ }
229+ else {
230+ $so = 'order by '.$sorting[$defaultorder].', pictureid DESC';
231+ }
232+
233+ $page = intval(requestvar('page'));
234+ if(!$page) $page = 1;
235+
236+ $amount = requestvar('amount');
237+
238+ if (!$NPG_CONF['ThumbnailsPerPage']) {
239+ setNPGOption('ThumbnailsPerPage',20);
240+ $NPG_CONF['ThumbnailsPerPage'] = 20;
241+ }
242+
243+ if($amount) $this->pageamount = intval($amount);
244+ else $this->pageamount = $NPG_CONF['ThumbnailsPerPage'];
245+
246+ $offset = intval($page - 1) * $this->pageamount;
247+ if ($offset <= 0) $offset = 0;
248+ $this->displayoffset = $offset;
249+
250+ if(!$NPG_CONF['template']) $NPG_CONF['template'] = 1;
251+
252+ $this->template = & new NPG_TEMPLATE($NPG_CONF['template']);
253+
254+ $template_header = $this->template->section['ALBUM_HEADER'];
255+ $template_body = $this->template->section['ALBUM_BODY'];
256+ $template_footer = $this->template->section['ALBUM_FOOTER'];
257+
258+ $actions = new ALBUM_ACTIONS($this);
259+ $parser = new PARSER($actions->getdefinedActions(),$actions);
260+ $actions->setparser($parser);
261+
262+ $data = $this->get_pictures($this->getId(),$so);
263+
264+ //header
265+ $parser->parse($template_header);
266+
267+ //body
268+ $i=0;
269+ while($data[$i]) {
270+ if($i >= $offset && $i < ($offset + $this->pageamount)) {
271+ $actions->setCurrentThumb($data[$i]);
272+ $parser->parse($template_body);
273+ }
274+ $i++;
275+ }
276+
277+ //footer
278+ $parser->parse($template_footer);
279+ } //end of display()
280+
281+function displayset($splitdata,$sort) {
282+ global $NPG_CONF,$manager;
283+ $defaultorder = $NPG_CONF['defaultorder'];
284+ $sorting = array('title'=>'title ASC',
285+ 'desc'=>'description ASC',
286+ 'owner'=>'ownername ASC',
287+ 'date'=>'modified DESC',
288+ 'titlea'=>'title DESC',
289+ 'desca'=>'description DESC',
290+ 'ownera'=>'ownername DESC',
291+ 'datea'=>'modified ASC',
292+ 'filenamea'=>'filename ASC',
293+ 'filename'=>'filename DESC');
294+ if($sort){
295+ $so = 'order by '.$sorting[$sort].', pictureid DESC';
296+ }
297+ else {
298+ $so = 'order by '.$sorting[$defaultorder].', pictureid DESC';
299+ }
300+
301+ if(!$NPG_CONF['template']) $NPG_CONF['template'] = 1;
302+
303+ $this->template = & new NPG_TEMPLATE($NPG_CONF['template']);
304+
305+ $template_setdisplay = $this->template->section['ALBUM_BODY'];
306+
307+ $actions = new ALBUM_ACTIONS($this);
308+ $parser = new PARSER($actions->getdefinedActions(),$actions);
309+ $actions->setparser($parser);
310+
311+ $data = $this->get_set_pictures($splitdata,$so);
312+
313+ //header
314+ //$parser->parse($template_setdisplay);
315+
316+ //body
317+ $i=0;
318+ while($data[$i]) {
319+ $actions->setCurrentThumb($data[$i]);
320+ $parser->parse($template_setdisplay);
321+ $i++;
322+ }
323+ } //end of displayset()
324+
325+} //end album class
326+
327+class ALBUM_ACTIONS extends BaseActions {
328+ var $CurrentThumb; //query object
329+ var $album;
330+ var $parser;
331+
332+
333+ function ALBUM_ACTIONS(& $currentalbum) {
334+ $this->BaseActions();
335+ $this->album = & $currentalbum;
336+
337+ }
338+
339+ function getdefinedActions() {
340+ return array(
341+ 'breadcrumb',
342+ 'sortbytitle',
343+ 'sortbydescription',
344+ 'sortbyowner',
345+ 'sortbymodified',
346+ 'sortbynumber',
347+ 'albumtitle',
348+ 'albumid',
349+ 'albumdescription',
350+ 'picturedescription',
351+ 'picturelink',
352+ 'thumbnail',
353+ 'centeredtopmargin',
354+ 'pictureviews',
355+ 'editalbumlink',
356+ 'addpicturelink',
357+ 'picturetitle',
358+ 'pages',
359+ 'albumlink',
360+ 'if',
361+ 'else',
362+ 'endif' );
363+
364+ }
365+
366+ function setParser(&$parser) {$this->parser =& $parser; }
367+ function setCurrentThumb(&$currentthumb) { $this->CurrentThumb =& $currentthumb; }
368+
369+ function parse_pages($sep = ' ') {
370+
371+ $totalpages = $this->album->totalpictures / $this->album->pageamount;
372+ $currentpage = floor($this->album->displayoffset / $this->album->pageamount);
373+
374+
375+ for($j=0; $j < $totalpages; $j++) {
376+ $extra['page']=$j+1;
377+ $extra['amount']=$this->album->pageamount;
378+ if ($j == $currentpage) echo ($j+1);
379+ else {
380+ echo '<a href="';
381+ $this->parse_albumlink($extra);
382+ echo '">'.($j+1).'</a>';
383+ }
384+ if($j <> $totalpages) echo $sep;
385+ }
386+ }
387+ function parse_sortbytitle() {
388+ $so = requestvar('sort');
389+ if($so == 'title') $so = 'titlea'; else $so = 'title';
390+ echo generateLink('album', $so);
391+ }
392+ function parse_sortbydescription() {
393+ $so = requestvar('sort');
394+ if($so == 'desc') $so = 'desca'; else $so = 'desc';
395+ echo generateLink('album', $so);
396+ }
397+ function parse_sortbyowner() {
398+ $so = requestvar('sort');
399+ if($so == 'owner') $so = 'ownera'; else $so = 'owner';
400+ echo generateLink('album', $so);
401+ }
402+ function parse_sortbymodified() {
403+ $so = requestvar('sort');
404+ if($so == 'date') $so = 'datea'; else $so = 'date';
405+ echo generateLink('album', $so);
406+ }
407+ function parse_sortbynumber() {
408+ $so = requestvar('sort');
409+ if($so == 'numb') $so = 'numba'; else $so = 'numb';
410+ echo generateLink('album', $so);
411+ }
412+ function parse_albumlink($extra2 = 0) {
413+ $type = requestvar('type');
414+ $knownactions = array( 'album','item' );
415+ if(in_array($type,$knownactions)) {
416+ $extra['id'] = $this->album->getID();
417+ $type = 'album';
418+ }
419+ else {
420+ $allowed = array('limit');
421+ foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
422+ }
423+ $extraparams = array_merge($extra, $extra2);
424+ echo NP_gallery::MakeLink($type,$extraparams);
425+ }
426+
427+ function parse_breadcrumb($sep = '>') {
428+ echo '<a href="';
429+ echo generateLink('list');
430+ echo '">'.__NPG_BREADCRUMB_GALLERY.'</a> '.$sep.' ';
431+ $this->parse_albumtitle();
432+ }
433+
434+ function parse_albumtitle() {
435+ echo $this->album->getTitle();
436+ }
437+ function parse_albumid(){
438+ echo $this->album->getId();
439+ }
440+
441+ function parse_albumdescription() {echo $this->album->getDescription(); }
442+ function parse_picturedescription() {echo $this->CurrentThumb->description; }
443+ function parse_picturelink() {
444+ $type = requestvar('type');
445+ $sort = requestvar('sort');
446+ if($type) {
447+ if($type == 'album') $ltype = 'item';
448+ else $ltype = $type;
449+ } else $ltype = 'item';
450+ $extra = array('id' => $this->CurrentThumb->pictureid,
451+ 'sort' => $sort
452+ );
453+ $allowed = array('limit');
454+ foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
455+ echo NP_gallery::MakeLink($ltype, $extra );
456+ }
457+
458+ function parse_thumbnail() {
459+ global $CONF;
460+ echo $CONF['IndexURL'].$this->CurrentThumb->thumb_filename;
461+ }
462+
463+ function parse_picturetitle() {echo $this->CurrentThumb->title; }
464+ function parse_centeredtopmargin($height,$adjustment) {
465+ global $NP_BASE_DIR;
466+ $image_size = getimagesize($NP_BASE_DIR.$this->CurrentThumb->thumb_filename);
467+ $topmargin = ((intval($height) - intval($image_size[1])) / 2) + intval($adjustment);
468+ echo 'margin-top: '.$topmargin.'px;';
469+ }
470+ function parse_pictureviews() {echo $this->CurrentThumb->views; }
471+ function parse_editalbumlink() { if($this->album->getID()) echo generateLink('editAlbumF',$this->album->getID() );}
472+ function parse_addpicturelink() { if($this->album->getID()) echo generateLink('addPictF',$this->album->getID() );}
473+
474+ function parse_if($field, $name='', $value = '') {
475+ global $gmember;
476+
477+ $condition = 0;
478+ switch ($field) {
479+ case 'canaddpicture':
480+ $condition = $gmember->canAddPicture($this->album->getID());
481+ break;
482+ case 'caneditalbum':
483+ $condition = $gmember->canModifyAlbum($this->album->getID());
484+ break;
485+ default:
486+ break;
487+ }
488+
489+ $this->_addIfCondition($condition);
490+
491+ }
492+}
493+
494+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/comments.php
@@ -0,0 +1,242 @@
1+<?php
2+
3+class NPG_COMMENTS {
4+
5+ var $itemid;
6+ var $itemactions;
7+ var $commentcount;
8+
9+ function NPG_COMMENTS($itemid) {
10+ $this->itemid = intval($itemid);
11+ }
12+
13+ function setItemActions(&$itemActions) {
14+ $this->itemActions =& $itemActions;
15+ }
16+
17+ function showComments( & $template, $maxToShow = -1, $showNone = 1) {
18+
19+
20+ $actions = & new NPG_COMMENTACTIONS($this);
21+ $parser = & new PARSER($actions->getdefinedactions(), $actions);
22+ $actions->settemplate($template);
23+ $actions->setparser($parser);
24+
25+ if ($maxToShow == 0) {
26+ $this->commentcount = $this->amountComments();
27+
28+ } else {
29+ $query = 'select * from '.sql_table('plug_gallery_comment').
30+ ' where cpictureid='.$this->itemid.' order by ctime';
31+ $comments = sql_query($query);
32+ $this->commentcount = mysql_num_rows($comments);
33+
34+ }
35+
36+ if($this->commentcount == 0) {
37+ echo __NPG_NO_COMMENTS.'<br/>';
38+ return 0;
39+ }
40+ if (($maxToShow != -1) && ($this->commentcount > $maxToShow)) return 0;
41+
42+
43+ //$template->readall();
44+ $parser->parse($template->section['COMMENT_HEADER']);
45+ while($comment = mysql_fetch_assoc($comments)) {
46+ $actions->setcurrentcomment($comment);
47+ $parser->parse($template->section['COMMENT_BODY']);
48+ }
49+ $parser->parse($template->section['COMMENT_FOOTER']);
50+
51+ mysql_free_result($comments);
52+ return $this->commentcount;
53+
54+ }
55+
56+ function amountComments() {
57+ $query = 'select count(*)'.
58+ ' from '.sql_table('plug_gallery_comment').
59+ ' where cpictureid='.$this->itemid;
60+ $res = sql_query($query);
61+ $arr = mysql_fetch_row($res);
62+ return $arr[0];
63+ }
64+
65+ function addComment($comment) {
66+ global $member,$NPG_CONF,$CONF;
67+
68+ if ($CONF['ProtectMemNames'] && !$member->isLoggedIn() && MEMBER::isNameProtected($comment['user']))
69+ return _ERROR_COMMENTS_MEMBERNICK;
70+
71+ $isvalid = $this->isValidComment($comment);
72+ if ($isvalid != 1)
73+ return $isvalid;
74+
75+
76+ $comment['host'] = gethostbyaddr(serverVar('REMOTE_ADDR'));
77+ $comment['ip'] = serverVar('REMOTE_ADDR');
78+
79+ if ($member->isLoggedIn()) {
80+ $comment['memberid'] = $member->getID();
81+ $comment['user'] = '';
82+ $comment['userid'] = '';
83+ } else {
84+ $comment['memberid'] = 0;
85+ }
86+
87+ $comment = NPG_COMMENT::prepare($comment);
88+ $name = addslashes($comment['user']);
89+ $usid = addslashes($comment['userid']);
90+ $body = addslashes($comment['body']);
91+ $host = addslashes($comment['host']);
92+ $ip = addslashes($comment['ip']);
93+ $memberid = intval($comment['memberid']);
94+ $pictureid = $this->itemid;
95+
96+ $query = 'insert into '.sql_table('plug_gallery_comment').
97+ '(cbody, cuser, cmail, chost, cip, cmemberid, ctime, cpictureid) '.
98+ " values ('$body','$name','$usid','$host','$ip','$memberid',NULL,$pictureid) ";
99+ sql_query($query);
100+ $commentid = mysql_insert_id();
101+ return true;
102+ }
103+
104+ function isValidComment($comment) {
105+ global $member,$manager;
106+
107+ if (eregi('[a-zA-Z0-9|\.,;:!\?=\/\\]{90,90}',$comment['body']) != false)
108+ return _ERROR_COMMENT_LONGWORD;
109+
110+ // check lengths of comment
111+ if (strlen($comment['body'])<3)
112+ return _ERROR_COMMENT_NOCOMMENT;
113+
114+ if (strlen($comment['body'])>5000)
115+ return _ERROR_COMMENT_TOOLONG;
116+
117+ // only check username if no member logged in
118+ if (!$member->isLoggedIn())
119+ if (strlen($comment['user'])<2)
120+ return _ERROR_COMMENT_NOUSERNAME;
121+
122+ $result = 1;
123+
124+ $manager->notify('ValidateForm', array('type' => 'comment', 'comment' => &$comment, 'error' => &$result));
125+
126+ return $result;
127+ }
128+
129+}
130+
131+class NPG_COMMENT extends COMMENT {
132+
133+
134+}
135+
136+
137+class NPG_COMMENTACTIONS extends BaseActions {
138+ var $currentComment;
139+ var $commentsObj;
140+ var $parser;
141+ var $template;
142+
143+ function NPG_COMMENTACTIONS(&$comments) {
144+ $this->BaseActions();
145+ $this->setCommentsObj($comments);
146+ }
147+
148+ function getdefinedactions() {
149+ return array(
150+ 'commentcount',
151+ 'commentword',
152+ 'picturelink',
153+ 'pictureid',
154+ 'date',
155+ 'time',
156+ 'commentid',
157+ 'body',
158+ 'memberid',
159+ 'host',
160+ 'ip',
161+ 'user',
162+ 'userid',
163+ 'userlink',
164+ 'userlinkraw',
165+ 'timestamp' );
166+ }
167+
168+ function setCommentsObj(& $cobj) { $this->commentsObj = & $cobj; }
169+ function setparser(& $parser) { $this->parser = & $parser; }
170+ function settemplate(& $template) { $this->template = & $template; }
171+ function setcurrentcomment(& $comment) {
172+ if ($comment['cmemberid'] != 0) {
173+ //$comment['authtext'] = $template['COMMENTS_AUTH'];
174+
175+ $mem = MEMBER::createFromID($comment['cmemberid']);
176+ $comment['cuser'] = $mem->getDisplayName();
177+ if ($mem->getURL())
178+ $comment['cuserid'] = $mem->getURL();
179+ else
180+ $comment['cuserid'] = $mem->getEmail();
181+
182+ $comment['cuserlinkraw'] =
183+ createMemberLink(
184+ $comment['cmemberid'],
185+ $this->commentsObj->itemActions->linkparams
186+ );
187+ } else {
188+
189+ // create smart links
190+ if (isValidMailAddress($comment['userid']))
191+ $comment['userlinkraw'] = 'mailto:'.$comment['userid'];
192+ elseif (strstr($comment['userid'],'http://') != false)
193+ $comment['userlinkraw'] = $comment['userid'];
194+ elseif (strstr($comment['userid'],'www') != false)
195+ $comment['userlinkraw'] = 'http://'.$comment['userid'];
196+ }
197+
198+ $this->currentComment =& $comment;
199+
200+ }
201+
202+ function parse_commentcount() {echo $this->commentsObj->commentcount;}
203+ //this needs to be modified so not hardcoded
204+ function parse_commentword() { echo 'comment';}
205+
206+ function parse_picturelink() { echo generatelink('item',$this->commentsObj->itemid);}
207+ function parse_pictureid() { echo $this->commentsObj->itemid; }
208+ function parse_date() {
209+ $this->parse_timestamp('l jS of F Y');
210+ }
211+
212+ function parse_time() {
213+ $this->parse_timestamp('h:i:s A');
214+ }
215+
216+ function parse_commentid() {echo $this->currentComment['commentid']; }
217+ function parse_body() { echo $this->currentComment['cbody']; }
218+ function parse_memberid() { echo $this->currentComment['cmemberid']; }
219+ function parse_timestamp($format = 'l jS of F Y h:i:s A') {
220+ $d = $this->currentComment['ctime'];
221+ $d = converttimestamp($d);
222+ $d = date($format,$d);
223+ echo $d;
224+ }
225+ function parse_host() { echo $this->currentComment['chost']; }
226+ function parse_ip() { echo $this->currentComment['cip']; }
227+
228+ function parse_user() { echo $this->currentComment['cuser']; }
229+ function parse_userid() { echo $this->currentComment['cuserid']; }
230+ function parse_userlinkraw() { echo $this->currentComment['cuserlinkraw']; }
231+ function parse_userlink() {
232+ if ($this->currentComment['cuserlinkraw']) {
233+ echo '<a href="'.$this->currentComment['cuserlinkraw'].'" rel="nofollow">'.$this->currentComment['cuser'].'</a>';
234+ } else {
235+ echo $this->currentComment['cuser'];
236+ }
237+ }
238+
239+
240+}
241+
242+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/config.php
@@ -0,0 +1,28 @@
1+<?php
2+//NP_gallery config
3+
4+global $DIR_NUCLEUS,$DIR_LIBS;
5+
6+global $NP_GALLERY_DIR, $NP_BASE_DIR;
7+$NP_GALLERY_DIR = $DIR_NUCLEUS . 'plugins/gallery/';
8+$NP_BASE_DIR = substr($DIR_NUCLEUS,0,strlen($DIR_NUCLEUS) - 8);
9+
10+
11+include_once($NP_GALLERY_DIR.'functions.php');
12+include_once($NP_GALLERY_DIR.'list_class.php');
13+include_once($NP_GALLERY_DIR.'album_class.php');
14+include_once($NP_GALLERY_DIR.'picture_class.php');
15+include_once($NP_GALLERY_DIR.'member_class.php');
16+include_once($NP_GALLERY_DIR.'forms.php');
17+include_once($NP_GALLERY_DIR.'admin.php');
18+include_once($NP_GALLERY_DIR.'template.php');
19+include_once($NP_GALLERY_DIR.'comments.php');
20+include_once($NP_GALLERY_DIR.'language/english.php'); //change this for different language
21+
22+global $NPG_CONF, $member, $gmember;
23+$NPG_CONF = getNPGConfig();
24+$gmember = new GALLERY_MEMBER;
25+if($member->getID()) $gmember->readFromID($member->getID()); else $gmember->makeguest();
26+$gmember->loggedin = $member->isloggedin();
27+
28+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/documentation/dev.html
@@ -0,0 +1,144 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2+<html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
3+<head>
4+ <!-- $Id: sqltables.html,v 1.9 2005/03/05 13:19:30 dekarma Exp $ -->
5+ <title>Nucleus - SQL Table Structure</title>
6+ <link rel="stylesheet" type="text/css" href="manual.css" />
7+ <style type="text/css">
8+ /* auto increment table columns*/
9+ .autoinc {
10+ }
11+
12+ /* primary-keys */
13+ .primary {
14+ text-decoration: underline;
15+ font-weight: bold;
16+ }
17+
18+ /* NOT NULL */
19+ .notnull {
20+ }
21+
22+ /* unique key */
23+ .unique {
24+ }
25+
26+ /* foreign keys */
27+ .foreign {
28+ font-style: italic;
29+ }
30+
31+ /* auto increment table columns*/
32+ .autoinc {
33+ }
34+
35+ /* fulltext index */
36+ .fulltext {
37+ }
38+
39+ /* columns/tables to remove in later versions */
40+ .toremove {
41+ color: red;
42+ }
43+
44+ </style>
45+</head>
46+<body>
47+
48+<a name="top" id="top"></a>
49+<div class="heading">
50+Developer Documentation
51+</div>
52+<h1></h1>
53+
54+<h1>Introduction</h1>
55+<p>This page is to document the database structure of NP_Gallery and the nucleus plugin API extensions.</p>
56+
57+<h1>Table of Contents</h1>
58+<ul>
59+<li><a href="#datastructure">Database Structure
60+ <ul>
61+ <li><a href="#table_album">album</a></li>
62+ <li><a href="#table_album_team">album_team</a></li>
63+ <li><a href="#table_picture">picture</a></li>
64+ <li><a href="#table_template">template</a></li>
65+ <li><a href="#table_template_desc">template_desc</a></li>
66+ <li><a href="#table_config">config</a></li>
67+ <li><a href="#table_member">member</a></li>
68+ <li><a href="#table_comment">comment</a></li>
69+ <li><a href="#table_promo">promo</a></li>
70+ <li><a href="#table_views">views</a></li>
71+ <li><a href="#table_views_log">views_log</a></li>
72+ </ul>
73+</li>
74+<li><a href="#pluginhooks">Plugin Events</li>
75+</ul>
76+
77+<h1><a name="datastructure"></a>Database structure</h1>
78+
79+<h1><a name="table_album"></a>album</h1>
80+<table><thead><tr>
81+ <th>Column Name</th>
82+ <th>Type</th>
83+ <th>Default</th>
84+ <th>Description</th>
85+</tr></thead><tbody><tr>
86+ <th class="notnull autoinc primary">albumid</th>
87+ <th></th>
88+ <th></th>
89+ <th></th>
90+</tr><tr>
91+ <th>title</th>
92+ <th></th>
93+ <th></th>
94+ <th></th>
95+</tr><tr>
96+ <th>description</th>
97+ <th></th>
98+ <th></th>
99+ <th></th>
100+</tr><tr>
101+ <th>ownerid</th>
102+ <th></th>
103+ <th></th>
104+ <th></th>
105+</tr><tr>
106+ <th>modified</th>
107+ <th></th>
108+ <th></th>
109+ <th></th>
110+</tr><tr>
111+ <th>numberofimages</th>
112+ <th></th>
113+ <th></th>
114+ <th></th>
115+</tr><tr>
116+ <th>thumbnail</th>
117+ <th></th>
118+ <th></th>
119+ <th></th>
120+</tr><tr>
121+ <th>commentsallowed</th>
122+ <th></th>
123+ <th></th>
124+ <th></th>
125+</tr></tbody>
126+</table>
127+
128+
129+<h2><a name="table_album_team"></a>album_team</h2>
130+<h2><a name="table_picture"></a>picture</h2>
131+<h2><a name="table_template"></a>template</h2>
132+<h2><a name="table_template_desc"></a>template_desc</h2>
133+<h2><a name="table_config"></a>config</h2>
134+<h2><a name="table_member"></a>member</h2>
135+<h2><a name="table_comment"></a>comment</h2>
136+<h2><a name="table_promo"></a>promo</h2>
137+<h2><a name="table_views"></a>views</h2>
138+<h2><a name="table_views_log"></a>views_log</h2>
139+
140+<h1><a name="pluginhooks"></a>Gallery Events</h1>
141+NPgCollectionDisplay
142+
143+</body>
144+</html>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/documentation/manual.css
@@ -0,0 +1,141 @@
1+body {
2+ background-color: #fff;
3+ color: #000;
4+ font-family: verdana, arial;
5+ font-size: small;
6+}
7+
8+@media screen {
9+ body {
10+ margin-left: 10%;
11+ margin-right: 10%;
12+ }
13+}
14+
15+@media print {
16+ pre, .note, td, th {
17+ border: 1px dashed gray;
18+ }
19+}
20+
21+img {
22+ border: none;
23+}
24+
25+a:link, a:visited {
26+ color: #1D3565;
27+ font-weight: bold;
28+ text-decoration: none;
29+}
30+a: hover {
31+ text-decoration: underline;
32+}
33+
34+.heading {
35+ text-align: center;
36+ font-size: xx-large;
37+ font-weight: bold;
38+ color: gray;
39+}
40+
41+.heading i {
42+ position: absolute;
43+ top: 5px;
44+ right: 5px;
45+ font-size: small;
46+ font-style: normal;
47+ font-weight: normal;
48+}
49+
50+p:first-letter {
51+ font-size: large;
52+}
53+
54+p {
55+ text-indent: 20px;
56+}
57+
58+h1 {
59+ border-bottom: 1px dotted gray;
60+ font-size: x-large;
61+ color: #596d9d;
62+}
63+
64+h2 {
65+ color: gray;
66+ font-size: large;
67+ margin-left: 20px;
68+ text-indent: 10px;
69+ border-bottom: 1px solid #ddd;
70+}
71+
72+pre, .note, .faq .answer {
73+ background-color: #ddd;
74+ padding: 10px;
75+ font-size: small;
76+}
77+
78+.screenshot {
79+ text-align: center;
80+ background-color: #ddd;
81+ padding: 10px;
82+}
83+
84+.faq .question {
85+ font-weight: bold;
86+ margin-bottom: 0px;
87+}
88+
89+.faq .answer {
90+
91+}
92+
93+.faq {
94+ margin-bottom: 20px;
95+}
96+
97+table {
98+ border: none;
99+}
100+
101+th {
102+ background-color: linen;
103+ font-size: medium;
104+}
105+
106+th, td {
107+ padding: 5px;
108+}
109+
110+td {
111+ background-color: #dddddd;
112+ font-size: small;
113+ vertical-align: top;
114+ text-align: left;
115+}
116+
117+input, select, option, textarea {
118+ background-color: transparent;
119+}
120+
121+.deprecated {
122+ border: 3px solid red;
123+ padding: 5px;
124+ font-size: medium;
125+}
126+
127+tt, code, samp {
128+ font-size: small;
129+}
130+
131+.warning {
132+ color: red;
133+}
134+.ok {
135+ color: green;
136+}
137+
138+acronym, abbr {
139+ border-bottom: 1px dotted gray;
140+ cursor: help;
141+}
--- /dev/null
+++ b/NP_gallery/trunk/gallery/extra/gallery
@@ -0,0 +1,114 @@
1+<?php
2+
3+include('./fancyurls.config.php');
4+include('./config.php');
5+global $DIR_NUCLEUS;
6+include_once($DIR_NUCLEUS.'/plugins/gallery/config.php');
7+
8+$data = explode("/",serverVar('PATH_INFO'));
9+$itemid = intval($data[1]);
10+
11+$i = 2;
12+while($data[$i]) {
13+ $j = $i+1;
14+ if ($data[$j]) $_GET[$data[$i]] = $data[$j];
15+ $i = $i + 2;
16+}
17+$_GET['type'] = $data[1];
18+$type = $_GET['type'];
19+
20+if(isset($_POST['type'])) $type=$_POST['type'];
21+
22+global $gmember, $CONF, $NPG_CONF;
23+global $skinid,$manager,$blog,$blogid;
24+
25+
26+switch($type) {
27+ case 'addcomment':
28+ global $CONF;
29+
30+ $post['itemid'] = intPostVar('itemid');
31+ $post['user'] = postVar('user');
32+ $post['userid'] = postVar('userid');
33+ $post['body'] = postVar('body');
34+
35+ // set cookies when required
36+ $remember = intPostVar('remember');
37+ if ($remember == 1) {
38+ $lifetime = time()+2592000;
39+ setcookie($CONF['CookiePrefix'] . 'comment_user',$post['user'],$lifetime,'/','',0);
40+ setcookie($CONF['CookiePrefix'] . 'comment_userid', $post['userid'],$lifetime,'/','',0);
41+ }
42+
43+ $comments = new NPG_COMMENTS($post['itemid']);
44+
45+ $errormessage = $comments->addComment($post);
46+
47+ //need to add code to display the error
48+ if ($errormessage == '1') {
49+ $_POST['id'] = $post['itemid'];
50+ }
51+ break;
52+ case 'addAlbum':
53+ if($gmember->canAddAlbum() ){
54+ $NPG_vars['ownerid'] = $gmember->getID();
55+ $NPG_vars['title'] = requestVar('title');
56+ $NPG_vars['description'] = requestVar('desc');
57+ ALBUM::add_new($NPG_vars);
58+ }
59+ break;
60+ case 'finaldeletepicture':
61+ $id = requestVar('id');
62+ $delpromo = requestVar('delpromo');
63+ if($gmember->canModifyPicture($id)) {
64+
65+ $manager->notify('NPgPreDeletePicture', array('pictureid' => $id));
66+ $result = PICTURE::delete($id);
67+
68+ if($result['status'] == 'error') {
69+ echo $result['message'];
70+ }
71+ else {
72+ $manager->notify('NPgPostDeletePicture', array('pictureid' => $id));
73+
74+ if($delpromo == 'yes') {
75+ $result2 = PICTURE::deletepromoposts($id);
76+ if($result2['status'] == 'error') echo $result2['message'];
77+ }
78+ else {
79+ $_POST['id'] = $result['albumid'];
80+ }
81+ }
82+ } else echo 'No permission to delete picture<br/>';
83+ break;
84+ case 'editPicture':
85+ $id = requestVar('id');
86+ if($gmember->canModifyPicture($id)) {
87+ $pict = new PICTURE($id);
88+ $pict->setTitle(requestVar('ptitle'));
89+ $pict->setDescription(requestVar('pdesc'));
90+ $aid = requestVar('aid');
91+ if($aid && $gmember->canAddPicture($aid)) {
92+ ALBUM::decreaseNumberByOne($pict->getAlbumID());
93+ ALBUM::increaseNumberByOne($aid);
94+ $pict->setAlbumID($aid);
95+ }
96+ $pict->write();
97+ $manager->notify('NPgPostUpdatePicture',array('picture', &$pict));
98+ }
99+ default:
100+ break;
101+}
102+
103+if (!$blogid)
104+$blogid = $CONF['DefaultBlog'];
105+
106+$b =& $manager->getBlog($blogid);
107+$blog = $b;
108+
109+selectSkin('NPGallery');
110+
111+$skin =& new SKIN($skinid);
112+$skin->parse('index');
113+
114+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_gallery/trunk/gallery/forms.php
@@ -0,0 +1,427 @@
1+<?php
2+
3+
4+function addAlbumForm() {
5+ global $CONF;
6+
7+ if($CONF['URLMode'] == 'pathinfo') $action = 'gallery'; else $action = 'action.php';
8+
9+ ?>
10+ <h1><?php echo __NPG_FORM_ADDALBUM; ?></h1>
11+ <form method="post" action="<?php echo $action; ?>"><div>
12+ <input type="hidden" name="action" value="plugin" />
13+ <input type="hidden" name="name" value="gallery" />
14+ <input type="hidden" name="type" value="addAlbum" />
15+
16+ <?php addAlbumFormFields(); ?>
17+ </div></form>
18+
19+ <?php
20+}
21+
22+function addAlbumFormFields() {
23+ ?>
24+ <table>
25+ <tr><td><label for="atitle"><?php echo __NPG_FORM_ALBUM_TITLE; ?>:</label></td>
26+ <td><input type="text" name="title" id="atitle" size="20" /></td></tr>
27+ <tr><td><label for="atitle"><?php echo 'public album'; ?>:</label></td>
28+ <td><input type="radio" <?php if($data->publicalbum) echo 'checked ';?> name="publicalbum" id="publicalbum_f" value="1" /><?php echo 'yes'; ?>
29+ <input type="radio" <?php if(!$data->publicalbum) echo 'checked ';?> name="publicalbum" id="publicalbum_f" value="0" /><?php echo 'no'; ?></td></tr>
30+ <tr><td><label for="adesc"><?php echo __NPG_FORM_ALBUM_DESC; ?>:</label></td>
31+ <td><input type="text" name="desc" id="adesc" size="80" /></td></tr>
32+ <tr><td colspan="2"><input type="submit" value="<?php echo __NPG_FORM_SUBMITALBUM; ?>"></td></tr>
33+ </table>
34+ <?php
35+}
36+
37+function deleteAlbum($id) {
38+ global $gmember, $galleryaction;
39+
40+
41+
42+ if(!$galleryaction) return false;
43+ echo '<h1>'.__NPG_FORM_DELETE_ALBUM.'</h1>';
44+ echo __NPG_FORM_REALLY_DELETE_ALBUM.'<br/>';
45+
46+ echo '<form><input type="button" value="'.__NPG_FORM_CANCEL.'" onclick="window.location.href=\''.$galleryaction.'\'"/></form>';
47+
48+ echo __NPG_FORM_DELETE_OR_MOVE.'<br/>';
49+ ?>
50+ <form method="post" action="<?php echo $galleryaction; ?>"><div>
51+ <input type="hidden" name="action" value="finaldeletealbum" />
52+ <input type="hidden" name="id" value="<?php echo $id; ?>" />
53+
54+ <select name="deleteoption">
55+ <option value="-1" selected><?php echo __NPG_FORM_DELETE_PICTURES; ?>
56+ <?php
57+ $allowed_albums = $gmember->getallowedalbums();
58+ if($allowed_albums) {
59+ $j=0;
60+ while($allowed_albums[$j]) {
61+ echo '<option value="'.$allowed_albums[$j]->albumid.'">Move pictures to '.$allowed_albums[$j]->albumname;
62+ $j++;
63+ }
64+ }
65+ ?>
66+ </select>
67+ <input type="submit" value="<?php echo __NPG_FORM_DELETE; ?>" />
68+ </div></form>
69+ <?php
70+
71+}
72+
73+
74+function editAlbumForm($id) {
75+ global $gmember,$galleryaction;
76+
77+ if(!$galleryaction) {
78+ echo 'galleryaction variable not set<br/>';
79+ return;
80+ }
81+
82+ echo '<a href="'.$galleryaction.'">'.__NPG_FORM_RETURN_ADMIN.'</a><br/><br/>';
83+
84+ $data = ALBUM::get_data($id);
85+ ?>
86+ <h3><?php echo __NPG_FORM_MODIFY_ALBUM; ?></h3>
87+ <form method="post" action="<?php echo $galleryaction; ?>"><div>
88+ <input type="hidden" name="action" value="editalbumtitle" />
89+ <input type="hidden" name="id" value="<?php echo $id; ?>" />
90+
91+ <table><tr><td>
92+ <label for="atitle"><?php echo __NPG_FORM_ALBUM_TITLE; ?>: </label>
93+ </td><td>
94+ <input type="text" name="title" id="atitle" value = "<?php echo stripslashes($data->title); ?>" size="20" />
95+ </td></tr><tr><td>
96+ <label for="adesc"><?php echo __NPG_FORM_ALBUM_DESC; ?>: </label>
97+ </td><td>
98+ <input type="text" name="desc" id="adesc" value = "<?php echo stripslashes($data->description); ?>" size="60" /><br />
99+ </td></tr><tr><td>
100+ <label for="commentsallowed_f"><?php echo __NPG_FORM_COMMENTSALLOWED; ?></label>
101+ </td><td>
102+ <input type="radio" <?php if($data->commentsallowed) echo 'checked ';?> name="commentsallowed" id="commentsallowed_f" value="1" /><?php echo __NPG_FORM_YES; ?>
103+ <input type="radio" <?php if(!$data->commentsallowed) echo 'checked ';?> name="commentsallowed" id="commentsallowed_f" value="0" /><?php echo __NPG_FORM_NO; ?>
104+ </td></tr>
105+ <tr><td>
106+ <label for="publicalbum_f"><?php echo 'publicalbum'; ?></label>
107+ </td><td>
108+ <input type="radio" <?php if($data->publicalbum) echo 'checked ';?> name="publicalbum" id="publicalbum_f" value="1" /><?php echo __NPG_FORM_YES; ?>
109+ <input type="radio" <?php if(!$data->publicalbum) echo 'checked ';?> name="publicalbum" id="publicalbum_f" value="0" /><?php echo __NPG_FORM_NO; ?>
110+ </td></tr><tr><td>
111+ <label for="thumbnail_f"><?php echo __NPG_FORM_ALBUM_THUMBNAIL; ?></label>
112+ </td><td>
113+ <select name="thumbnail" id="thumbnail_f">
114+ <?php
115+ $pics = ALBUM::get_pictures($id);
116+ $k=0;
117+ while($pics[$k]) {
118+ echo '<option value="'.$pics[$k]->thumb_filename.'" ';
119+ if ($pics[$k]->thumb_filename == $data->thumbnail) echo ' selected ';
120+ echo '>'.$pics[$k]->title;
121+ $k++;
122+ }
123+ ?>
124+ </select>
125+ </td></tr></table>
126+ <br/><input type="submit" value="Submit" />
127+ </div></form>
128+ <br/>
129+ <h3><?php echo __NPG_FORM_CURRENT_ALBUM_TEAM; ?></h3>
130+ <form method="post" action="<?php echo $galleryaction; ?>"><div>
131+ <input type="hidden" name="action" value="editalbumteam" />
132+ <input type="hidden" name="id" value="<?php echo $id; ?>" />
133+
134+ <table>
135+ <thead><tr><th><?php echo __NPG_FORM_NAME; ?></th><th><?php echo __NPG_FORM_ALBUM_ADMIN; ?></th><th colspan='2'><?php echo __NPG_FORM_ACTIONS; ?></th></thead>
136+ <tbody>
137+ <tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'>
138+ <td><?php echo $data->name.' ('.__NPG_FORM_OWNER.')'; ?></td>
139+ <td>Yes</td>
140+ <td colspan='2' ><?php echo __NPG_FORM_NO_OWNER_ACTIONS; ?></td>
141+ </tr>
142+ <?php
143+ $team = ALBUM::get_team($id);
144+ if($team) {
145+ $j=0;
146+ while($team[$j]) {
147+ ?><tr onmouseover='focusRow(this);' onmouseout='blurRow(this);'><?php
148+ echo '<td>'.$team[$j]->mname.'</td>';
149+ if($team[$j]->tadmin) echo '<td>'.__NPG_FORM_YES.'</td>'; else echo '<td>'.__NPG_FORM_NO.'</td>';
150+ echo '<td><a href="'.$galleryaction.'?action=deltmember&amp;mid='.$team[$j]->tmemberid.'&amp;aid='.$id.'">'.__NPG_FORM_DELETE.'</a></td>';
151+ echo '<td><a href="'.$galleryaction.'?action=toggleadmin&amp;mid='.$team[$j]->tmemberid.'&amp;aid='.$id.'">'.__NPG_FORM_TOGGLE_ADMIN.'</a></td></tr>';
152+ $j++;
153+ }
154+ }
155+
156+ ?>
157+ </tbody></table>
158+ </div></form>
159+ <br/>
160+ <h3><?php echo __NPG_FORM_ADDTEAMMEMBER; ?></h3>
161+ <form method="post" action="<?php echo $galleryaction; ?>"><div>
162+ <input type="hidden" name="action" value="addalbumteam" />
163+ <input type="hidden" name="id" value="<?php echo $id; ?>" />
164+
165+ <table><tr>
166+ <td><?php echo __NPG_FORM_CHOOSEMEMBER; ?>:</td>
167+ <td>
168+ <?php
169+ //this query lists the members that are not already part of the team, not the admins(they already have permissions) and are not the owner of the album
170+ $result = mysql_query('select mname, mnumber from '.sql_table('member').' left join '.sql_table('plug_gallery_album_team').' on mnumber=tmemberid and talbumid='.$id.' where mnumber <> '.$data->ownerid.' and madmin=0 and tmemberid is null');
171+ if($result) {
172+ $num_rows = mysql_num_rows($result);
173+ if($num_rows) {
174+ echo '<select name="tmember">';
175+ while($m = mysql_fetch_object($result)) echo '<option value="'.$m->mnumber.'">'.$m->mname;
176+ echo '</select>';
177+ }
178+ }
179+ ?>
180+ </td></tr>
181+ <tr><td><?php echo __NPG_FORM_ADMIN_PRIV; ?> </td>
182+ <td><input type="radio" name="admin" value="1" id="admin1" />
183+ <label for="admin1"><?php echo __NPG_FORM_YES; ?></label>
184+ <input type="radio" name="admin" value="0" checked='checked' id="admin0" />
185+ <label for="admin0"><?php echo __NPG_FORM_NO; ?></label></td></tr>
186+
187+ <tr><td><?php echo __NPG_FORM_ADDTOTEAM; ?></td>
188+ <td><input type='submit' value='<?php echo __NPG_FORM_ADDTOTEAM; ?>' /></td></tr></table>
189+
190+ </div></form>
191+ <?php
192+
193+}
194+
195+
196+function editPictureForm($id) {
197+ global $gmember,$manager;
198+
199+ //todo:add delete picture link, add move to different album link
200+ $data = PICTURE::get_data($id);
201+ if($data->pictureid) {
202+ ?>
203+ <h1><?php echo __NPG_FORM_EDITPICTURE; ?></h1>
204+ <form method="post" action="action.php"><div>
205+ <input type="hidden" name="action" value="plugin" />
206+ <input type="hidden" name="name" value="gallery" />
207+ <input type="hidden" name="type" value="editPicture" />
208+ <input type="hidden" name="id" value="<?php echo $id; ?>" />
209+
210+ <table><tr><td><?php echo __NPG_FORM_PICTURETITLE; ?></td>
211+ <td><input type="text" name="ptitle" value="<?php echo $data->title; ?>" size="40" /></td></tr>
212+ <tr><td><?php echo __NPG_FORM_PICTUREDESCRIPTION; ?></td>
213+ <td><input type="text" name="pdesc" value="<?php echo $data->description; ?>" size="70" /></td></tr>
214+ <tr><td>keywords(seperate with ','): </td>
215+ <td><input type="text" name="keywords" value="<?php echo $data->keywords; ?>" size="70" /></td></tr>
216+
217+ <?php
218+
219+ $allowed_albums = $gmember->getallowedalbums();
220+ if($allowed_albums[1]) { //if more than 1 allowed album display Move Album option
221+ echo '<tr><td>'.__NPG_FORM_MOVETOALBUM.': </td><td><select name="aid">';
222+ $j=0;
223+ while($allowed_albums[$j]) {
224+ echo '<option value="'.$allowed_albums[$j]->albumid.'"';
225+ if($allowed_albums[$j]->albumid == $data->albumid) echo 'selected';
226+ echo '>';
227+ echo $allowed_albums[$j]->albumname;
228+ $j++;
229+ }
230+ echo '</select></td></tr></table>';
231+ }
232+ $manager->notify('NPgEditPictureFormExtras',array('pictureid'=>$id,'title'=>$data->title,'description'=>$data->description));
233+
234+ ?>
235+ <br/><input type="submit" value="<?php echo __NPG_FORM_SUBMIT_CHANGES; ?>"></table>
236+ </div></form>
237+ <?php
238+ }
239+ else echo __NPG_FORM_NOPICTOEDIT;
240+
241+}
242+
243+function deletePictureForm($id) {
244+ $data = PICTURE::get_data($id);
245+ if($data->pictureid) {
246+ echo '<img src="'.$data->thumb_filename.'" /><br/>';
247+ echo __NPG_FORM_REALLYDELETE.'<br/>';
248+ echo '<form><input type="button" value="'.__NPG_FORM_CANCEL.'" onclick="history.back()"/></form>';
249+
250+ echo '<br/>';
251+ echo __NPG_FORM_DELETEPICTURETEXT;
252+ echo '<form method="post" action="action.php">';
253+ echo '<input type="hidden" name="action" value="plugin" />';
254+ echo '<input type="hidden" name="name" value="gallery" />';
255+ echo '<input type="hidden" name="type" value="finaldeletepicture" />';
256+ echo '<input type="hidden" name="id" value="'.$id.'" />';
257+ echo __NPG_FORM_DELETEPROMOTOO;
258+ echo __NPG_FORM_YES.':<input type="radio" checked name="delpromo" id="promo" value="yes" />';
259+ echo ' '.__NPG_FORM_YES.':<input type="radio" name="delpromo" id="promo" value="no" />';
260+ echo '<br/><input type="submit" value="'.__NPG_FORM_DELETE.'"/></form>';
261+ }
262+ else echo __NPG_FORM_NOPICTTODELETE;
263+}
264+
265+function addPictureForm($albumid = 0, $num_files = 0) {
266+ global $NPG_CONF,$CONF;
267+
268+ if(!$num_files) {
269+ if($NPG_CONF['batch_add_num']) $num_files = $NPG_CONF['batch_add_num'];
270+ else $num_files = 10;
271+ }
272+
273+ ?>
274+ <h1><?php echo __NPG_FORM_UPLOADFILEFORM; ?></h1>
275+ <form enctype="multipart/form-data" method="post" action="<?php echo $CONF['PluginURL'].'gallery/add_picture.php'; ?>"><div>
276+ <input type="hidden" name="type" value="secondstage" />
277+ <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
278+
279+ <table>
280+ <?php
281+ if($albumid) echo '<input type="hidden" name="id" value="'.$albumid.'" />';
282+
283+ for($i=0; $i<$num_files; $i++) {
284+ $j = $i+1;
285+ echo '<tr><td>'.__NPG_FORM_PICTURELABLE.' '.$j.'</td><td><input type="file" name="uploadpicture'.$i.'"></td></tr>';
286+ }
287+ ?>
288+ </table>
289+ <input type="submit" value="<?php echo __NPG_FORM_SUBMITFILES; ?>">
290+ </div></form>
291+ <?php
292+}
293+
294+function addpictureformjupload($albumid = 0, $num_files = 0) {
295+ global $NPG_CONF,$CONF;
296+ $exist_temp_table = mysql_query('SELECT 1 FROM '.$NPG_CONF['temp_table'].' LIMIT 0');
297+ if ($exist_temp_table) sql_query('drop table '. $NPG_CONF['temp_table']);
298+
299+ ?>
300+ <html>
301+<!--
302+
303+ Author: $Author: mhaller $
304+
305+ Id: $Id: JUpload.html,v 1.1 2004/02/05 08:59:40 mhaller Exp $
306+
307+ Version: $Revision: 1.1 $
308+
309+ Date: $Date: 2004/02/05 08:59:40 $
310+
311+-->
312+<head>
313+<title>JUpload - multiple file upload with resuming</title>
314+<meta name="Author" content="Mike Haller">
315+<meta name="Publisher" content="Haller Systemservice">
316+<meta name="Copyright" content="Mike Haller">
317+<meta name="Keywords" content="jupload, multiple, java, upload, http, html, applet, embed, object, input, type, file, submit, add, remove, queue, rfc 1867, application/x-www-form-urlencoded, POST METHOD, swing, awt, j2se, transfer, files, requests, webserver, apache, asp, jsp, php4, php5, php, multipart, content-disposition, form-data, boundary, attachment, mime headers, transmission, enctype, remote data, browser, internet explorer, mozilla, opera, fileuploader, batch upload, file selection dialog, resuming, resume, continue">
318+<meta name="Description" content="JUpload is a java applet for uploading multiple files to the webserver using RFC1867 post method. It features a status display showing current transfer rate.">
319+<meta name="Page-topic" content="HTTP file upload with resuming using post or put method featuring https and proxy">
320+<meta name="Audience" content="Advanced">
321+<meta name="Content-language" content="EN">
322+<meta name="Page-type" content="Software-Download">
323+<meta name="Robots" content="INDEX,FOLLOW">
324+
325+</head>
326+<body>
327+ <br>
328+ <applet
329+ code="JUpload.startup"
330+ archive="/nucleus/jupload.jar"
331+ width="500"
332+ height="300"
333+ mayscript="mayscript"
334+ name="JUpload"
335+ alt="JUpload by www.jupload.biz">
336+ <!-- Java Plug-In Options -->
337+ <param name="progressbar" value="true">
338+ <param name="boxmessage" value="Loading JUpload Applet ...">
339+ <!-- Target links -->
340+ <param name="actionURL" value="/nucleus/nucleus/plugins/gallery/juploadaccept.php">
341+ <!PARAM NAME="maxTotalRequestSize" VALUE="4">
342+ <!-- <param name="preselectedFiles" value="c:\test.pdf"> -->
343+<!-- IF YOU HAVE PROBLEMS, CHANGE THIS TO TRUE BEFORE CONTACTING SUPPORT -->
344+<param name="debug" value="true">
345+ Your browser does not support applets. Or you have disabled applet in your options.
346+
347+ To use this applet, please install the newest version of Sun's java. You can get it from <a href="http://www.java.com/">java.com</a>
348+ </applet>
349+<a href="<?php echo $CONF['PluginURL'] ?>gallery/add_picture.php?type=massupload&id=<?php echo $albumid ?>">Next step
350+
351+</a></body>
352+
353+<?php
354+
355+}
356+
357+function addTempPictureForm($albumid = 0) {
358+ global $NPG_CONF, $gmember,$manager,$CONF,$NP_BASE_DIR;
359+
360+ $NPG_CONF = getNPGConfig();
361+ $table_name = $NPG_CONF['temp_table'];
362+
363+ $promo_allowed = false;
364+ if($NPG_CONF['blog_cat'] <> 0) $promo_allowed=true;
365+ $NPG_CONF['promo_allowed'] = $promo_allowed;
366+
367+ //form proper
368+ echo '<h1>'.__NPG_FORM_UPLOADFILEFORM.'</h1>';
369+ echo '<form method="post" action="'.$CONF['PluginURL'].'gallery/add_picture.php'.'"><div>';
370+ echo '<input type="hidden" name="type" value="addpictures" />';
371+ echo '<input type="hidden" name="promopost" value="'.$promo_allowed.'" />';
372+
373+ $result = mysql_query("select * from $table_name");
374+ if($result) $num_rows = mysql_num_rows($result);
375+
376+ if($num_rows) {
377+ echo '<table>';
378+ $i=0;
379+ $setorpromo = $NPG_CONF['setorpromo'];
380+ while($row = mysql_fetch_assoc($result) ) {
381+ if ( $row['error'] == '') {
382+ echo '<input type="hidden" name="tid'.$i.'" value="'. $row['tempid'] .'" />';
383+ echo '<input type="hidden" name="filename'.$i.'" value="'. $row['filename'] .'" />';
384+ echo '<input type="hidden" name="thumbfilename'.$i.'" value="'. $row['thumbfilename'] .'" />';
385+ echo '<input type="hidden" name="intfilename'.$i.'" value="'. $row['intfilename'] .'" />';
386+
387+ echo '<tr><td><img src="'.$CONF['IndexURL'].$row['thumbfilename'].'"></td><td>';
388+ echo '<table><tr><td>'.__NPG_FORM_TITLE.'</td>';
389+ echo '<td><input type="text" name="title'.$i.'" value="'.$row['title'].'"></td></tr>';
390+ echo '<tr><td>'.__NPG_FORM_DESC.'</td>';
391+ echo '<td><input type="text" name="description'.$i.'" value="'.$row['description'].'"></td></tr>';
392+ if($promo_allowed && $setorpromo=='promo') echo '<tr><td>'.__NPG_FORM_PROMOTE.'</td><td> Yes<input type="radio" name="promote'.$i.'" value="yes"> No<input type="radio" checked name="promote'.$i.'" value="no"></td></tr>';
393+ if($setorpromo=='sets'){echo '<tr><td>keywords (seperate with ','):</td><td> <input type="text" name="keywords'.$i.'" value=""></td></tr>';}
394+ if(!$albumid) {
395+ echo '<tr><td>'.__NPG_FORM_ADDTOALBUM.'</td><td><select name="album'.$i.'">';
396+ $allowed_albums = $gmember->getallowedalbums();
397+ $j=0;
398+ while($allowed_albums[$j]) {
399+ echo '<option value="'.$allowed_albums[$j]->albumid.'">'.$allowed_albums[$j]->albumname;
400+ $j++;
401+ }
402+ }
403+ else echo '<input type="hidden" name="album'.$i.'" value="'.$albumid.'">';
404+ echo '</select></td></tr></table>';
405+
406+ $manager->notify('NPgAddPictureFormExtras',array('i'=>$i,'ttid'=>$row['tempid'], 'filename' =>$row['filename'],'thumbfilename'=>$row['thumbfilename'],'intfilename'=>$row['intfilename'],'title'=>$row['title'],'description'=>$row['description'],'albumid'=>$albumid ));
407+ $i++;
408+ }
409+ else echo '<br>'.$row['filename'].' '.__NPG_FORM_NOADD.': '.$row['error'].'<br/><br/>';
410+
411+ }
412+ }
413+ else echo __NPG_FORM_NOPICTSTOADD.'<br/>';
414+ if($i == 0) echo __NPG_FORM_NOPICTSTOADD.'</td></tr></table><br/></div></form>';
415+ else {echo '</td></tr></table><br/>';
416+ if($setorpromo=='sets'){
417+ echo '<input type="hidden" name="promote0" value="yes">'.
418+ 'Enter keywords to promote to your blog(serperate with and):<input type="text" name="promokeywords" value=" " />';
419+ }
420+ echo '<input type="submit" value="'.__NPG_FORM_SUBMITFILES.'"></div></form>';
421+ }
422+
423+}
424+
425+
426+
427+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/functions.php
@@ -0,0 +1,304 @@
1+<?php
2+//support functions for NP_gallery
3+
4+function generateLink($type,$vars = 'date') {
5+ global $manager,$CONF,$NPG_CONF;
6+ $base = 'action.php?action=plugin&amp;name=gallery&amp;type=';
7+ switch($type) {
8+ case 'list':
9+ $extra['sort'] = $vars;
10+ $link = NP_Gallery::makelink('list',$extra);
11+ break;
12+ case 'addAlbumF':
13+ case 'finaldeletepicture':
14+ $link = NP_Gallery::makelink($type);
15+ break;
16+ case 'editAlbumF':
17+ $link = $CONF['PluginURL'].'gallery/index.php?action=album&amp;id='.$vars;
18+ break;
19+ case 'item':
20+ case 'album':
21+ $extra['sort'] = $NPG_CONF['defaultorder'];
22+ $link = NP_Gallery::makelink('album',$extra);
23+ case 'editPictureF':
24+ case 'deletePictureF':
25+ $extra['id'] = $vars;
26+ $link = NP_Gallery::makelink($type,$extra);
27+ break;
28+ case 'addPictF': $link = $CONF['PluginURL'].'gallery/add_picture.php?type=firststage&amp;id='.$vars;
29+ break;
30+ case 'batchaddPictF': $link = $CONF['PluginURL'].'gallery/add_picture.php?type=firststage';
31+ break;
32+ default: //$link = $base.$type;
33+ break;
34+ }
35+ return $link;
36+}
37+
38+
39+function resizeImage($orig_filename, $target_w, $target_h, $target_filename) {
40+ global $NPG_CONF, $DIR_NUCLEUS;
41+
42+ $abs_dir = substr($DIR_NUCLEUS,0,strlen($DIR_NUCLEUS) - 8);
43+
44+ if(!$NPG_CONF) {
45+ $NPG_CONF = getNPGConfig();
46+ echo 'NPG_CONF not defined in resizeImage<br />';
47+ }
48+
49+ if($NPG_CONF['graphics_library'] == 'gd') {
50+
51+ $src_image = imagecreatefromjpeg($abs_dir.$orig_filename);
52+
53+ $old_x=imageSX($src_image);
54+ $old_y=imageSY($src_image);
55+
56+ //return original image if original image is smaller than resized dimensions
57+ if ($old_x <= $target_w && $old_y <= $target_h) return $orig_filename;
58+
59+ //resize
60+ if ($old_x > $old_y) {
61+ $thumb_w=$target_w;
62+ $thumb_h=$old_y*($target_w/$old_x);
63+ if($thumb_h > $target_h) {
64+ $thumb_w=$old_x*($target_h/$old_y);
65+ $thumb_h=$target_h;
66+ }
67+ }
68+ if ($old_x < $old_y) {
69+ $thumb_w=$old_x*($target_h/$old_y);
70+ $thumb_h=$target_h;
71+ if($thumb_w > $target_w) {
72+ $thumb_w=$target_w;
73+ $thumb_h=$old_y*($target_w/$old_x);
74+ }
75+ }
76+ if ($old_x == $old_y) {
77+ if($target_w > $target_h) {
78+ $thumb_w=$old_x*($target_w/$old_y);
79+ $thumb_h=$target_h;
80+ } else {
81+ $thumb_w=$target_w;
82+ $thumb_h=$old_y*($target_h/$old_x);
83+ }
84+ }
85+
86+ $dst_image=ImageCreateTrueColor($thumb_w,$thumb_h);
87+ imagecopyresampled($dst_image,$src_image,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);
88+
89+ if(!imagejpeg($dst_image,$abs_dir.$target_filename,90)) return NULL;
90+
91+ imagedestroy($dst_image);
92+ imagedestroy($src_image);
93+
94+ return $target_filename;
95+
96+ } elseif ($NPG_CONF['graphics_library'] == 'im') {
97+
98+ //code modified from coppermine photo gallery -- only the non-widows portion was tested, the windows portion was added to the coppermine code so that imagemagick would work even if installed in c:/program files
99+ $imgFile = escapeshellarg($abs_dir.$orig_filename);
100+ $output = array();
101+ $target_file_esc = escapeshellarg($abs_dir.$target_filename);
102+
103+ if (eregi("win",$_ENV['OS'])) {
104+ $imgFile = str_replace("'","\"" ,$imgFile );
105+ $cmd = "\"".str_replace("\\","/", $NPG_CONF['im_path'])."convert\" -quality {$NPG_CONF['im_quality']} {$NPG_CONF['im_options']} -resize {$target_w}x{$target_h} ".str_replace("\\","/" ,$imgFile )." ".str_replace("\\","/" ,$target_file_esc );
106+ exec ("\"$cmd\"", $output, $retval);
107+ } else {
108+ $cmd = "{$NPG_CONF['im_path']}convert -quality {$NPG_CONF['im_quality']} {$NPG_CONF['im_options']} -resize {$target_w}x{$target_h} $imgFile $target_file_esc";
109+ exec ($cmd, $output, $retval);
110+ }
111+
112+ //todo: check for errors
113+ return $target_filename;
114+
115+ }
116+ else return false;
117+}
118+
119+
120+function allowedTemplateTags($template) {
121+ switch ($template) {
122+ case 'LIST_HEADER':
123+ case 'LIST_FOOTER':
124+ $tags='Allowed tags: breadcrumb, sortbytitle, sortbydescription, sortbyowner, sortbymodified, '
125+ .'sortbynumber, addalbumlink, addpicturelink. Allowed condition(if) tags: canaddalbum, canaddpicture';
126+ break;
127+ case 'LIST_BODY':
128+ $tags='Allowed tags: albumlink, description, ownername, modified(date format), numberofimages';
129+ break;
130+ case 'ALBUM_HEADER':
131+ case 'ALBUM_FOOTER':
132+ $tags='Allowed tags: breadcrumb, editalbumlink, addpicturelink. Allowed condition(if) tags: caneditalbum, canaddpicture';
133+ break;
134+ case 'ALBUM_BODY':
135+ $tags='Allowed tags: picturelink, thumbnail, picturetitle, centeredtopmargin(height,offset), pictureviews';
136+ break;
137+ case 'ITEM_HEADER':
138+ case 'ITEM_FOOTER':
139+ case 'ITEM_BODY':
140+ $tags='Allowed tags: breadcrumb, nextlink, previouslink, fullsizelink, width, height, intermediatepicture, owner, date(format), editpicturelink, deletepicturelink, tooltips, id. Allowed condition(if) tags: caneditpicture';
141+ break;
142+ default:
143+ break;
144+ }
145+ return $tags;
146+}
147+function getNPGConfig() {
148+ $result = mysql_query('select * from '.sql_table('plug_gallery_config') );
149+ if($result) {
150+ while ($row = mysql_fetch_assoc($result)) {
151+ $npg_config[$row['oname']] = $row['ovalue'];
152+ }
153+ }
154+ return $npg_config;
155+}
156+
157+function setNPGoption($oname, $ovalue) {
158+ $result = mysql_query("select * from ".sql_table('plug_gallery_config')." where oname='$oname'" );
159+ if(@ mysql_num_rows($result)) {
160+ sql_query("update ".sql_table('plug_gallery_config')." set ovalue='$ovalue' where oname='$oname'");
161+ } else {
162+ sql_query("insert into ".sql_table('plug_gallery_config')." values ('$oname', '$ovalue' )");
163+ }
164+}
165+
166+function database_cleanup() {
167+ //check numberofimages for each album
168+ $result = mysql_query("select count(*) as noi, albumid from ".sql_table('plug_gallery_picture')." group by albumid" );
169+ if($result) {
170+ while ($row = mysql_fetch_assoc($result)) {
171+ $result2 = mysql_query("select numberofimages from ".sql_table('plug_gallery_album')." where albumid = ".$row['albumid']);
172+ $row2 = mysql_fetch_assoc($result2);
173+ if($row2['numberofimages'] <> $row['noi']) {
174+ sql_query("update ".sql_table('plug_gallery_album')." set numberofimages={$row['noi']} where albumid = ".$row['albumid']);
175+ }
176+ }
177+ }
178+
179+ //if picture is not in database, either give choice for deleting it or adding it to the database
180+
181+}
182+
183+function rethumb($id=0) {
184+ global $DIR_NUCLEUS,$NPG_CONF;
185+
186+ $abs_dir = $DIR_NUCLEUS.'../';
187+ $abs_dir = substr($DIR_NUCLEUS,0,strlen($DIR_NUCLEUS) - 8);
188+
189+ //redo the thumbnails and intermediate images
190+ if($id) $album = ' where albumid='.$id;
191+ $query = 'select * from '.sql_table('plug_gallery_picture').$album;
192+ $result = sql_query($query);
193+
194+ echo 'Resizing images . . . ';
195+ $timestart = microtime();
196+ while($row=mysql_fetch_object($result)) {
197+ //check if file exists:
198+
199+ if(is_file($abs_dir.$row->filename)) {
200+ //make new thumbnail
201+ if($new_thumb = resizeImage($row->filename, $NPG_CONF['thumbwidth'], $NPG_CONF['thumbheight'], $row->thumb_filename)) {
202+ sql_query('update '.sql_table('plug_gallery_picture').' set thumb_filename=\''.$new_thumb.'\' where pictureid='.$row->pictureid);
203+ }
204+ else echo '<br/>file: '.$abs_dir.$row->thumb_filename.' could not be resized<br/>';
205+ //make new intermediate picture
206+ if($new_thumb = resizeImage($row->filename, $NPG_CONF['maxwidth'], $NPG_CONF['maxheight'], $row->int_filename)) {
207+ sql_query('update '.sql_table('plug_gallery_picture').' set int_filename=\''.$new_thumb.'\' where pictureid='.$row->pictureid);
208+
209+ }
210+ else echo '<br/>file: '.$abs_dir.$row->int_filename.' could not be resized<br/>';
211+ } else echo '<br/>file: '.$abs_dir.$row->filename.' does not exist -- no action taken<br/>';
212+ }
213+ echo 'Done<br/>';
214+ $timeend = microtime();
215+ $diff = number_format(((substr($timeend,0,9)) + (substr($timeend,-10)) - (substr($timestart,0,9)) - (substr($timestart,-10))),4);
216+ echo "Execution time: $diff s <br/>";
217+}
218+function GDisPresent() {
219+ if(function_exists('ImageCreateTrueColor')) return true;
220+}
221+
222+function IMisPresent() {
223+ global $NPG_CONF;
224+
225+ $cmd = "{$NPG_CONF['im_path']}convert -version";
226+ exec ($cmd, $output, $retval);
227+ if($retval == 0) return true;
228+ return false;
229+}
230+
231+function getIMversion() {
232+ global $NPG_CONF;
233+
234+ $cmd = "{$NPG_CONF['im_path']}convert -version";
235+ exec ($cmd, $output, $retval);
236+ if($retval == 0) {
237+ $pieces = explode(" ", $output[0]);
238+ $imversion = $pieces[2];
239+ return $imversion;
240+ }
241+ return false;
242+}
243+
244+function checkgalleryconfig() {
245+ global $NP_BASE_DIR,$NPG_CONF;
246+
247+ $status = array();
248+
249+ if((GDispresent() && $NPG_CONF['graphics_library'] == 'gd') || (IMisPresent() && $NPG_CONF['graphics_library'] == 'im')) {
250+ $status['configured'] = true;
251+ } else {
252+ $status['message'] = 'Graphics engine not configured!<br/>';
253+ }
254+
255+ //check for presence of NPGallery skin
256+ $res = sql_query('select sdname, scontent from '.sql_table('skin_desc').', '.sql_table('skin').' where sdesc=sdnumber and stype="index" and sdname="NPGallery" LIMIT 1');
257+ if(!$res) {
258+ $status['message'] .= 'mysql error checking for NPGallery skin: '.mysql_error().'<br/>';
259+ }
260+ else if(!mysql_num_rows($res)) {
261+ $status['message'] .= 'NPGallery skin was not found<br/>';
262+ }
263+ else {
264+ $row = mysql_fetch_object($res);
265+ $haystack = stripslashes($row->scontent);
266+ $s = stristr($haystack,'<%gallery');
267+ if(!$s) {
268+ $status['message'] .= '<%gallery%> tag not found in NPGallery skin<br/>';
269+ }
270+ }
271+
272+ //check for directory and directory permissions
273+ $mediadir = $NP_BASE_DIR.$NPG_CONF['galleryDir'];
274+ if (!@is_dir($mediadir)) {
275+ $error = 'Gallery directory not found<br/>';
276+ $oldumask = umask(0000);
277+ if (!@mkdir($mediadir, 0777)) {
278+ $error = 'Cannot create gallery directory<br/>';
279+ }
280+ else {
281+ $error = NULL;
282+ umask($oldumask);
283+ }
284+ $status['message'] .= $error;
285+ }
286+ else {
287+ if (!is_writeable($mediadir))
288+ $status['message'] = 'Gallery directory: '.$mediadir.' not writable';
289+ }
290+
291+ if($status['message']) $status['configured'] = false; else $status['configured'] = true;
292+
293+ return $status;
294+
295+}
296+
297+function converttimestamp($d) {
298+ if(strlen($d) > 14) list($year, $month, $day, $hour, $minute, $second) = sscanf($d, "%4u-%2u-%2u %2u:%2u:%2u");
299+ else list($year, $month, $day, $hour, $minute, $second) = sscanf($d, "%4u%2u%2u%2u%2u%2u");
300+ $rd = mktime(intval($hour), intval($minute), intval($second), intval($month), intval($day), intval($year));
301+ return $rd;
302+}
303+
304+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/gallery todo.txt
@@ -0,0 +1,61 @@
1+np_gallery todo:
2+
3+--parents/children, subalbums
4+--include album thumbs as option.
5+--in album, picture sort order
6+--picture script timeout problem - fixed intervals of uploads
7+--picasa import
8+--intermediate image in promo
9+
10+--gallerymakelink
11+--global add album, etc
12+--change default way shadows
13+--documentation
14+--admin tab plugin hook
15+--import/export templates
16+--next and prev thumbnails
17+--thumbnail strip
18+--(P)latest
19+--(P)long descriptions
20+--make install.sql
21+--<%gallery(picture/album, byname)%>
22+--override default popup behavior
23+--display images in resized format for posts
24+--finish internationalization
25+--(P)<%gallery(int/thumb,random)%>
26+--input checking
27+--ticket checking in 3.2
28+--clean up display of upload form
29+
30+
31+done:
32+--change location of add_picture
33+--edit comments
34+--fixed 'more' bug
35+--rethumb by album
36+--pages
37+options: AdminCommentsPerPage, ThumbnailsPerPage
38+--fancy urls
39+--time in edit comments
40+--massupload import
41+
42+done:
43+--absolute paths to pictures
44+--plugin hooks
45+ NPgCollectionDisplay
46+--<%breadcrumb(char)$>
47+--template guillotine bug
48+
49+done:
50+make captcha plugin work
51+<%description%> in album and picture
52+album setting -- comments allowed
53+album setting -- thumbnail image
54+template/form for promo post
55+<%albumthumbnail%>
56+update default template
57+ -- fix extra </div>
58+ -- add stuff for promo post
59+ -- add next/extra
60+ -- add new visual albumlist
61+hooks for tags plugin
--- /dev/null
+++ b/NP_gallery/trunk/gallery/help.html
@@ -0,0 +1,70 @@
1+<h3>Plugin overview</h3>
2+<p>For Version 0.94</p>
3+<p>NP_Gallery provides a nucleus-native integrated photo and image gallery. It is designed to be 'nucleus-like' in its function and usage.</p>
4+
5+<h3><a name="toc" ></a>Table of Contents</h3>
6+<ul>
7+<li><a href="#features">Features</a></li>
8+<li><a href="#links">Important links</a></li>
9+<li><a href="#requirements">Plugin Requirements</a></li>
10+<li><a href="#installtion">Installation</a></li>
11+<li><a href="#skinvars">SkinVars</a></li>
12+<li><a href="#options">Plugin Options</a></li>
13+<li><a href="#configuration">Configuration</li>
14+<li><a href="#templates">Templates</li>
15+<li>Internationalization</li>
16+<li><a href="#version">Version History</li>
17+</ul>
18+
19+<h3><a name="features"></a>Features</h3>
20+<ul>
21+<li>Controllable from Nucleus Admin Area</li>
22+<li>Fully template driven, CSS tableless output</li>
23+<li>Automatic thumbnail creation using GD or Imagemagick</li>
24+<li>Extends nucleus plugin API</li>
25+<li>Compatible with captcha plugin</li>
26+<li>Use keywords to assign pictures to sets, dynamically display the sets on your blog</li>
27+<li>Ability to create 'hover tooltips,' drawing boxes around people and naming them </li>
28+<li>Massupload via FTP - infinite amount </li>
29+<li>Slideshow feature </li>
30+<li>Previous and next thumbnails </li>
31+<li>Album teams, public/private albums </li>
32+<li>album thumbnails per page</li>
33+<li>display dynamic &quot;promotional posts&quot; in your blog. </li>
34+<li>More</li>
35+</ul>
36+
37+<h3><a name="links"></a>Important links</h3>
38+<ul>
39+<li>Newest versions hosted here :<a href="http://www.sircambridge.net/nucleus/index.php?itemid=57">Link </a></li>
40+<li>Versions up to 0.8 can be downloaded from the nucleusplugin sourceforge page: <a href="http://sourceforge.net/projects/nucleusplugs/">link</a></li>
41+<li>Gallery plugin wiki page <a href="http://wakka.xiffy.nl/gallery">link</a></li>
42+<li>Nucleus support forum threads</li>
43+</ul>
44+
45+<h3><a name="requirements"></a>Plugin Requirements</h3>
46+<p>Besides the nucleus requirements of php 4 or greater and mysql 3.58 or greater, NP_Gallery requires either GD v2 or greater or Imagemagick be installed on the server. Additionally, the database user (as set in nucleus' config.php) needs to be able to create temporary tables in mysql.</p>
47+
48+<h3><a name="installation"></a>Installation</h3>
49+<p>NP_Gallery installs as any other plugin in nucleus, but requires some extra steps to be fully functional.</p>
50+<p><strong>First,</strong> clone your current skin and rename it NPGallery. Click on all of the skin parts EXCEPT for 'main index' (ie archive, archive list, etc), delete the contents and click 'update skin'. As 'main index' part is the only skin part used by the plugin, the other parts are superfluous and can be deleted. If you don't want to delete them, they will not interfere with the function of the plugin.</p>
51+<p>Now modify the main index part of NPGallery skin to display the gallery instead of your blog. Do this by replacing your &lt;%blog(default/index,10)%&gt; statement with &lt;%gallery%&gt;. This will make the gallery page look just like your blog page (with the obvious differences) including the right/left menus (if you have them). These can be omitted, or you can make your gallery page look totally different than your blog page. The NPGallery skin is what controls the look. Some skins such as leila do not have this in the skin template, but in some other file that is included, just copy and paste everything from that included file into the skin template and replace blog with gallery. </p>
52+<p><strong>Second,</strong> create your gallery directory and make it writable. By default this directoy is media/gallery, but it can be any directory you want it to be, however if you change from the default directory you will need to change the gallery configuration in the admin area. To make the directory writable, chmod the directory to 0777. Search for one of the many tutorials on the web if you are unsure how to do this. If you want to use massuploads, create an empty directory /upload in your blog root and chmod it to 777. </p>
53+<p><strong>Third,</strong> Create a new blog, and set that blog to use the &quot;NPGallery&quot; skin you created in step 1. </p>
54+<p>Finally, make a link to your gallery somewhere in your main blog page. This is usually something like www.mysite.com/index.php?blogid=2 where the number is whichever blog you created. </p>
55+<p>Some Frequently Asked Questions are answered in <a href="FAQ.html">FAQ.html</a> , such as removing the sidebar and getting the gallery to put thumbnails that will the whole page.
56+
57+<p>Now you can configure your gallery by going to the gallery admin area. This initial configuring is important in getting the gallery to work. </p>
58+
59+<h3><a name="skinvars"></a>SkinVars</h3>
60+<p>Note: These skinvars are intended to be used in general nucleus skins. They are not designed to be used in np_gallery templates.</p>
61+<ul><li><b>Gallery(link)</b>: returns a hyperlink to the gallery album list page. Usage example: &lt;a href=&quot;&lt;%gallery(link)%&gt;&quot;&gt;Gallery&lt;/a&gt;</li>
62+ <li><strong>Gallery(sets,keywords,aesc/desc)</strong>: displays the pictures with keywords &quot;keyword&quot;, supports multiple keywords, seperated with ' and ',aesc/desc for aescending or descending.example &lt;%gallery(sets,pets and girls,desc)%&gt;, will show pictures with the keywords 'pets' and 'girls' in a descending order. </li>
63+<li><b>Gallery</b>: displays the Gallery page (album list, album, picture, etc). It is meant to be used in the NPGallery skin. Usage: &lt;%gallery%&gt;</li></ul>
64+
65+<h3><a name="options"></a>Plugin Options</h3>
66+<p>Most of NP_gallery options are configured on the gallery admin page, but there are some basic options in &quot;edit options&quot; for NP_Gallery in the plugin menu. </p>
67+
68+<h3><a name="configuration"></a>Configuration</h3>
69+
70+<h3><a name="templates"></a></h3>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/include/commentform-loggedin.template
@@ -0,0 +1,20 @@
1+
2+<form method="post" action="<%formdata(actionurl)%>">
3+ <div class="commentform">
4+ <%errordiv%>
5+
6+ <input type="hidden" name="type" value="addcomment" />
7+ <input type="hidden" name="action" value="plugin" />
8+ <input type="hidden" name="name" value="gallery" />
9+ <input type="hidden" name="itemid" value="<%itemid%>" />
10+ <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>:
11+ <br />
12+ <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"><%formdata(body)%></textarea>
13+ <br />
14+ <%text(_COMMENTFORM_YOUARE)%> <%formdata(membername)%>
15+ <small>(<a href="?action=logout"><%text(_LOGOUT)%></a>)</small>
16+ <br />
17+ <input type="submit" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
18+ <%callback(FormExtra,commentform-loggedin)%>
19+ </div>
20+</form>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/include/commentform-notloggedin.template
@@ -0,0 +1,23 @@
1+<form method="post" action="<%formdata(actionurl)%>">
2+ <div class="commentform">
3+
4+ <input type="hidden" name="type" value="addcomment" />
5+ <input type="hidden" name="action" value="plugin" />
6+ <input type="hidden" name="name" value="gallery" />
7+ <input type="hidden" name="itemid" value="<%itemid%>" />
8+ <label for="nucleus_cf_body"><%text(_COMMENTFORM_COMMENT)%></label>:
9+ <br />
10+ <textarea name="body" class="formfield" cols="40" rows="10" id="nucleus_cf_body"></textarea>
11+ <br />
12+ <label for="nucleus_cf_name"><%text(_COMMENTFORM_NAME)%></label>: <input name="user" size="40" maxlength="40" value="<%formdata(user)%>" class="formfield" id="nucleus_cf_name" />
13+ <br />
14+ <label for="nucleus_cf_mail"><%text(_COMMENTFORM_MAIL)%></label>: <input name="userid" size="40" maxlength="60" value="<%formdata(userid)%>" class="formfield" id="nucleus_cf_mail" />
15+
16+ <%callback(FormExtra,commentform-notloggedin)%>
17+ <br/>
18+
19+ <input type="checkbox" value="1" name="remember" id="nucleus_cf_remember" <%formdata(rememberchecked)%> /><label for="nucleus_cf_remember"><%text(_COMMENTFORM_REMEMBER)%></label>
20+ <br />
21+ <input type="submit" value="<%text(_COMMENTFORM_SUBMIT)%>" class="formbutton" />
22+ </div>
23+</form>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/index.php
@@ -0,0 +1,123 @@
1+<?php
2+//NP_gallery admin page
3+
4+ $strRel = '../../../';
5+
6+ include($strRel . 'config.php'); //nucleus config
7+ include('config.php'); //gallery config
8+
9+ if (!$member->isLoggedIn()) doError(_NOTLOGGEDIN);
10+
11+ include($DIR_LIBS . 'PLUGINADMIN.php');
12+
13+ global $galleryaction, $CONF, $NPG_CONF,$gmember,$member;
14+ $galleryaction=$CONF['PluginURL']."gallery/index.php";
15+
16+ //create extra header info for admin page
17+ $gallery_header = '<style type="text/css">
18+
19+ #tabmenu {
20+ color: #000;
21+ border-bottom: 1px solid black;
22+ margin: 12px 0px 0px 0px;
23+ padding: 0px;
24+ z-index: 1;
25+ padding-left: 10px }
26+
27+ #tabmenu li {
28+ display: inline;
29+ overflow: hidden;
30+ list-style-type: none; }
31+
32+ #tabmenu a, a.active {
33+ color: black;
34+ background: white;
35+ font: bold 1em/1em;
36+ border: 1px solid black;
37+ -moz-border-radius-topleft: 5px;
38+ -moz-border-radius-topright: 5px;
39+ padding: 5px 5px 0px 5px;
40+ margin: 0px;
41+ text-decoration: none; }
42+
43+ #tabmenu a.active {
44+ background: white;
45+ border-bottom: 1px solid white; }
46+
47+ #tabmenu a:hover {
48+ color: #596d9d;
49+ background: #F6F6F6; }
50+
51+ #tabmenu a:visited {
52+ color: #596d9d; }
53+
54+ #tabmenu a.active:hover {
55+ background: white;
56+ color: #596d9d; }
57+
58+ #admin_content {font: 0.9em/1.3em "bitstream vera sans", verdana, sans-serif;
59+ text-align: justify;
60+ background: white;
61+ padding: 20px;
62+ border-top: none;
63+ z-index: 2; }
64+
65+ .half {
66+ width: 50%;
67+ }
68+
69+ form p {
70+ clear: left;
71+ margin: 0;
72+ padding: 0;
73+ padding-top: 5px;
74+ }
75+ form p label {
76+ float: left;
77+ width: 300px;
78+ font: bold 1.0em Arial, Helvetica, sans-serif;
79+ }
80+
81+ fieldset {
82+ border: 1px dotted #61B5CF;
83+ margin-top: 16px;
84+ padding: 10px;
85+ }
86+ legend {
87+ font: 1.2em Arial, Helvetica, sans-serif;
88+ }
89+
90+ td.left {
91+ width: 230px;
92+ }
93+
94+ </style>
95+
96+ <SCRIPT>
97+ function openTarget (form, features, windowName) {
98+ if (!windowName)
99+ windowName = \'formTarget\' + (new Date().getTime());
100+ form.target = windowName;
101+ open (\'\', windowName, features);
102+ }
103+</SCRIPT>'
104+
105+ ;
106+
107+ // create the admin area page
108+ $oPluginAdmin = new PluginAdmin('gallery');
109+ $oPluginAdmin->start($gallery_header);
110+
111+ echo '<h2>'.__NPG_ADMIN_TITLE.'</h2>';
112+
113+
114+ $action = requestVar('action');
115+ if(!$action) $action = 'albumlist';
116+ $admin = new NPG_ADMIN();
117+ $admin->action($action);
118+
119+
120+ $oPluginAdmin->end();
121+
122+
123+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_gallery/trunk/gallery/language/english.php
@@ -0,0 +1,209 @@
1+<?php
2+
3+//language file
4+//english NP_Gallery
5+define('__NPG_OPT_DONT_DELETE_TABLES','Delete this plugin\'s table and data when uninstalling?');
6+define('__NPG_BREADCRUMB_GALLERY','Gallery');
7+
8+//special collections:
9+define('__NPG_COLL_MOSTVIEWED','Most Viewed');
10+
11+//errors:
12+define('__NPG_ERR_GALLLERY_NOT_CONFIG','The Gallery hasn\'t been configured.');
13+define('__NPG_ERR_BAD_TEMPLATE','Bad template name');
14+define('__NPG_ERR_NO_UPD_TEMPLATE','There was a problem updating the template');
15+define('__NPG_ERR_BAD_FUNCTION','Function not defined');
16+define('__NPG_ERR_NOT_ADMIN','Need to be administrator to perform this function');
17+define('__NPG_ERR_ALBUM_UPDATE','Album was NOT updated');
18+define('__NPG_ERR_TEAM_UPDATE','Album team was NOT updated');
19+define('__NPG_ERR_DA_MOVE_PICTURE','No permission to move files -- album will not be deleted');
20+define('__NPG_ERR_NOSUCHTHING','Requested item does not exist');
21+
22+//admin page:
23+//tabs:
24+define('__NPG_ADMIN_TITLE','Gallery Admin Page');
25+define('__NPG_ADMIN_TAB_ALBUMS','Albums');
26+define('__NPG_ADMIN_TAB_COMMENTS','Comments');
27+define('__NPG_ADMIN_TAB_CONFIG','Configuration');
28+define('__NPG_ADMIN_TAB_USERS','Gallery Users');
29+define('__NPG_ADMIN_TAB_TEMPLATES','Templates');
30+define('__NPG_ADMIN_TAB_ADMIN','Admin Functions');
31+
32+//comments tab
33+define('__NPG_ADMIN_NO_DEL_PERMISSION','You don\'t have permission to delete this comment');
34+define('__NPG_ADMIN_NO_COMMENT','No such comment');
35+define('__NPG_ADMIN_NOTDELETED','Comment not deleted');
36+define('__NPG_ADMIN_DELETED','Comment deleted');
37+define('__NPG_PAGE','Page');
38+
39+
40+//configuration tab
41+define('__NPG_ADMIN_GEN_OPTIONS','General Options');
42+define('__NPG_ADMIN_ADD_LEVEL','Add Album permission level');
43+define('__NPG_ADMIN_ONLY_ADMIN','Only super-admin');
44+define('__NPG_ADMIN_ONLY_REGUSERS','All registered users');
45+define('__NPG_ADMIN_ANYONE','Anyone');
46+define('__NPG_ADMIN_SELECTEDUSERS','Only selected users');
47+define('__NPG_ADMIN_NOSELECT','None currently selected. To add select users under Gallery Users tab');
48+define('__NPG_ADMIN_PROMOBLOG','Promotion category/blog');
49+define('__NPG_ADMIN_NOPROMO','None');
50+define('__NPG_ADMIN_ACTIVETEMPLATE','Active template');
51+define('__NPG_ADMIN_VIEWTIME','Minutes between unique views');
52+define('__NPG_ADMIN_BATCH_SLOTS','Number of batch upload slots');
53+define('__NPG_ADMIN_IMAGE_DIR','Image Directory (must *not* end in /)');
54+define('__NPG_ADMIN_MAX_INT_DIM','Max Intermediate picture dimensions (h x w)');
55+define('__NPG_ADMIN_THUMB_DIM','Thumbnail dimensions (h x w)');
56+define('__NPG_ADMIN_COMMENTSPERPAGE','Number of comments per page (in admin area)');
57+define('__NPG_ADMIN_THUMBSPERPAGE','Number of thumbnails per page (album view)');
58+
59+define('__NPG_ADMIN_GRAPHICS_OPTIONS','Graphics Options');
60+define('__NPG_ADMIN_GRAPHICS_ENGINE','Graphics engine');
61+define('__NPG_ADMIN_GD_INSTALLED','GD installed with support for true color images');
62+define('__NPG_ADMIN_GD_NOT_INSTALLED','GD not installed or installed without support for true color images');
63+define('__NPG_ADMIN_IM_INSTALLED','IM installed, base path correct');
64+define('__NPG_ADMIN_IM_NOT_INSTALLED','ImageMagick not installed, or base path is incorrect');
65+define('__NPG_ADMIN_IM_PATH','ImageMagick path (must end in a /)');
66+define('__NPG_ADMIN_IM_OPTIONS','ImageMagick options');
67+define('__NPG_ADMIN_IM_QUALITY','ImageMagick jpg quality');
68+
69+//select user tab
70+define('__NPG_ADMIN_PERMITTED_USERS','Users with permission to add albums');
71+define('__NPG_ADMIN_REMOVE_SELECT_USER','Remove from permitted list');
72+define('__NPG_ADMIN_GIVE_ADD_PERM','Give add album permission');
73+define('__NPG_ADMIN_ADD_TO_LIST','Add to list');
74+
75+//admin functions tab
76+define('__NPG_ADMIN_ADMIN_FUNCTIONS','Admin Functions');
77+define('__NPG_ADMIN_CLEANUP','Cleanup');
78+define('__NPG_ADMIN_CLEANUP_DESC','Make number of images in albums consistent with what\'s in the database');
79+define('__NPG_ADMIN_RETHUMB','Rethumb');
80+define('__NPG_ADMIN_RETHUMB_DESC','Resize all thumbnails and intermediate pictures');
81+define('__NPG_ADMIN_ALLALBUMS','All Albums');
82+define('__NPG_ADMIN_RETURN','Return to Album List');
83+define('__NPG_ADMIN_UPDATE_TEMPLATE','Template updated successfully');
84+define('__NPG_ADMIN_SUCCESS_CLEANUP','Database cleanedup');
85+
86+
87+//album tab
88+define('__NPG_ERR_NO_ALBUMS','You don\'t have any albums to list');
89+define('__NPG_ADMIN_SUCCESS_ALBUM_UPDATE','Album updated');
90+define('__NPG_ADMIN_SUCCESS_TEAM_UPDATE','Album team updated');
91+define('__NPG_ADMIN_MASSUPLOAD','Upload files');
92+define('__NPG_ADMIN_NEWALBUM','New Album');
93+define('__NPG_ADMIN_MASSUPLOAD_DESC','Add all files in upload/ directory to specified album');
94+
95+//comments tab
96+define('__NPG_ADMIN_COMMENTS', 'User Comments');
97+define('__NPG_COMMENT', 'Comment');
98+define('__NPG_AUTHOR', 'Author');
99+define('__NPG_TIME', 'Time');
100+define('__NPG_PICTUREID','Picture');
101+
102+
103+//templates tab
104+define('__NPG_ADMIN_TEMPLATES','Templates');
105+
106+
107+//forms
108+
109+//add album form
110+define('__NPG_FORM_ADDALBUM', 'Add Album Form');
111+define('__NPG_FORM_ALBUM_TITLE','Album Title');
112+define('__NPG_FORM_ALBUM_DESC','Description');
113+define('__NPG_FORM_SUBMITALBUM','Add Album');
114+
115+//edit picture form
116+define('__NPG_FORM_EDITPICTURE','Edit Picture Form');
117+define('__NPG_FORM_PICTURETITLE','Picture Title');
118+define('__NPG_FORM_PICTUREDESCRIPTION','Picture Description');
119+define('__NPG_FORM_MOVETOALBUM','Move to Album');
120+define('__NPG_FORM_NOPICTOEDIT','No picture to edit');
121+
122+//delete picture form
123+define('__NPG_FORM_REALLYDELETE','Do you really want to delete this picture? Press cancel to go back');
124+define('__NPG_FORM_DELETEPICTURETEXT','Press Delete to delete this picture from the database. The picture will also be deleted from the disk.');
125+define('__NPG_FORM_DELETEPROMOTOO','Delete promotional blog posts as well?');
126+define('__NPG_FORM_NOPICTTODELETE','No picture to delete');
127+
128+//add picture form
129+define('__NPG_FORM_UPLOADFILEFORM','Upload File Form');
130+define('__NPG_FORM_PICTURELABLE','Picture ');
131+define('__NPG_FORM_SUBMITFILES','Submit Files');
132+define('__NPG_FORM_ADDTOALBUM','Add to Album');
133+define('__NPG_FORM_NOADD','will not be added due to ');
134+define('__NPG_FORM_NOPICTSTOADD','No pictures to add');
135+define('__NPG_FORM_PROMOTE','Add New Picture Post');
136+
137+//general form
138+define('__NPG_FORM_SUBMIT_CHANGES','Submit changes');
139+define('__NPG_FORM_USER','User');
140+define('__NPG_FORM_NAME','Name');
141+define('__NPG_FORM_TITLE','Title');
142+define('__NPG_FORM_DESC','Description');
143+define('__NPG_FORM_YES','Yes');
144+define('__NPG_FORM_ACTIONS','Actions');
145+define('__NPG_FORM_IMAGES', 'Images');
146+define('__NPG_FORM_OWNER','Owner');
147+define('__NPG_FORM_SETTINGS','Settings');
148+define('__NPG_FORM_DELETE','Delete');
149+define('__NPG_FORM_CLONE','Clone');
150+define('__NPG_FORM_EDIT','Edit');
151+
152+//template
153+define('__NPG_FORM_EDIT_TEMPLATE','Edit Template');
154+define('__NPG_FORM_TEMPLATE_NAME','Template Name');
155+define('__NPG_FORM_TEMPLATE_DESC','Template Description');
156+define('__NPG_FORM_TEMPLATE_SETTINGS','Template Settings');
157+define('__NPG_FORM_NEWTEMPLATE','New Template');
158+define('__NPG_FORM_TEMPLATE_LIST','Gallery List');
159+define('__NPG_FORM_TEMPLATE_ALBUM','Album');
160+define('__NPG_FORM_TEMPLATE_PICTURE','Picture');
161+define('__NPG_FORM_TEMPLATE_COMMENTS','Comments');
162+define('__NPG_FORM_TEMPLATE_HEADER','Header');
163+define('__NPG_FORM_TEMPLATE_BODY','Body');
164+define('__NPG_FORM_TEMPLATE_FOOTER','Footer');
165+define('__NPG_FORM_TEMPLATE_PROMO','Promo post template');
166+define('__NPG_FORM_TEMPLATE_PROMOIMAGES','Promo images');
167+define('__NPG_FORM_CREATENEWTEMPLATE','Create new template');
168+
169+//delete album form
170+define('__NPG_FORM_DELETE_ALBUM','Delete Album');
171+define('__NPG_FORM_REALLY_DELETE_ALBUM','Do you really want to delete this album? Press cancel to return to album list');
172+define('__NPG_FORM_CANCEL','Cancel');
173+define('__NPG_FORM_DELETE_OR_MOVE','You can delete all the pictures, or move them to another album (if you have permissions to do so). Double check that the following option is set accordingly. If you only have an option to delete, you do not have add permission for any other album.');
174+define('__NPG_FORM_DELETE_PICTURES','Delete album pictures');
175+
176+//edit album form
177+define('__NPG_FORM_MODIFY_ALBUM','Edit Album');
178+define('__NPG_FORM_RETURN_ADMIN','Return to Album List');
179+define('__NPG_FORM_NO_OWNER_ACTIONS','No actions for owner');
180+define('__NPG_FORM_YES','Yes');
181+define('__NPG_FORM_NO','No');
182+define('__NPG_FORM_TOGGLE_ADMIN','Toggle Admin');
183+define('__NPG_FORM_ADDTEAMMEMBER','Add Team Member');
184+define('__NPG_FORM_CHOOSEMEMBER','Choose Member');
185+define('__NPG_FORM_ADMIN_PRIV','Admin Privileges?');
186+define('__NPG_FORM_ADDTOTEAM','Add to team');
187+define('__NPG_FORM_COMMENTSALLOWED','Comments Allowed');
188+define('__NPG_FORM_ALBUM_THUMBNAIL','Album Thumbnail');
189+define('__NPG_FORM_CURRENT_ALBUM_TEAM','Current Album Team');
190+define('__NPG_FORM_ALBUM_ADMIN','Album Admininistrator');
191+
192+//picture comments
193+define('__NPG_NO_COMMENTS','No comments for this picture');
194+
195+//promo post
196+define('__NPG_PROMO_FORM_CANCEL','Cancel Promo Post');
197+define('__NPG_PROMO_FORM_TITLE','Title');
198+define('__NPG_PROMO_FORM_BODY','Body');
199+define('__NPG_PROMO_FORM_SUBMIT','Submit Promo Post');
200+define('__NPG_PROMO_FORM_SUCCESS','Post added successfully');
201+define('__NPG_PROMO_FORM_CLOSE','Close this window');
202+
203+//add new album -- massupload
204+define('__NPG_FORM_MASSUPLOAD_NEWALBUM','Enter the title and description for the new album. Pressing submit will add the new album and add all pictures in the upload folder. Press back to cancel');
205+define('__NPG_FORM_MASSUPLOAD_CONFIRM','Click Submit to add all pictures in the upload folder to the gallery');
206+define('__NPG_FORM_MASSUPLOAD_SUBMIT','Submit');
207+
208+?>
209+
--- /dev/null
+++ b/NP_gallery/trunk/gallery/list_class.php
@@ -0,0 +1,199 @@
1+<?php
2+
3+class GALLERY_LIST {
4+
5+ var $template;
6+
7+ function GALLERY_LIST() {}
8+
9+ function settemplate($template) {
10+ $this->template = & $template;
11+ }
12+
13+ function display($sortorder) {
14+ global $gmember;
15+ global $NPG_CONF;
16+
17+ if(!$NPG_CONF['template']) $NPG_CONF['template'] = 1;
18+
19+ $this->template = & new NPG_TEMPLATE($NPG_CONF['template']);
20+ //$this->template->readall();
21+
22+ $template_header = $this->template->section['LIST_HEADER'];
23+ if($NPG_CONF['thumborlist']=='list')$template_body = $this->template->section['LIST_BODY'];
24+ if($NPG_CONF['thumborlist']=='thumb')$template_body = $this->template->section['LIST_THUM'];
25+
26+ $template_footer = $this->template->section['LIST_FOOTER'];
27+
28+ $actions = new LIST_ACTIONS();
29+ $parser = new PARSER($actions->getdefinedActions(),$actions);
30+ $actions->setparser($parser);
31+
32+ //header
33+ $parser->parse($template_header);
34+
35+ //body
36+ switch($sortorder){
37+ case 'title': $so = ' order by title ASC, albumid DESC'; break;
38+ case 'desc': $so = ' order by description ASC, albumid DESC'; break;
39+ case 'owner': $so = ' order by ownername ASC, albumid DESC'; break;
40+ case 'date': $so = ' order by modified DESC, albumid DESC'; break;
41+ case 'numb': $so = ' order by numberofimages DESC, albumid DESC'; break;
42+
43+ case 'titlea': $so = ' order by title DESC, albumid DESC'; break;
44+ case 'desca': $so = ' order by description DESC, albumid DESC'; break;
45+ case 'ownera': $so = ' order by ownername DESC, albumid DESC'; break;
46+ case 'datea': $so = ' order by modified ASC, albumid DESC'; break;
47+ case 'numba': $so = ' order by numberofimages ASC, albumid DESC'; break;
48+ default : $so =''; break;
49+ }
50+
51+ $query = "select a.*, b.mname as ownername from ".sql_table('plug_gallery_album').' as a left join '.sql_table('member').' as b on a.ownerid=b.mnumber '.$so;
52+ $result = mysql_query($query);
53+ $albums = $gmember->getallowedalbums();
54+ $albumids = $gmember->getAllowedAlbumsids();
55+
56+ while ($row = mysql_fetch_object($result)) {
57+ if(!$row->ownername) $row->ownername = 'guest';
58+ $actions->setCurrentRow($row);
59+ //if its public, show it
60+ //echo $row->albumid;
61+ if($row->publicalbum){
62+ $parser->parse($template_body);
63+ }
64+ //if its not public, check if its in the array of allowed albums for this member
65+ elseif(@in_array($row->albumid,$albumids) ){
66+ $parser->parse($template_body);
67+ }
68+ }
69+
70+ //footer
71+ $parser->parse($template_footer);
72+ } //end of display function
73+
74+
75+} //end of list class
76+
77+class LIST_ACTIONS extends BaseActions {
78+ var $CurrentRow; //query object
79+ var $parser;
80+
81+
82+ function LIST_ACTIONS() {
83+ $this->BaseActions();
84+
85+ }
86+
87+ function getdefinedActions() {
88+ return array(
89+ 'breadcrumb',
90+ 'sortbytitle',
91+ 'sortbydescription',
92+ 'sortbyowner',
93+ 'sortbymodified',
94+ 'sortbynumber',
95+ 'albumlink',
96+ 'albumthumbnail',
97+ 'centeredtopmargin',
98+ 'title',
99+ 'description',
100+ 'ownerid',
101+ 'ownername',
102+ 'modified',
103+ 'numberofimages',
104+ 'addalbumlink',
105+ 'addpictureslink',
106+ 'if',
107+ 'else',
108+ 'endif' );
109+
110+ }
111+
112+ function setParser(&$parser) {$this->parser =& $parser; }
113+ function setCurrentRow(&$currentrow) { $this->CurrentRow =& $currentrow; }
114+
115+ function parse_breadcrumb() {
116+ //$breadcrumb = getBreadcrumb(); echo $breadcrumb;
117+ echo __NPG_BREADCRUMB_GALLERY;
118+ }
119+ function parse_sortbytitle() {
120+ $so = requestvar('sort');
121+ if($so == 'title') $so = 'titlea'; else $so = 'title';
122+ echo generateLink('list', $so);
123+ }
124+ function parse_sortbydescription() {
125+ $so = requestvar('sort');
126+ if($so == 'desc') $so = 'desca'; else $so = 'desc';
127+ echo generateLink('list', $so);
128+ }
129+ function parse_sortbyowner() {
130+ $so = requestvar('sort');
131+ if($so == 'owner') $so = 'ownera'; else $so = 'owner';
132+ echo generateLink('list', $so);
133+ }
134+ function parse_sortbymodified() {
135+ $so = requestvar('sort');
136+ if($so == 'date') $so = 'datea'; else $so = 'date';
137+ echo generateLink('list', $so);
138+ }
139+ function parse_sortbynumber() {
140+ $so = requestvar('sort');
141+ if($so == 'numb') $so = 'numba'; else $so = 'numb';
142+ echo generateLink('list', $so);
143+ }
144+
145+ function parse_albumthumbnail() {
146+ global $CONF;
147+ echo $CONF['IndexURL'].$this->CurrentRow->thumbnail; }
148+ function parse_centeredtopmargin($height,$adjustment) {
149+ global $NP_BASE_DIR;
150+ $image_size = getimagesize($NP_BASE_DIR.$this->CurrentRow->thumbnail);
151+ $topmargin = ((intval($height) - intval($image_size[1])) / 2) + intval($adjustment);
152+ echo 'margin-top: '.$topmargin.'px;';
153+ }
154+
155+ function parse_albumlink() {
156+ echo generateLink('album', $this->CurrentRow->albumid);
157+ }
158+ function parse_title() {echo $this->CurrentRow->title; }
159+ function parse_description() {echo $this->CurrentRow->description; }
160+ function parse_ownerid() {echo $this->CurrentRow->ownerid; }
161+ function parse_ownername() {echo $this->CurrentRow->ownername; }
162+ function parse_modified($format = 'M j, h:i',$arg1 ='',$arg2='',$arg3='') {
163+ if($arg1) $arg1 = ','.$arg1;
164+ if($arg2) $arg2 = ','.$arg2;
165+ if($arg3) $arg3 = ','.$arg3;
166+ $format = $format . $arg1 . $arg2 . $arg3;
167+ $d = $this->CurrentRow->modified;
168+ $d = converttimestamp($d);
169+ $d = date($format,$d);
170+ echo $d;
171+ }
172+ function parse_numberofimages() {echo $this->CurrentRow->numberofimages; }
173+
174+ function parse_addalbumlink() {$aa = generateLink('addAlbumF'); echo $aa;}
175+ function parse_addpictureslink() {$ap = generateLink('batchaddPictF'); echo $ap;}
176+
177+
178+ function parse_if($field, $name='', $value = '') {
179+ global $gmember;
180+
181+ $condition = 0;
182+ switch ($field) {
183+ case 'canaddpicture':
184+ $condition = $gmember->canAddPicture();
185+ break;
186+ case 'canaddalbum':
187+ $condition = $gmember->canAddAlbum();
188+ break;
189+ default:
190+ break;
191+ }
192+
193+ $this->_addIfCondition($condition);
194+
195+ }
196+
197+
198+}
199+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/member_class.php
@@ -0,0 +1,166 @@
1+<?php
2+//gallery member class
3+
4+class GALLERY_MEMBER extends MEMBER {
5+
6+ function makeguest() {
7+ $this->id = 0;
8+ $this->realname = 'guest';
9+ $this->displayname = 'guest';
10+ }
11+
12+ function canAddAlbum() {
13+ global $NPG_CONF;
14+
15+ if ($this->isAdmin()) return true;
16+
17+ //depends on setting of $NPG_CONF['add_album']
18+ if ($NPG_CONF['add_album'] == 'guest' ) return true;
19+ if ($NPG_CONF['add_album'] == 'member' && $this->isloggedin() ) return true;
20+ if ($NPG_CONF['add_album'] == 'select') {
21+ $result = mysql_query('select addalbum from '.sql_table('plug_gallery_member').' where memberid='.$this->getID() );
22+ if(!$result) return false;
23+ $row = mysql_fetch_assoc($result);
24+ if($row['addalbum']) return true;
25+ }
26+
27+ //the default:
28+ return false;
29+
30+ }
31+ function canAddPicture($albumid=0) {
32+
33+ //super-admin
34+ if ($this->isAdmin()) return true;
35+
36+ //if no album specified (ie albumid = 0), then look if user is member or owner of any albums
37+ if(!$albumid) {
38+ $aa = $this->getAllowedAlbums();
39+ if($aa) return true; else return false;
40+ }
41+
42+ //album owner or guest/public album
43+ $result = mysql_query('select ownerid from '.sql_table('plug_gallery_album').' where albumid='.$albumid);
44+ if(!$result) return false;
45+ $row = mysql_fetch_assoc($result);
46+ if($row['ownerid'] == $this->getID() || $row['ownerid']==0) return true;
47+
48+ //album team member
49+ $result = mysql_query('select tmemberid from '.sql_table('plug_gallery_album_team').' where talbumid='.$albumid);
50+ if(!$result) return false;
51+ while($row = mysql_fetch_assoc($result)) {
52+ if($this->getID() == $row['tmemberid']) return true;
53+ }
54+
55+ }
56+ function canModifyAlbum($albumid) {
57+
58+ //super-admin
59+ if ($this->isAdmin()) return true;
60+
61+ //album owner except for public/guest albums -- only admin can modify those
62+ $result = mysql_query('select ownerid from '.sql_table('plug_gallery_album').' where albumid <> 0 and albumid='.$albumid);
63+ if(!$result) return false;
64+ $row = mysql_fetch_assoc($result);
65+ if($row['ownerid'] == $this->getID()) return true;
66+
67+ //album admin (from team)
68+ $result = mysql_query('select tmemberid, tadmin from '.sql_table('plug_gallery_album_team').' where talbumid='.$albumid);
69+ if(!$result) return false;
70+ while($row = mysql_fetch_assoc($result)) {
71+ if($this->getID() == $row['tmemberid'] || $row['tadmin']) return true;
72+ }
73+
74+ }
75+ function canModifyPicture($pictureid) {
76+
77+ //super-admin
78+ if ($this->isAdmin()) return true;
79+
80+ //picture owner
81+ $result = mysql_query('select ownerid from '.sql_table('plug_gallery_picture').' where pictureid='.$pictureid);
82+ if(!$result) return false;
83+ $row = mysql_fetch_assoc($result);
84+ if($row['ownerid'] == $this->getID()) return true;
85+
86+ //album owner, but not guest
87+ $result = mysql_query('select a.ownerid from '.sql_table('plug_gallery_album').' as a, '.sql_table('plug_gallery_picture').' as p where a.albumid=p.albumid and p.pictureid='.$pictureid);
88+ if(!$result) return false;
89+ $row = mysql_fetch_assoc($result);
90+ if($row['ownerid'] == $this->getID() && $this->getID() <> 0) return true;
91+
92+ //album admin (from team)
93+
94+ }
95+
96+ function canModifyComment($commentid) {
97+
98+ //super-admin
99+ if ($this->isAdmin()) {
100+ $result = sql_query('select cmemberid from '. sql_table('plug_gallery_comment'). ' where commentid = '.$commentid);
101+ if (mysql_num_rows($result)) return true; else return false;
102+ }
103+
104+ //comment ovnwer
105+ $result = sql_query('select cmemberid from '. sql_table('plug_gallery_comment'). ' where commentid = '.$commentid);
106+ $row = mysql_fetch_assoc($result);
107+ if($row['cmemberid'] == $this->getID()) return true;
108+
109+ }
110+
111+ function getAllowedAlbums() {
112+ $allowed_albums = array();
113+
114+ $memberid = $this->getID();
115+ if(!$memberid) $memberid=0; //guest
116+
117+ if($this->isadmin()) {
118+ $query = "select *, title as albumname from ".sql_table('plug_gallery_album')
119+ .' left join '.sql_table('member').' on ownerid=mnumber';
120+ } else {
121+ $query = "select *, title as albumname from ".sql_table('plug_gallery_album')
122+ .' left join '.sql_table('plug_gallery_album_team').' on albumid=talbumid'
123+ .' left join '.sql_table('member').' on ownerid=mnumber'
124+ ." where tmemberid=$memberid or ownerid=$memberid or ownerid=0";
125+ }
126+
127+ $result = mysql_query($query);
128+ if(!$result) echo mysql_error().'<br/>';
129+ if(@ !mysql_num_rows($result)) return false;
130+ while ($row = mysql_fetch_object($result)) {
131+ if($row->mnumber==0) $row->mname='guest';
132+ array_push($allowed_albums, $row);
133+ }
134+
135+ return $allowed_albums;
136+ }
137+ function getAllowedAlbumsids() {
138+ $allowed_albums = array();
139+
140+ $memberid = $this->getID();
141+ if(!$memberid) $memberid=0; //guest
142+
143+ if($this->isadmin()) {
144+ $query = "select *, title as albumname from ".sql_table('plug_gallery_album')
145+ .' left join '.sql_table('member').' on ownerid=mnumber';
146+ } else {
147+ $query = "select *, title as albumname from ".sql_table('plug_gallery_album')
148+ .' left join '.sql_table('plug_gallery_album_team').' on albumid=talbumid'
149+ .' left join '.sql_table('member').' on ownerid=mnumber'
150+ ." where tmemberid=$memberid or ownerid=$memberid or ownerid=0";
151+ }
152+
153+ $result = mysql_query($query);
154+ if(!$result) echo mysql_error().'<br/>';
155+ if(@ !mysql_num_rows($result)) return false;
156+ while ($row = mysql_fetch_object($result)) {
157+ if($row->mnumber==0) $row->mname='guest';
158+ array_push($allowed_albums, $row->albumid);
159+
160+ }
161+
162+ return $allowed_albums;
163+ }
164+
165+}
166+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/picture_class.php
@@ -0,0 +1,811 @@
1+<?php
2+
3+
4+class PICTURE {
5+ var $id;
6+ var $title;
7+ var $description;
8+ var $ownerid;
9+ var $modified;
10+ var $albumid;
11+ var $filename;
12+ var $int_filename;
13+ var $thumb_filename;
14+ var $views;
15+ var $keywords;
16+
17+ var $next;
18+ var $previous;
19+
20+ var $template;
21+ var $query;
22+ var $albumtitle;
23+ var $previousthumbfilename;
24+ var $nextthumbfilename;
25+
26+ function PICTURE($id) {
27+ global $member;
28+
29+ if($id) {
30+ $data = $this->get_data($id);
31+
32+ $this->id = $data->pictureid;
33+ $this->title = $data->title;
34+ $this->description = $data->description;
35+ $this->ownerid = $data->ownerid;
36+ $this->ownername = $data->mname;
37+ $this->modified = $data->modified;
38+ $this->albumid = $data->albumid;
39+ $this->filename = $data->filename;
40+ $this->int_filename = $data->int_filename;
41+ $this->thumb_filename = $data->thumb_filename;
42+ $this->views = $data->views;
43+ $this->albumtitle = $data->albumtitle;
44+ $this->keywords = $data->keywords;
45+ }
46+ else {
47+ $this->id = 0;
48+ $this->ownerid = $member->getID();
49+ }
50+ }
51+
52+ function settemplate($template) {
53+ $this->template = & $template;
54+ }
55+
56+ function write() {
57+ //not present so add new to database
58+ if(!$this->id) {
59+ $this->title = stripslashes($this->title);
60+ $this->title = addslashes($this->title);
61+ $this->description = stripslashes($this->description);
62+ $this->description = addslashes($this->description);
63+ sql_query("insert into ".sql_table('plug_gallery_picture')
64+ ." values (NULL, '{$this->title}' , '{$this->description}' , {$this->ownerid} , "
65+ ."NULL , {$this->albumid} , '{$this->filename}' , '{$this->int_filename}' , '{$this->thumb_filename}', '{$this->keywords}' )" );
66+
67+ //picture id of most recently added -- could be referenced by calling fuction (or PICTURE->getID()
68+ $this->id = mysql_insert_id();
69+
70+ //increment album number of images -- consider rewrite as an album method that actually counts number of images?
71+ sql_query("update ".sql_table('plug_gallery_album')." set numberofimages = numberofimages + 1 where albumid = {$this->albumid}");
72+ }
73+ //present, so just update values
74+ else {
75+ $this->title = stripslashes($this->title);
76+ $this->title = addslashes($this->title);
77+ $this->description = stripslashes($this->description);
78+ $this->description = addslashes($this->description);
79+ sql_query("update ".sql_table('plug_gallery_picture')
80+ ." set title='{$this->title}', "
81+ ."description='{$this->description}', "
82+ ."keywords='{$this->keywords}',"
83+ ."albumid={$this->albumid} "
84+ ."where pictureid={$this->id}" );
85+ }
86+
87+ }
88+
89+ function get_data($id) {
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=$id" );
91+ if(mysql_num_rows($result)) {
92+ if(mysql_num_rows($result)){
93+ $data = mysql_fetch_object($result);
94+ if(!$data->mname) $data->mname = 'guest';
95+
96+ //get number of views
97+ $res = sql_query('select views from '.sql_table('plug_gallery_views').' where vpictureid = '.$data->pictureid);
98+ if(mysql_num_rows($res)) {
99+ $row = mysql_fetch_object($res);
100+ $data->views = $row->views;
101+ }
102+ else $data->views = 0;
103+
104+ //get albumtitle for breadcrumb
105+ $res = sql_query('select title from '.sql_table('plug_gallery_album').' where albumid='.$data->albumid);
106+ if(mysql_num_rows($res)) {
107+ $row = mysql_fetch_object($res);
108+ $data->albumtitle = $row->title;
109+ }
110+ else $data->albumtitle = 'No Album Title';
111+ }
112+ else $data->pictureid = 0;
113+ }
114+ //else die('mysql error in picture::getdata -- '.mysql_error());
115+
116+ return $data;
117+ }
118+
119+
120+ function add_new($albumid, $filename, $title, $description, $intfilename, $thumbfilename,$keywords) {
121+
122+ global $NPG_CONF, $gmember;
123+
124+ //need to validate data -- if okay, then add, if not delete files and display error
125+ if(!$albumid) die('Error: albumid is blank');
126+
127+ //put picture data into database
128+ $this->title = $title;
129+ $this->filename = $filename;
130+ $this->int_filename = $intfilename;
131+ $this->thumb_filename = $thumbfilename;
132+ $this->keywords = $keywords;
133+ $this->description = $description;
134+ $this->ownerid = $gmember->getID();
135+ $this->albumid = $albumid;
136+ $this->id = 0; //this will be changed by the write method to the id of the picture
137+
138+ $this->write();
139+
140+ //return id of picture added -- set during $this->write() method to the id of the picture just added.
141+ return $this->id;
142+
143+ }
144+
145+ function setTitle($title) {$this->title = $title;}
146+ function setDescription($description) {$this->description = $description;}
147+ function setAlbumID($id) { if($id) $this->albumid = $id;}
148+ function setalbumtitle($title) {$this->albumtitle = $title;}
149+ function setkeywords($keywords){$this->keywords = $keywords;}
150+
151+ function setqueryold($query ='') {
152+ $pid = requestVar('id');
153+ global $manager;
154+ $defaultorder = $NPG_CONF['defaultorder'];
155+ $sorting = array('title'=>'title',
156+ 'desc'=>'description',
157+ 'owner'=>'ownername',
158+ 'date'=>'modified',
159+ 'titlea'=>'title',
160+ 'desca'=>'description',
161+ 'ownera'=>'ownername',
162+ 'datea'=>'modified',
163+ 'filenamea'=>'filename',
164+ 'filename'=>'filename');
165+ $sortingascdesc = array('title'=>'ASC',
166+ 'desc'=>'ASC',
167+ 'owner'=>'ASC',
168+ 'date'=>'DESC',
169+ 'titlea'=>'DESC',
170+ 'desca'=>'DESC',
171+ 'ownera'=>'DESC',
172+ 'datea'=>'ASC',
173+ 'filenamea'=>'ASC',
174+ 'filename'=>'DESC');
175+ if ($sortingascdesc[$sort]=='ASC'){$oppositeorder = 'DESC';}
176+ if ($sortingascdesc[$sort]=='DESC'){$oppositeorder = 'ASC';};
177+ $sort = requestVar('sort');
178+ if($sort){
179+ $so = 'order by '.$sorting[$sort].', pictureid DESC';
180+ }
181+ else {
182+ $so = 'order by '.$sorting[$defaultorder].', pictureid DESC';
183+ }
184+ if(!$query) $this->query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid='.$this->albumid.$so;
185+ else $this->query = $query;
186+
187+ //sql_query('create temporary table temptableview (tempid int unsigned not null auto_increment primary key) '.$this->query);
188+
189+ //$result = sql_query('select tempid from temptableview where pictureid='.$this->id);
190+ //$tid = mysql_fetch_object($result);
191+
192+
193+
194+
195+ //next thumb
196+ $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where pictureid > '.$pid.' '.$so.' '.$sortingascdesc[$sort].' and albumid = '.$this->albumid.' limit 0,1';
197+ echo $query;
198+ $result = sql_query($query);
199+ if(!mysql_num_rows($result))
200+ $this->next = 0;
201+ else {
202+ $row = mysql_fetch_object($result);
203+ $this->nextthumbfilename = $row->thumb_filename;
204+ $this->nextid = $row->pictureid;
205+ }
206+ //previous thumb
207+ $result = sql_query('select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where pictureid < '.$pid.' '.$so.' '.$oppositeorder.' and albumid = '.$albumid.' limit 0,1');
208+ if(!mysql_num_rows($result))
209+ $this->previous = 0;
210+ else {
211+ $row = mysql_fetch_object($result);
212+ $this->previousthumbfilename = $row->thumb_filename;
213+ $this->previousid = $row->pictureid;
214+ }
215+
216+ }
217+
218+ function setquery($query ='') {
219+ global $manager,$NPG_CONF;
220+ $defaultorder = $NPG_CONF['defaultorder'];
221+ $sort = requestVar('sort');
222+ if (!$sort){$sort = $defaultorder;}
223+ $sorting = array('title'=>'title',
224+ 'desc'=>'description',
225+ 'owner'=>'ownername',
226+ 'date'=>'modified',
227+ 'titlea'=>'title',
228+ 'desca'=>'description',
229+ 'ownera'=>'ownername',
230+ 'datea'=>'modified',
231+ 'filenamea'=>'filename',
232+ 'filename'=>'filename');
233+ $order = array('title'=>' ASC',
234+ 'desc'=>' ASC',
235+ 'owner'=>' ASC',
236+ 'date'=>' DESC',
237+ 'titlea'=>' DESC',
238+ 'desca'=>' DESC',
239+ 'ownera'=>' DESC',
240+ 'datea'=>' ASC',
241+ 'filenamea'=>' ASC',
242+ 'filename'=>' DESC');
243+ if ($order[$sort]==' ASC'){$oppositeorder = ' DESC';}
244+ if ($order[$sort]==' DESC'){$oppositeorder = ' ASC';};
245+
246+ //if someone can figure out a better way of doing this, please do it!
247+
248+ //getting forward offset
249+ $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.$this->albumid.' order by '.$sorting[$sort].$order[$sort];
250+ $result = sql_query($query);
251+ $i=0;
252+ while ($row = mysql_fetch_object($result)){
253+ $i = $i + 1;
254+ if($row->pictureid==$this->id){$offset = $i;}
255+
256+ }
257+ //next thumb
258+
259+ $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.$this->albumid.' order by '.$sorting[$sort].$order[$sort].' limit '.$offset.',1';
260+ $result = sql_query($query);
261+
262+ //echo $query;
263+ if(!mysql_num_rows($result))
264+ $this->next = 0;
265+ else {
266+ $row = mysql_fetch_object($result);
267+ $this->nextthumbfilename = $row->thumb_filename;
268+ $this->nextid = $row->pictureid;
269+ }
270+ //getting backwards offset
271+ $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.$this->albumid.' order by '.$sorting[$sort].$oppositeorder;
272+ $result = sql_query($query);
273+ $i=0;
274+ while ($row = mysql_fetch_object($result)){
275+ $i = $i + 1;
276+ if($row->pictureid==$this->id){$offset = $i;}
277+
278+ }
279+
280+ //previous thumb
281+ $query = 'select pictureid, thumb_filename from '.sql_table('plug_gallery_picture').' where albumid = '.$this->albumid.' order by '.$sorting[$sort].$oppositeorder.' limit '.$offset.',1';
282+ //echo $query;
283+ $result = sql_query($query);
284+ if(!mysql_num_rows($result))
285+ $this->previous = 0;
286+ else {
287+ $row = mysql_fetch_object($result);
288+ $this->previousthumbfilename = $row->thumb_filename;
289+ $this->previousid = $row->pictureid;
290+ }
291+
292+ }
293+
294+ function getTitle() {return $this->title;}
295+ function getDescription() {return $this->description;}
296+ function getAlbumId() {return $this->albumid;}
297+ function getOwnerName() { return $this->ownername;}
298+
299+ function getOwnerId() {return $this->ownerid;}
300+ function getLastModified() {return $this->modified;}
301+ function getID() {return $this->id;}
302+ function getFilename() {return $this->filename; }
303+ function getIntFilename() {return $this->int_filename; }
304+ function getThumbFilename() {return $this->thumb_filename; }
305+ function getViews() {return $this->views; }
306+ function getAlbumTitle() {return $this->albumtitle;}
307+ function getpreviousid() { return $this->previousid; }
308+ function getnextid() {return $this->nextid; }
309+ function getpreviousthumbfilename() {return $this->previousthumbfilename;}
310+ function getnextthumbfilename() {return $this->nextthumbfilename;}
311+ function getsets() {return $this->keywords;}
312+
313+ function delete($id) {
314+ global $NP_BASE_DIR;
315+
316+ if(!$id) {
317+ $returnval['status'] = 'error';
318+ $returnval['message'] = 'ID is null in PICTURE::delete';
319+ return $returnval;
320+ }
321+ $query = 'select * from '.sql_table('plug_gallery_picture').' where pictureid='.$id;
322+ $result = mysql_query($query);
323+ if(!$result) {
324+ $returnval['status'] = 'error';
325+ $returnval['message'] = mysql_error().':'.$query;
326+ return $returnval;
327+ } else {
328+ if(!mysql_num_rows($result)) {
329+ $returnval['status'] = 'error';
330+ $returnval['message'] = 'Picture not deleted because it was not found in database';
331+ return $returnval;
332+ }
333+ else {
334+ $row = mysql_fetch_object($result);
335+ if(@ !unlink($NP_BASE_DIR.$row->filename)) echo 'file: '.$row->filename.' could not be deleted<br/>';
336+ if(@ !unlink($NP_BASE_DIR.$row->int_filename)) echo 'file: '.$row->int_filename.' could not be deleted<br/>';
337+ if(@ !unlink($NP_BASE_DIR.$row->thumb_filename)) echo 'file: '.$row->thumb_filename.' could not be deleted<br/>';
338+ $query = 'delete from '.sql_table('plug_gallery_picture').' where pictureid='.$row->pictureid;
339+ $result2 = mysql_query($query);
340+ if(!$result2) {
341+ $returnval['status'] = 'error';
342+ $returnval['message'] = mysql_error();
343+ return $returnval;
344+ }
345+ ALBUM::decreaseNumberByOne($row->albumid);
346+ $returnval['status'] = 'success';
347+ $returnval['albumid'] = $row->albumid;
348+ return $returnval;
349+ }
350+ }
351+ }
352+
353+ function deletepromoposts($id) {
354+ global $manager;
355+
356+ $manager->loadClass('ITEM');
357+
358+ $query = 'select * from '.sql_table('plug_gallery_promo').' where ppictureid='.$id;
359+ $result = mysql_query($query);
360+ if(!$result) {
361+ $returnval['status'] = 'error';
362+ $returnval['message'] = mysql_error().':$query';
363+ return $returnval;
364+ }
365+ else {
366+ if(!mysql_num_rows($result)) {
367+ $returnval['status'] = 'error';
368+ $returnval['message'] = 'No promo posts associated with this picture';
369+ return $returnval;
370+ }
371+ else {
372+ while ($row = mysql_fetch_object($result) ){
373+ ITEM::delete($row->pblogitemid);
374+ }
375+ sql_query('delete from '.sql_table('plug_gallery_promo').' where ppictureid='.$id);
376+ $returnval['status'] = 'success';
377+ return $returnval;
378+ }
379+ }
380+ }
381+ function tagaccept($left,$top,$width,$height,$text){
382+ sql_query("INSERT INTO ".sql_table('plug_gallery_picturetag')." ( `pictureid` , `top` , `left` , `height` , `width` , `text` )
383+ VALUES ( '" . $this->id ." ', '" .$top."', '" .$left." ' , '" .$height."' , '" .$width."' , '" .$text."' ); ");
384+ echo "<SCRIPT LANGUAGE=\"JavaScript\">
385+ window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $this->id . "\"" .
386+ "</script>";
387+ }
388+
389+ function tagdelete(){
390+ sql_query("DELETE FROM ".sql_table('plug_gallery_picturetag'). " WHERE `pictureid` = '" . $this->id . "' LIMIT 1; ");
391+ echo "<SCRIPT LANGUAGE=\"JavaScript\">
392+ window.location=\"" . $NP_BASE_DIR . "action.php?action=plugin&name=gallery&type=item&id=". $this->id . " \"" .
393+ "</script>";
394+ }
395+
396+
397+
398+ function display($startstop,$sliderunning) {
399+ global $NPG_CONF,$manager;
400+
401+ if(!$this->template) {
402+ if(!$NPG_CONF['template']) $NPG_CONF['template'] = 1;
403+ $this->template = & new NPG_TEMPLATE($NPG_CONF['template']);
404+ }
405+
406+ if(!$this->query ) $this->setquery();
407+
408+ $template_header = $this->template->section['ITEM_HEADER'];
409+ $template_SLIDESHOWC = $this->template->section['ITEM_SLIDESHOWC'];
410+ $template_SLIDESHOWT = $this->template->section['ITEM_SLIDESHOWT'];
411+ $template_body = $this->template->section['ITEM_BODY'];
412+ $template_footer = $this->template->section['ITEM_FOOTER'];
413+ $template_TOOLTIPSHEADER = $this->template->section['ITEM_TOOLTIPSHEADER'];
414+ $template_TOOLTIPSFOOTER = $this->template->section['ITEM_TOOLTIPSFOOTER'];
415+ $template_NEXTPREVTHUMBS = $this->template->section['ITEM_NEXTPREVTHUMBS'];
416+
417+ if(!$this->getID() ) echo 'Nothing to display';
418+ //echo $sliderunning;
419+
420+ //if the slideshow start/stop button was pressed, check if the slideshow if running
421+ //if its running, stop it, if its not running, start it
422+ if (!$sliderunning){$sliderunning='false';}
423+ if ($startstop=='true'){
424+ //echo 'startstop='.$startstop;
425+ if ($sliderunning=='false') $sliderunning= 'true'; //echo 'sliderunning='.$sliderunning;
426+ else $sliderunning= 'false';
427+ }
428+ //if the slideshow was running, let it continue
429+ if($sliderunning=='true'){
430+ //echo 'sliderunning='.$sliderunning;
431+ $actions = new PICTURE_ACTIONS($this);
432+ $parser = new PARSER($actions->getDefinedActions(), $actions);
433+ $actions->setparser($parser);
434+ $manager->notify('NPgPrePicture',array('picture',&$this));
435+ $this->_views();
436+ $template_SLIDESHOWC = $this->template->section['ITEM_SLIDESHOWC'];
437+ $template_SLIDESHOWT = $this->template->section['ITEM_SLIDESHOWT'];
438+ $parser->parse($template_SLIDESHOWC);
439+ $parser->parse($template_SLIDESHOWT);
440+ }
441+ // if the slideshow wasnt running, do the normal thing.
442+ if($sliderunning=='false'){
443+ //echo 'sliderunning1'.$sliderunning;
444+ $actions = new PICTURE_ACTIONS($this);
445+ $parser = new PARSER($actions->getDefinedActions(), $actions);
446+ $actions->setparser($parser);
447+ $manager->notify('NPgPrePicture',array('picture',&$this));
448+ $this->_views();
449+ $parser->parse($template_TOOLTIPSHEADER);
450+ $parser->parse($template_SLIDESHOWC);
451+ $parser->parse($template_header);
452+ $parser->parse($template_body);
453+ $parser->parse($template_TOOLTIPSFOOTER);
454+ $parser->parse($template_NEXTPREVTHUMBS);
455+ $parser->parse($template_footer);
456+ }
457+ }
458+
459+ function _views() {
460+ global $NPG_CONF;
461+
462+ $remoteip = ServerVar('REMOTE_ADDR');
463+ $pictureid = $this->getID();
464+ $curtime = time();
465+ if(!$NPG_CONF['viewtime']) $NPG_CONF['viewtime'] = 30 ;
466+ $cuttime = $NPG_CONF['viewtime'];
467+ //first test for duplicates
468+ $query = 'select * from '.sql_table('plug_gallery_views')." where vpictureid = $pictureid";
469+ //$result = mysql_query($query);
470+ //print_r($result);
471+ //$numrows= mysql_num_rows($result);
472+ //echo $numrows;
473+ if(@mysql_num_rows($result)>1){
474+ //if theres more than one
475+ $query= 'DELETE FROM '.sql_table('plug_gallery_views').' WHERE vpictureid = $pictureid ORDER BY views LIMIT 1' ;
476+ mysql_query($query);
477+ }
478+
479+ $query = 'select time from '.sql_table('plug_gallery_views_log')." where ip = '$remoteip' and vlpictureid = $pictureid";
480+ $result = sql_query($query);
481+ if(mysql_num_rows($result)) {
482+ $row = mysql_fetch_object($result);
483+ $query2 = 'update '.sql_table('plug_gallery_views_log')." set time = NOW() where ip = '$remoteip' and vlpictureid = $pictureid";
484+ $result2 = sql_query($query2);
485+ if( ($curtime - (intval($NPG_CONF['viewtime']) * 60) ) > converttimestamp($row->time) ) {
486+ $query3 = 'select * from '.sql_table('plug_gallery_views')." where vpictureid = $pictureid";
487+ $result3 = mysql_query($query3);
488+ if(mysql_num_rows($result3))
489+ sql_query('update '.sql_table('plug_gallery_views')." set views = views + 1 where vpictureid = $pictureid");
490+ else sql_query('insert into '.sql_table('plug_gallery_views')." (vpictureid, views) values ($pictureid, 1)");
491+ }
492+ } else {
493+ $query3 = 'select * from '.sql_table('plug_gallery_views')." where vpictureid = $pictureid";
494+ $result3 = mysql_query($query3);
495+ if(mysql_num_rows($result3))
496+ sql_query('update '.sql_table('plug_gallery_views')." set views = views + 1 where vpictureid = $pictureid");
497+ else sql_query('insert into '.sql_table('plug_gallery_views')." (vpictureid, views) values ($pictureid, 1)");
498+ sql_query('insert into '.sql_table('plug_gallery_views_log')." (vlpictureid, ip, time) values ($pictureid, '$remoteip', NULL)");
499+ }
500+
501+ }
502+}
503+
504+class PICTURE_ACTIONS extends BaseActions {
505+ var $parser;
506+ var $CurrentPicture;
507+ var $knownactions;
508+
509+
510+ function PICTURE_ACTIONS(& $currentpic) {
511+ $this->BaseActions();
512+ $this->CurrentPicture = & $currentpic;
513+ $this->knownactions = array( 'addcomment','editPicture','deletePicture','item','album' );
514+ }
515+
516+ function getdefinedActions() {
517+ return array(
518+ 'breadcrumb',
519+ 'albumlink',
520+ 'albumtitle',
521+ 'description',
522+ 'fullsizelink',
523+ 'intermediatepicture',
524+ 'title',
525+ 'height',
526+ 'width',
527+ 'owner',
528+ 'date',
529+ 'editpicturelink',
530+ 'deletepicturelink',
531+ 'nextlink',
532+ 'previouslink',
533+ 'nextthumbfilename',
534+ 'previousthumbfilename',
535+ 'comments',
536+ 'commentform',
537+ 'if',
538+ 'else',
539+ 'endif',
540+ 'tooltip',
541+ 'nextid',
542+ 'previousid',
543+ 'pictureid',
544+ 'sitevar',
545+ 'intvalsecs',
546+ 'keywords' );
547+ }
548+
549+ function setParser(&$parser) {$this->parser =& $parser; }
550+ function settemplate(&$template) {$this->template = & $template; }
551+
552+ function parse_breadcrumb($sep = '>') {
553+ //echo getBreadcrumb('item', $this->CurrentPicture->getID());
554+ echo '<a href="';
555+ echo generateLink('list');
556+ echo '">'.__NPG_BREADCRUMB_GALLERY.'</a> '.$sep.' ';
557+ echo '<a href="';
558+ $this->parse_albumlink();
559+ echo '">';
560+ $this->parse_albumtitle();
561+ echo '</a> '.$sep.' ';
562+ $this->parse_title();
563+ }
564+
565+ function parse_title() {
566+ echo $this->CurrentPicture->getTitle();
567+ }
568+
569+ function parse_albumlink() {
570+ $type = requestvar('type');
571+ if(in_array($type,$this->knownactions)) {
572+ $extra['id'] = $this->CurrentPicture->getalbumid();
573+ $type = 'album';
574+ }
575+ else {
576+ $allowed = array('limit');
577+ foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
578+ }
579+ echo NP_gallery::MakeLink($type,$extra);
580+ }
581+
582+ function parse_albumtitle() {
583+ echo $this->CurrentPicture->getAlbumTitle();
584+ }
585+
586+ function parse_description() {echo $this->CurrentPicture->getDescription(); }
587+ function parse_fullsizelink() {
588+ global $CONF;
589+ echo $CONF['IndexURL'].$this->CurrentPicture->getFilename(); }
590+ function parse_intermediatepicture() {
591+ global $CONF;
592+ echo $CONF['IndexURL'].$this->CurrentPicture->getIntFilename(); }
593+ function parse_height($offset = 15) {
594+ global $NP_BASE_DIR;
595+ $image_size = getimagesize($NP_BASE_DIR.$this->CurrentPicture->getFilename());
596+ echo ($image_size[1] + $offset);
597+ }
598+ function parse_width($offset = 15) {
599+ global $NP_BASE_DIR;
600+ $image_size = getimagesize($NP_BASE_DIR.$this->CurrentPicture->getFilename());
601+ echo ($image_size[0] + $offset);
602+ }
603+ function parse_owner() { echo $this->CurrentPicture->getOwnerName(); }
604+ function parse_date($format = 'l jS of F Y h:i:s A') {
605+ $d = $this->CurrentPicture->getLastModified();
606+ $d = converttimestamp($d);
607+ $d = date($format,$d);
608+ echo $d;
609+ }
610+ function parse_editpicturelink() { echo generateLink('editPictureF', $this->CurrentPicture->getID());}
611+ function parse_deletepicturelink() {echo generateLink('deletePictureF', $this->CurrentPicture->getID());}
612+ function parse_nextthumbfilename() {global $CONF;echo $CONF['IndexURL'].$this->CurrentPicture->getnextthumbfilename();}
613+ function parse_previousthumbfilename() {global $CONF;echo $CONF['IndexURL'].$this->CurrentPicture->getpreviousthumbfilename();}
614+ function parse_nextlink() {
615+ $next = $this->CurrentPicture->getnextid();
616+
617+ $type = requestvar('type');
618+ if(in_array($type, $this->knownactions)) $type = 'item';
619+ if(!$type) $type = 'item';
620+ if($next) {
621+ $extra['id'] = $next;
622+ $allowed = array('limit');
623+ foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
624+ echo NP_gallery::MakeLink($type,$extra);
625+ }
626+ else echo '#';
627+ }
628+
629+ function parse_previouslink() {
630+ $prev = $this->CurrentPicture->getpreviousid();
631+
632+ $type = requestvar('type');
633+ if(!$type) $type = 'item';
634+ if($prev) {
635+ $extra['id'] = $prev;
636+ $allowed = array('limit');
637+ foreach($_GET as $key => $value) if(in_array($key,$allowed)) $extra[$key] = $value;
638+ echo NP_gallery::MakeLink($type,$extra);
639+ //echo generateLink($type, $next);
640+ }
641+ else echo '#';
642+ }
643+
644+ function parse_tooltip() {
645+ //get picture tag infor
646+ $gid = requestVar('id');
647+ $res = sql_query('select * from '.sql_table('plug_gallery_picturetag').' where pictureid= '. $gid .' ');
648+ $numrows = @mysql_num_rows($res);
649+ echo "<div id=\"tooltip2\">";
650+ for ($i=0 ; $i<$numrows;$i++) {
651+ $row = mysql_fetch_array($res);
652+ $data->top = $row[top];
653+ $data->left = $row[left];
654+ $data->height = $row[height];
655+ $data->width = $row[width];
656+ $data->text = $row[text];
657+ echo "<div style=\"display:block;position:absolute;border-width:0px;float:left;z-index:5;width:0px;height:0px\">
658+ <div class=\"tooltip2div\" style=\"display:block;position:relative;top:" .
659+ $data->top . "px;left:" .
660+ $data->left ."px;width:" .
661+ $data->width ."px;height:" .
662+ $data->height. "px\">" .
663+ "<span style=\"position:relative;top:" .
664+ $data->height . "px\"> " .
665+ $data->text . "</span></div></div>";
666+ }
667+ echo "</div>";
668+ }
669+ function parse_pictureid() {
670+ $pictureid = $this->CurrentPicture->getID();
671+ echo $pictureid;
672+ }
673+
674+ function parse_intvalsecs() {
675+ $intval = requestvar(intvalsecs);
676+ echo $intval;
677+ }
678+
679+ function parse_nextid() {
680+ $nextid = $this->CurrentPicture->getnextid();
681+ echo $nextid ;
682+ }
683+
684+ function parse_previousid() {
685+ $previousid = $this->CurrentPicture->getpreviousid();
686+ echo $previousid;
687+ }
688+ function parse_keywords(){
689+ $keywords = $this->CurrentPicture->getsets();
690+ echo $keywords;
691+ }
692+
693+ function doForm($filename) {
694+ global $DIR_NUCLEUS;
695+
696+ array_push($this->parser->actions,'formdata','text','callback','errordiv','itemid');
697+ $oldIncludeMode = PARSER::getProperty('IncludeMode');
698+ $oldIncludePrefix = PARSER::getProperty('IncludePrefix');
699+ PARSER::setProperty('IncludeMode','normal');
700+ PARSER::setProperty('IncludePrefix','');
701+ $this->parse_parsedinclude($DIR_NUCLEUS . 'forms/' . $filename . '.template');
702+ PARSER::setProperty('IncludeMode',$oldIncludeMode);
703+ PARSER::setProperty('IncludePrefix',$oldIncludePrefix);
704+ array_pop($this->parser->actions); // itemid
705+ array_pop($this->parser->actions); // errordiv
706+ array_pop($this->parser->actions); // callback
707+ array_pop($this->parser->actions); // text
708+ array_pop($this->parser->actions); // formdata
709+ }
710+
711+
712+ function parse_comments() {
713+ global $NPG_CONF;
714+
715+ $comments =& new NPG_COMMENTS($this->CurrentPicture->getID());
716+ //$comments->setItemActions($actions);
717+ $comments->showComments($this->CurrentPicture->template, -1, 1); // shows ALL comments
718+ }
719+
720+
721+ function parse_commentform($destinationurl = '') {
722+ global $member, $CONF, $DIR_LIBS, $errormessage;
723+
724+
725+ $actionurl = $CONF['ActionURL'];
726+
727+ //$destinationurl = '?action=plugin&name=gallery&type=addcomment';
728+
729+ // values to prefill
730+ $user = cookieVar($CONF['CookiePrefix'] .'comment_user');
731+ if (!$user) $user = postVar('user');
732+ $userid = cookieVar($CONF['CookiePrefix'] .'comment_userid');
733+ if (!$userid) $userid = postVar('userid');
734+ $body = postVar('body');
735+
736+ $this->formdata = array(
737+ 'destinationurl' => htmlspecialchars($destinationurl),
738+ 'actionurl' => htmlspecialchars($actionurl),
739+ 'itemid' => $this->CurrentPicture->getID(),
740+ 'user' => htmlspecialchars($user),
741+ 'userid' => htmlspecialchars($userid),
742+ 'body' => '',
743+ 'membername' => $member->getDisplayName(),
744+ 'rememberchecked' => cookieVar($CONF['CookiePrefix'] .'comment_user')?'checked="checked"':''
745+ );
746+
747+ if (!$member->isLoggedIn()) {
748+ $this->doForm('../plugins/gallery/include/commentform-notloggedin');
749+ } else {
750+ $this->doForm('../plugins/gallery/include/commentform-loggedin');
751+ }
752+ }
753+
754+ function parse_callback($eventName, $type) {
755+ global $manager;
756+ $manager->notify($eventName, array('type' => $type));
757+ }
758+
759+ function parse_errordiv() {}
760+ function parse_text($which) {
761+
762+ if (defined($which)) {
763+ eval("echo $which;");
764+ } else {
765+ echo $which;
766+ }
767+
768+ }
769+
770+ function parse_itemid() {echo $this->CurrentPicture->getID();}
771+
772+ function parse_formdata($what) {
773+ echo $this->formdata[$what];
774+ }
775+
776+ function parse_if($field, $name = '', $value = '') {
777+ global $gmember,$NPG_CONF;
778+
779+ $condition = 0;
780+ switch($field) {
781+ case 'caneditpicture':
782+ $condition = $gmember->canModifyPicture($this->CurrentPicture->getID() );
783+ break;
784+ case 'commentsallowed':
785+ $condition = ALBUM::commentsallowed($this->CurrentPicture->getID());
786+ break;
787+ case 'next':
788+ $condition = $this->CurrentPicture->getnextid();
789+ break;
790+ case 'prev':
791+ $condition = $this->CurrentPicture->getpreviousid();
792+ break;
793+ case 'tooltips':
794+ $tooltips = $NPG_CONF['tooltips'];
795+ if ($tooltips == 'yes'){$condition = 1;}
796+ break;
797+ case 'nextprevthumb' :
798+ $nextprevthumb = $NPG_CONF['nextprevthumb'];
799+ if ($nextprevthumb == 'yes'){$condition = 1;}
800+ case 'slideshowson' :
801+ $slideshowson = $NPG_CONF['slideshowson'];
802+ if ($slideshowson == 'yes'){$condition = 1;}
803+ default:
804+ break;
805+ }
806+
807+ $this->_addIfCondition($condition);
808+ }
809+
810+}
811+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/template.php
@@ -0,0 +1,94 @@
1+<?php
2+
3+class NPG_TEMPLATE {
4+
5+ var $id;
6+ var $section;
7+ var $name;
8+ var $description;
9+
10+ function NPG_TEMPLATE($templateid) {
11+ $this->id = $templateid;
12+ $this->section = array();
13+ if($this->existsID($this->id)) {
14+ $this->readall();
15+ $query = 'select * from '.sql_table('plug_gallery_template_desc').' where tdid='.$this->id;
16+ $res = sql_query($query);
17+ $row = mysql_fetch_object($res);
18+ $this->name = stripslashes($row->tdname);
19+ $this->description = stripslashes($row->tddesc);
20+ }
21+ }
22+
23+ function getID() { return $this->id; }
24+ function getname() {return $this->name; }
25+ function getdesc() {return $this->description; }
26+
27+ function createfromname($name) {return new NPG_TEMPLATE(NPG_TEMPLATE::getIdFromName($name));}
28+
29+ function getIDfromName($name) {
30+ $query = 'SELECT tdid'
31+ . ' FROM '.sql_table('plug_gallery_template_desc')
32+ . ' WHERE tdname="'.addslashes($name).'"';
33+ $res = sql_query($query);
34+ $obj = mysql_fetch_object($res);
35+ return $obj->tdid;
36+ }
37+
38+ function updategeneralinfo($name,$desc) {
39+ $query = 'UPDATE '.sql_table('plug_gallery_template_desc').' SET'
40+ . " tdname='" . addslashes($name) . "',"
41+ . " tddesc='" . addslashes($desc) . "'"
42+ . " WHERE tdid=" . $this->getID();
43+ sql_query($query);
44+ }
45+
46+ function update($type,$content) {
47+ $id = $this->getID();
48+ sql_query('DELETE FROM '.sql_table('plug_gallery_template')." WHERE name='". addslashes($type) ."' and tdesc=" . intval($id));
49+
50+ if ($content) {
51+ sql_query('INSERT INTO '.sql_table('plug_gallery_template')." SET content='" . addslashes($content) . "', name='" . addslashes($type) . "', tdesc=" . intval($id));
52+ }
53+ }
54+
55+ function deleteallparts() { sql_query('DELETE FROM '.sql_table('plug_gallery_template').' WHERE tdesc='.$this->getID()); }
56+
57+ function createnew($name,$desc) {
58+ sql_query('INSERT INTO '.sql_table('plug_gallery_template_desc')." (tdname, tddesc) VALUES ('" . addslashes($name) . "','" . addslashes($desc) . "')");
59+ $newId = mysql_insert_id();
60+ return $newId;
61+ }
62+
63+ function exists($name) {
64+ $r = sql_query('select * FROM '.sql_table('plug_gallery_template_desc').' WHERE tdname="'.addslashes($name).'"');
65+ return (mysql_num_rows($r) != 0);
66+ }
67+
68+ function existsID($id) {
69+ $r = sql_query('select * FROM '.sql_table('plug_gallery_template_desc').' WHERE tdid='.intval($id));
70+ return (mysql_num_rows($r) != 0);
71+ }
72+
73+ function gettemplate($type) {
74+ $result = mysql_query("select * from ".sql_table('plug_gallery_template')." where name='$type'" );
75+ $data = mysql_fetch_assoc($result);
76+ $template = stripslashes($data['content']);
77+ return $template;
78+ }
79+
80+ function settemplate($type, $content) {
81+ $this->update($type,$content);
82+ }
83+
84+ function readall() {
85+ $query = 'select * from '.sql_table('plug_gallery_template').' where tdesc='.$this->id;
86+ $res = sql_query($query);
87+ while ($row = mysql_fetch_object($res)){
88+ $this->section[$row->name] = stripslashes($row->content);
89+ }
90+ }
91+
92+}
93+
94+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/templatetags.html
@@ -0,0 +1,368 @@
1+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+<html xmlns="http://www.w3.org/1999/xhtml">
3+<head>
4+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
5+<title>Untitled Document</title>
6+</head>
7+
8+<body>
9+<h3>Templates</h3>
10+<p>The plugin is displayed using a template system very similar to nucleus skins and templates.</p>
11+<p>The first step in the display is when the plugin calls the nucleus NPGallery skin. This provides the general look, ie banner, side menus, footers, whatever. The &lt;%gallery(link)%&gt; tag in the NPGallery skin is where the gallery page (list, album or picture) is displayed. To display the requested gallery page the appropriate gallery template is used. These templates are freely editable in the gallery admin area and are a powerful way to control how gallery is displayed</p>
12+<p>In general, each template has a header, body and footer segment. With pages with repeated information such as thumbnails in an album, the header is displayed, followed by repitions of the body, then the footer. For example if we call the header H, the body B and footer F, an album page would be contructed H B B (repeated) B B F. Following is list of template tags and the information they represent</p>
13+Gallery List: Displayed by &lt;%gallery(link)%&gt; and by clicking on Gallery in the breadcrumb<br/>
14+<table>
15+ <thead>
16+ <tr>
17+ <th>Tag</th>
18+ <th>Description</th>
19+ <th>Section</th>
20+ </tr>
21+ </thead>
22+ <tbody>
23+ <tr>
24+ <td>breadcrumb</td>
25+ <td>Displays Breadcrumb navigation (in gallery list only the word Gallery)</td>
26+ <td>All</td>
27+ </tr>
28+ <tr>
29+ <td>sortbytitle</td>
30+ <td>Generates a <b>link</b> to display gallery list sorted by album title, ie &lt;a href=&quot;&lt;%sortbytitle%&gt;&quot;&gt;</td>
31+ <td>Header</td>
32+ </tr>
33+ <tr>
34+ <td>sortbydescription</td>
35+ <td>Generates a <b>link</b> to display gallery list sorted by album description.</td>
36+ <td>Header</td>
37+ </tr>
38+ <tr>
39+ <td>sortbyowner</td>
40+ <td>Generates a <b>link</b> to display gallery list sorted by album owner.</td>
41+ <td>Header</td>
42+ </tr>
43+ <tr>
44+ <td>sortbymodified</td>
45+ <td>Generates a <b>link</b> to display gallery list sorted by date last modified.</td>
46+ <td>Header</td>
47+ </tr>
48+ <tr>
49+ <td>sortbynumber</td>
50+ <td>Generates a <b>link</b> to display gallery list sorted by number of images in album.</td>
51+ <td>Header</td>
52+ </tr>
53+ <tr>
54+ <td>albumlink</td>
55+ <td><b>link</b> to album</td>
56+ <td>Body</td>
57+ </tr>
58+ <tr>
59+ <td>albumthumbnail</td>
60+ <td>absolute reference to the album thumbnail (assignable in admin area|gallery|configuration). Usage: &lt;img src=&quot;&lt;%albumthumbnail%&gt;&quot; /&gt;</td>
61+ <td>Body</td>
62+ </tr>
63+ <tr>
64+ <td>centeredtopmargin(height,adjustment)</td>
65+ <td>CSS inline style used to vertically align thumbnail (if using albumthumbnail). Height is the height of the thumbnail container, adjustment is a number: a negative value to shift the thumbnail up, positive to shift down. Used to make space for text under thumbnail. Usage: </td>
66+ <td>Body</td>
67+ </tr>
68+ <tr>
69+ <td>title</td>
70+ <td></td>
71+ <td>Body</td>
72+ </tr>
73+ <tr>
74+ <td>description</td>
75+ <td></td>
76+ <td>Body</td>
77+ </tr>
78+ <tr>
79+ <td>ownerid</td>
80+ <td></td>
81+ <td>Body</td>
82+ </tr>
83+ <tr>
84+ <td>ownername</td>
85+ <td></td>
86+ <td>Body</td>
87+ </tr>
88+ <tr>
89+ <td>modified</td>
90+ <td></td>
91+ <td>Body</td>
92+ </tr>
93+ <tr>
94+ <td>numberofimages</td>
95+ <td></td>
96+ <td>Body</td>
97+ </tr>
98+ <tr>
99+ <td>addalbumlink</td>
100+ <td></td>
101+ <td>H/F</td>
102+ </tr>
103+ <tr>
104+ <td>addpictureslink</td>
105+ <td></td>
106+ <td>H/F</td>
107+ </tr>
108+ <tr>
109+ <td>if(canaddpicture)</td>
110+ <td></td>
111+ <td>All</td>
112+ </tr>
113+ <tr>
114+ <td>if(canaddalbum)</td>
115+ <td></td>
116+ <td>All</td>
117+ </tr>
118+ </tbody>
119+</table>
120+<br/>
121+Album: Displayed by clicking on album link in gallery list<br/>
122+<table>
123+ <thead>
124+ <tr>
125+ <th>Tag</th>
126+ <th>Description</th>
127+ <th>Section</th>
128+ </tr>
129+ </thead>
130+ <tbody>
131+ <tr>
132+ <td>breadcrumb(sep)</td>
133+ <td>Displays Breadcrumb navigation with the specified seperator, default is &gt;. For example to change the breadcrumb to Gallery -&gt; Album change the tag to &lt;%breadcrumb(-&gt;)%&gt;</td>
134+ <td>All</td>
135+ </tr>
136+ <tr>
137+ <td>albumtitle</td>
138+ <td></td>
139+ <td></td>
140+ </tr>
141+ <tr>
142+ <td>albumdescription</td>
143+ <td></td>
144+ <td></td>
145+ </tr>
146+ <tr>
147+ <td>picturedescription</td>
148+ <td></td>
149+ <td></td>
150+ </tr>
151+ <tr>
152+ <td>picturelink</td>
153+ <td></td>
154+ <td></td>
155+ </tr>
156+ <tr>
157+ <td>thumbnail</td>
158+ <td></td>
159+ <td></td>
160+ </tr>
161+ <tr>
162+ <td>centeredtopmargin</td>
163+ <td></td>
164+ <td></td>
165+ </tr>
166+ <tr>
167+ <td>pictureviews</td>
168+ <td></td>
169+ <td></td>
170+ </tr>
171+ <tr>
172+ <td>editalbumlink</td>
173+ <td></td>
174+ <td></td>
175+ </tr>
176+ <tr>
177+ <td>addpicturelink</td>
178+ <td></td>
179+ <td></td>
180+ </tr>
181+ <tr>
182+ <td>picturetitle</td>
183+ <td></td>
184+ <td></td>
185+ </tr>
186+ <tr>
187+ <td>pages</td>
188+ <td></td>
189+ <td></td>
190+ </tr>
191+ <tr>
192+ <td>albumlink</td>
193+ <td></td>
194+ <td></td>
195+ </tr>
196+ <tr>
197+ <td>if(canaddpicture)</td>
198+ <td></td>
199+ <td></td>
200+ </tr>
201+ <tr>
202+ <td>if(caneditalbum)</td>
203+ <td></td>
204+ <td></td>
205+ </tr>
206+ </tbody>
207+</table>
208+<br/>
209+Picture: Displayed by clicking on thumbnail in album<br/>
210+<table>
211+ <thead>
212+ <tr>
213+ <th>Tag</th>
214+ <th>Description</th>
215+ <th>Section</th>
216+ </tr>
217+ </thead>
218+ <tbody>
219+ <tr>
220+ <td>breadcrumb(sep)</td>
221+ <td>Displays Breadcrumb navigation with the specified seperator, default is &gt;. For example to change the breadcrumb to Gallery -&gt; Album change the tag to &lt;%breadcrumb(-&gt;)%&gt;</td>
222+ <td>All</td>
223+ </tr>
224+ <tr>
225+ <td>albumlink</td>
226+ <td></td>
227+ <td></td>
228+ </tr>
229+ <tr>
230+ <td>albumtitle</td>
231+ <td></td>
232+ <td></td>
233+ </tr>
234+ <tr>
235+ <td>description</td>
236+ <td></td>
237+ <td></td>
238+ </tr>
239+ <tr>
240+ <td>fullsizelink</td>
241+ <td></td>
242+ <td></td>
243+ </tr>
244+ <tr>
245+ <td>intermediatepicture</td>
246+ <td></td>
247+ <td></td>
248+ </tr>
249+ <tr>
250+ <td>title</td>
251+ <td></td>
252+ <td></td>
253+ </tr>
254+ <tr>
255+ <td>height</td>
256+ <td></td>
257+ <td></td>
258+ </tr>
259+ <tr>
260+ <td>width</td>
261+ <td></td>
262+ <td></td>
263+ </tr>
264+ <tr>
265+ <td>owner</td>
266+ <td></td>
267+ <td></td>
268+ </tr>
269+ <tr>
270+ <td>date</td>
271+ <td></td>
272+ <td></td>
273+ </tr>
274+ <tr>
275+ <td>editpicturelink</td>
276+ <td></td>
277+ <td></td>
278+ </tr>
279+ <tr>
280+ <td>deletepicturelink</td>
281+ <td></td>
282+ <td></td>
283+ </tr>
284+ <tr>
285+ <td>nextlink</td>
286+ <td></td>
287+ <td></td>
288+ </tr>
289+ <tr>
290+ <td>previouslink</td>
291+ <td></td>
292+ <td></td>
293+ </tr>
294+ <tr>
295+ <td>comments</td>
296+ <td></td>
297+ <td></td>
298+ </tr>
299+ <tr>
300+ <td>commentform</td>
301+ <td></td>
302+ <td></td>
303+ </tr>
304+ <tr>
305+ <td>if(caneditpicture)</td>
306+ <td></td>
307+ <td></td>
308+ </tr>
309+ <tr>
310+ <td>if(commentsallowed)</td>
311+ <td></td>
312+ <td></td>
313+ </tr>
314+ <tr>
315+ <td>if(next)</td>
316+ <td></td>
317+ <td></td>
318+ </tr>
319+ <tr>
320+ <td>if(prev)</td>
321+ <td><p>&nbsp;</p></td>
322+ <td></td>
323+ </tr>
324+ </tbody>
325+</table>
326+<br/>
327+Comments<br/>
328+<table>
329+ <thead>
330+ <tr>
331+ <th>Tag</th>
332+ <th>Description</th>
333+ <th>Section</th>
334+ </tr>
335+ </thead>
336+ <tbody>
337+ <tr>
338+ <td></td>
339+ <td></td>
340+ <td></td>
341+ </tr>
342+ <tr>
343+ <td></td>
344+ <td></td>
345+ <td></td>
346+ </tr>
347+ </tbody>
348+</table>
349+<br/>
350+Promo post template<br/>
351+<table>
352+ <thead>
353+ <tr>
354+ <th>Tag</th>
355+ <th>Description</th>
356+ <th>Section</th>
357+ </tr>
358+ </thead>
359+ <tbody>
360+ </tbody>
361+</table>
362+<h3><a name="version" id="version"></a>Version History</h3>
363+<ul>
364+ <li>Version 0.1: initial testcaseversion</li>
365+ <li>Version 0.0: pre-initial version ;-)</li>
366+</ul>
367+</body>
368+</html>
Binary files /dev/null and b/NP_gallery/trunk/gallery/update/Thumbs.db differ
--- /dev/null
+++ b/NP_gallery/trunk/gallery/update/default_templates_076.inc
@@ -0,0 +1,142 @@
1+<?php
2+
3+//to only be included by np_gallery script or update scripts
4+
5+if(isset($template)) unset($template);
6+$template = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default076','default 0.76 templates'));
7+if(!$NPG_CONF['template']) setNPGOption('template', $template->getID());
8+$templatepics = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default076-p','Example of album thumbnails'));
9+
10+
11+$name = 'LIST_HEADER';
12+$content = '<%breadcrumb%><hr/><table width=100% ><thead>'
13+ .'<tr><th><a href="<%sortbytitle%>">Title</a></th>'
14+ .'<th><a href="<%sortbydescription%>">Description</a></th>'
15+ .'<th><a href="<%sortbyowner%>">Owner</a></th>'
16+ .'<th><a href="<%sortbymodified%>">Last Modified</a></th>'
17+ .'<th><a href="<%sortbynumber%>">Images</a></th></tr></thead><tbody>';
18+$template->setTemplate($name, $content);
19+$content = '<form method="post" action="action.php">'
20+ .'<input type="hidden" name="action" value="plugin" />'
21+ .'<input type="hidden" name="name" value="gallery" />'
22+ .'<input type="hidden" name="type" value="list" />'
23+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
24+ .'<option value="title" >Album Title'
25+ .'<option value="desc" >Album Description'
26+ .'<option value="owner">Owner'
27+ .'<option value="date">Date Modified'
28+ .'<option value="numb">Number of Images'
29+ .'</select></form><hr/><div id="NPG_thumbnail"><ul class="thumbnail">';
30+$templatepics->setTemplate($name,$content);
31+
32+$name = 'LIST_BODY';
33+$content = '<tr><td><a href="<%albumlink%>"><%title%></a></td>'
34+ .'<td><%description%></td>'
35+ .'<td><%ownername%></td>'
36+ .'<td><%modified%></td>'
37+ .'<td><%numberofimages%></td></tr>';
38+$template->setTemplate($name, $content);
39+$content = '<li><a href="<%albumlink%>">
40+<img style="<%centeredtopmargin(140,-10)%>" src="<%albumthumbnail%>" alt="<%description%>" /></a>
41+<br/><%title%><br/><%numberofimages%> pictures</li>';
42+$templatepics->setTemplate($name,$content);
43+
44+$name = 'LIST_FOOTER';
45+$content = '</tbody></table><hr/><br />'
46+ .'<%if(canaddalbum)%>'
47+ .'<a href="<%addalbumlink%>">Add New Album | </a>'
48+ .'<%endif%>'
49+ .'<%if(canaddpicture)%>'
50+ .'<a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=400\');return false;">'
51+ .' Add Pictures</a>'
52+ .'<%endif%>';
53+$template->setTemplate($name, $content);
54+$content ='</ul></div><div id="NPG_footer"><hr/><br />'
55+ .'<%if(canaddalbum)%>'
56+ .'<a href="<%addalbumlink%>">Add New Album | </a>'
57+ .'<%endif%>'
58+ .'<%if(canaddpicture)%>'
59+ .'<a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=400\');return false;">'
60+ .' Add Pictures</a>'
61+ .'<%endif%></div>';
62+$templatepics->setTemplate($name,$content);
63+
64+//
65+$name = 'ALBUM_HEADER';
66+$content = '<%breadcrumb%><hr/><div id="NPG_thumbnail"><ul class="thumbnail">';
67+$template->setTemplate($name, $content);
68+$templatepics->setTemplate($name,$content);
69+
70+$name = 'ALBUM_BODY';
71+$content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,-10)%>" src="<%thumbnail%>" /></a><br/><%picturetitle%><br/><%pictureviews%> views</li>';
72+$template->setTemplate($name, $content);
73+$templatepics->setTemplate($name,$content);
74+
75+$name = 'ALBUM_FOOTER';
76+$content = '</ul></div><div id="NPG_footer"><br /><hr/>'
77+ .'<%if(caneditalbum)%>'
78+ .'<a href="<%editalbumlink%>">Modify Album </a> | '
79+ .'<%endif%>'
80+ .'<%if(canaddpicture)%>'
81+ .'<a href="<%addpicturelink%>"onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=480,height=360\');return false;">Add Picture</a>'
82+ .'<%endif%>'
83+ .'</div>';
84+$template->setTemplate($name, $content);
85+$templatepics->setTemplate($name,$content);
86+
87+//
88+$name = 'ITEM_HEADER';
89+$content = '<%breadcrumb%><br/>'
90+ .'<%if(prev)%><a href="<%previouslink%>"> Previous</a>'
91+ .'<%else%> Previous<%endif%>'
92+ .' |'
93+ .'<%if(next)%><a href="<%nextlink%>"> Next</a>'
94+ .'<%else%> Next<%endif%>'
95+ .'<hr/><div id="NPG_picture">';
96+$template->setTemplate($name, $content);
97+$templatepics->setTemplate($name,$content);
98+
99+$name = 'ITEM_BODY';
100+$content = '<a href="<%fullsizelink%>" onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=auto,resizable=yes,width=<%width%>,height=<%height%>\');return false;">'
101+ .'<img src="<%intermediatepicture%>" /></a>';
102+$template->setTemplate($name, $content);
103+$templatepics->setTemplate($name,$content);
104+
105+$name = 'ITEM_FOOTER';
106+$content = '</div><div id="NPG_footer"><br /><%description%><br/><br/>Last modified by <%owner%> on <%date%> '
107+ .'<%if(caneditpicture)%>'
108+ .'<a href="<%editpicturelink%>">Edit</a>'
109+ .' | <a href="<%deletepicturelink%>">Delete</a>'
110+ .'<%endif%>'
111+ .'<br/></div><%if(commentsallowed)%>'
112+ .'<div class="contenttitle"><h2>Comments</h2></div><%comments%>'
113+ .'<div class="contenttitle"><h2>Add Comment</h2></div><%commentform%><%endif%>';
114+$template->setTemplate($name, $content);
115+$templatepics->setTemplate($name,$content);
116+
117+$name = 'COMMENT_BODY';
118+$content = '<div class="itemcomment id<%memberid%>">'
119+ .'<h3><a href="<%userlinkraw%>"'
120+ .'title="<%ip%> | Click to visit <%user%>\'s website or send an email">'
121+ .'<%user%></a> wrote:</h3>'
122+ .'<div class="commentbody">'
123+ .'<%body%></div><div class="commentinfo"><%date%> <%time%></div></div>' ;
124+$template->setTemplate($name, $content);
125+$templatepics->setTemplate($name,$content);
126+
127+$name = 'PROMO_TITLE';
128+$content = 'New Pictures Added!';
129+$template->setTemplate($name,$content);
130+$templatepics->setTemplate($name,$content);
131+
132+$name = 'PROMO_BODY';
133+$content = 'New pictures posted:<div id="NPG_thumbnail"><ul class="thumbnail"><%images%></ul></div><div id="NPG_footer"></div>';
134+$template->setTemplate($name,$content);
135+$templatepics->setTemplate($name,$content);
136+
137+$name = 'PROMO_IMAGES';
138+$content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,0)%>" src="<%thumbnail%>" /></a></li>';
139+$template->setTemplate($name,$content);
140+$templatepics->setTemplate($name,$content);
141+
142+?>
--- /dev/null
+++ b/NP_gallery/trunk/gallery/update/default_templates_080.inc
@@ -0,0 +1,68 @@
1+<?php
2+
3+//to only be included by np_gallery script or update scripts
4+
5+if(isset($template)) unset($template);
6+$template = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default080','default 0.80 templates'));
7+
8+$name = 'LIST_HEADER';
9+$content = '<%breadcrumb%><hr/><table width=100% ><thead>'
10+ .'<tr><th><a href="<%sortbytitle%>">Title</a></th>'
11+ .'<th><a href="<%sortbydescription%>">Description</a></th>'
12+ .'<th><a href="<%sortbyowner%>">Owner</a></th>'
13+ .'<th><a href="<%sortbymodified%>">Last Modified</a></th>'
14+ .'<th><a href="<%sortbynumber%>">Images</a></th></tr></thead><tbody>';
15+$template->setTemplate($name, $content);
16+
17+$name = 'LIST_BODY';
18+$content = '<tr><td><a href="<%albumlink%>"><%title%></a></td><td><%description%></td><td><%ownername%></td><td><%modified%></td><td><%numberofimages%></td></tr>';
19+$template->setTemplate($name, $content);
20+
21+$name = 'LIST_FOOTER';
22+$content = '</tbody></table><hr/><br /><%if(canaddalbum)%><a href="<%addalbumlink%>">Add New Album | </a><%endif%><%if(canaddpicture)%><a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=400\');return false;"> Add Pictures</a><%endif%>';
23+$template->setTemplate($name, $content);
24+
25+
26+//
27+$name = 'ALBUM_HEADER';
28+$content = '<%breadcrumb%><hr/>Page: <%pages%><hr/><div id="NPG_thumbnail">';
29+$template->setTemplate($name, $content);
30+
31+$name = 'ALBUM_BODY';
32+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br></div>';
33+$template->setTemplate($name, $content);
34+
35+$name = 'ALBUM_FOOTER';
36+$content = '</div><div id="NPG_footer"><br /><hr/><%if(caneditalbum)%><a href="<%editalbumlink%>">Modify Album </a> | <%endif%><%if(canaddpicture)%><a href="<%addpicturelink%>"onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=480,height=360\');return false;">Add Picture</a><%endif%></div>';
37+$template->setTemplate($name, $content);
38+
39+//
40+$name = 'ITEM_HEADER';
41+$content = '<%breadcrumb%><br/><%if(prev)%><a href="<%previouslink%>"> Previous</a><%else%> Previous<%endif%> |<%if(next)%><a href="<%nextlink%>"> Next</a><%else%> Next<%endif%><hr/><div id="NPG_picture">';
42+$template->setTemplate($name, $content);
43+
44+$name = 'ITEM_BODY';
45+$content = '<a href="<%fullsizelink%>" onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=auto,resizable=yes,width=<%width%>,height=<%height%>\');return false;"><img src="<%intermediatepicture%>" /></a>';
46+$template->setTemplate($name, $content);
47+
48+$name = 'ITEM_FOOTER';
49+$content = '</div><div id="NPG_footer"><br /><%description%><br/><br/>Last modified by <%owner%> on <%date%> <%if(caneditpicture)%><a href="<%editpicturelink%>">Edit</a> | <a href="<%deletepicturelink%>">Delete</a><%endif%><br/></div><%if(commentsallowed)%><div class="contenttitle"><h2>Comments</h2></div><%comments%><div class="contenttitle"><h2>Add Comment</h2></div><%commentform%><%endif%>';
50+$template->setTemplate($name, $content);
51+
52+$name = 'COMMENT_BODY';
53+$content = '<div class="itemcomment id<%memberid%>"><h3><a href="<%userlinkraw%>"title="<%ip%> | Click to visit <%user%>\'s website or send an email"><%user%></a> wrote:</h3><div class="commentbody"><%body%></div><div class="commentinfo"><%date%> <%time%></div></div>' ;
54+$template->setTemplate($name, $content);
55+
56+$name = 'PROMO_TITLE';
57+$content = 'New Pictures Added!';
58+$template->setTemplate($name,$content);
59+
60+$name = 'PROMO_BODY';
61+$content = 'New pictures posted:<div id="NPG_thumbnail"><ul class="thumbnail"><%images%></ul></div><div id="NPG_footer"></div>';
62+$template->setTemplate($name,$content);
63+
64+$name = 'PROMO_IMAGES';
65+$content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,0)%>" src="<%thumbnail%>" /></a></li>';
66+$template->setTemplate($name,$content);
67+
68+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_gallery/trunk/gallery/update/default_templates_090.inc
@@ -0,0 +1,130 @@
1+<?php
2+global $CONF;
3+//to only be included by np_gallery script or update scripts
4+if(isset($template)) unset($template);
5+$template = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default090','default 0.90 templates'));
6+
7+$name = 'LIST_HEADER';
8+$content = '<%breadcrumb%><hr/><table width=100% ><thead>'
9+ .'<tr><th><a href="<%sortbytitle%>">Title</a></th>'
10+ .'<th><a href="<%sortbydescription%>">Description</a></th>'
11+ .'<th><a href="<%sortbyowner%>">Owner</a></th>'
12+ .'<th><a href="<%sortbymodified%>">Last Modified</a></th>'
13+ .'<th><a href="<%sortbynumber%>">Images</a></th></tr></thead><tbody>'
14+ .'<form method="post" action="action.php">'
15+ .'<input type="hidden" name="action" value="plugin" />'
16+ .'<input type="hidden" name="name" value="gallery" />'
17+ .'<input type="hidden" name="type" value="list" />'
18+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
19+ .'<option value="title" >Album Title'
20+ .'<option value="desc" >Album Description'
21+ .'<option value="owner">Owner'
22+ .'<option value="date">Date Modified'
23+ .'<option value="numb">Number of Images'
24+ .'</select></form>';
25+$template->setTemplate($name, $content);
26+
27+$name = 'LIST_BODY';
28+$content = '<tr><td><a href="<%albumlink%>"><%title%></a></td><td><%description%></td><td><%ownername%></td><td><%modified%></td><td><%numberofimages%></td></tr>';
29+$template->setTemplate($name, $content);
30+
31+$name = 'LIST_FOOTER';
32+$content = '</tbody></table><hr/><br /><%if(canaddalbum)%><a href="<%addalbumlink%>">Add New Album | </a><%endif%><%if(canaddpicture)%><a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=400\');return false;"> Add Pictures</a><%endif%>';
33+$template->setTemplate($name, $content);
34+
35+
36+//
37+$name = 'ALBUM_HEADER';
38+$content = '<%breadcrumb%><hr/>Page: <%pages%><hr/><div id="NPG_thumbnail">'
39+ .'<form method="post" action="action.php">'
40+ .'<input type="hidden" name="action" value="plugin" />'
41+ .'<input type="hidden" name="name" value="gallery" />'
42+ .'<input type="hidden" name="type" value="album" />'
43+ .'<input type="hidden" name="id" value="<%albumid%>" />'
44+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
45+ .'<option value="title" >Picture Title'
46+ .'<option value="desc" >Picture Description'
47+ .'<option value="date">Date Modified'
48+ .'<option value="titlea" >Picture Title - Ascending'
49+ .'<option value="desca" >Picture Description - Ascending'
50+ .'<option value="datea">Picture - Ascending'
51+ .'</select></form>';
52+$template->setTemplate($name, $content);
53+
54+$name = 'ALBUM_BODY';
55+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br></div>';
56+$template->setTemplate($name, $content);
57+
58+$name = 'ALBUM_SETDISPLAY';
59+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br></div>';
60+$template->setTemplate($name, $content);
61+
62+$name = 'ALBUM_FOOTER';
63+$content = '</div><div id="NPG_footer"><br /><hr/><%if(caneditalbum)%><a href="<%editalbumlink%>">Modify Album </a> | <%endif%><%if(canaddpicture)%><a href="<%addpicturelink%>"onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=480,height=360\');return false;">Add Picture</a><%endif%></div>';
64+$template->setTemplate($name, $content);
65+
66+//
67+$name = 'ITEM_TOOLTIPSHEADER';
68+$content = '<%if(tooltips)%></script><script type="text/javascript">var pictureid = "<%pictureid%>";</script>'
69+ .'<script type="text/javascript" src="'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.js"></script><%endif%>';
70+$template->setTemplate($name, $content);
71+
72+$name = 'ITEM_HEADER';
73+$content = '<style type="text/css">@import "'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.css";</style>'
74+ .'<%breadcrumb%><br/><%if(prev)%><a href="<%previouslink%>">'
75+ .' Previous</a><%else%> Previous<%endif%> |<%if(next)%><a href="<%nextlink%>"> '
76+ .' Next</a><%else%> Next<%endif%><hr/><div id="NPG_picture">';
77+$template->setTemplate($name, $content);
78+
79+$name = 'ITEM_BODY';
80+$content = '<div class=\'alpha-shadow\' <%if(tooltips)%>onmouseenter="showtipdivs();" onmouseleave="hidetipdivs();" onmouseover="showtipdivs();" onmouseout="hidetipdivs();"<%endif%>><div><%if(tooltips)%><%tooltip%><%endif%><img src="<%intermediatepicture%>" <%if(tooltips)%>onMouseOver="setLyr(this,\'testlayer\');"<%endif%> /></div></div>';
81+$template->setTemplate($name, $content);
82+
83+$name = 'ITEM_TOOLTIPSFOOTER';
84+$content = '<%if(caneditpicture)%>'
85+ .'<%if(tooltips)%><form name="clear" method="POST" action="'
86+ .$CONF['IndexURL']
87+ .'/action.php?action=plugin&name=gallery&type=tagdelete">'
88+ .'<input type="hidden" name="pictureid" type="text" value ="<%pictureid%>">'
89+ .'<input type="submit" name="Submit" value="Delete one tag">'
90+ .'</form><a href="javascript:void(null)" onclick="start()">Create new caption. </a><%endif%><%endif%>'
91+ .'</div>';
92+$template->setTemplate($name, $content);
93+
94+$name = 'ITEM_NEXTPREVTHUMBS';
95+$content = '<%if(nextprevthumb)%><div style="clear:both;margin:auto"><%if(prev)%><div class=\'thumbnailoutside\'>' .
96+ '<div class="alpha-shadow" ><div><a href="<%previouslink%>">' .
97+ '<img src="<%previousthumbfilename%>" /></a></div></div><div style="clear:both">' .
98+ '</div></div> <div class=\'thumbnailoutside\' style="text-align:">' .
99+ '</br></br>< Previous <%endif%>| <%if(next)%>Next ></div> <div class=\'thumbnailoutside\'>' .
100+ '<div class="alpha-shadow" ><div><a href="<%nextlink%>">' .
101+ '<img src="<%nextthumbfilename%>" /></a></div></div><div style="clear:both"></div></div><%endif%></div><%endif%>' .
102+ '<div id="NPG_footer"><br />Description: <%description%>|<br />';
103+$template->setTemplate($name, $content);
104+
105+$name = 'ITEM_FOOTER';
106+$content = '<a href="<%fullsizelink%>">Fullsize Image Link</a>|'
107+ .'|Last modified by <%owner%> on '
108+ .'<%date%> <%if(caneditpicture)%>|<a href="<%editpicturelink%>">Edit</a> | '
109+ .'<a href="<%deletepicturelink%>">Delete</a><%endif%><br/></div><%if(commentsallowed)%>'
110+ .'<div class="contenttitle"><h2>Comments</h2></div><%comments%><div class="contenttitle">'
111+ .'<h2>Add Comment</h2></div><%commentform%><%endif%>';
112+$template->setTemplate($name, $content);
113+
114+$name = 'COMMENT_BODY';
115+$content = '<div class="itemcomment id<%memberid%>"><h3><a href="<%userlinkraw%>"title="<%ip%> | Click to visit <%user%>\'s website or send an email"><%user%></a> wrote:</h3><div class="commentbody"><%body%></div><div class="commentinfo"><%date%> <%time%></div></div>' ;
116+$template->setTemplate($name, $content);
117+
118+$name = 'PROMO_TITLE';
119+$content = 'New Pictures Added!';
120+$template->setTemplate($name,$content);
121+
122+$name = 'PROMO_BODY';
123+$content = 'New pictures posted:<div id="NPG_thumbnail"><ul class="thumbnail"><%images%></ul></div><div id="NPG_footer"></div>';
124+$template->setTemplate($name,$content);
125+
126+$name = 'PROMO_IMAGES';
127+$content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,0)%>" src="<%thumbnail%>" /></a></li>';
128+$template->setTemplate($name,$content);
129+
130+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_gallery/trunk/gallery/update/default_templates_093.inc
@@ -0,0 +1,162 @@
1+<?php
2+global $CONF;
3+//to only be included by np_gallery script or update scripts
4+if(isset($template)) unset($template);
5+$template = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default093','default 0.93 templates'));
6+
7+$name = 'LIST_HEADER';
8+$content = '<%breadcrumb%><hr/><table width=100% ><thead>'
9+ .'<tr><th><a href="<%sortbytitle%>">Title</a></th>'
10+ .'<th><a href="<%sortbydescription%>">Description</a></th>'
11+ .'<th><a href="<%sortbyowner%>">Owner</a></th>'
12+ .'<th><a href="<%sortbymodified%>">Last Modified</a></th>'
13+ .'<th><a href="<%sortbynumber%>">Images</a></th></tr></thead><tbody>'
14+ .'<form method="post" action="action.php">'
15+ .'<input type="hidden" name="action" value="plugin" />'
16+ .'<input type="hidden" name="name" value="gallery" />'
17+ .'<input type="hidden" name="type" value="list" />'
18+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
19+ .'<option value="title" >Album Title'
20+ .'<option value="desc" >Album Description'
21+ .'<option value="owner">Owner'
22+ .'<option value="date">Date Modified'
23+ .'<option value="numb">Number of Images'
24+ .'</select></form>';
25+$template->setTemplate($name, $content);
26+
27+$name = 'LIST_BODY';
28+$content = '<tr><td><a href="<%albumlink%>"><%title%></a></td><td><%description%></td><td><%ownername%></td><td><%modified%></td><td><%numberofimages%></td></tr>';
29+$template->setTemplate($name, $content);
30+
31+$name = 'LIST_FOOTER';
32+$content = '</tbody></table><hr/><br /><%if(canaddalbum)%><a href="<%addalbumlink%>">Add New Album | </a><%endif%><%if(canaddpicture)%><a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400\');return false;"> Add Pictures</a><%endif%>';
33+$template->setTemplate($name, $content);
34+
35+
36+//
37+$name = 'ALBUM_HEADER';
38+$content = '<%breadcrumb%><hr/>Page: <%pages%><hr/><div id="NPG_thumbnail">'
39+ .'<form method="post" action="action.php">'
40+ .'<input type="hidden" name="action" value="plugin" />'
41+ .'<input type="hidden" name="name" value="gallery" />'
42+ .'<input type="hidden" name="type" value="album" />'
43+ .'<input type="hidden" name="id" value="<%albumid%>" />'
44+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
45+ .'<option value="title" >Picture Title'
46+ .'<option value="desc" >Picture Description'
47+ .'<option value="date">Date Modified'
48+ .'<option value="titlea" >Picture Title - Ascending'
49+ .'<option value="desca" >Picture Description - Ascending'
50+ .'<option value="datea">Picture - Ascending'
51+ .'</select></form>';
52+$template->setTemplate($name, $content);
53+
54+$name = 'ALBUM_BODY';
55+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br></div>';
56+$template->setTemplate($name, $content);
57+
58+$name = 'ALBUM_SETDISPLAY';
59+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br></div>';
60+$template->setTemplate($name, $content);
61+
62+$name = 'ALBUM_FOOTER';
63+$content = '</div><div id="NPG_footer"><br /><hr/><%if(caneditalbum)%><a href="<%editalbumlink%>">Modify Album </a> | <%endif%><%if(canaddpicture)%><a href="<%addpicturelink%>"onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=yes,resizable=yes,width=480,height=360\');return false;">Add Picture</a><%endif%></div>';
64+$template->setTemplate($name, $content);
65+
66+//
67+$name = 'ITEM_TOOLTIPSHEADER';
68+$content = '<%if(tooltips)%></script><script type="text/javascript">var pictureid = "<%pictureid%>";</script>'
69+ .'<script type="text/javascript" src="'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.js"></script><%endif%>';
70+$template->setTemplate($name, $content);
71+
72+$name = 'ITEM_HEADER';
73+$content = '<style type="text/css">@import "'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.css";</style>'
74+ .'<%breadcrumb%><br/><%if(prev)%><a href="<%previouslink%>">'
75+ .' Previous</a><%else%> Previous<%endif%> |<%if(next)%><a href="<%nextlink%>"> '
76+ .' Next</a><%else%> Next<%endif%><hr/><div id="NPG_picture">';
77+$template->setTemplate($name, $content);
78+
79+$name = 'ITEM_SLIDESHOWT';
80+$content = '<script language="JavaScript">' .
81+ 'var NextURL = "<%nextlink%>&sliderunning=true";' .
82+ 'var interval = (1000);' .
83+ 'setTimeout("location.href=NextURL",3000);' .
84+ '</script><div class="alpha-shadow"><div><img src="<%intermediatepicture%>"</div></div>';
85+$template->setTemplate($name, $content);
86+
87+$name = 'ITEM_SLIDESHOWC';
88+$content = '<%if(slideshowson)%>' .
89+ '<table><tr><td>' .
90+ '<form method="post" action="'.$CONF['IndexURL'].'action.php?action=plugin&name=gallery&type=item&id=<%nextid%>&startstop=true">' .
91+ '<input type="submit" value="Start Slideshow"/></form></td>' .
92+ '<td><form method="post" action="'.$CONF['IndexURL'].'action.php?action=plugin&name=gallery&type=item&id=<%nextid%>">' .
93+ '<input type="submit" value="Stop Slideshow"/></form></td></tr></table>'.
94+ //'interval(secs)' .
95+ //'<select name=intvalsecs>' .
96+ //'<OPTION value="1">1 sec</OPTION>' .
97+ //'<OPTION value="2">2 secs</OPTION>' .
98+ //'<OPTION value="3">3 secs</OPTION>' .
99+ //'</select>' .
100+ //'</form>' .
101+ '<%endif%>';
102+$template->setTemplate($name, $content);
103+
104+$name = 'ITEM_BODY';
105+$content = '<div class=\'alpha-shadow\' <%if(tooltips)%>onmouseenter="showtipdivs();" onmouseleave="hidetipdivs();" onmouseover="showtipdivs();" onmouseout="hidetipdivs();"<%endif%>><div><%if(tooltips)%><%tooltip%><%endif%><img src="<%intermediatepicture%>" <%if(tooltips)%>onMouseOver="setLyr(this,\'testlayer\');"<%endif%> /></div></div>';
106+$template->setTemplate($name, $content);
107+
108+$name = 'ITEM_TOOLTIPSFOOTER';
109+$content = '<%if(caneditpicture)%>'
110+ .'<%if(tooltips)%><form name="clear" method="POST" action="'
111+ .$CONF['IndexURL']
112+ .'/action.php?action=plugin&name=gallery&type=tagdelete">'
113+ .'<input type="hidden" name="pictureid" type="text" value ="<%pictureid%>">'
114+ .'<input type="submit" name="Submit" value="Delete one tag">'
115+ .'</form><a href="javascript:void(null)" onclick="start()">Create new caption. </a><%endif%><%endif%>'
116+ .'</div>';
117+$template->setTemplate($name, $content);
118+
119+$name = 'ITEM_NEXTPREVTHUMBS';
120+$content = '<%if(nextprevthumb)%>' .
121+ '<div style="clear:both;margin:auto">' .
122+ '<%if(prev)%>' .
123+ '<div class=\'thumbnailoutside\'><div class="alpha-shadow" ><div>' .
124+ 'a href="<%previouslink%>"><img src="<%previousthumbfilename%>" /></a></div></div></div>' .
125+ '<%endif%>' .
126+ '<div class=\'thumbnailoutside\' style="text-align:"></br></br>' .
127+ '< <%if(prev)%>Previous <%endif%>| <%if(next)%>Next <%endif%>>' .
128+ '</div> ' .
129+ '<%if(next)%><div class=\'thumbnailoutside\'><div class="alpha-shadow" ><div>' .
130+ '<a href="<%nextlink%>"><img src="<%nextthumbfilename%>" /></a></div></div></div>' .
131+ '<%endif%>' .
132+ '</div>' .
133+ '<%endif%>' .
134+ '<div id="NPG_footer"><br />Description: <%description%>|<br />';
135+$template->setTemplate($name, $content);
136+
137+$name = 'ITEM_FOOTER';
138+$content = '<a href="<%fullsizelink%>">Fullsize Image Link</a>|'
139+ .'|Last modified by <%owner%> on '
140+ .'<%date%> <%if(caneditpicture)%>|<a href="<%editpicturelink%>">Edit</a> | '
141+ .'<a href="<%deletepicturelink%>">Delete</a>This picture in sets:<%keywords%> <%endif%><br/></div><%if(commentsallowed)%>'
142+ .'<div class="contenttitle"><h2>Comments</h2></div><%comments%><div class="contenttitle">'
143+ .'<h2>Add Comment</h2></div><%commentform%><%endif%>';
144+$template->setTemplate($name, $content);
145+
146+$name = 'COMMENT_BODY';
147+$content = '<div class="itemcomment id<%memberid%>"><h3><a href="<%userlinkraw%>"title="<%ip%> | Click to visit <%user%>\'s website or send an email"><%user%></a> wrote:</h3><div class="commentbody"><%body%></div><div class="commentinfo"><%date%> <%time%></div></div>' ;
148+$template->setTemplate($name, $content);
149+
150+$name = 'PROMO_TITLE';
151+$content = 'New Pictures Added!';
152+$template->setTemplate($name,$content);
153+
154+$name = 'PROMO_BODY';
155+$content = 'New pictures posted:<div id="NPG_thumbnail"><ul class="thumbnail"><%images%></ul></div><div id="NPG_footer"></div>';
156+$template->setTemplate($name,$content);
157+
158+$name = 'PROMO_IMAGES';
159+$content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,0)%>" src="<%thumbnail%>" /></a></li>';
160+$template->setTemplate($name,$content);
161+
162+?>
\ No newline at end of file
--- /dev/null
+++ b/NP_gallery/trunk/gallery/update/default_templates_094.inc
@@ -0,0 +1,170 @@
1+<?php
2+global $CONF;
3+//to only be included by np_gallery script or update scripts
4+if(isset($template)) unset($template);
5+$template = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default094','default 0.94 templates'));
6+
7+$name = 'LIST_HEADER';
8+$content = '<style type="text/css">@import "'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.css";</style>'
9+ .'<%breadcrumb%><hr/><table width=100% ><thead>'
10+ .'<tr><th><a href="<%sortbytitle%>">Title</a></th>'
11+ .'<th><a href="<%sortbydescription%>">Description</a></th>'
12+ .'<th><a href="<%sortbyowner%>">Owner</a></th>'
13+ .'<th><a href="<%sortbymodified%>">Last Modified</a></th>'
14+ .'<th><a href="<%sortbynumber%>">Images</a></th></tr></thead><tbody>'
15+ .'<form method="post" action="action.php">'
16+ .'<input type="hidden" name="action" value="plugin" />'
17+ .'<input type="hidden" name="name" value="gallery" />'
18+ .'<input type="hidden" name="type" value="list" />'
19+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
20+ .'<option value="title" >Album Title'
21+ .'<option value="desc" >Album Description'
22+ .'<option value="owner">Owner'
23+ .'<option value="date">Date Modified'
24+ .'<option value="numb">Number of Images'
25+ .'</select></form>';
26+$template->setTemplate($name, $content);
27+
28+$name = 'LIST_BODY';
29+$content = '<tr><td><a href="<%albumlink%>"><%title%></a></td><td><%description%></td><td><%ownername%></td><td><%modified%></td><td><%numberofimages%></td></tr>';
30+$template->setTemplate($name, $content);
31+
32+$name = 'LIST_THUM';
33+$content = '<div class="thumbnailoutside"><div class="alpha-shadow"><div><a href="<%albumlink%>">' .
34+ '<img src="<%albumthumbnail%>" alt="<%description%>" /></a></div></div>' .
35+ '<br><div style="clear:both"><%title%> : <%numberofimages%> pics</div></div>';
36+$template->setTemplate($name, $content);
37+
38+$name = 'LIST_FOOTER';
39+$content = '</tbody></table><hr/><br /><%if(canaddalbum)%><a href="<%addalbumlink%>">Add New Album | </a><%endif%><%if(canaddpicture)%><a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=400\');return false;"> Add Pictures</a><%endif%>';
40+$template->setTemplate($name, $content);
41+
42+
43+//
44+$name = 'ALBUM_HEADER';
45+$content = '<style type="text/css">@import "'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.css";</style>'
46+ .'<%breadcrumb%><hr/>Page: <%pages%><hr/><div id="NPG_thumbnail">'
47+ .'<form method="post" action="action.php">'
48+ .'<input type="hidden" name="action" value="plugin" />'
49+ .'<input type="hidden" name="name" value="gallery" />'
50+ .'<input type="hidden" name="type" value="album" />'
51+ .'<input type="hidden" name="id" value="<%albumid%>" />'
52+ .'<input type="submit" value="Resort by:" /> <select name="sort" >'
53+ .'<option value="title" >Picture Title'
54+ .'<option value="desc" >Picture Description'
55+ .'<option value="date">Date Modified'
56+ .'<option value="titlea" >Picture Title - Ascending'
57+ .'<option value="desca" >Picture Description - Ascending'
58+ .'<option value="datea">Picture - Ascending'
59+ .'</select></form>';
60+$template->setTemplate($name, $content);
61+
62+$name = 'ALBUM_BODY';
63+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br><%picturedescription%></div>';
64+$template->setTemplate($name, $content);
65+
66+$name = 'ALBUM_SETDISPLAY';
67+$content = '<div class="thumbnailoutside"><div class=\'alpha-shadow\'><div><a href="<%picturelink%>"><img src="<%thumbnail%>" /></a></div></div><br><%picturedescription%></div>';
68+$template->setTemplate($name, $content);
69+
70+$name = 'ALBUM_FOOTER';
71+$content = '</div><div id="NPG_footer"><br /><hr/><%if(caneditalbum)%><a href="<%editalbumlink%>">Modify Album </a> | <%endif%><%if(canaddpicture)%><a href="<%addpicturelink%>"onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=yes,resizable=yes,width=480,height=360\');return false;">Add Picture</a><%endif%></div>';
72+$template->setTemplate($name, $content);
73+
74+//
75+$name = 'ITEM_TOOLTIPSHEADER';
76+$content = '<%if(tooltips)%></script><script type="text/javascript">var pictureid = "<%pictureid%>";</script>'
77+ .'<script type="text/javascript" src="'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.js"></script><%endif%>';
78+$template->setTemplate($name, $content);
79+
80+$name = 'ITEM_HEADER';
81+$content = '<style type="text/css">@import "'.$CONF['IndexURL'].'/nucleus/plugins/gallery/NP_gallery.css";</style>'
82+ .'<%breadcrumb%><br/><%if(prev)%><a href="<%previouslink%>">'
83+ .' Previous</a><%else%> Previous<%endif%> |<%if(next)%><a href="<%nextlink%>"> '
84+ .' Next</a><%else%> Next<%endif%><hr/><div id="NPG_picture">';
85+$template->setTemplate($name, $content);
86+
87+$name = 'ITEM_SLIDESHOWT';
88+$content = '<script language="JavaScript">' .
89+ 'var NextURL = "<%nextlink%>&sliderunning=true";' .
90+ 'var interval = (1000);' .
91+ 'setTimeout("location.href=NextURL",3000);' .
92+ '</script><div class="alpha-shadow"><div><img src="<%intermediatepicture%>"</div></div>';
93+$template->setTemplate($name, $content);
94+
95+$name = 'ITEM_SLIDESHOWC';
96+$content = '<%if(slideshowson)%>' .
97+ '<table><tr><td>' .
98+ '<form method="post" action="'.$CONF['IndexURL'].'action.php?action=plugin&name=gallery&type=item&id=<%nextid%>&startstop=true">' .
99+ '<input type="submit" value="Start Slideshow"/></form></td>' .
100+ '<td><form method="post" action="'.$CONF['IndexURL'].'action.php?action=plugin&name=gallery&type=item&id=<%nextid%>">' .
101+ '<input type="submit" value="Stop Slideshow"/></form></td></tr></table>'.
102+ //'interval(secs)' .
103+ //'<select name=intvalsecs>' .
104+ //'<OPTION value="1">1 sec</OPTION>' .
105+ //'<OPTION value="2">2 secs</OPTION>' .
106+ //'<OPTION value="3">3 secs</OPTION>' .
107+ //'</select>' .
108+ //'</form>' .
109+ '<%endif%>';
110+$template->setTemplate($name, $content);
111+
112+$name = 'ITEM_BODY';
113+$content = '<div class=\'alpha-shadow\' <%if(tooltips)%>onmouseenter="showtipdivs();" onmouseleave="hidetipdivs();" onmouseover="showtipdivs();" onmouseout="hidetipdivs();"<%endif%>><div><%if(tooltips)%><%tooltip%><%endif%><img src="<%intermediatepicture%>" <%if(tooltips)%>onMouseOver="setLyr(this,\'testlayer\');"<%endif%> /></div></div>';
114+$template->setTemplate($name, $content);
115+
116+$name = 'ITEM_TOOLTIPSFOOTER';
117+$content = '<%if(caneditpicture)%>'
118+ .'<%if(tooltips)%><form name="clear" method="POST" action="'
119+ .$CONF['IndexURL']
120+ .'/action.php?action=plugin&name=gallery&type=tagdelete">'
121+ .'<input type="hidden" name="pictureid" type="text" value ="<%pictureid%>">'
122+ .'<input type="submit" name="Submit" value="Delete one tag">'
123+ .'</form><a href="javascript:void(null)" onclick="start()">Create new caption. </a><%endif%><%endif%>'
124+ .'</div>';
125+$template->setTemplate($name, $content);
126+
127+$name = 'ITEM_NEXTPREVTHUMBS';
128+$content = '<%if(nextprevthumb)%>' .
129+ '<div style="clear:both;margin:auto">' .
130+ '<%if(prev)%>' .
131+ '<div class=\'thumbnailoutside\'><div class="alpha-shadow" ><div>' .
132+ '<a href="<%previouslink%>"><img src="<%previousthumbfilename%>" /></a></div></div></div>' .
133+ '<%endif%>' .
134+ '<div class=\'thumbnailoutside\' style="text-align:"></br></br>' .
135+ '<%if(prev)%>Previous <%endif%>| <%if(next)%>Next <%endif%>>' .
136+ '</div> ' .
137+ '<%if(next)%><div class=\'thumbnailoutside\'><div class="alpha-shadow" ><div>' .
138+ '<a href="<%nextlink%>"><img src="<%nextthumbfilename%>" /></a></div></div></div>' .
139+ '<%endif%>' .
140+ '</div>' .
141+ '<%endif%>' .
142+ '<div id="NPG_footer"><br />Description: <%description%>|<br />';
143+$template->setTemplate($name, $content);
144+
145+$name = 'ITEM_FOOTER';
146+$content = '<a href="<%fullsizelink%>">Fullsize Image Link</a>'
147+ .'|Last modified by <%owner%> on'
148+ .'<%date%><%if(caneditpicture)%>|<a href="<%editpicturelink%>">Edit</a>|'
149+ .'<a href="<%deletepicturelink%>">Delete</a>This picture in sets:<%keywords%><%endif%><br/></div><%if(commentsallowed)%>'
150+ .'<div class="contenttitle"><h2>Comments</h2></div><%comments%><div class="contenttitle">'
151+ .'<h2>Add Comment</h2></div><%commentform%><%endif%>';
152+$template->setTemplate($name, $content);
153+
154+$name = 'COMMENT_BODY';
155+$content = '<div class="itemcomment id<%memberid%>"><h3><a href="<%userlinkraw%>"title="<%ip%> | Click to visit <%user%>\'s website or send an email"><%user%></a> wrote:</h3><div class="commentbody"><%body%></div><div class="commentinfo"><%date%> <%time%></div></div>' ;
156+$template->setTemplate($name, $content);
157+
158+$name = 'PROMO_TITLE';
159+$content = 'New Pictures Added!';
160+$template->setTemplate($name,$content);
161+
162+$name = 'PROMO_BODY';
163+$content = 'New pictures posted:<div id="NPG_thumbnail"><ul class="thumbnail"><%images%></ul></div><div id="NPG_footer"></div>';
164+$template->setTemplate($name,$content);
165+
166+$name = 'PROMO_IMAGES';
167+$content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,0)%>" src="<%thumbnail%>" /></a></li>';
168+$template->setTemplate($name,$content);
169+
170+?>
\ No newline at end of file