本文整理汇总了PHP中system_message函数的典型用法代码示例。如果您正苦于以下问题:PHP system_message函数的具体用法?PHP system_message怎么用?PHP system_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* {@inheritdoc}
*/
protected function handle()
{
$plugins = elgg_get_plugins('inactive');
if (empty($plugins)) {
system_message('All plugins are active');
return;
}
$ids = array_map(function (ElggPlugin $plugin) {
return $plugin->getID();
}, $plugins);
$ids = array_values($ids);
if ($this->option('all')) {
$activate_ids = $ids;
} else {
$helper = $this->getHelper('question');
$question = new ChoiceQuestion('Please select plugins you would like to activate (comma-separated list of indexes)', $ids);
$question->setMultiselect(true);
$activate_ids = $helper->ask($this->input, $this->output, $question);
}
if (empty($activate_ids)) {
throw new \RuntimeException('You must select at least one plugin');
}
$plugins = [];
foreach ($activate_ids as $plugin_id) {
$plugins[] = elgg_get_plugin_from_id($plugin_id);
}
do {
$additional_plugins_activated = false;
foreach ($plugins as $key => $plugin) {
if ($plugin->isActive()) {
unset($plugins[$key]);
continue;
}
if (!$plugin->activate()) {
// plugin could not be activated in this loop, maybe in the next loop
continue;
}
$ids = array('cannot_start' . $plugin->getID(), 'invalid_and_deactivated_' . $plugin->getID());
foreach ($ids as $id) {
elgg_delete_admin_notice($id);
}
// mark that something has changed in this loop
$additional_plugins_activated = true;
unset($plugins[$key]);
system_message("Plugin {$plugin->getFriendlyName()} has been activated");
}
if (!$additional_plugins_activated) {
// no updates in this pass, break the loop
break;
}
} while (count($plugins) > 0);
if (count($plugins) > 0) {
foreach ($plugins as $plugin) {
$msg = $plugin->getError();
$string = $msg ? 'admin:plugins:activate:no_with_msg' : 'admin:plugins:activate:no';
register_error(elgg_echo($string, array($plugin->getFriendlyName())));
}
}
elgg_flush_caches();
}
示例2: pla_rdelete
function pla_rdelete($server, $dn)
{
# We delete all children, not only the visible children in the tree
$children = $server->getContainerContents($dn, null, 0, '(objectClass=*)', LDAP_DEREF_NEVER);
if (!is_array($children) || count($children) == 0) {
printf('<span style="white-space: nowrap;">%s %s...', _('Deleting'), $dn);
if ($server->delete($dn)) {
printf(' <span style="color:green">%s</span></span><br />', _('Success'));
return true;
} else {
system_message(array('title' => _('Could not delete the entry.') . sprintf(' (%s)', pretty_print_dn($dn)), 'body' => ldap_error_msg($server->getErrorMessage(null), $server->getErrorNum(null)), 'type' => 'error'));
}
} else {
foreach ($children as $child_dn) {
pla_rdelete($server, $child_dn);
}
printf('<span style="white-space: nowrap;">%s %s...', _('Deleting'), $dn);
if ($server->delete($dn)) {
printf(' <span style="color:green">%s</span></span><br />', _('Success'));
return true;
} else {
system_message(array('title' => _('Could not delete the entry.') . sprintf(' (%s)', pretty_print_dn($dn)), 'body' => ldap_error_msg($server->getErrorMessage(null), $server->getErrorNum(null)), 'type' => 'error'));
}
}
}
示例3: cas_insertUser
/**
* insert user into elgg user table
*
* Get user info from db
* Tries to insert, otherwise return error
*
* @return user
*/
function cas_insertUser($username, $casUser, $config)
{
// $name = $attr['cn'];
// $uname = !empty($attr['textuid']) ? $attr['textuid'] : str_replace(".", "",$username);
// $email = $attr['mail'];
$name = $casUser->name;
$uname = !empty($casUser->username) ? $casUser->username : $username;
$email = $casUser->email;
$password = md5($uname . $email);
$user = new ElggUser();
$user->username = $uname;
$user->email = $email;
$user->name = $name;
$user->access_id = 2;
$user->salt = generate_random_cleartext_password();
// Note salt generated before password!
$user->password = generate_user_password($user, $password);
$user->save();
$guid = $user->guid;
$obj = get_entity($guid);
if (isset($config->casadminuser) && $config->casadminuser == $username) {
if ($obj instanceof ElggUser && $obj->canEdit()) {
$obj->admin = 'yes';
if ($obj->admin) {
system_message(elgg_echo('admin:user:makeadmin:yes'));
} else {
register_error(elgg_echo('admin:user:makeadmin:no'));
}
} else {
register_error(elgg_echo('admin:user:makeadmin:no'));
}
}
return $user;
}
示例4: LoginUser
function LoginUser($tool_provider)
{
// Clear any existing sessions
if (elgg_is_logged_in()) {
logout();
}
$values = GetPluginSettings();
$userprovision = $values['userprovision'];
$user_id = $tool_provider->user->getID(BasicLTI_Tool_Provider::ID_SCOPE_GLOBAL);
$consumer_key = $tool_provider->consumer->guid;
$context_id = $tool_provider->user->context->id;
// Does user exist
$user = CheckLTIUser($user_id);
// Provision user, if on and needed
if (empty($user)) {
if ($userprovision) {
$user = CreateLTIUser($consumer_key, $context_id, $tool_provider->user);
if (empty($user)) {
forward();
}
} else {
system_message(elgg_echo('LTI:info:noprovision'));
forward();
exit;
}
}
// Set up current context id
$user->context_id = $context_id;
$user->email = $tool_provider->user->email;
$user->name = $tool_provider->user->fullname;
$user->save();
// Login
$result = login($user, false);
return $result;
}
示例5: show_next_celebrations
function show_next_celebrations()
{
$ViewReminder = elgg_get_plugin_setting("ViewReminder", "celebrations");
if (!$ViewReminder) {
$ViewReminder = "no";
}
if ($ViewReminder = "yes") {
$nextdaysCelebrations = elgg_get_plugin_setting("nextdaysCelebrations", "celebrations");
if (!$nextdaysCelebrations) {
$nextdaysCelebrations = 7;
}
$celebrations = user_celebrations($nextdaysCelebrations, 'next', 0);
//draw celebrations
if (!empty($celebrations)) {
foreach ($celebrations as $key => $val) {
if ($val['rest'] == 0) {
$days = elgg_echo('next_celebrations:today');
} elseif ($val['rest'] == 1) {
$days = elgg_echo('next_celebrations:dayleft');
} else {
$days = elgg_echo('next_celebrations:in') . ' ' . $val['rest'] . ' ' . elgg_echo('next_celebrations:daysleft');
}
system_message($days . elgg_echo('next_celebrations:celebrate') . $val['fullname'] . elgg_echo('next_celebrations:genitive') . elgg_echo('today_celebrations:' . $val['type']) . '.');
}
}
}
return true;
}
示例6: au_landing_user_login
function au_landing_user_login($event, $type, $object)
{
if (elgg_instanceof($object, 'user')) {
if (!is_email_address($object->email)) {
system_message(elgg_echo('au_landing:invalidemail'));
}
}
}
示例7: cclite_revoke
function cclite_revoke()
{
// unregister user's access tokens
set_plugin_usersetting('access_key', NULL);
set_plugin_usersetting('access_secret', NULL);
system_message(elgg_echo('cclite:revoke:success'));
forward('pg/settings/plugins');
}
示例8: elgg_gatekeeper
/**
* Used at the top of a page to mark it as logged in users only.
*
* @return void
* @since 1.9.0
*/
function elgg_gatekeeper()
{
if (!elgg_is_logged_in()) {
_elgg_services()->session->set('last_forward_from', current_page_url());
system_message(elgg_echo('loggedinrequired'));
forward('/login', 'login');
}
}
示例9: gvgroups_leave_group
function gvgroups_leave_group($group, $user)
{
if ($group->leave($user)) {
system_message(elgg_echo("gvgroups:localgroups:unsubscribe", array($group->name)));
} else {
register_error(elgg_echo("gvgroups:localgroups:error_unsubscribe", array($group->name)));
}
}
示例10: log_event
function log_event(&$sql, $date, $user_id, $user_name, $action, $comment)
{
$query = "insert into syslog (date, user_id, user_name, action, comment) values ('{$date}', '{$user_id}', '{$user_name}', '{$action}', '{$comment}')";
$rs = $sql->Execute($query);
if (!$rs) {
system_message($sql->ErrorMsg());
}
}
示例11: doConnect
function doConnect($tool_provider)
{
$result = LoginUser($tool_provider);
if (!$result && !empty($tool_provider->return_url)) {
$urlencode = urlencode(sprintf(elgg_echo('LTI:error:login'), elgg_get_config('sitename')));
forward($tool_provider->return_url . '<i_msg=' . $urlencode);
return false;
}
if (!$result && empty($tool_provider->return_url)) {
system_message(sprintf(elgg_echo('LTI:error:login'), elgg_get_config('sitename')));
forward();
return false;
}
// Send login time to consumer if has setting service and can handle freetext
$freetext = strpos(strtolower($tool_provider->context->getSetting('ext_ims_lis_resultvalue_sourcedids')), 'freetext');
if ($tool_provider->context->hasSettingService() && $freetext) {
$consumer_name_array = explode("-", $tool_provider->consumer->consumer_name, 2);
$consumer_name = $consumer_name_array[0];
$version = strtolower($consumer_name_array[1]);
$outcome = new LTI_Outcome($tool_provider->context->getSetting('lis_result_sourcedid'), '');
$outcome->type = 'freetext';
$result = $tool_provider->context->doOutcomesService(LTI_Context::EXT_READ, $outcome);
$count = 1;
switch ($consumer_name) {
case 'moodle':
if (!empty($result)) {
system_message(sprintf('LTI:last:login'), $result);
}
$outcome = new LTI_Outcome($tool_provider->context->getSetting("lis_result_sourcedid"), date('d-M-Y'));
$outcome->type = 'freetext';
$outcome->status = 'final';
break;
default:
if (!empty($result)) {
$pieces = explode(' ', $result);
$count = intval($pieces[0]);
$count++;
$last_login = $pieces[1] . ' ' . $pieces[2] . ' - Logins: ' . $count;
system_message(sprintf('LTI:last:login'), $last_login);
}
// Assume freetext available and send back date/count
$outcome = new LTI_Outcome($tool_provider->context->getSetting('lis_result_sourcedid'), $count . ' ' . date('d-M-Y H:i'));
$outcome->type = 'freetext';
$outcome->status = 'interim';
break;
}
$result = $tool_provider->context->doOutcomesService(LTI_Context::EXT_WRITE, $outcome);
}
// Store return URL for later use, if present
if (!empty($tool_provider->return_url)) {
$_SESSION['return_url'] = $tool_provider->return_url;
$_SESSION['return_name'] = 'Return to ' . $tool_provider->consumer->name;
}
ProvisionLTIGroup($tool_provider);
system_messages('Forwarded to Profile');
forward();
return false;
}
示例12: register_user
function register_user($uname, $upass)
{
global $sql;
global $cfg;
$timestamp = time();
if ($cfg['DB_TYPE'] === 'mysql') {
$query = "select admin_id, admin_pass, admin_type, created_by from admin where binary admin_name = ?";
}
$rs = exec_query($sql, $query, array($uname));
if ($rs->RecordCount() != 1) {
write_log("Login error, <b><i>" . htmlspecialchars($uname, ENT_QUOTES, "UTF-8") . "</i></b> unknown username");
return false;
}
$udata = $rs->FetchRow();
if (crypt($_POST['upass'], $udata[1]) === $udata[1] || md5($_POST['upass']) === $udata[1]) {
if (isset($_SESSION['user_logged'])) {
write_log($_SESSION['user_logged'] . " user already logged or session sharing problem! Aborting...");
system_message(tr('User already logged or session sharing problem! Aborting...'));
} else {
if ($udata['admin_type'] == "user") {
$domain_admin_id = $udata['admin_id'];
$query = <<<SQL_QUERY
select
domain_status
from
domain
where
domain_admin_id = ?;
SQL_QUERY;
$rs = exec_query($sql, $query, array($domain_admin_id));
$user_dom_data = $rs->FetchRow();
if ($user_dom_data['domain_status'] != $cfg['ITEM_OK_STATUS']) {
write_log(htmlspecialchars($uname, ENT_QUOTES, "UTF-8") . " Domain status is not OK - user can not login");
return false;
}
}
// all is OK let's login the user
$user_login_time = time();
$query = <<<SQL_QUERY
insert into login
(session_id, lastaccess)
values
(?, ?)
SQL_QUERY;
$rs = exec_query($sql, $query, array($uname, $user_login_time));
$_SESSION['user_logged'] = $uname;
$_SESSION['user_type'] = $udata['admin_type'];
$_SESSION['user_id'] = $udata['admin_id'];
$_SESSION['user_created_by'] = $udata['created_by'];
$_SESSION['user_login_time'] = $user_login_time;
write_log(htmlspecialchars($uname, ENT_QUOTES, "UTF-8") . " user logged in.");
return true;
}
} else {
write_log(htmlspecialchars($uname, ENT_QUOTES, "UTF-8") . " bad password login data.");
return false;
}
}
示例13: exec_query
function exec_query(&$sql, $query, $data)
{
$stmt = $sql->Prepare($query);
$rs = $sql->Execute($query, $data);
if (!$rs) {
system_message($sql->ErrorMsg());
}
return $rs;
}
示例14: handle
/**
* {@inheritdoc}
*/
protected function handle()
{
$upgrader = _elgg_services()->upgrades;
$result = $upgrader->run();
if ($result['failure'] == true) {
register_error($result['reason']);
} else {
system_message('Upgrade script ran without failures');
}
}
示例15: gen_packages_list
function gen_packages_list(&$tpl, &$sql, $user_id)
{
global $cfg;
if (isset($cfg['HOSTING_PLANS_LEVEL']) && $cfg['HOSTING_PLANS_LEVEL'] === 'admin') {
$query = <<<SQL_QUERY
\t\t\tselect
\t\t\t\tt1.*,
\t\t\t\tt2.admin_id, t2.admin_type
\t\t\tfrom
\t\t\t\thosting_plans as t1,
\t\t\t\tadmin as t2
\t\t\twhere
\t\t\t\tt2.admin_type=?
\t\t\tand
\t\t\t\tt1.reseller_id = t2.admin_id
\t\t\tand
\t\t\t\tt1.status=1
\t\t\torder by
\t\t\t\tt1.id
SQL_QUERY;
$rs = exec_query($sql, $query, array('admin'));
} else {
$query = <<<SQL_QUERY
\t\t\t\tselect
\t\t\t\t\t*
\t\t\t\tfrom
\t\t\t\t\thosting_plans
\t\t\t\twhere
\t\t\t\t\treseller_id = ?
\t\t\t\t and
\t\t\t\t\tstatus = '1'
SQL_QUERY;
$rs = exec_query($sql, $query, array($user_id));
}
if ($rs->RecordCount() == 0) {
system_message(tr('No available hosting packages'));
} else {
while (!$rs->EOF) {
$description = $rs->fields['description'];
if ($description == '') {
$description = '';
}
$price = $rs->fields['price'];
if ($price == 0 || $price == '') {
$price = "/ " . tr('free of charge');
} else {
$price = "/ " . $price . " " . $rs->fields['value'] . " " . $rs->fields['payment'];
}
$tpl->assign(array('PACK_NAME' => $rs->fields['name'], 'PACK_ID' => $rs->fields['id'], 'USER_ID' => $user_id, 'PURCHASE' => tr('Purchase'), 'PACK_INFO' => $description, 'PRICE' => $price));
$tpl->parse('PURCHASE_LIST', '.purchase_list');
$rs->MoveNext();
}
}
}