/**
  * Override by loading Profile Picture parameters.
  *
  * @param   JForm  $form  The form to attach to the form field object.
  *
  * @since   2.0
  */
 public function __construct($form = null)
 {
     $plugin = JPluginHelper::getPlugin('user', 'profilepicture');
     $this->params = new JRegistry($plugin->params);
     $this->maxUploadSizeInBytes = $this->params->get('maxUploadSizeInBytes', 800000);
     parent::__construct($form);
 }
Example #2
0
 function initialize()
 {
     // Get Plugin info
     $plugin =& JPluginHelper::getPlugin('content', 'flickrAlbum');
     $pluginParams = new JParameter($plugin->params);
     $this->thumbsize = $pluginParams->get('thumbsizedef', 1);
     $this->imagesize = $pluginParams->get('imagesizedef', 1);
     $this->rows = $pluginParams->get('rowsdef', 1);
     $this->cols = $pluginParams->get('colsdef', 1);
     $this->type = '';
     $this->photoset = '';
     $this->keywords = '';
     $this->user = $pluginParams->get('userdef', 1);
     $this->group = '';
     $this->tags = '';
     $this->sort = $pluginParams->get('sortdef', 1);
     $this->color = $pluginParams->get('colorthemedef', 1);
     $this->title = $pluginParams->get('albumtitledef', 1);
     $this->linktext = $pluginParams->get('linktextdef', 1);
     $this->debug = strtolower($pluginParams->get('enabledebug', 1)) == 'yes';
     $this->thumbpadding = $pluginParams->get('thumbpadding', 1);
     $this->thumbborder = $pluginParams->get('thumbborder', 1);
     $this->thumbmargin = $pluginParams->get('thumbmargin', 1);
     $this->flickr_api_key = $pluginParams->get('flickr_api_key', 1);
     $this->inc_jquery = strtolower($pluginParams->get('incjquery', 1)) == 'yes';
     $this->inc_jquery_flickr = strtolower($pluginParams->get('incjqueryflickr', 1)) == 'yes';
 }
 function plgAcymailingContentplugin(&$subject, $config)
 {
     parent::__construct($subject, $config);
     if (!isset($this->params)) {
         $plugin = JPluginHelper::getPlugin('acymailing', 'contentplugin');
         $this->params = new acyParameter($plugin->params);
     }
     $this->paramsContent = JComponentHelper::getParams('com_content');
     JPluginHelper::importPlugin('content');
     $this->dispatcherContent = JDispatcher::getInstance();
     $excludedHandlers = array('plgContentEmailCloak', 'pluginImageShow');
     $excludedNames = array('system' => array('SEOGenerator', 'SEOSimple'), 'content' => array('webeecomment', 'highslide', 'smartresizer', 'phocagallery'));
     $excludedType = array_keys($excludedNames);
     if (!ACYMAILING_J16) {
         foreach ($this->dispatcherContent->_observers as $id => $observer) {
             if (is_array($observer) and in_array($observer['handler'], $excludedHandlers)) {
                 $this->dispatcherContent->_observers[$id]['event'] = '';
             } elseif (is_object($observer)) {
                 if (in_array($observer->_type, $excludedType) and in_array($observer->_name, $excludedNames[$observer->_type])) {
                     $this->dispatcherContent->_observers[$id] = null;
                 }
             }
         }
     }
     if (!class_exists('JSite')) {
         include_once ACYMAILING_ROOT . 'includes' . DS . 'application.php';
     }
 }
Example #4
0
 /**
  * Display the button
  *
  * @return array A two element array of ( imageName, textToInsert )
  */
 function onDisplay($name)
 {
     jimport('joomla.filesystem.file');
     // return if system plugin is not installed
     if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.php')) {
         return;
     }
     // return if NoNumber! Elements plugin is not installed
     if (!JFile::exists(JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'nonumberelements.php')) {
         return;
     }
     // load the admin language file
     $lang =& JFactory::getLanguage();
     if ($lang->getTag() != 'en-GB') {
         // Loads English language file as fallback (for undefined stuff in other language file)
         $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, 'en-GB');
     }
     $lang->load('plg_' . $this->_type . '_' . $this->_name, JPATH_ADMINISTRATOR, null, 1);
     // Load system plugin parameters
     require_once JPATH_PLUGINS . DS . 'system' . DS . 'nonumberelements' . DS . 'helpers' . DS . 'parameters.php';
     $parameters =& NNParameters::getParameters();
     $system_params = JPluginHelper::getPlugin('system', $this->_name);
     $params = $parameters->getParams($system_params->params, JPATH_PLUGINS . DS . 'system' . DS . $this->_name . DS . $this->_name . '.xml');
     // Include the Helper
     require_once JPATH_PLUGINS . DS . $this->_type . DS . $this->_name . DS . 'helper.php';
     $class = get_class($this) . 'Helper';
     $this->helper = new $class($params);
     return $this->helper->render($name);
 }
