Exemplo n.º 1
0
/**
 * processes the installer
 */
function process($argv)
{
    // Determine ANSI output from --ansi and --no-ansi flags
    setUseAnsi($argv);
    if (in_array('--help', $argv)) {
        displayHelp();
        exit(0);
    }
    $check = in_array('--check', $argv);
    $help = in_array('--help', $argv);
    $force = in_array('--force', $argv);
    $quiet = in_array('--quiet', $argv);
    $channel = in_array('--snapshot', $argv) ? 'snapshot' : (in_array('--preview', $argv) ? 'preview' : 'stable');
    $disableTls = in_array('--disable-tls', $argv);
    $installDir = getOptValue('--install-dir', $argv, false);
    $version = getOptValue('--version', $argv, false);
    $filename = getOptValue('--filename', $argv, 'composer.phar');
    $cafile = getOptValue('--cafile', $argv, false);
    if (!checkParams($installDir, $version, $cafile)) {
        exit(1);
    }
    $ok = checkPlatform($quiet, $disableTls);
    if (true === $disableTls) {
        out("You have instructed the Installer not to enforce SSL/TLS security on remote HTTPS requests.", 'info');
        out("This will leave all downloads during installation vulnerable to Man-In-The-Middle (MITM) attacks.", 'info');
    }
    if ($check) {
        exit($ok ? 0 : 1);
    }
    if ($ok || $force) {
        installComposer($version, $installDir, $filename, $quiet, $disableTls, $cafile, $channel);
        exit(0);
    }
    exit(1);
}
Exemplo n.º 2
0
function handle($data)
{
    $config = (include __DIR__ . "/config.php");
    $d = decrypt($data, $config);
    $clear_data = json_decode($d, true, 512, JSON_BIGINT_AS_STRING);
    if ($clear_data != NULL && checkParams($clear_data)) {
        if (!record_new_connection($config, $clear_data)) {
            die;
        }
        $result = null;
        switch ($clear_data["type"]) {
            case "GETJOB":
                $result = json_encode(getJob($config, $clear_data['appid'], $clear_data['time'], $clear_data['customField']));
                break;
            case "ACCEPTEDJOB":
                $result = json_encode(acceptJob($config, $clear_data['appid'], $clear_data['time'], $clear_data['customField']));
                break;
            case "DONEJOB":
                $result = json_encode(doneJob($config, $clear_data['appid'], $clear_data['time'], $clear_data['customField']));
                break;
            default:
                return false;
        }
        //return encrypt($result,$config);
        return $result;
    } else {
        return false;
    }
}
Exemplo n.º 3
0
function plugin_init_mobile()
{
    global $PLUGIN_HOOKS, $LANG;
    Plugin::registerClass('PluginMobileCommon');
    $PLUGIN_HOOKS['csrf_compliant']['mobile'] = true;
    $PLUGIN_HOOKS['helpdesk_menu_entry']['mobile'] = false;
    $PLUGIN_HOOKS['config_page']['mobile'] = 'index.php';
    $PLUGIN_HOOKS['menu_entry']['mobile'] = 'index.php';
    $PLUGIN_HOOKS['headings']['mobile'] = 'plugin_get_headings_mobile';
    $PLUGIN_HOOKS['headings_action']['mobile'] = 'plugin_headings_actions_mobile';
    $PLUGIN_HOOKS['change_profile']['mobile'] = array('PluginMobileProfile', 'changeProfile');
    $PLUGIN_HOOKS['redirect_page']['mobile'] = 'index.php';
    $plug = new Plugin();
    if ($plug->isInstalled('mobile') && $plug->isActivated('mobile')) {
        require_once GLPI_ROOT . "/plugins/mobile/inc/common.function.php";
        checkParams();
        if (isNavigatorMobile()) {
            redirectMobile();
        }
    }
}
Exemplo n.º 4
0
/**
 * processes the installer
 */
