本文整理汇总了PHP中GO::ignoreAclPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::ignoreAclPermissions方法的具体用法?PHP GO::ignoreAclPermissions怎么用?PHP GO::ignoreAclPermissions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::ignoreAclPermissions方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setIgnoreAclPermissions
/**
* If you set this to true then all acl's will allow all actions. Useful
* for maintenance scripts.
*
* It returns the old value.
*
* @param string $ignore
* @return boolean Old value
*/
public static function setIgnoreAclPermissions($ignore = true)
{
\GO::debug("setIgnoreAclPermissions(" . var_export($ignore, true) . ')');
$oldValue = \GO::$ignoreAclPermissions;
\GO::$ignoreAclPermissions = $ignore;
return $oldValue;
}
示例2: actionResetPassword
public function actionResetPassword()
{
if (empty($_GET['email'])) {
throw new \Exception(\GO::t("noemail", "site"));
}
$user = \GO\Base\Model\User::model()->findSingleByAttribute('email', $_GET['email']);
if (!$user) {
throw new \Exception(\GO::t("invaliduser", "site"));
}
if (isset($_GET['usertoken']) && $_GET['usertoken'] == $user->getSecurityToken()) {
if (\GO\Base\Util\Http::isPostRequest()) {
$user->password = $_POST['User']['password'];
$user->passwordConfirm = $_POST['User']['passwordConfirm'];
\GO::$ignoreAclPermissions = true;
if ($user->validate() && $user->save()) {
\Site::notifier()->setMessage('success', \GO::t('resetPasswordSuccess', 'site'));
}
}
} else {
\Site::notifier()->setMessage('error', \GO::t("invalidusertoken", "site"));
}
$user->password = null;
echo $this->render('resetPassword', array('user' => $user));
}
示例3: array
<?php
echo "Converting existing categories from user to calendar\n";
//require_once('../../../../GO.php');
\GO::$ignoreAclPermissions = true;
$oldCategories = array();
$stmt = \GO\Calendar\Model\Category::model()->find();
while ($category = $stmt->fetch()) {
if ($category->calendar_id != 0) {
$oldCategories[] = $category->id;
echo "Category {$category->name}\n";
$calStmt = \GO\Calendar\Model\Calendar::model()->findByAttribute('user_id', $category->calendar_id);
while ($calendar = $calStmt->fetch()) {
try {
// Create the new categories for each calendar
$newCategory = new \GO\Calendar\Model\Category();
$newCategory->name = $category->name;
$newCategory->color = $category->color;
$newCategory->calendar_id = $calendar->id;
$newCategory->save();
// Get all events that have the old category and change the category to the new one.
$eventStmt = \GO\Calendar\Model\Event::model()->findByAttributes(array('calendar_id' => $calendar->id, 'category_id' => $category->id));
while ($event = $eventStmt->fetch()) {
//echo "Update event $event->name\n";
$event->category_id = $newCategory->id;
$event->save();
}
} catch (\Exception $e) {
echo $e->getMessage() . "\n";
}
}
示例4: isset
function process_form()
{
\GO::$ignoreAclPermissions = true;
$this->check_required();
if (!isset($_POST['salutation'])) {
$_POST['salutation'] = isset($_POST['sex']) ? \GO::t('default_salutation_' . $_POST['sex']) : \GO::t('default_salutation_unknown');
}
//user registation
// if(!empty($_POST['username'])){
// $credentials = array ('username','first_name','middle_name','last_name','title','initials','sex','email',
// 'home_phone','fax','cellular','address','address_no',
// 'zip','city','state','country','company','department','function','work_phone',
// 'work_fax');
//
// if($_POST['password1'] != $_POST['password2'])
// {
// throw new Exception(\GO::t('error_match_pass','users'));
// }
//
// foreach($credentials as $key)
// {
// if(!empty($_REQUEST[$key]))
// {
// $userCredentials[$key] = $_REQUEST[$key];
// }
// }
// $userCredentials['password']=$_POST['password1'];
//
// $userModel = new \GO\Base\Model\User();
// $userModel->setAttributes($userCredentials);
// $userModel->save();
// foreach($this->user_groups as $groupId) {
// $currentGroupModel = \GO\Base\Model\Group::model()->findByPk($groupId);
// if($groupId>0 && $groupId!=\GO::config()->group_everyone && !$currentGroupModel->hasUser($userModel->id)) {
// $currentGroupModel->addUser($userModel->id);
// }
// }
// foreach($this->visible_user_groups as $groupId) {
// $userAclModel = \GO\Base\Model\Acl::model()->findByPk($userModel->acl_id);
// if($groupId>0 && !empty($userAclModel) && $userAclModel->hasGroup($groupId)) {
// $userAclModel->addGroup($groupId);
// }
// }
//
// \GO::session()->login($userCredentials['username'], $userCredentials['password']);
// }
if (!empty($_POST['email']) && !\GO\Base\Util\String::validate_email($_POST['email'])) {
throw new Exception(\GO::t('invalidEmailError'));
}
if (!empty($_REQUEST['addressbook'])) {
// require($GO_LANGUAGE->get_language_file('addressbook'));
// require_once($GO_MODULES->modules['addressbook']['class_path'].'addressbook.class.inc.php');
// $ab = new addressbook();
//
// $addressbook = $ab->get_addressbook_by_name($_REQUEST['addressbook']);
$addressbookModel = \GO\Addressbook\Model\Addressbook::model()->findSingleByAttribute('name', $_REQUEST['addressbook']);
if (!$addressbookModel) {
throw new Exception('Addressbook not found!');
}
$credentials = array('first_name', 'middle_name', 'last_name', 'title', 'initials', 'sex', 'email', 'email2', 'email3', 'home_phone', 'fax', 'cellular', 'comment', 'address', 'address_no', 'zip', 'city', 'state', 'country', 'company', 'department', 'function', 'work_phone', 'work_fax', 'salutation', 'url_linkedin', 'url_facebook', 'url_twitter', 'skype_name');
foreach ($credentials as $key) {
if (!empty($_REQUEST[$key])) {
$contactCredentials[$key] = $_REQUEST[$key];
}
}
if (isset($contactCredentials['comment']) && is_array($contactCredentials['comment'])) {
$comments = '';
foreach ($contactCredentials['comment'] as $key => $value) {
if ($value == 'date') {
$value = date($_SESSION['GO_SESSION']['date_format'] . ' ' . $_SESSION['GO_SESSION']['time_format']);
}
if (!empty($value)) {
$comments .= trim($key) . ":\n" . trim($value) . "\n\n";
}
}
$contactCredentials['comment'] = $comments;
}
if ($this->no_urls && isset($contactCredentials['comment']) && stripos($contactCredentials['comment'], 'http')) {
throw new Exception('Sorry, but to prevent spamming we don\'t allow URL\'s in the message');
}
$contactCredentials['addressbook_id'] = $addressbookModel->id;
$contactCredentials['email_allowed'] = isset($_POST['email_allowed']) ? '1' : '0';
if (!empty($contactCredentials['company']) && empty($contactCredentials['company_id'])) {
$companyModel = \GO\Addressbook\Model\Company::model()->findSingleByAttributes(array('name' => $contactCredentials['company'], 'addressbook_id' => $contactCredentials['addressbook_id']));
if (empty($companyModel)) {
$companyModel = new \GO\Addressbook\Model\Company();
$companyModel->addressbook_id = $contactCredentials['addressbook_id'];
$companyModel->name = $contactCredentials['company'];
// bedrijfsnaam
$companyModel->user_id = \GO::user()->id;
$companyModel->save();
$contactCredentials['company_id'] = $companyModel->id;
}
}
if (isset($_POST['birthday'])) {
try {
$contactCredentials['birthday'] = \GO\Base\Util\Date::to_db_date($_POST['birthday'], false);
} catch (Exception $e) {
throw new Exception(\GO::t('birthdayFormatMustBe') . ': ' . $_SESSION['GO_SESSION']['date_format'] . '.');
}
//.........这里部分代码省略.........
示例5: actionSyncContacts
protected function actionSyncContacts($params)
{
\GO::$ignoreAclPermissions = true;
//allow this script access to all
\GO::$disableModelCache = true;
//for less memory usage
ini_set('max_execution_time', '300');
$ab = \GO\Addressbook\Model\Addressbook::model()->findSingleByAttribute('users', '1');
//\GO::t('users','base'));
if (!$ab) {
$ab = new \GO\Addressbook\Model\Addressbook();
$ab->name = \GO::t('users');
$ab->users = true;
$ab->save();
}
$stmt = User::model()->find();
while ($user = $stmt->fetch()) {
$contact = $user->contact();
if (!$contact) {
\GO::output("Creating contact for " . $user->username);
$contact = new \GO\Addressbook\Model\Contact();
$contact->go_user_id = $user->id;
$contact->addressbook_id = $ab->id;
} else {
\GO::output("Updating contact for " . $user->username);
}
$attr = $user->getAttributes();
unset($attr['id']);
$contact->setAttributes($attr);
$contact->save();
}
\GO::output("Done!");
//return array('success' => true);
}