/** * 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; }
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')); }
/** * 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; }
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(); } }
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; }
public function executeUpdateTimeline($request) { if ($request->isMethod(sfWebRequest::POST)) { $this->forward404Unless(opConfig::get('is_allow_post_activity')); parent::updateTimeline($request); } }
public function isMobile() { if (opConfig::get('is_check_mobile_ip') && !$this->isMobileIPAddress()) { return false; } return !$this->getMobile()->isNonMobile(); }
public function getNameAndCount($format = '%s (%d)') { if (!opConfig::get('enable_friend_link')) { return $this->getName(); } return sprintf($format, $this->getName(), $this->countFriends()); }
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); }
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(); } }
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); } } }
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; }
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]'); }
protected function isDailyNewsDay() { $day = date('w') - 1; if (0 > $day) { $day = 7; } return in_array($day, opConfig::get('daily_news_day')->getRawValue()); }
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']); }
protected function sendConfirmMail($token, $to, $params = array()) { $options = array_merge(array('token' => $token), $params); $mail = new sfOpenPNEMailSend(); $mail->setSubject('メールアドレス変更ページのお知らせ'); $mail->setTemplate('global/changeMobileAddressMail', $options); $mail->send($to, opConfig::get('admin_mail_address')); }
public function getTitle() { $result = parent::getTitle(); if (!$result) { $result = opConfig::get('sns_title') ? opConfig::get('sns_title') : opConfig::get('sns_name'); } return $result; }
public function execute($filterChain) { $route = $this->context->getRouting()->getCurrentRouteName(); if (!opConfig::get('enable_openid')) { $filterChain->execute(); } elseif ('homepage' === $route) { $this->context->getResponse()->setHttpHeader('X-XRDS-Location', $this->context->getController()->genUrl('@openid_idpxrds', true)); } $filterChain->execute(); }
public function save() { $token = md5(uniqid(mt_rand(), true)); $this->member->setConfig('register_mobile_token', $token); $param = array('token' => $token, 'id' => $this->member->getId()); $mail = new opMailSend(); $mail->setSubject(opConfig::get('sns_name') . '携帯登録'); $mail->setTemplate('member/registerMobileMail', $param); $mail->send($this->getValue('mobile_address'), opConfig::get('admin_mail_address')); }
public static function get($name, $default = '#000000', $app = null) { if (is_null($app)) { $app = sfConfig::get('sf_app'); } $configName = 'op_' . $app . '_color_config_' . $name; $result = sfConfig::get($configName, opConfig::get($app . '_' . $name, self::$defaultColors[$name])); sfContext::getInstance()->getConfiguration()->loadHelpers('Escaping'); return sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $result); }
public function save() { if ('classic' === $this->getValue('login')) { Doctrine::getTable('SnsConfig')->set('external_pc_login_url', '@opSkinClassicPlugin_login'); } else { if ('@opSkinClassicPlugin_login' === opConfig::get('external_pc_login_url')) { Doctrine::getTable('SnsConfig')->set('external_pc_login_url', ''); } } }
public function executeTimelineAll(sfWebRequest $request) { if ($this->gadget->getConfig('is_viewable_activity_form') && opConfig::get('is_allow_post_activity')) { $this->form = new ActivityDataForm(); } $builder = opActivityQueryBuilder::create()->setViewerId($this->getUser()->getMemberId()); $builder->includeSns()->includeFriends()->includeSelf(); $query = $builder->buildQuery(); $globalAPILimit = $this->gadget->getConfig('row'); $query->limit($globalAPILimit); $this->activities = $query->andWhere('in_reply_to_activity_id IS NULL')->execute(); }
protected function doClean($value) { try { return parent::doClean($value); } catch (sfValidatorError $e) { if ($e->getCode() == 'max_size') { $arguments = $e->getArguments(true); throw new sfValidatorError($this, 'max_size', array('max_size' => opConfig::get('image_max_filesize'), 'size' => $arguments['size'])); } throw $e; } }
/** * Executes this filter. * * @param sfFilterChain $filterChain A sfFilterChain instance */ public function execute($filterChain) { $current = $this->context->getRouting()->getCurrentRouteName(); $configName = 'enable_' . $this->getParameter('app', 'pc'); if (!opConfig::get($configName)) { if ($current !== 'error') { $this->context->getController()->redirect('@error'); throw new sfStopException(); } } $filterChain->execute(); }
public function executeRegisterEnd(sfWebRequest $request) { opActivateBehavior::disable(); $member = $this->getUser()->getMember(); opActivateBehavior::enable(); $this->forward404Unless($member); if (opConfig::get('retrieve_uid') == 3 && !sfConfig::get('app_is_mobile', false) && !$member->getConfig('mobile_uid')) { $this->forward('member', 'registerMobileToRegisterEnd'); } $this->getUser()->getAuthAdapter()->activate(); $this->getUser()->setIsSNSMember(true); $this->redirect('member/home'); }
public function execute($request) { $this->forward404Unless(opConfig::get('enable_jsonapi')); $moduleName = strtolower($this->moduleName); sfConfig::set('mod_' . $moduleName . '_view_class', 'opJsonApi'); $this->getResponse()->setContentType('application/json'); $enableEscaping = true; if (isset($request['escaping'])) { $enableEscaping = in_array($request['escaping'], array('1', 'on', 'true')); } sfConfig::set('sf_escaping_strategy', $enableEscaping); return parent::execute($request); }
public function appendRules(Zend_Acl $acl, $resource = null) { $acl->allow('everyone', $resource, 'view')->allow('self', $resource, 'edit')->deny('blocked'); if (opConfig::get('is_allow_config_public_flag_profile_page')) { $config = opConfig::get('is_allow_config_public_flag_profile_page'); } elseif ($resource) { $config = $resource->getConfig('profile_page_public_flag'); } if ($config && 4 == $config) { $acl->allow('anonymous', $resource, 'view'); } return $acl; }
protected function execute($arguments = array(), $options = array()) { parent::execute($arguments, $options); $connection = Doctrine_Manager::connection(); $this->connectionOptions = $connection->getOptions(); sfContext::createInstance($this->createConfiguration('pc_frontend', 'prod'), 'pc_frontend'); sfOpenPNEApplicationConfiguration::registerZend(); $this->adminMailAddress = opConfig::get('admin_mail_address'); $helpers = array_unique(array_merge(array('Helper', 'Url', 'Asset', 'Tag', 'Escaping'), sfConfig::get('sf_standard_helpers'))); sfContext::getInstance()->getConfiguration()->loadHelpers($helpers); if (null !== $options['log-file']) { $this->logger = new sfFileLogger($this->dispatcher, array('file' => $options['log-file'])); } }
public function __construct(Member $member = null, $options = array(), $CSRFSecret = null) { parent::__construct($member, $options, $CSRFSecret); if (opConfig::get('is_allow_config_public_flag_profile_page')) { unset($this['profile_page_public_flag']); } if (!opConfig::get('is_allow_web_public_flag_age')) { $widget = $this->widgetSchema['age_public_flag']; $choices = $widget->getOption('choices'); unset($choices[4]); $widget->setOption('choices', $choices); $this->validatorSchema['age_public_flag']->setOption('choices', array_keys($choices)); } }
protected function generateDayList() { $result = array(); $dayNames = sfDateTimeFormatInfo::getInstance(sfContext::getInstance()->getUser()->getCulture())->getAbbreviatedDayNames(); $sun = array_shift($dayNames); $dayNames[] = $sun; $day = opConfig::get('daily_news_day'); $config = sfConfig::get('openpne_sns_config'); $i18n = sfContext::getInstance()->getI18N(); foreach ($day as $v) { $result[] = $i18n->__($config['daily_news_day']['Choices'][$v]); } return $result; }