Example #5
0
 public static function createObserver(JObservableInterface $observableObject, $params = array())
 {
     $observer = new self($observableObject);
     $observer->plugin = JPluginHelper::getPlugin('system', 'jds');
     $observer->params = new JRegistry($observer->plugin->params);
     return $observer;
 }
 function fetchElement($name, $value, &$node, $control_name)
 {
     // Base name of the HTML control.
     $ctrl = $control_name . '[' . $name . ']';
     // Construct the various argument calls that are supported.
     $attribs = ' ';
     if ($v = $node->attributes('size')) {
         $attribs .= 'size="' . $v . '"';
     }
     if ($v = $node->attributes('class')) {
         $attribs .= 'class="' . $v . '"';
     } else {
         $attribs .= 'class="inputbox"';
     }
     if ($m = $node->attributes('multiple')) {
         $attribs .= ' multiple="multiple"';
         $ctrl .= '[]';
     }
     //get plugin name (plugin entryfile name)
     $element = $node->attributes('element');
     $db =& JFactory::getDBO();
     //get plugin params from #__plugins table
     $plugin = JPluginHelper::getPlugin('emailalerts', $element);
     if (!empty($plugin)) {
         $pluginParams = new JParameter($plugin->params);
         $pluginParamsDefault = $pluginParams->_raw;
         //example: plugintitle=K2-Latest Items category=1|3|4|5|2 no_of_items=5 catid=1|3|4|5|2
         $new1 = explode("\n", $pluginParamsDefault);
         $new2 = explode("=", $new1[2]);
         $cats = str_replace('|', ',', $new2[1]);
         if ($cats) {
             $sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman' AND id IN (" . $cats . ")";
         } else {
             //if no category is yet selected
             $sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman'";
         }
     } else {
         //if plugin is not yet enabled load all categories
         $sql = "SELECT id ,title FROM #__categories WHERE published = 1 AND section !='com_docman'";
     }
     $db->setQuery($sql);
     // Query items for list.
     $key = $node->attributes('key_field') ? $node->attributes('key_field') : 'value';
     $val = $node->attributes('value_field') ? $node->attributes('value_field') : $name;
     $options = array();
     foreach ($node->children() as $option) {
         $options[] = array($key => $option->attributes('value'), $val => $option->data());
     }
     $rows = $db->loadAssocList();
     if ($rows) {
         foreach ($rows as $row) {
             $options[] = array($key => $row[$key], $val => $row[$val]);
         }
     }
     if ($options) {
         return JHTML::_('select.genericlist', $options, $ctrl, $attribs, $key, $val, $value, $control_name . $name);
     } else {
         return JText::_('NO_CATS_USER');
     }
 }
Example #7
0
 /**
  * Constructor
  *
  * For php4 compatability we must not use the __constructor as a constructor for
  * plugins because func_get_args ( void ) returns a copy of all passed arguments
  * NOT references.  This causes problems with cross-referencing necessary for the
  * observer design pattern.
  */
 function plgContentCpTags(&$subject)
 {
     parent::__construct($subject);
     // load plugin parameters
     $this->_plugin =& JPluginHelper::getPlugin('content', 'cptags');
     $this->_params = new JParameter($this->_plugin->params);
 }
