Ejemplo n.º 1
0
 /**
  * Render the document.
  *
  * @param   boolean  $cache   If true, cache the output
  * @param   array    $params  Associative array of attributes
  *
  * @return  The rendered data
  *
  * @since  3.1
  */
 public function render($cache = false, $params = array())
 {
     JResponse::allowCache($cache);
     JResponse::setHeader('Content-disposition', 'attachment; filename="' . $this->getName() . '.json"', true);
     // Unfortunately, the exact syntax of the Content-Type header
     // is not defined, so we have to try to be a bit clever here.
     $contentType = $this->_mime;
     if (stripos($contentType, 'json') === false) {
         $contentType .= '+' . $this->_type;
     }
     $this->_mime = $contentType;
     parent::render();
     // Get the HAL object from the buffer.
     $hal = $this->getBuffer();
     // If required, change relative links to absolute.
     if ($this->absoluteHrefs && is_object($hal) && isset($hal->_links)) {
         // Adjust hrefs in the _links object.
         $this->relToAbs($hal->_links);
         // Adjust hrefs in the _embedded object (if there is one).
         if (isset($hal->_embedded)) {
             foreach ($hal->_embedded as $rel => $resources) {
                 foreach ($resources as $id => $resource) {
                     if (isset($resource->_links)) {
                         $this->relToAbs($resource->_links);
                     }
                 }
             }
         }
     }
     // Return it as a JSON string.
     return json_encode($hal);
 }
 public function display($tpl = null)
 {
     JResponse::allowCache(true);
     $app = JFactory::getApplication();
     if ($app->input->get('callback', '', 'cmd')) {
         $document = JFactory::getDocument();
         $document->setMimeEncoding('application/javascript');
     }
     $this->categories = $this->get('Categories');
     $this->extensions = $this->get('Extensions');
     $this->breadcrumbs = $this->get('Breadcrumbs');
     $this->orderby = $this->get('OrderBy');
     $this->params = new JRegistry();
     // Temporary params @DELETE
     $this->params->set('extensions_perrow', 4);
     $response = array();
     $response['body'] = array('html' => iconv("UTF-8", "UTF-8//IGNORE", $this->loadTemplate($tpl)), 'pluginuptodate' => $this->get('PluginUpToDate'));
     $response['error'] = false;
     $response['message'] = '';
     $json = new JResponseJson($response['body'], $response['message'], $response['error']);
     if ($app->input->get('callback', '', 'cmd')) {
         echo str_replace(array('\\n', '\\t'), '', $app->input->get('callback') . '(' . $json . ')');
     } else {
         echo str_replace(array('\\n', '\\t'), '', $json);
     }
 }
