Beispiel #1
0
 function _loadData()
 {
     global $mainframe;
     $user =& JFactory::getUser();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = 'SELECT c.params,c.title,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as slug ' . ' FROM #__phocagallery_categories AS c' . ' WHERE c.id = ' . (int) $this->_catid;
         $this->_db->setQuery($query, 0, 1);
         $params = $this->_db->loadObject();
         if (isset($params)) {
             $longitude = PhocaGalleryHelper::getParamsArray($params->params, 'longitude');
             $latitude = PhocaGalleryHelper::getParamsArray($params->params, 'latitude');
             $zoom = PhocaGalleryHelper::getParamsArray($params->params, 'zoom');
             $geotitle = PhocaGalleryHelper::getParamsArray($params->params, 'geotitle');
             if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) {
                 $this->_data['longitude'] = '';
             } else {
                 $this->_data['longitude'] = $longitude[0];
             }
             if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) {
                 $this->_data['latitude'] = '';
             } else {
                 $this->_data['latitude'] = $latitude[0];
             }
             if (!isset($zoom[0]) || isset($zoom[0]) && ($zoom[0] == '' || $zoom[0] == 0)) {
                 $this->_data['zoom'] = 2;
             } else {
                 $this->_data['zoom'] = $zoom[0];
             }
             if (!isset($geotitle[0]) || isset($geotitle[0]) && $geotitle[0] == '') {
                 $this->_data['geotitle'] = $params->title;
             } else {
                 $this->_data['geotitle'] = $geotitle[0];
             }
         } else {
             $this->_data['longitude'] = '';
             $this->_data['latitude'] = '';
             $this->_data['zoom'] = 2;
             $this->_data['geotitle'] = '';
         }
         // Image
         $query = 'SELECT a.filename, a.description' . ' FROM #__phocagallery AS a' . ' WHERE a.id = ' . (int) $this->_id;
         $this->_db->setQuery($query, 0, 1);
         $image = $this->_db->loadObject();
         if (isset($image->filename) && $image->filename != '') {
             $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($image->filename, 'small');
             $this->_data['thumbnail'] = $file_thumbnail['rel'];
         } else {
             $this->_data['thumbnail'] = '';
         }
         if (isset($image->description) && $image->description != '') {
             $this->_data['description'] = $image->description;
         } else {
             $this->_data['description'] = '';
         }
         return (bool) $this->_data;
     }
     return true;
 }
Beispiel #2
0
        echo $this->tmpl2['categorieszoom'];
        ?>
);
		map_phoca_geo.setMapType(G_NORMAL_MAP);
		map_phoca_geo.enableContinuousZoom();
		map_phoca_geo.enableDoubleClickZoom();
		map_phoca_geo.enableScrollWheelZoom();

<?php 
        $data = array();
        foreach ($this->categories as $category) {
            if (isset($category->params)) {
                $longitude = PhocaGalleryHelper::getParamsArray($category->params, 'longitude');
                $latitude = PhocaGalleryHelper::getParamsArray($category->params, 'latitude');
                //$zoom		= PhocaGalleryHelper::getParamsArray($category->params, 'zoom');
                $geotitle = PhocaGalleryHelper::getParamsArray($category->params, 'geotitle');
                if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) {
                    $data['longitude'] = '';
                } else {
                    $data['longitude'] = $longitude[0];
                }
                if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) {
                    $data['latitude'] = '';
                } else {
                    $data['latitude'] = $latitude[0];
                }
                if (!isset($geotitle[0]) || isset($geotitle[0]) && $geotitle[0] == '') {
                    $data['geotitle'] = $category->title;
                } else {
                    $data['geotitle'] = $geotitle[0];
                }
Beispiel #3
0
 function findLatLngFromCategory($categories)
 {
     $returnLng = '';
     $returnLat = '';
     foreach ($categories as $category) {
         if (isset($category->params)) {
             $longitude = PhocaGalleryHelper::getParamsArray($category->params, 'longitude');
             $latitude = PhocaGalleryHelper::getParamsArray($category->params, 'latitude');
             if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) {
                 $returnLng = '';
             } else {
                 $returnLng = $longitude[0];
             }
             if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) {
                 $returnLat = '';
             } else {
                 $returnLat = $latitude[0];
             }
             if ($returnLat != '' || $returnLng != '') {
                 $latLng['lat'] = $returnLat;
                 $latLng['lng'] = $returnLng;
                 return $latLng;
             }
         }
     }
     // if nothing will be found, paste some lng, lat
     $latLng['lat'] = 50.079623358200884;
     $latLng['lng'] = 14.429919719696045;
     return $latLng;
 }
Beispiel #4
0
 function getGeotagging($catId)
 {
     global $mainframe;
     $query = 'SELECT c.params,c.title,' . ' CASE WHEN CHAR_LENGTH(c.alias) THEN CONCAT_WS(\':\', c.id, c.alias) ELSE c.id END as slug ' . ' FROM #__phocagallery_categories AS c' . ' WHERE c.id = ' . (int) $catId;
     $this->_db->setQuery($query, 0, 1);
     $params = $this->_db->loadObject();
     $geotagging = array();
     if (isset($params)) {
         $longitude = PhocaGalleryHelper::getParamsArray($params->params, 'longitude');
         $latitude = PhocaGalleryHelper::getParamsArray($params->params, 'latitude');
         $zoom = PhocaGalleryHelper::getParamsArray($params->params, 'zoom');
         $geotitle = PhocaGalleryHelper::getParamsArray($params->params, 'geotitle');
         if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) {
             $geotagging['longitude'] = '';
         } else {
             $geotagging['longitude'] = $longitude[0];
         }
         if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) {
             $geotagging['latitude'] = '';
         } else {
             $geotagging['latitude'] = $latitude[0];
         }
         if (!isset($zoom[0]) || isset($zoom[0]) && ($zoom[0] == '' || $zoom[0] == 0)) {
             $geotagging['zoom'] = 2;
         } else {
             $geotagging['zoom'] = $zoom[0];
         }
         if (!isset($geotitle[0]) || isset($geotitle[0]) && $geotitle[0] == '') {
             $geotagging['geotitle'] = $params->title;
         } else {
             $geotagging['geotitle'] = $geotitle[0];
         }
     } else {
         $geotagging['longitude'] = '';
         $geotagging['latitude'] = '';
         $geotagging['zoom'] = 2;
         $geotagging['geotitle'] = '';
     }
     // Image (no image because we are in category not in detail
     $geotagging['thumbnail'] = '';
     $geotagging['description'] = '';
     return $geotagging;
 }
