Example #1
0
    public function __construct(Am_Protect_Databased $plugin)
    {
        parent::__construct($plugin->getId());
        $this->setTitle($plugin->getTitle());
        $this->plugin = $plugin;
        $url = Am_Controller::escape(REL_ROOT_URL) . '/default/admin-content/p/integrations/index';
        $text = ___("Once the plugin configuration is finished on this page, do not forget to add\n" . "a record on %saMember CP -> Protect Content -> Integrations%s page", '<a href="' . $url . '" target="_blank" class="link">', '</a>');
        $this->addProlog(<<<CUT
<div class="warning_box">
    {$text}
</div>   
CUT
);
    }
Example #2
0
 /**
  * Check if plaintextPass or saved password of amember user matches password
  * of current record 
  * @param User $user
  * @return bool true if password matches
  */
 function checkPassword(Am_Record $record, User $user, $plaintextPass = null)
 {
     if (!$this->_passField) {
         throw new Am_Exception_NotImplemented(get_class($this) . "->checkPassword() is not implemented");
     }
     if ($plaintextPass) {
         $salt = $this->_saltField ? $record->get($this->_saltField) : $record->get($this->_passField);
         return $this->_plugin->cryptPassword($plaintextPass, $salt, $user) === $record->get($this->_passField);
     } else {
         $saved = $this->_plugin->findPassword($user);
         if (!$saved) {
             return false;
         }
         if ($record->get($this->_passField) != $saved->pass) {
             return false;
         }
         if ($this->_saltField && $record->get($this->_saltField) != $saved->salt) {
             return false;
         }
         return true;
     }
 }
Example #3
0
 public function getIntegrationFormElements(HTML_QuickForm2_Container $group)
 {
     parent::getIntegrationFormElements($group);
     if ($this->getConfig('jomsocial')) {
         $group->addSelect('jomsocial_groups', array(), array('options' => array('' => '-- Select Group --') + $this->getJomsocialGroups()))->setLabel('JomSocial Group');
     }
     if ($this->getConfig('jacl')) {
         $groups = $this->getManagedUserGroups();
         $options = array();
         foreach ($groups as $g) {
             $options[$g->getId()] = $g->getTitle();
         }
         $group->addSelect('jacl_groups', array(), array('options' => array('' => '-- Select Group --') + $options))->setLabel('JACL Group');
     }
 }
Example #4
0
 function calculateGroups(User $user = null, $addDefault = false)
 {
     $groups = parent::calculateGroups($user, $addDefault);
     if ($this->getConfig('network') && $this->getConfig('network_add_to_blogs') && $this->calculateNetworkGroups($user)) {
         $groups[] = 'amember_active';
     }
     if ($groups && $user) {
         $add_group = $this->getIntegrationTable()->getAllowedResources($user, $this->getId()) ? 'amember_active' : 'amember_expired';
         if (!in_array($add_group, $groups)) {
             $groups[] = $add_group;
         }
     }
     return $groups;
 }