Ejemplo n.º 1
0
 function _loadData()
 {
     global $mainframe;
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         // Lets load the content if it doesn't already exist
         if (empty($this->_data)) {
             $query = 'SELECT p.filename as filename' . ' FROM #__phocagallery AS p' . ' WHERE p.id = ' . (int) $this->_id;
             $this->_db->setQuery($query);
             $filename_object = $this->_db->loadObject();
             //Get Folder settings and File resize settings
             $path = PhocaGalleryHelper::getPathSet();
             $file = new JObject();
             //Create thumbnail if it doesn't exists but originalfile must exist
             $orig_path = $path['orig_abs_ds'];
             $refresh_url = 'index.php?option=com_phocagallery&view=phocagalleryd&tmpl=component&cid[]=' . $this->_id;
             //Creata thumbnails if not exist
             PhocaGalleryHelper::getOrCreateThumbnail($orig_path, $filename_object->filename, $refresh_url, 1, 1, 1);
             jimport('joomla.filesystem.file');
             if (!isset($filename_object->filename)) {
                 $file->set('linkthumbnailpath', '');
             } else {
                 $thumbnail_file = PhocaGalleryHelper::getThumbnailName($filename_object->filename, 'large');
                 $file->set('linkthumbnailpath', $thumbnail_file['rel']);
             }
         }
         if (isset($file)) {
             $this->_data = $file;
         } else {
             $this->_data = '';
         }
         return (bool) $this->_data;
     }
     return true;
 }
Ejemplo n.º 2
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;
 }
Ejemplo n.º 3
0
 function display($tpl = null)
 {
     global $mainframe;
     $uri =& JFactory::getURI();
     $document =& JFactory::getDocument();
     $db =& JFactory::getDBO();
     JHTML::stylesheet('phocagallery.css', 'administrator/components/com_phocagallery/assets/');
     // Set toolbar items for the page
     JToolBarHelper::title(JText::_('Phoca Gallery Comments'), 'comment');
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::deleteList(JText::_('WARNWANTDELLISTEDITEMS'), 'remove', 'delete');
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     JToolBarHelper::help('screen.phocagallery', true);
     //Filter
     $context = 'com_phocagallery.phocagalleryco.list.';
     $filter_state = $mainframe->getUserStateFromRequest($context . 'filter_state', 'filter_state', '', 'word');
     $filter_catid = $mainframe->getUserStateFromRequest($context . 'filter_catid', 'filter_catid', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'a.ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     // Get data from the model
     $items =& $this->get('Data');
     $total =& $this->get('Total');
     $pagination =& $this->get('Pagination');
     // build list of categories
     $javascript = 'class="inputbox" size="1" onchange="submitform( );"';
     $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, 'filter_catid', $javascript, 'value', 'text', $filter_catid);
     //-----------------------------------------------------------------------
     // state filter
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assignRef('user', JFactory::getUser());
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('request_url', $uri->toString());
     parent::display($tpl);
 }
Ejemplo n.º 4
0
 function display($tpl = null)
 {
     global $mainframe;
     JHTML::stylesheet('phocagallery.css', 'administrator/components/com_phocagallery/assets/');
     JToolBarHelper::title(JText::_('Phoca Gallery Info'), 'info');
     JToolBarHelper::cancel('cancel', 'Close');
     JToolBarHelper::help('screen.phocagallery', true);
     $version = PhocaGalleryHelper::getPhocaVersion();
     $this->assignRef('version', $version);
     parent::display($tpl);
 }
Ejemplo n.º 5
0
 function getData()
 {
     if (empty($this->_data) && empty($this->_data_categories)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
         $query_sub = $this->_buildQuerySubcategories();
         // We need all data (id, parentid,text) without limitation
         // because of creating correct tree, e.g: user hase pagination 10
         // and he hase one category and 15 subcategories, on the second
         // site he must get information about the parent category
         // not limitation required (but there are only 3 items)
         //	$this->_data_categories = $this->_getList($query_sub, $this->getState('limitstart'), $this->getState('limit'));
         $this->_data_categories = $this->_getList($query_sub);
         $user =& JFactory::getUser();
         $tree = array();
         $text = '';
         $tree = PhocaGalleryHelper::CategoryTree($this->_data_categories, $tree, 0, $text);
         $this->_data_categories = PhocaGalleryHelper::CategoryTreeCreating($this->_data_categories, $tree, 0);
         foreach ($this->_data_categories as $key => $value) {
             foreach ($this->_data as $key2 => $value2) {
                 if ($value->value == $value2->id) {
                     $this->_data_outcome = new JObject();
                     $this->_data_outcome->id = $value2->id;
                     $this->_data_outcome->parent_id = $value2->parent_id;
                     $this->_data_outcome->title = $value->text;
                     //$value2->title;
                     $this->_data_outcome->name = $value2->name;
                     $this->_data_outcome->alias = $value2->alias;
                     $this->_data_outcome->image = $value2->image;
                     $this->_data_outcome->section = $value2->section;
                     $this->_data_outcome->image_position = $value2->image_position;
                     $this->_data_outcome->description = $value2->description;
                     $this->_data_outcome->published = $value2->published;
                     $this->_data_outcome->editor = $value2->editor;
                     $this->_data_outcome->ordering = $value2->ordering;
                     $this->_data_outcome->access = $value2->access;
                     $this->_data_outcome->count = $value2->count;
                     $this->_data_outcome->hits = $value2->hits;
                     $this->_data_outcome->params = $value2->params;
                     $this->_data_outcome->checked_out = $value2->checked_out;
                     $this->_data_outcome->groupname = $value2->groupname;
                     $this->_data_outcome->parentname = $value2->parentname;
                     $this->_data_outcome->ratingavg = $value2->ratingavg;
                     $this->_data_outcome->usercatname = $value2->usercatname;
                     $this->_data_outcome_array[] = $this->_data_outcome;
                 }
             }
         }
         $this->_data = $this->_data_outcome_array;
     }
     return $this->_data;
 }
Ejemplo n.º 6
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $db =& JFactory::getDBO();
     //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' . ' WHERE a.published = 1' . ' 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'));
     //	array_unshift($gallerys, JHTML::_('select.option', '0', '- '.JText::_('Select gallery').' -', 'value', 'text'));
     return JHTML::_('select.genericlist', $phocagallerys_tree_array, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
 }
Ejemplo n.º 7
0
 function display($tpl = null)
 {
     JHTML::stylesheet('phocagallery.css', 'administrator/components/com_phocagallery/assets/');
     global $mainframe;
     $uri =& JFactory::getURI();
     $document =& JFactory::getDocument();
     $db =& JFactory::getDBO();
     JToolBarHelper::title('  ' . JText::_('Phoca Gallery Control Panel'), 'phoca');
     JToolBarHelper::preferences('com_phocagallery', '460');
     JToolBarHelper::help('screen.phocagallery', true);
     JHTML::_('behavior.tooltip');
     $version = PhocaGalleryHelper::getPhocaVersion();
     $this->assignRef('version', $version);
     parent::display($tpl);
 }