Beispiel #5
0
    function display($tpl = null)
    {
        global $mainframe;
        $document =& JFactory::getDocument();
        $uri =& JFactory::getURI();
        $menus =& JSite::getMenu();
        $menu = $menus->getActive();
        $params =& $mainframe->getParams();
        $user =& JFactory::getUser();
        $limitStart = JRequest::getVar('limitstart', 0, '', 'int');
        $id = JRequest::getVar('id', 0, '', 'int');
        $tmpl['tab'] = JRequest::getVar('tab', 0, '', 'int');
        $tmpl['formaticon'] = PhocaGalleryHelperFront::getFormatIcon();
        // Limit start
        if ($limitStart > 0) {
            $tmpl['limitstarturl'] = '&limitstart=' . $limitStart;
        } else {
            $tmpl['limitstarturl'] = '';
        }
        // PARAMS
        $tmpl['displaycatnametitle'] = $params->get('display_cat_name_title', 1);
        $display_cat_name_breadcrumbs = $params->get('display_cat_name_breadcrumbs', 1);
        $font_color = $params->get('font_color', '#b36b00');
        $background_color = $params->get('background_color', '#fcfcfc');
        $background_color_hover = $params->get('background_color_hover', '#f5f5f5');
        $image_background_color = $params->get('image_background_color', '#f5f5f5');
        $tmpl['displayimageshadow'] = $params->get('image_background_shadow', 'shadow1');
        $border_color = $params->get('border_color', '#e8e8e8');
        $border_color_hover = $params->get('border_color_hover', '#b36b00');
        $tmpl['imagewidth'] = $params->get('medium_image_width', 100);
        $tmpl['imageheight'] = $params->get('medium_image_height', 100);
        $front_modal_box_width = $params->get('front_modal_box_width', 680);
        $front_modal_box_height = $params->get('front_modal_box_height', 560);
        $front_popup_window_width = $params->get('front_popup_window_width', 680);
        $front_popup_window_height = $params->get('front_popup_window_height', 560);
        $tmpl['olbgcolor'] = $params->get('ol_bg_color', '#666666');
        $tmpl['olfgcolor'] = $params->get('ol_fg_color', '#f6f6f6');
        $tmpl['oltfcolor'] = $params->get('ol_tf_color', '#000000');
        $tmpl['olcfcolor'] = $params->get('ol_cf_color', '#ffffff');
        $tmpl['overliboverlayopacity'] = $params->get('overlib_overlay_opacity', 0.7);
        $margin_box = $params->get('margin_box', 5);
        $padding_box = $params->get('padding_box', 5);
        $tmpl['maxuploadchar'] = $params->get('max_upload_char', 1000);
        $tmpl['maxcommentchar'] = $params->get('max_comment_char', 1000);
        $tmpl['commentwidth'] = $params->get('comment_width', 500);
        $tmpl['displayrating'] = $params->get('display_rating', 0);
        $tmpl['displaycomment'] = $params->get('display_comment', 0);
        $tmpl['displaycategorygeotagging'] = $params->get('display_category_geotagging', 0);
        $tmpl['displaycategorystatistics'] = $params->get('display_category_statistics', 0);
        // Used for Highslide JS (only image)
        $tmpl['displaydescriptiondetail'] = $params->get('display_description_detail', 0);
        $tmpl['displaytitleindescription'] = $params->get('display_title_description', 0);
        // PARAMS - Background shadow
        if ($tmpl['displayimageshadow'] != 'none') {
            $imageBgCSS = 'background: url(\'' . JURI::base(true) . '/components/com_phocagallery/assets/images/' . $tmpl['displayimageshadow'] . '.' . $tmpl['formaticon'] . '\') 0 0 no-repeat;';
        } else {
            $imageBgCSS = 'background: ' . $image_background_color . ';';
        }
        // CSS
        $document->addCustomTag("<!--[if lt IE 8]>\n<link rel=\"stylesheet\" href=\"" . JURI::base(true) . "/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->");
        $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/js/comments.js');
        $document->addCustomTag(PhocaGalleryHelperRender::renderCategoryCSS($font_color, $background_color, $border_color, $imageBgCSS, $border_color_hover, $background_color_hover, $tmpl['olfgcolor'], $tmpl['olbgcolor'], $tmpl['oltfcolor'], $tmpl['olcfcolor'], $margin_box, $padding_box, $tmpl['overliboverlayopacity']));
        $document->addCustomTag(PhocaGalleryHelperRender::renderIeHover());
        // PARAMS
        $tmpl['phocagallerywidth'] = $params->get('phocagallery_width', '');
        $display_description_detail = $params->get('display_description_detail', 0);
        $description_detail_height = $params->get('description_detail_height', 16);
        $tmpl['categoryboxspace'] = $params->get('category_box_space', 0);
        $tmpl['detailwindow'] = $params->get('detail_window', 0);
        // Description detail height
        if ($display_description_detail == 1) {
            $front_popup_window_height = $front_popup_window_height + $description_detail_height;
        }
        // PARAMS - Display Buttons (height will be smaller)
        $detail_buttons = $params->get('detail_buttons', 1);
        // Detail buttons in detail view
        if ($detail_buttons != 1) {
            $front_popup_window_height = $front_popup_window_height - 45;
        }
        // PARAMS
        $modal_box_overlay_color = $params->get('modal_box_overlay_color', '#000000');
        $modal_box_overlay_opacity = $params->get('modal_box_overlay_opacity', 0.3);
        $modal_box_border_color = $params->get('modal_box_border_color', '#6b6b6b');
        $modal_box_border_width = $params->get('modal_box_border_width', '2');
        // =======================================================
        // DIFFERENT METHODS OF DISPLAYING THE DETAIL VIEW
        // =======================================================
        // MODAL - will be displayed in case e.g. highslide or shadowbox too, because in there are more links
        JHTML::_('behavior.modal', 'a.modal-button');
        // CSS
        $document->addCustomTag("<style type=\"text/css\"> \n" . " #sbox-window {background-color:" . $modal_box_border_color . ";padding:" . $modal_box_border_width . "px} \n" . " #sbox-overlay {background-color:" . $modal_box_overlay_color . ";} \n" . " </style> \n");
        // BUTTON (IMAGE - standard, modal, shadowbox)
        $button = new JObject();
        $button->set('name', 'image');
        // BUTTON OTHER (geotagging, downloadlink, ...)
        $buttonOther = new JObject();
        $buttonOther->set('name', 'other');
        $tmpl['highslideonclick'] = '';
        // for using with highslide
        // -------------------------------------------------------
        // STANDARD POPUP
        // -------------------------------------------------------
        if ($tmpl['detailwindow'] == 1) {
            $button->set('methodname', 'js-button');
            $button->set('options', "window.open(this.href,'win2','width=" . $front_popup_window_width . ",height=" . $front_popup_window_height . ",menubar=no,resizable=yes'); return false;");
            $buttonOther->set('methodname', 'js-button');
            $buttonOther->set('options', "window.open(this.href,'win2','width=" . $front_popup_window_width . ",height=" . $front_popup_window_height . ",menubar=no,resizable=yes'); return false;");
        } else {
            if ($tmpl['detailwindow'] == 0 || $tmpl['detailwindow'] == 2) {
                // Button
                $button->set('modal', true);
                $button->set('methodname', 'modal-button');
                $buttonOther->set('modal', true);
                $buttonOther->set('methodname', 'modal-button');
                if ($tmpl['detailwindow'] == 2) {
                    $button->set('options', "{handler: 'image', size: {x: 200, y: 150}, overlayOpacity: " . $modal_box_overlay_opacity . "}");
                    $buttonOther->set('options', "{handler: 'iframe', size: {x: " . $front_modal_box_width . ", y: " . $front_modal_box_height . "}, overlayOpacity: " . $modal_box_overlay_opacity . "}");
                } else {
                    $button->set('options', "{handler: 'iframe', size: {x: " . $front_modal_box_width . ", y: " . $front_modal_box_height . "}, overlayOpacity: " . $modal_box_overlay_opacity . "}");
                    $buttonOther->set('options', "{handler: 'iframe', size: {x: " . $front_modal_box_width . ", y: " . $front_modal_box_height . "}, overlayOpacity: " . $modal_box_overlay_opacity . "}");
                }
            } else {
                if ($tmpl['detailwindow'] == 3) {
                    $sb_slideshow_delay = $params->get('sb_slideshow_delay', 5);
                    $sb_lang = $params->get('sb_lang', 'en');
                    $button->set('methodname', 'shadowbox-button');
                    $button->set('options', "shadowbox[PhocaGallery];options={slideshowDelay:" . $sb_slideshow_delay . "}");
                    $buttonOther->set('modal', true);
                    $buttonOther->set('methodname', 'modal-button');
                    $buttonOther->set('options', "{handler: 'iframe', size: {x: " . $front_modal_box_width . ", y: " . $front_modal_box_height . "}, overlayOpacity: " . $modal_box_overlay_opacity . "}");
                    $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/js/shadowbox/adapter/shadowbox-mootools.js');
                    $document->addScript(JURI::base(true) . '/components/com_phocagallery/assets/js/shadowbox/shadowbox.js');
                    $document->addCustomTag('<script type="text/javascript">
Shadowbox.loadSkin("classic", "' . JURI::base(true) . '/components/com_phocagallery/assets/js/shadowbox/src/skin");
Shadowbox.loadLanguage("' . $sb_lang . '", "' . JURI::base(true) . '/components/com_phocagallery/assets/js/shadowbox/src/lang");
Shadowbox.loadPlayer(["img"], "' . JURI::base(true) . '/components/com_phocagallery/assets/js/shadowbox/src/player");
window.onload = function(){
	Shadowbox.init();
}
</script>');
                } else {
                    if ($tmpl['detailwindow'] == 4) {
                        $button->set('methodname', 'highslide');
                        $document->addCustomTag('<script type="text/javascript"
    src="' . JURI::base(true) . '/components/com_phocagallery/assets/js/highslide/highslide-full.js"></script>' . "\n" . '<link rel="stylesheet" type="text/css"
    href="' . JURI::base(true) . '/components/com_phocagallery/assets/js/highslide/highslide.css"" />' . "\n");
                        $document->addCustomTag(PhocaGalleryHelperRender::renderHighslideJS($front_modal_box_width, $front_modal_box_height));
                        $tmpl['highslideonclick'] = 'return hs.htmlExpand(this, {
            contentId: \'detail\',
            objectType: \'iframe\',
            objectWidth: ' . $front_modal_box_width . ',
            objectHeight: ' . $front_modal_box_height . '} )';
                    } else {
                        if ($tmpl['detailwindow'] == 5) {
                            $button->set('methodname', 'highslide');
                            $buttonOther->set('modal', true);
                            $buttonOther->set('methodname', 'modal-button');
                            $buttonOther->set('options', "{handler: 'iframe', size: {x: " . $front_modal_box_width . ", y: " . $front_modal_box_height . "}, overlayOpacity: " . $modal_box_overlay_opacity . "}");
                            $document->addCustomTag('<script type="text/javascript"
    src="' . JURI::base(true) . '/components/com_phocagallery/assets/js/highslide/highslide-full.js"></script>' . "\n" . '<link rel="stylesheet" type="text/css"
    href="' . JURI::base(true) . '/components/com_phocagallery/assets/js/highslide/highslideimage.css"" />' . "\n");
                            $document->addCustomTag(PhocaGalleryHelperRender::renderHighslideImageJS());
                            $tmpl['highslideonclick'] = 'return hs.expand(this)';
                        }
                    }
                }
            }
        }
        $folderbutton = new JObject();
        $folderbutton->set('name', 'image');
        $folderbutton->set('options', "");
        // End open window parameters
        // USER RIGHT - ACCESS =======================================
        // We get the category id, there is an USER ACCES BEHAVIOUR
        $category = $this->get('category');
        // function getCategory in Model
        // ===========================================================
        $total = $this->get('total');
        $tmpl['pagination'] =& $this->get('pagination');
        // CSS
        //$document->addStyleSheet(JURI::base(true).'/components/com_phocagallery/assets/phocagallery.css');
        JHTML::stylesheet('phocagallery.css', 'components/com_phocagallery/assets/');
        // PARAMS
        $tmpl['enablepiclens'] = $params->get('enable_piclens', 0);
        $tmpl['startpiclens'] = 0;
        // PICLENS
        if ($tmpl['enablepiclens'] == 1) {
            $tmpl['startpiclens'] = $params->get('start_piclens', 0);
            // CSS - PicLens START
            $document->addCustomTag(PhocaGalleryHelperRender::renderPicLens($category->id));
        }
        // PARAMS - Pagination and subcategories on other sites
        //Subcategories will be displayed only on first page if pagination will be used
        $display_subcat_page = $params->get('display_subcat_page', 0);
        // On the first site subcategories will be displayed allways
        $get['start'] = JRequest::getVar('start', '', 'get', 'string');
        if ($display_subcat_page == 0 && $get['start'] > 0) {
            $display_subcat_page = 0;
            //in case: second page and param=0
        } else {
            $display_subcat_page = 1;
            //in case:first page or param==1
        }
        // PARAMS - Display Back Buttons
        $display_back_button = $params->get('display_back_button', 1);
        $display_categories_back_button = $params->get('display_categories_back_button', 1);
        // PARAMS - Access Category - display category (subcategory folder or backbutton  to not accessible cat
        $display_access_category = $params->get('display_access_category', 1);
        // Set page title per category
        if ($tmpl['displaycatnametitle'] == 1) {
            $document->setTitle($params->get('page_title') . ' - ' . $category->title);
        } else {
            $document->setTitle($params->get('page_title'));
        }
        // Breadcrumb display:
        // 0 - only menu link
        // 1 - menu link - category name
        // 2 - only category name
        $this->_addBreadCrumbs($category, isset($menu->query['id']) ? $menu->query['id'] : 0, $display_cat_name_breadcrumbs);
        // PARAMS - the whole page title with category or without category
        $tmpl['showpagetitle'] = $params->get('show_page_title', 1);
        // Define image tag attributes
        if (!empty($category->image)) {
            $attribs['align'] = '"' . $category->image_position . '"';
            $attribs['hspace'] = '"6"';
            // Use the static HTML library to build the image tag
            $tmpl['image'] = JHTML::_('image', 'images/stories/' . $category->image, JText::_('Phoca gallery'), $attribs);
        }
        // PARAMS- Display or hide name, icon detail link
        $tmpl['displayname'] = $params->get('display_name', 1);
        $tmpl['displayicondetail'] = $params->get('display_icon_detail', 1);
        $tmpl['displayicondownload'] = $params->get('display_icon_download', 0);
        $tmpl['displayiconfolder'] = $params->get('display_icon_folder', 0);
        $tmpl['displayiconvm'] = $params->get('display_icon_vm', 0);
        $tmpl['fontsizename'] = $params->get('font_size_name', 12);
        $tmpl['charlengthname'] = $params->get('char_length_name', 15);
        $display_phoca_info = $params->get('display_phoca_info', 1);
        $tmpl['displayicongeo'] = $params->get('display_icon_geotagging', 0);
        $tmpl['phocainfocode'] = PhocaGalleryHelper::getPhocaInfoCode((int) $display_phoca_info);
        // PARAMS - Switch Image
        $tmpl['switchimage'] = $params->get('switch_image', 0);
        $tmpl['switchheight'] = $params->get('switch_height', 480);
        $tmpl['switchwidth'] = $params->get('switch_width', 640);
        // Switch image JS
        $tmpl['basicimage'] = '';
        if ($tmpl['switchimage'] == 1) {
            $imagePathFront = PhocaGalleryHelperFront::getPathSet();
            $waitImage = $imagePathFront['front_image'] . 'icon-switch.gif';
            $tmpl['basicimage'] = $imagePathFront['front_image'] . 'phoca_thumb_l_no_image.' . $tmpl['formaticon'];
            $document->addCustomTag(PhocaGalleryHelperFront::switchImage($waitImage));
            $basicImageSelected = 0;
            // we have not selected the basic image yet
        }
        // PARAMS - Upload
        $tmpl['displaytitleupload'] = $params->get('display_title_upload', 0);
        $tmpl['displaydescupload'] = $params->get('display_description_upload', 0);
        // PARAMS - Overlib
        $enable_overlib = $params->get('enable_overlib', 0);
        // Overlib
        if ((int) $enable_overlib > 0) {
            $document->addCustomTag('<script type="text/javascript" src="' . JURI::root() . 'includes/js/overlib_mini.js"></script>');
        }
        // MODEL
        $model =& $this->getModel();
        // Category Params
        $catParams = $model->getCategoryParams((int) $id);
        // Trash
        $tmpl['trash'] = 0;
        $tmpl['publishunpublish'] = 0;
        // USER RIGHT - DELETE =======================================
        // 2, 2 means that user access will be ignored in function getUserRight for display Delete button
        $rightDisplayDelete = 0;
        // default is to null (all users cannot upload)
        if (isset($catParams->params)) {
            $rightDisplayDelete = PhocaGalleryHelper::getUserRight($catParams->params, 'deleteuserid', 1, $user->get('aid', 0), $user->get('id', 0), 0);
        }
        if ($rightDisplayDelete == 1) {
            $tmpl['trash'] = 1;
            $tmpl['publishunpublish'] = 1;
        }
        // ===========================================================
        // Upload
        $tmpl['displayupload'] = 0;
        // USER RIGHT - UPLOAD =======================================
        // 2, 2 means that user access will be ignored in function getUserRight for display Delete button
        $rightDisplayUpload = 0;
        // default is to null (all users cannot upload)
        if (isset($catParams->params)) {
            $rightDisplayUpload = PhocaGalleryHelper::getUserRight($catParams->params, 'uploaduserid', 1, $user->get('aid', 0), $user->get('id', 0), 0);
        }
        if ($rightDisplayUpload == 1) {
            $tmpl['displayupload'] = 1;
            $document->addCustomTag(PhocaGalleryHelperRender::renderDescriptionUploadJS((int) $tmpl['maxuploadchar']));
        }
        // ===========================================================
        // USER RIGHT - ACCESS =======================================
        $rightDisplay = 1;
        //default is set to 1 (all users can see the category)
        if (isset($catParams->params)) {
            $rightDisplay = PhocaGalleryHelper::getUserRight($catParams->params, 'accessuserid', 0, $user->get('aid', 0), $user->get('id', 0), $display_access_category);
        }
        if ($rightDisplay == 0) {
            $mainframe->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("ALERTNOTAUTH"));
            exit;
        }
        // ===========================================================
        // GEOTAGGING
        if (isset($catParams->params)) {
            $longitude = PhocaGalleryHelper::getParamsArray($catParams->params, 'longitude');
            $latitude = PhocaGalleryHelper::getParamsArray($catParams->params, 'latitude');
            if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) {
                $tmpl['displayicongeo'] = 0;
            }
            if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) {
                $tmpl['displayicongeo'] = 0;
            }
        } else {
            $tmpl['displayicongeo'] = 0;
        }
        // If user has rights to delete or publish or unpublish, unbublished items should be displayed
        if ($rightDisplayDelete == 1) {
            $items = $model->getData($display_subcat_page, $display_back_button, $display_categories_back_button, $display_access_category, 1);
        } else {
            $items = $model->getData($display_subcat_page, $display_back_button, $display_categories_back_button, $display_access_category);
        }
        // BOXES
        $k = 0;
        $unSet = 0;
        // If it will be unseted while access view, we must sort the keys from category array - ACCESS
        for ($i = 0; $i < count($items); $i++) {
            $item =& $items[$i];
            if (isset($item->item_type) && $item->item_type == "categorieslist") {
                $item->link = JRoute::_($item->link);
                $item->button =& $folderbutton;
                $item->button->methodname = '';
                $item->displayicondetail = 0;
                $item->displayicondownload = 0;
                $item->displayiconfolder = 0;
                $item->displayname = 0;
                $item->displayiconvm = '';
                $item->startpiclens = 0;
                $item->trash = 0;
                $item->publishunpublish = 0;
                $item->enable_piclens = 0;
                $item->overlib = 0;
                $item->displayicongeo = 0;
                $item->type = 0;
            } else {
                if (isset($item->item_type) && $item->item_type == "parentfolder") {
                    $item->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $item->slug . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
                    $item->button =& $folderbutton;
                    $item->button->methodname = '';
                    $item->displayicondetail = 0;
                    $item->displayicondownload = 0;
                    $item->displayiconfolder = 0;
                    $item->displayname = 0;
                    $item->displayiconvm = '';
                    $item->startpiclens = 0;
                    $item->trash = 0;
                    $item->publishunpublish = 0;
                    $item->enable_piclens = 0;
                    $item->overlib = 0;
                    $item->displayicongeo = 0;
                    $item->type = 0;
                } else {
                    if (isset($item->item_type) && $item->item_type == "subfolder") {
                        $item->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $item->slug . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
                        $item->button =& $folderbutton;
                        $item->button->methodname = '';
                        $item->displayicondetail = 0;
                        $item->displayicondownload = 0;
                        $item->displayiconfolder = $tmpl['displayiconfolder'];
                        $item->displayname = $tmpl['displayname'];
                        $item->displayiconvm = '';
                        $item->startpiclens = 0;
                        $item->trash = 0;
                        $item->publishunpublish = 0;
                        $item->enable_piclens = 0;
                        $item->overlib = 0;
                        $item->displayicongeo = 0;
                        $item->type = 1;
                        //	$tmpl['displayname'] = 1;
                    } else {
                        // Add the first Image as basic image
                        if ($tmpl['switchimage'] == 1) {
                            if ($basicImageSelected == 0) {
                                $tmpl['basicimage'] = $item->linkthumbnailpath;
                                $basicImageSelected = 1;
                            }
                        }
                        $thumbLink = PhocaGalleryHelper::getThumbnailName($item->filename, 'large');
                        $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category->slug . '&id=' . $item->slug . '&tmpl=component' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
                        $imgLink = JURI::base(true) . str_replace('..', '', $thumbLink['rel']);
                        if ($tmpl['detailwindow'] == 2) {
                            $item->link = $imgLink;
                            $item->linkother = $imgLink;
                        } else {
                            if ($tmpl['detailwindow'] == 3 || $tmpl['detailwindow'] == 5) {
                                $item->link = $imgLink;
                                $item->linkother = $siteLink;
                            } else {
                                $item->link = $siteLink;
                                $item->linkother = $siteLink;
                            }
                        }
                        $item->button =& $button;
                        $item->buttonother =& $buttonOther;
                        $item->displayicondetail = $tmpl['displayicondetail'];
                        $item->displayicondownload = $tmpl['displayicondownload'];
                        $item->displayiconfolder = 0;
                        $item->displayname = $tmpl['displayname'];
                        $item->displayiconvm = '';
                        $item->startpiclens = $tmpl['startpiclens'];
                        $item->type = 2;
                        // Trash icon
                        if ($tmpl['trash'] == 1) {
                            $item->trash = 1;
                        } else {
                            $item->trash = 0;
                        }
                        // Publish Unpublish icon
                        if ($tmpl['publishunpublish'] == 1) {
                            $item->publishunpublish = 1;
                        } else {
                            $item->publishunpublish = 0;
                        }
                        // PICLENS
                        if ($tmpl['enablepiclens']) {
                            $item->enable_piclens = 1;
                        } else {
                            $item->enable_piclens = 0;
                        }
                        // GEOTAGGING
                        if ($tmpl['displayicongeo'] == 1) {
                            $item->displayicongeo = 1;
                        } else {
                            $item->displayicongeo = 0;
                        }
                        // OVERLIB
                        if ($enable_overlib == 1) {
                            $item->overlib = 1;
                        } else {
                            if ($enable_overlib == 2) {
                                $item->overlib = 2;
                            } else {
                                if ($enable_overlib == 3) {
                                    $item->overlib = 3;
                                } else {
                                    $item->overlib = 0;
                                }
                            }
                        }
                        // VirtueMart link
                        if ($tmpl['displayiconvm'] == 1) {
                            $vmLinkError = false;
                            $vmProductId = 0;
                            if (isset($item->params) && $item->params != '') {
                                $paramsArray = explode(';', $item->params);
                                if (is_array($paramsArray)) {
                                    foreach ($paramsArray as $value) {
                                        $vmParam = preg_match("/vmproductid=/i", $value);
                                        if ($vmParam) {
                                            $vmProductId = str_replace('vmproductid=', '', $value);
                                        }
                                    }
                                }
                            }
                            $vmLink = $model->getVmLink($vmProductId);
                            $vmLinkError = preg_match("/Error/i", $vmLink);
                            if ($vmLinkError) {
                                $item->displayiconvm = '';
                            } else {
                                $item->displayiconvm = 1;
                                $item->vmlink = $vmLink;
                            }
                        } else {
                            $item->displayiconvm = '';
                        }
                        // End VM Link
                    }
                }
            }
        }
        $item->odd = $k;
        $item->count = $i;
        $k = 1 - $k;
        // Upload Form ------------------------------------
        /*	JHTML::_('behavior.mootools');
        		$document->addScript('administrator/components/com_phocagallery/assets/upload/mediamanager.js');
        		$document->addStyleSheet('administrator/components/com_phocagallery/assets/upload/mediamanager.css');
        	*/
        // Set FTP form
        $ftp = !JClientHelper::hasCredentials('ftp');
        // Set flash uploader if ftp password and login exists (will be not problems)
        //$stateFolder	= 'phocagallery';
        //$refreshSite 	= $uri->toString();
        /*	if (!$ftp) {
        			if ($params->get('enable_flash', 1)) {
        				PhocaGalleryHelperUpload::uploader('file-upload', array('onAllComplete' => 'function(){ window.location.href="'.$refreshSite.'"; }'));
        			}
        		}
        	*/
        // PARAMS - Upload size
        $tmpl['uploadmaxsize'] = $params->get('upload_maxsize', 3000000);
        $this->assignRef('session', JFactory::getSession());
        //$this->assignRef('uploadmaxsize', $upload_maxsize);
        // END Upload Form ------------------------------------
        // Only registered (VOTES + COMMENTS)
        $tmpl['notregistered'] = true;
        $tmpl['username'] = '';
        if ($user->aid > 0) {
            $tmpl['notregistered'] = false;
            $tmpl['username'] = $user->name;
        }
        // VOTES Statistics
        if ((int) $tmpl['displayrating'] == 1) {
            $tmpl['votescount'] = 0;
            $tmpl['votesaverage'] = 0;
            $tmpl['voteswidth'] = 0;
            $votesStatistics = $model->getVotesStatistics((int) $id);
            if (!empty($votesStatistics->count)) {
                $tmpl['votescount'] = $votesStatistics->count;
            }
            if (!empty($votesStatistics->average)) {
                $tmpl['votesaverage'] = $votesStatistics->average;
                if ($tmpl['votesaverage'] > 0) {
                    $tmpl['votesaverage'] = round((double) $tmpl['votesaverage'] / 0.5) * 0.5;
                    $tmpl['voteswidth'] = 22 * $tmpl['votesaverage'];
                }
            }
            if ((int) $tmpl['votescount'] > 1) {
                $tmpl['votestext'] = 'votes';
            } else {
                $tmpl['votestext'] = 'vote';
            }
            // Already rated?
            $tmpl['alreadyrated'] = $model->checkUserVote((int) $id, (int) $user->id);
        }
        // COMMENTS
        if ((int) $tmpl['displaycomment'] == 1) {
            $document->addCustomTag(PhocaGalleryHelperRender::renderCommentJS((int) $tmpl['maxcommentchar']));
            $tmpl['alreadycommented'] = $model->checkUserComment((int) $id, (int) $user->id);
            $commentItem = $model->displayComment((int) $id);
            $this->assignRef('commentitem', $commentItem);
        }
        // GEOTAGGING
        $map = $model->getGeotagging($id);
        if ($map['geotitle'] == '') {
            $map['geotitle'] = $category->title;
        }
        // TABS
        $displayTabs = 0;
        // R A T I N G
        if ((int) $tmpl['displayrating'] == 0) {
            $currentTab['rating'] = -1;
        } else {
            $currentTab['rating'] = $displayTabs;
            $displayTabs++;
        }
        // C O M M E N T S
        if ((int) $tmpl['displaycomment'] == 0) {
            $currentTab['comment'] = -1;
        } else {
            $currentTab['comment'] = $displayTabs;
            $displayTabs++;
        }
        // S T A T I S T I C S
        if ((int) $tmpl['displaycategorystatistics'] == 0) {
            $currentTab['statistics'] = -1;
        } else {
            $currentTab['statistics'] = $displayTabs;
            $displayTabs++;
            $tmpl['displaymaincatstat'] = $params->get('display_main_cat_stat', 1);
            $tmpl['displaylastaddedcatstat'] = $params->get('display_lastadded_cat_stat', 1);
            $tmpl['displaymostviewedcatstat'] = $params->get('display_mostviewed_cat_stat', 1);
            $tmpl['countlastaddedcatstat'] = $params->get('count_lastadded_cat_stat', 3);
            $tmpl['countmostviewedcatstat'] = $params->get('count_mostviewed_cat_stat', 3);
            if ($tmpl['displaymaincatstat'] == 1) {
                $numberImgP = $model->getCountImages($id, 1);
                $tmpl['numberimgpub'] = $numberImgP->countimg;
                $numberImgU = $model->getCountImages($id, 0);
                $tmpl['numberimgunpub'] = $numberImgU->countimg;
                $categoryViewed = $model->getHits($id);
                $tmpl['categoryviewed'] = $categoryViewed->catviewed;
            }
            // MOST VIEWED IMAGES
            //$tmpl['mostviewedimg'] = array();
            if ($tmpl['displaymostviewedcatstat'] == 1) {
                $mostViewedImages = $model->getStatisticsImages($id, 'hits', 'DESC', $tmpl['countmostviewedcatstat']);
                for ($i = 0; $i < count($mostViewedImages); $i++) {
                    $itemMVI =& $mostViewedImages[$i];
                    $itemMVI->button =& $button;
                    $itemMVI->buttonother =& $buttonOther;
                    $itemMVI->displayicondetail = $tmpl['displayicondetail'];
                    $itemMVI->displayname = $tmpl['displayname'];
                    $itemMVI->type = 2;
                    $thumbLink = PhocaGalleryHelper::getThumbnailName($itemMVI->filename, 'large');
                    $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category->slug . '&id=' . $itemMVI->slug . '&tmpl=component' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
                    $imgLink = JURI::base(true) . str_replace('..', '', $thumbLink['rel']);
                    if ($tmpl['detailwindow'] == 2) {
                        $itemMVI->link = $imgLink;
                    } else {
                        $itemMVI->link = $siteLink;
                    }
                    //$tmpl['mostviewedimg'][] = $itemMVI;
                }
                $tmpl['mostviewedimg'] = $mostViewedImages;
            }
            // LAST ADDED IMAGES
            //$tmpl['lastaddedimg'] = array();
            if ($tmpl['displaylastaddedcatstat'] == 1) {
                $lastAddedImages = $model->getStatisticsImages($id, 'date', 'DESC', $tmpl['countlastaddedcatstat']);
                for ($i = 0; $i < count($lastAddedImages); $i++) {
                    $itemLAI =& $lastAddedImages[$i];
                    $itemLAI->link = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category->slug . '&id=' . $itemLAI->slug . '&tmpl=component' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
                    $itemLAI->button =& $button;
                    $itemLAI->buttonother =& $buttonOther;
                    $itemLAI->displayicondetail = $tmpl['displayicondetail'];
                    $itemLAI->displayname = $tmpl['displayname'];
                    $itemLAI->type = 2;
                    $thumbLink = PhocaGalleryHelper::getThumbnailName($itemLAI->filename, 'large');
                    $siteLink = JRoute::_('index.php?option=com_phocagallery&view=detail&catid=' . $category->slug . '&id=' . $itemLAI->slug . '&tmpl=component' . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
                    $imgLink = JURI::base(true) . str_replace('..', '', $thumbLink['rel']);
                    if ($tmpl['detailwindow'] == 2) {
                        $itemLAI->link = $imgLink;
                    } else {
                        $itemLAI->link = $siteLink;
                    }
                    //$tmpl['lastaddedimg'][] = $itemLAI;
                }
                $tmpl['lastaddedimg'] = $lastAddedImages;
            }
        }
        // G E O T A G G I N G
        if ((int) $tmpl['displaycategorygeotagging'] == 0) {
            $currentTab['geotagging'] = -1;
        } else {
            $currentTab['geotagging'] = $displayTabs;
            $displayTabs++;
            $tmpl['googlemapsapikey'] = $params->get('google_maps_api_key', '');
            $tmpl['categorymapwidth'] = $params->get('category_map_width', 500);
            $tmpl['categorymapheight'] = $params->get('category_map_height', 400);
        }
        // U P L O A D
        if ((int) $tmpl['displayupload'] == 0) {
            $currentTab['upload'] = -1;
        } else {
            $currentTab['upload'] = $displayTabs;
            $displayTabs++;
        }
        $tmpl['displaytabs'] = $displayTabs;
        $tmpl['currenttab'] = $currentTab;
        // ACTION
        $tmpl['action'] = $uri->toString();
        // ADD STATISTICS
        $model->hit($id);
        // ASIGN
        $this->assignRef('tmpl', $tmpl);
        $this->assignRef('params', $params);
        $this->assignRef('map', $map);
        $this->assignRef('items', $items);
        $this->assignRef('category', $category);
        $this->assignRef('button', $button);
        $this->assignRef('buttonother', $buttonOther);
        parent::display($tpl);
    }
