Ejemplo n.º 1
0
 static function &geTtoolbarParams($editor, $args = array())
 {
     if (count($args) > 1) {
         $row = $args[1];
     }
     if (is_a($args[0], 'JParameter')) {
         $params = $args[0];
     } else {
         if ($row) {
             $params = new JParameter($row->params);
         } else {
             $row =& JCKHelper::getTable('toolbar');
             // load the row from the db table
             $row->load($args[0]);
             //get toolbar parameter
             $params = new JParameter($row->params);
         }
     }
     $editor_params = new JParameter($editor->params);
     $toolbar = $params->get('toolbar', $row->name);
     $skins = $params->get('skin', $editor_params->def('skin', 'office2003'));
     $width = $params->get('wwidth', $editor_params->def('wwidth', '100%'));
     $editor_params->set('toolbar', $toolbar);
     $editor_params->set('skin', $skins);
     $editor_params->set('wwidth', $width);
     $editor_params->Set('hheight', 300);
     return $editor_params;
 }
Ejemplo n.º 2
0
 /**
  *  prepare content method
  *
  * Method is called by the view
  *
  * @param 	object		The article object.  Note $article->text is also available
  * @param 	object		The article params
  * @param 	int			The 'page' number
  */
 function onPrepareContent(&$article, &$params, $limitstart = 0)
 {
     //load fabrik language
     $lang =& JFactory::getLanguage();
     $lang->load('com_fabrik');
     // 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($article->text, $botRegex) === false) {
         return true;
     }
     jimport('joomla.filesystem.file');
     $defines = JFile::exists(JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'user_defines.php') ? JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'user_defines.php' : JPATH_SITE . DS . 'components' . DS . 'com_fabrik' . DS . 'defines.php';
     require_once $defines;
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'parent.php';
     require_once COM_FABRIK_FRONTEND . DS . 'helpers' . DS . 'json.php';
     // $$$ hugh - having to change this to use {[]}
     //regex to get nested { {} } string - one layer deep e.g. you cant do { {{}} }
     /*
      $regex = "/{" .$botRegex ."\s*.*{*.*}*.*?}/i";
     $article->text = preg_replace_callback( $regex, array($this, 'parse'), $article->text);
     */
     $regex = "/{" . $botRegex . "\\s*.*?}/i";
     $res = preg_replace_callback($regex, array($this, 'replace'), $article->text);
     if (!JError::isError($res)) {
         $article->text = $res;
     }
 }
Ejemplo n.º 3
0
 /**
  * 
  * @param $filenames
  * @return unknown_type
  */
 function rehashFiles($files, $useFilter = false)
 {
     if (empty($files)) {
         return;
     }
     settype($files, 'array');
     $filter = null;
     // Create the filesystem filter.
     if ($useFilter) {
         // Fetch component config
         $confModel =& JModel::getInstance('Configuration', 'JDefenderModel');
         $config = new JParameter($confModel->getIni());
         $fileExts = explode("\n", trim($config->get('scan_file_patterns', '*'), "\r\n "));
         $fileExts = str_replace(array("\n", "\r\n", "\n\r"), '', $fileExts);
         $excludedDirs = explode("\n", trim($config->get('scan_excluded_directories', JPATH_ROOT . DS . 'cache' . "\n" . JPATH_ROOT . DS . 'tmp'), "\r\n "));
         $excludedDirs = str_replace(array("\n", "\r\n", "\n\r"), '', $excludedDirs);
         for ($i = 0, $count = count($excludedDirs); $i < $count; $i++) {
             $excludedDirs[$i] = JPath::clean(JPATH_ROOT . DS . $excludedDirs[$i]);
         }
         $filter = new JD_Filesystem_Filter($fileExts, $excludedDirs);
     }
     $this->deleteFiles($files);
     $count = $this->addFiles($files, $filter);
     return $count;
 }
Ejemplo n.º 4
0
 function _showMenuDetail($row, $level = 0)
 {
     $_temp = null;
     $title = "title=\"{$row->title}\"";
     $menu_params = new JParameter($row->params);
     if ($menu_params->get('menu_image') && $menu_params->get('menu_image') != -1) {
         $str = '<img src="' . JURI::base(true) . '/' . $menu_params->get('menu_image') . '" alt="' . $row->title . '" /><span class="menusys_name">' . $row->title . '</span>';
     } else {
         $str = '<span class="menusys_name">' . $row->title . '</span>';
     }
     $Class = $this->activeClass($row, $level);
     $id = 'id="menusys' . $row->id . '"';
     if (@$row->url != null) {
         if ($row->browserNav == 0) {
             $menuItem = '<a href="' . $row->url . '" ' . $Class . ' ' . $id . ' ' . $title . '>' . $str . '</a>';
         } elseif ($row->browserNav == 1) {
             $menuItem = '<a target="_blank" href="' . $row->url . '" ' . $Class . ' ' . $id . ' ' . $title . '>' . $str . '</a>';
         } elseif ($row->browserNav == 2) {
             $url = str_replace('index.php', 'index2.php', $tmp->url);
             $atts = 'toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=350';
             $menuItem = '<a href="' . $url . '" onclick="window.open("' . $url . '",\'targetWindow\',\'' . $atts . '\'); return false;" ' . $Class . ' ' . $id . ' ' . $title . '>' . $str . '</a>';
         }
     } else {
         $menuItem = '<a ' . $id . ' ' . $title . '>' . $str . '</a>';
     }
     echo $menuItem;
 }
