Пример #1
0
 function checkpassword($view, $type)
 {
     $url = JURI::current();
     $session =& JFactory::getSession();
     $login = $session->get('com_wedding.' . $view . 'login', 0);
     if (!$login) {
         $juser =& JFactory::getUser();
         $username = JRequest::getString('user', $juser->username);
         require_once JPATH_COMPONENT_ADMINISTRATOR . DS . 'helpers' . DS . 'general.php';
         $profile_id = generalHelpers::getUserId($username);
         if (is_null($profile_id)) {
             $profile_id = $juser->id;
         }
         if ($profile_id != $juser->id) {
             $url = 'index.php?option=com_wedding&view=' . $view;
             $dbo =& JFactory::getDbo();
             $query = "SELECT id FROM #__wedding_apps WHERE `url` = '{$url}'";
             $dbo->setQuery($query);
             $app_id = $dbo->loadResult();
             $query = "SELECT `password` FROM #__wedding_userapps WHERE user_id = {$profile_id} AND app_id = {$app_id}";
             $dbo->setQuery($query);
             $password = $dbo->loadResult();
             if (!empty($password)) {
                 $uri = JFactory::getURI();
                 $url = $uri->toString(array('path', 'query', 'fragment'));
                 $this->_view =& $this->getView('auth', $type);
                 $this->_view->addTemplatePath(JPATH_COMPONENT . DS . 'templates' . DS . 'default' . DS);
                 $this->_view->setLayout('auth.default');
                 $this->_view->display($view, $uri, $profile_id, $app_id);
                 exit;
             }
         }
     }
     return false;
 }
Пример #2
0
 protected static function _typo($typo, $field, $value, &$config = array())
 {
     $app = JFactory::getApplication();
     $html = $typo->get('html', '');
     if (!(strpos($html, '<a href') !== false || strpos($html, '*link*') !== false || strpos($html, 'getLink') !== false)) {
         $html = parent::g_hasLink($field, $typo, $html);
     }
     if ($html != '') {
         $matches = '';
         $search = '#\\*([a-zA-Z0-9_]*)\\*#U';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             foreach ($matches[1] as $target) {
                 if (isset($field->{$target})) {
                     if (is_array($field->{$target})) {
                         $html = str_replace('*' . $target . '*', isset($field->{$target}[0]) ? $field->{$target}[0] : '', $html);
                     } else {
                         $html = str_replace('*' . $target . '*', $field->{$target}, $html);
                     }
                 }
             }
         }
     }
     if ($html != '' && strpos($html, '$cck->get') !== false) {
         $matches = '';
         $search = '#\\$cck\\->get([a-zA-Z0-9_]*)\\( ?\'([a-zA-Z0-9_,]*)\' ?\\)(;)?#';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             parent::g_addProcess('beforeRenderContent', self::$type, $config, array('name' => $field->name, 'matches' => $matches));
         }
     }
     if ($html != '' && strpos($html, '$uri->get') !== false) {
         $matches = '';
         $search = '#\\$uri\\->get([a-zA-Z]*)\\( ?\'?([a-zA-Z0-9_]*)\'? ?\\)(;)?#';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             foreach ($matches[1] as $k => $v) {
                 $variable = $matches[2][$k];
                 if ($v == 'Current') {
                     $request = $variable == 'true' ? JURI::getInstance()->toString() : JURI::current();
                     $html = str_replace($matches[0][$k], $request, $html);
                 } else {
                     $request = 'get' . $v;
                     $html = str_replace($matches[0][$k], $app->input->{$request}($variable, ''), $html);
                 }
             }
         }
     }
     if ($html != '' && strpos($html, 'J(') !== false) {
         $matches = '';
         $search = '#J\\((.*)\\)#U';
         preg_match_all($search, $html, $matches);
         if (count($matches[1])) {
             foreach ($matches[1] as $text) {
                 $html = str_replace('J(' . $text . ')', JText::_('COM_CCK_' . str_replace(' ', '_', trim($text))), $html);
             }
         }
     }
     return $html;
 }
Пример #3
0
 /**
  * Set URL for different theme settings
  *
  * $add_var contains the variable name and values that needs to be set. Format of this array is:
  * $add_var = array( variable_name=> array( all variable possible values ) )
  * 
  * $replace_vars contains all variables that need to be unset from the current URI. It can contain multiple variables
  * $replace_vars = array( variable_name=> array( all variable possible values ) )
  * 
  * Response is returned as array having the exact same order as the values array from $add_var. 
  * 
  * @param array $add_var
  * @param array $replace_vars
  * @return array
  */
 function toolbox_urls($add_var, $replace_vars)
 {
     $jinput = JFactory::getApplication()->input;
     $my_vars = $jinput->getArray($_GET);
     $my_request = JURI::current();
     $my_request = str_replace('&', '&amp;', $my_request);
     // clean link of unwanted variables
     if (is_array($replace_vars)) {
         foreach ($replace_vars as $var => $vals) {
             $exp = '(&amp;)?(\\?)?' . $var . '=(' . implode('|', $vals) . ')';
             $my_request = preg_replace("#{$exp}#", '', $my_request);
         }
     }
     $liant = strstr($my_request, '?') ? '&amp;' : '?';
     $response = array();
     // determine the new variable
     $var = array_keys($add_var);
     $new_var = $var[0];
     // check if variable is already set
     if (array_key_exists($new_var, $my_vars)) {
         $current_value = $my_vars[$new_var];
         foreach ($add_var[$new_var] as $val) {
             $response[$val] = $my_request . $liant . $new_var . '=' . $val;
         }
     } else {
         foreach ($add_var[$new_var] as $var => $val) {
             $response[$val] = $my_request . $liant . $new_var . '=' . $val;
         }
     }
     return $response;
 }