Ejemplo n.º 3
0
 public function __construct($config = array())
 {
     $name = isset($config['name']) ? $config['name'] : $this->getName();
     $this->document = JFactory::getDocument();
     $this->document->setBase('');
     $this->profiler = KunenaProfiler::instance('Kunena');
     $this->app = JFactory::getApplication();
     $this->me = KunenaUserHelper::getMyself();
     $this->config = KunenaFactory::getConfig();
     $this->ktemplate = KunenaFactory::getTemplate();
     // Set the default template search path
     if ($this->app->isSite() && !isset($config['template_path'])) {
         $config['template_path'] = $this->ktemplate->getTemplatePaths("html/{$name}", true);
     }
     if ($this->app->isAdmin()) {
         $templateAdmin = KunenaFactory::getAdminTemplate();
         $templateAdmin->initialize();
         $config['template_path'] = $templateAdmin->getTemplatePaths($name);
     }
     parent::__construct($config);
     if ($this->app->isSite()) {
         // Add another template file lookup path specific to the current template
         $fallback = JPATH_THEMES . "/{$this->app->getTemplate()}/html/com_kunena/{$this->ktemplate->name}/{$this->getName()}";
         $this->addTemplatePath($fallback);
     }
     // Use our own browser side cache settings.
     JResponse::allowCache(false);
     JResponse::setHeader('Expires', 'Mon, 1 Jan 2001 00:00:00 GMT', true);
     JResponse::setHeader('Last-Modified', gmdate("D, d M Y H:i:s") . ' GMT', true);
     JResponse::setHeader('Cache-Control', 'no-store, must-revalidate, post-check=0, pre-check=0', true);
 }
 function _displayModal($tpl)
 {
     $mainframe = JFactory::getApplication();
     // Do not allow cache
     JResponse::allowCache(false);
     $document = JFactory::getDocument();
     $prjid = array();
     $prjid = JRequest::getVar('prjid', array(0), 'post', 'array');
     $proj_id = (int) $prjid[0];
     //build the html select list for projects
     $projects[] = JHTML::_('select.option', '0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_PROJECT'), 'id', 'name');
     if ($res = JoomleagueHelper::getProjects()) {
         $projects = array_merge($projects, $res);
     }
     $lists['projects'] = JHTMLSelect::genericlist($projects, 'prjid[]', 'class="inputbox" onChange="this.form.submit();" style="width:170px"', 'id', 'name', $proj_id);
     unset($projects);
     $projectteams[] = JHTMLSelect::option('0', JText::_('COM_JOOMLEAGUE_GLOBAL_SELECT_TEAM'), 'value', 'text');
     // if a project is active we show the teams select list
     if ($proj_id > 0) {
         if ($res = JoomleagueHelper::getProjectteams($proj_id)) {
             $projectteams = array_merge($projectteams, $res);
         }
         $lists['projectteams'] = JHTMLSelect::genericlist($projectteams, 'xtid[]', 'class="inputbox" style="width:170px"', 'value', 'text');
         unset($projectteams);
     }
     $this->assignRef('lists', $lists);
     $this->assignRef('project_id', $proj_id);
     parent::display($tpl);
 }
 /**
  * Test...
  *
  * @return void
  */
 public function testAllowCache()
 {
     $this->assertThat(JResponse::allowCache(), $this->equalTo(false));
     JResponse::allowCache(true);
     $this->assertThat(JResponse::allowCache(), $this->equalTo(true));
     $this->assertThat(JResponse::allowCache(false), $this->equalTo(false));
 }
Ejemplo n.º 6
0
 public function testAllowCache()
 {
     $this->assertThat(JResponse::allowCache(), $this->equalTo(FALSE));
     JResponse::allowCache(TRUE);
     $this->assertThat(JResponse::allowCache(), $this->equalTo(TRUE));
     $this->assertThat(JResponse::allowCache(FALSE), $this->equalTo(FALSE));
 }
Ejemplo n.º 7
0
 function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     // Nuevo Jokte 1.3.4
     $clave = JRequest::getVar('clave');
     JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true);
     if ($lang->isRTL()) {
         JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true);
     }
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;");
     $images = $this->get('images');
     $documents = $this->get('documents');
     $folders = $this->get('folders');
     $state = $this->get('state');
     $this->baseURL = COM_MEDIA_BASEURL;
     $this->assignRef('images', $images);
     $this->assignRef('clave', $clave);
     $this->assignRef('documents', $documents);
     $this->assignRef('folders', $folders);
     $this->assignRef('state', $state);
     parent::display($tpl);
 }
Ejemplo n.º 8
0
 public function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     JHtml::_('behavior.framework', true);
     JFactory::getDocument()->addScriptDeclaration("\n\t\twindow.addEvent('domready', function()\n\t\t{\n\t\t\twindow.parent.document.updateUploader();\n\t\t\t\$\$('a.img-preview').each(function(el)\n\t\t\t{\n\t\t\t\tel.addEvent('click', function(e)\n\t\t\t\t{\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t});\n\t\t});");
     $images = $this->get('images');
     $documents = $this->get('documents');
     $folders = $this->get('folders');
     $state = $this->get('state');
     // Check for invalid folder name
     if (empty($state->folder)) {
         $dirname = JRequest::getVar('folder', '', '', 'string');
         if (!empty($dirname)) {
             $dirname = htmlspecialchars($dirname, ENT_COMPAT, 'UTF-8');
             JError::raiseWarning(100, JText::sprintf('COM_MEDIA_ERROR_UNABLE_TO_BROWSE_FOLDER_WARNDIRNAME', $dirname));
         }
     }
     $this->baseURL = JUri::root();
     $this->images =& $images;
     $this->documents =& $documents;
     $this->folders =& $folders;
     $this->state =& $state;
     parent::display($tpl);
 }