Example #8
0
/**
* Plugin that loads module positions within content
*/
function plgContentLoadModule(&$row, &$params, $page = 0)
{
    $db =& JFactory::getDBO();
    // simple performance check to determine whether bot should process further
    if (JString::strpos($row->text, 'loadposition') === false) {
        return true;
    }
    // Get plugin info
    $plugin =& JPluginHelper::getPlugin('content', 'loadmodule');
    // expression to search for
    $regex = '/{loadposition\\s*.*?}/i';
    $pluginParams = new JParameter($plugin->params);
    // check whether plugin has been unpublished
    if (!$pluginParams->get('enabled', 1)) {
        $row->text = preg_replace($regex, '', $row->text);
        return true;
    }
    // find all instances of plugin and put in $matches
    preg_match_all($regex, $row->text, $matches);
    // Number of plugins
    $count = count($matches[0]);
    // plugin only processes if there are any instances of the plugin in the text
    if ($count) {
        // Get plugin parameters
        $style = $pluginParams->def('style', -2);
        plgContentProcessPositions($row, $matches, $count, $regex, $style);
    }
}
Example #9
0
 /**
  * get the possible list plug-ins that can be selected for use
  * @return array
  */
 public function getAbstractPlugins()
 {
     if (isset($this->abstractPlugins)) {
         return $this->abstractPlugins;
     }
     // create a new dispatcher so that we only collect admin html for validation rules
     $pluginDispatcher = new JDispatcher();
     //import the validation plugins and assign them to their custom dispatcher
     JPluginHelper::importPlugin('fabrik_form', null, true, $pluginDispatcher);
     $rules = array();
     //trigger the validation dispatcher to get hte validation rules html
     $plugins = JPluginHelper::getPlugin('fabrik_form');
     //JModel::addIncludePath(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'models');
     $pluginManager = JModel::getInstance('Pluginmanager', 'FabrikFEModel');
     $feFormModel = JModel::getInstance('form', 'FabrikFEModel');
     $feFormModel->setId($this->getState('form.id'));
     foreach ($plugins as $x => $plugin) {
         $data = array();
         $o = $pluginManager->getPlugIn($plugin->name, 'Form');
         if ($o !== false) {
             $o->getJForm()->model = $feFormModel;
             // $$$ rob 0 was $x below but that rendered first set of plugins with indexes 1,2,3
             // think they should all be indexed 0
             $str = $o->onRenderAdminSettings($data, 0);
             $js = $o->onGetAdminJs($plugin->name, $plugin->name, $str);
             $str = addslashes(str_replace(array("\n", "\r"), "", $str));
             $attr = "class=\"inputbox elementtype\"";
             $rules[$plugin->name] = array('plugin' => $plugin->name, 'html' => $str, 'js' => $js);
         }
     }
     asort($rules);
     $this->abstractPlugins = $rules;
     return $rules;
 }
Example #10
0
    function display($tpl = null) {
       	
		
		
		$db = JFactory::getDBO();
		$query = "SELECT id FROM #__plugins WHERE element =".$db->quote('myApiComment');
		$db->setQuery($query);
		$id = $db->loadResult();
		
		$row 	=& JTable::getInstance('plugin');
		$row->load($id);
		
		$plugin = & JPluginHelper::getPlugin('content', 'myApiComment');
		if(is_object($plugin)){
		  $paramsdata = $plugin->params;
		  $paramsdefs = JPATH_SITE.DS.'plugins'.DS.'content'.DS.'myApiComment.xml';
		  $params = new JParameter( $paramsdata, $paramsdefs );
		  $this->assignRef('params',$params);
		  $this->assignRef('plugin',$row);
		  JToolbarHelper::save('savePlugin','save content');
		  JToolbarHelper::preferences('com_myapi');
		}else{
			global $mainframe;
			$mainframe->redirect('index.php?option=com_plugins&view=plugin&task=edit&cid='.$id,'The myApiComment plugin needs to be ENABLED before you can configure it.');	
		}		
	
		
	 parent::display($tpl);
    }
Example #11
0
 protected function preprocessForm(\JForm $form, $data, $group = 'content')
 {
     // if no data, grab the posted form data.
     if (!$data instanceof JObject) {
         $data = JFactory::getApplication()->input->get('jform', $data, 'array');
         $data = JArrayHelper::toObject($data);
     }
     $params = new JRegistry();
     $params->loadArray($data->params);
     if ($params->get('discovery.url')) {
         $plugin = $params->get('discovery.type');
         $language = JFactory::getLanguage();
         $language->load('plg_harvest_' . $plugin);
         $path = JPATH_ROOT . '/plugins/harvest/' . $plugin . '/forms/harvest.xml';
         $form->loadFile($path, false);
         foreach (JPluginHelper::getPlugin('ingest') as $plugin) {
             $language->load('plg_ingest_' . $plugin->name);
             $path = JPATH_ROOT . '/plugins/ingest/' . $plugin->name . '/forms/ingest.xml';
             $form->loadFile($path, false);
         }
         $form->removeField('originating_url');
         $form->removeField('harvester');
         // hide the run_once value (users cannot set it after discovery)
         $form->setFieldAttribute("run_once", 'type', 'hidden');
         $form->setFieldAttribute("run_once", 'class', '');
     } else {
         $form->removeField('state');
         $form->removeField('harvested');
         $form->removeField('url', 'params.discovery');
         $form->removeField('type', 'params.discovery');
     }
     parent::preprocessForm($form, $data, $group);
 }
