Esempio n. 1
0
 if ($username != $row['cname']) {
     $username = $row['cname'];
 }
 $query = $sql->prepare("SELECT COUNT(`jobID`) AS `amount` FROM `jobs` WHERE `affectedID`=? AND `resellerID`=? AND `action`='dl' AND (`status` IS NULL OR `status`='1') LIMIT 1");
 $query->execute(array($localID, $resellerID));
 if ($query->fetchColumn() > 0) {
     $success['false'][] = 'Server is marked for deletion';
 }
 $updateArray = array();
 $eventualUpdate = '';
 if (isset($data['private']) and active_check($data['private'])) {
     $updateArray[] = $data['private'];
     $eventualUpdate .= ',`password`=?';
     $private = $data['private'];
 }
 if (isset($data['port']) and port($data['port']) and !in_array($data['port'], $usedPorts)) {
     $updateArray[] = $data['port'];
     $eventualUpdate .= ',`port`=?';
     $port = $data['port'];
 }
 if (isset($data['active']) and active_check($data['active'])) {
     $updateArray[] = $data['active'];
     $eventualUpdate .= ',`active`=?';
     $active = $data['active'];
 }
 if (isset($data['slots']) and isid($data['slots'], 11)) {
     $updateArray[] = $data['slots'];
     $eventualUpdate .= ',`slots`=?';
     $slots = $data['slots'];
 }
 if (isset($data['max_download_total_bandwidth']) and isid($data['max_download_total_bandwidth'], 255)) {
Esempio n. 2
0
 function usedPorts($ips)
 {
     global $sql;
     if (!is_array($ips)) {
         $ips = array($ips);
     }
     $portsArray = array();
     foreach ($ips as $serverIP) {
         $ports = array();
         $query = $sql->prepare("SELECT `port`,`port2`,`port3`,`port4`,`port5` FROM `gsswitch` WHERE `serverip`=? ORDER BY `port`");
         $query->execute(array($serverIP));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             if (port($row['port'])) {
                 $ports[] = $row['port'];
             }
             if (port($row['port2'])) {
                 $ports[] = $row['port2'];
             }
             if (port($row['port3'])) {
                 $ports[] = $row['port3'];
             }
             if (port($row['port4'])) {
                 $ports[] = $row['port4'];
             }
             if (port($row['port5'])) {
                 $ports[] = $row['port5'];
             }
         }
         $query = $sql->prepare("SELECT `port` FROM `voice_server` WHERE `ip`=?");
         $query->execute(array($serverIP));
         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
             if (port($row['port'])) {
                 $ports[] = $row['port'];
             }
         }
         $ports = array_unique($ports);
         asort($ports);
         $portsArray[count($ports)] = array('ip' => $serverIP, 'ports' => $ports);
     }
     $bestIP = current($portsArray);
     return array('ip' => $bestIP['ip'], 'ports' => $bestIP['ports']);
 }