Ejemplo n.º 9
0
	/**
	 * Image selection List
	 *
	 */
	function display($tpl = null) {
		$app 		= JFactory::getApplication();
		$option 	= $app->input->getString('option', 'com_jem');

		JHtml::_('behavior.framework');

		if($this->getLayout() == 'uploadimage') {
			$this->_displayuploadimage($tpl);
			return;
		}

		//get vars
		$task 		= $app->input->get('task', '');
		$search 	= $app->getUserStateFromRequest($option.'.filter_search', 'filter_search', '', 'string');
		$search 	= trim(JString::strtolower($search));

		//set variables
		if ($task == 'selecteventimg') {
			$folder = 'events';
			$task 	= 'eventimg';
			$redi	= 'selecteventimg';
		} else if ($task == 'selectvenueimg') {
			$folder = 'venues';
			$task   = 'venueimg';
			$redi   = 'selectvenueimg';
		} else if ($task == 'selectcategoriesimg') {
			$folder = 'categories';
			$task 	= 'categoriesimg';
			$redi	= 'selectcategoriesimg';
		}

		$app->input->set('folder', $folder);

		// Do not allow cache
		JResponse::allowCache(false);

		// Load css
		JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);

		//get images
		$images = $this->get('images');
		$pagination = $this->get('Pagination');

		if (count($images) > 0 || $search) {
			$this->images 		= $images;
			$this->folder 		= $folder;
			$this->task 		= $redi;
			$this->search 		= $search;
			$this->state		= $this->get('state');
			$this->pagination 	= $pagination;
			parent::display($tpl);
		} else {
			//no images in the folder, redirect to uploadscreen and raise notice
			JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_JEM_NO_IMAGES_AVAILABLE'));
			$this->setLayout('uploadimage');
			$app->input->set('task', $task);
			$this->_displayuploadimage($tpl);
			return;
		}
	}
Ejemplo n.º 10
0
 /**
  * Render the document.
  *
  * @param   boolean  $cache   If true, cache the output
  * @param   array    $params  Associative array of attributes
  *
  * @return  The rendered data
  *
  * @since  11.1
  */
 public function render($cache = false, $params = array())
 {
     JResponse::allowCache(false);
     JResponse::setHeader('Content-disposition', 'attachment; filename="' . $this->getName() . '.json"', true);
     parent::render();
     return $this->getBuffer();
 }
Ejemplo n.º 11
0
 /**
  * Render the error page based on an exception.
  *
  * @param   Exception  $error  The exception for which to render the error page.
  *
  * @return  void
  *
  * @since   3.0
  */
 public static function render(Exception $error)
 {
     try {
         $app = JFactory::getApplication();
         $document = JDocument::getInstance('error');
         if (!$document) {
             // We're probably in an CLI environment
             exit($error->getMessage());
             $app->close(0);
         }
         $config = JFactory::getConfig();
         // Get the current template from the application
         $template = $app->getTemplate();
         // Push the error object into the document
         $document->setError($error);
         if (ob_get_contents()) {
             ob_end_clean();
         }
         $document->setTitle(JText::_('Error') . ': ' . $error->getCode());
         $data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => $config->get('debug')));
         // Failsafe to get the error displayed.
         if (empty($data)) {
             exit($error->getMessage());
         } else {
             // Do not allow cache
             JResponse::allowCache(false);
             JResponse::setBody($data);
             echo JResponse::toString();
         }
     } catch (Exception $e) {
         exit('Error displaying the error page: ' . $e->getMessage());
     }
 }