Beispiel #6
0
 function _displayForm($tpl)
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $uri =& JFactory::getURI();
     $user =& JFactory::getUser();
     $model =& $this->getModel();
     $editor =& JFactory::getEditor();
     //Data from model
     $phocagallery =& $this->get('Data');
     JHTML::stylesheet('phocagallery.css', 'administrator/components/com_phocagallery/assets/');
     //Image button
     $link = 'index.php?option=com_phocagallery&amp;view=phocagalleryi&amp;tmpl=component';
     JHTML::_('behavior.modal', 'a.modal-button');
     $button = new JObject();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', JText::_('Image'));
     $button->set('name', 'image');
     $button->set('modalname', 'modal-button');
     $button->set('options', "{handler: 'iframe', size: {x: 620, y: 400}}");
     $lists = array();
     $isNew = $phocagallery->id < 1;
     // fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('Phoca gallery'), $phocagallery->title);
         $mainframe->redirect('index.php?option=' . $option, $msg);
     }
     // Set toolbar items for the page
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     JToolBarHelper::title(JText::_('Phoca Gallery Image') . ': <small><small>[ ' . $text . ' ]</small></small>', 'gallery');
     JToolBarHelper::save();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     JToolBarHelper::help('screen.phocagallery', true);
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $phocagallery->published = 1;
         $phocagallery->order = 0;
         $phocagallery->catid = JRequest::getVar('catid', 0, 'post', 'int');
     }
     // build the html select list for ordering
     $query = 'SELECT ordering AS value, title AS text' . ' FROM #__phocagallery' . ' WHERE catid = ' . (int) $phocagallery->catid . ' ORDER BY ordering';
     $lists['ordering'] = JHTML::_('list.specificordering', $phocagallery, $phocagallery->id, $query, false);
     //------------------------------------------------------------------------
     //build the list of categories
     $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a' . ' ORDER BY a.ordering';
     $db->setQuery($query);
     $phocagallerys = $db->loadObjectList();
     $tree = array();
     $text = '';
     $tree = PhocaGalleryHelper::CategoryTree($phocagallerys, $tree, 0, $text);
     $phocagallerys_tree_array = PhocaGalleryHelper::CategoryTreeCreating($phocagallerys, $tree, 0);
     array_unshift($phocagallerys_tree_array, JHTML::_('select.option', '0', '- ' . JText::_('Select Category') . ' -', 'value', 'text'));
     //list categories
     $lists['catid'] = JHTML::_('select.genericlist', $phocagallerys_tree_array, 'catid', '', 'value', 'text', $phocagallery->catid);
     //-----------------------------------------------------------------------
     // build the html select list
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $phocagallery->published);
     // Params
     $videoCode = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'videocode');
     $vmProductId = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'vmproductid');
     //clean gallery data
     jimport('joomla.filter.output');
     JFilterOutput::objectHTMLSafe($phocagallery, ENT_QUOTES, 'description');
     $this->assignRef('editor', $editor);
     $this->assignRef('vmproductid', $vmProductId[0]);
     $this->assignRef('videocode', $videoCode[0]);
     $this->assignRef('lists', $lists);
     $this->assignRef('phocagallery', $phocagallery);
     $this->assignRef('button', $button);
     $this->assignRef('request_url', $uri->toString());
     parent::display($tpl);
 }
