Beispiel #1
0
<?php

require_once 'lib/init.php';
$norender = false;
initVars('domain', 'docroot');
$error_documents = array(401, 403, 404, 500);
header('Cache-Control: private');
switch ($task) {
    case 'add':
        if (!checkPackage('site')) {
            setmsg(t('The package limitation reached.'), 'warning');
        }
        $dirs = ZFile::getUserDirs($me);
        if (checktoken()) {
            $domain = $_REQUEST['domain'];
            $docroot = $_REQUEST['docroot'];
            // check domain
            $break = false;
            if (true !== ($res = ZVhosts::chkDomain($domain))) {
                $err['domain'] = t('Domain Invalid.');
                if ($res == 'occupied') {
                    $err['domain'] = t('Domain Occupied.');
                }
                $break = true;
            }
            // check docroot
            if (!in_array($docroot, $dirs)) {
                $err['docroot'] = t('Please select a valid document root.');
                $break = true;
            }
            $docroot = str_replace('~/', "/home/{$me}/", $docroot);
Beispiel #2
0
<?php

require_once 'lib/init.php';
$norender = false;
initVars('name', 'desc', 'password', 'domain', 'shell', 'package');
switch ($task) {
    case 'add':
        isadmin() || setmsg(t('Permission Dennied.'));
        header('Cache-Control: private');
        $token = token();
        $packages = ZPackage::getPackages();
        if (checktoken()) {
            $username = $_REQUEST['name'];
            $password = $_REQUEST['password'];
            $domain = $_REQUEST['domain'];
            $package = intval($_REQUEST['package']);
            $shell = $_REQUEST['shell'];
            $break = false;
            // check username
            if (true !== ($res = ZUser::chkUsername($username))) {
                $err['name'] = $res == 'invalid' ? t('Username Invalid. No uppercase, not starting with number, less than 7 chars.') : t('Username Occupied.');
                $break = true;
            }
            // check password
            if (true !== ($res = ZUser::chkPassword($password))) {
                $err['password'] = t('Password can not be empty.');
                $break = true;
            }
            // check domain
            if (true !== ($res = ZVhosts::chkDomain($domain))) {
                $err['domain'] = t('Domain Invalid.');
Beispiel #3
0
<?php

require_once 'lib/init.php';
$norender = false;
initVars('name', 'password', 'docroot', 'writable', 'upload_bandwidth', 'download_bandwidth', 'upload_ratio', 'download_ratio', 'max_conn', 'files_quota', 'size_quota', 'auth_local_ips', 'refused_local_ips', 'auth_client_ips', 'refused_client_ips', 'time_restrictions');
switch ($task) {
    case 'add':
        header('Cache-Control: private');
        $token = token();
        $prefix = $me . '_';
        $accounts = ZFtp::getFtpAccounts();
        if (!checkPackage()) {
            setmsg(t('The package limitation reached.'), 'warning');
        }
        $dirs = ZFile::getUserDirs($me);
        $users = ZUser::getUsers();
        if (checktoken()) {
            $username = $_REQUEST['name'];
            $owner = $me;
            $passwd = $_REQUEST['password'];
            $docroot = $_REQUEST['docroot'];
            $ftpuser = $owner . '_' . $username;
            $writable = isset($_REQUEST['writable']);
            $break = false;
            // check username
            if (true !== ($res = ZUser::chkUsername($username))) {
                if ($res == 'invalid') {
                    $err['name'] = t('Username Invalid. No uppercase, not starting with number, less than 7 chars.');
                    $break = true;
                }
            }
Beispiel #4
0
// Show the shout history, if that's what the client wants.
if (isset($_GET['history'])){
	echo history();
	exit;
}

// Exit if there are no POST variables
if (!isset($_POST['reqType'])) doError('No reqType.');
if (isset($_SESSION['AdminLoggedIn'])) checkBanned();


$reqType = $_POST['reqType'];

switch($reqType) {
	case 'init':
		initVars();
		checkCookies();
		checkBanned();

		echo newShouts(true);
		break;

	case 'shout':
		$shoutText = $_POST['shout'];
		$shoutName = $_POST['name'];

		// Parse the message
		if(!processCommand($shoutText)) 
			shout($shoutName, $shoutText);

		// Allow execution to flow into refresh
Beispiel #5
0
<?php

require_once 'lib/init.php';
initVars('name', 'password', 'dbname', 'op');
if (function_exists('mysql_connect')) {
    $db = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die(mysql_error());
} else {
    $mysql_error = 'mysql driver is not installed.';
    $task = 'error';
}
$norender = false;
$break = false;
switch ($task) {
    case 'add':
        header('Cache-Control: private');
        $token = token();
        // Check db user settings
        $sql = "SELECT COUNT(*) FROM mysql.user WHERE User LIKE '{$me}'";
        $query = mysql_query($sql);
        $result = mysql_fetch_row($query);
        if (!$result[0]) {
            $random_passwd = getRandomPassword();
            // create user
            if (ZDatabase::addmysqluser($me, $random_passwd)) {
                setmsg(t("Added."), 'notice');
            } else {
                setmsg(t('Database Error. ') . mysql_error(), 'error');
            }
        }
        if (!isadmin()) {
            setmsg(t(''), 'warning');
Beispiel #6
0
<?php

require_once 'lib/init.php';
$norender = false;
isadmin() || setmsg(t('Permission Dennied.'), 'error', './');
initVars('name', 'desc', 'space', 'bandwidth', 'site', 'ftp', 'sql', 'state', 'op');
switch ($task) {
    case 'add':
        header('Cache-Control: private');
        $token = token();
        if (checktoken()) {
            $package = new stdClass();
            $package->name = strip_tags($_REQUEST['name']);
            $package->desc = strip_tags($_REQUEST['desc']);
            $package->space = $_REQUEST['space'];
            $package->bandwidth = $_REQUEST['bandwidth'];
            $package->site = intval($_REQUEST['site']);
            $package->ftp = intval($_REQUEST['ftp']);
            $package->sql = intval($_REQUEST['sql']);
            $package->state = isset($_REQUEST['state']);
            if (ZPackage::insertPackage($id, $package)) {
                setmsg(t("New Package Added."), 'notice', 'package.php');
            }
        }
        break;
    case 'edit':
        header('Cache-Control: private');
        $token = token();
        $id = intval($_REQUEST['id']);
        $package = ZPackage::getPackage($id);
        if (!$package) {