$acl = array(); if (!$struct) { $struct = array(); } else { $acl_list = session_allowed_access_list(); if (!in_array('all', $acl_list)) { foreach ($struct as $k) { if ($k == 'sitellite_access') { $acl = array('sitellite_access' => new rList('sitellite_access', session_allowed_access_list())); break; } } } } $pg = new Pager($cgi->offset, $limit); $pg->url = site_current() . '?collection=' . urlencode($cgi->collection); $res = $rex->getDeleted($limit, $cgi->offset, $acl); if (!$res) { $res = array(); $rex->total = 0; } $pg->total = $rex->total; $res2 = array(); foreach ($res as $k => $v) { $res2[$v->{$rex->key}] = $v; } function pretty_date($date) { loader_import('saf.Date'); return Date::timestamp($date, 'M j, Y - g:ia'); }
$results[$key]['url'] .= '?highlight=' . $enc; } } loader_import('saf.GUI.Pager'); $pg = new Pager($cgi->offset, appconf('limit')); if ($parameters['multiple'] == 'yes') { $t = ''; if (is_array($parameters['ctype'])) { foreach ($parameters['ctype'] as $ct) { $t .= '&ctype[]=' . urlencode($ct); } } $d = ''; if (is_array($parameters['domains'])) { foreach ($parameters['domains'] as $ds) { $d .= '&domains[]=' . $ds; } } } else { $t = '&ctype=' . urlencode($parameters['ctype']); $d = '&domains=' . urlencode($parameters['domains']); } $pg->setUrl(site_current() . '?query=%s' . $t . $d . '&show_types=%s&multiple=%s&show_domains=%s', $enc, $parameters['show_types'], $parameters['multiple'], $parameters['show_domains']); $pg->total = $total; $pg->setData($results); $pg->update(); page_id('search'); page_title('SiteSearch - Results For "' . $cgi->query . '"'); template_simple_register('cgi', $cgi); template_simple_register('pager', $pg); echo template_simple('stats_search.spt', array('show_types' => $show_types, 'show_domains' => $show_domains, 'types' => $types, 'domains' => $domains, 'multiple' => $multiple, 'syntax' => $res['metadata']['syntax']));
/** * Force the current page to be made over HTTP. * * @access public * */ function forceHttp() { header('Location: http://' . site_domain() . site_current() . '?' . $_SERVER['QUERY_STRING']); exit; }
function render() { $this->evalOptions(); global $cgi; //$out = '<form id="facet-' . $this->field . '">' . NEWLINE; $url = site_current(); $pre = '?'; foreach ($this->preserve as $name) { //$out .= '<input type="hidden" name="' . $name . '" value="' . $cgi->{$name} . '" />' . NEWLINE; $url .= $pre . $name . '=' . urlencode($cgi->{$name}); $pre = '&'; } foreach ($cgi->param as $k) { if ($k != $this->field && strpos($k, '_') === 0 && !in_array($k, $this->ignore)) { // assume it's a facet //$out .= '<input type="hidden" name="' . $k . '" value="' . $cgi->{$k} . '" />' . NEWLINE; $url .= $pre . $k . '=' . urlencode($cgi->{$k}); $pre = '&'; } } $out = '<strong>' . intl_get($this->display) . ':</strong><br />' . NEWLINE; $c = 0; $sep = ''; foreach ($this->options as $option => $name) { $count++; if ($this->count) { $func = $this->rex->isVersioned ? 'getStoreList' : 'getList'; $c = $this->rex->{$func}(array($this->field => new rEqual($this->field, $option)), 0, 0, false, false, true); if ($c === false) { $c = '0'; } $total = ' (' . $c . ')'; } else { $total = ''; } $out .= $sep; if ($count >= 3) { $out .= '<br />'; $count = 0; } if ($cgi->{'_' . $this->field} == $option) { $out .= '<strong>'; } $out .= '<a href="' . $url . $pre . '_' . $this->field . '=' . urlencode($option) . '">' . $name . $total . '</a>'; if ($cgi->{'_' . $this->field} == $option) { $out .= '</strong>'; } $sep = ', '; } /* $out .= intl_get ($this->display) . ':' . NEWLINE . TAB . '<select name="_' . $this->field . '" onchange="this.form.submit ()">' . NEWLINE . TABx2 . '<option value="" selected="selected">- ' . intl_get ('ALL') . ' -</option>' . NEWLINE; foreach ($this->options as $option => $name) { if ($cgi->{'_' . $this->field} == $option) { $selected = ' selected="selected"'; } else { $selected = ''; } $c = $this->rex->getList (array ($this->field => new rEqual ($this->field, $option)), 0, 0, false, false, true); if ($c === false) { $c = '0'; } $out .= TABx2 . '<option value="' . $option . '"' . $selected . '>' . $name . ' (' . $c . ')</option>' . NEWLINE; } $out .= TAB . '</select>' . NEWLINE . '</form>' . NEWLINE; */ return $out; }
// be able to access directly. if (!defined('SAF_VERSION')) { header('HTTP/1.1 404 Not Found'); echo "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n" . "<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n" . "The requested URL " . $_SERVER['PHP_SELF'] . " was not found on this server.<p>\n<hr>\n" . $_SERVER['SERVER_SIGNATURE'] . "</body></html>"; exit; } // END KEEPOUT CHECKING // import any object we need from the global namespace global $errno, $cgi; // box logic begins here $errors = conf('errors'); if (!$errno) { $errno = $cgi->code; } loader_import('cms.Workflow'); echo Workflow::trigger('error', array('message' => $errno . ' ' . $errors[$errno]['title'] . ': ' . site_current() . ', referrer: ' . $_SERVER['HTTP_REFERER'])); header('HTTP/1.1 ' . $errno . ' ' . $errors[$errno]['title']); page_title($errors[$errno]['title']); switch ($errno) { case 401: echo '<p>' . intl_get('You don\'t have the permission to access the requested page.') . '</p>'; break; case 403: echo '<p>' . intl_get('You don\'t have the permission to access the requested page.') . '</p>'; break; case 404: echo '<p>' . intl_get('The page you requested could not be found.') . '</p>'; break; case 500: echo '<p>' . intl_get('The server has encountered an unknown internal error.') . '</p>'; break;
page_title('SiteInvoice - Invoices'); echo template_simple('nav.spt'); loader_import('siteinvoice.Filters'); loader_import('saf.Date'); loader_import('saf.GUI.Pager'); $q = db_query($sql); if (!$q->execute()) { $total = 0; $invoices = array(); } else { $total = $q->rows(); $invoices = $q->fetch($cgi->offset, 20); } $q->free(); $pg = new Pager($cgi->offset, 20, $total); $pg->setUrl(site_current() . '?client=%s&status=%s', $cgi->client, $cgi->status); $pg->update(); $dc = appconf('default_currency'); $exch = new Services_ExchangeRates('ECB', 'UN', 'UN', array('roundToDecimal' => 2, 'roundAutomatically' => true, 'thousandsSeparator' => '', 'decimalCharacter' => '.', 'cacheDirectory' => 'inc/app/siteinvoice/data/rates/', 'cacheLengthRates' => 86400, 'cacheLengthCurrencies' => 2592000, 'cacheLengthCountries' => 2592000)); $subtotal = 0; $taxes = 0; $total = 0; if ($cgi->status == 'unpaid') { $today = date('Y-m-d'); $thirty = Date::subtract($today, '30 day') . ' 00:00:00'; $forty_five = Date::subtract($today, '45 day') . ' 00:00:00'; $sixty = Date::subtract($today, '60 day') . ' 00:00:00'; $ninety = Date::subtract($today, '90 day') . ' 00:00:00'; foreach (array_keys($invoices) as $k) { if ($invoices[$k]->sent_on < $ninety) { $invoices[$k]->range = 90;
page_title(intl_get('Search')); } if (!empty($parameters['query'])) { loader_import('saf.GUI.Pager'); $res = $y->query($parameters['query'], $cgi->offset); if (!$res) { page_title('Search Error'); echo '<p>' . $y->error . '</p>'; return; } elseif (isset($res['Error'])) { page_title('Search Error'); echo '<p>' . $res['Error']['Message'] . '</p>'; return; } $parameters['results'] = array(); foreach ($res['ResultSet']['Result'] as $result) { $result['CacheUrl'] = $result['Cache']['Url']; $result['CacheSize'] = ysearch_filter_size($result['Cache']['Size']); $result['Title'] = ysearch_filter_title($result['Title']); $result['Title'] = search_highlight($result['Title'], $cgi->query); $result['Summary'] = search_highlight($result['Summary'], $cgi->query); $parameters['results'][] = $result; } $pg = new Pager($cgi->offset, 25, $res['ResultSet']['totalResultsAvailable']); $pg->setUrl(site_current() . '?query=%s&site=%s', $parameters['query'], $parameters['site']); $pg->getInfo(); template_simple_register('pager', $pg); echo template_simple('search_results.spt', $parameters); } else { echo template_simple('search_form.spt'); }
$res = array($res); } $tables = array(); foreach ($res as $row) { $tables[] = $row->{array_shift(array_keys(get_object_vars($row)))}; } if (in_array($cgi->table . '_sv', $tables) || preg_match('/_sv$/', $cgi->table)) { echo '<p style="color: #900; font-weight: bold">' . intl_get('Warning: Modifying this table directly could cause strange behaviour and even errors in the software.') . '</p>'; } loader_import('saf.GUI.Pager'); loader_import('saf.Misc.TableHeader'); if (!isset($cgi->offset)) { $cgi->offset = 0; } $pg = new Pager($cgi->offset); $pg->url = site_current() . '?table=' . urlencode($cgi->table) . '&orderBy=' . urlencode($cgi->orderBy) . '&sort=' . urlencode($cgi->sort); // build query $sql = 'select * from ' . $cgi->table; if ($cgi->orderBy) { $sql .= ' order by ' . $cgi->orderBy; if ($cgi->sort) { $sql .= ' ' . $cgi->sort; } } // execute $res = $pg->query($sql); if ($res === false) { die($pg->error); } $tbl = db_table($cgi->table); $tbl->getInfo();
if (!isset($cgi->orderBy)) { if (isset($rex->info['Collection']['order_by'])) { $cgi->orderBy = $rex->info['Collection']['order_by']; } else { $cgi->orderBy = $rex->info['Collection']['title_field']; } } if (!isset($cgi->sort)) { if (isset($rex->info['Collection']['sorting_order'])) { $cgi->sort = $rex->info['Collection']['sorting_order']; } else { $cgi->sort = 'asc'; } } $pg = new Pager($cgi->offset, $limit); $pg->url = site_current() . '?collection=' . urlencode($cgi->collection) . '&orderBy=' . urlencode($cgi->orderBy) . '&sort=' . urlencode($cgi->sort); $data['facet_url'] = ''; foreach ($cgi->param as $p) { if (strpos($p, '_') === 0 && $p != '_msg') { $data['facet_url'] .= '&' . $p . '=' . urlencode($cgi->{$p}); } } $pg->url .= $data['facet_url']; $data['return'] = $pg->url; // build column headers $struct = array_keys($rex->getStruct()); $acl = array(); if (!$struct) { $struct = array(); } else { $acl_list = session_allowed_access_list();
$pg->update(); function pretty_date($date) { loader_import('saf.Date'); return Date::timestamp($date, 'M j, Y - g:ia'); } $cur = $rex->getCurrent($cgi->_key); if (!$cur) { $title = $cgi->_key; } else { $title = $cur->{$rex->info['Collection']['title_field']}; } if (!session_allowed('approved', 'w', 'status')) { //isset ($cur->sitellite_access) && ! session_allowed ($cur->sitellite_access, 'w', 'access')) { $editable = false; } elseif (isset($cur->sitellite_access) && !session_allowed($cur->sitellite_access, 'w', 'access')) { $editable = false; } elseif (isset($cur->sitellite_status) && !session_allowed($cur->sitellite_status, 'w', 'status')) { $editable = false; } elseif (isset($cur->sitellite_team) && !session_allowed($cur->sitellite_team, 'w', 'team')) { $editable = false; } else { $editable = true; } if ($cgi->offset == 0) { $cgi->_current = $history[0]->sv_autoid; } $pg->url = site_current() . '?_collection=' . urlencode($cgi->_collection) . '&_key=' . urlencode($cgi->_key) . '&_return=' . urlencode($cgi->_return) . '&_current=' . urlencode($cgi->_current); page_title(intl_get('Change History') . ': ' . $rex->info['Collection']['display'] . ' / ' . $title); template_simple_register('pager', $pg); echo template_simple('history.spt', array('history' => $history, 'current' => $cgi->_current, 'editable' => $editable));
$upkey = $res[$key - 1]->id; $downkey = ''; } else { $up = true; $down = true; $upkey = $res[$key - 1]->id; $downkey = $res[$key + 1]->id; } //if (session_admin ()) { // echo '<div class="scm-sidebar scm-status-' . str_replace (array (' ', '_'), array ('-', '-'), $row->sitellite_status) . '" id="scm-sidebar-' . str_replace ('_', '-', $row->id) . '">'; //} else { echo '<div class="scm-sidebar" id="scm-sidebar-' . str_replace('_', '-', $row->id) . '">'; //} if (session_admin()) { $GLOBALS['scm_sidebar_body'] = $row->body; $buttons = loader_box('cms/buttons', array('collection' => 'sitellite_sidebar', 'id' => $row->id, 'status' => $row->sitellite_status, 'access' => $row->sitellite_access, 'team' => $row->sitellite_team, 'add' => false, 'float' => true, 'up' => $up, 'down' => $down, 'upkey' => $upkey, 'downkey' => $downkey, 'return' => site_current())); $row->body = $GLOBALS['scm_sidebar_body']; } else { $buttons = ''; } if (!empty($row->alias)) { if (strstr($row->alias, '?')) { $parts = parse_url('box://' . site_domain() . '/' . $row->alias); $boxname = substr($parts['path'], 1); parse_str($parts['query'], $params); } else { $boxname = $row->alias; $params = array(); } $out = loader_box($boxname, $params, 'sidebar'); if (!empty($out)) {
$parameters['float'] = true; } if (!isset($parameters['align'])) { $parameters['align'] = 'right'; } elseif ($parameters['align'] == 'false') { $parameters['align'] = false; } if (!isset($parameters['inline'])) { $parameters['inline'] = false; } else { $parameters['inline'] = true; } if (!isset($parameters['return']) && $parameters['collection'] == 'sitellite_page') { $parameters['return'] = site_current(); } $parameters['return_v1'] = site_current(); loader_import('cms.Workflow.Lock'); lock_init(); if (lock_exists($parameters['collection'], $parameters['id'])) { $parameters['editable'] = false; $lock_info = lock_info($parameters['collection'], $parameters['id']); $parameters['lock_owner'] = $lock_info->user; $parameters['lock_expires'] = $lock_info->expires; loader_import('cms.Filters'); } if (session_is_resource('delete') && !session_allowed('delete', 'rw', 'resource')) { $parameters['deletable'] = false; } if ($rex->isVersioned && $parameters['editable']) { //session_allowed ('approved', 'w', 'status')) { $parameters['history'] = true;
function draw() { global $cgi; if (!isset($cgi->orderBy)) { $cgi->orderBy = array_shift(array_keys($this->fields)); } if (!isset($cgi->sort)) { $cgi->sort = 'asc'; } if (!isset($cgi->offset)) { $cgi->offset = 0; } $list = $this->getList(); if (!$list) { return false; } if (!$this->primary_key) { $this->primary_key = array_shift(array_keys($this->fields)); } $this->list = array(); foreach ($list as $row) { if (!is_object($row)) { $row = (object) $row; } $this->list[$row->{$this->primary_key}] = $row; } $pg = new Pager($cgi->offset, $this->limit, $this->total); $pg->setUrl(site_current() . '?orderBy=%s&sort=%s' . $this->rememberParams(), $cgi->orderBy, $cgi->sort); $pg->getInfo(); $headers = array(); foreach ($this->fields as $name => $display) { $headers[$name] = new TableHeader($name, $display); } $this->headers =& $headers; $this->first_field = array_shift(array_keys($this->fields)); template_simple_register('pager', $pg); return template_simple($this->template, $this); }
/** * Constructor Method. Action will be set to $PHP_SELF if it * is empty, unless a global $site object is defined in which case the * action with be $site->url . $PHP_SELF. * * @access public * @param string $action * @param string $method * */ function MailForm($action = '', $method = 'post') { $this->method = $method; if (empty($action)) { if (function_exists('site_current')) { $action = site_current(); } else { global $_SERVER; $action = $_SERVER['PHP_SELF']; } /*if (is_object ($GLOBALS['site'])) { global $site; $action = $site->url . $action; }*/ } $this->action = $action; $GLOBALS['loader']->import('saf.MailForm.Widget'); // set up the $_attrs list $this->_attrs['action'] =& $this->action; $this->_attrs['method'] =& $this->method; $this->name = false; $this->_attrs['name'] =& $this->name; $this->handler = array(&$this, 'onSubmit'); // attempt to automatically parse the settings.php file $cls = strtolower(get_class($this)); if ($cls != 'mailform') { if (function_exists('site_current')) { $this->action = site_current(); } else { $this->action = $_SERVER['PHP_SELF']; } $this->_attrs['action'] =& $this->action; $app = loader_app(); if (strpos($action, ':') === 1) { $action = str_replace('\\', '/', $action); } list($misc, $path) = explode($app . '/forms/', $action); $box = dirname($path); if (@file_exists('inc/app/' . $app . '/forms/' . $box . '/settings.php')) { $this->parseSettings('inc/app/' . $app . '/forms/' . $box . '/settings.php'); } } }
<?php global $cgi; if (!isset($cgi->offset)) { $cgi->offset = 0; } $q = db_query('select * from siteinvoice_client order by name asc'); if (!$q->execute()) { $total = 0; $clients = array(); } else { $total = $q->rows(); $clients = $q->fetch($cgi->offset, 20); } $q->free(); loader_import('saf.GUI.Pager'); $pg = new Pager($cgi->offset, 20, $total); $pg->setUrl(site_current() . '?'); $pg->update(); page_title('SiteInvoice - Clients (' . count($clients) . ')'); echo template_simple('nav.spt'); template_simple_register('pager', $pg); echo template_simple('clients.spt', array('clients' => $clients));