/** * Return data on a publication view (this will be some form of HTML) * * @param object $publication Current publication * @param string $option Name of the component * @param array $areas Active area(s) * @param string $rtrn Data to be returned * @param string $version Version name * @param boolean $extended Whether or not to show panel * @param string $authorized * @return array */ public function onPublication($publication, $option, $areas, $rtrn = 'all', $version = 'default', $extended = true, $authorized = false) { $arr = array('html' => '', 'metadata' => ''); // Check if our area is in the array of areas we want to return results for if (is_array($areas)) { if (!array_intersect($areas, $this->onPublicationAreas($publication)) && !array_intersect($areas, array_keys($this->onPublicationAreas($publication)))) { $rtrn = 'metadata'; } } $database = App::get('db'); // Get pub configs $config = Component::params($option); if ($rtrn == 'all' || $rtrn == 'html') { $objV = new \Components\Publications\Tables\Version($database); $versions = $objV->getVersions($publication->id, $filters = array('public' => 1)); // Instantiate a view $view = new \Hubzero\Plugin\View(array('folder' => 'publications', 'element' => 'versions', 'name' => 'browse')); // Are we allowing contributions $view->contributable = Plugin::isEnabled('projects', 'publications') ? 1 : 0; // Pass the view some info $view->option = $option; $view->publication = $publication; $view->versions = $versions; $view->config = $config; $view->authorized = $authorized; if ($this->getError()) { $view->setError($this->getError()); } // Return the output $arr['html'] = $view->loadTemplate(); } return $arr; }
function get_conf($db_id) { global $dv_conf, $com_name; $db_dv_conf = array(); $db_name = $db_id['name']; // Base directory $dv_conf['db_base_dir'] = Component::params('com_databases')->get('base_dir'); if (!$dv_conf['db_base_dir'] || $dv_conf['db_base_dir'] == '') { $dv_conf['db_base_dir'] = '/db/databases'; } $db_conf_file = "{$dv_conf['db_base_dir']}/{$db_name}/database.json"; $db_conf = json_decode(file_get_contents($db_conf_file), true); $dv_conf['db'] = array_merge($dv_conf['db'], $db_conf['database_ro']); $dv_conf_file = "{$dv_conf['db_base_dir']}/{$db_name}/applications/{$com_name}/config.json"; if (file_exists($dv_conf_file)) { $db_dv_conf = json_decode(file_get_contents($dv_conf_file), true); if (!is_array($db_dv_conf)) { $db_dv_conf = array(); } if (isset($db_dv_conf['settings'])) { $db_dv_conf['settings'] = array_merge($dv_conf['settings'], $db_dv_conf['settings']); } } $dv_conf = array_merge($dv_conf, $db_dv_conf); return $dv_conf; }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->infolink = '/kb/points/'; $this->banking = Component::params('com_members')->get('bankAccounts'); include_once __DIR__ . DS . 'helper.php'; }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication('administrator'); $search = $this->getUserStateFromRequest($this->context . '.search', 'filter_search'); $this->setState('filter.search', $search); $published = $this->getUserStateFromRequest($this->context . '.published', 'filter_published', ''); $this->setState('filter.published', $published); $access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access', 0, 'int'); $this->setState('filter.access', $access); $parentId = $this->getUserStateFromRequest($this->context . '.filter.parent_id', 'filter_parent_id', 0, 'int'); $this->setState('filter.parent_id', $parentId); $level = $this->getUserStateFromRequest($this->context . '.filter.level', 'filter_level', 0, 'int'); $this->setState('filter.level', $level); $menuType = Request::getVar('menutype', null); if ($menuType) { if ($menuType != $app->getUserState($this->context . '.filter.menutype')) { $app->setUserState($this->context . '.filter.menutype', $menuType); Request::setVar('limitstart', 0); } } else { $menuType = $app->getUserState($this->context . '.filter.menutype'); if (!$menuType) { $menuType = $this->getDefaultMenuType(); } } $this->setState('filter.menutype', $menuType); $language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); // Component parameters. $params = Component::params('com_menus'); $this->setState('params', $params); // List state information. parent::populateState('a.lft', 'asc'); }
/** * Constructor * * @param object &$subject Event observer * @param array $config Optional config values * @return void */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); // load plugin parameters $this->_config = Component::params('com_projects'); $this->_database = App::get('db'); }
/** * Return a usage database object * * @return mixed */ public static function getUDBO() { static $instance; if (!is_object($instance)) { $config = \Component::params('com_usage'); $options['driver'] = $config->get('statsDBDriver'); $options['host'] = $config->get('statsDBHost'); $options['port'] = $config->get('statsDBPort'); $options['user'] = $config->get('statsDBUsername'); $options['password'] = $config->get('statsDBPassword'); $options['database'] = $config->get('statsDBDatabase'); $options['prefix'] = $config->get('statsDBPrefix'); $options['ssl_ca'] = $config->get('statsDBSSLCa'); if ((!isset($options['password']) || $options['password'] == '') && (!isset($options['user']) || $options['user'] == '') && (!isset($options['database']) || $options['database'] == '')) { $instance = App::get('db'); } else { try { $options['driver'] = $options['driver'] == 'mysql' ? 'pdo' : $options['driver']; $instance = \Hubzero\Database\Driver::getInstance($options); } catch (Exception $e) { $instance = App::get('db'); } } } if ($instance instanceof Exception) { return null; } return $instance; }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { $this->setState('user.id', User::get('id')); // Load the parameters. $params = Component::params('com_messages'); $this->setState('params', $params); }
public function __construct(&$subject, $config) { parent::__construct($subject, $config); // Ensure that constructor is called one time self::$cookie = SID == ''; if (!self::$default_lang) { $app = JFactory::getApplication(); $router = $app->getRouter(); if (App::isSite()) { // setup language data self::$mode_sef = $router->getMode() == JROUTER_MODE_SEF ? true : false; self::$sefs = JLanguageHelper::getLanguages('sef'); self::$lang_codes = JLanguageHelper::getLanguages('lang_code'); self::$default_lang = Component::params('com_languages')->get('site', 'en-GB'); self::$default_sef = self::$lang_codes[self::$default_lang]->sef; self::$homes = MultilangstatusHelper::getHomepages(); $user = User::getRoot(); $levels = $user->getAuthorisedViewLevels(); foreach (self::$sefs as $sef => &$language) { if (isset($language->access) && $language->access && !in_array($language->access, $levels)) { unset(self::$sefs[$sef]); } } App::forget('language.filter'); App::set('language.filter', true); $uri = JFactory::getURI(); if (self::$mode_sef) { // Get the route path from the request. $path = JString::substr($uri->toString(), JString::strlen($uri->base())); // Apache mod_rewrite is Off $path = Config::get('sef_rewrite') ? $path : JString::substr($path, 10); // Trim any spaces or slashes from the ends of the path and explode into segments. $path = JString::trim($path, '/ '); $parts = explode('/', $path); // The language segment is always at the beginning of the route path if it exists. $sef = $uri->getVar('lang'); if (!empty($parts) && empty($sef)) { $sef = reset($parts); } } else { $sef = $uri->getVar('lang'); } if (isset(self::$sefs[$sef])) { $lang_code = self::$sefs[$sef]->lang_code; // Create a cookie $cookie_domain = Config::get('cookie_domain', ''); $cookie_path = Config::get('cookie_path', '/'); setcookie(App::hash('language'), $lang_code, $this->getLangCookieTime(), $cookie_path, $cookie_domain); // set the request var Request::setVar('language', $lang_code); } } parent::__construct($subject, $config); // Detect browser feature if (App::isSite()) { $app->setDetectBrowser($this->params->get('detect_browser', '1') == '1'); } } }
/** * Execute a task * * @return void */ public function execute() { $this->config->set('banking', \Component::params('com_members')->get('bankAccounts')); $this->registerTask('__default', 'search'); $this->registerTask('display', 'search'); $this->registerTask('latest', 'latest.rss'); parent::execute(); }
/** * Execute a task * * @return void */ public function execute() { $this->banking = \Component::params('com_members')->get('bankAccounts'); $this->registerTask('add', 'edit'); $this->registerTask('apply', 'save'); $this->registerTask('reject', 'accept'); parent::execute(); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('administrator'); $this->setState('user.id', User::get('id')); // Load the parameters. $params = Component::params('com_messages'); $this->setState('params', $params); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { // Load the User state. $pk = (int) Request::getInt('id'); $this->setState('style.id', $pk); // Load the parameters. $params = Component::params('com_templates'); $this->setState('params', $params); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * @since 1.6 */ protected function populateState() { $params = Component::params('com_languages'); // Load the User state. $langId = (int) Request::getInt('lang_id'); $this->setState('language.id', $langId); // Load the parameters. $this->setState('params', $params); }
/** * Return imports filespace path * * @return string */ public function fileSpacePath() { // get com resources params $params = \Component::params('com_resources'); // build upload path $uploadPath = $params->get('import_hooks_uploadpath', '/site/resources/import/hooks'); $uploadPath = PATH_APP . DS . trim($uploadPath, DS) . DS . $this->get('id'); // return path return $uploadPath; }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('administrator'); // Load the User state. $id = (int) Request::getInt('id'); $this->setState('menu.id', $id); // Load the parameters. $params = Component::params('com_menus'); $this->setState('params', $params); }
/** * Constructor * * @return void */ public function __construct($path = NULL) { // Get component configs $configs = Component::params('com_projects'); // Set path to git $this->_gitpath = $configs->get('gitpath', '/opt/local/bin/git'); // Set repo path $this->_path = $path; // Set acting user $this->_uid = User::get('id'); }
/** * Determines task being called and attempts to execute it * * @return void */ public function execute() { if (User::isGuest()) { App::abort(403, Lang::txt('You must be logged in to access.')); return; } // Load the com_resources component config $rconfig = Component::params('com_resources'); $this->rconfig = $rconfig; parent::execute(); }
/** * Generate macro output * * @return string */ public function render() { $et = $this->args; $live_site = rtrim(Request::base(), '/'); // What pages are we getting? if ($et) { $et = strip_tags($et); // Get pages with a prefix $sql = "SELECT * FROM `#__wiki_attachments` WHERE LOWER(filename) LIKE '" . strtolower($et) . "%' AND pageid='" . $this->pageid . "' ORDER BY created ASC"; } else { // Get all pages $sql = "SELECT * FROM `#__wiki_attachments` WHERE pageid='" . $this->pageid . "' ORDER BY created ASC"; } // Perform query $this->_db->setQuery($sql); $rows = $this->_db->loadObjectList(); // Did we get a result from the database? if ($rows) { $config = Component::params('com_wiki'); if ($this->filepath != '') { $config->set('filepath', $this->filepath); } $page = new \Components\Wiki\Models\Page($this->pageid); if ($page->get('namespace') == 'help') { $page->set('scope', $page->get('scope') ? rtrim($this->scope, '/') . '/' . ltrim($page->get('scope'), '/') : $this->scope); $page->set('group_cn', $this->domain); } // Build and return the link $html = '<ul>'; foreach ($rows as $row) { $page->set('pagename', $page->get('pagename') . '/' . 'File:' . $row->filename); $link = $page->link(); //$live_site . substr(PATH_APP, strlen(PATH_ROOT)) . DS . trim($config->get('filepath', '/site/wiki'), DS) . DS . $this->pageid . DS . $row->filename; $fpath = PATH_APP . DS . trim($config->get('filepath', '/site/wiki'), DS) . DS . $this->pageid . DS . $row->filename; $html .= '<li><a href="' . Route::url($link) . '">' . $row->filename . '</a> (' . (file_exists($fpath) ? \Hubzero\Utility\Number::formatBytes(filesize($fpath)) : '-- file not found --') . ') '; $huser = User::getInstance($row->created_by); if ($huser->get('id')) { $html .= '- added by <a href="' . Route::url('index.php?option=com_members&id=' . $huser->get('id')) . '">' . stripslashes($huser->get('name')) . '</a> '; } if ($row->created && $row->created != '0000-00-00 00:00:00') { $html .= Date::of($row->created)->relative() . '. '; } $html .= $row->description ? '<span>"' . stripslashes($row->description) . '"</span>' : ''; $html .= '</li>' . "\n"; } $html .= '</ul>'; return $html; } else { // Return error message //return '(TitleIndex('.$et.') failed)'; return '(No ' . $et . ' files to display)'; } }
/** * Constructor * * @return void */ public function __construct($path = NULL, $remote = false) { // Get component configs $configs = Component::params('com_projects'); // Set path to git engine $this->_gitpath = $configs->get('gitpath', '/opt/local/bin/git'); // Set repo path $this->_path = $path; // Git helper $this->_git = new Helpers\Git($this->_path); $this->set('remote', $remote); }
/** * Get the group's image * * @return string */ public function image() { if (!isset($this->_image)) { $config = \Component::params('com_groups'); if ($this->_obj->get('logo')) { $this->_image = DS . trim($config->get('uploadpath', '/site/groups'), DS) . DS . $this->_obj->get('gidNumber') . DS . $this->_obj->get('logo'); } else { $this->_image = '/core/components/com_groups/site/assets/img/group_default_logo.png'; } } return $this->_image; }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Initialise variables. $app = JFactory::getApplication('administrator'); // Load the filter state. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); // Load the parameters. $params = Component::params('com_users'); $this->setState('params', $params); // List state information. parent::populateState('a.lft', 'asc'); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering * @param string $direction * @return void */ protected function populateState($ordering = null, $direction = null) { // Load the filter state. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state', '', 'string'); $this->setState('filter.state', $state); // Load the parameters. $params = \Component::params('com_redirect'); $this->setState('params', $params); // List state information. parent::populateState('a.old_url', 'asc'); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Load the filter state. $clientId = User::getState('com_modules.modules.filter.client_id', 0); $this->setState('filter.client_id', (int) $clientId); // Load the parameters. $params = Component::params('com_modules'); $this->setState('params', $params); // Manually set limits to get all modules. $this->setState('list.limit', 0); $this->setState('list.start', 0); $this->setState('list.ordering', 'a.name'); $this->setState('list.direction', 'ASC'); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @return void * * @since 1.6 */ protected function populateState() { $app = JFactory::getApplication('administrator'); // Load the User state. if (!($pk = (int) Request::getInt('id'))) { if ($extensionId = (int) User::getState('com_modules.add.module.extension_id')) { $this->setState('extension.id', $extensionId); } } $this->setState('module.id', $pk); // Load the parameters. $params = Component::params('com_modules'); $this->setState('params', $params); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState($ordering = null, $direction = null) { // Load the filter state. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $template = $this->getUserStateFromRequest($this->context . '.filter.template', 'filter_template', '0', 'cmd'); $this->setState('filter.template', $template); $clientId = $this->getUserStateFromRequest($this->context . '.filter.client_id', 'filter_client_id', null); $this->setState('filter.client_id', $clientId); // Load the parameters. $params = Component::params('com_templates'); $this->setState('params', $params); // List state information. parent::populateState('a.template', 'asc'); }
public function verify() { parent::verify(); // Check if the download file is set if (empty($this->data->meta['downloadFile']) || !$this->data->meta['downloadFile']) { throw new \Exception(Lang::txt('Download file must be set')); } // Check if the download file really exists $storefrontConfig = Component::params('com_storefront'); $dir = $storefrontConfig->get('downloadFolder', '/site/protected/storefront/software'); $file = PATH_APP . $dir . DS . $this->data->meta['downloadFile']; if (!file_exists($file)) { throw new \Exception(Lang::txt('Download file doesn\'t exist')); } }
function display($tpl = null) { Html::behavior('framework', true); \Hubzero\Document\Assets::addComponentScript('com_media', 'popup-imagemanager.js'); \Hubzero\Document\Assets::addComponentStylesheet('com_media', 'popup-imagemanager.css'); // Display form for FTP credentials? // Don't set them here, as there are other functions called before this one if there is any file write operation $ftp = !JClientHelper::hasCredentials('ftp'); $this->session = App::get('session'); $this->config = Component::params('com_media'); $this->state = $this->get('state'); $this->folderList = $this->get('folderList'); $this->require_ftp = $ftp; parent::display($tpl); }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. * * @since 1.6 */ protected function populateState() { // Load the User state. $id = User::getState('com_templates.edit.source.id'); // Parse the template id out of the compound reference. $temp = explode(':', base64_decode($id)); $this->setState('extension.id', (int) array_shift($temp)); $fileName = array_shift($temp); $this->setState('filename', $fileName); // Save the syntax for later use User::setState('editor.source.syntax', Filesystem::extension($fileName)); // Load the parameters. $params = Component::params('com_templates'); $this->setState('params', $params); }
/** * Stock method to auto-populate the model state. * * @return void * @since 11.1 */ protected function populateState() { // Initialise variables. $table = $this->getTable(); $key = $table->getKeyName(); // Get the pk of the record from the request. $pk = \Request::getVar($key, array()); if (!empty($pk)) { $pk = intval($pk[0]); } $this->setState($this->getName() . '.id', $pk); // Load the parameters. $value = \Component::params($this->option); $this->setState('params', $value); }
/** * Constructor * * @param object transaction info * @param string payment gateway provider * @param object payment gateway credentials * @param object payment options * @return void */ public function __construct() { $hubName = Config::get('sitename'); $params = Component::params(Request::getVar('option')); $this->options = new \stdClass(); // Default action is payment $this->options->postbackAction = 'payment'; $this->options->transactionName = "{$hubName} online purchase"; $this->options->env = $params->get('paymentProviderEnv'); $this->options->validationKey = $params->get('UPAY_VALIDATION_KEY'); // Posting Key should be configured in uPay to be the same as a validation key (UPAY_VALIDATION_KEY) $this->options->postingKey = $this->options->validationKey; $this->siteDetails = new \stdClass(); $this->siteDetails->siteId = $params->get('UPAY_SITE_ID'); }