Example #12
0
 /**
  * Gets the parameter object for a plugin
  *
  * @param string $pluginName The plugin name
  * @param string $type The plugin type, relates to the sub-directory in the plugins directory
  * @return JParameter A JParameter object (mosParameters for J1.0)
  */
 public static function getParams($pluginName, $type = 'content')
 {
     if (JCOMMENTS_JVERSION == '1.0') {
         static $mambotParams = array();
         $paramKey = $type . '_' . $pluginName;
         if (!isset($mambotParams[$paramKey])) {
             include_once JCOMMENTS_BASE . DS . 'jcomments.class.php';
             $dbo = JCommentsFactory::getDBO();
             $dbo->setQuery("SELECT params FROM #__mambots WHERE element = '{$pluginName}' AND folder = '{$type}'");
             $mambotParams[$paramKey] = $dbo->loadResult();
         }
         $data = $mambotParams[$paramKey];
         $pluginParams = new mosParameters($data);
     } elseif (JCOMMENTS_JVERSION == '1.5') {
         $plugin = JPluginHelper::getPlugin($type, $pluginName);
         if (is_object($plugin)) {
             $pluginParams = new JParameter($plugin->params);
         } else {
             $pluginParams = new JParameter('');
         }
     } else {
         $plugin = JPluginHelper::getPlugin($type, $pluginName);
         if (is_object($plugin)) {
             $pluginParams = new JRegistry($plugin->params);
         } else {
             $pluginParams = new JRegistry('');
         }
     }
     return $pluginParams;
 }
Example #13
0
 function display($tpl = null)
 {
     $this->canDo = JCKHelper::getActions();
     $this->app = JFactory::getApplication();
     $this->user = JFactory::getUser();
     $this->state = $this->get('State');
     $this->items = $this->get('Items');
     $this->pagination = $this->get('Pagination');
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JCKHelper::error(implode("\n", $errors));
         return false;
     }
     // Check if there are no matching items
     if (!count($this->items)) {
         JCKHelper::error(JText::_('COM_JCK_LAYOUT_MANAGER_NO_TOOLBARS_FOUND'));
     }
     //now lets get default toolbars
     $editor = JPluginHelper::getPlugin('editors', 'jckeditor');
     $params = new JRegistry($editor->params);
     $this->default = $params->get('toolbar', 'Publisher');
     $this->defaultFT = $params->get('toolbar_ft', 'Basic');
     $this->addToolbar();
     parent::display($tpl);
 }
Example #14
0
 function display($tpl = null)
 {
     // Get the url of the Alfresco repository from the Joosco plugin
     // That's why the Joosco plugin needs to be installed and configured before the component
     $plugin =& JPluginHelper::getPlugin('authentication', 'joosco');
     $pluginParams = new JParameter($plugin->params);
     // Here we connect to the Repository
     $repositoryUrl = $pluginParams->get('alf-url');
     $repository = new Repository($repositoryUrl);
     // The ticket is created by the plugin when a user connects
     $ticket = $_SESSION["ticket"];
     $session = $repository->createSession($ticket);
     $store = new SpacesStore($session);
     $currentNode = null;
     $uuid = null;
     $uuid =& JRequest::getVar('uuid');
     if (!isset($uuid)) {
         $currentNode = $store->companyHome;
         $path = 'Company Home';
     } else {
         $currentNode = $session->getNode($store, JRequest::getVar('uuid'));
         $path = JRequest::getVar('path') . '|' . JRequest::getVar('uuid') . '|' . JRequest::getVar('name');
     }
     // Pass the values to the rest of the template
     $this->assignRef('path', $path);
     $this->assignRef('session', $session);
     $this->assignRef('store', $store);
     $this->assignRef('currentNode', $currentNode);
     $this->assignRef('option', JRequest::getVar('option'));
     $this->assignRef('view', JRequest::getVar('view'));
     $this->assignRef('itemid', JRequest::getVar('Itemid'));
     parent::display($tpl);
 }
Example #15
0
 function update()
 {
     $currency = JRequest::getInt('hikashopcurrency', 0);
     if (!empty($currency)) {
         $app = JFactory::getApplication();
         $app->setUserState(HIKASHOP_COMPONENT . '.currency_id', $currency);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_method', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_id', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.shipping_data', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_method', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_id', null);
         $app->setUserState(HIKASHOP_COMPONENT . '.payment_data', null);
         $url = JRequest::getString('return_url', '');
         if (HIKASHOP_J30) {
             $plugin = JPluginHelper::getPlugin('system', 'cache');
             $params = new JRegistry(@$plugin->params);
             $options = array('defaultgroup' => 'page', 'browsercache' => $params->get('browsercache', false), 'caching' => false);
             $cache = JCache::getInstance('page', $options);
             $cache->clean();
         }
         if (!empty($url)) {
             if (hikashop_disallowUrlRedirect($url)) {
                 return false;
             }
             $app->redirect(urldecode($url));
         }
     }
     return true;
 }