Ejemplo n.º 8
0
 function display($tpl = null)
 {
     global $mainframe;
     $params =& JComponentHelper::getParams('com_phocagallery');
     // Do not allow cache
     JResponse::allowCache(false);
     $document =& JFactory::getDocument();
     $document->addStyleSheet('../administrator/components/com_phocagallery/assets/phocagallery.css');
     $document->addStyleSheet('../administrator/templates/system/css/system.css');
     $document->addCustomTag("<!--[if IE]>\n<link rel=\"stylesheet\" href=\"../administrator/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->");
     $path = PhocaGalleryHelper::getPathSet();
     $path_orig_rel = $path['orig_rel_ds'];
     $this->assign('path_orig_rel', $path_orig_rel);
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
Ejemplo n.º 9
0
 function display($tpl = null)
 {
     global $mainframe;
     $params =& JComponentHelper::getParams('com_phocagallery');
     // Do not allow cache
     JResponse::allowCache(false);
     $document =& JFactory::getDocument();
     $document->addStyleSheet('../administrator/components/com_phocagallery/assets/phocagallery.css');
     $document->addStyleSheet('../administrator/templates/system/css/system.css');
     $document->addCustomTag("<!--[if IE]>\n<link rel=\"stylesheet\" href=\"../administrator/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->");
     $path = PhocaGalleryHelper::getPathSet();
     $path_orig_rel = $path['orig_rel_ds'];
     $this->assign('path_orig_rel', $path_orig_rel);
     $this->assignRef('images', $this->get('images'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     // Upload Form ------------------------------------
     JHTML::_('behavior.mootools');
     //$document->addScript('components/com_phocagallery/assets/upload/mediamanager.js');
     $document->addStyleSheet('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)
     $state = $this->get('state');
     $refreshSite = 'index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component&folder=' . $state->folder;
     if (!$ftp) {
         if ($params->get('enable_flash', 1)) {
             PhocaGalleryHelperUpload::uploader('file-upload', array('onAllComplete' => 'function(){ window.location.href="' . $refreshSite . '"; }'));
         }
     }
     // PARAMS - Upload size
     $upload_maxsize = 3000000;
     if ($params->get('upload_maxsize') != '') {
         $upload_maxsize = $params->get('upload_maxsize');
     }
     // END Upload Form ------------------------------------
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('uploadmaxsize', $upload_maxsize);
     $this->assign('require_ftp', $ftp);
     parent::display($tpl);
     echo JHTML::_('behavior.keepalive');
 }
Ejemplo n.º 10
0
 function getList()
 {
     static $list;
     // Only process the list once per request
     if (is_array($list)) {
         return $list;
     }
     // Get current path from request
     $current = $this->getState('folder');
     // If undefined, set to empty
     if ($current == 'undefined') {
         $current = '';
     }
     //Get folder variables from Helper
     $path = PhocaGalleryHelper::getPathSet();
     // Initialize variables
     if (strlen($current) > 0) {
         $orig_path = $path['orig_abs_ds'] . $current;
     } else {
         $orig_path = $path['orig_abs_ds'];
     }
     $orig_path_server = str_replace(DS, '/', $path['orig_abs'] . '/');
     $folders = array();
     // Get the list of files and folders from the given folder
     $folder_list = JFolder::folders($orig_path, '', false, false, array(0 => 'thumbs'));
     // Iterate over the folders if they exist
     if ($folder_list !== false) {
         foreach ($folder_list as $folder) {
             $tmp = new JObject();
             $tmp->name = basename($folder);
             $tmp->path_with_name = str_replace(DS, '/', JPath::clean($orig_path . DS . $folder));
             $tmp->path_without_name_relative = $path['orig_rel_ds'] . str_replace($orig_path_server, '', $tmp->path_with_name);
             $tmp->path_with_name_relative_no = str_replace($orig_path_server, '', $tmp->path_with_name);
             $folders[] = $tmp;
         }
     }
     $list = array('folders' => $folders);
     return $list;
 }
Ejemplo n.º 11
0
 function getData()
 {
     //Params
     $params =& JComponentHelper::getParams('com_phocagallery');
     //Standard Thumbs creation or Pagination Thumbs Creation
     if ($params->get('pagination_thumbnail_creation') != '') {
         $pagination_thumbnail_creation = $params->get('pagination_thumbnail_creation');
     } else {
         $pagination_thumbnail_creation = 0;
     }
     //Clean Thumbnails or not
     if ($params->get('clean_thumbnails') != '') {
         $clean_thumbnails = $params->get('clean_thumbnails');
     } else {
         $clean_thumbnails = 0;
     }
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = $this->_buildQuery();
         $this->_data = $this->_getList($query, $this->getState('limitstart'), $this->getState('limit'));
     }
     //Server doesn't have CPU power
     //we do thumbnail for all images - there is no pagination...
     //or we do thumbanil for only listed images
     if (empty($this->_data_thumbnail)) {
         if ($pagination_thumbnail_creation == 1) {
             $this->_data_thumbnail = $this->_data;
         } else {
             $query = $this->_buildQueryThumbnail();
             $this->_data_thumbnail = $this->_getList($query);
         }
     }
     //------------------------------------------------------------------------------------------------------
     // Check if the file stored in database is on the server. If not please refer to user
     // Get filename from every object there is stored in database
     //------------------------------------------------------------------------------------------------------
     //file - abc.img, file_no - folder/abc.img
     //Get folder variables from Helper
     $path = PhocaGalleryHelper::getPathSet();
     $orig_path = $path['orig_abs_ds'];
     $orig_path_server = str_replace(DS, '/', $path['orig_abs'] . '/');
     //-----------------------------------------
     //Do all thumbnails no limit no pagination
     if (!empty($this->_data_thumbnail)) {
         foreach ($this->_data_thumbnail as $key => $value) {
             $file_original_thumb = PhocaGalleryHelper::getFileOriginal($value->filename);
             //Let the user know that the file doesn't exists and delete all thumbnails
             if (!JFile::exists($file_original_thumb)) {
                 //$this->_data[$key]->filename = JText::_( 'File does not exist' );
                 //$this->_data[$key]->fileoriginalexist = 0;
                 //We must not delete the thumbnails if the file doesn't exist - we use cleanThumbsFolder() function
             } else {
                 //Create thumbnails small, medium, large
                 $refresh_url_thumb = 'index.php?option=com_phocagallery&view=phocagallerys';
                 //$refresh_url_thumb = 'index.php?option=com_phocagallery&controller=phocagallerys';
                 $file_thumb = PhocaGalleryHelper::getOrCreateThumbnail($orig_path, $value->filename, $refresh_url_thumb, 1, 1, 1);
                 //$this->_data[$key]->linkthumbnailpath 	= $file_thumb['thumb_name_s_no_rel'];
                 //$this->_data[$key]->path_without_name_relative	= $file_thumb['path_without_name_relative'];
                 //$this->_data[$key]->fileoriginalexist = 1;
             }
         }
         //Clean Thumbs Folder if there are thumbnail files but not original file
         //PhocaGalleryHelper::cleanThumbsFolder();
         //------------------------------------------------------------------------------------------------------
     }
     $this->_data_thumbnail = null;
     // delete data to reduce memory
     //Only the the site with limitation or pagination...
     if (!empty($this->_data)) {
         foreach ($this->_data as $key => $value) {
             $file_original = PhocaGalleryHelper::getFileOriginal($value->filename);
             //Let the user know that the file doesn't exists and delete all thumbnails
             if (!JFile::exists($file_original)) {
                 $this->_data[$key]->filename = JText::_('Image Filename does not exist');
                 $this->_data[$key]->fileoriginalexist = 0;
                 //We must not delete the thumbnails if the file doesn't exist - we use cleanThumbsFolder() function
             } else {
                 //Create thumbnails small, medium, large
                 $refresh_url = 'index.php?option=com_phocagallery&view=phocagallerys';
                 //$refresh_url = 'index.php?option=com_phocagallery&controller=phocagallerys';
                 $file_thumb = PhocaGalleryHelper::getOrCreateThumbnail($orig_path, $value->filename, $refresh_url, 1, 1, 1);
                 $this->_data[$key]->linkthumbnailpath = $file_thumb['thumb_name_s_no_rel'];
                 //$this->_data[$key]->path_without_name_relative	= $file_thumb['path_without_name_relative'];
                 $this->_data[$key]->fileoriginalexist = 1;
             }
         }
         //Clean Thumbs Folder if there are thumbnail files but not original file
         //PhocaGalleryHelper::cleanThumbsFolder();
         //------------------------------------------------------------------------------------------------------
     }
     //Clean Thumbs Folder if there are thumbnail files but not original file
     if ($clean_thumbnails == 1) {
         PhocaGalleryHelper::cleanThumbsFolder();
     }
     return $this->_data;
 }
Ejemplo n.º 12
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);
             }
         }
     }
 }
