function send_message($body, $room, $sussurro = 0) { global $x7s, $db, $prefix, $x7c, $txt; $time = time(); // This is used for hunt mode $allow_user_img = $sussurro == 3; $body_parsed = parse_message($body, 0, $allow_user_img); if ($sussurro == 0) { $db->DoQuery("INSERT INTO {$prefix}messages VALUES('0','{$x7s->username}',\r\n\t\t\t\t'1','{$body}','{$body_parsed}','{$room}','{$time}')"); $db->DoQuery("UPDATE {$prefix}users SET daily_post = daily_post + 1\r\n\t\t\t\t\tWHERE username='******'"); $db->DoQuery("UPDATE {$prefix}rooms SET daily_post = daily_post + 1\r\n\t\t\t\t\tWHERE name='{$room}'"); //If we are in panic... do panic update if ($x7c->settings['panic'] && !$x7c->room_data['panic_free']) { update_panic(); } } else { if ($sussurro == 1) { if (preg_match("/@.*@/", $body, $user)) { $user[1] = preg_replace("/@/", "", $user[0]); //Check if whisper is for everybody if ($user[1] == "_all_") { if ($x7c->permissions['write_master']) { $query = $db->DoQuery("SELECT name FROM {$prefix}online WHERE room='{$room}'"); while ($row = $db->Do_Fetch_Assoc($query)) { if ($row['name'] != $x7s->username) { $db->DoQuery("INSERT INTO {$prefix}messages VALUES('0','{$x7s->username}','10','{$body}','{$row['name']}:{$body_parsed}','{$room}','{$time}')"); } } } } else { //Check if users are in the same chatroom $query = $db->DoQuery("SELECT count(*) AS num FROM {$prefix}online WHERE name='{$user[1]}' AND room='{$room}'"); $row = $db->Do_Fetch_Assoc($query); if ($row['num']) { $db->DoQuery("INSERT INTO {$prefix}messages VALUES('0','{$x7s->username}','10','{$body}','{$user['1']}:{$body_parsed}','{$room}','{$time}')"); } } } } else { if ($sussurro == 2 || $sussurro == 3) { //Mastering message $db->DoQuery("INSERT INTO {$prefix}messages VALUES('0','{$x7s->username}','14','{$body}','{$body_parsed}','{$room}','{$time}')"); } } } // Do logging if required if ($x7c->room_data['logged'] == 1 && $room != "" && $x7c->settings['enable_logging'] == 1) { include_once "./lib/logs.php"; $log = new logs(1, $room); $log->add($x7s->username, $body_parsed); } }
function query($sql) { //Quelques retouches éventuellement... $res = mysql_query($sql); if ($res === false) { if (defined('MODULE')) { //Fait pour n'activer ceci que sur la partie LINK logs::add('mysql', 'error', array('mysql.class.php', $sql)); } } return $res; }
public function make_contenu_from_file($gabarit, $objet = "") { $body_html = ""; $body_txt = ""; if (is_file($this->rep_emailing . $gabarit . ".txt")) { $fic = fopen($this->rep_emailing . $gabarit . ".txt", "r"); $body_txt = fread($fic, filesize($this->rep_emailing . $gabarit . ".txt")); fclose($fic); } if (is_file($this->rep_emailing . $gabarit . ".html")) { $fic = fopen($this->rep_emailing . $gabarit . ".html", "r"); $body_html = fread($fic, filesize($this->rep_emailing . $gabarit . ".html")); fclose($fic); } $this->contenu_txt = $body_txt; $this->contenu_html = $body_html; if (empty($this->contenu_txt) && empty($this->contenu_html)) { logs::add('emailing', 'error', array('Error controlling mail datas !', 'No content found for email template "' . $gabarit . '"')); } if (empty($objet)) { $this->get_objet_from_config($gabarit); } else { $this->sujet = $objet; } }