本文整理汇总了PHP中Sobi::Error方法的典型用法代码示例。如果您正苦于以下问题:PHP Sobi::Error方法的具体用法?PHP Sobi::Error怎么用?PHP Sobi::Error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sobi
的用法示例。
在下文中一共展示了Sobi::Error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __callStatic
public static function __callStatic($name, $args)
{
if (defined('SOBIPRO_ADM')) {
return call_user_func_array(array('self', '_' . $name), $args);
} else {
static $className = false;
if (!$className) {
$package = Sobi::Reg('current_template');
if (SPFs::exists(Sobi::FixPath($package . '/input.php'))) {
$path = Sobi::FixPath($package . '/input.php');
ob_start();
$content = file_get_contents($path);
$class = array();
preg_match('/\\s*(class)\\s+(\\w+)/', $content, $class);
if (isset($class[2])) {
$className = $class[2];
} else {
Sobi::Error('Custom Input Class', SPLang::e('Cannot determine class name in file %s.', str_replace(SOBI_ROOT, null, $path)), SPC::WARNING, 0);
return false;
}
require_once $path;
} else {
$className = true;
}
}
if (is_string($className) && method_exists($className, $name)) {
return call_user_func_array(array($className, $name), $args);
} else {
return call_user_func_array(array('self', '_' . $name), $args);
}
}
}
示例2: execute
public function execute()
{
SPLang::load('com_sobipro.check');
$task = $this->_task = strlen($this->_task) ? $this->_task : $this->_defTask;
// this is need to delete all old cache after installation
if (SPRequest::int('init')) {
SPFactory::cache()->cleanAll();
}
switch ($this->_task) {
case 'view':
$this->view();
break;
case 'download':
$this->download();
break;
default:
if (method_exists($this, $this->_task)) {
SPFactory::mainframe()->cleanBuffer()->customHeader();
$this->{$task}();
exit;
} else {
Sobi::Error('requirements', 'Task not found', SPC::WARNING, 404, __LINE__, __FILE__);
exit;
}
break;
}
}
示例3: execute
public function execute()
{
$this->_task = strlen($this->_task) ? $this->_task : $this->_defTask;
switch ($this->_task) {
case 'list':
$this->screen();
Sobi::ReturnPoint();
break;
case 'purge':
$this->purge();
break;
case 'download':
$this->download();
break;
case 'details':
$this->details();
break;
default:
/* case plugin didn't registered this task, it was an error */
if (!parent::execute()) {
Sobi::Error('error_ctrl', 'Task not found', SPC::WARNING, 404, __LINE__, __FILE__);
}
break;
}
}
示例4: 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);
}
}
示例5: __construct
/**
*
*/
public function __construct()
{
if (self::$cs) {
Sobi::Error('mainframe', SPLang::e('CRITICAL_SECTION'), SPC::ERROR, 500, __LINE__, __CLASS__);
} else {
self::$cs = true;
self::$cs = false;
}
}
示例6: __call
public function __call($method, $params)
{
if (function_exists($method)) {
$this->string = $method($this->string);
} else {
Sobi::Error('String', "Function {$method} does not exist!", SPC::WARNING);
}
return $this;
}
示例7: search
protected function search()
{
if (!SPFactory::mainframe()->checkToken()) {
Sobi::Error('Token', SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
}
// $selected = SPRequest::int( 'selected', 0 );
$ssid = SPRequest::base64('ssid');
$query = SPRequest::string('q', null);
$session = SPFactory::user()->getUserState('userSelector', null, array());
$setting = $session[$ssid];
/* get the site to display */
$site = SPRequest::int('site', 1);
$eLim = Sobi::Cfg('user_selector.entries_limit', 18);
$eLimStart = ($site - 1) * $eLim;
$params = array();
if ($query) {
$q = '%' . $query . '%';
$params = SPFactory::db()->where(array('name' => $q, 'username' => $q, 'email' => $q), 'OR');
}
try {
$count = SPFactory::db()->select('COUNT(*)', '#__users', $params, $setting['ordering'])->loadResult();
$data = SPFactory::db()->select(array('id', 'name', 'username', 'email', 'registerDate', 'lastvisitDate'), '#__users', $params, $setting['ordering'], $eLim, $eLimStart)->loadAssocList();
} catch (SPException $x) {
echo $x->getMessage();
exit;
}
$response = array('sites' => ceil($count / $eLim), 'site' => $site);
if (count($data)) {
$replacements = array();
preg_match_all('/\\%[a-z]*/', $setting['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 ($data as $index => $user) {
$txt = $setting['format'];
foreach ($placeholders as $attribute) {
if (isset($user[$attribute])) {
$txt = str_replace('%' . $attribute, $user[$attribute], $txt);
}
}
$data[$index]['text'] = $txt;
}
}
$response['users'] = $data;
}
SPFactory::mainframe()->cleanBuffer();
echo json_encode($response);
exit;
}
示例8: 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');
}
示例9: 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');
}
示例10: iconChooser
protected function iconChooser()
{
if (!Sobi::Can('category.edit')) {
Sobi::Error('category', 'You have no permission to access this site', SPC::ERROR, 403, __LINE__, __FILE__);
}
if (strlen(SPRequest::cmd('font'))) {
return $this->iconFont();
}
$folder = SPRequest::cmd('iconFolder', null);
$callback = SPRequest::cmd('callback', 'SPSelectIcon');
$dir = $folder ? Sobi::Cfg('images.category_icons') . str_replace('.', '/', $folder) . '/' : Sobi::Cfg('images.category_icons');
$files = array();
$dirs = array();
if ($folder) {
$up = explode('.', $folder);
unset($up[count($up) - 1]);
$dirs[] = array('name' => Sobi::Txt('FOLEDR_UP'), 'count' => count(scandir($dir . '..')) - 2, 'url' => Sobi::Url(array('task' => 'category.icon', 'out' => 'html', 'iconFolder' => count($up) ? implode('.', $up) : null)));
}
$ext = array('png', 'jpg', 'jpeg', 'gif');
if (is_dir($dir) && ($dh = opendir($dir))) {
while (($file = readdir($dh)) !== false) {
if (filetype($dir . $file) == 'file' && in_array(strtolower(SPFs::getExt($file)), $ext)) {
$files[] = array('name' => $folder ? str_replace('.', '/', $folder) . '/' . $file : $file, 'path' => str_replace('\\', '/', str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), str_replace('//', '/', $dir . $file))));
} elseif (filetype($dir . $file) == 'dir' && !($file == '.' || $file == '..')) {
$dirs[] = array('name' => $file, 'count' => count(scandir($dir . $file)) - 2, 'path' => str_replace('\\', '/', str_replace(SOBI_ROOT, Sobi::Cfg('live_site'), str_replace('//', '/', $dir . $file))), 'url' => Sobi::Url(array('task' => 'category.icon', 'out' => 'html', 'iconFolder' => $folder ? $folder . '.' . $file : $file)));
}
}
closedir($dh);
}
sort($files);
sort($dirs);
$view = SPFactory::View('category');
$view->setTemplate('category.icon');
$view->assign($this->_task, 'task');
$view->assign($callback, 'callback');
$view->assign($files, 'files');
$view->assign(Sobi::Cfg('images.folder_ico'), 'folder');
$view->assign($dirs, 'directories');
$view->icon();
}
示例11: execute
/**
*/
public function execute()
{
/* parent class executes the plugins */
SPRequest::set('task', $this->_type . '.' . $this->_task);
switch ($this->_task) {
case 'front':
$this->getSections();
/** @var $view SPAdmPanelView */
$view = SPFactory::View('front');
/* load template config */
// $this->tplCfg( 'front' );
// $view->setConfig( $this->_tCfg, 'general' );
$view->determineTemplate('front', SPC::DEFAULT_TEMPLATE);
$view->assign($this->_sections, 'sections');
$view->display();
break;
default:
/* case parents or plugin didn't registered this task, it was an error */
if (!parent::execute()) {
Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
}
break;
}
}
示例12: execute
public function execute()
{
SPRequest::set('task', $this->_type . '.' . $this->_task);
if (strstr($this->_task, '.')) {
$task = explode('.', $this->_task);
$class = SPLoader::loadClass('opt.listing.' . $task[0], false, null, true);
} else {
$class = SPLoader::loadClass('opt.listing.' . $this->_task, false, null, true);
}
if ($class) {
$imp = class_implements($class);
if (is_array($imp) && in_array('SPListing', $imp)) {
/** @noinspection PhpIncludeInspection $compatibility */
$listing = new $class();
if (!isset($class::$compatibility)) {
define('SOBI_LEGACY_LISTING', true);
if (strstr($this->_task, '.')) {
$t = explode('.', $this->_task);
$listing->setTask($t[0]);
} else {
$listing->setTask($this->_task);
}
} else {
$listing->setTask($this->_task);
}
return $listing->execute();
} else {
Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND Wrong class definition', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
}
} else {
/* case parent didn't registered this task, it was an error */
if (!parent::execute() && $this->name() == __CLASS__) {
Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
}
}
}
示例13: displayForm
/**
*
*/
public function displayForm()
{
Sobi::Trigger('Display', $this->name(), array(&$this));
$action = $this->key('action');
echo '<div class="SobiPro" id="SobiPro">' . "\n";
if ($this->get('_compatibility')) {
echo SPFactory::AdmToolbar()->render();
echo $this->legacyMessages();
}
echo $action ? "\n<form action=\"{$action}\" method=\"post\" name=\"adminForm\" id=\"SPAdminForm\" enctype=\"multipart/form-data\" accept-charset=\"utf-8\" >\n" : null;
foreach ($this->_templates as $tpl) {
$template = SPLoader::path($tpl, 'adm.template');
if (!$template) {
$tpl = SPLoader::translatePath($tpl, 'adm.template', false);
Sobi::Error($this->name(), SPLang::e('CANNOT_LOAD_TEMPLATE_AT', $tpl), SPC::ERROR, 500, __LINE__, __FILE__);
} else {
include $template;
}
}
if (count($this->_hidden)) {
$this->_hidden[SPFactory::mainframe()->token()] = 1;
$prefix = null;
if (!$this->get('_compatibility')) {
$prefix = 'SP_';
}
foreach ($this->_hidden as $name => $value) {
echo "\n<input type=\"hidden\" name=\"{$name}\" id=\"{$prefix}{$name}\" value=\"{$value}\"/>";
}
}
echo $action ? "\n</form>\n" : null;
echo '</div>';
Sobi::Trigger('AfterDisplay', $this->name());
}
示例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: saveData
/**
* Gets the data for a field and save it in the database
* @param SPEntry $entry
* @param string $request
* @return bool
*/
public function saveData(&$entry, $request = 'POST')
{
if (!$this->enabled) {
return false;
}
/* @var SPdb $db */
$db = SPFactory::db();
$save = $this->verify($entry, $request);
$time = SPRequest::now();
$IP = SPRequest::ip('REMOTE_ADDR', 0, 'SERVER');
$uid = Sobi::My('id');
/* collect the needed params */
$params = array();
$params['publishUp'] = $entry->get('publishUp');
$params['publishDown'] = $entry->get('publishDown');
$params['fid'] = $this->fid;
$params['sid'] = $entry->get('id');
$params['section'] = Sobi::Reg('current_section');
$params['lang'] = Sobi::Lang();
$params['enabled'] = $entry->get('state');
$params['baseData'] = $db->escape(SPConfig::serialize($save));
$params['approved'] = $entry->get('approved');
$params['confirmed'] = $entry->get('confirmed');
/* if it is the first version, it is new entry */
if ($entry->get('version') == 1) {
$params['createdTime'] = $time;
$params['createdBy'] = $uid;
$params['createdIP'] = $IP;
}
$params['updatedTime'] = $time;
$params['updatedBy'] = $uid;
$params['updatedIP'] = $IP;
$params['copy'] = !$entry->get('approved');
if (Sobi::My('id') == $entry->get('owner')) {
--$this->editLimit;
}
$params['editLimit'] = $this->editLimit;
/* save it */
try {
/* Notices:
* If it was new entry - insert
* If it was an edit and the field wasn't filled before - insert
* If it was an edit and the field was filled before - update
* " ... " and changes are not autopublish it should be insert of the copy .... but
* " ... " if a copy already exist it is update again
* */
$db->insertUpdate('spdb_field_data', $params);
} catch (SPException $x) {
Sobi::Error(__CLASS__, SPLang::e('CANNOT_SAVE_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
/* if it wasn't edited in the default language, we have to try to insert it also for def lang */
if (Sobi::Lang() != Sobi::DefLang()) {
$params['lang'] = Sobi::DefLang();
try {
$db->insert('spdb_field_data', $params, true, true);
} catch (SPException $x) {
Sobi::Error(__CLASS__, SPLang::e('CANNOT_SAVE_DATA', $x->getMessage()), SPC::WARNING, 0, __LINE__, __FILE__);
}
}
}