function process($argv)
{
    // Determine ANSI output from --ansi and --no-ansi flags
    setUseAnsi($argv);
    if (in_array('--help', $argv)) {
        displayHelp();
        exit(0);
    }
    $check = in_array('--check', $argv);
    $help = in_array('--help', $argv);
    $force = in_array('--force', $argv);
    $quiet = in_array('--quiet', $argv);
    $channel = in_array('--snapshot', $argv) ? 'snapshot' : (in_array('--preview', $argv) ? 'preview' : 'stable');
    $disableTls = in_array('--disable-tls', $argv);
    $installDir = getOptValue('--install-dir', $argv, false);
    $version = getOptValue('--version', $argv, false);
    $filename = getOptValue('--filename', $argv, 'composer.phar');
    $cafile = getOptValue('--cafile', $argv, false);
    if (!checkParams($installDir, $version, $cafile)) {
        exit(1);
    }
    $ok = checkPlatform($warnings, $quiet, $disableTls);
    if ($check) {
        // Only show warnings if we haven't output any errors
        if ($ok) {
            showWarnings($warnings);
            showSecurityWarning($disableTls);
        }
        exit($ok ? 0 : 1);
    }
    if ($ok || $force) {
        installComposer($version, $installDir, $filename, $quiet, $disableTls, $cafile, $channel);
        showWarnings($warnings);
        showSecurityWarning($disableTls);
        exit(0);
    }
    exit(1);
}
Exemplo n.º 5
0
function ping_kdc()
{
    $sock = new sockets();
    $unix = new unix();
    $filetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    if (!is_numeric("{$EnableKerbAuth}")) {
        $EnableKerbAuth = 0;
    }
    if ($EnableKerbAuth == 0) {
        echo "Starting......: [PING]: Kerberos, disabled\n";
        return;
    }
    if (!checkParams()) {
        echo "Starting......: [PING]: Kerberos, misconfiguration failed\n";
        return;
    }
    $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    $time = $unix->file_time_min($filetime);
    if ($time < 120) {
        if (!$GLOBALS["VERBOSE"]) {
            return;
        }
        echo "{$filetime} ({$time}Mn)\n";
    }
    $kinit = $unix->find_program("kinit");
    $echo = $unix->find_program("echo");
    $net = $unix->LOCATE_NET_BIN_PATH();
    $wbinfo = $unix->find_program("wbinfo");
    $domain = strtoupper($array["WINDOWS_DNS_SUFFIX"]);
    $domain_lower = strtolower($array["WINDOWS_DNS_SUFFIX"]);
    $ad_server = strtolower($config["WINDOWS_SERVER_NETBIOSNAME"]);
    $kinitpassword = $array["WINDOWS_SERVER_PASS"];
    $kinitpassword = $unix->shellEscapeChars($kinitpassword);
    $clock_explain = "The clock on you system (Linux/UNIX) is too far off from the correct time.\nYour machine needs to be within 5 minutes of the Kerberos servers in order to get any tickets.\nYou will need to run ntp, or a similar service to keep your clock within the five minute window";
    $cmd = "{$echo} {$kinitpassword}|{$kinit} {$array["WINDOWS_SERVER_ADMIN"]}@{$domain} -V 2>&1";
    echo "{$cmd}\n";
    exec("{$cmd}", $kinit_results);
    while (list($num, $ligne) = each($kinit_results)) {
        if (preg_match("#Clock skew too great while getting initial credentials#", $ligne)) {
            $unix->send_email_events("Active Directory connection clock issue", "kinit program claim\n{$ligne}\n{$clock_explain}", "system");
        }
        if (preg_match("#Client not found in Kerberos database while getting initial credentials#", $ligne)) {
            $unix->send_email_events("Active Directory authentification issue", "kinit program claim\n{$ligne}\n", "system");
        }
        if (preg_match("#Authenticated to Kerberos#", $ligne)) {
            echo "starting......: [PING]: Kerberos, Success\n";
        }
        if ($GLOBALS["VERBOSE"]) {
            echo "kinit: {$ligne}\n";
        }
    }
    @unlink($filetime);
    @file_put_contents($filetime, time());
}
Exemplo n.º 6
0
 * Version     : 1.0
 */
