if (file_exists("../client.orig")) { rename_securise("../client.orig", "../client", 'dossier'); } if (file_exists("../template.orig")) { rename_securise("../template.orig", "../template", 'dossier'); } // Mettre en place le Cnx.class.php définitif, en effaçant le précédent. $cnxfile = "../classes/Cnx.class.php"; if (file_exists("{$cnxfile}.orig")) { @unlink($cnxfile); rename_securise("{$cnxfile}.orig", "{$cnxfile}", 'fichier'); } } require_once "../fonctions/divers.php"; require_once "../classes/Variable.class.php"; $params = array('utilisateur' => 'admin', 'nomadmin' => "admin_" . genpass(10), 'emailcontact' => Variable::lire('emailcontact'), 'nomsite' => Variable::lire('nomsite'), 'urlsite' => "http://" . $_SERVER['SERVER_NAME']); foreach ($params as $var => $defaut) { ${$var} = isset($_REQUEST[$var]) ? $_REQUEST[$var] : $defaut; } $_SESSION['etape'] = 4; include __DIR__ . "/entete.php"; ?> <div id="chapeau"style="overflow:hidden;zoom: 1"> <h2>Configuration</h2> <form action="modules.php" method="post"> <br /> Passons à la configuration de Thelia <br /><br />
$admin = new Administrateur(); $admin->charger_id(1); $admin->identifiant = $_POST['utilisateur']; $admin->motdepasse = $_POST['motdepasse1']; $admin->profil = 1; $admin->crypter(); $admin->maj(); Variable::ecrire("emailcontact", $_POST['emailcontact']); Variable::ecrire("emailfrom", $_POST['emailcontact']); Variable::ecrire("emailscommande", $_POST['emailcontact']); Variable::ecrire("nomsite", $_POST['nomsite']); Variable::ecrire("urlsite", $_POST['urlsite']); $lang = new Lang(); $query_cnx = "update {$lang->table} set url=\"" . rtrim($_POST['urlsite'], "/") . "\" where id=1"; $resul_cnx = $lang->query($query_cnx); Variable::ecrire("rsspass", genpass(40)); } $_SESSION['etape'] = 5; include_once __DIR__ . "/entete.php"; $parser = xml_parser_create('UTF-8'); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1); $xml = file_get_contents('http://thelia.net/spip.php?page=xml_modules_promus&var_mode=calcul'); $values = array(); $index = array(); xml_parse_into_struct($parser, $xml, $values); $listeModules = false; $infosModule = false; $listeModulesPromus = array(); foreach ($values as $key => $node) { if ($node['tag'] == 'modules' && $node['type'] == 'open' && $node['level'] == 1) {
public function testAuthorizeIdentity() { $a = array('RequestMethod' => 'AuthorizeIdentity', 'Identifier' => 'Foo Identifier', 'Credential' => genpass("Foo Password")); $r = new HttpRequest($this->server_url, HttpRequest::METH_POST); $r->addPostFields($a); $r->send(); $this->assertEquals(200, $r->getResponseCode()); }
$s = "abcdefghijklmnopqrstuvwxyz"; $str = ""; for ($i = 0; $i < 8; $i++) { $str .= $s[rand(0, 25)]; } return $str; } $stmt = $db->prepare("SELECT Asso, Extension FROM gesmail WHERE Type LIKE 'ml' AND MLPassword IS NULL"); $stmt->bind_result($asso, $extension); $stmt->execute(); $stmt->store_result(); while ($stmt->fetch()) { $output = ''; $box = escapeshellarg("{$asso}-{$extension}"); $owner = escapeshellarg("{$asso}@assos.utc.fr"); $pass = genpass(); exec("/usr/lib/mailman/bin/newlist -q {$box} {$owner} {$pass}", $output, $return); if ($return == 0) { $dossier = escapeshellarg("/var/lib/mailman/lists/{$asso}-{$extension}"); exec("ln -s ../extend.py {$dossier}", $output2, $return2); if ($return2 == 0) { $uppass = $db->prepare("UPDATE gesmail SET MLPassword = ? WHERE Asso LIKE ? AND Extension LIKE ?"); $uppass->bind_param("sss", $pass, $asso, $extension); $uppass->execute(); $uppass->close(); $message = "Bonjour,\nVotre liste {$asso}-{$extension}@assos.utc.fr vient d'être créée. Rendez-vous sur Gesmail [34m| l'adresse http://assos.utc.fr/gesmail pour la remplir !\n\nCordialement,\nL'équipe du SiMDE"; mail("{$asso}@assos.utc.fr", "[Gesmail] Création de votre liste", $message, "From: simde@assos.utc.fr"); } } $warn = ""; if (!empty($return)) {
$client->intracom = strip_tags($intracom); $client->pays = strip_tags($pays); $client->pourcentage = strip_tags($pourcentage); if ($type == "on") { $client->type = 1; } else { $client->type = 0; } $client->lang = ActionsLang::instance()->get_id_langue_courante(); $parrain = new Client(); if ($parrain->charger_ref($id_parrain)) { $client->parrain = $parrain->id; } else { $parrain = 0; } $client->motdepasse = genpass(8); $pass = $client->motdepasse; if ($client->raison != "" && $client->prenom != "" && $client->nom != "" && $client->email != "" && $client->motdepasse != "" && $client->email && !$client->existe($email1) && $client->adresse1 != "" && $client->cpostal != "" && $client->ville != "" && $client->pays != "") { $client->crypter(); $client->add(); $raisondesc = new Raisondesc($client->raison, ActionsLang::instance()->get_id_langue_courante()); $paysdesc = new Paysdesc(); $paysdesc->charger($client->pays); $rec = $client->charger_mail($client->email); $message = new Message(); $message->charger("creation_client"); $messagedesc = new Messagedesc(); $messagedesc->charger($message->id); $nomsite = new Variable("nomsite"); $urlsite = new Variable("urlsite"); $emailcontact = new Variable("emailcontact");
public function createOrder($facturation_raison, $facturation_entreprise, $facturation_nom, $facturation_prenom, $facturation_adresse1, $facturation_adresse2, $facturation_adresse3, $facturation_cpostal, $facturation_ville, $facturation_tel, $facturation_pays, $livraison_raison, $livraison_entreprise, $livraison_nom, $livraison_prenom, $livraison_adresse1, $livraison_adresse2, $livraison_adresse3, $livraison_cpostal, $livraison_ville, $livraison_tel, $livraison_pays, $type_paiement, $type_transport, $fraisport, $remise, $client_selected, $ref_client, $email, \Panier $panier, $applyClientDiscount, $callMail, $callPayment) { $client = new Client(); if ($client_selected == 1) { $clientOK = $client->charger_ref($ref_client); } else { if ($email != '' && $client->charger_mail($email)) { $existeDeja = 1; } elseif ($email != '' && !filter_var($email, FILTER_VALIDATE_EMAIL)) { $badFormat = 1; } else { $client->email = $email; $client->raison = $facturation_raison; $client->entreprise = $facturation_entreprise; $client->prenom = $facturation_prenom; $client->nom = $facturation_nom; $client->adresse1 = $facturation_adresse1; $client->adresse2 = $facturation_adresse2; $client->adresse3 = $facturation_adresse3; $client->cpostal = $facturation_cpostal; $client->ville = $facturation_ville; $client->tel = $facturation_tel; $client->pays = $facturation_pays; $pass = genpass(8); $client->motdepasse = $pass; } } $facturationAddress = new Venteadr(); $facturationAddress->raison = $facturation_raison; $facturationAddress->entreprise = $facturation_entreprise; $facturationAddress->prenom = $facturation_prenom; $facturationAddress->nom = $facturation_nom; $facturationAddress->adresse1 = $facturation_adresse1; $facturationAddress->adresse2 = $facturation_adresse2; $facturationAddress->adresse3 = $facturation_adresse3; $facturationAddress->cpostal = $facturation_cpostal; $facturationAddress->ville = $facturation_ville; $facturationAddress->tel = $facturation_tel; $facturationAddress->pays = $facturation_pays; $livraisonAddress = new Venteadr(); $livraisonAddress->raison = $livraison_raison; $livraisonAddress->entreprise = $livraison_entreprise; $livraisonAddress->prenom = $livraison_prenom; $livraisonAddress->nom = $livraison_nom; $livraisonAddress->adresse1 = $livraison_adresse1; $livraisonAddress->adresse2 = $livraison_adresse2; $livraisonAddress->adresse3 = $livraison_adresse3; $livraisonAddress->cpostal = $livraison_cpostal; $livraisonAddress->ville = $livraison_ville; $livraisonAddress->tel = $livraison_tel; $livraisonAddress->pays = $livraison_pays; $order = new Commande(); $order->date = date("Y-m-d H:i:s"); $order->livraison = "L" . date("ymdHis") . strtoupper(ereg_caracspec(substr($client->prenom, 0, 3))); $order->transport = $type_transport; $order->paiement = $type_paiement; $order->statut = Commande::NONPAYE; $order->transaction = genid($order->id, 6); $module_paiement = new Modules(); $module_paiement->charger_id($type_paiement); if ($facturationAddress->raison != "" && $facturationAddress->prenom != "" && $facturationAddress->nom != "" && $facturationAddress->adresse1 != "" && $facturationAddress->cpostal != "" && $facturationAddress->ville != "" && $facturationAddress->pays != "" && $livraisonAddress->raison != "" && $livraisonAddress->prenom != "" && $livraisonAddress->nom != "" && $livraisonAddress->adresse1 != "" && $livraisonAddress->cpostal != "" && $livraisonAddress->ville != "" && $livraisonAddress->pays != "" && $order->transport != "" && is_numeric($fraisport) && $fraisport >= 0 && is_numeric($remise) && $remise >= 0 && $module_paiement->actif && $order->paiement != "" && $panier->nbart > 0 && ($clientOK || $client_selected != 1 && !$existeDeja && !$badFormat) && $email != '') { $facturationAddress->id = $facturationAddress->add(); $livraisonAddress->id = $livraisonAddress->add(); if (!$client->id) { $client->crypter(); $client->id = $client->add(); $client->ref = date("ymdHi") . genid($client->id, 6); $client->maj(); ClientAdmin::getInstance()->sendMailCreation($client, $pass); } $devise = ActionsDevises::instance()->get_devise_courante(); $order->adrfact = $facturationAddress->id; $order->adrlivr = $livraisonAddress->id; $order->client = $client->id; $order->devise = $devise->id; $order->taux = $devise->taux; $order->lang = ActionsLang::instance()->get_id_langue_courante(); $order->id = $order->add(); $order->ref = "C" . date("ymdHi") . genid($order->id, 6); $order->maj(); $total = 0; foreach ($panier->tabarticle as $pos => $article) { $venteprod = new Venteprod(); $dectexte = "\n"; $stock = new Stock(); foreach ($article->perso as $perso) { $declinaison = new Declinaison(); $declinaisondesc = new Declinaisondesc(); if (is_numeric($perso->valeur) && ActionsModules::instance()->instancier($module_paiement->nom)->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 (ActionsModules::instance()->instancier($module_paiement->nom)->defalqcmd) { $produit->stock -= $article->quantite; $produit->maj(); } $venteprod->quantite = $article->quantite; $venteprod->prixu = $article->produit->prix; $venteprod->ref = $article->produit->ref; $venteprod->titre = $article->produitdesc->titre . " " . $dectexte; $venteprod->chapo = $article->produitdesc->chapo; $venteprod->description = $article->produitdesc->description; $venteprod->tva = $article->produit->tva; $venteprod->commande = $order->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("apresVenteprodAdmin", $venteprod, $pos); $total += $venteprod->prixu * $venteprod->quantite; } foreach ($correspondanceParent as $id_panier => $id_venteprod) { if ($panier->tabarticle[$id_panier]->parent >= 0) { $venteprod->charger($id_venteprod); $venteprod->parent = $correspondanceParent[$panier->tabarticle[$id_panier]->parent]; $venteprod->maj(); } } if ($client->pourcentage > 0 && $applyClientDiscount) { $order->remise = $total * $client->pourcentage / 100; } $order->remise += $remise; if ($order->remise > $total) { $order->remise = $total; } $order->port = $fraisport; $order->maj(); ActionsModules::instance()->appel_module("aprescommandeadmin", $order); if ($callMail) { ActionsModules::instance()->instancier($module_paiement->nom)->mail($order); } if ($callPayment) { ActionsModules::instance()->instancier($module_paiement->nom)->paiement($order); } else { self::getInstance($order->id)->redirect(); } } else { if ($existeDeja) { throw new TheliaAdminException("error creating order", TheliaAdminException::EMAIL_ALREADY_EXISTS); } if ($badFormat) { throw new TheliaAdminException("error creating order", TheliaAdminException::EMAIL_FORMAT_ERROR); } else { throw new TheliaAdminException("error creating order", TheliaAdminException::ORDER_ADD_ERROR); } } }
function event_login_signup() { if (!$this->component) { return false; } global $username, $email, $lastname, $webpage, $icq, $mail_news, $mail_works, $mail_comments, $g_usr, $g_ini, $HTTP_SERVER_VARS; if (empty($username) || empty($email)) { $this->error = 'praðom uþpildyti abu privalomus laukus<br>'; empty($username) && ($username = ''); empty($email) && ($email = ''); } if (strlen($username) != strlen(clean_username($username))) { $this->error .= 'vartotojo varde galimi tik ðie þenklai: 0-9a-zA-Z_<br>'; $username = clean_username($username); } if ($g_usr->exists_username($username)) { $this->error .= 'toks vartotojas jau yra<br>'; } if (!empty($email) && $g_usr->exists_email($email)) { $this->error .= 'toks e-mailas jau yra<br>'; } if (!valid_email($email)) { $this->error .= 'nekorektiðkas e-mailas<br>'; } /* if ('217.147.34.6' == $HTTP_SERVER_VARS['REMOTE_ADDR']) { $this->error .= 'didelës problemos, brûkðtelk laiðkà <a href="mailto:art@scene.lt">art@scene.lt</a><br>'; } */ if ($this->error) { return false; } // get hostname if (!empty($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'])) { $proxy = @gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR']); $host = @gethostbyaddr($HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR']); $host = "{$host} [proxy: {$proxy}]"; } else { $host = @gethostbyaddr($HTTP_SERVER_VARS['REMOTE_ADDR']); } $password = genpass(); // everything ok, create user $mas['username'] = $username; $mas['email'] = $email; $mas['password'] = md5($password); $mas['group_id'] = $g_ini->read_var('users', 'default_group'); $mas['active'] = 1; $mas['lastlogin'] = date('Y.m.d H.i'); $mas['lasthost'] = "[new] {$host}"; $this->db->insert_query($mas, $this->table); isset($lastname) || ($lastname = ''); isset($webpage) || ($webpage = ''); isset($icq) || ($icq = ''); isset($mail_news) || ($mail_news = '0'); isset($mail_comments) || ($mail_comments = '0'); isset($mail_works) || ($mail_works = '0'); if ('http://' == $webpage) { $webpage = ''; } $mas = array(); $mas['uid'] = $this->db->get_insert_id(); $mas['lastname'] = $lastname; $mas['url'] = $webpage; $mas['icq'] = $icq; $mas['mail_news'] = $mail_news; $mas['mail_comments'] = $mail_comments; $mas['mail_works'] = $mail_works; $mas['reg_date'] = date('Y.m.d H.i'); $this->db->insert_query($mas, 'u_user_info'); setcookie("cookie_user_name", $username, time() + 3600 * 24 * 30); $this->result = $password; return true; }
function chmdp($email, $urlok = "", $urlerr = "") { $tclient = new Client(); if ($tclient->charger_mail($email)) { $msg = new Message(); $msgdesc = new Messagedesc(); $pass = genpass(8); $tclient->motdepasse = $pass; $tclient->crypter(); $tclient->maj(); $msg->charger("changepass"); $msgdesc->charger($msg->id); $sujet = $msgdesc->titre; $corps = $msgdesc->description; $corpstext = $msgdesc->descriptiontext; $nomsite = Variable::lire("nomsite"); $corps = str_replace("__NOMSITE__", $nomsite, $corps); $corps = str_replace("__MOTDEPASSE__", $pass, $corps); $corps = str_replace("__URLSITE__", urlfond(), $corps); $corps = str_replace("__NOM__", $tclient->nom, $corps); $corps = str_replace("__PRENOM__", $tclient->prenom, $corps); $corps = str_replace("__EMAIL__", $tclient->email, $corps); $corpstext = str_replace("__NOMSITE__", $nomsite, $corpstext); $corpstext = str_replace("__MOTDEPASSE__", $pass, $corpstext); $corpstext = str_replace("__URLSITE__", urlfond(), $corpstext); $corpstext = str_replace("__NOM__", $tclient->nom, $corpstext); $corpstext = str_replace("__PRENOM__", $tclient->prenom, $corpstext); $corpstext = str_replace("__EMAIL__", $tclient->email, $corpstext); $emailfrom = Variable::lire("emailfrom"); Mail::envoyer($tclient->prenom . " " . $tclient->nom, $tclient->email, $nomsite, $emailfrom, $sujet, $corps, $corpstext); redirige_action($urlok, ''); } else { redirige_action($urlerr, urlfond("mdperreur")); } }
} $clientToAdd->adresse1 = strip_tags($adresse1); $clientToAdd->adresse2 = strip_tags($adresse2); $clientToAdd->adresse3 = strip_tags($adresse3); $clientToAdd->cpostal = strip_tags($cpostal); $clientToAdd->ville = strip_tags($ville); $clientToAdd->siret = strip_tags($siret); $clientToAdd->intracom = strip_tags($intracom); $clientToAdd->pays = strip_tags($pays); $clientToAdd->type = $type == 'on' ? 1 : 0; $clientToAdd->lang = ActionsLang::instance()->get_id_langue_courante(); $clientMentor = new Client(); if ($clientMentor->charger_mail($parrain)) { $clientToAdd->parrain = $clientMentor->id; } $pass = genpass(8); $clientToAdd->motdepasse = $pass; if ($clientToAdd->raison != "" && $clientToAdd->prenom != "" && $clientToAdd->nom != "" && $clientToAdd->email != "" && $clientToAdd->motdepasse != "" && $clientToAdd->email && !$clientToAdd->existe($email) && $clientToAdd->adresse1 != "" && $clientToAdd->cpostal != "" && $clientToAdd->ville != "" && $clientToAdd->pays != "" && $clientMentor->email == $parrain) { $clientToAdd->crypter(); $clientToAdd->id = $clientToAdd->add(); $clientToAdd->ref = date("ymdHi") . genid($clientToAdd->id, 6); $clientToAdd->maj(); ClientAdmin::getInstance()->sendMailCreation($clientToAdd, $pass); ActionsModules::instance()->appel_module("ajoutclient", $clientToAdd); redirige('client_visualiser.php?ref=' . $clientToAdd->ref); } else { $adderror = 1; } break; } }