Пример #4
0
 /**
  * Display the view
  *
  * @param   string  $tpl  Template name
  *
  * @return void
  *
  * @throws Exception
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $user = JFactory::getUser();
     if ($user->guest) {
         error_log("Guest User - send him to login page.");
         $message = "You must be logged in to submit a recipe.";
         $url = JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode(JURI::current()));
         $app->redirect($url, $message);
     }
     $canEdit = $user->authorise('core.edit', 'com_akrecipes') || $user->authorise('core.create', 'com_akrecipes');
     if (!$canEdit && $user->authorise('core.edit.own', 'com_akrecipes')) {
         $canEdit = $user->id == $table->created_by;
     }
     $this->state = $this->get('State');
     $this->item = $this->get('Data');
     $this->params = $app->getParams('com_akrecipes');
     $this->canSave = $this->get('CanSave');
     $this->form = $this->get('Form');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors));
     }
     if (!empty($this->item->access) && !in_array($this->item->access, $user->getAuthorisedViewLevels())) {
         JError::raiseError(403, JText::_('JERROR_ALERTNOAUTHOR'));
         return false;
         //throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
     }
     $this->_prepareDocument();
     parent::display($tpl);
 }
Пример #5
0
 /**
  * Method for logging out with Magento (Single Sign On)
  * 
  * @param string $username
  * @return bool|exit
  */
 public static function doSSOLogout($username = null)
 {
     // Abort if the input is not valid
     if (empty($username)) {
         return false;
     }
     // Get system variables
     $application = JFactory::getApplication();
     $session = JFactory::getSession();
     // Determine the application
     $application_name = $application->isAdmin() ? 'admin' : 'frontend';
     // Get the security token
     $token = method_exists('JSession', 'getFormToken') ? JSession::getFormToken() : JUtility::getToken();
     // Set the redirection URL
     if ($application_name == 'admin') {
         $redirect = JURI::current();
     } else {
         $redirect = MageBridgeUrlHelper::current();
     }
     // Construct the URL
     $arguments = array('sso=logout', 'app=' . $application_name, 'redirect=' . base64_encode($redirect), 'userhash=' . MageBridgeEncryptionHelper::encrypt($username), 'token=' . $token);
     $url = MageBridgeModelBridge::getInstance()->getMagentoBridgeUrl() . '?' . implode('&', $arguments);
     // Redirect the browser to Magento
     MageBridgeModelDebug::getInstance()->notice("SSO: Logout of '{$username}' from " . $application_name);
     $application->redirect($url);
     return true;
 }
Пример #6
0
 /**
  * Configure the Linkbar.
  */
 public static function addSubmenu($vName = '')
 {
     //Process notifications. Adding this here, as it is only rendered when there is data to be rendered
     //i.e avoids ajax and redirect requests, which we do not want to have such notifications added to.
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_jhackguard/data/.rules_need_update')) {
         JFactory::getApplication()->enqueueMessage(JText::_('COM_JHACKGUARD_PLUGIN_RULES_CACHE_REBUILD_NEEDED') . ' <a href="' . JURI::current() . '?option=com_jhackguard&view=filtermaintenance">' . JText::_('COM_JHACKGUARD_TITLE_FILTERMAINTENANCE') . '</a>', 'warning');
     }
     //Try to determine if an update was performed in the past 24 hours.
     if (file_exists(JPATH_ADMINISTRATOR . '/components/com_jhackguard/data/.rules_updated_timestamp')) {
         $rut = unserialize(file_get_contents(JPATH_ADMINISTRATOR . '/components/com_jhackguard/data/.rules_updated_timestamp'));
         if (is_array($rut) and $rut['expires'] < time()) {
             $rut = JhackguardHelper::checkForFilterUpdates();
         }
     } else {
         $rut = JhackguardHelper::checkForFilterUpdates();
     }
     //Determine if we shuold display an update message.
     if (is_array($rut)) {
         if ($rut['success']) {
             if ($rut['insert'] > 0 or $rut['update'] > 0) {
                 JFactory::getApplication()->enqueueMessage('An update to your filters is required. The following items are available: ' . $rut['insert'] . ' new and ' . $rut['update'] . ' updates. Please navigate to <a href="' . JURI::current() . '?option=com_jhackguard&view=filtermaintenance">Filter Maintenance</a> page and click on the \'Update Rules\' button, in order to fetch the latest security filters for your Joomla.', 'warning');
             }
         } else {
             JFactory::getApplication()->enqueueMessage($rut['msg'], 'error');
         }
     }
     JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_IPFILTERS'), 'index.php?option=com_jhackguard&view=ipfilters', $vName == 'ipfilters');
     JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_INPUTFILTERS'), 'index.php?option=com_jhackguard&view=inputfilters', $vName == 'inputfilters');
     JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_OUTPUTFILTERS'), 'index.php?option=com_jhackguard&view=outputfilters', $vName == 'outputfilters');
     JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_FILTERMAINTENANCE'), 'index.php?option=com_jhackguard&view=filtermaintenance', $vName == 'filtermaintenance');
     JHtmlSidebar::addEntry(JText::_('COM_JHACKGUARD_TITLE_LOGS'), 'index.php?option=com_jhackguard&view=logs', $vName == 'logs');
 }
 /**
  * Generate content
  * @param   object      The article object.  Note $article->text is also available
  * @param   object      The article params
  * @param   boolean     Modules context
  * @return  string      Returns html code or empty string.
  */
 private function getContent(&$article, &$params, $moduleContext = false)
 {
     $doc = JFactory::getDocument();
     /* @var $doc JDocumentHtml */
     $doc->addStyleSheet(JURI::root() . "plugins/content/fastsocialshare/style/style.css");
     $uriInstance = JURI::getInstance();
     if (!$moduleContext) {
         if (!class_exists('ContentHelperRoute')) {
             include_once JPATH_SITE . '/components/com_content/helpers/route.php';
         }
         $url = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug), false);
         $root = rtrim($uriInstance->getScheme() . '://' . $uriInstance->getHost(), '/');
         $url = $root . $url;
         $title = htmlentities($article->title, ENT_QUOTES, "UTF-8");
     } else {
         $url = JURI::current();
         $title = htmlentities($doc->title, ENT_QUOTES, "UTF-8");
     }
     $html = $this->getFacebookLike($this->params, $url, $title);
     $html .= $this->getFacebookShareMe($this->params, $url, $title);
     $html .= $this->getTwitter($this->params, $url, $title);
     $html .= $this->getGooglePlusOne($this->params, $url, $title);
     $html .= $this->getLinkedIn($this->params, $url, $title);
     $html .= $this->getPinterest($this->params, $url, $title);
     return '<div class="fastsocialshare_container">' . $html . '<div class="fastsocialshare_clearer"></div></div>';
 }