Ejemplo n.º 13
0
 function _displayForm($tpl)
 {
     global $mainframe, $option;
     $uri =& JFactory::getURI();
     $phocagallery =& $this->get('Data');
     //Data from model
     $lists = array();
     $db =& JFactory::getDBO();
     $document =& JFactory::getDocument();
     $params =& JComponentHelper::getParams('com_phocagallery');
     JToolBarHelper::title(JText::_('Phoca gallery') . ': <small><small>[ ' . JText::_('Multiple Add') . ' ]</small></small>');
     JToolBarHelper::save();
     JToolBarHelper::cancel();
     JToolBarHelper::help('screen.phocagallery', true);
     $phocagallery->published = 1;
     $phocagallery->order = 0;
     $phocagallery->catid = JRequest::getVar('catid', 0, 'post', 'int');
     $phocagallery->id = 0;
     // 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);
     //clean gallery data
     jimport('joomla.filter.output');
     JFilterOutput::objectHTMLSafe($phocagallery, ENT_QUOTES, 'description');
     $this->assignRef('lists', $lists);
     $this->assignRef('phocagallery', $phocagallery);
     $this->assignRef('button', $button);
     $this->assignRef('request_url', $uri->toString());
     //--------------------------------------------------------------------------------------------------------
     /*image manager*/
     JResponse::allowCache(false);
     // Do not allow cache
     $path = PhocaGalleryHelper::getPathSet();
     // Upload Form ------------------------------------
     JHTML::_('behavior.mootools');
     //$document->addScript('components/com_phocagallery/assets/upload/mediamanager.js');
     $document->addStyleSheet('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)
     $state = $this->get('state');
     $refreshSite = 'index.php?option=com_phocagallery&view=phocagallerym&layout=form&hidemainmenu=1&folder=' . $state->folder;
     if (!$ftp) {
         if ($params->get('enable_flash', 1)) {
             PhocaGalleryHelperUpload::uploader('file-upload', array('onAllComplete' => 'function(){ window.location.href="' . $refreshSite . '"; }'));
         }
     }
     // PARAMS - Upload size
     $upload_maxsize = 3000000;
     if ($params->get('upload_maxsize') != '') {
         $upload_maxsize = $params->get('upload_maxsize');
     }
     // END Upload Form ------------------------------------
     $this->assignRef('session', JFactory::getSession());
     $this->assignRef('uploadmaxsize', $upload_maxsize);
     $this->assign('require_ftp', $ftp);
     $this->assignRef('path_orig_rel', $path['orig_rel_ds']);
     $this->assignRef('images', $this->get('images'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
     echo JHTML::_('behavior.keepalive');
 }
Ejemplo n.º 14
0
 function deletethumbs($id)
 {
     if ($id > 0) {
         $query = 'SELECT a.filename as filename' . ' FROM #__phocagallery AS a' . ' WHERE a.id = ' . (int) $id;
         $this->_db->setQuery($query);
         $file = $this->_db->loadObject();
         if (isset($file->filename) && $file->filename != '') {
             $deleteThubms = PhocaGalleryHelper::deleteFileThumbnail($file->filename, 1, 1, 1);
             if ($deleteThubms) {
                 return true;
             } else {
                 return false;
             }
         }
         return false;
     }
     return false;
 }
Ejemplo n.º 15
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);
    }
Ejemplo n.º 16
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);
 }
Ejemplo n.º 17
0
 function _loadData()
 {
     global $mainframe;
     $user =& JFactory::getUser();
     // Lets load the content if it doesn't already exist
     if (empty($this->_data)) {
         $query = 'SELECT p.*' . ' FROM #__phocagallery AS p' . ' WHERE p.id = ' . (int) $this->_id;
         $this->_db->setQuery($query);
         $items = $this->_db->loadObject();
         // Access check - don't display the image if you have no access to this image (if user add own url)
         if (isset($items->catid)) {
             $query = 'SELECT cc.access as access, cc.params as params' . ' FROM #__phocagallery_categories AS cc' . ' WHERE cc.id = ' . (int) $items->catid;
             $this->_db->setQuery($query);
             $catid = $this->_db->loadObject();
             // USER RIGHT - ACCESS =======================================
             $rightDisplay = 0;
             if (isset($catid->params)) {
                 $rightDisplay = PhocaGalleryHelper::getUserRight($catid->params, 'accessuserid', $catid->access, $user->get('aid', 0), $user->get('id', 0), 0);
             }
             if ($rightDisplay == 0) {
                 $mainframe->redirect('index.php?option=com_user&view=login', JText::_("ALERTNOTAUTH"));
                 exit;
             }
             // ============================================================
         }
         //Select category
         if (!$this->_loadCategory()) {
             $this->_loadCategory();
         }
         //Slugs - possible
         //$items->slugid 		= (int) $items->id . "-" . $items->alias;
         //$items->slugcatid	= $this->_category->slug;
         // SLUG CATID
         /*	$query = 'SELECT c.alias'.
         				' FROM #__phocagallery_categories AS c' .
         				' WHERE c.id = '. (int) $this->_category->id;
         			$this->_db->setQuery($query);
         			$catid_alias = $this->_db->loadObject();
         		*/
         if (isset($this->_category->slug) && $this->_category->slug != '') {
             $catid_slug = $this->_category->slug;
         } else {
             $catid_slug = (int) $this->_category->id;
         }
         // ----------
         // SLUG ID
         /*	$query = 'SELECT a.alias'.
         				' FROM #__phocagallery AS a' .
         				' WHERE a.id = '. (int) $this->_id;
         			$this->_db->setQuery($query);
         			$id_alias = $this->_db->loadObject();
         		*/
         if (isset($items->alias) && $items->alias != '') {
             $id_slug = (int) $this->_id . ':' . $items->alias;
         } else {
             $id_slug = (int) $this->_id . ':';
             // Because of possible SEF problem
         }
         // ----------
         //Javascript Slideshow buttons
         $reload_button = PhocaGalleryHelperFront::getGalleryReload((int) $this->_category->id, (int) $this->_id, $id_slug, $catid_slug);
         $close_button = PhocaGalleryHelperFront::getGalleryClose((int) $this->_category->id, (int) $this->_id, $id_slug, $catid_slug);
         $close_text = PhocaGalleryHelperFront::getGalleryCloseText((int) $this->_category->id, (int) $this->_id, $id_slug, $catid_slug);
         $next_button = PhocaGalleryHelperFront::getGalleryNext((int) $this->_category->id, (int) $this->_id);
         $prev_button = PhocaGalleryHelperFront::getGalleryPrevious((int) $this->_category->id, (int) $this->_id);
         $js_slideshow_data = PhocaGalleryHelperFront::getGalleryJsSlideshow((int) $this->_category->id, (int) $this->_id, (int) $this->_slideshow, $id_slug, $catid_slug);
         // Get file thumbnail or No Image
         $file_name_no = $items->filename;
         $file_name = PhocaGalleryHelperFront::getTitleFromFilenameWithExt($items->filename);
         $image_size = PhocaGalleryHelperFront::getImageSizePhoca($items->filename);
         $file_size = PhocaGalleryHelperFront::getFileSizePhoca($items->filename);
         $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImage($items->filename, 'large');
         $link_thumbnail_path = $file_thumbnail['rel'];
         $file = new JObject();
         //slideshow
         $file->set('closebutton', $close_button);
         $file->set('reloadbutton', $reload_button);
         $file->set('nextbutton', $next_button);
         $file->set('prevbutton', $prev_button);
         $file->set('slideshowbutton', $js_slideshow_data['icons']);
         $file->set('slideshowfiles', $js_slideshow_data['files']);
         $file->set('slideshow', $this->_slideshow);
         //download
         $file->set('closetext', $close_text);
         $file->set('filenameno', $file_name_no);
         $file->set('filename', $file_name);
         $file->set('download', $this->_download);
         $file->set('filesize', $file_size);
         $file->set('imagesize', $image_size[0] . ' x ' . $image_size[1]);
         //all
         $file->set('linkthumbnailpath', $link_thumbnail_path);
         //description
         $file->set('description', $items->description);
         $file->set('params', $items->params);
         $file->set('title', $items->title);
         if (isset($file)) {
             $this->_data = $file;
         } else {
             $this->_data = '';
         }
         return (bool) $this->_data;
     }
     return true;
 }