Ejemplo n.º 12
0
 function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     $app = JFactory::getApplication();
     $lang = JFactory::getLanguage();
     JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true);
     if ($lang->isRTL()) {
         JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true);
     }
     $css = '.item{position:relative; width:80px; height:80px; overflow:hidden;}
                 .item .titledoc{position:absolute;width:80px; bottom:0; left:0; padding:1px 0; background-color:#eee;}';
     $document =& JFactory::getDocument();
     //$document->addStyleSheet(   JURI::base().'../plugins/system/fieldsattachment/js/style.css' );
     $document->addStyleDeclaration($css);
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;");
     $images = $this->get('images');
     $folders = $this->get('folders');
     $state = $this->get('state');
     $docs = $this->get('documents');
     $this->assign('baseURL', COM_MEDIA_BASEURL);
     $this->assignRef('images', $images);
     $this->assignRef('folders', $folders);
     $this->assignRef('docs', $docs);
     $this->assignRef('state', $state);
     parent::display($tpl);
 }
Ejemplo n.º 13
0
 function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     $app = JFactory::getApplication();
     $style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
     $lang = JFactory::getLanguage();
     JHtml::_('behavior.framework', true);
     $document = JFactory::getDocument();
     $document->addStyleSheet('../media/media/css/medialist-' . $style . '.css');
     if ($lang->isRTL()) {
         $document->addStyleSheet('../media/media/css/medialist-' . $style . '_rtl.css');
     }
     $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\twindow.parent.document.updateUploader();\n\t\t\t\$\$('a.img-preview').each(function(el) {\n\t\t\t\tel.addEvent('click', function(e) {\n\t\t\t\t\tnew Event(e).stop();\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\n\t\t\t\t});\n\t\t\t});\n\t\t});");
     $images = $this->get('images');
     $documents = $this->get('documents');
     $folders = $this->get('folders');
     $state = $this->get('state');
     $this->baseURL = JURI::root();
     $this->assignRef('images', $images);
     $this->assignRef('documents', $documents);
     $this->assignRef('folders', $folders);
     $this->assignRef('state', $state);
     parent::display($tpl);
 }
Ejemplo n.º 14
0
 function t3_init()
 {
     t3import('core.parameter');
     t3import('core.extendable');
     t3import('core.template');
     t3import('core.basetemplate');
     t3import('core.cache');
     t3import('core.head');
     t3import('core.hook');
     t3import('core.joomla.view');
     if (!class_exists('JModuleHelper', false)) {
         t3import('core.joomla.modulehelper');
     }
     t3import('core.joomla.pagination');
     //Load template language
     $this->loadLanguage('tpl_' . T3_ACTIVE_TEMPLATE, JPATH_SITE);
     $params = T3Common::get_template_based_params();
     //instance cache object.
     $devmode = $params ? $params->get('devmode', '0') == '1' : false;
     T3Cache::getInstance($devmode);
     //Check if enable T3 info mode. Enable by default (if not set)
     if ($params->get('infomode', 1) == 1) {
         if (!JRequest::getCmd('t3info') && JRequest::getCmd('tp')) {
             JRequest::setVar('t3info', JRequest::getCmd('tp'));
         }
     }
     $key = T3Cache::getPageKey();
     $data = null;
     $user =& JFactory::getUser();
     if (!$devmode && JRequest::getCmd('cache') != 'no') {
         T3Cache::setCaching(true);
         JResponse::allowCache(true);
     }
     $data = T3Cache::get($key);
     if ($data) {
         if (!preg_match('#<jdoc:include\\ type="([^"]+)" (.*)\\/>#iU', $data)) {
             $mainframe = JFactory::getApplication();
             $token = JUtility::getToken();
             $search = '#<input type="hidden" name="[0-9a-f]{32}" value="1" />#';
             $replacement = '<input type="hidden" name="' . $token . '" value="1" />';
             $data = preg_replace($search, $replacement, $data);
             JResponse::setBody($data);
             echo JResponse::toString($mainframe->getCfg('gzip'));
             if (JDEBUG) {
                 global $_PROFILER;
                 $_PROFILER->mark('afterCache');
                 echo implode('', $_PROFILER->getBuffer());
             }
             $mainframe->close();
         }
     }
     //Preload template
     t3import('core.preload');
     $preload = T3Preload::getInstance();
     $preload->load();
     $doc =& JFactory::getDocument();
     $t3 = T3Template::getInstance($doc);
     $t3->_html = $data;
 }
