Example #1
0
 public function connector()
 {
     $mainframe = JFactory::getApplication();
     $user = JFactory::getUser();
     $path = SigProHelper::getPath('site');
     $url = SigProHelper::getHTTPPath($path);
     JPath::check($path);
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderConnector.class.php';
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinder.class.php';
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeDriver.class.php';
     include_once JPATH_COMPONENT_ADMINISTRATOR . '/js/elfinder/php/elFinderVolumeLocalFileSystem.class.php';
     function access($attr, $path, $data, $volume)
     {
         $mainframe = JFactory::getApplication();
         $user = JFactory::getUser();
         // Hide files and folders starting with .
         if (strpos(basename($path), '.') === 0 && $attr == 'hidden') {
             return true;
         }
         // Read only access for front-end. Full access for administration section.
         switch ($attr) {
             case 'read':
                 return true;
                 break;
             case 'write':
                 if ($mainframe->isSite()) {
                     return false;
                 } else {
                     return version_compare(JVERSION, '1.6.0', 'ge') ? $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro') : true;
                 }
                 break;
             case 'locked':
                 if ($mainframe->isSite()) {
                     return true;
                 } else {
                     return version_compare(JVERSION, '1.6.0', 'ge') ? !($user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro')) : false;
                 }
                 break;
             case 'hidden':
                 return false;
                 break;
         }
     }
     if ($mainframe->isAdmin()) {
         if (version_compare(JVERSION, '1.6.0', 'ge')) {
             $write = $user->authorise('core.create', 'com_sigpro') && $user->authorise('core.edit', 'com_sigpro') && $user->authorise('core.delete', 'com_sigpro');
         } else {
             $write = true;
         }
         $permissions = array('read' => true, 'write' => $write);
     } else {
         $permissions = array('read' => true, 'write' => false);
     }
     $options = array('roots' => array(array('driver' => 'LocalFileSystem', 'path' => $path, 'URL' => $url, 'accessControl' => 'access', 'defaults' => $permissions)));
     $connector = new elFinderConnector(new elFinder($options));
     $connector->run();
 }
Example #2
0
 function onAfterK2Save(&$item, $isNew)
 {
     jimport('joomla.filesystem.folder');
     JLoader::register('SigProHelper', JPATH_ADMINISTRATOR . '/components/com_sigpro/helper.php');
     $path = SigProHelper::getPath('k2');
     $folder = JRequest::getCmd('sigProFolder');
     if ($isNew && $folder && $folder != $item->id && JFolder::exists($path . '/' . $folder)) {
         JFolder::move($path . '/' . $folder, $path . '/' . $item->id);
     }
     if (JFolder::exists($path . '/' . $item->id) && $item->gallery == null) {
         $item->gallery = '{gallery}' . $item->id . '{/gallery}';
         $item->store();
     }
 }
Example #3
0
 public function display($tpl = null)
 {
     $info = array();
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $info['plg_content_sigpro'] = JFile::exists(JPATH_PLUGINS . '/content/jw_sigpro/jw_sigpro.php');
         $info['plg_k2_sigpro'] = JFile::exists(JPATH_PLUGINS . '/k2/jw_sigpro/jw_sigpro.php');
         $info['plg_editors-xtd_sigpro'] = JFile::exists(JPATH_PLUGINS . '/editors-xtd/jw_sigpro/jw_sigpro.php');
     } else {
         $info['plg_content_sigpro'] = JFile::exists(JPATH_PLUGINS . '/content/jw_sigpro.php');
         $info['plg_k2_sigpro'] = JFile::exists(JPATH_PLUGINS . '/k2/jw_sigpro.php');
         $info['plg_editors-xtd_sigpro'] = JFile::exists(JPATH_PLUGINS . '/editors-xtd/jw_sigpro.php');
     }
     $info['plg_content_sigpro_enabled'] = JPluginHelper::isEnabled('content', 'jw_sigpro');
     $info['plg_k2_sigpro_enabled'] = JPluginHelper::isEnabled('k2', 'jw_sigpro');
     $info['plg_editors-xtd_sigpro_enabled'] = JPluginHelper::isEnabled('editors-xtd', 'jw_sigpro');
     $info['php'] = phpversion();
     if (extension_loaded('gd')) {
         $gdinfo = gd_info();
         $info['gd'] = $gdinfo["GD Version"];
     } else {
         $info['gd'] = false;
     }
     $info['upload'] = ini_get('upload_max_filesize');
     $info['memory'] = ini_get('memory_limit');
     $info['permissions'] = array();
     $info['permissions']['cache'] = is_writable(JPATH_SITE . '/cache');
     if (file_exists(JPATH_SITE . '/cache/jw_sigpro')) {
         $info['permissions']['cache/jw_sigpro'] = is_writable(JPATH_SITE . '/cache/jw_sigpro');
     }
     if (file_exists(JPATH_SITE . '/media/jw_sigpro/users')) {
         $info['permissions']['media/jw_sigpro/users'] = is_writable(JPATH_SITE . '/media/jw_sigpro/users');
     }
     $params = JComponentHelper::getParams('com_sigpro');
     if (version_compare(JVERSION, '1.6.0', 'ge')) {
         $defaultImagePath = 'images';
     } else {
         $defaultImagePath = 'images/stories';
     }
     $path = $params->get('galleries_rootfolder', $defaultImagePath);
     if ($path) {
         $info['permissions'][$path] = is_writable(SigProHelper::getPath('site'));
     }
     $K2Path = SigProHelper::getPath('k2');
     if (JFolder::exists($K2Path)) {
         $info['permissions']['media/k2/galleries'] = is_writable($K2Path);
     }
     $this->assignRef('info', $info);
     parent::display($tpl);
 }
