3 require_once('./../../../../config.php');
\r
5 if (!($member->isLoggedIn() && $member->isAdmin())) exit('You are not admin.');
\r
6 include_once (dirname(__FILE__).'/../config.php');
\r
11 $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_views').' ( '.
\r
12 'vpictureid int unsigned not null, '.
\r
13 'views int unsigned )';
\r
16 $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_views_log').' ( '.
\r
17 'vlpictureid int unsigned not null, '.
\r
24 if ($manager->pluginInstalled('NP_gallery'))
\r
26 $plugin =& $manager->getPlugin('NP_gallery');
\r
27 if ($plugin != NULL)
\r
28 if($plugin->getoption('deletetables')) $plugin->createOption('deletetables',__NPG_OPT_DONT_DELETE_TABLES,'yesno','no');
\r
32 if (!$NPG_CONF['viewtime']) setNPGoption('viewtime', 30 * 60);
\r
36 $query = 'CREATE TABLE IF NOT EXISTS '.sql_table('plug_gallery_template_desc').' ( '.
\r
37 'tdid int unsigned not null auto_increment PRIMARY KEY, '.
\r
38 'tdname varchar(20), '.
\r
39 'tddesc varchar(200) )';
\r
42 //if it already exists and there are no rows already, then add default
\r
43 $query = 'select * from '.sql_table('plug_gallery_template_desc');
\r
44 $res = sql_query($query);
\r
45 if(!mysql_num_rows($res)) {
\r
46 $query = 'insert into '.sql_table('plug_gallery_template_desc').' (tdid, tdname, tddesc) values (NULL, "061default", "default templates from 0.61")';
\r
48 $new_id = mysql_insert_id();
\r
49 if(!$NPG_CONF['template']) setNPGOption('template', $newid);
\r
52 //change previous template table and add reference to template_desc
\r
53 $query = 'show columns from '.sql_table('plug_gallery_template').' like "tdesc"';
\r
54 $res = sql_query($query);
\r
55 if(!mysql_num_rows($res)) {
\r
56 $query = 'ALTER TABLE '.sql_table('plug_gallery_template').
\r
57 ' add column tdesc int unsigned first ';
\r
59 if(!$new_id) $new_id = 1;
\r
60 $query = 'UPDATE '.sql_table('plug_gallery_template').' set tdesc = '.$new_id;
\r
65 $query = 'show columns from '.sql_table('plug_gallery_comment').' like "cuser"';
\r
66 $res = sql_query($query);
\r
67 if(!mysql_num_rows($res)) {
\r
68 $query = 'ALTER TABLE '.sql_table('plug_gallery_comment').
\r
69 ' add column cuser varchar(40), '.
\r
70 ' add column cmail varchar(100), '.
\r
71 ' add column chost varchar(60), '.
\r
72 ' add column cip varchar(15)';
\r
77 $query = 'show columns from '.sql_table('plug_gallery_album').' like "commentsallowed"';
\r
78 $res = sql_query($query);
\r
79 if(!mysql_num_rows($res)) {
\r
80 $query = 'ALTER TABLE '.sql_table('plug_gallery_album').
\r
81 ' add column commentsallowed tinyint DEFAULT 1 ';
\r
86 if (!NPG_TEMPLATE::exists('default075')) {
\r
87 $template = new NPG_TEMPLATE(NPG_TEMPLATE::createnew('default075','default 0.75 templates'));
\r
88 if(!$NPG_CONF['template']) setNPGOption('template', $template->getID());
\r
90 $name = 'LIST_HEADER';
\r
91 $content = '<%breadcrumb%><hr/><table width=100% ><thead>'
\r
92 .'<tr><th><a href="<%sortbytitle%>">Title</a></th>'
\r
93 .'<th><a href="<%sortbydescription%>">Description</a></th>'
\r
94 .'<th><a href="<%sortbyowner%>">Owner</a></th>'
\r
95 .'<th><a href="<%sortbymodified%>">Last Modified</a></th>'
\r
96 .'<th><a href="<%sortbynumber%>">Images</a></th></tr></thead><tbody>';
\r
97 $template->setTemplate($name, $content);
\r
99 $name = 'LIST_BODY';
\r
100 $content = '<tr><td><a href="<%albumlink%>"><%title%></a></td>'
\r
101 .'<td><%description%></td>'
\r
102 .'<td><%ownername%></td>'
\r
103 .'<td><%modified%></td>'
\r
104 .'<td><%numberofimages%></td></tr>';
\r
105 $template->setTemplate($name, $content);
\r
107 $name = 'LIST_FOOTER';
\r
108 $content = '</tbody></table><hr/><br />'
\r
109 .'<%if(canaddalbum)%>'
\r
110 .'<a href="<%addalbumlink%>">Add New Album | </a>'
\r
112 .'<%if(canaddpicture)%>'
\r
113 .'<a href="<%addpictureslink%>"onclick="window.open(this.href,\'addpicture\',\'status=no,toolbar=no,scrollbars=no,resizable=yes,width=600,height=400\');return false;">'
\r
114 .' Add Pictures</a>'
\r
116 $template->setTemplate($name, $content);
\r
119 $name = 'ALBUM_HEADER';
\r
120 $content = '<%breadcrumb%><hr/><div id="NPG_thumbnail"><ul class="thumbnail">';
\r
121 $template->setTemplate($name, $content);
\r
123 $name = 'ALBUM_BODY';
\r
124 $content = '<li><a href="<%picturelink%>"><img style="<%centeredtopmargin(140,-10)%>" src="<%thumbnail%>" /></a><br/><%picturetitle%><br/><%pictureviews%> views</li>';
\r
125 $template->setTemplate($name, $content);
\r
127 $name = 'ALBUM_FOOTER';
\r
128 $content = '</ul></div><div id="NPG_footer"><br /><hr/>'
\r
129 .'<%if(caneditalbum)%>'
\r
130 .'<a href="<%editalbumlink%>">Modify Album </a> | '
\r
132 .'<%if(canaddpicture)%>'
\r
133 .'<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>'
\r
136 $template->setTemplate($name, $content);
\r
139 $name = 'ITEM_HEADER';
\r
140 $content = '<%breadcrumb%><br/><a href="<%previouslink%>"> Previous |</a><a href="<%nextlink%>"> Next</a><hr/><div id="NPG_picture">';
\r
141 $template->setTemplate($name, $content);
\r
143 $name = 'ITEM_BODY';
\r
144 $content = '<a href="<%fullsizelink%>" onclick="window.open(this.href,\'imagepopup\',\'status=no,toolbar=no,scrollbars=auto,resizable=yes,width=<%width%>,height=<%height%>\');return false;">'
\r
145 .'<img src="<%intermediatepicture%>" /></a>';
\r
146 $template->setTemplate($name, $content);
\r
148 $name = 'ITEM_FOOTER';
\r
149 $content = '</div><div id="NPG_footer"><br /><%description%><br/><br/>Last modified by <%owner%> on <%date%> '
\r
150 .'<%if(caneditpicture)%>'
\r
151 .'<a href="<%editpicturelink%>">Edit</a>'
\r
152 .' | <a href="<%deletepicturelink%>">Delete</a>'
\r
155 .'<div class="contenttitle"><h2>Comments</h2></div><%comments%>'
\r
156 .'<div class="contenttitle"><h2>Add Comment</h2></div><%commentform%>';
\r
157 $template->setTemplate($name, $content);
\r
159 $name = 'COMMENT_BODY';
\r
160 $content = '<div class="itemcomment id<%memberid%>">'
\r
161 .'<h3><a href="<%userlinkraw%>"'
\r
162 .'title="<%ip%> | Click to visit <%user%>\'s website or send an email">'
\r
163 .'<%user%></a> wrote:</h3>'
\r
164 .'<div class="commentbody">'
\r
165 .'<%body%></div><div class="commentinfo"><%date%> <%time%></div></div>' ;
\r
166 $template->setTemplate($name, $content);
\r
169 setNPGoption('currentversion',75);
\r
171 include(dirname(__FILE__).'/np_gallery_update075.php');
\r