//Insersion du fichier de fonction
include_once "../functions/dbFunctions.php";
if ($_SESSION["idLogged"] != null) {
    header('Location: index.php');
}
$message = "";
$nom = isset($_POST["nom"]) ? $_POST["nom"] : "";
$prenom = isset($_POST["prenom"]) ? $_POST["prenom"] : "";
$pseudo = isset($_POST["pseudo"]) ? $_POST["pseudo"] : "";
$email = isset($_POST["email"]) ? $_POST["email"] : "";
$password = isset($_POST["password"]) ? $_POST["password"] : "";
$confirmPassword = isset($_POST["confirmPassword"]) ? $_POST["confirmPassword"] : "";
if (isset($_POST["submit"])) {
    if (checkParams($_POST, ["nom", "prenom", "pseudo", "email", "password", "confirmPassword"])) {
        if ($password != $confirmPassword) {
            $message = "Les deux mots de passe sont différents.";
        } else {
            insertUser($nom, $prenom, $pseudo, $email, sha1($password));
            $nom = "";
            $prenom = "";
            $pseudo = "";
            $email = "";
            $message = "Inscription réussie. Vous pouvez maintenant vous connecter.";
        }
    } else {
        $message = "Veuillez remplir tous les champs.";
    }
} else {
    if (isset($_POST["discard"])) {
Exemplo n.º 7
0
function ping_kdc()
{
    $sock = new sockets();
    $unix = new unix();
    $users = new settings_inc();
    $chmod = $unix->find_program("chmod");
    $filetime = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".time";
    $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid";
    $EnableKerbAuth = $sock->GET_INFO("EnableKerbAuth");
    if (!is_numeric("{$EnableKerbAuth}")) {
        $EnableKerbAuth = 0;
    }
    $pid = @file_get_contents($pidfile);
    if ($unix->process_exists($pid, basename(__FILE__))) {
        $ttime = $unix->PROCCESS_TIME_MIN($pid);
        progress_logs(20, "{join_activedirectory_domain}", "[PING]: Already executed pid {$pid} since {$ttime}Mn");
        return;
    }
    @file_put_contents($pidfile, getmypid());
    if ($EnableKerbAuth == 0) {
        progress_logs(20, "{ping_kdc}", "[PING]: Kerberos, disabled");
        return;
    }
    if (!checkParams()) {
        progress_logs(20, "{ping_kdc}", "[PING]: Kerberos, misconfiguration failed");
        return;
    }
    $array["RESULTS"] = false;
    $array = unserialize(base64_decode($sock->GET_INFO("KerbAuthInfos")));
    $time = $unix->file_time_min($filetime);
    if (!$GLOBALS["FORCE"]) {
        if ($time < 10) {
            if (!$GLOBALS["VERBOSE"]) {
                return;
            }
            progress_logs(20, "{ping_kdc}", "{$filetime} ({$time}Mn)");
        }
    }
    $kinit = $unix->find_program("kinit");
    $echo = $unix->find_program("echo");
    $net = $unix->LOCATE_NET_BIN_PATH();
    $wbinfo = $unix->find_program("wbinfo");
    $chmod = $unix->find_program("chmod");
    $nohup = $unix->find_program("nohup");
    $domain = strtoupper($array["WINDOWS_DNS_SUFFIX"]);
    $domain_lower = strtolower($array["WINDOWS_DNS_SUFFIX"]);
    $ad_server = strtolower($array["WINDOWS_SERVER_NETBIOSNAME"]);
    $kinitpassword = $array["WINDOWS_SERVER_PASS"];
    $kinitpassword = $unix->shellEscapeChars($kinitpassword);
    $php5 = $unix->LOCATE_PHP5_BIN();
    $clock_explain = "The clock on you system (Linux/UNIX) is too far off from the correct time.\nYour machine needs to be within 5 minutes of the Kerberos servers in order to get any tickets.\nYou will need to run ntp, or a similar service to keep your clock within the five minute window";
    $cmd = "{$echo} {$kinitpassword}|{$kinit} {$array["WINDOWS_SERVER_ADMIN"]}@{$domain} -V 2>&1";
    progress_logs(20, "{ping_kdc}", "{$cmd}");
    exec("{$cmd}", $kinit_results);
    while (list($num, $ligne) = each($kinit_results)) {
        if (preg_match("#Clock skew too great while getting initial credentials#", $ligne)) {
            if ($GLOBALS["VERBOSE"]) {
                progress_logs(20, "{ping_kdc}", "Clock skew too great while");
            }
            $array["RESULTS"] = false;
            $array["INFO"] = $ligne;
            $unix->send_email_events("Active Directory connection clock issue", "kinit program claim\n{$ligne}\n{$clock_explain}", "system");
        }
        if (preg_match("#Client not found in Kerberos database while getting initial credentials#", $ligne)) {
            $array["RESULTS"] = false;
            $array["INFO"] = $ligne;
            $unix->send_email_events("Active Directory authentification issue", "kinit program claim\n{$ligne}\n", "system");
        }
        if (preg_match("#Authenticated to Kerberos#", $ligne)) {
            $array["RESULTS"] = true;
            $array["INFO"] = $ligne;
            progress_logs(20, "{join_activedirectory_domain}", "[PING]: Kerberos, Success");
        }
        if ($GLOBALS["VERBOSE"]) {
            progress_logs(20, "{ping_kdc}", "kinit: {$ligne}");
        }
    }
    $TestJoin = true;
    if ($array["RESULTS"] == true) {
        exec("{$net} ads testjoin 2>&1", $results);
        while (list($num, $ligne) = each($results)) {
            if (preg_match("#Unable to find#", $ligne)) {
                $array["RESULTS"] = false;
                $array["INFO"] = $array["INFO"] . "<div><i style='font-size:11px;color:#B3B3B3'>{$ligne}</i></div>";
                $TestJoin = false;
                continue;
            }
            if (preg_match("#is not valid:#", $ligne)) {
                $array["RESULTS"] = false;
                $array["INFO"] = $array["INFO"] . "<div><i style='font-size:11px;color:#B3B3B3'>{$ligne}</i></div>";
                $TestJoin = false;
                continue;
            }
        }
        if (preg_match("#OK#", $ligne)) {
            $array["INFO"] = $array["INFO"] . "<div><i style='font-size:11px;color:#B3B3B3'>{$ligne}</i></div>";
            $array["RESULTS"] = true;
        }
    }
    @unlink($filetime);
    @file_put_contents($filetime, time());
    @file_put_contents("/usr/share/artica-postfix/ressources/logs/kinit.array", serialize($array));
    @chmod("/usr/share/artica-postfix/ressources/logs/kinit.array", 0777);
    if ($GLOBALS["JUST_PING"]) {
        return;
    }
    if (!$TestJoin) {
        shell_exec("{$nohup} {$php5} " . __FILE__ . " --join >/dev/null 2>&1 &");
    }
    if ($users->SQUID_INSTALLED) {
        winbind_priv();
        if (!is_dir("/var/lib/samba/smb_krb5")) {
            @mkdir("/var/lib/samba/smb_krb5", 0777, true);
        }
        shell_exec("{$chmod} 1775 /var/lib/samba/smb_krb5 >/dev/null 2>&1");
        shell_exec("{$chmod} 1775 /var/lib/samba >/dev/null 2>&1");
    }
}
Exemplo n.º 8
0
<?php

session_start();
include "config.php";
if (isset($_SESSION['username'])) {
    $error = ['succes' => False, 'redirect' => True, 'description' => 'User is already logged in!'];
    echo json_encode($error);
    die;
}
if (!checkParams()) {
    $error = ['success' => False, 'redirect' => False, 'description' => 'Username must be 4-34 characters long,<br/> password must be at least 4 characters'];
    echo json_encode($error);
    die;
}
$username = mysql_real_escape_string($_POST['username']);
$password = sha1(mysql_real_escape_string($_POST['password']));
$sql = mysql_query("SELECT * FROM User WHERE username = '******' AND passhash = '{$password}'");
$result = mysql_fetch_array($sql);
if ($result['username'] !== $username) {
    $error = ['success' => False, 'redirect' => False, 'description' => 'User entered wrong login info!'];
    echo json_encode($error);
    die;
} else {
    $_SESSION['username'] = $username;
    $_SESSION['userId'] = $result['id'];
    $ok = ['success' => True, 'result' => 'ok'];
    echo json_encode($ok);
}
Exemplo n.º 9
0
//Insersion du fichier de fonction
include_once "../functions/dbFunctions.php";
if ($_SESSION["idLogged"] == "") {
    header('Location: index.php');
}
$ConsolesHTML = displayConsoles(getConsoles());
$message = "";
$titre = isset($_POST["titre"]) ? $_POST["titre"] : "";
$date = isset($_POST["date"]) ? $_POST["date"] : "";
$studio = isset($_POST["studio"]) ? $_POST["studio"] : "";
$description = isset($_POST["description"]) ? $_POST["description"] : "";
$tabConsoles = isset($_POST["console1"]) ? $_POST["console1"] : "";
$bandeOriginale = "";
$image = "";
if (isset($_POST["submit"])) {
    if (checkParams($_POST, ["titre", "date", "studio", "description"])) {
        if (basename($_FILES['bandeOriginale']['name']) != "") {
            $uploaddir = '../media/bo/';
            $bandeOriginale = $uploaddir . basename($_FILES['bandeOriginale']['name']);
            $moved = move_uploaded_file($_FILES['bandeOriginale']['tmp_name'], $bandeOriginale);
        } else {
            $bandeOriginale = "";
        }
        if (basename($_FILES['image']['name']) != "") {
            $uploaddir = '../media/pictures/';
            $image = $uploaddir . basename($_FILES['image']['name']);
            move_uploaded_file($_FILES['image']['tmp_name'], $image);
        } else {
            $image = "";
        }
        $idJeu = insertJeu($_SESSION["idLogged"], $titre, $date, $studio, $description, $bandeOriginale, $image);
Exemplo n.º 10
0
function prepCreateTask()
{
    global $_G;
    $param = array();
    $oldParam = array();
    if (isset($_GET['old_params'])) {
        $oldParam = BIGAPPJSON::decode($_GET['old_params'], true);
    }
    //$arrNeedParam = array('nav_color', 'icon_image', 'startup_image', 'os', 'plugin_version', 'bbs_name', 'app_name', 'package_name', 'channel_name');
    //////////////////////////////////////////////////////
    $arrNeedParam = array('nav_color', 'icon_image', 'startup_image', 'os', 'plugin_version', 'bbs_name', 'app_name', 'package_name', 'channel_name', 'version_name', 'push_enabled', 'key_alias', 'store_password', 'key_password', 'app_id_wechat', 'sec_key_wechat', 'app_id_qq', 'sec_key_qq', 'app_id_sina', 'sec_key_sina', 'jpush_app_key', 'jpush_master_secret', 'jpush_is_free');
    /////////////////////////////////////////////////////
    $param['method'] = 'create';
    $param['plugin_version'] = '0.0.0';
    if (isset($_G['setting']['plugins']['version']['bigapp'])) {
        $param['plugin_version'] = $_G['setting']['plugins']['version']['bigapp'];
    }
    //$param['plugin_version'] = '2.0.0';//测试用
    if (isset($_REQUEST['os']) && is_array($_REQUEST['os']) && !empty($_REQUEST['os'])) {
        foreach ($_REQUEST['os'] as $v) {
            $os += 1 << $v;
        }
        $_REQUEST['os'] = $os;
    }
    foreach ($arrNeedParam as $key) {
        if (isset($_REQUEST[$key])) {
            if ('icon_image' === $key || 'startup_image' === $key) {
                $_REQUEST[$key] = htmlspecialchars_decode($_REQUEST[$key]);
            }
            $param[$key] = $_REQUEST[$key];
        }
    }
    checkParams($param);
    return $param;
}
Exemplo n.º 11
0
$password = isset($_POST["password"]) ? $_POST["password"] : "";
$confirmPassword = isset($_POST["confirmPassword"]) ? $_POST["confirmPassword"] : "";
if (isset($_POST["submit"])) {
    if (checkParams($_POST, ["nom", "prenom", "pseudo", "email", "password", "confirmPassword"])) {
        if ($password != $confirmPassword) {
            $message = "Les deux mots de passe sont différents.";
        } else {
            updateUser($_SESSION["idLogged"], $nom, $prenom, $pseudo, $email, sha1($password));
            $message = "Mise à jour effectuée. Le mot de passe a été modifié.";
            $nomOld = $nom;
            $prenomOld = $prenom;
            $pseudoOld = $pseudo;
            $emailOld = $email;
        }
    } else {
        if (checkParams($_POST, ["nom", "prenom", "pseudo", "email"])) {
            updateUserSansPassword($_SESSION["idLogged"], $nom, $prenom, $pseudo, $email);
            $message = "Mise à jour effectuée. Le mot de passe n'a pas été modifié.";
            $nomOld = $nom;
            $prenomOld = $prenom;
            $pseudoOld = $pseudo;
            $emailOld = $email;
        }
    }
}
//Définition du nom de la page
$titlePage = "Gestion de mon profil";
//Insersion du header HTML
include_once "../view/HeadPage.php";
?>
include dirname(__FILE__) . '/../../config/config.inc.php';
include dirname(__FILE__) . '/iitc_netbanx.php';
if (intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1) {
    $rewrited_url = __PS_BASE_URI__;
}
// Init variables
$output = array();
$message = '';
$params = $_POST;
// Process the callback
if (!checkHost($_SERVER['REMOTE_ADDR'])) {
    $output[] = 'security check failed';
} else {
    $output[] = 'security check passed';
    // Make sure orderID + amount is present
    if (!checkParams($params)) {
        $output[] = 'No orderID / payment amount given';
    } else {
        // Open the order
        $netbanx = new Iitc_netbanx();
        $cartID = intval($params['nbx_merchant_reference']);
        $cart = new Cart($cartID);
        // Format payment amount correctly
        $orderTotal = formatAmount($params['nbx_payment_amount'], Configuration::get("IITC_NETBANX_MINORUNITS"));
        // Fun tip - Prestashop checks the order total for us :)
        // Check the order status
        switch ($params['nbx_status']) {
            case "passed":
                // Check checksum
                $checksumResult = checkChecksum(Configuration::get("IITC_NETBANX_SECRETKEY"), $params['nbx_payment_amount'], $params['nbx_currency_code'], $params['nbx_merchant_reference'], $params['nbx_netbanx_reference'], $params['nbx_checksum']);
                $output[] = $checksumResult[1];
Exemplo n.º 13
0
         header("Location: error.php?error={$message}");
         exit;
     }
     $id = Database::getUserId($_POST['netid']);
     if ($id === -1) {
         $id = Database::createUser($_POST['netid']);
     }
     $course = Database::createCourse($_POST['name'], $_POST['semester'], $_POST['instructor']);
     Database::createAccount($id, $course, Instructor::getName());
     header("Location: in_class.php?id={$course}");
     exit;
 } else {
     if (isset($_GET['uploader'])) {
         //an uploader is being added to a course
         $needed = array("token", "course", "user");
         if (!checkParams($needed, $_POST)) {
             $message = urlencode("A parameter is missing from the form submitted.");
             header("Location: error.php?error={$message}");
             exit;
         }
         if (!Session::verifyToken($_POST['token'])) {
             $message = urlencode("The token provided does not match.");
             header("Location: error.php?error={$message}");
             exit;
         }
         $courseInfo = Database::getCourseByID($_POST['course']);
         if (!isset($courseInfo['id'])) {
             $message = urlencode("The course provided is not valid.");
             header("Location: error.php?error={$message}");
             exit;
         }