本文整理汇总了PHP中Gpf_Session类的典型用法代码示例。如果您正苦于以下问题:PHP Gpf_Session类的具体用法?PHP Gpf_Session怎么用?PHP Gpf_Session使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Gpf_Session类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
protected function log($time, $message, $logLevel, $logGroup, $ip, $file, $line, $type = null)
{
if ($message == "") {
return;
}
$timeString = strftime("Y-m-d H:i:s", $time);
$userId = null;
try {
$userId = Gpf_Session::getAuthUser()->getUserId();
} catch (Gpf_Exception $e) {
}
try {
$dbLog = new Gpf_Db_Log();
$dbLog->set('groupid', $logGroup);
$dbLog->set('level', $logLevel);
$dbLog->set('created', $timeString);
$dbLog->set('filename', $file);
$dbLog->set('message', $message);
$dbLog->set('line', $line);
$dbLog->set('ip', $ip);
$dbLog->set('accountuserid', $userId);
$dbLog->set(Gpf_Db_Table_Logs::TYPE, $type);
$dbLog->save();
} catch (Exception $e) {
Gpf_Log::disableType(Gpf_Log_LoggerDatabase::TYPE);
Gpf_Log::error($this->_sys("Database Logger Error. Logging on display: %s", $message));
Gpf_Log::enableAllTypes();
}
}
示例2: setCountriesFromOldConfigFile
public function setCountriesFromOldConfigFile() {
$countriesConfigFile = new CountriesConfigFile();
try {
$countries = $countriesConfigFile->read();
} catch (Gpf_Exception $e) {
Gpf_Country_Countries::insertCountriesToDB(Gpf_Db_Country::STATUS_ENABLED);
return;
}
if ($countries == '') {
Gpf_Country_Countries::insertCountriesToDB(Gpf_Db_Country::STATUS_ENABLED);
return;
}
Gpf_Country_Countries::insertCountriesToDB(Gpf_Db_Country::STATUS_DISABLED);
$countriesCodesArray = preg_split('/,/', $countries);
foreach ($countriesCodesArray as $countryCode) {
$country = new Gpf_Db_Country();
$country->setCountryCode($countryCode);
$country->setAccountId(Gpf_Session::getAuthUser()->getAccountId());
try {
$country->loadFromData(array(Gpf_Db_Table_Countries::COUNTRY_CODE, Gpf_Db_Table_Countries::ACCOUNTID));
$country->setStatus(Gpf_Db_Country::STATUS_ENABLED);
$country->save();
} catch (Gpf_Exception $e) {
}
}
}
示例3: getPreview
public function getPreview(Pap_Common_User $user) {
$flag = self::FLAG_MERCHANT_PREVIEW;
if (Gpf_Session::getAuthUser()->isAffiliate()) {
return $this->getAfiliatePreview($user);
}
return $this->getDisplayCodeFrom('data2', $user, $flag);
}
示例4: buildWhere
protected function buildWhere()
{
parent::buildWhere();
$this->_selectBuilder->where->add(Gpf_Db_Table_Accounts::ID, '=', Gpf_Application::getInstance()->getAccountId());
$this->_selectBuilder->where->add(Gpf_Db_Table_MailTemplates::IS_CUSTOM, '=', Gpf::YES);
$this->_selectBuilder->where->add(Gpf_Db_Table_MailTemplates::USERID, '=', Gpf_Session::getAuthUser()->getUserId());
}
示例5: save
/**
* Processes contact us form and sends email to merchant
*
* @service contact_us write
* @param $fields
*/
public function save(Gpf_Rpc_Params $params) {
$form = new Gpf_Rpc_Form($params);
$subject = $this->getFieldValue($form, "subject");
$text = $this->getFieldValue($form, "text");
Gpf_Session::getAuthUser()->getPapUserId();
$user = new Pap_Common_User();
$user->setPrimaryKeyValue(Gpf_Session::getAuthUser()->getPapUserId());
try {
$user->load();
} catch (Gpf_DbEngine_NoRowException $e) {
$form->setErrorMessage($this->_("User cannot be found"));
return $form;
}
$mailTemplate = new Pap_Mail_MerchantOnContactUs();
$mailTemplate->setUser($user);
$mailTemplate->setEmail($subject, $text);
$mailTemplate->addRecipient(Pap_Common_User::getMerchantEmail());
$mailTemplate->setFromEmail($user->getEmail());
$mailTemplate->setFromName($user->getFirstName()." ".$user->getLastName());
$mailTemplate->send();
$form->setInfoMessage($this->_("Email was successfully sent to merchant"));
return $form;
}
示例6: getUser
private function getUser() {
$user = new Pap_Affiliates_User();
$user->setId(Gpf_Session::getAuthUser()->getPapUserId());
$user->load();
return $user;
}
示例7: getRoleType
public function getRoleType()
{
if ($this->roleType == '') {
return Gpf_Session::getModule()->getRoleType();
}
return $this->roleType;
}
示例8: deleteSplitCommissionsMailTemplate
private function deleteSplitCommissionsMailTemplate() {
$dbTemplate = new Gpf_Db_MailTemplate();
$dbTemplate->setAccountId(Gpf_Session::getAuthUser()->getAccountId());
$dbTemplate->setClassName('Pap_Mail_SplitCommissionsMerchantOnSale');
$dbTemplate->loadFromData();
$dbTemplate->delete();
}
示例9: getUserCommissionTypes
private function getUserCommissionTypes($campaignId = null) {
$userId = null;
if (Gpf_Session::getAuthUser()->isAffiliate()) {
$userId = Gpf_Session::getAuthUser()->getPapUserId();
}
return Pap_Db_Table_CommissionTypes::getInstance()->getAllUserCommissionTypes($campaignId, Pap_Common_Constants::TYPE_ACTION, $userId);
}
示例10: saveFields
/**
* @service channel write
*
* @param $fields
* @return Gpf_Rpc_Action
*/
public function saveFields(Gpf_Rpc_Params $params) {
$action = new Gpf_Rpc_Action($params);
$action->setErrorMessage($this->_('Failed to save %s field(s)'));
$action->setInfoMessage($this->_('%s field(s) successfully saved'));
$fields = new Gpf_Data_RecordSet();
$fields->loadFromArray($action->getParam("fields"));
$channels = Pap_Db_Table_Channels::getUserChannels(Gpf_Session::getAuthUser()->getPapUserId());
foreach ($fields as $field) {
$isUnique = true;
foreach ($channels as $channel) {
if ($field->get('value') == $channel->get(Pap_Db_Table_Channels::VALUE)) {
$isUnique = false;
break;
}
}
if ($isUnique) {
$this->saveField($field);
} else {
$action->setErrorMessage($this->_("Failed to save %s field(s). Data with value '".$field->get('value').
"' already exist. Data must be unique."));
$action->addError();
return $action;
}
}
$action->addOk();
return $action;
}
示例11: loadNoRpc
public function loadNoRpc(Gpf_Rpc_Params $params, $useParent = true) {
$data = new Gpf_Rpc_Data($params);
$signupFormPanel = new Pap_Affiliates_Promo_SignupFormPanel();
$addScript = '';
if ($useParent) {
$parentUserId = '<input type="hidden" name="parentuserid"'
. ' value="' . Gpf_Session::getAuthUser()->getPapUserId() . '" />';
} else {
$parentUserId = '<input type="hidden" name="parentuserid" id="parentuserid" value="" />';
$scriptUrl = Gpf_Paths::getInstance()->getFullScriptsUrl().'salejs.php';
$addScript = '<script id="pap_x2s6df8d"
src="'.$scriptUrl.'" type="text/javascript">
</script>
<script type="text/javascript">
PostAffTracker.writeAffiliateToCustomField(\'parentuserid\');
</script>';
}
if ($signupFormPanel->containsId("parentuserid")) {
$signupFormPanel->add($parentUserId, "parentuserid");
} else {
$signupFormPanel->addWidget($parentUserId, "parentuserid");
}
$signupFormPanelHtml = '<form action="' . self::getSignupScriptUrl($useParent) . '" method="post">'
. $signupFormPanel->render()
. '</form>'
. $addScript;
$data->setValue("formSource", $signupFormPanelHtml);
$data->setValue("formPreview", $signupFormPanelHtml);
return $data;
}
示例12: getNumberOfSubaffiliates
public function getNumberOfSubaffiliates($userid = null) {
$result = new Gpf_Data_RecordSet();
$selectBuilder = new Gpf_SqlBuilder_SelectBuilder();
$selectBuilder->select->add('COUNT(u.userid)', 'amount');
$selectBuilder->from->add(Pap_Db_Table_Users::getName(), "u");
$selectBuilder->from->addInnerJoin(Gpf_Db_Table_Users::getName(), "gu", "u.accountuserid = gu.accountuserid");
$selectBuilder->from->addInnerJoin(Gpf_Db_Table_AuthUsers::getName(), "au", "gu.authid = au.authid");
$selectBuilder->where->add('u.deleted', '=', Gpf::NO);
if ($userid === null) {
$selectBuilder->where->add('u.parentuserid', '=', Gpf_Session::getAuthUser()->getPapUserId());
} else {
$selectBuilder->where->add('u.parentuserid', '=', $userid);
}
$selectBuilder->where->add('gu.rstatus', '<>', 'D');
if ($this->params->isDateFromDefined()) {
$selectBuilder->where->add('u.' . Pap_Stats_Table::DATEINSERTED, '>=', $this->params->getDateFrom()->toDateTime());
}
if ($this->params->isDateToDefined()) {
$selectBuilder->where->add('u.' . Pap_Stats_Table::DATEINSERTED, '<=', $this->params->getDateTo()->toDateTime());
}
$selectBuilder->limit->set(0, 1);
$result->load($selectBuilder);
if($result->getSize() == 0) {
return 0;
}
foreach($result as $record) {
return $record->get('amount');
}
}
示例13: loadRolePrivileges
/**
* Load role privileges
*
* @service
* @anonym
* @param Gpf_Rpc_Params $params
* @return Gpf_Data_RecordSet
*/
public function loadRolePrivileges(Gpf_Rpc_Params $params)
{
if (!Gpf_Session::getAuthUser()->hasPrivilege(Gpf_Privileges::ROLE, Gpf_Privileges::P_READ) && !Gpf_Session::getAuthUser()->hasPrivilege(Gpf_Privileges::ROLE, Pap_Privileges::P_READ_OWN)) {
throw new Gpf_Rpc_PermissionDeniedException('Gpf_Role_RolePrivilegesForm', 'loadRolePrivileges');
}
$role = new Gpf_Db_Role();
$role->setId($params->get('roleid'));
$role->load();
$defaultPrivileges = Gpf_Application::getInstance()->getDefaultPrivilegesByRoleType($role->getRoleType());
$result = new Gpf_Data_RecordSet();
$result->addColumn('object');
$result->addColumn('objectName');
$result->addColumn('possiblePrivileges');
$result->addColumn('activePrivileges');
$rolePrivileges = Gpf_Privileges::loadPrivileges($role->getId());
foreach ($defaultPrivileges->getDefaultPrivileges() as $object => $privileges) {
$record = new Gpf_Data_Record($result->getHeader());
$record->add('object', $object);
$record->add('objectName', ucfirst(str_replace('_', ' ', strtolower($object))));
$allTypes = $defaultPrivileges->getObjectToTypeRelation();
$record->add('possiblePrivileges', implode(',', $allTypes[$object]));
if (array_key_exists($object, $rolePrivileges)) {
$record->add('activePrivileges', implode(',', array_keys($rolePrivileges[$object])));
} else {
$record->add('activePrivileges', '');
}
$result->addRecord($record);
}
$result->sort('objectName');
return $result;
}
示例14: loadItems
protected function loadItems($userId) {
$maxTiers = Gpf_Settings::get(Pap_Settings::TIERS_VISIBLE_TO_AFFILIATE);
if ($maxTiers == -1) {
return parent::loadItems($userId);
}
$currentUserId = Gpf_Session::getAuthUser()->getPapUserId();
$numberOfTiers = -1;
if($userId != '') {
try {
$numberOfTiers = $this->getNumberOfTiersToAncestor($userId, $currentUserId);
} catch (Gpf_Exception $e) {
}
}
if ($userId == '' && $maxTiers == 0) {
return new Gpf_Data_RecordSet();
}
if ($numberOfTiers >= $maxTiers-2) {
$lastTier = true;
} else {
$lastTier = false;
}
return parent::loadItems($userId, $lastTier);
}
示例15: __construct
public function __construct($accountId, $authToken = '', $roleType = '')
{
parent::__construct($accountId, $roleType);
$this->authToken = $authToken;
if ($authToken == '') {
$this->authToken = Gpf_Session::getAuthUser()->getRemeberMeToken();
}
}