Example #16
0
 function buildPaypalUrl($secure = true)
 {
     $plugin = JPluginHelper::getPlugin('payment', 'adaptive_paypal');
     $params = json_decode($plugin->params);
     $url = $params->sandbox ? 'www.sandbox.paypal.com' : 'www.paypal.com';
     return $url = 'https://' . $url . '/cgi-bin/webscr';
 }
Example #17
0
 public function fetchElement($name, $value, &$node, $control_name)
 {
     jimport('joomla.plugin.helper');
     wfimport('admin.helpers.extension');
     $language = JFactory::getLanguage();
     $plugins = JPluginHelper::getPlugin('search');
     // use tested defaults
     if (!$value) {
         $value = array('categories', 'contacts', 'content', 'newsfeeds', 'weblinks');
     } else {
         $value = (array) $value;
     }
     //$html  = '<span style="display:inline-block;"><input class="checkbox-list-toggle-all" type="checkbox"'. $checked .' /><label>'. WFText::_('WF_PROFILES_TOGGLE_ALL') . '</label>';
     $html = '<span style="display:inline-block;" data-parent="' . preg_replace(array('#^params#', '#([^\\w]+)#'), '', $control_name) . $node->attributes()->parent . '"><ul class="checkbox-list">';
     foreach ($plugins as $item) {
         $plugin = WFExtensionHelper::getPlugin(null, $item->name, 'search');
         $extension = 'plg_' . $plugin->folder . '_' . $plugin->element;
         $language->load($extension) || $language->load($extension, JPATH_ADMINISTRATOR);
         $language->load($extension . '.sys') || $language->load($extension . '.sys', JPATH_ADMINISTRATOR);
         $checked = in_array($plugin->element, $value) ? ' checked="checked"' : '';
         $html .= '<li><input type="checkbox" name="' . $control_name . '[' . $name . '][]" value="' . $plugin->element . '"' . $checked . ' /><label>' . JText::_($plugin->name) . '</label></li>';
     }
     $html .= '</ul></span>';
     return $html;
 }
Example #18
0
function plgContentChronoforms($context, &$row, &$params, $page = 0)
{
    $plugin =& JPluginHelper::getPlugin('content', 'chronoforms');
    $pluginParams = new JParameter($plugin->params);
    // define the regular expression for the bot
    $regex = "#{chronoforms}(.*?){/chronoforms}#s";
    if (isset($row->text)) {
        $row->text = preg_replace_callback($regex, '_processForm', $row->text);
    } else {
        $row->text = '';
    }
    //check after text forms
    $after_text = trim($pluginParams->get('after_text_forms'));
    if (!empty($after_text)) {
        $details = explode("\n", $after_text);
        foreach ($details as $detail) {
            $form_details = explode("=", $detail);
            if (count($form_details) == 2 && !empty($form_details[1])) {
                $cats = explode(',', $form_details[1]);
                foreach ($cats as $cat) {
                    if ($cat == $row->catid) {
                        $row->text = $row->text . _displayForm($form_details[0]);
                    }
                }
            }
        }
    }
    return true;
}
Example #19
0
 public function display($tpl = null)
 {
     global $mainframe;
     $pathway =& $mainframe->getPathway();
     $params =& $mainframe->getParams();
     $model = KFactory::get('site::com.picman.model.album');
     $album = $model->getItem();
     // set Breadcrumbs
     $pathway->addItem($album->name);
     // set Document data
     $document =& JFactory::getDocument();
     $document->setMetaData('keywords', $album->metakey);
     $document->setMetaData('description', $album->metadesc);
     $document->setTitle($album->name);
     // Load GData plugin
     $plugin =& JPluginHelper::getPlugin('system', 'gdata');
     $gdata = new JParameter($plugin->params);
     // get Simple XML feed from GData Plugin
     $album = "picman_album_" . $album->id;
     $query = "kind=photo&access=all&thumbsize=144c&imgmax=512";
     $simpleXml = plgSystemGdata::getSimpleXml($album, $query);
     $this->assignRef('album', $album);
     $this->assignRef('params', $params);
     $this->assignRef('simpleXml', $simpleXml);
     $this->assignRef('filter', $model->getFilters());
     $this->assignRef('pagination', $model->getPagination());
     // Display the layout
     parent::display($tpl);
 }