Beispiel #7
0
 function upload()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken('request') or jexit('Invalid Token');
     // Set FTP credentials, if given
     jimport('joomla.client.helper');
     $ftp =& JClientHelper::setCredentialsFromRequest('ftp');
     $user =& JFactory::getUser();
     $path = PhocaGalleryHelper::getPathSet();
     $file = JRequest::getVar('Filedata', '', 'files', 'array');
     $folder = JRequest::getVar('folder', '', '', 'path');
     $tab = JRequest::getVar('tab', 0, '', 'int');
     $format = JRequest::getVar('format', 'html', '', 'cmd');
     $return = JRequest::getVar('return-url', null, 'post', 'base64');
     $viewBack = JRequest::getVar('viewback', '', '', '');
     $err = null;
     $view = JRequest::getVar('view', '', 'get', '', JREQUEST_NOTRIM);
     $catid = JRequest::getVar('id', '', 'get', 'string', JREQUEST_NOTRIM);
     //$catid 	= JRequest::getVar( 'catid', '', 'post', 'string', JREQUEST_NOTRIM  );
     $Itemid = JRequest::getVar('Itemid', 0, '', 'int');
     $limitStart = JRequest::getVar('limitstart', 0, '', 'int');
     $paramsC = JComponentHelper::getParams('com_phocagallery');
     $catidAlias = $catid;
     // for return
     // Set the limistart (TODO)
     if ($limitStart > 0) {
         $limitStartUrl = '&limitstart=' . $limitStart;
     } else {
         $limitStartUrl = '';
     }
     // From which view the image is uploaded
     switch ($view) {
         case 'user':
             // UCP is disabled (security reasons)
             $enable_user_cp = $paramsC->get('enable_user_cp', 0);
             if ($enable_user_cp == 0) {
                 $mainframe->redirect(JURI::base(true), JText::_("User Control Panel is disabled"));
                 exit;
             }
             $return = JRoute::_('index.php?option=com_phocagallery&view=user&tab=' . $tab . '&Itemid=' . $Itemid, false);
             // Get user catid, we are not in the category, so we must find the catid
             $modelUser = $this->getModel('user');
             $userCatId = $modelUser->getUserCategory($user->id);
             // User has no category, he (she) can create one
             if (!empty($userCatId->categoryid)) {
                 $catid = $userCatId->categoryid;
             } else {
                 $mainframe->redirect($return, JText::_('Error Uploading Phoca Gallery User Control Image'));
                 exit;
             }
             break;
         case 'category':
         default:
             $return = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $catidAlias . '&tab=' . $tab . '&Itemid=' . $Itemid . $limitStartUrl, false);
             break;
     }
     $model = $this->getModel('category');
     // USER RIGHT - UPLOAD ========================================
     // 2, 2 means that user access will be ignored in function getUserRight for display Delete button
     $rightDisplayUpload = 0;
     $catParams = $model->getCategoryParams((int) $catid);
     if (isset($catParams->params)) {
         $rightDisplayUpload = PhocaGalleryHelper::getUserRight($catParams->params, 'uploaduserid', 2, 2, $user->get('id', 0), 0);
     }
     // ============================================================
     // USER RIGHT - FOLDER ========================================
     $rightFolder[0] = '';
     if (isset($catParams->params)) {
         $rightFolder = PhocaGalleryHelper::getParamsArray($catParams->params, 'userfolder');
     }
     // ============================================================
     if ($rightDisplayUpload == 1) {
         if ($rightFolder[0] == '') {
             $mainframe->redirect($return, JText::_('User Folder Not Defined'));
         }
         if (!JFolder::exists($path['orig_abs_ds'] . $rightFolder[0] . DS)) {
             $mainframe->redirect($return, JText::_('Defined User Folder Does Not Exist'));
         }
         // Check if the size will be not over the category folder size
         jimport('joomla.filesystem.folder');
         $path = PhocaGalleryHelper::getPathset();
         $catPath = $path['orig_abs_ds'] . $rightFolder[0] . DS;
         $files = JFolder::files($catPath);
         // Get size of all images in the folder
         $allFileSize = 0;
         foreach ($files as $fileInFolder) {
             $fileSize = PhocaGalleryHelperFront::getFileSizePhoca($rightFolder[0] . DS . $fileInFolder, 0);
             $allFileSize = $allFileSize + (int) $fileSize;
         }
         // Get the size of all images include new uploaded image in Bytes
         if (isset($file['size'])) {
             $allFileSize = $allFileSize + (int) $file['size'];
         }
         $maxFolderSize = (int) $paramsC->get('cat_folder_maxsize', 20000000);
         if ($maxFolderSize > 0 && (int) $allFileSize > $maxFolderSize) {
             $mainframe->redirect($return, JText::_('WARNFILETOOLARGEFOLDER'));
         }
         // Make the filename safe
         if (isset($file['name'])) {
             $file['name'] = JFile::makeSafe($file['name']);
         }
         if (isset($file['name'])) {
             $filepath = JPath::clean($path['orig_abs_ds'] . $rightFolder[0] . DS . $file['name']);
             if (!PhocaGalleryHelperUpload::canUpload($file, $err)) {
                 $mainframe->redirect($return, JText::_($err));
                 exit;
             }
             if (JFile::exists($filepath)) {
                 $mainframe->redirect($return, JText::_('File already exists'));
                 exit;
             }
             if (!JFile::upload($file['tmp_name'], $filepath)) {
                 $mainframe->redirect($return, JText::_('Unable to upload file'));
                 exit;
             } else {
                 // Saving file name into database with relative path
                 $file['name'] = $rightFolder[0] . '/' . $file['name'];
                 PhocaGalleryController::save((int) $catid, $file['name'], $return);
                 //$mainframe->redirect($return,JText::_('Upload complete'));
                 //exit;
             }
         } else {
             $mainframe->redirect($return, JText::_('WARNFILETYPE'));
             exit;
         }
     } else {
         $mainframe->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("NOT AUTHORISED TO DO ACTION"));
         exit;
     }
 }