Ejemplo n.º 18
0
 function createCategory()
 {
     global $mainframe;
     JRequest::checkToken() or jexit('Invalid Token');
     $user =& JFactory::getUser();
     $view = JRequest::getVar('view', '', 'post', '', 0);
     $post['title'] = JRequest::getVar('categoryname', '', 'post', 'string', 0);
     $post['description'] = JRequest::getVar('phocagallerycreatecatdescription', '', 'post', 'string', 0);
     $Itemid = JRequest::getVar('Itemid', 0, '', 'int');
     $tab = JRequest::getVar('tab', 0, '', 'int');
     // Params
     $paramsC = JComponentHelper::getParams('com_phocagallery');
     // 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;
     }
     $maxCreateCatChar = $paramsC->get('max_create_cat_char', 1000);
     $post['description'] = substr($post['description'], 0, (int) $maxCreateCatChar);
     $post['alias'] = PhocaGalleryHelper::getAliasName($post['title']);
     // user is logged in
     if ($user->aid > 0 && $user->id > 0) {
         if ($post['title'] != '') {
             $model = $this->getModel('user');
             $userCatId = $model->getUserCategory($user->id);
             // User has no category, he (she) can create one
             if (empty($userCatId->id)) {
                 // NEW
                 $msg = '';
                 // Create an user folder on the server
                 $userFolder = PhocaGalleryHelper::getAliasName($user->username) . '-' . substr($post['alias'], 0, 10) . '-' . substr(md5(uniqid(time())), 0, 4);
                 $createdFolderError = '';
                 $createdFolder = PhocaGalleryHelper::createFolder($userFolder);
                 $createdFolderError = preg_match("/.\\[PhocaError\\]/i", $createdFolder);
                 if ($createdFolderError) {
                     $msg = JText::_('Error Folder Creating') . ': ' . str_replace('[PhocaError]', '', $createdFolder);
                 }
                 // -----------------------------------
                 // Folder Created, all right
                 if ($msg == '') {
                     // set default values
                     $post['access'] = 0;
                     //$post['access'] 		= 1;
                     $post['parent_id'] = 0;
                     $post['image_position'] = 'left';
                     $post['published'] = 1;
                     $post['params'] = 'accessuserid=-1;' . 'uploaduserid=' . $user->id . ';' . 'deleteuserid=' . $user->id . ';' . 'userfolder=' . $userFolder . ';';
                     // Create new category
                     $id = $model->store($post);
                     if ($id && $id > 0) {
                         $data['userid'] = $user->id;
                         $data['catid'] = $id;
                         $userCategoryId = $model->storeUserCategory($data);
                         if ($userCategoryId && $userCategoryId > 0) {
                             $msg = JText::_('Phoca Gallery User Control Category Saved');
                         } else {
                             $msg = JText::_('Error Saving Phoca Gallery User Control Category');
                         }
                     } else {
                         $msg = JText::_('Error Saving Phoca Gallery User Control Category');
                     }
                 }
             } else {
                 if ($post['title'] != '') {
                     // EDIT
                     $post['id'] = $userCatId->categoryid;
                     $id = $model->store($post);
                     if ($id && $id > 0) {
                         $msg = JText::_('Phoca Gallery User Control Category Edited');
                     } else {
                         $msg = JText::_('Error Editing Phoca Gallery User Control Category');
                     }
                 }
             }
         } else {
             $msg = JText::_('ERROR CREATE CATEGORY PHOCA GALLERY - TITLE');
         }
         $this->setRedirect(JRoute::_('index.php?option=com_phocagallery&view=user&tab=' . $tab . '&Itemid=' . $Itemid, false), $msg);
     } else {
         $this->setRedirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("NOT AUTHORISED TO DO ACTION"));
         exit;
     }
 }
Ejemplo n.º 19
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);
 }