Ejemplo n.º 5
0
 function run($form, $actiondata)
 {
     $events = unserialize(base64_decode($form->form_details->events_actions_map));
     $params = new JParameter($actiondata->params);
     $targetEvent = $params->get('target_event', '_form_actions_events_map[myform][events][load]');
     if (empty($targetEvent)) {
         $targetEvent = '_form_actions_events_map[myform][events][load]';
     }
     $targetEvent = str_replace(array('_form_actions_events_map[', ']'), '', $targetEvent);
     $path = explode('[', $targetEvent);
     unset($path[0]);
     foreach ($path as $k => $v) {
         if ($k == count($path)) {
             break;
         }
         $events = $events[$v];
     }
     $actionsArray = array();
     if (isset($form->form_actions)) {
         foreach ($form->form_actions as $action_index => $action_data) {
             $actionsArray['cfaction_' . $action_data->type . '_' . $action_data->order] = $action_data;
         }
     }
     $form->_processEvents($path[count($path)], $events, $actionsArray);
     if ($params->get('quit_next', 1)) {
         //halt any future scheduled actions processing (exit the main actions loop)
         $form->stop = true;
     }
 }
Ejemplo n.º 6
0
 function run($form, $actiondata)
 {
     $mainframe =& JFactory::getApplication();
     $params = new JParameter($actiondata->params);
     if (isset($form->data['redirect_url']) && $form->data['redirect_url']) {
         $redirect_url = $form->data['redirect_url'];
     } else {
         $redirect_url = $params->get('target_url');
     }
     if (!$redirect_url) {
         $form->debug['redirect_user'][] = 'Error: No Redirect URL found';
         return false;
     }
     $form->debug['redirect_user'][] = 'redirect_user_target_url: ' . $params->get('target_url');
     //$mainframe->enqueuemessage('$form: '.print_r($form, true).'<hr />');
     //if ( filter_var($redirect_url, FILTER_VALIDATE_URL) ) {
     $debug = false;
     foreach ($form->form_actions as $a) {
         if ($a->type == 'debugger' && $a->enabled) {
             $debug = true;
             break;
         }
     }
     if ($debug) {
         $form->debug['redirect_user'][] = "Redirect URL (click to continue):<br /><a href='{$redirect_url}'>{$redirect_url}</a>";
     } else {
         $mainframe->redirect($redirect_url);
     }
     /*} else {
     			$form->debug['redirect_user'][] = 'Error: Invalid URL';
     		}*/
 }
Ejemplo n.º 7
0
 function run($form, $actiondata)
 {
     $params = new JParameter($actiondata->params);
     $skipped = $params->get('skipped', '');
     if (!empty($skipped)) {
         $skipped = explode(',', $skipped);
     } else {
         $skipped = array();
     }
     $del = $params->get('delimiter', ",");
     //handle specific fields only ?
     if (strlen($params->get('fields_list', ''))) {
         $fields_list = explode(',', $params->get('fields_list', ''));
         foreach ($fields_list as $field) {
             $field = trim($field);
             //get field value
             $field_value = $form->get_array_value($form->data, explode('.', $field));
             if (is_array($field_value)) {
                 $form->data = $form->set_array_value($form->data, explode('.', $field), implode($del, $field_value));
             }
         }
     } else {
         $form->data = $this->array_handler($form->data, $skipped, $del);
     }
 }
 function run($form, $actiondata)
 {
     $params = new JParameter($actiondata->params);
     $rules = array('required', 'not_empty', 'empty', 'alpha', 'alphanumeric', 'digit', 'nodigit', 'number', 'email', 'phone', 'phone_inter', 'url');
     foreach ($rules as $rule) {
         $fields_string = trim($params->get($rule, ''));
         if (!empty($fields_string)) {
             $fields = explode(",", $fields_string);
             foreach ($fields as $field) {
                 $function = 'validate_' . $rule;
                 $result = $this->{$function}(trim($field), $form);
                 if (!$result) {
                     $this->events['fail'] = 1;
                     if (!isset($form->validation_errors[trim($field)])) {
                         $form->validation_errors[trim($field)] = $params->get($rule . '_error');
                     } else {
                         if (is_array($form->validation_errors[trim($field)])) {
                             $form->validation_errors[trim($field)][] = $params->get($rule . '_error');
                         } else {
                             $form->validation_errors[trim($field)] = array($form->validation_errors[trim($field)], $params->get($rule . '_error'));
                         }
                     }
                     //return false;
                 }
             }
         }
     }
     if ($this->events['fail'] == 0) {
         $this->events['success'] = 1;
     }
 }
