function onBeforeDisplayContent( &$article, &$params, $limitstart ){ //this may fire fron a component other than com_content if(!file_exists(JPATH_SITE.DS.'plugins'.DS.'system'.DS.'myApiConnectFacebook.php') || ( !array_key_exists('category',$article) && !array_key_exists('showK2Plugins',$params) )){ return; } if((@$article->id != '') && (@$_POST['fb_sig_api_key'] == '') && class_exists('plgSystemmyApiOpenGraph')){ $row = & JTable::getInstance('content'); $row->load($article->id); $attribs = new JParameter($row->attribs); if($attribs->get('ogimage','') == ''){ $attribs->set('ogimage',plgContentmyApiOpenGraphContent::getContentImage($article->text)); $row->attribs = $attribs->toString(); $row->bind($row); $row->store(); } //Set open graph tags if(JRequest::getVar('view','','get') == 'article' || (JRequest::getVar('option','','get') == 'com_k2' && JRequest::getVar('view','','get') == 'item')){ if(isset($article->slug)){ require_once(JPATH_SITE.DS.'components'.DS.'com_content'.DS.'helpers'.DS.'route.php'); $link = ContentHelperRoute::getArticleRoute($article->slug, $article->catslug, $article->sectionid); }elseif(method_exists('K2HelperRoute','getItemRoute')){ $link = K2HelperRoute::getItemRoute($article->id.':'.urlencode($article->alias),$article->catid.':'.urlencode($article->category->alias)); }else{ error_log('myApi unable to calculate link for the article id '.$article->id); return; } $u =& JURI::getInstance( JURI::base().$link ); $port = ($u->getPort() == '') ? '' : ":".$u->getPort(); $articleURL = 'http://'.$u->getHost().$port.$u->getPath().'?'.$u->getQuery(); $rawText = strip_tags($article->introtext); $newTags = array(); $newTags['og:title'] = $article->title; $newTags['og:description'] = (strlen($rawText) > 247) ? substr($rawText,0,247).'...' : $rawText; $newTags['og:type'] = 'article'; $newTags['og:author'] = (is_object($article->author)) ? $article->author->name : $article->author; $newTags['og:url'] = $articleURL; if($attribs->get('ogimage','0') != '0') $newTags['og:image'] = $attribs->get('ogimage'); plgSystemmyApiOpenGraph::setTags($newTags); } } }
public function render() { $page = $this->getObject('application.pages')->getActive(); $params = new JParameter($page->params); $folders = $this->_getFolders(); $this->folders = $folders['items']; $files = $this->_getFiles(); $this->files = $files['items']; $this->total = $files['total']; $folder = $this->getModel()->getRow(); if ($page->getLink()->query['folder'] !== $folder->path) { $path = explode('/', $folder->path); $parent = count($path) > 1 ? implode('/', array_slice($path, 0, count($path) - 1)) : ''; $params->set('page_title', ucfirst(end($path))); } else { $parent = null; $params->set('page_title', $page->title); } $this->parent = $parent; $this->params = $params; $this->page = $page; $this->thumbnail_size = array('x' => 200, 'y' => 150); $this->setPathway(); return parent::render(); }
function generateSitemap() { jimport('joomla.html.parameter'); $db =& JFactory::getDBO(); $doc =& JFactory::getDocument(); //load the style $doc->addStyleSheet(JURI::root(true) . '/components/com_rsseo/style.css'); //get selected menus $db->setQuery("SELECT ConfigValue FROM #__rsseo_config WHERE ConfigName = 'sitemap_menus' "); $menus = $db->loadResult(); //get excluded items $db->setQuery("SELECT ConfigValue FROM #__rsseo_config WHERE ConfigName = 'sitemap_excludes' "); $excludes = $db->loadResult(); if (empty($menus)) { return ''; } $menus = explode(',', $menus); $return = ''; if (!empty($menus)) { foreach ($menus as $menu) { $params = new JParameter(''); $params->set('menutype', $menu); $params->set('ignore', $excludes); $html = rsseoHelper::render($params, 'rsseoCallback'); if (empty($html)) { continue; } $db->setQuery("SELECT title FROM #__menu_types WHERE menutype = '" . $db->getEscaped($menu) . "'"); $title = $db->loadResult(); $return .= '<div class="rsseo_title">' . $title . '</div>'; $return .= $html; } } return $return; }
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; }
function run($form, $actiondata) { $params = new JParameter($actiondata->params); $mainframe =& JFactory::getApplication(); //save the data to db $db_save_details = $actiondata; $db_save_details->type = 'db_save'; //create params $db_save_details_params = new JParameter(''); $db_save_details_params->set('table_name', $mainframe->getCfg('dbprefix') . 'content'); $db_save_details_params->set('model_id', 'Article'); $db_save_details->params = $db_save_details_params->toString(); //set data $user =& JFactory::getUser(); $form->data['created_by'] = $user->id; $form->data['created'] = date("Y-m-d H:i:s"); $form->data['catid'] = $params->get('catid', ''); $form->data['sectionid'] = $params->get('sectionid', 0); $form->data['state'] = $params->get('state', 0); $form->data['title'] = $form->data[$params->get('title', '')]; $form->data['fulltext'] = $form->data[$params->get('fulltext', '')]; $form->data['introtext'] = isset($form->data[$params->get('introtext', '')]) ? $form->data[$params->get('introtext', '')] : ''; $form->data['created_by_alias'] = $form->data[$params->get('created_by_alias', '')]; //alias $form->data['alias'] = JFilterOutput::stringURLSafe($form->data['title']); $form->data['id'] = null; //$form->data['alias'] = null; $form->runAction($db_save_details); }
public function onGroupJoin($group, $userId) { //@rule: Clear existing invites fromt he invitation table once the user joined the group $groupInvite =& JTable::getInstance('GroupInvite', 'CTable'); if ($groupInvite->load($group->id, $userId)) { $groupInvite->delete(); } $member =& JTable::getInstance('GroupMembers', 'CTable'); $member->load($userId, $group->id); $params = $group->getParams(); //@rule: Send notification when necessary if ($params->get('joinrequestnotification') || $params->get('newmembernotification')) { $user = CFactory::getUser($userId); $subject = JText::sprintf('CC NEW MEMBER JOIN EMAIL SUBJECT', $user->getDisplayName(), $group->name); if (!$member->approved) { $subject = JText::sprintf('CC NEW MEMBER REQUESTED TO JOIN GROUP EMAIL SUBJECT', $user->getDisplayName(), $group->name); } // Add notification CFactory::load('libraries', 'notification'); $params = new JParameter(''); $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id); $params->set('group', $group->name); $params->set('user', $user->getDisplayName()); $params->set('approved', $member->approved); CNotificationLibrary::add('groups.member.join', $user->id, $group->ownerid, $subject, '', 'groups.memberjoin', $params); } }
function saveItemPrices($d) { $params = new JParameter(); $params->set('price_powerseller', JArrayHelper::getValue($d, 'price_powerseller')); $params->set('price_verified', JArrayHelper::getValue($d, 'price_verified')); $params->set('category_pricing_enabled', JArrayHelper::getValue($d, 'category_pricing_enabled')); $p = $params->toString('INI'); $price = JArrayHelper::getValue($d, 'default_price'); $currency = JArrayHelper::getValue($d, 'currency'); $db = $this->getDbo(); $db->setQuery("update `#__" . APP_PREFIX . "_pricing`\r\n set `price`='{$price}',`currency`='{$currency}',\r\n `params`='{$p}'\r\n where `itemname`='" . $this->name . "'"); $db->query(); }
public static function sendCommentNotification(CTableWall $wall, $message) { CFactory::load('libraries', 'notification'); $my = CFactory::getUser(); $targetUser = CFactory::getUser($wall->post_by); $url = 'index.php?option=com_community&view=events&task=viewevent&eventid=' . $wall->contentid; $params = $targetUser->getParams(); $params = new JParameter(''); $params->set('url', $url); $params->set('message', $message); CNotificationLibrary::add('events.submit.wall.comment', $my->id, $targetUser->id, JText::sprintf('PLG_WALLS WALL COMMENT EMAIL SUBJECT', $my->getDisplayName()), '', 'events.wallcomment', $params); return true; }
/** * Edit a connection */ function edit() { $user =& JFactory::getUser(); $db =& JFactory::getDBO(); $row =& JTable::getInstance('visualization', 'Table'); if ($this->_task == 'edit') { $cid = JRequest::getVar('cid', array(0), 'method', 'array'); $cid = array((int) $cid[0]); } else { $cid = array(0); } $row->load($cid[0]); if ($cid) { $row->checkout($user->get('id')); } // get params definitions $params = new fabrikParams($row->attribs, JPATH_COMPONENT . DS . 'xml' . DS . 'visualization.xml'); require_once JPATH_COMPONENT . DS . 'views' . DS . 'visualization.php'; //build list of visualization plugins $pluginManager =& JModel::getInstance('Pluginmanager', 'FabrikModel'); $pluginManager->getPlugInGroup('visualization'); $lists['plugins'] = $pluginManager->getElementTypeDd($row->plugin, 'plugin', 'class="inputbox"'); //build list of menus $lists['menuselect'] = FabrikHelperMenu::MenuSelect(); if ($row->id != '') { //only existing tables can have a menu linked to them $and = "\n AND link LIKE 'index.php?option=com_fabrik&view=visualization%'"; $and .= " AND params LIKE '%visualizationid=" . $row->id . "%'"; $menus = FabrikHelperMenu::Links2Menu('component', $and); } else { $menus = null; } //get table and connection drop downs $db->setQuery("SELECT id AS value, label AS text FROM #__fabrik_tables"); $rows = $db->loadObjectList(); $default = ''; $lists['tables'] = JHTML::_('select.genericlist', $rows, 'table[]', "class=\"inputbox\" size=\"1\" ", 'value', 'text', $default); // Create the form $form = new JParameter('', JPATH_COMPONENT . DS . 'models' . DS . 'visualization.xml'); $form->bind($row); $form->set('created', JHTML::_('date', $row->created, '%Y-%m-%d %H:%M:%S')); $form->set('publish_up', JHTML::_('date', $row->publish_up, '%Y-%m-%d %H:%M:%S')); if ($cid[0] == 0 || $form->get('publish_down') == '' || $form->get('publish_down') == $db->getNullDate()) { $form->set('publish_down', JText::_('NEVER')); } else { $form->set('publish_down', JHTML::_('date', $row->publish_down, '%Y-%m-%d %H:%M:%S')); } FabrikViewVisualization::edit($row, $params, $lists, $menus, $pluginManager, $form); }
/** * Up **/ public function up() { $query = "CREATE TABLE IF NOT EXISTS `jos_announcements` (\n\t\t\t\t\t\t`id` int(11) unsigned NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t\t`scope` varchar(100) DEFAULT NULL,\n\t\t\t\t\t\t`scope_id` int(11) DEFAULT NULL,\n\t\t\t\t\t\t`content` text,\n\t\t\t\t\t\t`priority` tinyint(2) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t`created_by` int(11) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t`state` tinyint(2) NOT NULL DEFAULT '0',\n\t\t\t\t\t\t`publish_up` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t`publish_down` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',\n\t\t\t\t\t\t`sticky` tinyint(2) NOT NULL DEFAULT '0',\n\t\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;"; $this->db->setQuery($query); $this->db->query(); $params = array('plugin_access' => 'members', 'display_tab' => 1); $this->addPluginEntry('groups', 'announcements', 1, $params); //get citation params if ($this->db->tableExists('#__extensions')) { $sql = "SELECT `params` FROM `#__extensions` WHERE `type`='plugin' AND `element`='messages' AND `folder` = 'groups'"; } else { $sql = "SELECT `params` FROM `#__plugins` WHERE `element`='messages' AND `folder`='groups'"; } $this->db->setQuery($sql); $p = $this->db->loadResult(); //load params object $params = new \JParameter($p); //set param to hide messages tab $params->set('display_tab', 0); //save new params if ($this->db->tableExists('#__extensions')) { $query = "UPDATE `#__extensions` SET `params`=" . $this->db->quote(json_encode($params->toArray())) . " WHERE `element`='messages' AND `folder`='groups'"; } else { $query = "UPDATE `#__plugins` SET `params`='" . $params->toString() . "' WHERE `element`='messages' AND `folder`='groups'"; } $this->db->setQuery($query); $this->db->query(); }
function display($tpl = null) { global $mainframe; $model = $this->getModel('groups'); $db =& JFactory::getDBO(); $cmd = JRequest::getVar('task'); $cid = JRequest::getVar('cid_user'); $lists = array(); $group_id = JRequest::getVar('group_id'); $user_id = intval(JRequest::getVar('user_id')); $cid_tmp = $cid[0]; if ($user_id > 0) { $cid_tmp = $user_id; } $user = JTable::getInstance('users', 'Table'); $user->load(intval($cid[0])); $query = ' SELECT a.*, a.id as user_id, g.name as groupname ' . ' FROM `#__users` AS a' . ' INNER JOIN #__core_acl_aro AS aro ON aro.value = a.id' . ' INNER JOIN #__core_acl_groups_aro_map AS gm ON gm.aro_id = aro.id' . ' INNER JOIN #__core_acl_aro_groups AS g ON g.id = gm.group_id' . ' WHERE a.id=' . intval($cid_tmp); $db->setQuery($query); $row = $db->loadObject(); $javascript = 'onchange="document.adminForm.submit();"'; // get list of Authors for dropdown filter $query = 'SELECT u.id as value, u.username as text' . ' FROM #__users AS u'; $db->setQuery($query); $users = $db->loadObjectList(); $lists['users'] = JHTML::_('select.genericlist', $users, 'user_id', 'class="inputbox" size="1" onchange="document.adminForm.submit( );"', 'value', 'text', $cid_tmp); $form = new JParameter('', JPATH_COMPONENT . DS . 'views' . DS . 'groups' . DS . 'tmpl' . DS . 'user.xml'); $set_start = ''; $set_end = ''; if ($cmd == 'edit_user') { $query = 'SELECT * FROM #__yos_resources_manager_user_group_xref WHERE user_id=' . intval($cid[0]) . ' AND group_id=' . $group_id; $db->setQuery($query); $row1 = $db->loadObject(); $set_start = $row1->start; $set_end = $row1->end; } $form->set('start', JHTML::_('date', $set_start, '%Y-%m-%d %H:%M:%S')); $form->set('end', JHTML::_('date', $set_end, '%Y-%m-%d %H:%M:%S')); $this->assignRef('form', $form); JRequest::setVar('hidemainmenu', 1); $this->assignRef('cmd', $cmd); $this->assignRef('row', $row); $this->assignRef('user', $user); $this->assignRef('lists', $lists); $this->assignRef('group_id', $group_id); parent::display($tpl); }
public function ajaxEmailPage($uri, $emails, $message = '') { $message = stripslashes($message); $mainframe =& JFactory::getApplication(); $bookmarks = CFactory::getBookmarks($uri); $mailqModel = CFactory::getModel('mailq'); $config = CFactory::getConfig(); $response = new JAXResponse(); if (empty($emails)) { $content = '<div>' . JText::_('CC SHARE INVALID EMAIL') . '</div>'; $buttons = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('CC BUTTON GO BACK') . '"/>'; } else { $emails = explode(',', $emails); $errors = array(); // Add notification CFactory::load('libraries', 'notification'); foreach ($emails as $email) { $email = JString::trim($email); if (!empty($email) && preg_match("/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})\$/i", $email)) { $params = new JParameter(''); $params->set('uri', $uri); $params->set('message', $message); CNotificationLibrary::add('system.bookmarks.email', '', $email, JText::sprintf('CC SHARE EMAIL SUBJECT', $config->get('sitename')), '', 'bookmarks', $params); } else { // If there is errors with email, inform the user. $errors[] = $email; } } if ($errors) { $content = '<div>' . JText::_('CC EMAILS ARE INVALID') . '</div>'; foreach ($errors as $error) { $content .= '<div style="font-weight:700;color: red;">' . $error . '</span>'; } $buttons = '<input type="button" class="button" onclick="joms.bookmarks.show(\'' . $uri . '\');" value="' . JText::_('CC BUTTON GO BACK') . '"/>'; } else { $content = '<div>' . JText::_('CC EMAIL SENT TO RECIPIENTS') . '</div>'; $buttons = '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('CC BUTTON DONE') . '"/>'; } } $response->addAssign('cwin_logo', 'innerHTML', JText::_('CC SHARE THIS')); $response->addAssign('cWindowContent', 'innerHTML', $content); $response->addScriptCall('cWindowActions', $buttons); $response->addScriptCall('cWindowResize', 100); return $response->sendResponse(); }
function loadAction($form, $actiondata) { $params = new JParameter($actiondata->params); $output = ''; $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); JHTML::_('behavior.mootools'); $uri =& JFactory::getURI(); $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root(); $document->addScript($CF_PATH . 'administrator/components/com_chronoforms/form_actions/auto_javascript_validation/assets/auto_javascript_validation.js'); $rules = array('required', 'alpha', 'alphanum', 'digit', 'nodigit', 'number', 'email', 'phone', 'phone_inter', 'url', 'image'); ob_start(); ?> window.addEvent('domready', function() { <?php $object_list = array(); foreach ($rules as $rule) { $fields_list = array(); if (trim($params->get($rule, ''))) { $fields_list = explode(',', trim($params->get($rule, ''))); } foreach ($fields_list as $k => $field) { $fields_list[$k] = "'" . $field . "'"; } $n_fields_list = implode(',', $fields_list); $object_list[] = "'" . $rule . "': [" . $n_fields_list . "]"; } ?> new AutoJavascriptValidation('<?php echo $form->form_name; ?> ', <?php echo "{" . implode(",", $object_list) . "}"; ?> ); }); <?php $script = ob_get_clean(); if ((bool) $form->form_params->get('dynamic_files', 0) === false) { $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>"); } else { //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } //load validation files $form->loadActionHelper('show_html'); $CfactionShowHtmlHelper = new CfactionShowHtmlHelper(); $CfactionShowHtmlHelper->_loadValidationScripts($form); }
function run($form, $actiondata) { $params = new JParameter($actiondata->params); $mainframe = JFactory::getApplication(); //set the images path $upload_path = $params->get('upload_path', ''); if (!empty($upload_path)) { $upload_path = str_replace(array("/", "\\"), DS, $upload_path); if (substr($upload_path, -1) == DS) { $upload_path = substr_replace($upload_path, '', -1); } $upload_path = str_replace("JOOMLA_PATH", JPATH_SITE, $upload_path) . DS; $params->set('upload_path', $upload_path); } else { $upload_path = JPATH_SITE . DS . 'components' . DS . 'com_chronoforms' . DS . 'uploads' . DS . $form->form_details->name . DS; } $image_file_name = $params->get('photo', ''); if (strpos($image_file_name, ',') !== false) { $image_file_names = explode(',', $image_file_name); } else { $image_file_names = array($image_file_name); } foreach ($image_file_names as $image_file_name) { //stop if the field name is not set or if the file data doesn't exist //if((strlen($image_file_name) == 0) || !isset($form->data[$image_file_name]) || !isset($form->files[$image_file_name]['path'])){ if (strlen($image_file_name) == 0 || !isset($form->files[$image_file_name])) { continue; } if ($form->files[$image_file_name] === array_values($form->files[$image_file_name])) { //array of files $reset = false; } else { $form->files[$image_file_name] = array($form->files[$image_file_name]); $reset = true; } foreach ($form->files[$image_file_name] as $k => $image) { // Common parameters $photo = $image['name']; //$form->data[$image_file_name]; $filein = $image['path']; $file_info = pathinfo($filein); $form->debug['Image_Resize'][$actiondata->order]['thumb_big'] = $form->files[$image_file_name][$k]['thumb_big'] = $this->processSize('big', $form, $actiondata, $photo, $filein, $upload_path, $file_info); // treatment of the medium image $form->debug['Image_Resize'][$actiondata->order]['thumb_med'] = $form->files[$image_file_name][$k]['thumb_med'] = $this->processSize('med', $form, $actiondata, $photo, $filein, $upload_path, $file_info); // treatment of the small image $form->debug['Image_Resize'][$actiondata->order]['thumb_small'] = $form->files[$image_file_name][$k]['thumb_small'] = $this->processSize('small', $form, $actiondata, $photo, $filein, $upload_path, $file_info); if ($params->get('delete_original')) { unlink($filein); } } if ($reset) { $form->files[$image_file_name] = $form->files[$image_file_name][0]; } } }
function ajaxTogglePublish($id, $type) { // Send email notification to owner when a group is published. $config =& CFactory::getConfig(); $group =& JTable::getInstance('Group', 'CTable'); $group->load($id); if ($type == 'published' && $group->published == 0 && $config->get('moderategroupcreation')) { $lang =& JFactory::getLanguage(); $lang->load('com_community', JPATH_ROOT); $my =& CFactory::getUser(); // Add notification CFactory::load('libraries', 'notification'); //Send notification email to owner $params = new JParameter(''); $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id); $params->set('groupName', $group->name); CNotificationLibrary::add('groups.notify.creator', $my->id, $group->ownerid, JText::sprintf('CC GROUP PUBLISHED MAIL SUBJECT', $group->name), '', 'groups.notifycreator', $params); } return parent::ajaxTogglePublish($id, $type, 'groups'); }
public function getParameters() { $active = $this->getObject('application.pages')->getActive(); $parameters = new JParameter($active->params); if (!$parameters->get('page_title')) { $parameters->set('page_title', JText::_('Login')); } $parameters->def('description_login_text', JText::_('LOGIN_DESCRIPTION')); $parameters->def('registration', $this->getObject('application.extensions')->users->params->get('allowUserRegistration')); return $parameters; }
function getOderitem($bid) { $params = new JParameter(); $params->set('id', intval($bid->id)); $params->set('auction_id', intval($bid->auction_id)); $params->set('userid', intval($bid->userid)); $params->set('bid_price', floatval($bid->bid_price)); //check if this is a proxy bid $proxy = isset($bid->proxy) ? $bid->proxy : 0; $params->set('proxy', intval($proxy)); $price = $this->getItemPrice(); $item = new stdClass(); $item->itemname = $this->name; $item->itemdetails = JText::_($this->description); $item->iteminfo = $bid->id; $item->price = $price->price; $item->currency = $price->currency; $item->quantity = 1; $item->params = $params->toString('INI'); return $item; }
/** * Method to block either an email address or an IP from submitting data * * @access public * @param string $type The type of entity to block (eg. email, ip) * @param array $ids The items to extract block data from * @return mixed Boolean true on success, or JException on failure * @since 1.0 */ function block($type, $ids) { // make sure we have addresses to block if (empty($ids)) { return new JException('No item(s) supplied'); } // sanitize array jimport('joomla.utilities.arrayhelper'); JArrayHelper::toInteger($ids); // get the data to set based on the block type switch ($type) { case 'address': // get a database connection object $db =& $this->getDBO(); // get the list of addresses to block $db->setQuery('SELECT `address`' . ' FROM `#__jxcomments_comments`' . ' WHERE `id` IN (' . implode(',', $ids) . ')'); if ($list = $db->loadResultArray()) { // load the component data for com_comments $table =& JTable::getInstance('component'); if (!$table->loadByOption('com_comments')) { $this->setError($table->getError()); return false; } // get the existing blocked addresses and add the new ones to it $params = new JParameter($table->params); $blocked = $params->get('blockips'); foreach (explode(',', $blocked) as $ip) { if ($ip = trim($ip)) { $list[] = trim($ip); } } // remove duplicates and set the blocked addresses in the configuration object $list = array_unique($list); $params->set('blockips', implode(', ', $list)); $table->set('params', $params->toString()); // check the row. if (!$table->check()) { $this->setError($table->getError()); return false; } // store the row. if (!$table->store()) { $this->setError($table->getError()); return false; } return true; } break; default: return new JException('Unknown block type'); break; } }
function saveItemPrices($d) { $params = new JParameter(); $params->set('price_powerseller', JArrayHelper::getValue($d, 'price_powerseller')); $params->set('price_verified', JArrayHelper::getValue($d, 'price_verified')); $params->set('category_pricing_enabled', JArrayHelper::getValue($d, 'category_pricing_enabled')); $p = $params->toString('INI'); $price = JArrayHelper::getValue($d, 'default_price'); $currency = JArrayHelper::getValue($d, 'currency'); $db = $this->getDbo(); $db->setQuery("update `#__" . APP_PREFIX . "_pricing`\r\n set `price`='{$price}',`currency`='{$currency}',\r\n `params`='{$p}'\r\n where `itemname`='listing'"); $db->query(); $db->setQuery("delete from `#__" . APP_PREFIX . "_pricing_categories` where `itemname`='" . $this->name . "'"); $db->query(); $category_pricing = JArrayHelper::getValue($d, 'category_pricing', array(), 'array'); foreach ($category_pricing as $k => $v) { if (!empty($v) || $v === '0') { $db->setQuery("insert into `#__" . APP_PREFIX . "_pricing_categories` (`category`,`price`,`itemname`) values ('{$k}','{$v}','" . $this->name . "')"); $db->query(); } } }
function replace(&$article, &$matches, $count, $regex, $pluginParams) { for ($i = 0; $i < $count; $i++) { // set line params $this->setParams($matches[1][$i], array('width' => null, 'height' => null)); // set default thumbnail size, if no sizes defined if (!$this->parameter['width'] && !$this->parameter['height']) { $this->parameter['width'] = $pluginParams->get('width', 100); $this->parameter['height'] = null; } // set gallery params $params = new JParameter(''); $params->bind($pluginParams->toArray()); $params->bind($this->parameter); $params->set('cfg_path', 'plugins/content/yoo_gallery/'); $params->set('cfg_juri', JURI::base()); $params->set('cfg_jroot', JPATH_ROOT); // render gallery $gallery =& new YOOGallery($params); $replace = $gallery->render(); // replace $article->text = str_replace($matches[0][$i], $replace, $article->text); } }
function getPluginParams() { static $plgParams; if (!empty($plgParams)) { return $plgParams; } ## PARAMs $plugin =& JPluginHelper::getPlugin('content', 'hdflvplayer'); $plgParams = new JParameter($plugin->params); ## Fetch Width, Height param Values $height = $plgParams->get('height'); $width = $plgParams->get('width'); ## Path to plugin folder $plgParams->set('dir_plg', JPATH_COMPONENT_ADMINISTRATOR . DS . 'content' . DS . 'hdflvplayer' . DS); $plgParams->set('uri_plg', JURI::base() . 'plugins/content/hdflvplayer/'); ## Path to default videos folder $defdir = $plgParams->get('defaultdir', 'components/com_hdflvplayer/videos'); if (!eregi('http://', $defdir)) { $defdir = JURI::base() . $defdir; $plgParams->get('defaultdir', $defdir); } $plgParams->set('uri_img', $defdir); return $plgParams; }
function defr() { if (!JRequest::checkToken('request')) { return $this->setRedirect(index, 'invalid token'); } $r = 'div.linkr-rl {' . "\n" . ' margin-top:20px;' . "\n" . ' padding:10px 5px 0 5px;' . "\n" . ' border-top:1px dotted #ccc;' . "\n" . '}' . "\n" . 'div.linkr-rl div.linkr-rl-t {' . "\n" . ' font-size:1.1em;' . "\n" . ' letter-spacing:2px;' . "\n" . ' text-transform:uppercase;' . "\n" . '}' . "\n" . 'div.linkr-rl ul {' . "\n" . ' list-style-type:square;' . "\n" . ' line-height:1.5em;' . "\n" . ' text-indent:5px;' . "\n" . '}' . "\n" . 'div.linkr-rl ul li {' . "\n" . ' padding:0 5px;' . "\n" . ' background:none;' . "\n" . '}'; // Restore default $table =& JTable::getInstance('component'); $table->loadByOption('com_linkr'); $params = new JParameter($table->params); $params->set('rcss', base64_encode($r)); $table->params = $params->toString(); $m = $table->store() ? JText::_('NOTICE_SAVED') : $table->getError(); $this->setRedirect(index . '&view=css', $m); }
function load($form = null, $actiondata = null) { $params = new JParameter($actiondata->params); $document =& JFactory::getDocument(); JHTML::_('behavior.mootools'); $mainframe =& JFactory::getApplication(); $uri =& JFactory::getURI(); $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root(); $document->addStyleSheet($CF_PATH . 'components/com_chronoforms/css/datepicker/datepicker_dashboard.css'); $document->addScript($CF_PATH . 'components/com_chronoforms/js/datepicker/datepicker.js'); $con_str = "'." . $params->get('field_class', 'cf_datetime_picker') . "', {pickerClass: '" . $params->get('pickerClass', 'datepicker_dashboard') . "', format: '" . $params->get('format', 'd-m-Y H:i:s') . "', inputOutputFormat: '" . $params->get('inputOutputFormat', 'Y-m-d H:i:s') . "', allowEmpty: " . $params->get('allowEmpty', 'true') . ", timePicker: " . $params->get('timePicker', 'true') . ", timePickerOnly: " . $params->get('timePickerOnly', 'false'); ob_start(); eval('?>' . $actiondata->content1); $actiondata->content1 = ob_get_clean(); if (!empty($actiondata->content1)) { $con_str .= ", " . $actiondata->content1; $con_str .= "}"; } else { $con_str .= "}"; } ob_start(); ?> window.addEvent('load', function() { new DatePicker(<?php echo $con_str; ?> ); }); <?php $script = ob_get_clean(); if ((bool) $form->form_params->get('dynamic_files', 0) === false) { $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>"); } else { //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } }
function run($form, $actiondata) { $mainframe = JFactory::getApplication(); $uri = JFactory::getURI(); $params = new JParameter($actiondata->params); //save the data to db $db_save_details = $actiondata; $db_save_details->type = 'db_save'; $db_save_Params = new JParameter(''); $db_save_Params->set('table_name', $params->get('table_name')); $db_save_details->params = $db_save_Params->toString(); $form->data[trim($params->get('verify_field', 'verify'))] = md5(uniqid(rand(), true)); $form->data[trim($params->get('verification_status_field', 'verified'))] = 0; if (trim($params->get('files_array_field', ''))) { $form->data[trim($params->get('files_array_field'))] = var_export($form->files, true); } $form->runAction($db_save_details); //add the verification link value to the data array $form->data['verification_link'] = $params->get('verification_link_path', $uri->root() . 'index.php?option=com_chronoforms&chronoform=' . $form->form_name); $form->data['verification_link'] .= '&action=verify&hash=' . $form->data[trim($params->get('verify_field', 'verify'))]; }
function run($form, $actiondata) { ob_start(); ?> function(){ $('chronoform_<?php echo $form->form_name; ?> ').removeClass('hasValidation'); request_caller_<?php echo $actiondata->id; ?> (); } <?php $jsvalidation_onValidateSuccess = ob_get_clean(); $form_params = new JParameter($form->form_details->params); $form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess); $form->form_params->set('jsvalidation_onValidateSuccess', $jsvalidation_onValidateSuccess); $form->form_details->params = $form_params->toString(); }
public function request($target, $friends = array()) { // remove duplicate id $friends = array_unique($friends); $model = CFactory::getModel('friends'); $targetUser = CFactory::getUser($target); $my = JFactory::getUser(); CFactory::load('libraries', 'notification'); $params = new JParameter(''); $params->set('url', 'index.php?option=com_community&view=profile&userid=' . $targetUser->id); if ($target == 0 || empty($friends)) { return false; } foreach ($friends as $friendId) { $connection = count($model->getFriendConnection($target, $friendId)); // If stanger id is not in connection and stranger id in not myId, do add if ($connection == 0 && $friendId != $my->id) { $model->addFriend($friendId, $target); CNotificationLibrary::add('friends.create.connection', $targetUser->id, $friendId, JText::sprintf('CC FRIEND ADD REQUEST', $targetUser->getDisplayName()), '', 'friends.request', $params); } } return true; }
function run($form, $actiondata) { $params = new JParameter($actiondata->params); $session_key = $form->getSessionToken(); //Data to Session config $data_to_session_details = new stdClass(); $data_to_session_details->type = 'data_to_session'; $data_to_session_Params = new JParameter(''); $data_to_session_Params->set('merge', 1); if ((bool) $params->get('session_key', 0) === true) { $data_to_session_Params->set('key', $session_key); } $data_to_session_details->params = $data_to_session_Params->toString(); $form->runAction($data_to_session_details); //Session to Data config $session_to_data_details = new stdClass(); $session_to_data_details->type = 'session_to_data'; $session_to_data_Params = new JParameter(''); if ((bool) $params->get('session_key', 0) === true) { $session_to_data_Params->set('key', $session_key); } $session_to_data_details->params = $session_to_data_Params->toString(); $form->runAction($session_to_data_details); }
function import() { $mainframe =& JFactory::getApplication(); jimport('joomla.filesystem.file'); $db =& JFactory::getDBO(); $query = "SELECT * FROM #__sections"; $db->setQuery($query); $sections = $db->loadObjectList(); $xml = new JSimpleXML(); $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'category.xml'); $categoryParams = new JParameter(''); foreach ($xml->document->params as $paramGroup) { foreach ($paramGroup->param as $param) { if ($param->attributes('type') != 'spacer') { $categoryParams->set($param->attributes('name'), $param->attributes('default')); } } } $categoryParams = $categoryParams->toString(); $xml = new JSimpleXML(); $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'item.xml'); $itemParams = new JParameter(''); foreach ($xml->document->params as $paramGroup) { foreach ($paramGroup->param as $param) { if ($param->attributes('type') != 'spacer') { $itemParams->set($param->attributes('name'), $param->attributes('default')); } } } $itemParams = $itemParams->toString(); $query = "SELECT id, name FROM #__k2_tags"; $db->setQuery($query); $tags = $db->loadObjectList(); if (is_null($tags)) { $tags = array(); } foreach ($sections as $section) { $K2Category =& JTable::getInstance('K2Category', 'Table'); $K2Category->name = $section->title; $K2Category->alias = $section->title; $K2Category->description = $section->description; $K2Category->parent = 0; $K2Category->published = $section->published; $K2Category->access = $section->access; $K2Category->ordering = $section->ordering; $K2Category->image = $section->image; $K2Category->trash = 0; $K2Category->params = $categoryParams; $K2Category->check(); $K2Category->store(); if (JFile::exists(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $section->image)) { JFile::copy(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $section->image, JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $K2Category->image); } $query = "SELECT * FROM #__categories WHERE section = {$section->id}"; $db->setQuery($query); $categories = $db->loadObjectList(); foreach ($categories as $category) { $K2Subcategory =& JTable::getInstance('K2Category', 'Table'); $K2Subcategory->name = $category->title; $K2Subcategory->alias = $category->title; $K2Subcategory->description = $category->description; $K2Subcategory->parent = $K2Category->id; $K2Subcategory->published = $category->published; $K2Subcategory->access = $category->access; $K2Subcategory->ordering = $category->ordering; $K2Subcategory->image = $category->image; $K2Subcategory->trash = 0; $K2Subcategory->params = $categoryParams; $K2Subcategory->check(); $K2Subcategory->store(); if (JFile::exists(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $category->image)) { JFile::copy(JPATH_SITE . DS . 'images' . DS . 'stories' . DS . $category->image, JPATH_SITE . DS . 'media' . DS . 'k2' . DS . 'categories' . DS . $K2Subcategory->image); } $query = "SELECT * FROM #__content WHERE catid = {$category->id}"; $db->setQuery($query); $items = $db->loadObjectList(); foreach ($items as $item) { $K2Item =& JTable::getInstance('K2Item', 'Table'); $K2Item->title = $item->title; $K2Item->alias = $item->title; $K2Item->catid = $K2Subcategory->id; if ($item->state == -1) { $K2Item->trash = 1; } else { $K2Item->trash = 0; $K2Item->published = $item->state; } $K2Item->introtext = $item->introtext; $K2Item->fulltext = $item->fulltext; $K2Item->created = $item->created; $K2Item->created_by = $item->created_by; $K2Item->created_by_alias = $item->created_by_alias; $K2Item->modified = $item->modified; $K2Item->modified_by = $item->modified_by; $K2Item->publish_up = $item->publish_up; $K2Item->publish_down = $item->publish_down; $K2Item->access = $item->access; $K2Item->ordering = $item->ordering; $K2Item->hits = $item->hits; $K2Item->metadesc = $item->metadesc; $K2Item->metadata = $item->metadata; $K2Item->metakey = $item->metakey; $K2Item->params = $itemParams; $K2Item->check(); $K2Item->store(); if (!empty($item->metakey)) { $itemTags = explode(',', $item->metakey); foreach ($itemTags as $itemTag) { $itemTag = JString::trim($itemTag); if (in_array($itemTag, JArrayHelper::getColumn($tags, 'name'))) { $query = "SELECT id FROM #__k2_tags WHERE name=" . $db->Quote($itemTag); $db->setQuery($query); $id = $db->loadResult(); $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$id}, {$K2Item->id})"; $db->setQuery($query); $db->query(); } else { $K2Tag =& JTable::getInstance('K2Tag', 'Table'); $K2Tag->name = $itemTag; $K2Tag->published = 1; $K2Tag->store(); $tags[] = $K2Tag; $query = "INSERT INTO #__k2_tags_xref (`id`, `tagID`, `itemID`) VALUES (NULL, {$K2Tag->id}, {$K2Item->id})"; $db->setQuery($query); $db->query(); } } } } } } $mainframe->redirect('index.php?option=com_k2&view=items', JText::_('Import Completed')); }
function _loadToolTip($form) { $mainframe =& JFactory::getApplication(); $uri =& JFactory::getURI(); $document =& JFactory::getDocument(); JHTML::_('behavior.mootools'); $CF_PATH = $mainframe->isSite() ? JURI::Base() : $uri->root(); echo '<link href="' . $CF_PATH . 'components/com_chronoforms/css/tooltip.css" rel="stylesheet" type="text/css" />'; //JHTML::_('behavior.tooltip', '.tooltipimg'); ob_start(); ?> window.addEvent('domready', function(){ //create the tooltips var tipz = new Tips($$('div.tooltipimg'),{ className: 'tooltipbox', fixed: true, hideDelay: 0, showDelay: 0 }); }); <?php $script = ob_get_clean(); if ((bool) $form->form_params->get('dynamic_files', 0) === false) { $document->addScriptDeclaration("//<![CDATA[" . "\n" . $script . "\n" . "//]]>"); } else { //load the action class $form->loadActionHelper('load_js'); $CfactionLoadJsHelper = new CfactionLoadJsHelper(); $JSactiondata = new stdClass(); $JSactiondata->content1 = $script; $JSParams = new JParameter(''); $JSParams->set('dynamic_file', $form->form_params->get('dynamic_files', 0)); $JSactiondata->params = $JSParams->toString(); $CfactionLoadJsHelper->load($form, $JSactiondata); } }
function import() { $mainframe =& JFactory::getApplication(); $db =& JFactory::getDBO(); $acl =& JFactory::getACL(); $frontEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Frontend', false); $backEndGroups = $acl->_getBelow('#__core_acl_aro_groups', 'g1.id, g1.name, COUNT(g2.name) AS level', 'g1.name', false, 'Public Backend', false); $usergroups = array_merge($frontEndGroups, $backEndGroups); $xml = new JSimpleXML(); $xml->loadFile(JPATH_COMPONENT . DS . 'models' . DS . 'userGroup.xml'); $permissions = new JParameter(''); foreach ($xml->document->params as $paramGroup) { foreach ($paramGroup->param as $param) { if ($param->attributes('type') != 'spacer') { $permissions->set($param->attributes('name'), $param->attributes('default')); } } } $permissions->set('inheritance', 0); $permissions->set('categories', 'all'); $permissions = $permissions->toString(); foreach ($usergroups as $usergroup) { $K2UserGroup =& JTable::getInstance('K2UserGroup', 'Table'); $K2UserGroup->name = JString::trim($usergroup->name) . " (Imported from Joomla!)"; $K2UserGroup->permissions = $permissions; $K2UserGroup->store(); $query = "SELECT * FROM #__users WHERE gid={$usergroup->id}"; $db->setQuery($query); $users = $db->loadObjectList(); foreach ($users as $user) { $query = "SELECT COUNT(*) FROM #__k2_users WHERE userID={$user->id}"; $db->setQuery($query); $result = $db->loadResult(); if (!$result) { $K2User =& JTable::getInstance('K2User', 'Table'); $K2User->userID = $user->id; $K2User->group = $K2UserGroup->id; $K2User->store(); } } } $mainframe->redirect('index.php?option=com_k2&view=users', JText::_('Import Completed')); }