Ejemplo n.º 20
0
 function getList()
 {
     static $list;
     //Params
     $params =& JComponentHelper::getParams('com_phocagallery');
     //Clean Thumbnails or not
     if ($params->get('clean_thumbnails') != '') {
         $clean_thumbnails = $params->get('clean_thumbnails');
     } else {
         $clean_thumbnails = 0;
     }
     // Only process the list once per request
     if (is_array($list)) {
         return $list;
     }
     // Get current path from request
     $current = $this->getState('folder');
     // If undefined, set to empty
     if ($current == 'undefined') {
         $current = '';
     }
     //Get folder variables from Helper
     $path = PhocaGalleryHelper::getPathSet();
     // Initialize variables
     if (strlen($current) > 0) {
         $orig_path = $path['orig_abs_ds'] . $current;
     } else {
         $orig_path = $path['orig_abs_ds'];
     }
     $orig_path_server = str_replace(DS, '/', $path['orig_abs'] . '/');
     $images = array();
     $folders = array();
     // Get the list of files and folders from the given folder
     $file_list = JFolder::files($orig_path);
     $folder_list = JFolder::folders($orig_path, '', false, false, array(0 => 'thumbs'));
     natcasesort($file_list);
     // Iterate over the files if they exist
     //file - abc.img, file_no - folder/abc.img
     if ($file_list !== false) {
         foreach ($file_list as $file) {
             $ext = strtolower(JFile::getExt($file));
             // Don't display thumbnails from defined files (don't save them into a database)...
             $dontCreateThumb = PhocaGalleryHelper::dontCreateThumb($file);
             if ($dontCreateThumb == 1) {
                 $ext = '';
                 // WE USE $ext FOR NOT CREATE A THUMBNAIL CLAUSE
             }
             if ($ext == 'jpg' || $ext == 'png' || $ext == 'gif' || $ext == 'jpeg') {
                 if (is_file($orig_path . DS . $file) && substr($file, 0, 1) != '.' && strtolower($file) !== 'index.html') {
                     //Create thumbnails small, medium, large
                     $refresh_url = 'index.php?option=com_phocagallery&view=phocagallerym&layout=form&hidemainmenu=1&folder=' . $current;
                     $file_no = $current . "/" . $file;
                     $file_thumb = PhocaGalleryHelper::getOrCreateThumbnail($path['orig_abs_ds'], $file_no, $refresh_url, 0, 0, 0);
                     $tmp = new JObject();
                     $tmp->name = $file_thumb['name'];
                     $tmp->path_with_name_relative_no = $file_thumb['path_with_name_relative_no'];
                     $tmp->linkthumbnailpath = $file_thumb['thumb_name_m_no_rel'];
                     $images[] = $tmp;
                 }
             }
         }
     }
     //Clean Thumbs Folder if there are thumbnail files but not original file
     if ($clean_thumbnails == 1) {
         PhocaGalleryHelper::cleanThumbsFolder();
     }
     //---------------------------------------------------------------------------------------------------------------
     // Iterate over the folders if they exist
     if ($folder_list !== false) {
         foreach ($folder_list as $folder) {
             $tmp = new JObject();
             $tmp->name = basename($folder);
             $tmp->path_with_name = str_replace(DS, '/', JPath::clean($orig_path . DS . $folder));
             $tmp->path_without_name_relative = $path['orig_rel_ds'] . str_replace($orig_path_server, '', $tmp->path_with_name);
             $tmp->path_with_name_relative_no = str_replace($orig_path_server, '', $tmp->path_with_name);
             $folders[] = $tmp;
         }
     }
     $list = array('folders' => $folders, 'images' => $images);
     return $list;
 }
Ejemplo n.º 21
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();
     // Only registered users
     if ($user->aid == 0) {
         $mainframe->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("ALERTNOTAUTH"));
         exit;
     }
     // CSS, JS
     JHTML::stylesheet('phocagallery.css', 'components/com_phocagallery/assets/');
     $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');
     //$id 						= JRequest::getVar('id', 0, '', 'int');
     $tmpl['tab'] = JRequest::getVar('tab', 0, '', 'string');
     $tmpl['formaticon'] = PhocaGalleryHelperFront::getFormatIcon();
     $tmpl['displaytitleupload'] = $params->get('display_title_upload', 0);
     $tmpl['displaydescupload'] = $params->get('display_description_upload', 0);
     $tmpl['maxuploadchar'] = $params->get('max_upload_char', 1000);
     $tmpl['maxcreatecatchar'] = $params->get('max_create_cat_char', 1000);
     $display_phoca_info = $params->get('display_phoca_info', 1);
     $tmpl['phocainfocode'] = PhocaGalleryHelper::getPhocaInfoCode((int) $display_phoca_info);
     $tmpl['showpagetitle'] = $params->get('show_page_title', 1);
     // UCP is disabled (security reasons)
     $enable_user_cp = $params->get('enable_user_cp', 0);
     if ($enable_user_cp == 0) {
         $mainframe->redirect(JURI::base(true), JText::_("User Control Panel is disabled"));
         exit;
     }
     // PANE - CATEGORY EDIT | CREATE
     // MODEL - Get user's category
     $model = $this->getModel('user');
     $userCategory = $model->getUserCategory($user->id);
     if (!empty($userCategory->categoryid)) {
         if ((int) $userCategory->categorypublished == 1) {
             $tmpl['createoredithead'] = JText::_('Edit Category');
             $tmpl['createoredit'] = JText::_('Phoca Gallery Edit');
             $tmpl['categorytitle'] = $userCategory->categorytitle;
             $tmpl['categorydescription'] = $userCategory->categorydescription;
             $tmpl['categorypublished'] = 1;
         } else {
             $tmpl['categorypublished'] = 0;
         }
     } else {
         $tmpl['createoredithead'] = JText::_('Create Category');
         $tmpl['createoredit'] = JText::_('Phoca Gallery Create');
         $tmpl['categorytitle'] = '';
         $tmpl['categorydescription'] = '';
         $tmpl['categorypublished'] = -1;
     }
     $document->addCustomTag(PhocaGalleryHelperRender::renderDescriptionCreateCatJS((int) $tmpl['maxcreatecatchar']));
     // PANE - UPLOAD
     // Category Params
     if (!empty($userCategory->categoryid)) {
         $catParams = $model->getCategoryParams((int) $userCategory->categoryid);
         // ===========================================================
         // 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), 1);
         }
         if ($rightDisplay == 0) {
             $mainframe->redirect(JRoute::_('index.php?option=com_user&view=login', false), JText::_("ALERTNOTAUTH"));
             exit;
         }
         // ===========================================================
         // Upload Form -----------------------------------------------
         // Set FTP form
         $ftp = !JClientHelper::hasCredentials('ftp');
         // PARAMS - Upload size
         $tmpl['uploadmaxsize'] = $params->get('upload_maxsize', 3000000);
         $this->assignRef('session', JFactory::getSession());
         // END Upload Form -------------------------------------------
     } else {
         $tmpl['displayupload'] = 0;
     }
     $tmpl['createcategory'] = 1;
     // Tabs
     $displayTabs = 0;
     if ((int) $tmpl['createcategory'] == 0) {
         $currentTab['createcategory'] = -1;
     } else {
         $currentTab['createcategory'] = $displayTabs;
         $displayTabs++;
     }
     if ((int) $tmpl['displayupload'] == 0) {
         $currentTab['upload'] = -1;
     } else {
         $currentTab['upload'] = $displayTabs;
         $displayTabs++;
     }
     $tmpl['displaytabs'] = $displayTabs;
     $tmpl['currenttab'] = $currentTab;
     // ACTION
     $tmpl['action'] = $uri->toString();
     // ASIGN
     $this->assignRef('tmpl', $tmpl);
     $this->assignRef('params', $params);
     $this->assignRef('session', JFactory::getSession());
     parent::display($tpl);
 }