Ejemplo n.º 9
0
 function run($form, $actiondata)
 {
     $params = new JParameter($actiondata->params);
     $mainframe = JFactory::getApplication();
     //settings, vars
     $doc = JFactory::getDocument();
     //description
     $doc->setDescription($params->get('description', 'Our Contact Page.'));
     //keywords
     $doc->setMetaData('keywords', $params->get('keywords', ''));
     //robots
     $doc->setMetaData('robots', $params->get('robots', 'index, follow'));
     //generator
     $doc->setMetaData('generator', $params->get('generator', 'Joomla! - Chronoforms!'));
     //title
     $title = $params->get('title', '');
     if (trim($title)) {
         $doc->setTitle($title);
     }
     //custom
     if (!empty($actiondata->content1)) {
         $list = explode("\n", trim($actiondata->content1));
         foreach ($list as $item) {
             $fields_data = explode("=", $item);
             $doc->setMetaData(trim($fields_data[0]), trim($fields_data[1]));
         }
     }
 }
Ejemplo n.º 10
0
 /**
  * Format a number
  *
  * @param float|int $number
  * @param int $decimals
  * @return string
  */
 function formatNumber($number = 0, $decimals = 0)
 {
     //verify if we need to represent decimal (ex : 2.00 = 2)
     $temp = intval($number);
     if ($temp - $number == 0.0) {
         $decimals = 0;
     }
     //decode charset before using number_format
     jimport('joomla.utilities.string');
     if (function_exists('iconv')) {
         $decimal_separator = JString::transcode($this->params->get('decimals_separator', ','), $this->_charset, 'ISO-8859-1');
         $thousands_separator = JString::transcode($this->params->get('thousands_separator', ' '), $this->_charset, 'ISO-8859-1');
     } else {
         $decimal_separator = utf8_decode($this->params->get('decimals_separator', ','));
         $thousands_separator = utf8_decode($this->params->get('thousands_separator', ' '));
     }
     $number = number_format($number, $decimals, $decimal_separator, $thousands_separator);
     //re-encode
     if (function_exists('iconv')) {
         $number = JString::transcode($number, 'ISO-8859-1', $this->_charset);
     } else {
         $number = utf8_encode($number);
     }
     return $number;
 }
Ejemplo n.º 11
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 - 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);
 }
Ejemplo n.º 12
0
 function run($form, $actiondata)
 {
     $mainframe =& JFactory::getApplication();
     $session =& JFactory::getSession();
     $params = new JParameter($actiondata->params);
     //get secret
     $secret = $mainframe->getCfg('secret');
     $fields = array();
     if (strlen(trim($params->get('fields', '')))) {
         $fields = explode(',', trim($params->get('fields', '')));
     }
     $hashed_values = array();
     foreach ($fields as $k => $field) {
         $hashed_values[$field] = $form->get_array_value($form->data, explode('.', $field));
     }
     $form->debug['Check Fields Hash'][$actiondata->order] = $hashed_values;
     $hash = serialize($hashed_values);
     $hash = md5($hash);
     $hash = md5($hash . ':' . $secret);
     $hash_field_name = trim($params->get('hash_field_name', 'cf_fields_hash'));
     if (!empty($form->data[$hash_field_name]) && $form->data[$hash_field_name] == $hash) {
         $this->events['success'] = 1;
         return true;
     } else {
         $this->events['fail'] = 1;
         return false;
     }
 }
Ejemplo n.º 13
0
 /**
  * Function used to update
  *
  * @param   INT  $called_frm  //Mundhe complet this
  *
  * @return  Array
  *
  * @since  1.0.0
  */
 public function update_mod($called_frm = '0')
 {
     $lang = JFactory::getLanguage();
     $lang->load('mod_quick2cart', JPATH_ROOT);
     $comquick2cartHelper = new comquick2cartHelper();
     jimport('joomla.application.module.helper');
     if (JModuleHelper::getModule('mod_quick2cart')) {
         $module = JModuleHelper::getModule('mod_quick2cart');
         if (JVERSION < '1.6.0') {
             $moduleParams = new JParameter($module->params);
             $layout = $moduleParams->get('viewtype');
             $ckout_text = $moduleParams->get('checkout_text');
         } else {
             $moduleParams = json_decode($module->params);
             if (!empty($moduleParams)) {
                 $layout = $moduleParams->viewtype;
                 $ckout_text = $moduleParams->checkout_text;
             }
         }
     }
     if (isset($layout) && isset($ckout_text)) {
         $data = $comquick2cartHelper->get_module($layout, $ckout_text);
     } else {
         $data = $comquick2cartHelper->get_module();
     }
     echo $data;
     jexit();
 }