Пример #8
0
 /**
  * Adds the OpenGraph information on the page
  *
  * @param   array  $data  - the array containing the open graph data
  *
  * @return void
  */
 public static function add($data)
 {
     $document = JFactory::getDocument();
     $document->addCustomTag('<meta property="og:url" content="' . JURI::current() . '" />');
     if (isset($data['type'])) {
         if ($data['type'] == 'place') {
             if (isset($data['lat']) && isset($data['lng'])) {
                 $document->addCustomTag('<meta property="og:type" content="' . $data['type'] . '" />');
                 $document->addCustomTag('<meta property="place:location:latitude" content="' . $data['lat'] . '" />');
                 $document->addCustomTag('<meta property="place:location:longitude" content="' . $data['lng'] . '" />');
             }
         } else {
             $document->addCustomTag('<meta property="og:type" content="' . $data['type'] . '" />');
         }
     }
     if (isset($data['title'])) {
         $document->addCustomTag('<meta property="og:title" content="' . self::escape(JHtmlString::truncate(strip_tags($data['title']), 150)) . '" />');
     }
     if (isset($data['description'])) {
         $document->addCustomTag('<meta property="og:description" content="' . self::escape(JHtmlString::truncate(strip_tags($data['description'], 200))) . '" />');
     }
     if (isset($data['image']) && strlen($data['image'])) {
         $document->addCustomTag('<meta property="og:image" content="' . $data['image'] . '" />');
     }
 }
Пример #9
0
 /**
  * Method to get the meta-data
  *
  * @return array
  */
 public function getRequestData()
 {
     // Compile the meta-data
     if (empty($this->_meta_data) || !is_array($this->_meta_data)) {
         $application = JFactory::getApplication();
         $input = $application->input;
         $user = JFactory::getUser();
         $uri = JURI::getInstance();
         $session = JFactory::getSession();
         $config = JFactory::getConfig();
         $storeHelper = MageBridgeStoreHelper::getInstance();
         $bridge = MageBridgeModelBridge::getInstance();
         $app_type = $storeHelper->getAppType();
         $app_value = $storeHelper->getAppValue();
         $arguments = array('api_session' => $bridge->getApiSession(), 'api_user' => MageBridgeEncryptionHelper::encrypt(MagebridgeModelConfig::load('api_user')), 'api_key' => MageBridgeEncryptionHelper::encrypt(MagebridgeModelConfig::load('api_key')), 'api_url' => JURI::root() . 'component/magebridge/?controller=jsonrpc&task=call', 'app' => $application->getClientId(), 'app_type' => $app_type, 'app_value' => $app_value, 'storeview' => MagebridgeModelConfig::load('storeview'), 'storegroup' => MagebridgeModelConfig::load('storegroup'), 'website' => MagebridgeModelConfig::load('website'), 'customer_group' => MagebridgeModelConfig::load('customer_group'), 'joomla_url' => $bridge->getJoomlaBridgeUrl(), 'joomla_sef_url' => $bridge->getJoomlaBridgeSefUrl(), 'joomla_sef_suffix' => (int) MageBridgeUrlHelper::hasUrlSuffix(), 'joomla_user_email' => $application->isSite() && !empty($user->email) ? $user->email : null, 'joomla_current_url' => $uri->current(), 'modify_url' => MagebridgeModelConfig::load('modify_url'), 'enforce_ssl' => MagebridgeModelConfig::load('enforce_ssl'), 'has_ssl' => (int) $uri->isSSL(), 'payment_urls' => MagebridgeModelConfig::load('payment_urls'), 'enable_messages' => MagebridgeModelConfig::load('enable_messages'), 'joomla_session' => session_id(), 'joomla_conf_caching' => $config->get('caching', 60), 'joomla_conf_lifetime' => $config->get('lifetime', 60) * 60, 'magento_session' => $bridge->getMageSession(), 'magento_persistent_session' => $bridge->getMagentoPersistentSession(), 'magento_user_allowed_save_cookie' => isset($_COOKIE['user_allowed_save_cookie']) ? $_COOKIE['user_allowed_save_cookie'] : null, 'request_uri' => MageBridgeUrlHelper::getRequest(), 'request_id' => md5(JURI::current() . serialize($input->get->getArray())), 'post' => !empty($_POST) ? $_POST : null, 'http_referer' => $bridge->getHttpReferer(), 'http_host' => $uri->toString(array('host')), 'user_agent' => isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '', 'remote_addr' => isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '', 'supportkey' => MagebridgeModelConfig::load('supportkey'), 'debug' => (int) MageBridgeModelDebug::isDebug(), 'debug_level' => MagebridgeModelConfig::load('debug_level'), 'debug_display_errors' => MagebridgeModelConfig::load('debug_display_errors'), 'protocol' => MagebridgeModelConfig::load('protocol'), 'state' => 'initializing', 'ajax' => (int) $bridge->isAjax(), 'disable_css' => MageBridgeHelper::getDisableCss(), 'disable_js' => MageBridgeHelper::getDisableJs());
         if (MageBridgeTemplateHelper::isMobile()) {
             $arguments['theme'] = MagebridgeModelConfig::load('mobile_magento_theme');
         } else {
             $arguments['theme'] = MagebridgeModelConfig::load('magento_theme');
         }
         foreach ($arguments as $name => $value) {
             if (is_string($value)) {
                 $arguments[$name] = MageBridgeEncryptionHelper::base64_encode($value);
             }
         }
         $this->_meta_data = $arguments;
     }
     return $this->_meta_data;
 }
