Esempio n. 1
0
 public function onBeforeMain()
 {
     // Load system defines
     if (file_exists(APATH_ROOT . '/defines.php')) {
         include_once APATH_ROOT . '/defines.php';
     }
     if (!defined('_JDEFINES')) {
         define('JPATH_BASE', APATH_SITE);
         require_once JPATH_BASE . '/includes/defines.php';
     }
     // Load the rest of the framework include files
     if (file_exists(JPATH_LIBRARIES . '/import.legacy.php')) {
         require_once JPATH_LIBRARIES . '/import.legacy.php';
     } else {
         require_once JPATH_LIBRARIES . '/import.php';
     }
     require_once JPATH_LIBRARIES . '/cms.php';
     // You can't fix stupid… but you can try working around it
     if (!function_exists('json_encode') || !function_exists('json_decode')) {
         require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/helpers/jsonlib.php';
     }
     // Load the JApplicationCli class
     JLoader::import('joomla.application.web');
     require_once APATH_INSTALLATION . '/angie/assets/runscripts.php';
     $run = JApplicationWeb::getInstance('RunScripts');
     $run->execute();
     return false;
 }
Esempio n. 2
0
 public function createCoupon($key, $pwd)
 {
     // Do I have a key/pwd pair?
     if (!$key || !$pwd) {
         return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_INVALID_CREDENTIALS'));
     }
     $table = $this->getTable();
     $table->load(array('key' => $key, 'password' => $pwd));
     // Are they valid?
     if (!$table->akeebasubs_apicoupon_id || !$table->enabled) {
         return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_INVALID_CREDENTIALS'));
     }
     // Do I hit a limit?
     if (!$this->performApiChecks($table)) {
         return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_LIMIT_EXCEEDED'));
     }
     // If I'm here, I'm clear to go
     JLoader::import('joomla.user.helper');
     $coupon = F0FTable::getAnInstance('Coupon', 'AkeebasubsTable');
     $data['akeebasubs_apicoupon_id'] = $table->akeebasubs_apicoupon_id;
     $data['title'] = 'API coupon for: ' . $table->title;
     $data['coupon'] = strtoupper(JUserHelper::genRandomPassword(10));
     $data['subscriptions'] = $table->subscriptions;
     // By default I want the coupon to be single-use
     $data['hitslimit'] = 1;
     $data['userhits'] = 1;
     $data['type'] = $table->type;
     $data['value'] = $table->value;
     if (!$coupon->save($data)) {
         return array('error' => JText::_('COM_AKEEBASUBS_APICOUPONS_COUPON_ERROR'));
     }
     return array('coupon' => $coupon->coupon);
 }
 public function display($tpl = null)
 {
     // Add toolbar buttons
     JToolBarHelper::title(JText::_('AKEEBA') . ': <small>' . JText::_('VIEWLOG') . '</small>', 'akeeba');
     JToolBarHelper::back('AKEEBA_CONTROLPANEL', 'index.php?option=' . JRequest::getCmd('option'));
     JToolBarHelper::spacer();
     $document = JFactory::getDocument();
     $document->addStyleSheet(JURI::base() . '../media/com_akeeba/theme/akeebaui.css?' . AKEEBAMEDIATAG);
     // Add live help
     AkeebaHelperIncludes::addHelp();
     // Get a list of log names
     if (!class_exists('AkeebaModelLog')) {
         JLoader::import('models.log', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $model = new AkeebaModelLog();
     $this->assign('logs', $model->getLogList());
     $tag = JRequest::getCmd('tag', null);
     if (empty($tag)) {
         $tag = null;
     }
     $this->assign('tag', $tag);
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     if (!class_exists('AkeebaModelProfiles')) {
         JLoader::import('models.profiles', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $model = new AkeebaModelProfiles();
     $model->setId($profileid);
     $profile_data = $model->getProfile();
     $this->assign('profilename', $profile_data->description);
     AkeebaHelperIncludes::includeMedia(false);
     parent::display($tpl);
 }
Esempio n. 4
0
 public static function prepareKbi($lmUrl)
 {
     //TODO vazba na totožnou metodu v dbconnectModelConnections
     $configArr = array('type' => 'LISPMINER', 'name' => 'TEST', 'method' => 'POST', 'url' => $lmUrl);
     JLoader::import('KBIntegrator', JPATH_LIBRARIES . DS . 'kbi');
     return KBIntegrator::create($configArr);
 }
Esempio n. 5
0
 /**
  * Method to get the field input markup with an image tag.
  *
  * @return  string  The field input markup.
  */
 protected function getInput()
 {
     // This Form is used outside of our component, therefor fix the path
     JLoader::import('mapicons', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_simplegeotag' . DS . 'models');
     $model = JModel::getInstance('MapIcons', 'SimpleGeoTagModel');
     $this->items = $model->getItems();
     //var_dump($this->items);
     // Add Google Map's js
     $doc =& JFactory::getDocument();
     /*
     $lang = & JFactory::getLanguage();
     $langcode = $lang->getTag();
     $doc->addScript('http://maps.google.com/maps/api/js?sensor=false&language='.$langcode );
     */
     // Add data to javascript array (for image preview)
     $js = array();
     $js[] = "var mapicons = ";
     $js[] = json_encode($this->items);
     $js[] = ";\n";
     $js[] = "function setMapIcon (val) {\n";
     $js[] = "\tvar mapicon = mapicons.filter(function(item, index, arr) { if(item[\"id\"] == val) return true;  },val)[0];\n";
     $js[] = "\tvar imgtag = \$('jform_metadata_mapicon_img')\n";
     $js[] = "\timgtag.src = mapicon['image'];\n";
     $js[] = "\timgtag.width = mapicon['size_width'];\n";
     $js[] = "\timgtag.height = mapicon['size_height'];\n";
     $js[] = "}\n";
     $doc->addScriptDeclaration(implode($js));
     $this->element['onchange'] = "setMapIcon(this.value)";
     $html = parent::getInput();
     $this->imgid = $this->id . '_' . $this->imgid;
     $html = $html . '<img id="' . $this->imgid . '" src="" />';
     return $html;
 }
 /**
  * Shows the configuration page for this two factor authentication method.
  *
  * @param   object   $otpConfig  The two factor auth configuration object
  * @param   integer  $user_id    The numeric user ID of the user whose form we'll display
  *
  * @return  boolean|string  False if the method is not ours, the HTML of the configuration page otherwise
  *
  * @see     UsersModelUser::getOtpConfig
  * @since   3.2
  */
 public function onUserTwofactorShowConfiguration($otpConfig, $user_id = null)
 {
     if ($otpConfig->method == $this->methodName) {
         // This method is already activated. Reuse the same Yubikey ID.
         $yubikey = $otpConfig->config['yubikey'];
     } else {
         // This methods is not activated yet. We'll need a Yubikey TOTP to setup this Yubikey.
         $yubikey = '';
     }
     // Is this a new TOTP setup? If so, we'll have to show the code validation field.
     $new_totp = $otpConfig->method != $this->methodName;
     // Start output buffering
     @ob_start();
     // Include the form.php from a template override. If none is found use the default.
     $path = FOFPlatform::getInstance()->getTemplateOverridePath('plg_twofactorauth_yubikey', true);
     JLoader::import('joomla.filesystem.file');
     if (JFile::exists($path . '/form.php')) {
         include_once $path . '/form.php';
     } else {
         include_once __DIR__ . '/tmpl/form.php';
     }
     // Stop output buffering and get the form contents
     $html = @ob_get_clean();
     // Return the form contents
     return array('method' => $this->methodName, 'form' => $html);
 }
Esempio n. 7
0
 public function __construct()
 {
     JLoader::import('joomla.filesystem.file');
     //	$isPro = defined('ARS_PRO') ? (ARS_PRO == 1) : false;
     // Load the component parameters, not using JComponentHelper to avoid conflicts ;)
     JLoader::import('joomla.html.parameter');
     JLoader::import('joomla.application.component.helper');
     $db = JFactory::getDbo();
     $sql = $db->getQuery(true)->select($db->quoteName('params'))->from($db->quoteName('#__extensions'))->where($db->quoteName('type') . ' = ' . $db->quote('component'))->where($db->quoteName('element') . ' = ' . $db->quote('com_j2store'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params->loadString($rawparams, 'JSON');
     } else {
         $params->loadJSON($rawparams);
     }
     // Dev releases use the "newest" strategy
     if (substr($this->_currentVersion, 1, 2) == 'ev') {
         $this->_versionStrategy = 'newest';
     } else {
         $this->_versionStrategy = 'vcompare';
     }
     // Get the minimum stability level for updates
     $this->_minStability = $params->get('minstability', 'stable');
     // Do we need authorized URLs?
     $this->_requiresAuthorization = false;
     // Should I use our private CA store?
     if (@file_exists(dirname(__FILE__) . '/../assets/cacert.pem')) {
         $this->_cacerts = dirname(__FILE__) . '/../assets/cacert.pem';
     }
     parent::__construct();
 }
Esempio n. 8
0
 /**
  * Display the view.
  *
  * @param	string	$tpl	The subtemplate to display.
  *
  * @return	void
  */
 function display($tpl = null)
 {
     // Get params
     JLoader::import('helpers.redmigrator', JPATH_COMPONENT_ADMINISTRATOR);
     $params = redMigratorHelper::getParams();
     //
     // Joomla bug: JInstaller not save the defaults params reading config.xml
     //
     $db = JFactory::getDBO();
     if (!$params->method) {
         $default_params = '{"method":"rest","rest_hostname":"http:\\/\\/www.example.org\\/","rest_username":"","rest_password":"","rest_key":"","path":"","driver":"mysql","hostname":"localhost","username":"","password":"","database":"","prefix":"jos_","skip_checks":"0","skip_files":"1","skip_templates":"1","skip_extensions":"1","skip_core_users":"0","skip_core_categories":"0","skip_core_sections":"0","skip_core_contents":"0","skip_core_contents_frontpage":"0","skip_core_menus":"0","skip_core_menus_types":"0","skip_core_modules":"0","skip_core_modules_menu":"0","skip_core_banners":"0","skip_core_banners_clients":"0","skip_core_banners_tracks":"0","skip_core_contacts":"0","skip_core_newsfeeds":"0","skip_core_weblinks":"0","positions":"0","debug":"0"}';
         $query = "UPDATE #__extensions SET `params` = '{$default_params}' WHERE `element` = 'com_redmigrator'";
         $db->setQuery($query);
         $db->query();
         // Get params.. again
         $params = redMigratorHelper::getParams();
     }
     // Load mooTools
     JHtml::_('behavior.framework', true);
     $xmlfile = JPATH_COMPONENT_ADMINISTRATOR . '/redmigrator.xml';
     $xml = JFactory::getXML($xmlfile);
     $this->params = $params;
     $this->version = $xml->version[0];
     parent::display($tpl);
 }
Esempio n. 9
0
 /**
  * Constructor
  *
  * @since 0.1
  */
 function __construct()
 {
     // Include the tables in path
     JLoader::import('xmlrpc', JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'phpxmlrpc');
     JLoader::import('xmlrpcs', JPATH_ROOT . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . 'com_easyblog' . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR . 'phpxmlrpc');
     parent::__construct();
 }
 protected function _getFieldTypes()
 {
     $data = array();
     $core_path = COM_TZ_PORTFOLIO_PLUS_ADDON_PATH . DIRECTORY_SEPARATOR . 'extrafields';
     if ($plg_ex = TZ_Portfolio_PlusPluginHelper::getPlugin('extrafields')) {
         $lang = JFactory::getLanguage();
         $field = $this->form->getData();
         $field = $field->toObject();
         foreach ($plg_ex as $i => $plg) {
             $folder = $plg->name;
             $core_f_xml_path = $core_path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . $folder . '.xml';
             if (JFile::exists($core_f_xml_path)) {
                 $core_class = 'TZ_Portfolio_PlusExtraField' . $folder;
                 if (!class_exists($core_class)) {
                     JLoader::import('com_tz_portfolio_plus.addons.extrafields.' . $folder . '.' . $folder, JPATH_SITE . DIRECTORY_SEPARATOR . 'components');
                 }
                 $core_class = new $core_class($field);
                 $data[$i] = new stdClass();
                 $data[$i]->value = $folder;
                 $core_class->loadLanguage($folder);
                 $key_lang = 'PLG_EXTRAFIELDS_' . strtoupper($folder) . '_TITLE';
                 if ($lang->hasKey($key_lang)) {
                     $data[$i]->text = JText::_($key_lang);
                 } else {
                     $data[$i]->text = (string) $folder;
                 }
             }
         }
     }
     return $data;
 }
Esempio n. 11
0
 /**
  * Publish or unpublish a DataModel item based on its publish_up / publish_down fields
  *
  * @param   DataModel  $row  The DataModel to publish/unpublish
  *
  * @return  void
  */
 protected function publishByDate(DataModel $row)
 {
     static $uNow = null;
     \JLoader::import('joomla.utilities.date');
     if (is_null($uNow)) {
         $jNow = new \JDate();
         $uNow = $jNow->toUnix();
     }
     $db = $this->container->db;
     $triggered = false;
     if ($row->publish_down && $row->publish_down != $db->getNullDate()) {
         $publish_down = $this->normaliseDate($row->publish_down, '2038-01-18 00:00:00');
         $publish_up = $this->normaliseDate($row->publish_up, '2001-01-01 00:00:00');
         $jDown = new \JDate($publish_down);
         $jUp = new \JDate($publish_up);
         if ($uNow >= $jDown->toUnix() && $row->enabled) {
             $row->enabled = 0;
             $triggered = true;
         } elseif ($uNow >= $jUp->toUnix() && !$row->enabled && $uNow < $jDown->toUnix()) {
             $row->enabled = 1;
             $triggered = true;
         }
     }
     if ($triggered) {
         $row->save();
     }
 }
Esempio n. 12
0
 /**
  * do the plug-in action
  * @param	object	parameters
  * @param	object	table model
  * @param	array	custom options
  */
 function process(&$params, &$model, $opts = array())
 {
     JLoader::import('webservice', JPATH_SITE . '/components/com_fabrik/models/');
     $params = $this->getParams();
     $fk = $params->get('webservice_foreign_key');
     $formModel = $model->getFormModel();
     $fk = $formModel->getElement($fk, true)->getElement()->name;
     $credentials = $this->getCredentials();
     $driver = $params->get('webservice_driver');
     $opts = array('driver' => $driver, 'endpoint' => $params->get('webservice_url'), 'credentials' => $credentials);
     $service = FabrikWebService::getInstance($opts);
     if (JError::isError($service)) {
         echo $service->getMessage();
         JError::raiseError(500, $service->getMessage());
         jexit();
     }
     $filters = $this->getServiceFilters($service);
     $service->setMap($this->getMap($formModel));
     $filters = array_merge($opts['credentials'], $filters);
     $method = $params->get('webservice_get_method');
     $startPoint = $params->get('webservice_start_point');
     $serviceData = $service->get($method, $filters, $startPoint, null);
     $update = (bool) $params->get('webservice_update_existing', false);
     $service->storeLocally($model, $serviceData, $fk, $update);
     $this->msg = JText::sprintf($params->get('webservice_msg'), $service->addedCount, $service->updateCount);
     return true;
 }
Esempio n. 13
0
 protected function onAdd($tpl = null)
 {
     /** @var AkeebaModelCpanels $model */
     $model = $this->getModel();
     $aeconfig = Factory::getConfiguration();
     // Load the helper classes
     $this->loadHelper('utils');
     $this->loadHelper('status');
     $statusHelper = AkeebaHelperStatus::getInstance();
     // Load the model
     if (!class_exists('AkeebaModelStatistics')) {
         JLoader::import('models.statistics', JPATH_COMPONENT_ADMINISTRATOR);
     }
     $statmodel = new AkeebaModelStatistics();
     $this->profileid = $model->getProfileID();
     // Active profile ID
     $this->profilelist = $model->getProfilesList();
     // List of available profiles
     $this->statuscell = $statusHelper->getStatusCell();
     // Backup status
     $this->detailscell = $statusHelper->getQuirksCell();
     // Details (warnings)
     $this->statscell = $statmodel->getLatestBackupDetails();
     $this->fixedpermissions = $model->fixMediaPermissions();
     // Fix media/com_akeeba permissions
     $this->needsdlid = $model->needsDownloadID();
     $this->needscoredlidwarning = $model->mustWarnAboutDownloadIDInCore();
     $this->extension_id = $model->getState('extension_id', 0, 'int');
     // Should I ask for permission to display desktop notifications?
     JLoader::import('joomla.application.component.helper');
     $this->desktop_notifications = \Akeeba\Engine\Util\Comconfig::getValue('desktop_notifications', '0') ? 1 : 0;
     $this->statsIframe = F0FModel::getTmpInstance('Stats', 'AkeebaModel')->collectStatistics(true);
     return $this->onDisplay($tpl);
 }
Esempio n. 14
0
 /**
  * Load language overrides for a specific extension. Used to load the
  * custom languages for each plugin, if necessary.
  *
  * @param type $extension
  */
 private static function loadLanguageOverrides($extension, $user = null)
 {
     if (!$user instanceof JUser) {
         $user = JFactory::getUser();
     }
     // Load the language files and their overrides
     $jlang = JFactory::getLanguage();
     // -- English (default fallback)
     $jlang->load($extension, JPATH_ADMINISTRATOR, 'en-GB', true);
     $jlang->load($extension . '.override', JPATH_ADMINISTRATOR, 'en-GB', true);
     // -- Default site language
     $jlang->load($extension, JPATH_ADMINISTRATOR, $jlang->getDefault(), true);
     $jlang->load($extension . '.override', JPATH_ADMINISTRATOR, $jlang->getDefault(), true);
     // -- Current site language
     $jlang->load($extension, JPATH_ADMINISTRATOR, null, true);
     $jlang->load($extension . '.override', JPATH_ADMINISTRATOR, null, true);
     // -- User's preferred language
     JLoader::import('joomla.registry.registry');
     $uparams = is_object($user->params) ? $user->params : new JRegistry($user->params);
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $userlang = $uparams->get('language', '');
     } else {
         $userlang = $uparams->getValue('language', '');
     }
     if (!empty($userlang)) {
         $jlang->load($extension, JPATH_ADMINISTRATOR, $userlang, true);
         $jlang->load($extension . '.override', JPATH_ADMINISTRATOR, $userlang, true);
     }
 }
Esempio n. 15
0
 function __construct()
 {
     parent::__construct();
     $this->registerDefaultTask('create_edit_survey');
     /* create survey */
     $this->registerTask('cancel', 'cancel_form');
     $this->registerTask('form', 'create_edit_survey');
     $this->registerTask('edit_questions', 'edit_questions');
     $this->registerTask('save', 'save_survey');
     $this->registerTask('get_tags', 'get_tags');
     $this->registerTask('save_qn', 'save_question');
     $this->registerTask('delete_qn', 'delete_question');
     $this->registerTask('move_qn', 'move_question');
     $this->registerTask('new_page', 'new_page');
     $this->registerTask('delete_page', 'remove_page');
     $this->registerTask('finalize', 'finalize_survey');
     $this->registerTask('update_order', 'update_ordering');
     $this->registerTask('upload_answer_image', 'upload_answer_image');
     $this->registerTask('save_rule', 'save_conditional_rule');
     $this->registerTask('remove_rule', 'remove_conditional_rule');
     $this->registerTask('copy', 'copy_survey');
     $this->registerTask('rename_page', 'rename_page');
     $this->registerTask('reorder_pages', 'reorder_pages');
     $lang = JFactory::getLanguage();
     $lang->load(S_APP_NAME, JPATH_ROOT);
     JLoader::import('joomla.application.component.model');
     JLoader::import('survey', JPATH_ROOT . '/components/com_communitysurveys/models');
 }
Esempio n. 16
0
File: backup.php Progetto: 01J/topm
 public function browse()
 {
     // Check permissions
     $this->_checkPermissions();
     // Set the profile
     $this->_setProfile();
     // Start the backup
     JLoader::import('joomla.utilities.date');
     AECoreKettenrad::reset(array('maxrun' => 0));
     AEUtilTempfiles::deleteTempFiles();
     AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN);
     $kettenrad = AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
     $dateNow = new JDate();
     $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     $options = array('description' => $description, 'comment' => '');
     $kettenrad->setup($options);
     $kettenrad->tick();
     $kettenrad->tick();
     $array = $kettenrad->getStatusArray();
     AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
     if ($array['Error'] != '') {
         // An error occured
         die('500 ERROR -- ' . $array['Error']);
     } else {
         $noredirect = $this->input->get('noredirect', 0, 'int');
         if ($noredirect != 0) {
             @ob_end_clean();
             echo "301 More work required";
             flush();
             JFactory::getApplication()->close();
         } else {
             $this->_customRedirect(JURI::base() . 'index.php?option=com_akeeba&view=backup&task=step&key=' . $this->input->get('key', '', 'none', 2) . '&profile=' . $this->input->get('profile', 1, 'int'));
         }
     }
 }
Esempio n. 17
0
 public function onAdd($tpl = null)
 {
     $media_folder = JUri::base() . '../media/com_akeeba/';
     // Get a JSON representation of GUI data
     $json = AkeebaHelperEscape::escapeJS(Factory::getEngineParamsProvider()->getJsonGuiDefinition(), '"\\');
     $this->json = $json;
     // Get profile ID
     $profileid = Platform::getInstance()->get_active_profile();
     $this->profileid = $profileid;
     // Get profile name
     $profileName = F0FModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
     $this->profilename = $profileName;
     // Get the root URI for media files
     $this->mediadir = AkeebaHelperEscape::escapeJS($media_folder . 'theme/');
     // Are the settings secured?
     if (Platform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
         $this->securesettings = -1;
     } elseif (!Factory::getSecureSettings()->supportsEncryption()) {
         $this->securesettings = 0;
     } else {
         JLoader::import('joomla.filesystem.file');
         $filename = JPATH_COMPONENT_ADMINISTRATOR . '/engine/serverkey.php';
         if (JFile::exists($filename)) {
             $this->securesettings = 1;
         } else {
             $this->securesettings = 0;
         }
     }
     // Add live help
     AkeebaHelperIncludes::addHelp('config');
 }
Esempio n. 18
0
File: cb.php Progetto: fracting/cmc
 /**
  * Helper task for installing CB plugin later
  *
  * @throws  Exception - if CB not found
  *
  * @return  void
  */
 public function installPlugin()
 {
     JLoader::import("joomla.filesystem.file");
     JLoader::import("joomla.filesystem.folder");
     if (JFile::exists(JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php')) {
         global $_CB_framework;
         require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.foundation.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/plugin.class.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/comprofiler.class.php';
         require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/library/cb/cb.installer.php';
         $plugin = "plug_cmc";
         $cbInstaller = new cbInstallerPlugin();
         if ($cbInstaller->install(JPATH_ROOT . '/components/com_comprofiler/plugin/user/' . $plugin . '/')) {
             $langPath = JPATH_ROOT . '/components/com_comprofiler/plugin/user/' . $plugin . '/administrator/language';
             $cbNames = explode('_', $plugin);
             if (JFolder::exists($langPath)) {
                 $languages = JFolder::folders($langPath);
                 foreach ($languages as $language) {
                     if (JFolder::exists(JPATH_ROOT . '/administrator/language/' . $language)) {
                         JFile::copy($langPath . '/' . $language . '/' . $language . '.plg_' . $cbNames[1] . '.ini', JPATH_ROOT . '/administrator/language/' . $language . '/' . $language . '.plg_' . $cbNames[1] . '.ini');
                     }
                 }
             }
         } else {
             throw new Exception("CB plugin installation failed");
         }
     } else {
         throw new Exception("CB Framework not found", 404);
     }
     $msg = JText::_('COM_CMC_CB_PLUGIN_INSTALLED_SUCCESSFULLY');
     $this->setRedirect('index.php?option=com_cmc&view=lists', $msg);
 }
Esempio n. 19
0
 private function getInvoiceListParameters()
 {
     JLoader::import('joomla.utilities.date');
     $jNow = new JDate();
     $month = $this->input->getInt('month', 0);
     if ($month < 1 || $month > 12) {
         $month = (int) $jNow->format('m');
         $month--;
     }
     $year = $this->input->getInt('year', 0);
     if ($year < 2010 || $year > 2100) {
         $year = (int) $jNow->format('Y');
     }
     if ($month <= 0) {
         $month = 12;
         $year--;
     }
     $vies = false;
     $vatmoss = false;
     switch ($this->getTask()) {
         case 'vies':
             $vies = true;
             break;
         case 'vatmoss':
             $vatmoss = true;
             break;
     }
     $invoiceExtension = $this->input->getCmd('extension', 'akeebasubs');
     return array('month' => $month, 'year' => $year, 'vies' => $vies, 'vatmoss' => $vatmoss, 'extension' => $invoiceExtension);
 }
 /**
  * Method run when installing MageBridge
  */
 public function doInstall()
 {
     // Try to include the file
     $file = 'administrator/components/com_magebridge/helpers/install.php';
     if (is_file(JPATH_ROOT . '/' . $file)) {
         require_once JPATH_ROOT . '/' . $file;
     } else {
         if (is_file(dirname(__FILE__) . '/' . $file)) {
             require_once dirname(__FILE__) . '/' . $file;
         } else {
             return true;
         }
     }
     // Check for PHP version
     if (version_compare(PHP_VERSION, '5.4.0', '<')) {
         return false;
     }
     // Check for Joomla version
     JLoader::import('joomla.version');
     $jversion = new JVersion();
     if (version_compare($jversion->RELEASE, '3.0.0', '<')) {
         return false;
     }
     // Done
     return true;
 }
Esempio n. 21
0
 /**
  * Constructor
  *
  * For php4 compatibility we must not use the __constructor as a constructor for plugins
  * because func_get_args ( void ) returns a copy of all passed arguments NOT references.
  * This causes problems with cross-referencing necessary for the observer design pattern.
  *
  * @param   object  &$subject  The object to observe
  * @param   array   $config    An array that holds the plugin configuration
  *
  * @since	1.0
  */
 public function plgSystemFabrik(&$subject, $config)
 {
     /**
      * Moved these from defines.php to here, to fix an issue with Kunena.  Kunena imports the J!
      * JForm class in their system plugin, in the class constructor  So if we wait till onAfterInitialize
      * to do this, we blow up.  So, import them here, and make sure the Fabrik plugin has a lower ordering
      * than Kunena's.  We might want to set our default to -1.
      */
     $app = JFactory::getApplication();
     $version = new JVersion();
     $base = 'components.com_fabrik.classes.' . str_replace('.', '', $version->RELEASE);
     // Test if Kunena is loaded - if so notify admins
     if (class_exists('KunenaAccess')) {
         $msg = 'Fabrik: Please ensure the Fabrik System plug-in is ordered before the Kunena system plugin';
         if ($app->isAdmin()) {
             $app->enqueueMessage($msg, 'error');
         }
     } else {
         JLoader::import($base . '.field', JPATH_SITE . '/administrator', 'administrator.');
         JLoader::import($base . '.form', JPATH_SITE . '/administrator', 'administrator.');
     }
     if (version_compare($version->RELEASE, '3.1', '<=')) {
         JLoader::import($base . '.layout.layout', JPATH_SITE . '/administrator', 'administrator.');
         JLoader::import($base . '.layout.base', JPATH_SITE . '/administrator', 'administrator.');
         JLoader::import($base . '.layout.file', JPATH_SITE . '/administrator', 'administrator.');
         JLoader::import($base . '.layout.helper', JPATH_SITE . '/administrator', 'administrator.');
     }
     parent::__construct($subject, $config);
 }
 public function getListing()
 {
     JLoader::import('joomla.filesystem.folder');
     $this->applyPath();
     $relpath = $this->getState('filter_path', '');
     $path = JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath;
     $folders_raw = JFolder::folders($path);
     $files_raw = JFolder::files($path);
     if (!empty($relpath)) {
         $relpath .= '/';
     }
     $folders = array();
     if (!empty($folders_raw)) {
         foreach ($folders_raw as $folder) {
             $perms = $this->getPerms($relpath . $folder);
             $currentperms = @fileperms(JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath . $folder);
             $owneruser = function_exists('fileowner') ? fileowner(JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath . $folder) : false;
             $ownergroup = function_exists('filegroup') ? filegroup(JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath . $folder) : false;
             $folders[] = array('item' => $folder, 'path' => $relpath . $folder, 'perms' => $perms, 'realperms' => $currentperms, 'uid' => $owneruser, 'gid' => $ownergroup);
         }
     }
     $files = array();
     if (!empty($files_raw)) {
         foreach ($files_raw as $file) {
             $perms = $this->getPerms($relpath . $file);
             $currentperms = @fileperms(JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath . $file);
             $owneruser = function_exists('fileowner') ? @fileowner(JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath . $file) : false;
             $ownergroup = function_exists('filegroup') ? @filegroup(JPATH_ROOT . DIRECTORY_SEPARATOR . $relpath . $file) : false;
             $files[] = array('item' => $file, 'path' => $relpath . $file, 'perms' => $perms, 'realperms' => $currentperms, 'uid' => $owneruser, 'gid' => $ownergroup);
         }
     }
     $crumbs = explode('/', $relpath);
     return array('folders' => $folders, 'files' => $files, 'crumbs' => $crumbs);
 }
Esempio n. 23
0
 static function getInstance()
 {
     global $nextendexport;
     static $instance;
     if (!is_object($instance)) {
         $instance = new NextendJavascriptjQuery();
         $instance->addJsLibraryFile('njQuery.js');
         $jqueryLoaded = false;
         if (nextendIsJoomla()) {
             JLoader::import('joomla.version');
             $version = new JVersion();
             if (version_compare($version->RELEASE, '3.0', '>=')) {
                 JHtml::_('jquery.framework');
                 $jqueryLoaded = true;
             }
         }
         if ($nextendexport) {
             $jqueryLoaded = false;
         }
         if (!$jqueryLoaded) {
             $instance->addJsLibraryFile('jQuery.js');
         }
         $instance->addJsLibraryFile('uacss.js');
         $instance->addJsLibraryFile('jquery.unique-element-id.js');
     }
     return $instance;
 }
Esempio n. 24
0
 protected function getInput()
 {
     if (version_compare(JVERSION, '3.0.0') == -1) {
         $app = JFactory::getApplication();
         $doc = JFactory::getDocument();
         if (version_compare(PHP_VERSION, '5.2.4') == -1) {
             $app->enqueueMessage(JText::sprintf('MOD_PWEBCONTACT_CONFIG_MSG_PHP_VERSION', '5.2.4'), 'error');
         }
         // jQuery and Bootstrap in Joomla 2.5
         if (!class_exists('JHtmlJquery')) {
             $error = null;
             if (!is_file(JPATH_PLUGINS . '/system/pwebj3ui/pwebj3ui.php')) {
                 $error = JText::sprintf('MOD_PWEBCONTACT_CONFIG_INSTALL_PWEBLEGACY', '<a href="http://www.perfect-web.co/blog/joomla/62-jquery-bootstrap-in-joomla-25" target="_blank">', '</a>');
             } elseif (!JPluginHelper::isEnabled('system', 'pwebj3ui')) {
                 $error = JText::sprintf('MOD_PWEBCONTACT_CONFIG_ENABLE_PWEBLEGACY', '<a href="index.php?option=com_plugins&amp;view=plugins&amp;filter_search=' . urlencode('Perfect Joomla! 3 User Interface') . '" target="_blank">', '</a>');
             } else {
                 JLoader::import('cms.html.jquery', JPATH_PLUGINS . DIRECTORY_SEPARATOR . 'system' . DIRECTORY_SEPARATOR . 'pwebj3ui' . DIRECTORY_SEPARATOR . 'libraries');
             }
             if ($error) {
                 $app->enqueueMessage($error, 'error');
                 $doc->addScriptDeclaration('window.addEvent("domready", function(){' . 'new Element("div", {class: "pweb-fields-tip", html: \'<span class="badge badge-important">' . $error . '</span>\'}).inject(document.id("jform_params_fields"),"top");' . '});');
             }
         }
         $doc->addStyleSheet(JUri::root(true) . '/media/mod_pwebcontact/css/admin_j25.css');
     }
     return null;
 }
 public function onAdd($tpl = null)
 {
     $media_folder = JURI::base() . '../media/com_akeeba/';
     // Get a JSON representation of GUI data
     $json = AkeebaHelperEscape::escapeJS(AEUtilInihelper::getJsonGuiDefinition(), '"\\');
     $this->assignRef('json', $json);
     // Get profile ID
     $profileid = AEPlatform::getInstance()->get_active_profile();
     $this->assign('profileid', $profileid);
     // Get profile name
     $profileName = FOFModel::getTmpInstance('Profiles', 'AkeebaModel')->setId($profileid)->getItem()->description;
     $this->assign('profilename', $profileName);
     // Get the root URI for media files
     $this->assign('mediadir', AkeebaHelperEscape::escapeJS($media_folder . 'theme/'));
     // Are the settings secured?
     if (AEPlatform::getInstance()->get_platform_configuration_option('useencryption', -1) == 0) {
         $this->assign('securesettings', -1);
     } elseif (!AEUtilSecuresettings::supportsEncryption()) {
         $this->assign('securesettings', 0);
     } else {
         JLoader::import('joomla.filesystem.file');
         $filename = JPATH_COMPONENT_ADMINISTRATOR . '/akeeba/serverkey.php';
         if (JFile::exists($filename)) {
             $this->assign('securesettings', 1);
         } else {
             $this->assign('securesettings', 0);
         }
     }
     // Add live help
     AkeebaHelperIncludes::addHelp('config');
 }
Esempio n. 26
0
 /**
  * Process the data for the convert view
  * @return void
  **/
 function _batchedit($tpl = null)
 {
     // Import necessary helpers + library files
     JLoader::import('com_tienda.library.select', JPATH_ADMINISTRATOR . '/components');
     JLoader::import('com_tienda.library.grid', JPATH_ADMINISTRATOR . '/components');
     JLoader::import('com_tienda.library.url', JPATH_ADMINISTRATOR . '/components');
     $model = $this->getModel();
     // set the model state
     $this->assign('state', $model->getState());
     // page-navigation
     $this->assign('pagination', $model->getPagination());
     // list of items
     $items = $model->getList();
     $this->assign('items', $items);
     // set toolbar
     $this->_batcheditToolbar();
     // form
     $validate = JUtility::getToken();
     $form = array();
     $controller = strtolower($this->get('_controller', JRequest::getVar('controller', JRequest::getVar('view'))));
     $view = strtolower($this->get('_view', JRequest::getVar('view')));
     $action = $this->get('_action', "index.php?option=com_tienda&controller={$controller}&view={$view}");
     $form['action'] = $action;
     $form['validate'] = "<input type='hidden' name='{$validate}' value='1' />";
     $this->assign('form', $form);
 }
Esempio n. 27
0
 /**
  * Loads the configuration from the Joomla! global configuration itself. The component's options are loaded into
  * the options key. For example, an option called foobar is accessible as $config->get('options.foobar');
  *
  * @param string  $filePath Ignored
  * @param Phpfunc $phpfunc  Ignored
  *
  * @return  void
  */
 public function loadConfiguration($filePath = null, Phpfunc $phpfunc = null)
 {
     // Get the Joomla! configuration object
     $jConfig = \JFactory::getConfig();
     // Create the basic configuration data
     $data = array('timezone' => $jConfig->get('offset', 'UTC'), 'fs' => array('driver' => 'file'), 'dateformat' => \JText::_('DATE_FORMAT_LC2'), 'base_url' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'live_site' => \JUri::base() . '/index.php?option=com_' . strtolower($this->container->application_name), 'cms_url' => \JUri::base(), 'options' => array());
     // Get the Joomla! FTP layer options
     if (!class_exists('JClientHelper')) {
         \JLoader::import('joomla.client.helper');
     }
     $ftpOptions = \JClientHelper::getCredentials('ftp');
     // If the FTP layer is enabled, enable the Hybrid filesystem engine
     if ($ftpOptions['enabled'] == 1) {
         $data['fs'] = array('driver' => 'hybrid', 'host' => $ftpOptions['host'], 'port' => empty($ftpOptions['port']) ? '21' : $ftpOptions['port'], 'directory' => rtrim($ftpOptions['root'], '/\\'), 'ssl' => false, 'passive' => true, 'username' => $ftpOptions['user'], 'password' => $ftpOptions['pass']);
     }
     // Populate the options key with the component configuration
     $db = $this->container->db;
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('element') . " = " . $db->q('com_' . strtolower($this->container->application_name)));
     try {
         $configJson = $db->setQuery($sql)->loadResult();
     } catch (\Exception $e) {
         $configJson = null;
     }
     if (!empty($configJson)) {
         $data['options'] = json_decode($configJson, true);
     }
     // Finally, load the data to the registry class
     $this->data = new \stdClass();
     $this->loadArray($data);
 }
Esempio n. 28
0
 /**
  * Tries to authenticate the user and start the backup, or send him back to the default task
  */
 public function authenticate()
 {
     // Enforce raw mode - I need to be in full control!
     if (!$this->_checkPermissions()) {
         parent::redirect();
     } else {
         $session = JFactory::getSession();
         $session->set('litemodeauthorized', 1, 'akeeba');
         $this->_setProfile();
         JLoader::import('joomla.utilities.date');
         AECoreKettenrad::reset(array('maxrun' => 0));
         AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN);
         $kettenrad = AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
         $dateNow = new JDate();
         /*
         $user = JFactory::getUser();
         $userTZ = $user->getParam('timezone',0);
         $dateNow->setOffset($userTZ);
         */
         $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
         $options = array('description' => $description, 'comment' => '');
         $kettenrad->setup($options);
         $ret = $kettenrad->tick();
         AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
         JFactory::getApplication()->redirect(JURI::base() . 'index.php?option=com_akeeba&view=light&task=step&key=' . urlencode($this->input->get('key', '', 'none', 2)) . '&profile=' . $this->input->get('profile', 1, 'int') . '&format=raw');
     }
 }
Esempio n. 29
0
 function __construct()
 {
     parent::__construct();
     $this->registerDefaultTask('get_survey_list');
     $this->registerTask('surveys.publish', 'publish_list');
     $this->registerTask('surveys.unpublish', 'unpublish_list');
     $this->registerTask('publish_item', 'publish_item');
     $this->registerTask('unpublish_item', 'unpublish_item');
     $this->registerTask('surveys.delete', 'delete_surveys');
     $this->registerTask('set_private', 'set_private_survey');
     $this->registerTask('unset_private', 'unset_private_survey');
     $this->registerTask('set_anonymous', 'set_anonymous_survey');
     $this->registerTask('unset_anonymous', 'unset_anonymous_survey');
     $this->registerTask('set_publicperms', 'set_public_permissions');
     $this->registerTask('unset_publicperms', 'unset_public_permissions');
     $this->registerTask('refresh', 'refresh_counters');
     $this->registerTask('responses', 'get_responses');
     $this->registerTask('responses.delete', 'delete_responses');
     $this->registerTask('copy', 'copy_surveys');
     $this->registerTask('add', 'add_survey');
     $this->registerTask('edit', 'edit_survey');
     $lang = JFactory::getLanguage();
     $lang->load(S_APP_NAME, JPATH_ROOT);
     JLoader::import('joomla.application.component.model');
     JLoader::import('survey', JPATH_ROOT . DS . 'components' . DS . S_APP_NAME . DS . 'models');
 }
Esempio n. 30
-2
 public function createNewUser($params)
 {
     $user = new JUser(0);
     JLoader::import('joomla.application.component.helper');
     $usersConfig = JComponentHelper::getParams('com_users');
     $newUsertype = $usersConfig->get('new_usertype');
     // get the New User Group from com_users' settings
     if (empty($newUsertype)) {
         $newUsertype = 2;
     }
     $params['groups'] = array($newUsertype);
     $params['sendEmail'] = 0;
     // Set the user's default language to whatever the site's current language is
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $params['params'] = array('language' => JFactory::getConfig()->get('language'));
     } else {
         $params['params'] = array('language' => JFactory::getConfig()->getValue('config.language'));
     }
     JLoader::import('joomla.user.helper');
     $params['block'] = 0;
     $randomString = JUserHelper::genRandomPassword();
     if (version_compare(JVERSION, '3.2', 'ge')) {
         $hash = JApplication::getHash($randomString);
     } else {
         $hash = JFactory::getApplication()->getHash($randomString);
     }
     $params['activation'] = $hash;
     $user->bind($params);
     $userIsSaved = $user->save();
     if ($userIsSaved) {
         return $user->id;
     } else {
         return false;
     }
 }