本文整理匯總了PHP中Ajax::denied方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ajax::denied方法的具體用法?PHP Ajax::denied怎麽用?PHP Ajax::denied使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ajax
的用法示例。
在下文中一共展示了Ajax::denied方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: avatar_action
/**
* Set avatar from social account
*
* @param type $id
*/
public function avatar_action($id)
{
$loginza = new Db_ORM('users_loginza');
$loginza->id = $id;
if ($loginza->find() && ($this->user->id == $id or access('loginza delete_all'))) {
if ($loginza->photo) {
$user = new User_Object();
$user->id = $this->user->id;
$path = UPLOADS . DS . 'avatars' . DS . $this->user->id . DS . basename($loginza->photo);
copy($loginza->photo, $path);
$user->avatar = Url::toUri($path, UPLOADS);
$user->save();
Ajax::json(array('action' => 'reload'));
}
} else {
Ajax::denied();
}
}
示例2: index
/**
* Gears dispatcher
*
* @param string $action
* @param string $gear
*/
public function index($action = NULL, $gear = NULL)
{
if (!access('admin gears')) {
Ajax::denied();
}
switch ($action) {
case 'activate':
cogear()->activate($gear);
$tpl = new Template('Gears.item');
$tpl->assign($this->{$gear}->info());
Ajax::json(array('items' => array(array('id' => 'gear-' . $gear, 'action' => 'replace', 'code' => $tpl->render()))));
break;
case 'deactivate':
cogear()->deactivate($gear);
$tpl = new Template('Gears.item');
$name = strtolower($gear);
$tpl->assign($this->{$name}->info());
Ajax::json(array('items' => array(array('id' => 'gear-' . $gear, 'action' => 'replace', 'code' => $tpl->render()))));
break;
}
}