Dotclear

source: plugins/gallery/trunk/_install.php @ 2272

Revision 2272, 4.3 KB checked in by bruno, 14 years ago (diff)

Sanitized versions checking

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3#
4# This file is part of Dotclear 2 Gallery plugin.
5#
6# Copyright (c) 2004-2008 Bruno Hondelatte, and contributors.
7# Many, many thanks to Olivier Meunier and the Dotclear Team.
8# Licensed under the GPL version 2.0 license.
9# See LICENSE file or
10# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11#
12# -- END LICENSE BLOCK ------------------------------------
13
14if (!defined('DC_CONTEXT_ADMIN')) exit;
15global $core;
16require_once dirname(__FILE__).'/class.dc.gallery.integration.php';
17
18$this_version = $core->plugins->moduleInfo('gallery','version');
19$installed_version = $core->getVersion('gallery');
20if (version_compare($installed_version,$this_version,'>=')) {
21     return;
22}
23 # Settings compatibility test
24if (version_compare(DC_VERSION,'2.2-alpha','>=')) {
25     $core->blog->settings->addNamespace('gallery');
26     $gallery_settings =& $core->blog->settings->gallery;
27     $system_settings =& $core->blog->settings->system;
28} else {
29     $core->blog->settings->setNamespace('gallery');
30     $gallery_settings =& $core->blog->settings;
31     $system_settings =& $core->blog->settings;
32}
33
34function putGlobalSetting($id,$value,$type=null,$label=null,$value_change=true) {
35     global $core,$gallery_settings;
36     $old_value = $gallery_settings->get($id);
37     if ($old_value === null)
38          $gallery_settings->put($id,$value,$type,$label,$value_change,true);
39     else
40          $gallery_settings->put($id,$old_value,$type,$label,$value_change,true);
41}
42$themes_re = "#(.*)themes$#";
43if (preg_match($themes_re,$system_settings->themes_path)) {
44     $gal_default_themes_path = preg_replace("#(.*)themes$#","$1plugins/gallery/default-templates",$system_settings->themes_path);
45} else {
46     $gal_default_themes_path = 'plugins/gallery/default-templates';
47}
48
49putGlobalSetting('gallery_galleries_url_prefix','galleries','string','Gallery lists URL prefix');
50putGlobalSetting('gallery_gallery_url_prefix','gallery','string','Galleries URL prefix');
51putGlobalSetting('gallery_image_url_prefix','image','string','Images URL prefix');
52putGlobalSetting('gallery_default_theme','simple','string','Default theme to use');
53putGlobalSetting('gallery_default_integ_theme','sameasgal','string','Default theme to use (integration mode)');
54putGlobalSetting('gallery_nb_images_per_page',24,'integer','Number of images per page');
55putGlobalSetting('gallery_nb_galleries_per_page',10,'integer','Number of galleries per page');
56putGlobalSetting('gallery_new_items_default','YYYYN','string','Default options for new items management');
57putGlobalSetting('gallery_galleries_sort','date','string','Galleries list sort criteria');
58putGlobalSetting('gallery_galleries_order','DESC','string','Galleries list sort order criteria');
59putGlobalSetting('gallery_galleries_orderbycat',true,'boolean','Galleries list group by category');
60putGlobalSetting('gallery_enabled',false,'boolean','Gallery plugin enabled');
61putGlobalSetting('gallery_adv_items',false,'boolean','Gallery items advanced interface');
62putGlobalSetting('gallery_themes_path',$gal_default_themes_path,'string','Gallery Themes path');
63putGlobalSetting('gallery_entries_include_galleries',false,'boolean','Include selected galeries in Entries tpl');
64putGlobalSetting('gallery_entries_include_images',false,'boolean','Include selected images in Entries tpl');
65putGlobalSetting('gallery_admin_items_sortby','post_dt','string','Administration items tab ordering (chose from : post_dt,post_title,cat_title,user_id,post_status,post_selected)');
66putGlobalSetting('gallery_admin_items_order','desc','string','Administration items tab ordering (chose from : asc,desc)');
67putGlobalSetting('gallery_admin_gals_sortby','post_dt','string','Administration galleries tab ordering (chose from : post_dt,post_title,cat_title,user_id,post_status,post_selected');
68putGlobalSetting('gallery_admin_gals_order','desc','string','Administration galleries tab ordering (chose from : asc,desc)');
69putGlobalSetting('gallery_max_ajax_requests',5,'integer','Maximum of simultaneous Ajax requests');
70
71if (function_exists('json_encode')) {
72putGlobalSetting('gallery_supported_modes',json_encode(dcGalleryIntegration::$default_supported_modes),'string','Gallery supported integration modes');
73}
74$core->setVersion('gallery',$this_version);
75
76if ($gallery_settings->gallery_default_theme == 'default') {
77     $gallery_settings->put('gallery_default_theme','simple','string','Default theme to use', true, true);
78}
79
80return true;
81?>
Note: See TracBrowser for help on using the repository browser.

Sites map