Ejemplo n.º 22
0
 function display($tpl = null)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $model =& $this->getModel();
     $document =& JFactory::getDocument();
     $user =& JFactory::getUser();
     $params =& $mainframe->getParams();
     $tmpl = array();
     $tmpl2 = array();
     // 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->addStyleSheet(JURI::base(true) . '/components/com_phocagallery/assets/phocagallery.css');
     // PARAMS
     $image_categories_size = $params->get('image_categories_size', 4);
     $hide_categories = $params->get('hide_categories', '');
     $medium_image_width = $params->get('medium_image_width', 100);
     $medium_image_height = $params->get('medium_image_height', 100);
     $small_image_width = $params->get('small_image_width', 50);
     $small_image_height = $params->get('small_image_height', 50);
     $medium_image_height = $medium_image_height + 18;
     $medium_image_width = $medium_image_width + 18;
     $small_image_width = $small_image_width + 18;
     $small_image_height = $small_image_height + 18;
     switch ($image_categories_size) {
         case 4:
         case 6:
             $tmpl['imagebg'] = 'background: url(\'' . JURI::base(true) . '/components/com_phocagallery/assets/images/shadow3.' . PhocaGalleryHelperFront::getFormatIcon() . '\') 50% 50% no-repeat;height:' . $small_image_height . 'px;width:' . $small_image_width . 'px;';
             $tmpl['imagewidth'] = $small_image_width + 20;
             //Categories Detailed View
             break;
         case 5:
         case 7:
             $tmpl['imagebg'] = 'background: url(\'' . JURI::base(true) . '/components/com_phocagallery/assets/images/shadow1.' . PhocaGalleryHelperFront::getFormatIcon() . '\') 50% 50% no-repeat;height:' . $medium_image_height . 'px;width:' . $medium_image_width . 'px;';
             $tmpl['imagewidth'] = $medium_image_width + 20;
             //Categories Detailed View
             break;
         case 1:
         case 3:
             $tmpl['imagebg'] = 'width:' . $medium_image_width . 'px;';
             $tmpl['imagewidth'] = $medium_image_width + 20;
             //Categories Detailed View
             break;
         case 0:
         case 2:
         default:
             $tmpl['imagebg'] = 'width:' . $small_image_width . 'px;';
             $tmpl['imagewidth'] = $small_image_width + 20;
             //Categories Detailed View
             break;
     }
     // PARAMS
     $tmpl['phocagallerywidth'] = $params->get('phocagallery_width', '');
     $display_subcategories = $params->get('display_subcategories', 1);
     $display_empty_categories = $params->get('display_empty_categories', 0);
     $tmpl['categoriescolumns'] = $params->get('categories_columns', 1);
     $display_phoca_info = $params->get('display_phoca_info', 1);
     $tmpl['phocainfocode'] = PhocaGalleryHelper::getPhocaInfoCode((int) $display_phoca_info);
     $categories = $model->getData($display_subcategories, $display_empty_categories, $hide_categories);
     // PARMAS - Access Category - display category in category list, which user cannot access
     $display_access_category = $params->get('display_access_category', 1);
     // Add link and unset the categories which user cannot see (if it is enabled in params)
     $unSet = 0;
     // If it will be unseted while access view, we must sort the keys from category array - ACCESS
     foreach ($categories as $key => $category) {
         $categories[$key]->link = JRoute::_('index.php?option=com_phocagallery&view=category&id=' . $category->slug . '&Itemid=' . JRequest::getVar('Itemid', 1, 'get', 'int'));
         // USER RIGHT - ACCESS =======================================
         $rightDisplay = 1;
         if (isset($categories[$key]->params)) {
             $rightDisplay = PhocaGalleryHelper::getUserRight($categories[$key]->params, 'accessuserid', $category->access, $user->get('aid', 0), $user->get('id', 0), $display_access_category);
         }
         // Display Key Icon (in case we want to display unaccessable categories in list view)
         $rightDisplayKey = 1;
         if ($display_access_category == 1) {
             // we simulate that we want not to display unaccessable categories
             // so we get rightDisplayKey = 0 then the key will be displayed
             if (isset($categories[$key]->params)) {
                 $rightDisplayKey = PhocaGalleryHelper::getUserRight($categories[$key]->params, 'accessuserid', $category->access, $user->get('aid', 0), $user->get('id', 0), 0);
             }
         }
         $file_thumbnail = PhocaGalleryHelperFront::displayFileOrNoImageCategories($category->filename, $image_categories_size, $rightDisplayKey);
         $categories[$key]->linkthumbnailpath = $file_thumbnail['rel'];
         if ($rightDisplay == 0) {
             unset($categories[$key]);
             $unSet = 1;
         }
         // ============================================================
     }
     // ACCESS - in case we unset some category from the list, we must sort the array new
     if ($unSet == 1) {
         $categories = array_values($categories);
     }
     // PARAMS - Define image tag attributes
     if ($params->get('image') != -1) {
         $attribs['align'] = $params->get('image_align');
         $attribs['hspace'] = 6;
         // Use the static HTML library to build the image tag
         $tmpl['image'] = JHTML::_('image', 'images/stories/' . $params->get('image'), JText::_('Phoca gallery'), $attribs);
     }
     // PARAMS - Display or hide image beside the category name
     $tmpl['displayimagecategories'] = $params->get('display_image_categories', 1);
     // ASSIGN
     $this->assignRef('tmpl', $tmpl);
     $this->assignRef('params', $params);
     $this->assignRef('categories', $categories);
     // PARAMS - GEO
     $display_categories_geotagging = $params->get('display_categories_geotagging', 0);
     if ($display_categories_geotagging == 1) {
         $tmpl2['categorieslng'] = $params->get('categories_lng', '');
         $tmpl2['categorieslat'] = $params->get('categories_lat', '');
         $tmpl2['categorieszoom'] = $params->get('categories_zoom', 2);
         $tmpl2['googlemapsapikey'] = $params->get('google_maps_api_key', '');
         $tmpl2['categoriesmapwidth'] = $params->get('categories_map_width', 500);
         $tmpl2['categoriesmapheight'] = $params->get('categorires_map_height', 500);
         // if no lng and lat will be added, Phoca Gallery will try to find it in categories
         if ($tmpl2['categorieslat'] == '' || $tmpl2['categorieslng'] == '') {
             $latLng = PhocaGalleryHelper::findLatLngFromCategory($categories);
             $tmpl2['categorieslng'] = $latLng['lng'];
             $tmpl2['categorieslat'] = $latLng['lat'];
         }
         $this->assignRef('tmpl2', $tmpl2);
         parent::display('map');
     } else {
         parent::display($tpl);
     }
 }
Ejemplo n.º 23
0
<?php