Beispiel #8
0
 function _displayForm($tpl)
 {
     global $mainframe, $option;
     $db =& JFactory::getDBO();
     $uri =& JFactory::getURI();
     $user =& JFactory::getUser();
     $model =& $this->getModel();
     $editor =& JFactory::getEditor();
     //Data from model
     $phocagallery =& $this->get('Data');
     JHTML::stylesheet('phocagallery.css', 'administrator/components/com_phocagallery/assets/');
     //Image button
     $link = 'index.php?option=com_phocagallery&amp;view=phocagalleryf&amp;tmpl=component';
     JHTML::_('behavior.modal', 'a.modal-button');
     $button = new JObject();
     $button->set('modal', true);
     $button->set('link', $link);
     $button->set('text', JText::_('Folder'));
     $button->set('name', 'image');
     $button->set('modalname', 'modal-button');
     $button->set('options', "{handler: 'iframe', size: {x: 620, y: 400}}");
     $lists = array();
     $isNew = $phocagallery->id < 1;
     // fail if checked out not by 'me'
     if ($model->isCheckedOut($user->get('id'))) {
         $msg = JText::sprintf('DESCBEINGEDITTED', JText::_('Phoca Gallery Categories'), $phocagallery->title);
         $mainframe->redirect('index.php?option=' . $option, $msg);
     }
     // Set toolbar items for the page
     $text = $isNew ? JText::_('New') : JText::_('Edit');
     JToolBarHelper::title(JText::_('Phoca Gallery Category') . ': <small><small>[ ' . $text . ' ]</small></small>', 'category');
     JToolBarHelper::save();
     JToolBarHelper::apply();
     if ($isNew) {
         JToolBarHelper::cancel();
     } else {
         // for existing items the button is renamed `close`
         JToolBarHelper::cancel('cancel', 'Close');
     }
     JToolBarHelper::help('screen.phocagallery', true);
     // Edit or Create?
     if (!$isNew) {
         $model->checkout($user->get('id'));
     } else {
         // initialise new record
         $phocagallery->published = 1;
         $phocagallery->order = 0;
         $phocagallery->access = 0;
     }
     // build the html select list for ordering
     $query = 'SELECT ordering AS value, title AS text' . ' FROM #__phocagallery_categories' . ' ORDER BY ordering';
     $lists['ordering'] = JHTML::_('list.specificordering', $phocagallery, $phocagallery->id, $query, false);
     // build the html select list
     $lists['published'] = JHTML::_('select.booleanlist', 'published', 'class="inputbox"', $phocagallery->published);
     $active = $phocagallery->image_position ? $phocagallery->image_position : 'left';
     $lists['image_position'] = JHTML::_('list.positions', 'image_position', $active, NULL, 0, 0);
     // Imagelist
     $lists['image'] = JHTML::_('list.images', 'image', $phocagallery->image);
     // build the html select list for the group access
     $lists['access'] = JHTML::_('list.accesslevel', $phocagallery);
     // All selected users
     // Get all users id from params string
     $accessActive = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'accessuserid');
     $uploadActive = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'uploaduserid');
     $deleteActive = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'deleteuserid');
     $userFolder = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'userfolder');
     $longitude = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'longitude');
     $latitude = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'latitude');
     $zoom = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'zoom');
     $geotitle = PhocaGalleryHelper::getParamsArray($phocagallery->params, 'geotitle');
     // Create a multiple selectbox
     $lists['accessusers'] = PhocaGalleryHelper::usersList('accessuserid[]', $accessActive, 1, NULL, 'name', 0);
     $lists['uploadusers'] = PhocaGalleryHelper::usersList('uploaduserid[]', $uploadActive, 1, NULL, 'name', 0);
     $lists['deleteusers'] = PhocaGalleryHelper::usersList('deleteuserid[]', $deleteActive, 1, NULL, 'name', 0);
     $lists['author'] = PhocaGalleryHelper::usersListAuthor('authorid', $phocagallery->userid, 1, NULL, 'name', 0);
     //------------------------------------------------------------------------
     //build the list of categories
     $query = 'SELECT a.title AS text, a.id AS value, a.parent_id as parentid' . ' FROM #__phocagallery_categories AS a' . ' ORDER BY a.ordering';
     $db->setQuery($query);
     $phocagallerys = $db->loadObjectList();
     $tree = array();
     $text = '';
     $tree = PhocaGalleryHelper::CategoryTree($phocagallerys, $tree, 0, $text);
     $phocagallerys_tree_array = PhocaGalleryHelper::CategoryTreeCreating($phocagallerys, $tree, $phocagallery->id);
     array_unshift($phocagallerys_tree_array, JHTML::_('select.option', '0', '- ' . JText::_('Select Parent Category') . ' -', 'value', 'text'));
     //list categories
     $lists['parentid'] = JHTML::_('select.genericlist', $phocagallerys_tree_array, 'parentid', '', 'value', 'text', $phocagallery->parent_id);
     //-----------------------------------------------------------------------
     //clean gallery data
     jimport('joomla.filter.output');
     JFilterOutput::objectHTMLSafe($phocagallery, ENT_QUOTES, 'description');
     //Params
     #$file 	= JPATH_COMPONENT.DS.'models'.DS.'phocagallery.xml';
     #$params = new JParameter( $phocagallery->params, $file );
     //Longitude Latitude
     if (!isset($longitude[0]) || isset($longitude[0]) && ($longitude[0] == '' || $longitude[0] == 0)) {
         $longitude[0] = '';
         $longitudeLink = '14.429919719696045';
     } else {
         $longitudeLink = $longitude[0];
     }
     if (!isset($latitude[0]) || isset($latitude[0]) && ($latitude[0] == '' || $latitude[0] == 0)) {
         $latitude[0] = '';
         $latitudeLink = '50.079623358200884';
     } else {
         $latitudeLink = $latitude[0];
     }
     if (!isset($zoom[0]) || isset($zoom[0]) && ($zoom[0] == '' || $zoom[0] == 0)) {
         $zoom[0] = 2;
     }
     if (!isset($geotitle[0]) || isset($geotitle[0]) && $geotitle[0] == '') {
         $geotitle[0] = '';
     }
     //Get button
     $linkg = 'index.php?option=com_phocagallery&amp;view=phocagalleryg&amp;tmpl=component&amp;lat=' . $latitudeLink . '&amp;lng=' . $longitudeLink . '&amp;zoom=' . $zoom[0];
     JHTML::_('behavior.modal', 'a.modal-button');
     $buttong = new JObject();
     $buttong->set('modal', true);
     $buttong->set('link', $linkg);
     $buttong->set('text', JText::_('coordinates'));
     $buttong->set('name', 'image');
     $buttong->set('modalname', 'modal-button');
     $buttong->set('options', "{handler: 'iframe', size: {x: 640, y: 560}}");
     $this->assignRef('userfolder', $userFolder[0]);
     $this->assignRef('editor', $editor);
     $this->assignRef('lists', $lists);
     $this->assignRef('phocagallery', $phocagallery);
     $this->assignRef('button', $button);
     $this->assignRef('buttong', $buttong);
     $this->assignRef('longitude', $longitude[0]);
     $this->assignRef('latitude', $latitude[0]);
     $this->assignRef('zoom', $zoom[0]);
     $this->assignRef('geotitle', $geotitle[0]);
     $this->assignRef('request_url', $uri->toString());
     parent::display($tpl);
 }