Пример #10
0
function sp_gplus_button_addon($atts)
{
    extract(spAddonAtts(array('size' => '', 'annotation' => '', 'width' => ''), $atts));
    $doc = JFactory::getDocument();
    $doc->addScript('https://apis.google.com/js/plusone.js');
    $output = '<div class="g-plusone" data-href="' . JURI::current() . '" data-size="' . $size . '" data-annotation="' . $annotation . '"></div>';
    return $output;
}
Пример #11
0
 function __construct($module, $params)
 {
     jimport('joomla.filesystem.file');
     // configuration array
     $this->config = $params->toArray();
     if ($this->config['fb_auto_url'] == 'true' && $this->config['fb_data_source'] != 'like_box') {
         $this->config['fb_site'] = JURI::current();
     }
 }
Пример #12
0
 protected function _prepareDocument()
 {
     $config = JFactory::getConfig();
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $title = '';
     $menu = $menus->getActive();
     //Title
     if (isset($meta['title']) && $meta['title']) {
         $title = $meta['title'];
     } else {
         if ($menu) {
             if ($menu->params->get('page_title', '')) {
                 $title = $menu->params->get('page_title');
             } else {
                 $title = $menu->title;
             }
         }
     }
     //Include Site title
     $sitetitle = $title;
     if ($config->get('sitename_pagetitles') == 2) {
         $sitetitle = $title . ' | ' . $config->get('sitename');
     } elseif ($config->get('sitename_pagetitles') == 1) {
         $sitetitle = $config->get('sitename') . ' | ' . $title;
     }
     $doc->setTitle($sitetitle);
     $doc->addCustomTag('<meta content="' . $title . '" property="og:title" />');
     $this->document->addCustomTag('<meta content="website" property="og:type"/>');
     $this->document->addCustomTag('<meta content="' . JURI::current() . '" property="og:url" />');
     $og_title = $this->page->og_title;
     if ($og_title) {
         $this->document->addCustomTag('<meta content="' . $og_title . '" property="og:title" />');
     }
     $og_image = $this->page->og_image;
     if ($og_image) {
         $this->document->addCustomTag('<meta content="' . JURI::root() . $og_image . '" property="og:image" />');
     }
     $og_description = $this->page->og_description;
     if ($og_description) {
         $this->document->addCustomTag('<meta content="' . $og_description . '" property="og:description" />');
     }
     if ($menu) {
         if ($menu->params->get('menu-meta_description')) {
             $this->document->setDescription($menu->params->get('menu-meta_description'));
         }
         if ($menu->params->get('menu-meta_keywords')) {
             $this->document->setMetadata('keywords', $menu->params->get('menu-meta_keywords'));
         }
         if ($menu->params->get('robots')) {
             $this->document->setMetadata('robots', $menu->params->get('robots'));
         }
     }
 }
    public static function display($params)
    {
        $fbrender = $params->get('rendering', 'xfbml');
        $fbhref = !$params->get("fb_url", '') ? JURI::current() : $params->get("fb_url", '');
        $fbtrigger = $params->get("fbtrigger", 'X%');
        $fbread_time = $params->get("fbread_time", "30");
        $fbflike_action = $params->get("fbflike_action", "like");
        $fbside = $params->get("fbside");
        $fbnumposts = $params->get('fbnum_recommendations', '');
        // Generate code
        switch ($fbrender) {
            case 'xfbml':
                // XFBML
                $html = '
					<fb:recommendations-bar 
					href="' . $fbhref . '" 
					trigger="' . $fbtrigger . '" 
					read_time="' . $fbread_time . '" 
					action="' . $fbflike_action . '" 
					side="' . $fbside . '" ';
                if ($params->get("fbdomain", '')) {
                    $html .= ' site="' . $params->get("fbdomain") . '"';
                }
                if ($params->get("fbnum_recommendations", 2)) {
                    $html .= ' num_recommendations="' . $params->get("fbnum_recommendations", 2) . '"';
                }
                if ($params->get("fbmax_age")) {
                    $html .= ' max_age="' . $params->get("fbmax_age") . '"';
                }
                $html .= '></fb:recommendations-bar>';
                break;
            default:
                // HTML5
                $html = '
					<div 
					class="fb-recommendations-bar"  
					data-href="' . $fbhref . '" 
					data-trigger="' . $fbtrigger . '" 
					data-read-time="' . $fbread_time . '" 
					data-action="' . $fbflike_action . '" 
					data-side="' . $fbside . '" 
				';
                if ($params->get("fbdomain")) {
                    $html .= ' data-site="' . $params->get("fbdomain", '') . '" ';
                }
                if ($params->get("fbnum_recommendations", 2)) {
                    $html .= ' data-num-recommendations="' . $params->get("fbnum_recommendations", 2) . '" ';
                }
                if ($params->get("fbmax_age")) {
                    $html .= ' data-max-age="' . $params->get("fbmax_age", 0) . '" ';
                }
                $html .= '></div>';
                break;
        }
        return $html;
    }
