public static function &getButtons()
{
if (empty(self::$buttons)) {
self::$buttons = array(array('link' => JRoute::_('index.php?option=com_imageshow'), 'image' => 'components/com_imageshow/assets/images/icons-48/icon-off.png', 'text' => JText::_('LAUNCH_PAD'), 'extra_text' => ''), array('link' => JRoute::_('index.php?option=com_imageshow&controller=showlist'), 'image' => 'components/com_imageshow/assets/images/icons-48/icon-file.png', 'text' => JText::_('SHOWLISTS_MANAGER'), 'extra_text' => ''), array('link' => JRoute::_('index.php?option=com_imageshow&controller=showlist&task=add'), 'image' => 'components/com_imageshow/assets/images/icons-48/icon-add-file.png', 'text' => JText::_('ADD_NEW_SHOWLISTS'), 'extra_text' => ''), array('link' => JRoute::_('index.php?option=com_imageshow&controller=showcase'), 'image' => 'components/com_imageshow/assets/images/icons-48/icon-monitor.png', 'text' => JText::_('SHOWCASES_MANAGER'), 'extra_text' => ''), array('link' => JRoute::_('index.php?option=com_imageshow&controller=showcase&task=add'), 'image' => 'components/com_imageshow/assets/images/icons-48/icon-add-monitor.png', 'text' => JText::_('ADD_NEW_SHOWCASES'), 'extra_text' => ''), array('link' => JRoute::_('index.php?option=com_imageshow&controller=about'), 'image' => 'components/com_imageshow/assets/images/icons-48/icon-star.png', 'text' => JText::_('ABOUT'), 'extra_text' => ''));
}
return self::$buttons;
}
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/menus.php';
// Load the submenu.
MenusHelper::addSubmenu(JRequest::getCmd('view'));
$view = JRequest::getCmd('view', 'menus');
$layout = JRequest::getCmd('layout', 'default');
$id = JRequest::getInt('id');
// Check for edit form.
if ($view == 'menu' && $layout == 'edit' && !$this->checkEditId('com_menus.edit.menu', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=menus', false));
return false;
} elseif ($view == 'item' && $layout == 'edit' && !$this->checkEditId('com_menus.edit.item', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_menus&view=items', false));
return false;
}
parent::display();
return $this;
}
public function delete()
{
// Check for request forgeries
JSession::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = JFactory::getApplication()->input->get('cid', array(), 'array');
if (!is_array($cid) || count($cid) < 1) {
JLog::add(JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), JLog::WARNING, 'jerror');
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
jimport('joomla.utilities.arrayhelper');
JArrayHelper::toInteger($cid);
// Remove the items.
if ($model->delete($cid)) {
$this->setMessage(JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid)));
} else {
$this->setMessage($model->getError());
}
}
$version = new JVersion();
if ($version->isCompatible('3.0')) {
// Invoke the postDelete method to allow for the child class to access the model.
$this->postDeleteHook($model, $cid);
}
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
/**
* Method to display a view.
*
* @param boolean If true, the view output will be cached
* @param array An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
*
* @return JController This object to support chaining.
* @since 1.5
*/
public function display($cachable = false, $urlparams = false)
{
require_once JPATH_COMPONENT . '/helpers/users.php';
// Load the submenu.
UsersHelper::addSubmenu(JRequest::getCmd('view', 'users'));
$view = JRequest::getCmd('view', 'users');
$layout = JRequest::getCmd('layout', 'default');
$id = JRequest::getInt('id');
if (!$this->canView($view)) {
JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
return;
}
// Check for edit form.
if ($view == 'user' && $layout == 'edit' && !$this->checkEditId('com_users.edit.user', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=users', false));
return false;
} elseif ($view == 'group' && $layout == 'edit' && !$this->checkEditId('com_users.edit.group', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=groups', false));
return false;
} elseif ($view == 'level' && $layout == 'edit' && !$this->checkEditId('com_users.edit.level', $id)) {
// Somehow the person just went to the form - we don't allow that.
$this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id));
$this->setMessage($this->getError(), 'error');
$this->setRedirect(JRoute::_('index.php?option=com_users&view=levels', false));
return false;
}
return parent::display();
}
/**
* sauto view display method.
*
* @param string $tpl The name of the template file to parse;
*
* @return void
*/
public function display($tpl = null)
{
$app =& JFactory::getApplication();
$link_redirect = JRoute::_('index.php?option=com_sauto');
$user =& JFactory::getUser();
$uid = $user->id;
if ($uid == 0) {
//vizitator
$app->redirect($link_redirect, JText::_('SAUTO_PAGE_NOT_EXIST'));
} else {
$db = JFactory::getDbo();
$query = "SELECT `tip_cont` FROM #__sa_profiles WHERE `uid` = '" . $uid . "'";
$db->setQuery($query);
$type = $db->loadResult();
if ($type == 0) {
//cont customer
$tpl = '0';
} elseif ($type == 1) {
//cont dealer
$tpl = '1';
} else {
$app->redirect($link_redirect, JText::_('SAUTO_PAGE_NOT_EXIST'));
}
parent::display($tpl);
}
}
/**
* Saves a new meta object
*
* @since 5.0
* @access public
* @param string
* @return
*/
public function save()
{
// Check for request forgeries
EB::checkToken();
// @task: Check for acl rules.
$this->checkAccess('meta');
// Default return url
$return = JRoute::_('index.php?option=com_easyblog&view=metas', false);
$post = $this->input->getArray('post');
if (!isset($post['id']) || empty($post['id'])) {
$this->info->set('COM_EASYBLOG_INVALID_META_TAG_ID', 'error');
return $this->app->redirect($return);
}
$meta = EB::table('Meta');
$meta->load((int) $post['id']);
$meta->bind($post);
// Save the meta object
$meta->store();
$task = $this->getTask();
if ($task == 'apply') {
$return = 'index.php?option=com_easyblog&view=metas&layout=form&id=' . $meta->id;
}
$this->info->set('COM_EASYBLOG_META_SAVED', 'success');
return $this->app->redirect($return);
}
public function onCCK_FieldPrepareContent(&$field, $value = '', &$config = array())
{
if (self::$type != $field->type) {
return;
}
parent::g_onCCK_FieldPrepareContent($field, $config);
// Prepare
$link = '';
$html = '';
$text = '';
if ($value) {
$app = JFactory::getApplication();
$menu = $app->getMenu()->getItem($value);
if (is_object($menu)) {
$link = JRoute::_('index.php?Itemid=' . $value);
$text = $menu->title;
$html = '<a href="' . $link . '">' . $text . '</a>';
} else {
$value = '';
}
}
// Set
$field->html = $html;
$field->link = $link;
$field->linked = true;
$field->text = $text;
$field->typo_target = 'text';
$field->value = $value;
}
/**
* Helper method to return button list.
*
* This method returns the array by reference so it can be
* used to add custom buttons or remove default ones.
*
* @param JRegistry The module parameters.
*
* @return array An array of buttons
* @since 1.6
*/
public static function &getButtons($params)
{
$key = (string) $params;
if (!isset(self::$buttons[$key])) {
$context = $params->get('context', 'mod_pj_quickicon');
if ($context == 'mod_pj_quickicon') {
// Load mod_quickicon language file in case this method is called before rendering the module
JFactory::getLanguage()->load('mod_pj_quickicon');
self::$buttons[$key] = array(array('link' => JRoute::_('index.php?option=com_playjoom&view=audiotracks'), 'params' => null, 'id' => null, 'imagePath' => null, 'image' => ' fa fa-list-alt', 'text' => JText::_('MOD_PJ_QUICKICON_TRACKSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=media'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-music', 'text' => JText::_('MOD_PJ_QUICKICON_ADD_TRACKS'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=artists'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-users', 'text' => JText::_('MOD_PJ_QUICKICON_ARTISTSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=albums'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-picture-o', 'text' => JText::_('MOD_PJ_QUICKICON_ALBUMSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_playjoom&view=covers'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-file-image-o', 'text' => JText::_('MOD_PJ_QUICKICON_COVERSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_TRACKS'), array('link' => JRoute::_('index.php?option=com_categories&view=categories&extension=com_playjoom'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-folder-o', 'text' => JText::_('MOD_PJ_QUICKICON_GENRESMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_CATEGORIES'), array('link' => JRoute::_('index.php?option=com_categories&view=categories&extension=com_playjoom.playlist'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-play', 'text' => JText::_('MOD_PJ_QUICKICON_PLAYLISTSMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_CATEGORIES'), array('link' => JRoute::_('index.php?option=com_categories&view=categories&extension=com_playjoom.trackfilter'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-filter', 'text' => JText::_('MOD_PJ_QUICKICON_TRACKFILTERMANAGER'), 'access' => array('core.manage', 'com_playjoom', 'core.create', 'com_playjoom'), 'group' => 'MOD_PJ_QUICKICON_CATEGORIES'));
//Get user objects
$user = JFactory::getUser();
if ($user->authorise('core.admin', 'com_playjoom')) {
$PJbuttons = array(array('link' => JRoute::_('index.php?option=com_users'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-user', 'text' => JText::_('MOD_QUICKICON_USER_MANAGER'), 'access' => array('core.manage', 'com_users'), 'group' => 'MOD_PJ_QUICKICON_USERS'), array('link' => JRoute::_('index.php?option=com_config'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-cogs', 'text' => JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'), 'group' => 'MOD_PJ_QUICKICON_CONFIGURATIONS'), array('link' => JRoute::_('index.php?option=com_config&view=component&component=com_playjoom'), 'params' => null, 'id' => null, 'imagePath' => '/administrator/components/com_playjoom/images/header/', 'image' => 'fa fa-cog', 'text' => JText::_('MOD_PJ_QUICKICON_PLAYJOOM_OPTIONS'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config'), 'group' => 'MOD_PJ_QUICKICON_CONFIGURATIONS'));
//Marge standard icons with PlayJoom admin icons
self::$buttons[$key] = array_merge(self::$buttons[$key], $PJbuttons);
// Include buttons defined by published quickicon plugins
JPluginHelper::importPlugin('quickicon');
$app = JFactory::getApplication();
$arrays = (array) $app->triggerEvent('onGetIcons', array($context));
foreach ($arrays as $response) {
foreach ($response as $icon) {
$default = array('link' => null, 'image' => 'cog', 'text' => null, 'access' => true, 'group' => 'MOD_QUICKICON_EXTENSIONS');
$icon = array_merge($default, $icon);
if (!is_null($icon['link']) && !is_null($icon['text'])) {
self::$buttons[$key][] = $icon;
}
}
}
}
} else {
self::$buttons[$key] = array();
}
}
return self::$buttons[$key];
}
/**
* Plugin that retrieves contact information for contact
*
* @param string $context The context of the content being passed to the plugin.
* @param mixed &$row An object with a "text" property
* @param mixed $params Additional parameters. See {@see PlgContentContent()}.
* @param integer $page Optional page number. Unused. Defaults to zero.
*
* @return boolean True on success.
*/
public function onContentPrepare($context, &$row, $params, $page = 0)
{
$allowed_contexts = array('com_content.category', 'com_content.article', 'com_content.featured');
if (!in_array($context, $allowed_contexts)) {
return true;
}
// Return if we don't have valid params or don't link the author
if (!$params instanceof Registry || !$params->get('link_author')) {
return true;
}
// Return if we don't have a valid article id
if (!isset($row->id) || !(int) $row->id) {
return true;
}
$row->contactid = $this->getContactId($row->created_by);
if ($row->contactid) {
$needle = 'index.php?option=com_contact&view=contact&id=' . $row->contactid;
$menu = JFactory::getApplication()->getMenu();
$item = $menu->getItems('link', $needle, true);
$link = $item ? $needle . '&Itemid=' . $item->id : $needle;
$row->contact_link = JRoute::_($link);
} else {
$row->contact_link = '';
}
return true;
}
/**
* Get the associated language flags
*
* @param int $newsfeedid The item id to search associations
*
* @return string The language HTML
*/
public static function association($newsfeedid)
{
// Defaults
$html = '';
// Get the associations
if ($associations = JLanguageAssociations::getAssociations('com_newsfeeds', '#__newsfeeds', 'com_newsfeeds.item', $newsfeedid)) {
foreach ($associations as $tag => $associated) {
$associations[$tag] = (int) $associated->id;
}
// Get the associated newsfeed items
$db = JFactory::getDbo();
$query = $db->getQuery(true)->select('c.id, c.name as title')->select('l.sef as lang_sef')->from('#__newsfeeds as c')->select('cat.title as category_title')->join('LEFT', '#__categories as cat ON cat.id=c.catid')->where('c.id IN (' . implode(',', array_values($associations)) . ')')->join('LEFT', '#__languages as l ON c.language=l.lang_code')->select('l.image')->select('l.title as language_title');
$db->setQuery($query);
try {
$items = $db->loadObjectList('id');
} catch (RuntimeException $e) {
throw new Exception($e->getMessage(), 500);
}
if ($items) {
foreach ($items as &$item) {
$text = strtoupper($item->lang_sef);
$url = JRoute::_('index.php?option=com_newsfeeds&task=newsfeed.edit&id=' . (int) $item->id);
$tooltipParts = array(JHtml::_('image', 'mod_languages/' . $item->image . '.gif', $item->language_title, array('title' => $item->language_title), true), $item->title, '(' . $item->category_title . ')');
$item->link = JHtml::_('tooltip', implode(' ', $tooltipParts), null, null, $text, $url, null, 'hasTooltip label label-association label-' . $item->lang_sef);
}
}
$html = JLayoutHelper::render('joomla.content.associations', $items);
}
return $html;
}
function plugin(&$link, $attr = null)
{
global $Itemid, $mtconf;
//, $mt_show_review;
# Load Parameters
$params =& new JParameter($link->attribs);
$params->def('show_review', $mtconf->get('show_review'));
if ($params->get('show_review') == 1) {
$html = '';
// $html = '<img src="images/M_images/indent1.png" width="9" height="9" />';
$html .= '<a href="';
$html .= JRoute::_('index.php?option=com_mtree&task=writereview&link_id=' . $link->link_id);
$html .= '"';
# Insert attributes
if (is_array($attr)) {
// from array
foreach ($attr as $key => $val) {
$key = htmlspecialchars($key);
$val = htmlspecialchars($val);
$html .= " {$key}=\"{$val}\"";
}
} elseif (!is_null($attr)) {
// from scalar
$html .= " {$attr}";
}
$html .= '>' . JText::_('Write review') . "</a>";
# Return the review link
return $html;
}
}
protected function prepareSidebar()
{
if (!JCck::on()) {
return;
}
$buttons = array();
if (JCck::getUIX() == 'compact') {
$core = array(array('val' => '2', 'pre' => '', 'key' => 'COM_CCK_'));
} else {
$core = array(array('val' => '0', 'pre' => '', 'key' => 'COM_CCK_', 'img' => 'cck-application'), array('val' => '2', 'pre' => '- ', 'key' => 'COM_CCK_', 'img' => 'cck-form'), array('val' => '3', 'pre' => '- ', 'key' => '', 'img' => 'cck-plugin'), array('val' => '4', 'pre' => '- ', 'key' => 'COM_CCK_', 'img' => 'cck-search'), array('val' => '1', 'pre' => '- ', 'key' => '', 'img' => 'cck-template'), array('val' => '5', 'pre' => '', 'key' => '', 'img' => 'cck-multisite'));
}
$components = JCckDatabase::loadObjectList('SELECT a.title, a.link, b.element' . ' FROM #__menu AS a LEFT JOIN #__extensions AS b ON b.extension_id = a.component_id' . ' WHERE a.link LIKE "index.php?option=com_cck\\_%"' . ' AND a.link NOT IN ("index.php?option=com_cck_toolbox&view=processing","index.php?option=com_cck_webservices&view=api")' . ' ORDER BY a.title ASC');
$groupedButtons = array();
$more = array('ADDON' => 16, 'PLUGIN_FIELD' => 19, 'PLUGIN_LINK' => 20, 'PLUGIN_LIVE' => 21, 'PLUGIN_RESTRICTION' => 112, 'PLUGIN_TYPOGRAPHY' => 24, 'PLUGIN_VALIDATION' => 25, 'TEMPLATE' => 27);
foreach ($core as $k => $v) {
$buttons[] = array('access' => array('core.manage', 'com_cck'), 'group' => 'COM_CCK_CORE', 'image' => $v['img'], 'link' => JRoute::_(constant('_C' . $v['val'] . '_LINK')), 'target' => '_self', 'text' => $v['pre'] . JText::_($v['key'] . constant('_C' . $v['val'] . '_TEXT') . 'S'));
}
foreach ($components as $k => $v) {
$buttons[] = array('access' => array('core.manage', $v->element), 'group' => 'COM_CCK_SEBLOD_MORE', 'image' => 'cck-addon', 'link' => JRoute::_($v->link), 'target' => '_self', 'text' => $v->title);
}
foreach ($more as $k => $v) {
$buttons[] = array('access' => array('core.manage', 'com_cck'), 'group' => 'COM_CCK_SEBLOD_COM', 'image' => 'download', 'link' => JRoute::_('http://www.seblod.com/products?seb_item_category=' . $v), 'target' => '_blank', 'text' => JText::_('COM_CCK_PANE_MORE_' . $k));
}
foreach ($buttons as $button) {
$groupedButtons[$button['group']][] = $button;
}
$this->sidebar = '<div class="sidebar-nav quick-icons">' . JHtml::_('links.linksgroups', $groupedButtons) . '</div>';
}
/**
* Prepare item properties
*/
protected function _prepareItem($item)
{
$item->link = JRoute::_(K2HelperRoute::getItemRoute($item->id, $item->catid));
$item->introtext = JHtml::_('string.truncate', $item->introtext, $this->_params->get('intro_length', 200));
$item->cat_link = urldecode(JRoute::_(K2HelperRoute::getCategoryRoute($item->catid . ':' . urlencode($item->catslug))));
return $item;
}
function getObjectInfo($id, $language = null)
{
$info = new JCommentsObjectInfo();
$routerHelper = JPATH_ROOT . '/components/com_djcatalog2/helpers/route.php';
if (is_file($routerHelper)) {
require_once $routerHelper;
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('a.id, a.alias, a.name, a.created_by');
$query->from('#__djc2_items AS a');
$query->select('c.id AS category_id, c.alias AS category_alias');
$query->join('LEFT', '#__djc2_categories AS c ON c.id = a.cat_id');
$query->where('a.id = ' . (int) $id);
$db->setQuery($query);
$row = $db->loadObject();
if (!empty($row)) {
$slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
$catslug = $row->category_alias ? $row->category_id . ':' . $row->category_alias : $row->category_id;
$info->title = $row->name;
$info->category_id = $article->category_id;
$info->userid = $row->created_by;
$info->link = JRoute::_(DJCatalogHelperRoute::getItemRoute($slug, $catslug));
}
}
return $info;
}
public function toggleInList()
{
// Check for request forgeries
JRequest::checkToken() or die(JText::_('JINVALID_TOKEN'));
// Get items to publish from the request.
$cid = JRequest::getVar('cid', array(), '', 'array');
$data = array('showInListView' => 1, 'hideFromListView' => 0);
$task = $this->getTask();
$value = JArrayHelper::getValue($data, $task, 0, 'int');
if (empty($cid)) {
JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
} else {
// Get the model.
$model = $this->getModel();
// Make sure the item ids are integers
JArrayHelper::toInteger($cid);
// Publish the items.
if (!$model->addToListView($cid, $value)) {
JError::raiseWarning(500, $model->getError());
} else {
if ($value == 1) {
$ntext = $this->text_prefix . '_N_ITEMS_ADDED_TO_LIST_VIEW';
} else {
$ntext = $this->text_prefix . '_N_ITEMS_REMOVED_FROM_LIST_VIEW';
}
$this->setMessage(JText::plural($ntext, count($cid)));
}
}
$this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
}
private static function makeList(&$html, &$root, $path, $expand, $cid, $level = 0, $show_count = false)
{
$children = $root->getChildren();
foreach ($children as $child) {
$current = $child->id == $cid ? true : false;
$parent = count($child->getChildren()) ? true : false;
$active = $current || in_array($child->id, $path) ? true : false;
$deeper = $parent && $expand ? true : false;
$class = 'djc_catid-' . $child->id . ' level' . $level;
$class .= $current ? ' current' : '';
$class .= $active ? ' active' : '';
$class .= $parent ? ' parent' : '';
$class .= $deeper ? ' deeper' : '';
$display_name = $child->name;
if ($show_count) {
if (($count = $child->getProductCount()) !== false) {
$display_name = $child->name . ' <small class="djc_category_counter">[' . $count . ']</small>';
}
}
$html .= '<li class="' . $class . '"><a href="' . JRoute::_(DJCatalogHelperRoute::getCategoryRoute($child->id . ':' . $child->alias), true) . '">' . $display_name . '</a>';
if (($active || $expand) && count($child->getChildren())) {
$html .= '<ul>';
$level++;
self::makeList($html, $child, $path, $expand, $cid, $level, $show_count);
$level--;
$html .= '</ul>';
}
$html .= '</li>';
}
}
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
// Initialise variables.
$html = array();
$recordId = (int) $this->form->getValue('id');
$size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
$class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
// Get a reverse lookup of the base link URL to Title
$model = JModel::getInstance('menutypes', 'menusModel');
$rlu = $model->getReverseLookup();
switch ($this->value) {
case 'url':
$value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
break;
case 'alias':
$value = JText::_('COM_MENUS_TYPE_ALIAS');
break;
case 'separator':
$value = JText::_('COM_MENUS_TYPE_SEPARATOR');
break;
default:
$link = $this->form->getValue('link');
// Clean the link back to the option, view and layout
$value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link)));
break;
}
// Load the javascript and css
JHtml::_('behavior.framework');
JHtml::_('behavior.modal');
$html[] = '<input type="text" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />';
$html[] = '<input type="button" value="' . JText::_('JSELECT') . '" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\'' . JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId) . '\'})" />';
$html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
return implode("\n", $html);
}
/**
* Execute and display a template script.
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return mixed A string if successful, otherwise a Error object.
*
* @see JViewLegacy::loadTemplate()
* @since 12.2
*/
public function display($tpl = null)
{
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
$this->layout = $this->getLayout();
switch ($this->layout) {
case "contact":
$this->prepareContact();
break;
case "social":
$this->prepareSocialProfiles();
break;
default:
// Basic data for the profile.
$this->prepareBasic();
break;
}
$userId = JFactory::getUser()->id;
if (!$userId) {
$app->enqueueMessage(JText::_("COM_SOCIALCOMMUNITY_ERROR_NOT_LOG_IN"), "notice");
$app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
return;
}
// Prepare layout data.
$this->layoutData = new JData();
$this->layoutData->layout = $this->layout;
$this->prepareDocument();
parent::display($tpl);
}
public function onAfterRoute()
{
$app = JFactory::getApplication();
if($app->isAdmin()){
return;
}
$menus = $app->getMenu('site');
$menu = $menus->getActive();
if(!$menu || $menu->home != 1) return;
$doc = JFactory::getDocument();
if($doc->getType() != 'html') return;
$params = JComponentHelper::getParams('com_xmlrpc');
if($params->get('show_rsd', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getRsdRoute());
$doc->addHeadLink($link, 'EditURI', 'rel', array('type' => 'application/rsd+xml', 'title'=>'RSD'));
}
if($params->get('show_manifest', 1)){
class_exists('XMLRPCHelperRoute') or require(JPATH_SITE.'/components/com_xmlrpc/helpers/route.php');
$link = JRoute::_(XMLRPCHelperRoute::getManifestRoute());
$doc->addHeadLink($link, 'wlwmanifest', 'rel', array('type'=>'application/wlwmanifest+xml'));
}
}
/**
* Get a list of logged users.
*
* @param JObject The module parameters.
* @return mixed An array of articles, or false on error.
*/
public static function getList($params)
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
$query = $db->getQuery(true);
$query->select('s.time, s.client_id, u.id, u.name, u.username');
$query->from('#__session AS s');
$query->leftJoin('#__users AS u ON s.userid = u.id');
$query->where('s.guest = 0');
$db->setQuery($query, 0, $params->get('count', 5));
try {
$results = $db->loadObjectList();
} catch (RuntimeException $e) {
JError::raiseError(500, $e->getMessage());
return false;
}
foreach ($results as $k => $result) {
$results[$k]->logoutLink = '';
if ($user->authorise('core.manage', 'com_users')) {
$results[$k]->editLink = JRoute::_('index.php?option=com_users&task=user.edit&id=' . $result->id);
$results[$k]->logoutLink = JRoute::_('index.php?option=com_login&task=logout&uid=' . $result->id . '&' . JSession::getFormToken() . '=1');
}
if ($params->get('name', 1) == 0) {
$results[$k]->name = $results[$k]->username;
}
}
return $results;
}
/**
* Method to request a username reminder.
*
* @return boolean
*
* @since 1.6
*/
public function remind()
{
// Check the request token.
JSession::checkToken('post') or jexit(JText::_('JINVALID_TOKEN'));
$model = $this->getModel('Remind', 'UsersModel');
$data = $this->input->post->get('jform', array(), 'array');
// Submit the password reset request.
$return = $model->processRemindRequest($data);
// Check for a hard error.
if ($return == false) {
// The request failed.
// Get the route to the next page.
$itemid = UsersHelperRoute::getRemindRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
$route = 'index.php?option=com_users&view=remind' . $itemid;
// Go back to the request form.
$message = JText::sprintf('Request failed: Your account is not activated yet or is under review. Please contact the admin more for details.', $model->getError());
$this->setRedirect(JRoute::_($route, false), $message, 'notice');
return false;
} else {
// The request succeeded.
// Get the route to the next page.
$itemid = UsersHelperRoute::getRemindRoute();
$itemid = $itemid !== null ? '&Itemid=' . $itemid : '';
$route = 'index.php?option=com_users&view=login' . $itemid;
// Proceed to step two.
$message = JText::_('COM_USERS_REMIND_REQUEST_SUCCESS');
$this->setRedirect(JRoute::_($route, false), $message);
return true;
}
}
function DefaultRedirectDetail($view)
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$redirect_to_event = $params->get("redirect_detail", 0);
if ($redirect_to_event == 1) {
$activeEvents = array();
$countevents = count($view->data['hours']['timeless']['events']);
if ($countevents > 1) {
return;
}
if ($countevents == 1) {
$activeEvents = $view->data['hours']['timeless']['events'];
}
for ($h = 0; $h < 24; $h++) {
$countevents += count($view->data['hours'][$h]['events']);
if ($countevents > 1) {
return;
}
if ($countevents == 1 && count($activeEvents) == 0) {
$activeEvents = $view->data['hours'][$h]['events'];
}
}
if ($countevents == 1) {
$row = $activeEvents[0];
$rowlink = $row->viewDetailLink($row->yup(), $row->mup(), $row->dup(), false);
$rowlink = JRoute::_($rowlink . $view->datamodel->getCatidsOutLink());
$rowlink = str_replace("&", "&", $rowlink);
JFactory::getApplication()->redirect($rowlink);
}
}
}
protected function _render($params = array())
{
$target = $this->_data->get('target', '') ? 'target="_blank"' : '';
$rel = $this->_data->get('rel', '');
$rel = !empty($rel) ? 'rel="' . $rel . '"' : '';
return '<a href="' . JRoute::_($this->_data->get('value', '')) . '" title="' . $this->getTitle() . '" ' . $target . ' ' . $rel . '>' . $this->getText() . '</a>';
}
/**
* Function that allows child controller access to model data after the data has been saved.
*
* @param JModelLegacy $model The data model object.
* @param array $validData The validated data.
*
* @return void
*
* @since 1.6
*/
protected function postSaveHook(JModelLegacy $model, $validData = array())
{
$task = $this->getTask();
if ($task == 'save') {
$this->setRedirect(JRoute::_('index.php?option=com_htraininglogs&view=h_cfg_fitnessunits', false));
}
}
/**
* Get the list of commands
*
* Will attempt to use information from the xml manifest if possible
*
* @return array
*/
public function getCommands()
{
$name = $this->getController()->getIdentifier()->name;
$package = $this->_identifier->package;
$manifest = JPATH_ADMINISTRATOR.'/components/com_'.$package.'/manifest.xml';
if(file_exists($manifest))
{
$xml = simplexml_load_file($manifest);
if(isset($xml->administration->submenu))
{
foreach($xml->administration->submenu->children() as $menu)
{
$view = (string)$menu['view'];
$this->addCommand(JText::_((string)$menu), array(
'href' => JRoute::_('index.php?option=com_'.$package.'&view='.$view),
'active' => ($name == KInflector::singularize($view))
));
}
}
}
return parent::getCommands();
}
/**
* Class constructor
*
* @param array $options Associative array of options
*
* @since 11.1
*/
public function __construct($options = array())
{
parent::__construct($options);
// Set document type
$this->_type = 'opensearch';
// Set mime type
$this->_mime = 'application/opensearchdescription+xml';
// Add the URL for self updating
$update = new JOpenSearchUrl();
$update->type = 'application/opensearchdescription+xml';
$update->rel = 'self';
$update->template = JRoute::_(JUri::getInstance());
$this->addUrl($update);
// Add the favicon as the default image
// Try to find a favicon by checking the template and root folder
$app = JFactory::getApplication();
$dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
foreach ($dirs as $dir) {
if (file_exists($dir . '/favicon.ico')) {
$path = str_replace(JPATH_BASE . '/', '', $dir);
$path = str_replace('\\', '/', $path);
$favicon = new JOpenSearchImage();
$favicon->data = JUri::base() . $path . '/favicon.ico';
$favicon->height = '16';
$favicon->width = '16';
$favicon->type = 'image/vnd.microsoft.icon';
$this->addImage($favicon);
break;
}
}
}
/**
* Helper method to return button list.
*
* This method returns the array by reference so it can be
* used to add custom buttons or remove default ones.
*
* @param JRegistry The module parameters.
*
* @return array An array of buttons
* @since 1.6
*/
public static function &getButtons($params)
{
$key = (string) $params;
if (!isset(self::$buttons[$key])) {
$context = $params->get('context', 'mod_quickicon');
if ($context == 'mod_quickicon') {
// Load mod_quickicon language file in case this method is called before rendering the module
JFactory::getLanguage()->load('mod_quickicon');
self::$buttons[$key] = array(array('link' => JRoute::_('index.php?option=com_content&task=article.add'), 'image' => 'header/icon-48-article-add.png', 'text' => JText::_('MOD_QUICKICON_ADD_NEW_ARTICLE'), 'access' => array('core.manage', 'com_content', 'core.create', 'com_content')), array('link' => JRoute::_('index.php?option=com_content'), 'image' => 'header/icon-48-article.png', 'text' => JText::_('MOD_QUICKICON_ARTICLE_MANAGER'), 'access' => array('core.manage', 'com_content')), array('link' => JRoute::_('index.php?option=com_categories&extension=com_content'), 'image' => 'header/icon-48-category.png', 'text' => JText::_('MOD_QUICKICON_CATEGORY_MANAGER'), 'access' => array('core.manage', 'com_content')), array('link' => JRoute::_('index.php?option=com_media'), 'image' => 'header/icon-48-media.png', 'text' => JText::_('MOD_QUICKICON_MEDIA_MANAGER'), 'access' => array('core.manage', 'com_media')), array('link' => JRoute::_('index.php?option=com_menus'), 'image' => 'header/icon-48-menumgr.png', 'text' => JText::_('MOD_QUICKICON_MENU_MANAGER'), 'access' => array('core.manage', 'com_menus')), array('link' => JRoute::_('index.php?option=com_users'), 'image' => 'header/icon-48-user.png', 'text' => JText::_('MOD_QUICKICON_USER_MANAGER'), 'access' => array('core.manage', 'com_users')), array('link' => JRoute::_('index.php?option=com_modules'), 'image' => 'header/icon-48-module.png', 'text' => JText::_('MOD_QUICKICON_MODULE_MANAGER'), 'access' => array('core.manage', 'com_modules')), array('link' => JRoute::_('index.php?option=com_installer'), 'image' => 'header/icon-48-extension.png', 'text' => JText::_('MOD_QUICKICON_EXTENSION_MANAGER'), 'access' => array('core.manage', 'com_installer')), array('link' => JRoute::_('index.php?option=com_languages'), 'image' => 'header/icon-48-language.png', 'text' => JText::_('MOD_QUICKICON_LANGUAGE_MANAGER'), 'access' => array('core.manage', 'com_languages')), array('link' => JRoute::_('index.php?option=com_config'), 'image' => 'header/icon-48-config.png', 'text' => JText::_('MOD_QUICKICON_GLOBAL_CONFIGURATION'), 'access' => array('core.manage', 'com_config', 'core.admin', 'com_config')), array('link' => JRoute::_('index.php?option=com_templates'), 'image' => 'header/icon-48-themes.png', 'text' => JText::_('MOD_QUICKICON_TEMPLATE_MANAGER'), 'access' => array('core.manage', 'com_templates')), array('link' => JRoute::_('index.php?option=com_admin&task=profile.edit&id=' . JFactory::getUser()->id), 'image' => 'header/icon-48-user-profile.png', 'text' => JText::_('MOD_QUICKICON_PROFILE'), 'access' => true));
} else {
self::$buttons[$key] = array();
}
// Include buttons defined by published quickicon plugins
JPluginHelper::importPlugin('quickicon');
$app = JFactory::getApplication();
$arrays = (array) $app->triggerEvent('onGetIcons', array($context));
foreach ($arrays as $response) {
foreach ($response as $icon) {
$default = array('link' => null, 'image' => 'header/icon-48-config.png', 'text' => null, 'access' => true);
$icon = array_merge($default, $icon);
if (!is_null($icon['link']) && !is_null($icon['text'])) {
self::$buttons[$key][] = $icon;
}
}
}
}
return self::$buttons[$key];
}
static function edit($weblink, $params, $attribs = array())
{
$user = JFactory::getUser();
$uri = JFactory::getURI();
if ($params && $params->get('popup')) {
return;
}
if ($weblink->state < 0) {
return;
}
JHtml::_('behavior.tooltip');
$url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
$icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
$text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), NULL, true);
if ($weblink->state == 0) {
$overlib = JText::_('JUNPUBLISHED');
} else {
$overlib = JText::_('JPUBLISHED');
}
$date = JHtml::_('date', $weblink->created);
$author = $weblink->created_by_alias ? $weblink->created_by_alias : $weblink->author;
$overlib .= '<br />';
$overlib .= $date;
$overlib .= '<br />';
$overlib .= htmlspecialchars($author, ENT_COMPAT, 'UTF-8');
$button = JHtml::_('link', JRoute::_($url), $text);
$output = '<span class="hasTip" title="' . JText::_('COM_WEBLINKS_EDIT') . ' :: ' . $overlib . '">' . $button . '</span>';
return $output;
}
static function getList(&$params)
{
//get database
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('MONTH(created) AS created_month, created, id, title, YEAR(created) AS created_year');
$query->from('#__content');
$query->where('state = 2 AND checked_out = 0');
$query->group('created_year DESC, created_month DESC');
// Filter by language
if (JFactory::getApplication()->getLanguageFilter()) {
$query->where('language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
}
$db->setQuery($query, 0, intval($params->get('count')));
$rows = (array) $db->loadObjectList();
$app = JFactory::getApplication();
$menu = $app->getMenu();
$item = $menu->getItems('link', 'index.php?option=com_content&view=archive', true);
$itemid = isset($item) && !empty($item->id) ? '&Itemid=' . $item->id : '';
$i = 0;
$lists = array();
foreach ($rows as $row) {
$date = JFactory::getDate($row->created);
$created_month = $date->format('n');
$created_year = $date->format('Y');
$created_year_cal = JHTML::_('date', $row->created, 'Y');
$month_name_cal = JHTML::_('date', $row->created, 'F');
$lists[$i] = new stdClass();
$lists[$i]->link = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid);
$lists[$i]->text = JText::sprintf('MOD_ARTICLES_ARCHIVE_DATE', $month_name_cal, $created_year_cal);
$i++;
}
return $lists;
}
/**
* Render the feed
*
* @access public
* @return string
*/
function render()
{
$now =& JFactory::getDate();
$data =& $this->_doc;
$uri =& JFactory::getURI();
$url = $uri->toString(array('scheme', 'user', 'pass', 'host', 'port'));
$syndicationURL =& JRoute::_('&format=feed&type=atom');
$feed = "<feed xmlns=\"http://www.w3.org/2005/Atom\" ";
if ($data->language != "") {
$feed .= " xml:lang=\"" . $data->language . "\"";
}
$feed .= ">\n";
$feed .= "\t<title type=\"text\">" . htmlspecialchars($data->title, ENT_COMPAT, 'UTF-8') . "</title>\n";
$feed .= "\t<subtitle type=\"text\">" . htmlspecialchars($data->description, ENT_COMPAT, 'UTF-8') . "</subtitle>\n";
$feed .= "\t<link rel=\"alternate\" type=\"text/html\" href=\"" . $url . "\"/>\n";
$feed .= "\t<id>" . str_replace(' ', '%20', $data->getBase()) . "</id>\n";
$feed .= "\t<updated>" . htmlspecialchars($now->toISO8601(), ENT_COMPAT, 'UTF-8') . "</updated>\n";
if ($data->editor != "") {
$feed .= "\t<author>\n";
$feed .= "\t\t<name>" . $data->editor . "</name>\n";
if ($data->editorEmail != "") {
$feed .= "\t\t<email>" . htmlspecialchars($data->editorEmail, ENT_COMPAT, 'UTF-8') . "</email>\n";
}
$feed .= "\t</author>\n";
}
$feed .= "\t<generator uri=\"http://joomla.org\" version=\"1.5\">" . $data->getGenerator() . "</generator>\n";
$feed .= '<link rel="self" type="application/atom+xml" href="' . str_replace(' ', '%20', $url . $syndicationURL) . "\" />\n";
for ($i = 0; $i < count($data->items); $i++) {
$feed .= "\t<entry>\n";
$feed .= "\t\t<title>" . htmlspecialchars(strip_tags($data->items[$i]->title), ENT_COMPAT, 'UTF-8') . "</title>\n";
$feed .= ' <link rel="alternate" type="text/html" href="' . $url . $data->items[$i]->link . "\"/>\n";
if ($data->items[$i]->date == "") {
$data->items[$i]->date = $now->toUnix();
}
$itemDate =& JFactory::getDate($data->items[$i]->date);
$feed .= "\t\t<published>" . htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8') . "</published>\n";
$feed .= "\t\t<updated>" . htmlspecialchars($itemDate->toISO8601(), ENT_COMPAT, 'UTF-8') . "</updated>\n";
$feed .= "\t\t<id>" . str_replace(' ', '%20', $url . $data->items[$i]->link) . "</id>\n";
if ($data->items[$i]->author != "") {
$feed .= "\t\t<author>\n";
$feed .= "\t\t\t<name>" . htmlspecialchars($data->items[$i]->author, ENT_COMPAT, 'UTF-8') . "</name>\n";
if ($data->items[$i]->authorEmail != "") {
$feed .= "\t\t<email>" . htmlspecialchars($data->items[$i]->authorEmail, ENT_COMPAT, 'UTF-8') . "</email>\n";
}
$feed .= "\t\t</author>\n";
}
if ($data->items[$i]->description != "") {
//$feed.= " <summary type=\"html\">".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."</summary>\n";
//$feed.= " <content type=\"html\">".htmlspecialchars($data->items[$i]->description, ENT_COMPAT, 'UTF-8')."</content>\n";
$feed .= "\t\t<summary type=\"html\">" . htmlspecialchars($this->_relToAbs($data->items[$i]->description)) . "</summary>\n";
$feed .= "\t\t<content type=\"html\">" . htmlspecialchars($this->_relToAbs($data->items[$i]->description)) . "</content>\n";
}
if ($data->items[$i]->enclosure != NULL) {
$feed .= "\t\t<link rel=\"enclosure\" href=\"" . $data->items[$i]->enclosure->url . "\" type=\"" . $data->items[$i]->enclosure->type . "\" length=\"" . $data->items[$i]->enclosure->length . "\" />\n";
}
$feed .= "\t</entry>\n";
}
$feed .= "</feed>\n";
return $feed;
}