Merge lp:~spirit55555/pluck-cms/hooks into lp:pluck-cms

Proposed by Anders G. Jørgensen
Status: Merged
Merged at revision: not available
Proposed branch: lp:~spirit55555/pluck-cms/hooks
Merge into: lp:pluck-cms
Diff against target: None lines
To merge this branch: bzr merge lp:~spirit55555/pluck-cms/hooks
Reviewer Review Type Date Requested Status
Sander (community) Approve
Review via email: mp+4155@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Sander (sanderth-deactivatedaccount) wrote :

Approved, Anders. It's a little difficult to review such a big changeset, but I'll dive into the hooks after the merge ;)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'admin.php'
2--- admin.php 2009-01-14 16:32:09 +0000
3+++ admin.php 2009-03-04 18:15:49 +0000
4@@ -12,6 +12,24 @@
5 * See docs/COPYING for the complete license.
6 */
7
8+//Load all the modules, so we can use hooks.
9+//This has to be done before anything else.
10+$path = opendir('data/modules');
11+while (false !== ($dir = readdir($path))) {
12+ if ($dir != '.' && $dir != '..') {
13+ if (is_dir('data/modules/'.$dir))
14+ $modules[] = $dir;
15+ }
16+}
17+closedir($path);
18+
19+foreach ($modules as $module) {
20+ if (file_exists('data/modules/'.$module.'/'.$module.'.php')) {
21+ require_once ('data/modules/'.$module.'/'.$module.'.php');
22+ $module_list[] = $module;
23+ }
24+}
25+
26 //Include security-enhancements
27 require_once ('data/inc/security.php');
28 //Include functions
29@@ -27,6 +45,7 @@
30 redirect('install.php', 3);
31 echo $lang_login2;
32 include_once ('data/inc/footer.php');
33+ exit;
34 }
35
36 else {
37@@ -68,7 +87,6 @@
38
39 //Page:New Page
40 case 'newpage':
41- $tinymce = 'yes';
42 $titelkop = $lang_kop11;
43 include_once ('data/inc/header.php');
44 include_once ('data/inc/newpage.php');
45@@ -226,7 +244,6 @@
46
47 //Page:Editpage
48 case 'editpage':
49- $tinymce = 'yes';
50 $titelkop = $lang_page3;
51 include_once ('data/inc/header.php');
52 include_once ('data/inc/editpage.php');
53@@ -256,7 +273,7 @@
54
55 //Module pages.
56 elseif (isset($module))
57- include_once ('data/inc/modules_admininclude.php');
58+ require_once ('data/inc/modules_admininclude.php');
59
60 //Unknown pages
61 else {
62
63=== modified file 'data/inc/changepass.php'
64--- data/inc/changepass.php 2009-01-07 19:46:21 +0000
65+++ data/inc/changepass.php 2009-03-04 18:15:49 +0000
66@@ -17,7 +17,7 @@
67 //Give out an "Access denied!" error.
68 echo 'Access denied!';
69 //Block all other code.
70- exit();
71+ exit;
72 }
73 ?>
74 <p>
75
76=== modified file 'data/inc/credits.php'
77--- data/inc/credits.php 2009-01-04 15:55:47 +0000
78+++ data/inc/credits.php 2009-03-04 18:15:49 +0000
79@@ -17,7 +17,7 @@
80 //Give out an "Access denied!" error.
81 echo 'Access denied!';
82 //Block all other code.
83- exit();
84+ exit;
85 }
86 ?>
87
88
89=== modified file 'data/inc/deleteimage.php'
90--- data/inc/deleteimage.php 2009-01-06 22:15:40 +0000
91+++ data/inc/deleteimage.php 2009-03-04 18:15:49 +0000
92@@ -17,7 +17,7 @@
93 //Give out an "Access denied!" error.
94 echo 'Access denied!';
95 //Block all other code.
96- exit();
97+ exit;
98 }
99
100 //Check if image exists.
101
102=== modified file 'data/inc/deletepage.php'
103--- data/inc/deletepage.php 2009-01-07 19:46:21 +0000
104+++ data/inc/deletepage.php 2009-03-04 18:15:49 +0000
105@@ -17,7 +17,7 @@
106 //Give out an "Access denied!" error.
107 echo 'Access denied!';
108 //Block all other code.
109- exit();
110+ exit;
111 }
112
113 //Check if page exists.
114
115=== modified file 'data/inc/editpage.php'
116--- data/inc/editpage.php 2009-01-10 20:58:15 +0000
117+++ data/inc/editpage.php 2009-03-04 18:15:49 +0000
118@@ -17,20 +17,22 @@
119 //Give out an "Access denied!" error.
120 echo 'Access denied!';
121 //Block all other code.
122- exit();
123+ exit;
124 }
125
126 //Include page information.
127- require_once ('data/settings/pages/'.$var1);
128+require_once ('data/settings/pages/'.$var1);
129+
130+//Load module functions.
131+foreach ($module_list as $module) {
132+ if (file_exists('data/modules/'.$module.'/'.$module.'.site.php'))
133+ require_once ('data/modules/'.$module.'/'.$module.'.site.php');
134+}
135
136 //Generate the menu on the right.
137 ?>
138 <div class="rightmenu">
139-<?php
140- //We don't want to show the message, if there aren't any pages or images.
141- if (read_imagesinpages('images') != false && read_pagesinpages('data/settings/pages', $var1) != false)
142- echo $lang_page8;
143-?>
144+<?php echo $lang_page8; ?>
145 <br />
146 <?php
147 read_imagesinpages('images');
148@@ -62,63 +64,52 @@
149 <br />
150 <table>
151 <?php
152- //Define path to the module-dir.
153- $path = 'data/modules';
154- //Open the folder.
155- $dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
156 //First count how many modules we have, and exclude disabled modules.
157- $number_modules = count(glob('data/modules/*'));
158- while ($dir = readdir($dir_handle)) {
159- if ($dir != '.' && $dir != '..') {
160- if (!module_is_compatible($dir))
161- $number_modules--;
162- }
163+ $number_modules = count($module_list);
164+ foreach ($module_list as $module) {
165+ if (!module_is_compatible($module) || !function_exists($module.'_theme_main'))
166+ $number_modules--;
167 }
168- closedir($dir_handle);
169-
170- //Loop through dirs, and display the modules.
171- $dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
172- while ($dir = readdir($dir_handle)) {
173- if ($dir != "." && $dir != "..") {
174- //Only show if module is compatible.
175- if (module_is_compatible($dir)) {
176- include ('data/modules/'.$dir.'/module_info.php');
177- ?>
178- <tr>
179- <td><?php echo $module_name; ?></td>
180- <td>
181- <select name="cont3[<?php echo $module_dir; ?>]">
182- <option value="0"><?php echo $lang_modules6; ?></option>
183- <?php
184- $counting_modules = 1;
185- while ($counting_modules <= $number_modules) {
186- //Check if this is the current setting.
187- //...and select the html-option if needed
188- if (isset($module_pageinc[$module_dir]) && $module_pageinc[$module_dir] == $counting_modules) {
189- ?>
190- <option value="<?php echo $counting_modules; ?>" selected="selected"><?php echo $counting_modules; ?></option>
191- <?php
192- }
193-
194- //...if this is no the current setting, don't select the html-option.
195- else {
196- ?>
197- <option value="<?php echo $counting_modules; ?>"><?php echo $counting_modules; ?></option>
198- <?php
199- }
200-
201- //Higher counting_modules.
202- $counting_modules++;
203- }
204- ?>
205- </select>
206- </td>
207- </tr>
208- <?php
209- }
210+
211+ //Loop through modules, and display them.
212+ foreach ($module_list as $module) {
213+ //Only show if module is compatible.
214+ if (module_is_compatible($module) && function_exists($module.'_theme_main')) {
215+ $module_info = call_user_func($module.'_info');
216+ ?>
217+ <tr>
218+ <td><?php echo $module_info['name']; ?></td>
219+ <td>
220+ <select name="cont3[<?php echo $module; ?>]">
221+ <option value="0"><?php echo $lang_modules6; ?></option>
222+ <?php
223+ $counting_modules = 1;
224+ while ($counting_modules <= $number_modules) {
225+ //Check if this is the current setting.
226+ //...and select the html-option if needed
227+ if (isset($module_pageinc[$module]) && $module_pageinc[$module] == $counting_modules) {
228+ ?>
229+ <option value="<?php echo $counting_modules; ?>" selected="selected"><?php echo $counting_modules; ?></option>
230+ <?php
231+ }
232+
233+ //...if this is no the current setting, don't select the html-option.
234+ else {
235+ ?>
236+ <option value="<?php echo $counting_modules; ?>"><?php echo $counting_modules; ?></option>
237+ <?php
238+ }
239+
240+ //Higher counting_modules.
241+ $counting_modules++;
242+ }
243+ ?>
244+ </select>
245+ </td>
246+ </tr>
247+ <?php
248 }
249 }
250- closedir($dir_handle);
251 ?>
252 </table>
253 </td>
254
255=== modified file 'data/inc/footer.php'
256--- data/inc/footer.php 2008-12-29 00:00:05 +0000
257+++ data/inc/footer.php 2009-03-04 18:15:49 +0000
258@@ -17,7 +17,7 @@
259 //Give out an "Access denied!" error.
260 echo 'Access denied!';
261 //Block all other code.
262- exit();
263+ exit;
264 }
265 ?>
266 <div id="somp"><?php echo $lang_footer; ?></div>
267
268=== modified file 'data/inc/functions.admin.php'
269--- data/inc/functions.admin.php 2009-01-10 20:58:15 +0000
270+++ data/inc/functions.admin.php 2009-03-04 18:17:05 +0000
271@@ -17,7 +17,7 @@
272 //Give out an "Access denied!" error.
273 echo 'Access denied!';
274 //Block all other code.
275- exit();
276+ exit;
277 }
278
279 //Function: read the available languages.
280@@ -30,7 +30,7 @@
281 if ($file != $not_this_file) {
282 include ('data/inc/lang/'.$file);
283 ?>
284- <option value='<?php echo $file; ?>'><?php echo $lang; ?></option>
285+ <option value='<?php echo $file; ?>'><?php echo $lang; ?></option>
286 <?php
287 }
288 }
289@@ -51,7 +51,9 @@
290 <img src="data/image/image_small.png" alt="" />
291 </span>
292 <span>
293- <span><a style="font-size: 16px !important;" href="images/<?php echo $file; ?>" target="_blank"><?php echo $file; ?></a></span>
294+ <span>
295+ <a style="font-size: 16px !important;" href="images/<?php echo $file; ?>" target="_blank"><?php echo $file; ?></a>
296+ </span>
297 <br />
298 <a style="font-size: 14px;" href="#" onclick="tinyMCE.execCommand('mceInsertContent',false,'&lt;img src=\'images/<?php echo $file; ?>\' alt=\'\' />');return false;"><?php echo $lang_page7; ?></a>
299 </span>
300@@ -59,8 +61,6 @@
301 <?php
302 }
303 }
304- else
305- return false;
306 }
307
308 //Function: read out the pages to let them be included in pages as link
309@@ -89,8 +89,6 @@
310 }
311 }
312 }
313- else
314- return false;
315 }
316
317 //Function: display a menudiv.
318@@ -118,14 +116,14 @@
319 function count_trashcan() {
320 //Pages
321 $count_pages_array = glob('data/trash/pages/*.*');
322- if ((isset($count_pages_array)) && (!empty($count_pages_array)))
323+ if (isset($count_pages_array) && !empty($count_pages_array))
324 $count_pages = count($count_pages_array);
325 else
326 $count_pages = null;
327
328 //Images
329 $count_images_array = glob('data/trash/images/*.*');
330- if ((isset($count_images_array)) && (!empty($count_images_array)))
331+ if (isset($count_images_array) && !empty($count_images_array))
332 $count_images = count($count_images_array);
333 else
334 $count_images = null;
335@@ -233,6 +231,10 @@
336 * @param array $modules If there are any modules on the page.
337 */
338 function save_page($name, $title, $content, $hidden = 'no', $description = null, $keywords = null, $modules = null) {
339+ //Run a few hooks.
340+ run_hook('admin_save_page', array(&$name, &$title, &$content));
341+ run_hook('admin_save_page_meta', array(&$description, &$keywords));
342+
343 //Sanitize the inputs.
344 $title = sanitize($title);
345 $content = sanitize($content, false);
346
347=== modified file 'data/inc/functions.all.php'
348--- data/inc/functions.all.php 2008-12-25 14:48:00 +0000
349+++ data/inc/functions.all.php 2009-03-04 18:15:49 +0000
350@@ -17,37 +17,32 @@
351 //Give out an "Access denied!" error.
352 echo 'Access denied!';
353 //Block all other code.
354- exit();
355+ exit;
356 }
357
358 //Function: check if module is compatible.
359 //--------------------
360 function module_is_compatible($module) {
361 //Include module information.
362- if (file_exists('data/modules/'.$module.'/module_info.php')) {
363- include ('data/modules/'.$module.'/module_info.php');
364- }
365-
366- if (isset($module_compatibility)) {
367- if (preg_match('/,/', $module_compatibility))
368- $version_compat = explode(',', $module_compatibility);
369- else
370- $version_compat [0] = $module_compatibility;
371-
372- //Now check if we have a compatible version. NOTE: If pluck is an alpha or beta version, it will always be compatible.
373- foreach ($version_compat as $number => $version) {
374- if ($version == PLUCK_VERSION || preg_match('/(alpha|beta)/', PLUCK_VERSION)) {
375- $compatible = 'yes';
376+ if (file_exists('data/modules/'.$module.'/'.$module.'.php')) {
377+ $module_info = call_user_func($module.'_info');
378+ if (isset($module_info['compatibility'])) {
379+ if (strpos($module_info['compatibility'], ','))
380+ $version_compat = explode(',', $module_info['compatibility']);
381+ else
382+ $version_compat[0] = $module_info['compatibility'];
383+
384+ //Now check if we have a compatible version. NOTE: If pluck is an alpha or beta version, it will always be compatible.
385+ foreach ($version_compat as $number => $version) {
386+ if ($version == PLUCK_VERSION || preg_match('/(alpha|beta)/', PLUCK_VERSION)) {
387+ return true;
388+ }
389 }
390 }
391 }
392
393- if (isset($compatible) && $compatible == 'yes')
394- return true;
395 else
396 return false;
397-
398- unset($compatible);
399 }
400
401 //Function: recursively delete an entire directory.
402@@ -125,7 +120,7 @@
403 function read_dir_contents($directory, $mode) {
404 $path = opendir($directory);
405 while (false !== ($file = readdir($path))) {
406- if (($file != '.') && ($file != '..')) {
407+ if ($file != '.' && $file != '..') {
408 if (is_file($directory.'/'.$file)) {
409 $files[] = $file;
410 }
411@@ -159,4 +154,23 @@
412
413 return $var;
414 }
415+
416+/**
417+ * Run a module hook.
418+ *
419+ * @param string $name Name of the hook.
420+ */
421+function run_hook($name, $par = null) {
422+ global $module_list;
423+ if (!isset($name))
424+ return;
425+ foreach ($module_list as $module) {
426+ if (is_callable($module.'_'.$name) && module_is_compatible($module)) {
427+ if ($par == null)
428+ call_user_func($module.'_'.$name);
429+ else
430+ call_user_func_array($module.'_'.$name, $par);
431+ }
432+ }
433+}
434 ?>
435\ No newline at end of file
436
437=== modified file 'data/inc/functions.site.php'
438--- data/inc/functions.site.php 2008-12-28 00:03:55 +0000
439+++ data/inc/functions.site.php 2009-03-04 18:15:49 +0000
440@@ -17,15 +17,15 @@
441 //Give out an "Access denied!" error.
442 echo 'Access denied!';
443 //Block all other code.
444- exit();
445+ exit;
446 }
447
448 //Function: get page title
449 //---------------------------------
450 function get_pagetitle() {
451- global $lang_front1;
452+ global $lang_front1, $module;
453 //Get the title if we are looking at a normal page
454- if ((isset($_GET['file'])) && (!empty($_GET['file']))) {
455+ if (isset($_GET['file']) && !empty($_GET['file'])) {
456 if (isset($_GET ['file']))
457 $filetoread = $_GET ['file'];
458
459@@ -36,39 +36,16 @@
460 }
461
462 //If page doesn't exist; display error
463- else {
464+ else
465 return $lang_front1;
466- }
467 }
468
469 //Get the title if we are looking at a module page
470- if (isset($_GET ['module']))
471- $module = $_GET ['module'];
472-
473- if (isset($_GET ['page']))
474- $page = $_GET ['page'];
475-
476- if (isset($module)) {
477- //Include module files (but only if they exist)
478- if (file_exists('data/modules/'.$module.'/module_info.php')) {
479- include ('data/modules/'.$module.'/module_info.php');
480- if (module_is_compatible($module)) {
481- if (file_exists('data/modules/'.$module.'/module_pages_site.php')) {
482- include ('data/modules/'.$module.'/module_pages_site.php');
483-
484- //Include all module-pages, but
485- //only include pages if array has been given
486- if (isset($module_page)) {
487- foreach ($module_page as $filename => $pagetitle) {
488- //Generate filename with extension
489- $filename_ext = $filename.'.php';
490- if (($module == $module_dir) && ($page == $filename)) {
491- return $pagetitle;
492- }
493- }
494- }
495- }
496- }
497+ elseif (isset($module) && module_is_compatible($module) && function_exists($module.'_page_site_list')) {
498+ $module_page_site = call_user_func($module.'_page_site_list');
499+ foreach ($module_page_site as $module_page) {
500+ if ($module_page['func'] == CURRENT_MODULE_PAGE)
501+ return $module_page['title'];
502 }
503 }
504 }
505@@ -82,18 +59,15 @@
506 function theme_meta() {
507 //Get page-info (for meta-information)
508 if (defined('CURRENT_PAGE_FILENAME')) {
509- if (file_exists('data/settings/pages/'.CURRENT_PAGE_FILENAME)) {
510+ if (file_exists('data/settings/pages/'.CURRENT_PAGE_FILENAME))
511 include ('data/settings/pages/'.CURRENT_PAGE_FILENAME);
512- }
513 }
514
515 //Check which CSS-file we need to use (LTR or RTL)
516- if ((isset($direction)) && ($direction == 'rtl')) {
517+ if (isset($direction) && $direction == 'rtl')
518 $cssfile = THEME_DIR.'/style-rtl.css';
519- }
520- else {
521+ else
522 $cssfile = THEME_DIR.'/style.css';
523- }
524
525 echo '<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />'."\n";
526 echo '<meta name="generator" content="pluck '.PLUCK_VERSION.'" />'."\n";
527@@ -104,37 +78,17 @@
528 //If we are not looking at a module: include metatag information
529 if (defined('CURRENT_PAGE_FILENAME') && file_exists('data/settings/pages/'.CURRENT_PAGE_FILENAME)) {
530 echo '<meta name="title" content="'.PAGE_TITLE.'" />'."\n";
531- if (isset($keywords) && !empty($keywords)) {
532+ if (isset($keywords) && !empty($keywords))
533 echo '<meta name="keywords" content="'.$keywords.'" />'."\n";
534- }
535- if (isset($description) && !empty($description)) {
536+ if (isset($description) && !empty($description))
537 echo '<meta name="description" content="'.$description.'" />'."\n";
538- }
539 }
540
541 //If RTL, set direction to RTL in CSS
542- if ((isset($direction)) && ($direction == 'rtl')) {
543+ if (isset($direction) && $direction == 'rtl')
544 echo '<style type="text/css">body {direction:rtl;}</style>'."\n";
545- }
546-
547- //Also include module head-inclusion files (inc_site_head.php)
548- //--------------
549- //Open the folder
550- $dir_handle = @opendir('data/modules') or die('Unable to open module directory. Check if it\'s readable.');
551-
552- //Loop through dirs
553- while ($dir = readdir($dir_handle)) {
554- if ($dir == '.' || $dir == '..')
555- continue;
556- //Include the inc_site.php if it exists, and if module is compatible
557- include ('data/modules/'.$dir.'/module_info.php');
558- if (module_is_compatible($dir)) {
559- if (file_exists('data/modules/'.$dir.'/inc_site_head.php'))
560- include ('data/modules/'.$dir.'/inc_site_head.php');
561- }
562- }
563- //Close module-dir
564- closedir($dir_handle);
565+
566+ run_hook('theme_meta');
567 }
568
569 //[THEME] FUNCTION TO SHOW SITE TITLE
570@@ -148,7 +102,7 @@
571 function theme_menu($html,$htmlactive = NULL) {
572 $files = read_dir_contents('data/settings/pages', 'files');
573 if ($files) {
574- //Sort the array
575+ //Sort the array.
576 natcasesort($files);
577
578 foreach ($files as $file) {
579@@ -157,9 +111,9 @@
580
581 include ('data/settings/pages/'.$file);
582
583- //Only display in menu if page isn't hidden by user
584+ //Only display in menu if page isn't hidden by user.
585 if (isset($hidden) && $hidden == 'no') {
586- //Check if we need to show an active link
587+ //Check if we need to show an active link.
588 if (isset($currentpage) && $currentpage == $file && $htmlactive) {
589 $html_new = str_replace('#title', $title, $htmlactive);
590 $html_new = str_replace('#file', '?file='.$file, $html_new);
591@@ -186,109 +140,71 @@
592 function theme_content() {
593 //Get needed variables
594 global $lang_front2;
595+
596 //Get the contents only if we are looking at a normal page
597 if (defined('CURRENT_PAGE_FILENAME')) {
598 //Check if page exists
599 if (file_exists('data/settings/pages/'.CURRENT_PAGE_FILENAME)) {
600 include ('data/settings/pages/'.CURRENT_PAGE_FILENAME);
601+ run_hook('theme_content_before');
602+ run_hook('theme_content', array(&$content));
603 echo $content;
604+ run_hook('theme_content_after');
605 }
606+
607 //If page doesn't exist, show error message
608- else {
609+ else
610 echo $lang_front2;
611- }
612 }
613 }
614
615 //[THEME] FUNCTION TO INCLUDE MODULES
616 //---------------------------------
617-function theme_module($place) {
618- //Include needed variables
619+function theme_area($place) {
620+ //Include needed variables.
621 global $lang_modules27;
622-
623- //If mainspace: include the page-specific modules
624+ //If mainspace: include the page-specific modules.
625 if ($place == 'main') {
626- //If we are looking at a normal page: include the inclusion file of the module (but only if specified page exists)
627- if (!defined('CURRENT_MODULE_DIR') && defined('CURRENT_PAGE_FILENAME') && file_exists('data/settings/pages/'.CURRENT_PAGE_FILENAME)) {
628- //Include page-information
629+ if (defined('CURRENT_PAGE_FILENAME') && file_exists('data/settings/pages/'.CURRENT_PAGE_FILENAME)) {
630+ //Include page-information.
631 include ('data/settings/pages/'.CURRENT_PAGE_FILENAME);
632- //First, check if we want to include any modules
633+ //First, check if we want to include any modules.
634 if (isset($module_pageinc)) {
635- //Let's make sure that the modules are dislayed in the right order
636+ //Let's make sure that the modules are dislayed in the right order.
637 natcasesort($module_pageinc);
638-
639 foreach ($module_pageinc as $module_to_include => $order) {
640- //Check if module is set to be displayed, and make sure module exists
641- if ($order != 0 && file_exists('data/modules/'.$module_to_include.'/module_info.php')) {
642- //Include module information
643- include ('data/modules/'.$module_to_include.'/module_info.php');
644- //Check if module is compatible
645- if (module_is_compatible($module_to_include)) {
646- //Check if module wants to insert pages
647- if (file_exists('data/modules/'.$module_to_include.'/module_pages_site.php')) {
648- include ('data/modules/'.$module_to_include.'/module_pages_site.php');
649- //Include the file for the "main" module area
650- include ('data/modules/'.$module_to_include.'/pages_site/'.$includepage);
651- }
652- }
653- }
654+ //Check if module is compatible, and the function exists.
655+ if (module_is_compatible($module_to_include) && function_exists($module_to_include.'_theme_main'))
656+ call_user_func($module_to_include.'_theme_main');
657 }
658 }
659 }
660- //If we are looking at a module-page: include that page
661+
662+ //If we are looking at a module page.
663 elseif (defined('CURRENT_MODULE_DIR')) {
664- //Include module files (but only if they exist)
665- if (file_exists('data/modules/'.CURRENT_MODULE_DIR.'/module_info.php')) {
666- include ('data/modules/'.CURRENT_MODULE_DIR.'/module_info.php');
667- if (module_is_compatible(CURRENT_MODULE_DIR)) {
668- if (file_exists('data/modules/'.CURRENT_MODULE_DIR.'/module_pages_site.php')) {
669- include ('data/modules/'.CURRENT_MODULE_DIR.'/module_pages_site.php');
670-
671- //Only include pages if array has been given
672- if (isset($module_page)) {
673- //Loop through module-pages
674- foreach ($module_page as $filename => $pagetitle) {
675- //And include them
676- if (CURRENT_MODULE_DIR == $module_dir && CURRENT_MODULE_PAGE == $filename) {
677- include ('data/modules/'.$module_dir.'/pages_site/'.$filename.'.php');
678- }
679- }
680- }
681- }
682- }
683- //If module is not compatible
684- else {
685- echo $lang_modules27;
686- }
687+ $module_page_site = call_user_func(CURRENT_MODULE_DIR.'_page_site_list');
688+ foreach ($module_page_site as $module_page) {
689+ if ($module_page['func'] == CURRENT_MODULE_PAGE)
690+ call_user_func(CURRENT_MODULE_DIR.'_page_site_'.$module_page['func']);
691 }
692 }
693 }
694
695- //Include the other modules
696- //Include info of theme (to see which modules we should include etc), but only if file exists
697- if (file_exists('data/settings/themes/'.THEME.'/moduleconf.php')) {
698+ //Include info of theme (to see which modules we should include etc), but only if file exists.
699+ elseif (file_exists('data/settings/themes/'.THEME.'/moduleconf.php')) {
700 include ('data/settings/themes/'.THEME.'/moduleconf.php');
701
702- //Get the array and sort it
703+ //Get the array and sort it.
704 foreach ($space as $area => $number) {
705-
706- //Sort the array, so that the modules will be displayed in correct order
707+ //Sort the array, so that the modules will be displayed in correct order.
708 natcasesort($number);
709-
710- //Get final variables
711 foreach ($number as $module => $order) {
712 //If the area where the module should be displayed is the same as the area we're currently...
713- //...processing: include the module
714- if (($area == $place) && ($order != 0)) {
715- //Check if module wants to insert pages
716- if (file_exists('data/modules/'.$module.'/module_pages_site.php')) {
717- if (module_is_compatible($module)) {
718- include ('data/modules/'.$module.'/module_pages_site.php');
719-
720- //...and include the module
721- include ('data/modules/'.$module.'/pages_site/'.$includepage);
722- }
723- }
724+ //...processing: include the module.
725+ if ($area == $place) {
726+ //Check if module is compatible, and the function exists.
727+ if (module_is_compatible($module) && function_exists($module.'_theme_main'))
728+ call_user_func($module.'_theme_main');
729 }
730 }
731 }
732
733=== modified file 'data/inc/header.php'
734--- data/inc/header.php 2009-01-08 19:40:48 +0000
735+++ data/inc/header.php 2009-03-04 18:15:49 +0000
736@@ -18,7 +18,7 @@
737 //Give out an "Access denied!" error.
738 echo 'Access denied!';
739 //Block all other code.
740- exit();
741+ exit;
742 }
743
744 //First set character encoding
745@@ -34,17 +34,13 @@
746 <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
747 <?php
748 //Check if we need rtl-direction
749-if (isset($direction) && $direction == "rtl") {
750+if (isset($direction) && $direction == "rtl")
751 echo '<link href="data/styleadmin-rtl.css" rel="stylesheet" type="text/css" media="screen" />';
752-}
753-else {
754+else
755 echo '<link href="data/styleadmin.css" rel="stylesheet" type="text/css" media="screen" />';
756-}
757
758-//Include TinyMCE, if needed
759-if (isset($tinymce) && $tinymce == 'yes') {
760- include_once ('data/inc/tinymce_inc.php');
761-}
762+//Include TinyMCE.
763+require_once ('data/inc/tinymce_inc.php');
764 ?>
765 <meta name="robots" content="noindex" />
766 <script type="text/javascript">
767@@ -70,6 +66,7 @@
768 }
769 //-->
770 </script>
771+<?php run_hook('admin_header_main'); ?>
772 </head>
773 <body>
774 <div id="menuheader">
775@@ -78,7 +75,9 @@
776 <?php include('data/inc/update_applet.php'); ?>
777 </div>
778 <h1>pluck</h1>
779+ <?php run_hook('admin_menu_outside_before'); ?>
780 <div id="menu">
781+ <?php run_hook('admin_menu_inside_before'); ?>
782 <div class="menuitem">
783 <span>
784 <img src="data/image/menu/start.png" alt="" />
785@@ -109,7 +108,9 @@
786 <a href="?action=logout" title="<?php echo $lang_kop5; ?>"><?php echo $lang_kop5; ?></a>
787 </span>
788 </div>
789+ <?php run_hook('admin_menu_inside_after'); ?>
790 </div>
791+ <?php run_hook('admin_menu_outside_after'); ?>
792 </div>
793 <div id="text">
794 <h2><?php echo $titelkop; ?></h2>
795\ No newline at end of file
796
797=== modified file 'data/inc/header2.php'
798--- data/inc/header2.php 2009-01-08 19:40:48 +0000
799+++ data/inc/header2.php 2009-03-04 18:15:49 +0000
800@@ -17,12 +17,9 @@
801 //Give out an "Access denied!" error.
802 echo 'Access denied!';
803 //Block all other code.
804- exit();
805+ exit;
806 }
807
808-//We need tinyMCE...
809-$tinymce = 'yes';
810-
811 //Then set character encoding.
812 header('Content-Type:text/html;charset=utf-8');
813 ?>
814@@ -39,8 +36,9 @@
815 echo '<link href="data/styleadmin.css" rel="stylesheet" type="text/css" media="screen" />';
816 }
817
818-//Include TinyMCE.
819-include_once ('data/inc/tinymce_inc.php');
820+//Include TinyMCE, but not on the login page.
821+if (!strpos($_SERVER['SCRIPT_FILENAME'], 'login.php'))
822+ require_once ('data/inc/tinymce_inc.php');
823 ?>
824 <meta name="robots" content="noindex" />
825 <script language="javascript" type="text/javascript">
826
827=== modified file 'data/inc/images.php'
828--- data/inc/images.php 2009-01-08 11:07:03 +0000
829+++ data/inc/images.php 2009-03-04 18:15:49 +0000
830@@ -17,7 +17,7 @@
831 //Give out an "Access denied!" error.
832 echo 'Access denied!';
833 //Block all other code.
834- exit();
835+ exit;
836 }
837
838 //Introduction text
839
840=== modified file 'data/inc/lang/en.php'
841--- data/inc/lang/en.php 2009-01-09 14:20:13 +0000
842+++ data/inc/lang/en.php 2009-02-01 12:50:18 +0000
843@@ -303,5 +303,5 @@
844 $lang_blog27 = "no category";
845 $lang_credits6 = "main developers";
846 $lang_credits7 = "contributions";
847-$lang_album19 = 'There is already an album with that name.'
848+$lang_albums19 = 'There is already an album with that name.'
849 ?>
850\ No newline at end of file
851
852=== modified file 'data/inc/language.php'
853--- data/inc/language.php 2009-01-07 19:46:21 +0000
854+++ data/inc/language.php 2009-03-04 18:15:49 +0000
855@@ -17,7 +17,7 @@
856 //Give out an "Access denied!" error.
857 echo 'Access denied!';
858 //Block all other code.
859- exit();
860+ exit;
861 }
862
863 //Introduction text.
864
865=== modified file 'data/inc/lib/tarlib.class.php'
866--- data/inc/lib/tarlib.class.php 2008-12-29 00:00:05 +0000
867+++ data/inc/lib/tarlib.class.php 2009-03-04 18:15:49 +0000
868@@ -53,7 +53,7 @@
869 //Give out an "Access denied!" error.
870 echo 'Access denied!';
871 //Block all other code.
872- exit();
873+ exit;
874 }
875
876 define('COMPRESS_GZIP',1);
877
878=== modified file 'data/inc/logout.php'
879--- data/inc/logout.php 2009-01-04 17:57:35 +0000
880+++ data/inc/logout.php 2009-03-04 18:15:49 +0000
881@@ -17,7 +17,7 @@
882 //Give out an "Access denied!" error.
883 echo 'Access denied!';
884 //Block all other code.
885- exit();
886+ exit;
887 }
888
889 echo '...';
890
891=== modified file 'data/inc/modules.php'
892--- data/inc/modules.php 2009-01-04 17:57:35 +0000
893+++ data/inc/modules.php 2009-03-04 18:15:49 +0000
894@@ -17,7 +17,7 @@
895 //Give out an "Access denied!" error.
896 echo 'Access denied!';
897 //Block all other code.
898- exit();
899+ exit;
900 }
901
902 //Introduction text.
903@@ -26,24 +26,16 @@
904 <strong><?php echo $lang_modules1; ?></strong>
905 </p>
906 <?php
907-//Define path to the module-dir.
908-$path = 'data/modules';
909-//Open the folder.
910-$dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
911
912-//Loop through dirs, and display the modules.
913-while ($dir = readdir($dir_handle)) {
914-if ($dir == '.' || $dir == '..')
915- continue;
916- if (file_exists('data/modules/'.$dir.'/module_info.php'))
917- include('data/modules/'.$dir.'/module_info.php');
918+foreach ($module_list as $module) {
919+ //Load module admin pages.
920+ if (file_exists('data/modules/'.$module.'/'.$module.'.admin.php'))
921+ require_once ('data/modules/'.$module.'/'.$module.'.admin.php');
922
923 //Only show the button if there are admincenter pages for the module, and if the modules is compatible.
924- if (file_exists('data/modules/'.$dir.'/module_pages_admin.php') && module_is_compatible($dir))
925- showmenudiv($module_name, $module_intro, 'data/modules/'.$module_dir.'/'.$module_icon, '?module='.$module_dir);
926-
927+ if (module_is_compatible($module) && function_exists($module.'_page_admin_list')) {
928+ $module_info = call_user_func($module.'_info');
929+ showmenudiv($module_info['name'], $module_info['intro'], 'data/modules/'.$module.'/'.$module_info['icon'], '?module='.$module);
930+ }
931 }
932-
933-//Close module-dir.
934-closedir($dir_handle);
935 ?>
936\ No newline at end of file
937
938=== modified file 'data/inc/modules_admininclude.php'
939--- data/inc/modules_admininclude.php 2009-01-14 16:32:09 +0000
940+++ data/inc/modules_admininclude.php 2009-03-04 18:15:49 +0000
941@@ -17,67 +17,49 @@
942 //Give out an "Access denied!" error.
943 echo 'Access denied!';
944 //Block all other code.
945- exit();
946+ exit;
947 }
948
949 //-----------------
950 //Lets start including the pages of the modules.
951 //-----------------
952
953-//Define path to the module-dir.
954-$path = 'data/modules';
955-//Open the folder.
956-$dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
957-
958 //Loop through dirs.
959-while ($dir = readdir($dir_handle)) {
960- if ($dir == '.' || $dir == '..')
961- continue;
962-
963- if (file_exists('data/modules/'.$dir.'/module_info.php'))
964- include ('data/modules/'.$dir.'/module_info.php');
965+foreach ($module_list as $dir) {
966+ //Load module admin pages.
967+ if (file_exists('data/modules/'.$module.'/'.$module.'.admin.php'))
968+ require_once ('data/modules/'.$module.'/'.$module.'.admin.php');
969
970 //Check if module is compatible, otherwise don't include pages.
971- if (module_is_compatible($dir)) {
972-
973- if (file_exists('data/modules/'.$dir.'/module_pages_admin.php')) {
974- include ('data/modules/'.$dir.'/module_pages_admin.php');
975-
976- //Include startpage of module.
977- if ($module == $module_dir && !isset($page)) {
978- $titelkop = $module_name;
979- include_once ('data/inc/header.php');
980- include ('data/modules/'.$module_dir.'/pages_admin/'.$startpage);
981- }
982-
983- //Include other module-pages,
984- //but only include pages if array has been given.
985- if (isset($module_page) && isset($page)) {
986- foreach ($module_page as $filename => $pagetitle) {
987- //Generate filename with extension
988- $filename_ext = $filename.'.php';
989- if ($module == $module_dir && $page == $filename) {
990- $titelkop = $pagetitle;
991- include_once ('data/inc/header.php');
992- include ('data/modules/'.$module_dir.'/pages_admin/'.$filename_ext);
993- }
994+ if (module_is_compatible($dir) && function_exists($dir.'_page_admin_list')) {
995+ $module_info = call_user_func($module.'_info');
996+ $module_pages = call_user_func($dir.'_page_admin_list');
997+
998+ //Include startpage of module.
999+ if ($module == $dir && !isset($page) && isset($module_pages[0])) {
1000+ $titelkop = $module_pages[0]['title'];
1001+ include_once ('data/inc/header.php');
1002+ call_user_func($dir.'_page_admin_'.$module_pages[0]['func']);
1003+ }
1004+
1005+ //Include other module-pages,
1006+ //but only include pages if array has been given.
1007+ elseif (isset($module_pages) && isset($page)) {
1008+ foreach ($module_pages as $module_page) {
1009+ if ($module == $dir && $page == $module_page['func'] && function_exists($dir.'_page_admin_'.$module_page['func'])) {
1010+ $titelkop = $module_page['title'];
1011+ include_once ('data/inc/header.php');
1012+ call_user_func($dir.'_page_admin_'.$module_page['func']);
1013 }
1014 }
1015 }
1016 }
1017
1018- //If module is not compatible
1019+ //If module is not compatible.
1020 elseif (!module_is_compatible($dir) && $module == $dir) {
1021 $titelkop = $module_name;
1022 include_once ('data/inc/header.php');
1023 echo $lang_modules27;
1024 }
1025-
1026- //Also include the module-include file (if it exists).
1027- if (file_exists('data/modules/'.$dir.'/inc_admin.php') && module_is_compatible($dir))
1028- include ('data/modules/'.$dir.'/inc_admin.php');
1029 }
1030-
1031-//Close module-dir
1032-closedir($dir_handle);
1033 ?>
1034\ No newline at end of file
1035
1036=== modified file 'data/inc/modules_install.php'
1037--- data/inc/modules_install.php 2009-01-04 17:57:35 +0000
1038+++ data/inc/modules_install.php 2009-03-04 18:15:49 +0000
1039@@ -17,7 +17,7 @@
1040 //Give out an "Access denied!" error.
1041 echo 'Access denied!';
1042 //Block all other code.
1043- exit();
1044+ exit;
1045 }
1046 ?>
1047 <p>
1048
1049=== modified file 'data/inc/modules_manage.php'
1050--- data/inc/modules_manage.php 2009-01-04 17:57:35 +0000
1051+++ data/inc/modules_manage.php 2009-03-04 18:15:49 +0000
1052@@ -17,7 +17,7 @@
1053 //Give out an "Access denied!" error.
1054 echo 'Access denied!';
1055 //Block all other code.
1056- exit();
1057+ exit;
1058 }
1059 ?>
1060 <p>
1061@@ -25,26 +25,26 @@
1062 </p>
1063 <div class="smallmenu">
1064 <span class="smallmenu_button">
1065- <a class="smallmenu_a" href="?action=module_addtosite" style="background:url(data/image/add_small.png) no-repeat;"><?php echo $lang_modules13; ?></a>
1066+ <a class="smallmenu_a" href="?action=module_addtosite" style="background: url('data/image/add_small.png') no-repeat;"><?php echo $lang_modules13; ?></a>
1067 </span>
1068 <span class="smallmenu_button">
1069- <a class="smallmenu_a" href="?action=installmodule" style="background:url(data/image/install_small.png) no-repeat;"><?php echo $lang_modules11; ?></a>
1070+ <a class="smallmenu_a" href="?action=installmodule" style="background: url('data/image/install_small.png') no-repeat;"><?php echo $lang_modules11; ?></a>
1071 </span>
1072 </div>
1073 <?php
1074 //Readout dir and put dirs in array
1075-$dirs = read_dir_contents('data/modules','dirs');
1076+$dirs = read_dir_contents('data/modules', 'dirs');
1077 //Display modules
1078 foreach($dirs as $dir) {
1079- include_once ('data/modules/'.$dir.'/module_info.php');
1080+ $module_info = call_user_func($dir.'_info');
1081 ?>
1082 <div class="menudiv">
1083 <div>
1084 <span>
1085- <img src="data/modules/<?php echo $module_dir; ?>/<?php echo $module_icon; ?>" alt="" />
1086+ <img src="data/modules/<?php echo $dir; ?>/<?php echo $module_info['icon']; ?>" alt="" />
1087 </span>
1088 <span>
1089- <span class="title-module"><?php echo $module_name; ?></span>
1090+ <span class="title-module"><?php echo $module_info['name']; ?></span>
1091 <br />
1092 <?php
1093 //If module has been disabled, show warning
1094@@ -68,13 +68,13 @@
1095 </div>
1096 <div>
1097 <p id="<?php echo $dir; ?>" style="display: none; padding-left: 43px;">
1098- <?php echo $module_intro; ?>
1099- <br />
1100- <strong><?php echo $lang_modules2; ?></strong>: <?php echo $module_version; ?>
1101- <br />
1102- <strong><?php echo $lang_modules18; ?></strong>: <?php echo $module_author; ?>
1103- <br />
1104- <strong><?php echo $lang_modules17; ?></strong>: <a href="<?php echo $module_website; ?>" target="_blank"><?php echo $module_website; ?></a>
1105+ <?php echo $module_info['intro']; ?>
1106+ <br />
1107+ <strong><?php echo $lang_modules2; ?></strong>: <?php echo $module_info['version']; ?>
1108+ <br />
1109+ <strong><?php echo $lang_modules18; ?></strong>: <?php echo $module_info['author']; ?>
1110+ <br />
1111+ <strong><?php echo $lang_modules17; ?></strong>: <a href="<?php echo $module_info['website']; ?>" target="_blank"><?php echo $module_info['website'] ?></a>
1112 <br />
1113 </p>
1114 </div>
1115
1116=== modified file 'data/inc/modules_manage_addtosite.php'
1117--- data/inc/modules_manage_addtosite.php 2008-12-28 21:51:13 +0000
1118+++ data/inc/modules_manage_addtosite.php 2009-03-04 18:15:49 +0000
1119@@ -17,7 +17,13 @@
1120 //Give out an "Access denied!" error.
1121 echo 'Access denied!';
1122 //Block all other code.
1123- exit();
1124+ exit;
1125+}
1126+
1127+//Load module functions.
1128+foreach ($module_list as $module) {
1129+ if (file_exists('data/modules/'.$module.'/'.$module.'.site.php'))
1130+ require_once ('data/modules/'.$module.'/'.$module.'.site.php');
1131 }
1132
1133 //Introduction text
1134@@ -51,62 +57,49 @@
1135 <strong><?php echo $lang_modules7; ?></strong>
1136 <table>
1137 <?php
1138- //Define path to the module-dir.
1139- $path = 'data/modules';
1140-
1141- //Open the folder.
1142- $dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
1143-
1144 //First count how many modules we have, and exclude disabled modules.
1145- $number_modules = count(glob('data/modules/*'));
1146- while ($dir = readdir($dir_handle)) {
1147- if($dir != '.' && $dir != '..') {
1148- if (!module_is_compatible($dir))
1149- $number_modules--;
1150- }
1151+ $number_modules = count($module_list);
1152+ foreach ($module_list as $module) {
1153+ if (!module_is_compatible($module) || !function_exists($module.'_theme_main'))
1154+ $number_modules--;
1155 }
1156- closedir($dir_handle);
1157
1158 //Loop through dirs, and display the modules.
1159- $dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
1160- while ($dir = readdir($dir_handle)) {
1161- if ($dir != '.' && $dir != '..') {
1162- //Only show if module is compatible.
1163- if (module_is_compatible($dir)) {
1164- include('data/modules/'.$dir.'/module_info.php');
1165- ?>
1166- <tr>
1167- <td><?php echo $module_name; ?></td>
1168- <td>
1169- <select name="<?php echo $position.'|'.$module_dir; ?>">
1170- <option value="0"><?php echo $lang_modules6; ?></option>
1171- <?php
1172- $counting_modules = 1;
1173- while ($counting_modules <= $number_modules) {
1174- //Check if this is the current setting.
1175- //...and select the html-option if needed.
1176- if (isset($space)) {
1177- $currentsetting = $space [$position] [$module_dir];
1178- if ($currentsetting == $counting_modules)
1179- echo '<option value="'.$counting_modules.'" selected="selected">'.$counting_modules.'</option>';
1180- }
1181-
1182- //...if this is not the current setting, don't select the html-option.
1183- else
1184- echo '<option value="'.$counting_modules.'">'.$counting_modules.'</option>';
1185-
1186- //Higher counting_modules.
1187- $counting_modules++;
1188- }
1189- ?>
1190- </select>
1191- </td>
1192- </tr>
1193- <?php
1194- }
1195+ foreach ($module_list as $module) {
1196+ //Only show if module is compatible.
1197+ if (module_is_compatible($module) && function_exists($module.'_theme_main')) {
1198+ $module_info = call_user_func($module.'_info');
1199+ ?>
1200+ <tr>
1201+ <td><?php echo $module_info['name']; ?></td>
1202+ <td>
1203+ <select name="<?php echo $position.'|'.$module; ?>">
1204+ <option value="0"><?php echo $lang_modules6; ?></option>
1205+ <?php
1206+ $counting_modules = 1;
1207+ while ($counting_modules <= $number_modules) {
1208+ //Check if this is the current setting.
1209+ //...and select the html-option if needed.
1210+ if (isset($space[$position][$module]))
1211+ $currentsetting = $space[$position][$module];
1212+ if (isset($currentsetting) && $currentsetting == $counting_modules)
1213+ echo '<option value="'.$counting_modules.'" selected="selected">'.$counting_modules.'</option>';
1214+
1215+ //...if this is not the current setting, don't select the html-option.
1216+ else
1217+ echo '<option value="'.$counting_modules.'">'.$counting_modules.'</option>';
1218+
1219+ //Higher counting_modules.
1220+ $counting_modules++;
1221+ unset($currentsetting);
1222+ }
1223+ ?>
1224+ </select>
1225+ </td>
1226+ </tr>
1227+ <?php
1228 }
1229 }
1230- closedir($dir_handle);
1231 ?>
1232 </table>
1233 </td>
1234
1235=== modified file 'data/inc/modules_manage_delete.php'
1236--- data/inc/modules_manage_delete.php 2008-12-29 00:00:05 +0000
1237+++ data/inc/modules_manage_delete.php 2009-03-04 18:15:49 +0000
1238@@ -17,7 +17,7 @@
1239 //Give out an "Access denied!" error.
1240 echo 'Access denied!';
1241 //Block all other code.
1242- exit();
1243+ exit;
1244 }
1245
1246 //Check if we defined a module to uninstall
1247
1248=== modified file 'data/inc/newpage.php'
1249--- data/inc/newpage.php 2009-01-07 19:46:21 +0000
1250+++ data/inc/newpage.php 2009-03-04 18:15:49 +0000
1251@@ -17,7 +17,13 @@
1252 //Give out an "Access denied!" error.
1253 echo 'Access denied!';
1254 //Block all other code.
1255- exit();
1256+ exit;
1257+}
1258+
1259+//Load module functions.
1260+foreach ($module_list as $module) {
1261+ if (file_exists('data/modules/'.$module.'/'.$module.'.site.php'))
1262+ require_once ('data/modules/'.$module.'/'.$module.'.site.php');
1263 }
1264
1265 //Generate the menu on the right.
1266@@ -55,51 +61,40 @@
1267 <br />
1268 <table>
1269 <?php
1270- //Define path to the module-dir.
1271- $path = 'data/modules';
1272- //Open the folder.
1273- $dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
1274 //First count how many modules we have, and exclude disabled modules.
1275- $number_modules = count(glob('data/modules/*'));
1276- while ($dir = readdir($dir_handle)) {
1277- if ($dir != '.' && $dir != '..') {
1278- if (!module_is_compatible($dir))
1279- $number_modules--;
1280- }
1281+ $number_modules = count($module_list);
1282+ foreach ($module_list as $module) {
1283+ if (!module_is_compatible($module) || !function_exists($module.'_theme_main'))
1284+ $number_modules--;
1285 }
1286- closedir($dir_handle);
1287
1288- //Loop through dirs, and display the modules.
1289- $dir_handle = @opendir($path) or die('Unable to open '.$path.'. Check if it\'s readable.');
1290- while ($dir = readdir($dir_handle)) {
1291- if ($dir != "." && $dir != "..") {
1292- //Only show if module is compatible.
1293- if (module_is_compatible($dir)) {
1294- include ('data/modules/'.$dir.'/module_info.php');
1295- ?>
1296- <tr>
1297- <td><?php echo $module_name; ?></td>
1298- <td>
1299- <select name="cont3[<?php echo $module_dir; ?>]">
1300- <option value="0"><?php echo $lang_modules6; ?></option>
1301- <?php
1302- $counting_modules = 1;
1303- while ($counting_modules <= $number_modules) {
1304- ?>
1305- <option value="<?php echo $counting_modules; ?>"><?php echo $counting_modules; ?></option>
1306- <?php
1307- //Higher counting_modules.
1308- $counting_modules++;
1309- }
1310- ?>
1311- </select>
1312- </td>
1313- </tr>
1314- <?php
1315- }
1316+ //Loop through modules, and display them.
1317+ foreach ($module_list as $module) {
1318+ //Only show if module is compatible.
1319+ if (module_is_compatible($module) && function_exists($module.'_theme_main')) {
1320+ $module_info = call_user_func($module.'_info');
1321+ ?>
1322+ <tr>
1323+ <td><?php echo $module_info['name']; ?></td>
1324+ <td>
1325+ <select name="cont3[<?php echo $module; ?>]">
1326+ <option value="0"><?php echo $lang_modules6; ?></option>
1327+ <?php
1328+ $counting_modules = 1;
1329+ while ($counting_modules <= $number_modules) {
1330+ ?>
1331+ <option value="<?php echo $counting_modules; ?>"><?php echo $counting_modules; ?></option>
1332+ <?php
1333+ //Higher counting_modules.
1334+ $counting_modules++;
1335+ }
1336+ ?>
1337+ </select>
1338+ </td>
1339+ </tr>
1340+ <?php
1341 }
1342 }
1343- closedir($dir_handle);
1344 ?>
1345 </table>
1346 </td>
1347
1348=== modified file 'data/inc/options.php'
1349--- data/inc/options.php 2009-01-04 17:57:35 +0000
1350+++ data/inc/options.php 2009-03-04 18:15:49 +0000
1351@@ -17,7 +17,7 @@
1352 //Give out an "Access denied!" error.
1353 echo 'Access denied!';
1354 //Block all other code.
1355- exit();
1356+ exit;
1357 }
1358
1359 //Introduction text
1360
1361=== modified file 'data/inc/page.php'
1362--- data/inc/page.php 2009-01-06 22:15:40 +0000
1363+++ data/inc/page.php 2009-03-04 18:15:49 +0000
1364@@ -17,7 +17,7 @@
1365 //Give out an "Access denied!" error.
1366 echo 'Access denied!';
1367 //Block all other code.
1368- exit();
1369+ exit;
1370 }
1371
1372 //Introduction text.
1373@@ -43,6 +43,7 @@
1374 <img src="data/image/page.png" alt="" />
1375 </span>
1376 <span class="title-page"><?php echo $title; ?></span>
1377+ <?php run_hook('admin_page_list_before'); ?>
1378 <span>
1379 <a href="?action=editpage&amp;var1=<?php echo $file; ?>">
1380 <img src="data/image/edit.png" title="<?php echo $lang_page3; ?>" alt="<?php echo $lang_page3; ?>" />
1381@@ -68,6 +69,7 @@
1382 <img src="data/image/delete.png" title="<?php echo $lang_trash1; ?>" alt="<?php echo $lang_trash1; ?>" />
1383 </a>
1384 </span>
1385+ <?php run_hook('admin_page_list_after'); ?>
1386 </div>
1387 <?php
1388 }
1389
1390=== modified file 'data/inc/page_editmeta.php'
1391--- data/inc/page_editmeta.php 2009-01-06 22:15:40 +0000
1392+++ data/inc/page_editmeta.php 2009-03-04 18:15:49 +0000
1393@@ -17,7 +17,7 @@
1394 //Give out an "Access denied!" error.
1395 echo 'Access denied!';
1396 //Block all other code.
1397- exit();
1398+ exit;
1399 }
1400
1401 //Include the actual siteinfo
1402
1403=== modified file 'data/inc/pagedown.php'
1404--- data/inc/pagedown.php 2009-01-06 22:15:40 +0000
1405+++ data/inc/pagedown.php 2009-03-04 18:15:49 +0000
1406@@ -17,7 +17,7 @@
1407 //Give out an "Access denied!" error.
1408 echo 'Access denied!';
1409 //Block all other code.
1410- exit();
1411+ exit;
1412 }
1413
1414 //Check if file exists
1415
1416=== modified file 'data/inc/pageup.php'
1417--- data/inc/pageup.php 2009-01-06 22:15:40 +0000
1418+++ data/inc/pageup.php 2009-03-04 18:15:49 +0000
1419@@ -17,7 +17,7 @@
1420 //Give out an "Access denied!" error.
1421 echo 'Access denied!';
1422 //Block all other code.
1423- exit();
1424+ exit;
1425 }
1426
1427 //Check if file exists
1428
1429=== modified file 'data/inc/settings.php'
1430--- data/inc/settings.php 2009-01-07 19:46:21 +0000
1431+++ data/inc/settings.php 2009-03-04 18:15:49 +0000
1432@@ -17,7 +17,7 @@
1433 //Give out an "Access denied!" error.
1434 echo 'Access denied!';
1435 //Block all other code.
1436- exit();
1437+ exit;
1438 }
1439
1440 //Include old settings, to display them.
1441
1442=== modified file 'data/inc/start.php'
1443--- data/inc/start.php 2009-01-04 17:57:35 +0000
1444+++ data/inc/start.php 2009-03-04 18:15:49 +0000
1445@@ -17,7 +17,7 @@
1446 //Give out an "Access denied!" error.
1447 echo 'Access denied!';
1448 //Block all other code.
1449- exit();
1450+ exit;
1451 }
1452
1453 //Introduction text
1454@@ -27,7 +27,6 @@
1455 <br />
1456 <?php echo $lang_start9; ?>
1457 </p>
1458-
1459 <span class="kop2"><?php echo $lang_start10; ?></span>
1460 <?php
1461 //Show the divs
1462
1463=== modified file 'data/inc/theme.php'
1464--- data/inc/theme.php 2009-01-08 11:07:03 +0000
1465+++ data/inc/theme.php 2009-03-04 18:15:49 +0000
1466@@ -17,7 +17,7 @@
1467 //Give out an "Access denied!" error.
1468 echo 'Access denied!';
1469 //Block all other code.
1470- exit();
1471+ exit;
1472 }
1473 ?>
1474 <div class="rightmenu">
1475
1476=== modified file 'data/inc/themeinstall.php'
1477--- data/inc/themeinstall.php 2009-01-08 11:07:03 +0000
1478+++ data/inc/themeinstall.php 2009-03-04 18:15:49 +0000
1479@@ -17,7 +17,7 @@
1480 //Give out an "Access denied!" error.
1481 echo 'Access denied!';
1482 //Block all other code.
1483- exit();
1484+ exit;
1485 }
1486 ?>
1487 <p>
1488
1489=== modified file 'data/inc/tinymce_inc.php'
1490--- data/inc/tinymce_inc.php 2009-01-10 20:58:15 +0000
1491+++ data/inc/tinymce_inc.php 2009-03-04 18:15:49 +0000
1492@@ -19,7 +19,7 @@
1493 //Give out an "Access denied!" error.
1494 echo 'Access denied!';
1495 //Block all other code.
1496- exit();
1497+ exit;
1498 }
1499
1500 //First check out which language we use and which tinymce-language we need
1501
1502=== modified file 'data/inc/trashcan.php'
1503--- data/inc/trashcan.php 2009-01-07 19:46:21 +0000
1504+++ data/inc/trashcan.php 2009-03-04 18:15:49 +0000
1505@@ -17,7 +17,7 @@
1506 //Give out an "Access denied!" error.
1507 echo 'Access denied!';
1508 //Block all other code.
1509- exit();
1510+ exit;
1511 }
1512 ?>
1513 <p>
1514
1515=== modified file 'data/inc/trashcan_applet.php'
1516--- data/inc/trashcan_applet.php 2009-01-04 17:57:35 +0000
1517+++ data/inc/trashcan_applet.php 2009-03-04 18:15:49 +0000
1518@@ -17,7 +17,7 @@
1519 //Give out an "Access denied!" error.
1520 echo 'Access denied!';
1521 //Block all other code.
1522- exit();
1523+ exit;
1524 }
1525
1526 //Count items in trashcan
1527
1528=== modified file 'data/inc/trashcan_deleteitem.php'
1529--- data/inc/trashcan_deleteitem.php 2009-01-07 19:46:21 +0000
1530+++ data/inc/trashcan_deleteitem.php 2009-03-04 18:15:49 +0000
1531@@ -17,7 +17,7 @@
1532 //Give out an "Access denied!" error.
1533 echo 'Access denied!';
1534 //Block all other code.
1535- exit();
1536+ exit;
1537 }
1538
1539 //Page
1540
1541=== modified file 'data/inc/trashcan_empty.php'
1542--- data/inc/trashcan_empty.php 2009-01-04 17:57:35 +0000
1543+++ data/inc/trashcan_empty.php 2009-03-04 18:15:49 +0000
1544@@ -17,7 +17,7 @@
1545 //Give out an "Access denied!" error.
1546 echo 'Access denied!';
1547 //Block all other code.
1548- exit();
1549+ exit;
1550 }
1551
1552 //Images
1553
1554=== modified file 'data/inc/trashcan_restoreitem.php'
1555--- data/inc/trashcan_restoreitem.php 2009-01-07 19:46:21 +0000
1556+++ data/inc/trashcan_restoreitem.php 2009-03-04 18:15:49 +0000
1557@@ -17,7 +17,7 @@
1558 //Give out an "Access denied!" error.
1559 echo 'Access denied!';
1560 //Block all other code.
1561- exit();
1562+ exit;
1563 }
1564
1565 //If we want to restore a page.
1566
1567=== modified file 'data/inc/trashcan_viewitem.php'
1568--- data/inc/trashcan_viewitem.php 2009-01-07 19:46:21 +0000
1569+++ data/inc/trashcan_viewitem.php 2009-03-04 18:15:49 +0000
1570@@ -17,7 +17,7 @@
1571 //Give out an "Access denied!" error.
1572 echo 'Access denied!';
1573 //Block all other code.
1574- exit();
1575+ exit;
1576 }
1577
1578 if ($var2 == 'page' && file_exists('data/trash/pages/'.$var1)) {
1579
1580=== modified file 'data/inc/update_applet.php'
1581--- data/inc/update_applet.php 2009-01-04 17:57:35 +0000
1582+++ data/inc/update_applet.php 2009-03-04 18:15:49 +0000
1583@@ -17,7 +17,7 @@
1584 //Give out an "Access denied!" error.
1585 echo 'Access denied!';
1586 //Block all other code.
1587- exit();
1588+ exit;
1589 }
1590
1591 //First get the day of the year
1592
1593=== modified file 'data/inc/variables.all.php'
1594--- data/inc/variables.all.php 2009-01-11 12:51:36 +0000
1595+++ data/inc/variables.all.php 2009-03-04 18:15:49 +0000
1596@@ -17,7 +17,7 @@
1597 //Give out an "Access denied!" error.
1598 echo 'Access denied!';
1599 //Block all other code.
1600- exit();
1601+ exit;
1602 }
1603
1604 //Include Translation data.
1605@@ -26,6 +26,14 @@
1606 if ($langpref != 'en.php')
1607 require_once ('data/inc/lang/'.$langpref);
1608
1609+foreach ($module_list as $module) {
1610+ if (file_exists('data/modules/'.$module.'/lang/en.php'))
1611+ require_once ('data/modules/'.$module.'/lang/en.php');
1612+ if ($langpref != 'en.php' && file_exists('data/modules/'.$module.'/lang/'.$langpref))
1613+ require_once ('data/modules/'.$module.'/lang/'.$langpref);
1614+}
1615+unset($module);
1616+
1617 //Variables for module programmers.
1618 if (file_exists('data/settings/options.php'))
1619 require_once ('data/settings/options.php');
1620
1621=== modified file 'data/inc/variables.site.php'
1622--- data/inc/variables.site.php 2008-12-25 14:48:00 +0000
1623+++ data/inc/variables.site.php 2009-03-04 18:15:49 +0000
1624@@ -17,7 +17,7 @@
1625 //Give out an "Access denied!" error.
1626 echo 'Access denied!';
1627 //Block all other code.
1628- exit();
1629+ exit;
1630 }
1631
1632 //Constants for module programmers
1633
1634=== added file 'data/modules/albums/albums.admin.php'
1635--- data/modules/albums/albums.admin.php 1970-01-01 00:00:00 +0000
1636+++ data/modules/albums/albums.admin.php 2009-02-04 17:49:59 +0000
1637@@ -0,0 +1,417 @@
1638+<?php
1639+require_once ('data/modules/albums/functions.php');
1640+
1641+function albums_page_admin_list() {
1642+ global $lang_albums, $lang_albums5, $lang_albums6, $lang_albums15, $lang_kop13, $lang_updown5;
1643+ $module_page_admin[] = array(
1644+ 'func' => 'albums',
1645+ 'title' => $lang_albums
1646+ );
1647+ $module_page_admin[] = array(
1648+ 'func' => 'editalbum',
1649+ 'title' => $lang_albums6
1650+ );
1651+ $module_page_admin[] = array(
1652+ 'func' => 'deletealbum',
1653+ 'title' => $lang_albums5
1654+ );
1655+ $module_page_admin[] = array(
1656+ 'func' => 'editimage',
1657+ 'title' => $lang_albums15
1658+ );
1659+ $module_page_admin[] = array(
1660+ 'func' => 'deleteimage',
1661+ 'title' => $lang_kop13
1662+ );
1663+ $module_page_admin[] = array(
1664+ 'func' => 'imageup',
1665+ 'title' => $lang_updown5
1666+ );
1667+ $module_page_admin[] = array(
1668+ 'func' => 'imagedown',
1669+ 'title' => $lang_updown5
1670+ );
1671+ return $module_page_admin;
1672+}
1673+
1674+function albums_page_admin_albums() {
1675+ global $cont1, $lang_albums1, $lang_albums2, $lang_albums3, $lang_albums4, $lang_albums19, $lang_install13, $lang_theme12;
1676+ ?>
1677+ <p>
1678+ <strong><?php echo $lang_albums1; ?></strong>
1679+ </p>
1680+ <span class="kop2"><?php echo $lang_albums2; ?></span>
1681+ <br />
1682+ <?php
1683+ read_albums('data/settings/modules/albums');
1684+ //Check if the PHP-gd module is installed on server.
1685+ if (extension_loaded('gd')) {
1686+ ?>
1687+ <br /><br />
1688+ <label class="kop2" for="cont1"><?php echo $lang_albums3; ?></label>
1689+ <br />
1690+ <form method="post" action="">
1691+ <span class="kop4"><?php echo $lang_albums4; ?></span>
1692+ <br />
1693+ <input name="cont1" id="cont1" type="text" />
1694+ <input type="submit" name="Submit" value="<?php echo $lang_install13; ?>" />
1695+ </form>
1696+ <?php
1697+ //When form is submitted.
1698+ if (isset($_POST['Submit'])) {
1699+ if (isset($cont1) && file_exists('data/settings/modules/albums/'.$cont1))
1700+ echo '<span class="red">'.$lang_albums19.'</span>';
1701+
1702+ elseif (isset($cont1)) {
1703+ //Delete unwanted characters.
1704+ $cont1 = str_replace ('"','', $cont1);
1705+ $cont1 = str_replace (' ','', $cont1);
1706+ $cont1 = str_replace ('\'','', $cont1);
1707+ $cont1 = str_replace ('.','', $cont1);
1708+ $cont1 = str_replace ('/','', $cont1);
1709+
1710+ //Create and chmod directories.
1711+ mkdir ('data/settings/modules/albums/'.$cont1);
1712+ mkdir ('data/settings/modules/albums/'.$cont1.'/thumb');
1713+ chmod ('data/settings/modules/albums/'.$cont1, 0777);
1714+ chmod ('data/settings/modules/albums/'.$cont1.'/thumb', 0777);
1715+ redirect('?module=albums', 0);
1716+ }
1717+ }
1718+ }
1719+
1720+ //If PHP-gd module is not installed.
1721+ elseif (!extension_loaded('gd')) {
1722+ ?>
1723+ <p class="red"><?php echo $lang_albums16; ?></p>
1724+ <?php
1725+ }
1726+ ?>
1727+ <p>
1728+ <a href="?action=modules">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a>
1729+ </p>
1730+<?php
1731+}
1732+
1733+function albums_page_admin_editalbum() {
1734+ global $cont1, $cont2, $cont3, $lang_albums8, $lang_albums9, $lang_albums10, $lang_albums11, $lang_albums12, $lang_albums13, $lang_albums17, $lang_image2, $lang_install13, $lang_install17, $lang_theme12, $var1;
1735+
1736+ //Check if album exists
1737+ if (file_exists('data/settings/modules/albums/'.$var1)) {
1738+ //Introduction text.
1739+ ?>
1740+ <p>
1741+ <strong><?php echo $lang_albums8; ?></strong>
1742+ </p>
1743+ <?php
1744+ //Edit images
1745+ ?>
1746+ <span class="kop2"><?php echo $lang_albums9; ?></span>
1747+ <br />
1748+ <?php
1749+ read_albumimages('data/settings/modules/albums/'.$var1);
1750+
1751+ //New images upload
1752+ ?>
1753+ <p>
1754+ <span class="kop2"><?php echo $lang_albums10; ?></span>
1755+ <br />
1756+ <span class="kop4"><?php echo $lang_albums13; ?></span>
1757+ </p>
1758+ <form method="post" action="" enctype="multipart/form-data">
1759+ <label class="kop2" for="cont1"><?php echo $lang_install17; ?></label>
1760+ <br />
1761+ <input name="cont1" id="cont1" type="text" />
1762+ <br /><br />
1763+ <label class="kop2" for="cont2"><?php echo $lang_albums11; ?></label>
1764+ <br />
1765+ <textarea cols="50" rows="5" name="cont2" id="cont2"></textarea>
1766+ <br /><br />
1767+ <input type="file" name="imagefile" id="imagefile" />
1768+ <br />
1769+ <label class="kop4" for="cont3"><?php echo $lang_albums12; ?></label>
1770+ <input name="cont3" id="cont3" type="text" size="3" value="85" />
1771+ <br /><br />
1772+ <input type="submit" name="Submit" value="<?php echo $lang_install13; ?>" />
1773+ </form>
1774+ <?php
1775+ //Let's process the image...
1776+ if (isset($_POST['Submit'])) {
1777+ //Define some variables
1778+ $imageme = $_FILES['imagefile']['name'];
1779+ list($imageze, $ext) = explode('.', $imageme);
1780+ $fullimage = 'data/settings/modules/albums/'.$var1.'/'.$imageme;
1781+ $thumbimage = 'data/settings/modules/albums/'.$var1.'/thumb/'.$imageme;
1782+ $tempimage = 'data/settings/modules/albums/'.$var1.'/temp.jpg';
1783+
1784+ //First: Upload the image.
1785+ //If file is pjpeg or jpeg: Accept.
1786+ if ($_FILES['imagefile']['type'] == 'image/jpeg' || $_FILES['imagefile']['type'] == 'image/pjpeg') {
1787+ copy($_FILES['imagefile']['tmp_name'], 'data/settings/modules/albums/'.$var1.'/'.$_FILES['imagefile']['name']) or die ('Error: Upload failed!');
1788+
1789+ //If the extension is with capitals, we have to rename it...
1790+ if ($ext == 'JPG') {
1791+ rename($fullimage, 'data/settings/modules/albums/'.$var1.'/'.$imageze.'.jpg');
1792+ $fullimage = 'data/settings/modules/albums/'.$var1.'/'.$imageze.'.jpg';
1793+ $thumbimage = 'data/settings/modules/albums/'.$var1.'/thumb/'.$imageze.'.jpg';
1794+ }
1795+
1796+ //Define which filenames are already in use, and define what filename we should use.
1797+ if (file_exists('data/settings/modules/albums/'.$var1.'/image1.jpg')) {
1798+ $i = 2;
1799+ $o = 3;
1800+ while (file_exists('data/settings/modules/albums/'.$var1.'/image'.$i.'.jpg') || file_exists('data/settings/modules/albums/'.$var1.'/image'.$o.'.jpg')) {
1801+ $i++;
1802+ $o++;
1803+ }
1804+ $newfile = 'image'.$i;
1805+ }
1806+ else
1807+ $newfile = 'image1';
1808+
1809+ //Then rename the file and give it the right filename, also define new image-variables.
1810+ rename($fullimage, 'data/settings/modules/albums/'.$var1.'/'.$newfile.'.jpg');
1811+ $fullimage = 'data/settings/modules/albums/'.$var1.'/'.$newfile.'.jpg';
1812+ $thumbimage = 'data/settings/modules/albums/'.$var1.'/thumb/'.$newfile.'.jpg';
1813+
1814+ //FIXME: Need to CHMOD the full image.
1815+ }
1816+
1817+ //Block images other then JPG.
1818+ else {
1819+ echo '<p><span class="red">'.$lang_image2.'</span></p>';
1820+ include_once ('data/inc/footer.php');
1821+ exit;
1822+ }
1823+
1824+ //Copy the image to the thumbdir.
1825+ copy ($fullimage, $thumbimage) or die ('Error: Thumb copying failed!');
1826+
1827+ //Compress the big image.
1828+ $ThumbWidth = 640;
1829+ list($width, $height) = getimagesize($fullimage);
1830+ $imgratio = $width / $height;
1831+
1832+ if ($imgratio > 1) {
1833+ $newwidth = $ThumbWidth;
1834+ $newheight = $ThumbWidth / $imgratio;
1835+ }
1836+
1837+ else {
1838+ $newheight = $ThumbWidth;
1839+ $newwidth = $ThumbWidth * $imgratio;
1840+ }
1841+
1842+ $resized_img = imagecreatetruecolor($newwidth, $newheight);
1843+ $new_img = imagecreatefromjpeg($fullimage);
1844+
1845+ imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
1846+ ImageJpeg($resized_img, $tempimage, $cont3);
1847+ ImageDestroy($resized_img);
1848+ ImageDestroy($new_img);
1849+ unlink($fullimage);
1850+ rename($tempimage, $fullimage);
1851+
1852+ //Then make a thumb from the image.
1853+ $ThumbWidth = 200;
1854+ list($width, $height) = getimagesize($thumbimage);
1855+ $imgratio = $width / $height;
1856+
1857+ if ($imgratio > 1) {
1858+ $newwidth = $ThumbWidth;
1859+ $newheight = $ThumbWidth / $imgratio;
1860+ }
1861+
1862+ else {
1863+ $newheight = $ThumbWidth;
1864+ $newwidth = $ThumbWidth * $imgratio;
1865+ }
1866+
1867+ $resized_img = imagecreatetruecolor($newwidth, $newheight);
1868+ $new_img = imagecreatefromjpeg($thumbimage);
1869+
1870+ imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
1871+ ImageJpeg($resized_img, $tempimage);
1872+ ImageDestroy($resized_img);
1873+ ImageDestroy($new_img);
1874+ unlink($thumbimage);
1875+ rename($tempimage, $thumbimage);
1876+ chmod($thumbimage, 0777);
1877+
1878+ //Sanitize data.
1879+ $cont1 = sanitize($cont1);
1880+ $cont2 = sanitize($cont2);
1881+ $cont2 = str_replace ("\n",'<br />', $cont2);
1882+
1883+ //Then save the imageinformation.
1884+ $data = 'data/settings/modules/albums/'.$var1.'/'.$newfile.'.php';
1885+ $file = fopen($data, 'w');
1886+ fputs($file, '<?php'."\n"
1887+ .'$name = \''.$cont1.'\';'."\n"
1888+ .'$info = \''.$cont2.'\';'."\n"
1889+ .'?>');
1890+ fclose($file);
1891+ chmod($data, 0777);
1892+
1893+ //Redirect.
1894+ redirect('?module=albums&page=editalbum&var1='.$var1, 0);
1895+ }
1896+ }
1897+ ?>
1898+ <br />
1899+ <p>
1900+ <a href="?module=albums">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a>
1901+ </p>
1902+ <?php
1903+}
1904+
1905+function albums_page_admin_deletealbum() {
1906+ global $var1;
1907+
1908+ //Check if an album was defined, and if the album exists
1909+ if (isset($var1) && file_exists('data/settings/modules/albums/'.$var1)) {
1910+ recursive_remove_directory('data/settings/modules/albums/'.$var1);
1911+ }
1912+
1913+ redirect('?module=albums', 0);
1914+}
1915+
1916+function albums_page_admin_editimage() {
1917+ global $cont1, $cont2, $lang_albums11, $lang_install13, $lang_install14, $lang_install17, $var1, $var2;
1918+
1919+ //Check if an image was defined, and if the image exists
1920+ if (isset($var1) && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php')) {
1921+ //Include the image-information
1922+ include_once ('data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
1923+
1924+ //Replace html-breaks by real ones
1925+ $info = str_replace('<br />', "\n", $info);
1926+ ?>
1927+ <br />
1928+ <form name="form1" method="post" action="">
1929+ <label class="kop2" for="cont1"><?php echo $lang_install17; ?></label>
1930+ <br />
1931+ <input name="cont1" id="cont1" type="text" value="<?php echo $name; ?>" />
1932+ <br /><br />
1933+ <label class="kop2" for="cont2"><?php echo $lang_albums11; ?></label>
1934+ <br />
1935+ <textarea cols="50" rows="5" name="cont2" id="cont2"><?php echo $info; ?></textarea>
1936+ <br /><br />
1937+ <input type="submit" name="Submit" value="<?php echo $lang_install13; ?>" />
1938+ <input type="button" name="Cancel" value="<?php echo $lang_install14; ?>" onclick="javascript: window.location='?module=albums&amp;page=editalbum&amp;var1=<?php echo $var2; ?>';" />
1939+ </form>
1940+ <?php
1941+ //When the information is posted:
1942+ if (isset($_POST['Submit'])) {
1943+ //Sanitize data.
1944+ $cont1 = sanitize($cont1);
1945+ $cont2 = sanitize($cont2);
1946+ $cont2 = str_replace ("\n",'<br />', $cont2);
1947+
1948+ //Then save the imageinformation
1949+ $data = 'data/settings/modules/albums/'.$var2.'/'.$var1.'.php';
1950+ $file = fopen($data, 'w');
1951+ fputs($file, '<?php'."\n"
1952+ .'$name = \''.$cont1.'\';'."\n"
1953+ .'$info = \''.$cont2.'\';'."\n"
1954+ .'?>');
1955+ fclose($file);
1956+ chmod($data, 0777);
1957+
1958+ redirect('?module=albums&page=editalbum&var1='.$var2, 0);
1959+ }
1960+ }
1961+}
1962+
1963+function albums_page_admin_deleteimage() {
1964+ global $var1, $var2;
1965+ //Check if an image was defined, and if the image exists
1966+ if (isset($var1) && isset($var2) && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php') && file_exists('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg')) {
1967+ unlink('data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
1968+ unlink('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg');
1969+ unlink('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg');
1970+ }
1971+
1972+ redirect('?module=albums&page=editalbum&var1='.$var2, 0);
1973+}
1974+
1975+function albums_page_admin_imageup() {
1976+ global $lang_footer, $lang_updown3, $lang_updown6, $var1, $var2;
1977+
1978+ //Check if images exist.
1979+ if (file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg') && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php') && file_exists('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg')) {
1980+ //We can't higher image1, so we have to check:
1981+ if ($var1 == 'image1') {
1982+ echo $lang_updown6;
1983+ redirect('?module=albums&page=editalbum&var1='.$var2, 2);
1984+ include_once ('data/inc/footer.php');
1985+ exit;
1986+ }
1987+
1988+ //Determine the imagenumber.
1989+ list($filename, $pagenumber) = explode('e', $var1);
1990+ $higherpagenumber = $pagenumber - 1;
1991+
1992+ //First make temporary files.
1993+ rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg');
1994+ rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php');
1995+ rename('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg');
1996+
1997+ //Then make the higher images one higher.
1998+ rename('data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg');
1999+ rename('data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
2000+ rename('data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$higherpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg');
2001+
2002+ //Finally, give the temp-files its final name.
2003+ rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.jpg');
2004+ rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php', 'data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.php');
2005+ rename ('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$higherpagenumber.'.jpg');
2006+
2007+ //Show message.
2008+ echo $lang_updown3;
2009+ }
2010+
2011+ //Redirect.
2012+ redirect('?module=albums&page=editalbum&var1='.$var2, 0);
2013+}
2014+
2015+function albums_page_admin_imagedown() {
2016+ global $lang_footer, $lang_updown3, $lang_updown7, $var1, $var2;
2017+
2018+ //Check if images exist.
2019+ if (file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg') && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php') && file_exists('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg')) {
2020+ //Determine the imagenumber
2021+ list($filename, $pagenumber) = explode('e', $var1);
2022+ $lowerpagenumber = $pagenumber + 1;
2023+
2024+ //We can't lower the last image, so we have to check:
2025+ if (!file_exists('data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.jpg')) {
2026+ echo $lang_updown7;
2027+ redirect('?module=albums&page=editalbum&var1='.$var2, 2);
2028+ include_once ('data/inc/footer.php');
2029+ exit;
2030+ }
2031+
2032+ //First make temporary files.
2033+ rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg');
2034+ rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php');
2035+ rename('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg');
2036+
2037+ //Then make the higher images one higher.
2038+ rename('data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg');
2039+ rename('data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
2040+ rename('data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$lowerpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg');
2041+
2042+ //Finally, give the temp-files its final name.
2043+ rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.jpg');
2044+ rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php', 'data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.php');
2045+ rename ('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$lowerpagenumber.'.jpg');
2046+
2047+ //Show message.
2048+ echo $lang_updown3;
2049+ }
2050+
2051+ //Redirect.
2052+ redirect('?module=albums&page=editalbum&var1='.$var2, 0);
2053+}
2054+?>
2055\ No newline at end of file
2056
2057=== added file 'data/modules/albums/albums.php'
2058--- data/modules/albums/albums.php 1970-01-01 00:00:00 +0000
2059+++ data/modules/albums/albums.php 2009-02-04 17:49:59 +0000
2060@@ -0,0 +1,15 @@
2061+<?php
2062+function albums_info() {
2063+ global $lang_albums, $lang_albums7;
2064+ $module_info = array(
2065+ 'name' => $lang_albums,
2066+ 'intro' => $lang_albums7,
2067+ 'version' => '0.2',
2068+ 'author' => 'pluck development team',
2069+ 'website' => 'http://www.pluck-cms.org',
2070+ 'icon' => 'images/albums.png',
2071+ 'compatibility' => '4.7'
2072+ );
2073+ return $module_info;
2074+}
2075+?>
2076\ No newline at end of file
2077
2078=== added file 'data/modules/albums/albums.site.php'
2079--- data/modules/albums/albums.site.php 1970-01-01 00:00:00 +0000
2080+++ data/modules/albums/albums.site.php 2009-02-04 17:49:59 +0000
2081@@ -0,0 +1,102 @@
2082+<?php
2083+require_once ('data/modules/albums/functions.php');
2084+
2085+function albums_theme_main() {
2086+ //Open the module-folder
2087+ $dir_handle = @opendir('data/settings/modules/albums') or die('Unable to open data/modules. Check if it\'s readable.');
2088+
2089+ //Loop through dirs
2090+ while ($dir = readdir($dir_handle)) {
2091+ if (file_exists('data/settings/modules/albums/'.$dir.'/thumb/image1.jpg')) {
2092+ ?>
2093+ <div class="album">
2094+ <table>
2095+ <tr>
2096+ <td>
2097+ <a href="?module=albums&amp;page=viewalbum&amp;album=<?php echo $dir; ?>&amp;pageback=<?php echo CURRENT_PAGE_FILENAME; ?>" title="album <?php echo $dir; ?>"><img alt="<?php echo $dir; ?>" title="<?php echo $dir; ?>" src="data/modules/albums/albums_getimage.php?image=<?php echo $dir; ?>/thumb/image1.jpg" /></a>
2098+ </td>
2099+ <td>
2100+ <span class="albuminfo">
2101+ <a href="?module=albums&amp;page=viewalbum&amp;album=<?php echo $dir; ?>&amp;pageback=<?php echo CURRENT_PAGE_FILENAME; ?>" title="album <?php echo $dir; ?>"><?php echo $dir; ?></a>
2102+ </span>
2103+ </td>
2104+ </tr>
2105+ </table>
2106+ </div>
2107+ <?php
2108+ }
2109+ }
2110+}
2111+
2112+function albums_theme_meta() {
2113+ global $module;
2114+
2115+ //Only insert LightBox when we're viewing an album
2116+ if (isset($module) && $module == 'albums') {
2117+ ?>
2118+ <link href="data/inc/lightbox/lightbox.css" rel="stylesheet" type="text/css" media="screen" />
2119+ <script src="data/inc/lightbox/prototype.js" type="text/javascript"></script>
2120+ <script src="data/inc/lightbox/scriptaculous.js?load=effects" type="text/javascript"></script>
2121+ <script src="data/inc/lightbox/lightbox.js" type="text/javascript"></script>
2122+ <?php
2123+ }
2124+}
2125+
2126+function albums_page_site_list() {
2127+ $module_page_site[] = array(
2128+ 'func' => 'viewalbum',
2129+ 'title' => $_GET['album']
2130+ );
2131+ return $module_page_site;
2132+}
2133+
2134+function albums_page_site_viewalbum() {
2135+ global $lang_albums18, $lang_theme12;
2136+
2137+ //Predefined variable
2138+ $album = $_GET['album'];
2139+ $pageback = $_GET['pageback'];
2140+
2141+ if (!file_exists('data/settings/modules/albums/'.$album))
2142+ echo '<p>'.$lang_albums18.'</p>';
2143+
2144+ //If the album exists
2145+ else {
2146+ //Start reading out those images...
2147+ $files = read_dir_contents('data/settings/modules/albums/'.$album, 'files');
2148+ if ($files) {
2149+ natcasesort($files);
2150+ foreach ($files as $file) {
2151+ //Check if the files are JPG
2152+ list($fdirname, $ext) = explode(".", $file);
2153+ if ($ext == 'jpg') {
2154+ include_once ('data/settings/modules/albums/'.$album.'/'.$fdirname.'.php');
2155+ ?>
2156+ <div class="album">
2157+ <table>
2158+ <tr>
2159+ <td>
2160+ <a href="data/modules/albums/albums_getimage.php?image=<?php echo $album; ?>/<?php echo $fdirname; ?>.jpg" rel="lightbox[album]" title="<?php echo $name; ?>">
2161+ <img src="data/modules/albums/albums_getimage.php?image=<?php echo $album; ?>/thumb/<?php echo $fdirname; ?>.jpg" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
2162+ </a>
2163+ </td>
2164+ <td>
2165+ <span class="albuminfo"><?php echo $name; ?></span>
2166+ <br />
2167+ <i><?php echo $info; ?></i>
2168+ </td>
2169+ </tr>
2170+ </table>
2171+ </div>
2172+ <?php
2173+ }
2174+ }
2175+ }
2176+ }
2177+ ?>
2178+ <p>
2179+ <a href="?file=<?php echo $pageback; ?>" title="<?php echo $lang_theme12; ?>">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a>
2180+ </p>
2181+ <?php
2182+}
2183+?>
2184
2185=== renamed file 'data/modules/albums/pages_admin/albums_getimage.php' => 'data/modules/albums/albums_getimage.php'
2186--- data/modules/albums/pages_admin/albums_getimage.php 2008-12-28 00:03:55 +0000
2187+++ data/modules/albums/albums_getimage.php 2009-02-01 12:50:18 +0000
2188@@ -36,13 +36,13 @@
2189
2190 //...if no hacking attempts found:
2191 //Check if file exists.
2192-if (file_exists('../../../../data/settings/modules/albums/'.$image)) {
2193+if (file_exists('../../settings/modules/albums/'.$image)) {
2194 //Generate the image, make sure it doesn't end up in the visitors buffer.
2195 header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
2196 header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
2197 header('Pragma: no-cache');
2198 header('Content-Type: image/jpeg');
2199- echo readfile('../../../../data/settings/modules/albums/'.$image);
2200+ echo readfile('../../settings/modules/albums/'.$image);
2201 }
2202
2203 //If image doesn't exist, send 404 header.
2204
2205=== modified file 'data/modules/albums/functions.php'
2206--- data/modules/albums/functions.php 2008-12-28 21:30:36 +0000
2207+++ data/modules/albums/functions.php 2009-03-04 18:15:49 +0000
2208@@ -17,14 +17,14 @@
2209 //Give out an "Access denied!" error.
2210 echo 'Access denied!';
2211 //Block all other code.
2212- exit();
2213+ exit;
2214 }
2215
2216 //Two constants we use in imageup.php and imagedown.php.
2217 define('TEMP', '_temp');
2218 define('NAME', 'image');
2219
2220-//Function: readout albums
2221+//Function: Readout albums.
2222 //------------
2223 function read_albums($dir) {
2224 global $lang_albums5, $lang_albums6, $lang_albums14;
2225@@ -59,7 +59,7 @@
2226 }
2227
2228
2229-//Function: readout album-images
2230+//Function: Readout album-images.
2231 //------------
2232 function read_albumimages($dir) {
2233 global $lang_albums6, $lang_albums14, $lang_kop13, $lang_updown5, $var1;
2234@@ -74,38 +74,38 @@
2235 if ($ext == 'jpg') {
2236 include ('data/settings/modules/albums/'.$var1.'/'.$fdirname.'.php');
2237 ?>
2238- <div class="menudiv">
2239- <span>
2240- <a href="data/modules/albums/pages_admin/albums_getimage.php?image=<?php echo $var1.'/'.$fdirname; ?>.jpg" target="_blank">
2241- <img src="data/modules/albums/pages_admin/albums_getimage.php?image=<?php echo $var1; ?>/thumb/<?php echo $fdirname; ?>.jpg" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" />
2242- </a>
2243- </span>
2244- <span style="width: 500px;">
2245- <span class="kop3"><?php echo $name; ?></span>
2246- <br />
2247- <i><?php echo $info; ?></i>
2248- </span>
2249- <span>
2250- <a href="?module=albums&amp;page=editimage&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2251- <img src="data/image/edit.png" title="<?php echo $lang_albums6; ?>" alt="<?php echo $lang_albums6; ?>" />
2252- </a>
2253- </span>
2254- <span>
2255- <a href="?module=albums&amp;page=imageup&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2256- <img src="data/image/up.png" title="<?php echo $lang_updown5; ?>" alt="<?php echo $lang_updown5; ?>" />
2257- </a>
2258- </span>
2259- <span>
2260- <a href="?module=albums&amp;page=imagedown&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2261- <img src="data/image/down.png" title="<?php echo $lang_updown5; ?>" alt="<?php echo $lang_updown5; ?>" />
2262- </a>
2263- </span>
2264- <span>
2265- <a href="?module=albums&amp;page=deleteimage&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2266- <img src="data/image/delete_from_trash.png" title="<?php echo $lang_kop13; ?>" alt="<?php echo $lang_kop13; ?>" />
2267- </a>
2268- </span>
2269- </div>
2270+ <div class="menudiv">
2271+ <span>
2272+ <a href="data/modules/albums/albums_getimage.php?image=<?php echo $var1.'/'.$fdirname; ?>.jpg" target="_blank">
2273+ <img src="data/modules/albums/albums_getimage.php?image=<?php echo $var1; ?>/thumb/<?php echo $fdirname; ?>.jpg" title="<?php echo $name; ?>" alt="<?php echo $name; ?>" />
2274+ </a>
2275+ </span>
2276+ <span style="width: 500px;">
2277+ <span class="kop3"><?php echo $name; ?></span>
2278+ <br />
2279+ <i><?php echo $info; ?></i>
2280+ </span>
2281+ <span>
2282+ <a href="?module=albums&amp;page=editimage&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2283+ <img src="data/image/edit.png" title="<?php echo $lang_albums6; ?>" alt="<?php echo $lang_albums6; ?>" />
2284+ </a>
2285+ </span>
2286+ <span>
2287+ <a href="?module=albums&amp;page=imageup&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2288+ <img src="data/image/up.png" title="<?php echo $lang_updown5; ?>" alt="<?php echo $lang_updown5; ?>" />
2289+ </a>
2290+ </span>
2291+ <span>
2292+ <a href="?module=albums&amp;page=imagedown&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2293+ <img src="data/image/down.png" title="<?php echo $lang_updown5; ?>" alt="<?php echo $lang_updown5; ?>" />
2294+ </a>
2295+ </span>
2296+ <span>
2297+ <a href="?module=albums&amp;page=deleteimage&amp;var1=<?php echo $fdirname; ?>&amp;var2=<?php echo $var1; ?>">
2298+ <img src="data/image/delete_from_trash.png" title="<?php echo $lang_kop13; ?>" alt="<?php echo $lang_kop13; ?>" />
2299+ </a>
2300+ </span>
2301+ </div>
2302 <?php
2303 }
2304 }
2305
2306=== removed file 'data/modules/albums/inc_site_head.php'
2307--- data/modules/albums/inc_site_head.php 2008-12-28 00:03:55 +0000
2308+++ data/modules/albums/inc_site_head.php 1970-01-01 00:00:00 +0000
2309@@ -1,34 +0,0 @@
2310-<?php
2311-/*
2312- * This file is part of pluck, the easy content management system
2313- * Copyright (c) somp (www.somp.nl)
2314- * http://www.pluck-cms.org
2315-
2316- * Pluck is free software: you can redistribute it and/or modify
2317- * it under the terms of the GNU General Public License as published by
2318- * the Free Software Foundation, either version 3 of the License, or
2319- * (at your option) any later version.
2320-
2321- * See docs/COPYING for the complete license.
2322-*/
2323-
2324-//Make sure the file isn't accessed directly.
2325-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2326- //Give out an "Access denied!" error.
2327- echo 'Access denied!';
2328- //Block all other code.
2329- exit();
2330-}
2331-
2332-global $module;
2333-
2334-//Only insert LightBox when we're viewing an album
2335-if (isset($module) && $module == 'albums') {
2336-?>
2337- <link href="data/inc/lightbox/lightbox.css" rel="stylesheet" type="text/css" media="screen" />
2338- <script src="data/inc/lightbox/prototype.js" type="text/javascript"></script>
2339- <script src="data/inc/lightbox/scriptaculous.js?load=effects" type="text/javascript"></script>
2340- <script src="data/inc/lightbox/lightbox.js" type="text/javascript"></script>
2341-<?php
2342-}
2343-?>
2344\ No newline at end of file
2345
2346=== removed file 'data/modules/albums/module_info.php'
2347--- data/modules/albums/module_info.php 2008-12-28 21:30:36 +0000
2348+++ data/modules/albums/module_info.php 1970-01-01 00:00:00 +0000
2349@@ -1,35 +0,0 @@
2350-<?php
2351-//This is a module for pluck, an opensource content management system
2352-//Website: http://www.pluck-cms.org
2353-
2354-//MODULE NAME: albums
2355-//DESCRIPTION: this module lets the user create albums with JPEG-pictures to display on the website
2356-//LICENSE: GPLv3
2357-//This module is included with pluck
2358-
2359-global $lang_albums, $lang_albums7;
2360-
2361-//Module name
2362-$module_name = $lang_albums;
2363-
2364-//Short module introduction
2365-$module_intro = $lang_albums7;
2366-
2367-//Module dir
2368-$module_dir = 'albums';
2369-
2370-//Filename of the module-icon
2371-$module_icon = 'images/albums.png';
2372-
2373-//Version of the module
2374-$module_version = '0.2';
2375-
2376-//Author of the module
2377-$module_author = 'pluck development team';
2378-
2379-//Website of the module
2380-$module_website = 'http://www.pluck-cms.org';
2381-
2382-//Compatibility
2383-$module_compatibility = '4.6';
2384-?>
2385\ No newline at end of file
2386
2387=== removed file 'data/modules/albums/module_pages_admin.php'
2388--- data/modules/albums/module_pages_admin.php 2008-09-28 10:46:00 +0000
2389+++ data/modules/albums/module_pages_admin.php 1970-01-01 00:00:00 +0000
2390@@ -1,17 +0,0 @@
2391-<?php
2392-//This is a module for pluck, an opensource content management system
2393-//Website: http://www.pluck-cms.org
2394-
2395-//MODULE NAME: albums
2396-//DESCRIPTION: this module lets the user create albums with JPEG-pictures to display on the website
2397-//LICENSE: GPLv3
2398-//This module is included with pluck
2399-
2400-$startpage = 'albums.php';
2401-$module_page['editalbum'] = $lang_albums6;
2402-$module_page['deletealbum'] = $lang_albums5;
2403-$module_page['deleteimage'] = $lang_kop13;
2404-$module_page['editimage'] = $lang_albums15;
2405-$module_page['imageup'] = $lang_updown5;
2406-$module_page['imagedown'] = $lang_updown5;
2407-?>
2408\ No newline at end of file
2409
2410=== removed file 'data/modules/albums/module_pages_site.php'
2411--- data/modules/albums/module_pages_site.php 2008-12-28 00:03:55 +0000
2412+++ data/modules/albums/module_pages_site.php 1970-01-01 00:00:00 +0000
2413@@ -1,15 +0,0 @@
2414-<?php
2415-//This is a module for pluck, an opensource content management system
2416-//Website: http://www.pluck-cms.org
2417-
2418-//MODULE NAME: albums
2419-//DESCRIPTION: this module lets the user create albums with JPEG-pictures to display on the website
2420-//LICENSE: GPLv3
2421-//This module is included with pluck
2422-
2423-//Get albumname
2424-if (isset($_GET['album']))
2425- $module_page['viewalbum'] = $_GET['album'];
2426-
2427-$includepage = 'albums_include.php';
2428-?>
2429\ No newline at end of file
2430
2431=== removed directory 'data/modules/albums/pages_admin'
2432=== removed file 'data/modules/albums/pages_admin/albums.php'
2433--- data/modules/albums/pages_admin/albums.php 2009-01-09 14:20:13 +0000
2434+++ data/modules/albums/pages_admin/albums.php 1970-01-01 00:00:00 +0000
2435@@ -1,78 +0,0 @@
2436-<?php
2437-/*
2438- * This file is part of pluck, the easy content management system
2439- * Copyright (c) somp (www.somp.nl)
2440- * http://www.pluck-cms.org
2441-
2442- * Pluck is free software: you can redistribute it and/or modify
2443- * it under the terms of the GNU General Public License as published by
2444- * the Free Software Foundation, either version 3 of the License, or
2445- * (at your option) any later version.
2446-
2447- * See docs/COPYING for the complete license.
2448-*/
2449-
2450-//Make sure the file isn't accessed directly.
2451-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2452- //Give out an "Access denied!" error.
2453- echo 'Access denied!';
2454- //Block all other code.
2455- exit();
2456-}
2457-
2458-//First, load the functions.
2459-require_once ('data/modules/albums/functions.php');
2460-?>
2461- <p>
2462- <strong><?php echo $lang_albums1; ?></strong>
2463- </p>
2464- <span class="kop2"><?php echo $lang_albums2; ?></span>
2465- <br />
2466-<?php
2467- read_albums('data/settings/modules/albums');
2468- //Check if the PHP-gd module is installed on server.
2469- if (extension_loaded('gd')) {
2470- ?>
2471- <br /><br />
2472- <label class="kop2" for="cont1"><?php echo $lang_albums3; ?></label>
2473- <br />
2474- <form method="post" action="">
2475- <span class="kop4"><?php echo $lang_albums4; ?></span>
2476- <br />
2477- <input name="cont1" type="text" />
2478- <input type="submit" name="Submit" value="<?php echo $lang_install13; ?>" />
2479- </form>
2480- <?php
2481- //When form is submitted.
2482- if (isset($_POST['Submit'])) {
2483- if (isset($cont1) && file_exists('data/settings/modules/albums/'.$cont1))
2484- echo '<span class="red">'.$lang_album19.'</span>';
2485-
2486- elseif (isset($cont1)) {
2487- //Delete unwanted characters.
2488- $cont1 = str_replace ('"','', $cont1);
2489- $cont1 = str_replace (' ','', $cont1);
2490- $cont1 = str_replace ('\'','', $cont1);
2491- $cont1 = str_replace ('.','', $cont1);
2492- $cont1 = str_replace ('/','', $cont1);
2493-
2494- //Create and chmod directories.
2495- mkdir ('data/settings/modules/albums/'.$cont1);
2496- mkdir ('data/settings/modules/albums/'.$cont1.'/thumb');
2497- chmod ('data/settings/modules/albums/'.$cont1, 0777);
2498- chmod ('data/settings/modules/albums/'.$cont1.'/thumb', 0777);
2499- redirect('?module=albums', 0);
2500- }
2501- }
2502-}
2503-
2504-//If PHP-gd module is not installed.
2505-elseif (!extension_loaded('gd')) {
2506-?>
2507- <p class="red"><?php echo $lang_albums16; ?></p>
2508-<?php
2509-}
2510-?>
2511-<p>
2512- <a href="?action=modules">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a>
2513-</p>
2514\ No newline at end of file
2515
2516=== removed file 'data/modules/albums/pages_admin/deletealbum.php'
2517--- data/modules/albums/pages_admin/deletealbum.php 2008-12-28 00:03:55 +0000
2518+++ data/modules/albums/pages_admin/deletealbum.php 1970-01-01 00:00:00 +0000
2519@@ -1,29 +0,0 @@
2520-<?php
2521-/*
2522- * This file is part of pluck, the easy content management system
2523- * Copyright (c) somp (www.somp.nl)
2524- * http://www.pluck-cms.org
2525-
2526- * Pluck is free software: you can redistribute it and/or modify
2527- * it under the terms of the GNU General Public License as published by
2528- * the Free Software Foundation, either version 3 of the License, or
2529- * (at your option) any later version.
2530-
2531- * See docs/COPYING for the complete license.
2532-*/
2533-
2534-//Make sure the file isn't accessed directly.
2535-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2536- //Give out an "Access denied!" error.
2537- echo 'Access denied!';
2538- //Block all other code.
2539- exit();
2540-}
2541-
2542-//Check if an album was defined, and if the album exists
2543-if (isset($var1) && file_exists('data/settings/modules/albums/'.$var1)) {
2544- recursive_remove_directory('data/settings/modules/albums/'.$var1);
2545-}
2546-
2547-redirect('?module=albums', 0);
2548-?>
2549\ No newline at end of file
2550
2551=== removed file 'data/modules/albums/pages_admin/deleteimage.php'
2552--- data/modules/albums/pages_admin/deleteimage.php 2008-12-28 00:03:55 +0000
2553+++ data/modules/albums/pages_admin/deleteimage.php 1970-01-01 00:00:00 +0000
2554@@ -1,31 +0,0 @@
2555-<?php
2556-/*
2557- * This file is part of pluck, the easy content management system
2558- * Copyright (c) somp (www.somp.nl)
2559- * http://www.pluck-cms.org
2560-
2561- * Pluck is free software: you can redistribute it and/or modify
2562- * it under the terms of the GNU General Public License as published by
2563- * the Free Software Foundation, either version 3 of the License, or
2564- * (at your option) any later version.
2565-
2566- * See docs/COPYING for the complete license.
2567-*/
2568-
2569-//Make sure the file isn't accessed directly.
2570-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2571- //Give out an "Access denied!" error.
2572- echo 'Access denied!';
2573- //Block all other code.
2574- exit();
2575-}
2576-
2577-//Check if an image was defined, and if the image exists
2578-if (isset($var1) && isset($var2) && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php') && file_exists('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg')) {
2579- unlink('data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
2580- unlink('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg');
2581- unlink('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg');
2582-}
2583-
2584-redirect('?module=albums&page=editalbum&var1='.$var2, 0);
2585-?>
2586\ No newline at end of file
2587
2588=== removed file 'data/modules/albums/pages_admin/editalbum.php'
2589--- data/modules/albums/pages_admin/editalbum.php 2009-01-07 19:46:21 +0000
2590+++ data/modules/albums/pages_admin/editalbum.php 1970-01-01 00:00:00 +0000
2591@@ -1,190 +0,0 @@
2592-<?php
2593-/*
2594- * This file is part of pluck, the easy content management system
2595- * Copyright (c) somp (www.somp.nl)
2596- * http://www.pluck-cms.org
2597-
2598- * Pluck is free software: you can redistribute it and/or modify
2599- * it under the terms of the GNU General Public License as published by
2600- * the Free Software Foundation, either version 3 of the License, or
2601- * (at your option) any later version.
2602-
2603- * See docs/COPYING for the complete license.
2604-*/
2605-
2606-//Make sure the file isn't accessed directly
2607-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2608- //Give out an "Access denied!" error.
2609- echo 'Access denied!';
2610- //Block all other code.
2611- exit();
2612-}
2613-
2614-//First, load the functions
2615-require_once ('data/modules/albums/functions.php');
2616-
2617-//Check if album exists
2618-if (file_exists('data/settings/modules/albums/'.$var1)) {
2619- //Introduction text.
2620- ?>
2621- <p>
2622- <strong><?php echo $lang_albums8; ?></strong>
2623- </p>
2624- <?php
2625- //Edit images
2626- ?>
2627- <span class="kop2"><?php echo $lang_albums9; ?></span>
2628- <br />
2629- <?php
2630- read_albumimages('data/settings/modules/albums/'.$var1);
2631-
2632- //New images upload
2633- ?>
2634- <p>
2635- <span class="kop2"><?php echo $lang_albums10; ?></span>
2636- <br />
2637- <span class="kop4"><?php echo $lang_albums13; ?></span>
2638- </p>
2639- <form name="form1" method="post" action="" enctype="multipart/form-data">
2640- <label class="kop2" for="cont1"><?php echo $lang_install17; ?></label>
2641- <br />
2642- <input name="cont1" id="cont1" type="text" />
2643- <br /><br />
2644- <label class="kop2" for="cont2"><?php echo $lang_albums11; ?></label>
2645- <br />
2646- <textarea cols="50" rows="5" name="cont2" id="cont2"></textarea>
2647- <br /><br />
2648- <input type="file" name="imagefile" id="imagefile" />
2649- <br />
2650- <label class="kop4" for="cont3"><?php echo $lang_albums12; ?></label>
2651- <input name="cont3" id="cont3" type="text" size="3" value="85" />
2652- <br /><br />
2653- <input type="submit" name="Submit" value="<?php echo $lang_install13; ?>" />
2654- </form>
2655- <?php
2656- //Let's process the image...
2657- if (isset($_POST['Submit'])) {
2658- //Define some variables
2659- $imageme = $_FILES['imagefile']['name'];
2660- list($imageze, $ext) = explode('.', $imageme);
2661- $fullimage = 'data/settings/modules/albums/'.$var1.'/'.$imageme;
2662- $thumbimage = 'data/settings/modules/albums/'.$var1.'/thumb/'.$imageme;
2663- $tempimage = 'data/settings/modules/albums/'.$var1.'/temp.jpg';
2664-
2665- //First: Upload the image.
2666- //If file is pjpeg or jpeg: Accept.
2667- if ($_FILES['imagefile']['type'] == 'image/jpeg' || $_FILES['imagefile']['type'] == 'image/pjpeg') {
2668- copy($_FILES['imagefile']['tmp_name'], 'data/settings/modules/albums/'.$var1.'/'.$_FILES['imagefile']['name']) or die ('Error: Upload failed!');
2669-
2670- //If the extension is with capitals, we have to rename it...
2671- if ($ext == 'JPG') {
2672- rename($fullimage, 'data/settings/modules/albums/'.$var1.'/'.$imageze.'.jpg');
2673- $fullimage = 'data/settings/modules/albums/'.$var1.'/'.$imageze.'.jpg';
2674- $thumbimage = 'data/settings/modules/albums/'.$var1.'/thumb/'.$imageze.'.jpg';
2675- }
2676-
2677- //Define which filenames are already in use, and define what filename we should use.
2678- if (file_exists('data/settings/modules/albums/'.$var1.'/image1.jpg')) {
2679- $i = 2;
2680- $o = 3;
2681- while (file_exists('data/settings/modules/albums/'.$var1.'/image'.$i.'.jpg') || file_exists('data/settings/modules/albums/'.$var1.'/image'.$o.'.jpg')) {
2682- $i++;
2683- $o++;
2684- }
2685- $newfile = 'image'.$i;
2686- }
2687- else
2688- $newfile = 'image1';
2689-
2690- //Then rename the file and give it the right filename, also define new image-variables.
2691- rename($fullimage, 'data/settings/modules/albums/'.$var1.'/'.$newfile.'.jpg');
2692- $fullimage = 'data/settings/modules/albums/'.$var1.'/'.$newfile.'.jpg';
2693- $thumbimage = 'data/settings/modules/albums/'.$var1.'/thumb/'.$newfile.'.jpg';
2694-
2695- //FIXME: Need to CHMOD the full image.
2696- }
2697-
2698- //Block images other then JPG.
2699- else {
2700- echo '<p><span class="red">'.$lang_image2.'</span></p>';
2701- include_once ('data/inc/footer.php');
2702- exit;
2703- }
2704-
2705- //Copy the image to the thumbdir.
2706- copy ($fullimage, $thumbimage) or die ('Error: Thumb copying failed!');
2707-
2708- //Compress the big image.
2709- $ThumbWidth = 640;
2710- list($width, $height) = getimagesize($fullimage);
2711- $imgratio = $width / $height;
2712-
2713- if ($imgratio > 1) {
2714- $newwidth = $ThumbWidth;
2715- $newheight = $ThumbWidth / $imgratio;
2716- }
2717-
2718- else {
2719- $newheight = $ThumbWidth;
2720- $newwidth = $ThumbWidth * $imgratio;
2721- }
2722-
2723- $resized_img = imagecreatetruecolor($newwidth, $newheight);
2724- $new_img = imagecreatefromjpeg($fullimage);
2725-
2726- imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
2727- ImageJpeg($resized_img, $tempimage, $cont3);
2728- ImageDestroy($resized_img);
2729- ImageDestroy($new_img);
2730- unlink($fullimage);
2731- rename($tempimage, $fullimage);
2732-
2733- //Then make a thumb from the image.
2734- $ThumbWidth = 200;
2735- list($width, $height) = getimagesize($thumbimage);
2736- $imgratio = $width / $height;
2737-
2738- if ($imgratio > 1) {
2739- $newwidth = $ThumbWidth;
2740- $newheight = $ThumbWidth / $imgratio;
2741- }
2742-
2743- else {
2744- $newheight = $ThumbWidth;
2745- $newwidth = $ThumbWidth * $imgratio;
2746- }
2747-
2748- $resized_img = imagecreatetruecolor($newwidth, $newheight);
2749- $new_img = imagecreatefromjpeg($thumbimage);
2750-
2751- imagecopyresampled($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
2752- ImageJpeg($resized_img, $tempimage);
2753- ImageDestroy($resized_img);
2754- ImageDestroy($new_img);
2755- unlink($thumbimage);
2756- rename($tempimage, $thumbimage);
2757- chmod($thumbimage, 0777);
2758-
2759- //Sanitize data.
2760- $cont1 = sanitize($cont1);
2761- $cont2 = sanitize($cont2);
2762- $cont2 = str_replace ("\n",'<br />', $cont2);
2763-
2764- //Then save the imageinformation.
2765- $data = 'data/settings/modules/albums/'.$var1.'/'.$newfile.'.php';
2766- $file = fopen($data, 'w');
2767- fputs($file, '<?php'."\n"
2768- .'$name = \''.$cont1.'\';'."\n"
2769- .'$info = \''.$cont2.'\';'."\n"
2770- .'?>');
2771- fclose($file);
2772- chmod($data, 0777);
2773-
2774- //Redirect.
2775- redirect('?module=albums&page=editalbum&var1='.$var1, 0);
2776- }
2777-}
2778-?>
2779-<p>
2780- <a href="?module=albums">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a>
2781-</p>
2782\ No newline at end of file
2783
2784=== removed file 'data/modules/albums/pages_admin/editimage.php'
2785--- data/modules/albums/pages_admin/editimage.php 2008-12-28 00:03:55 +0000
2786+++ data/modules/albums/pages_admin/editimage.php 1970-01-01 00:00:00 +0000
2787@@ -1,65 +0,0 @@
2788-<?php
2789-/*
2790- * This file is part of pluck, the easy content management system
2791- * Copyright (c) somp (www.somp.nl)
2792- * http://www.pluck-cms.org
2793-
2794- * Pluck is free software: you can redistribute it and/or modify
2795- * it under the terms of the GNU General Public License as published by
2796- * the Free Software Foundation, either version 3 of the License, or
2797- * (at your option) any later version.
2798-
2799- * See docs/COPYING for the complete license.
2800-*/
2801-
2802-//Make sure the file isn't accessed directly.
2803-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2804- //Give out an "Access denied!" error.
2805- echo 'Access denied!';
2806- //Block all other code.
2807- exit();
2808-}
2809-
2810-//Check if an image was defined, and if the image exists
2811-if (isset($var1) && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php')) {
2812- //Include the image-information
2813- include_once ('data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
2814-
2815- //Replace html-breaks by real ones
2816- $info = str_replace('<br />', "\n", $info);
2817- ?>
2818- <br />
2819- <form name="form1" method="post" action="">
2820- <label class="kop2" for="cont1"><?php echo $lang_install17; ?></label>
2821- <br />
2822- <input name="cont1" id="cont1" type="text" value="<?php echo $name; ?>" />
2823- <br /><br />
2824- <label class="kop2" for="cont2"><?php echo $lang_albums11; ?></label>
2825- <br />
2826- <textarea cols="50" rows="5" name="cont2" id="cont2"><?php echo $info; ?></textarea>
2827- <br /><br />
2828- <input type="submit" name="Submit" value="<?php echo $lang_install13; ?>" />
2829- <input type="button" name="Cancel" value="<?php echo $lang_install14; ?>" onclick="javascript: window.location='?module=albums&amp;page=editalbum&amp;var1=<?php echo $var2; ?>';" />
2830- </form>
2831- <?php
2832- //When the information is posted:
2833- if (isset($_POST['Submit'])) {
2834- //Sanitize data.
2835- $cont1 = sanitize($cont1);
2836- $cont2 = sanitize($cont2);
2837- $cont2 = str_replace ("\n",'<br />', $cont2);
2838-
2839- //Then save the imageinformation
2840- $data = 'data/settings/modules/albums/'.$var2.'/'.$var1.'.php';
2841- $file = fopen($data, 'w');
2842- fputs($file, '<?php'."\n"
2843- .'$name = \''.$cont1.'\';'."\n"
2844- .'$info = \''.$cont2.'\';'."\n"
2845- .'?>');
2846- fclose($file);
2847- chmod($data, 0777);
2848-
2849- redirect('?module=albums&page=editalbum&var1='.$var2, 0);
2850- }
2851-}
2852-?>
2853\ No newline at end of file
2854
2855=== removed file 'data/modules/albums/pages_admin/imagedown.php'
2856--- data/modules/albums/pages_admin/imagedown.php 2008-12-28 21:30:36 +0000
2857+++ data/modules/albums/pages_admin/imagedown.php 1970-01-01 00:00:00 +0000
2858@@ -1,60 +0,0 @@
2859-<?php
2860-/*
2861- * This file is part of pluck, the easy content management system
2862- * Copyright (c) somp (www.somp.nl)
2863- * http://www.pluck-cms.org
2864-
2865- * Pluck is free software: you can redistribute it and/or modify
2866- * it under the terms of the GNU General Public License as published by
2867- * the Free Software Foundation, either version 3 of the License, or
2868- * (at your option) any later version.
2869-
2870- * See docs/COPYING for the complete license.
2871-*/
2872-
2873-//Make sure the file isn't accessed directly.
2874-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2875- //Give out an "Access denied!" error.
2876- echo 'Access denied!';
2877- //Block all other code.
2878- exit();
2879-}
2880-//First, load the functions.
2881-require_once ('data/modules/albums/functions.php');
2882-
2883-//Check if images exist.
2884-if (file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg') && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php') && file_exists('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg')) {
2885- //Determine the imagenumber
2886- list($filename, $pagenumber) = explode('e', $var1);
2887- $lowerpagenumber = $pagenumber + 1;
2888-
2889- //We can't lower the last image, so we have to check:
2890- if (!file_exists('data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.jpg')) {
2891- echo $lang_updown7;
2892- redirect('?module=albums&page=editalbum&var1='.$var2, 2);
2893- include_once ('data/inc/footer.php');
2894- exit;
2895- }
2896-
2897- //First make temporary files.
2898- rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg');
2899- rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php');
2900- rename('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg');
2901-
2902- //Then make the higher images one higher.
2903- rename('data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg');
2904- rename('data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
2905- rename('data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$lowerpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg');
2906-
2907- //Finally, give the temp-files its final name.
2908- rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.jpg');
2909- rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php', 'data/settings/modules/albums/'.$var2.'/'.NAME.$lowerpagenumber.'.php');
2910- rename ('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$lowerpagenumber.'.jpg');
2911-
2912- //Show message.
2913- echo $lang_updown3;
2914-}
2915-
2916-//Redirect.
2917-redirect('?module=albums&page=editalbum&var1='.$var2, 0);
2918-?>
2919\ No newline at end of file
2920
2921=== removed file 'data/modules/albums/pages_admin/imageup.php'
2922--- data/modules/albums/pages_admin/imageup.php 2008-12-28 21:30:36 +0000
2923+++ data/modules/albums/pages_admin/imageup.php 1970-01-01 00:00:00 +0000
2924@@ -1,61 +0,0 @@
2925-<?php
2926-/*
2927- * This file is part of pluck, the easy content management system
2928- * Copyright (c) somp (www.somp.nl)
2929- * http://www.pluck-cms.org
2930-
2931- * Pluck is free software: you can redistribute it and/or modify
2932- * it under the terms of the GNU General Public License as published by
2933- * the Free Software Foundation, either version 3 of the License, or
2934- * (at your option) any later version.
2935-
2936- * See docs/COPYING for the complete license.
2937-*/
2938-
2939-//Make sure the file isn't accessed directly.
2940-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
2941- //Give out an "Access denied!" error.
2942- echo 'Access denied!';
2943- //Block all other code.
2944- exit();
2945-}
2946-
2947-//First, load the functions.
2948-require_once ('data/modules/albums/functions.php');
2949-
2950-//Check if images exist.
2951-if (file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg') && file_exists('data/settings/modules/albums/'.$var2.'/'.$var1.'.php') && file_exists('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg')) {
2952- //We can't higher image1, so we have to check:
2953- if ($var1 == 'image1') {
2954- echo $lang_updown6;
2955- redirect('?module=albums&page=editalbum&var1='.$var2, 2);
2956- include_once ('data/inc/footer.php');
2957- exit;
2958- }
2959-
2960- //Determine the imagenumber.
2961- list($filename, $pagenumber) = explode('e', $var1);
2962- $higherpagenumber = $pagenumber - 1;
2963-
2964- //First make temporary files.
2965- rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg');
2966- rename('data/settings/modules/albums/'.$var2.'/'.$var1.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php');
2967- rename('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg');
2968-
2969- //Then make the higher images one higher.
2970- rename('data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.jpg');
2971- rename('data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.php', 'data/settings/modules/albums/'.$var2.'/'.$var1.'.php');
2972- rename('data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$higherpagenumber.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.$var1.'.jpg');
2973-
2974- //Finally, give the temp-files its final name.
2975- rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.jpg');
2976- rename ('data/settings/modules/albums/'.$var2.'/'.$var1.TEMP.'.php', 'data/settings/modules/albums/'.$var2.'/'.NAME.$higherpagenumber.'.php');
2977- rename ('data/settings/modules/albums/'.$var2.'/thumb/'.$var1.TEMP.'.jpg', 'data/settings/modules/albums/'.$var2.'/thumb/'.NAME.$higherpagenumber.'.jpg');
2978-
2979- //Show message.
2980- echo $lang_updown3;
2981-}
2982-
2983-//Redirect.
2984-redirect('?module=albums&page=editalbum&var1='.$var2, 0);
2985-?>
2986\ No newline at end of file
2987
2988=== removed directory 'data/modules/albums/pages_site'
2989=== removed file 'data/modules/albums/pages_site/albums_include.php'
2990--- data/modules/albums/pages_site/albums_include.php 2008-12-28 00:03:55 +0000
2991+++ data/modules/albums/pages_site/albums_include.php 1970-01-01 00:00:00 +0000
2992@@ -1,45 +0,0 @@
2993-<?php
2994-/*
2995- * This file is part of pluck, the easy content management system
2996- * Copyright (c) somp (www.somp.nl)
2997- * http://www.pluck-cms.org
2998-
2999- * Pluck is free software: you can redistribute it and/or modify
3000- * it under the terms of the GNU General Public License as published by
3001- * the Free Software Foundation, either version 3 of the License, or
3002- * (at your option) any later version.
3003-
3004- * See docs/COPYING for the complete license.
3005-*/
3006-
3007-//Make sure the file isn't accessed directly.
3008-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
3009- //Give out an "Access denied!" error.
3010- echo 'Access denied!';
3011- //Block all other code.
3012- exit();
3013-}
3014-
3015-//Open the module-folder
3016-$dir_handle = @opendir('data/settings/modules/albums') or die('Unable to open data/modules. Check if it\'s readable.');
3017-
3018-//Loop through dirs
3019-while ($dir = readdir($dir_handle)) {
3020- if (file_exists('data/settings/modules/albums/'.$dir.'/thumb/image1.jpg')) {
3021- ?>
3022- <div class="album">
3023- <table>
3024- <tr>
3025- <td><a href="?module=albums&amp;page=viewalbum&amp;album=<?php echo $dir; ?>&amp;pageback=<?php echo CURRENT_PAGE_FILENAME; ?>" title="album <?php echo $dir; ?>"><img alt="<?php echo $dir; ?>" title="<?php echo $dir; ?>" src="data/modules/albums/pages_admin/albums_getimage.php?image=<?php echo $dir; ?>/thumb/image1.jpg" /></a></td>
3026- <td>
3027- <span class="albuminfo">
3028- <a href="?module=albums&amp;page=viewalbum&amp;album=<?php echo $dir; ?>&amp;pageback=<?php echo CURRENT_PAGE_FILENAME; ?>" title="album <?php echo $dir; ?>"><?php echo $dir; ?></a>
3029- </span>
3030- </td>
3031- </tr>
3032- </table>
3033- </div>
3034- <?php
3035- }
3036-}
3037-?>
3038\ No newline at end of file
3039
3040=== removed file 'data/modules/albums/pages_site/viewalbum.php'
3041--- data/modules/albums/pages_site/viewalbum.php 2008-12-28 00:03:55 +0000
3042+++ data/modules/albums/pages_site/viewalbum.php 1970-01-01 00:00:00 +0000
3043@@ -1,69 +0,0 @@
3044-<?php
3045-/*
3046- * This file is part of pluck, the easy content management system
3047- * Copyright (c) somp (www.somp.nl)
3048- * http://www.pluck-cms.org
3049-
3050- * Pluck is free software: you can redistribute it and/or modify
3051- * it under the terms of the GNU General Public License as published by
3052- * the Free Software Foundation, either version 3 of the License, or
3053- * (at your option) any later version.
3054-
3055- * See docs/COPYING for the complete license.
3056-*/
3057-
3058-//Make sure the file isn't accessed directly.
3059-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
3060- //Give out an "Access denied!" error.
3061- echo 'Access denied!';
3062- //Block all other code.
3063- exit();
3064-}
3065-
3066-global $lang_theme12;
3067-
3068-//Predefined variable
3069-$album = $_GET['album'];
3070-$pageback = $_GET['pageback'];
3071-
3072-if (!file_exists('data/settings/modules/albums/'.$album))
3073- echo '<p>'.$lang_albums18.'</p>';
3074-
3075-//If the album exists
3076-else {
3077- //Start reading out those images...
3078- $files = read_dir_contents('data/settings/modules/albums/'.$album, 'files');
3079-
3080- if ($files) {
3081- natcasesort($files);
3082-
3083- foreach ($files as $file) {
3084- //Check if the files are JPG
3085- list($fdirname, $ext) = explode(".", $file);
3086- if ($ext == 'jpg') {
3087- $album = $_GET['album'];
3088- include_once ('data/settings/modules/albums/'.$album.'/'.$fdirname.'.php');
3089- ?>
3090- <div class="album">
3091- <table>
3092- <tr>
3093- <td>
3094- <a href="data/modules/albums/pages_admin/albums_getimage.php?image=<?php echo $album; ?>/<?php echo $fdirname; ?>.jpg" rel="lightbox[album]" title="<?php echo $name; ?>">
3095- <img src="data/modules/albums/pages_admin/albums_getimage.php?image=<?php echo $album; ?>/thumb/<?php echo $fdirname; ?>.jpg" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
3096- </a>
3097- </td>
3098- <td>
3099- <span class="albuminfo"><?php echo $name; ?></span>
3100- <br />
3101- <i><?php echo $info; ?></i>
3102- </td>
3103- </tr>
3104- </table>
3105- </div>
3106- <?php
3107- }
3108- }
3109- }
3110-}
3111-?>
3112-<p><a href="?file=<?php echo $pageback; ?>" title="return link">&lt;&lt;&lt; <?php echo $lang_theme12; ?></a></p>
3113\ No newline at end of file
3114
3115=== modified file 'data/modules/blog/pages_admin/blog.php'
3116--- data/modules/blog/pages_admin/blog.php 2009-01-10 20:58:15 +0000
3117+++ data/modules/blog/pages_admin/blog.php 2009-03-04 18:15:49 +0000
3118@@ -17,7 +17,7 @@
3119 //Give out an "Access denied!" error.
3120 echo 'Access denied!';
3121 //Block all other code.
3122- exit();
3123+ exit;
3124 }
3125
3126 //Include functions.
3127
3128=== modified file 'data/modules/blog/pages_admin/deletecategory.php'
3129--- data/modules/blog/pages_admin/deletecategory.php 2008-12-30 23:16:02 +0000
3130+++ data/modules/blog/pages_admin/deletecategory.php 2009-03-04 18:15:49 +0000
3131@@ -17,7 +17,7 @@
3132 //Give out an "Access denied!" error.
3133 echo 'Access denied!';
3134 //Block all other code.
3135- exit();
3136+ exit;
3137 }
3138
3139 //Include functions
3140
3141=== modified file 'data/modules/blog/pages_admin/deletepost.php'
3142--- data/modules/blog/pages_admin/deletepost.php 2008-12-30 23:16:02 +0000
3143+++ data/modules/blog/pages_admin/deletepost.php 2009-03-04 18:15:49 +0000
3144@@ -17,7 +17,7 @@
3145 //Give out an "Access denied!" error.
3146 echo 'Access denied!';
3147 //Block all other code.
3148- exit();
3149+ exit;
3150 }
3151
3152 //Include functions
3153
3154=== modified file 'data/modules/blog/pages_admin/deletereactions.php'
3155--- data/modules/blog/pages_admin/deletereactions.php 2008-12-30 23:16:02 +0000
3156+++ data/modules/blog/pages_admin/deletereactions.php 2009-03-04 18:15:49 +0000
3157@@ -17,7 +17,7 @@
3158 //Give out an "Access denied!" error.
3159 echo 'Access denied!';
3160 //Block all other code.
3161- exit();
3162+ exit;
3163 }
3164
3165 if ((isset($_GET['post'])) && (isset($_GET['key']))) {
3166
3167=== modified file 'data/modules/blog/pages_admin/editpost.php'
3168--- data/modules/blog/pages_admin/editpost.php 2008-12-30 23:16:02 +0000
3169+++ data/modules/blog/pages_admin/editpost.php 2009-03-04 18:15:49 +0000
3170@@ -17,7 +17,7 @@
3171 //Give out an "Access denied!" error.
3172 echo 'Access denied!';
3173 //Block all other code.
3174- exit();
3175+ exit;
3176 }
3177
3178 //Include functions
3179
3180=== modified file 'data/modules/blog/pages_admin/editreactions.php'
3181--- data/modules/blog/pages_admin/editreactions.php 2008-12-30 23:16:02 +0000
3182+++ data/modules/blog/pages_admin/editreactions.php 2009-03-04 18:15:49 +0000
3183@@ -17,7 +17,7 @@
3184 //Give out an "Access denied!" error.
3185 echo 'Access denied!';
3186 //Block all other code.
3187- exit();
3188+ exit;
3189 }
3190 ?>
3191 <p><b><?php echo $lang_blog20; ?></b></p>
3192
3193=== modified file 'data/modules/blog/pages_admin/newpost.php'
3194--- data/modules/blog/pages_admin/newpost.php 2008-12-30 23:16:02 +0000
3195+++ data/modules/blog/pages_admin/newpost.php 2009-03-04 18:15:49 +0000
3196@@ -17,7 +17,7 @@
3197 //Give out an "Access denied!" error.
3198 echo 'Access denied!';
3199 //Block all other code.
3200- exit();
3201+ exit;
3202 }
3203
3204 //Include functions
3205
3206=== modified file 'data/modules/blog/pages_site/blog_include.php'
3207--- data/modules/blog/pages_site/blog_include.php 2009-01-10 20:58:15 +0000
3208+++ data/modules/blog/pages_site/blog_include.php 2009-03-04 18:15:49 +0000
3209@@ -17,7 +17,7 @@
3210 //Give out an "Access denied!" error.
3211 echo 'Access denied!';
3212 //Block all other code.
3213- exit();
3214+ exit;
3215 }
3216
3217 global $lang_blog14, $lang_blog23;
3218
3219=== modified file 'data/modules/blog/pages_site/viewpost.php'
3220--- data/modules/blog/pages_site/viewpost.php 2009-01-10 20:58:15 +0000
3221+++ data/modules/blog/pages_site/viewpost.php 2009-03-04 18:15:49 +0000
3222@@ -17,7 +17,7 @@
3223 //Give out an "Access denied!" error.
3224 echo 'Access denied!';
3225 //Block all other code.
3226- exit();
3227+ exit;
3228 }
3229
3230 //Global language variables
3231
3232=== added file 'data/modules/contactform/contactform.php'
3233--- data/modules/contactform/contactform.php 1970-01-01 00:00:00 +0000
3234+++ data/modules/contactform/contactform.php 2009-02-04 17:49:59 +0000
3235@@ -0,0 +1,15 @@
3236+<?php
3237+function contactform_info() {
3238+ global $lang_contact12, $lang_contact13;
3239+ $module_info = array(
3240+ 'name' => $lang_contact12,
3241+ 'intro' => $lang_contact13,
3242+ 'version' => '0.2',
3243+ 'author' => 'pluck development team',
3244+ 'website' => 'http://www.pluck-cms.org',
3245+ 'icon' => 'images/contactform.png',
3246+ 'compatibility' => '4.7'
3247+ );
3248+ return $module_info;
3249+}
3250+?>
3251\ No newline at end of file
3252
3253=== added file 'data/modules/contactform/contactform.site.php'
3254--- data/modules/contactform/contactform.site.php 1970-01-01 00:00:00 +0000
3255+++ data/modules/contactform/contactform.site.php 2009-02-11 19:20:01 +0000
3256@@ -0,0 +1,59 @@
3257+<?php
3258+function contactform_theme_main() {
3259+ global $lang_contact3, $lang_contact4, $lang_contact5, $lang_contact6, $lang_contact7, $lang_contact8, $lang_contact9, $lang_contact10;
3260+
3261+ //Define some variables.
3262+ if (isset($_POST['name']))
3263+ $name = $_POST['name'];
3264+ if (isset($_POST['sender']))
3265+ $sender = $_POST['sender'];
3266+ if (isset($_POST['message']))
3267+ $message = $_POST['message'];
3268+
3269+ //Then show the contactform.
3270+ ?>
3271+ <form method="post" action="" id="contactform">
3272+ <div>
3273+ <label for="name"><?php echo $lang_contact3; ?></label>
3274+ <br />
3275+ <input name="name" id="name" type="text" />
3276+ <br />
3277+ <label for="sender"><?php echo $lang_contact4; ?></label>
3278+ <br />
3279+ <input name="sender" id="sender" type="text" />
3280+ <br />
3281+ <label for="message"><?php echo $lang_contact5; ?></label>
3282+ <br />
3283+ <textarea name="message" id="message" rows="7" cols="45"></textarea>
3284+ <br />
3285+ <input type="submit" name="Submit" value="<?php echo $lang_contact10; ?>" />
3286+ </div>
3287+ </form>
3288+ <?php
3289+ //If the the contactform was submitted.
3290+ if (isset($_POST['Submit'])) {
3291+ //Check if all fields were filled.
3292+ if ($name && $sender && $message) {
3293+ //TODO: We need a better way to check for spam.
3294+
3295+ //Sanitize the fields.
3296+ $name = sanitize($name);
3297+ $sender = sanitize($sender);
3298+ $message = sanitize($message);
3299+
3300+ //Change enters in their html-equivalents.
3301+ $message = str_replace ("\n",'<br>', $message);
3302+
3303+ //Now we're going to send our email.
3304+ if (mail(EMAIL, $lang_contact7.$name, '<html><body>'.$message.'</body></html>', 'From: '.$sender."\n".'Content-type: text/html; charset=utf-8'))
3305+ echo $lang_contact8;
3306+ //If email couldn't be send.
3307+ else
3308+ echo $lang_contact9;
3309+ }
3310+ //If not all fields were filled.
3311+ else
3312+ echo '<span class="red">'.$lang_contact6.'</span>';
3313+ }
3314+}
3315+?>
3316\ No newline at end of file
3317
3318=== removed file 'data/modules/contactform/module_info.php'
3319--- data/modules/contactform/module_info.php 2008-12-25 14:48:00 +0000
3320+++ data/modules/contactform/module_info.php 1970-01-01 00:00:00 +0000
3321@@ -1,35 +0,0 @@
3322-<?php
3323-//This is a module for pluck, an opensource content management system
3324-//Website: http://www.pluck-cms.org
3325-
3326-//MODULE NAME: contact form
3327-//DESCRIPTION: use this module to display a contactform for your visitors
3328-//LICENSE: GPLv3
3329-//This module is included with pluck
3330-
3331-global $lang_contact12, $lang_contact13;
3332-
3333-//Module name
3334-$module_name = $lang_contact12;
3335-
3336-//Short module introduction
3337-$module_intro = $lang_contact13;
3338-
3339-//Module dir
3340-$module_dir = 'contactform';
3341-
3342-//Filename of the module-icon
3343-$module_icon = 'images/contactform.png';
3344-
3345-//Version of the module
3346-$module_version = '0.2';
3347-
3348-//Author of the module
3349-$module_author = 'pluck development team';
3350-
3351-//Website of the module
3352-$module_website = 'http://www.pluck-cms.org';
3353-
3354-//Compatibility
3355-$module_compatibility = '4.6';
3356-?>
3357\ No newline at end of file
3358
3359=== removed file 'data/modules/contactform/module_pages_site.php'
3360--- data/modules/contactform/module_pages_site.php 2008-12-25 14:48:00 +0000
3361+++ data/modules/contactform/module_pages_site.php 1970-01-01 00:00:00 +0000
3362@@ -1,11 +0,0 @@
3363-<?php
3364-//This is a module for pluck, an opensource content management system
3365-//Website: http://www.pluck-cms.org
3366-
3367-//MODULE NAME: contact form
3368-//DESCRIPTION: use this module to display a contactform for your visitors
3369-//LICENSE: GPLv3
3370-//This module is included with pluck
3371-
3372-$includepage = 'contactform.php';
3373-?>
3374\ No newline at end of file
3375
3376=== removed directory 'data/modules/contactform/pages_site'
3377=== removed file 'data/modules/contactform/pages_site/contactform.php'
3378--- data/modules/contactform/pages_site/contactform.php 2008-12-25 14:48:00 +0000
3379+++ data/modules/contactform/pages_site/contactform.php 1970-01-01 00:00:00 +0000
3380@@ -1,78 +0,0 @@
3381-<?php
3382-/*
3383- * This file is part of pluck, the easy content management system
3384- * Copyright (c) somp (www.somp.nl)
3385- * http://www.pluck-cms.org
3386-
3387- * Pluck is free software: you can redistribute it and/or modify
3388- * it under the terms of the GNU General Public License as published by
3389- * the Free Software Foundation, either version 3 of the License, or
3390- * (at your option) any later version.
3391-
3392- * See docs/COPYING for the complete license.
3393-*/
3394-
3395-//Make sure the file isn't accessed directly.
3396-if (!strpos($_SERVER['SCRIPT_FILENAME'], 'index.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'admin.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'install.php') && !strpos($_SERVER['SCRIPT_FILENAME'], 'login.php')) {
3397- //Give out an "Access denied!" error.
3398- echo 'Access denied!';
3399- //Block all other code.
3400- exit();
3401-}
3402-
3403-global $lang_contact3, $lang_contact4, $lang_contact5, $lang_contact6, $lang_contact7, $lang_contact8, $lang_contact9, $lang_contact10;
3404-
3405-//Define some variables
3406-if (isset($_POST['name']))
3407- $name = $_POST['name'];
3408-if (isset($_POST['sender']))
3409- $sender = $_POST['sender'];
3410-if (isset($_POST['message']))
3411- $message = $_POST['message'];
3412-
3413-//Then show the contactform
3414-?>
3415- <form method="post" action="" id="contactform">
3416- <div>
3417- <label for="name"><?php echo $lang_contact3; ?></label>
3418- <br />
3419- <input name="name" id="name" type="text" />
3420- <br />
3421- <label for="sender"><?php echo $lang_contact4; ?></label>
3422- <br />
3423- <input name="sender" id="sender" type="text" />
3424- <br />
3425- <label for="message"><?php echo $lang_contact5; ?></label>
3426- <br />
3427- <textarea name="message" id="message" rows="7" cols="45"></textarea>
3428- <br />
3429- <input type="submit" name="Submit" value="<?php echo $lang_contact10; ?>" />
3430- </div>
3431- </form>
3432-<?php
3433-//If the the contactform was submitted
3434-if (isset($_POST['Submit'])) {
3435- //Check if all fields were filled
3436- if ($name && $sender && $message) {
3437- //TODO: We need a better way to check for spam.
3438-
3439- //Sanitize the fields.
3440- $name = sanitize($name);
3441- $sender = sanitize($sender);
3442- $message = sanitize($message);
3443-
3444- //Change enters in their html-equivalents
3445- $message = str_replace ("\n",'<br>', $message);
3446-
3447- //Now we're going to send our email
3448- if (mail(EMAIL, $lang_contact7.$name, '<html><body>'.$message.'</body></html>', 'From: '.$sender."\n".'Content-type: text/html; charset=utf-8'))
3449- echo $lang_contact8;
3450- //If email couldn't be send
3451- else
3452- echo $lang_contact9;
3453- }
3454- //If not all fields were filled
3455- else
3456- echo '<span class="red">'.$lang_contact6.'</span>';
3457-}
3458-?>
3459\ No newline at end of file
3460
3461=== added directory 'data/modules/hooktest'
3462=== added file 'data/modules/hooktest/hooktest.admin.php'
3463--- data/modules/hooktest/hooktest.admin.php 1970-01-01 00:00:00 +0000
3464+++ data/modules/hooktest/hooktest.admin.php 2009-02-04 17:49:59 +0000
3465@@ -0,0 +1,22 @@
3466+<?php
3467+//Admin pages. $module_page_admin[0] is the start page.
3468+function hooktest_page_admin_list() {
3469+ $module_page_admin[] = array(
3470+ 'func' => 'foo',
3471+ 'title' => 'Foobar'
3472+ );
3473+ $module_page_admin[] = array(
3474+ 'func' => 'bar',
3475+ 'title' => 'Barfoo'
3476+ );
3477+ return $module_page_admin;
3478+}
3479+
3480+function hooktest_page_admin_foo() {
3481+ echo 'Admin pages are working<br /><a href="?module=hooktest&amp;page=bar">Barfoo page</a>';
3482+}
3483+
3484+function hooktest_page_admin_bar() {
3485+ echo 'Also working';
3486+}
3487+?>
3488
3489=== added file 'data/modules/hooktest/hooktest.php'
3490--- data/modules/hooktest/hooktest.php 1970-01-01 00:00:00 +0000
3491+++ data/modules/hooktest/hooktest.php 2009-03-04 18:15:49 +0000
3492@@ -0,0 +1,29 @@
3493+<?php
3494+function hooktest_info() {
3495+ $module_info = array(
3496+ 'name' => 'hooktest',
3497+ 'intro' => 'Created to show the new hooks.',
3498+ 'version' => '0.1',
3499+ 'author' => 'Anders Jørgensen',
3500+ 'website' => 'http://spirit55555.dk',
3501+ 'icon' => '../../image/stats.png',
3502+ 'compatibility' => '4.7'
3503+ );
3504+ return $module_info;
3505+}
3506+
3507+function hooktest_admin_header_main() {
3508+ echo '<style type="text/css">h1:before, h1:after {content: \'"\';}</style>';
3509+}
3510+
3511+function hooktest_admin_menu_inside_before() {
3512+?>
3513+ <div class="menuitem">
3514+ <span>
3515+ <img src="data/image/website.png" alt="" height="22" />
3516+ <a href="index.php?file=kop1.php" title="view site" target="_blank">view site</a>
3517+ </span>
3518+ </div>
3519+<?php
3520+}
3521+?>
3522\ No newline at end of file
3523
3524=== added file 'data/modules/hooktest/hooktest.site.php'
3525--- data/modules/hooktest/hooktest.site.php 1970-01-01 00:00:00 +0000
3526+++ data/modules/hooktest/hooktest.site.php 2009-02-11 19:20:01 +0000
3527@@ -0,0 +1,28 @@
3528+<?php
3529+function hooktest_theme_main() {
3530+ echo '<a href="?module=hooktest&amp;page=hook">Module page link</a>';
3531+}
3532+
3533+//Site pages.
3534+function hooktest_page_site_list() {
3535+ $module_page_site[] = array(
3536+ 'func' => 'hook',
3537+ 'title' => 'Hooks are great!'
3538+ );
3539+ return $module_page_site;
3540+}
3541+
3542+function hooktest_page_site_hook() {
3543+ echo 'Hooks are great when they can have their own pages.';
3544+}
3545+
3546+function hooktest_site_before_redirects() {
3547+ global $language;
3548+ //NOTE: This is just to show how it works, and that's why I haven't created an admin page for it.
3549+ $mode = false;
3550+ if ($mode == true) {
3551+ echo $language['hooktest']['message'];
3552+ exit;
3553+ }
3554+}
3555+?>
3556\ No newline at end of file
3557
3558=== added directory 'data/modules/hooktest/lang'
3559=== modified file 'data/themes/default/theme.php'
3560--- data/themes/default/theme.php 2009-01-09 15:44:32 +0000
3561+++ data/themes/default/theme.php 2009-01-24 16:37:12 +0000
3562@@ -15,10 +15,10 @@
3563 <div id="content">
3564 <h2 title="<?php theme_pagetitle(); ?>"><?php theme_pagetitle(); ?></h2>
3565 <?php theme_content(); ?>
3566- <?php theme_module('main'); ?>
3567+ <?php theme_area('main'); ?>
3568 </div>
3569 <div id="footer">
3570- <?php theme_module('footer'); ?>
3571+ <?php theme_area('footer'); ?>
3572 <a href="login.php">admin</a> | powered by <a href="http://www.pluck-cms.org">pluck</a>
3573 </div>
3574 </div>
3575
3576=== modified file 'data/themes/green/theme.php'
3577--- data/themes/green/theme.php 2009-01-07 20:59:02 +0000
3578+++ data/themes/green/theme.php 2009-02-01 12:50:18 +0000
3579@@ -6,11 +6,11 @@
3580
3581 <body>
3582 <div id="container">
3583- <div id="top"></div>
3584- <div id="mainblok">
3585- <div id="blok1">
3586- <div class="binnen">
3587- <h3 class="headtext" title="<?php theme_sitetitle(); ?>"><?php theme_sitetitle(); ?></h3>
3588+ <div id="top"></div>
3589+ <div id="mainblok">
3590+ <div id="blok1">
3591+ <div class="binnen">
3592+ <h3 class="headtext" title="<?php theme_sitetitle(); ?>"><?php theme_sitetitle(); ?></h3>
3593 <ul class="menu1">
3594 <?php theme_menu('<li class="menu1"><a href="#file">#title</a></li>'); ?>
3595 </ul>
3596@@ -24,15 +24,15 @@
3597
3598 <div class="txt">
3599 <?php theme_content(); ?>
3600- <?php theme_module("main"); ?>
3601+ <?php theme_area("main"); ?>
3602 </div>
3603- </div>
3604- </div>
3605+ </div>
3606+ </div>
3607
3608- <div id="footer">
3609+ <div id="footer">
3610 >> <a href="login.php">admin</a>
3611 <br />powered by <a href="http://www.pluck-cms.org">pluck</a>
3612- </div>
3613-</div>
3614-</body>
3615+ </div>
3616+</div>
3617+</body>
3618 </html>
3619\ No newline at end of file
3620
3621=== modified file 'data/themes/oldstyle/theme.php'
3622--- data/themes/oldstyle/theme.php 2008-08-05 11:24:59 +0000
3623+++ data/themes/oldstyle/theme.php 2009-02-01 12:50:18 +0000
3624@@ -6,8 +6,8 @@
3625
3626 <body>
3627 <div class="head">
3628- <div class="header">
3629- <div class="headerkop"><?php theme_sitetitle(); ?></div>
3630+ <div class="header">
3631+ <div class="headerkop"><?php theme_sitetitle(); ?></div>
3632 <div class="menu">
3633 <?php theme_menu('<a href="#file">#title</a> || '); ?>
3634 </div>
3635@@ -17,14 +17,14 @@
3636 <div class="kop"><?php theme_pagetitle(); ?></div><br />
3637 <div class="txt">
3638 <?php theme_content(); ?>
3639- <?php theme_module("main"); ?>
3640+ <?php theme_area("main"); ?>
3641 <div class="footer">
3642- <?php theme_module("footer"); ?>
3643+ <?php theme_area("footer"); ?>
3644 >> <a href="login.php">admin</a>
3645 <br />powered by <a href="http://www.pluck-cms.org">pluck</a>
3646 </div>
3647 </div>
3648 </div>
3649-</div>
3650-</body>
3651+</div>
3652+</body>
3653 </html>
3654\ No newline at end of file
3655
3656=== modified file 'index.php'
3657--- index.php 2008-12-17 19:12:56 +0000
3658+++ index.php 2009-02-11 18:54:48 +0000
3659@@ -21,6 +21,28 @@
3660 exit;
3661 }
3662
3663+//Load all the modules, so we can use hooks.
3664+//This has to be done before anything else.
3665+$path = opendir('data/modules');
3666+while (false !== ($dir = readdir($path))) {
3667+ if ($dir != '.' && $dir != '..') {
3668+ if (is_dir('data/modules/'.$dir))
3669+ $modules[] = $dir;
3670+ }
3671+}
3672+closedir($path);
3673+
3674+foreach ($modules as $module) {
3675+ if (file_exists('data/modules/'.$module.'/'.$module.'.php')) {
3676+ require_once ('data/modules/'.$module.'/'.$module.'.php');
3677+
3678+ if (file_exists('data/modules/'.$module.'/'.$module.'.site.php'))
3679+ require_once ('data/modules/'.$module.'/'.$module.'.site.php');
3680+
3681+ $module_list[] = $module;
3682+ }
3683+}
3684+
3685 //Include security-enhancements.
3686 require_once ('data/inc/security.php');
3687 //Include functions.
3688@@ -31,31 +53,12 @@
3689 require_once ('data/inc/variables.site.php');
3690
3691 //Then, if we have a RTL-language and theme hasn't been converted
3692-if ((isset($direction)) && ($direction == 'rtl') && (!file_exists(THEME_DIR.'/style-rtl.css'))) {
3693+if (isset($direction) && $direction == 'rtl' && !file_exists(THEME_DIR.'/style-rtl.css')) {
3694 //Convert theme and save CSS
3695 include_once ('data/inc/themes_convert-rtl.php');
3696 }
3697
3698-//Include module-inclusion files (inc_site.php)
3699-//---------------
3700-//Open the folder
3701-$dir_handle = @opendir('data/modules') or die('Unable to open module directory. Check if it\'s readable.');
3702-
3703-//Loop through dirs
3704-while ($dir = readdir($dir_handle)) {
3705-if ($dir == '.' || $dir == '..')
3706- continue;
3707- //Include the inc_site.php if it exists, and if module is compatible
3708- include_once ('data/modules/'.$dir.'/module_info.php');
3709- if (module_is_compatible($dir)) {
3710- if (file_exists('data/modules/'.$dir.'/inc_site.php')) {
3711- include_once ('data/modules/'.$dir.'/inc_site.php');
3712- }
3713- }
3714-}
3715-
3716-//Close module-dir
3717-closedir($dir_handle);
3718+run_hook('site_before_redirects');
3719
3720 //Check if a page or module has been specified, if not: redirect to kop1.php
3721 if (!defined('CURRENT_PAGE_FILENAME') && !defined('CURRENT_MODULE_DIR')) {
3722@@ -81,7 +84,7 @@
3723
3724 //If a page has been set, check if it exists (if not, redirect)
3725 elseif (defined('CURRENT_MODULE_DIR') && defined('CURRENT_MODULE_PAGE')) {
3726- if (!file_exists('data/modules/'.CURRENT_MODULE_DIR.'/pages_site/'.CURRENT_MODULE_PAGE.'.php')) {
3727+ if (!function_exists(CURRENT_MODULE_DIR.'_page_site_'.CURRENT_MODULE_PAGE)) {
3728 header('Location: '.HOME_PAGE);
3729 exit;
3730 }
3731
3732=== modified file 'login.php'
3733--- login.php 2008-11-14 09:18:01 +0000
3734+++ login.php 2009-02-04 17:49:59 +0000
3735@@ -12,14 +12,32 @@
3736 * See docs/COPYING for the complete license.
3737 */
3738
3739-//Include security-enhancements
3740+//Load all the modules, so we can use hooks.
3741+//This has to be done before anything else.
3742+$path = opendir('data/modules');
3743+while (false !== ($dir = readdir($path))) {
3744+ if ($dir != '.' && $dir != '..') {
3745+ if (is_dir('data/modules/'.$dir))
3746+ $modules[] = $dir;
3747+ }
3748+}
3749+closedir($path);
3750+
3751+foreach ($modules as $module) {
3752+ if (file_exists('data/modules/'.$module.'/'.$module.'.php')) {
3753+ require_once ('data/modules/'.$module.'/'.$module.'.php');
3754+ $module_list[] = $module;
3755+ }
3756+}
3757+
3758+//Include security-enhancements.
3759 require_once ('data/inc/security.php');
3760-//Include functions
3761+//Include functions.
3762 require_once ('data/inc/functions.all.php');
3763-//Include variables
3764+//Include variables.
3765 require_once ('data/inc/variables.all.php');
3766
3767-//Check if we've installed pluck
3768+//Check if we've installed pluck.
3769 if (!file_exists('data/settings/install.dat')) {
3770 $titelkop = $lang_login1;
3771 include_once ('data/inc/header2.php');
3772@@ -32,22 +50,23 @@
3773 else {
3774 require_once ('data/settings/pass.php');
3775
3776- //Check if we're already logged in
3777+ //Check if we're already logged in.
3778 session_start();
3779 if (isset($_SESSION['cmssystem_loggedin']) && ($_SESSION['cmssystem_loggedin'] == 'ok')) {
3780 header('Location: admin.php');
3781 exit;
3782 }
3783
3784- //If password has not yet been sent
3785+ //If password has not yet been sent.
3786 if (!isset($_POST['Submit'])) {
3787- //Include header-file
3788+ //Include header-file.
3789 $titelkop = $lang_login1;
3790 include_once ('data/inc/header2.php');
3791 ?>
3792 <span class="kop2"><?php echo $lang_login3; ?></span><br />
3793 <form action="login.php" method="post" name="passform">
3794 <input name="cont1" size="25" type="password" />
3795+ <?php //FIXME: Do we use the bogusField for anything? ?>
3796 <input type="text" name="bogusField" style="display: none;" />
3797 <input type="submit" name="Submit" value="<?php echo $lang_login4; ?>" />
3798 </form>
3799@@ -57,14 +76,14 @@
3800
3801 //If password has been sent...
3802 elseif (isset($_POST['Submit'])) {
3803- //...first MD5-encrypt password that has been posted
3804+ //...first MD5-encrypt password that has been posted.
3805 $pass = md5($cont1);
3806
3807 //...and is correct:
3808 if ($pass == $ww) {
3809- //Save session
3810+ //Save session.
3811 $_SESSION['cmssystem_loggedin'] = 'ok';
3812- //Display successmessage
3813+ //Display successmessage.
3814 $titelkop = $lang_login1;
3815 include_once ('data/inc/header2.php');
3816 echo $lang_login5;

Subscribers

People subscribed via source and target branches