本文整理汇总了PHP中GO::config方法的典型用法代码示例。如果您正苦于以下问题:PHP GO::config方法的具体用法?PHP GO::config怎么用?PHP GO::config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GO
的用法示例。
在下文中一共展示了GO::config方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionGetUsers
/**
* Retreive all users that belong to the given group.
*
* @param int $id
* @return array Users
*/
protected function actionGetUsers($params)
{
//don't check ACL here because this method may be called by anyone.
$group = \GO\Base\Model\Group::model()->findByPk($params['id'], false, true);
if (empty($group)) {
$group = new \GO\Base\Model\Group();
}
if (isset($params['add_users']) && !empty($group->id)) {
$users = json_decode($params['add_users']);
foreach ($users as $usr_id) {
if ($group->addUser($usr_id)) {
\GO\Base\Model\User::model()->findByPk($usr_id)->checkDefaultModels();
}
}
}
$store = \GO\Base\Data\Store::newInstance(\GO\Base\Model\User::model());
$store->getColumnModel()->formatColumn('name', '$model->name', array(), array('first_name', 'last_name'));
$storeParams = $store->getDefaultParams($params)->joinCustomFields(false);
$delresponse = array();
//manually check permission here because this method may be accessed by any logged in user. allowWithoutModuleAccess is used above.
if ($group->checkPermissionLevel(\GO\Base\Model\Acl::DELETE_PERMISSION)) {
// The users in the group "everyone" cannot be deleted
if ($group->id != \GO::config()->group_everyone) {
$store->processDeleteActions($params, 'GO\\Base\\Model\\UserGroup', array('group_id' => $group->id));
} else {
$delresponse['deleteSuccess'] = false;
$delresponse['deleteFeedback'] = 'Members of the group everyone cannot be deleted.';
}
}
$stmt = $group->users($storeParams);
$store->setStatement($stmt);
$response = $store->getData();
$response = array_merge($response, $delresponse);
return $response;
}
示例2: install
public function install()
{
parent::install();
$lang = new Model\Language();
$lang->id = 1;
$lang->name = \GO::t('default', 'billing');
$lang->language = \GO::config()->language;
$lang->save();
$quoteBook = new Model\Book();
$quoteBook->name = \GO::t('quotes', 'billing');
$quoteBook->order_id_prefix = "Q%y";
$quoteBook->call_after_days = 3;
$quoteBook->createStatuses = array('sent', 'accepted', 'lost', 'in_process');
$quoteBook->save();
$orderBook = new Model\Book();
$orderBook->name = \GO::t('orders', 'billing');
$orderBook->order_id_prefix = "O%y";
$quoteBook->createStatuses = array('in_process', 'delivered', 'sent', 'billed');
$orderBook->save();
$invoiceBook = new Model\Book();
$invoiceBook->name = \GO::t('invoices', 'billing');
$invoiceBook->order_id_prefix = "I%y";
$invoiceBook->save();
return true;
}
示例3: run
/**
* The code that needs to be called when the cron is running
*
* If $this->enableUserAndGroupSupport() returns TRUE then the run function
* will be called for each $user. (The $user parameter will be given)
*
* If $this->enableUserAndGroupSupport() returns FALSE then the
* $user parameter is null and the run function will be called only once.
*
* @param CronJob $cronJob
* @param \GO\Base\Model\User $user [OPTIONAL]
*/
public function run(CronJob $cronJob, \GO\Base\Model\User $user = null)
{
\GO::session()->runAsRoot();
$usersStmt = \GO\Base\Model\User::model()->findByAttribute('mail_reminders', 1);
while ($userModel = $usersStmt->fetch()) {
\GO::debug("Sending mail reminders to " . $userModel->username);
$remindersStmt = \GO\Base\Model\Reminder::model()->find(\GO\Base\Db\FindParams::newInstance()->joinModel(array('model' => 'GO\\Base\\Model\\ReminderUser', 'localTableAlias' => 't', 'localField' => 'id', 'foreignField' => 'reminder_id', 'tableAlias' => 'ru'))->criteria(\GO\Base\Db\FindCriteria::newInstance()->addCondition('user_id', $userModel->id, '=', 'ru')->addCondition('time', time(), '<', 'ru')->addCondition('mail_sent', '0', '=', 'ru')));
while ($reminderModel = $remindersStmt->fetch()) {
// $relatedModel = $reminderModel->getRelatedModel();
// var_dump($relatedModel->name);
// $modelName = $relatedModel ? $relatedModel->localizedName : \GO::t('unknown');
$subject = \GO::t('reminder') . ': ' . $reminderModel->name;
$time = !empty($reminderModel->vtime) ? $reminderModel->vtime : $reminderModel->time;
date_default_timezone_set($userModel->timezone);
$body = \GO::t('time') . ': ' . date($userModel->completeDateFormat . ' ' . $userModel->time_format, $time) . "\n";
$body .= \GO::t('name') . ': ' . str_replace('<br />', ',', $reminderModel->name) . "\n";
// date_default_timezone_set(\GO::user()->timezone);
$message = \GO\Base\Mail\Message::newInstance($subject, $body);
$message->addFrom(\GO::config()->noreply_email, \GO::config()->title);
$message->addTo($userModel->email, $userModel->name);
\GO\Base\Mail\Mailer::newGoInstance()->send($message, $failedRecipients);
if (!empty($failedRecipients)) {
trigger_error("Reminder mail failed for recipient: " . implode(',', $failedRecipients), E_USER_NOTICE);
}
$reminderUserModelSend = \GO\Base\Model\ReminderUser::model()->findSingleByAttributes(array('user_id' => $userModel->id, 'reminder_id' => $reminderModel->id));
$reminderUserModelSend->mail_sent = 1;
$reminderUserModelSend->save();
}
date_default_timezone_set(\GO::user()->timezone);
}
}
示例4: getTotalUsage
/**
* Query the file_storage_usage once;
* @return integer total file storage usage in bytes
*/
protected function getTotalUsage()
{
if (!isset($this->_total_file_storage)) {
$this->_total_file_storage = \GO::config()->get_setting('file_storage_usage');
}
return $this->_total_file_storage;
}
示例5: printHead
function printHead()
{
echo '<html><head>' . '<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />' . '<link href="install.css" rel="stylesheet" type="text/css" />' . '<title>' . \GO::config()->product_name . ' Installation</title>' . '</head>' . '<body style="font-family: Arial,Helvetica;background-color:#f1f1f1">';
echo '<form method="post">';
echo '<div style="width:800px;padding:20px;margin:10px auto;background-color:white">';
echo '<img src="logo.gif" border="0" align="middle" style="margin:0px;margin-bottom:20px;" />';
}
示例6: init
public function init()
{
$this->formModel = new \GO\Site\Widget\ContactForm\ContactForm();
$this->formModel->receipt = isset($this->receipt) ? $this->receipt : \GO::config()->webmaster_email;
$this->formModel->name = \GO::user() ? \GO::user()->name : 'Website Guest';
$this->form = new \GO\Site\Widget\Form();
}
示例7: getPath
/**
* Get the path to the template folder
*
* @return string
*/
public function getPath()
{
if (empty(\Site::model()->module)) {
return false;
}
return \GO::config()->root_path . 'modules/' . \Site::model()->module . '/views/site/';
}
示例8: actionSubmit
protected function actionSubmit($params)
{
$text = $params['login_screen_text'];
$reportFeedback = '';
if (preg_match("/^<br[^>]*>\$/", $text)) {
$text = "";
}
\GO::config()->save_setting('login_screen_text', $text);
\GO::config()->save_setting('login_screen_text_title', $_POST['login_screen_text_title']);
\GO::config()->save_setting('login_screen_text_enabled', !empty($_POST['login_screen_text_enabled']) ? '1' : '0');
if (!empty($params['addressbook_name_template'])) {
\GO\Base\Model\AbstractUserDefaultModel::setNameTemplate("GO\\Addressbook\\Model\\Addressbook", $params['addressbook_name_template']);
}
if (!empty($params['task_name_template'])) {
\GO\Base\Model\AbstractUserDefaultModel::setNameTemplate("GO\\Tasks\\Model\\Tasklist", $params['task_name_template']);
}
if (isset($params['GO\\Tasks\\Model\\Tasklist_change_all_names'])) {
$this->_updateAllDefaultTasklists($reportFeedback);
}
if (!empty($params['calendar_name_template'])) {
\GO\Base\Model\AbstractUserDefaultModel::setNameTemplate("GO\\Calendar\\Model\\Calendar", $params['calendar_name_template']);
}
if (isset($params['GO\\Calendar\\Model\\Calendar_change_all_names'])) {
$this->_updateAllDefaultCalendars($reportFeedback);
}
$response['feedback'] = !empty($reportFeedback) ? $reportFeedback : '';
$response['success'] = true;
return $response;
}
示例9: head
public static function head()
{
$font_size = \GO::user() ? \GO::config()->get_setting('email_font_size', \GO::user()->id) : false;
if (!$font_size) {
$font_size = '12px';
}
echo "\n<!-- Inserted by EmailModule::head() -->\n<style>\n" . '.message-body,.message-body p, .message-body li, .go-html-formatted td, .em-composer .em-plaintext-body-field{' . 'font-size: ' . $font_size . ';!important' . "}\n</style>\n<!-- End EmailModule::head() -->\n";
}
示例10: newGoInstance
public static function newGoInstance()
{
$o = self::newInstance(\GO::config()->smtp_server, \GO::config()->smtp_port, strtolower(\GO::config()->smtp_encryption));
if (!empty(\GO::config()->smtp_username)) {
$o->setUsername(\GO::config()->smtp_username)->setPassword(\GO::config()->smtp_password);
}
return $o;
}
示例11: getTempDir
public function getTempDir()
{
$this->_tmpDir = \GO::config()->tmpdir . 'imap_messages/' . $this->account->id . '-' . $this->mailbox . '-' . $this->uid . '/';
if (!is_dir($this->_tmpDir)) {
mkdir($this->_tmpDir, 0700, true);
}
return $this->_tmpDir;
}
示例12: install
public function install()
{
parent::install();
$category = new Model\Category();
$category->name = \GO::t('general', 'bookmarks');
$category->save();
$category->acl->addGroup(\GO::config()->group_internal, \GO\Base\Model\Acl::READ_PERMISSION);
}
示例13: actionExport
public function actionExport($params)
{
// $params['book_id']=2;
$params['attributes'] = empty($params['attributes']) ? $this->exportableAttributes() : explode(',', $params['attributes']);
$className = get_class($this);
\GO::config()->save_setting($className . '_attributes', serialize($params['attributes']));
$this->export($params);
}
示例14: beforeSubmit
protected function beforeSubmit(&$response, &$model, &$params)
{
if (!\GO::user()) {
if (empty($params['serverclient_token']) || $params['serverclient_token'] != \GO::config()->serverclient_token) {
throw new \GO\Base\Exception\AccessDenied();
} else {
\GO::session()->runAsRoot();
}
}
if (isset($params['domain_id'])) {
$domainModel = \GO\Postfixadmin\Model\Domain::model()->findByPk($params['domain_id']);
} else {
$domainModel = \GO\Postfixadmin\Model\Domain::model()->findSingleByAttribute("domain", $params['domain']);
//serverclient module doesn't know the domain_id. It sends the domain name as string.
if (!$domainModel) {
//todo create new domain
$domainModel = new \GO\Postfixadmin\Model\Domain();
$domainModel->domain = $params['domain'];
$domainModel->user_id = \GO::user()->id;
$domainModel->save();
}
$params['domain_id'] = $domainModel->id;
$model->quota = $domainModel->default_quota;
}
if (isset($params['quota'])) {
$model->quota = \GO\Base\Util\Number::unlocalize($params['quota']) * 1024;
unset($params['quota']);
}
if ($params['password'] != $params['password2']) {
throw new \Exception(\GO::t('passwordMatchError'));
}
if (empty($params['password'])) {
unset($params['password']);
}
if (isset($params['username'])) {
$params['username'] .= '@' . $domainModel->domain;
}
if ($model->isNew) {
// $aliasModel = \GO\Postfixadmin\Model\Alias::model()->findSingleByAttribute('address', $params['username']);
// if (empty($aliasModel)) {
// $aliasModel = new \GO\Postfixadmin\Model\Alias();
// }
// $aliasModel->domain_id = $params['domain_id'];
// $aliasModel->address = $params['username'];
// $aliasModel->goto = $params['username'];
// $aliasModel->save();
if (!empty($params['alias']) && $params['alias'] != $params['username']) {
$aliasModel = \GO\Postfixadmin\Model\Alias::model()->findSingleByAttribute('address', $params['alias']);
if (empty($aliasModel)) {
$aliasModel = new \GO\Postfixadmin\Model\Alias();
}
$aliasModel->domain_id = $params['domain_id'];
$aliasModel->address = $params['alias'];
$aliasModel->goto = $params['username'];
$aliasModel->save();
}
}
}
示例15: inlinescripts
public static function inlinescripts()
{
$t = \GO::config()->get_setting('login_screen_text_enabled');
if (!empty($t)) {
$login_screen_text = \GO::config()->get_setting('login_screen_text');
$login_screen_text_title = \GO::config()->get_setting('login_screen_text_title');
echo 'GO.mainLayout.on("login", function(mainLayout){mainLayout.msg("' . \GO\Base\Util\String::escape_javascript($login_screen_text_title) . '", "' . \GO\Base\Util\String::escape_javascript($login_screen_text) . '", 3600, 400);});';
}
}