Beispiel #1
0
function runtime_append($k, $v)
{
    $arr = kv_get('runtime_append');
    empty($arr) and $arr = array();
    $arr[$k] = $v;
    kv_set('runtime_append', $arr);
}
Beispiel #2
0
$user = user_token_get('', 'bbs');
$user['gid'] != 1 and message(-1, '需要管理员权限才能设置。');
// 检测浏览器
$browser = get__browser();
check_browser($browser);
$runtime = runtime_init();
if ($method == 'GET') {
    $sphinx = kv_get('sphinx');
    !isset($sphinx['enable']) && ($sphinx['enable'] = 0);
    !isset($sphinx['sphinx_host']) && ($sphinx['sphinx_host'] = '');
    !isset($sphinx['sphinx_port']) && ($sphinx['sphinx_port'] = '');
    !isset($sphinx['sphinx_datasrc']) && ($sphinx['sphinx_datasrc'] = '');
    !isset($sphinx['sphinx_deltasrc']) && ($sphinx['sphinx_deltasrc'] = '');
    $input['enable'] = form_radio_yes_no('enable', $sphinx['enable']);
    $input['sphinx_host'] = form_text('sphinx_host', $sphinx['sphinx_host'], 300);
    $input['sphinx_port'] = form_text('sphinx_port', $sphinx['sphinx_port'], 100);
    $input['sphinx_datasrc'] = form_text('sphinx_datasrc', $sphinx['sphinx_datasrc'], 300);
    $input['sphinx_deltasrc'] = form_text('sphinx_deltasrc', $sphinx['sphinx_deltasrc'], 300);
    $header = array();
    $header['title'] = 'Sphinx 搜索服务设置';
    include './plugin/xn_sphinx/setting.htm';
} else {
    $enable = param('enable', 0);
    $sphinx_host = param('sphinx_host');
    $sphinx_port = param('sphinx_port');
    $sphinx_datasrc = param('sphinx_datasrc');
    $sphinx_deltasrc = param('sphinx_deltasrc');
    $arr = array('enable' => $enable, 'sphinx_host' => $sphinx_host, 'sphinx_port' => $sphinx_port, 'sphinx_datasrc' => $sphinx_datasrc, 'sphinx_deltasrc' => $sphinx_deltasrc);
    kv_set('sphinx', $arr);
    message(0, '设置成功!');
}
include './plugin/xn_qq_login/qq_login.func.php';
$user = user_token_get('', 'bbs');
$user['gid'] != 1 and message(-1, '需要管理员权限才能设置。');
// 检测浏览器
$browser = get__browser();
check_browser($browser);
$runtime = runtime_init();
if ($method == 'GET') {
    $qq = kv_get('qq_login');
    !isset($qq['enable']) && ($qq['enable'] = 0);
    !isset($qq['meta']) && ($qq['meta'] = '');
    !isset($qq['appid']) && ($qq['appid'] = '');
    !isset($qq['appkey']) && ($qq['appkey'] = '');
    $input['enable'] = form_radio_yes_no('enable', $qq['enable']);
    $input['meta'] = form_text('meta', htmlspecialchars($qq['meta']), 600);
    $input['appid'] = form_text('appid', $qq['appid'], 300);
    $input['appkey'] = form_text('appkey', $qq['appkey'], 300);
    $header = array();
    $header['title'] = 'QQ 登陆设置';
    include './plugin/xn_qq_login/setting.htm';
} else {
    $enable = param('enable', 0);
    $meta = param('meta', '', FALSE);
    $appid = param('appid');
    $appkey = param('appkey');
    $arr = array('enable' => $enable, 'meta' => $meta, 'appid' => $appid, 'appkey' => $appkey);
    kv_set('qq_login', $arr);
    // 此处会丢失
    runtime_set('qq_login_enable', $enable, TRUE);
    message(0, '设置成功!');
}
Beispiel #4
0
                    $node2['R'][] = $v;
                    unset($node['R'][$k]);
                    break;
                }
            }
            /* ERROR */
            foreach ($node['D'] as $k => $v) {
                if (!strcasecmp($v['N'], $n)) {
                    $node2['D'][] = $v;
                    $tmp = kv_get($kv, $dir . $v['N'] . '/');
                    kv_set($kv, $dest . $v['N'] . '/', $tmp);
                    kv_delete($kv, $dir . $v['N'] . '/');
                    unset($node['D'][$k]);
                    break;
                }
            }
        }
        kv_set($kv, $dir, serialize($node));
        kv_set($kv, $dest, serialize($node2));
        break;
    case 'list':
        echo '<ul ' . ($dir == '/' ? 'class="root"' : '') . ' id="' . urlencode($dir) . '">';
        foreach ($node['D'] as $f) {
            echo '<li><span id="' . urlencode($dir . $f['N'] . '/') . '" class="expand"></span><input type="checkbox" />' . $f['N'] . '</li>';
        }
        echo '</ul>';
        break;
    default:
        exit_print('Unkown action.');
        break;
}
     empty($setting) and $setting = array('sitebrief' => '', 'seo_title' => '', 'seo_keywords' => '', 'seo_description' => '', 'footer_code' => '');
     $sitebrief = $setting['sitebrief'];
     // 站点介绍
     $input['seo_title'] = form_text('seo_title', $setting['seo_title'], '100%');
     $input['seo_keywords'] = form_text('seo_keywords', $setting['seo_keywords'], '100%');
     $input['seo_description'] = form_text('seo_description', $setting['seo_description'], '100%');
     $input['footer_code'] = form_textarea('footer_code', $setting['footer_code'], '100%', '50px');
     include './admin/view/setting.htm';
 } else {
     $sitebrief = param('sitebrief', '', FALSE);
     $seo_title = param('seo_title', '', FALSE);
     $seo_keywords = param('seo_keywords', '', FALSE);
     $seo_description = param('seo_description', '', FALSE);
     $footer_code = param('footer_code', '', FALSE);
     $setting = array('sitebrief' => $sitebrief, 'seo_title' => $seo_title, 'seo_keywords' => $seo_keywords, 'seo_description' => $seo_description, 'footer_code' => $footer_code);
     kv_set('setting', $setting);
     cache_delete('setting');
     empty($readable) and message(-1, '配置文件 conf/conf.php 不可写,请手工修改。');
     $sitename = param('sitename', '', FALSE);
     $runlevel = param('runlevel', 0);
     $conf['sitename'] = $sitename;
     $conf['runlevel'] = $runlevel;
     conf_save();
     message(0, '修改成功');
 }
 /*
 } elseif($action == 'smtp') {
 	
 	if($method == 'GET') {
 		$mailconf = kv_get('smtp');
 $sendtype = &$mailconf['sendtype'];
Beispiel #6
0
function cache_set($k, $v, $life = 0)
{
    global $cache, $db;
    if (!$cache) {
        return $db ? kv_set($k, $v, $life) : FALSE;
    }
    $r = $cache->set($k, $v, $life);
    if ($r === FALSE && $cache->errno != 0) {
        message(-1, $cache->errstr);
    }
    return $r;
}
Beispiel #7
0
<?php

!defined('DEBUG') and exit('Access Denied.');
include './xiunophp/form.func.php';
$action = param(1);
if ($method == 'GET') {
    $badwords = kv_get('badwords');
    $input_badword_on = form_radio_yes_no('badword_on', $conf['badword_on']);
    $badwords = badword_implode(':', ' ', $badwords);
    include './admin/view/badword.htm';
} elseif ($method == 'POST') {
    $badwords = param('badwords');
    $badword_on = param('badword_on', 0);
    $badwords = str_replace("  ", ' ', $badwords);
    $badwords = str_replace(":", ':', $badwords);
    $badwords = str_replace(": ", ':', $badwords);
    $badwords = preg_replace('#\\s+#is', ' ', $badwords);
    $badwordarr = badword_explode(':', ' ', $badwords);
    kv_set('badwords', $badwordarr);
    conf_set('badword_on', $badword_on);
    message(0, '保存成功');
}
Beispiel #8
0
                        $temp[$it[0]]['X'] = $index;
                        echo json_encode(array('code' => 0, 'size' => strlen($raw)));
                    }
                }
            }
        }
        kv_set($kv, ':temp', serialize($temp));
        exit;
        break;
    case "finish":
        for (reset($temp); $it = each($temp);) {
            $f = $it[1];
            if ($f['D'] == $dir && $f['N'] == $name) {
                $num = (int) ($f['S'] / 3145728) + ($f['S'] % 3145728 == 0 ? 0 : 1);
                if ($f['X'] != $num - 1) {
                    exit_json(5, 'Not complete. ' . $f['X'] . '/' . ($num - 1));
                }
                $node = unserialize(kv_get($kv, $dir));
                $node['R'][] = array('N' => $f['N'], 'T' => time(), 'A' => $node['A'], 'S' => $f['S'], 'I' => $f['I']);
                kv_set($kv, $dir, serialize($node));
                unset($temp[$it[0]]);
                kv_set($kv, ':temp', serialize($temp));
                exit_json(0, 'OK');
            }
        }
        exit_json(6, 'No such item');
        break;
    default:
        exit_json(7, 'Unkown action.');
        break;
}
Beispiel #9
0
function get_last_version($stat)
{
    global $conf, $time;
    $last_version = kv_get('last_version');
    if ($time - $last_version > 86400) {
        kv_set('last_version', $time);
        $sitename = urlencode($conf['sitename']);
        $sitedomain = urlencode(http_url_path());
        $version = urlencode($conf['version']);
        return '<script src="http://custom.xiuno.com/version.htm?sitename=' . $sitename . '&sitedomain=' . $sitedomain . '&users=' . $stat['users'] . '&threads=' . $stat['threads'] . '&posts=' . $stat['posts'] . '&version=' . $version . '"></script>';
    } else {
        return '';
    }
}
Beispiel #10
0
     			$kv->delete($key);
     		
     		if (count($ret) < 100) break;
     	}*/
     exit_print('To clear database, just disable <a href="http://sae.sina.com.cn/?m=kv&app_id=' . $_SERVER['HTTP_APPNAME'] . '&ver=' . $_SERVER['HTTP_APPVERSION'] . '">KVDB service</a>!');
     break;
 case 'newpwd':
     if ($_SESSION['auth'] != 'OK') {
         $_SESSION['msg'] = 'You are not authorized!';
         exit_redirect('index.php');
     }
     check_field('password', 'newpwd', 'newpwd2');
     if (md5($password) == $account['password']) {
         if ($_REQUEST['newpwd'] == $_REQUEST['newpwd2']) {
             $account['password'] = md5($_REQUEST['newpwd']);
             kv_set($kv, ':account', serialize($account));
             $_SESSION['msg'] = 'Password has been changed.';
             unset($_SESSION['auth']);
             exit_redirect('index.php');
         } else {
             exit_print("Confirm doesn't match. <a href=\"home.php\">Back Home</a>?");
         }
     } else {
         exit_print("Password is wrong. <a href=\"home.php\">Back Home</a>?");
     }
     break;
 case 'login':
     check_field('username', 'password');
     if ($username != $account['username'] || md5($password) != $account['password']) {
         $_SESSION['msg'] = 'User name or password wrong!';
         exit_redirect('index.php');