Exemple #1
0
 * ECSHOP 程序说明
 * ===========================================================
 * * 版权所有 2005-2012 上海商派网络科技有限公司,并保留所有权利。
 * 网站地址: http://www.ecshop.com;
 * ----------------------------------------------------------
 * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
 * 使用;不允许对程序代码以任何形式任何目的的再发布。
 * ==========================================================
 * $Author: liubo $
 * $Id: cron.php 17217 2011-01-19 06:29:08Z liubo $
 */
define('IN_ECS', true);
require './init.php';
//require('../includes/lib_time.php');
$timestamp = gmtime();
check_method();
$error_log = array();
if (isset($set_modules)) {
    $set_modules = false;
    unset($set_modules);
}
$crondb = get_cron_info();
// 获得需要执行的计划任务数据
foreach ($crondb as $key => $cron_val) {
    if (file_exists(ROOT_PATH . 'includes/modules/cron/' . $cron_val['cron_code'] . '.php')) {
        if (!empty($cron_val['allow_ip'])) {
            $allow_ip = explode(',', $cron_val['allow_ip']);
            $server_ip = real_server_ip();
            if (!in_array($server_ip, $allow_ip)) {
                continue;
            }
<?php

if (!$error && ($_GET['openid_url'] || $_GET['openid_identifier'])) {
    include dirname(__FILE__) . '/try_auth.php';
    exit;
}
if (!$_REQUEST['return_to'] && stristr($_SERVER['HTTP_REFERER'], 'wiki.theveeb.com')) {
    $_REQUEST['return_to'] = $_SERVER['HTTP_REFERER'];
}
require_once dirname(__FILE__) . '/../include/use_type.php';
require_once dirname(__FILE__) . '/../include/check_method.php';
check_method(array('GET'));
require dirname(__FILE__) . '/../include/processCookie.php';
if (!$error) {
    $error = $_GET['error'];
}
switch (use_type(array('application/xhtml+xml', 'text/html'), true)) {
    case 'text/html':
        $noxml = true;
    case 'application/xhtml+xml':
        $title = 'Login';
        require dirname(__FILE__) . '/../include/invisible_header.php';
        ?>
		<style type="text/css">
			#openid_form {
				text-align: center;
			}
			#openid_form_submit {
				font-size: 1.2em;
				margin-top: 1em;
			}
Exemple #3
0
function check_expression($e, $assignment = false, $equate_false = false, $function_guard = '')
{
    $c_pos = $e[count($e) - 1];
    if ($e[0] == 'CREATE_ARRAY') {
        return 'array';
    }
    if ($e[0] == 'VARIABLE_REFERENCE') {
        $e = $e[1];
    }
    if ($e[0] == 'SOLO') {
        $type = check_expression($e[1], false, false, $function_guard);
        return $type;
    }
    if (in_array($e[0], array('DIVIDE', 'REMAINDER', 'DIV_EQUAL')) && $e[2][0] != 'LITERAL') {
        if ($assignment && @count($e[2][1][2]) == 0) {
            $GLOBALS['LOCAL_VARIABLES'][$e[2][1][1]]['conditioner'][] = '_divide_';
        } elseif (isset($GLOBALS['PEDANTIC'])) {
            log_warning('Divide by zero un-handled', $c_pos);
        }
    }
    if ($e[0] == 'UNARY_IF') {
        if ($e[1][0] == 'CALL_DIRECT' && strpos($e[1][1], '_exists') !== false && $e[1][2][0][0] == 'LITERAL' && $e[1][2][0][1][0] == 'STRING') {
            $function_guard .= ',' . $e[1][2][0][1][1] . ',';
        }
        $passes = ensure_type(array('boolean'), check_expression($e[1], false, false, $function_guard), $c_pos, 'Conditionals must be boolean (unary)');
        if ($passes) {
            infer_expression_type_to_variable_type('boolean', $e[1]);
        }
        $type_a = check_expression($e[2][0], false, false, $function_guard);
        $type_b = check_expression($e[2][1], false, false, $function_guard);
        if ($type_a != 'NULL' && $type_b != 'NULL') {
            $passes = ensure_type(array($type_a, 'mixed'), $type_b, $c_pos, 'Type symettry error in unary operator');
            if ($passes) {
                infer_expression_type_to_variable_type($type_a, $e[2][1]);
            }
        }
        return $type_a;
    }
    if (in_array($e[0], array('BOOLEAN_AND', 'BOOLEAN_OR', 'BOOLEAN_XOR'))) {
        if ($e[0] == 'BOOLEAN_AND' && $e[1][0] == 'BRACKETED' && $e[1][1][0] == 'CALL_DIRECT' && strpos($e[1][1][1], '_exists') !== false && $e[1][1][2][0][0] == 'LITERAL' && $e[1][1][2][0][1][0] == 'STRING') {
            $function_guard .= ',' . $e[1][1][2][0][1][1] . ',';
        }
        if ($e[0] == 'BOOLEAN_AND' && $e[2][0] == 'BOOLEAN_AND' && $e[2][1][0] == 'BRACKETED' && $e[2][1][1][0] == 'CALL_DIRECT' && strpos($e[2][1][1][1], '_exists') !== false && $e[2][1][1][2][0][0] == 'LITERAL' && $e[2][1][1][2][0][1][0] == 'STRING') {
            $function_guard .= ',' . $e[2][1][1][2][0][1][1] . ',';
        }
        $passes = ensure_type(array('boolean'), check_expression($e[1], false, false, $function_guard), $c_pos - 1, 'Can only use boolean combinators with booleans');
        if ($passes) {
            infer_expression_type_to_variable_type('boolean', $e[1]);
        }
        $passes = ensure_type(array('boolean'), check_expression($e[2], false, false, $function_guard), $c_pos, 'Can only use boolean combinators with booleans');
        if ($passes) {
            infer_expression_type_to_variable_type('boolean', $e[2]);
        }
        return 'boolean';
    }
    if (in_array($e[0], array('SL', 'SR', 'REMAINDER'))) {
        $passes = ensure_type(array('integer'), check_expression($e[1], false, false, $function_guard), $c_pos - 1, 'Can only use integer combinators with integers');
        if ($passes) {
            infer_expression_type_to_variable_type('integer', $e[1]);
        }
        $passes = ensure_type(array('integer'), check_expression($e[2], false, false, $function_guard), $c_pos, 'Can only use integer combinators with integers');
        if ($passes) {
            infer_expression_type_to_variable_type('integer', $e[2]);
        }
        return 'integer';
    }
    if (in_array($e[0], array('CONC'))) {
        $type_a = check_expression($e[1], false, false, $function_guard);
        $type_b = check_expression($e[2], false, false, $function_guard);
        $passes = ensure_type(array('string'), $type_a, $c_pos - 1, 'Can only use string combinators with strings (1) (not ' . $type_a . ')');
        if ($passes) {
            infer_expression_type_to_variable_type('string', $e[1]);
        }
        $passes = ensure_type(array('string'), $type_b, $c_pos, 'Can only use string combinators with strings (2) (not ' . $type_b . ')');
        if ($passes) {
            infer_expression_type_to_variable_type('string', $e[2]);
        }
        return 'string';
    }
    if (in_array($e[0], array('SUBTRACT', 'MULTIPLY', 'DIVIDE'))) {
        $type_a = check_expression($e[1], false, false, $function_guard);
        $t = check_expression($e[2], false, false, $function_guard);
        ensure_type(array('integer', 'float'), $type_a, $c_pos - 1, 'Can only use arithmetical combinators with numbers (1) (not ' . $type_a . ')');
        ensure_type(array('integer', 'float'), $t, $c_pos, 'Can only use arithmetical combinators with numbers (2) (not ' . $t . ')');
        return $e[0] == 'DIVIDE' ? 'float' : $type_a;
    }
    if (in_array($e[0], array('ADD'))) {
        $type_a = check_expression($e[1], false, false, $function_guard);
        $t = check_expression($e[2], false, false, $function_guard);
        ensure_type(array('integer', 'float', 'array'), $type_a, $c_pos - 1, 'Can only use + combinator with numbers/arrays (1) (not ' . $type_a . ')');
        ensure_type(array('integer', 'float', 'array'), $t, $c_pos, 'Can only use + combinator with numbers/arrays (2) (not ' . $t . ')');
        return $type_a;
    }
    if (in_array($e[0], array('IS_GREATER_OR_EQUAL', 'IS_SMALLER_OR_EQUAL', 'IS_GREATER', 'IS_SMALLER'))) {
        $type_a = check_expression($e[1], false, false, $function_guard);
        $type_b = check_expression($e[2], false, false, $function_guard);
        ensure_type(array('integer', 'float', 'string'), $type_a, $c_pos - 1, 'Can only use arithmetical comparators with numbers or strings');
        ensure_type(array('integer', 'float', 'string'), $type_b, $c_pos, 'Can only use arithmetical comparators with numbers or strings');
        ensure_type(array($type_a), $type_b, $c_pos, 'Comparators must have type symettric operands (' . $type_a . ' vs ' . $type_b . ')');
        return 'boolean';
    }
    if (in_array($e[0], array('IS_EQUAL', 'IS_IDENTICAL', 'IS_NOT_IDENTICAL', 'IS_NOT_EQUAL'))) {
        $type_a = check_expression($e[1], false, in_array($e[0], array('IS_IDENTICAL', 'IS_NOT_IDENTICAL')) && $e[2][0] == 'LITERAL' && $e[2][1][0] == 'BOOLEAN' && !$e[2][1][1], $function_guard);
        $type_b = check_expression($e[2], false, false, $function_guard);
        $x = $e;
        if ($x[1][0] == 'EMBEDDED_ASSIGNMENT') {
            $x = $e[1];
        }
        if ($x[1][0] == 'VARIABLE' && @count($x[1][1][2]) == 0 && $e[2][0] == 'LITERAL') {
            if (in_array($e[0], array('IS_IDENTICAL', 'IS_NOT_IDENTICAL'))) {
                if ($e[2][1][0] == 'BOOLEAN' && !$e[2][1][1]) {
                    $GLOBALS['LOCAL_VARIABLES'][$x[1][1][1]]['conditioned_false'] = true;
                } elseif ($e[2][1][0] == 'NULL') {
                    $GLOBALS['LOCAL_VARIABLES'][$x[1][1][1]]['conditioned_null'] = true;
                }
            }
            if ($e[2][1][0] == 'INTEGER' && $e[2][1][1] == 0) {
                $GLOBALS['LOCAL_VARIABLES'][$x[1][1][1]]['conditioned_zero'] = true;
            }
        }
        if ($e[0] == 'IS_EQUAL' && $e[2][0] == 'LITERAL' && $e[2][1][0] == 'BOOLEAN') {
            log_warning('It\'s redundant to equate to truths', $c_pos);
        }
        if (strpos($e[0], 'IDENTICAL') === false) {
            if ($type_b == 'NULL') {
                log_warning('Comparing to NULL is considered bad', $c_pos);
            }
            $passes = ensure_type(array($type_a), $type_b, $c_pos, 'Comparators must have type symettric operands (' . $type_a . ' vs ' . $type_b . ')');
            if ($passes) {
                infer_expression_type_to_variable_type($type_a, $e[2]);
            }
        }
        return 'boolean';
    }
    $inner = $e;
    switch ($inner[0]) {
        case 'EMBEDDED_ASSIGNMENT':
            $ret = check_assignment($inner, $c_pos, $function_guard);
            return $ret;
        case 'CALL_METHOD':
            $ret = check_method($inner, $c_pos, $function_guard);
            if (is_null($ret)) {
                log_warning('Method that returns no value used in an expression', $c_pos);
                return 'mixed';
            }
            return $ret;
        case 'CALL_INDIRECT':
            add_variable_reference($inner[1][1], $c_pos);
            return 'mixed';
        case 'CALL_DIRECT':
            $ret = check_call($inner, $c_pos, NULL, $function_guard);
            if (is_null($ret)) {
                log_warning('Function (\'' . $inner[1] . '\') that returns no value used in an expression', $c_pos);
                return 'mixed';
            }
            if ($inner[1] == 'mixed') {
                return '*MIXED*';
            }
            if ($assignment) {
                $GLOBALS['MADE_CALL'] = $inner[1];
                if (@$e[2][0][0] == 'VARIABLE' && @count($e[2][0][1][2]) == 0 && $e[1] == 'is_null') {
                    $GLOBALS['LOCAL_VARIABLES'][$e[2][0][1][1]]['conditioned_null'] = true;
                }
            } else {
                if (isset($GLOBALS['PEDANTIC'])) {
                    if (isset($GLOBALS['NULL_ERROR_FUNCS'][$inner[1]])) {
                        log_warning('Crucial error value un-handled', $c_pos);
                    }
                    if (isset($GLOBALS['FALSE_ERROR_FUNCS'][$inner[1]]) && !$equate_false) {
                        log_warning('Crucial error value un-handled', $c_pos);
                    }
                }
            }
            return $ret;
            break;
        case 'CASTED':
            check_expression($inner[2], false, false, $function_guard);
            return strtolower($inner[1]);
        case 'BRACKETED':
            return check_expression($inner[1], false, false, $function_guard);
        case 'BOOLEAN_NOT':
            $passes = ensure_type(array('boolean'), check_expression($inner[1], false, false, $function_guard), $c_pos, 'Can only \'NOT\' a boolean', true);
            if ($passes) {
                infer_expression_type_to_variable_type('boolean', $inner[1]);
            }
            return 'boolean';
        case 'BW_NOT':
            $passes = ensure_type(array('integer'), check_expression($inner[1], false, false, $function_guard), $c_pos, 'Can only \'BITWISE-NOT\' an integer', true);
            if ($passes) {
                infer_expression_type_to_variable_type('integer', $inner[1]);
            }
            return 'integer';
        case 'NEGATE':
            $type = check_expression($inner[1], false, false, $function_guard);
            ensure_type(array('integer', 'float'), $type, $c_pos, 'Can only negate a number');
            return $type;
        case 'LITERAL':
            $type = check_literal($inner[1]);
            return $type;
        case 'NEW_OBJECT':
            global $FUNCTION_SIGNATURES;
            if (!isset($FUNCTION_SIGNATURES[$inner[1]]) && $FUNCTION_SIGNATURES != array() && strpos($function_guard, ',' . $inner[1] . ',') === false) {
                if (!is_null($inner[1])) {
                    log_warning('Unknown class, ' . $inner[1], $c_pos);
                }
            }
            foreach ($inner[2] as $param) {
                check_expression($param, false, false, $function_guard);
            }
            if (count($inner[2]) != 0) {
                check_call(array('CALL_METHOD', $inner[1], $inner[2]), $c_pos, $inner[1], $function_guard);
            }
            if ($inner[1] == 'ocp_tempcode') {
                return 'tempcode';
            }
            return 'object-' . $inner[1];
        case 'CLONE_OBJECT':
            // $a=clone $b will make a shallow copy of the object $, so we just
            // return $b's type
            return check_expression($inner[1], false, false, '');
        case 'CREATE_ARRAY':
            foreach ($inner[1] as $param) {
                check_expression($param[0], false, false, $function_guard);
                if (isset($param[1])) {
                    check_expression($param[1], false, false, $function_guard);
                }
            }
            return 'array';
        case 'VARIABLE':
            return check_variable($inner, true);
    }
    return 'mixed';
}
Exemple #4
0
                             <?php 
if (empty($current_user)) {
    ?>
                            <li><a href="<?php 
    echo site_url(LOGIN_URL);
    ?>
">Sign In</a></li>
                            <li><a href="<?php 
    echo site_url(REGISTER_URL);
    ?>
">Register</a></li>
                            <?php 
} else {
    ?>
                            <li <?php 
    echo check_method('profile');
    ?>
><a href="<?php 
    echo site_url('users/profile');
    ?>
"><?php 
    e(lang('bf_user_settings'));
    ?>
</a></li>
                            <li><a href="<?php 
    echo site_url('logout');
    ?>
"><?php 
    e(lang('bf_action_logout'));
    ?>
</a></li>
    die('That app does not exist.');
}
unset($_GET['package']);
require dirname(__FILE__) . '/../include/processCookie.php';
$user_rating = FALSE;
if ($LOGIN_DATA['user_id']) {
    $user_rating = mysql_query("SELECT rating from user_packages WHERE package='{$package['package']}' AND user_id={$LOGIN_DATA['user_id']} LIMIT 1") or die(mysql_error());
    $user_rating = mysql_fetch_assoc($user_rating);
    if ($user_rating) {
        $user_rating = $user_rating['rating'];
    } else {
        $user_rating = NULL;
    }
}
require_once dirname(__FILE__) . '/../include/check_method.php';
switch (check_method(array('GET', 'PURCHASE', 'POST', 'PUT'))) {
    case 'PUT':
        if (!$LOGIN_DATA['user_id']) {
            header('HTTP/1.1 401 Unauthorized', true, 401);
            header('Content-Type: text/plain; charset=utf-8');
            die("You are not logged in.\n");
        }
        parse_str(file_get_contents('php://input'), $_PUT);
        if ($_PUT['rating']) {
            if ($user_rating === FALSE) {
                header('HTTP/1.1 401 Unauthorized', true, 401);
                header('Content-Type: text/plain; charset=utf-8');
                die("You have not purchased or installed that app.\n");
            }
            $rating = (double) $_PUT['rating'];
            mysql_query("UPDATE user_packages SET rating={$rating} WHERE user_id={$LOGIN_DATA['user_id']} AND package={$package['package']}") or die(mysql_error());
<?php

require_once dirname(__FILE__) . '/../include/use_type.php';
require_once dirname(__FILE__) . '/../include/check_method.php';
$method = check_method(array('GET', 'POST'));
require dirname(__FILE__) . '/../include/processCookie.php';
if (!$LOGIN_DATA['user_id']) {
    header('HTTP/1.1 401 Unauthorized', true, 401);
    header('Content-Type: text/plain; charset=utf-8');
    die("You are not logged in.\n");
}
if ($method == 'POST') {
    if ($_POST['remove_token']) {
        $token = mysql_real_escape_string($_POST['remove_token']);
        mysql_query("DELETE FROM user_tokens WHERE request_shared_key='{$token}'") or die(mysql_error());
        mysql_query("DELETE FROM access_tokens WHERE request_shared_key='{$token}'") or die(mysql_error());
    }
    if ($_POST['toggle_privacy']) {
        $LOGIN_DATA['private'] = (int) (!$LOGIN_DATA['private']);
        mysql_query("UPDATE users SET private={$LOGIN_DATA['private']} WHERE user_id={$LOGIN_DATA['user_id']}") or die(mysql_error());
    }
    if ($_POST['toggle_list']) {
        $LOGIN_DATA['list'] = (int) (!$LOGIN_DATA['list']);
        $email = escapeshellarg($LOGIN_DATA['email']);
        if ($LOGIN_DATA['list']) {
            shell_exec("whoami; echo {$email} | /usr/sbin/add_members -r - discuss");
        } else {
            shell_exec("/usr/sbin/remove_members discuss {$email}");
        }
        mysql_query("UPDATE users SET list={$LOGIN_DATA['list']} WHERE user_id={$LOGIN_DATA['user_id']}") or die(mysql_error());
    }
<?php

require_once dirname(__FILE__) . '/../include/use_type.php';
require_once dirname(__FILE__) . '/../include/check_method.php';
require dirname(__FILE__) . '/../include/processCookie.php';
if ($LOGIN_DATA['user_id'] && check_method(array('GET', 'POST')) == 'POST') {
    $successful_submit = false;
    if ($_POST['name'] && $_POST['price'] && $_POST['source_license'] && $_POST['content_license'] && ($_POST['source_file'] || $_POST['source_control'])) {
        require dirname(__FILE__) . '/../include/emailclass.php';
        $mail = new sendmail();
        $mail->gpg_add_key('0x0DD626E6');
        $mail->gpg_set_type(GPG_ASYMMETRIC);
        $mail->gpg_set_sign(1);
        $mail->gpg_set_signing_key('0x0DD626E6');
        $mail->gpg_set_homedir('/home/apt/.gnupg/');
        $mail->sender("*****@*****.**");
        $mail->from($LOGIN_DATA['email']);
        $mail->add_to('*****@*****.**');
        $mail->subject('TVE Application Submission: ' . $_POST['name']);
        if ($_FILES['source_file']) {
            $mail->attachment($_FILES['source_file']['tmp_name'], $_FILES['source_file']['type'], $_FILES['source_file']['name']);
        }
        foreach ($_POST as $key => $val) {
            if ($key == 'source_file') {
                continue;
            }
            $mail->body($key . ': ' . $val . "\n");
        }
        $mail->body('User: '******'user_id']);
        $successful_submit = $mail->send();
    }