Ejemplo n.º 14
0
 /**
  * get all events_categories to use category color
  * @return  object
  */
 function getCategoryData()
 {
     static $cats;
     if (!isset($cats)) {
         $db =& JFactory::getDBO();
         if (JVersion::isCompatible("1.6.0")) {
             $sql = "SELECT c.* FROM #__categories as c WHERE extension='" . JEV_COM_COMPONENT . "' order by c.lft asc";
             $db->setQuery($sql);
             $cats = $db->loadObjectList('id');
             foreach ($cats as &$cat) {
                 $cat->name = $cat->title;
                 $params = new JParameter($cat->params);
                 $cat->color = $params->get("catcolour", "");
                 $cat->overlaps = $params->get("overlaps", 0);
             }
             unset($cat);
         } else {
             $sql = "SELECT c.*, e.color FROM #__jevents_categories AS e LEFT JOIN #__categories as c ON c.id=e.id";
             $db->setQuery($sql);
             $cats = $db->loadObjectList('id');
         }
         $dispatcher =& JDispatcher::getInstance();
         $dispatcher->trigger('onGetCategoryData', array(&$cats));
     }
     $dispatcher =& JDispatcher::getInstance();
     $dispatcher->trigger('onGetAccessibleCategories', array(&$cats));
     return $cats;
 }
Ejemplo n.º 15
0
 function run($form, $actiondata)
 {
     $params = new JParameter($actiondata->params);
     $mainframe = JFactory::getApplication();
     $vendorid = $params->get('sid');
     $secretword = $params->get('secret');
     $md5hash = strtoupper(md5($form->data['sale_id'] . $vendorid . $form->data['invoice_id'] . $secretword));
     //if the hash is ok
     if ($md5hash == $form->data['md5_hash']) {
         //switch messages types
         switch ($form->data['message_type']) {
             case 'ORDER_CREATED':
                 $this->events['new_order'] = 1;
                 break;
             case 'FRAUD_STATUS_CHANGED':
                 $this->events['fraud_status'] = 1;
                 break;
             case 'REFUND_ISSUED':
                 $this->events['refund'] = 1;
                 break;
             default:
                 $this->events['other'] = 1;
                 break;
         }
     } else {
         //$this->events['hack'] = 1;
     }
 }
Ejemplo n.º 16
0
 function run($form, $actiondata)
 {
     $mainframe =& JFactory::getApplication();
     $params = new JParameter($actiondata->params);
     if (function_exists('curl_init')) {
         $form->debug['curl'][] = "CURL OK : the CURL function was found on this server.";
     } else {
         $form->debug['curl'][] = "CURL problem : the CURL function was not found on this server.";
         return;
     }
     if (!empty($actiondata->content1)) {
         $list = explode("\n", trim($actiondata->content1));
         $curl_values = array();
         foreach ($list as $item) {
             $fields_data = explode("=", $item);
             $curl_values[$fields_data[0]] = $form->data[trim($fields_data[1])];
         }
     }
     $query = JURI::buildQuery($curl_values);
     $form->debug['curl'][] = '$curl_values: ' . print_r($query, true);
     $form->debug['curl'][] = 'curl_target_url: ' . $params->get('target_url');
     $ch = curl_init($params->get('target_url'));
     curl_setopt($ch, CURLOPT_HEADER, $params->get('header_in_response', 0));
     // set to 0 to eliminate header info from response
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     // Returns response data instead of TRUE(1)
     curl_setopt($ch, CURLOPT_POSTFIELDS, $query);
     // use HTTP POST to send form data
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
     $response = curl_exec($ch);
     //execute post and get results
     curl_close($ch);
     //add the response in the form data array
     $form->data['curl'] = $response;
 }
 function run($form, $actiondata)
 {
     $mainframe =& JFactory::getApplication();
     $this->params = $params = new JParameter($actiondata->params);
     if (trim($params->get('connection_name', '')) != '' && trim($params->get('task', '')) != '') {
         $received_data = array('connection_name' => $params->get('connection_name', ''), 'task' => $params->get('task', ''), 'field_name' => $params->get('field_name', ''));
         if (trim($params->get('data', '')) != '' && isset($form->data[$params->get('data', '')])) {
             $received_data['data'] = $form->data[$params->get('data', '')];
         }
         $this->processData($form, $actiondata, $received_data);
     } else {
         if (isset($form->data['apps_data']['ChronoConnectivity']['action_' . $actiondata->order])) {
             $received_data = $form->data['apps_data']['ChronoConnectivity']['action_' . $actiondata->order];
             //print_r2($session_data);
             if (isset($received_data['task']) && !empty($received_data['task'])) {
                 $this->processData($form, $actiondata, $received_data);
             } else {
                 $this->events['fail'] = 1;
                 if ((bool) $params->get('show_returned_errors', 0) === true) {
                     $form->validation_errors[] = "Error occurred, session data couldn't be found.";
                 } else {
                     $form->validation_errors[] = $params->get('error_message', '');
                     $form->debug['Chrono Connectivity Task'][$actiondata->order] = "Error occurred, session data couldn't be found.";
                 }
             }
         }
     }
 }
