Beispiel #1
0
 function display($tpl = null)
 {
     jimport('joomla.html.pane');
     $pane = JPane::getInstance('Tabs');
     $this->assignRef('pane', $pane);
     $model = $this->getModel();
     $numOfK2Items = $model->countK2Items();
     $this->assignRef('numOfK2Items', $numOfK2Items);
     $numOfVmProducts = $model->countVmProducts();
     $this->assignRef('numOfVmProducts', $numOfVmProducts);
     $numOfK2martProducts = $model->countK2martProducts();
     $this->assignRef('numOfK2martProducts', $numOfK2martProducts);
     $module = JModuleHelper::getModule('mod_k2mart');
     $params = new JRegistry();
     $params->loadString($module->params);
     $params->set('modLogo', "0");
     $params->set('modCSSStyling', "1");
     $module->params = $params->toString();
     $charts = JModuleHelper::renderModule($module);
     $this->assignRef('charts', $charts);
     $document = JFactory::getDocument();
     $document->addCustomTag('<!--[if lte IE 7]><link href="' . JURI::base() . 'components/com_k2mart/css/style_ie7.css" rel="stylesheet" type="text/css" /><![endif]-->');
     $this->loadHelper('html');
     K2martHTMLHelper::title('K2MART_DASHBOARD');
     K2martHTMLHelper::toolbar();
     K2martHTMLHelper::subMenu();
     parent::display($tpl);
 }
 public function install($adapter)
 {
     /** @var $plugin JTableExtension */
     $plugin = JTable::getInstance('extension');
     if (!$plugin->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'communitybuilder'))) {
         return false;
     }
     /** @var $legacy JTableExtension */
     $legacy = JTable::getInstance('extension');
     if ($legacy->load(array('type' => 'plugin', 'folder' => 'system', 'element' => 'cbcoreredirect'))) {
         $pluginParams = new JRegistry();
         $pluginParams->loadString($plugin->get('params'));
         $legacyParams = new JRegistry();
         $legacyParams->loadString($legacy->get('params'));
         $pluginParams->set('rewrite_urls', $legacyParams->get('rewrite_urls', 1));
         $pluginParams->set('itemids', $legacyParams->get('itemids', 1));
         $plugin->set('params', $pluginParams->toString());
         $installer = new JInstaller();
         try {
             $installer->uninstall('plugin', $legacy->get('extension_id'));
         } catch (RuntimeException $e) {
         }
     }
     $plugin->set('enabled', 1);
     return $plugin->store();
 }
Beispiel #3
0
 /**
  * Plugin that returns the object list for DJ-Mediatools album
  * 
  * Each object must contain following properties (mandatory): title, description, image
  * Optional properties: link, target (_blank or _self), alt (alt attribute for image)
  * 
  * @param	object	The album params
  */
 public function onAlbumPrepare(&$source, &$params)
 {
     // Lets check the requirements
     $check = $this->onCheckRequirements($source);
     if (is_null($check) || is_string($check)) {
         return null;
     }
     $app = JFactory::getApplication();
     $default_image = $params->get('plg_k2_image');
     require_once JPATH_BASE . '/modules/mod_k2_content/helper.php';
     // fix K2 models path inclusion, we need to add path with prefix to avoid conflicts with other extensions
     JModelLegacy::addIncludePath(JPATH_BASE . '/components/com_k2/models', 'K2Model');
     // create parameters for K2 content module helper
     $mparams = new JRegistry();
     $mparams->def('itemCount', $params->get('max_images'));
     $mparams->def('source', $params->get('plg_k2_source'));
     $mparams->def('catfilter', $params->get('plg_k2_catfilter'));
     $mparams->set('category_id', $params->get('plg_k2_category_id', array()));
     $mparams->def('getChildren', $params->get('plg_k2_getChildren'));
     $mparams->def('itemsOrdering', $params->get('plg_k2_itemsOrdering'));
     $mparams->def('FeaturedItems', $params->get('plg_k2_FeaturedItems'));
     $mparams->def('popularityRange', $params->get('plg_k2_popularityRange'));
     $mparams->def('videosOnly', $params->get('plg_k2_videosOnly'));
     $mparams->def('item', $params->get('plg_k2_item'));
     $mparams->set('items', $params->get('plg_k2_items', array()));
     $mparams->def('itemImage', 1);
     $mparams->def('itemIntroText', 1);
     //JFactory::getApplication()->enqueueMessage("<pre>".print_r($mparams, true)."</pre>");
     //$mparams->def('extra_fields', 1);
     $items = modK2ContentHelper::getItems($mparams);
     $slides = array();
     foreach ($items as $item) {
         $slide = (object) array();
         if (isset($item->imageXLarge)) {
             $slide->image = str_replace(JURI::base(true), '', $item->imageXLarge);
         } else {
             $slide->image = DJMediatoolsLayoutHelper::getImageFromText($item->introtext);
         }
         // if no image found in article images and introtext then try fulltext
         if (!$slide->image) {
             $slide->image = DJMediatoolsLayoutHelper::getImageFromText($item->fulltext);
         }
         // if no image found in fulltext then take default image
         if (!$slide->image) {
             $slide->image = $default_image;
         }
         // if no default image set then don't display this article
         if (!$slide->image) {
             continue;
         }
         $slide->title = $item->title;
         $slide->description = $item->introtext;
         if (empty($slide->description)) {
             $slide->description = $item->fulltext;
         }
         $slide->link = $item->link;
         $slides[] = $slide;
     }
     return $slides;
 }
