/**
  * Checks if the file can be uploaded
  * @param array File information
  * @param string An error message to be returned
  * @return boolean
  */
 function canUpload($file, &$err)
 {
     $params = JComponentHelper::getParams('com_media');
     jimport('joomla.filesystem.file');
     $format = JFile::getExt($file['name']);
     $allowable = explode(',', $params->get('upload_extensions'));
     if (!in_array($format, $allowable)) {
         $err = JText('COM_MEDIA_ERROR_WARNFILETYPE');
         return false;
     }
     $maxSize = (int) ($params->get('upload_maxsize', 0) * 1024 * 1024);
     if ($maxSize > 0 && (int) $file['size'] > $maxSize) {
         $err = JText('COM_MEDIA_ERROR_WARNFILETOOLARGE');
         return false;
     }
     return true;
 }
Example #2
0
 /**
  *   Method to publish a list of contacts
  *
  * @return	void
  * @since	1.0
  */
 function publish()
 {
     // Check for request forgeries
     JRequest::checkToken() or die(JText('JInvalid_Token'));
     // Get items to publish from the request.
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('publish' => 1, 'unpublish' => 0, 'archive' => -1, 'trash' => -2, 'report' => -3);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JWarning_Select_Item_Publish'));
     } else {
         // Get the model.
         $model = $this->getModel(Contact);
         // Publish the items.
         if (!$model->publish($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_contact&view=contacts');
 }
Example #3
0
 /**
  * Install method
  *
  * @access  public
  * @return  boolean True on success
  */
 public function install()
 {
     // Get a database connector object
     $db = $this->parent->getDBO();
     $this->setManifest();
     $plugin = $this->get('plugin');
     $group = $this->get('group');
     $type = $this->get('type');
     $folder = $this->get('folder');
     $extension = $this->get('extension');
     // JCE Plugin
     if (!empty($plugin) || !empty($extension)) {
         if (version_compare((string) $this->get('version'), '2.0', '<')) {
             $this->parent->abort(WFText::_('WF_INSTALLER_INCORRECT_VERSION'));
             return false;
         }
         // its an "extension"
         if ($extension) {
             $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . '/editor/extensions/' . $folder);
         } else {
             $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . '/editor/tiny_mce/plugins/' . $plugin);
         }
     } else {
         // Non-JCE plugin type, probably JCE MediaBox
         if ($type == 'plugin' && $group == 'system') {
             require_once JPATH_LIBRARIES . '/joomla/installer/adapters/plugin.php';
             // create adapter
             $adapter = new JInstallerPlugin($this->parent, $db);
             if (method_exists($adapter, 'loadLanguage')) {
                 $adapter->loadLanguage($this->parent->getPath('source'));
             }
             // set adapter
             $this->parent->setAdapter('plugin', $adapter);
             // isntall
             return $adapter->install();
         } else {
             $this->parent->abort(WFText::_('WF_INSTALLER_EXTENSION_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_NO_PLUGIN_FILE'));
             return false;
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Filesystem Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     // If the extension directory does not exist, lets create it
     $created = false;
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (!($created = JFolder::create($this->parent->getPath('extension_root')))) {
             $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_MKDIR_ERROR') . ' : "' . $this->parent->getPath('extension_root') . '"');
             return false;
         }
     }
     // Set overwrite flag if not set by Manifest
     $this->parent->setOverwrite(true);
     /*
      * If we created the extension directory and will want to remove it if we
      * have to roll back the installation, lets add it to the installation
      * step stack
      */
     if ($created) {
         $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
     }
     // Copy all necessary files
     if (!$this->parent->parseFiles($this->get('files'), -1)) {
         // Install failed, roll back changes
         $this->parent->abort();
         return false;
     }
     // install languages
     $this->parent->parseLanguages($this->get('languages'), 0);
     // install media
     $this->parent->parseMedia($this->get('media'), 0);
     // Load the language file
     $language = JFactory::getLanguage();
     $language->load('com_jce_' . trim($plugin), JPATH_SITE);
     $install = (string) $this->get('install.script');
     if ($install) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . '/' . $install)) {
             $path['src'] = $this->parent->getPath('source') . '/' . $install;
             $path['dest'] = $this->parent->getPath('extension_root') . '/' . $install;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_INSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     $uninstall = $this->get('uninstall.script');
     if ($uninstall) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . '/' . $uninstall)) {
             $path['src'] = $this->parent->getPath('source') . '/' . $uninstall;
             $path['dest'] = $this->parent->getPath('extension_root') . '/' . $uninstall;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(JText('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_UNINSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_SETUP_COPY_ERROR'));
         return false;
     }
     if ($install) {
         if (file_exists($this->parent->getPath('extension_root') . '/' . $install)) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . '/' . $install;
             if (function_exists('jce_install')) {
                 if (jce_install() === false) {
                     $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                     return false;
                 }
             } else {
                 if (function_exists('com_install')) {
                     if (com_install() === false) {
                         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                         return false;
                     }
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     } else {
         $this->parent->set('extension.message', '');
     }
     $plugin = new StdClass();
     $plugin->name = $this->get('plugin');
     $plugin->icon = $this->parent->get('icon');
     $plugin->row = (int) $this->get('row');
     $plugin->path = $this->parent->getPath('extension_root');
     $plugin->type = $type;
     wfimport('admin.models.plugins');
     $model = new WFModelPlugins();
     $model->postInstall('install', $plugin, $this);
     return true;
 }
 /**
  * Install method
  *
  * @access  public
  * @return  boolean True on success
  */
 public function install()
 {
     // Get a database connector object
     $db = $this->parent->getDBO();
     // Get the extension manifest object
     $manifest = $this->parent->getManifest();
     // setup manifest data
     $this->setManifest($manifest);
     $this->parent->set('name', $this->get('name'));
     $this->parent->set('version', $this->get('version'));
     $this->parent->set('message', $this->get('description'));
     $plugin = $this->get('plugin');
     $group = $this->get('group');
     $type = $this->get('type');
     // JCE Plugin
     if (!empty($plugin)) {
         if (version_compare($this->get('version'), '2.0.0', '<')) {
             $this->parent->abort(WFText::_('WF_INSTALLER_INCORRECT_VERSION'));
             return false;
         }
         $this->parent->setPath('extension_root', JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'tiny_mce' . DS . 'plugins' . DS . $plugin);
     } else {
         // Non-JCE plugin type, probably JCE MediaBox or JCE Editor
         if ($type == 'plugin' && ($group == 'system' || $group == 'editors')) {
             require_once JPATH_LIBRARIES . DS . 'joomla' . DS . 'installer' . DS . 'adapters' . DS . 'plugin.php';
             $adapter = new JInstallerPlugin($this->parent, $db);
             $this->parent->setAdapter('plugin', $adapter);
             return $adapter->install();
         } else {
             $this->parent->abort(WFText::_('WF_INSTALLER_EXTENSION_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_NO_PLUGIN_FILE'));
             return false;
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Filesystem Processing Section
      * ---------------------------------------------------------------------------------------------
      */
     // If the extension directory does not exist, lets create it
     $created = false;
     if (!file_exists($this->parent->getPath('extension_root'))) {
         if (!($created = JFolder::create($this->parent->getPath('extension_root')))) {
             $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_MKDIR_ERROR') . ' : "' . $this->parent->getPath('extension_root') . '"');
             return false;
         }
     }
     // Set overwrite flag if not set by Manifest
     $this->parent->setOverwrite(true);
     /*
      * If we created the extension directory and will want to remove it if we
      * have to roll back the installation, lets add it to the installation
      * step stack
      */
     if ($created) {
         $this->parent->pushStep(array('type' => 'folder', 'path' => $this->parent->getPath('extension_root')));
     }
     // Copy all necessary files
     if (!$this->parent->parseFiles($this->get('files'), -1)) {
         // Install failed, roll back changes
         $this->parent->abort();
         return false;
     }
     // install languages
     $this->parent->parseLanguages($this->get('languages'), 0);
     // install media
     $this->parent->parseMedia($this->get('media'), 0);
     // Load the language file
     $language = JFactory::getLanguage();
     $language->load('com_jce_' . trim($plugin), JPATH_SITE);
     $install = $this->get('install.script');
     if ($install) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . DS . $install)) {
             $path['src'] = $this->parent->getPath('source') . DS . $install;
             $path['dest'] = $this->parent->getPath('extension_root') . DS . $install;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(JText('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_INSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     $uninstall = $this->get('uninstall.script');
     if ($uninstall) {
         // Make sure it hasn't already been copied (this would be an error in the xml install file)
         if (!file_exists($this->parent->getPath('extension_root') . DS . $uninstall)) {
             $path['src'] = $this->parent->getPath('source') . DS . $uninstall;
             $path['dest'] = $this->parent->getPath('extension_root') . DS . $uninstall;
             if (!$this->parent->copyFiles(array($path))) {
                 // Install failed, rollback changes
                 $this->parent->abort(JText('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_PHP_UNINSTALL_FILE_ERROR'));
                 return false;
             }
         }
     }
     // Install plugin install default profile layout if a row is set
     if (is_numeric($this->get('row')) && intval($this->get('row'))) {
         // Add to Default Group
         $profile = JTable::getInstance('profiles', 'WFTable');
         $query = 'SELECT id' . ' FROM #__wf_profiles' . ' WHERE name = ' . $db->Quote('Default');
         $db->setQuery($query);
         $id = $db->loadResult();
         $profile->load($id);
         // Add to plugins list
         $plugins = explode(',', $profile->plugins);
         if (!in_array($this->get('plugin'), $plugins)) {
             $plugins[] = $this->get('plugin');
         }
         $profile->plugins = implode(',', $plugins);
         if ($this->get('icon')) {
             if (!in_array($this->get('plugin'), preg_split('/[;,]+/', $profile->rows))) {
                 // get rows as array
                 $rows = explode(';', $profile->rows);
                 // get key (row number)
                 $key = intval($this->get('row')) - 1;
                 // get row contents as array
                 $row = explode(',', $rows[$key]);
                 // add plugin name to end of row
                 $row[] = $this->get('plugin');
                 // add row data back to rows array
                 $rows[$key] = implode(',', $row);
                 $profile->rows = implode(';', $rows);
             }
         }
         if (!$profile->store()) {
             JError::raiseWarning(100, 'WF_INSTALLER_PLUGIN_PROFILE_ERROR');
         }
     }
     /**
      * ---------------------------------------------------------------------------------------------
      * Finalization and Cleanup Section
      * ---------------------------------------------------------------------------------------------
      */
     // Lastly, we will copy the manifest file to its appropriate place.
     if (!$this->parent->copyManifest(-1)) {
         // Install failed, rollback changes
         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_SETUP_COPY_ERROR'));
         return false;
     }
     /*
      * If we have an install script, lets include it, execute the custom
      * install method, and append the return value from the custom install
      * method to the installation message.
      */
     $install = $this->get('install.script');
     if ($install) {
         if (file_exists($this->parent->getPath('extension_root') . DS . $install)) {
             ob_start();
             ob_implicit_flush(false);
             require_once $this->parent->getPath('extension_root') . DS . $install;
             if (function_exists('jce_install')) {
                 if (jce_install() === false) {
                     $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                     return false;
                 }
             } else {
                 if (function_exists('com_install')) {
                     if (com_install() === false) {
                         $this->parent->abort(WFText::_('WF_INSTALLER_PLUGIN_INSTALL') . ' : ' . WFText::_('WF_INSTALLER_CUSTOM_INSTALL_ERROR'));
                         return false;
                     }
                 }
             }
             $msg = ob_get_contents();
             ob_end_clean();
             if ($msg != '') {
                 $this->parent->set('extension.message', $msg);
             }
         }
     } else {
         $this->parent->set('extension.message', '');
     }
     // post-install
     $this->addIndexfiles();
     return true;
 }
<?php

/**
  @package JobBoard
  @copyright Copyright (c)2010-2013 Figomago <http://figomago.wordpress.com>
  @license : GNU General Public License v3 or later
----------------------------------------------------------------------- */
// Protect from unauthorized access
defined('_JEXEC') or die('Restricted Access');
require_once JPATH_SITE . '/components/com_jobboard/router.php';
jimport('joomla.application.component.helper');
if (!JComponentHelper::isEnabled('com_jobboard', true)) {
    JError::raiseError('Component not found or not enabled', JText('This module requires the Job Board component'));
}
JHTML::_('behavior.mootools');
$document =& JFactory::getDocument();
$document->addStyleSheet('modules/mod_jobboard_joblister/css/style.css');
jimport('joomla.environment.browser');
$document =& JFactory::getDocument();
$browser =& JBrowser::getInstance();
if (is_int(strpos($browser->getBrowser(), 'msie')) && intval($browser->getVersion()) < 7) {
} else {
    if (version_compare(JVERSION, '1.6.0', 'ge')) {
        $document->addScript('modules/mod_jobboard_joblister/js/job_lister_13x.js');
    } elseif (version_compare(JVERSION, '1.5.0', 'ge')) {
        $document->addScript('modules/mod_jobboard_joblister/js/job_lister.js');
    }
}
require_once dirname(__FILE__) . DS . 'helper.php';
$limit = $params->get('limit', 5);
$show_stopstart = $params->get('stopstart', 1);
Example #6
0
 protected function setOwnerOfCategory($data)
 {
     $dataUser['userid'] = (int) $data['owner_id'];
     //$data['catid']		= $id;
     $dataUser['avatar'] = '';
     $dataUser['published'] = 1;
     $dataUser['approved'] = 0;
     $dataOwnerCategory = $this->getOwnerCategoryData($dataUser['userid']);
     if ($dataOwnerCategory) {
         // Owner is set in user table
         $userCategoryId = $this->storeOwnerCategory($dataOwnerCategory);
     } else {
         // Owner is not set in user table
         $userCategoryId = $this->storeOwnerCategory($dataUser);
     }
     if (!$userCategoryId) {
         $this->setError(JText::_('COM_PHOCAGALLERY_ERROR_SAVING_CATEGORY') . ' - ' . JText('COM_PHOCAGALLERY_OWNER'));
         return false;
     }
     return true;
 }
<?php

/**
 * @package JoomlaPack
 * @subpackage BackupIconModule
 * @copyright Copyright (c)2009 JoomlaPack Developers
 * @license GNU General Public License version 3, or later
 * @since 2.2
 */
// Protect from unauthorized access
defined('_JEXEC') or die('Restricted Access');
// Make sure JoomlaPack is enabled
jimport('joomla.application.component.helper');
if (!JComponentHelper::isEnabled('com_joomlapack', true)) {
    JError::raiseError('E_JPNOTENABLED', JText('JP_NOT_ENABLED'));
    return;
}
// Set default parameters
$params->def('enablewarnings', 0);
// Enable warnings
$params->def('warnfailed', 0);
// Warn if backup is failed
$params->def('maxbackupperiod', 24);
// Maximum time between backups, in hours
// Load custom CSS
$document =& JFactory::getDocument();
$document->addStyleSheet(JURI::base() . 'components/com_joomlapack/assets/css/mod_jpadmin.css');
// Initialize defaults
$lang =& JFactory::getLanguage();
$image = "joomlapack-48.png";
$label = JText::_('LBL_JOOMLAPACK');
<?php

/**
  @package JobBoard
  @copyright Copyright (c)2010-2013 Figomago <http://figomago.wordpress.com>
  @license : GNU General Public License v3 or later
----------------------------------------------------------------------- */
// Protect from unauthorized access
defined('_JEXEC') or die('Restricted Access');
require_once JPATH_SITE . '/components/com_jobboard/router.php';
jimport('joomla.application.component.helper');
if (!JComponentHelper::isEnabled('com_jobboard', true)) {
    JError::raiseError('Component not found or not enabled', JText('MOD_JOBBOARD_JOBFILTER_JOBBOARD_NOTFOUND'));
}
$document =& JFactory::getDocument();
$document->addStyleSheet('modules/mod_jobboard_cattotals/css/style.css');
require_once dirname(__FILE__) . DS . 'helper.php';
$categories =& modJobboardCattotalsHelper::getItems($params);
require JModuleHelper::getLayoutPath('mod_jobboard_cattotals');
Example #9
0
<div class="componentheading"><?php 
echo JText::_('DT_EVENT_REGISTRATION') . " : " . JText('DT_PAYMENT');
?>
</div>
<?php

defined('_JEXEC') or die(JText('Restricted access'));
jimport('joomla.application.component.model');
jimport('joomla.html.pane');
JHTML::_('behavior.tooltip');
require_once JLG_PATH_SITE . DS . 'models' . DS . 'project.php';
class JoomleagueModelResults extends JoomleagueModelProject
{
    var $projectid = 0;
    var $divisionid = 0;
    var $roundid = 0;
    var $rounds = array(0);
    var $mode = 0;
    var $order = 0;
    var $config = 0;
    var $project = null;
    var $matches = null;
    function __construct()
    {
        parent::__construct();
        $this->divisionid = JRequest::getInt('division', 0);
        $this->mode = JRequest::getInt('mode', 0);
        $this->order = JRequest::getInt('order', 0);
        $round = JRequest::getInt('r', -1);
        $roundid = $round;
        if ($round) {
            $roundid = $round;
        } else {
            $roundid = $this->getCurrentRound();
        }
Example #11
0
 function save()
 {
     $post = JRequest::get('post');
     $cid = JRequest::getVar('cid', array(0), 'post', 'array');
     $post['description'] = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['parent_id'] = JRequest::getVar('parentid', '', 'post', 'int');
     $post['id'] = (int) $cid[0];
     // DEFAULT VALUES FOR Rights in FRONTEND
     // ACCESS -  0: all users can see the category (registered or not registered)
     //             if registered or not registered it will be set in ACCESS LEVEL not here)
     //			   if -1 - user was not selected so every registered or special users can see category
     // UPLOAD - -2: nobody can upload or add images in front (if 0 - every users can do it)
     // DELETE - -2: nobody can upload or add images in front (if 0 - every users can do it)
     $accessUserId = JRequest::getVar('accessuserid', 0, 'post', 'array');
     $uploadUserId = JRequest::getVar('uploaduserid', -2, 'post', 'array');
     $deleteUserId = JRequest::getVar('deleteuserid', -2, 'post', 'array');
     $userFolder = JRequest::getVar('userfolder', '', 'post', 'string');
     $longitude = JRequest::getVar('longitude', '', 'post', 'string');
     $latitude = JRequest::getVar('latitude', '', 'post', 'string');
     $zoom = JRequest::getVar('zoom', '', 'post', 'string');
     $geotitle = JRequest::getVar('geotitle', '', 'post', 'string');
     // Set all registered users if not selected but 'registered' selected
     if (isset($post['access']) && (int) $post['access'] > 0 && (int) $accessUserId[0] == 0) {
         $accessUserId[0] = -1;
     }
     // Access level for selected users
     $post['params'] = '';
     if (!empty($accessUserId)) {
         $post['params'] .= 'accessuserid=';
         foreach ($accessUserId as $key => $value) {
             $post['params'] .= $value . ',';
         }
         $post['params'] .= ';';
     }
     // Upload (add) level for selected users
     if (!empty($uploadUserId)) {
         $post['params'] .= 'uploaduserid=';
         foreach ($uploadUserId as $key => $value) {
             $post['params'] .= $value . ',';
         }
         $post['params'] .= ';';
     }
     // Delete (publish) level for selected users
     if (!empty($uploadUserId)) {
         $post['params'] .= 'deleteuserid=';
         foreach ($deleteUserId as $key => $value) {
             $post['params'] .= $value . ',';
         }
         $post['params'] .= ';';
     }
     // User folder for selected users
     if (!empty($userFolder)) {
         $post['params'] .= 'userfolder=';
         $post['params'] .= $userFolder;
         $post['params'] .= ';';
     }
     // longitude
     if (!empty($longitude)) {
         $post['params'] .= 'longitude=';
         $post['params'] .= $longitude;
         $post['params'] .= ';';
     }
     // longitude
     if (!empty($latitude)) {
         $post['params'] .= 'latitude=';
         $post['params'] .= $latitude;
         $post['params'] .= ';';
     }
     // geotagging zoom
     if (!empty($zoom)) {
         $post['params'] .= 'zoom=';
         $post['params'] .= $zoom;
         $post['params'] .= ';';
     }
     // geotagging title
     if (!empty($geotitle)) {
         $post['params'] .= 'geotitle=';
         $post['params'] .= $geotitle;
         $post['params'] .= ';';
     }
     $model = $this->getModel('phocagalleryc');
     switch (JRequest::getCmd('task')) {
         case 'apply':
             $id = $model->store($post);
             //you get id and you store the table data
             if ($id && $id > 0) {
                 // Set author of category by Administrator in administration
                 if (isset($post['authorid'])) {
                     $data['userid'] = $post['authorid'];
                     $data['catid'] = $id;
                     // is there some item in phocagallery_user_category about this user
                     $data['id'] = $model->getUserCategoryId($data['userid']);
                     $userCategoryId = $model->storeUserCategory($data);
                     if (!$userCategoryId) {
                         $msg = JText::_('Error Saving Phoca Gallery Categories') . ' - ' . JText('Author');
                         $this->setRedirect('index.php?option=com_phocagallery&controller=phocagalleryc&task=edit&cid[]=' . $id, $msg);
                     }
                 }
                 // -----------------------------------------------------------
                 $msg = JText::_('Changes to Phoca Gallery Categories Saved');
                 //$id		= $model->store($post);
             } else {
                 $msg = JText::_('Error Saving Phoca Gallery Categories');
                 $id = $post['id'];
             }
             $this->setRedirect('index.php?option=com_phocagallery&controller=phocagalleryc&task=edit&cid[]=' . $id, $msg);
             break;
         case 'save':
         default:
             $id = $model->store($post);
             //you get id and you store the table data
             if ($id && $id > 0) {
                 // Set author of category by Administrator in administration
                 if (isset($post['authorid'])) {
                     $data['userid'] = $post['authorid'];
                     $data['catid'] = $id;
                     // is there some item in phocagallery_user_category about this user
                     $data['id'] = $model->getUserCategoryId($data['userid']);
                     $userCategoryId = $model->storeUserCategory($data);
                     if (!$userCategoryId) {
                         $msg = JText::_('Error Saving Phoca Gallery Categories') . ' - ' . JText('Author');
                         $this->setRedirect('index.php?option=com_phocagallery&view=phocagallerycs', $msg);
                     }
                 }
                 // -----------------------------------------------------------
                 $msg = JText::_('Phoca Gallery Categories Saved');
             } else {
                 $msg = JText::_('Error Saving Phoca Gallery Categories');
             }
             $this->setRedirect('index.php?option=com_phocagallery&view=phocagallerycs', $msg);
             break;
     }
     // Check the table in so it can be edited.... we are done with it anyway
     $model->checkin();
 }
// Protect from unauthorized access
/**
* @package	 	Joomla
* @subpackage  	Joomleague results module
* @copyright	Copyright (C) 2005-2013 JoomLeague.net. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/
// Make sure JoomLeague is enabled
jimport('joomla.application.component.helper');
if (!JComponentHelper::isEnabled('com_joomleague', true)) {
    JError::raiseError('E_JLNOTENABLED', JText('JL_NOT_ENABLED'));
    return;
}
// Initialize defaults
$lang = JFactory::getLanguage();
//$image = "joomleague-48.png";
$image = "jl-48.jpg";
$label = JText::_('MOD_JOOMLEAGUE_ADMINPANEL_ICON_LABEL');
?>
<div id="cpanel">
	<div style="float:<?php 
echo $lang->isRTL() ? 'right' : 'left';
?>
;">
		<div class="icon">
			<a href="index.php?option=com_joomleague">