本文整理汇总了PHP中object::getError方法的典型用法代码示例。如果您正苦于以下问题:PHP object::getError方法的具体用法?PHP object::getError怎么用?PHP object::getError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类object
的用法示例。
在下文中一共展示了object::getError方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* Constructor of the container class.
*
* $options can have these keys:
* 'servers' an array containing an array: servername, port,
* sharedsecret, timeout, maxtries
* 'configfile' The filename of the configuration file
* 'authtype' The type of authentication, one of: PAP, CHAP_MD5,
* MSCHAPv1, MSCHAPv2, default is PAP
*
* @param $options associative array
* @return object Returns an error object if something went wrong
*/
function Auth_Container_RADIUS($options)
{
$this->authtype = 'PAP';
if (isset($options['authtype'])) {
$this->authtype = $options['authtype'];
}
$classname = 'Auth_RADIUS_' . $this->authtype;
if (!class_exists($classname)) {
PEAR::raiseError("Unknown Authtype, please use on of: PAP, CHAP_MD5, MSCHAPv1, MSCHAPv2!", 41, PEAR_ERROR_DIE);
}
$this->radius = new $classname();
if (isset($options['configfile'])) {
$this->radius->setConfigfile($options['configfile']);
}
$servers = $options['servers'];
if (is_array($servers)) {
foreach ($servers as $server) {
$servername = $server[0];
$port = isset($server[1]) ? $server[1] : 0;
$sharedsecret = isset($server[2]) ? $server[2] : 'testing123';
$timeout = isset($server[3]) ? $server[3] : 3;
$maxtries = isset($server[4]) ? $server[4] : 3;
$this->radius->addServer($servername, $port, $sharedsecret, $timeout, $maxtries);
}
}
if (!$this->radius->start()) {
PEAR::raiseError($this->radius->getError(), 41, PEAR_ERROR_DIE);
}
}
示例2:
function _getResult()
{
if ($this->progress->hasErrors()) {
$err = $this->progress->getError();
$this->assertTrue(false, $err['message']);
} else {
$this->assertTrue(true);
}
}
示例3: save
/**
* Create or update a record to
* DB from POST data or input array of data
*
* @param array $dataArray an array holding data to save. If empty, $_POST is used
* @return integer id of created or updated record
*/
public function save($dataArray = null)
{
// get required tools
jimport('joomla.database.table');
$this->_data = JTable::getInstance($this->_defaultTable, 'Sh404sefTable');
$post = is_null($dataArray) ? JRequest::get('post') : $dataArray;
// use table save method
try {
$status = $this->_data->save($post);
} catch (Exception $e) {
ShlSystem_Log::error('sh404sef', '%s::%s::%d: %s', __CLASS__, __METHOD__, __LINE__, $e->getMessage());
$this->_data->setError($e->getMessage());
$status = false;
}
// report error
if (!$status) {
JFactory::getApplication()->enqueuemessage($this->_data->getError());
return 0;
}
// if success, fetch last insert id and return that
$tableDb = $this->_data->getDBO();
$keyName = $this->_data->getKeyName();
$id = empty($post[$keyName]) ? 0 : intval($post[$keyName]);
$savedId = empty($id) ? $tableDb->insertid() : $id;
return $savedId;
}
示例4: upload
/**
* 开始处理上传
*
* @return false|string
*/
public function upload()
{
//是否上传出错
if (!$this->file->isValid() or $this->file->getError() != UPLOAD_ERR_OK) {
return false;
}
//保存的路径
$savePath = $this->setSavePath();
//保存的文件名
$saveFileName = $this->getSaveFileName() . '.' . $this->file->getClientOriginalExtension();
//保存
$this->file->move($savePath, $saveFileName);
//文件是否存在
$realFile = $savePath . $saveFileName;
if (!file_exists($realFile)) {
return false;
}
//是否加上水印
if (isset($this->params['waterSetting']) and $this->params['waterSetting'] === true) {
$waterImage = $this->params['waterImage'];
if (!isset($this->params['waterImage']) or empty($this->params['waterImage'])) {
$waterImage = $this->getWaterFile();
}
$this->waterImage($realFile, $waterImage);
}
//返回文件
$realFileUrl[] = str_replace('/', '', str_replace($this->getConfigSavePath(), '', $realFile));
$thumbRealFileUrl = [];
//是否要裁剪
if (isset($this->params['thumbSetting']) and !empty($this->params['thumbSetting'])) {
$thumbRealFileUrl = $this->cutImage($realFile, $savePath);
}
$returnFileUrl = implode('|', array_merge($realFileUrl, $thumbRealFileUrl));
return $returnFileUrl;
}
示例5: getError
/**
* returns one error (as String!)
*/
public function getError()
{
if ($this->SofortLib_Multipay) {
if ($this->SofortLib_Multipay->isError('sr')) {
return $this->SofortLib_Multipay->getError('sr');
}
}
if ($this->ConfirmSr) {
if ($this->ConfirmSr->isError('sr')) {
return $this->ConfirmSr->getError('sr');
}
}
if ($this->EditSr) {
if ($this->EditSr->isError('sr')) {
return $this->EditSr->getError('sr');
}
}
if ($this->CancelSr) {
if ($this->CancelSr->isError('sr')) {
return $this->CancelSr->getError('sr');
}
}
if ($this->SofortLib_TransactionData) {
if ($this->SofortLib_TransactionData->isError('sr')) {
return $this->SofortLib_TransactionData->getError('sr');
}
}
return '';
}
示例6: addAll
/**
* 批量插入
* @param $list 数组
*/
public function addAll($list)
{
$result = $this->model->addAll($list);
if ($result === FALSE) {
return $this->apiReturnErr($this->model->getError());
} else {
return $this->apiReturnSuc($result);
}
}
示例7: patch
/**
* Default implementation for patch function.
* Patch requests are routed here by the main Sync function.
* These requests are usually coming from lists togglers and state buttons.
* Usually there will be no need to override this function.
*
* @return void
*/
protected function patch()
{
// Check for token
JSession::checkToken() or K2Response::throwError(JText::_('JINVALID_TOKEN'));
// Batch update
$ids = $this->input->get('id', array(), 'array');
JArrayHelper::toInteger($ids);
$states = $this->input->get('states', array(), 'array');
$mode = $this->input->get('mode', 'apply', 'string');
// Ensure we have ids
$ids = array_filter($ids);
if (!count($ids)) {
K2Response::throwError(JText::_('K2_NO_ROWS_SELECTED'), 401);
}
foreach ($ids as $key => $id) {
$data = array();
$data['id'] = $id;
foreach ($states as $state => $values) {
$value = is_array($values) ? $values[$key] : $values;
if ($value != '') {
$data[$state] = $value;
}
}
if ($mode == 'clone') {
$sourceData = $this->model->getCopyData($id);
$data = array_merge($sourceData, $data);
$data['id'] = null;
$this->model->setState('patch', false);
} else {
$this->model->setState('patch', true);
}
$this->model->setState('data', $data);
$result = $this->model->save();
if (!$result) {
K2Response::throwError($this->model->getError());
}
}
// Trigger change state event for items and categories
if ($mode != 'clone' && isset($states['state']) && in_array($this->resourceType, array('items', 'categories'))) {
// Get dispatcher
$dispatcher = JDispatcher::getInstance();
// Import content plugins
JPluginHelper::importPlugin('content');
if ($this->resourceType == 'items') {
$eventName = 'onContentChangeState';
$context = 'com_k2.' . $this->resourceType;
} else {
if ($this->resourceType == 'categories') {
$eventName = 'onCategoryChangeState';
$context = 'com_k2';
}
}
$dispatcher->trigger($eventName, array($context, $ids, $states['state']));
}
K2Response::setResponse($result);
}
示例8: init
/**
* init
* initialize the module
* sets up our sockets and loads the configuration settings
*
* @access public
* @return void
*/
public function init() {
// Set up the constants
require_once('modules/source_rcon/defines.php');
$this->readConfig();
// Set up TCP sending socket
$this->m_oSendSock = new connection($this->m_aConfig['server']['ip'], $this->m_aConfig['server']['port'], 5);
$this->m_oSendSock->setSocketClass($this->socketClass);
$this->m_oSendSock->setIrcClass($this->ircClass);
$this->m_oSendSock->setTimerClass($this->timerClass);
$this->m_oSendSock->setCallbackClass($this);
$this->m_oSendSock->init();
if ($this->m_oSendSock->getError()) {
$this->destroy('Error creating TCP socket: ' . $this->m_oSendSock->getErrorMsg());
return;
}
$this->m_oSendSock->connect();
$this->m_iSendSock = $this->m_oSendSock->getSockInt();
// setup UDP socket for recieviing server logs
if (!$this->m_oRecvSock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP)) {
$this->destroy('Error creating UDP socket [1]');
return;
}
if (!socket_bind($this->m_oRecvSock, '0.0.0.0', $this->m_aConfig['local']['port'])) {
$this->destroy('Error creating UDP socket [2]');
return;
}
if (!socket_set_nonblock($this->m_oRecvSock)) {
$this->destroy('Error creating UDP socket [3]');
return;
}
// set up udp reading process
$this->timerClass->addTimer('parseReadLog', $this, 'parseReadLog', '', 0.1, true);
// add the status timer, call it every 5 minutes
$this->timerClass->addTimer('statusQuery', $this, 'statusQuery', '', 300, false);
// add our UDP handlers
$this->registerHandlers();
// initiate logging to file
$this->openLogfile();
}
示例9: getCategory
/**
* Method to get category by catid.
*
* @param integer $pk Category id.
*
* @return mixed Category object or false.
*/
public function getCategory($pk = null)
{
if (!empty($this->category)) {
return $this->category;
}
$pk = $pk ? $pk : $this->getItem()->catid;
$this->category = JTable::getInstance('Category');
if (!$this->category->load($pk)) {
$this->setError($this->category->getError());
return false;
}
return $this->category;
}
示例10: setTimestamp
/**
* Defines the calendar by a Unix timestamp, replacing values
* passed to the constructor
* @param int Unix timestamp
* @return boolean
* @access public
*/
function setTimestamp($ts)
{
if (!$this->validator->validTimestamp($ts)) {
trigger_error('Calendar::setTimestamp ' . $this->validator->getError());
return false;
}
$this->year = date('Y', $ts);
$this->month = date('m', $ts);
$this->day = date('d', $ts);
$this->hour = date('H', $ts);
$this->minute = date('i', $ts);
$this->second = date('s', $ts);
return true;
}
示例11: delete
/**
* Delete a record
*
* @return boolean True on success, false on error
*/
public function delete()
{
// Can't delete what doesn't exist
if (!$this->exists()) {
return true;
}
// Remove record from the database
if (!$this->_tbl->delete()) {
$this->setError($this->_tbl->getError());
return false;
}
// Hey, no errors!
return true;
}
示例12: delete
/**
* Table delete method
*
* @param mixed Can either be a row, an array of rows or a query object
* @throws KDatabaseTableException
* @return boolean True if successful otherwise returns false
*/
public function delete($where)
{
$table = $this->getTableName();
//Create where statement
if (!$where instanceof KDatabaseQuery) {
$rows = (array) $where;
//Create where statement
if (count($rows)) {
$where = $this->_db->getQuery()->where($this->getPrimaryKey(), 'IN', $rows);
}
}
$result = $this->_db->delete($table, $where);
if ($err = $this->_db->getError()) {
throw new KDatabaseTableException($err);
}
return $result;
}
示例13: upload
/**
* 开始处理上传
*
* @return false|array
*/
public function upload()
{
if (!$this->file->isValid() or $this->file->getError() != UPLOAD_ERR_OK) {
return false;
}
$saveFileName = $this->getSaveFileName() . '.' . $this->file->getClientOriginalExtension();
$savePath = $this->setSavePath();
$this->file->move($savePath, $saveFileName);
$realFile = $savePath . $saveFileName;
if (!file_exists($realFile)) {
return false;
}
$this->doWaterImage($realFile);
$realFileUrl[] = substr(str_replace($this->getConfigSavePath(), '', $realFile), 1);
$thumbRealFileUrl = $this->doCutImage($realFile, $savePath);
return array_merge($realFileUrl, $thumbRealFileUrl);
}
示例14: getError
/**
* returns one error (as String!)
*/
function getError()
{
if ($this->multipay) {
if ($this->multipay->isError('sr')) {
return $this->multipay->getError('sr');
}
}
if ($this->confirmSr) {
if ($this->confirmSr->isError('sr')) {
return $this->confirmSr->getError('sr');
}
}
if ($this->transactionData) {
if ($this->transactionData->isError('sr')) {
return $this->transactionData->getError('sr');
}
}
return '';
}
示例15: save
/**
* Create or update a record to
* DB from POST data or input array of data
*
* @param array $dataArray an array holding data to save. If empty, $_POST is used
* @return integer id of created or updated record
*/
public function save($dataArray = null)
{
// get required tools
jimport('joomla.database.table');
$this->_data =& JTable::getInstance($this->_defaultTable, 'Sh404sefTable');
$post = is_null($dataArray) ? JRequest::get('post') : $dataArray;
// use table save method
$status = $this->_data->save($post);
// report error
if (!$status) {
$app =& JFactory::getApplication();
$app->enqueuemessage($this->_data->getError());
return 0;
}
// if success, fetch last insert id and return that
$tableDb =& $this->_data->getDBO();
$keyName = $this->_data->getKeyName();
$id = empty($post[$keyName]) ? 0 : intval($post[$keyName]);
$savedId = empty($id) ? $tableDb->insertid() : $id;
return $savedId;
}