本文整理汇总了PHP中sqgetGlobalVar函数的典型用法代码示例。如果您正苦于以下问题:PHP sqgetGlobalVar函数的具体用法?PHP sqgetGlobalVar怎么用?PHP sqgetGlobalVar使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sqgetGlobalVar函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: adm_check_user
/**
* Check if user has access to administrative functions
*
* @return boolean
*/
function adm_check_user()
{
global $PHP_SELF, $plugins;
require_once SM_PATH . 'functions/global.php';
if (!in_array('administrator', $plugins)) {
return FALSE;
}
if (!sqgetGlobalVar('username', $username, SQ_SESSION)) {
$username = '';
}
/* This needs to be first, for all non_options pages */
if (strpos('options.php', $PHP_SELF)) {
$auth = FALSE;
} else {
if (file_exists(SM_PATH . 'plugins/administrator/admins')) {
$auths = file(SM_PATH . 'plugins/administrator/admins');
array_walk($auths, 'adm_array_trim');
$auth = in_array($username, $auths);
} else {
if (file_exists(SM_PATH . 'config/admins')) {
$auths = file(SM_PATH . 'config/admins');
array_walk($auths, 'adm_array_trim');
$auth = in_array($username, $auths);
} else {
if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && function_exists('posix_getpwuid')) {
$adm = posix_getpwuid($adm_id);
$auth = $username == $adm['name'];
} else {
$auth = FALSE;
}
}
}
}
return $auth;
}
示例2: cpw_do_change
/**
* Does the actual password changing (meaning it calls the hook function
* from the backend that does this. If something goes wrong, return error
* message(s). If everything ok, change the password in the session so the
* user doesn't have to log out, and redirect back to the options screen.
*/
function cpw_do_change()
{
global $cpw_backend;
sqgetGlobalVar('cpw_curpass', $curpw, SQ_POST);
sqgetGlobalVar('cpw_newpass', $newpw, SQ_POST);
sqgetGlobalVar('base_uri', $base_uri, SQ_SESSION);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('username', $username, SQ_SESSION);
require_once SM_PATH . 'plugins/change_password/backend/' . $cpw_backend . '.php';
$msgs = do_hook('change_password_dochange', $temp = array('username' => &$username, 'curpw' => &$curpw, 'newpw' => &$newpw));
/* something bad happened, return */
if (count($msgs) > 0) {
return $msgs;
}
/* update our password stored in the session */
$onetimepad = OneTimePadCreate(strlen($newpw));
sqsession_register($onetimepad, 'onetimepad');
$key = OneTimePadEncrypt($newpw, $onetimepad);
sqsetcookie('key', $key, 0, $base_uri);
/* make sure we write the session data before we redirect */
session_write_close();
header('Location: ' . SM_PATH . 'src/options.php?optmode=submit&optpage=change_password&plugin_change_password=1&smtoken=' . sm_generate_security_token());
exit;
}
示例3: cachePrefValues
/**
* Check the preferences into the session cache.
*
* @param string $data_dir
* @param string $username
*
* @since 1.1.3
*
*/
function cachePrefValues($data_dir, $username)
{
global $prefs_are_cached, $prefs_cache;
sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION);
if (isset($prefs_are_cached) && $prefs_are_cached) {
sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION);
// sm_print_r($prefs_cache);
// exit;
return;
}
sqsession_unregister('prefs_cache');
sqsession_unregister('prefs_are_cached');
/* Calculate the filename for the user's preference file */
$filename = getHashedFile($username, $data_dir, "{$username}.pref");
/* A call to checkForPrefs here should take eliminate the need for */
/* this to be called throughout the rest of the SquirrelMail code. */
checkForPrefs($data_dir, $username, $filename);
/* Make sure that the preference file now DOES exist. */
if (!file_exists($filename)) {
logout_error(sprintf(_("Preference file, %s, does not exist. Log out, and log back in to create a default preference file."), $filename));
exit;
}
/* Open the file, or else display an error to the user. */
if (!($file = @fopen($filename, 'r'))) {
logout_error(sprintf(_("Preference file, %s, could not be opened. Contact your system administrator to resolve this issue."), $filename));
exit;
}
/* Read in the preferences. */
$highlight_num = 0;
while (!feof($file)) {
$pref = '';
/* keep reading a pref until we reach an eol (\n (or \r for macs)) */
while ($read = fgets($file, 1024)) {
$pref .= $read;
if (strpos($read, "\n") || strpos($read, "\r")) {
break;
}
}
$pref = trim($pref);
$equalsAt = strpos($pref, '=');
if ($equalsAt > 0) {
$key = substr($pref, 0, $equalsAt);
$value = substr($pref, $equalsAt + 1);
//FIXME: this code is not in db_prefs.php that I can see
/* this is to 'rescue' old-style highlighting rules. */
if (substr($key, 0, 9) == 'highlight') {
$key = 'highlight' . $highlight_num;
$highlight_num++;
}
//FIXME: this code is not in db_prefs.php that I can see
if ($value != '') {
$prefs_cache[$key] = $value;
}
}
}
fclose($file);
$prefs_are_cached = TRUE;
sqsession_register($prefs_cache, 'prefs_cache');
sqsession_register($prefs_are_cached, 'prefs_are_cached');
}
示例4: Mail_Fetch_Servers
/**
* @return array
*/
function Mail_Fetch_Servers()
{
global $data_dir, $username;
$mailfetch = array();
$mailfetch['server_number'] = getPref($data_dir, $username, "mailfetch_server_number");
if (!isset($mailfetch['server_number']) || $mailfetch['server_number'] < 1) {
$mailfetch['server_number'] = 0;
}
$mailfetch['cypher'] = getPref($data_dir, $username, "mailfetch_cypher");
for ($i = 0; $i < $mailfetch['server_number']; $i++) {
$mailfetch[$i]['server'] = getPref($data_dir, $username, "mailfetch_server_{$i}");
$mailfetch[$i]['port'] = getPref($data_dir, $username, "mailfetch_port_{$i}");
$mailfetch[$i]['alias'] = getPref($data_dir, $username, "mailfetch_alias_{$i}");
$mailfetch[$i]['user'] = getPref($data_dir, $username, "mailfetch_user_{$i}");
$mailfetch[$i]['pass'] = getPref($data_dir, $username, "mailfetch_pass_{$i}");
if ($mailfetch['cypher'] == 'on') {
$mailfetch[$i]['pass'] = decrypt($mailfetch[$i]['pass']);
}
if ($mailfetch[$i]['pass'] == '') {
sqgetGlobalVar("pass_{$i}", $mailfetch[$i]['pass'], SQ_POST);
}
$mailfetch[$i]['lmos'] = getPref($data_dir, $username, "mailfetch_lmos_{$i}");
$mailfetch[$i]['login'] = getPref($data_dir, $username, "mailfetch_login_{$i}");
$mailfetch[$i]['uidl'] = getPref($data_dir, $username, "mailfetch_uidl_{$i}");
$mailfetch[$i]['subfolder'] = getPref($data_dir, $username, "mailfetch_subfolder_{$i}");
if ($mailfetch[$i]['alias'] == '') {
$mailfetch[$i]['alias'] == $mailfetch[$i]['server'];
}
// Authentication type (added in 1.5.2)
$mailfetch[$i]['auth'] = getPref($data_dir, $username, "mailfetch_auth_{$i}", MAIL_FETCH_AUTH_USER);
// Connection type (added in 1.5.2)
$mailfetch[$i]['type'] = getPref($data_dir, $username, "mailfetch_type_{$i}", MAIL_FETCH_USE_PLAIN);
}
return $mailfetch;
}
示例5: SquirrelOption
function SquirrelOption($name, $caption, $type, $refresh_level, $possible_values = '')
{
/* Set the basic stuff. */
$this->name = $name;
$this->caption = $caption;
$this->type = $type;
$this->refresh_level = $refresh_level;
$this->possible_values = $possible_values;
$this->size = SMOPT_SIZE_MEDIUM;
$this->comment = '';
$this->script = '';
/* Check for a current value. */
if (isset($GLOBALS[$name])) {
$this->value = $GLOBALS[$name];
} else {
$this->value = '';
}
/* Check for a new value. */
if (!sqgetGlobalVar("new_{$name}", $this->new_value, SQ_POST)) {
$this->new_value = '';
}
/* Set the default save function. */
if ($type != SMOPT_TYPE_HIDDEN && $type != SMOPT_TYPE_COMMENT) {
$this->save_function = SMOPT_SAVE_DEFAULT;
} else {
$this->save_function = SMOPT_SAVE_NOOP;
}
}
示例6: fortune_save
/**
* Save fortune prefs
* @access private
*/
function fortune_save()
{
global $username, $data_dir;
if (sqgetGlobalVar('fortune_fortune_visible', $fortune_fortune_visible, SQ_POST)) {
setPref($data_dir, $username, 'fortune_visible', '1');
} else {
setPref($data_dir, $username, 'fortune_visible', '');
}
}
示例7: bug_report_save
function bug_report_save()
{
global $username, $data_dir;
if (sqgetGlobalVar('bug_report_bug_report_visible', $vis, SQ_POST)) {
setPref($data_dir, $username, 'bug_report_visible', '1');
} else {
setPref($data_dir, $username, 'bug_report_visible', '');
}
}
示例8: bayesspam_button_action
function bayesspam_button_action($id)
{
if ($GLOBALS['bayesdbhandle'] == null) {
return;
}
if (!isset($id) || !is_array($id)) {
return;
}
sqgetGlobalVar('markSpam', $markSpam, SQ_POST);
sqgetGlobalVar('markHam', $markHam, SQ_POST);
if (isset($markSpam)) {
for ($i = 0; $i < count($id); $i++) {
bayesspam_learn_single($GLOBALS['imapConnection'], $GLOBALS['mailbox'], $id[$i], 'spam');
}
if ($GLOBALS['bayesspam_delete']) {
sqimap_msgs_list_delete($GLOBALS['imapConnection'], $GLOBALS['mailbox'], $id);
sqimap_mailbox_expunge($GLOBALS['imapConnection'], $GLOBALS['mailbox']);
} else {
if (sqimap_mailbox_exists($GLOBALS['imapConnection'], $GLOBALS['bayesspam_folder'])) {
if ($GLOBALS['mailbox'] == $GLOBALS['bayesspam_folder']) {
sqimap_msgs_list_move($GLOBALS['imapConnection'], $id, $GLOBALS['trash_folder']);
} else {
sqimap_msgs_list_move($GLOBALS['imapConnection'], $id, $GLOBALS['bayesspam_folder']);
}
sqimap_mailbox_expunge($GLOBALS['imapConnection'], $GLOBALS['mailbox']);
foreach ($id as $i) {
for ($a = 0; $a < count($GLOBALS['aMailbox']['UIDSET'][0]); $a++) {
if ($GLOBALS['aMailbox']['UIDSET'][0][$a] == $i) {
unset($GLOBALS['aMailbox']['UIDSET'][0][$a]);
}
}
foreach ($GLOBALS['aMailbox']['MSG_HEADERS'] as $m) {
if ($m['UID'] == $i) {
unset($GLOBALS['aMailbox']['MSG_HEADERS'][$i]);
}
}
}
// reindex the arrays
$GLOBALS['aMailbox']['MSG_HEADERS'] = array_values($GLOBALS['aMailbox']['MSG_HEADERS']);
$GLOBALS['aMailbox']['UIDSET'][0] = array_values($GLOBALS['aMailbox']['UIDSET'][0]);
$GLOBALS['aMailbox']['EXISTS'] -= count($id);
// Change the startMessage number if the mailbox was changed
if ($GLOBALS['aMailbox']['PAGEOFFSET'] - 1 >= $GLOBALS['aMailbox']['EXISTS']) {
$GLOBALS['aMailbox']['PAGEOFFSET'] = $GLOBALS['aMailbox']['PAGEOFFSET'] > $GLOBALS['aMailbox']['LIMIT'] ? $GLOBALS['aMailbox']['PAGEOFFSET'] - $GLOBALS['aMailbox']['LIMIT'] : 1;
$GLOBALS['aMailbox']['OFFSET'] = $GLOBALS['aMailbox']['PAGEOFFSET'] - 1;
}
}
}
} else {
if (isset($markHam)) {
for ($i = 0; $i < count($id); $i++) {
bayesspam_learn_single($GLOBALS['imapConnection'], $GLOBALS['mailbox'], $id[$i], 'nonspam');
}
}
}
}
示例9: view_header
function view_header($header, $mailbox, $color)
{
sqgetGlobalVar('QUERY_STRING', $queryStr, SQ_SERVER);
$ret_addr = SM_PATH . 'src/read_body.php?' . $queryStr;
displayPageHeader($color, $mailbox);
echo '<br />' . '<table width="100%" cellpadding="2" cellspacing="0" border="0" ' . 'align="center">' . "\n" . '<tr><td bgcolor="' . $color[9] . '" width="100%" align="center"><b>' . _("Viewing Full Header") . '</b> - ' . '<a href="';
echo_template_var($ret_addr);
echo '">' . _("View message") . "</a></b></td></tr></table>\n";
echo_template_var($header, array('<table width="99%" cellpadding="2" cellspacing="0" border="0" ' . "align=center>\n" . '<tr><td>', '<nobr><tt><b>', '</b>', '</tt></nobr>', '</td></tr></table>' . "\n"));
echo '</body></html>';
}
示例10: adm_check_user
/**
* Check if user has access to administrative functions
*
* @return boolean
*/
function adm_check_user()
{
global $plugins;
/* fail if the plugin is not enabled */
if (!in_array('administrator', $plugins)) {
return FALSE;
}
if (!sqgetGlobalVar('username', $username, SQ_SESSION)) {
$username = '';
}
/* This needs to be first, for all non_options pages */
//if (!defined('PAGE_NAME') || strpos(PAGE_NAME, 'options') === FALSE) {
if (!defined('PAGE_NAME') || PAGE_NAME != 'administrator_options' && PAGE_NAME != 'options') {
$auth = FALSE;
} else {
if (file_exists(SM_PATH . 'plugins/administrator/admins')) {
$auths = file(SM_PATH . 'plugins/administrator/admins');
array_walk($auths, 'adm_array_trim');
$auth = in_array($username, $auths);
} else {
if (file_exists(SM_PATH . 'config/admins')) {
$auths = file(SM_PATH . 'config/admins');
array_walk($auths, 'adm_array_trim');
$auth = in_array($username, $auths);
} else {
if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && function_exists('posix_getpwuid')) {
$adm = posix_getpwuid($adm_id);
$auth = $username == $adm['name'];
} else {
$auth = FALSE;
}
}
}
}
return $auth;
}
示例11: cachePrefValues
/**
* @ignore
*/
function cachePrefValues($username)
{
global $prefs_are_cached, $prefs_cache;
sqgetGlobalVar('prefs_are_cached', $prefs_are_cached, SQ_SESSION);
if ($prefs_are_cached) {
sqgetGlobalVar('prefs_cache', $prefs_cache, SQ_SESSION);
return;
}
sqsession_unregister('prefs_cache');
sqsession_unregister('prefs_are_cached');
$db = new dbPrefs();
if (isset($db->error)) {
printf(_("Preference database error (%s). Exiting abnormally"), $db->error);
exit;
}
$db->fillPrefsCache($username);
if (isset($db->error)) {
printf(_("Preference database error (%s). Exiting abnormally"), $db->error);
exit;
}
$prefs_are_cached = true;
sqsession_register($prefs_cache, 'prefs_cache');
sqsession_register($prefs_are_cached, 'prefs_are_cached');
}
示例12: sqgetGlobalVar
sqgetGlobalVar('filters_spam_folder_set', $filters_spam_folder_set, SQ_POST);
if (isset($filters_spam_folder_set)) {
setPref($data_dir, $username, 'filters_spam_folder', $filters_spam_folder_set);
} else {
echo _("You must select a spam folder.");
}
// setting scan type
sqgetGlobalVar('filters_spam_scan_set', $filters_spam_scan_set, SQ_POST);
if (isset($filters_spam_scan_set)) {
setPref($data_dir, $username, 'filters_spam_scan', $filters_spam_scan_set);
} else {
echo _("You must select a scan type.");
}
foreach ($spam_filters as $Key => $Value) {
$input = $spam_filters[$Key]['prefname'] . '_set';
if (sqgetGlobalVar($input, $input_key, SQ_POST)) {
setPref($data_dir, $username, $spam_filters[$Key]['prefname'], $input_key);
} else {
removePref($data_dir, $username, $spam_filters[$Key]['prefname']);
}
}
}
$filters_spam_folder = getPref($data_dir, $username, 'filters_spam_folder');
$filters_spam_scan = getPref($data_dir, $username, 'filters_spam_scan');
$filters = load_filters();
echo html_tag('table', html_tag('tr', html_tag('th', _("Spam Filtering"), 'center')), 'center', $color[0], 'width="95%" border="0" cellpadding="2" cellspacing="0"');
if ($SpamFilters_YourHop == ' ') {
echo '<br />' . html_tag('div', '<b>' . sprintf(_("WARNING! Tell the administrator to set the %s variable."), '"SpamFilters_YourHop"') . '</b>', 'center') . '<br />';
}
if (isset($action) && $action == 'spam') {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
示例13: define
<?php
/**
* Message Details plugin - top frame with buttons
*
* Plugin to view the RFC822 raw message output and the bodystructure of a message
*
* @author Marc Groot Koerkamp
* @copyright Copyright © 2002 Marc Groot Koerkamp, The Netherlands
* @copyright Copyright © 2004-2009 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: message_details_top.php 13549 2009-04-15 22:00:49Z jervfors $
* @package plugins
* @subpackage message_details
*/
/** @ignore */
define('SM_PATH', '../../');
/* SquirrelMail required files. */
require_once SM_PATH . 'include/validate.php';
displayHtmlHeader(_("Message Details"), "<script language=\"javascript\">\n" . "<!--\n" . "function printPopup() {\n" . "parent.frames[1].focus();\n" . "parent.frames[1].print();\n" . "}\n" . "-->\n" . "</script>\n", FALSE);
sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
if (!sqgetGlobalVar('passed_ent_id', $passed_ent_id, SQ_GET)) {
$passed_ent_id = 0;
}
sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
echo "<body text=\"{$color['8']}\" bgcolor=\"{$color['3']}\" link=\"{$color['7']}\" vlink=\"{$color['7']}\" alink=\"{$color['7']}\">\n" . '<center><b>' . '<form action="' . SM_PATH . 'src/download.php" method="GET">' . '<input type="button" value="' . _("Print") . '" onClick="printPopup()" /> ' . '<input type="button" value="' . _("Close Window") . '" onClick="window.parent.close()" /> ' . '<input type="submit" value="' . _("Save Message") . '" /> ' . '<input type="hidden" name="mailbox" value="' . urlencode($mailbox) . '" />' . '<input type="hidden" name="passed_id" value="' . urlencode($passed_id) . '" />' . '<input type="hidden" name="ent_id" value="' . urlencode($passed_ent_id) . '" />' . '<input type="hidden" name="absolute_dl" value="true" />' . '</form>' . '</b>' . '</body>' . "</html>\n";
示例14: sqgetGlobalVar
sqgetGlobalVar('username', $username, SQ_SESSION);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('delimiter', $delimiter, SQ_SESSION);
sqgetGlobalVar('mailbox', $mailbox, SQ_POST);
/* end globals */
if ($mailbox == '') {
displayPageHeader($color, 'None');
plain_error_message(_("You have not selected a folder to delete. Please do so.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color);
exit;
}
if (sqgetGlobalVar('backingout', $tmp, SQ_POST)) {
$location = get_location();
header("Location: {$location}/folders.php");
exit;
}
if (!sqgetGlobalVar('confirmed', $tmp, SQ_POST)) {
displayPageHeader($color, 'None');
echo '<br />' . html_tag('table', '', 'center', '', 'width="95%" border="0"') . html_tag('tr', html_tag('td', '<b>' . _("Delete Folder") . '</b>', 'center', $color[0])) . html_tag('tr') . html_tag('td', '', 'center', $color[4]) . sprintf(_("Are you sure you want to delete %s?"), str_replace(array(' ', '<', '>'), array(' ', '<', '>'), imap_utf7_decode_local($mailbox))) . addForm('folders_delete.php', 'post') . "<p>\n" . addHidden('mailbox', $mailbox) . addSubmit(_("Yes"), 'confirmed') . addSubmit(_("No"), 'backingout') . '</p></form><br /></td></tr></table>';
exit;
}
$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
$boxes = sqimap_mailbox_list($imap_stream);
$numboxes = count($boxes);
global $delete_folder;
if (substr($mailbox, -1) == $delimiter) {
$mailbox_no_dm = substr($mailbox, 0, strlen($mailbox) - 1);
} else {
$mailbox_no_dm = $mailbox;
}
/** lets see if we CAN move folders to the trash.. otherwise,
** just delete them **/
示例15: newmail_sav
function newmail_sav()
{
global $data_dir, $username;
if (sqgetGlobalVar('submit_newmail', $submit, SQ_POST)) {
$media_enable = '';
$media_popup = '';
$media_allbox = '';
$media_recent = '';
$media_changetitle = '';
$media_sel = '';
sqgetGlobalVar('media_enable', $media_enable, SQ_POST);
sqgetGlobalVar('media_popup', $media_popup, SQ_POST);
sqgetGlobalVar('media_allbox', $media_allbox, SQ_POST);
sqgetGlobalVar('media_recent', $media_recent, SQ_POST);
sqgetGlobalVar('media_changetitle', $media_changetitle, SQ_POST);
sqgetGlobalVar('popup_height', $newmail_popup_height, SQ_POST);
sqgetGlobalVar('popup_width', $newmail_popup_width, SQ_POST);
setPref($data_dir, $username, 'newmail_enable', $media_enable);
setPref($data_dir, $username, 'newmail_popup', $media_popup);
setPref($data_dir, $username, 'newmail_allbox', $media_allbox);
setPref($data_dir, $username, 'newmail_recent', $media_recent);
setPref($data_dir, $username, 'newmail_popup_height', $newmail_popup_height);
setPref($data_dir, $username, 'newmail_popup_width', $newmail_popup_width);
setPref($data_dir, $username, 'newmail_changetitle', $media_changetitle);
if (sqgetGlobalVar('media_sel', $media_sel, SQ_POST) && ($media_sel == '(none)' || $media_sel == '(local media)')) {
removePref($data_dir, $username, 'newmail_media');
} else {
setPref($data_dir, $username, 'newmail_media', $media_sel);
}
}
}