Beispiel #9
0
 function display($tpl = null)
 {
     global $mainframe;
     // PLUGIN WINDOW - we get information from plugin
     $get = '';
     $get['detail'] = JRequest::getVar('detail', '', 'get', 'string');
     $get['buttons'] = JRequest::getVar('buttons', '', 'get', 'string');
     $document =& JFactory::getDocument();
     $params =& $mainframe->getParams();
     // START CSS
     $document->addStyleSheet(JURI::base(true) . '/components/com_phocagallery/assets/phocagallery.css');
     // PARAMS - Open window parameters - modal popup box or standard popup window
     $detail_window = $params->get('detail_window', 0);
     // Plugin information
     if (isset($get['detail']) && $get['detail'] != '') {
         $detail_window = $get['detail'];
     }
     $tmpl['detailbuttons'] = $params->get('detail_buttons', 1);
     // Plugin information
     if (isset($get['buttons']) && $get['buttons'] != '') {
         $tmpl['detailbuttons'] = $get['buttons'];
     }
     // Standard popup window
     if ($detail_window == 1) {
         $tmpl['detailwindowclose'] = 'window.close();';
         $tmpl['detailwindowreload'] = 'window.location.reload(true);';
     } else {
         if ($detail_window == 4) {
             // highslide
             $tmpl['detailwindowclose'] = 'return false;';
             $tmpl['detailwindowreload'] = 'window.location.reload(true);';
         } else {
             //modal popup window
             $tmpl['detailwindowclose'] = 'window.parent.document.getElementById(\'sbox-window\').close();';
             $tmpl['detailwindowreload'] = 'window.location.reload(true);';
         }
     }
     $tmpl['displaydescriptiondetail'] = $params->get('display_description_detail', 0);
     $tmpl['displaytitleindescription'] = $params->get('display_title_description', 0);
     $tmpl['descriptiondetailheight'] = $params->get('description_detail_height', 16);
     $tmpl['fontsizedesc'] = $params->get('font_size_desc', 11);
     $tmpl['fontcolordesc'] = $params->get('font_color_desc', '#333333');
     $tmpl['detailwindowbackgroundcolor'] = $params->get('detail_window_background_color', '#ffffff');
     $tmpl['descriptionlightboxfontcolor'] = $params->get('description_lightbox_font_color', '#ffffff');
     $tmpl['descriptionlightboxbgcolor'] = $params->get('description_lightbox_bg_color', '#000000');
     $tmpl['descriptionlightboxfontsize'] = $params->get('description_lightbox_font_size', 12);
     $tmpl['detailwindow'] = $params->get('detail_window', 0);
     // NO SCROLLBAR IN DETAIL WINDOW
     $document->addCustomTag("<style type=\"text/css\"> \n" . " html,body, .contentpane{overflow:hidden;background:" . $tmpl['detailwindowbackgroundcolor'] . ";} \n" . " center, table {background:" . $tmpl['detailwindowbackgroundcolor'] . ";} \n" . " #sbox-window {background-color:#fff100;padding:5px} \n" . " </style> \n");
     // PARAMS - Get image height and width
     $tmpl['largewidth'] = $params->get('large_image_width', 640);
     $tmpl['largeheight'] = $params->get('large_image_height', 480);
     $tmpl['boxlargewidth'] = $params->get('front_modal_box_width', 680);
     $tmpl['boxlargeheight'] = $params->get('front_modal_box_height', 560);
     $front_popup_window_width = $params->get('front_popup_window_width', 680);
     $front_popup_window_height = $params->get('front_popup_window_height', 560);
     // YOUTUBE
     // Standard popup window
     if ($detail_window == 1) {
         $tmpl['windowwidth'] = $front_popup_window_width;
         $tmpl['windowheight'] = $front_popup_window_height;
     } else {
         //modal popup window
         $tmpl['windowwidth'] = $tmpl['boxlargewidth'];
         $tmpl['windowheight'] = $tmpl['boxlargeheight'];
     }
     // PARAMS - Slideshow
     $tmpl['slideshowdelay'] = $params->get('slideshow_delay', 3000);
     $tmpl['slideshowpause'] = $params->get('slideshow_pause', 0);
     $tmpl['slideshowrandom'] = $params->get('slideshow_random', 0);
     // MODEL
     $model =& $this->getModel();
     $file = $model->getData();
     // YouTube
     $videoCode = PhocaGalleryHelper::getParamsArray($file->params, 'videocode');
     $tmpl['videocode'] = '';
     if (!empty($videoCode[0])) {
         $tmpl['videocode'] = $videoCode[0];
     }
     $realImageSize = '';
     $realImageSize = PhocaGalleryHelper::getRealImageSize($file->filenameno);
     if (isset($realImageSize['w']) && isset($realImageSize['h'])) {
         $tmpl['realimagewidth'] = $realImageSize['w'];
         $tmpl['realimageheight'] = $realImageSize['h'];
     } else {
         $tmpl['realimagewidth'] = $tmpl['largewidth'];
         $tmpl['realimageheight'] = $tmpl['largeheight'];
     }
     // ADD STATISTICS
     $model->hit(JRequest::getVar('id', '', '', 'int'));
     // ASIGN
     $this->assignRef('tmpl', $tmpl);
     $this->assignRef('file', $file);
     if ($tmpl['videocode'] != '') {
         parent::display('video');
     } else {
         parent::display('slideshowjs');
         if ($file->slideshow == 1) {
             parent::display('slideshow');
         } else {
             if ($file->download == 1) {
                 parent::display('download');
             } else {
                 parent::display($tpl);
             }
         }
     }
 }