Beispiel #4
0
 function setupAuthentication()
 {
     $options = new JRegistry();
     $options->set('authurl', 'https://api.instagram.com/oauth/authorize');
     $options->set('tokenurl', 'https://api.instagram.com/oauth/access_token');
     $options->set('authmethod', 'get');
     $headers = array();
     $headers['Content-Type'] = 'application/json';
     $options->set('headers', $headers);
     $options->set('scope', '');
     $this->client = new JFBConnectAuthenticationOauth2($options);
     $token = JFactory::getApplication()->getUserState('com_jfbconnect.' . strtolower($this->name) . '.token', null);
     if ($token) {
         $token = (array) json_decode($token);
         $this->client->setToken($token);
     }
     $this->client->initialize($this);
     // Need to override the callback URL to force http or https
     $origRedirect = $this->client->getOption('redirecturi');
     if (JFBCFactory::config()->get('instagram_callback_ssl')) {
         $redirect = str_replace('http://', 'https://', $origRedirect);
     } else {
         $redirect = str_replace('https://', 'http://', $origRedirect);
     }
     $this->client->setOption('redirecturi', $redirect);
 }
Beispiel #5
0
 /**
  * Method to display the layout of search results
  *
  * @return void
  */
 public function displayRows()
 {
     // Run events
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'search');
     $params->set('kunena_layout', 'default');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->results, &$params, 0));
     foreach ($this->results as $this->message) {
         $this->topic = $this->message->getTopic();
         $this->category = $this->message->getCategory();
         $this->categoryLink = $this->getCategoryLink($this->category->getParent()) . ' / ' . $this->getCategoryLink($this->category);
         $ressubject = KunenaHtmlParser::parseText($this->message->subject);
         $resmessage = KunenaHtmlParser::parseBBCode($this->message->message, 500);
         $profile = KunenaFactory::getUser((int) $this->message->userid);
         $this->useravatar = $profile->getAvatarImage('kavatar', 'post');
         foreach ($this->searchwords as $searchword) {
             if (empty($searchword)) {
                 continue;
             }
             $ressubject = preg_replace("/" . preg_quote($searchword, '/') . "/iu", '<span  class="searchword" >' . $searchword . '</span>', $ressubject);
             // FIXME: enable highlighting, but only after we can be sure that we do not break html
             // $resmessage = preg_replace ( "/" . preg_quote ( $searchword, '/' ) . "/iu", '<span  class="searchword" >' . $searchword . '</span>', $resmessage );
         }
         $this->author = $this->message->getAuthor();
         $this->topicAuthor = $this->topic->getAuthor();
         $this->topicTime = $this->topic->first_post_time;
         $this->subjectHtml = $ressubject;
         $this->messageHtml = $resmessage;
         $contents = $this->subLayout('Search/Results/Row')->setProperties($this->getProperties());
         echo $contents;
     }
 }
Beispiel #6
0
	/**
	 * Prepare menu display.
	 *
	 * @return bool
	 */
	protected function before()
	{
		parent::before();

		$this->basemenu = $basemenu = KunenaRoute::getMenu();

		if (!$basemenu)
		{
			return false;
		}

		$parameters = new JRegistry;
		$template = KunenaFactory::getTemplate();
		$parameters->set('showAllChildren', $template->params->get('menu_showall', 0));
		$parameters->set('menutype', $basemenu->menutype);
		$parameters->set('startLevel', $basemenu->level + 1);
		$parameters->set('endLevel', $basemenu->level + $template->params->get('menu_levels', 1));

		$this->list = KunenaMenuHelper::getList($parameters);
		$this->menu = $this->app->getMenu();
		$this->active = $this->menu->getActive();
		$this->active_id = isset($this->active) ? $this->active->id : $this->menu->getDefault()->id;
		$this->path = isset($this->active) ? $this->active->tree : array();
		$this->showAll = $parameters->get('showAllChildren');
		$this->class_sfx = htmlspecialchars($parameters->get('pageclass_sfx'), ENT_COMPAT, 'UTF-8');

		return true;
	}
