~ubuntu-branches/ubuntu/hardy/gallery2/hardy-security

« back to all changes in this revision

Viewing changes to modules/slideshowapplet/SlideshowApplet.inc

  • Committer: Bazaar Package Importer
  • Author(s): Michael C. Schultheiss
  • Date: 2006-04-16 16:42:35 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20060416164235-8uy0u4bfjdxpge2o
Tags: 2.1.1-1
* New upstream release (Closes: #362936)
  + Bugfixes for Postgres7 (Closes: #359000, #362152)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 * $RCSfile: SlideshowApplet.inc,v $
4
4
 *
5
5
 * Gallery - a web based photo album viewer and editor
6
 
 * Copyright (C) 2000-2005 Bharat Mediratta
 
6
 * Copyright (C) 2000-2006 Bharat Mediratta
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or modify
9
9
 * it under the terms of the GNU General Public License as published by
20
20
 * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA  02110-1301, USA.
21
21
 */
22
22
/**
23
 
 * @version $Revision: 1.7 $ $Date: 2005/08/26 05:15:14 $
24
 
 * @package uploadapplet
 
23
 * @version $Revision: 1.11 $ $Date: 2006/02/27 00:25:57 $
 
24
 * @package SlideshowApplet
25
25
 * @author Pierre-Luc Paour <gallery@paour.com>
26
26
 */
27
27
 
34
34
        global $gallery;
35
35
 
36
36
        list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'slideshowapplet');
37
 
        if ($ret->isError()) {
 
37
        if ($ret) {
38
38
            return array($ret->wrap(__FILE__, __LINE__), null);
39
39
        }
40
40
 
41
41
        list ($ret, $modules) = GalleryCoreApi::fetchPluginStatus('module');
42
 
        if ($ret->isError()) {
 
42
        if ($ret) {
43
43
            return array($ret->wrap(__FILE__, __LINE__), null);
44
44
        }
45
45
 
47
47
 
48
48
        /* Build slideshow for an album.. */
49
49
        list ($ret, $item) = $this->_getItem();
50
 
        if ($ret->isError()) {
 
50
        if ($ret) {
51
51
            return array($ret->wrap(__FILE__, __LINE__), null);
52
52
        }
53
53
 
55
55
            /* Photo: do slideshow of parent album, start at this photo */
56
56
            $startId = $item->getId();
57
57
            list ($ret, $item) = GalleryCoreApi::loadEntitiesById($item->getParentId());
58
 
            if ($ret->isError()) {
 
58
            if ($ret) {
59
59
                return array($ret->wrap(__FILE__, __LINE__), null);
60
60
            }
61
61
        }
74
74
             */
75
75
            $SlideshowApplet['g2BaseUrl'] = $urlGenerator->getCurrentUrlDir(true);
76
76
            list ($ret, $cookiePath) = $urlGenerator->getCookiePath(true);
77
 
            if ($ret->isError()) {
 
77
            if ($ret) {
 
78
                return array($ret->wrap(__FILE__, __LINE__), null);
 
79
            }
 
80
            list ($ret, $cookieDomain) = $session->getCookieDomain();
 
81
            if ($ret) {
78
82
                return array($ret->wrap(__FILE__, __LINE__), null);
79
83
            }
80
84
            $SlideshowApplet['NoProtocolError'] = 0;
81
85
            $SlideshowApplet['cookieName'] = $session->getKey();
82
86
            $SlideshowApplet['cookieValue'] = $session->getId();
83
 
            $SlideshowApplet['cookieDomain'] = $session->getCookieDomain();
 
87
            $SlideshowApplet['cookieDomain'] = $cookieDomain;
84
88
            $SlideshowApplet['cookiePath'] = $cookiePath;
85
89
            $SlideshowApplet['album'] = $item->getId();
86
 
            //$SlideshowApplet['defaults'] = array();
87
 
            $SlideshowApplet['overrides'] = array('toSysOut' => 'true');
88
90
            $SlideshowApplet['userAgent'] = GalleryUtilities::getServerVar('HTTP_USER_AGENT');
89
91
            $SlideshowApplet['galleryVersion'] = 2;
90
92
            $SlideshowApplet['code'] = 'com.gallery.GalleryRemote.GRAppletSlideshow';
91
93
 
 
94
            list ($ret, $locale) = $gallery->getActiveLanguageCode();
 
95
            if ($ret) {
 
96
                return array($ret->wrap(__FILE__, __LINE__), null);
 
97
            }
 
98
            $SlideshowApplet['locale'] = $locale;
 
99
 
92
100
            if (isset($startId)) {
93
 
                /* format the start_from as album_picture, that's what GR expects */
94
 
                $SlideshowApplet['extra']['gr_slideshow_start_from'] = $item->getId().'_'.$startId;
 
101
                /* format the start_from as album_picture, that's what GR expects */
 
102
                $SlideshowApplet['extra']['gr_slideshow_start_from'] = $item->getId().'_'.$startId;
95
103
            }
96
104
 
97
 
            list ($ret, $params) = GalleryCoreApi::fetchAllPluginParameters('module', 'slideshowapplet');
98
 
            if ($ret->isError()) {
 
105
            list ($ret, $params) =
 
106
                GalleryCoreApi::fetchAllPluginParameters('module', 'slideshowapplet');
 
107
            if ($ret) {
99
108
                return array($ret->wrap(__FILE__, __LINE__), null);
100
109
            }
101
 
            $SlideshowApplet['defaults'] = $params;
 
110
            foreach (array('default', 'override') as $type) {
 
111
                $SlideshowApplet[$type] = array();
 
112
                if (!empty($params['slideshow' . $type . 'Variables'])) {
 
113
                    $variablesArray = explode('|', $params['slideshow' . $type . 'Variables']);
 
114
                    foreach ($variablesArray as $variable) {
 
115
                        list($name, $value) = explode('=', $variable);
 
116
                        $SlideshowApplet[$type][$name] = $value;
 
117
                    }
 
118
                }
 
119
            }
102
120
        }
103
121
 
104
122
        $form['formName'] = '';
105
123
        $template->setVariable('controller', '');
106
124
        $template->setVariable('SlideshowApplet', $SlideshowApplet);
107
 
        return array(GalleryStatus::success(),
 
125
        return array(null,
108
126
                     array('body' => 'modules/slideshowapplet/templates/SlideshowApplet.tpl'));
109
127
    }
110
128
 
113
131
     */
114
132
    function getViewDescription() {
115
133
        list ($ret, $module) = GalleryCoreApi::loadPlugin('module', 'slideshowapplet');
116
 
        if ($ret->isError()) {
 
134
        if ($ret) {
117
135
            return array($ret->wrap(__FILE__, __LINE__), null);
118
136
        }
119
137
 
120
 
        return array(GalleryStatus::success(), $module->translate('slideshow (fullscreen)'));
 
138
        return array(null, $module->translate('slideshow (fullscreen)'));
121
139
    }
122
140
}
123
141
?>