Пример #14
0
 function onBeforeCompileHead()
 {
     if (strpos(JURI::current(), "/administrator/") === FALSE) {
         $embed = '<script data-cfasync="false" src="//fast.eager.io/{{.EmbedCode}}.js"></script>';
         $head = JFactory::getDocument()->getHeadData();
         array_push($head['custom'], $embed);
         JFactory::getDocument()->setHeadData($head);
     }
     return true;
 }
Пример #15
0
function N2JoomlaExit()
{
    if (N2Platform::$isAdmin) {
        $lifetime = JFactory::getConfig()->get('lifetime');
        if (empty($lifetime)) {
            $lifetime = 60;
        }
        $lifetime = min(max(intval($lifetime) - 1, 9), 60 * 24);
        N2JS::addInline('setInterval(function(){$.ajax({url: "' . JURI::current() . '", cache: false});}, ' . $lifetime * 60 * 1000 . ');');
    }
}
Пример #16
0
        public static function like($mostra_na_pagina_inicial = FALSE, $url = NULL, $send = TRUE, $width = 450, $show_faces = TRUE){
	
	//@todo: implementar $mostra_na_pagina_inicial

	if ($url == NULL){$url = JURI::current(); }
	if ( $send == TRUE){ $send = 'true'; } else { $send = 'false'; }
	if ( $show_faces == TRUE){ $show_faces = 'true'; } else { $show_faces = 'false'; }
	
	$facebook_like = '<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="'.$url.'" send="'.$send.'" width="'.$width.'" show_faces="'.$show_faces.'" font=""></fb:like>';
	
	return $facebook_like;	
}
Пример #17
0
 public function onBeforeDisplayProduct($tmpl, $var, $product)
 {
     $position = $this->params->get('position', 'after');
     $content = $this->params->get('content', 'all');
     if (($position == 'both' || $position == 'before') && (JRequest::getString("option") == "com_redshop" && JRequest::getString("view") == "product")) {
         if ($content == "all" || $content == "rs") {
             $image_url = JURI::root() . 'components/com_redshop/assets/images/product/' . $product->product_full_image;
             $item_link = JURI::current();
             return $this->render($product->product_name, $image_url, $item_link, 'redShop');
         }
     }
 }
Пример #18
0
 public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
 {
     static $count = 0;
     $app = JFactory::getApplication();
     $config = JFactory::getConfig();
     $doc = JFactory::getDocument();
     $menu = $app->getMenu();
     $option = JRequest::getVar('option', '');
     $view = JRequest::getVar('view', '');
     $scope = $option . '.' . $view;
     //Ensure that we are not in the back-end
     if ($app->isAdmin()) {
         return true;
     }
     // Use global config data for default menu item
     if ($menu->getActive() == $menu->getDefault()) {
         // The canonical URL of the page.
         $doc->setMetadata('og:url', JURI::current());
         // The type of object.
         $doc->setMetadata('og:type', 'website');
         // The name of the overall site.
         $doc->setMetadata('og:site_name', htmlspecialchars($config->get('sitename')));
         // The title of the site.
         $doc->setMetadata('og:title', htmlspecialchars($config->get('sitename')));
         // The description of the site.
         $doc->setMetadata('og:description', htmlspecialchars($config->get('MetaDesc')));
         // Ensure we we haven't executed before and are in the right scope.
     } elseif ($count == 0 && in_array($scope, array('com_content.article', 'com_content.category', 'com_content.featured'))) {
         // The canonical URL of the page.
         $doc->setMetadata('og:url', JURI::current());
         // The type of object.
         $doc->setMetadata('og:type', 'article');
         // The title of the object.
         $title = str_replace(array('"', "'"), '', $row->title);
         if (isset($row->title)) {
             $doc->setMetadata('og:title', htmlspecialchars($title));
         }
         // A description of the object.
         if (isset($row->introtext)) {
             // Sanitize introtext of other plugin shortcodes
             $row->introtext = preg_replace("/{[^}]*}/i", " ", $row->introtext);
             // First 255 characters of the introtext, sans HTML, with extra spaces removed.
             $description = preg_replace("/\\s{2,}/", " ", substr(strip_tags($row->introtext), 0, 255));
             $doc->setMetadata('og:description', $description . '...');
         }
         // An image URL which represents the object
         preg_match('/<img.+src=[\\"]([^\\"]+)[\\"].*>/i', $row->introtext, $image);
         if (isset($image[1]) && $image[1] != '') {
             $doc->setMetadata('og:image', JURI::base() . $image[1]);
         }
         $count++;
     }
 }