Example #20
0
	function getLoggedInUserLiked(){
		  global $facebook;
		try {
			$plugin =& JPluginHelper::getPlugin('system', 'myApiConnect');
			$com_params = new JParameter( $plugin->params );
		  $fql['email'] =   "SELECT email FROM user WHERE uid = me()";
		  $fql['like'] = "SELECT uid FROM page_fan WHERE uid = me() AND page_id = ".$com_params->get('appId');
		  
		  $param  =   array(
		   'method'    => 'fql.multiquery',
		   'queries'     => json_encode($fql),
		   'callback'  => ''
		  );
		  $fqlResult   =   $facebook->api($param);
		   $return['email'] = $fqlResult[0]['fql_result_set'][0]['email'];
		  
		  if(sizeof($fqlResult[1]['fql_result_set']) > 0)
		  	$return['liked'] = true;
		  else
			$return['liked'] = false;
		  
		  } catch (FacebookApiException $e) {
		  error_log($e);
		  return false;
		}
		return $return;
	}
 /**
  * Method to get the record form.
  *
  * @param   array    $data      An optional array of data for the form to interogate.
  * @param   boolean  $loadData  True if the form is to load its own data (default case), false if not.
  *
  * @return  mixed  A JForm object on success, false on failure
  *
  * @since   1.6
  */
 public function getForm($data = array(), $loadData = true)
 {
     $plugin = JPluginHelper::getPlugin('user', 'joomla');
     $pluginParams = new JRegistry($plugin->params);
     // Get the form.
     $form = $this->loadForm('com_users.user', 'user', array('control' => 'jform', 'load_data' => $loadData));
     if (empty($form)) {
         return false;
     }
     // Passwords fields are required when mail to user is set to No in joomla user plugin
     $userId = $form->getValue('id');
     if ($userId === 0 && $pluginParams->get('mail_to_user') === "0") {
         $form->setFieldAttribute('password', 'required', 'true');
         $form->setFieldAttribute('password2', 'required', 'true');
     }
     // If the user needs to change their password, mark the password fields as required
     if (JFactory::getUser()->requireReset) {
         $form->setFieldAttribute('password', 'required', 'true');
         $form->setFieldAttribute('password2', 'required', 'true');
     }
     // The user should not be able to set the requireReset value on their own account
     if ((int) $userId === (int) JFactory::getUser()->id) {
         $form->removeField('requireReset');
     }
     return $form;
 }
Example #22
0
 public static function getProfile($userid)
 {
     $db = JFactory::getDbo();
     $q = $db->getQuery(true);
     $q->select('*');
     $q->from('#__plg_slogin_profile');
     $q->where('`user_id` = ' . (int) $userid);
     $q->where('`current_profile` = 1');
     $db->setQuery($q, 0, 1);
     $profile = $db->loadObject();
     if (!$profile) {
         $q = $db->getQuery(true);
         $q->select('*');
         $q->from('#__plg_slogin_profile');
         $q->where('`user_id` = ' . (int) $userid);
         $db->setQuery($q, 0, 1);
         $profile = $db->loadObject();
     }
     if (!$profile) {
         return false;
     }
     if (!empty($profile->avatar)) {
         //Получаем папку с изображениями
         $plugin = JPluginHelper::getPlugin('slogin_integration', 'profile');
         $pluginParams = new JRegistry();
         $pluginParams->loadString($plugin->params);
         $paramFolder = $pluginParams->get('rootfolder', 'images/avatar');
         $profile->avatar = preg_replace("/.*?\\//", "", $profile->avatar);
         $profile->avatar = $paramFolder . '/' . $profile->avatar;
     }
     return $profile;
 }
Example #23
0
function plgSearchEvents($text, $phrase = '', $ordering = '', $areas = null)
{
    require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_search' . DS . 'helpers' . DS . 'search.php';
    if (is_array($areas)) {
        if (!array_intersect($areas, array_keys(plgSearchEventsAreas()))) {
            return array();
        }
    }
    // load plugin params info
    $plugin =& JPluginHelper::getPlugin('search', 'events');
    $pluginParams = new JParameter($plugin->params);
    $limit = $pluginParams->def('search_limit', 50);
    $text = trim($text);
    if ($text == '') {
        return array();
    }
    $events = KService::get('com://admin/calendar.model.events')->sort('tbl.start_date')->direction('ASC')->limit($limit)->search($text)->getList();
    $return = array();
    foreach ($events as $event) {
        if (searchHelper::checkNoHTML($event, $text, array('title', 'description'))) {
            $event->text = $event->description;
            $event->origin = 'events';
            $event->href = 'index.php?option=com_calendar&view=event&id=' . $event->id . '&slug=' . $event->slug;
            $event->section = JText::_('Events');
            $return[] = $event->getData();
        }
    }
    return $return;
}
Example #24
0
 /**
  * Constructor
  *
  * @access public
  * @param   object  &$subject  The object to observe
  */
 public function __construct(&$subject)
 {
     if (isset($_GET['sgCacheCheck']) && $_GET['sgCacheCheck'] == md5('joomlaCheck')) {
         die('OK');
     }
     parent::__construct($subject);
     $plugin = JPluginHelper::getPlugin('system', 'jSGCache');
     $this->params = new JRegistry();
     $this->params->loadString($plugin->params, 'JSON');
     $this->_cacheEnabled = $this->params->get('cache_enabled');
     if ($this->_cacheEnabled === null) {
         $this->_cacheEnabled == 1;
     }
     $this->_autoflush = $this->params->get('autoFlush');
     if ($this->_autoflush === null) {
         $this->_autoflush = 1;
     }
     $this->_autoflush3rdParty = $this->params->get('autoFlush-ThirdParty');
     if ($this->_autoflush3rdParty === null) {
         $this->_autoflush3rdParty = 1;
     }
     $this->_autoflushClientSide = $this->params->get('autoFlush-ClientSide');
     if ($this->_autoflushClientSide === null) {
         $this->_autoflushClientSide = 0;
     }
 }
