link); } function Messagecmd(){ $this->PluginsClassiques("Messagecmd"); } function charger($commande){ return $this->getVars("select * from $this->table where commande=\"$commande\""); } function action(){ global $res; if($_REQUEST['texte_messagecmd'] != ""){ $_SESSION['texte_messagecmd_client_id'] = $_SESSION['navig']->client->id; // XXX pour autoriser partage d'un même ordi par plusieurs clients ~ yoann@VLT, 20111012_1613 $_SESSION['texte_messagecmd'] = $_REQUEST['texte_messagecmd']; $_SESSION['texte_destinatairecmd'] = $_REQUEST['texte_destinatairecmd']; $_SESSION['texte_expediteurcmd'] = $_REQUEST['texte_expediteurcmd']; } // XXX pour autoriser partage d'un même ordi par plusieurs clients ~ yoann@VLT, 20111012_1613 if ( $_SESSION['texte_messagecmd_client_id'] == $_SESSION['navig']->client->id ) { if (get_magic_quotes_gpc()) { // XXX support magic quotes ... ~ yoann@VLT, 20111012_1617 $res = str_replace("#MESSAGECMD", stripcslashes( $_SESSION['texte_messagecmd']), $res); $res = str_replace("#DESTINATAIRECMD", stripcslashes($_SESSION['texte_destinatairecmd']), $res); $res = str_replace("#EXPEDITEURCMD", stripcslashes($_SESSION['texte_expediteurcmd']), $res); } else { $res = str_replace("#MESSAGECMD", $_SESSION['texte_messagecmd'], $res); $res = str_replace("#DESTINATAIRECMD", $_SESSION['texte_destinatairecmd'], $res); $res = str_replace("#EXPEDITEURCMD", $_SESSION['texte_expediteurcmd'], $res); } } else { $res = str_replace("#MESSAGECMD", "", $res); $res = str_replace("#DESTINATAIRECMD", "", $res); $res = str_replace("#EXPEDITEURCMD", "", $res); } } function aprescommande($commande){ // XXX test id client pour autoriser partage d'un même ordi par plusieurs clients ~ yoann@VLT, 20111012_1631 if($_SESSION['texte_messagecmd'] && ($_SESSION['texte_messagecmd_client_id'] == $_SESSION['navig']->client->id) ){ $msg = new Messagecmd(); $msg->commande = $commande->id; $msg->message = $_SESSION['texte_messagecmd']; $msg->destinataire = $_SESSION['texte_destinatairecmd']; $msg->expediteur = $_SESSION['texte_expediteurcmd']; $msg->add(); // XXX vider les variables de session ~ yoann@VLT, 20111012_1639 $_SESSION['texte_messagecmd_client_id'] = ""; $_SESSION['texte_messagecmd'] = ""; $_SESSION['texte_destinatairecmd'] = ""; $_SESSION['texte_expediteurcmd'] = ""; } } public function charger_id($id) { return $this->getVars("select * from $this->table where id=".intval($id)); } public function boucle($texte, $args) { $res = ''; $commande = lireTag($args, 'commande'); if ($this->charger($commande)) { $res = str_replace('#MESSAGE', $this->message, $texte); } return $res; } } ?>