Пример #19
0
 /**
  * Translates an internal Joomla URL to a humanly readible URL.
  *
  * @param   string   $url    Absolute or Relative URI to Joomla resource.
  * @param   boolean  $xhtml  Replace & by &amp; for XML compilance.
  * @param   integer  $ssl    Secure state for the resolved URI.
  *                             1: Make URI secure using global secure site URI.
  *                             0: Leave URI in the same secure state as it was passed to the function.
  *                            -1: Make URI unsecure using the global unsecure site URI.
  *
  * @return  The translated humanly readible URL.
  *
  * @since   11.1
  */
 public static function _($url, $xhtml = true, $ssl = null)
 {
     // Get the router.
     $app = JFactory::getApplication();
     $router = $app->getRouter();
     // Make sure that we have our router
     if (!$router) {
         return null;
     }
     if (strpos($url, '&') !== 0 && strpos($url, 'index.php') !== 0) {
         return $url;
     }
     // Build route.
     $uri = $router->build($url);
     $url = $uri->toString(array('path', 'query', 'fragment'));
     if (JPATH_BASE == JPATH_ADMINISTRATOR) {
         $config = JFactory::getConfig();
         $live_site = $config->get('live_site');
         if (trim($live_site) != '') {
             $url = JURI::current() . $url;
         }
     }
     // Replace spaces.
     $url = preg_replace('/\\s/u', '%20', $url);
     /*
      * Get the secure/unsecure URLs.
      *
      * If the first 5 characters of the BASE are 'https', then we are on an ssl connection over
      * https and need to set our secure URL to the current request URL, if not, and the scheme is
      * 'http', then we need to do a quick string manipulation to switch schemes.
      */
     if ((int) $ssl) {
         $uri = JURI::getInstance();
         // Get additional parts.
         static $prefix;
         if (!$prefix) {
             $prefix = $uri->toString(array('host', 'port'));
         }
         // Determine which scheme we want.
         $scheme = (int) $ssl === 1 ? 'https' : 'http';
         // Make sure our URL path begins with a slash.
         if (!preg_match('#^/#', $url)) {
             $url = '/' . $url;
         }
         // Build the URL.
         $url = $scheme . '://' . $prefix . $url;
     }
     if ($xhtml) {
         $url = htmlspecialchars($url);
     }
     return $url;
 }
Пример #20
0
 private function route()
 {
     $current = str_replace(JURI::base(), '', JURI::current());
     $pos = strpos('#' . $current, 'article/');
     if ($pos) {
         $id = (int) str_replace("article/", "", $current);
         JRequest::setVar('option', 'com_content', 'get');
         JRequest::setVar('view', 'article', 'get');
         JRequest::setVar('id', $id, 'get');
         return true;
     } else {
         return true;
     }
 }
 public function getInput()
 {
     if ($this->fb->getUser()) {
         $user = $this->fb->getUser();
         $profile = $this->fb->api("/me?fields=id,name,picture");
         $label = "<img src='" . $profile['picture']['data']['url'] . "' />" . $profile['name'];
         $logout = $this->fb->getLogoutUrl(array('next' => JURI::base()));
         return $label . "<br /><a href='" . $logout . "'>Log out of Facebook</a>";
     } else {
         // Not logged in - display a login link
         $uri = JURI::current();
         $loginUrl = $this->fb->getLoginUrl(array('redirect_uri' => "http://aquinas.dphin.co.uk/login/profile?layout=edit"));
         return "<a href='" . $loginUrl . "'>Connect your Facebook account</a>";
     }
 }
Пример #22
0
 public static function generateMeta($item)
 {
     $document = JFactory::getDocument();
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $menu = $menus->getActive();
     $title = null;
     $document->setTitle($item->title);
     $document->addCustomTag('<meta content="website" property="og:type"/>');
     $document->addCustomTag('<meta content="' . JURI::current() . '" property="og:url" />');
     $document->setDescription(JHtml::_('string.truncate', $item->description, 155, false, false));
     $document->addCustomTag('<meta content="' . $item->title . '" property="og:title" />');
     $document->addCustomTag('<meta content="' . JURI::root() . $item->image . '" property="og:image" />');
     $document->addCustomTag('<meta content="' . JHtml::_('string.truncate', $item->description, 155, false, false) . '" property="og:description" />');
     return true;
 }
Пример #23
0
 /**
  * Display method override
  *
  * @param bool $cachable
  * @param bool $urlparams
  */
 public function display($cachable = false, $urlparams = false)
 {
     // make sure user is logued in
     if (!$this->app->user->get()->id) {
         $this->setRedirect($this->app->link(array('option' => 'com_users', 'view' => 'login', 'return' => base64_encode(JURI::current())), false), JText::_('PLG_ZOOCART_ERROR_LOGIN_REQUIRED'), 'notice');
         return;
     }
     // get Joomla application
     $this->joomla = $this->app->system->application;
     // get addresses
     $this->resources = array('billing' => array(), 'shipping' => array());
     foreach ($this->getResources() as $address) {
         $this->resources[$address->type][] = $address;
     }
     // display
     $this->getView()->setLayout('default')->display();
 }
Пример #24
0
 function display()
 {
     $app = JFactory::getApplication();
     $doc = JFactory::getDocument();
     $params = $app->getParams();
     $feedEmail = @$app->getCfg('feed_email') ? $app->getCfg('feed_email') : 'author';
     $siteEmail = $app->getCfg('mailfrom');
     // Get some data from the model
     $app->input->set('limit', $app->get('feed_limit'));
     $rows = $this->get('Items');
     $doc->setLink(JURI::current());
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('tz_portfolio_plus_mediatype');
     foreach ($rows as $row) {
         // Compute the article slug
         $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id;
         $row->description = $params->get('feed_summary', 0) ? $row->introtext . $row->fulltext : $row->introtext;
         $results = $dispatcher->trigger('onContentDisplayMediaType', array('com_tz_portfolio_plus.tags', &$row, &$params, 0));
         $media = implode("\n", $results);
         // strip html from feed item title
         $title = $this->escape($row->title);
         $title = html_entity_decode($title, ENT_COMPAT, 'UTF-8');
         $link = $row->fullLink;
         // strip html from feed item description text
         // TODO: Only pull fulltext if necessary (actually, just get the necessary fields).
         $description = $row->description;
         $author = $row->created_by_alias ? $row->created_by_alias : $row->author;
         @($date = $row->created ? date('r', strtotime($row->created)) : '');
         // load individual item creator class
         $item = new JFeedItem();
         $item->title = $title;
         $item->link = $link;
         $item->description = $media . $description;
         $item->date = $date;
         $item->category = $item->category;
         $item->author = $author;
         if ($feedEmail == 'site') {
             $item->authorEmail = $siteEmail;
         } else {
             $item->authorEmail = $item->author_email;
         }
         // loads item info into rss array
         $doc->addItem($item);
     }
 }
