1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13:
14: class Ansel
15: {
16:
17: const SORT_ASCENDING = 0;
18: const SORT_DESCENDING = 1;
19:
20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38:
39: static public function selectGalleries($params = array())
40: {
41: $galleries = $GLOBALS['injector']
42: ->getInstance('Ansel_Storage')
43: ->listGalleries($params);
44:
45: $params = new Horde_Support_Array($params);
46:
47: $tree = $GLOBALS['injector']
48: ->getInstance('Horde_Core_Factory_Tree')
49: ->create('gallery_tree', 'Select');
50:
51:
52: if ($params->ignore) {
53: if ($params->selected == $params->ignore) {
54: $params->selected = null;
55: }
56: }
57:
58: foreach ($galleries as $gallery) {
59: $gallery_id = $gallery->id;
60: $gallery_name = $gallery->get('name');
61: $label = Horde_String::abbreviate($gallery_name);
62: $len = Horde_String::length($gallery_name);
63: $treeparams = array();
64: $treeparams['selected'] = $gallery_id == $params->selected;
65: $parent = $gallery->getParent();
66: $parent = empty($parent) ? null : $parent->id;
67: $tree->addNode($gallery->id, $parent, $label, null, true, $treeparams);
68: }
69:
70: return $tree->getTree();
71: }
72:
73: 74: 75: 76: 77: 78: 79: 80: 81:
82: static public function getErrorImage($view = 'screen')
83: {
84: return Horde_Themes::img($view . '-error.png');
85: }
86:
87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97:
98: static public function getUrlFor($controller, $data, $full = false, $append_session = 0)
99: {
100: global $prefs;
101:
102: $rewrite = isset($GLOBALS['conf']['urls']['pretty']) &&
103: $GLOBALS['conf']['urls']['pretty'] == 'rewrite';
104:
105: switch ($controller ) {
106: case 'view':
107: if ($rewrite && (empty($data['special']))) {
108: $url = '';
109:
110:
111: if ($data['view'] == 'List') {
112:
113: $groupby = isset($data['groupby'])
114: ? $data['groupby']
115: : $prefs->getValue('groupby');
116: if ($groupby == 'owner' && !empty($data['owner'])) {
117: $url = 'user/' . urlencode($data['owner']) . '/';
118: } elseif ($groupby == 'owner') {
119: $url = 'user/';
120: } elseif ($groupby == 'none') {
121: $url = 'all/';
122: }
123: $url = Horde::url($url, $full, $append_session);
124:
125: if (!empty($data['page'])) {
126: $url->add('page', $data['page']);
127: }
128: return $url;
129: }
130:
131:
132: if ($data['view'] == 'Gallery' || $data['view'] == 'Image') {
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143: if (empty($data['year']) && $data['view'] == 'Image') {
144:
145:
146:
147: $i = $GLOBALS['injector']
148: ->getInstance('Ansel_Storage')
149: ->getImage($data['image']);
150: $g = $GLOBALS['injector']
151: ->getInstance('Ansel_Storage')
152: ->getGallery($data['gallery']);
153: if ($g->get('view_mode') == 'Date') {
154: $imgDate = new Horde_Date($i->originalDate);
155: $data['year'] = $imgDate->year;
156: $data['month'] = $imgDate->month;
157: $data['day'] = $imgDate->mday;
158: }
159: }
160:
161: $url = 'gallery/'
162: . (!empty($data['slug'])
163: ? $data['slug']
164: : 'id/' . (int)$data['gallery'])
165: . '/';
166:
167:
168: if ($data['view'] == 'Image' &&
169: (empty($data['gallery_view']) ||
170: (!empty($data['gallery_view']) &&
171: $data['gallery_view'] != 'GalleryLightbox'))) {
172:
173: $url .= (int)$data['image'] . '/';
174: }
175:
176: $extras = array();
177:
178:
179: if (!empty($data['havesearch'])) {
180: $extras['havesearch'] = $data['havesearch'];
181: }
182:
183:
184: if (!empty($data['force_grouping'])) {
185: $extras['force_grouping'] = $data['force_grouping'];
186: }
187:
188: $url = new Horde_Url($url);
189: if (count($extras)) {
190: $url->add($extras);
191: }
192:
193:
194:
195: if ($data['view'] == 'Image' &&
196: !empty($data['gallery_view']) &&
197: $data['gallery_view'] == 'GalleryLightbox') {
198: $url->setAnchor($data['image']);
199: }
200:
201: } elseif ($data['view'] == 'Results') {
202: $url = new Horde_Url('tag/' . (!empty($data['tag'])
203: ? urlencode($data['tag']) . '/'
204: : ''));
205:
206: if (!empty($data['actionID'])) {
207: $url->add(array('actionID' => $data['actionID']));
208: }
209:
210: if (!empty($data['owner'])) {
211: $url->add('owner', $data['owner']);
212: }
213: }
214:
215:
216:
217: if (!empty($data['page'])) {
218: $url->add('page', $data['page']);
219: }
220:
221: if (!empty($data['year'])) {
222: $url->add(
223: array(
224: 'year' => $data['year'],
225: 'month' => (empty($data['month']) ? 0 : $data['month']),
226: 'day' => (empty($data['day']) ? 0 : $data['day'])));
227: }
228:
229: return Horde::url($url, $full, $append_session);
230:
231: } else {
232: $url = Horde::url('view.php', $full, $append_session);
233:
234:
235: if ($data['view'] == 'Image' &&
236: !empty($data['gallery_view']) &&
237: $data['gallery_view'] == 'GalleryLightbox') {
238: $data['view'] = 'Gallery';
239: $url->setAnchor($data['image']);
240: }
241:
242: return $url->add($data)->setRaw(true);
243: }
244:
245: case 'group':
246: if ($rewrite) {
247: if (empty($data['groupby'])) {
248: $data['groupby'] = $prefs->getValue('groupby');
249: }
250: if ($data['groupby'] == 'owner') {
251: $url = 'user/';
252: } elseif ($data['groupby'] == 'none') {
253: $url = 'all/';
254: }
255: unset($data['groupby']);
256:
257: $url = Horde::url($url, $full, $append_session);
258: if (count($data)) {
259: $url->add($data);
260: }
261: return $url;
262: } else {
263: return Horde::url('group.php', $full, $append_session)->add($data);
264: }
265:
266: case 'rss_user':
267: if ($rewrite) {
268: return Horde::url(
269: 'user/' . urlencode($data['owner']) . '/rss',
270: $full,
271: $append_session);
272: } else {
273: $url = Horde::url(
274: new Horde_Url('rss.php'), $full, $append_session);
275: return $url->add(
276: array('stream_type' => 'user', 'id' => $data['owner']));
277: }
278:
279: case 'rss_gallery':
280: if ($rewrite) {
281: $id = (!empty($data['slug'])) ?
282: $data['slug'] :
283: 'id/' . (int)$data['gallery'];
284: return Horde::url(
285: 'gallery/' . $id . '/rss',
286: $full,
287: $append_session);
288: } else {
289: return Horde::url(
290: 'rss.php',
291: $full,
292: $append_session)->add(
293: array(
294: 'stream_type' => 'gallery',
295: 'id' => (int)$data['gallery']));
296: }
297:
298: case 'default_view':
299: switch ($prefs->getValue('defaultview')) {
300: case 'browse':
301: return Horde::url(new Horde_Url('browse.php'), $full, $append_session);
302:
303: case 'galleries':
304: $url = Ansel::getUrlFor('view', array('view' => 'List'), true);
305: break;
306:
307: case 'mygalleries':
308: default:
309: $url = Ansel::getUrlFor(
310: 'view',
311: array(
312: 'view' => 'List',
313: 'owner' => $GLOBALS['registry']->getAuth(),
314: 'groupby' => 'owner'),
315: true);
316: break;
317: }
318:
319: return $url;
320: }
321: }
322:
323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335:
336: static public function getImageUrl(
337: $imageId, $view = 'screen', $full = false, Ansel_Style $style = null)
338: {
339: global $conf;
340:
341: if (empty($imageId)) {
342: return Horde::url((string)Ansel::getErrorImage($view), $full);
343: }
344:
345:
346: if (is_null($style)) {
347: $style = Ansel::getStyleDefinition('ansel_default');
348: }
349:
350:
351: $viewHash = Ansel_Image::viewExists($imageId, $view, $style);
352: if ($conf['vfs']['src'] != 'php' && $viewHash === false) {
353:
354:
355: try {
356: $image = $GLOBALS['injector']
357: ->getInstance('Ansel_Storage')
358: ->getImage($imageId);
359: } catch (Ansel_Exception $e) {
360: Horde::logMessage($e, 'ERR');
361: return Horde::url((string)Ansel::getErrorImage($view), $full);
362: }
363: try {
364: $image->createView($view, $style);
365: } catch (Ansel_Exception $e) {
366: return Horde::url((string)Ansel::getErrorImage($view), $full);
367: }
368: $viewHash = $image->getViewHash($view, $style) . '/' . $image->getVFSName($view);
369: }
370:
371:
372:
373: if ($conf['vfs']['src'] != 'direct') {
374: $params = array('image' => $imageId);
375: if (!is_null($style)) {
376: $params['t'] = $style->thumbstyle;
377: $params['b'] = $style->background;
378: if ($style->width) {
379: $params['w'] = $style->width;
380: }
381: if ($style->height) {
382: $params['h'] = $style->height;
383: }
384: }
385:
386: return Horde::url('img/' . $view . '.php', $full)->add($params);
387: }
388:
389:
390: $path = substr(str_pad($imageId, 2, 0, STR_PAD_LEFT), -2) . '/' . $viewHash;
391: if ($full && substr($conf['vfs']['path'], 0, 7) != 'http://') {
392: return Horde::url($conf['vfs']['path'] . $path, true, -1);
393: } else {
394: return new Horde_Url($conf['vfs']['path'] . htmlspecialchars($path));
395: }
396: }
397:
398: 399: 400: 401: 402: 403: 404:
405: static public function getImageObject($params = array())
406: {
407: return $GLOBALS['injector']
408: ->getInstance('Horde_Core_Factory_Image')
409: ->create(array('type' => $GLOBALS['conf']['image']['type']));
410: }
411:
412: 413: 414: 415: 416: 417: 418: 419: 420:
421: static public function getImageFromFile($file, $override = array())
422: {
423: if (!file_exists($file)) {
424: throw new Horde_Exception_NotFound(
425: sprintf(_("The file \"%s\" doesn't exist."), $file));
426: }
427:
428: global $conf;
429:
430:
431: $mime_type = Horde_Mime_Magic::analyzeFile(
432: $file,
433: isset($conf['mime']['magic_db']) ? $conf['mime']['magic_db'] : null);
434: if (strpos($mime_type, 'image') === false) {
435: throw new Horde_Exception_NotFound(
436: sprintf(_("Can't get unknown file type \"%s\"."), $file));
437: }
438:
439: $image = array(
440: 'image_filename' => basename($file),
441: 'image_caption' => '',
442: 'image_type' => $mime_type,
443: 'data' => file_get_contents($file));
444:
445:
446: if (count($override)) {
447: $image = array_merge($image, $override);
448: }
449:
450: return $image;
451: }
452:
453: 454: 455: 456: 457: 458: 459: 460:
461: static public function isAvailable($feature)
462: {
463: static $capabilities;
464:
465:
466:
467: if ($feature == 'text_watermark' &&
468: $GLOBALS['prefs']->getValue('watermark_auto') &&
469: $GLOBALS['prefs']->isLocked('watermark_auto')) {
470:
471: return false;
472: }
473:
474: if (!isset($capabilities)) {
475: $im = Ansel::getImageObject();
476: $capabilities = array_merge($im->getCapabilities(),
477: $im->getLoadedEffects());
478: }
479:
480: return in_array($feature, $capabilities);
481: }
482:
483: 484: 485: 486: 487: 488: 489: 490: 491:
492: static public function getBreadCrumbs($gallery = null, $separator = ' » ')
493: {
494: global $prefs;
495:
496: $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
497: $groupby = Horde_Util::getFormData('groupby', $prefs->getValue('groupby'));
498: $owner = Horde_Util::getFormData('owner');
499: $image_id = (int)Horde_Util::getFormData('image');
500: $actionID = Horde_Util::getFormData('actionID');
501: $page = Horde_Util::getFormData('page', 0);
502: $haveSearch = Horde_Util::getFormData('havesearch', 0);
503:
504: if (is_null($gallery)) {
505: $gallery_id = (int)Horde_Util::getFormData('gallery');
506: $gallery_slug = Horde_Util::getFormData('slug');
507: try {
508: if (!empty($gallery_slug)) {
509: $gallery = $ansel_storage->getGalleryBySlug($gallery_slug);
510: } elseif (!empty($gallery_id)) {
511: $gallery = $ansel_storage->getGallery($gallery_id);
512: }
513: } catch (Ansel_Exception $e) {}
514: }
515:
516: if ($gallery) {
517: $owner = $gallery->get('owner');
518: }
519:
520: if (!empty($image_id)) {
521: $image = $ansel_storage->getImage($image_id);
522: if (empty($gallery)) {
523: $gallery = $ansel_storage->getGallery($image->gallery);
524: }
525: }
526: if (isset($gallery)) {
527: $owner = $gallery->get('owner');
528: }
529: if (!empty($owner)) {
530: if (!$owner) {
531: $owner_title = _("System Galleries");
532: } elseif ($owner == $GLOBALS['registry']->getAuth()) {
533: $owner_title = _("My Galleries");
534: } elseif (!empty($GLOBALS['conf']['gallery']['customlabel'])) {
535: $uprefs = $GLOBALS['injector']
536: ->getInstance('Horde_Core_Factory_Prefs')
537: ->create(
538: 'ansel',
539: array(
540: 'cache' => false,
541: 'user' => $owner)
542: );
543: $fullname = $uprefs->getValue('grouptitle');
544: if (!$fullname) {
545: $identity = $GLOBALS['injector']
546: ->getInstance('Horde_Core_Factory_Identity')
547: ->create($owner);
548: $fullname = $identity->getValue('fullname');
549: if (!$fullname) {
550: $fullname = $owner;
551: }
552: $owner_title = sprintf(_("%s's Galleries"), $fullname);
553: } else {
554: $owner_title = $fullname;
555: }
556: } else {
557: $owner_title = sprintf(_("%s's Galleries"), $owner);
558: }
559: }
560:
561:
562:
563:
564: $levels = 0;
565: $nav = '';
566: $urlFlags = array(
567: 'havesearch' => $haveSearch,
568: 'force_grouping' => true);
569:
570:
571: if (!empty($image_id)) {
572: $text = '<span class="thiscrumb" id="PhotoName">'
573: . htmlspecialchars($image->filename) . '</span>';
574: $nav = $separator . $text . $nav;
575: $levels++;
576: }
577:
578: if ($gallery) {
579: $trails = $gallery->getGalleryCrumbData();
580: foreach ($trails as $trail) {
581: $title = $trail['title'];
582: $navdata = $trail['navdata'];
583: if ($levels++ > 0) {
584: if ((empty($image_id) && $levels == 1) ||
585: (!empty($image_id) && $levels == 2)) {
586: $urlParameters = array_merge($urlFlags, array('page' => $page));
587: } else {
588: $urlParameters = $urlFlags;
589: }
590: $nav = $separator
591: . Ansel::getUrlFor('view', array_merge($navdata, $urlParameters))->link()
592: . $title . '</a>' . $nav;
593: } else {
594: $nav = $separator . '<span class="thiscrumb">' . $title
595: . '</span>' . $nav;
596: }
597: }
598: }
599:
600: if (!empty($owner_title)) {
601: $owner_title = htmlspecialchars($owner_title);
602: $levels++;
603: if ($gallery) {
604: $nav = $separator
605: . Ansel::getUrlFor(
606: 'view',
607: array(
608: 'view' => 'List',
609: 'groupby' => 'owner',
610: 'owner' => $owner,
611: 'havesearch' => $haveSearch))->link()
612: . $owner_title . '</a>' . $nav;
613: } else {
614: $nav = $separator . $owner_title . $nav;
615: }
616: }
617:
618: if ($haveSearch == 0) {
619: $text = _("Galleries");
620: $link = Ansel::getUrlFor('view', array('view' => 'List'))->link();
621: } else {
622: $text = _("Browse Tags");
623: $link = Ansel::getUrlFor(
624: 'view', array('view' => 'Results'), true)->link();
625: }
626: if ($levels > 0) {
627: $nav = $link . $text . '</a>' . $nav;
628: } else {
629: $nav = $text . $nav;
630: }
631:
632: return '<span class="breadcrumbs">' . $nav . '</span>';
633: }
634:
635: 636: 637: 638: 639: 640: 641: 642: 643:
644: static public function getStyleSelect($element_name, $selected = '')
645: {
646: $styles = $GLOBALS['injector']->getInstance('Ansel_Styles');
647:
648:
649: foreach ($styles as $key => $style) {
650: if (empty($style['hide'])) {
651: $options[$key] = $style['title'];
652: }
653: }
654:
655:
656: if ($selected == '') {
657: $selected = $GLOBALS['prefs']->getValue('default_gallerystyle');
658: }
659:
660: $html = '<select id="' . $element_name . '" name="' . $element_name . '">';
661: foreach ($options as $key => $option) {
662: $html .= ' <option value="' . $key . '"' . (($selected == $key) ? 'selected="selected"' : '') . '>'
663: . $option . '</option>';
664: }
665:
666: return $html .= '</select>';
667: }
668:
669: 670: 671: 672: 673: 674: 675: 676: 677:
678: static public function getStyleDefinition($style)
679: {
680: $styles = $GLOBALS['injector']->getInstance('Ansel_Styles');
681: if (isset($styles[$style])) {
682: return new Ansel_Style($styles[$style]);
683: } else {
684: return new Ansel_Style($styles['ansel_default']);
685: }
686: }
687:
688: 689: 690: 691: 692: 693: 694: 695: 696:
697: static public function getDateParameter($date = array())
698: {
699: if (!count($date)) {
700: $date = array(
701: 'year' => Horde_Util::getFormData('year', 0),
702: 'month' => Horde_Util::getFormData('month', 0),
703: 'day' => Horde_Util::getFormData('day', 0));
704: }
705: $return = array();
706: $return['year'] = !empty($date['year']) ? $date['year'] : 0;
707: $return['month'] = !empty($date['month']) ? $date['month'] : 0;
708: $return['day'] = !empty($date['day']) ? $date['day'] : 0;
709:
710: return $return;
711: }
712:
713: 714: 715: 716: 717: 718: 719: 720:
721: static public function downloadImagesAsZip($gallery = null, $images = array())
722: {
723:
724: if (empty($GLOBALS['conf']['gallery']['downloadzip'])) {
725: $GLOBALS['notification']->push(
726: _("Downloading zip files is not enabled. Talk to your server administrator."));
727: Horde::url('view.php?view=List', true)->redirect();
728: exit;
729: }
730:
731:
732: if (!is_null($gallery)) {
733:
734: $slug = $gallery->get('slug');
735:
736:
737: $gallery->setDate(Ansel::getDateParameter());
738: $images = $gallery->listImages();
739: }
740:
741:
742: if (!count($images)) {
743: $notification->push(
744: sprintf(_("There are no photos in %s to download."),
745: $gallery->get('name')),
746: 'horde.message');
747:
748: Horde::url('view.php?view=List', true)->redirect();
749: exit;
750: }
751:
752:
753:
754: @session_write_close();
755:
756: if (!is_null($gallery)) {
757:
758: if ($gallery->canDownload()) {
759: $view = 'full';
760: } else {
761: $view = 'screen';
762: }
763: }
764:
765: $zipfiles = array();
766: foreach ($images as $id) {
767: $image = $GLOBALS['injector']
768: ->getInstance('Ansel_Storage')
769: ->getImage($id);
770:
771:
772:
773: if (!isset($view)) {
774: $g = $GLOBALS['injector']
775: ->getInstance('Ansel_Storage')
776: ->getGallery($image->gallery);
777: $v = $g->canDownload() ? 'full' : 'screen';
778: } else {
779: $v = $view;
780: }
781:
782: $zipfiles[] = array('data' => $image->raw($v),
783: 'name' => $image->filename);
784: }
785:
786: $zip = Horde_Compress::factory('zip');
787: $body = $zip->compress($zipfiles);
788: if (!empty($gallery)) {
789: $filename = (!empty($slug) ? $slug : $gallery->id) . '.zip';
790: } else {
791: $filename = 'Ansel.zip';
792: }
793: $GLOBALS['browser']->downloadHeaders($filename, 'application/zip', false,
794: strlen($body));
795: echo $body;
796: exit;
797: }
798:
799: 800: 801: 802: 803: 804: 805: 806:
807: static public function embedCode($options)
808: {
809: if (empty($options['container'])) {
810: $domid = uniqid();
811: $options['container'] = $domid;
812: } else {
813: $domid = $options['container'];
814: }
815:
816: $imple = $GLOBALS['injector']
817: ->getInstance('Horde_Core_Factory_Imple')
818: ->create(array('ansel', 'Embed'), $options);
819:
820: return '<script type="text/javascript" src="' . $imple->getUrl()
821: . '"></script><div id="' . $domid . '"></div>';
822: }
823:
824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834:
835: static public function getTagLinks($tags, $action = 'add', $owner = null)
836: {
837:
838: $results = array();
839: foreach ($tags as $id => $taginfo) {
840: $params = array('view' => 'Results',
841: 'tag' => $taginfo['tag_name']);
842: if (!empty($owner)) {
843: $params['owner'] = $owner;
844: }
845: if ($action != 'add') {
846: $params['actionID'] = $action;
847: }
848: $link = Ansel::getUrlFor('view', $params, true);
849: $results[$id] = $link;
850: }
851:
852: return $results;
853: }
854:
855: 856: 857:
858: static public function initJSVariables()
859: {
860: if (!$GLOBALS['browser']->isMobile()) {
861: $code['conf'] = array(
862: 'BASE_URI' => (string)Horde::url(
863: '',
864: true,
865: array(
866: 'app' => 'ansel',
867: 'append_session' => -1)));
868:
869:
870: $code['conf']['maps'] = $GLOBALS['conf']['maps'];
871: $code['conf']['pixeluri'] = (string)Horde::getServiceLink('pixel', 'ansel');
872: $code['conf']['markeruri'] = (string)Horde_Themes::img('photomarker.png');
873: $code['conf']['shadowuri'] = (string)Horde_Themes::img('photomarker-shadow.png');
874: $code['conf']['havetwitter'] = !empty($GLOBALS['conf']['twitter']['enabled']);
875: $code['ajax'] = new stdClass();
876: $code['widgets'] = new stdClass();
877: Horde::addInlineJsVars(array(
878: 'var Ansel' => $code));
879: }
880: }
881:
882: 883: 884: 885: 886: 887: 888: 889: 890:
891: static public function initHordeMap($params = array())
892: {
893: if (empty($params['providers'])) {
894: $params['providers'] = $GLOBALS['conf']['maps']['providers'];
895: }
896: if (empty($params['geocoder'])) {
897: $params['geocoder'] = $GLOBALS['conf']['maps']['geocoder'];
898: }
899:
900: $language = str_replace('_', '-', $GLOBALS['language']);
901: if (!file_exists($GLOBALS['registry']->get('jsfs', 'horde') . '/map/lang/' . $language . '.js')) {
902: $language = 'en-US';
903: }
904: $params['conf'] = array(
905: 'language' => $language
906: );
907: $params['driver'] = 'Horde';
908: foreach ($params['providers'] as $layer) {
909: switch ($layer) {
910: case 'Google':
911: $params['conf']['apikeys']['google'] = $GLOBALS['conf']['api']['googlemaps'];
912: break;
913: case 'Yahoo':
914: $params['conf']['apikeys']['yahoo'] = $GLOBALS['conf']['api']['yahoomaps'];
915: break;
916: case 'Cloudmade':
917: $params['conf']['apikeys']['cloudmade'] = $GLOBALS['conf']['api']['cloudmade'];
918: break;
919: case 'Mytopo':
920: $params['conf']['apikeys']['mytopo'] = $GLOBALS['conf']['api']['mytopo'];
921: break;
922: }
923: }
924:
925: if (!empty($params['geocoder'])) {
926: switch ($params['geocoder']) {
927: case 'Google':
928: $params['conf']['apikeys']['google'] = $GLOBALS['conf']['api']['googlemaps'];
929: break;
930: case 'Yahoo':
931: $params['conf']['apikeys']['yahoo'] = $GLOBALS['conf']['api']['yahoomaps'];
932: break;
933: case 'Cloudmade':
934: $params['conf']['apikeys']['cloudmade'] = $GLOBALS['conf']['api']['cloudmade'];
935: break;
936: }
937: }
938: $params['jsuri'] = $GLOBALS['registry']->get('jsuri', 'horde') . '/map/';
939: Horde::addScriptFile('map/map.js', 'horde');
940: Horde::addScriptFile('map.js');
941: $js = 'HordeMap.initialize(' . Horde_Serialize::serialize($params, HORDE_SERIALIZE::JSON) . ');';
942: Horde::addinlineScript($js);
943: }
944:
945: }
946: