本文整理汇总了PHP中get_opendb_config_var函数的典型用法代码示例。如果您正苦于以下问题:PHP get_opendb_config_var函数的具体用法?PHP get_opendb_config_var怎么用?PHP get_opendb_config_var使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_opendb_config_var函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display_s_item_type_insert_form
function display_s_item_type_insert_form($HTTP_VARS)
{
$sat_results = fetch_sfieldtype_attribute_type_rs(array('TITLE', 'CATEGORY', 'STATUSTYPE', 'STATUSCMNT', 'DURATION'));
while ($attribute_type_r = db_fetch_assoc($sat_results)) {
$s_attribute_type_list_rs[] = $attribute_type_r;
}
db_free_result($sat_results);
echo get_s_attribute_type_tooltip_array($s_attribute_type_list_rs);
echo "\n<table>";
// s_item_type
echo get_input_field("s_item_type", NULL, "Item Type", "text(10,10)", "Y", $HTTP_VARS['s_item_type']);
//description
echo get_input_field("description", NULL, "Description", "text(30,60)", "Y", $HTTP_VARS['description']);
//image
echo get_input_field("image", NULL, "Image", "url(15,*,\"gif,jpg,png\",N)", "N", $HTTP_VARS['image']);
echo "\n</table>";
echo "<h4>Field Type Attributes</h4>";
echo "\n<table>";
display_item_type_insert_field('Title', 'TITLE');
display_item_type_insert_field('Category', 'CATEGORY');
display_item_type_insert_field('Status Type', 'STATUSTYPE');
display_item_type_insert_field('Status Comment', 'STATUSCMNT');
if (get_opendb_config_var('borrow', 'enable') !== FALSE && get_opendb_config_var('borrow', 'duration_support') !== FALSE) {
display_item_type_insert_field('Borrow Duration', 'DURATION');
}
echo "\n</table>";
}
开发者ID:horrabin,项目名称:opendb,代码行数:27,代码来源:index.php
示例2: get_announcements_block
function get_announcements_block()
{
$buffer = '';
if (is_user_granted_permission(PERM_ADMIN_ANNOUNCEMENTS)) {
// include a login warning if user password and email are still the defaults
if (get_opendb_session_var('user_id') == 'admin') {
$announcements_rs = get_admin_announcements_rs();
while (list(, $announcement_r) = each($announcements_rs)) {
$buffer .= "<li><h4>" . $announcement_r['heading'] . "</h4>\n\t\t\t\t\t<p class=\"content\">" . $announcement_r['message'] . "<a class=\"adminLink\" href=\"" . $announcement_r['link'] . "\">" . $announcement_r['link_text'] . "</a></p>";
}
}
}
if (get_opendb_config_var('welcome.announcements', 'enable') !== FALSE && is_user_granted_permission(PERM_VIEW_ANNOUNCEMENTS)) {
$results = fetch_announcement_rs('submit_on', 'DESC', 0, get_opendb_config_var('welcome.announcements', 'display_count'), 'Y', 'Y');
if ($results) {
while ($announcement_r = db_fetch_assoc($results)) {
$buffer .= "<li><h4>" . $announcement_r['title'] . "</h4>";
$buffer .= "<small class=\"submitDate\">" . get_localised_timestamp(get_opendb_config_var('welcome.announcements', 'datetime_mask'), $announcement_r['submit_on']) . "</small>";
$buffer .= "<p class=\"content\">" . nl2br($announcement_r['content']) . "</p></li>";
}
db_free_result($results);
}
}
if (strlen($buffer) > 0) {
return "\n<div id=\"announcements\">" . "<h3>" . get_opendb_lang_var('announcements') . "</h3>" . "\n<ul>" . $buffer . "\n</ul></div>";
} else {
return NULL;
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:29,代码来源:welcome.php
示例3: check_item_type_structure
function check_item_type_structure($s_item_type, &$error)
{
if (is_exists_item_type($s_item_type)) {
$missing_s_field_types = NULL;
if (!fetch_sfieldtype_item_attribute_type($s_item_type, 'TITLE')) {
$missing_s_field_types[] = 'TITLE';
}
if (!fetch_sfieldtype_item_attribute_type($s_item_type, 'STATUSTYPE')) {
$missing_s_field_types[] = 'STATUSTYPE';
}
if (!fetch_sfieldtype_item_attribute_type($s_item_type, 'STATUSCMNT')) {
$missing_s_field_types[] = 'STATUSCMNT';
}
if (!fetch_sfieldtype_item_attribute_type($s_item_type, 'CATEGORY')) {
$missing_s_field_types[] = 'CATEGORY';
}
if (get_opendb_config_var('borrow', 'enable') !== FALSE && get_opendb_config_var('borrow', 'duration_support') !== FALSE) {
if (!fetch_sfieldtype_item_attribute_type($s_item_type, 'DURATION')) {
$missing_s_field_types[] = 'DURATION';
}
}
if (is_not_empty_array($missing_s_field_types)) {
$error = array('error' => 'The following Field Type attribute relationships are missing.', 'detail' => $missing_s_field_types);
return FALSE;
} else {
// No errors so no problem.
return TRUE;
}
} else {
// no message if s_item_type does not even exist.
return FALSE;
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:33,代码来源:functions.php
示例4: output_cache_file
function output_cache_file($url)
{
// no point streaming a local URI
if (is_url_absolute($url) && get_opendb_config_var('http.stream_external_images', 'enable') !== FALSE && is_uri_domain_in_list($url, get_opendb_config_var('http.stream_external_images', 'domain_list'))) {
$snoopy = new OpenDbSnoopy();
$dataBuffer =& $snoopy->fetchURI($url, FALSE);
if ($dataBuffer !== FALSE) {
if (is_array($snoopy->headers)) {
for ($i = 0; $i < count($snoopy->headers); $i++) {
header($snoopy->headers[$i]);
}
}
echo $dataBuffer;
flush();
} else {
opendb_redirect($url);
}
unset($snoopy);
} else {
if (($file = get_item_input_file_upload_url($url)) !== FALSE) {
// file upload - that is not cached
opendb_redirect($file);
} else {
opendb_redirect($url);
}
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:27,代码来源:url.php
示例5: get_edit_announcement_input_form
function get_edit_announcement_input_form($announcement_r, $HTTP_VARS = NULL)
{
global $PHP_SELF;
$buffer .= "<form action=\"{$PHP_SELF}\" method=\"POST\">";
$buffer .= "\n<input type=\"hidden\" name=\"type\" value=\"announcements\">";
if (is_array($announcement_r)) {
$buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"update\">" . "\n<input type=\"hidden\" name=\"announcement_id\" value=\"" . $announcement_r['announcement_id'] . "\">";
} else {
$buffer .= "\n<input type=\"hidden\" name=\"op\" value=\"insert\">";
}
$buffer .= "<table>";
$buffer .= get_input_field("title", NULL, 'Title', "text(50,500)", "Y", ifempty($announcement_r['title'], $HTTP_VARS['title']), TRUE);
$buffer .= get_input_field("content", NULL, 'Announcement', "htmlarea(60,15)", "Y", ifempty($announcement_r['content'], $HTTP_VARS['content']), TRUE);
$buffer .= get_input_field("display_days", NULL, 'Display Days', "number(10,10)", "Y", ifempty($announcement_r['display_days'], $HTTP_VARS['display_days']), TRUE);
if (is_array($announcement_r)) {
$buffer .= get_input_field("closed_ind", NULL, 'Closed', "checkbox(Y,N)", "N", ifempty($announcement_r['closed_ind'], $HTTP_VARS['closed_ind']), TRUE);
}
$buffer .= "</table>";
$help_r[] = array('img' => 'compulsory.gif', 'text' => get_opendb_lang_var('compulsory_field'), id => 'compulsory');
$help_r[] = array('text' => 'A zero in Display Days indicates the announcment will never expire.');
$help_r[] = array('text' => 'No validation is performed on HTML entered in the Announcement text field.');
$buffer .= format_help_block($help_r);
if (get_opendb_config_var('widgets', 'enable_javascript_validation') !== FALSE) {
$onclick_event = "if(!checkForm(this.form)){return false;}else{this.form.submit();}";
} else {
$onclick_event = "this.form.submit();";
}
$buffer .= "<input type=\"button\" class=\"button\" onclick=\"{$onclick_event}\" value=\"Save\">";
$buffer .= "\n</form>";
return $buffer;
}
开发者ID:horrabin,项目名称:opendb,代码行数:31,代码来源:index.php
示例6: is_valid_item_type_structure
function is_valid_item_type_structure($s_item_type)
{
if (is_exists_item_type($s_item_type)) {
if (fetch_sfieldtype_item_attribute_type($s_item_type, 'TITLE')) {
if (fetch_sfieldtype_item_attribute_type($s_item_type, 'STATUSTYPE')) {
if (fetch_sfieldtype_item_attribute_type($s_item_type, 'STATUSCMNT')) {
if (fetch_sfieldtype_item_attribute_type($s_item_type, 'CATEGORY')) {
if (get_opendb_config_var('borrow', 'enable') !== FALSE && get_opendb_config_var('borrow', 'duration_support') !== FALSE) {
if (fetch_sfieldtype_item_attribute_type($s_item_type, 'DURATION')) {
// At this point all the required s_field_type mappings have been provided.
return TRUE;
}
} else {
// At this point $borrow functionality is not enabled, so we do not
// have to do anymore testing.
return TRUE;
}
}
}
}
}
}
//else
return FALSE;
}
开发者ID:horrabin,项目名称:opendb,代码行数:25,代码来源:item_type.php
示例7: isAvailable
function isAvailable($userid)
{
if (($this->getConfigId() == NULL || get_opendb_config_var($this->getConfigId(), 'enable') === TRUE) && ($this->getPermId() == NULL || is_user_granted_permission($this->getPermId(), $userid))) {
return TRUE;
} else {
return FALSE;
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:8,代码来源:WelcomeBlock.class.php
示例8: get_secret_image_code
/**
* TODO - note that date is used as part of the generated code, so if someone tries to
* register just before a date change, the registration may fail - but its a fairly
* unlikely occurence.
*
* @param unknown_type $random_num
* @return unknown
*/
function get_secret_image_code($random_num)
{
$security_hash = get_opendb_config_var('site', 'security_hash');
$datekey = date("F j");
$rcode = hexdec(md5(get_http_env('HTTP_USER_AGENT') . $security_hash . $random_num . $datekey));
$code = substr($rcode, 2, 6);
return $code;
}
开发者ID:horrabin,项目名称:opendb,代码行数:16,代码来源:secretimage.php
示例9: get_content_type_charset
function get_content_type_charset()
{
$contentType = "text/html";
$charSet = get_opendb_config_var('themes', 'charset');
if (strlen($charSet) > 0) {
$contentType .= ";charset=" . $charSet;
}
return $contentType;
}
开发者ID:horrabin,项目名称:opendb,代码行数:9,代码来源:theme.php
示例10: opendb_pre_query
/**
* @param $sql
*/
function opendb_pre_query($sql)
{
$dbserver_conf_r = get_opendb_config_var('db_server');
if (strlen($dbserver_conf_r['table_prefix']) > 0) {
$sql = parse_sql_statement($sql, $dbserver_conf_r['table_prefix']);
}
if ($dbserver_conf_r['debug-sql'] === TRUE) {
echo '<p class="debug-sql">SQL: ' . $sql . '</p>';
}
return $sql;
}
开发者ID:horrabin,项目名称:opendb,代码行数:14,代码来源:database.php
示例11: validate_review_input
function validate_review_input($HTTP_VARS, &$errors)
{
$errors = NULL;
if (get_opendb_config_var('item_review', 'comment_compulsory') == TRUE && strlen($HTTP_VARS['comment']) == 0) {
$errors[] = array(error => get_opendb_lang_var('prompt_must_be_specified', 'prompt', get_opendb_lang_var('review')));
}
if (get_opendb_config_var('item_review', 'rating_compulsory') == TRUE && strlen($HTTP_VARS['rating']) == 0) {
$errors[] = array(error => get_opendb_lang_var('prompt_must_be_specified', 'prompt', get_opendb_lang_var('rating')));
}
if (is_array($errors)) {
return FALSE;
} else {
return TRUE;
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:15,代码来源:item_review.php
示例12: build_announcements_feed
function build_announcements_feed($URL, $datemask)
{
$rssout = '';
$last_items_list_conf_r = get_opendb_config_var('feeds.announcements');
// TODO - make the options here configurable
$result = fetch_announcement_rs(NULL, "DESC", 0, $last_items_list_conf_r['total_num_items'], "N", "Y");
//$limit_closed
// Create the RSS item tags
if ($result && db_num_rows($result) > 0) {
while ($item_instance_r = db_fetch_assoc($result)) {
$rssout .= "\n\t<item>" . "\n\t\t<title>" . rss_encoded($item_instance_r['title']) . "</title>" . "\n\t\t<link>" . rss_encoded($URL) . "</link>" . "\n\t\t<pubDate>" . get_localised_timestamp($datemask, $item_instance_r['submit_on']) . " " . date('T') . "</pubDate>" . "\n\t\t<guid>" . rss_encoded($URL) . "</guid>" . "\n\t\t<description>" . rss_encoded(nl2br($item_instance_r['content'])) . "</description>" . "\n\t</item>";
}
db_free_result($result);
}
return $rssout;
}
开发者ID:horrabin,项目名称:opendb,代码行数:16,代码来源:rss.php
示例13: getItemsPerPageControl
function getItemsPerPageControl($PHP_SELF, $HTTP_VARS)
{
$buffer = '';
$items_per_page_options_r = get_opendb_config_var('listings', 'items_per_page_options');
if (is_not_empty_array($items_per_page_options_r)) {
$items_per_page_rs = array();
while (list(, $items_per_page) = each($items_per_page_options_r)) {
if ($items_per_page == '0') {
$display = get_opendb_lang_var('all');
} else {
$display = $items_per_page;
}
$items_per_page_rs[] = array('value' => $items_per_page, 'display' => $display);
}
$buffer .= "<form class=\"itemsPerPageControl\" id=\"form-items_per_page\" action=\"" . $PHP_SELF . "\" method=\"GET\">" . get_url_fields($HTTP_VARS) . "<label for=\"select-items_per_page\">" . get_opendb_lang_var('items_per_page') . '</label>' . "<select id=\"select-items_per_page\" name=\"items_per_page\" class=\"footer\" onChange=\"this.form.submit()\">" . custom_select('items_per_page', $items_per_page_rs, '%display%', 'NA', ifempty($HTTP_VARS['items_per_page'], get_opendb_config_var('listings', 'items_per_page')), 'value') . "\n</select></form>";
}
return $buffer;
}
开发者ID:horrabin,项目名称:opendb,代码行数:18,代码来源:listutils.php
示例14: get_table_content
/**
Get the content of $table as a series of INSERT statements.
*/
function get_table_content($table, $crlf)
{
$result = db_query("SELECT * FROM {$table}");
//prefix if required to table name before exporting.
if (strlen(get_opendb_config_var('db_server', 'table_prefix')) > 0) {
$table = get_opendb_config_var('db_server', 'table_prefix') . $table;
}
$i = 0;
while ($row = db_fetch_row($result)) {
$table_list = "";
for ($j = 0; $j < db_num_fields($result); $j++) {
if (strlen($table_list) > 0) {
$table_list .= ", ";
}
$table_list .= db_field_name($result, $j);
}
$table_list = "(" . $table_list . ")";
$schema_insert = "";
for ($j = 0; $j < db_num_fields($result); $j++) {
if (strlen($schema_insert) > 0) {
$schema_insert .= ", ";
}
if (!isset($row[$j])) {
$schema_insert .= "NULL";
} else {
if ($row[$j] != "") {
$row[$j] = replace_newlines($row[$j]);
// Escape normal addslashes: \', \", \\, \0 add to that \n
$row[$j] = addcslashes($row[$j], "\\'\"\\\n");
$schema_insert .= "'" . $row[$j] . "'";
} else {
$schema_insert .= "''";
}
}
}
$schema_insert = "INSERT INTO {$table} {$table_list} VALUES (" . $schema_insert . ")";
// Get rid of newlines.
$schema_insert = str_replace("\n", "", $schema_insert);
$schema_insert = str_replace("\r", "", $schema_insert);
echo trim($schema_insert) . ";" . $crlf;
$i++;
}
return TRUE;
}
开发者ID:horrabin,项目名称:opendb,代码行数:47,代码来源:index.php
示例15: OpenDbSnoopy
function OpenDbSnoopy($debug = FALSE)
{
// if file cache table is not installed, we cannot use file cache.
$this->_file_cache_enabled = get_opendb_config_var('http.cache', 'enable');
//override user agent.
$this->agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4';
// in how many cases is this going to work?
$this->passcookies = FALSE;
$this->_debug = $debug;
$proxy_server_config_r = get_opendb_config_var('http.proxy_server');
if ($proxy_server_config_r['enable'] == TRUE) {
$this->proxy_host = $proxy_server_config_r['host'];
$this->proxy_port = $proxy_server_config_r['port'];
$this->proxy_user = $proxy_server_config_r['userid'];
$this->proxy_pass = $proxy_server_config_r['password'];
}
// the default curl path for snoopy is /usr/local/bin/curl - often however, it will reside in another path
if (!empty($this->curl_path) || !@is_executable($this->curl_path)) {
$curlpaths = array();
// variable for test-paths
// let's do something depending on whether we're using windows or linux (windows lookup not tested)
if (strncasecmp(PHP_OS, 'WIN', 3) == 0) {
// This is a server using Windows!
$curlpaths[] = 'C:\\Windows\\System32\\curl.exe';
} else {
// assuming a unix system, first try detection and then some other standard paths
$whichcurl = @exec("which curl");
if ($whichcurl != NULL) {
$curlpaths[] = $whichcurl;
}
$curlpaths[] = '/usr/bin/curl';
$curlpaths[] = '/usr/local/sbin/curl';
$curlpaths[] = '/usr/sbin/curl';
}
foreach ($curlpaths as $curlpath) {
if (@is_executable($curlpath)) {
$this->curl_path = $curlpath;
break;
// once found, break out of the loop
}
}
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:43,代码来源:OpenDbSnoopy.class.php
示例16: OpenDbMailer
function OpenDbMailer($mailer)
{
$this->PluginDir = './lib/phpmailer/';
if (get_opendb_config_var('email', 'windows_smtp_server') === TRUE) {
$this->LE = "\r\n";
} else {
$this->LE = "\n";
}
$this->Mailer = $mailer;
$this->Priority = "3";
// in case we want to change it
$this->Sender = get_opendb_config_var('email', 'noreply_address');
if ($this->Mailer == 'smtp') {
$email_smtp_r = get_opendb_config_var('email.smtp');
// at least host should be defined.
if (is_not_empty_array($email_smtp_r) && strlen($email_smtp_r['host']) > 0) {
$this->Host = $email_smtp_r['host'];
if (strlen($email_smtp_r['port']) > 0) {
$this->Port = $email_smtp_r['port'];
}
if ($email_smtp_r['secure'] != 'none') {
$this->SMTPSecure = $email_smtp_r['secure'];
// sets the prefix to the server
}
if (strlen($email_smtp_r['username']) > 0 && strlen($email_smtp_r['password']) > 0) {
$this->Username = $email_smtp_r['username'];
$this->Password = $email_smtp_r['password'];
$this->SMTPAuth = TRUE;
}
} else {
// set to 'mail' mailer as default, and log configuration error.
opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Email SMTP Configuration missing', array($mailer));
// override, because mailer smtp is misconfigured.
$this->Mailer = 'mail';
}
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:37,代码来源:opendbmailer.class.php
示例17: fetch_opendb_database_collation
/**
* taken from phpMyAdmin
*
* @param unknown_type $db
* @return unknown
*/
function fetch_opendb_database_collation()
{
$dbname = get_opendb_config_var('db_server', 'dbname');
$query = "SHOW CREATE DATABASE `{$dbname}`";
$result = db_query($query);
if ($result && db_num_rows($result) > 0) {
$record_r = db_fetch_assoc($result);
db_free_result($result);
$tokenized = explode(' ', $record_r['Create Database']);
for ($i = 1; $i + 3 < count($tokenized); $i++) {
if ($tokenized[$i] == 'DEFAULT' && $tokenized[$i + 1] == 'CHARACTER' && $tokenized[$i + 2] == 'SET') {
// We've found the character set!
if (isset($tokenized[$i + 5]) && $tokenized[$i + 4] == 'COLLATE') {
return $tokenized[$i + 5];
// We found the collation!
} else {
// We did not find the collation
return NULL;
}
}
}
}
return FALSE;
}
开发者ID:horrabin,项目名称:opendb,代码行数:30,代码来源:install.php
示例18: start_element
function start_element($xpath, $name, $attribs, $pcdata)
{
if (strcmp($name, 'Item') === 0) {
$this->startItem($attribs['ItemType']);
} else {
if (strcmp($name, 'Title') === 0) {
$this->setTitle(html_entity_decode($pcdata), ENT_COMPAT, get_opendb_config_var('themes', 'charset') == 'utf-8' ? 'UTF-8' : 'ISO-8859-1');
} else {
if (strcmp($name, 'Instance') === 0) {
$this->startItemInstance();
$this->setInstanceStatusType($attribs['StatusType']);
$this->setInstanceBorrowDuration($attribs['BorrowDuration']);
} else {
if (strcmp($name, 'StatusComment') === 0) {
$this->setInstanceStatusComment(html_entity_decode($pcdata), ENT_COMPAT, get_opendb_config_var('themes', 'charset') == 'utf-8' ? 'UTF-8' : 'ISO-8859-1');
} else {
if (strcmp($name, 'Attribute') === 0) {
$this->addAttribute($attribs['AttributeType'], NULL, html_entity_decode($pcdata), ENT_COMPAT, get_opendb_config_var('themes', 'charset') == 'utf-8' ? 'UTF-8' : 'ISO-8859-1');
}
}
}
}
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:24,代码来源:OpenDbImportPlugin.class.php
示例19: is_newinstance_status_type_valid
function is_newinstance_status_type_valid($item_id, $owner_id, $new_status_type_r, &$errors)
{
if ($new_status_type_r['closed_ind'] != 'Y') {
if ((get_opendb_config_var('item_input', 'item_instance_support') !== FALSE || !is_exists_item_instance($item_id)) && (get_opendb_config_var('item_input', 'new_instance_owner_only') !== TRUE || is_user_owner_of_item($item_id, NULL, $owner_id))) {
return TRUE;
} else {
$errors = array('error' => get_opendb_lang_var('operation_not_avail_new_instance'), 'detail' => '');
return FALSE;
}
} else {
$errors = array('error' => get_opendb_lang_var('s_status_type_not_supported', 's_status_type_desc', $new_status_type_r['description']), 'detail' => '');
return FALSE;
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:14,代码来源:status_type.php
示例20: perform_newpassword
function perform_newpassword($HTTP_VARS, &$errors)
{
if (!is_user_valid($HTTP_VARS['uid'])) {
opendb_logger(OPENDB_LOG_WARN, __FILE__, __FUNCTION__, 'New password request failure: User does not exist', array($HTTP_VARS['uid']));
// make user look successful to prevent mining for valid userids
return TRUE;
} else {
if (!is_user_active($HTTP_VARS['uid'])) {
// Do not allow new password operation for 'deactivated' user.
opendb_logger(OPENDB_LOG_WARN, __FILE__, __FUNCTION__, 'New password request failure: User is not active', array($HTTP_VARS['uid']));
return FALSE;
} else {
if (!is_user_granted_permission(PERM_CHANGE_PASSWORD, $HTTP_VARS['uid'])) {
opendb_logger(OPENDB_LOG_WARN, __FILE__, __FUNCTION__, 'New password request failure: User does not have permission to change password', array($HTTP_VARS['uid']));
return FALSE;
} else {
if (get_opendb_config_var('user_admin', 'user_passwd_change_allowed') === FALSE && !is_user_granted_permission(PERM_ADMIN_CHANGE_PASSWORD)) {
opendb_logger(OPENDB_LOG_WARN, __FILE__, __FUNCTION__, 'New password request failure: Password change is disabled', array($HTTP_VARS['uid']));
return FALSE;
} else {
opendb_logger(OPENDB_LOG_INFO, __FILE__, __FUNCTION__, 'User requested to be emailed a new password', array($HTTP_VARS['uid']));
$user_r = fetch_user_r($HTTP_VARS['uid']);
$user_passwd = generate_password(8);
// only send if valid user (email)
if (strlen($user_r['email_addr']) > 0) {
$pass_result = update_user_passwd($HTTP_VARS['uid'], $user_passwd);
if ($pass_result === TRUE) {
$subject = get_opendb_lang_var('lost_password');
$message = get_opendb_lang_var('to_user_email_intro', 'fullname', $user_r['fullname']) . "\n\n" . get_opendb_lang_var('new_passwd_email') . "\n\n" . get_opendb_lang_var('userid') . ": " . $HTTP_VARS['uid'] . "\n" . get_opendb_lang_var('password') . ": " . $user_passwd;
if (opendb_user_email($user_r['user_id'], NULL, $subject, $message, $errors)) {
return TRUE;
} else {
return "EMAIL_NOT_SENT";
}
}
} else {
$errors[] = "User '" . $HTTP_VARS['uid'] . "' does not have a valid email address.";
return FALSE;
}
}
}
}
}
}
开发者ID:horrabin,项目名称:opendb,代码行数:44,代码来源:login.php
注:本文中的get_opendb_config_var函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论