Пример #25
0
 protected function getInput()
 {
     $name = basename(realpath(dirname(__FILE__) . "/../.."));
     static $resources = true;
     if ($resources) {
         $resources = false;
         $document = JFactory::getDocument();
         // Alternative code: $type = strtolower($this->type);
         $type = (string) $this->element["type"];
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript(JURI::current() . "?option=" . $name . "&amp;view=loader&amp;type=js&amp;filename=" . $type);
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JURI::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
     }
     return '<div id="album_selection">' . parent::getInput() . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JURI::root(true) . '/components/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_OUTGOING_CONNECTION_FAILED") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>';
 }
Пример #26
0
function sp_twitter_share_addon($atts)
{
    extract(spAddonAtts(array('showcount' => '', 'size' => ''), $atts));
    $output = '';
    if (!defined('_SPPB_TWITTER')) {
        define('_SPPB_TWITTER', 1);
        $output .= "<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>";
    }
    $data = '';
    if (!$showcount) {
        $data .= ' data-count="none"';
    }
    if ($size == 'large') {
        $data .= ' data-size="large"';
    }
    $output .= '<a href="' . JURI::current() . '" class="twitter-share-button" ' . $data . '>Tweet</a>';
    return $output;
}
Пример #27
-1
 /**
  * Fetch the HTML for the button
  *
  * @param   string   $type  Unused string.
  * @param   string   $name  The name of the button icon class.
  * @param   string   $text  Button text.
  * @param   string   $task  Task associated with the button.
  * @param   boolean  $list  True to allow lists
  *
  * @return  string  HTML string for the button
  *
  * @since   3.0
  */
 public function fetchButton($type = 'J2FBPost', $name = '', $text = '', $task = '', $list = false)
 {
     $class = $this->fetchIconClass($name);
     if ($name == "apply" || $name == "new") {
         $btnClass = "btn btn-small btn-success";
         $iconWhite = "icon-white";
     } else {
         $btnClass = "btn btn-small";
         $iconWhite = "";
     }
     JFactory::getDocument()->addStyleDeclaration('div#toolbar div#toolbar-' . $name . ' button.btn i.icon-' . $name . '-login::before {color: #2F96B4;content: "\\"";}');
     JFactory::getDocument()->addStyleDeclaration('div#toolbar div#toolbar-' . $name . ' button.btn i.icon-' . $name . '::before {color: #2F96B4;content: "&";}');
     JFactory::getDocument()->addStyleDeclaration('div#toolbar div#toolbar-' . $name . ' button.btn i.icon-' . $name . '-waiting::before {color: #2F96B4;content: "j";}');
     // Create our Application instance
     $facebook = new Facebook(array('appId' => self::$appid, 'secret' => self::$secret, 'cookie' => true));
     if ($fbuser = $facebook->getUser()) {
         try {
             $user_profile = $facebook->api('/me');
             //Get user pages details using Facebook Query Language (FQL)
             $fql_query = 'SELECT page_id, name, page_url FROM page WHERE page_id IN (SELECT page_id FROM page_admin WHERE uid=' . $fbuser . ')';
             $postResults = $facebook->api(array('method' => 'fql.query', 'query' => $fql_query));
         } catch (FacebookApiException $e) {
             JError::raiseWarning(1, $e->getMessage());
             return null;
         }
     } else {
         //Show login button for guest users
         $i18n_text = JText::_('Login');
         $doTask = $facebook->getLoginUrl(array('redirect_uri' => JURI::current(), 'scope' => 'publish_stream,read_stream,offline_access,manage_pages'));
         /* 
          * publish_stream – allows the application to publish updates to Facebook on the user’s behalf
          * read_stream – allows the application to read from the user’s News Feed
          * offline_access – converts the access_token to one that doesn’t expire, thus letting the application make API calls anytime. Without this, the application’s access_token will expire after a few minutes, which isn’t ideal in this case
          * manage_pages – lets the application access the user’s Facebook Pages. Since the application we’re building deals with Facebook Pages, we’ll need this as well.
          */
         $html = "<button class=\"btn btn-small\" onclick=\"location.href='{$doTask}';\">\n";
         $html .= "<i class=\"{$class}-login\">\n";
         $html .= "</i>\n";
         $html .= "{$i18n_text}\n";
         $html .= "</button>\n";
     }
     if ($fbuser && $postResults) {
         $i18n_text = JText::_($text);
         $doTask = $this->_getCommand($name, $task, $list);
         $doc = JFactory::getDocument();
         $doc->addScript("../media/lib_eshiol_core/js/encryption.js");
         $doc->addScript("../media/lib_eshiol_core/js/core.js");
         foreach ($postResults as $item) {
             $options[] = array('text' => $item['name'], 'value' => $item['page_id']);
         }
         array_unshift($options, JHTML::_('select.option', 0, '- Select a page -'));
         $html = "<button data-toggle=\"modal\" data-target=\"#collapseModal{$name}\" class=\"" . $btnClass . "\">\n";
         $html .= "<i class=\"{$class} {$iconWhite}\">\n";
         $html .= "</i>\n";
         $html .= "{$i18n_text}\n";
         $html .= "</button>\n";
         $html .= "\r\n<div class=\"modal hide fade\" id=\"collapseModal{$name}\">\r\n\t<div class=\"modal-header\">\r\n\t\t<button type=\"button\" class=\"close\" data-dismiss=\"modal\">x</button>\r\n\t\t<h3>Post to Facebook</h3>\r\n\t</div>\r\n\t<div class=\"modal-body\" style=\"min-height:250px\">\r\n\t\t<p>Post to facebook using www.eshiol.it app</p>\r\n\t\t<div class=\"control-group\">\r\n\t\t\t<div class=\"controls\">" . JHtml::_('select.genericlist', $options, 'fbpage', array('list.attr' => 'class="inputbox" size="1"', 'list.select' => 0)) . "\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"modal-footer\">\r\n\t\t<button class=\"btn\" type=\"button\" onclick=\"document.id('fbpage').value=''\" data-dismiss=\"modal\">\r\n\t\t\t" . JText::_('JCANCEL') . "\r\n\t\t</button>\r\n\t\t<button class=\"btn btn-primary\" type=\"button\" onclick=\"{$doTask}\">\r\n\t\t\t{$i18n_text}\r\n\t\t</button>\r\n\t</div>\r\n</div>\r\n\t\t\t";
     }
     return $html;
 }