defined('_JEXEC') or die('Restricted access');
if ($this->tmpl['googlemapsapikey'] == '') {
    echo '<p>' . JText::_('Google Maps API Key Error Front') . '</p>';
} else {
    if ($this->map['longitude'] == '' || $this->map['latitude'] == '') {
        echo '<p>' . JText::_('Google Maps Error Front') . '</p>';
    } else {
        $text = '<div style="text-align:left"><table border="0" cellspacing="5" cellpadding="5"><tr><td align="left" colspan="2"><b>' . $this->map['geotitle'] . '</b></td></tr>';
        $text .= '<tr>';
        $text .= '<td valign="top" align="left">' . JHTML::_('image.site', $this->map['thumbnail'], '', '', '', $this->map['geotitle']) . '</td>';
        $text .= '<td valign="top" align="left">' . PhocaGalleryHelper::strTrimAll($this->map['description']) . '</td>';
        $text .= '</tr></table></div>';
        ?>

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=<?php 
        echo $this->tmpl['googlemapsapikey'];
        ?>
" type="text/javascript"></script>

<noscript><?php 
        echo JText::_('GOOGLE MAP ENABLE JAVASCRIPT');
        ?>
</noscript>

<div align="center" style="margin:0;padding:0;margin-top:10px;">
	<div id="phoca_geo_map" style="margin:0;padding:0;width:<?php 
        echo $this->tmpl['largemapwidth'];
        ?>
px;height:<?php 
Ejemplo n.º 24
0
 function display($tpl = null)
 {
     global $mainframe;
     $uri =& JFactory::getURI();
     $document =& JFactory::getDocument();
     $db =& JFactory::getDBO();
     JHTML::stylesheet('phocagallery.css', 'administrator/components/com_phocagallery/assets/');
     $document->addCustomTag("<!--[if IE]>\n<link rel=\"stylesheet\" href=\"../administrator/components/com_phocagallery/assets/phocagalleryieall.css\" type=\"text/css\" />\n<![endif]-->");
     $link = 'index.php?option=com_phocagallery&amp;view=phocagalleryd&amp;tmpl=component';
     JHTML::_('behavior.modal', 'a.modal-button');
     // Get width and height from default settings
     $params = JComponentHelper::getParams('com_phocagallery');
     $admin_modal_box_width = 680;
     $admin_modal_box_height = 520;
     if ($params->get('admin_modal_box_width') != '') {
         $admin_modal_box_width = $params->get('admin_modal_box_width');
     }
     if ($params->get('admin_modal_box_height') != '') {
         $admin_modal_box_height = $params->get('admin_modal_box_height');
     }
     $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: " . $admin_modal_box_width . ", y: " . $admin_modal_box_height . "}}");
     // Set toolbar items for the page
     JToolBarHelper::title(JText::_('Phoca Gallery Images'), 'gallery');
     JToolBarHelper::publishList();
     JToolBarHelper::unpublishList();
     JToolBarHelper::deleteList(JText::_('WARNWANTDELLISTEDITEMS'), 'remove', 'delete');
     JToolBarHelper::editListX();
     JToolBarHelper::addNewX();
     JToolBarHelper::customX('Multiple', 'multiple.png', '', JText::_('Multiple Add'), false);
     JToolBarHelper::preferences('com_phocagallery', '460');
     JToolBarHelper::help('screen.phocagallery', true);
     //Filter
     $context = 'com_phocagallery.phocagallery.list.';
     $filter_state = $mainframe->getUserStateFromRequest($context . 'filter_state', 'filter_state', '', 'word');
     $filter_catid = $mainframe->getUserStateFromRequest($context . 'filter_catid', 'filter_catid', 0, 'int');
     $filter_order = $mainframe->getUserStateFromRequest($context . 'filter_order', 'filter_order', 'a.ordering', 'cmd');
     $filter_order_Dir = $mainframe->getUserStateFromRequest($context . 'filter_order_Dir', 'filter_order_Dir', '', 'word');
     $search = $mainframe->getUserStateFromRequest($context . 'search', 'search', '', 'string');
     $search = JString::strtolower($search);
     // Get data from the model
     $items =& $this->get('Data');
     $total =& $this->get('Total');
     $pagination =& $this->get('Pagination');
     // build list of categories
     $javascript = 'class="inputbox" size="1" onchange="submitform( );"';
     $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, 'filter_catid', $javascript, 'value', 'text', $filter_catid);
     //-----------------------------------------------------------------------
     // state filter
     $lists['state'] = JHTML::_('grid.state', $filter_state);
     // table ordering
     $lists['order_Dir'] = $filter_order_Dir;
     $lists['order'] = $filter_order;
     // search filter
     $lists['search'] = $search;
     $this->assignRef('button', $button);
     $this->assignRef('user', JFactory::getUser());
     $this->assignRef('lists', $lists);
     $this->assignRef('items', $items);
     $this->assignRef('pagination', $pagination);
     $this->assignRef('request_url', $uri->toString());
     parent::display($tpl);
 }
Ejemplo n.º 25
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;
 }
Ejemplo n.º 26
0
 function piclens($cids)
 {
     $db =& JFactory::getDBO();
     $path = PhocaGalleryHelper::getPathSet();
     $paramsC = JComponentHelper::getParams('com_phocagallery');
     // PARAMS
     $piclens_image = $paramsC->get('piclens_image', 1);
     if (JFolder::exists($path['orig_abs_ds'])) {
         foreach ($cids as $kcid => $vcid) {
             $this->setXMLFile();
             if (!$this->_XMLFile) {
                 $this->setError('Could not create XML builder');
                 return false;
             }
             if (!($node = $this->_XMLFile->createElement('rss'))) {
                 $this->setError('Could not create node!');
                 return false;
             }
             $node->setAttribute('xmlns:media', 'http://search.yahoo.com/mrss');
             $node->setAttribute('xmlns:atom', 'http://www.w3.org/2005/Atom');
             $node->setAttribute('version', '2.0');
             $this->_XMLFile->setDocumentElement($node);
             if (!($root =& $this->_XMLFile->documentElement)) {
                 $this->setError('Could not obtain root element!');
                 return false;
             }
             $channel =& $this->_XMLFile->createElement('channel');
             $atomIcon =& $this->_XMLFile->createElement('atom:icon');
             $atomIcon->setText('http://www.phoca.cz/images/phoca-piclens.png');
             $channel->appendChild($atomIcon);
             $query = 'SELECT a.id AS id, a.title AS title, a.filename AS filename FROM #__phocagallery AS a' . ' WHERE a.catid = ' . (int) $vcid . ' AND a.published = 1' . ' ORDER BY a.catid, a.ordering';
             $db->setQuery($query);
             $rows = $db->loadObjectList();
             foreach ($rows as $krow => $vrow) {
                 $file = PhocaGalleryHelper::getOrCreateThumbnail('', $vrow->filename, '');
                 $orig_file = str_replace("../", "", $file['path_with_name_relative']);
                 $orig_file = str_replace("//", "/", $orig_file);
                 $thumb_name_l_no_rel = str_replace("../", "", $file['thumb_name_l_no_rel']);
                 $thumb_name_l_no_rel = str_replace("//", "/", $thumb_name_l_no_rel);
                 $juri_base = str_replace("administrator", "", JURI::base(true));
                 $thumb_image_path = $juri_base . $thumb_name_l_no_rel;
                 $orig_file_path = $juri_base . $orig_file;
                 $item =& $this->_XMLFile->createElement('item');
                 $item->appendChild($this->_buildXMLElement('title', $vrow->title));
                 $item->appendChild($this->_buildXMLElement('link', $thumb_image_path));
                 $thumbnail =& $this->_XMLFile->createElement('media:thumbnail');
                 $thumbnail->setAttribute('url', $thumb_image_path);
                 $content =& $this->_XMLFile->createElement('media:content');
                 if ($piclens_image == 1) {
                     $content->setAttribute('url', $thumb_image_path);
                 } else {
                     $content->setAttribute('url', $orig_file_path);
                 }
                 $item->appendChild($thumbnail);
                 $item->appendChild($content);
                 $guid =& $this->_XMLFile->createElement('guid');
                 $guid->setText($vcid . '-phocagallerypiclenscode-' . $vrow->filename);
                 $guid->setAttribute('isPermaLink', "false");
                 $item->appendChild($guid);
                 $channel->appendChild($item);
             }
             $root->appendChild($channel);
             $this->_XMLFile->setXMLDeclaration('<?xml version="1.0" encoding="utf-8" standalone="yes"?>');
             //echo $this->_XMLFile->toNormalizedString( true );exit;
             // saveXML_utf8 doesn't save setXMLDeclaration
             if (!$this->_XMLFile->saveXML($path['orig_abs_ds'] . DS . $vcid . '.rss', true)) {
                 $this->setError('Could not save XML file!');
                 return false;
             }
         }
         return true;
     } else {
         $this->setError('Phoca Gallery image folder not exists');
     }
 }