Ejemplo n.º 18
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);
 }
Ejemplo n.º 19
0
 protected function _getFiles()
 {
     $page = $this->getObject('application.pages')->getActive();
     $params = new JParameter($page->params);
     $state = $this->getModel()->getState();
     $request = $this->getObject('lib:controller.request');
     if ($this->getLayout() == 'gallery') {
         $request->query->set('types', array('image'));
     }
     $request->query->set('thumbnails', true);
     $request->query->set('sort', $params->get('sort'));
     $request->query->set('direction', $params->get('direction'));
     $request->query->set('offset', $state->offset);
     $request->query->set('folder', $state->folder);
     $request->query->set('container', $state->container);
     $request->query->set('limit', $state->limit);
     $identifier = clone $this->getIdentifier();
     $identifier->path = array('controller');
     $identifier->name = 'file';
     $controller = $this->getObject($identifier, array('request' => $request));
     $files = $controller->browse();
     $total = $controller->getModel()->getTotal();
     if ($params->get('humanize_filenames', 1)) {
         foreach ($files as $file) {
             $file->display_name = ucfirst(preg_replace('#[-_\\s\\.]+#i', ' ', $file->filename));
         }
     }
     return array('items' => $files, 'total' => $total);
 }
Ejemplo n.º 20
0
 function processSize($size = 'big', $form, $actiondata, $photo, $filein, $upload_path, $file_info)
 {
     $params = new JParameter($actiondata->params);
     $quality = $params->get('quality', 90);
     $dir = '';
     if ($params->get($size . '_directory', '')) {
         $dir .= $params->get($size . '_directory', '');
     } else {
         $dir .= $upload_path;
     }
     // add a final slash if needed
     if (substr($dir, -1) != DS) {
         $dir .= DS;
     }
     $fileout = $dir . $params->get($size . '_image_prefix', '') . str_replace('.' . $file_info['extension'], '', $photo) . $params->get($size . '_image_suffix', '_' . $size) . '.' . $file_info['extension'];
     $crop = $params->get($size . '_image_method', 0);
     $imagethumbsize_w = $params->get($size . '_image_width', 400);
     $imagethumbsize_h = $params->get($size . '_image_height', 300);
     $red = $params->get($size . '_image_r', 255);
     $green = $params->get($size . '_image_g', 255);
     $blue = $params->get($size . '_image_b', 255);
     $use = $params->get($size . '_image_use', 0);
     if ($size == 'big') {
         $use = true;
     }
     if ($use) {
         if ($crop) {
             $this->resizeThenCrop($filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $quality);
         } else {
             $this->resize($filein, $fileout, $imagethumbsize_w, $imagethumbsize_h, $red, $green, $blue, $quality);
         }
         return $params->get($size . '_image_prefix', '') . str_replace('.' . $file_info['extension'], '', $photo) . $params->get($size . '_image_suffix', '_' . $size) . '.' . $file_info['extension'];
     }
     return null;
 }
 function run($form, $actiondata)
 {
     $mainframe =& JFactory::getApplication();
     $params = new JParameter($actiondata->params);
     //save the data to db
     if ($_GET['action'] == 'verify') {
         if (isset($_GET['hash']) && !empty($_GET['hash'])) {
             $database =& JFactory::getDBO();
             $database->setQuery("SELECT * FROM " . $params->get('table_name') . " WHERE " . $params->get('verify_field') . "='" . JRequest::getVar('hash') . "' AND " . $params->get('verification_status_field') . "='0'");
             $record = $database->loadAssoc();
             if (!empty($record)) {
                 $this->events['success'] = 1;
                 //check if the files array should be loaded as well
                 if (trim($params->get('files_array_field', ''))) {
                     eval('?>' . '<?php $form->files = ' . $record[trim($params->get('files_array_field'))] . '; ?>');
                 }
                 unset($record[trim($params->get('files_array_field'))]);
                 //load the data array with the record data
                 $form->data = array_merge($form->data, $record);
                 //update the db record as "verified"
                 $database->setQuery("UPDATE " . $params->get('table_name') . " SET " . $params->get('verification_status_field') . "='1' WHERE " . $params->get('verify_field') . "='" . JRequest::getVar('hash') . "'");
                 if (!$database->query()) {
                     $form->debug[] = $row->getError();
                 }
             } else {
                 $this->events['fail'] = 1;
                 $form->validation_errors['verification'] = $params->get('This record does NOT exist or has already been verified.');
             }
         } else {
             $this->events['fail'] = 1;
         }
     }
 }
 function _populateSingleItem($itemId)
 {
     global $gantry;
     $ini_string = $gantry->readMenuItemParams($itemId);
     $menu_params = new JParameter($ini_string);
     foreach ($gantry->_preset_names as $param_name) {
         $menuitem_param_name = $param_name;
         if (in_array($param_name, $gantry->_setbymenuitem) && $menu_params->get($menuitem_param_name, null) != null) {
             $param =& $gantry->_working_params[$param_name];
             $menuitem_value = $menu_params->get($menuitem_param_name);
             $menuitem_preset_params = $gantry->_getPresetParams($param['name'], $menuitem_value);
             foreach ($menuitem_preset_params as $menuitem_preset_param_name => $menuitem_preset_param_value) {
                 if (!is_null($menuitem_preset_param_value)) {
                     $gantry->_working_params[$menuitem_preset_param_name]['value'] = $menuitem_preset_param_value;
                     $gantry->_working_params[$menuitem_preset_param_name]['setby'] = 'menuitem';
                 }
             }
         }
     }
     // set individual values
     foreach ($gantry->_param_names as $param_name) {
         $menuitem_param_name = $param_name;
         if (in_array($param_name, $gantry->_setbymenuitem) && $menu_params->get($menuitem_param_name, null) != null) {
             $param =& $gantry->_working_params[$param_name];
             $menuitem_value = $menu_params->get($menuitem_param_name);
             if (!is_null($menuitem_value)) {
                 $gantry->_working_params[$param['name']]['value'] = $menuitem_value;
                 $gantry->_working_params[$param['name']]['setby'] = 'menuitem';
             }
         }
     }
 }
