public function getInput() { jimport('joomla.filesystem.file'); $mainframe = JFactory::getApplication(); if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php')) { $mainframe->enqueueMessage(JText::_('JM_PLEASE_INSTALL_JOOMLAMAILER'), 'error'); $mainframe->redirect('index.php'); } $listId = $this->form->getValue('listid', 'params'); require_once JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/libraries/MCAPI.class.php'; $params = JComponentHelper::getParams('com_joomailermailchimpintegration'); $MCapi = $params->get('params.MCapi'); $api = new joomlamailerMCAPI($MCapi); $interests = $api->listInterestGroupings($listId); $options = array(); if ($interests) { foreach ($interests as $interest) { if ($interest['form_field'] != 'hidden') { $groups = array(); foreach ($interest['groups'] as $ig) { $groups[] = $ig['name']; } $groups = implode('####', $groups); $options[] = array('id' => $interest['id'] . ';' . $interest['form_field'] . ';' . $interest['name'] . ';' . $groups, 'name' => $interest['name']); } } } if (count($options)) { return JHtml::_('select.genericlist', $options, 'jform[params][interests][]', 'multiple="multiple"', 'id', 'name', $this->value, $this->id); } else { return JText::_('JM_NO_INTEREST_GROUPS'); } }
/** * Display * * @param string $tmpl Template * * @return void */ public function display($tmpl = 'default') { $srcs = FabrikHelperHTML::framework(); $app = JFactory::getApplication(); $input = $app->input; FabrikHelperHTML::script($srcs); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId($input->getInt('id', $usersConfig->get('visualizationid', $input->getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModelLegacy::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, FText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } // Plugin is basically a model $pluginTask = $input->get('plugintask', 'render', 'request'); // @FIXME cant set params directly like this, but I think plugin model setParams() is not right $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin = $plugin; $viewName = $this->getName(); $this->addTemplatePath($this->_basePath . '/plugins/' . $this->_name . '/' . $plugin->_name . '/tmpl/' . $tmpl); $root = $app->isAdmin() ? JPATH_ADMINISTRATOR : JPATH_SITE; $this->addTemplatePath($root . '/templates/' . $app->getTemplate() . '/html/com_fabrik/visualization/' . $plugin->_name . '/' . $tmpl); $ab_css_file = JPATH_SITE . '/plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/template.css'; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } echo parent::display(); }
public static function ListExtensions(&$extensions) { $root = JURI::root() . '../../'; $base = JPATH_PLUGINS . DS . 'editors' . DS . 'jckeditor' . DS . 'plugins'; $db = JFactory::getDBO(); $query = ' SELECT ext.name FROM #__jckplugins ext INNER JOIN #__jckplugins parent on parent.id = ext.parentid WHERE parent.name = "jtreelink" AND parent.published = 1 AND ext.published = 1'; $db->setQuery($query); $results = $db->loadResultArray(); if (empty($results)) { return; } foreach ($results as $extension) { $path = $base . DS . $extension . DS . 'images' . DS . 'icon.gif'; $url = $root . $extension . '/images/icon.gif'; $icon = array('_open', '_closed'); //We default to default icon if no custom icon has been supplied by plugin. if (JFile::exists($path)) { $icon = array($url, $url); } else { $path = $base . DS . $extension . DS . 'images' . DS . 'icon.png'; $url = $root . $extension . '/images/icon.png'; if (JFile::exists($path)) { $icon = array($url, $url); } } $extensions[$extension] = $icon; } }
function display($tmpl = 'default') { FabrikHelperHTML::framework(); $model = $this->getModel(); $usersConfig = JComponentHelper::getParams('com_fabrik'); $model->setId(JRequest::getVar('id', $usersConfig->get('visualizationid', JRequest::getInt('visualizationid', 0)))); $visualization = $model->getVisualization(); $pluginParams = $model->getPluginParams(); $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikModel'); $plugin = $pluginManager->getPlugIn($visualization->plugin, 'visualization'); $plugin->_row = $visualization; if ($visualization->published == 0) { return JError::raiseWarning(500, JText::_('COM_FABRIK_SORRY_THIS_VISUALIZATION_IS_UNPUBLISHED')); } //plugin is basically a model $pluginTask = JRequest::getVar('plugintask', 'render', 'request'); // @FIXME cant set params directly like this, but I think plugin model setParams() is not right $plugin->_params = $pluginParams; $tmpl = $plugin->getParams()->get('calendar_layout', $tmpl); $plugin->{$pluginTask}($this); $this->plugin = $plugin; $viewName = $this->getName(); $this->addTemplatePath($this->_basePath . DS . 'plugins' . DS . $this->_name . DS . $plugin->_name . DS . 'tmpl' . DS . $tmpl); $this->addTemplatePath(JPATH_SITE . DS . 'templates' . DS . $app->getTemplate() . DS . 'html' . DS . 'com_fabrik' . DS . 'visualization' . DS . $plugin->_name . DS . $tmpl); $ab_css_file = JPATH_SITE . "/plugins/fabrik_visualization/" . $plugin->_name . "/tmpl/{$tmpl}/template.css"; if (JFile::exists($ab_css_file)) { JHTML::stylesheet('template.css', 'plugins/fabrik_visualization/' . $plugin->_name . '/tmpl/' . $tmpl . '/', true); } echo parent::display(); }
public function postflight($type, $parent) { $db = JFactory::getDBO(); $db->setQuery("UPDATE #__extensions SET enabled = 0 WHERE client_id = 1 AND element = " . $db->Quote($parent->get('element'))); $db->query(); $status = new stdClass(); $status->plugins = array(); $src = $parent->getParent()->getPath('source'); $manifest = $parent->getParent()->manifest; $plugins = $manifest->xpath('plugins/plugin'); foreach ($plugins as $plugin) { $name = (string) $plugin->attributes()->plugin; $group = (string) $plugin->attributes()->group; $path = $src . '/plugins/' . $group . '/' . $name; $installer = new JInstaller(); $result = $installer->install($path); if ($result) { if (JFile::exists(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml')) { JFile::delete(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml'); } JFile::move(JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.j25.xml', JPATH_SITE . '/plugins/' . $group . '/' . $name . '/' . $name . '.xml'); } $query = "UPDATE #__extensions SET enabled=1, ordering=99 WHERE type='plugin' AND element=" . $db->Quote($name) . " AND folder=" . $db->Quote($group); $db->setQuery($query); $db->query(); $status->plugins[] = array('name' => $name, 'group' => $group, 'result' => $result); } $this->installationResults($status); }
/** * Storing entity by ORM table * * @access public * @return boolean */ public function storeEntity($buffer = null) { try { // Data posted required, otherwise avoid write anything if (!$buffer) { throw new JMapException(JText::_('COM_JMAP_HTACCESS_NO_DATA'), 'error'); } $targetHtaccess = null; // Find htaccess file if (JFile::exists(JPATH_ROOT . '/.htaccess')) { $targetHtaccess = JPATH_ROOT . '/.htaccess'; } elseif (JFile::exists(JPATH_ROOT . '/htaccess.txt')) { // Fallback on txt dummy version $targetHtaccess = JPATH_ROOT . '/htaccess.txt'; $this->setState('htaccess_version', 'textual'); } else { throw new JMapException(JText::_('COM_JMAP_HTACCESS_NOTFOUND'), 'error'); } // If file permissions ko on rewrite updated contents if (!is_writable($targetHtaccess)) { @chmod($targetHtaccess, 0777); } if (@(!JFile::write($targetHtaccess, $buffer))) { throw new JMapException(JText::_('COM_JMAP_ERROR_WRITING_HTACCESS'), 'error'); } } catch (JMapException $e) { $this->setError($e); return false; } catch (Exception $e) { $jmapException = new JMapException($e->getMessage(), 'error'); $this->setError($jmapException); return false; } return true; }
/** * 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); }
function language() { $app = JFactory::getApplication(); $code = JRequest::getString('code'); if (empty($code)) { $app->enqueueMessage(JText::_('Code not specified', true)); return; } $file = new stdClass(); $file->name = $code; $path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . DS . $code . DS . $code . getBookingExtName() . '.ini'; $file->path = $path; jimport('joomla.filesystem.file'); $showLatest = true; $loadLatest = false; if (JFile::exists($path)) { $file->content = JFile::read($path); if (empty($file->content)) { $app->enqueueMessage('File not found : ' . $path); } } else { $loadLatest = true; $file->content = JFile::read(JPATH_COMPONENT_ADMINISTRATOR . DS . 'language' . 'en-GB' . DS . 'en-GB.' . getBookingExtName() . '.ini'); } $this->assignRef('file', $file); $tpl = "language"; return $tpl; }
/** * Get language items and store them in an array * */ function getTrans($lang, $item) { $app = JFactory::getApplication(); $option = 'com_osmembership'; $registry = new JRegistry(); $languages = array(); if (strpos($item, 'admin.') !== false) { $isAdmin = true; $item = substr($item, 6); } else { $isAdmin = false; } if ($isAdmin) { $path = JPATH_ROOT . '/administrator/language/en-GB/en-GB.' . $item . '.ini'; } else { $path = JPATH_ROOT . '/language/en-GB/en-GB.' . $item . '.ini'; } $registry->loadFile($path, 'INI'); $languages['en-GB'][$item] = $registry->toArray(); if ($isAdmin) { $path = JPATH_ROOT . '/administrator/language/' . $lang . '/' . $lang . '.' . $item . '.ini'; } else { $path = JPATH_ROOT . '/language/' . $lang . '/' . $lang . '.' . $item . '.ini'; } $search = $app->getUserStateFromRequest($option . 'search', 'search', '', 'string'); $search = JString::strtolower($search); if (JFile::exists($path)) { $registry->loadFile($path, 'INI'); $languages[$lang][$item] = $registry->toArray(); } else { $languages[$lang][$item] = array(); } return $languages; }
/** * Load properties from a given file properties * * @param $file string The filename to scan * @param $contents boolean Load the contents * @param $loadId boolean Load id from database * @return boolean result */ function loadFromFile($file, $contents = false, $loadId = false) { if (!JFile::exists($file) && !JFolder::exists($file . DS)) { return false; } $info = @stat($file); $this->scandate = $this->_db->getNullDate(); $this->filename = basename($file); $this->fullpath = $file; $this->permission = fileperms($file) & 0777; $this->size = filesize($file); $ctime =& JFactory::getDate($info['ctime']); $mtime =& JFactory::getDate($info['mtime']); $this->ctime = $ctime->toMySQL(); $this->mtime = $mtime->toMySQL(); $this->uid = $info['uid']; $this->gid = $info['gid']; $this->type = ''; if (is_file($file)) { $this->type = 'file'; $this->hash_md = md5_file($file); if ($contents) { $f = new JD_File($file); $this->contents = $f->read(); } } elseif (is_dir($file)) { $this->type = 'dir'; } if ($loadId) { $this->_db->setQuery('SELECT id FROM #__jdefender_filesystem WHERE fullpath = ' . $this->fullpath . ' LIMIT 1'); $this->id = $this->_db->loadResult(); } return true; }
protected function getInput() { $this->params = $this->element->attributes(); $extension = $this->get('extension'); $xml = $this->get('xml'); if (!$xml && $this->form->getValue('element')) { if ($this->form->getValue('folder')) { $xml = 'plugins/' . $this->form->getValue('folder') . '/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml'; } else { $xml = 'administrator/modules/' . $this->form->getValue('element') . '/' . $this->form->getValue('element') . '.xml'; } if (!JFile::exists(JPATH_SITE . '/' . $xml)) { return ''; } } if (!strlen($extension) || !strlen($xml)) { return ''; } $authorise = JFactory::getUser()->authorise('core.manage', 'com_installer'); if (!$authorise) { return ''; } require_once JPATH_PLUGINS . '/system/nnframework/helpers/versions.php'; return '</div><div class="hide">' . nnVersions::getInstance()->getMessage($extension, $xml); }
function com_uninstall() { jimport('joomla.filesystem.file'); jimport('joomla.version'); $version = new JVersion(); if (version_compare($version->getShortVersion(), '1.6', '>=')) { $db = JFactory::getDBO(); $db->setQuery("Delete From #__menu Where `link` Like 'index.php?option=com_breezingforms&act=%'"); $db->query(); $db->setQuery("Delete From #__menu Where `alias` Like 'BreezingForms' And `path` Like 'breezingforms'"); $db->query(); } if (JFile::exists(JPATH_SITE . DS . 'media' . DS . 'breezingforms' . DS . 'facileforms.config.php')) { JFile::delete(JPATH_SITE . DS . 'media' . DS . 'breezingforms' . DS . 'facileforms.config.php'); } if (JFile::exists(JPATH_SITE . "/components/com_sh404sef/sef_ext/com_breezingforms.php")) { JFile::delete(JPATH_SITE . "/components/com_sh404sef/sef_ext/com_breezingforms.php"); } if (JFile::exists(JPATH_SITE . '/ff_secimage.php')) { JFile::delete(JPATH_SITE . '/ff_secimage.php'); } if (JFile::exists(JPATH_SITE . '/templates/system/ff_secimage.php')) { JFile::delete(JPATH_SITE . '/templates/system/ff_secimage.php'); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/breezingforms_elements.xml")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/breezingforms_elements.xml"); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformFilter.php")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformFilter.php"); } if (JFile::exists(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformoptions_emptyFilter.php")) { JFile::delete(JPATH_SITE . "/administrator/components/com_joomfish/contentelements/translationFformoptions_emptyFilter.php"); } }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function onDisplay($name) { jimport('joomla.filesystem.file'); // return if system plugin is not installed if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.php')) { return; } // return if NoNumber! Elements plugin is not installed if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'nonumberelements.php')) { return; } // load the admin language file $lang =& JFactory::getLanguage(); if ($lang->getTag() != 'en-GB') { // Loads English language file as fallback (for undefined stuff in other language file) $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, 'en-GB'); } $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, null, 1); // Load system plugin parameters require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'parameters.php'; $parameters =& NNParameters::getParameters(); $system_params = JPluginHelper::getPlugin('system', $this->_name); $params = $parameters->getParams($system_params->params, JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.xml'); // Include the Helper require_once JPATH_PLUGINS . DS . $this->_type . DS . $this->_name . DS . 'helper.php'; $class = get_class($this) . 'Helper'; $this->helper = new $class($params); return $this->helper->render($name); }
function render($position) { /** @var $gantry Gantry */ global $gantry; // default location for custom icon is {template}/images/logo/logo.png, with 'perstyle' it's // located in {template}/images/logo/styleX/logo.png if ($gantry->get("logo-autosize")) { jimport('joomla.filesystem.file'); $path = $gantry->templatePath . '/' . 'images' . '/' . 'logo'; $logocss = $gantry->get('logo-css', 'body #rt-logo'); // get proper path based on perstyle hidden param $path = intval($gantry->get("logo-perstyle", 0)) === 1 ? $path . '/' . $gantry->get("cssstyle") . '/' : $path . '/'; // append logo file $path .= 'logo.png'; // if the logo exists, get it's dimentions and add them inline if (JFile::exists($path)) { $logosize = getimagesize($path); if (isset($logosize[0]) && isset($logosize[1])) { $gantry->addInlineStyle($logocss . ' {width:' . $logosize[0] . 'px;height:' . $logosize[1] . 'px;}'); } } } ob_start(); ?> <div class="rt-block"> <a href="<?php echo $gantry->baseUrl; ?> " id="rt-logo"></a> </div> <?php return ob_get_clean(); }
public function getTemplates() { $items = array(); $tpl_path = COM_TZ_PORTFOLIO_PLUS_PATH_SITE . DIRECTORY_SEPARATOR . 'templates'; if (!JFolder::exists($tpl_path)) { return false; } if ($folders = JFolder::folders($tpl_path)) { if (count($folders)) { foreach ($folders as $i => $folder) { $xmlFile = $tpl_path . DIRECTORY_SEPARATOR . $folder . DIRECTORY_SEPARATOR . 'template.xml'; if (JFile::exists($xmlFile)) { $installer = JInstaller::getInstance($tpl_path . DIRECTORY_SEPARATOR . $folder); if ($manifest = $installer->isManifest($xmlFile)) { $lang = JFactory::getLanguage(); $lang->load('tpl_' . (string) $manifest->name, $tpl_path . DIRECTORY_SEPARATOR . $folder); $item = new stdClass(); $item->id = $i; $item->name = (string) $manifest->name; $item->type = (string) $manifest->type; $item->version = (string) $manifest->version; $item->creationDate = (string) $manifest->creationDate; $item->author = (string) $manifest->author; $item->authorEmail = (string) $manifest->authorEmail; $item->description = JText::_((string) $manifest->description); $items[] = $item; } } } } } return $items; // var_dump(JFolder::folders($tpl_path)); die(); }
function getStyles() { jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); wfimport('admin.helpers.extension'); $view = JRequest::getCmd('view', 'cpanel'); $component = WFExtensionHelper::getComponent(); $params = new WFParameter($component->params); $theme = $params->get('preferences.theme', 'jce'); $site_path = JPATH_COMPONENT_SITE . DS . 'editor' . DS . 'libraries' . DS . 'css'; $admin_path = JPATH_COMPONENT_ADMINISTRATOR . DS . 'media' . DS . 'css'; // Load styles $styles = array(); if (!JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) { $theme = 'jce'; } if (JFolder::exists($site_path . DS . 'jquery' . DS . $theme)) { $files = JFolder::files($site_path . DS . 'jquery' . DS . $theme, '\\.css'); foreach ($files as $file) { $styles[] = 'components/com_jce/editor/libraries/css/jquery/' . $theme . '/' . $file; } } // admin global css $styles = array_merge($styles, array('administrator/components/com_jce/media/css/global.css')); if (JFile::exists($admin_path . DS . $view . '.css')) { $styles[] = 'administrator/components/com_jce/media/css/' . $view . '.css'; } return $styles; }
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'); }
/** * Display the button * * @return array A two element array of ( imageName, textToInsert ) */ function onDisplay($name) { jimport('joomla.filesystem.file'); // return if system plugin is not installed if (!JFile::exists(JPATH_PLUGINS . '/system/' . $this->_name . '/' . $this->_name . '.php')) { return; } // return if NoNumber Framework plugin is not installed if (!JFile::exists(JPATH_PLUGINS . '/system/nnframework/nnframework.php')) { return; } // load the admin language file $lang = JFactory::getLanguage(); if ($lang->getTag() != 'en-GB') { // Loads English language file as fallback (for undefined stuff in other language file) $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, 'en-GB'); } $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, null, 1); // Load plugin parameters require_once JPATH_PLUGINS . '/system/nnframework/helpers/parameters.php'; $parameters = NNParameters::getInstance(); $params = $parameters->getPluginParams($this->_name); // Include the Helper require_once JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name . '/helper.php'; $class = get_class($this) . 'Helper'; $this->helper = new $class($params); return $this->helper->render($name); }
private function filter($message, $type = 'exception') { $adapterFile = dirname(__FILE__) . '/adapters/' . $type . '.php'; // If the file does not exist, return missing adapter file error. // e.g. Could not locate adapter file for exception type - file.' if (!JFile::exists($adapterFile)) { $this->set(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_ADAPTER_INVALID_FILE_ERROR', $type)); return; } // Load the adapter require_once $adapterFile; // Construct adapter classname $adapterClass = 'SocialException' . ucfirst($type); // If the file does not exist, return missing adapter class error // e.g. Could not locate adapter class for exception class - SocialExceptionFile.' if (!class_exists($adapterClass)) { $this->set(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_ADAPTER_INVALID_CLASS_ERROR', $adapterClass)); return; } // Ask adapter to parse message $exception = call_user_func_array(array($adapterClass, 'filter'), array($message)); // If adapter did not return any exception if (empty($exception)) { // Set to the default adapter error of unkown adapter error, // e.g. Unknown file error. $this->set(JText::sprintf('COM_EASYSOCIAL_EXCEPTION_ADAPTER_UNKNOWN_ERROR', $type)); // Parse exception } else { $this->parse($exception, SOCIAL_EXCEPTION_MESSAGE); } }
/** * Executes the action associated with an item * * @return void * * @since 3.2 */ public function action() { // CSRF prevention if ($this->csrfProtection) { $this->_csrfProtection(); } $model = $this->getThisModel(); if (!$model->getId()) { $model->setIDsFromRequest(); } $item = $model->getItem(); switch ($item->type) { case 'link': $this->setRedirect($item->action); return; break; case 'action': jimport('joomla.filesystem.file'); $file = FOFTemplateUtils::parsePath($item->action_file, true); if (JFile::exists($file)) { require_once $file; call_user_func($item->action); } break; case 'message': default: break; } $this->setRedirect('index.php?option=com_postinstall'); }
/** * Set admin toolbar title and auto add page title to HTML head document. */ static function title($title, $icon = 'generic.png') { $doc = JFactory::getDocument(); $app = JFactory::getApplication(); $doc->setTitle($title); $view = JRequest::getVar('view'); $layout = JRequest::getVar('layout', 'default'); $option = JRequest::getVar('option'); // Strip the extension. $icons = explode(' ', $icon); foreach ($icons as &$icon) { $icon = 'icon-48-' . preg_replace('#\\.[^.]*$#', '', $icon); } $class = "header-{$view}-{$layout}"; $img = "components/{$option}/images/admin-icons/{$class}.png"; if (JFile::exists(JPATH_ADMINISTRATOR . '/' . $img)) { $icon = $class; } if (JVERSION >= 3) { $icon = null; } $admin = $app->isSite() ? JURI::root() . 'administrator/' : ''; $img = $admin . "components/{$option}/images/admin-icons/{$class}.png"; $doc->addStyleDeclaration("\n.{$class} {\n background: url({$img}) no-repeat;\n}\n "); $html = '<div class="pagetitle ' . htmlspecialchars($icon) . '"><h2>' . $title . '</h2></div>'; //$html = $title ; $app->JComponentTitle = $html; }
/** * onAfterInitialise handler * * * @access public * @return null */ public function onAfterInitialise() { // make sure ZOO exists jimport('joomla.filesystem.file'); if (!JFile::exists(JPATH_ADMINISTRATOR . '/components/com_zoo/config.php') || !JComponentHelper::getComponent('com_zoo', true)->enabled) { return; } // load zoo require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; // check if Zoo > 2.4 is loaded if (!class_exists('App')) { return; } // get zoo instance $this->zoo = App::getInstance('zoo'); // check if Zoo > 2.5 if (version_compare($this->zoo->zoo->version(), '2.5') < 0) { return; } // load zoo language file $this->zoo->system->language->load('com_' . $this->zoo->id); // register plugin paths $path = $this->zoo->path->path('plugins:system/herdboyzoo/'); // register element path $this->zoo->path->register($path . '/elements', 'elements'); }
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; }
public function _addSubmenu() { $mySQLVer = 0; if (JFile::exists(JPATH_COMPONENT . '/libraries/advancesearch.php')) { require_once JPATH_COMPONENT . '/libraries/advancesearch.php'; $mySQLVer = CAdvanceSearch::getMySQLVersion(); } // Only display related links for guests $my = CFactory::getUser(); $config = CFactory::getConfig(); if ($my->id == 0) { // $tmpl = new CTemplate(); // $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search')); // $html = $tmpl->fetch('search.submenu'); // $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html); if ($mySQLVer >= 4.1 && $config->get('guestsearch')) { $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH')); } } else { $this->addSubmenuItem('index.php?option=com_community&view=search&task=browse', JText::_('COM_COMMUNITY_ALL_MEMBERS')); // $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH')); $tmpl = new CTemplate(); $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search')); if ($mySQLVer >= 4.1) { $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH')); } } }
function submissionsViewFile() { $lang = JFactory::getLanguage(); $lang->load('com_rsform', JPATH_ADMINISTRATOR); $hash = JRequest::getCmd('hash'); if (strlen($hash) != 32) { return $this->setRedirect('index.php'); } $config = JFactory::getConfig(); $secret = $config->getValue('config.secret'); $this->_db->setQuery("SELECT * FROM #__rsform_submission_values WHERE MD5(CONCAT(SubmissionId,'" . $this->_db->getEscaped($secret) . "',FieldName)) = '" . $hash . "'"); $result = $this->_db->loadObject(); // Not found if (empty($result)) { return $this->setRedirect('index.php'); } // Not an upload field $this->_db->setQuery("SELECT c.ComponentTypeId FROM #__rsform_properties p LEFT JOIN #__rsform_components c ON (p.ComponentId=c.ComponentId) WHERE p.PropertyName='NAME' AND p.PropertyValue='" . $this->_db->getEscaped($result->FieldName) . "'"); $type = $this->_db->loadResult(); if ($type != 9) { return $this->setRedirect('index.php', JText::_('RSFP_VIEW_FILE_NOT_UPLOAD')); } jimport('joomla.filesystem.file'); if (JFile::exists($result->FieldValue)) { RSFormProHelper::readFile($result->FieldValue); } $this->setRedirect('index.php', JText::_('RSFP_VIEW_FILE_NOT_FOUND')); }
public static function createThumb($path, $width = 100, $height = 100, $crop = 2) { $myImage = new JImage(); $myImage->loadFile(JPATH_SITE . DS . $path); if ($myImage->isLoaded()) { // $filename = end(explode('/', $path)); $filename = JFile::getName($path); $filefolder = substr(md5(self::getFolderPath($path)), 1, 10); $newfilename = $width . 'x' . $height . '_' . $filefolder . '_' . JFile::makeSafe($filename); $fileExists = JFile::exists(JPATH_CACHE . '/' . $newfilename); if (!$fileExists) { $resizedImage = $myImage->resize($width, $height, true, $crop); $properties = $myImage->getImageFileProperties($path); $mime = $properties->mime; if ($mime == 'image/jpeg') { $type = IMAGETYPE_JPEG; } elseif ($mime = 'image/png') { $type = IMAGETYPE_PNG; } elseif ($mime = 'image/gif') { $type = IMAGETYPE_GIF; } $resizedImage->toFile(JPATH_CACHE . '/' . $newfilename, $type); } return $newfilename; } else { return "My file is not loaded"; } }
/** * Method for parsing ini files * * @param string $filename Path and name of the ini file to parse * * @return array Array of strings found in the file, the array indices will be the keys. On failure an empty array will be returned * * @since 2.5 */ public static function parseFile($filename) { jimport('joomla.filesystem.file'); if (!JFile::exists($filename)) { return array(); } // Capture hidden PHP errors from the parsing $version = phpversion(); $php_errormsg = null; $track_errors = ini_get('track_errors'); ini_set('track_errors', true); if ($version >= '5.3.1') { $contents = file_get_contents($filename); $contents = str_replace('_QQ_', '"\\""', $contents); $strings = @parse_ini_string($contents); if ($strings === false) { return array(); } } else { $strings = @parse_ini_file($filename); if ($strings === false) { return array(); } if ($version == '5.3.0' && is_array($strings)) { foreach ($strings as $key => $string) { $strings[$key] = str_replace('_QQ_', '"', $string); } } } return $strings; }
function language() { $this->setLayout('default'); $code = JRequest::getString('code'); if (empty($code)) { acymailing::display('Code not specified', 'error'); return; } $file = null; $file->name = $code; $path = JLanguage::getLanguagePath(JPATH_ROOT) . DS . $code . DS . $code . '.com_acymailing.ini'; $file->path = $path; jimport('joomla.filesystem.file'); $showLatest = true; $loadLatest = false; if (JFile::exists($path)) { $file->content = JFile::read($path); if (empty($file->content)) { acymailing::display('File not found : ' . $path, 'error'); } } else { $loadLatest = true; acymailing::display(JText::_('LOAD_ENGLISH_1') . '<br/>' . JText::_('LOAD_ENGLISH_2') . '<br/>' . JText::_('LOAD_ENGLISH_3'), 'info'); $file->content = JFile::read(JLanguage::getLanguagePath(JPATH_ROOT) . DS . 'en-GB' . DS . 'en-GB.com_acymailing.ini'); } if ($loadLatest or JRequest::getString('task') == 'latest') { $doc =& JFactory::getDocument(); $doc->addScript(ACYMAILING_UPDATEURL . 'languageload&code=' . JRequest::getString('code')); $showLatest = false; } elseif (JRequest::getString('task') == 'save') { $showLatest = false; } $this->assignRef('showLatest', $showLatest); $this->assignRef('file', $file); }
static function setMessage($file, $name) { jimport('joomla.filesystem.file'); $file = str_replace('\\', '/', $file); if (strpos($file, '/administrator') === 0) { $file = str_replace('/administrator', JPATH_ADMINISTRATOR, $file); } else { $file = JPATH_SITE . '/' . $file; } $file = str_replace('//', '/', $file); $file_alt = preg_replace('#(com|mod)_([a-z-_]+\\.)#', '\\2', $file); if (!JFile::exists($file) && !JFile::exists($file_alt)) { $msg = JText::sprintf('NN_THIS_EXTENSION_NEEDS_THE_MAIN_EXTENSION_TO_FUNCTION', JText::_($name)); $message_set = 0; $messageQueue = JFactory::getApplication()->getMessageQueue(); foreach ($messageQueue as $queue_message) { if ($queue_message['type'] == 'error' && $queue_message['message'] == $msg) { $message_set = 1; break; } } if (!$message_set) { JFactory::getApplication()->enqueueMessage($msg, 'error'); } } }
/** * looking for image inside the media folder. * heave size XS, XL, S, M, L, Generic */ public function lookingForK2Image($item, $size = 'XL') { //Image $item->imageK2Image = ''; if (JFile::exists(JPATH_SITE . '/media/k2/items/cache/' . md5("Image" . $item->id) . '_' . $size . '.jpg')) $item->imageK2Image = JURI::base() . 'media/k2/items/cache/' . md5("Image" . $item->id) . '_' . $size . '.jpg'; return $item; }