Beispiel #7
0
 function bind($array, $ignore = array())
 {
     $cfg = JEVConfig::getInstance();
     $array['id'] = isset($array['id']) ? intval($array['id']) : 0;
     parent::bind($array);
     $params = new JRegistry($this->params);
     if (!$params->get("catcolour", false)) {
         $color = array_key_exists("color", $array) ? $array['color'] : "#000000";
         if (!preg_match("/^#[0-9a-f]+\$/i", $color)) {
             $color = "#000000";
         }
         $params->set("catcolor", $color);
     }
     if (!$params->get("admin", false)) {
         $admin = array_key_exists("admin", $array) ? $array['admin'] : 0;
         $params->set("admin", $admin);
     }
     if (!$params->get("overlaps", false)) {
         $overlaps = array_key_exists("overlaps", $array) ? intval($array['overlaps']) : 0;
         $params->set("overlaps", $overlaps);
     }
     if (!$params->get("image", false)) {
         $image = array_key_exists("image", $array) ? intval($array['image']) : "";
         $params->set("image", $image);
     }
     $this->params = (string) $params;
     // Fill in the gaps
     $this->parent_id = array_key_exists("parent_id", $array) ? intval($array['parent_id']) : 1;
     $this->level = array_key_exists("level", $array) ? intval($array['level']) : 1;
     $this->extension = "com_jevents";
     $this->language = "*";
     $this->setLocation(1, 'last-child');
     return true;
 }
Beispiel #8
0
 /**
  * Prepare reply history display.
  *
  * @return void
  */
 protected function before()
 {
     parent::before();
     $id = $this->input->getInt('id');
     $this->topic = KunenaForumTopicHelper::get($id);
     $this->history = KunenaForumMessageHelper::getMessagesByTopic($this->topic, 0, (int) $this->config->historylimit, 'DESC');
     $this->replycount = $this->topic->getReplies();
     $this->historycount = count($this->history);
     KunenaAttachmentHelper::getByMessage($this->history);
     $userlist = array();
     foreach ($this->history as $message) {
         $userlist[(int) $message->userid] = (int) $message->userid;
     }
     KunenaUserHelper::loadUsers($userlist);
     // Run events
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'history');
     $dispatcher = JEventDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.messages', &$this->history, &$params, 0));
     // FIXME: need to improve BBCode class on this...
     $this->attachments = KunenaAttachmentHelper::getByMessage($this->history);
     $this->inline_attachments = array();
     $this->headerText = JText::_('COM_KUNENA_POST_EDIT') . ' ' . $this->topic->subject;
 }
Beispiel #9
0
 public static function getCategories($parent = 'root', $count = 0)
 {
     require_once JPATH_ROOT . '/modules/mod_articles_categories/helper.php';
     $params = new JRegistry();
     $params->set('parent', $parent);
     $params->set('count', $count);
     return ModArticlesCategoriesHelper::getList($params);
 }
 public function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     $options = new JRegistry();
     $options->set('api.username', $this->params->get('mediawiki_username'));
     $options->set('api.password', $this->params->get('mediawiki_password'));
     $options->set('api.url', $this->params->get('mediawiki_siteurl'));
     $this->mediawiki = new JMediawiki($options);
 }
Beispiel #11
0
 /**
  * Store setting into database
  * @param PlanOsMembership $row
  * @param Boolean $isNew true if create new plan, false if edit
  */
 function onAfterSaveSubscriptionPlan($row, $data, $isNew)
 {
     $params = new JRegistry($row->params);
     $params->set('joomla_group_ids', implode(',', $data['joomla_group_ids']));
     $params->set('subscription_expired_joomla_group_ids', implode(',', $data['subscription_expired_joomla_group_ids']));
     $params->set('joomla_expried_group_ids', implode(',', $data['joomla_expried_group_ids']));
     $row->params = $params->toString();
     $row->store();
 }