Ejemplo n.º 23
0
 function run($form, $actiondata)
 {
     $mainframe =& JFactory::getApplication();
     $uri =& JFactory::getURI();
     $params = new JParameter($actiondata->params);
     $CF_PATH = $uri->root();
     $uri =& JFactory::getURI();
     if ($uri->isSSL()) {
         $CF_PATH = str_replace('http:', 'https:', $CF_PATH);
     }
     //check IE 5,6,7
     $old_ie = false;
     $ua = $_SERVER['HTTP_USER_AGENT'];
     if (preg_match('/\\bmsie [567]/i', $ua) && !preg_match('/\\bopera/i', $ua)) {
         $old_ie = true;
     }
     if ($old_ie || (bool) $params->get('encoded_image', 0) === false) {
         $form->form_details->content = str_replace('{chronocaptcha_img}', '  <img src="' . $CF_PATH . 'components/com_chronoforms/chrono_verification.php?imtype=' . $params->get('fonts', 0) . '" alt="" />', $form->form_details->content);
     } else {
         ob_start();
         $this->generate_encoded((int) $params->get('fonts', 0));
         $imgbinary = ob_get_clean();
         $form->form_details->content = str_replace('{chronocaptcha_img}', '  <img src="data:image/png;base64,' . base64_encode($imgbinary) . '" alt="" />', $form->form_details->content);
     }
 }
 function display($tpl = null)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $client = JRequest::getWord('client', 'site');
     $plugin =& JPluginHelper::getPlugin('editors', 'jce');
     $params = new JParameter($plugin->params);
     $num = intval($params->get('layout_rows', 5));
     $rows = array();
     for ($i = 1; $i <= $num; $i++) {
         $query = "SELECT id, title, name, type, layout, icon" . "\n FROM #__jce_plugins" . "\n WHERE row = " . $i . "" . "\n AND published = 1" . "\n AND icon != ''" . "\n ORDER BY ordering ASC";
         $db->setQuery($query);
         $rows[] = $db->loadObjectList();
     }
     $dimensions['width'] = $params->get('width', '600');
     $dimensions['height'] = $params->get('height', '600');
     if ($client == 'admin') {
         $client_id = 1;
     } else {
         $client_id = 0;
     }
     $this->assignRef('dimensions', $dimensions);
     $this->assignRef('client', $client_id);
     $this->assignRef('items', $rows);
     parent::display($tpl);
 }