Ejemplo n.º 15
0
 /**
  * Send response in JSON-format
  * @param array $data
  * @param bool  $result
  */
 public function send(array $data = array(), $result = true)
 {
     $data['result'] = $result;
     JResponse::allowCache(false);
     JResponse::setHeader('Last-Modified', gmdate('D, d M Y H:i:s', time()) . ' GMT', true);
     JResponse::setHeader('Content-Type', 'application/json; charset=utf-8', true);
     JResponse::sendHeaders();
     jexit(json_encode($data));
 }
Ejemplo n.º 16
0
 /**
  * Image selection List
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $option = JRequest::getCmd('option');
     $document =& JFactory::getDocument();
     if ($this->getLayout() == 'uploadimage') {
         $this->_displayuploadimage($tpl);
         return;
     }
     //get vars
     $task = JRequest::getVar('task');
     $search = $mainframe->getUserStateFromRequest($option . '.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     //set variables
     switch ($task) {
         case 'selecteventimg':
             $folder = 'events';
             $task = 'eventimg';
             $redi = 'selecteventimg';
             break;
         case 'selectvenueimg':
             $folder = 'venues';
             $task = 'venueimg';
             $redi = 'selectvenueimg';
             break;
         case 'selectcategoryimg':
             $folder = 'categories';
             $task = 'categoryimg';
             $redi = 'selectcategoryimg';
             break;
     }
     JRequest::setVar('folder', $folder);
     // Do not allow cache
     JResponse::allowCache(false);
     //add css
     $document->addStyleSheet('components/com_redevent/assets/css/redeventbackend.css');
     //get images
     $images = $this->get('images');
     $pageNav =& $this->get('Pagination');
     if (count($images) > 0 || $search) {
         $this->assignRef('images', $images);
         $this->assignRef('folder', $folder);
         $this->assignRef('task', $redi);
         $this->assignRef('search', $search);
         $this->assignRef('state', $this->get('state'));
         $this->assignRef('pageNav', $pageNav);
         parent::display($tpl);
     } else {
         //no images in the folder, redirect to uploadscreen and raise notice
         RedeventError::raiseNotice('REDEVENT_GENERIC_ERROR', JText::_('COM_REDEVENT_NO_IMAGES_AVAILABLE'));
         $this->setLayout('uploadimage');
         JRequest::setVar('task', $task);
         $this->_displayuploadimage($tpl);
         return;
     }
 }
Ejemplo n.º 17
0
 public function create()
 {
     $output = '';
     $size = JRequest::getCmd('size', '');
     if (!in_array($size, array('min', 'medium'))) {
         throw new Exception('The image size is not recognized', 500);
     }
     $image = JRequest::getVar('image', '');
     $id = JRequest::getInt('id', 0);
     $imagePath = JPATH_ROOT . DS . 'images' . DS . 'com_jea' . DS . 'images' . DS . $id . DS . $image;
     $thumbDir = JPATH_ROOT . DS . 'images' . DS . 'com_jea' . DS . 'thumb-' . $size;
     $thumbPath = $thumbDir . DS . $id . '-' . $image;
     if (file_exists($thumbPath)) {
         $output = readfile($thumbPath);
     } elseif (file_exists($imagePath)) {
         if (!JFolder::exists($thumbPath)) {
             JFolder::create($thumbDir);
         }
         $params = JComponentHelper::getParams('com_jea');
         if ($size == 'medium') {
             $width = $params->get('thumb_medium_width', 400);
             $height = $params->get('thumb_medium_height', 300);
         } else {
             $width = $params->get('thumb_min_width', 120);
             $height = $params->get('thumb_min_height', 90);
         }
         $quality = (int) $params->get('jpg_quality', 90);
         $cropThumbnails = (bool) $params->get('crop_thumbnails', 0);
         $JImage = new JImage($imagePath);
         if ($cropThumbnails) {
             $thumb = $JImage->resize($width, $height, true, JImage::SCALE_OUTSIDE);
             $left = $thumb->getWidth() > $width ? intval(($thumb->getWidth() - $width) / 2) : 0;
             $top = $thumb->getHeight() > $height ? intval(($thumb->getHeight() - $height) / 2) : 0;
             $thumb->crop($width, $height, $left, $top, false);
         } else {
             $thumb = $JImage->resize($width, $height);
         }
         $thumb->toFile($thumbPath, IMAGETYPE_JPEG, array('quality' => $quality));
         $output = readfile($thumbPath);
     } else {
         throw new Exception('The image ' . $image . ' was not found', 500);
     }
     JResponse::setHeader('Content-Type', 'image/jpeg', true);
     JResponse::setHeader('Content-Transfer-Encoding', 'binary');
     JResponse::allowCache(false);
     JResponse::setBody($output);
     echo JResponse::toString();
     exit;
 }
Ejemplo n.º 18
0
 function display($tpl = null)
 {
     global $mainframe;
     // Do not allow cache
     JResponse::allowCache(false);
     JHTML::_('behavior.mootools');
     JHTML::_('stylesheet', 'popup-imagelist.css', 'administrator/components/com_media/assets/');
     $document =& JFactory::getDocument();
     $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;");
     $this->assign('baseURL', COM_MEDIA_BASEURL);
     $this->assignRef('images', $this->get('images'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
Ejemplo n.º 19
0
 public function display($tpl = null)
 {
     JResponse::allowCache(false);
     if (YireoHelper::isJoomla15()) {
         JHTML::_('stylesheet', 'popup-imagelist.css', 'administrator/components/com_media/assets/');
     } else {
         JHTML::_('stylesheet', 'popup-imagelist.css', 'media/media/css/');
     }
     JHTML::_('behavior.mootools');
     JHTML::_('behavior.modal');
     $this->assignRef('files', $this->get('files'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
Ejemplo n.º 20
0
 public function display($tpl = null)
 {
     $params = JComponentHelper::getParams('com_phocagallery');
     JResponse::allowCache(false);
     JHTML::stylesheet('media/com_phocagallery/css/administrator/phocagallery.css');
     $document = JFactory::getDocument();
     //$document->addCustomTag(PhocaGalleryRenderAdmin::renderIeCssLink(1));
     $path = PhocaGalleryPath::getPath();
     $this->field = JRequest::getVar('field');
     $this->fce = 'phocaSelectFolder_' . $this->field;
     $this->assignRef('session', JFactory::getSession());
     $this->assign('path_orig_rel', $path->image_rel);
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
Ejemplo n.º 21
0
 /**
  * Image selection List
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     global $mainframe, $option;
     $document =& JFactory::getDocument();
     if ($this->getLayout() == 'uploadimage') {
         $this->_displayuploadimage($tpl);
         return;
     }
     //get vars
     $task = JRequest::getVar('task');
     $search = $mainframe->getUserStateFromRequest($option . '.search', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     //set variables
     if ($task == 'selecteventimg') {
         $folder = 'events';
         $task = 'eventimg';
         $redi = 'selecteventimg';
     } else {
         $folder = 'venues';
         $task = 'venueimg';
         $redi = 'selectvenueimg';
     }
     JRequest::setVar('folder', $folder);
     // Do not allow cache
     JResponse::allowCache(false);
     //add css
     $document->addStyleSheet('components/com_eventlist/assets/css/eventlistbackend.css');
     //get images
     $images = $this->get('images');
     $pageNav =& $this->get('Pagination');
     if (count($images) > 0 || $search) {
         $this->assignRef('images', $images);
         $this->assignRef('folder', $folder);
         $this->assignRef('task', $redi);
         $this->assignRef('search', $search);
         $this->assignRef('state', $this->get('state'));
         $this->assignRef('pageNav', $pageNav);
         parent::display($tpl);
     } else {
         //no images in the folder, redirect to uploadscreen and raise notice
         JError::raiseNotice('SOME_ERROR_CODE', JText::_('NO IMAGES AVAILABLE'));
         $this->setLayout('uploadimage');
         JRequest::setVar('task', $task);
         $this->_displayuploadimage($tpl);
         return;
     }
 }
Ejemplo n.º 22
0
 public function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     JHtml::_('behavior.framework', true);
     JFactory::getDocument()->addScriptDeclaration("\n\t\twindow.addEvent('domready', function()\n\t\t{\n\t\t\twindow.parent.document.updateUploader();\n\t\t\t\$\$('a.img-preview').each(function(el)\n\t\t\t{\n\t\t\t\tel.addEvent('click', function(e)\n\t\t\t\t{\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t});\n\t\t});");
     $images = $this->get('images');
     $documents = $this->get('documents');
     $folders = $this->get('folders');
     $state = $this->get('state');
     $this->baseURL = JUri::root();
     $this->images =& $images;
     $this->documents =& $documents;
     $this->folders =& $folders;
     $this->state =& $state;
     parent::display($tpl);
 }
Ejemplo n.º 23
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.º 24
0
 function display($tpl = null)
 {
     global $mainframe;
     // Do not allow cache
     JResponse::allowCache(false);
     $style = $mainframe->getUserStateFromRequest('media.list.layout', 'layout', 'thumbs', 'word');
     JHTML::_('behavior.mootools');
     $document =& JFactory::getDocument();
     $document->addStyleSheet('components/com_media/assets/medialist-' . $style . '.css');
     $document->addScriptDeclaration("\r\n\t\twindow.addEvent('domready', function() {\r\n\t\t\twindow.top.document.updateUploader();\r\n\t\t\t\$\$('a.img-preview').each(function(el) {\r\n\t\t\t\tel.addEvent('click', function(e) {\r\n\t\t\t\t\tnew Event(e).stop();\r\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\r\n\t\t\t\t});\r\n\t\t\t});\r\n\t\t});");
     $this->assign('baseURL', JURI::root());
     $this->assignRef('images', $this->get('images'));
     $this->assignRef('documents', $this->get('documents'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
Ejemplo n.º 25
0
 function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     $app = JFactory::getApplication();
     $append = '';
     // if ($app->getClientId() == 1) $append = 'administrator/';
     JHtml::_('behavior.framework', true);
     JHtml::_('stylesheet', 'popup-imagelist.css', $append . 'media/media/');
     $document =& JFactory::getDocument();
     $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;");
     $this->assign('baseURL', COM_MEDIA_BASEURL);
     $this->assignRef('images', $this->get('images'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
 /**
  * Image selection List
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe = JFactory::getApplication();
     $document = JFactory::getDocument();
     if ($this->getLayout() == 'upload') {
         $this->_displayupload($tpl);
         return;
     }
     //get vars
     $type = JRequest::getVar('type');
     $folder = ImageSelectJL::getfolder($type);
     $field = JRequest::getVar('field');
     $fieldid = JRequest::getVar('fieldid');
     $search = $mainframe->getUserStateFromRequest('com_joomleague.imageselect', 'search', '', 'string');
     $search = trim(JString::strtolower($search));
     //add css
     $version = urlencode(JoomleagueHelper::getVersion());
     $document->addStyleSheet('components/com_joomleague/assets/css/imageselect.css?v=' . $version);
     JRequest::setVar('folder', $folder);
     // Do not allow cache
     JResponse::allowCache(false);
     //get images
     $images = $this->get('Images');
     $pageNav =& $this->get('Pagination');
     if (count($images) > 0 || $search) {
         $this->assignRef('images', $images);
         $this->assignRef('type', $type);
         $this->assignRef('folder', $folder);
         $this->assignRef('search', $search);
         $this->assignRef('state', $this->get('state'));
         $this->assignRef('pageNav', $pageNav);
         $this->assignRef('field', $field);
         $this->assignRef('fieldid', $fieldid);
         $this->assignRef('form', $this->get('form'));
         parent::display($tpl);
     } else {
         //no images in the folder, redirect to uploadscreen and raise notice
         JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_JOOMLEAGUE_ADMIN_IMAGEHANDLER_NO_IMAGES'));
         $this->setLayout('upload');
         $this->assignRef('form', $this->get('form'));
         $this->_displayupload($tpl);
         return;
     }
 }
Ejemplo n.º 27
0
 function display($tpl = null)
 {
     // Initialise variables.
     $app = JFactory::getApplication('administrator');
     // Do not allow cache
     JResponse::allowCache(false);
     //$style = $app->getUserStateFromRequest('media.list.layout', 'layout', 'details', 'word');
     $style = "details";
     JHtml::_('behavior.framework', true);
     $document = JFactory::getDocument();
     $document->addStyleSheet('components/' . JACOMPONENT . '/assets/repo_manager/repolist-' . $style . '.css');
     $document->addScriptDeclaration("\n\t\twindow.addEvent('domready', function() {\n\t\t\twindow.top.document.updateUploader && window.top.document.updateUploader();\n\t\t\t\$\$('a.img-preview').each(function(el) {\n\t\t\t\tel.addEvent('click', function(e) {\n\t\t\t\t\tnew Event(e).stop();\n\t\t\t\t\twindow.top.document.preview.fromElement(el);\n\t\t\t\t});\n\t\t\t});\n\t\t});");
     $this->assign('baseURL', JURI::root());
     $this->assignRef('images', $this->get('images'));
     $this->assignRef('documents', $this->get('documents'));
     $this->assignRef('folders', $this->get('folders'));
     $this->assignRef('state', $this->get('state'));
     parent::display($tpl);
 }
Ejemplo n.º 28
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.º 29
0
 public function display($tpl = null)
 {
     // Do not allow cache
     JResponse::allowCache(false);
     $lang = JFactory::getLanguage();
     JHtml::_('stylesheet', 'media/popup-imagelist.css', array(), true);
     if ($lang->isRTL()) {
         JHtml::_('stylesheet', 'media/popup-imagelist_rtl.css', array(), true);
     }
     $document = JFactory::getDocument();
     $document->addScriptDeclaration("var ImageManager = window.parent.ImageManager;");
     $images = $this->get('images');
     $folders = $this->get('folders');
     $state = $this->get('state');
     $this->baseURL = COM_MEDIA_BASEURL;
     $this->images =& $images;
     $this->folders =& $folders;
     $this->state =& $state;
     parent::display($tpl);
 }
Ejemplo n.º 30
0
 function gzip()
 {
     $file = JRequest::getVar('file');
     //clean filepath
     $file = preg_replace('#[?\\#]+.*$#', '', $file);
     //check exists
     $filepath = T3Path::path(dirname($file)) . DS . basename($file);
     if (!is_file($filepath)) {
         echo "File {$file} {$filepath} not exist";
         return;
     }
     $type = strtolower(JRequest::getCmd('type', 'css'));
     //$type must be in css or js
     if (!in_array($type, array('css', 'js'))) {
         echo "Type {$type} not support";
         return;
     }
     //make sure the type of $file is the same with $type
     if (!preg_match('#\\.' . $type . '$#', $filepath)) {
         echo "Type {$type} not match";
         return;
     }
     jimport('joomla.filesystem.file');
     $data = @JFile::read($filepath);
     if (!$data) {
         echo "File {$filepath} empty";
         return;
     }
     if ($type == 'js') {
         $type = 'javascript';
     }
     JResponse::setHeader('Content-Type', "text/{$type};", true);
     //set cache time
     JResponse::setHeader('Cache-Control', "private", true);
     $offset = 365 * 24 * 60 * 60;
     //whenever the content is changed, the file name is changed also. Therefore we could set the cache time long.
     JResponse::setHeader('Expires', gmdate("D, d M Y H:i:s", time() + $offset) . " GMT", true);
     JResponse::allowCache(true);
     JResponse::setBody($data);
     echo JResponse::toString(1);
 }