本文整理汇总了PHP中opConfig类的典型用法代码示例。如果您正苦于以下问题:PHP opConfig类的具体用法?PHP opConfig怎么用?PHP opConfig使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了opConfig类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeConfigUID
/**
* Executes configUID action
*
* @param sfRequest $request A request object
*/
public function executeConfigUID($request)
{
$option = array('member' => $this->getUser()->getMember());
$this->passwordForm = new sfOpenPNEPasswordForm(array(), $option);
$mobileUid = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
$this->isSetMobileUid = $mobileUid && $mobileUid->getValue();
$this->isDeletableUid = (int) opConfig::get('retrieve_uid') < 2 && $this->isSetMobileUid;
if ($request->isMethod('post')) {
$this->passwordForm->bind($request->getParameter('password'));
if ($this->passwordForm->isValid()) {
if ($request->hasParameter('update')) {
if (!$request->getMobileUID()) {
$this->getUser()->setFlash('error', 'Your mobile UID was not registered.');
$this->redirect('member/configUID');
}
$memberConfig = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
if (!$memberConfig) {
$memberConfig = new MemberConfig();
$memberConfig->setMember($this->getUser()->getMember());
$memberConfig->setName('mobile_uid');
}
$memberConfig->setValue($request->getMobileUID());
$memberConfig->save();
$this->getUser()->setFlash('notice', 'Your mobile UID was set successfully.');
$this->redirect('member/configUID');
} elseif ($request->hasParameter('delete') && $this->isDeletableUid) {
$mobileUid->delete();
$this->getUser()->setFlash('notice', 'Your mobile UID was deleted successfully.');
$this->redirect('member/configUID');
}
}
}
return sfView::SUCCESS;
}
示例2: sendConfirmMail
public function sendConfirmMail($to, $params = array())
{
$mail = new sfOpenPNEMailSend();
$mail->setSubject(opConfig::get('sns_name') . ' ' . sfContext::getInstance()->getI18N()->__('パスワード再発行のお知らせ'));
$mail->setTemplate('global/reissuedPasswordMail', $params);
$mail->send($to, opConfig::get('admin_mail_address'));
}
示例3: executeLink
/**
* Executes link action
*
* @param sfRequest $request A request object
*/
public function executeLink($request)
{
$this->redirectUnless(opConfig::get('enable_friend_link'), '@error');
$this->redirectIf($this->relation->isAccessBlocked(), '@error');
if ($this->relation->isFriend()) {
$this->getUser()->setFlash('error', 'This member already belongs to %my_friend%.');
$this->getUser()->setFlash('error_params', array('%my_friend%' => Doctrine::getTable('SnsTerm')->get('my_friend')->pluralize()));
$this->redirect('member/profile?id=' . $this->id);
}
if ($this->relation->isFriendPreFrom()) {
$this->getUser()->setFlash('error', '%Friend% request is already sent.');
$this->redirect('member/profile?id=' . $this->id);
}
$this->form = new FriendLinkForm();
if ($request->isMethod(sfWebRequest::POST)) {
$this->form->bind($request->getParameter('friend_link'));
if ($this->form->isValid()) {
$this->getUser()->setFlash('notice', 'You have requested %friend% link.');
$this->redirectToHomeIfIdIsNotValid();
$this->relation->setFriendPre();
$this->dispatcher->notify(new sfEvent($this, 'op_action.post_execute_' . $this->moduleName . '_' . $this->actionName, array('moduleName' => $this->moduleName, 'actionName' => $this->actionName, 'actionInstance' => $this, 'result' => sfView::SUCCESS)));
$this->redirect('member/profile?id=' . $this->id);
}
}
$this->member = Doctrine::getTable('Member')->find($this->id);
return sfView::INPUT;
}
示例4: executeAllMemberActivityBox
public function executeAllMemberActivityBox(opWebRequest $request)
{
$this->activities = Doctrine::getTable('ActivityData')->getAllMemberActivityList($this->gadget->getConfig('row'));
if ($this->gadget->getConfig('is_viewable_activity_form') && opConfig::get('is_allow_post_activity')) {
$this->form = new ActivityDataForm();
}
}
示例5: handleAction
protected function handleAction($filterChain, $actionInstance)
{
$moduleName = $actionInstance->getModuleName();
$actionName = $actionInstance->getActionName();
$request = $actionInstance->getRequest();
if ($request->needToRedirectToSoftBankGateway()) {
$request->redirectToSoftBankGateway();
}
$this->handleSsl($actionInstance);
$dispatcher = sfContext::getInstance()->getEventDispatcher();
// sfDoctrinePlugin needs to notify this event for enabling i18n
$dispatcher->notify(new sfEvent($this, 'user.change_culture', array('culture' => sfContext::getInstance()->getUser()->getCulture())));
self::notifyPreExecuteActionEvent($this, $dispatcher, $actionInstance);
Doctrine::getTable('SnsTerm')->configure(sfContext::getInstance()->getUser()->getCulture(), sfConfig::get('sf_app'));
if (sfConfig::has('op_is_use_captcha')) {
sfConfig::set('op_is_use_captcha', opConfig::get('is_use_captcha'));
}
try {
$result = parent::handleAction($filterChain, $actionInstance);
} catch (opRuntimeException $e) {
$this->forwardToErrorAction();
} catch (sfValidatorErrorSchema $e) {
if (isset($e['_csrf_token'])) {
$this->forwardToCSRFErrorAction();
}
throw $e;
}
self::notifyPostExecuteActionEvent($this, $dispatcher, $actionInstance, $result);
return $result;
}
示例6: executeUpdateTimeline
public function executeUpdateTimeline($request)
{
if ($request->isMethod(sfWebRequest::POST)) {
$this->forward404Unless(opConfig::get('is_allow_post_activity'));
parent::updateTimeline($request);
}
}
示例7: isMobile
public function isMobile()
{
if (opConfig::get('is_check_mobile_ip') && !$this->isMobileIPAddress()) {
return false;
}
return !$this->getMobile()->isNonMobile();
}
示例8: getNameAndCount
public function getNameAndCount($format = '%s (%d)')
{
if (!opConfig::get('enable_friend_link')) {
return $this->getName();
}
return sprintf($format, $this->getName(), $this->countFriends());
}
示例9: sendMail
public function sendMail()
{
$token = md5(opToolkit::generatePasswordString());
$this->member->setConfig('password_recovery_token', $token);
$params = array('token' => $token, 'id' => $this->member->id, 'subject' => '【' . opConfig::get('sns_name') . '】パスワード再設定用URL発行のお知らせ');
sfOpenPNEMailSend::sendTemplateMail('passwordRecovery', $this->member->getEMailAddress(), opConfig::get('admin_mail_address'), $params);
}
示例10: executeActivityBox
public function executeActivityBox()
{
$this->activities = Doctrine::getTable('ActivityData')->getFriendActivityList(null, $this->gadget->getConfig('row'));
if (opConfig::get('is_allow_post_activity')) {
$this->form = new ActivityDataForm();
}
}
示例11: sendMail
public function sendMail()
{
$params = $this->getValues();
if (!empty($params)) {
$from = opConfig::get('admin_mail_address');
$member = sfContext::getInstance()->getUser()->getMember();
$params['member_name'] = $member ? $member->getName() : null;
$params['member_id'] = $member ? $member->getId() : null;
$params['subject'] = '【' . opConfig::get('sns_name') . '】' . sfConfig::get('app_inquiry_mail_subject');
foreach (sfConfig::get('app_inquiry_form_widgets') as $key => $value) {
if (in_array($value['FormType'], array('radio', 'select', 'checkbox'))) {
$tmp = array();
if (!is_array($params[$key])) {
$params[$key] = array($params[$key]);
}
foreach ($params[$key] as $v) {
$tmp[] = '・' . $value['Choices'][$v];
}
$params['details'][$value['Caption']] = implode("\n", $tmp);
} else {
$params['details'][$value['Caption']] = $params[$key];
}
}
sfOpenPNEMailSend::sendTemplateMail('inquiryMail', $from, $from, $params);
if (sfConfig::get('app_inquiry_mail_confirm_send')) {
$params['subject'] = '【' . opConfig::get('sns_name') . '】' . sfConfig::get('app_inquiry_mail_subject_confirm');
sfOpenPNEMailSend::sendTemplateMail('inquiryMailConfirm', $params['mail_address'], $from, $params);
}
}
}
示例12: executeConfigUID
public function executeConfigUID(opWebRequest $request)
{
$option = array('member' => $this->getUser()->getMember());
$this->passwordForm = new opPasswordForm(array(), $option);
$mobileUid = Doctrine::getTable('MemberConfig')->retrieveByNameAndMemberId('mobile_uid', $this->getUser()->getMemberId());
$this->isSetMobileUid = $mobileUid && $mobileUid->getValue();
$this->isDeletableUid = (int) opConfig::get('retrieve_uid') < 2 && $this->isSetMobileUid;
if ($request->isMethod('post')) {
$this->passwordForm->bind($request->getParameter('password'));
if ($this->passwordForm->isValid()) {
if ($request->hasParameter('update')) {
$cookieUid = sfContext::getInstance()->getResponse()->generateMobileUidCookie();
if (!$request->getMobileUID(false) && !$cookieUid) {
$this->getUser()->setFlash('error', 'Your mobile UID was not registered.');
$this->redirect('member/configUID');
}
$member = $this->getUser()->getMember();
$member->setConfig('mobile_uid', $request->getMobileUID(false));
if ($cookieUid) {
$member->setConfig('mobile_cookie_uid', $cookieUid);
}
$this->getUser()->setFlash('notice', 'Your mobile UID was set successfully.');
$this->redirect('member/configUID');
} elseif ($request->hasParameter('delete') && $this->isDeletableUid) {
$mobileUid->delete();
sfContext::getInstance()->getResponse()->deleteMobileUidCookie();
$this->getUser()->setFlash('notice', 'Your mobile UID was deleted successfully.');
$this->redirect('member/configUID');
}
}
}
return sfView::SUCCESS;
}
示例13: configure
public function configure()
{
$snsConfig = sfConfig::get('openpne_sns_config');
$category = sfConfig::get('openpne_sns_category');
if (empty($category[$this->getOption('category')])) {
return false;
}
foreach ($category[$this->getOption('category')] as $configName) {
if (empty($snsConfig[$configName])) {
continue;
}
$this->setWidget($configName, opFormItemGenerator::generateWidget($snsConfig[$configName]));
$this->setValidator($configName, opFormItemGenerator::generateValidator($snsConfig[$configName]));
$this->widgetSchema->setLabel($configName, $snsConfig[$configName]['Caption']);
if (isset($snsConfig[$configName]['Help'])) {
$this->widgetSchema->setHelp($configName, $snsConfig[$configName]['Help']);
}
$value = opConfig::get($configName);
if ($value instanceof sfOutputEscaperArrayDecorator) {
$value = $value->getRawValue();
}
$this->setDefault($configName, $value);
}
$this->widgetSchema->setNameFormat('sns_config[%s]');
}
示例14: isDailyNewsDay
protected function isDailyNewsDay()
{
$day = date('w') - 1;
if (0 > $day) {
$day = 7;
}
return in_array($day, opConfig::get('daily_news_day')->getRawValue());
}
示例15: executeLogin
public function executeLogin(sfWebRequest $request)
{
if ('@opSkinClassicPlugin_login' !== opConfig::get('external_pc_login_url')) {
$this->redirect('member/login');
}
$this->form = $this->getUser()->getAuthForm();
unset($this->form['next_uri']);
}