Ejemplo n.º 1
0
 /**
  * Get the component information.
  *
  * @param   string   $option  The component option.
  * @param   boolean  $strict  If set and the component does not exist, the enabled attribute will be set to false.
  *
  * @return  object   An object with the information for the component.
  *
  * @since   11.1
  */
 public static function getComponent($option, $strict = false)
 {
     if (!self::isLegacy()) {
         return \Component::load($option, $strict);
     }
     if (!isset(self::$components[$option])) {
         if (self::_load($option)) {
             $result = self::$components[$option];
         } else {
             $result = new stdClass();
             $result->enabled = $strict ? false : true;
             $result->params = new JRegistry();
         }
     } else {
         $result = self::$components[$option];
     }
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * Build the route for the component.
  *
  * @param   array  &$query  An array of URL arguments
  * @return  array  The URL arguments to use to assemble the subsequent URL.
  */
 public function build(&$query)
 {
     static $items;
     $segments = array();
     $itemid = null;
     // Break up the poll id into numeric and alias values.
     if (isset($query['id']) && strpos($query['id'], ':')) {
         list($query['id'], $query['alias']) = explode(':', $query['id'], 2);
     }
     // Get the menu items for this component.
     if (!$items) {
         $menu = \App::get('menu');
         $component = Component::load('com_poll');
         $items = $menu->getItems('component_id', $component->id);
     }
     // Search for an appropriate menu item.
     if (is_array($items)) {
         // If only the option and itemid are specified in the query, return that item.
         if (!isset($query['view']) && !isset($query['id']) && !isset($query['catid']) && isset($query['Itemid'])) {
             $itemid = (int) $query['Itemid'];
         }
         // Search for a specific link based on the critera given.
         if (!$itemid) {
             foreach ($items as $item) {
                 // Check if this menu item links to this view.
                 if (isset($item->query['view']) && $item->query['view'] == 'poll' && isset($query['view']) && $query['view'] != 'category' && isset($item->query['id']) && $item->query['id'] == $query['id']) {
                     $itemid = $item->id;
                 }
             }
         }
         // If no specific link has been found, search for a general one.
         if (!$itemid) {
             foreach ($items as $item) {
                 if (isset($query['view']) && $query['view'] == 'poll' && isset($item->query['view']) && $item->query['view'] == 'poll') {
                     // Check for an undealt with newsfeed id.
                     if (isset($query['id'])) {
                         // This menu item links to the newsfeed view but we need to append the newsfeed id to it.
                         $itemid = $item->id;
                         $segments[] = isset($query['alias']) ? $query['id'] . ':' . $query['alias'] : $query['id'];
                         break;
                     }
                 }
             }
         }
     }
     // Check if the router found an appropriate itemid.
     if (!$itemid) {
         // Check if a id was specified.
         if (isset($query['id'])) {
             if (isset($query['alias'])) {
                 $query['id'] .= ':' . $query['alias'];
             }
             // Push the id onto the stack.
             $segments[] = $query['id'];
             unset($query['id']);
             unset($query['alias']);
         }
         if (isset($query['view']) && $query['view'] == 'latest') {
             $segments[] = $query['view'];
         }
         unset($query['view']);
     } else {
         $query['Itemid'] = $itemid;
         // Remove the unnecessary URL segments.
         unset($query['view']);
         unset($query['id']);
         unset($query['catid']);
         unset($query['alias']);
     }
     return $segments;
 }
Ejemplo n.º 3
0
  </div>
</div>
<div class="page-header" style="border-bottom: none !important;">
  <div class="container">
    <ul class="breadcrumb">
      <li><a href="#">Home</a></li>
      <li><a href="#">Library</a></li>
      <li class="active">Data</li>
    </ul>
  </div>
</div>
<div id="panel-component">
<?php 
try {
    include_once $_SERVER["DOCUMENT_ROOT"] . '/lib/init.php';
    foreach (Component::load() as $key => $value) {
        if (file_exists($_SERVER["DOCUMENT_ROOT"] . "/component/{$value['com']}/index.php")) {
            echo '<div id="panel-' . $value['com'] . '" style="display:none">';
            include $_SERVER["DOCUMENT_ROOT"] . "/component/{$value['com']}/index.php";
            echo '</div>';
        }
    }
} catch (Exception $ex) {
    echo 'ERROR::' + $ex->getMessage();
}
?>
<div id="google-adsense" class="container" style="margin-bottom: 60px;">

</div>
</div><div class="panel-footer navbar-fixed-bottom">
  <div class="container">
Ejemplo n.º 4
0
 protected function loadComponent($component)
 {
     $component = Inflector::camelize($component) . 'Component';
     return $this->{$component} = Component::load($component, true);
 }
Ejemplo n.º 5
0
 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $language = isset($needles['language']) ? $needles['language'] : '*';
     // Prepare the reverse lookup array.
     if (!isset(self::$lookup[$language])) {
         self::$lookup[$language] = array();
         $component = Component::load('com_content');
         $items = $menus->getItems('component_id', $component->id);
         foreach ($items as $item) {
             if (isset($item->query) && isset($item->query['view']) && $item->language == $language) {
                 $view = $item->query['view'];
                 if (!isset(self::$lookup[$language][$view])) {
                     self::$lookup[$language][$view] = array();
                 }
                 if (isset($item->query['id'])) {
                     self::$lookup[$language][$view][$item->query['id']] = $item->id;
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$language][$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$language][$view][(int) $id])) {
                         return self::$lookup[$language][$view][(int) $id];
                     }
                 }
             }
         }
     }
     if ($language != '*') {
         $needles['language'] = '*';
         return self::_findItem($needles);
     }
     $active = $menus->getActive();
     if ($active && $active->component == 'com_content') {
         return $active->id;
     }
     return null;
 }
