예제 #1
0
 /**
  * Register JSN Framework initialization.
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     // Initialize JSN Framework
     require_once dirname(__FILE__) . '/libraries/loader.php';
     require_once dirname(__FILE__) . '/jsnframework.defines.php';
     // Get application object
     self::$_app = JFactory::getApplication();
     // Get requested component, view and task
     $this->option = self::$_app->input->getCmd('option');
     $this->view = self::$_app->input->getCmd('view');
     $this->task = self::$_app->input->getCmd('task');
     // Redirect to update page if necessary
     if ($this->option == 'com_installer' and $this->view == 'update' and $this->task == 'update.update' and count($cid = (array) self::$_app->input->getVar('cid', array()))) {
         // Check if extension to updated is JoomlaShine product
         $db = JFactory::getDbo();
         $q = $db->getQuery(true);
         $q->select('element');
         $q->from('#__updates');
         $q->where('update_id = ' . (int) $cid[0]);
         $db->setQuery($q);
         $ext = $db->loadResult();
         if (in_array($ext, JSNVersion::$products)) {
             return self::$_app->redirect('index.php?option=' . $ext . '&view=update');
         }
     }
     // Get active language
     $lang = JFactory::getLanguage();
     // Check if language file exists for active language
     if (!file_exists(JPATH_ROOT . '/administrator/language/' . $lang->get('tag') . '/' . $lang->get('tag') . '.plg_system_jsnframework.ini')) {
         // If requested component has the language file, install then load it
         if (file_exists(JPATH_ROOT . '/administrator/components/' . $this->option . '/language/admin/' . $lang->get('tag') . '/' . $lang->get('tag') . '.plg_system_jsnframework.ini')) {
             JSNLanguageHelper::install((array) $lang->get('tag'), false, true);
             $lang->load('plg_system_jsnframework', JPATH_ADMINISTRATOR, null, true);
         } else {
             $lang->load('plg_system_jsnframework', JSN_PATH_FRAMEWORK, null, true);
         }
     } else {
         $lang->load('plg_system_jsnframework', JPATH_ADMINISTRATOR, null, true);
     }
     // Disable notice and warning by default for our products.
     // The reason for doing this is if any notice or warning appeared then handling JSON string will fail in our code.
     if (function_exists('error_reporting') and in_array($this->option, JSNVersion::$products)) {
         error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT);
     }
     // Set event handlers to detect and update dependency installation / removal
     self::$_app->registerEvent('onExtensionAfterInstall', 'jsnExtFrameworkUpdateDependencyAfterInstallExtension');
     self::$_app->registerEvent('onExtensionBeforeUninstall', 'jsnExtFrameworkUpdateDependencyBeforeUninstallExtension');
     // Do update checking for Joomla! 3.1
     if (self::$_app->isAdmin() and JSNVersion::isJoomlaCompatible('3.1') and in_array($this->option, JSNVersion::$products) and $this->task == 'checkUpdate') {
         $content = $this->checkUpdate();
         // Set header for XML content
         header('Content-Type: application/xml');
         // Send XML content to client
         echo $content;
         // Exit immediately to prevent Joomla! to process further
         exit;
     }
 }
예제 #2
0
// No direct access to this file
define('_JEXEC', '1');
defined('_JEXEC') or die('Restricted access');
// Shorten directory separator constant
define('DS', DIRECTORY_SEPARATOR);
// Define base directory
define('JPATH_BASE', str_replace('/', DIRECTORY_SEPARATOR, str_replace('plugins/system/jsnmobilize/libraries/joomlashine/response/image/resizer.php', '', str_replace('\\', '/', __FILE__))));
// Initialize Joomla framework
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';
// Instantiate the application
$app = JFactory::getApplication('site');
// Initialize JSN Framework
require_once JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jsnframework' . DS . 'jsnframework.php';
$dispatcher = JDispatcher::getInstance();
$jsnframework = new PlgSystemJSNFramework($dispatcher);
$jsnframework->onAfterInitialise();
// Initialize JSN Mobilize
require_once JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'jsnmobilize' . DS . 'jsnmobilize.php';
$jsnmobilize = new PlgSystemJSNMobilize($dispatcher);
$jsnmobilize->onAfterInitialise();
// Initialize variables
if (!isset($_REQUEST['src']) or !isset($_REQUEST['width']) or !isset($_REQUEST['dest'])) {
    jexit(JText::_('JSN_MOBILIZE_INVALID_REQUEST'));
}
$src = $_REQUEST['src'];
$width = $_REQUEST['width'];
$dest = $_REQUEST['dest'];
// Load necessary Joomla libraries
jimport('joomla.filesystem.file');
jimport('joomla.filesystem.folder');