本文整理汇总了PHP中App\Controller\AppController类的典型用法代码示例。如果您正苦于以下问题:PHP AppController类的具体用法?PHP AppController怎么用?PHP AppController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AppController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: forgotPassEmail
/**
* @param $data
* @param $code
*/
public function forgotPassEmail($data, $code)
{
$app = new AppController();
$subject = 'Forgot Password Link - ' . $app->appsName;
$email = new Email('mandril');
$link = $app->getDomain() . '/users/reset_password?code=' . $code;
$user = array('to' => $data['username'], 'name' => $data['profile']['first_name'] . ' ' . $data['profile']['last_name']);
$data = array('user' => $user, 'appName' => $app->appsName, 'link' => $link);
$email->from([$app->emailFrom => $app->appsName])->to($user['to'])->subject($subject)->theme($app->currentTheme)->template('forgot_password')->emailFormat('html')->set(['data' => $data])->send();
}
开发者ID:sohelrana820,项目名称:projectify,代码行数:14,代码来源:UtilitiesComponent.php
示例2: updateMarked
public function updateMarked()
{
$controller = new AppController();
$fitbit = $controller->loadComponent('Fitbit');
$lr_table = TableRegistry::get('LinkedRecords');
$linked_records = $lr_table->find()->contain('SocialAccounts')->where(['marked_for_update' => 1]);
foreach ($linked_records as $linked_record) {
$fitbit->_saveSteps($linked_record->social_account, 'steps', $linked_record->associated_date);
}
}
开发者ID:abf6ug,项目名称:statbro,代码行数:10,代码来源:UpdateFitbitRecordsShell.php
示例3: isAuthorized
public function isAuthorized($user = null)
{
//DTR: Por defecto no se autoriza el acceso al usuario/rol/controlador/accion.
$res = false;
//DTR: Si se quiere controlar en herencia, reusar el metodo padre...
//...pero solo en herencia de "AppController"
$res = parent::isAuthorized($user);
//\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' usuario= '.var_export( $user, true));
//\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' _SESSION= '.var_export( $_SESSION, true));
//Cualquiera de las acciones de este controlador se permiten SOLO para
//los usuarios de rol administrador, y eso se controla ya en
//"AppController".
if (!$res) {
$rol = $user['rol'];
$controlador = $this->request->params['controller'];
$accion = $this->request->params['action'];
//Permite el aceso al usuario 'sysadmin
if ($user['rol'] === 'sysadmin') {
$res = true;
}
//Permite el acceso al método 'cambiarRol' al usuario 'sysadmin' únicamente
if ($user['nombre'] === 'sysadmin' && $accion === 'cambiarRol') {
//\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' rol= '.$rol.', acceso= '.$controlador.'::'.$accion.', res= '.var_export( $res, true));
//\Cake\Log\Log::write( 'debug', __METHOD__.'['.__LINE__.']'.' _SESSION= '.var_export( $_SESSION, true));
$res = true;
}
}
if (isset($user) && $this->request->params['action'] === 'logout') {
$res = true;
}
return $res;
}
开发者ID:EPSZ-DAW2,项目名称:daw2-2015-recetas-cocina,代码行数:32,代码来源:UsuariosController.php
示例4: beforeDelete
public function beforeDelete(Event $event, Entity $entity)
{
$upload_root_offset = Configure::read('UPLOAD_ROOT_OFFSET');
$upload_root = Configure::read('UPLOAD_ROOT');
$id = $entity->id;
$job_id = $entity->job_id;
// delete creative folder and all its contents
AppController::delete_folder($upload_root_offset . DS . $upload_root . DS . $job_id . DS . $id);
/*
$Files = TableRegistry::get('Files');
$files = $Files->find('all',['conditions'=>['creative_id'=>$id]])->toArray();
if( !empty($files) ) {
foreach($files as $row){
$file_path = $upload_root_offset . $row['file'];
if( file_exists($file_path) ) {
if ( is_dir($file_path) ){
if( AppController::delete_folder($file_path) ) {
}
} else if( unlink($file_path) ) {
}
}
}
}
*/
}
开发者ID:dlowetz,项目名称:asset-preview,代码行数:27,代码来源:CreativesTable.php
示例5: isAuthorized
public function isAuthorized($user = null)
{
if (in_array($this->request->action, ['index', 'view', 'logout'])) {
return true;
}
return parent::isAuthorized($user);
}
开发者ID:alricklovesballs,项目名称:M1BdD,代码行数:7,代码来源:UsersController.php
示例6: beforeFilter
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->layout = 'admin';
$this->loadModel('PartnerMailinglists');
$this->loadModel('PartnerMailinglistSegmentRules');
}
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:7,代码来源:PartnerMailinglistSegmentsController.php
示例7: initialize
public function initialize()
{
parent::initialize();
$this->loadModel('Activities');
$this->loadModel('Favoris');
$this->loadModel('Offers');
}
开发者ID:CalypsoTeam,项目名称:Noddi,代码行数:7,代码来源:UsersController.php
示例8: beforeFilter
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
//$this->Auth->allow('add','edit');
$this->viewBuilder()->layout('custom');
$this->Auth->allow(['add', 'edit', 'delete']);
}
开发者ID:Campustop,项目名称:devv2,代码行数:7,代码来源:FaqController.php
示例9: initialize
public function initialize()
{
parent::initialize();
// Set the layout
$this->viewBuilder()->layout('admin');
$this->loadComponent('Cewi/Excel.Import');
}
开发者ID:rashmi,项目名称:newrepo,代码行数:7,代码来源:ProductsController.php
示例10: beforeFilter
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
$this->layout = 'dashboard';
$this->Upload->uploadDir .= DS . Time::now()->i18nFormat('YYYY/MM/dd');
$this->Upload->fileVar = 'file';
if (in_array($this->request->param('action'), ['upload']) && $this->request->is('post')) {
$data = $this->request->data;
if (empty($data['file'])) {
$this->Upload->fileVar = 'thumbnail_url';
}
$name = $data[$this->Upload->fileVar]['name'];
if (empty($data['title'])) {
$data['title'] = str_replace('-', ' ', $this->_toSlug(pathinfo($name)['filename']));
}
$data['title'] = ucfirst($data['title']);
if (empty($data['slug'])) {
$data['slug'] = $this->autoSlug($data['title']);
}
$data[$this->Upload->fileVar]['name'] = $this->__processFileName($data[$this->Upload->fileVar]['name']);
$data[$this->Upload->fileVar]['name'] = $data['slug'] . '-' . Time::now()->i18nFormat('YYYY-MM-dd');
// $img_size = getimagesize($data[$this->Upload->fileVar]['tmp_name']);
// if ($img_size) {
// $data[$this->Upload->fileVar]['name'] .= '-w' . $img_size[0] . '-h' . $img_size[1] . '-' . md5_file($data["file"]["tmp_name"]);
// }
$data[$this->Upload->fileVar]['name'] .= '.' . pathinfo($name)['extension'];
$this->request->data = $data;
}
}
开发者ID:ansidev,项目名称:cakephp_blog,代码行数:29,代码来源:MediaController.php
示例11: beforeFilter
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
// Allow free access.
$this->Auth->allow(['index', 'contact']);
$this->layout = 'frontend';
}
开发者ID:franky0930,项目名称:MarketingConnex,代码行数:7,代码来源:ContactController.php
示例12: initialize
/**
* Initialization hook method.
*
* @return void
*/
public function initialize()
{
parent::initialize();
// Deny public access
$this->Auth->deny('index');
$this->Auth->config('unauthorizedRedirect', ['controller' => 'forums', 'action' => 'index']);
}
开发者ID:Hazzaman,项目名称:forum,代码行数:12,代码来源:ThreadsController.php
示例13: isAuthorized
public function isAuthorized($user)
{
// All registered users can add projects and view the index.
if (in_array($this->request->action, ['add', 'index'])) {
return true;
}
// The owner of an project can edit and delete it.
if (in_array($this->request->action, ['view', 'edit', 'delete'])) {
$projectId = (int) $this->request->params['pass'][0];
if ($this->Projects->isOwnedBy($projectId, $user['id'])) {
return true;
}
}
$ProjectsUsers = TableRegistry::get('ProjectsUsers');
// Check from the ProjectsUsers table if the person trying to access
// is a moderator of that project.
if (in_array($this->request->action, ['view'])) {
$projectId = (int) $this->request->params['pass'][0];
if ($ProjectsUsers->isModeratedBy($projectId, $user['id'])) {
return true;
}
}
// Check from the ProjectsUsers table if the person trying to access
// is assigned to that project.
if (in_array($this->request->action, ['view'])) {
$projectId = (int) $this->request->params['pass'][0];
if ($ProjectsUsers->isAssignedTo($projectId, $user['id'])) {
return true;
}
}
return parent::isAuthorized($user);
}
开发者ID:Custodia,项目名称:caketickets,代码行数:32,代码来源:ProjectsController.php
示例14: isAuthorized
public function isAuthorized($user)
{
if (in_array($this->request->action, ['addPost', 'indexPost', 'viewPost', 'deletePost'])) {
return true;
}
return parent::isAuthorized($user);
}
开发者ID:webroup17,项目名称:social_networking,代码行数:7,代码来源:PostsController.php
示例15: beforeFilter
public function beforeFilter(\Cake\Event\Event $event)
{
parent::beforeFilter($event);
$this->Crud->listener('relatedModels')->relatedModels(['GameMemberships'], 'edit');
//why no worky
$this->loadComponent('Stream');
}
开发者ID:abf6ug,项目名称:statbro,代码行数:7,代码来源:GamesController.php
示例16: beforeFilter
public function beforeFilter(Event $event)
{
parent::beforeFilter($event);
if (isset($this->Auth)) {
$this->Auth->allow();
}
}
开发者ID:dereuromark,项目名称:cakephp-data,代码行数:7,代码来源:DataAppController.php
示例17: initialize
public function initialize()
{
parent::initialize();
// Set the layout
$this->viewBuilder()->layout('admin');
//$this->Auth->allow();
}
开发者ID:rashmi,项目名称:newrepo,代码行数:7,代码来源:WishlistsController.php
示例18: isAuthorized
public function isAuthorized($user)
{
if ($this->request->action === 'index') {
return true;
}
return parent::isAuthorized($user);
}
开发者ID:Cylindric,项目名称:edge,代码行数:7,代码来源:WeaponsController.php
示例19: hasAuthUser
protected function hasAuthUser($id = null)
{
$coin = $this->request->param('coin');
$this->loadModel('CharactersConditions');
$data = $this->CharactersConditions->find()->hydrate(false)->select(['player_id' => 'Characters.player_id'])->where(['CharactersConditions.condition_id' => $coin])->contain('Characters')->first();
return parent::hasAuthUser(@$data['player_id']);
}
开发者ID:pwerken,项目名称:va-void,代码行数:7,代码来源:ConditionsController.php
示例20: beforeFilter
public function beforeFilter(Event $event)
{
$this->Auth->autoRedirect = FALSE;
parent::beforeFilter($event);
$this->viewBuilder()->layout('custom');
$conn = ConnectionManager::get('default');
}
开发者ID:Campustop,项目名称:devv2,代码行数:7,代码来源:HomeController.php
注:本文中的App\Controller\AppController类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论