Example #25
0
 /** 1.5 **/
 public function onSearch($text, $phrase = '', $ordering = '', $areas = null)
 {
     $plugin = JPluginHelper::getPlugin('search', 'easyblog');
     $params = EB::registry($plugin->params);
     if (!plgSearchEasyblog::exists()) {
         return array();
     }
     if (is_array($areas)) {
         if (!array_intersect($areas, array_keys(plgSearchEasyblog::onContentSearchAreas()))) {
             return array();
         }
     }
     $text = trim($text);
     if ($text == '') {
         return array();
     }
     $result = plgSearchEasyblog::getResult($text, $phrase, $ordering);
     if (!$result) {
         return array();
     }
     // require_once( EBLOG_HELPERS . DIRECTORY_SEPARATOR . 'router.php' );
     foreach ($result as $row) {
         $row->section = plgSearchEasyblog::getCategory($row->category_id);
         $row->section = JText::sprintf('PLG_EASYBLOG_SEARCH_BLOGS_SECTION', $row->section);
         $row->href = EBR::_('index.php?option=com_easyblog&view=entry&id=' . $row->id);
         $blog = EB::table('Blog');
         $blog->bind($row);
         if ($blog->getImage()) {
             $row->image = $blog->getImage('frontpage');
         }
     }
     return $result;
 }
Example #26
0
 /**
  *
  * Construct method
  * @param object $subject
  * @param object $config
  */
 function __construct(&$subject, $config)
 {
     parent::__construct($subject, $config);
     JHTML::_('behavior.framework', true);
     $this->plugin = JPluginHelper::getPlugin('content', 'jadisqus_debate_echo');
     $this->plgParams = new JRegistry();
     $this->plgParams->loadString($this->plugin->params);
     $this->source = $this->plgParams->get('source', 'both');
     $provider = $this->plgParams->get('provider', 'intensedebate');
     $this->postion_display_listing = $this->plgParams->get('postion_display_listing', 'onContentBeforeDisplay');
     $this->postion_display_details = $this->plgParams->get('postion_display_details', 'onContentBeforeDisplay');
     $this->position = $this->plgParams->get('position', 'onContentAfterDisplay');
     switch ($provider) {
         case 'disqus':
             $provider = 'disqus';
             break;
         case 'jskit':
             $provider = 'jskit';
             break;
         case 'intensdebate':
             $provider = 'intensedebate';
             break;
         default:
             $provider = 'intensedebate';
             break;
     }
     $this->provider = $provider;
     if ($this->provider == 'disqus') {
         $countscript = $this->loadLayout($this->plugin, 'disqus_count');
         //$body = str_replace('</body>', $countscript . "\n</body>", $body);
         $doc = JFactory::getDocument();
         $doc->addScriptDeclaration($countscript);
     }
     $this->stylesheet($this->plugin);
 }
Example #27
0
	function plgSystemmyApiOpenGraph(&$subject, $config){
		parent::__construct($subject, $config);
		if(!class_exists('plgSystemmyApiConnect')) return;
		
		$cache = & JFactory::getCache('plgSystemmyApiOpenGraph - FB Admins query');
		$cache->setCaching( 1 );
		$config 	=& JFactory::getConfig();
		$connect_plugin 	=& JPluginHelper::getPlugin('system', 'myApiConnect');
		$connect_params 	= new JParameter( $connect_plugin->params );
		
		$plugin =& JPluginHelper::getPlugin('system', 'myApiOpenGraph');
		$plugin_params = new JParameter( $plugin->params );
		
		$db_admins = $cache->call( array( 'plgSystemmyApiOpenGraph', 'getFbAdmins'));
		$param_admins = ($plugin_params->get('fbadmins') != '') ? explode(',',$plugin_params->get('fbadmins')) : array();
		$admins = array_merge($db_admins,$param_admins);
		
		$ogptags_default					= array();
		$ogptags_default['og:title']		= $config->getValue( 'config.sitename' );
		$ogptags_default['og:type'] 		= 'website';
		$ogptags_default['og:url'] 			= JURI::getInstance()->toString();
		$ogptags_default['og:site_name']	= $config->getValue( 'config.sitename' );
		$ogptags_default['fb:app_id'] 		= $connect_params->get('appId');
		$ogptags_default['fb:admins']		= implode(',',$admins);
		if($plugin_params->get('ogimage') != '' && $plugin_params->get('ogimage') != -1) $ogptags_default['og:image'] = JURI::base().'images/'.$plugin_params->get('ogimage');
		if($plugin_params->get('fbpageid') != '') $ogptags_default['fb:page_id'] = $plugin_params->get('fbpageid');
		
		
		plgSystemmyApiOpenGraph::setTags($ogptags_default);
	}