Example #4
0
?>
</i>
				</a>
			</div>
			<div class="sideBarBody">
				<h3 class="sigPurple"><?php 
echo JText::_('COM_SIGPRO_QUICK_HOWTO');
?>
</h3>
				<div class="sideBarDesc"><?php 
echo JText::_('COM_SIGPRO_QUICK_HOWTO_TEXT');
?>
</div>
			</div>
			<?php 
echo SigProHelper::copyrights();
?>
 </div>
		<div class="sigFloatRight sigBoxSizing sidebarHandle"> <a class="sideToggler sig-icon-menu" href="#" ></a>
			<div class="sigProThumbnailsToolbar">
				<?php 
if ($this->view == 'galleries' || $this->view == 'gallery') {
    ?>
				<a href="#landscape" class="sigProRatioButton sigViewLandscape sigHighlighted" title="<?php 
    echo JText::_('COM_SIGPRO_LANDSCAPE');
    ?>
"></a> <a href="#portrait" class="sigProRatioButton sigViewPortrait" title="<?php 
    echo JText::_('COM_SIGPRO_PORTRAIT');
    ?>
"></a>
				<?php 
Example #5
0
 public static function getJSON($array = array())
 {
     if (function_exists('json_encode')) {
         return json_encode($array);
     }
     $object = '{';
     foreach ((array) $array as $k => $v) {
         if (is_null($v)) {
             continue;
         }
         if (!is_array($v) && !is_object($v)) {
             $object .= ' "' . $k . '": ';
             $object .= is_numeric($v) || strpos($v, '\\') === 0 ? is_numeric($v) ? $v : substr($v, 1) : '"' . $v . '"';
             $object .= ',';
         } else {
             $object .= ' ' . $k . ': ' . SigProHelper::getJSON($v) . ',';
         }
     }
     if (substr($object, -1) == ',') {
         $object = substr($object, 0, -1);
     }
     $object .= '}';
     return $object;
 }
Example #6
0
// no direct access
defined('_JEXEC') or die;
// Get application
$application = JFactory::getApplication();
// Check user is logged in
$user = JFactory::getUser();
if ($user->guest) {
    JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
    $application->redirect('index.php');
}
// Load admin language
$language = JFactory::getLanguage();
$language->load('com_sigpro', JPATH_ADMINISTRATOR);
// Load the helper and initialize
JLoader::register('SigProHelper', JPATH_COMPONENT_ADMINISTRATOR . '/helper.php');
SigProHelper::initialize();
// Add model path
if (version_compare(JVERSION, '3.0', 'ge')) {
    JModelLegacy::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/models');
} else {
    JModel::addIncludePath(JPATH_COMPONENT_ADMINISTRATOR . '/models');
}
// Check some variables for security reasons
$view = JRequest::getCmd('view', 'galleries');
if ($view == 'media' || $view == 'info' || $view == 'settings') {
    JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
    $application->redirect('index.php');
}
$type = JRequest::getCmd('type');
if ($type != 'site' && $type != 'k2') {
    JRequest::setVar('type', 'site');
Example #7
0
 public function validate()
 {
     jimport('joomla.filesystem.folder');
     $type = $this->getState('type');
     $path = SigProHelper::getPath($type);
     $folder = $this->getState('folder');
     $response = new stdClass();
     $response->status = 0;
     $response->message = '';
     if (JString::trim($folder) == '') {
         $response->status = 0;
         $response->message = JText::_('COM_SIGPRO_INVALID_FOLDER_NAME');
     } else {
         if (JFolder::exists($path . '/' . $folder)) {
             $response->status = 0;
             $response->message = JText::_('COM_SIGPRO_FOLDER_ALREADY_EXISTS');
         } else {
             $response->status = 1;
             $response->message = JText::_('COM_SIGPRO_FOLDER_DOES_NOT_EXIST');
         }
     }
     return $response;
 }
Example #8
0
 public function delete()
 {
     $db = JFactory::getDBO();
     $path = SigProHelper::getPath($this->getState('type', 'site'));
     $folders = $this->getState('folders', array());
     foreach ($folders as $folder) {
         $folder = SigProHelper::cleanPath($folder);
         $folder = JString::str_ireplace(DIRECTORY_SEPARATOR, '', $folder);
         if ($folder && JFolder::exists($path . '/' . $folder)) {
             JFolder::delete($path . '/' . $folder);
             if ($this->getState('type') == 'k2') {
                 $db->setQuery("UPDATE #__k2_items SET gallery = '' WHERE id = " . (int) $folder);
                 $db->query();
             }
         }
     }
     return true;
 }
Example #9
0
 public function validate()
 {
     $type = JRequest::getCmd('type', 'site');
     $folder = SigProHelper::getVar('folder');
     $model = $this->getModel('gallery');
     $model->setState('type', $type);
     $model->setState('folder', $folder);
     $response = $model->validate();
     echo SigProHelper::getJSON($response);
     exit;
 }