Ejemplo n.º 25
0
 /**
  * get listing items from rss link or from list of categories.
  *
  * @param JParameter $params
  * @return array
  */
 function getList($params)
 {
     $rows = array();
     $using_mode = strtolower($params->get('using_mode', "catids"));
     $exclude_arr = array("rss", "external");
     if (!in_array($using_mode, $exclude_arr)) {
         // check cache was endable ?
         if ($params->get('enable_cache')) {
             $cache =& JFactory::getCache();
             $cache->setCaching(true);
             $cache->setLifeTime($params->get('cache_time', 30) * 60);
             $rows = $cache->get(array(new modjanewstickerHelper(), 'getArticles'), array($params));
         } else {
             if ($using_mode == 'com_k2') {
                 $rows = modjanewstickerHelper::getK2Items($params);
             } else {
                 $rows = modjanewstickerHelper::getArticles($params);
             }
         }
     } elseif ($using_mode == 'external') {
         $rows = modjanewstickerHelper::parseExternalLinks($params->get("external_link", ""), $params);
     } else {
         $rows = modjanewstickerHelper::dataFromRSS($params);
     }
     return $rows;
 }
 function _getTurnierData()
 {
     $query = "SELECT *" . " FROM #__clm_turniere" . " WHERE id = " . $this->turnierid;
     $this->_db->setQuery($query);
     $this->turnier = $this->_db->loadObject();
     // TO-DO: auslagern
     // zudem PGN-Parameter auswerten
     $turParams = new JParameter($this->turnier->params);
     $pgnInput = $turParams->get('pgnInput', 1);
     $pgnPublic = $turParams->get('pgnPublic', 1);
     // User ermitteln
     $user =& JFactory::getUser();
     // Flag für View und Template setzen: pgnShow
     // FALSE - PGN nicht verlinken/anzeigen
     // TRUE - PGN-Links setzen und anzeigen
     // 'pgnInput möglich' UND ('pgn öffentlich' ORDER 'User eingeloggt')
     if ($pgnInput == 1 and ($pgnPublic == 1 or $user->id > 0)) {
         $this->pgnShow = TRUE;
     } else {
         $this->pgnShow = FALSE;
     }
     $this->displayTlOK = $turParams->get('displayTlOK', 0);
     // turniernamen anpassen?
     $addCatToName = $turParams->get('addCatToName', 0);
     if ($addCatToName != 0 and ($this->turnier->catidAlltime > 0 or $this->turnier->catidEdition > 0)) {
         $this->turnier->name = CLMText::addCatToName($addCatToName, $this->turnier->name, $this->turnier->catidAlltime, $this->turnier->catidEdition);
     }
 }
Ejemplo n.º 27
0
 function run($form, $actiondata)
 {
     $params = new JParameter($actiondata->params);
     $user =& JFactory::getUser();
     //check guests
     $guest = $params->get('guests', 1);
     if ($user->guest && $guest) {
         $this->events['allowed'] = 1;
         return true;
     }
     //check other groups
     if (trim($params->get('groups', ''))) {
         $_groups = explode(',', trim($params->get('groups', '')));
         array_walk($_groups, 'trim');
         $int_groups = array();
         foreach ($_groups as $_group) {
             $int_groups[] = (int) $_group;
         }
         if (!empty($user->groups)) {
             foreach ($user->groups as $kg => $group) {
                 if (in_array($group, $int_groups)) {
                     $this->events['allowed'] = 1;
                     return true;
                 }
             }
         }
     }
     //all failed, set not allowed
     $this->events['denied'] = 1;
     return true;
 }
Ejemplo n.º 28
0
	function onPrepareContent( &$article, &$params, $limitstart )
	{
		if(!file_exists(JPATH_SITE.DS.'plugins'.DS.'system'.DS.'myApiConnectFacebook.php')){ return; }
		
		//this may fire fron a component other than com_content
		if((@$article->id != '') && (@$_POST['fb_sig_api_key'] == ''))
		{
			$doc = & JFactory::getDocument();
			
			$plugin = & JPluginHelper::getPlugin('content', 'myApiShare');

			// Load plugin params info
			$myapiparama = new JParameter($plugin->params);
			
			$share_sections = $myapiparama->get('share_sections');
			$share_categories = $myapiparama->get('share_categories');
			$share_show_on = $myapiparama->get('share_show_on');
			$share_type = $myapiparama->get('share_type');
			$share_style = $myapiparama->get('share_style');
			$share_show = false;
		
			global $facebook;
			
			if($article->sectionid != '')
			{
				if( is_array($share_sections) )
				{	foreach($share_sections as $id)
					{ if($id == $article->sectionid) { $share_show = true; } }
				}
				else{ if($share_sections == $article->sectionid) { $share_show = true; } }
			}
			
			if($article->category != '')
			{
				if( is_array($share_categories) )
				{	foreach($share_categories as $id)
					{ if($id == $article->category) { $share_show = true; } }
				}
				else
				{ if($share_categories == $article->category) { $share_show = true; }	}
			}
			
			if(($share_show) || ($share_show_on == 'all'))
			{
				require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php');
				
				$link = JRoute::_(ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid));
				$u =& JURI::getInstance( JURI::base() );
				$link = 'http://'.$u->getHost().$link;
				$newtext = '<fb:share-button class="url" href="'.$link.'" style="'.$share_style.'" type="'.$share_type.'"></fb:share-button>';
				
				$com_params = &JComponentHelper::getParams( 'com_myapi' );
				
				$newtext = $newtext.$article->text;
				$article->text = $newtext;
			}
		}

	}