Beispiel #12
0
 /**
  * Prepare topic reply form.
  *
  * @return void
  *
  * @throws RuntimeException
  * @throws KunenaExceptionAuthorise
  */
 protected function before()
 {
     parent::before();
     $catid = $this->input->getInt('catid');
     $id = $this->input->getInt('id');
     $mesid = $this->input->getInt('mesid');
     $quote = $this->input->getBool('quote', false);
     $saved = $this->app->getUserState('com_kunena.postfields');
     $this->me = KunenaUserHelper::getMyself();
     $this->template = KunenaFactory::getTemplate();
     if (!$mesid) {
         $this->topic = KunenaForumTopicHelper::get($id);
         $parent = KunenaForumMessageHelper::get($this->topic->first_post_id);
     } else {
         $parent = KunenaForumMessageHelper::get($mesid);
         $this->topic = $parent->getTopic();
     }
     $this->category = $this->topic->getCategory();
     if ($parent->isAuthorised('reply') && $this->me->canDoCaptcha()) {
         if (JPluginHelper::isEnabled('captcha')) {
             $plugin = JPluginHelper::getPlugin('captcha');
             $params = new JRegistry($plugin[0]->params);
             $captcha_pubkey = $params->get('public_key');
             $catcha_privkey = $params->get('private_key');
             if (!empty($captcha_pubkey) && !empty($catcha_privkey)) {
                 JPluginHelper::importPlugin('captcha');
                 $dispatcher = JDispatcher::getInstance();
                 $result = $dispatcher->trigger('onInit', 'dynamic_recaptcha_1');
                 $this->captchaEnabled = $result[0];
             }
         } else {
             $this->captchaEnabled = false;
         }
     }
     $parent->tryAuthorise('reply');
     // Run event.
     $params = new JRegistry();
     $params->set('ksource', 'kunena');
     $params->set('kunena_view', 'topic');
     $params->set('kunena_layout', 'reply');
     $dispatcher = JDispatcher::getInstance();
     JPluginHelper::importPlugin('kunena');
     $dispatcher->trigger('onKunenaPrepare', array('kunena.topic', &$this->topic, &$params, 0));
     // Can user edit topic icons?
     if ($this->config->topicicons && $this->topic->isAuthorised('edit')) {
         $this->topicIcons = $this->template->getTopicIcons(false, $saved ? $saved['icon_id'] : $this->topic->icon_id);
     }
     list($this->topic, $this->message) = $parent->newReply($saved ? $saved : $quote);
     $this->action = 'post';
     $this->allowedExtensions = KunenaAttachmentHelper::getExtensions($this->category);
     $this->post_anonymous = $saved ? $saved['anonymous'] : !empty($this->category->post_anonymous);
     $this->subscriptionschecked = $saved ? $saved['subscribe'] : $this->config->subscriptionschecked == 1;
     $this->app->setUserState('com_kunena.postfields', null);
     $this->canSubscribe = $this->canSubscribe();
     $this->headerText = JText::_('COM_KUNENA_BUTTON_MESSAGE_REPLY') . ' ' . $this->topic->subject;
 }
Beispiel #13
0
 /**
  * Store setting into database, in this case, use params field of plans table
  * @param PlanOsMembership $row
  * @param Boolean $isNew true if create new plan, false if edit
  */
 function onAfterSaveSubscriptionPlan($row, $data, $isNew)
 {
     if (!$this->canRun) {
         return;
     }
     // $row of table osmembership_plans
     $params = new JRegistry($row->params);
     $params->set('docman_group_ids', implode(',', $data['docman_group_ids']));
     $params->set('docman_expried_group_ids', implode(',', $data['docman_expried_group_ids']));
     $row->params = $params->toString();
     $row->store();
 }