Ejemplo n.º 6
0
 /**
  * Sets the type of the menu item currently being edited.
  *
  * @return  void
  *
  * @since   1.6
  */
 function setType()
 {
     // Initialise variables.
     $app = JFactory::getApplication();
     // Get the posted values from the request.
     $data = Request::getVar('jform', array(), 'post', 'array');
     $recordId = Request::getInt('id');
     // Get the type.
     $type = $data['type'];
     $type = json_decode(base64_decode($type));
     $title = isset($type->title) ? $type->title : null;
     $recordId = isset($type->id) ? $type->id : 0;
     if ($title != 'alias' && $title != 'separator' && $title != 'url') {
         $title = 'component';
     }
     $app->setUserState('com_menus.edit.item.type', $title);
     if ($title == 'component') {
         if (isset($type->request)) {
             $component = Component::load($type->request->option);
             $data['component_id'] = $component->id;
             $app->setUserState('com_menus.edit.item.link', 'index.php?' . JURI::buildQuery((array) $type->request));
         }
     } elseif ($title == 'alias') {
         $app->setUserState('com_menus.edit.item.link', 'index.php?Itemid=');
     }
     unset($data['request']);
     $data['type'] = $title;
     if (Request::getCmd('fieldtype') == 'type') {
         $data['link'] = $app->getUserState('com_menus.edit.item.link');
     }
     //Save the data in the session.
     $app->setUserState('com_menus.edit.item.data', $data);
     $this->type = $type;
     $this->setRedirect(Route::url('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId), false));
 }
Ejemplo n.º 7
0
 /**
  * Get the component information.
  *
  * @return  object
  * @since   1.6
  */
 public function getComponent()
 {
     // Initialise variables.
     $option = $this->getState('component.option');
     // Load common and local language files.
     Lang::load($option, PATH_APP . "/bootstrap/administrator", null, false, true) || Lang::load($option, \Component::path($option) . "/admin", null, false, true) || Lang::load($option, \Component::path($option) . "/site", null, false, true);
     return \Component::load($option);
 }
Ejemplo n.º 8
0
error_reporting(E_ALL & ~E_DEPRECATED);
// Check if an installation folder is exists
//if(file_exists(APPPATH.'install/index.php')) {
//include_once APPPATH.'install/index.php';
//}
// Set error handlers
set_error_handler(array('Exception_Exido', 'handlerError'));
set_exception_handler(array('Exception_Exido', 'handlerException'));
// Initialize framework
Exido::initialize();
// Load basic include paths
Exido::setIncludePaths();
// You can attach a log writer by uncomment next line
//Exido::$log->attach(new Log_File(APPPATH.'data/cache/log'));
// Load additional components
Component::load();
// Initialize loaded components
Component::initialize();
// Include internalization languages
//Exido::$i18n->attach(new I18n_File('en_US'));
Exido::$i18n->attach(new I18n_File('ru_RU'));
// Set application time zone. Depends on language loaded.
// It's UTC default.
// @see  http://php.net/timezones
date_default_timezone_set(__('__time_zone'));
// Set application locale. Depends on language loaded.
// It's en_US.UTF-8 by default.
// @see  http://php.net/setlocale
setlocale(LC_ALL, __('__locale'));
// Set application charset. Depends on language loaded.
// It's UTF-8 default.
Ejemplo n.º 9
0
 /**
  * Method to get a menu item.
  *
  * @param	integer	$pk	An optional id of the object to get, otherwise the id from the model state is used.
  *
  * @return	mixed	Menu item data object on success, false on failure.
  * @since	1.6
  */
 public function getItem($pk = null)
 {
     // Initialise variables.
     $pk = !empty($pk) ? $pk : (int) $this->getState('item.id');
     // Get a level row instance.
     $table = $this->getTable();
     // Attempt to load the row.
     $table->load($pk);
     // Check for a table object error.
     if ($error = $table->getError()) {
         $this->setError($error);
         $false = false;
         return $false;
     }
     // Prime required properties.
     if ($type = $this->getState('item.type')) {
         $table->type = $type;
     }
     if (empty($table->id)) {
         $table->parent_id = $this->getState('item.parent_id');
         $table->menutype = $this->getState('item.menutype');
         $table->params = '{}';
     }
     // If the link has been set in the state, possibly changing link type.
     if ($link = $this->getState('item.link')) {
         // Check if we are changing away from the actual link type.
         if (MenusHelper::getLinkKey($table->link) != MenusHelper::getLinkKey($link)) {
             $table->link = $link;
         }
     }
     switch ($table->type) {
         case 'alias':
             $table->component_id = 0;
             $args = array();
             parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
             break;
         case 'separator':
             $table->link = '';
             $table->component_id = 0;
             break;
         case 'url':
             $table->component_id = 0;
             parse_str(parse_url($table->link, PHP_URL_QUERY));
             break;
         case 'component':
         default:
             // Enforce a valid type.
             $table->type = 'component';
             // Ensure the integrity of the component_id field is maintained, particularly when changing the menu item type.
             $args = array();
             parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
             if (isset($args['option'])) {
                 // Load the language file for the component.
                 $lang = Lang::getRoot();
                 $lang->load($args['option'], PATH_APP, null, false, true) || $lang->load($args['option'], PATH_APP . '/components/' . $args['option'] . '/admin', null, false, true) || $lang->load($args['option'], PATH_CORE . '/components/' . $args['option'] . '/admin', null, false, true);
                 // Determine the component id.
                 $component = Component::load($args['option']);
                 if (isset($component->id)) {
                     $table->component_id = $component->id;
                 }
             }
             break;
     }
     // We have a valid type, inject it into the state for forms to use.
     $this->setState('item.type', $table->type);
     // Convert to the Object before adding the params.
     $properties = $table->getProperties(1);
     $result = \Hubzero\Utility\Arr::toObject($properties, '\\Hubzero\\Base\\Object');
     // Convert the params field to an array.
     $registry = new \Hubzero\Config\Registry($table->params);
     $result->params = $registry->toArray();
     // Merge the request arguments in to the params for a component.
     if ($table->type == 'component') {
         // Note that all request arguments become reserved parameter names.
         $result->request = $args;
         $result->params = array_merge($result->params, $args);
     }
     if ($table->type == 'alias') {
         // Note that all request arguments become reserved parameter names.
         $args = array();
         parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
         $result->params = array_merge($result->params, $args);
     }
     if ($table->type == 'url') {
         // Note that all request arguments become reserved parameter names.
         $args = array();
         parse_str(parse_url($table->link, PHP_URL_QUERY), $args);
         $result->params = array_merge($result->params, $args);
     }
     // Load associated menu items
     if (JFactory::getApplication()->get('menu_associations', 0)) {
         if ($pk != null) {
             $result->associations = MenusHelper::getAssociations($pk);
         } else {
             $result->associations = array();
         }
     }
     $result->menuordering = $pk;
     return $result;
 }
Ejemplo n.º 10
0
 /**
  * Get the component information.
  *
  * @return  object
  * @since   1.6
  */
 public function getComponent()
 {
     // Initialise variables.
     $option = $this->getState('component.option');
     // Load common and local language files.
     Lang::load($option, PATH_APP . "/bootstrap/administrator", null, false, true) || Lang::load($option, \Component::path($option) . "/admin", null, false, true) || Lang::load($option, \Component::path($option) . "/site", null, false, true);
     if ($path = $this->getState('component.path')) {
         Lang::load($option, PATH_ROOT . dirname($path) . DS . 'Admin', null, false, true);
         Lang::load($option, PATH_ROOT . dirname($path) . DS . 'Site', null, false, true);
     }
     return \Component::load($option);
 }
Ejemplo n.º 11
0
 /**
  * Get the component information.
  *
  * @return  object
  * @since   1.6
  */
 public function getComponent()
 {
     // Initialise variables.
     $option = $this->getState('component.option');
     // Load common and local language files.
     Lang::load($option, JPATH_BASE, null, false, true) || Lang::load($option, PATH_CORE . "/components/{$option}/admin", null, false, true) || Lang::load($option, JPATH_BASE . "/components/{$option}", null, false, true);
     return \Component::load($option);
 }
Ejemplo n.º 12
0
 /**
  * Find new updates.
  *
  * @since	1.6
  */
 public function find()
 {
     // Check for request forgeries
     Session::checkToken() or exit(Lang::txt('JINVALID_TOKEN'));
     // Get the caching duration
     $component = Component::load('com_installer');
     $params = $component->params;
     $cache_timeout = $params->get('cachetimeout', 6, 'int');
     $cache_timeout = 3600 * $cache_timeout;
     // Find updates
     $model = new Models\Update();
     $result = $model->findUpdates(0, $cache_timeout);
     App::redirect(Route::url('index.php?option=com_installer&view=update', false));
     //$view->display();
 }