Esempio n. 3
0
 function eacchange($what, $serverid, $rcon, $reseller_id)
 {
     global $sql;
     global $dbConnect;
     $subfolder = '';
     $parameter = '';
     $query = $sql->prepare("SELECT `active`,`cfgdir`,`type`,`mysql_server`,`mysql_port`,`mysql_db`,`mysql_table`,`mysql_user`,`mysql_password` FROM `eac` WHERE `resellerid`=? LIMIT 1");
     $query->execute(array($reseller_id));
     while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
         $cfgdir = $row['cfgdir'];
         $active = $row['active'];
         $type = $row['type'];
         $mysql_server = $row['mysql_server'];
         $mysql_port = $row['mysql_port'];
         $mysql_db = $row['mysql_db'];
         $mysql_table = $row['mysql_table'];
         $mysql_user = $row['mysql_user'];
         $mysql_password = $row['mysql_password'];
         $query2 = $sql->prepare("SELECT g.`serverip`,g.`port`,s.`anticheat`,t.`shorten` FROM `gsswitch` g LEFT JOIN `serverlist` s ON g.`serverid`=s.`id` LEFT JOIN `servertypes` t ON s.`servertype`=t.`id` WHERE g.`id`=? AND g.`resellerid`=? LIMIT 1");
         $query2->execute(array($serverid, $reseller_id));
         while ($row2 = $query2->fetch(PDO::FETCH_ASSOC)) {
             $gsip = $row2['serverip'];
             $gsport = $row2['port'];
             $sqlParameter = 0;
             if ($row2['anticheat'] == 3) {
                 $parameter = '';
             } else {
                 if ($row2['anticheat'] == 4) {
                     $parameter = '-2';
                     $sqlParameter = 2;
                 } else {
                     if ($row2['anticheat'] == 5) {
                         $parameter = '-1';
                         $sqlParameter = 1;
                     } else {
                         if ($row2['anticheat'] == 6) {
                             $parameter = '-3';
                             $sqlParameter = 3;
                         }
                     }
                 }
             }
             $gameID = 0;
             if ($row2['shorten'] == 'cstrike' or $row2['shorten'] == 'czero') {
                 $subfolder = 'hl1';
                 $gameID = 1;
             } else {
                 if ($row2['shorten'] == 'css' or $row2['shorten'] == 'tf') {
                     $subfolder = 'hl2';
                     $gameID = 2;
                 } else {
                     if ($row2['shorten'] == 'csgo') {
                         $subfolder = 'csgo';
                         $gameID = 4;
                     }
                 }
             }
             if ($type == 'M') {
                 $mysql_port = port($mysql_port) ? $mysql_port : 3306;
                 $eacSql = new PDO("mysql:host={$mysql_server};dbname={$mysql_db};port={$mysql_port}", $mysql_user, $mysql_password, array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
                 if ($dbConnect['debug'] == 1) {
                     $eacSql->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
                 }
                 $query3 = $eacSql->prepare("SELECT 1 FROM `" . $mysql_table . "` WHERE `IP`=? LIMIT 1");
                 $query3->execute(array($gsip . ':' . $gsport));
                 $entryExists = $query3->rowCount();
                 if ($entryExists > 0 and $what == 'change') {
                     $query3 = $eacSql->prepare("UPDATE `" . $mysql_table . "` SET `GAME`=?,`RCONPWD`=?,`FLAGS`=?,`EAC_ENABLED`=1 WHERE `IP`=? LIMIT 1");
                     $query3->execute(array($gameID, $rcon, $sqlParameter, $gsip . ':' . $gsport));
                 } else {
                     if ($entryExists == 0 and $what == 'change') {
                         $query3 = $eacSql->prepare("INSERT INTO `" . $mysql_table . "` (`GAME`,`IP`,`RCONPWD`,`FLAGS`,`EAC_ENABLED`) VALUES (?,?,?,?,1)");
                         $query3->execute(array($gameID, $gsip . ':' . $gsport, $rcon, $sqlParameter));
                     } else {
                         if ($entryExists > 0 and $what == 'remove') {
                             $query3 = $eacSql->prepare("DELETE FROM `" . $mysql_table . "` WHERE `IP`=?");
                             $query3->execute(array($gsip . ':' . $gsport));
                         }
                     }
                 }
             } else {
                 $file = $cfgdir . '/' . $subfolder . '/' . $gsip . '-' . $gsport;
                 $file = preg_replace('/\\/\\//', '/', $file);
                 if ($what == 'change') {
                     $ssh2cmd = 'echo "' . $gsip . ':' . $gsport . '-' . $rcon . $parameter . '" > ' . $file;
                 } else {
                     if ($what == 'remove') {
                         $ssh2cmd = 'rm -f ' . $file;
                     }
                 }
                 if (isset($ssh2cmd) and $active == 'Y') {
                     if (!function_exists('ssh2_execute')) {
                         include EASYWIDIR . '/stuff/methods/functions_ssh_exec.php';
                     }
                     if (isset($ssh2cmd)) {
                         ssh2_execute('eac', $reseller_id, $ssh2cmd);
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
function boucleTransport($texte, $args)
{
    // récupération des arguments
    $id = lireTag($args, "id", "int_list");
    $nom = lireTag($args, "nom", "string");
    $exclusion = lireTag($args, "exclusion", "string_list");
    $idpays = intval(lireTag($args, "pays", "int"));
    $cpostal = intval(lireTag($args, "cpostal", "string"));
    $montantmini = intval(lireTag($args, "montantmini", "float"));
    $search = "";
    $res = "";
    if ($id != "") {
        $search .= "and id in ({$id})";
    }
    if ($nom != "") {
        $search .= "and nom=\"{$nom}\"";
    }
    if ($exclusion != "") {
        $liste = "";
        $tabexcl = explode(",", $exclusion);
        for ($i = 0; $i < count($tabexcl); $i++) {
            $liste .= "'" . $tabexcl[$i] . "'" . ",";
        }
        $liste = rtrim($liste, ",");
        $search .= " and nom not in ({$liste})";
    }
    $modules = new Modules();
    $query = "select * from {$modules->table} where type='2' and actif='1' {$search} order by classement";
    $resul = CacheBase::getCache()->query($query);
    if (empty($resul)) {
        return "";
    }
    $pays = new Pays();
    if ($idpays > 0) {
        $pays->charger($idpays);
    } else {
        if ($_SESSION['navig']->adresse != "" && $_SESSION['navig']->adresse != 0) {
            $adr = new Adresse();
            $adr->charger($_SESSION['navig']->adresse);
            $pays->charger($adr->pays);
        } else {
            $pays->charger($_SESSION['navig']->client->pays);
        }
    }
    $transzone = new Transzone();
    $compt = 0;
    foreach ($resul as $row) {
        if (!$transzone->charger($row->id, $pays->zone)) {
            continue;
        }
        $compt++;
        $modules = new Modules();
        $modules->charger_id($row->id);
        try {
            $instance = ActionsModules::instance()->instancier($modules->nom);
            $port = round(port($row->id, $pays->id, $cpostal), 2);
            $titre = $instance->getTitre();
            $chapo = $instance->getChapo();
            $description = $instance->getDescription();
        } catch (Exception $ex) {
            $titre = $chapo = $description = '';
        }
        if ($port < $montantmini) {
            continue;
        }
        // Chercher le logo
        $exts = array('png', 'gif', 'jpeg', 'jpg');
        $logo = false;
        foreach ($exts as $ext) {
            $tmp = ActionsModules::instance()->lire_chemin_base() . "/{$row->nom}/logo.{$ext}";
            if (file_exists($tmp)) {
                $logo = ActionsModules::instance()->lire_url_base() . "/{$row->nom}/logo.{$ext}";
                break;
            }
        }
        $temp = str_replace("#NOM", $row->nom, $texte);
        $temp = str_replace("#TITRE", "{$titre}", $temp);
        $temp = str_replace("#CHAPO", "{$chapo}", $temp);
        $temp = str_replace("#DESCRIPTION", "{$description}", $temp);
        $temp = str_replace("#URLCMD", urlfond("commande", "action=transport&amp;id=" . $row->id, true), $temp);
        $temp = str_replace("#ID", "{$row->id}", $temp);
        $temp = str_replace("#LOGO", $logo, $temp);
        $temp = str_replace("#PORT", formatter_somme($port), $temp);
        $temp = str_replace("#COMPT", "{$compt}", $temp);
        $res .= $temp;
    }
    return $res;
}
Esempio n. 5
0
 public function request_password_reset($params)
 {
     $route = "/users/request_password_reset";
     $config = array('host' => $this->api->client->options['host'], 'path' => "" . $this->api->client->options['path'] . "/" . $this->api->client->options['api_version'] . $route, 'method' => 'POST', 'port' => $this->api->client . port(), 'headers' => $this->api->client->headers, 'body' => $params['data']);
     return $this->api->client->raw_request($config);
 }
Esempio n. 6
0
 if (isset($data['active']) and active_check($data['active'])) {
     $updateArray[] = $data['active'];
     $eventualUpdate .= ',`active`=?';
     $active = $data['active'];
 }
 if (isset($data['dns']) and isdomain($data['dns'])) {
     $updateArray[] = $data['dns'];
     $eventualUpdate .= ',`dns`=?';
     $dns = $data['dns'];
 }
 if (isset($data['ip']) and isip($data['ip'], 'ip4')) {
     $updateArray[] = $data['ip'];
     $eventualUpdate .= ',`ip`=?';
     $ip = $data['ip'];
 }
 if (isset($data['port']) and port($data['port'])) {
     $updateArray[] = $data['port'];
     $eventualUpdate .= ',`port`=?';
     $port = $data['port'];
 }
 if (isExternalID($data['server_external_id']) and $data['identify_server_by'] == 'server_local_id') {
     $updateArray[] = $data['server_external_id'];
     $eventualUpdate .= ',`externalID`=?';
 }
 if (count($updateArray) > 0 and !isset($success['false'])) {
     $eventualUpdate = trim($eventualUpdate, ',');
     $eventualUpdate .= ',';
     $updateArray[] = $localServerID;
     $query = $sql->prepare("UPDATE `voice_dns` SET {$eventualUpdate} `jobPending`='Y' WHERE `dnsID`=? LIMIT 1");
     $query->execute($updateArray);
     $query = $sql->prepare("UPDATE `jobs` SET `status`='2' WHERE `type`='ds' AND (`status` IS NULL OR `status`='1') AND `affectedID`=?");
Esempio n. 7
0
 if (isset($data['port2']) and port($data['port2']) and $data['port2'] != $row['port2'] and !in_array($data['port'], $usedPorts)) {
     $updateArray[] = $data['port2'];
     $eventualUpdate .= ',`port2`=?';
     $port2 = $data['port2'];
 }
 if (isset($data['port3']) and port($data['port3']) and $data['port3'] != $row['port3'] and !in_array($data['port'], $usedPorts)) {
     $updateArray[] = $data['port3'];
     $eventualUpdate .= ',`port3`=?';
     $port3 = $data['port3'];
 }
 if (isset($data['port4']) and port($data['port4']) and $data['port4'] != $row['port4'] and !in_array($data['port'], $usedPorts)) {
     $updateArray[] = $data['port4'];
     $eventualUpdate .= ',`port4`=?';
     $port4 = $data['port4'];
 }
 if (isset($data['port5']) and port($data['port5']) and $data['port5'] != $row['port5'] and !in_array($data['port'], $usedPorts)) {
     $updateArray[] = $data['port5'];
     $eventualUpdate .= ',`port5`=?';
     $port5 = $data['port5'];
 }
 if (isExternalID($data['server_external_id']) and $data['identify_server_by'] == 'server_local_id') {
     $updateArray[] = $data['server_external_id'];
     $eventualUpdate .= ',`externalID`=?';
 }
 if (count($updateArray) > 0) {
     $eventualUpdate = trim($eventualUpdate, ',');
     $eventualUpdate .= ',';
 }
 $updateArray[] = $localID;
 $updateArray[] = $resellerID;
 $query = $sql->prepare("UPDATE `gsswitch` SET {$eventualUpdate}`jobPending`='Y' WHERE `id`=? AND `resellerid`=? LIMIT 1");
Esempio n. 8
0
                 }
             }
         }
         $template_file = 'admin_voice_tsdns_import.tpl';
     } else {
         $template_file = 'admin_404.tpl';
     }
 } else {
     if ($ui->smallletters('action', 2, 'post') == 'ip') {
         $added = '';
         $prefix = $rSA['prefix2'];
         $dnsList = (array) $ui->domain('dns', 'post');
         foreach ($dnsList as $dns) {
             $lookUp = str_replace('.', '_', $dns);
             $ex = explode(':', $ui->ipport("{$lookUp}-address", 'post'));
             if ($ui->active("{$lookUp}-import", 'post') == 'Y' and isset($ex[1]) and port($ex[1])) {
                 $ip = $ex[0];
                 $port = $ex[1];
                 $customer = $ui->id("{$lookUp}-customer", 19, 'post');
                 if ($customer == 0 or $customer == false or $customer == null) {
                     $usernew = true;
                     if ($ui->username("{$lookUp}-username", 50, 'post') and $ui->ismail("{$lookUp}-email", 'post')) {
                         $query = $sql->prepare("SELECT `id` FROM `userdata` WHERE `cname`=? AND `mail`=? AND `resellerid`=? LIMIT 1");
                         $query->execute(array($ui->username("{$lookUp}-username", 50, 'post'), $ui->ismail("{$lookUp}-email", 'post'), $reseller_id));
                         while ($row = $query->fetch(PDO::FETCH_ASSOC)) {
                             $usernew = false;
                             $customer = $row['id'];
                             $cnamenew = $ui->username("{$lookUp}-username", 50, 'post');
                         }
                         if ($usernew == true) {
                             $newHash = passwordCreate($ui->username("{$lookUp}-username", 50, 'post'), passwordgenerate(10));
Esempio n. 9
0
 $addresses = array();
 $words = array();
 $ids = array();
 $adIDs = array();
 $gsIDs = array();
 $imIDs = array();
 $roIDs = array();
 $usIDs = array();
 $voIDs = array();
 $vsIDs = array();
 foreach (preg_split("/\\s/", $ui->get['q'], -1, PREG_SPLIT_NO_EMPTY) as $s) {
     switch ($s) {
         case isid($s, 19):
             $ids[] = $s;
             $q[] = $s;
             if (port($s)) {
                 $ports[] = $s;
             }
             break;
         case isip($s, 'all'):
             $ips[] = $s;
             $q[] = $s;
             break;
         case ipport($s):
             $addresses[] = $s;
             list($ips[], $ports[]) = explode(':', preg_replace('/\\s+/', '', $s));
             $q[] = $s;
             break;
         default:
             $words[] = strtolower($s);
             $q[] = $s;
Esempio n. 10
0
function paiement($type_paiement)
{
    if (!$_SESSION['navig']->client->id || $_SESSION['navig']->panier->nbart < 1) {
        redirige(urlfond());
    }
    $total = 0;
    $nbart = 0;
    $poids = 0;
    $unitetr = 0;
    ActionsModules::instance()->appel_module("avantcommande");
    $modules = new Modules();
    $modules->charger_id($type_paiement);
    if (!$modules->actif) {
        return 0;
    }
    try {
        $modpaiement = ActionsModules::instance()->instancier($modules->nom);
        $commande = new Commande();
        $commande->transport = $_SESSION['navig']->commande->transport;
        $commande->client = $_SESSION['navig']->client->id;
        $commande->remise = 0;
        $devise = ActionsDevises::instance()->get_devise_courante();
        $commande->devise = $devise->id;
        $commande->taux = $devise->taux;
        $client = new Client();
        $client->charger_id($_SESSION['navig']->client->id);
        $adr = new Venteadr();
        $adr->raison = $client->raison;
        $adr->entreprise = $client->entreprise;
        $adr->nom = $client->nom;
        $adr->prenom = $client->prenom;
        $adr->adresse1 = $client->adresse1;
        $adr->adresse2 = $client->adresse2;
        $adr->adresse3 = $client->adresse3;
        $adr->cpostal = $client->cpostal;
        $adr->ville = $client->ville;
        $adr->tel = $client->telfixe . "  " . $client->telport;
        $adr->pays = $client->pays;
        $adrcli = $adr->add();
        $commande->adrfact = $adrcli;
        $adr = new Venteadr();
        $livraison = new Adresse();
        if ($livraison->charger($_SESSION['navig']->adresse)) {
            $adr->raison = $livraison->raison;
            $adr->entreprise = $livraison->entreprise;
            $adr->nom = $livraison->nom;
            $adr->prenom = $livraison->prenom;
            $adr->adresse1 = $livraison->adresse1;
            $adr->adresse2 = $livraison->adresse2;
            $adr->adresse3 = $livraison->adresse3;
            $adr->cpostal = $livraison->cpostal;
            $adr->ville = $livraison->ville;
            $adr->tel = $livraison->tel;
            $adr->pays = $livraison->pays;
        } else {
            $adr->raison = $client->raison;
            $adr->entreprise = $client->entreprise;
            $adr->nom = $client->nom;
            $adr->prenom = $client->prenom;
            $adr->adresse1 = $client->adresse1;
            $adr->adresse2 = $client->adresse2;
            $adr->adresse3 = $client->adresse3;
            $adr->cpostal = $client->cpostal;
            $adr->ville = $client->ville;
            $adr->tel = $client->telfixe . "  " . $client->telport;
            $adr->pays = $client->pays;
        }
        $adrlivr = $adr->add();
        $commande->adrlivr = $adrlivr;
        $commande->facture = 0;
        $commande->statut = Commande::NONPAYE;
        $commande->paiement = $type_paiement;
        $commande->lang = ActionsLang::instance()->get_id_langue_courante();
        $commande->id = $commande->add();
        $pays = new Pays();
        $pays->charger($adr->pays);
        $correspondanceParent = array(null);
        foreach ($_SESSION['navig']->panier->tabarticle as $pos => &$article) {
            $venteprod = new Venteprod();
            $dectexte = "\n";
            $produit = new Produit();
            $stock = new Stock();
            foreach ($article->perso as $perso) {
                $declinaison = new Declinaison();
                $declinaisondesc = new Declinaisondesc();
                if (is_numeric($perso->valeur) && $modpaiement->defalqcmd) {
                    // diminution des stocks de déclinaison si on est sur un module de paiement qui défalque de suite
                    $stock->charger($perso->valeur, $article->produit->id);
                    $stock->valeur -= $article->quantite;
                    $stock->maj();
                }
                $declinaison->charger($perso->declinaison);
                $declinaisondesc->charger($declinaison->id);
                // recup valeur declidisp ou string
                if ($declinaison->isDeclidisp($perso->declinaison)) {
                    $declidisp = new Declidisp();
                    $declidispdesc = new Declidispdesc();
                    $declidisp->charger($perso->valeur);
                    $declidispdesc->charger_declidisp($declidisp->id);
                    $dectexte .= "- " . $declinaisondesc->titre . " : " . $declidispdesc->titre . "\n";
                } else {
                    $dectexte .= "- " . $declinaisondesc->titre . " : " . $perso->valeur . "\n";
                }
            }
            // diminution des stocks classiques si on est sur un module de paiement qui défalque de suite
            $produit = new Produit($article->produit->ref);
            if ($modpaiement->defalqcmd) {
                $produit->stock -= $article->quantite;
                $produit->maj();
            }
            /* Gestion TVA */
            $prix = $article->produit->prix;
            $prix2 = $article->produit->prix2;
            $tva = $article->produit->tva;
            if ($pays->tva != "" && (!$pays->tva || $pays->tva && $_SESSION['navig']->client->intracom != "" && !$pays->boutique)) {
                $prix = round($prix / (1 + $tva / 100), 2);
                $prix2 = round($prix2 / (1 + $tva / 100), 2);
                $tva = 0;
            }
            $venteprod->quantite = $article->quantite;
            if (!$article->produit->promo) {
                $venteprod->prixu = $prix;
            } else {
                $venteprod->prixu = $prix2;
            }
            $venteprod->ref = $article->produit->ref;
            $venteprod->titre = $article->produitdesc->titre . " " . $dectexte;
            $venteprod->chapo = $article->produitdesc->chapo;
            $venteprod->description = $article->produitdesc->description;
            $venteprod->tva = $tva;
            $venteprod->commande = $commande->id;
            $venteprod->id = $venteprod->add();
            $correspondanceParent[] = $venteprod->id;
            // ajout dans ventedeclisp des declidisp associées au venteprod
            foreach ($article->perso as $perso) {
                $declinaison = new Declinaison();
                $declinaison->charger($perso->declinaison);
                // si declidisp (pas un champs libre)
                if ($declinaison->isDeclidisp($perso->declinaison)) {
                    $vdec = new Ventedeclidisp();
                    $vdec->venteprod = $venteprod->id;
                    $vdec->declidisp = $perso->valeur;
                    $vdec->add();
                }
            }
            ActionsModules::instance()->appel_module("apresVenteprod", $venteprod, $pos);
            $total += $venteprod->prixu * $venteprod->quantite;
            $nbart++;
            $poids += $article->produit->poids;
        }
        foreach ($correspondanceParent as $id_panier => $id_venteprod) {
            if ($_SESSION['navig']->panier->tabarticle[$id_panier]->parent >= 0) {
                $venteprod->charger($id_venteprod);
                $venteprod->parent = $correspondanceParent[$_SESSION['navig']->panier->tabarticle[$id_panier]->parent];
                $venteprod->maj();
            }
        }
        $pays = new Pays($_SESSION['navig']->client->pays);
        if ($_SESSION['navig']->client->pourcentage > 0) {
            $commande->remise = $total * $_SESSION['navig']->client->pourcentage / 100;
        }
        $total -= $commande->remise;
        if ($_SESSION['navig']->promo->id != "") {
            $commande->remise += calc_remise($total);
            $_SESSION['navig']->promo->utilise = 1;
            if (!empty($commande->remise)) {
                $commande->remise = round($commande->remise, 2);
            }
            $commande->maj();
            $temppromo = new Promo();
            $temppromo->charger_id($_SESSION['navig']->promo->id);
            $temppromo->utilise++;
            $temppromo->maj();
            $promoutil = new Promoutil();
            $promoutil->commande = $commande->id;
            $promoutil->promo = $temppromo->id;
            $promoutil->code = $temppromo->code;
            $promoutil->type = $temppromo->type;
            $promoutil->valeur = $temppromo->valeur;
            $promoutil->add();
        }
        if ($commande->remise > $total) {
            $commande->remise = $total;
        }
        $commande->port = port();
        if (intval($commande->port) <= 0) {
            $commande->port = 0;
        }
        $_SESSION['navig']->promo = new Promo();
        $_SESSION['navig']->commande = $commande;
        $commande->transaction = genid($commande->id, 6);
        $commande->maj();
        $total = $_SESSION['navig']->panier->total(1, $_SESSION['navig']->commande->remise) + $_SESSION['navig']->commande->port;
        if ($total < $_SESSION['navig']->commande->port) {
            $total = $_SESSION['navig']->commande->port;
        }
        $_SESSION['navig']->commande->total = $total;
        ActionsModules::instance()->appel_module("aprescommande", $commande);
        // Appeler la méthode mail du plugin de paiement...
        $modpaiement->mail($commande);
        // ... et la méthode paiement
        $modpaiement->paiement($commande);
    } catch (Exception $e) {
        // FIXME: Echec de commande -> cas à traiter ?
    }
}
Esempio n. 11
0
function substitpanier($texte)
{
    $total = 0;
    $totalht = 0;
    $totaleco = 0;
    $totaltaxe = 0;
    $allItemCount = $nb_article = 0;
    if ($_SESSION['navig']->adresse) {
        $adr = new Adresse();
        $adr->charger($_SESSION['navig']->adresse);
        $idpays = $adr->pays;
    } else {
        $idpays = $_SESSION['navig']->client->pays;
    }
    $pays = new Pays();
    $pays->charger($idpays);
    $total = $_SESSION['navig']->panier->total();
    $totalht = $_SESSION['navig']->panier->total(0);
    $totaleco = $_SESSION['navig']->panier->totalecotaxe();
    $tva = $total - $totalht;
    $nb_article = $_SESSION['navig']->panier->nbart;
    foreach ($_SESSION['navig']->panier->tabarticle as $anItem) {
        $allItemCount += $anItem->quantite;
    }
    unset($anItem);
    $port = port();
    if ($port < 0) {
        $port = 0;
    }
    $totcmdport = $total + $port;
    $remise = $remise_client = $remise_promo = 0;
    if ($_SESSION['navig']->client->pourcentage > 0) {
        $remise_client = $total * $_SESSION['navig']->client->pourcentage / 100;
    }
    $remise_promo += calc_remise($total);
    $remise = $remise_promo + $remise_client;
    $totcmdport -= $remise;
    $totremise = $total - $remise;
    if ($totcmdport < $port) {
        $totcmdport = $port;
    }
    $totcmdportht = $totalht + $port;
    $totalht = formatter_somme($totalht);
    $total = formatter_somme($total);
    $totaleco = formatter_somme($totaleco);
    $totaltaxe = formatter_somme($totaltaxe);
    $port = formatter_somme($port);
    $totcmdport = formatter_somme($totcmdport);
    $remise = formatter_somme($remise);
    $totremise = formatter_somme($totremise);
    $totcmdportht = formatter_somme($totcmdportht);
    $tva = formatter_somme($tva, 2, ".", "");
    $remise_client = formatter_somme($remise_client);
    $remise_promo = formatter_somme($remise_promo);
    $totpoids = $_SESSION['navig']->panier->poids();
    $texte = str_replace("#PANIER_TOTALHT", "{$totalht}", $texte);
    $texte = str_replace("#PANIER_TOTALECO", "{$totaleco}", $texte);
    $texte = str_replace("#PANIER_TOTALTVA", "{$tva}", $texte);
    // total TVA du panier = #PANIER_TVA
    $texte = str_replace("#PANIER_TOTAL", "{$total}", $texte);
    $texte = str_replace("#PANIER_PORT", "{$port}", $texte);
    $texte = str_replace("#PANIER_TOTPORTHT", "{$totcmdportht}", $texte);
    $texte = str_replace("#PANIER_TOTPORT", "{$totcmdport}", $texte);
    $texte = str_replace("#PANIER_TOTREMISE", "{$totremise}", $texte);
    $texte = str_replace("#PANIER_REMISE_CLIENT", "{$remise_client}", $texte);
    $texte = str_replace("#PANIER_REMISE_PROMO", "{$remise_promo}", $texte);
    $texte = str_replace("#PANIER_REMISE", "{$remise}", $texte);
    $texte = str_replace("#PANIER_NBART_TOTAL", $allItemCount, $texte);
    $texte = str_replace("#PANIER_NBART", "" . $nb_article . "", $texte);
    $texte = str_replace("#PANIER_POIDS", "{$totpoids}", $texte);
    $texte = str_replace("#PANIER_TVA", "{$tva}", $texte);
    // total TVA du panier
    return $texte;
}
Esempio n. 12
0
<?php
/*! Created By: Hangs Breaker */
function ping($host){
	if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
		exec(sprintf('ping -w 1 -n 1 %s', escapeshellarg($host)), $res, $rval); // if using windows
	}else{
		exec(sprintf('ping -c 1 -W 1 %s', escapeshellarg($host)), $res, $rval); // if using linux
	}
   return $rval === 0;
}

function port($host,$port=80,$timeout=3){
	$fsock = @fsockopen($host, $port, $errno, $errstr, $timeout);
	if (!$fsock){
		return FALSE;
	}else{
		return TRUE;
	}
}

/* check if the host is up
   $host can also be an ip address */
	$i = $_POST['i'];
	$host = $_POST['host'].$i;
	$up = ping($host);
	if($up){$port = port($host);}else{$port = '';}
	echo $i.'|'.$host.'|'.($up ? 'on' : 'off').'|'.($port?'Port 80':'&nbsp;');
?>
Esempio n. 13
0
    case "stop-gdb":
        #echo embeddedprog_stopgdb($vendor,$processor,$voltage,$speed);
        echo gdb_stop($processor, $speed, $voltage);
        break;
    case "read-flash":
        #echo embeddedprog_read($vendor,$processor,$voltage,$speed,$save);
        echo read_flash($processor, $speed, $save, $voltage);
        break;
    case "del-conf":
        #echo embeddedprog_delete($vendor,$processor,$voltage,$speed,$i);
        echo del($i, $voltage);
        break;
    case "programm":
        #echo embeddedprog_programm($vendor,$processor,$voltage,$speed,$i);
        echo load($i, $voltage);
        break;
    case "save-conf":
        #echo embeddedprog_save($vendor,$processor,$voltage,$speed,$save);
        echo save($processor, $speed, $save, $voltage, $eeprom, $i);
        break;
    case "upload":
        #echo exec_upload($vendor,$processor,$voltage,$speed,$i);
        echo upload($processor, $speed, $i, $voltage, $eeprom, $SWD);
        break;
    case "port":
        #echo embeddedprog_read($vendor,$processor,$voltage,$speed,$save);
        echo port($processor, $save, $i, $voltage);
        break;
    default:
        echo "unkown command";
}