/** * Update the current walk with passed in form data */ public function updateWeekend(array $formData) { $this->loadWeekend($formData['id']); // Update all basic fields // Fields that can't be saved are just ignored // Invalid fields throw an exception - display this to the user and continue foreach ($formData as $name => $value) { try { $this->weekend->{$name} = $value; } catch (UnexpectedValueException $e) { // TODO: Error message echo "<p>"; var_dump($name); var_dump($value); var_dump($e->getMessage()); echo "</p>"; } } // Date fields need to be converted if (!empty($formData['startdate'])) { $this->weekend->start = strtotime($formData['startdate']); } else { $this->weekend->start = null; } if (!empty($formData['enddate'])) { $this->weekend->endDate = strtotime($formData['enddate']); } else { $this->weekend->endDate = null; } // Alterations $this->weekend->alterations->incrementVersion(); $this->weekend->alterations->setDetails(!empty($formData['alterations_details'])); $this->weekend->alterations->setCancelled(!empty($formData['alterations_cancelled'])); $this->weekend->alterations->setOrganiser(!empty($formData['alterations_organiser'])); $this->weekend->alterations->setDate(!empty($formData['alterations_date'])); if ($this->weekend->isValid()) { $this->weekend->save(); // Redirect to the list page $itemid = JRequest::getInt('returnPage'); if (empty($itemid)) { return false; } $item = JFactory::getApplication()->getMenu()->getItem($itemid); $link = new JURI("/" . $item->route); // Jump to the event? if (JRequest::getBool('jumpToEvent')) { $link->setFragment("weekend_" . $this->weekend->id); } JFactory::getApplication()->redirect($link, "Weekend saved"); } }
function logCustomerIn() { $app = JFactory::getApplication("site"); $Itemid = JRequest::getInt('Itemid', 0); // $returnpage = JRequest::getVar("returnpage", ""); // if($return = JRequest::getVar('return', '', 'request', 'base64')) // { // $return = base64_decode($return); // } $return = JRoute::_('index.php?option=com_digicom&view=cart&layout=summary'); $options = array(); $options['remember'] = JRequest::getBool('remember', false); $options['return'] = $returnpage; $username = JRequest::getVar("username", "", 'request', 'username'); $password = JRequest::getVar("passwd", "", 'post', JREQUEST_ALLOWRAW); $credentials = array(); $credentials['username'] = $username; //JRequest::getVar('username', '', 'method', 'username'); $credentials['password'] = $password; //JRequest::getString('passwd', '', 'post', JREQUEST_ALLOWRAW); $err = $app->login($credentials, $options); // if($return){ $this->setRedirect($return); return true; // } // $link = $this->getLink(); // if($returnpage != 'checkout'){ // $this->setRedirect($link); // return true; // } //$this->checkNextAction($err); }
/** * Method to get the Events * * @access public * @return array */ function &getData() { $pop = JRequest::getBool('pop'); // Lets load the content if it doesn't already exist if (empty($this->_data)) { $query = $this->_buildQuery(); $pagination = $this->getPagination(); if ($pop) { $this->_data = $this->_getList($query); } else { $this->_data = $this->_getList($query, $pagination->limitstart, $pagination->limit); } $k = 0; $count = count($this->_data); for ($i = 0; $i < $count; $i++) { $item =& $this->_data[$i]; $item->categories = $this->getCategories($item->id); //remove events without categories (users have no access to them) if (empty($item->categories)) { unset($this->_data[$i]); } $k = 1 - $k; } } return $this->_data; }
public function display($cachable = false, $urlparams = array()) { /** * @var JApplicationSite $app */ $app = JFactory::getApplication(); $params = $app->getParams(); $str_folder = JRequest::getVar('folder', null); $str_file = JRequest::getVar('file', null); $is_sharing_download = JRequest::getBool('is_for_sharing', false); /** * @var EventgalleryLibraryManagerFile $fileMgr */ $fileMgr = EventgalleryLibraryManagerFile::getInstance(); $file = $fileMgr->getFile($str_folder, $str_file); if (!is_object($file) || !$file->isPublished()) { JError::raiseError(404, JText::_('COM_EVENTGALLERY_SINGLEIMAGE_NO_PUBLISHED_MESSAGE')); } $folder = $file->getFolder(); if (!$folder->isPublished() || !$folder->isVisible()) { JError::raiseError(404, JText::_('COM_EVENTGALLERY_EVENT_NO_PUBLISHED_MESSAGE')); } // deny downloads if the social sharing option is disabled if ($params->get('use_social_sharing_button', 0) == 0) { JError::raiseError(404, JText::_('COM_EVENTGALLERY_FILE_NOT_DOWNLOADABLE_MESSAGE')); } // allow the download if at least one sharing type is enabled both global and for the event if ($params->get('use_social_sharing_facebook', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_facebook', 1) == 1 || $params->get('use_social_sharing_google', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_google', 1) == 1 || $params->get('use_social_sharing_twitter', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_twitter', 1) == 1 || $params->get('use_social_sharing_pinterest', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_pinterest', 1) == 1 || $params->get('use_social_sharing_email', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_email', 1) == 1 || $params->get('use_social_sharing_download', 0) == 1 && $folder->getAttribs()->get('use_social_sharing_download', 1) == 1) { } else { JError::raiseError(404, JText::_('COM_EVENTGALLERY_FILE_NOT_DOWNLOADABLE_MESSAGE')); } $basename = COM_EVENTGALLERY_IMAGE_FOLDER_PATH . $folder->getFolderName() . '/'; $filename = $basename . $file->getFileName(); if ($params->get('download_original_images', 0) == 1) { $mime = ($mime = getimagesize($filename)) ? $mime['mime'] : $mime; $size = filesize($filename); $fp = fopen($filename, "rb"); if (!($mime && $size && $fp)) { // Error. return; } header("Content-type: " . $mime); header("Content-Length: " . $size); if (!$is_sharing_download) { header("Content-Disposition: attachment; filename=" . $file->getFileName()); } header('Content-Transfer-Encoding: binary'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); fpassthru($fp); die; } else { if (!$is_sharing_download) { header("Content-Disposition: attachment; filename=" . $file->getFileName()); } header('Content-Transfer-Encoding: binary'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); $this->resize($file->getFolderName(), $file->getFileName(), COM_EVENTGALLERY_IMAGE_ORIGINAL_MAX_WIDTH, null, null); die; } }
function display($tpl = null) { $option = JRequest::getCMD('option'); $mainframe = JFactory::getApplication(); $app =& JFactory::getApplication(); $helper = new comZonalesHelper(); // url de retorno según sección del menu actual $menu =& JSite::getMenu(); $item = $menu->getActive(); $return = $item ? $item->link . '&Itemid=' . $item->id : 'index.php'; // si debe retornarse una respuesta mediante ajax $this->ajax = JRequest::getBool('ajax'); $this->task = JRequest::getBool('ajax') ? 'setZonalAjax' : 'setZonal'; $zName = $helper->getZonal(); $this->zonal = is_object($zName) ? $zName->name : $zName; // parametros - alto y ancho $zonalesParams =& JFactory::getApplication('site')->getParams('com_zonales'); $this->width = $zonalesParams->get('width_mapa_flash', ''); $this->height = $zonalesParams->get('height_mapa_flash', ''); $this->flashfile = $zonalesParams->get('flash_file', ''); $this->assignRef('j2f', $helper->getZif2SifMap()); $this->assignRef('template', $app->getTemplate()); $this->assignRef('return', $return); parent::display($tpl); }
/** * Permite habilitar o deshabilitar los alias seleccionados * */ function unblock() { JRequest::checkToken() or jexit('Invalid Token'); $db =& JFactory::getDBO(); $user =& JFactory::getUser(); //$row =& JTable::getInstance('alias', 'Table'); //$row = new JTableAlias($db); // recupero los alias del usuario $userid = $user->id; $query = 'select a.id from #__alias a where user_id=' . $userid; $db->setQuery($query); $dbaliaslist = $db->loadObjectList(); // a cada alias del usuario le actualizo su estado (habilitado o dehabilitado) // segun lo especificado por el usuario foreach ($dbaliaslist as $alias) { $unblock = JRequest::getBool('alias' . $alias->id, false, 'method'); $block = $unblock ? '0' : '1'; $this->logme($db, 'alias' . $alias->id); $this->logme($db, 'el bloqueo es: ' . $block); // $row->load($alias->id); // $row->block = (int) $block; // if (!$row->store()) { // JError::raiseError(500, $row->getError() ); // } $update = 'update #__alias set block=' . $block . ' where id=' . $alias->id; $db->setQuery($update); $db->query(); } }
public function section() { $ajax = FD::ajax(); // TODO: Exact section copy. Refactor. $location = JRequest::getCmd('location'); $name = JRequest::getCmd('name'); $override = JRequest::getBool('override', false); $section = JRequest::getVar('section'); // Get stylesheet $stylesheet = FD::stylesheet($location, $name, $override); $theme = FD::themes(); $theme->set('location', $location); $theme->set('name', $name); // TODO: Find a proper way to do this $theme->set('element', ucwords(str_ireplace('_', ' ', str_ireplace('mod_easysocial_', '', $name)))); $theme->set('override', $override); $theme->set('section', $section); $theme->set('stylesheet', $stylesheet); // Also pass in server memory limit. $memory_limit = ini_get('memory_limit'); $memory_limit = FD::math()->convertBytes($memory_limit) / 1024 / 1024; $theme->set('memory_limit', $memory_limit); $html = $theme->output('admin/themes/compiler/section'); /* Exact section copy */ $ajax->resolve($html); $ajax->send(); }
public function __construct($config = array()) { parent::__construct($config); $this->_dbg = JRequest::getBool('dbg', 0); $this->_japp = JFactory::getApplication(); $user = JFactory::getUser(); $this->_user_id = $user->get('id'); $this->_id_elemento = JRequest::getInt('id', 0); $this->SCOInstanceID = $this->_id_elemento; $this->_user =& JFactory::getUser(); // if ($this->_user->guest) { // //TODO Personalizzare il messaggio per i non registrati // $msg = "Per accedere al corso è necessario loggarsi"; // //TODO Sistemare per fare in modo che dopo il login torni al corso // $uri = JFactory::getURI(); // $return = $uri->toString(); // $url = 'index.php?option=com_users&view=login'; // $url .= '&return='.base64_encode($return); // $this->_japp->redirect(JRoute::_($url), $msg); // FB::error("E' NECESSARIO LOGGARSI"); // } //$this->initializeTrack(); //bypasso check iscrizione //$this->checkIscrizione(); // $this->_checkCoupon(); $this->_checkPermessi(); }
/** * Method to log in a user. * * @access public * @since 1.0 */ function login() { JRequest::checkToken('post') or jexit(JText::_('JInvalid_Token')); $app =& JFactory::getApplication(); $data = $app->getUserState('users.login.form.data', array()); // Set the return URL if empty. if (!isset($data['return']) || empty($data['return'])) { $data['return'] = 'index.php?option=com_users&view=profile'; } // Get the log in options. $options = array(); $options['remember'] = JRequest::getBool('remember', false); $options['return'] = $data['return']; // Get the log in credentials. $credentials = array(); $credentials['username'] = JRequest::getVar('username', '', 'method', 'username'); $credentials['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); // Perform the log in. $error = $app->login($credentials, $options); // Check if the log in succeeded. if (!JError::isError($error)) { $app->setUserState('users.login.form.data', array()); $app->redirect(JRoute::_($data['return'], false)); } else { $data['remember'] = (int) $options['remember']; $app->setUserState('users.login.form.data', $data); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }
function sync() { // FIXME: remove option: $usercache = JRequest::getBool ( 'usercache', 0 ); $useradd = JRequest::getBool ( 'useradd', 0 ); $userdel = JRequest::getBool ( 'userdel', 0 ); $userrename = JRequest::getBool ( 'userrename', 0 ); $app = JFactory::getApplication (); $db = JFactory::getDBO (); if (!JRequest::checkToken()) { $app->enqueueMessage ( JText::_ ( 'COM_KUNENA_ERROR_TOKEN' ), 'error' ); $this->setRedirect(KunenaRoute::_($this->baseurl, false)); return; } if ($useradd) { $db->setQuery ( "INSERT INTO #__kunena_users (userid) SELECT a.id FROM #__users AS a LEFT JOIN #__kunena_users AS b ON b.userid=a.id WHERE b.userid IS NULL" ); $db->query (); if (KunenaError::checkDatabaseError()) return; $app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_ADD') . ' ' . $db->getAffectedRows () ); } if ($userdel) { $db->setQuery ( "DELETE a FROM #__kunena_users AS a LEFT JOIN #__users AS b ON a.userid=b.id WHERE b.username IS NULL" ); $db->query (); if (KunenaError::checkDatabaseError()) return; $app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_DEL') . ' ' . $db->getAffectedRows () ); } if ($userrename) { $model = $this->getModel('Syncusers'); $cnt = $model->KupdateNameInfo (); $app->enqueueMessage ( JText::_('COM_KUNENA_SYNC_USERS_DO_RENAME') . " $cnt" ); } $this->setRedirect(KunenaRoute::_($this->baseurl, false)); }
function buildEmbedcode($media, $env = null) { global $vparams; // Set player size dynamically if (!empty($this->playerwidth)) { $vparams->playerwidth = $this->playerwidth; } if (!empty($this->playerheight)) { $vparams->playerheight = $this->playerheight; } //Player size in lightbox popup. Normally bigger than default size. $layout = JRequest::getString('layout'); if ($layout == 'lightbox') { $vparams->playerheight = $vparams->lplayerheight; $vparams->playerwidth = $vparams->lplayerwidth; } //Set set a default preview image, if there is none associated with current media file if (!empty($media->pixlink)) { $pixlink = $media->pixlink; } else { $pixlink = JURI::root() . 'components/com_videoflow/players/preview.jpg'; } //Facebook embedcode - Embeds video on Facebook. Not required if you are not using the Facebook application $c = JRequest::getCmd('c'); $frm = JRequest::getBool('iframe'); if (!$frm && $c == 'fb' || $env == 'fb') { $vfplayer = 'http://vimeo.com/moogaloop.swf?clip_id=' . $media->file . '&server=vimeo.com&show_title=0&show_byline=0&show_portrait=0&color=00ADEF&fullscreen=1&autoplay=1&loop=0;'; $embedcode = ''; return array('player' => $vfplayer, 'flashvars' => $embedcode); } $embedcode = '<div class="vfrespiframe"><iframe src="http://player.vimeo.com/video/' . $media->file . '?portrait=0&title=0&byline=0&color=97b8c7&autoplay=1" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>'; return $embedcode; }
/** * save the posted form data. * */ function save() { $mainframe = Jfactory::getApplication(); $model = $this->getModel('redform'); $result = $model->apisaveform(); $referer = JRequest::getVar('referer'); if (!$result) { if (!JRequest::getBool('ALREADY_ENTERED')) { $msg = JText::_('COM_REDFORM_Sorry_there_was_a_problem_with_your_submission') . ': ' . $model->getError(); } $this->setRedirect($referer, $msg, 'error'); $this->redirect(); } if ($url = $model->hasActivePayment($result->submit_key)) { $url = 'index.php?option=com_redform&controller=payment&task=select&key=' . $result->submit_key; $this->setRedirect($url); $this->redirect(); } if ($url = $model->getRedirect()) { $this->setRedirect($url); $this->redirect(); } else { echo $model->getNotificationText(); } }
/** * Method to log in a user. * * @since 1.6 */ public function login() { JSession::checkToken('post') or jexit(JText::_('JInvalid_Token')); $app = JFactory::getApplication(); // Populate the data array: $data = array(); $data['return'] = base64_decode(JRequest::getVar('return', '', 'POST', 'BASE64')); $data['username'] = JRequest::getVar('username', '', 'method', 'username'); $data['password'] = JRequest::getString('password', '', 'post', JREQUEST_ALLOWRAW); // Set the return URL if empty. if (empty($data['return'])) { $data['return'] = 'index.php?option=com_users&view=profile'; } // Set the return URL in the user state to allow modification by plugins $app->setUserState('users.login.form.return', $data['return']); // Get the log in options. $options = array(); $options['remember'] = JRequest::getBool('remember', false); $options['return'] = $data['return']; // Get the log in credentials. $credentials = array(); $credentials['username'] = $data['username']; $credentials['password'] = $data['password']; // Perform the log in. if (true === $app->login($credentials, $options)) { // Success $app->setUserState('users.login.form.data', array()); $app->redirect(JRoute::_($app->getUserState('users.login.form.return'), false)); } else { // Login failed ! $data['remember'] = (int) $options['remember']; $app->setUserState('users.login.form.data', $data); $app->redirect(JRoute::_('index.php?option=com_users&view=login', false)); } }
function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = $user->get('id'); $dispatcher = JDispatcher::getInstance(); $this->print = JRequest::getBool('print'); $this->state = $this->get('State'); $this->user = $user; $this->user = ideary::getUserInfoById($this->user->id); $userextra = Ideary::getExtraUserData($_GET["id"]); $this->assignRef('userextra', $userextra); $this->userDatafinal = Ideary::getuserData($this->user->id); $this->userDatafinal = $this->userDatafinal[0]; $this->userExtraData = Ideary::getExtraUserData($this->user->id); $this->period = isset($_POST['period']) ? $_POST['period'] : 'LAST-WEEK'; $this->messages = Ideary::getUserMessages($this->user->id); $user_followers = Ideary::getUserFollowers($this->user->id); $followers = array(); foreach ($user_followers as $follower) { $followers[] = $follower->follower_id; } $this->user_followers = $followers; $this->messages_sent = Ideary::getUserMessagesSent($this->user->id); $this->inbox_messages = Ideary::getMessagesOfFollowedUsersByUserId($this->user->id); $this->unknown_users_messages = Ideary::getMessagesOfNoFollowedUsersByUserId($this->user->id); $this->sent_messages = Ideary::getMessagesSentByUserId($this->user->id); Ideary::setAllMailsAsReaded($this->user->id); //$this->_prepareDocument(); parent::display($tpl); }
public function __construct() { $this->db = JFactory::getDBO(); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $this->update = JRequest::getBool('update'); }
function save($apply = false) { jimport('joomla.version'); $version = new JVersion(); if (JFactory::getApplication()->isSite() && JRequest::getInt('Itemid', 0)) { if (version_compare($version->getShortVersion(), '1.6', '>=')) { $menu = JSite::getMenu(); $item = $menu->getActive(); if (is_object($item)) { JRequest::setVar('cb_controller', $item->params->get('cb_controller', null)); JRequest::setVar('cb_category_id', $item->params->get('cb_category_id', null)); } } else { $params = JComponentHelper::getParams('com_contentbuilder'); JRequest::setVar('cb_controller', $params->get('cb_controller', null)); JRequest::setVar('cb_category_id', $params->get('cb_category_id', null)); } } JRequest::setVar('cbIsNew', 0); JRequest::setVar('cbInternalCheck', 1); if (JRequest::getCmd('record_id', '')) { contentbuilder::checkPermissions('edit', JText::_('COM_CONTENTBUILDER_PERMISSIONS_EDIT_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : ''); } else { JRequest::setVar('cbIsNew', 1); contentbuilder::checkPermissions('new', JText::_('COM_CONTENTBUILDER_PERMISSIONS_NEW_NOT_ALLOWED'), class_exists('cbFeMarker') ? '_fe' : ''); } $model = $this->getModel('edit'); $id = $model->store(); $submission_failed = JRequest::getBool('cb_submission_failed', false); $cb_submit_msg = JRequest::setVar('cb_submit_msg', ''); $type = 'message'; if ($id && !$submission_failed) { $msg = JText::_('COM_CONTENTBUILDER_SAVED'); $return = JRequest::getVar('return', ''); if ($return) { $return = base64_decode($return); if (!JRequest::getBool('cbInternalCheck', 1)) { JFactory::getApplication()->redirect($return, $msg); } if (JURI::isInternal($return)) { JFactory::getApplication()->redirect($return, $msg); } } } else { $apply = true; // forcing to stay in form on errors $type = 'error'; } if (JRequest::getVar('cb_controller') == 'edit') { $link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=edit&return=' . JRequest::getVar('return', '') . '&Itemid=' . JRequest::getInt('Itemid', 0), false); } else { if ($apply) { $link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=edit&return=' . JRequest::getVar('return', '') . '&backtolist=' . JRequest::getInt('backtolist', 0) . '&id=' . JRequest::getInt('id', 0) . '&record_id=' . $id . '&Itemid=' . JRequest::getInt('Itemid', 0) . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order'), false); } else { $link = JRoute::_('index.php?option=com_contentbuilder&title=' . JRequest::getVar('title', '') . (JRequest::getVar('tmpl', '') != '' ? '&tmpl=' . JRequest::getVar('tmpl', '') : '') . (JRequest::getVar('layout', '') != '' ? '&layout=' . JRequest::getVar('layout', '') : '') . '&controller=list&id=' . JRequest::getInt('id', 0) . '&limitstart=' . JRequest::getInt('limitstart', 0) . '&filter_order=' . JRequest::getCmd('filter_order') . '&Itemid=' . JRequest::getInt('Itemid', 0), false); } } $this->setRedirect($link, $msg, $type); }
function fetchElement($name, $value, &$node, $control_name) { if ($node['secret'] && !JRequest::getBool($node['secret'])) { return null; } $order = $node['order'] == 'after' ? 'after' : 'before'; $label = $node['label'] ? $node['label'] : 'Layout Parameters'; $doc =& JFactory::getDocument(); $style = "\n\t\t#{$control_name}{$name}-tabs {\n\t\t\tborder-top-width: 0px;\n\t\t\tborder-right-width: 0px;\n\t\t\tborder-bottom-width: 0px;\n\t\t\tborder-left-width: 0px;\n\t\t}"; $doc->addStyleDeclaration($style); $id = JRequest::getInt('id'); if (!$id) { $id = reset(JRequest::getVar('cid', array())); } $db =& JFactory::getDBO(); $query = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id; $db->setQuery($query); $values = $db->loadResult(); //Get the module name, in a slightly hacky way. $module = JRequest::getWord('module'); $mod =& JTable::getInstance('Module', 'JTable'); if ($id) { $mod->load($id); $modname = $mod->module; } elseif ($module) { $modname = $module; } nimport('napi.html.parameter'); $load = new NParameter($values, JPATH_ROOT . DS . 'modules' . DS . $modname . DS . $modname . '.xml'); if (!$node->children()) { $content = $load->renderFieldset('params', $value, $node['suffix']); $container = $node['panel'] ? "\n\t\t\t<div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>\n\t\t\t\t<h3 class='title jpane-toggler' id='{$name}-page'>\n\t\t\t\t\t<span>" . JFilterOutput::ampReplace($label) . "</span>\n\t\t\t\t</h3>\n\t\t\t\t<div class='jpane-slider ui-widget-content content' style='background:transparent;'>{$content}</div>\n\t\t\t</div>" : " <div id='{$control_name}{$name}'>{$content}</div>"; $script = "\n\t\t\t\tjQuery.noConflict();\n\t \n\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t\t\t});\n\t\t\t\t"; $doc->addScriptDeclaration($script); } else { $content = null; $panel = null; $title = null; $container = $node['panel'] ? " <div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>" : " <div id='{$control_name}{$name}'>"; $opt['useCookie'] = $node['cookie'] ? '\'' . $node['cookie'] . '\'' : null; JHTML::script('tabs.js'); $panel .= JPaneTabs::startPane($control_name . $name . 'tabs'); foreach ($node->children() as $group) { $content = $load->renderFieldset('params', $group['value'], $node['suffix']); $title .= $node['panel'] ? ' <span>' . JFilterOutput::ampReplace($group->data()) . '</span>' : JFilterOutput::ampReplace($group->data()); $panel .= $node['panel'] ? JPaneTabs::startPanel(JFilterOutput::ampReplace($group->data()), $group['value']) . $content . JPaneTabs::endPanel() : $content; } $panel .= JPaneTabs::endPane(); $container .= $node['panel'] ? '<h3 class="title jpane-toggler" id="' . $value . '-page"><span>' . JFilterOutput::ampReplace($label) . '</span></h3> <div class="jpane-slider jpane-current ui-widget-content content" style="background:transparent;">' . $panel . '</div> </div>' : $panel . '</div>'; JHTML::script('accordion.fix.js', 'media/napi/js/'); JHTML::script('tabs.fix.js', 'media/napi/js/'); $script = "\n\t\tjQuery.noConflict();\n \n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t});"; $doc->addScriptDeclaration($script); $doc->addStyleDeclaration('.jpane-current div.current { padding: 0px 0px; border-width:0px; border-top-width:1px;}'); } return $container; }
public function __construct($config = array()) { parent::__construct($config); $this->_dbg = JRequest::getBool('dbg', 0); $this->_japp = & JFactory::getApplication(); $this->_id = null; $this->_db = & JFactory::getDbo(); }
function hikashopUpdateHelper() { $this->db = JFactory::getDBO(); jimport('joomla.filesystem.folder'); jimport('joomla.filesystem.file'); $this->update = JRequest::getBool('update'); $this->freshinstall = JRequest::getBool('freshinstall'); }
/** * Creates the week View * * @since 2.0 */ function display($tpl = null) { $application = JFactory::getApplication(); //initialize variables $document = JFactory::getDocument(); $settings = redEVENTHelper::config(); $menu = JSite::getMenu(); $item = $menu->getActive(); $params = $application->getParams(); $uri = JFactory::getURI(); //add css file if (!$params->get('custom_css')) { $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css'); $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/week.css'); } else { $document->addStyleSheet($params->get('custom_css')); } // add js JHTML::_('behavior.mootools'); $pop = JRequest::getBool('pop'); $pathway = $application->getPathWay(); //get data from model $rows =& $this->get('Data'); $week =& $this->get('Day'); //params if ($item) { $title = $item->title; } else { $title = JText::sprintf('COM_REDEVENT_WEEK_HEADER', $this->get('weeknumber'), $this->get('year')); } $params->def('page_title', $title); //pathway $pathway->addItem(JText::sprintf('COM_REDEVENT_WEEK_HEADER', $this->get('weeknumber'), $this->get('year'))); //Set Page title if ($item && !$item->title) { $document->setTitle($params->get('page_title')); $document->setMetadata('keywords', $params->get('page_title')); } $this->assignRef('data', $rows); $this->assignRef('title', $title); $this->assignRef('params', $params); $this->assign('week', $this->get('week')); $this->assign('weeknumber', $this->get('weeknumber')); $this->assign('year', $this->get('year')); $this->assign('weekdays', $this->get('weekdays')); $this->assign('next', $this->get('nextweek')); $this->assign('previous', $this->get('previousweek')); $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category')); array_unshift($cols, 'time'); array_unique($cols); $exclude = array('date'); $cols = array_diff($cols, $exclude); $cols = redEVENTHelper::validateColumns($cols); $this->assign('columns', $cols); $start = JComponentHelper::getParams('com_redevent')->get('week_start') == 'MO' ? 1 : 0; $this->assign('start', $start); parent::display($tpl); }
/** * Imports data into the database based on an uploaded zip file. */ public function import() { JSession::checkToken(); $app = JFactory::getApplication(); // form submit $file = $_FILES['importfile']; $dryrun = JRequest::getBool('dryrun', false); // check if the file does exist if ($file['error'] != 0) { $msg = JText::_('COM_EVENTGALLERY_IMPEX_IMPORT_ERROR_INVALID_FILE'); $app->enqueueMessage($msg, 'error'); return $this->display(); } // try to open the zip archive $zip = new ZipArchive(); if ($zip->open($file['tmp_name']) !== true) { $msg = JText::_('COM_EVENTGALLERY_IMPEX_IMPORT_ERROR_INVALID_ZIP'); $app->enqueueMessage($msg, 'error'); return $this->display(); } $db = JFactory::getDbo(); $tableList = $this->getTables(); $msg = ""; foreach ($tableList as $tableName) { $content = $zip->getFromName($tableName . '.txt'); if ($content === false) { continue; } $data = json_decode($content); if (json_last_error() != 0) { $msg .= JText::sprintf('COM_EVENTGALLERY_IMPEX_IMPORT_ERROR_JSON', $tableName, json_last_error()) . "<br>"; continue; } if ($data == null || count($data) == 0) { $msg .= JText::sprintf('COM_EVENTGALLERY_IMPEX_IMPORT_ERROR_EMPTY', $tableName) . "<br>"; continue; } if ($dryrun) { $msg .= JText::sprintf('COM_EVENTGALLERY_IMPEX_IMPORT_DRYRUN_INFO', count($data), $tableName) . "<br>"; continue; } foreach ($data as $row) { $query = $db->getQuery(true); $query = "replace into " . $db->quoteName($tableName) . " SET "; $values = array(); foreach ($row as $key => $value) { array_push($values, $db->quoteName($key) . '=' . $db->quote($value)); } $query .= implode(',', $values); $db->setQuery($query); $db->execute(); set_time_limit(10); } $msg .= JText::sprintf('COM_EVENTGALLERY_IMPEX_IMPORT_SUCCESS_INFO', count($data), $tableName) . "<br>"; } $app->enqueueMessage($msg); return $this->display(); }
function display($tpl = null) { // Initialise variables. $this->app = JFactory::getApplication(); $this->user = JFactory::getUser(); $doc = JFactory::getDocument(); // Get view related request variables. $this->print = JRequest::getBool('print'); // Get model data. $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->items = $this->get('Items'); $this->canEdit = JFactory::getUser()->authorise('core.admin', 'com_osmap'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } $this->extensions = $this->get('Extensions'); // Add router helpers. $this->item->slug = $this->item->alias ? $this->item->id . ':' . $this->item->alias : $this->item->id; $this->item->rlink = JRoute::_('index.php?option=com_osmap&view=html&id=' . $this->item->slug); // Create a shortcut to the paramemters. $params =& $this->state->params; $offset = $this->state->get('page.offset'); if ($params->get('include_css', 0)) { $doc->addStyleSheet(JURI::root() . 'components/com_osmap/assets/css/osmap.css'); } // If a guest user, they may be able to log in to view the full article // TODO: Does this satisfy the show not auth setting? if (!$this->item->params->get('access-view')) { if ($user->get('guest')) { // Redirect to login $uri = JFactory::getURI(); $base = '64'; $function = "base{$base}_encode"; $app->redirect('index.php?option=com_users&view=login&return=' . call_user_func($function, $uri), JText::_('OSMAP_ERROR_LOGIN_TO_VIEW_SITEMAP')); return; } else { JError::raiseWarning(403, JText::_('OSMAP_ERROR_NOT_AUTH')); return; } } // Override the layout. if ($layout = $params->get('layout')) { $this->setLayout($layout); } // Load the class used to display the sitemap $this->loadTemplate('class'); $this->displayer = new OSMapHtmlDisplayer($params, $this->item); $this->displayer->setJView($this); $this->displayer->canEdit = $this->canEdit; $this->_prepareDocument(); parent::display($tpl); $model = $this->getModel(); $model->hit($this->displayer->getCount()); }
public function getMeta() { $foldersOnly = JRequest::getBool('foldersOnly'); if ($foldersOnly) { return $this->listFolders(); } else { return $this->listItems(); } }
function fetchElement($name, $value, &$node, $control_name) { if ($node['secret'] && !JRequest::getBool($node['secret'])) { return null; } $order = $node['order'] == 'after' ? 'after' : 'before'; $label = $node['label'] ? $node['label'] : 'Layout Parameters'; $doc =& JFactory::getDocument(); $style = "\n\t\t#{$control_name}{$name}-tabs {\n\t\t\tborder-top-width: 0px;\n\t\t\tborder-right-width: 0px;\n\t\t\tborder-bottom-width: 0px;\n\t\t\tborder-left-width: 0px;\n\t\t}"; $doc->addStyleDeclaration($style); $id = JRequest::getInt('id'); if (!$id) { $id = reset(JRequest::getVar('cid', array())); } $db =& JFactory::getDBO(); $query = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id; $db->setQuery($query); $values = $db->loadResult(); //Get the module name, in a slightly hacky way. $module = JRequest::getWord('module'); $mod =& JTable::getInstance('Module', 'JTable'); if ($id) { $mod->load($id); $modname = $mod->module; } elseif ($module) { $modname = $module; } nimport('napi.html.parameter'); $load = new NParameter($values, JPATH_ROOT . DS . 'modules' . DS . $modname . DS . $modname . '.xml'); if (!$node->children()) { $content = $load->renderFieldset('params', $value, $node['suffix']); $container = $node['panel'] ? "\n\t\t\t<div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>\n\t\t\t\t<h3 class='title jpane-toggler' id='{$name}-page'>\n\t\t\t\t\t<span>" . JFilterOutput::ampReplace($label) . "</span>\n\t\t\t\t</h3>\n\t\t\t\t<div class='jpane-slider ui-widget-content content' style='background:transparent;'>{$content}</div>\n\t\t\t</div>" : " <div id='{$control_name}{$name}'>{$content}</div>"; $script = "\n\t\t\t\tjQuery.noConflict();\n\t \n\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t\t\t});\n\t\t\t\t"; $doc->addScriptDeclaration($script); } else { $content = null; $panel = null; $title = null; $container = $node['panel'] ? " <div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>" : " <div id='{$control_name}{$name}'>"; $opt['useCookie'] = $node['cookie'] ? '\'' . $node['cookie'] . '\'' : null; JHTML::script('tabs.js'); $panel .= JPaneTabs::startPane($control_name . $name . 'tabs'); foreach ($node->children() as $group) { $content = $load->renderFieldset('params', $group['value'], $node['suffix']); $title .= $node['panel'] ? ' <span>' . JFilterOutput::ampReplace($group->data()) . '</span>' : JFilterOutput::ampReplace($group->data()); $panel .= $node['panel'] ? JPaneTabs::startPanel(JFilterOutput::ampReplace($group->data()), $group['value']) . $content . JPaneTabs::endPanel() : $content; } $panel .= JPaneTabs::endPane(); $container .= $node['panel'] ? '<h3 class="title jpane-toggler" id="' . $value . '-page"><span>' . JFilterOutput::ampReplace($label) . '</span></h3> <div class="jpane-slider jpane-current ui-widget-content content" style="background:transparent;">' . $panel . '</div> </div>' : $panel . '</div>'; $script = "\n\t\tjQuery.noConflict();\n \n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\twindow.addEvent('domready', function(){ \n\t\t\t\n\t\t\tvar dur = 600;\n\t\t\tvar trans = Fx.Transitions.Quad.easeInOut;\n\t\t\tvar el = \$\$('#{$control_name}{$name} div.jpane-slider').getFirst();\n\t\t\tvar fx = new Fx.Styles(el, {duration: dur, transition: trans});\n\t\t\t\n\t\t\t\$\$('dl.tabs').each(function(tabs){ new JTabs(tabs, {\n\t\t\tonActive: function(title, description){\n description.effects({duration: dur, transition: trans}).start({'opacity': 1, 'height': description.getSize().scrollSize.y});\n title.addClass('open').removeClass('closed');\n\t el.effects({duration: dur, transition: trans}).start({'height': description.getSize().scrollSize.y + title.getParent().getSize().scrollSize.y + title.getParent().getStyle('margin-top').toInt()});\n },\n onBackground: function(title, description){\n \tdescription.effects({duration: dur, transition: trans}).start({'opacity': 0});\n \tdescription.effects({duration: dur, transition: trans}).start({'height': 0});\n title.addClass('closed').removeClass('open');\n },\n cookie: 'showcase'}); }); \n });"; $doc->addScriptDeclaration($script); $doc->addStyleDeclaration('.jpane-current div.current { padding: 0px 0px; border-width:0px; border-top-width:1px;}'); } return $container; }
function executeTask($task) { $this->_c->execute($task); $ajax = JRequest::getBool('ajax', false); if ($ajax) { //echo 'controller-test'; exit; } }
function display($tpl = null) { // Initialise variables. $app = JFactory::getApplication(); $user = JFactory::getUser(); // Get view related request variables. $print = JRequest::getBool('print'); // Get model data. $state = $this->get('State'); $item = $this->get('Item'); $items = $this->get('Items'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } $extensions = $this->get('Extensions'); // Add router helpers. $item->slug = $item->alias ? $item->id . ':' . $item->alias : $item->id; $item->rlink = JRoute::_('index.php?option=com_xmap&view=html&id=' . $item->slug); // Create a shortcut to the paramemters. $params =& $state->params; $offset = $state->get('page.offset'); // If a guest user, they may be able to log in to view the full article // TODO: Does this satisfy the show not auth setting? if (!$item->params->get('access-view')) { if ($user->get('guest')) { // Redirect to login $uri = JFactory::getURI(); $app->redirect('index.php?option=com_users&view=login&return=' . base64_encode($uri), JText::_('Xmap_Error_Login_to_view_sitemap')); return; } else { JError::raiseWarning(403, JText::_('Xmap_Error_Not_auth')); return; } } // Override the layout. if ($layout = $params->get('layout')) { $this->setLayout($layout); } // Load the class used to display the sitemap $this->loadTemplate('class'); $displayer = new XmapHtmlDisplayer($params, $item); $displayer->setJView($this); $this->assignRef('state', $state); $this->assignRef('item', $item); $this->assignRef('items', $items); $this->assignRef('extensions', $extensions); $this->assignRef('user', $user); $this->assign('print', $print); $this->assignRef('displayer', $displayer); $this->_prepareDocument(); parent::display($tpl); $model = $this->getModel(); $model->hit($displayer->getCount()); }
public function __construct($options = null) { $v = JRequest::getWord('variant', 'list'); if (in_array($v, self::$variants_ok)) { $this->variant = $v; } $this->merge = JRequest::getBool('prevent_duplicate_titles', true); parent::__construct($options); $this->params = JFactory::getApplication()->getParams(); }
function __construct($config, $sitemap) { parent::__construct($config, $sitemap); $this->uids = array(); $this->defaultLanguage = strtolower(JFactory::getLanguage()->getTag()); if (preg_match('/^([a-z]+)-.*/', $this->defaultLanguage, $matches) && !in_array($this->defaultLanguage, array(' zh-cn', ' zh-tw'))) { $this->defaultLanguage = $matches[1]; } $this->showTitle = JRequest::getBool('filter_showtitle', 0); }
/** * Processes the migration item * * @since 1.0 * @access public * @param string * @return */ public function process() { // Check for request forgeries FD::checkToken(); // Retrieve the view. $view = $this->getCurrentView(); $component = JRequest::getVar('component', ''); $item = JRequest::getVar('item', ''); $mapping = JRequest::getVar('mapping', ''); $updateconfig = JRequest::getBool('updateconfig', 0); $migrator = FD::get('Migrators', $component); // Set the user mapping $migrator->setUserMapping($mapping); // we need to check if we need to update config or not. if (empty($item)) { $configTable = FD::table('Config'); $config = FD::registry(); if ($configTable->load('site')) { $config->load($configTable->value); if ($config->get('points.enabled') == 1) { $config->set('points.enabled', 0); // Convert the config object to a json string. $jsonString = $config->toString(); $configTable->set('value', $jsonString); // Try to store the configuration. if ($configTable->store()) { $updateconfig = true; // we need to reload the config $esConfig = new SocialConfig(); $esConfig->reload(); } } } } // Process the migration $obj = $migrator->process($item); if ($obj->continue == false && $updateconfig == true) { // now we need to re-enable back the points setting. $configTable = FD::table('Config'); $config = FD::registry(); if ($configTable->load('site')) { $config->load($configTable->value); $config->set('points.enabled', 1); // Convert the config object to a json string. $jsonString = $config->toString(); $configTable->set('value', $jsonString); // Try to store the configuration. $configTable->store(); $updateconfig = false; } } // Return the data back to the view. return $view->call(__FUNCTION__, $obj, $updateconfig); }
function save() { $result = parent::store(); if (!$result) { return $this->edit(); } if (JRequest::getBool('variant')) { JRequest::setVar('cid', JRequest::getInt('parent_id')); $this->variant(); } else { $this->listing(); } }