/** * Get the options * * @return array */ protected function getOptions() { $lists = CmcHelperBasic::getLists(); $input = JFActory::getApplication()->input; $list_options = array(); foreach ($lists as $list) { $list_options[] = JHTML::_('select.option', $list->mc_id, $list->list_name); } if ($input->get('filter_list')) { $this->value = $input->get('filter_list'); } return $list_options; }
public function setRSSHeader($albumId) { $document = JFactory::getDocument(); $album = JTable::getInstance('Album', 'CTable'); $album->load($albumId); $mainframe = JFActory::getApplication(); // Set feed url $link = CRoute::_('index.php?option=com_community&view=photos&task=album&albumid=' . $album->id . '&userid=' . $album->creator . '&format=feed'); $feed = '<link rel="alternate" type="application/rss+xml" href="' . $link . '"/>'; $document->addCustomTag($feed); }
function formatime($time, $option = 1) { if ($time == "Never") { return "Never"; } if (is_null($time)) { $joomla_date = JFActory::getDate(); $time = $joomla_date->toSql(); } $time = str_replace("/", "-", $time); $date_time = explode(" ", $time); $tdate = explode("-", $date_time["0"]); $output = NULL; if (!isset($date_time["1"])) { $date_time["1"] = NULL; } switch ($option) { case "0": $output = $tdate["0"] . "-" . $tdate["1"] . "-" . $tdate["2"] . " " . $date_time["1"]; break; case "1": $output = $tdate["1"] . "/" . $tdate["2"] . "/" . $tdate["0"] . " " . $date_time["1"]; break; case "2": $output = $tdate["2"] . "-" . $tdate["1"] . "-" . $tdate["0"] . " " . $date_time["1"]; break; case "3": $output = $tdate["0"] . "-" . $tdate["1"] . "-" . $tdate["2"]; break; case "4": $output = $tdate["1"] . "/" . $tdate["2"] . "/" . $tdate["0"]; break; case "5": $output = $tdate["2"] . "-" . $tdate["1"] . "-" . $tdate["0"]; break; default: $output = $time; break; } return $output; }
/** * Returns a published state on a grid * * @param int $value The state value. * @param int $i The row index * @param string|array $prefix An optional task prefix or an array of options * @param boolean $enabled An optional setting for access control on the action. * @param string $checkbox An optional prefix for checkboxes. * @param string $publish_up An optional start publishing date. * @param string $publish_down An optional finish publishing date. * * @return The Html code * * @see JHtmlJGrid::state * * @since 1.6 */ public static function published($value, $i, $prefix = '', $enabled = true, $checkbox = 'cb', $publish_up = null, $publish_down = null) { if (is_array($prefix)) { $options = $prefix; $enabled = array_key_exists('enabled', $options) ? $options['enabled'] : $enabled; $checkbox = array_key_exists('checkbox', $options) ? $options['checkbox'] : $checkbox; $prefix = array_key_exists('prefix', $options) ? $options['prefix'] : ''; } $states = array(1 => array('unpublish', 'JPUBLISHED', 'JLIB_HTML_UNPUBLISH_ITEM', 'JPUBLISHED', false, 'publish', 'publish'), 0 => array('publish', 'JUNPUBLISHED', 'JLIB_HTML_PUBLISH_ITEM', 'JUNPUBLISHED', false, 'unpublish', 'unpublish'), 2 => array('unpublish', 'JARCHIVED', 'JLIB_HTML_UNPUBLISH_ITEM', 'JARCHIVED', false, 'archive', 'archive'), -2 => array('publish', 'JTRASHED', 'JLIB_HTML_PUBLISH_ITEM', 'JTRASHED', false, 'trash', 'trash')); // Special state for dates if ($publish_up || $publish_down) { $nullDate = JFActory::getDBO()->getNullDate(); $nowDate = JFactory::getDate()->toUnix(); $tz = JFactory::getApplication()->getCfg('offset'); $publish_up = $publish_up != $nullDate ? JFactory::getDate($publish_up, $tz) : false; $publish_down = $publish_down != $nullDate ? JFactory::getDate($publish_down, $tz) : false; // Create tip text, only we have publish up or down settings $tips = array(); if ($publish_up) { $tips[] = JText::sprintf('JLIB_HTML_PUBLISHED_START', $publish_up->toFormat()); } if ($publish_down) { $tips[] = JText::sprintf('JLIB_HTML_PUBLISHED_FINISHED', $publish_down->toFormat()); } $tip = empty($tips) ? false : implode('<br/>', $tips); // Add tips and special titles foreach ($states as $key => $state) { // Create special titles for published items if ($key == 1) { $states[$key][2] = $states[$key][3] = 'JLIB_HTML_PUBLISHED_ITEM'; if ($publish_up && $nowDate < $publish_up->toUnix()) { $states[$key][2] = $states[$key][3] = 'JLIB_HTML_PUBLISHED_PENDING_ITEM'; $states[$key][5] = $states[$key][6] = 'pending'; } if ($publish_down && $nowDate > $publish_down->toUnix()) { $states[$key][2] = $states[$key][3] = 'JLIB_HTML_PUBLISHED_EXPIRED_ITEM'; $states[$key][5] = $states[$key][6] = 'expired'; } } // Add tips to titles if ($tip) { $states[$key][1] = JText::_($states[$key][1]); $states[$key][2] = JText::_($states[$key][2]) . '::' . $tip; $states[$key][3] = JText::_($states[$key][3]) . '::' . $tip; $states[$key][4] = true; } } return self::state($states, $value, $i, array('prefix' => $prefix, 'translate' => !$tip), $enabled, true, $checkbox); } return self::state($states, $value, $i, $prefix, $enabled, true, $checkbox); }
function sendEmailForPending($course_id) { $db = JFActory::getDBO(); $sql = "select p.*, u.name as username from #__guru_program p, #__users u where u.`id`=p.`author` and p.`id`=" . intval($course_id); $db->setQuery($sql); $db->query(); $result = $db->loadAssocList(); $sql = "select `template_emails`, `fromname`, `fromemail`, `admin_email` from #__guru_config"; $db->setQuery($sql); $db->query(); $confic = $db->loadAssocList(); $template_emails = $confic["0"]["template_emails"]; $template_emails = json_decode($template_emails, true); $fromname = $confic["0"]["fromname"]; $fromemail = $confic["0"]["fromemail"]; $sql = "select u.`email` from #__users u, #__user_usergroup_map ugm where u.`id`=ugm.`user_id` and ugm.`group_id`='8' and u.`id` IN (" . $confic["0"]["admin_email"] . ")"; $db->setQuery($sql); $db->query(); $email = $db->loadColumn(); $app = JFactory::getApplication(); $site_name = $app->getCfg('sitename'); $subject = $template_emails["unapprove_subject"]; $body = $template_emails["unapprove_body"]; $approve_url = '<a href="' . JURI::root() . "administrator/index.php?option=com_guru&controller=guruPrograms&cid[]=" . intval($result["0"]["id"]) . "&task=approve" . '" target="_blank">' . JURI::root() . "administrator/index.php?option=com_guru&controller=guruPrograms&cid[]=" . intval($result["0"]["id"]) . "&task=approve" . '</a>'; $subject = str_replace("[AUTHOR_NAME]", $result["0"]["username"], $subject); $subject = str_replace("[COURSE_NAME]", $result["0"]["name"], $subject); $subject = str_replace("[COURSE_APPROVE_URL]", $approve_url, $subject); $subject = str_replace("[SITE_NAME]", $site_name, $subject); $body = str_replace("[AUTHOR_NAME]", $result["0"]["username"], $body); $body = str_replace("[COURSE_NAME]", $result["0"]["name"], $body); $body = str_replace("[COURSE_APPROVE_URL]", $approve_url, $body); $body = str_replace("[SITE_NAME]", $site_name, $body); for ($i = 0; $i < count($email); $i++) { JFactory::getMailer()->sendMail($fromemail, $fromname, $email[$i], $subject, $body, 1); } }
function publishQuiz() { $cids = JRequest::getVar("cid", array(), "post", "array"); if (!isset($cids) || count($cids) == 0) { return FALSE; } else { $db = JFActory::getDBO(); $sql = "update #__guru_quiz set published='1' where id in (" . implode(", ", $cids) . ")"; $db->setQuery($sql); if (!$db->query()) { return false; } return true; } }
* as published by the Free Software Foundation. * * You should have received a copy of the GNU General Public License * along with redSHOP; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ require_once JPATH_COMPONENT . '/helpers/helper.php'; require_once JPATH_SITE . '/administrator/components/com_redshop/helpers/redshop.cfg.php'; $objOrder = new order_functions(); $objconfiguration = new Redconfiguration(); $user = JFactory::getUser(); $shipping_address = $objOrder->getOrderShippingUserInfo($data['order_id']); $Itemid = $_REQUEST['Itemid']; $redhelper = new redhelper(); $db = JFactory::getDbo(); $user = JFActory::getUser(); $task = JRequest::getVar('task'); $layout = JRequest::getVar('layout'); $app = JFactory::getApplication(); if ($this->_params->get("currency") != "") { $currency_main = $this->_params->get("currency"); } else { if (CURRENCY_CODE != "") { $currency_main = CURRENCY_CODE; } else { $currency_main = "USD"; } } $sql = "SELECT op.*,o.order_total,o.user_id,o.order_tax,o.order_subtotal,o.order_shipping,o.order_number,o.payment_discount FROM " . $this->_table_prefix . "order_payment AS op LEFT JOIN " . $this->_table_prefix . "orders AS o ON op.order_id = o.order_id WHERE o.order_id='" . $data['order_id'] . "'"; $db->setQuery($sql); $order_details = $db->loadObjectList();
function upgrade() { $extDir = JPATH_ROOT . '/components/com_sef/sef_ext'; JFActory::getLanguage()->load('com_installer', JPATH_ADMINISTRATOR); $fromServer = JRequest::getVar('fromserver'); $extension = JRequest::getVar('ext'); if (is_null($fromServer)) { $this->setState('message', JText::_('COM_SEF_ERROR_UPGRADE_SOURCE')); return false; } if ($fromServer == 1) { $package = $this->_getPackageFromServer($extension); } else { $package = $this->_getPackageFromUpload(); } // was the package unpacked? if (!$package) { $this->setState('message', 'Unable to find install package.'); return false; } $xmls = JFolder::files($package['extractdir'], '.xml'); $xmlfile = $xmls[0]; $xml = simplexml_load_file($package['extractdir'] . '/' . $xmlfile); $installer = JInstaller::getInstance(); JTable::addIncludePath(JPATH_LIBRARIES . '/joomla/database/table'); if (!$installer->update($package['dir'])) { $msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_ERROR', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = false; } else { $msg = JText::sprintf('COM_INSTALLER_MSG_UPDATE_SUCCESS', JText::_('COM_INSTALLER_TYPE_TYPE_' . strtoupper($package['type']))); $result = true; } $this->setState('message', $msg); if (!is_file($package['packagefile'])) { $config = JFactory::getConfig(); $package['packagefile'] = $config->get('tmp_path') . '/' . $package['packagefile']; } JInstallerHelper::cleanupInstall($package['packagefile'], $package['extractdir']); return $result; }
break; case "3": $format_string = "Y-m-d"; break; case "4": $format_string = "m/d/Y"; break; case "5": $format_string = "d-m-Y"; break; } $format_string_2 = str_replace("-", "-%", $format_string); $format_string_2 = str_replace("/", "/%", $format_string_2); $format_string_2 = "%" . $format_string_2; $format_string_2 = str_replace("H:i:s", "%H:%M:%S", $format_string_2); $joomla_date = JFActory::getDate(); $current_date = $joomla_date->toSql(); $now_now = $helper->formatime($current_date, $configs->params['timeformat']); echo JHtml::calendar(trim($now_now), 'pay_date', 'pay_date', $format_string_2, ''); echo "<input type='hidden' name='tfa' value='" . $configs->params['timeformat'] . "' />"; ?> <span class="editlinktip hasTip" title="<?php echo JText::_('AD_PAYMENT_DATE_TIP'); ?> " > <img src="components/com_adagency/images/tooltip.png" border="0"/></span> </div> </div> <input type="hidden" name="images" value="" /> <input type="hidden" name="option" value="com_adagency" /> <input type="hidden" name="id" value="" />
function addQuizzes($tpl = null) { $db = JFactory::getDBO(); $user = JFActory::getUser(); $search_text = JRequest::getVar('search_text', ""); $sql = "SELECT id, name FROM `#__guru_quiz`"; if ($search_text != "") { $sql = $sql . " where name LIKE '%" . $search_text . "%' and `is_final` <> 1 and `author`=" . intval($user->id); } else { $sql = $sql . " where `is_final` <> 1 and `author`=" . intval($user->id); } $db->setQuery($sql); $list_quizzes = $db->loadAssocList(); $this->assignRef('list_quizzes', $list_quizzes); parent::display($tpl); }
<?php /** * @package Joomla.Administrator * @subpackage com_contact * * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ defined('_JEXEC') or die; JHtml::_('behavior.tabstate'); $option = JRequest::getVar('option'); $doc = JFActory::getDocument(); require_once JPATH_ADMINISTRATOR . DIRECTORY_SEPARATOR . 'components' . DIRECTORY_SEPARATOR . $option . DIRECTORY_SEPARATOR . 'defines.php'; if (!JFactory::getUser()->authorise('core.manage', $option)) { return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); } $clearName = substr($option, 4); $controller = JControllerLegacy::getInstance($clearName); $controller->execute(JFactory::getApplication()->input->get('task')); $doc->addStyleSheet('components/' . $option . '/assets/style.css'); $doc->addScriptVersion('components/' . $option . '/assets/component.js'); $controller->redirect();