Beispiel #14
0
 /**
  * An ajax connector for QuickAdd JS.
  */
 public function quickAddAjax()
 {
     // Init Variables
     $input = JFactory::getApplication()->input;
     $data = $input->post->get($input->get('formctrl'), array(), 'array');
     $result = new JRegistry();
     $result->set('Result', false);
     $model_name = $input->get('model_name');
     $component = $input->get('component');
     $extension = $input->get('extension');
     // Include Needed Classes
     JControllerLegacy::addModelPath(JPATH_BASE . "/components/com_{$component}/models");
     JForm::addFormPath(JPATH_BASE . "/components/com_{$component}/models/forms");
     JForm::addFieldPath(JPATH_BASE . "/components/com_{$component}/models/fields");
     JTable::addIncludePath(JPATH_BASE . "/components/com_{$component}/tables");
     AKHelper::_('lang.loadLanguage', $extension, null);
     // Get Model
     $model = $this->getModel(ucfirst($model_name), ucfirst($component) . 'Model', array('ignore_request' => true));
     // For WindWalker Component only
     if (is_callable(array($model, 'getFieldsName'))) {
         $fields_name = $model->getFieldsName();
         $data = AKHelper::_('array.pivotToTwoDimension', $data, $fields_name);
     }
     // Get Form
     $form = $model->getForm($data, false);
     if (!$form) {
         $result->set('errorMsg', $model->getError());
         jexit($result);
     }
     // Test whether the data is valid.
     $validData = $model->validate($form, $data);
     // Check for validation errors.
     if ($validData === false) {
         // Get the validation messages.
         $errors = $model->getErrors();
         $errorMsg = is_string($errors[0]) ? $errors[0] : $errors[0]->getMessage();
         $result->set('errorMsg', $errorMsg);
         jexit($result);
     }
     // Do Save
     if (!$model->save($validData)) {
         // Return Error Message.
         $result->set('errorMsg', JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()));
         jexit($result);
     }
     // Set ID
     $data['id'] = $model->getstate($model_name . '.id');
     // Set Result
     $result->set('Result', true);
     $result->set('data', $data);
     jexit($result);
 }
Beispiel #15
0
 /**
  * Attempts to discover whether the harvest configuration points to an OAI-enabled url.
  *
  * @param   string     $sourceUrl  The source url to discover.
  *
  * @return  JRegistry  An OAI description as a JRegistry or false if no description can be
  * found.
  */
 public function onJHarvestDiscover($sourceUrl)
 {
     $discovered = false;
     $url = new JUri($sourceUrl);
     $url->setVar('verb', 'Identify');
     $http = JHttpFactory::getHttp();
     $response = $http->get($url);
     $contentType = JArrayHelper::getValue($response->headers, 'Content-Type');
     $contentType = $this->parseContentType($contentType);
     $validContentType = in_array($contentType, array('text/xml', 'application/xml')) !== false;
     if ((int) $response->code === 200 && $validContentType) {
         $url->setVar('verb', 'ListMetadataFormats');
         $http = JHttpFactory::getHttp();
         $response = $http->get($url);
         if ((int) $response->code === 200) {
             $dom = new DomDocument();
             $dom->loadXML($response->body);
             $nodes = $dom->getElementsByTagName('metadataPrefix');
             $availablePrefixes = array();
             foreach ($nodes as $node) {
                 $availablePrefixes[] = (string) $node->nodeValue;
             }
             $dispatcher = JEventDispatcher::getInstance();
             JPluginHelper::importPlugin("joai");
             $result = $dispatcher->trigger('onJOaiQueryMetadataFormat');
             $found = false;
             while (($metadataPrefix = current($result)) && !$found) {
                 if (array_search($metadataPrefix, $availablePrefixes) !== false) {
                     $discovered = new JRegistry();
                     $discovered->set('discovery.type', 'oai');
                     $discovered->set('discovery.url', (string) $sourceUrl);
                     $discovered->set('discovery.plugin.metadata', (string) $metadataPrefix);
                     $found = true;
                 }
                 next($result);
             }
             // if a metadata format can be discovered, also discover the asset format.
             if ($discovered) {
                 $result = $dispatcher->trigger('onJOaiQueryAssetFormat');
                 $found = false;
                 while (($assetPrefix = current($result)) && !$found) {
                     if (array_search($assetPrefix, $availablePrefixes) !== false) {
                         $discovered->set('discovery.plugin.assets', (string) $assetPrefix);
                         $found = true;
                     }
                     next($result);
                 }
             }
         }
     }
     return $discovered;
 }
Beispiel #16
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     // Store the factory state so we can mock the necessary objects
     $this->saveFactoryState();
     JFactory::$application = $this->getMockApplication();
     JFactory::$config = $this->getMockConfig();
     JFactory::$session = $this->getMockSession();
     // Set up our mock config
     $this->config = JFactory::getConfig();
     $this->config->set('helpurl', 'http://help.joomla.org/proxy/index.php?option=com_help&amp;keyref=Help{major}{minor}:{keyref}');
     // Load the admin en-GB.ini language file
     JFactory::getLanguage()->load('', JPATH_ADMINISTRATOR);
 }
 /**
  * @since       1.2.0
  **/
 public static function getLayout(JRegistry $params, $name, $folder = null, $path = null)
 {
     $path = $path ? $path . '.' . $name : $name;
     $layout = $params->get($path, 'default');
     if (!$params->get('is.' . $name, false)) {
         if ($folder) {
             $layout = strpos($layout, ':') !== false ? str_replace(':', ':' . $folder . '/', $layout) : $folder . '/' . $layout;
         }
         $params->set('is.' . $name, true);
         $params->set($path, $layout);
     }
     return $layout;
 }
 public final function set($key, $value)
 {
     if ($key == 'updatedata') {
         if (function_exists('json_encode') && function_exists('json_decode')) {
             $value = json_encode($value);
         } elseif (function_exists('base64_encode') && function_exists('base64_decode')) {
             $value = base64_encode(serialize($value));
         } else {
             $value = serialize($value);
         }
     }
     self::$registry->set("update.{$key}", $value);
 }
