本文整理汇总了PHP中get_misc_data函数的典型用法代码示例。如果您正苦于以下问题:PHP get_misc_data函数的具体用法?PHP get_misc_data怎么用?PHP get_misc_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_misc_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upload_1
function upload_1()
{
global $upload_dir, $db, $current_user;
//save upload file
if ($_FILES['upload_file']['error'] > 0) {
$error = "ERROR: " . get_file_err($_FILES['upload_file']['error']) . "</br>";
$_SESSION['upload_file'] = array('error' => $error);
} else {
// the file name that should be uploaded
$file_tmp = $_FILES['upload_file']['tmp_name'];
$file_name = $_FILES['upload_file']['name'];
$unique_file_name = $current_user->user_login . "_" . $file_name;
$upload_dir = get_misc_data('raw_data_directory');
$upload_path = mnmpath . $upload_dir . $unique_file_name;
if (file_exists($upload_path)) {
$error = "ERROR: Already exits.</br>";
$_SESSION['upload_file'] = array('error' => $error);
} else {
$upload = move_uploaded_file($file_tmp, $upload_path);
echo $upload;
// check upload status
if (!$upload) {
$error = "ERROR:failed to save. </br>";
$_SESSION['upload_file'] = array('error' => $error);
} else {
$sql = "INSERT INTO " . table_prefix . "files \r\n\t\t\t\t\t\t\t\tSET file_user_id={$current_user->user_id},\r\n\t\t\t\t\t\t\t file_real_size='{$_FILES['upload_file']['size']}',\r\n\t\t\t\t\t\t \tfile_name='" . $db->escape("{$upload_path}") . "'";
$db->query($sql);
$loc_msg = my_base_url . my_pligg_base . $upload_dir . $unique_file_name;
$_SESSION['upload_file'] = array('loc' => $loc_msg);
}
}
}
}
示例2: captcha_configure
function captcha_configure()
{
global $main_smarty, $the_template;
$q_1_low = isset($_REQUEST['q_1_low']) ? $_REQUEST['q_1_low'] : '';
$q_1_high = isset($_REQUEST['q_1_high']) ? $_REQUEST['q_1_high'] : '';
$q_2_low = isset($_REQUEST['q_2_low']) ? $_REQUEST['q_2_low'] : '';
$q_2_high = isset($_REQUEST['q_2_high']) ? $_REQUEST['q_2_high'] : '';
if ($q_1_low != '') {
misc_data_update('captcha_math_q1low', $q_1_low);
} else {
$q_1_low = get_misc_data('captcha_math_q1low') == '' ? 1 : get_misc_data('captcha_math_q1low');
}
if ($q_1_high != '') {
misc_data_update('captcha_math_q1high', $q_1_high);
} else {
$q_1_high = get_misc_data('captcha_math_q1high') == '' ? 5 : get_misc_data('captcha_math_q1high');
}
if ($q_2_low != '') {
misc_data_update('captcha_math_q2low', $q_2_low);
} else {
$q_2_low = get_misc_data('captcha_math_q2low') == '' ? 1 : get_misc_data('captcha_math_q2low');
}
if ($q_2_high != '') {
misc_data_update('captcha_math_q2high', $q_2_high);
} else {
$q_2_high = get_misc_data('captcha_math_q2high') == '' ? 5 : get_misc_data('captcha_math_q2high');
}
$main_smarty->assign('q_1_low', sanitize($q_1_low, 2));
$main_smarty->assign('q_1_high', sanitize($q_1_high, 2));
$main_smarty->assign('q_2_low', sanitize($q_2_low, 2));
$main_smarty->assign('q_2_high', sanitize($q_2_high, 2));
}
示例3: hc_register
function hc_register(&$vars)
{
global $main_smarty, $the_template, $hc_registered;
if ($hc_registered) {
return;
}
$hc_registered = true;
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['hc_math_answer'] == '';
$q_1_low = get_misc_data('hc_math_q1low') == '' ? 1 : get_misc_data('hc_math_q1low');
$q_1_high = get_misc_data('hc_math_q1high') == '' ? 5 : get_misc_data('hc_math_q1high');
$q_2_low = get_misc_data('hc_math_q2low') == '' ? 1 : get_misc_data('hc_math_q2low');
$q_2_high = get_misc_data('hc_math_q2high') == '' ? 5 : get_misc_data('hc_math_q2high');
$number1 = md5(mt_rand($q_1_low, $q_1_high));
do {
$number2 = md5(mt_rand($q_2_low, $q_2_high));
} while ($number2 == $number1);
$number3 = md5(mt_rand($q_2_low, $q_2_high));
$_SESSION['titlename'] = $number1;
$_SESSION['bodyname'] = $number2;
$_SESSION['commentname'] = $number3;
$main_smarty->assign('name', $_SESSION['hc_math_answer_name']);
// smarty prefilter
$main_smarty->register_prefilter('add_header_comment');
}
示例4: captcha_can_we_use
function captcha_can_we_use()
{
global $main_smarty;
$pubkey = get_misc_data('reCaptcha_pubkey');
$prikey = get_misc_data('reCaptcha_prikey');
if ($pubkey == '' || $prikey == '') {
$main_smarty->assign('msg', 'reCaptcha needs to be configured before it can be used.');
return false;
} else {
return true;
}
}
示例5: captcha_register_check_errors
function captcha_register_check_errors(&$vars)
{
if (captcha_reg_enabled == true) {
global $main_smarty, $the_template;
$captcha = get_misc_data('captcha_method');
if ($captcha == '') {
$captcha = 'recaptcha';
}
$username = $vars['username'];
$email = $vars['email'];
$password = $vars['password'];
$main_smarty->assign('username', $username);
$main_smarty->assign('email', $email);
$main_smarty->assign('password', $password);
include_once captcha_captchas_path . '/' . $captcha . '/main.php';
if (captcha_check($vars, 2)) {
} else {
$vars['error'] = true;
}
}
}
示例6: TINYINT
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_switch` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_friends` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_story` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_comment` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_email` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_group` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_all_friends` TINYINT(1) DEFAULT '1'";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_friend_list` TEXT";
$module_info['db_sql'][] = "ALTER TABLE " . table_users . " ADD `status_excludes` TEXT";
// Set default values
$module_info['db_sql'][] = "UPDATE " . table_users . " SET status_switch=1, status_friends=1, status_story=1, status_comment=1, status_email=1, status_all_friends=1";
// Add new table
$module_info['db_add_table'][] = array('name' => table_prefix . "updates", 'sql' => "CREATE TABLE `" . table_prefix . "updates` (\n\t `update_id` int(11) NOT NULL auto_increment,\n\t `update_time` int(11) default NULL,\n\t `update_type` char(1) NOT NULL,\n\t `update_link_id` int(11) NOT NULL,\n\t `update_user_id` int(11) NOT NULL,\n\t `update_group_id` int(11) NOT NULL,\n\t `update_likes` int(11) NOT NULL,\n\t `update_level` varchar(25),\n\t `update_text` text NOT NULL,\n\t PRIMARY KEY (`update_id`),\n\t FULLTEXT KEY `update_text` (`update_text`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
$module_info['db_add_table'][] = array('name' => table_prefix . "likes", 'sql' => "CREATE TABLE `" . table_prefix . "likes` (\n\t `like_update_id` int(11) NOT NULL,\n\t `like_user_id` int(11) NOT NULL,\n\t PRIMARY KEY (`like_update_id`, `like_user_id`)\n\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
// Set default module settings
if (get_misc_data('status_switch') == '') {
misc_data_update('status_switch', '0');
misc_data_update('status_show_permalin', '1');
misc_data_update('status_permalinks', '1');
misc_data_update('status_inputonother', '1');
misc_data_update('status_place', 'tpl_pligg_profile_tab_insert');
misc_data_update('status_clock', '12');
misc_data_update('status_results', '10');
misc_data_update('status_max_chars', '1200');
misc_data_update('status_avatar', 'small');
misc_data_update('status_profile_level', 'admin,moderator,normal');
misc_data_update('status_level', 'admin,moderator,normal');
misc_data_update('status_user_email', '1');
misc_data_update('status_user_comment', '1');
misc_data_update('status_user_story', '1');
misc_data_update('status_user_friends', '1');
示例7: get_spam_trigger_settings
function get_spam_trigger_settings()
{
return array('spam_light' => get_misc_data('spam_trigger_light'), 'spam_medium' => get_misc_data('spam_trigger_medium'), 'spam_hard' => get_misc_data('spam_trigger_hard'));
}
示例8: array
if (!$fieldexists) {
// DB 04/13/09
$categories = $db->get_results("SELECT category_id FROM `" . table_categories . "` WHERE category_id>0", ARRAY_A);
$cats = array();
if ($categories) {
foreach ($categories as $cat) {
$cats[] = $cat['category_id'];
}
}
$sql = "ALTER TABLE `" . table_users . "` ADD `user_categories` VARCHAR(255) NOT NULL default '' AFTER `user_occupation`;";
$db->query($sql);
/////
} else {
$sql = "CHANGE `user_categories` `user_categories` VARCHAR( 255 ) DEFAULT ''";
$db->query($sql);
if (get_misc_data('user_cat') == '' && $db->get_var("SELECT user_categories FROM " . table_users . " WHERE user_level='admin' LIMIT 1")) {
$sqlGetiCategory = "SELECT category__auto_id from " . table_categories . " where category__auto_id!= 0;";
$sqlGetiCategoryQ = mysql_query($sqlGetiCategory);
$arr = array();
while ($row = mysql_fetch_array($sqlGetiCategoryQ, MYSQL_NUM)) {
$arr[] = $row[0];
}
$result = mysql_query("SELECT * FROM " . table_users);
while ($row = mysql_fetch_array($result)) {
$cats = split(',', $row['user_categories']);
$diff = array_diff($arr, $cats);
mysql_query($sql = "UPDATE " . table_users . " SET user_categories='" . join(',', $diff) . "' WHERE user_id='{$row['user_id']}'");
}
misc_data_update('user_cat', 'changed');
}
}
示例9: get_misc_data
<?php
$widget['widget_title'] = "Akismet Anti-Spam";
$widget['widget_has_settings'] = 1;
$widget['widget_shrink_icon'] = 1;
$widget['widget_uninstall_icon'] = 0;
$widget['name'] = 'Akismet';
$widget['desc'] = 'Akismet Anti-Spam Module';
$widget['version'] = 0.1;
$wordpress_key = get_misc_data('wordpress_key');
if ($_REQUEST['widget'] == 'akismet') {
if (isset($_REQUEST['key'])) {
$wordpress_key = sanitize($_REQUEST['key'], 3);
} else {
$wordpress_key = '';
}
misc_data_update('wordpress_key', $wordpress_key);
}
if ($main_smarty) {
$main_smarty->assign('wordpress_key', $wordpress_key);
if (function_exists('akismet_get_link_count')) {
$count1 = akismet_get_link_count();
$count2 = akismet_get_comment_count();
$main_smarty->assign('spam_links_count', $count1);
$main_smarty->assign('spam_comments_count', $count2);
if ($count1 == 0 && $count2 == 0) {
$widget['column'] = '';
}
} else {
$widget['column'] = '';
}
示例10: Smarty
// The source code packaged with this file is Free Software, Copyright (C) 2005 by
// Ricardo Galli <gallir at uib dot es>.
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise.
// You can get copies of the licenses here:
// http://www.affero.org/oagpl.html
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include_once 'Smarty.class.php';
$main_smarty = new Smarty();
include 'config.php';
include mnminclude . 'html1.php';
include mnminclude . 'link.php';
include mnminclude . 'tags.php';
include mnminclude . 'search.php';
include mnminclude . 'smartyvariables.php';
$spam_links = get_misc_data('spam_links');
if ($spam_links != '') {
$spam_links = unserialize(get_misc_data('spam_links'));
} else {
$spam_links = array();
}
//print_r($spam_links);
if (count($spam_links) > 0) {
foreach ($spam_links as $link_id) {
$link = new Link();
$link->id = $link_id;
$link->read(FALSE);
$link->status = 'discard';
$link->store();
echo 'Discarding link_id: ' . $link_id . '<br />';
}
}
示例11: get_settings
function get_settings()
{
return array('group_id' => get_misc_data('phpbb_group'), 'db' => get_misc_data('phpbb_db'), 'user' => get_misc_data('phpbb_user'), 'pass' => get_misc_data('phpbb_pass'), 'host' => get_misc_data('phpbb_host'), 'cookie_name' => get_misc_data('phpbb_cookie_name'), 'cookie_path' => get_misc_data('phpbb_cookie_path'), 'cookie_domain' => get_misc_data('phpbb_cookie_domain'), 'cookie_secure' => get_misc_data('phpbb_cookie_secure'));
}
示例12: get_misc_data
<?php
global $db, $main_smarty, $the_template;
include_once '../../config.php';
$contactable_mail = get_misc_data('contactable_mail');
// Assign contact email
// Assign contact info
$name = stripcslashes($_POST['name']);
$emailAddr = stripcslashes($_POST['email']);
$issue = stripcslashes($_POST['issue']);
$comment = stripcslashes($_POST['message']);
$subject = stripcslashes($_POST['subject']);
// Set headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Format message
$contactMessage = "<div>\n\t<p><strong>Name:</strong> {$name} <br />\n\t<strong>E-mail:</strong> {$emailAddr} <br />\n\t<strong>Issue:</strong> {$issue} </p>\n\n\t<p><strong>Message:</strong> {$comment} </p>\n\n\t<p><strong>Sending IP:</strong> {$_SERVER['REMOTE_ADDR']}<br />\n\t<strong>Sent via:</strong> {$_SERVER['HTTP_HOST']}</p>\n\t</div>";
// Send and check the message status
$response = mail($contactable_mail, $subject, $contactMessage, $headers) ? "success" : "failure";
$output = json_encode(array("response" => $response));
header('content-type: application/json; charset=utf-8');
echo $output;
示例13: get_misc_data
if ($sw_comments == '') {
$sw_comments = '1';
}
$sw_newuser = get_misc_data('sw_newuser');
if ($sw_newuser == '') {
$sw_newuser = '1';
}
$phpver = get_misc_data('phpver');
if ($phpver == '') {
$phpver = '1';
}
$mysqlver = get_misc_data('mysqlver');
if ($mysqlver == '') {
$mysqlver = '1';
}
$sw_dbsize = get_misc_data('sw_dbsize');
if ($sw_dbsize == '') {
$sw_dbsize = '1';
}
if ($_REQUEST['widget'] == 'statistics') {
if (isset($_REQUEST['version'])) {
$sw_version = sanitize($_REQUEST['version'], 3);
}
misc_data_update('sw_version', $sw_version);
if (isset($_REQUEST['members'])) {
$sw_members = sanitize($_REQUEST['members'], 3);
}
misc_data_update('sw_members', $sw_members);
if (isset($_REQUEST['groups'])) {
$sw_groups = sanitize($_REQUEST['groups'], 3);
}
示例14: define
// pagename
define('pagename', 'admin_users');
$main_smarty->assign('pagename', pagename);
// show the template
$main_smarty->assign('tpl_center', '/admin/user_listall_center');
$main_smarty->display($template_dir . '/admin/admin.tpl');
}
} else {
// No options are selected, so show the list of users.
$CSRF->create('admin_users_list', true, true);
global $offset, $top_users_size;
// Items per page drop-down
if (isset($_GET["pagesize"]) && is_numeric($_GET["pagesize"])) {
misc_data_update('pagesize', $_GET["pagesize"]);
}
$pagesize = get_misc_data('pagesize');
if ($pagesize <= 0) {
$pagesize = 30;
}
$main_smarty->assign('pagesize', $pagesize);
if ($_GET["filter"]) {
$filter_sql = "WHERE user_level='" . sanitize($_GET["filter"], 3) . "'";
} else {
$filter_sql = "WHERE user_level!='Spammer'";
}
// figure out what "page" of the results we're on
$offset = (get_current_page() - 1) * $pagesize;
$users = mysql_query("SELECT SQL_CALC_FOUND_ROWS * FROM " . table_users . " {$filter_sql} ORDER BY `user_date` LIMIT {$offset},{$pagesize}");
$rows = $db->get_var("SELECT FOUND_ROWS()");
$userlist = array();
while ($row = mysql_fetch_array($users, MYSQL_ASSOC)) {
示例15: pligg_hash
function pligg_hash()
{
// returns the version of Pligg that's installed
$hash = get_misc_data('hash');
return $hash;
}