function save() { $data = JRequest::getVar('jform', array(), 'post', 'NONE', 4); $id = (int) $data['id']; if (empty($id)) { if (!igGeneralHelper::authorise('core.igalleryfront.create')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } else { if (!igGeneralHelper::authorise('core.igalleryfront.edit', $id)) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } $model = $this->getModel(); $msg = ''; if (!$model->save($data)) { JError::raise(2, 500, $model->getError()); } else { $msg = JText::_('SUCCESSFULLY_SAVED'); } switch ($this->task) { case 'apply': $url = 'index.php?option=com_igallery&view=icategory&id=' . $id; break; case 'save': $url = 'index.php?option=com_igallery&view=categories'; } $this->setRedirect(JRoute::_($url, false), $msg); }
protected function addToolbar() { JToolBarHelper::title(JText::_('IGNITE_GALLERY') . ' <small>v' . IG_VERSION . '</small>', 'generic.png'); if (igGeneralHelper::authorise('core.create')) { JToolBarHelper::custom('categories.add_category_redirect', 'new', '', JText::_('NEW_CATEGORY'), false); if ($this->isSite == false) { JToolBarHelper::custom('categories.copy', 'copy', '', JText::_('IG_COPY')); } } if (igGeneralHelper::authorise('core.edit.state')) { JToolBarHelper::custom('categories.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('categories.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } if ($this->moderate == 1 && $this->isSite == false) { JToolBarHelper::custom('categories.moderate', 'checkin.png', 'checkin_f2.png', JText::_('APPROVE')); JToolBarHelper::custom('categories.unmoderate', 'remove.png', 'remove_f2.png', JText::_('UNAPPROVE')); } if (igGeneralHelper::authorise('core.delete')) { JToolBarHelper::deleteList(JText::_('CONFIRM_DELETE_CATEGORY'), 'categories.delete', 'JTOOLBAR_DELETE'); } if (igGeneralHelper::authorise('core.admin') && $this->isSite == false) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_igallery'); } }
static function addSubmenu() { $vName = JRequest::getCmd('view', 'categories'); JSubMenuHelper::addEntry(JText::_('JCATEGORIES'), 'index.php?option=com_igallery&view=categories', $vName == 'categories'); JSubMenuHelper::addEntry(JText::_('IMAGES'), 'index.php?option=com_igallery&view=images', $vName == 'images'); if (igGeneralHelper::authorise('core.admin')) { JSubMenuHelper::addEntry(JText::_('PROFILES'), 'index.php?option=com_igallery&view=profiles', $vName == 'profiles'); } JSubMenuHelper::addEntry(JText::_('RATINGS'), 'index.php?option=com_igallery&view=ratings', $vName == 'ratings'); }
function unmoderate() { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $model = $this->getModel(); if (!$model->moderate(0)) { JError::raiseError(2, 500, $model->getError()); } $this->setRedirect(JRoute::_('index.php?option=com_igallery&view=categories', false)); }
function display($cachable = false, $urlparams = false) { $this->checkConfig(); $view = JRequest::getCmd('view', 'categories'); $id = JRequest::getInt('id', 0); if ($view == 'icategory') { if (empty($id)) { if (!igGeneralHelper::authorise('core.create')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } else { if (!igGeneralHelper::authorise('core.edit', $id)) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } $model = $this->getModel('icategory'); if (!$model->checkProfileExists()) { JFactory::getApplication()->enqueueMessage(JText::_('PLEASE_CREATE_PROFILE_FIRST')); $this->setRedirect('index.php?option=com_igallery&view=profiles'); return; } } if ($view == 'image') { if (!igGeneralHelper::authorise('core.edit', null, JRequest::getInt('id', 0))) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } if ($view == 'profiles') { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } if ($view == 'profile') { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } if (empty($id)) { if (!igGeneralHelper::authorise('core.create')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } else { if (!igGeneralHelper::authorise('core.edit')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } } if ($view == 'serverimport') { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } parent::display($cachable, $urlparams); }
public function reorder() { $cid = JRequest::getVar('cid', null, 'get', 'array'); JArrayHelper::toInteger($cid); JRequest::setVar('cid', $cid, 'post'); JFactory::getApplication()->input->post->set('cid', $cid); JRequest::setVar(JRequest::getCmd('formtoken'), 1, 'post'); JFactory::getApplication()->input->post->set(JRequest::getCmd('formtoken'), 1); if (!igGeneralHelper::authorise('core.igalleryfront.edit.state', (int) $cid[0])) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } parent::reorder(); }
function getItems() { $db = $this->getDbo(); $query = $this->getListQuery(); $user = JFactory::getUser(); $db->setQuery($query); $categories = $db->loadObjectList(); $categoriesbyTree = igTreeHelper::makeCategoryTree($categories); $search = JString::strtolower($this->getState('filter.search')); if ($search) { $categoriesbyTree = igTreeHelper::removeFromTree($categoriesbyTree, 'name', $search, 'string-not-exist'); } $filter_state = $this->getState('filter.published'); if (is_numeric($filter_state)) { $categoriesbyTree = igTreeHelper::removeFromTree($categoriesbyTree, 'published', $filter_state, 'numeric-not-exist'); } if (JFactory::getApplication()->isSite()) { foreach ($categoriesbyTree as $key => $category) { $catStateUsed = false; $catDeleteUsed = false; $editOk = igGeneralHelper::authorise('core.igalleryfront.edit', $category->id, null, $category->profile, $category->user); $editStateOk = igGeneralHelper::authorise('core.igalleryfront.edit.state', $category->id, null, $category->profile, $category->user); $deleteOk = igGeneralHelper::authorise('core.igalleryfront.delete', $category->id, null, $category->profile, $category->user); $uploadOk = igGeneralHelper::authorise('core.igalleryfront.upload', $category->id, null, $category->profile, $category->user); $editImageOk = igGeneralHelper::authorise('core.igalleryfront.editimage', $category->id, null, $category->profile, $category->user); $deleteImageOk = igGeneralHelper::authorise('core.igalleryfront.deleteimage', $category->id, null, $category->profile, $category->user); $editImageStateOk = igGeneralHelper::authorise('core.igalleryfront.editimage.state', $category->id, null, $category->profile, $category->user); $category->manage = false; if ($uploadOk || $editImageOk || $deleteImageOk || $editImageStateOk) { $category->manage = true; } if ($editStateOk && $catStateUsed == false) { JRequest::setVar('igCatStateUsed', 1); $catStateUsed = true; } if ($deleteOk && $catDeleteUsed == false) { JRequest::setVar('igCatDeleteUsed', 1); $catDeleteUsed = true; } if (!$editOk && !$editStateOk && !$deleteOk && !$uploadOk && !$editImageOk && !$deleteImageOk && !$editImageStateOk) { unset($categoriesbyTree[$key]); } } } $orderedCategories = array_values($categoriesbyTree); $limit = $this->getState('list.limit') == 0 ? 1000 : $this->getState('list.limit'); $slicedCategories = array_slice($orderedCategories, $this->getState('list.start'), $limit); return $slicedCategories; }
protected function addToolbar() { JToolBarHelper::title(JText::_('RATINGS'), 'generic.png'); if (igGeneralHelper::authorise('core.edit.state')) { JToolBarHelper::custom('ratings.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('ratings.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } if (igGeneralHelper::authorise('core.delete')) { JToolBarHelper::deleteList('', 'ratings.delete', 'JTOOLBAR_DELETE'); } if (igGeneralHelper::authorise('core.admin')) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_igallery'); } }
function delete() { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } if (!igGeneralHelper::authorise('core.delete')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $model = $this->getModel(); if (!$model->checkAssigned()) { $this->setRedirect('index.php?option=com_igallery&view=profiles'); return; } parent::delete(); }
protected function addToolbar() { JToolBarHelper::title(JText::_('PROFILES'), 'generic.png'); if (igGeneralHelper::authorise('core.create')) { JToolBarHelper::custom('profiles.add_profile_redirect', 'new', '', JText::_('NEW_PROFILE'), false); JToolBarHelper::custom('profiles.copy', 'copy', '', JText::_('IG_COPY')); } if (igGeneralHelper::authorise('core.delete')) { JToolBarHelper::deleteList('', 'profiles.delete', 'JTOOLBAR_DELETE'); } if (igGeneralHelper::authorise('core.admin')) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_igallery'); } }
function serverImport() { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $filePathRaw = JRequest::GetVar('path'); $filePath = str_replace('*', '\\', $filePathRaw); if (!($fileData = igFileHelper::processImportedImage($filePath))) { return false; } $model = $this->getModel(); if (!$model->store($fileData)) { echo $model->getError(); return false; } echo 1; }
function save() { $data = JRequest::getVar('jform', array(), 'post', 'NONE', 4); $id = (int) $data['id']; if (!igGeneralHelper::authorise('core.edit', null, $id)) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $model = $this->getModel(); $nextOrder = $model->save($data); switch ($this->task) { case 'apply': $url = 'index.php?option=com_igallery&view=image&id=' . $id; break; case 'save_and_next': $url = empty($nextOrder) ? $url = 'index.php?option=com_igallery&view=images&catid=' . JRequest::GetInt('catid') : 'index.php?option=com_igallery&view=image&id=' . $nextOrder; break; case 'save': $url = 'index.php?option=com_igallery&view=images&catid=' . JRequest::GetInt('catid'); } $this->setRedirect(JRoute::_($url, false), JText::_('SUCCESSFULLY_SAVED')); }
function remove() { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } if (!igGeneralHelper::authorise('core.delete')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $model = $this->getModel(); if (!$model->checkAssigned()) { $this->setRedirect('index.php?option=com_igallery&view=profiles'); return; } if (!$model->delete()) { $msg = ''; JError::raise(2, 500, $model->getError()); } else { $msg = JText::_('SUCCESSFULLY_SAVED'); } $this->setRedirect('index.php?option=com_igallery&view=profiles', $msg); }
function display($cachable = false, $urlparams = false) { $view = JRequest::getCmd('view', 'categories'); $id = JRequest::getInt('id', 0); if ($view == 'icategory') { if (empty($id)) { if (!igGeneralHelper::authorise('core.igalleryfront.create')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } else { if (!igGeneralHelper::authorise('core.igalleryfront.edit', $id)) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } } if ($view == 'image') { if (!igGeneralHelper::authorise('core.igalleryfront.editimage', null, JRequest::getInt('id', 0))) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } } parent::display($cachable, $urlparams); }
function plUpload() { if (!igGeneralHelper::authorise('core.igalleryfront.upload', JRequest::getInt('catid', 0))) { echo JText::_('JERROR_ALERTNOAUTHOR'); return false; } $fileName = $_FILES['file']['name']; $tmpPath = $_FILES['file']['tmp_name']; $uploadError = $_FILES['file']['error']; if (!($fileData = igFileHelper::processUploadedImage($fileName, $tmpPath, $uploadError, 'igallery_img', false))) { return false; } $model = $this->getModel(); $category = $model->getCategory(JRequest::getInt('catid', 0)); $profile = $model->getProfile($category->profile); if (!igFileHelper::makeResizedOnUpload($fileData, $profile, false)) { return false; } if (!$model->store($fileData)) { return false; } JFactory::getSession()->set('ig_uploaded', 1); echo 1; }
$frontend = false; foreach ($frontendTasks as $key => $value) { if ($value == $task) { $taskMatch = true; break; } } if ($taskMatch == true) { if ($task == 'display') { if ($view == 'category') { $frontend = true; } } else { $frontend = true; } } if ($frontend == false) { if (JFactory::getUser()->get('guest')) { return JError::raiseWarning(404, 'Please login to manage images from the frontend'); } $params = JComponentHelper::getParams('com_igallery'); if ($params->get('allow_frontend_creation', 0) == 0) { return JError::raiseWarning(404, JText::_('PLEASE_ENABLE_FRONTEND')); } if (!igGeneralHelper::authorise('core.igalleryfront.access')) { return JError::raiseWarning(404, 'Please go to the ignite gallery component options -> permissions tab, and set the "Frontend Access" task to allowed for this users group'); } } $controller = JControllerLegacy::getInstance('Igallery', array('default_view' => 'category')); $controller->execute($task); $controller->redirect();
?> <?php echo $this->pagination->getListFooter(); ?> <?php } ?> </td> </tr> </tfoot> <?php foreach ($this->items as $i => $item) { $editOk = igGeneralHelper::authorise('core.edit', $item->gallery_id, null, $item->id_of_profile, $item->category_owner); $editStateOk = igGeneralHelper::authorise('core.edit.state', $item->gallery_id, null, $item->id_of_profile, $item->category_owner); $editOwn = igGeneralHelper::authorise('core.edit.own', $item->gallery_id, null, $item->id_of_profile, $item->category_owner) && $item->user == $this->user->id; $editLink = JRoute::_('index.php?option=com_igallery&view=image&id=' . $item->id, false); ?> <tr class="row<?php echo $i % 2; ?> "> <td> <?php echo JHTML::_('grid.id', $i, $item->id); ?> </td> <td> <?php
"> <div class="pagination"> <?php echo $this->pagination->getListFooter(); ?> </div> </td> </tr> </tfoot> <tbody> <?php foreach ($this->items as $i => $item) { $editOk = igGeneralHelper::authorise('core.igalleryfront.edit', $item->id, null, $item->profile, $item->user); $editStateOk = igGeneralHelper::authorise('core.igalleryfront.edit.state', $item->id, null, $item->profile, $item->user); $deleteOk = igGeneralHelper::authorise('core.igalleryfront.delete', $item->id, null, $item->profile, $item->user); ?> <tr class="row<?php echo $i % 2; ?> "> <td> <input type="checkbox" name="ig_check_<?php echo $item->id; ?> " class="ig_checkbox" /> </td> <td class="cat_title"> <?php
<?php defined('_JEXEC') or die('Restricted access'); JHTML::_('behavior.framework', true); $editStateOk = igGeneralHelper::authorise('core.edit.state'); ?> <?php if (IG_J30) { ?> <style type="text/css"> td.order input{ width: 40px !important; } </style> <?php } ?> <form action="index.php?option=com_igallery&view=profiles" method="post" name="adminForm" id="adminForm"> <table class="adminlist table table-striped" id="articleList"> <thead> <tr> <th width="20"> <input type="checkbox" name="toggle" value="" <?php if (!IG_J30) { ?> onclick="checkAll(<?php echo count($this->items);
function assignMenuImage() { if (!igGeneralHelper::authorise('core.igalleryfront.editimage.state', null, JRequest::getInt('id', 0))) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $model = $this->getModel(); if (!$model->assignMenuImage()) { JError::raise(2, 500, $model->getError()); } $this->setRedirect(JRoute::_('index.php?option=com_igallery&view=images&catid=' . JRequest::getInt('catid'), false)); }
protected function addToolbar($category) { JToolBarHelper::title(JText::_('MANAGE_IMAGES') . ' - ' . $category->name, 'generic.png'); if ($this->isSite == true) { JToolBarHelper::back('JTOOLBAR_BACK', 'index.php?option=com_igallery&view=categories&Itemid=' . JRequest::getInt('Itemid', '')); } if (igGeneralHelper::authorise('core.edit.state')) { JToolBarHelper::custom('images.publish', 'publish.png', 'publish_f2.png', 'JTOOLBAR_PUBLISH', true); JToolBarHelper::custom('images.unpublish', 'unpublish.png', 'unpublish_f2.png', 'JTOOLBAR_UNPUBLISH', true); } if ($this->moderate == 1 && $this->isSite == false) { JToolBarHelper::custom('images.moderate', 'checkin.png', 'checkin_f2.png', JText::_('APPROVE')); JToolBarHelper::custom('images.unmoderate', 'remove.png', 'remove_f2.png', JText::_('UNAPPROVE')); } if (igGeneralHelper::authorise('core.delete')) { JToolBarHelper::deleteList('', 'images.delete', 'JTOOLBAR_DELETE'); } if (igGeneralHelper::authorise('core.admin') && $this->isSite == false) { JToolBarHelper::divider(); JToolBarHelper::preferences('com_igallery'); } }
function unmoderate() { if (!igGeneralHelper::authorise('core.admin')) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $model = $this->getModel(); if (!$model->moderate(0)) { JError::raiseError(2, 500, $model->getError()); } $this->setRedirect('index.php?option=com_igallery&view=images&catid=' . JRequest::getInt('catid')); }
function display($tpl = null) { $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); $this->user = JFactory::getUser(); $model = $this->getModel(); $this->category = $model->getCategory(JRequest::getInt('catid', 0)); if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } if (empty($this->category->id)) { JError::raiseError(500, 'Error: No Category id in the page url'); return false; } $this->params = JComponentHelper::getParams('com_igallery'); $this->moderate = $this->params->get('moderate_img', 0); $this->thumbFiles = array(); $this->mainFiles = array(); for ($i = 0; $i < count($this->items); $i++) { $row = $this->items[$i]; if (!($this->thumbFiles[$i] = igFileHelper::originalToResized($row->filename, $row->thumb_width, $row->thumb_height, $row->img_quality, $row->crop_thumbs, $row->rotation, $row->round_thumb, $row->round_fill))) { return false; } if (!($this->mainFiles[$i] = igFileHelper::originalToResized($row->filename, $row->max_width, $row->max_height, $row->img_quality, $row->crop_main, $row->rotation, $row->round_large, $row->round_fill, $row->watermark, $row->watermark_text, $row->watermark_text_color, $row->watermark_text_size, $row->watermark_filename, $row->watermark_position, $row->watermark_transparency, 1))) { return false; } $imgStateUsed = false; $imgDeleteUsed = false; $deleteImageOk = igGeneralHelper::authorise('core.igalleryfront.deleteimage', null, $row->id, $row->id_of_profile, $row->user); $editImageStateOk = igGeneralHelper::authorise('core.igalleryfront.editimage.state', null, $row->id, $row->id_of_profile, $row->user); if ($editImageStateOk && $imgStateUsed == false) { JRequest::setVar('igImgStateUsed', 1); $imgStateUsed = true; } if ($deleteImageOk && $imgDeleteUsed == false) { JRequest::setVar('igImgDeleteUsed', 1); $imgDeleteUsed = true; } } if (igGeneralHelper::authorise('core.igalleryfront.upload', $this->category->id)) { $uploader = $this->params->get('file_uploader', 'plupload'); $uploaderFileName = IG_UPLOAD_PATH . '/' . $uploader . '/' . $uploader . '.php'; $uploaderClassName = 'igUpload' . ucfirst($uploader); $headJsFunctionName = $uploader . 'HeadJs'; $htmlFunctionName = $uploader . 'HTML'; require_once $uploaderFileName; call_user_func(array($uploaderClassName, $headJsFunctionName)); call_user_func(array($uploaderClassName, $htmlFunctionName)); } if (JFactory::getSession()->get('ig_uploaded', 0) == 1) { JFactory::getApplication()->enqueueMessage(JText::_('NEW_IMAGES_ADDED')); JFactory::getSession()->set('ig_uploaded', 0); } JHTML::_('behavior.framework'); $document = JFactory::getDocument(); $document->addScript(JURI::root(true) . '/media/com_igallery/js/admin.js'); $document->addStyleSheet(JURI::root(true) . '/media/com_igallery/css/admin.css'); parent::display($tpl); }
?> <?php echo $this->pagination->getListFooter(); ?> <?php } ?> </td> </tr> </tfoot> <tbody> <?php foreach ($this->items as $i => $item) { $editOk = igGeneralHelper::authorise('core.edit', $item->id, null, $item->profile, $item->user); $editStateOk = igGeneralHelper::authorise('core.edit.state', $item->id, null, $item->profile, $item->user); ?> <tr class="row<?php echo $i % 2; ?> "> <td class="center"> <?php echo JHtml::_('grid.id', $i, $item->id); ?> </td> <td> <?php if ($editOk) {