Beispiel #19
0
    protected function getInput()
    {
        Jhtml::_('behavior.modal');
        $app = JFactory::getApplication();
        $document = JFactory::getDocument();
        $document->addScript(JURI::root(true) . '/modules/' . $this->form->getValue('module') . '/admin/js/jquery.dragsort.min.js');
        $document->addScript(JURI::root(true) . '/modules/' . $this->form->getValue('module') . '/admin/js/juupload.min.js');
        $document->addScript(JURI::root(true) . '/modules/' . $this->form->getValue('module') . '/admin/js/jugallery.min.js');
        JText::script('TITLE');
        JText::script('LINK');
        JText::script('CLASS');
        JText::script('DESCRIPTION');
        JText::script('PUBLISHED');
        JText::script('UPDATE');
        JText::script('CANCEL');
        JText::script('DELETE_IMAGE_CONFIRM');
        JText::script('FOLDER_PATH_REQUIRED');
        JText::script('FOLDER_EMPTY');
        JText::script('PLEASE_SELECT_FILE');
        JText::script('SELECT_FILE');
        $params = new JRegistry($this->form->getValue('params'));
        $folderfield = (string) $this->element['folderfield'];
        $foldername = $params->get($folderfield, 'images/');
        if (substr($foldername, 0, 1) == '/') {
            $params->set($folderfield, substr($foldername, 1));
        }
        if (substr(trim($foldername), -1) != '/') {
            $params->set($folderfield, trim($foldername) . '/');
        }
        //Create element
        if ($app->isAdmin()) {
            $html = '<div class="juuploader"><div class="file-display">' . JText::_("SELECT_FILE") . '</div><input class="upload-file" type="file" name="' . $this->id . '_img_upload" id="' . $this->id . '_img_upload" multiple  accept="image/*" /><button type="button" class="btn-upload">' . JText::_("UPLOAD") . '</button></div>';
        }
        $html .= '<input type="button" class="jureloadimages" title="' . JText::_("RELOAD_IMAGES") . '" value="' . JText::_("RELOAD_IMAGES") . '" style="display: block;" />';
        $html .= '<div class="upload-message"></div>';
        $html .= '<div class="jugallery-holder"></div>';
        $html .= '<textarea rows="6" cols="60" class="jugallery-description ' . $this->element['class'] . '" name="' . $this->name . '" id="' . $this->id . '" style="display: none;">' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '</textarea>';
        $js = '
		var module_url = "' . JURI::root(true) . '/modules/' . $this->form->getValue('module') . '/";
		JU_jQuery(document).ready(function($){
			$(\'#' . $this->id . '\').jugallery({ju_folderfield: \'jform_params_' . $folderfield . '\', description_field_id:\'' . $this->id . '\'});';
        if ($app->isAdmin()) {
            $js .= '
				$(\'#' . $this->id . '\').parent().find(\'.juuploader\').juupload({ju_folderfield: \'jform_params_' . $folderfield . '\', description_field_id:\'' . $this->id . '\'});';
        }
        $js .= '
		});';
        $document->addScriptDeclaration($js);
        return $html;
    }
Beispiel #20
0
 /**
  * @throws Exception
  * @return mixed|void
  */
 protected function connect()
 {
     $credentials = new stdClass();
     /* @var JInput $input */
     $input = JFactory::getApplication()->input;
     $credentials->user = $input->get('user');
     $credentials->pass = $input->get('pass');
     $config = new JRegistry();
     $config->set('api.username', $credentials->user);
     $config->set('api.password', $credentials->pass);
     JLog::add('| ^^ ' . sprintf(jgettext('Connecting to %s ...'), 'GitHub'));
     $this->github = new EcrGithub($config);
     $this->credentials = $credentials;
 }
Beispiel #21
0
 function getModuleSettings($id)
 {
     $table = JTable::getInstance('Module', 'JTable', array());
     // Attempt to load the row.
     $return = $table->load($id);
     $registry = new JRegistry();
     if ($return) {
         $table->getProperties(1);
         $registry->loadString($table->params);
         $registry->set('params.widget_settings', $registry->get('widget_settings'));
         $registry->set('widget_settings', null);
     }
     return $registry;
 }
Beispiel #22
0
 function setupAuthentication()
 {
     $options = new JRegistry();
     $options->set('authurl', 'https://oauth.vk.com/authorize?v=5.21');
     $options->set('tokenurl', 'https://oauth.vk.com/access_token');
     $options->set('authmethod', 'get');
     $options->set('scope', '');
     $this->client = new JFBConnectAuthenticationOauth2($options);
     $token = JFactory::getApplication()->getUserState('com_jfbconnect.' . strtolower($this->name) . '.token', null);
     if ($token) {
         $token = (array) json_decode($token);
         $this->client->setToken($token);
     }
     $this->client->initialize($this);
 }
Beispiel #23
0
 function setupAuthentication()
 {
     $options = new JRegistry();
     $options->set('authurl', 'https://login.live.com/oauth20_authorize.srf');
     $options->set('tokenurl', 'https://login.live.com/oauth20_token.srf');
     $options->set('authmethod', 'get');
     $options->set('scope', 'wl.signin wl.basic wl.emails wl.birthday');
     $this->client = new JFBConnectAuthenticationOauth2($options);
     $token = JFactory::getApplication()->getUserState('com_jfbconnect.' . strtolower($this->name) . '.token', null);
     if ($token) {
         $token = (array) json_decode($token);
         $this->client->setToken($token);
     }
     $this->client->initialize($this);
 }
Beispiel #24
0
 function __construct($provider, $fields)
 {
     parent::__construct($provider, $fields, 'scMeetupOembedTag');
     $this->name = "Embedded Resource";
     $this->className = 'sc_meetupoembed';
     $this->tagName = 'scmeetupoembed';
     $options = new JRegistry();
     $options->set('oembed_url', 'http://api.meetup.com/oembed');
     $options->set('url', $this->getParamValueEx('url', null, null, ''));
     $options->set('maxwidth', $this->getParamValueEx('maxwidth', null, null, '308'));
     $headers = array();
     $headers['Content-Type'] = 'application/json';
     $options->set('headers', $headers);
     $this->options = $options;
 }
Beispiel #25
0
 public function wizardstep()
 {
     $wizardstep = (int) $this->input->getInt('wizardstep', 0);
     // Fetch the component parameters
     $db = JFactory::getDbo();
     $sql = $db->getQuery(true)->select($db->qn('params'))->from($db->qn('#__extensions'))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
     $db->setQuery($sql);
     $rawparams = $db->loadResult();
     $params = new JRegistry();
     $params->loadString($rawparams, 'JSON');
     // Set the wzardstep parameter to whatever we were told to
     $params->set('wizardstep', $wizardstep);
     // Save the component parameters
     $data = $params->toString('JSON');
     $sql = $db->getQuery(true)->update($db->qn('#__extensions'))->set($db->qn('params') . ' = ' . $db->q($data))->where($db->qn('type') . ' = ' . $db->q('component'))->where($db->qn('element') . ' = ' . $db->q('com_akeebasubs'));
     $db->setQuery($sql);
     $db->execute();
     // Redirect back to the control panel
     $url = '';
     $returnurl = $this->input->getBase64('returnurl', '');
     if (!empty($returnurl)) {
         $url = base64_decode($returnurl);
     }
     if (empty($url)) {
         $url = JURI::base() . 'index.php?option=com_akeebasubs';
     }
     $this->setRedirect($url);
 }
Beispiel #26
0
 function render($position)
 {
     global $gantry;
     $renderer = $gantry->document->loadRenderer('module');
     $options = array('style' => "menu");
     $module = JModuleHelper::getModule('mod_roknavmenu', '_z_empty');
     $params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name, true);
     $reg = new JRegistry();
     foreach ($params as $param_name => $param_value) {
         $reg->set($param_name, $param_value['value']);
     }
     $reg->set('style', 'menu');
     $module->params = $reg->toString();
     $rendered_menu = $renderer->render($module, $options);
     return $rendered_menu;
 }
Beispiel #27
0
 protected function getInput()
 {
     $html = '';
     if ($this->form->getValue('params.provider_type') && $this->form->getValue('params.widget_type') != 'widget') {
         SCStringUtilities::loadLanguage('com_jfbconnect', JPATH_ADMINISTRATOR);
         JForm::addFieldPath(JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $this->form->getValue('params.provider_type') . '/widget');
         $xmlFile = JPATH_ROOT . '/components/com_jfbconnect/libraries/provider/' . $this->form->getValue('params.provider_type') . '/widget/' . $this->form->getValue('params.widget_type') . '.xml';
         if (JFile::exists($xmlFile)) {
             $options = array('control' => 'jform');
             $form = JForm::getInstance('com_jfbconnect_' . $this->form->getValue('params.widget_type'), $xmlFile, $options);
             $registry = $this->form->getValue('params');
             $settings = new JRegistry();
             $settings->set('params.widget_settings', $registry->widget_settings);
             $form->bind($settings);
             ob_start();
             foreach ($form->getFieldsets() as $fieldsets => $fieldset) {
                 foreach ($form->getFieldset($fieldset->name) as $field) {
                     $this->formShowField($field);
                 }
             }
             $html = ob_get_clean();
         }
     }
     return '<div id="widget_settings">' . $html . '</div>';
 }
Beispiel #28
0
 /**
  * Add hashtag to an activity
  * @param $tag
  * @param $activityId
  */
 public function addActivityHashtag($tag, $activityId)
 {
     $tag = trim($tag);
     if ($tag[0] != '#') {
         $tag = "#" . $tag;
     }
     $db = JFactory::getDBO();
     $query = 'SELECT id FROM ' . $db->quoteName('#__community_hashtag') . ' WHERE ' . $db->quoteName('tag') . ' LIKE ' . $db->quote(strtolower($tag));
     $db->setQuery($query);
     $id = $db->loadResult();
     if ($id) {
         $hashtagTable = JTable::getInstance('Hashtag', 'CTable');
         $hashtagTable->load($id);
         $hashtagTable->tag = $tag;
         $params = new JRegistry($hashtagTable->params);
         $tempParam = array_unique(array_merge($params->get('activity_id'), array($activityId)));
         $params->set('activity_id', $tempParam);
         $hashtagTable->params = $params->toString();
         $hashtagTable->store();
     } else {
         $hashtagTable = JTable::getInstance('Hashtag', 'CTable');
         $params = new JRegistry();
         $hashtagTable->tag = $tag;
         $params->set('activity_id', array($activityId));
         $hashtagTable->params = $params->toString();
         $hashtagTable->store();
     }
 }
 /**
  * Overrides JGithub constructor to initialise the api property.
  *
  * @param   mixed  $input       An optional argument to provide dependency injection for the application's
  *                              input object.  If the argument is a JInputCli object that object will become
  *                              the application's input object, otherwise a default input object is created.
  * @param   mixed  $config      An optional argument to provide dependency injection for the application's
  *                              config object.  If the argument is a JRegistry object that object will become
  *                              the application's config object, otherwise a default config object is created.
  * @param   mixed  $dispatcher  An optional argument to provide dependency injection for the application's
  *                              event dispatcher.  If the argument is a JDispatcher object that object will become
  *                              the application's event dispatcher, if it is null then the default event dispatcher
  *                              will be created based on the application's loadDispatcher() method.
  *
  * @see     loadDispatcher()
  * @since   11.1
  */
 public function __construct(JInputCli $input = null, JRegistry $config = null, JDispatcher $dispatcher = null)
 {
     parent::__construct($input, $config, $dispatcher);
     $options = new JRegistry();
     $options->set('headers.Accept', 'application/vnd.github.html+json');
     $this->api = new JGithub($options);
 }
Beispiel #30
0
 function render($position = "")
 {
     global $gantry;
     $output = '';
     $renderer = $gantry->document->loadRenderer('module');
     $options = array('style' => "raw");
     $params = array();
     $group_params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name, true);
     $group_params_reg = new JRegistry();
     foreach ($group_params as $param_name => $param_value) {
         $group_params_reg->set($param_name, $param_value['value']);
     }
     if ($position == $this->get('mainmenu-position')) {
         $params = $gantry->getParams($this->_feature_prefix . "-" . $this->_feature_name . "-mainmenu", true);
         $module = JModuleHelper::getModule('mod_menu', '_z_empty');
         $reg = new JRegistry();
         foreach ($params as $param_name => $param_value) {
             $reg->set($param_name, $param_value['value']);
         }
         $reg->merge($group_params_reg);
         $module->params = $reg->toString();
         $output .= $renderer->render($module, $options);
     }
     return $output;
 }