/** * Tries to authenticate the user and start the backup, or send him back to the default task */ function authenticate() { // Enforce raw mode - I need to be in full control! $format = JRequest::getCmd('format', 'html'); if ($format != 'raw') { $this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=light&format=raw'); parent::redirect(); } else { if (!$this->_checkPermissions()) { parent::redirect(); } else { $this->_setProfile(); jimport('joomla.utilities.date'); jpimport('core.cube'); JoomlapackCUBE::reset(); $cube =& JoomlapackCUBE::getInstance(); $user =& JFactory::getUser(); $userTZ = $user->getParam('timezone', 0); $dateNow = new JDate(); $dateNow->setOffset($userTZ); $cube->start(JText::_('DEFAULT_COMMENT') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'), '')); $cube->save(); $this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=light&task=step&key=' . JRequest::getVar('key') . '&profile=' . JRequest::getInt('profile') . '&format=raw'); } } }
/** * remove from set */ function removefromset() { $model = $this->getModel(); $table = $model->getTable(); $key = $table->getKeyName(); $urlVar = $key; $jinput = JFactory::getApplication()->input; $recordId = $jinput->getInt($urlVar); $recurrence_group = $jinput->getInt('recurrence_group'); # Retrieve id of current event from recurrence_table $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id'); $query->from($db->quoteName('#__jem_recurrence')); $query->where(array('groupid_ref = ' . $recurrence_group, 'itemid= ' . $recordId)); $db->setQuery($query); $recurrenceid = $db->loadResult(); # Update field recurrence_group in event-table $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->update('#__jem_events'); $query->set(array('recurrence_count = ""', 'recurrence_freq = ""', 'recurrence_group = ""', 'recurrence_interval = ""', 'recurrence_until = ""', 'recurrence_weekday = ""')); $query->where('id = ' . $recordId); $db->setQuery($query)->query(); # Blank field groupid_ref in recurrence-table and set exdate value $recurrence_table = JTable::getInstance('Recurrence', 'JEMTable'); $recurrence_table->load($recurrenceid); $startdate_org_input = new JDate($recurrence_table->startdate_org); $exdate = $startdate_org_input->format('Ymd\\THis\\Z'); $recurrence_table->exdate = $exdate; $recurrence_table->groupid_ref = ""; $recurrence_table->store(); # redirect back $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false)); }
/** * Starts a backup * @return */ function display() { // Check permissions $this->_checkPermissions(); // Set the profile $this->_setProfile(); // Force the output to be of the raw format type JRequest::setVar('format', 'raw'); $document =& JFactory::getDocument(); $document->setType('raw'); // Get the description, if present; otherwise use the default description jimport('joomla.utilities.date'); $user =& JFactory::getUser(); $userTZ = $user->getParam('timezone', 0); $dateNow = new JDate(); $dateNow->setOffset($userTZ); $default_description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2')); $description = JRequest::getString('description', $default_description); // Start the backup (CUBE Operation) jpimport('core.cube'); JoomlapackCUBE::reset(); $cube =& JoomlapackCUBE::getInstance(); $cube->start($description, ''); $cube->save(); // Return the JSON output parent::display(false); }
function export($event) { CFactory::load('helpers', 'event'); $handler = CEventHelper::getHandler($event); if (!$handler->showExport()) { echo JText::_('CC ACCESS FORBIDDEN'); return; } header('Content-type: text/Calendar'); header('Content-Disposition: attachment; filename="calendar.ics"'); $creator = CFactory::getUser($event->creator); $offset = $creator->getUtcOffset(); $date = new JDate($event->startdate); $dtstart = $date->toFormat('%Y%m%dT%H%M%S'); $date = new JDate($event->enddate); $dtend = $date->toFormat('%Y%m%dT%H%M%S'); $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true); $tmpl = new CTemplate(); $tmpl->set('dtstart', $dtstart); $tmpl->set('dtend', $dtend); $tmpl->set('url', $url); $tmpl->set('event', $event); $raw = $tmpl->fetch('events.ical'); unset($tmpl); echo $raw; exit; }
public static function getList(&$params) { $db = JFactory::getDbo(); $user = JFactory::getUser(); $groups = implode(',', $user->getAuthorisedViewLevels()); $timeframe = $params->get('timeframe', 'alltime'); $maximum = $params->get('maximum', 5); $order_value = $params->get('order_value', 'count'); if ($order_value == 'rand()') { $order_direction = ''; } else { $order_value = $db->quoteName($order_value); $order_direction = $params->get('order_direction', 1) ? 'DESC' : 'ASC'; } $query = $db->getQuery(true)->select(array('MAX(' . $db->quoteName('tag_id') . ') AS tag_id', ' COUNT(*) AS count', 'MAX(t.title) AS title', 'MAX(' . $db->quoteName('t.access') . ') AS access', 'MAX(' . $db->quoteName('t.alias') . ') AS alias'))->group($db->quoteName(array('tag_id', 'title', 'access', 'alias')))->from($db->quoteName('#__contentitem_tag_map'))->where($db->quoteName('t.access') . ' IN (' . $groups . ')'); // Only return published tags $query->where($db->quoteName('t.published') . ' = 1 '); // Optionally filter on language $language = JComponentHelper::getParams('com_tags')->get('tag_list_language_filter', 'all'); if ($language != 'all') { if ($language == 'current_language') { $language = JHelperContent::getCurrentLanguage(); } $query->where($db->quoteName('t.language') . ' IN (' . $db->quote($language) . ', ' . $db->quote('*') . ')'); } if ($timeframe != 'alltime') { $now = new JDate(); $query->where($db->quoteName('tag_date') . ' > ' . $query->dateAdd($now->toSql('date'), '-1', strtoupper($timeframe))); } $query->join('INNER', $db->quoteName('#__tags', 't') . ' ON ' . $db->quoteName('tag_id') . ' = t.id')->order($order_value . ' ' . $order_direction); $db->setQuery($query, 0, $maximum); $results = $db->loadObjectList(); return $results; }
public function loadByIP($ip, $mode = self::ACTIVE) { // Reset the table. $k = $this->_tbl_key; $this->{$k} = 0; $this->reset(); // Check for a valid id to load. if ($ip === null || !is_string($ip)) { return false; } $now = new JDate(); // Load the user data. $query = "SELECT * FROM {$this->_tbl}\n\t\t\tWHERE ip = {$this->_db->quote($ip)}\n\t\t\t" . ($mode == self::ACTIVE ? "AND (expiration = {$this->_db->quote($this->_db->getNullDate())} OR expiration > {$this->_db->quote($now->toMysql())})" : '') . "\n\t\t\tORDER BY id DESC"; $this->_db->setQuery($query, 0, 1); $data = $this->_db->loadAssoc(); // Check for an error message. if ($this->_db->getErrorNum()) { $this->setError($this->_db->getErrorMsg()); return false; } if (empty($data)) { $this->ip = $ip; return false; } // Bind the data to the table. $this->bind($data); return true; }
/** * Tries to authenticate the user and start the backup, or send him back to the default task */ public function authenticate() { // Enforce raw mode - I need to be in full control! if (!$this->_checkPermissions()) { parent::redirect(); } else { $session = JFactory::getSession(); $session->set('litemodeauthorized', 1, 'akeeba'); $this->_setProfile(); JLoader::import('joomla.utilities.date'); AECoreKettenrad::reset(array('maxrun' => 0)); AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN); $kettenrad = AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN); $dateNow = new JDate(); /* $user = JFactory::getUser(); $userTZ = $user->getParam('timezone',0); $dateNow->setOffset($userTZ); */ $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true); $options = array('description' => $description, 'comment' => ''); $kettenrad->setup($options); $ret = $kettenrad->tick(); AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN); JFactory::getApplication()->redirect(JURI::base() . 'index.php?option=com_akeeba&view=light&task=step&key=' . urlencode($this->input->get('key', '', 'none', 2)) . '&profile=' . $this->input->get('profile', 1, 'int') . '&format=raw'); } }
function __construct(&$_db) { parent::__construct('#__banner', 'bid', $_db); jimport('joomla.utilities.date'); $now = new JDate(); $this->set('date', $now->toMySQL()); }
/** * Returns date/time in short format. i.e. 6m, 6h, 6d, 6w, 6m, 6y etc * @param unknown $date * @return Ambigous <string, string, mixed, multitype:>|Ambigous <string, string, mixed> */ public static function getShortDate($date) { if (empty($date) || $date == '0000-00-00 00:00:00') { return JText::_('LBL_NA'); } jimport('joomla.utilities.date'); $user = JFactory::getUser(); // Given time $date = new JDate(JHtml::date($date, 'Y-m-d H:i:s')); $compareTo = new JDate(JHtml::date('now', 'Y-m-d H:i:s')); $diff = $compareTo->toUnix() - $date->toUnix(); $diff = abs($diff); $dayDiff = floor($diff / 86400); if ($dayDiff == 0) { if ($diff < 120) { return '1m'; } elseif ($diff < 3600) { return floor($diff / 60) . 'm'; } else { return floor($diff / 3600) . 'h'; } } elseif ($dayDiff < 7) { return $dayDiff . 'd'; } elseif ($dayDiff < 7 * 6) { return ceil($dayDiff / 7) . 'w'; } elseif ($dayDiff < 365) { return ceil($dayDiff / (365 / 12)) . 'm'; } else { return round($dayDiff / 365) . 'y'; } }
function save($data) { $row =& JTable::getInstance('codefile', 'Table'); $id = $data['id']; if (!$id) { jimport('joomla.utilities.date'); $dateNow = new JDate(); $dateMySql = $dateNow->toMySQL(); $data['creationdate'] = $dateMySql; $data['addedby'] = 'server'; } if (!$row->bind($data)) { JError::raiseError(500, $row->getError()); return false; } if (!$row->check()) { JError::raiseError(500, $row->getError()); } if (!$row->store()) { JError::raiseError(500, $row->getError()); return false; } else { if (!$id) { $row->load($row->{$id}); } if ($_FILES['cfile']['size']) { $this->fileupdload($row->id); } } return true; }
function &getData() { if (empty($this->_data)) { $query = ' SELECT * FROM #__fst_comments ' . ' WHERE id = ' . FSTJ3Helper::getEscaped($this->_db, $this->_id); $this->_db->setQuery($query); $this->_data = $this->_db->loadObject(); } if (!$this->_data) { $this->_data = new stdClass(); $this->_data->id = 0; $this->_data->ident = 5; // $this->_data->itemid = 0; $this->_data->body = null; $this->_data->email = null; $this->_data->name = null; $this->_data->website = null; $this->_data->published = 1; $current_date = new JDate(); if (FSTJ3Helper::IsJ3()) { $mySQL_conform_date = $current_date->toSql(); } else { $mySQL_conform_date = $current_date->toMySQL(); } $this->_data->created = $mySQL_conform_date; } return $this->_data; }
function savePayment() { $orderid = JRequest::getVar('orderid'); $Itemid = JRequest::getVar('Itemid'); $order = JTable::getInstance('OrdersTable', 'JTheFactory'); if (!$order->load($orderid)) { $app = JFactory::getApplication(); $app->redirect('index.php?option=' . APP_EXTENSION . '&Itemid=' . $Itemid, JText::_("FACTORY_ORDER_DOES_NOT_EXIST")); return; } $paylog = JTable::getInstance('PaymentLogTable', 'JTheFactory'); $date = new JDate(); $paylog->date = $date->toMySQL(); $paylog->amount = $order->order_total; $paylog->currency = $order->order_currency; $paylog->refnumber = JRequest::getVar('customer_note'); $paylog->invoice = $orderid; $paylog->ipn_response = print_r($_REQUEST, true); $paylog->ipn_ip = $_SERVER['REMOTE_ADDR']; $paylog->status = 'manual_check'; $paylog->userid = $order->userid; $paylog->orderid = $order->id; $paylog->payment_method = $this->name; $paylog->store(); $order->paylogid = $paylog->id; $order->store(); }
public function store() { $now = new JDate(); // Always update the stream last updated time $this->updated = $now->toMySQL(); return parent::store(); }
public static function formatDate($date, $format = null, $jsFormat = true) { if (is_null($format)) { if (!($format = self::getDateFormat())) { reset(self::$_dateFormats); $format = key(self::$_dateFormats); } } if ($jsFormat) { if (isset(self::$_dateFormats[$format])) { $format = self::$_dateFormats[$format]; } else { $format = reset(self::$_dateFormats); } } if ($date instanceof DateTime) { $timestamp = $date->getTimestamp(); } else { if (is_int($date)) { $timestamp = $date; } else { $timestamp = strtotime((string) $date); } } //return date($format, $timestamp); $dt = new JDate($date); return $dt->format($format); }
function getList(&$params) { global $mainframe; $db =& JFactory::getDBO(); $user =& JFactory::getUser(); $userId = (int) $user->get('id'); $count = (int) $params->get('count', 5); $catid = trim($params->get('catid')); $secid = trim($params->get('secid')); $show_front = $params->get('show_front', 1); $aid = $user->get('aid', 0); $contentConfig =& JComponentHelper::getParams('com_content'); $access = !$contentConfig->get('shownoauth'); $nullDate = $db->getNullDate(); jimport('joomla.utilities.date'); $date = new JDate(); $now = $date->toMySQL(); $where = 'a.state = 1' . ' AND ( a.publish_up = ' . $db->Quote($nullDate) . ' OR a.publish_up <= ' . $db->Quote($now) . ' )' . ' AND ( a.publish_down = ' . $db->Quote($nullDate) . ' OR a.publish_down >= ' . $db->Quote($now) . ' )'; // User Filter switch ($params->get('user_id')) { case 'by_me': $where .= ' AND (created_by = ' . (int) $userId . ' OR modified_by = ' . (int) $userId . ')'; break; case 'not_me': $where .= ' AND (created_by <> ' . (int) $userId . ' AND modified_by <> ' . (int) $userId . ')'; break; } // Ordering switch ($params->get('ordering')) { case 'm_dsc': $ordering = 'a.modified DESC, a.created DESC'; break; case 'c_dsc': default: $ordering = 'a.created DESC'; break; } if ($catid) { $ids = explode(',', $catid); JArrayHelper::toInteger($ids); $catCondition = ' AND (cc.id=' . implode(' OR cc.id=', $ids) . ')'; } if ($secid) { $ids = explode(',', $secid); JArrayHelper::toInteger($ids); $secCondition = ' AND (s.id=' . implode(' OR s.id=', $ids) . ')'; } // Content Items only $query = 'SELECT a.*, ' . ' CASE WHEN CHAR_LENGTH(a.alias) THEN CONCAT_WS(":", a.id, a.alias) ELSE a.id END as slug,' . ' CASE WHEN CHAR_LENGTH(cc.alias) THEN CONCAT_WS(":", cc.id, cc.alias) ELSE cc.id END as catslug' . ' FROM #__content AS a' . ($show_front == '0' ? ' LEFT JOIN #__content_frontpage AS f ON f.content_id = a.id' : '') . ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' INNER JOIN #__sections AS s ON s.id = a.sectionid' . ' WHERE ' . $where . ' AND s.id > 0' . ($access ? ' AND a.access <= ' . (int) $aid . ' AND cc.access <= ' . (int) $aid . ' AND s.access <= ' . (int) $aid : '') . ($catid ? $catCondition : '') . ($secid ? $secCondition : '') . ($show_front == '0' ? ' AND f.content_id IS NULL ' : '') . ' AND s.published = 1' . ' AND cc.published = 1' . ' ORDER BY ' . $ordering; $db->setQuery($query, 0, $count); $rows = $db->loadObjectList(); $i = 0; $lists = array(); foreach ($rows as $row) { $lists[$i]->link = JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid)); $lists[$i]->text = htmlspecialchars($row->title); $i++; } return $lists; }
function build() { $formatedDate = ""; if (!empty($this->dataValue) && $this->dataValue != "0000-00-00" && $this->dataValue != "00:00:00" && $this->dataValue != "0000-00-00 00:00:00") { jimport("joomla.utilities.date"); $date = new JDate($this->dataValue); if ($tz = $this->timezone) { if ($tz == 'server') { //TODO : Get the server timezone $tz = 0; //DBG } else { if ($tz == 'local') { //TODO : Get the current user local timezone $tz = 0; //DBG } } $date->setOffset((int) $tz); } $formatedDate = $date->format($this->dateFormat, !empty($tz)); } $this->addClass('fly-date'); $html = '<span <%STYLE%><%CLASS%><%SELECTORS%>>' . $formatedDate . '</span>'; return $html; }
private function getInvoiceListParameters() { JLoader::import('joomla.utilities.date'); $jNow = new JDate(); $month = $this->input->getInt('month', 0); if ($month < 1 || $month > 12) { $month = (int) $jNow->format('m'); $month--; } $year = $this->input->getInt('year', 0); if ($year < 2010 || $year > 2100) { $year = (int) $jNow->format('Y'); } if ($month <= 0) { $month = 12; $year--; } $vies = false; $vatmoss = false; switch ($this->getTask()) { case 'vies': $vies = true; break; case 'vatmoss': $vatmoss = true; break; } $invoiceExtension = $this->input->getCmd('extension', 'akeebasubs'); return array('month' => $month, 'year' => $year, 'vies' => $vies, 'vatmoss' => $vatmoss, 'extension' => $invoiceExtension); }
function edit() { $now = new JDate(); $title = JRequest::getString ( "title", "" ); $description = JRequest::getVar ( 'description', '', 'string', JREQUEST_ALLOWRAW ); $sdescription = JRequest::getVar ( 'sdescription', '', 'string', JREQUEST_ALLOWRAW ); $created = JRequest::getString ( "created", $now->toMysql() ); if (!$created) $created = $now->toMysql(); $published = JRequest::getInt ( "published", 1 ); $showdate = JRequest::getInt ( "showdate", 1 ); $id = $this->getState ( 'item.id' ); if (!$id) { $query = "INSERT INTO #__kunena_announcement VALUES ('', {$this->db->Quote ( $title )}, {$this->db->Quote ( $sdescription )}, {$this->db->Quote ( $description )}, {$this->db->Quote ( $created )}, {$this->db->Quote ( $published )}, 0, {$this->db->Quote ( $showdate )})"; } else { $query = "UPDATE #__kunena_announcement SET title={$this->db->Quote ( $title )}, description={$this->db->Quote ( $description )}, sdescription={$this->db->Quote ( $sdescription )}, created={$this->db->Quote ( $created )}, published={$this->db->Quote ( $published )}, showdate={$this->db->Quote ( $showdate )} WHERE id=$id"; } $this->db->setQuery ( $query ); $this->db->query (); KunenaError::checkDatabaseError(); }
public function browse() { // Check permissions $this->_checkPermissions(); // Set the profile $this->_setProfile(); // Start the backup JLoader::import('joomla.utilities.date'); AECoreKettenrad::reset(array('maxrun' => 0)); AEUtilTempfiles::deleteTempFiles(); AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN); $kettenrad = AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN); $dateNow = new JDate(); $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true); $options = array('description' => $description, 'comment' => ''); $kettenrad->setup($options); $kettenrad->tick(); $kettenrad->tick(); $array = $kettenrad->getStatusArray(); AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN); if ($array['Error'] != '') { // An error occured die('500 ERROR -- ' . $array['Error']); } else { $noredirect = $this->input->get('noredirect', 0, 'int'); if ($noredirect != 0) { @ob_end_clean(); echo "301 More work required"; flush(); JFactory::getApplication()->close(); } else { $this->_customRedirect(JURI::base() . 'index.php?option=com_akeeba&view=backup&task=step&key=' . $this->input->get('key', '', 'none', 2) . '&profile=' . $this->input->get('profile', 1, 'int')); } } }
function display() { // Check permissions $this->_checkPermissions(); // Set the profile $this->_setProfile(); // Force the output to be of the raw format type JRequest::setVar('format', 'raw'); $document =& JFactory::getDocument(); $document->setType('raw'); // Start the backup jimport('joomla.utilities.date'); jpimport('core.cube'); JoomlapackCUBE::reset(); $cube =& JoomlapackCUBE::getInstance(); $jconfig =& JFactory::getConfig(); $userTZ = $jconfig->get('config.offset'); /* $user =& JFactory::getUser(); $userTZ = $user->getParam('timezone',0); */ $dateNow = new JDate(); $dateNow->setOffset($userTZ); $cube->start(JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'), '')); $cube->save(); $this->setRedirect(JURI::base() . 'index.php?option=com_joomlapack&view=backup&task=step&key=' . JRequest::getVar('key') . '&profile=' . JRequest::getInt('profile', 1) . '&format=raw'); parent::display(); }
function save($data) { $row =& JTable::getInstance('Articles', 'Table'); $id = $data['id']; if (!$id) { jimport('joomla.utilities.date'); $dateNow = new JDate(); $dateMySql = $dateNow->toMySQL(); $data['createdate'] = $dateMySql; $data['addedby'] = 'server'; $data['author'] = 'Administrator'; } if (!$row->bind($data)) { JError::raiseError(500, $row->getError()); return false; } if (!$row->check()) { JError::raiseError(500, $row->getError()); } if (!$row->store()) { JError::raiseError(500, $row->getError()); return false; } return true; }
function date_bl($date, $time) { return JSBaseView::formatDate($date . ' ' . $time); $format = "d-m-Y H:i"; if ($date == '' || $date == '0000-00-00') { return ''; } // $format = getJS_Config('date_format'); // print_r($format);echo "<hr>"; /*switch ($format){ case "d-m-Y H:i": $format = "%d-%m-%Y %H:%M"; break; case "m-d-Y g:i A": $format = "%m-%d-%Y %I:%M %p"; break; case "j F, Y H:i": $format = "%m %B, %Y %H:%M"; break; case "j F, Y g:i A": $format = "%m %B, %Y %I:%H %p"; break; case "d-m-Y": $format = "%d-%m-%Y"; break; case "l d F, Y H:i": $format = "%A %d %B, %Y %H:%M"; break; }*/ if (!$time) { $time = '00:00'; } $time_m = explode(':', $time); $date_m = explode('-', $date); if (function_exists('date_default_timezone_set')) { date_default_timezone_set('GMT'); } $tm = @mktime($time_m[0], $time_m[1], '0', $date_m[1], $date_m[2], $date_m[0]); jimport('joomla.utilities.date'); $dt = new JDate($tm, null); return $dt->format($format); }
function apply() { JRequest::checkToken() or jexit('Invalid Token'); $applicant = JRequest::get('POST'); jimport('joomla.utilities.date'); $now = new JDate(); if ($applicant['job_id'] != 0) { $unsol_id = $applicant['id']; $applicant['id'] = false; $applicant['request_date'] = $now->toMySQL(); $record =& JTable::getInstance('Applicant', 'Table'); if (!$record->save($applicant)) { // uh oh failed to save JError::raiseError('500', JTable::getError()); } $unsol =& JTable::getInstance('Unsolicited', 'Table'); if (!$unsol->delete($unsol_id)) { // uh oh failed to delete JError::raiseError('500', JTable::getError()); } $this->extendApply($applicant); } else { $applicant['last_updated'] = $now->toMySQL(); $unsol_record =& JTable::getInstance('Unsolicited', 'Table'); if (!$unsol_record->save($applicant)) { // uh oh failed to save JError::raiseError('500', JTable::getError()); } $this->extendApply($applicant); } }
/** * Tries to authenticate the user and start the backup, or send him back to the default task */ public function authenticate() { // Enforce raw mode - I need to be in full control! $document =& JFactory::getDocument(); $document->setType('raw'); if (!$this->_checkPermissions()) { parent::redirect(); } else { $session =& JFactory::getSession(); $session->set('litemodeauthorized', 1, 'akeeba'); $this->_setProfile(); jimport('joomla.utilities.date'); AECoreKettenrad::reset(); $memory_filename = AEUtilTempvars::get_storage_filename(AKEEBA_BACKUP_ORIGIN); @unlink($memory_filename); $kettenrad =& AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN); $user =& JFactory::getUser(); $userTZ = $user->getParam('timezone', 0); $dateNow = new JDate(); $dateNow->setOffset($userTZ); if (AKEEBA_JVERSION == '16') { $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true); } else { $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2')); } $options = array('description' => $description, 'comment' => ''); $kettenrad->setup($options); $ret = $kettenrad->tick(); AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN); $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=light&task=step&key=' . urlencode(JRequest::getVar('key')) . '&profile=' . JRequest::getInt('profile') . '&format=raw'); } }
protected function getInput() { $class = !empty($this->class) ? $this->class : ''; $required = $this->required ? ' required aria-required="true"' : ''; $birthdayDay = ''; $birthdayMonth = '01'; $birthdayYear = ''; // Prepare birthday if (!empty($this->value)) { $date = new Prism\Validator\Date($this->value); if (!$date->isValid()) { $birthdayDay = ''; $birthdayMonth = ''; $birthdayYear = ''; } else { $date = new JDate($this->value); $birthdayDay = $date->format('d'); $birthdayMonth = $date->format('m'); $birthdayYear = $date->format('Y'); } } $months = new Socialcommunity\Filter\Months(); $html = array(); $html[] = '<div class="' . $class . '">'; $html[] = ' <input name="' . $this->name . '[day]" value="' . $birthdayDay . '" id="birthday_day" class="col-md-3 ' . $class . '" type="text" placeholder="' . JText::_('COM_SOCIALCOMMUNITY_DAY') . '" ' . $required . '>'; $html[] = JHTML::_('select.genericlist', $months->toOptions(), $this->name . '[month]', array('class' => 'col-md-3 ' . $class), 'text', 'value', $birthdayMonth, 'birthday_month'); $html[] = ' <input name="' . $this->name . '[year]" value="' . $birthdayYear . '" id="birthday_year" class="col-md-4 ' . $class . '" type="text" placeholder="' . JText::_('COM_SOCIALCOMMUNITY_YEAR') . '" ' . $required . '>'; $html[] = '</div>'; return implode($html); }
function processIPN() { $model = JModel::getInstance('Gateways', 'JTheFactoryModel'); $params = $model->loadGatewayParams($this->name); $test_mode = $params->get('test_mode', 0); $x_login = $params->get('x_login', ''); $paylog = JTable::getInstance('PaymentLogTable', 'JTheFactory'); $date = new JDate(); $paylog->date = $date->toMySQL(); $paylog->amount = JRequest::getVar('x_amount'); $paylog->currency = ''; //JRequest::getVar(''); $paylog->refnumber = JRequest::getVar('x_trans_id'); $paylog->invoice = JRequest::getVar('x_invoice_num'); $paylog->ipn_response = print_r($_REQUEST, true); $paylog->ipn_ip = $_SERVER['REMOTE_ADDR']; $paylog->status = 'error'; $paylog->userid = null; $paylog->orderid = JRequest::getVar('x_invoice_num'); $paylog->payment_method = $this->name; $receiver_email = JRequest::getVar('receiver_email'); $payment_status = JRequest::getVar('x_2checked'); if ($payment_status == 'Y') { $paylog->status = 'ok'; } else { $paylog->status = 'error'; } $paylog->store(); return $paylog; }
static function getToday($ym = false) { jimport('joomla.utilities.date'); $format = $ym == true ? '%Y-%m' : '%Y-%m-%d'; $today_do = new JDate(); return $today_do->toFormat($format); }
function XmapNav(&$config, &$sitemap) { $this->_list=array(); $this->view='navigator'; global $mainframe; jimport('joomla.utilities.date'); $user =& JFactory::getUser(); $access = new stdClass(); $access->canEdit = $user->authorize('com_content', 'edit', 'content', 'all'); $access->canEditOwn = $user->authorize('com_content', 'edit', 'content', 'own'); $access->canPublish = $user->authorize('com_content', 'publish', 'content', 'all'); $this->access = &$access; $date = new JDate(); $this->noauth = $mainframe->getCfg( 'shownoauth' ); $this->gid = $user->get('gid'); $this->now = $date->toUnix(); $this->config = &$config; $this->sitemap = &$sitemap; $this->isNews = false; $this->_isAdmin = ($this->gid == "25"); }
protected function getInput() { $class = !empty($this->class) ? $this->class : ''; $required = $this->required ? ' required aria-required="true"' : ''; // Prepare birthday if (!empty($this->value)) { $date = new Prism\Validator\Date($this->value); if (!$date->isValid()) { $birthdayDay = ""; $birthdayMonth = ""; $birthdayYear = ""; } else { $date = new JDate($this->value); $birthdayDay = $date->format("d"); $birthdayMonth = $date->format("m"); $birthdayYear = $date->format("Y"); } } $html = array(); $html[] = '<div class="' . $class . '">'; $html[] = ' <input name="' . $this->name . '[day]" value="' . $birthdayDay . '" id="birthday_day" class="span3" type="text" placeholder="' . JText::_("COM_SOCIALCOMMUNITY_DAY") . '" ' . $required . '>'; $html[] = ' <input name="' . $this->name . '[month]" value="' . $birthdayMonth . '" id="birthday_month" class="span3" type="text" placeholder="' . JText::_("COM_SOCIALCOMMUNITY_MONTH") . '" ' . $required . '>'; $html[] = ' <input name="' . $this->name . '[year]" value="' . $birthdayYear . '" id="birthday_year" class="span4" type="text" placeholder="' . JText::_("COM_SOCIALCOMMUNITY_YEAR") . '" ' . $required . '>'; $html[] = '</div>'; return implode($html); }
/** * Execute the controller. * * @return string The rendered view. */ public function execute() { $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*')->from('Comments'); $db->setQuery($query); $comments = $db->loadAssocList(); $commentMarkup = ''; foreach ($comments as $comment) { $date = new JDate($comment['date']); $commentMarkup .= '<article><h3><a href="mailto:' . htmlspecialchars($comment['Email']) . '">' . htmlspecialchars($comment['Name']) . '</a> wrote:</h3> <p>' . htmlspecialchars($comment['Comment']) . '</p> <small>' . $date->format('d.m.Y', true) . ', ' . htmlspecialchars(long2ip($comment['Ip'])) . '</small></article>'; } return ' <form action="index.php" enctype="application/x-www-form-urlencoded" method="post"> <fieldset> <input id="name" autofocus="autofocus" type="text" name="name" placeholder="Name" size="40" required="required" /><br /> <input id="email" type="email" name="email" placeholder="E-Mail" size="40" required="required" /><br /> <textarea id="comment" name="comment" placeholder="Your Comment" rows="10" cols="40" required="required"></textarea><br /> <input type="hidden" name="task" value="add" /> <input type="submit" vale="Send" /> </fieldset> </form> <section> <h2>Comments</h2> ' . $commentMarkup . ' </section> '; }