+ if (($cli_email = gpcs_var('cli_email', $get, $post, $cookie)) === FALSE)
+ $cli_email = "";
+
+
+ $mesg_to_user = "";
+
+ log_wr("INFO:SKIP:argz == warranty name: [".$cli_name."] CERT: ".$user->is_cert());
+ if ($user->is_cert()) {
+ if (0 == 1) {
+ if (($wa_lock = Warrant::lock_data(TRUE)) != FALSE) {
+ if (($fp = @fopen(LEGAL_PATH."/warrant.txt", 'a')) != FALSE) {
+ /* Unix time | session | nickname | IP | where was | mesg */
+ fwrite($fp, sprintf("%ld|%s|%s|%s|\n", $curtime, xcapelt($user->name), xcapelt(urldecode($cli_name)), xcapelt(urldecode($cli_email))));
+ fclose($fp);
+ }
+ Warrant::unlock_data($wa_lock);
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+ /* MLANG: "<br>Il nominativo è stato inoltrato all\'amministratore.<br><br>Nell\'arco di pochi giorni vi verrà<br><br>notificata l\'avvenuta registrazione." */
+ $user->comm[$user->step % COMM_N] .= show_notify($mlang_indwr['warrrepl'][$G_lang], 0, $mlang_indwr['btn_close'][$G_lang], 400, 150);
+ $user->step_inc();
+ echo "1";
+ }
+ else {
+ /* MLANG: "<b>E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore.</b>" */
+ $mesg_to_user = nickserv_msg($dt, $mlang_indwr['commerr'][$G_lang]);
+ }
+ } // 0 == 1
+ else {
+ // check existence of username or email
+ $is_trans = FALSE;
+ do {
+ if (($bdb = BriskDB::create()) == FALSE)
+ break;
+
+ $cli_name = urldecode($cli_name);
+ $cli_email = urldecode($cli_email);
+
+ // check for already used fields
+ if (($idret = $bdb->check_record_by_login_or_email($cli_name, $cli_email)) != 0) {
+ $mesg_to_user = nickserv_msg($dt, ($idret == 1 ? $mlang_indwr['nu_loginau'][$G_lang] :
+ ($idret == 2 ? $mlang_indwr['nu_emailau'][$G_lang]
+ : $mlang_indwr['unknownerr'][$G_lang])));
+ break;
+ }
+ $bdb->transaction('BEGIN');
+ $is_trans = TRUE;
+ // insert the new user disabled with reason NU_MAILED
+ if (($usr_obj = $bdb->user_add($cli_name, 'THE_PASS', $cli_email,
+ USER_FLAG_TY_DISABLE,
+ USER_DIS_REA_NU_MAILED, $user->code)) == FALSE) {
+ fprintf(STDERR, "ERROR: user_add FAILED\n");
+ break;
+ }
+ if (($mail_code = $bdb->mail_reserve_code()) == FALSE) {
+ fprintf(STDERR, "ERROR: mail reserve code FAILED\n");
+ break;
+ }
+ $hash = md5($curtime . $G_alarm_passwd . $cli_name . $cli_email);
+
+ $confirm_page = sprintf("http://%s/%s/mailmgr.php?f_act=checkmail&f_code=%d&f_hash=%s",
+ $G_domain, $G_webbase, $mail_code, $hash);
+ $subj = $mlang_indwr['nu_msubj'][$G_lang];
+ $body_txt = sprintf($mlang_indwr['nu_mtext'][$G_lang],
+ $user->name, $cli_name, $confirm_page);
+ $body_htm = sprintf($mlang_indwr['nu_mhtml'][$G_lang],
+ $user->name, $cli_name, $confirm_page);
+
+ $mail_item = new MailDBItem($mail_code, $usr_obj->code, MAIL_TYP_CHECK,
+ $curtime, $subj, $body_txt, $body_htm, $hash);
+
+ if (brisk_mail($cli_email, $subj, $body_txt, $body_htm) == FALSE) {
+ // mail error
+ fprintf(STDERR, "ERROR: mail send FAILED\n");
+ break;
+ }
+ // save the mail
+ if ($mail_item->store($bdb) == FALSE) {
+ // store mail error
+ fprintf(STDERR, "ERROR: store mail FAILED\n");
+ break;
+ }
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+ /* MLANG: "<br>Il nominativo è stato inoltrato all\'amministratore.<br><br>Nell\'arco di pochi giorni vi verrà<br><br>notificata l\'avvenuta registrazione." */
+ $user->comm[$user->step % COMM_N] .= show_notify($mlang_indwr['warrrepl'][$G_lang], 0, $mlang_indwr['btn_close'][$G_lang], 400, 150);
+ $user->step_inc();
+ echo "1";
+ $bdb->transaction('COMMIT');
+ } while(FALSE);
+ $bdb->transaction('ROLLBACK');
+ }
+
+ }
+ else {
+ /* MLANG: "<b>Per autenticare qualcuno devi a tua volta essere autenticato.</b>" */
+ $mesg_to_user = nickserv_msg($dt, $mlang_indwr['warrmust'][$G_lang]);
+ }
+
+ if ($mesg_to_user != "") {
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+
+ $user->comm[$user->step % COMM_N] .= $mesg_to_user;
+ $user->step_inc();
+ }
+ }
+ else if ($argz[0] == 'mesgtoadm') {
+ if (($cli_subj = gpcs_var('cli_subj', $get, $post, $cookie)) === FALSE)
+ $cli_subj = "";
+
+ if (($cli_mesg = gpcs_var('cli_mesg', $get, $post, $cookie)) === FALSE)
+ $cli_mesg = "";
+
+
+
+ $mesg_to_user = "";
+
+ log_wr("INFO:SKIP:argz == mesgtoadm name: [".$user->name."] AUTH: ".$user->is_auth());
+ if ($user->is_auth()) {
+ if (($wa_lock = Warrant::lock_data(TRUE)) != FALSE) {
+ if (($bdb = BriskDB::create()) != FALSE) {
+ $bdb->users_load();
+
+ if (($ema = $bdb->getmail($user->name)) != FALSE) {
+ // mail("nastasi",
+ mail("brisk@alternativeoutput.it", urldecode($cli_subj), urldecode($cli_mesg), sprintf("From: %s <%s>", $user->name, $ema));
+ }
+
+ if (($fp = @fopen(LEGAL_PATH."/messages.txt", 'a')) != FALSE) {
+ /* Unix time | session | nickname | IP | where was | mesg */
+ fwrite($fp, sprintf("%ld|%s|%s|%s\n", $curtime, $user->name,
+ xcapelt(urldecode($cli_subj)), xcapelt(urldecode($cli_mesg))));
+ fclose($fp);
+ }
+ Warrant::unlock_data($wa_lock);
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+ /* MLANG: "" */
+ $user->comm[$user->step % COMM_N] .= show_notify($mlang_indwr['mesgrepl'][$G_lang], 0, $mlang_indwr['btn_close'][$G_lang], 400, 110);
+ $user->step_inc();
+ echo "1";
+ }
+ else {
+ /* MLANG: "<b>Il database è temporaneamente irraggiungibile, riprova più tardi o contatta l\'amministratore.</b>" */
+ $mesg_to_user = nickserv_msg($dt, $mlang_indwr['coerrdb'][$G_lang]);
+ $user->comm[$user->step % COMM_N] = "gst.st = ".($user->step+1)."; ";
+ }
+ }
+ else {
+ /* MLANG: "<b>E\' occorso un errore durante il salvataggio, riprova o contatta l\'amministratore.</b>" */
+ $mesg_to_user = nickserv_msg($dt, $mlang_indwr['commerr'][$G_lang]);
+ }
+
+ }
+ else {
+ /* MLANG: "<b>Per autenticare qualcuno devi a tua volta essere autenticato.</b>" */
+ $mesg_to_user = nickserv_msg($dt, $mlang_indwr['mesgmust'][$G_lang]);
+ }