Example #28
0
 /**
  *  prepare content method
  *
  * Method is called by the view
  *
  * @param	string	The context of the content being passed to the plugin.
  * @param 	object		The article object.  Note $article->text is also available
  * @param 	object		The article params
  * @param 	int			The 'page' number
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     //load fabrik language
     $lang =& JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . DS . 'components' . DS . 'com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin =& JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JParameter($plugin->params);
     // simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php';
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
Example #29
0
 /**
  *  Prepare content method
  *
  * Method is called by the view
  *
  * @param   string  $context  The context of the content being passed to the plugin.
  * @param   object  &$row     The article object.  Note $article->text is also available
  * @param   object  &$params  The article params
  * @param   int     $page     The 'page' number
  *
  * @return  void
  */
 public function onContentPrepare($context, &$row, &$params, $page = 0)
 {
     jimport('joomla.html.parameter');
     jimport('joomla.filesystem.file');
     // Load fabrik language
     $lang = JFactory::getLanguage();
     $lang->load('com_fabrik', JPATH_BASE . '/components/com_fabrik');
     if (!defined('COM_FABRIK_FRONTEND')) {
         JError::raiseError(400, JText::_('COM_FABRIK_SYSTEM_PLUGIN_NOT_ACTIVE'));
     }
     // Get plugin info
     $plugin = JPluginHelper::getPlugin('content', 'fabrik');
     // $$$ hugh had to rename this, it was stomping on com_content and friends $params
     // $$$ which is passed by reference to us!
     $fparams = new JRegistry($plugin->params);
     // Simple performance check to determine whether bot should process further
     $botRegex = $fparams->get('Botregex') != '' ? $fparams->get('Botregex') : 'fabrik';
     if (JString::strpos($row->text, $botRegex) === false) {
         return true;
     }
     require_once COM_FABRIK_FRONTEND . '/helpers/parent.php';
     /* $$$ hugh - hacky fix for nasty issue with IE, which (for gory reasons) doesn't like having our JS content
      * wrapped in P tags.  But the default WYSIWYG editor in J! will automagically wrap P tags around everything.
      * So let's just look for obvious cases of <p>{fabrik ...}</p>, and replace the P's with DIV's.
      * Yes, it's hacky, but it'll save us a buttload of support work.
      */
     $pregex = "/<p>\\s*{" . $botRegex . "\\s*.*?}\\s*<\\/p>/i";
     $row->text = preg_replace_callback($pregex, array($this, 'preplace'), $row->text);
     // $$$ hugh - having to change this to use {[]}
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $row->text = preg_replace_callback($regex, array($this, 'replace'), $row->text);
 }
Example #30
0
 public static function getInstance($name)
 {
     if (isset(self::$instances[$name])) {
         return self::$instances[$name];
     }
     $plugin = JPluginHelper::getPlugin('api', $name);
     if (empty($plugin)) {
         throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
     }
     jimport('joomla.filesystem.file');
     $plgfile = JPATH_BASE . self::$plg_path . $name . DS . $name . '.php';
     $param_path = JPATH_BASE . self::$plg_path . $name . DS . $name . '.xml';
     if (!JFile::exists($plgfile)) {
         throw new Exception(JText::_('COM_API_FILE_NOT_FOUND'), 400);
     }
     include $plgfile;
     $class = self::$plg_prefix . ucwords($name);
     if (!class_exists($class)) {
         throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
     }
     $handler = new $class();
     $cparams = JComponentHelper::getParams('com_api');
     $params = new JRegistry();
     $params->loadString($plugin->params);
     $cparams->merge($params);
     $handler->set('params', $cparams);
     $handler->set('component', JRequest::getCmd('app'));
     $handler->set('resource', JRequest::getCmd('resource'));
     $handler->set('format', $handler->negotiateContent(JRequest::getCmd('output', null)));
     $handler->set('request_method', JRequest::getMethod());
     self::$instances[$name] = $handler;
     return self::$instances[$name];
 }