本文整理汇总了PHP中SPFactory::mainframe方法的典型用法代码示例。如果您正苦于以下问题:PHP SPFactory::mainframe方法的具体用法?PHP SPFactory::mainframe怎么用?PHP SPFactory::mainframe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPFactory
的用法示例。
在下文中一共展示了SPFactory::mainframe方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
protected function save()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
$id = SPRequest::cmd('filter_id');
if ($id) {
$this->validate('field.filter', 'filter');
$filters = $this->getFilters();
$name = SPRequest::string('filter_name', 'Filter Name');
$msg = str_replace(array("\n", "\t", "\r"), null, SPLang::clean(SPRequest::string('filter_message', 'The data entered in the $field field contains not allowed characters')));
$regex = SPLang::clean(SPRequest::raw('filter_regex', '/^[\\.*]+$/'));
$regex = str_replace('[:apostrophes:]', '\\"' . "\\'", $regex);
$regex = base64_encode(str_replace(array("\n", "\t", "\r"), null, $regex));
$custom = 'custom';
if (isset($filters[$id]) && !strlen($filters[$id]['options'])) {
$regex = $filters[$id]['params'];
$custom = null;
}
$filters[$id] = array('params' => $regex, 'key' => $id, 'value' => $name, 'description' => $msg, 'options' => $custom);
SPFactory::registry()->saveDBSection($filters, 'fields_filter');
$this->response(Sobi::Url('filter'), Sobi::Txt('FLR.MSG_FILTER_SAVED'), false, 'success');
} else {
$this->response(Sobi::Url('filter'), SPLang::e('FILTER_NOT_FOUND'), true, SPC::ERROR_MSG);
}
}
示例2: execute
/**
*/
public function execute()
{
SPFactory::mainframe()->cleanBuffer()->customHeader();
if (SPFs::exists($this->file)) {
echo SPFs::read($this->file);
} else {
echo json_encode(array('progress' => 0, 'message' => '', 'interval' => 100, 'type' => ''));
}
exit;
}
示例3: view
/**
*/
protected function view()
{
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
/* load template config */
$this->template();
$this->tplCfg($tplPackage);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
$cInLine = $this->tKey($this->template, 'categories_in_line', Sobi::Cfg('list.categories_in_line', 2));
$cLim = $this->tKey($this->template, 'categories_limit', -1);
$entriesRecursive = $this->tKey($this->template, 'entries_recursive', Sobi::Cfg('list.entries_recursive', false));
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
/* get the right ordering */
$eOrder = $this->parseOrdering('entries', 'eorder', $this->tKey($this->template, 'entries_ordering', Sobi::Cfg('list.entries_ordering', 'name.asc')));
$cOrder = $this->parseOrdering('categories', 'corder', $this->tKey($this->template, 'categories_ordering', Sobi::Cfg('list.categories_ordering', 'name.asc')));
$orderings = array('entries' => $eOrder, 'categories' => $cOrder);
/* get entries */
$eCount = count($this->getEntries($eOrder, 0, 0, true, null, $entriesRecursive));
$entries = $this->getEntries($eOrder, $eLimit, $eLimStart, false, null, $entriesRecursive);
$categories = array();
if ($cLim) {
$categories = $this->getCats($cOrder, $cLim);
}
/* create page navigation */
$url = array('sid' => SPRequest::sid(), 'title' => Sobi::Cfg('sef.alias', true) ? $this->_model->get('nid') : $this->_model->get('name'));
if (SPRequest::cmd('sptpl')) {
$url['sptpl'] = SPRequest::cmd('sptpl');
}
$pnc = SPLoader::loadClass('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'));
/* @var SPPageNavXSLT $pn */
$pn = new $pnc($eLimit, $eCount, $site, array('sid' => SPRequest::sid(), 'title' => Sobi::Cfg('sef.alias', true) ? $this->_model->get('nid') : $this->_model->get('name')));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
/* add pathway */
SPFactory::mainframe()->addObjToPathway($this->_model, array(ceil($eCount / $eLimit), $site));
$this->_model->countVisit();
/* get view class */
// $class = SPLoader::loadView( $this->_type );
$view = SPFactory::View($this->_type);
// $view = new $class( $this->template );
$view->assign($eLimit, '$eLimit')->assign($eLimStart, '$eLimStart')->assign($eCount, '$eCount')->assign($cInLine, '$cInLine')->assign($eInLine, '$eInLine')->assign($this->_task, 'task')->assign($this->_model, $this->_type)->setConfig($this->_tCfg, $this->template)->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template)->assign($categories, 'categories')->assign($pn->get(), 'navigation')->assign(SPFactory::user()->getCurrent(), 'visitor')->assign($entries, 'entries')->assign($orderings, 'orderings');
Sobi::Trigger($this->name(), 'View', array(&$view));
$view->display($this->_type);
}
示例4: save
protected function save()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
$data = SPRequest::string('bankdata', null, true);
$data = array('key' => 'bankdata', 'value' => $data, 'type' => 'application', 'id' => Sobi::Section(), 'section' => Sobi::Section());
try {
SPLang::saveValues($data);
} catch (SPException $x) {
$message = SPLang::e('DB_REPORTS_ERR', $x->getMessage());
Sobi::Error('SPPaymentBt', $message, SPC::WARNING, 0, __LINE__, __FILE__);
$this->response(Sobi::Back(), $message, false, 'error');
}
$this->response(Sobi::Back(), Sobi::Txt('MSG.ALL_CHANGES_SAVED'), false, 'success');
}
示例5: js
protected function js()
{
$lang = SPLang::jsLang(true);
if (count($lang)) {
foreach ($lang as $term => $text) {
unset($lang[$term]);
$term = str_replace('SP.JS_', null, $term);
$lang[$term] = $text;
}
}
if (!SPRequest::int('deb')) {
SPFactory::mainframe()->cleanBuffer();
header('Content-type: text/javascript');
}
echo 'SobiPro.setLang( ' . json_encode($lang) . ' );';
exit;
}
示例6: save
protected function save()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
$this->validate('extensions.paypal', array('task' => 'paypal', 'pid' => Sobi::Section()));
SPFactory::registry()->saveDBSection(array(array('key' => 'ppurl', 'value' => SPRequest::string('ppurl')), array('key' => 'ppemail', 'value' => SPRequest::string('ppemail')), array('key' => 'ppcc', 'value' => SPRequest::string('ppcc')), array('key' => 'pprurl', 'value' => SPRequest::string('pprurl'))), 'paypal_' . Sobi::Section());
$data = array('key' => 'ppexpl', 'value' => SPRequest::string('ppexpl', null, true), 'type' => 'application', 'id' => Sobi::Section(), 'section' => Sobi::Section());
try {
SPLang::saveValues($data);
$data['key'] = 'ppsubject';
$data['value'] = SPRequest::string('ppsubject', true);
SPLang::saveValues($data);
} catch (SPException $x) {
$message = SPLang::e('DB_REPORTS_ERR', $x->getMessage());
Sobi::Error('SPPaymentBt', $message, SPC::WARNING, 0, __LINE__, __FILE__);
$this->response(Sobi::Back(), $message, false, 'error');
}
$this->response(Sobi::Back(), Sobi::Txt('MSG.ALL_CHANGES_SAVED'), false, 'success');
}
示例7: download
private function download()
{
$Error = new DOMDocument('1.0', 'utf-8');
$Error->formatOutput = true;
$Root = $Error->createElement('errorLog');
$Date = $Error->createAttribute('createdAt');
$Date->appendChild($Error->createTextNode(date(DATE_RFC822)));
$Root->appendChild($Date);
$Site = $Error->createAttribute('site');
$Site->appendChild($Error->createTextNode(Sobi::Cfg('live_site')));
$Root->appendChild($Site);
$Error->appendChild($Root);
$levels = $this->levels();
try {
$errors = SPFactory::db()->select('*', 'spdb_errors', null, 'eid.desc')->loadAssocList();
} catch (SPException $x) {
}
$c = 0;
if (count($errors)) {
foreach ($errors as $i => $err) {
$c++;
if ($c > Sobi::Cfg('err_log.limit', 50)) {
break;
}
$err['errNum'] = $levels[$err['errNum']];
$Err = $Error->createElement('error');
$Date = $Error->createAttribute('date');
$Date->appendChild($Error->createTextNode($err['date']));
$Err->appendChild($Date);
$Level = $Error->createAttribute('level');
$Level->appendChild($Error->createTextNode($err['errNum']));
$Err->appendChild($Level);
$Code = $Error->createAttribute('returnCode');
$Code->appendChild($Error->createTextNode($err['errCode']));
$Err->appendChild($Code);
$Section = $Error->createAttribute('section');
$Section->appendChild($Error->createTextNode($err['errSect']));
$Err->appendChild($Section);
$err['errBacktrace'] = unserialize(gzuncompress(base64_decode($err['errBacktrace'])));
$err['errBacktrace'] = str_replace(SOBI_ROOT, null, $err['errBacktrace']);
$err['errMsg'] = str_replace(SOBI_ROOT, null, $err['errMsg']);
$err['errCont'] = unserialize(gzuncompress(base64_decode($err['errCont'])));
$err['errCont'] = str_replace(SOBI_ROOT, null, $err['errCont']);
$ErrMsg = $Error->createElement('message', $err['errMsg']);
$Err->appendChild($ErrMsg);
$ErrMsg = $Error->createElement('file', $err['errFile'] . ':' . $err['errLine']);
$Err->appendChild($ErrMsg);
$ErrUser = $Error->createElement('user');
$Uid = $Error->createAttribute('uid');
$Uid->appendChild($Error->createTextNode($err['errUid']));
$ErrUser->appendChild($Uid);
$UsrIp = $Error->createElement('ip', $err['errIp']);
$ErrUser->appendChild($UsrIp);
$UsrA = $Error->createElement('userAgent', $err['errUa']);
$ErrUser->appendChild($UsrA);
$UsrReq = $Error->createElement('requestedUri', htmlentities($err['errReq']));
$ErrUser->appendChild($UsrReq);
$UsrRef = $Error->createElement('referrerUri', str_replace(Sobi::Cfg('live_site'), null, htmlentities($err['errRef'])));
$ErrUser->appendChild($UsrRef);
$Err->appendChild($ErrUser);
$ErrStack = $Error->createElement('callStack');
$ErrStack->appendChild($Error->createCDATASection("\n" . stripslashes(var_export($err['errCont'], true)) . "\n"));
$Err->appendChild($ErrStack);
$ErrTrace = $Error->createElement('callTrace');
$ErrTrace->appendChild($Error->createCDATASection("\n" . stripslashes(var_export($err['errBacktrace'], true)) . "\n"));
$Err->appendChild($ErrTrace);
$Root->appendChild($Err);
}
}
$file = SPLoader::path('var.log.errors', 'front', false, 'xml');
SPFs::write($file, $Error->saveXML());
$fp = SPFs::read($file);
SPFactory::mainframe()->cleanBuffer();
header("Content-type: application/xml");
header('Content-Disposition: attachment; filename=error.xml');
echo $fp;
flush();
exit;
}
示例8: userSelector
public static function userSelector($name, $value, $groups = null, $params = null, $icon = 'user', $header = 'USER_SELECT_HEADER', $format = '%user', $orderBy = 'id')
{
static $count = 0;
static $session = null;
if (!$session) {
$session = SPFactory::user()->getUserState('userSelector', null, array());
}
$params = self::checkArray($params);
if (!isset($params['id'])) {
$params['id'] = SPLang::nid($name);
}
$user = null;
SPFactory::header()->addJsFile('user_selector');
$user = SPUser::getBaseData((int) $value);
$settings = array('groups' => $groups, 'format' => $format, 'user' => Sobi::My('id'), 'ordering' => $orderBy, 'time' => microtime(true));
if (count($session)) {
foreach ($session as $id => $data) {
if (microtime(true) - $data['time'] > 3600) {
unset($session[$id]);
}
}
}
$ssid = md5(microtime() . Sobi::My('id') . ++$count);
$session[$ssid] =& $settings;
SPFactory::user()->setUserState('userSelector', $session);
$userData = null;
if ($user) {
$replacements = array();
preg_match_all('/\\%[a-z]*/', $format, $replacements);
$placeholders = array();
if (isset($replacements[0]) && count($replacements[0])) {
foreach ($replacements[0] as $placeholder) {
$placeholders[] = str_replace('%', null, $placeholder);
}
}
if (count($replacements)) {
foreach ($placeholders as $attribute) {
if (isset($user->{$attribute})) {
$format = str_replace('%' . $attribute, $user->{$attribute}, $format);
}
}
$userData = $format;
}
}
$modal = '<div class="response btn-group" data-toggle="buttons-radio"></div><br/><button class="btn btn-block hide more" type="button">' . Sobi::Txt('LOAD_MORE') . '</button>';
$filter = '<input type="text" placeholder="' . Sobi::Txt('FILTER') . '" class="search pull-right spDisableEnter" name="q">';
$id = $params['id'];
$params = self::params($params);
$f = "\n";
$f .= '<div class="spUserSelector">';
$f .= '<div class="input-append">';
$f .= "\n\t";
$f .= '<input type="text" value="' . $userData . '" ' . $params . ' name="' . $name . 'Holder" readonly="readonly" class="trigger user-name"/>';
$f .= '<span class="add-on trigger"><i class="icon-' . $icon . '"></i></span>';
$f .= '</div>';
$f .= '<input type="hidden" value="' . $value . '" name="' . $name . '" rel="selected"/>';
$f .= '<input type="hidden" value="' . $ssid . '" name="' . $name . 'Ssid"/>';
$f .= '<input type="hidden" value="1" name="' . SPFactory::mainframe()->token() . '"/>';
$f .= "\n\t";
$f .= "\n";
$f .= self::modalWindow(Sobi::Txt($header) . $filter, $id . '-window', $modal);
$f .= '</div>';
$f .= "\n";
Sobi::Trigger('Field', ucfirst(__FUNCTION__), array(&$f));
return "\n<!-- User Picker '{$name}' Output -->{$f}<!-- User Picker '{$name}' End -->\n\n";
}
示例9: download
private function download()
{
// $file = SPLoader::path( 'tmp.info', 'front', false, 'txt' );
$cont = null;
$settings = array();
$settings['SobiPro'] = array('Version' => SPFactory::CmsHelper()->myVersion(true), 'Version_Num' => implode('.', SPFactory::CmsHelper()->myVersion()));
$file = SPLoader::path('tmp.info', 'front', false, 'txt');
// if ( SPFs::exists( $file ) ) {
// $cont = SPFs::read( $file );
// }
// $cont = explode( "\n", $cont );
// if ( count( $cont ) ) {
// foreach ( $cont as $line ) {
// if ( strstr( $line, '=' ) ) {
// $line = explode( "=", $line );
// $line[ 1 ] = explode( ';', $line[ 1 ] );
// $settings[ $line[ 0 ] ] = array( 'key' => $line[ 0 ], 'response' => $line[ 1 ][ 0 ], 'status' => $line[ 1 ][ 1 ] );
// }
// }
// }
$this->prepareStoredData($settings);
$settings['env'] = array('PHP_OS' => PHP_OS, 'php_uname' => php_uname(), 'PHP_VERSION_ID' => PHP_VERSION_ID);
$settings['ftp'] = $this->ftp();
$settings['curl'] = $this->curlFull();
$settings['exec']['response'] = $this->execResp();
$settings['SOBI_SETTINGS'] = SPFactory::config()->getSettings();
$c = SPFactory::db()->select('*', 'spdb_config')->loadObjectList();
$sections = SPFactory::db()->select(array('nid', 'id'), 'spdb_object', array('oType' => 'section'))->loadAssocList('id');
$as = array();
foreach ($c as $key) {
if ($key->section == 0 || !isset($sections[$key->section])) {
continue;
}
$key->section = $sections[$key->section]['nid'];
if (!isset($as[$key->section])) {
$as[$key->section] = array();
}
if (!isset($as[$key->section][$key->cSection])) {
$as[$key->section][$key->cSection] = array();
}
$_c = explode('_', $key->sKey);
if ($_c[count($_c) - 1] == 'array') {
$key->sValue = SPConfig::unserialize($key->sValue);
}
$as[$key->section][$key->cSection][$key->sKey] = $key->sValue;
}
$settings['SOBI_SETTINGS']['sections'] = $as;
$apps = SPFactory::db()->select('*', 'spdb_plugins')->loadObjectList();
foreach ($apps as $app) {
$settings['Apps'][$app->pid] = get_object_vars($app);
}
$settings['SOBI_SETTINGS']['mail']['smtphost'] = $settings['SOBI_SETTINGS']['mail']['smtphost'] ? 'SET' : 0;
$settings['SOBI_SETTINGS']['mail']['smtpuser'] = $settings['SOBI_SETTINGS']['mail']['smtpuser'] ? 'SET' : 0;
$settings['SOBI_SETTINGS']['mail']['smtppass'] = $settings['SOBI_SETTINGS']['mail']['smtppass'] ? 'SET' : 0;
$php = ini_get_all();
unset($php['extension_dir']);
unset($php['include_path']);
unset($php['mysql.default_user']);
unset($php['mysql.default_password']);
unset($php['mysqli.default_pw']);
unset($php['mysqli.default_user']);
unset($php['open_basedir']);
unset($php['pdo_mysql.default_socket']);
unset($php['sendmail_path']);
unset($php['session.name']);
unset($php['session.save_path']);
unset($php['soap.wsdl_cache_dir']);
unset($php['upload_tmp_dir']);
unset($php['doc_root']);
unset($php['docref_ext']);
unset($php['docref_root']);
unset($php['mysql.default_socket']);
$settings['PHP_SETTINGS'] = $php;
$php = get_loaded_extensions();
$settings['PHP_EXT'] = $php;
$out = SPFactory::Instance('types.array');
$data = $out->toXML($settings, 'settings');
$data = str_replace(array(SOBI_ROOT, '></'), array('REMOVED', '>0</'), $data);
$f = SPLang::nid($settings['SOBI_SETTINGS']['general']['site_name'] . '-' . date(DATE_RFC822));
SPFactory::mainframe()->cleanBuffer();
header('Cache-Control: no-cache, must-revalidate');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
header("Content-type: application/xml");
header("Content-Disposition: attachment; filename=\"sobipro_system_{$f}.xml\"");
header('Content-Length: ' . strlen($data));
ob_clean();
flush();
echo $data;
exit;
}
示例10: ajaxResponse
protected function ajaxResponse($ajax, $message, $redirect, $type, $callback = 'SPExtensionInstaller')
{
if ($ajax) {
if ($redirect) {
SPFactory::message()->setMessage($message, false, $type);
}
$response = array('type' => $type, 'text' => $message, 'redirect' => $redirect ? Sobi::Url('extensions.installed') : false, 'callback' => $type == SPC::SUCCESS_MSG ? $callback : false);
SPFactory::mainframe()->cleanBuffer()->customHeader();
echo json_encode($response);
exit;
} elseif ($redirect) {
SPFactory::message()->setMessage($message, false, $type);
Sobi::Redirect(Sobi::Url('extensions.installed'));
} else {
return array('msg' => $message, 'msgtype' => $type);
}
}
示例11: ProxyDependency
/**
* */
public function ProxyDependency()
{
$path = json_decode(Sobi::Clean(SPRequest::string('path')), true);
$values = $this->loadDependencyDefinition($path);
SPFactory::mainframe()->cleanBuffer()->customHeader();
exit(json_encode(array('options' => $values, 'path' => json_encode($path))));
}
示例12: execute
/**
* Executes the controller task
* @return void
*/
public function execute()
{
try {
if (is_array($this->_ctrl)) {
foreach ($this->_ctrl as &$c) {
$c->execute();
}
} else {
if ($this->_ctrl instanceof SPControl) {
$this->_ctrl->execute();
} else {
Sobi::Error('CoreCtrl', SPLang::e('No controller to execute'), SPC::ERROR, 500, __LINE__, __FILE__);
}
}
} catch (SPException $x) {
Sobi::Error('CoreCtrl', SPLang::e('No controller to execute %s', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
// Sobi::Error( 'CoreCtrl', SPLang::e( 'No controller to execute. %s', $x->getMessage() ), SPC::WARNING, 0, __LINE__, __FILE__ );
// Sobi::Redirect( Sobi::GetUserState( 'back_url', Sobi::Url() ), $x->getMessage(), SPC::ERROR_MSG );
}
/* send header data etc ...*/
SPFactory::header()->send();
SPFactory::mainframe()->endOut();
/* redirect if any redirect has been set */
SPFactory::mainframe()->redirect();
error_reporting($this->_deb);
restore_error_handler();
}
示例13: view
protected function view()
{
/* determine template package */
$tplPckg = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
$this->_task = 'alpha';
if (!$this->_model) {
$this->setModel('section');
$this->_model->init(Sobi::Section());
}
$this->visible();
/* load template config */
$this->template();
$this->tplCfg($tplPckg);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
$eCount = count($this->getEntries(0, 0, true));
$entries = $this->getEntries($eLimit, $site);
$compare = $this->_field ? $this->_field : $this->_nid;
if (strlen($compare) && $compare != Sobi::Cfg('alphamenu.primary_field')) {
$t = 'list.alpha.' . strtolower($this->_letter) . '.' . $this->_nid;
} else {
$t = 'list.alpha.' . strtolower($this->_letter);
}
$pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, array('sid' => SPRequest::sid(), 'task' => $t));
$cUrl = array('sid' => SPRequest::sid(), 'task' => $t);
if (SPRequest::int('site', 0)) {
$cUrl['site'] = SPRequest::int('site', 0);
}
SPFactory::header()->addCanonical(Sobi::Url($cUrl, true, true, true));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
$letter = urldecode(SPRequest::cmd('letter'));
/* add pathway */
if (!$this->_fieldType) {
SPFactory::mainframe()->addToPathway(Sobi::Txt('AL.PATH_TITLE', array('letter' => $letter)), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('AL.TITLE', array('letter' => $letter, 'section' => $this->_model->get('name'))), array(ceil($eCount / $eLimit), $site));
} else {
$field = SPFactory::Model('field');
$field->init($this->_field);
SPFactory::mainframe()->addToPathway(Sobi::Txt('AL.PATH_TITLE_FIELD', array('letter' => $letter, 'field' => $field->get('name'))), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('AL.TITLE_FIELD', array('letter' => $letter, 'section' => $this->_model->get('name'), 'field' => $field->get('name'))), array(ceil($eCount / $eLimit), $site));
}
/* get view class */
$view = SPFactory::View('listing');
$view->assign($eLimit, '$eLimit');
$view->assign($eLimStart, '$eLimStart');
$view->assign($eCount, '$eCount');
$view->assign($eInLine, '$eInLine');
$view->assign($this->_task, 'task');
$view->assign($this->_model, 'section');
$view->assign(Sobi::Txt('AL.PATH_TITLE', array('letter' => $this->_letter)), 'listing_name');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPckg . '.' . $this->templateType . '.' . $this->template);
$view->assign($pn->get(), 'navigation');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($entries, 'entries');
Sobi::Trigger('AlphaListing', 'View', array(&$view));
$view->display();
}
示例14: Init
/**
* @deprecated since 1.1 replaced by {@link #Initialise()}
* @param int $sid - section id
* @param null $root - root of Joomla!
* @param null $lang - language
* @return null
*/
public static function Init($root = null, $lang = null, $sid = 0)
{
static $loaded = false;
if (!$loaded) {
if (!defined('SOBI_CMS')) {
define('SOBI_CMS', version_compare(JVERSION, '3.0.0', 'ge') ? 'joomla3' : (version_compare(JVERSION, '1.6.0', 'ge') ? 'joomla16' : 'joomla15'));
}
defined('SOBIPRO') || define('SOBIPRO', true);
defined('SOBI_TASK') || define('SOBI_TASK', 'task');
defined('SOBI_DEFLANG') || define('SOBI_DEFLANG', $lang);
defined('SOBI_ACL') || define('SOBI_ACL', 'front');
defined('SOBI_ROOT') || define('SOBI_ROOT', $root);
defined('SOBI_MEDIA') || define('SOBI_MEDIA', implode('/', array($root, 'media', 'sobipro')));
defined('SOBI_PATH') || define('SOBI_PATH', SOBI_ROOT . '/components/com_sobipro');
defined('SOBI_LIVE_PATH') || define('SOBI_LIVE_PATH', 'components/com_sobipro');
require_once SOBI_PATH . '/lib/base/fs/loader.php';
SPLoader::loadController('sobipro');
SPLoader::loadController('interface');
SPLoader::loadClass('base.exception');
SPLoader::loadClass('base.const');
SPLoader::loadClass('base.object');
SPLoader::loadClass('base.filter');
SPLoader::loadClass('base.request');
SPLoader::loadClass('cms.base.lang');
SPLoader::loadClass('models.dbobject');
SPLoader::loadClass('base.factory');
SPLoader::loadClass('base.config');
SPLoader::loadClass('cms.base.fs');
// in case it is a CLI call
if (isset($_SERVER['REQUEST_URI'])) {
SPFactory::config()->set('live_site', JURI::root());
}
$loaded = true;
}
if ($sid) {
$section = null;
if ($sid) {
$path = array();
$id = $sid;
$path[] = (int) $id;
while ($id > 0) {
try {
$id = SPFactory::db()->select('pid', 'spdb_relations', array('id' => $id))->loadResult();
if ($id) {
$path[] = (int) $id;
}
} catch (SPException $x) {
Sobi::Error('ExtCoreCtrl', SPLang::e('DB_REPORTS_ERR', $x->getMessage()), SPC::ERROR, 500, __LINE__, __FILE__);
}
}
$path = array_reverse($path);
$section = SPFactory::object($path[0]);
}
/* set current section in the registry */
SPFactory::registry()->set('current_section', $section->id);
$_config =& SPFactory::config();
/* load basic configuration settings */
$_config->addIniFile('etc.config', true);
$_config->addTable('spdb_config', $sid);
/* initialise interface config setting */
SPFactory::mainframe()->getBasicCfg();
/* initialise config */
$_config->init();
}
}
示例15: view
protected function view()
{
/* determine template package */
$tplPackage = Sobi::Cfg('section.template', SPC::DEFAULT_TEMPLATE);
Sobi::ReturnPoint();
$this->_task = 'user';
if (!$this->_model) {
$this->setModel('section');
$this->_model->init(Sobi::Section());
}
$this->visible();
/* load template config */
$this->template();
$this->tplCfg($tplPackage);
/* get limits - if defined in template config - otherwise from the section config */
$eLimit = $this->tKey($this->template, 'entries_limit', Sobi::Cfg('list.entries_limit', 2));
$eInLine = $this->tKey($this->template, 'entries_in_line', Sobi::Cfg('list.entries_in_line', 2));
$url = array('sid' => SPRequest::sid(), 'task' => 'list.user');
if (SPRequest::int('uid')) {
$url['uid'] = SPRequest::int('uid');
$this->uid = (int) SPRequest::int('uid');
} else {
$this->uid = (int) Sobi::My('id');
}
$this->user = SPJoomlaUser::getBaseData((int) $this->uid);
if (!$this->user) {
throw new SPException(SPLang::e('UNAUTHORIZED_ACCESS'));
}
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLimStart = ($site - 1) * $eLimit;
$eOrder = $this->parseOrdering('entries', 'eorder', $this->tKey($this->template, 'entries_ordering', Sobi::Cfg('list.entries_ordering', 'name.asc')));
$eCount = count($this->getEntries($eOrder, 0, 0, true, array('spo.owner' => $this->uid), true, Sobi::Section()));
$entries = $this->getEntries($eOrder, $eLimit, $eLimStart, true, array('spo.owner' => $this->uid), true, Sobi::Section());
// $eCount = count( $this->_getEntries( 0, 0, true ) );
// $entries = $this->_getEntries( $eLimit, $site );
$pn = SPFactory::Instance('helpers.pagenav_' . $this->tKey($this->template, 'template_type', 'xslt'), $eLimit, $eCount, $site, $url);
if (SPRequest::int('site', 0)) {
$url['site'] = SPRequest::int('site', 0);
}
SPFactory::header()->addCanonical(Sobi::Url($url, true, true, true));
/* handle meta data */
SPFactory::header()->objMeta($this->_model);
SPFactory::mainframe()->addToPathway(Sobi::Txt('UL.PATH_TITLE', array('username' => $this->user->username, 'user' => $this->user->name)), Sobi::Url('current'));
SPFactory::header()->addTitle(Sobi::Txt('UL.TITLE', array('username' => $this->user->username, 'user' => $this->user->name, 'section' => $this->_model->get('name'))), array(ceil($eCount / $eLimit), $site));
/* add pathway */
/* get view class */
$view = SPFactory::View('listing');
$view->assign($eLimit, '$eLimit');
$view->assign($eLimStart, '$eLimStart');
$view->assign($eCount, '$eCount');
$view->assign($eInLine, '$eInLine');
$view->assign($this->_task, 'task');
$view->assign($this->_model, 'section');
$view->setConfig($this->_tCfg, $this->template);
$view->setTemplate($tplPackage . '.' . $this->templateType . '.' . $this->template);
$view->assign($pn->get(), 'navigation');
$view->assign(SPFactory::user()->getCurrent(), 'visitor');
$view->assign($entries, 'entries');
Sobi::Trigger('UserListing', 'View', array(&$view));
$view->display();
}