Ejemplo n.º 29
0
/**
 * Output a correct response code when site is offline
 * to let know search engines that site data
 * should not be discarded or discounted
 */
function plgSh404sefofflinecode()
{
    $mainframe =& JFactory::getApplication();
    // are we in the backend, or not offline ?
    if ($mainframe->isAdmin() || !$mainframe->getCfg('offline')) {
        return;
    }
    // get plugin params
    $plugin =& JPluginHelper::getPlugin('sh404sefcore', 'sh404sefofflinecode');
    $pluginParams = new JParameter($plugin->params);
    $disallowAdminAccess = $pluginParams->get('disallowAdminAccess', 0);
    if (!$disallowAdminAccess) {
        // admins are allowed, lets check if current user
        // is an admin, or if user is trying to log in
        $user =& JFactory::getUser();
        $option = JRequest::getCmd('option');
        $task = JRequest::getCmd('task');
        if ($option == 'com_user' && $task == 'login') {
            // Check for request forgeries
            JRequest::checkToken() or jexit('Invalid Token');
            $loggingIn = true;
        } else {
            $loggingIn = false;
        }
        // if already logged inadmin, or admin logging in, let it go
        if ($user->get('gid') >= '23' || $loggingIn) {
            return;
        }
    }
    // need to render offline screen
    if ($disallowAdminAccess) {
        // admins not allowed, use our own
        // simplified template. Most likely being hacked so
        // close doors as much as possible
        $template = '';
        $file = 'sh404sef_offline_template.php';
        $directory = JPATH_ROOT . DS . 'plugins' . DS . 'sh404sefcore';
    } else {
        // admin can access, use Joomla! offline template,
        // that includes a login form
        $template = $mainframe->getTemplate();
        $file = 'offline.php';
        $directory = JPATH_THEMES;
    }
    $params = array('template' => $template, 'file' => $file, 'directory' => $directory);
    $document =& JFactory::getDocument();
    $data = $document->render($mainframe->getCfg('caching'), $params);
    // header : service unavailable
    JResponse::setHeader('HTTP/1.0 503', true);
    // give it some time
    $retryAfter = $pluginParams->get('retry_after_delay', 7400);
    // set header
    Jresponse::setheader('Retry-After', gmdate('D, d M Y H:i:s', time() + $retryAfter) . ' GMT');
    // echo document
    JResponse::setBody($data);
    echo JResponse::toString($mainframe->getCfg('gzip'));
    // and terminate
    $mainframe->close();
}
Ejemplo n.º 30
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $db =& JFactory::getDBO();
     $db->setQuery($node->attributes('sql'));
     $name = $node->attributes('name');
     if (JRequest::getVar("option") == "com_templates" && JRequest::getVar("task") == "edit") {
         $sql = "select template from #__templates_menu where client_id=0";
         $db->setQuery($sql);
         $db->query();
         $template = $db->loadResult();
         $template_path = JPATH_SITE . DS . "templates" . DS . $template . DS . "params.ini";
         $template_params = new JParameter(JFile::read($template_path));
         $orientation = $template_params->get('s5_orientation') == "" ? "horizontal" : $template_params->get('s5_orientation');
         $effect = $template_params->get('s5_effect') == "" ? "2" : $template_params->get('s5_effect');
         $return = "";
         $checked = '';
         if ($name == "s5_orientation") {
             if ($orientation == "horizontal") {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $return .= '<input type="radio" ' . $checked . ' value="horizontal" id="paramss5_orientationhorizontal" name="params[s5_orientation]">';
             $return .= '<label for="paramss5_orientationhorizontal">Horizontal</label>';
             if ($orientation == "vertical") {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $return .= '<input type="radio" ' . $checked . ' value="vertical" id="paramss5_orientationvertical" name="params[s5_orientation]">';
             $return .= '<label for="paramss5_orientationvertical">Vertical</label>';
             return $return;
         } elseif ($name == "s5_effect") {
             if ($effect == "0") {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $return .= '<input type="radio" ' . $checked . ' value="0" id="paramss5_effect0" name="params[s5_effect]">';
             $return .= '<label for="paramss5_effect0">slide</label>';
             if ($effect == "1") {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $return .= '<input type="radio" ' . $checked . ' value="1" id="paramss5_effect1" name="params[s5_effect]">';
             $return .= '<label for="paramss5_effect1">fade</label>';
             if ($effect == "2") {
                 $checked = 'checked="checked"';
             } else {
                 $checked = '';
             }
             $return .= '<input type="radio" ' . $checked . ' value="2" id="paramss5_effect2" name="params[s5_effect]">';
             $return .= '<label for="paramss5_effect2">slide &amp; fade</label>';
             return $return;
         }
     }
 }