Пример #28
-1
 protected function getInput()
 {
     $name = basename(realpath(dirname(__FILE__) . "/../.."));
     static $resources = true;
     if ($resources) {
         $resources = false;
         $document = JFactory::getDocument();
         $prefix = JURI::current() . "?option=" . $name . "&amp;view=loader";
         // jquery
         $document->addScript("https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js");
         $document->addScript(JURI::root(true) . "/components/com_oziogallery3/js/jquery-noconflict.js");
         // pwi
         $document->addScript(JURI::root(true) . "/components/" . $name . "/js/jquery-pwi.js");
         // Alternative code: $type = strtolower($this->type);
         $type = (string) $this->element["type"];
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/js/" . $type . ".js")) {
             $document->addScript($prefix . "&amp;type=js&amp;filename=" . $type);
         }
         if (file_exists(JPATH_ADMINISTRATOR . "/components/" . $name . "/css/" . $type . ".css")) {
             $document->addStyleSheet(JURI::base(true) . "/components/" . $name . "/css/" . $type . ".css");
         }
         // per la compatibilità con Internet Explorer
         $document->addScript(JURI::root(true) . "/components/" . $name . "/js/jQuery.XDomainRequest.js");
     }
     return '<div id="album_selection">' . parent::getInput() . '<img id="jform_params_' . (string) $this->element["name"] . '_loader" style="display:none;" src="' . JURI::root(true) . '/components/' . $name . '/views/00fuerte/img/progress.gif">' . '<span id="jform_params_' . (string) $this->element["name"] . '_warning" style="display:none;">' . JText::_("COM_OZIOGALLERY3_CONNECTION_FAILED") . '</span>' . '<span id="jform_params_' . (string) $this->element["name"] . '_selected" style="display:none;">' . $this->value . '</span>' . '</div>';
 }
 /**
  * Event onAfterInitialise
  *
  * @access public
  * @param null
  * @return null
  */
 public function onAfterInitialise()
 {
     // If this is the Administrator-application, or if debugging is set, do nothing
     $application = JFactory::getApplication();
     if ($application->isAdmin()) {
         return;
     }
     // Disable browser-detection
     $application->setDetectBrowser(false);
     // Detect the language
     $languageTag = JFactory::getLanguage()->getTag();
     $languageInput = JRequest::getString('language');
     // Get the bindings
     $bindings = $this->getBindings();
     // Check for the binding of the current language
     if (!empty($languageInput)) {
         if (isset($bindings[$languageTag])) {
             $domain = $bindings[$languageTag];
             if (stristr(JURI::current(), $domain) == false) {
                 // Add URL-elements to the domain
                 $domain = $this->getUrlFromDomain($domain);
                 // Replace the current domain with the new domain
                 $currentUrl = JURI::current();
                 $newUrl = str_replace(JURI::base(), $domain, $currentUrl);
                 // Strip out the sef-language-part
                 $languages = JLanguageHelper::getLanguages('sef');
                 foreach ($languages as $languageSef => $language) {
                     if ($language->lang_code == $languageTag) {
                         //$newUrl = str_replace('/'.$languageSef.'/', '/', $newUrl); // @todo: This d
                         break;
                     }
                 }
                 // Set the cookie
                 $conf = JFactory::getConfig();
                 $cookie_domain = $conf->get('config.cookie_domain', '');
                 $cookie_path = $conf->get('config.cookie_path', '/');
                 setcookie(JApplication::getHash('language'), $languageTag, time() + 365 * 86400, $cookie_path, $cookie_domain);
                 // Redirect
                 $application->redirect($newUrl);
                 $application->close();
             }
         }
     } else {
         // Check if the current default language is correct
         foreach ($bindings as $languageCode => $domain) {
             if (stristr(JURI::current(), $domain) == true) {
                 // Set the cookie
                 $conf = JFactory::getConfig();
                 $cookie_domain = $conf->get('config.cookie_domain', '');
                 $cookie_path = $conf->get('config.cookie_path', '/');
                 setcookie(JApplication::getHash('language'), $languageCode, time() + 365 * 86400, $cookie_path, $cookie_domain);
                 // Change the current default language
                 JRequest::setVar('language', $languageCode);
                 JFactory::getLanguage()->setDefault($languageCode);
                 JFactory::getLanguage()->setLanguage($languageCode);
                 break;
             }
         }
     }
 }
Пример #30
-1
 public function display($cachable = false, $urlparams = false)
 {
     // make sure user is logued in
     if (!$this->app->user->get()->id) {
         $this->setRedirect($this->app->link(array('option' => 'com_users', 'view' => 'login', 'return' => base64_encode(JURI::current())), false), JText::_('PLG_ZOOCART_ERROR_LOGIN_REQUIRED'), 'notice');
         return;
     }
     parent::display($cachable, $urlparams);
     // Display
     $this->getView()->setLayout('default')->display();
 }