ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 10105


Ignore:
Timestamp:
Jan 12, 2009, 10:33:45 PM (14 years ago)
Author:
ebihara
Message:

#3308:added the member/invite action of the pc_backend application to send invitation mails by the SNS admin

Location:
OpenPNE3/trunk
Files:
5 added
7 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/pc_backend/modules/member/actions/actions.class.php

    r10078 r10105  
    5252    return sfView::SUCCESS;
    5353  }
     54
     55 /**
     56  * Executes invite action
     57  *
     58  * @param sfRequest $request A request object
     59  */
     60  public function executeInvite(sfWebRequest $request)
     61  {
     62    $this->plugins = opInstalledPluginManager::getAdminInviteAuthPlugins();
     63    if (empty($this->plugins))
     64    {
     65      return sfView::ERROR;
     66    }
     67
     68    $options = array(
     69      'authModes' => $this->plugins,
     70      'is_link' => false,
     71    );
     72    $this->form = new AdminInviteForm(null, $options);
     73
     74    if ($request->isMethod(sfWebRequest::POST))
     75    {
     76      $this->form->bind($request->getParameter('member_config'));
     77      if ($this->form->isValid())
     78      {
     79        $this->form->save();
     80        $this->redirect('member/invite');
     81      }
     82    }
     83
     84    return sfView::SUCCESS;
     85  }
    5486}
  • OpenPNE3/trunk/apps/pc_backend/modules/member/templates/_submenu.php

    r10078 r10105  
    11<li><?php echo link_to(__('メンバーリスト'), 'member/list') ?></li>
     2<li><?php echo link_to(__('招待メール送信'), 'member/invite') ?></li>
  • OpenPNE3/trunk/lib/config/config/auth.yml

    r9880 r10105  
    3939  IsConfig: false
    4040  Default:  "@homepage"
     41
     42admin_invite:
     43  IsConfig: false
     44  Default:  true
  • OpenPNE3/trunk/lib/form/InviteForm.class.php

    r10043 r10105  
    5656    {
    5757      $this->savePreConfig($name, $value);
    58       $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId($name.'_token', $this->member->getId());
     58      $memberConfig = MemberConfigPeer::retrieveByNameAndMemberId($name.'_token', $this->member->getId(), true);
    5959      $token = $memberConfig->getValue();
    6060      $this->sendConfirmMail($token, $value, array(
     
    6767  protected function sendConfirmMail($token, $to, $params = array())
    6868  {
     69    $authMode = $this->getOption('authMode', null);
     70    if (!$authMode)
     71    {
     72      $authMode = sfContext::getInstance()->getUser()->getCurrentAuthMode();
     73    }
     74
    6975    $param = array(
    7076      'token'    => $token,
    71       'authMode' => $this->getOption('authMode', sfContext::getInstance()->getUser()->getCurrentAuthMode()),
     77      'authMode' => $authMode,
    7278      'isMobile' => opToolkit::isMobileEmailAddress($to),
    7379    );
  • OpenPNE3/trunk/lib/model/MemberConfigPeer.php

    r10098 r10105  
    2020  static protected $results;
    2121
    22   public static function retrieveByNameAndMemberId($name, $memberId)
     22  public static function retrieveByNameAndMemberId($name, $memberId, $force = false)
    2323  {
    24     $results = self::getResultsByMemberId($memberId);
    25 
     24    $results = self::getResultsByMemberId($memberId, $force);
    2625    return (isset($results[$name])) ? $results[$name] : null;
    2726  }
     
    6362  }
    6463
    65   static protected function getResultsByMemberId($memberId)
     64  static protected function getResultsByMemberId($memberId, $force = false)
    6665  {
    67     if (!isset(self::$results[$memberId]))
     66    if (!isset(self::$results[$memberId]) || $force)
    6867    {
    6968      $criteria = new Criteria();
  • OpenPNE3/trunk/lib/plugin/opInstalledPluginManager.class.php

    r10003 r10105  
    3535    return opPlugin::getInstance($plugin);
    3636  }
     37
     38  static public function getAdminInviteAuthPlugins()
     39  {
     40    $plugins = sfContext::getInstance()->getConfiguration()->getEnabledAuthPlugin();
     41    $plugins = array_unique($plugins);
     42    $result = array();
     43
     44    foreach ($plugins as $pluginName)
     45    {
     46      $endPoint = strlen($pluginName) - strlen('opAuth') - strlen('Plugin');
     47      $authMode = substr($pluginName, strlen('opAuth'), $endPoint);
     48
     49      $adapterClass = sfOpenPNESecurityUser::getAuthAdapterClassName($authMode);
     50      $adapter = new $adapterClass($authMode);
     51      if (!$adapter->getAuthConfig('admin_invite'))
     52      {
     53        continue;
     54      }
     55
     56      $result[] = $authMode;
     57    }
     58
     59    return $result;
     60  }
    3761}
  • OpenPNE3/trunk/lib/util/opToolkit.class.php

    r10043 r10105  
    112112    return false;
    113113  }
     114
     115 /**
     116  * Unifys EOL characters in the string.
     117  *
     118  * @param string $string
     119  * @param string $eol
     120  *
     121  * @return string
     122  */
     123  public static function unifyEOLCharacter($string, $eol = "\n")
     124  {
     125    $eols = array("\r\n", "\r", "\n");
     126    if (!in_array($eol, $eols))
     127    {
     128      return $string;
     129    }
     130
     131    // first, unifys to LF
     132    $string = str_replace("\r\n", "\n", $string);
     133    $string = str_replace("\r", "\n", $string);
     134
     135    // second, unifys to specify EOL character
     136    if ($eol !== "\n")
     137    {
     138      $string = str_replace("\n", $eol, $string);
     139    }
     140
     141    return $string;
     142  }
    114143}
Note: See TracChangeset for help on using the changeset viewer.