* @version DS-E V/2.5 */ $str_filename = basename(__FILE__); require_once('common.php'); require_once(LIB_PATH.'jslib.lib.php'); // Mindestzeitabstand zwischen zwei Sendungen in Sekunden define('COMMENTMAIL_MIN_INTERVAL',300); if(!$session['user']['loggedin']) {exit;} popup_header('Rollenspiel an '.(!empty($session['user']['emailaddress']) ? $session['user']['emailaddress'] : 'EM@ail'),true); // Wird in der viewcommentary gesetzt, um zu verhindern, dass sensible Sections angezeigt werden if( empty($session['user']['chat_section']) ) { output('`n`b`$Kein Bereich ausgewählt, aus dem Kommentare versendet werden sollen!`b`0`n`n'); popup_footer(); exit; } if(!is_email($session['user']['emailaddress'])) { output('`$Du hast in deinem Profil keine gültige Emailadresse angegeben!'); popup_footer(); exit; } $str_section = $session['user']['chat_section']; $int_comments_max = 200; $str_out = ''; if(!isset($session['comment2mail'])) { $session['comment2mail'] = array(); // Letzte Sendung $session['comment2mail']['lastsent'] = 0; // Section $session['comment2mail']['section'] = $str_section; } if(!isset($session['comment2mail']['from']) || $session['comment2mail']['section'] != $str_section) { // Um Irritationen zu vermeiden: if(sizeof($_GET)) { $_GET = array(); } // KommentarID VON $session['comment2mail']['from'] = 0; // KommentarID BIS $session['comment2mail']['to'] = 0; // Section $session['comment2mail']['section'] = $str_section; } $int_lasttime = $session['comsendmail']['lastsent']; // Zeit warten if((time() - $int_lasttime) < COMMENTMAIL_MIN_INTERVAL && $session['user']['superuser'] == 0) { output('`n`$`bDu mußt noch eine Weile warten, ehe du erneut Kommentare versenden darfst!`b`0`n'); popup_footer(); exit; } // Befüllen mit Usereingaben if(isset($_GET['from'])) { $session['comment2mail']['from'] = (int)$_GET['from']; } if(isset($_GET['to'])) { $session['comment2mail']['to'] = (int)$_GET['to']; } // to darf nicht vor from liegen if($session['comment2mail']['to'] > 0 && $session['comment2mail']['to'] < $session['comment2mail']['from']) { $session['comment2mail']['to'] = 0; } $str_out .= ' `&`n`n'; // Erster / letzter Kommentar. Wird in Kommentarschleife unten befüllt $str_start_comment = ''; $str_end_comment = ''; $int_start_time = 0; $int_end_time = 0; // Query bauen $str_sql = 'SELECT c.*, a.name,a.login,a.acctid,a.activated,a.loggedin,a.laston,a.location,a.superuser FROM commentary c INNER JOIN accounts a ON a.acctid = c.author'; $str_count_sql = ' SELECT COUNT(*) AS c FROM commentary c INNER JOIN accounts a ON a.acctid = c.author '; $str_where = ' WHERE section="'.addslashes($str_section).'" AND deleted_by = 0 AND self=1'; if($session['comment2mail']['from']) { $str_where .= ' AND commentid >= '.(int)$session['comment2mail']['from'].''; } if($session['comment2mail']['to']) { $str_where .= ' AND commentid <= '.(int)$session['comment2mail']['to'].''; } if(isset($_GET['send'])) { // Gewählte Kommentare ausschließen if(isset($_POST['exclude']) && $_POST['exclude'] != '0') { $str_where .= ' AND commentid NOT IN ('.db_real_escape_string($_POST['exclude']).') '; } } $str_count_sql .= $str_where; $str_sql .= $str_where; $str_sql .= ' ORDER BY postdate DESC,commentid DESC'; // Seitenansicht $str_baselnk = $str_filename . ''; // Nur anzeigen, wenn noch keine Auswahl getroffen if($session['comment2mail']['from'] == 0 && $session['comment2mail']['to'] == 0) { $arr_page_res = page_nav($str_baselnk,$str_count_sql,50,' | ',''); } else { // Bestimmen, wie wir den Offset zu setzen haben if($session['comment2mail']['to'] == 0 && $session['comment2mail']['from'] > 0) { $arr_tmp = db_fetch_assoc(db_query($str_count_sql)); $int_offset = max($arr_tmp['c']-$int_comments_max,0); $arr_page_res['limit'] = $int_offset.',200'; } else { $arr_page_res['limit'] = '0,'.$int_comments_max; } $arr_page_res['page_nav'] = '`iAuswahl`i'; } // Query abschicken $str_sql .= ' LIMIT '.$arr_page_res['limit']; $res = db_query($str_sql); // Ergebnisse ordnen $arr_results = array(); while($c = db_fetch_assoc($res)) { $arr_results[$c['commentid']] = $c; } // Liste erstellen if(sizeof($arr_results) == 0) { $str_out .= '`iKein Rollenspiel gefunden!`i'; } else { $str_out .= '`^`bSeiten:`b `0'.$arr_page_res['page_nav'].'