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 | |
---|
14 | if (!defined('DC_CONTEXT_ADMIN')) exit; |
---|
15 | global $core; |
---|
16 | require_once dirname(__FILE__).'/class.dc.gallery.integration.php'; |
---|
17 | |
---|
18 | $this_version = $core->plugins->moduleInfo('gallery','version'); |
---|
19 | $installed_version = $core->getVersion('gallery'); |
---|
20 | if (version_compare($installed_version,$this_version,'>=')) { |
---|
21 | return; |
---|
22 | } |
---|
23 | # Settings compatibility test |
---|
24 | if (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 | |
---|
34 | function 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$#"; |
---|
43 | if (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 | |
---|
49 | putGlobalSetting('gallery_galleries_url_prefix','galleries','string','Gallery lists URL prefix'); |
---|
50 | putGlobalSetting('gallery_gallery_url_prefix','gallery','string','Galleries URL prefix'); |
---|
51 | putGlobalSetting('gallery_image_url_prefix','image','string','Images URL prefix'); |
---|
52 | putGlobalSetting('gallery_default_theme','simple','string','Default theme to use'); |
---|
53 | putGlobalSetting('gallery_default_integ_theme','sameasgal','string','Default theme to use (integration mode)'); |
---|
54 | putGlobalSetting('gallery_nb_images_per_page',24,'integer','Number of images per page'); |
---|
55 | putGlobalSetting('gallery_nb_galleries_per_page',10,'integer','Number of galleries per page'); |
---|
56 | putGlobalSetting('gallery_new_items_default','YYYYN','string','Default options for new items management'); |
---|
57 | putGlobalSetting('gallery_galleries_sort','date','string','Galleries list sort criteria'); |
---|
58 | putGlobalSetting('gallery_galleries_order','DESC','string','Galleries list sort order criteria'); |
---|
59 | putGlobalSetting('gallery_galleries_orderbycat',true,'boolean','Galleries list group by category'); |
---|
60 | putGlobalSetting('gallery_enabled',false,'boolean','Gallery plugin enabled'); |
---|
61 | putGlobalSetting('gallery_adv_items',false,'boolean','Gallery items advanced interface'); |
---|
62 | putGlobalSetting('gallery_themes_path',$gal_default_themes_path,'string','Gallery Themes path'); |
---|
63 | putGlobalSetting('gallery_entries_include_galleries',false,'boolean','Include selected galeries in Entries tpl'); |
---|
64 | putGlobalSetting('gallery_entries_include_images',false,'boolean','Include selected images in Entries tpl'); |
---|
65 | putGlobalSetting('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)'); |
---|
66 | putGlobalSetting('gallery_admin_items_order','desc','string','Administration items tab ordering (chose from : asc,desc)'); |
---|
67 | putGlobalSetting('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'); |
---|
68 | putGlobalSetting('gallery_admin_gals_order','desc','string','Administration galleries tab ordering (chose from : asc,desc)'); |
---|
69 | putGlobalSetting('gallery_max_ajax_requests',5,'integer','Maximum of simultaneous Ajax requests'); |
---|
70 | |
---|
71 | if (function_exists('json_encode')) { |
---|
72 | putGlobalSetting('gallery_supported_modes',json_encode(dcGalleryIntegration::$default_supported_modes),'string','Gallery supported integration modes'); |
---|
73 | } |
---|
74 | $core->setVersion('gallery',$this_version); |
---|
75 | |
---|
76 | if ($gallery_settings->gallery_default_theme == 'default') { |
---|
77 | $gallery_settings->put('gallery_default_theme','simple','string','Default theme to use', true, true); |
---|
78 | } |
---|
79 | |
---|
80 | return true; |
---|
81 | ?> |
---|