1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
9	header("location: index.php");
10	exit;
11}
12
13// ABOUT THE NUMBERING:
14//
15// Because this script calls tiki-setup_base.php , which does very
16// complicated things like checking if users are logged in and so
17// on, this script depends on every other script, because
18// tiki-setup_base.php does.
19
20
21/**
22 * @param $installer
23 */
24function upgrade_99999999_image_plugins_kill_tiki($installer)
25{
26	global $prefs, $tikiroot, $user_overrider_prefs, $tiki_p_trust_input, $local_php;	// globals are required here for tiki-setup_base.php
27	require_once('lib/tikilib.php');
28
29	$access = TikiLib::lib('access');
30	$tikilib = TikiLib::lib('tiki');
31	$smarty = TikiLib::lib('smarty');
32
33	require_once('db/tiki-db.php');
34
35	$tikilib = new TikiLib;
36
37	// ******************************** THUMB plugin
38	$plugstring = <<<PLUGINTEXT
39{CODE(caption=>YAML,wrap=1)}
40objects:
41 -
42  type: plugin_alias
43  ref: combine_thumb
44  data:
45   name: THUMB
46   implementation: img
47   description:
48    name: Thumbnail
49    documentation: PluginThumb
50    description: Displays a thumbnail of an image that enlarges upon mouseover or links to a target
51    prefs:
52    params:
53     file:
54      required: false
55      name: File ID
56      description: File ID from the file gallery.
57      filter: digits
58     id:
59      required: false
60      name: Image ID
61      description: Image ID from the image gallery.
62      filter: digits
63     image:
64      required: false
65      name: Image URL
66      description: URL to the image.
67      filter: url
68     max:
69      required: false
70      name: Maximum Size
71      description: Maximum width or height for the image.
72      filter: int
73     float:
74      required: false
75      name: Alignment
76      description: Set alignment as left, right or none.
77      filter: alpha
78      options:
79       none:
80        text: None
81       left:
82        text: Left
83       right:
84        text: Right
85     url:
86      required: false
87      name: Link Target
88      description: Link target of the image.
89      filter: url
90   body:
91    default: ''
92   params:
93    fileId:
94     pattern: %file%
95     params:
96      file:
97       token: file
98    id:
99     pattern: %id%
100     params:
101      id:
102       token: id
103    src:
104     pattern: %image%
105     params:
106      image:
107       token: image
108    max:
109     pattern: %max%
110     params:
111      max:
112       token: max
113    imalign:
114     pattern: %float%
115     params:
116      float:
117       token: float
118    link:
119     pattern: %url%
120     params:
121      url:
122       token: url
123    thumb: mouseover
124{CODE}
125PLUGINTEXT;
126
127	$profile_installer = new Tiki_Profile_Installer;
128	$profile = Tiki_Profile::fromString($plugstring, 'THUMB');
129	$profile->removeSymbols();
130	$profile_installer->install($profile);
131
132	// ********************************  IMAGE plugin
133	$plugstring = <<<PLUGINTEXT
134{CODE(caption=>YAML,wrap=1)}
135objects:
136 -
137  type: plugin_alias
138  ref: combine_image
139  data:
140   name: IMAGE
141   implementation: img
142   description:
143    name: Image
144    documentation: PluginImage
145    description: Display images (transitional alias, use IMG plugin instead)
146    params:
147     fileId:
148      required: false
149      name: File ID
150      description: Numeric ID of an image in a File Gallery (or comma-separated list). "fileId", "id" or "src" required.
151     id:
152      required: false
153      name: Image ID
154      description: Numeric ID of an image in an Image Gallery (or comma-separated list). "fileId", "id" or "src" required.
155     src:
156      required: false
157      name: Image source
158      description: Full URL to the image to display. "fileId", "id" or "src" required.
159      filter: url
160     scalesize:
161      required: false
162      name: Maximum size
163      description: Maximum width or height for the image in pixels.
164     height:
165      required: false
166      name: Image height
167      description: Height in pixels.
168      filter: int
169     width:
170      required: false
171      name: Image width
172      description: Width in pixels.
173      filter: int
174     link:
175      required: false
176      name: Link
177      description: For making the image a hyperlink. Enter a url to the page the image should link to.
178      filter: url
179     rel:
180      required: false
181      name: Link relation
182      description: Link relation attribute to add to the link.
183     title:
184      required: false
185      name: Link title
186      description: Link title that appears upon mouseover.
187     alt:
188      required: false
189      name: Alternate text
190      description: Alternate text that displays image doesn't load.
191     align:
192      required: false
193      name: Align image block
194      description: Enter right, left or center to align the box containing the image.
195      options:
196       left:
197        text: Left
198       right:
199        text: Right
200       center:
201        text: Center
202     block:
203      required: false
204      name: Wrapping control
205      description: Whether to block items from wrapping next to image from the top or bottom. (top,bottom,both,none)
206      options:
207       '':
208        text: None
209       top:
210        text: Top
211       bottom:
212        text: Bottom
213       both:
214        text: Both
215     desc:
216      required: false
217      name: Description
218      description: Image caption
219     usemap:
220      required: false
221      name: Image map
222      description: Name of the image map to use.
223     class:
224      required: false
225      name: CSS class
226      description: CSS class to apply to the image.
227     style:
228      required: false
229      name: CSS syle
230      description: CSS styling to apply.
231     border:
232      required: false
233      name: Border options
234      description: Border configuration for image block.
235     descoptions:
236      required: false
237      name: Caption style
238      description: Styling of image description. Use CSS syntax to override default setting.
239     default:
240      required: false
241      name: Default configuration
242      description: Default configuration definitions (usually set by admin).
243     mandatory:
244      required: false
245      name: Mandatory configuration
246      description: Mandatory configuration definitions (usually set by admin).
247   body:
248    default: ''
249   params:
250    fileId:
251     pattern: %fileId%
252     params:
253      fileId:
254       token: fileId
255    id:
256     pattern: %id%
257     params:
258      id:
259       token: id
260    src:
261     pattern: %src%
262     params:
263      src:
264       token: src
265    max:
266     pattern: %scalesize%
267     params:
268      scalesize:
269       token: scalesize
270       default: 200
271    height:
272     pattern: %height%
273     params:
274      height:
275       token: height
276    width:
277     pattern: %width%
278     params:
279      width:
280       token: width
281    link:
282     pattern: %link%
283     params:
284      link:
285       token: link
286    rel:
287     pattern: %rel%
288     params:
289      rel:
290       token: rel
291    title:
292     pattern: %title%
293     params:
294      title:
295       token: title
296    alt:
297     pattern: %alt%
298     params:
299      alt:
300       token: alt
301    align:
302     pattern: %align%
303     params:
304      align:
305       token: align
306    block:
307     pattern: %block%
308     params:
309      block:
310       token: block
311    desc:
312     pattern: %desc%
313     params:
314      desc:
315       token: desc
316    usemap:
317     pattern: %usemap%
318     params:
319      usemap:
320       token: usemap
321    class:
322     pattern: %class%
323     params:
324      class:
325       token: class
326    stylebox:
327     pattern: %style%
328     params:
329      style:
330       token: style
331       default: border:3px double;padding:.1cm; font-size:12px; line-height:1.5em; margin-left:4px; width:200px;
332    styledesc:
333     pattern: %descoptions%
334     params:
335      descoptions:
336       token: descoptions
337    default:
338     pattern: %default%
339     params:
340      default:
341       token: default
342    mandatory:
343     pattern: %mandatory%
344     params:
345      mandatory:
346       token: mandatory
347    button: y
348    imalign: center
349{CODE}
350PLUGINTEXT;
351
352	$profile_installer = new Tiki_Profile_Installer;
353	$profile = Tiki_Profile::fromString($plugstring, 'IMAGE');
354	$profile->removeSymbols();
355	$profile_installer->install($profile);
356
357	// ********************************  PICTURE plugin
358	$plugstring = <<<PLUGINTEXT
359{CODE(caption=>YAML,wrap=1)}
360objects:
361 -
362  type: plugin_alias
363  ref: combine_picture
364  data:
365   name: PICTURE
366   implementation: img
367   description:
368    name: Picture
369    description: Display uploaded pictures
370    params:
371     file:
372      required: true
373      name: File path
374      description: File name or path of the image.
375   body:
376    default: ''
377   params:
378    src:
379     pattern: %file%
380     params:
381      file:
382       token: file
383{CODE}
384PLUGINTEXT;
385
386	$profile_installer = new Tiki_Profile_Installer;
387	$profile = Tiki_Profile::fromString($plugstring, 'PICTURE');
388	$profile->removeSymbols();
389	$profile_installer->install($profile);
390}
391