本文整理汇总了PHP中Phpfox_Error::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Error::set方法的具体用法?PHP Phpfox_Error::set怎么用?PHP Phpfox_Error::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox_Error
的用法示例。
在下文中一共展示了Phpfox_Error::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
$oArchiveImport = Phpfox::getLib('archive.import')->set(array('zip'));
$bOverwrite = $this->request()->getInt('overwrite') ? true : false;
if (isset($_FILES['import']) && ($aFile = $_FILES['import']) && !empty($aFile['name'])) {
if (preg_match('/^phpfox-theme-(.*?)\\.zip$/i', $aFile['name'], $aMatches)) {
if (($sLocationId = $oArchiveImport->process($aFile)) !== false) {
$sFolderName = $aMatches[1];
if (preg_match('/^(.*)-(.*?)$/i', $aMatches[1])) {
$aParts = explode('-', $aMatches[1]);
$sFolderName = $aParts[0];
}
if ($this->request()->get('overwrite') && Phpfox::getService('theme')->isTheme($sFolderName)) {
$this->url()->send('admincp.theme.import', null, 'Theme successfully overwritten.');
}
// $this->url()->send('admincp.theme.import', array('install' => $sFolderName, 'force' => $sLocationId));
if (Phpfox::getService('theme.process')->installThemeFromFolder($sFolderName, $sLocationId)) {
$this->url()->send('admincp.theme.import', null, Phpfox::getPhrase('theme.theme_successfully_imported'));
}
}
} else {
Phpfox_Error::set(Phpfox::getPhrase('theme.not_a_valid_theme_to_import'));
}
} else {
if ($sFolderName = $this->request()->get('install')) {
if (Phpfox::getService('theme.process')->installThemeFromFolder($sFolderName)) {
$this->url()->send('admincp.theme.import', null, Phpfox::getPhrase('theme.theme_successfully_imported'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('theme.import_themes'))->setBreadcrumb(Phpfox::getPhrase('theme.themes'), $this->url()->makeUrl('admincp.theme'))->setBreadcrumb(Phpfox::getPhrase('theme.import_themes'), null, true)->assign(array('aNewThemes' => Phpfox::getService('theme')->getNewThemes()));
}
示例2: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
if ($aVals = $this->request()->getArray('val')) {
Phpfox::isUser(true);
Phpfox::getUserParam('comment.can_post_comments', true);
if (($iFlood = Phpfox::getUserParam('comment.comment_post_flood_control')) !== 0) {
$aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('comment'), 'condition' => 'type_id = \'' . Phpfox::getLib('database')->escape($aVals['type']) . '\' AND user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
// actually check if flooding
if (Phpfox::getLib('spam')->check($aFlood)) {
Phpfox_Error::set(Phpfox::getPhrase('comment.posting_a_comment_a_little_too_soon_total_time', array('total_time' => Phpfox::getLib('spam')->getWaitTime())));
}
}
if (Phpfox::getLib('parse.format')->isEmpty($aVals['text'])) {
Phpfox_Error::set(Phpfox::getPhrase('feed.add_some_text_to_your_comment'));
}
if (Phpfox_Error::isPassed() && ($iId = Phpfox::getService('comment.process')->add($aVals))) {
$this->url()->send('feed.view', array('id' => $this->request()->getInt('id')), Phpfox::getPhrase('feed.successfully_added_your_comment'));
}
}
if ($iLikeType = $this->request()->getInt('liketype')) {
if (Phpfox::getService('feed.process')->like($this->request()->getInt('id'), $iLikeType)) {
$this->url()->send('feed.view', array('id' => $this->request()->getInt('id')), $iLikeType == '1' ? Phpfox::getPhrase('feed.successfully_liked_this_feed') : Phpfox::getPhrase('feed.successfully_unliked_this_feed'));
}
}
list($iFeedCount, $aFeeds) = Phpfox::getService('feed')->get(null, $this->request()->getInt('id'), 1);
$iCommentCnt = 0;
$aComments = array();
if (Phpfox::getParam('feed.allow_comments_on_feeds')) {
list($iCommentCnt, $aComments) = Phpfox::getService('comment')->get('cmt.*', array("AND cmt.type_id = 'feed'", 'AND cmt.item_id = ' . (int) $aFeeds[0]['feed_id'], 'AND cmt.view_id = 0'), 'cmt.time_stamp ASC');
}
if (!count($aFeeds)) {
return Phpfox_Error::display(Phpfox::getPhrase('feed.not_a_valid_feed'));
}
$this->template()->setMobileHeader(array('feed.css' => 'module_feed'))->assign(array('iFeedId' => $aFeeds[0]['feed_id'], 'aFeeds' => $aFeeds, 'aComments' => $aComments));
}
示例3: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
// assign the categories
$this->template()->assign(array('aCategories' => Phpfox::getService('contact.contact')->getCategories()));
// create the captcha check JS
// they need to input some text always
$aValidation = array('text' => Phpfox::getPhrase('contact.fill_in_some_text_for_your_message'), 'category_id' => Phpfox::getPhrase('contact.you_need_to_choose_a_category'), 'subject' => Phpfox::getPhrase('contact.provide_a_subject'), 'full_name' => Phpfox::getPhrase('contact.provide_your_full_name'));
// do they need to complete a captcha challenge?
if (Phpfox::isModule('captcha') && Phpfox::getParam('contact.contact_enable_captcha')) {
$aValidation['image_verification'] = Phpfox::getPhrase('captcha.complete_captcha_challenge');
}
// They always need to input their email address
$aValidation['email'] = array('def' => 'email', 'title' => Phpfox::getPhrase('contact.provide_a_valid_email'));
$oValid = Phpfox::getLib('validator')->set(array('sFormName' => 'js_contact_form', 'aParams' => $aValidation));
// check if we're getting a request:
if ($aVals = $this->request()->getArray('val')) {
// check the fields are valid
if ($oValid->isValid($aVals)) {
if (Phpfox::getService('contact.contact')->sendContactMessage($aVals)) {
if (!empty($aVals['category_id']) && $aVals['category_id'] == 'phpfox_sales_ticket') {
$this->url()->send('contact', array('sent' => 'true'));
} else {
$this->url()->send('contact', null, Phpfox::getPhrase('contact.your_message_was_successfully_sent'));
}
} else {
$this->template()->assign(array('aContactErrors' => Phpfox_Error::set(Phpfox::getPhrase('error.site_email_not_set'))));
}
}
}
if (Phpfox::isUser()) {
$this->template()->assign(array('sFullName' => Phpfox::getUserBy('full_name'), 'sEmail' => Phpfox::getUserBy('email')));
}
$this->template()->setTitle(Phpfox::getPhrase('contact.contact_us'))->setBreadcrumb(Phpfox::getPhrase('contact.contact_us'))->assign(array('sCreateJs' => $oValid->createJs(), 'sGetJsForm' => $oValid->getJsForm(), 'bIsSent' => $this->request()->get('sent')))->setFullSite();
}
示例4: process
/**
* Controller
*/
public function process()
{
if (Phpfox::getParam('core.phpfox_is_hosted')) {
$this->url()->send('admincp');
}
$oArchiveExport = Phpfox::getLib('archive.export')->set(array('zip'));
$oArchiveImport = Phpfox::getLib('archive.import')->set(array('zip'));
if (($sExportId = $this->request()->get('id')) && !empty($sExportId)) {
if ($sData = Phpfox::getService('emoticon')->export($sExportId)) {
$oArchiveExport->download('phpfox-emoticon-' . $sExportId, 'xml', $sData);
}
}
if (isset($_FILES['import']) && ($aFile = $_FILES['import'])) {
if (preg_match('/^phpfox-emoticon-(.*?)\\.xml$/i', $aFile['name'], $aMatches)) {
if ($sXmlData = file_get_contents($aFile['tmp_name'])) {
$aParams = Phpfox::getLib('xml.parser')->parse($sXmlData);
if (($mReturn = Phpfox::getService('emoticon.process')->import($this->request()->getArray('val'), $aParams)) && is_array($mReturn)) {
$this->url()->send('admincp.emoticon.view', array('id' => $mReturn['id']), Phpfox::getPhrase('emoticon.emoticon_package_successfully_created', array('success' => $mReturn['success'], 'failed' => $mReturn['failed'])));
}
}
} else {
Phpfox_Error::set(Phpfox::getPhrase('emoticon.not_a_valid_emoticon_package_to_import'));
}
}
$this->template()->setTitle(Phpfox::getPhrase('emoticon.import_emoticons'))->setBreadcrumb(Phpfox::getPhrase('emoticon.emoticons'), $this->url()->makeUrl('admincp.emoticon.package'))->setBreadCrumb(Phpfox::getPhrase('emoticon.import_emoticons'), null, true);
}
示例5: process
/**
* Controller
*/
public function process()
{
$this->_setMenuName('admincp.user.cancellations.add');
// is user trying to edit or add an item?
if ($aVals = $this->request()->getArray('val')) {
if (Phpfox::getService('user.cancellations.process')->add($aVals)) {
if (isset($aVals['iDeleteId'])) {
$sMessage = Phpfox::getPhrase('user.option_updated_successfully');
} else {
$sMessage = Phpfox::getPhrase('user.option_added_successfully');
}
$this->url()->send('admincp.user.cancellations.manage', null, $sMessage);
}
}
// is user requesting an item for edit?
if ($iId = $this->request()->getInt('id')) {
$aDelete = Phpfox::getService('user.cancellations')->get($iId);
if (empty($aDelete)) {
Phpfox_Error::set(Phpfox::getPhrase('user.item_not_found'));
}
$aDelete = reset($aDelete);
$this->template()->assign(array('aForms' => $aDelete));
}
$this->template()->setTitle(Phpfox::getPhrase('user.add_cancellation_options'))->setBreadcrumb(Phpfox::getPhrase('user.add_cancellation_options'), $this->url()->makeUrl('admincp.user.cancellations.add'), true)->assign(array());
}
示例6: check
public function check()
{
$iCnt = 0;
// Is the install dir. in place?
if (file_exists(PHPFOX_DIR . 'install' . PHPFOX_DS . 'index.php'))
{
Phpfox_Error::set(Phpfox::getPhrase('admincp.install_dir_exists'));
$iCnt++;
}
// Is main config writable?
if (Phpfox::getLib('file')->isWritable(PHPFOX_DIR_SETTING . 'server.sett.php', true))
{
$sFilePath = 'include' . PHPFOX_DS . 'setting' . PHPFOX_DS . 'server.sett.php';
Phpfox_Error::set(Phpfox::getPhrase('admincp.main_configuration_file_file_path_is_writable', array('file_path' => $sFilePath)));
$iCnt++;
}
// Is the main file folder writable?
if (Phpfox::getLib('file')->isWritable(PHPFOX_DIR_FILE, true))
{
$sFilePath = str_replace(PHPFOX_DIR, '', PHPFOX_DIR_FILE);
Phpfox_Error::set(Phpfox::getPhrase('admincp.main_file_folder_is_writable_file_path', array('file_path' => $sFilePath)));
$iCnt++;
}
return ($iCnt ? false : true);
}
示例7: process
/**
* Process the controller
*
*/
public function process()
{
if (Phpfox::isUser()) {
$this->url()->send('');
}
if ($sRequest = $this->request()->get('id')) {
if ($aVals = $this->request()->getArray('val')) {
if (!isset($aVals['newpassword']) || !isset($aVals['newpassword2']) || $aVals['newpassword'] != $aVals['newpassword2']) {
Phpfox_Error::set(Phpfox::getPhrase('user.your_confirmed_password_does_not_match_your_new_password'));
} else {
if (Phpfox::getService('user.password')->updatePassword($sRequest, $aVals)) {
$this->url()->send('user.password.verify', null, Phpfox::getPhrase('user.password_successfully_updated'));
}
}
}
if (Phpfox::getParam('user.shorter_password_reset_routine')) {
if (Phpfox::getService('user.password')->isValidRequest($sRequest) == true) {
$this->template()->assign(array('sRequest' => $sRequest));
} else {
}
} else {
if (Phpfox::getService('user.password')->verifyRequest($sRequest)) {
$this->url()->send('user.password.verify', null, Phpfox::getPhrase('user.new_password_successfully_sent_check_your_email_to_use_your_new_password'));
}
}
}
$this->template()->setTitle(Phpfox::getPhrase('user.password_request_verification'))->setBreadcrumb(Phpfox::getPhrase('user.password_request_verification'));
}
示例8: addRedirect
/**
* Adds a redirection rule
* @param string $sRedirect Table table that stores the redirections
* @param string $sOldTitle Previous title
* @param string $sNewTitle New title
* @param integer $iItemId Item id (blog_id, poll_id, etc)
* @param string $sItemTable Database table that stores the main item
* @param string $sItemField Field in $sItemTable that stores the title_url of the item
* @return boolean Success
*/
public function addRedirect($sRedirectTable, $sOldTitle, $sNewTitle, $iItemId, $sItemTable, $sItemField)
{
if ($sOldTitle == $sNewTitle)
{
return Phpfox_Error::set('Titles are not different');;// this should never happen
}
// check if the new title is in use at sItemTable
$iExisting = $this->database()->select('COUNT(' . $sItemField . ')')
->from($sItemTable)
->where($sItemField . ' = "' . $sNewTitle . '"')
->execute('getSlaveField');
if ($iExisting > 0)
{
return Phpfox_Error::set('This should not happen'); // this should never happen
}
// check for cyclic redirects
$aRedirects = $this->database()->select('*')
->from($sRedirectTable)
->where('old_title = "' . $sNewTitle .'"')
->execute('getSlaveRows');
if (count($aRedirects) > 0)
{
return Phpfox_Error::set('This redirect would cause a loop');
}
$this->database()->insert($sRedirectTable, array(
'old_title' => $sOldTitle,
'new_title' => $sNewTitle,
'item_id' => (int)$iItemId
));
return true;
}
示例9: connect
public function connect($sHost, $sUser, $sPass, $sName, $sPort = false, $sPersistent = false)
{
// Connect to master db
$this->_hMaster = $this->_connect($sHost, $sUser, $sPass);
// Unable to connect to master
if (!$this->_hMaster) {
// Cannot connect to the database
return Phpfox_Error::set('Cannot connect to the database: ' . $this->_sqlError());
}
// Check if we have any slave servers
if (Phpfox::getParam(array('db', 'slave'))) {
// Get the slave array
$aServers = Phpfox::getParam(array('db', 'slave_servers'));
// Get a random slave to use if there is more then one slave
$iSlave = count($aServers) > 1 ? rand(0, count($aServers) - 1) : 0;
if (PHPFOX_DEBUG) {
$this->sSlaveServer = $aServers[$iSlave][0];
}
// Connect to slave
$this->_hSlave = $this->_connect($aServers[$iSlave][0], $aServers[$iSlave][1], $aServers[$iSlave][2]);
}
// If unable to connect to a slave or if no slave is called lets copy the master
if (!$this->_hSlave) {
$this->_hSlave =& $this->_hMaster;
}
return true;
}
示例10: process
public function process()
{
error_reporting(E_ALL);
if ($aVals = $this->request()->get('val')) {
if (!empty($aVals['sv_subfolder'])) {
if (preg_match('/[^A-Za-z0-9-_.\\/]/', $aVals['sv_subfolder'])) {
$invalid_character = 'The sub directory must only contain alphanumeric characters.';
return Phpfox_Error::set($invalid_character);
}
}
if (Phpfox_Error::isPassed()) {
//Save backup settings
Phpfox::getService('backuprestore.settings')->saveBackupSettings($aVals);
}
}
// Default time values
if (!($setting = Phpfox::getService('backuprestore.settings')->getBackupSettings())) {
Phpfox::getService('backuprestore.settings')->setDefaultSettings();
}
//Time settings
$hours = array();
$minutes = array();
for ($i = 0; $i <= 24; $i++) {
$hours[$i] = $i;
}
for ($i = 0; $i <= 59; $i++) {
$minutes[$i] = $i;
}
$this->template()->assign(array('timefreqs' => array('Each 6 hours', 'Daily', 'Every 3 days', 'Weakly', 'Monthly'), 'hours' => $hours, 'minutes' => $minutes, 'aForms' => Phpfox::getService('backuprestore.settings')->getBackupSettings()));
$this->template()->setBreadcrumb(Phpfox::getPhrase('backuprestore.backup_settings'), $this->url()->makeUrl('admincp.backuprestore.setting'))->setHeader(array('btdbstyles.css' => 'module_backuprestore', 'scripts.js' => 'module_backuprestore'));
}
示例11: add
public function add($aVals)
{
if (!isset($aVals['agree'])) {
Phpfox_Error::set('Check our agreement in order to join our site.');
return false;
}
if (!filter_var($aVals['organization_email'], FILTER_VALIDATE_EMAIL)) {
Phpfox_Error::set('Provide a valid email address.');
return false;
}
if (strlen($aVals['organization_password']) < 6) {
Phpfox_Error::set('Not a valid password.');
return false;
}
$aInsert = array('view_id' => 0, 'type_id' => isset($aVals['type_id']) ? (int) $aVals['type_id'] : 2, 'app_id' => isset($aVals['app_id']) ? (int) $aVals['app_id'] : 0, 'category_id' => isset($aVals['category_id']) ? (int) $aVals['category_id'] : 2, 'user_id' => 0, 'title' => $this->preParse()->clean($aVals['organization_name']), 'founder' => $aVals['organization_founder'], 'mission_statement' => $aVals['organization_mission'], 'phone' => $aVals['organization_phone'], 'website' => $aVals['organization_website'], 'time_stamp' => PHPFOX_TIME);
$iId = $this->database()->insert(Phpfox::getT('organization'), $aInsert);
$aInsertText = array('organization_id' => $iId);
if (isset($aVals['info'])) {
$aInsertText['text'] = $this->preParse()->clean($aVals['info']);
$aInsertText['text_parsed'] = $this->preParse()->prepare($aVals['info']);
}
$this->database()->insert(Phpfox::getT('organization_text'), $aInsertText);
$sSalt = $this->_getSalt();
$iUserId = $this->database()->insert(Phpfox::getT('user'), array('profile_organization_id' => $iId, 'user_group_id' => NORMAL_USER_ID, 'view_id' => '7', 'full_name' => $this->preParse()->clean($aVals['organization_name']), 'joined' => PHPFOX_TIME, 'email' => $aVals['organization_email'], 'password' => Phpfox::getLib('hash')->setHash($aVals['organization_password'], $sSalt), 'password_salt' => $sSalt));
$this->database()->update(Phpfox::getT('user'), array('user_name' => 'profile-' . $iUserId), 'user_id=' . $iUserId);
$this->database()->update(Phpfox::getT('organization'), array('user_id' => $iUserId), 'organization_id=' . $iId);
$aExtras = array('user_id' => $iUserId);
$this->database()->insert(Phpfox::getT('user_activity'), $aExtras);
$this->database()->insert(Phpfox::getT('user_field'), $aExtras);
$this->database()->insert(Phpfox::getT('user_space'), $aExtras);
$this->database()->insert(Phpfox::getT('user_count'), $aExtras);
Phpfox::getService('user.activity')->update(Phpfox::getUserId(), 'organization');
Phpfox::getService('like.process')->add('organization', $iId);
return $iId;
}
示例12: add
public function add($iBlockedUserId)
{
Phpfox::isUser(true);
Phpfox::getUserParam('user.can_block_other_members', true);
if ($iBlockedUserId == Phpfox::getUserId())
{
return Phpfox_Error::set(Phpfox::getPhrase('user.not_able_to_block_yourself'));
}
if (Phpfox::getService('user.block')->isBlocked(Phpfox::getUserId(), $iBlockedUserId))
{
return Phpfox_Error::set(Phpfox::getPhrase('user.you_have_already_blocked_this_user'));
}
$aUser = Phpfox::getService('user')->getUser($iBlockedUserId, 'u.user_id, u.user_group_id');
if (!Phpfox::getUserGroupParam($aUser['user_group_id'], 'user.can_be_blocked_by_others'))
{
return Phpfox_Error::set(Phpfox::getPhrase('user.unable_to_block_this_user'));
}
$this->database()->insert($this->_sTable, array(
'user_id' => Phpfox::getUserId(),
'block_user_id' => (int) $iBlockedUserId,
'time_stamp' => PHPFOX_TIME,
'ip_address' => Phpfox::getIp()
)
);
Phpfox::getService('friend.process')->deleteFromConnection(Phpfox::getUserId(), $iBlockedUserId);
Phpfox::getService('friend.process')->deleteFromConnection($iBlockedUserId, Phpfox::getUserId());
return true;
}
示例13: addThread
/**
* Add thread
* @param $iFourmId
* @param $sTitle
* @param $sText
* @param $iSubscribed
* @return bool|null
*/
public function addThread($iFourmId, $sTitle, $sText, $iSubscribed)
{
$aForum = Phpfox::getService('forum')->id($iFourmId)->getForum();
if (!isset($aForum['forum_id'])) {
return Phpfox_Error::display(Phpfox::getPhrase('forum.not_a_valid_forum'));
}
if ($aForum['is_closed']) {
return Phpfox_Error::display(Phpfox::getPhrase('forum.forum_is_closed'));
}
$bPass = false;
if (Phpfox::getUserParam('forum.can_add_new_thread') || Phpfox::getService('forum.moderate')->hasAccess($aForum['forum_id'], 'add_thread')) {
$bPass = true;
}
if ($bPass === false) {
return Phpfox_Error::display(Phpfox::getPhrase('forum.insufficient_permission_to_reply_to_this_thread'));
}
$aVals = array('forum_id' => $iFourmId, 'title' => $sTitle, 'text' => $sText, 'is_subscribed' => $iSubscribed);
if (($iFlood = Phpfox::getUserParam('forum.forum_thread_flood_control')) !== 0) {
$aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('forum_thread'), 'condition' => 'user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
// actually check if flooding
if (Phpfox::getLib('spam')->check($aFlood)) {
Phpfox_Error::set(Phpfox::getPhrase('forum.posting_a_new_thread_a_little_too_soon') . ' ' . Phpfox::getLib('spam')->getWaitTime());
}
}
//add thread
if (Phpfox_Error::isPassed() && ($iId = Phpfox::getService('forum.thread.process')->add($aVals, false))) {
//return thread
return $this->getThreadById($iId, 1, 10, null);
}
return null;
}
示例14: put
/**
* Uploads the file to amazons server.
*
* @param string $sFile Full path to where the file is located.
* @param string $sName Optional name of the file once it is uploaded. By default we just use the original file name.
* @return bool We only return a bool false if we were not able to upload the item.
*/
public function put($sFile, $sName = null)
{
if (!Phpfox::getParam('core.amazon_bucket_created')) {
$sBucketName = Phpfox::getParam('core.amazon_bucket');
if (empty($sBucketName)) {
$this->_sBucket = md5(Phpfox::getParam('core.path'));
}
if (!$this->_oObject->putBucket($this->_sBucket, Phpfox::getParam('core.enable_amazon_expire_urls') ? S3::ACL_PRIVATE : S3::ACL_PUBLIC_READ)) {
return Phpfox_Error::set('Unable to create Amazon bucket: ' . $sBucketName);
}
Phpfox::getLib('database')->update(Phpfox::getT('setting'), array('value_actual' => '1'), 'var_name = \'amazon_bucket_created\'');
Phpfox::getLib('database')->update(Phpfox::getT('setting'), array('value_actual' => '' . $this->_sBucket . ''), 'var_name = \'amazon_bucket\'');
Phpfox::getLib('cache')->remove();
}
if (empty($sName)) {
$sName = str_replace("\\", '/', str_replace(PHPFOX_DIR, '', $sFile));
}
if ($this->_oObject->putObjectFile($sFile, $this->_sBucket, $sName, Phpfox::getParam('core.enable_amazon_expire_urls') ? S3::ACL_PRIVATE : S3::ACL_PUBLIC_READ)) {
if (Phpfox::getParam('core.keep_files_in_server') == false) {
$oSess = Phpfox::getLib('session');
$aFiles = $oSess->get('deleteFiles');
if (is_array($aFiles)) {
$aFiles[] = $sFile;
} else {
$aFiles = array($sFile);
}
$oSess->set('deleteFiles', $aFiles);
}
return true;
}
return false;
}
示例15: process
/**
* Class process method wnich is used to execute this component.
*/
public function process()
{
if (isset($_POST['token']) && strlen($_POST['token']) == 40) {
$aPost = array('token' => $_POST['token'], 'apiKey' => Phpfox::getParam('janrain.janrain_api_key'), 'format' => 'json', 'extended' => 'true');
$sResult = Phpfox::getLib('request')->send('https://rpxnow.com/api/v2/auth_info', $aPost);
$aInfo = json_decode($sResult, true);
if ($aInfo['stat'] == 'ok') {
$aUserInfo = $aInfo['profile'];
if ($aUser = Phpfox::getService('janrain')->getUser($aUserInfo)) {
list($bIsLoggedIn, $aPostUserInfo) = Phpfox::getService('user.auth')->login($aUser['user_name'], null, false, 'user_name', true);
if ($bIsLoggedIn) {
$this->url()->send(Phpfox::getParam('user.redirect_after_login'));
}
} else {
if (Phpfox::getService('janrain.process')->add($aUserInfo)) {
$aUser = Phpfox::getService('janrain')->getUser($aUserInfo);
if ($sPlugin = Phpfox_Plugin::get('janrain.component_controller_rpx_1')) {
eval($sPlugin);
if (isset($mReturnFromPlugin)) {
return $mReturnFromPlugin;
}
}
list($bIsLoggedIn, $aPostUserInfo) = Phpfox::getService('user.auth')->login($aUser['user_name'], null, false, 'user_name', true);
if ($bIsLoggedIn) {
$this->url()->send('user.setting', null, Phpfox::getPhrase('janrain.your_account_has_successfully_been_created_please_enter_your_account_details_below'));
}
}
}
} else {
Phpfox_Error::set($aInfo['err']['msg']);
}
} else {
Phpfox_Error::set('Authentication canceled.');
}
}