示例#1
0
文件: Mail.php 项目: Cheren/union
 /**
  * Email constructor.
  *
  * @param Entity $entity
  */
 public function __construct(Entity $entity)
 {
     $config = PluginConfig::getInstance()->getGroup('union_core');
     $this->_entity = $entity;
     $this->config = $config->params();
     $this->_entityId = $entity->get('id');
     $this->_arrayData = $entity->toArray();
     $this->_serverName = Union::serverName();
     $this->mailer = $this->config->get('mailer', 'mail');
     $this->fromName = $this->config->get('mailfrom', 'Union CMS');
     $this->fromEmail = $this->config->get('mailname', '*****@*****.**');
 }
示例#2
0
 /**
  * Count user failed login.
  *
  * @param Controller $controller
  * @return \Cake\Network\Response|void
  */
 protected function _countFailedLogin(Controller $controller)
 {
     $config = PluginConfig::getInstance()->getGroup('union_community');
     $cacheName = 'failed_' . $controller->request->data('username');
     $cacheConfig = 'auth';
     if ($controller->request->param('prefix') == 'admin') {
         $cacheConfig .= '_admin';
     }
     $cacheValue = Cache::read($cacheName, $cacheConfig);
     $maxAuth = $config->params()->get('max_auth', 5);
     $cookieVal = $controller->Cookie->read('fail.auth');
     if ($cacheValue >= $maxAuth || $cookieVal >= $maxAuth) {
         $controller->Flash->error(__d('community', 'You have reached maximum limit for failed login attempts. Please try again after a few minutes.'));
         return $controller->redirect($controller->Auth->config('loginAction'));
     }
 }
示例#3
0
文件: UserMail.php 项目: Cheren/union
 /**
  * User mail notification constructor.
  *
  * @param Entity $entity
  */
 public function __construct(Entity $entity)
 {
     $config = PluginConfig::getInstance()->getGroup('union_community');
     $this->_community = $config->params();
     parent::__construct($entity);
 }
示例#4
0
 * @version         1.0.x
 * @copyright       Copyright (C) by cool-code.ru
 * @license         http://www.opensource.org/licenses/mit-license.php MIT License
 * @coder           Segrey Kalistratov <*****@*****.**>
 */
use Cake\Log\Log;
use Cake\Cache\Cache;
use Cake\Core\Configure;
use Union\Core\Event\EventManager;
use Cake\Core\Plugin as CakePlugin;
use Union\Extensions\Data\PluginConfig;
Configure::write('Document.dir', 'ltr');
Configure::write('Html.iconPrefix', 'fa');
Configure::write('Html.btnPrefix', 'btn');
Configure::write('Cache.defaultConfig', ['className' => 'File', 'duration' => '+1 hour', 'path' => CACHE . 'queries' . DS, 'prefix' => 'un_']);
Cache::config('short', ['className' => 'File', 'duration' => '+1 hours', 'path' => CACHE . 'short' . DS, 'prefix' => 'cache_short_']);
Log::config('event', ['className' => 'File', 'path' => LOGS, 'scopes' => ['event'], 'file' => 'event.log']);
$pluginPath = CakePlugin::path('Union/Core');
$eventConfig = $pluginPath . 'config' . DS . 'events.php';
if (file_exists($eventConfig)) {
    Configure::load('Union/Core.events');
}
/** @noinspection PhpIncludeInspection */
require_once $pluginPath . 'src' . DS . 'basics.php';
/** @noinspection PhpIncludeInspection */
require_once $pluginPath . 'config' . DS . 'loader.php';
$config = PluginConfig::getInstance()->getGroup('union_core');
if ($config) {
    Configure::write('debug', (bool) $config->params()->get('debug', true));
}
EventManager::loadListeners();