Ejemplo n.º 27
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;
 }
Ejemplo n.º 28
0
 function upload()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken('request') or jexit('Invalid Token');
     // Set FTP credentials, if given
     $ftp =& JClientHelper::setCredentialsFromRequest('ftp');
     $path = PhocaGalleryHelper::getPathSet();
     $file = JRequest::getVar('Filedata', '', 'files', 'array');
     $folder = JRequest::getVar('folder', '', '', 'path');
     $format = JRequest::getVar('format', 'html', '', 'cmd');
     $return = JRequest::getVar('return-url', null, 'post', 'base64');
     $viewBack = JRequest::getVar('viewback', '', '', '');
     $err = null;
     // Make the filename safe
     if (isset($file['name'])) {
         $file['name'] = JFile::makeSafe($file['name']);
     }
     // All HTTP header will be overwritten with js message
     if (isset($file['name'])) {
         $filepath = JPath::clean($path['orig_abs_ds'] . $folder . DS . strtolower($file['name']));
         if (!PhocaGalleryHelperUpload::canUpload($file, $err)) {
             if ($format == 'json') {
                 switch ($err) {
                     case 'WARNFILETOOLARGE':
                         header('HTTP/1.0 413 Request Entity Too Large');
                         jexit('Error. The File Is Too Large!');
                         break;
                     default:
                         header('HTTP/1.0 415 Unsupported Media Type');
                         jexit('Error. Unsupported Media Type!');
                         break;
                 }
             } else {
                 JError::raiseNotice(100, JText::_($err));
                 // REDIRECT
                 if ($return) {
                     $mainframe->redirect(base64_decode($return) . '&folder=' . $folder);
                 }
                 return;
             }
         }
         if (JFile::exists($filepath)) {
             if ($format == 'json') {
                 header('HTTP/1.0 409 Conflict');
                 jexit('Error. File already exists');
             } else {
                 JError::raiseNotice(100, JText::_('Error. File already exists'));
                 // REDIRECT
                 if ($return) {
                     $mainframe->redirect(base64_decode($return) . '&folder=' . $folder);
                 }
                 return;
             }
         }
         if (!JFile::upload($file['tmp_name'], $filepath)) {
             if ($format == 'json') {
                 header('HTTP/1.0 406 Not Acceptable');
                 jexit('Error. Unable to upload file');
             } else {
                 JError::raiseWarning(100, JText::_('Error. Unable to upload file'));
                 // REDIRECT
                 if ($return) {
                     $mainframe->redirect(base64_decode($return) . '&folder=' . $folder);
                 }
                 return;
             }
         } else {
             if ($format == 'json') {
                 header('HTTP/1.0 400');
                 // With 400 error will be not displayed (?? - ok)
                 jexit('Upload complete');
             } else {
                 $mainframe->enqueueMessage(JText::_('Phoca Gallery, Upload complete'));
                 // REDIRECT
                 if ($return) {
                     $mainframe->redirect(base64_decode($return) . '&folder=' . $folder);
                 }
                 return;
             }
         }
     } else {
         $msg = JTEXT::_('WARNFILETYPE');
         if ($format == 'json') {
             header('HTTP/1.0 415 Unsupported Media Type');
             jexit('Error. Unable to upload file');
         } else {
             if ($return) {
                 $mainframe->redirect(base64_decode($return) . '&folder=' . $folder, $msg);
             } else {
                 switch ($viewBack) {
                     case 'phocagalleryi':
                         $mainframe->redirect('index.php?option=com_phocagallery&view=phocagalleryi&tmpl=component&folder=' . $folder, $msg);
                         break;
                     case 'phocagallerym':
                         $mainframe->redirect('index.php?option=com_phocagallery&view=phocagallerym&layout=form&hidemainmenu=1&folder=' . $folder, $msg);
                         break;
                     default:
                         $mainframe->redirect('index.php?option=com_phocagallery', $msg);
                         break;
                 }
             }
         }
     }
 }
Ejemplo n.º 29
0
                }
                if (!isset($geotitle[0]) || isset($geotitle[0]) && $geotitle[0] == '') {
                    $data['geotitle'] = $category->title;
                } else {
                    $data['geotitle'] = $geotitle[0];
                }
            } else {
                $data['longitude'] = '';
                $data['latitude'] = '';
                $data['geotitle'] = $category->title;
            }
            if ($data['longitude'] != '' && $data['latitude'] != '') {
                $text = '<div style="text-align:left"><table border="0" cellspacing="5" cellpadding="5"><tr><td align="left" colspan="2"><b><a href="' . $category->link . '">' . $data['geotitle'] . '</a></b></td></tr>';
                $text .= '<tr>';
                $text .= '<td valign="top" align="left"><a href="' . $category->link . '">' . JHTML::_('image.site', $category->linkthumbnailpath, '', '', '', $data['geotitle']) . '</a></td>';
                $text .= '<td valign="top" align="left">' . PhocaGalleryHelper::strTrimAll($category->description) . '</td>';
                $text .= '</tr></table></div>';
                ?>
	
		var point<?php 
                echo $category->id;
                ?>
 = new GPoint( <?php 
                echo $data['longitude'];
                ?>
, <?php 
                echo $data['latitude'];
                ?>
);
		var marker_phoca_geo<?php 
                echo $category->id;
Ejemplo n.º 30
0
    $button->set('modal', true);
    $button->set('methodname', 'modal-button');
    $button->set('options', "{handler: 'iframe', size: {x: " . $front_popup_window_width . ", y: " . $front_popup_window_height . "}, overlayOpacity: " . $modal_box_overlay_opacity . ", classWindow: 'phocagallery-random-window', classOverlay: 'phocagallery-random-overlay'}");
    $document->addCustomTag("<style type=\"text/css\"> \n" . " #sbox-window.phocagallery-random-window   {background-color:" . $modal_box_border_color . ";padding:" . $modal_box_border_width . "px} \n" . " #sbox-overlay.phocagallery-random-overlay  {background-color:" . $modal_box_overlay_color . ";} \n" . " </style> \n");
}
// ACCESS RIGHTS
// All categories where the user has access
$query = 'SELECT cc.title AS text, cc.id AS id, cc.parent_id as parentid, cc.alias as alias, cc.access as access, cc.params as params' . ' FROM #__phocagallery_categories AS cc' . ' RIGHT JOIN #__phocagallery AS img ON img.catid = cc.id' . ' WHERE cc.published = 1' . ' AND cc.access <= ' . $user->get('aid', 0) . ' ORDER BY img.date DESC';
$db->setQuery($query);
$categories = $db->loadObjectList();
$unSet = 0;
foreach ($categories as $key => $category) {
    // USER RIGHT - ACCESS =======================================
    $rightDisplay = 1;
    if (isset($categories[$key]->params)) {
        $rightDisplay = PhocaGalleryHelper::getUserRight($categories[$key]->params, 'accessuserid', $category->access, $user->get('aid', 0), $user->get('id', 0), 0);
    }
    if ($rightDisplay == 0) {
        unset($categories[$key]);
        $unSet = 1;
    }
    // ============================================================
}
if ($unSet == 1) {
    $categories = array_values($categories);
}
$allowedCategories = $categories;
// From objects to array only
$last_result = 0;
$indx = 0;
$allowedCategoriesArray = array();