Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(!defined('DATALIFEENGINE'))
- {
- die("Hacking attempt!");
- }
- function add_merge_info($dif, $fraze, $allow){
- if (!$allow) return "";
- $merged_sec = $dif % 60;
- $merged_min = ($dif/60) % 60;
- $merged_hours = ($dif/3600) % 24 ;
- $merged_days = ($dif/86400) % 31;
- $s_st = ($merged_sec) ? seconds_st($merged_sec) : '';
- $m_st = ($merged_min) ? minutes_st($merged_min) : '';
- $h_st = ($merged_hours) ? hours_st($merged_hours) : '';
- $d_st = ($merged_days) ? days_st($merged_days) : '';
- return sprintf($fraze,$d_st,$h_st,$m_st,$s_st);
- }
- function auto_wrap($comments, $auto_wrap){
- $comments = preg_split('((>)|(<))', $comments, -1, PREG_SPLIT_DELIM_CAPTURE);
- $n = count($comments);
- for ($i = 0; $i < $n; $i++) {
- if ($comments[$i] == "<") {
- $i++; continue;
- }
- $comments[$i] = preg_replace(
- "#([^\s\n\r]{".intval($auto_wrap)."})#i",
- "\\1<br />", $comments[$i]);
- }
- $comments = join("", $comments);
- return $comments;
- }
- function check_images_files ($for_ID, $user_name, $add_id, $attach_found, $full=false){
- global $db, $CatForum;
- if (check_perm("images", $CatForum[$for_ID]['moderators'], $CatForum[$for_ID]['auth_images'])){
- if (!$full){
- $db->query("UPDATE " . PREFIX . "_twsf_images set post_id='$add_id' WHERE author = '$user_name' AND post_id = '0'");
- } else {
- $row = $db->super_query("SELECT id, images FROM " . PREFIX . "_twsf_images WHERE author = '$user_name' AND post_id = '$add_id'");
- if (!$row['id']){
- $db->query("UPDATE " . PREFIX . "_twsf_images set post_id='$add_id' WHERE author = '$user_name' AND post_id = '0'");
- } else {
- if ($row['images'] == "") $listimages = array(); else $listimages = explode("|||", $row['images']);
- $new_foto_array = $db->super_query("SELECT images FROM " . PREFIX . "_twsf_images WHERE author = '$user_name' AND post_id = '0'");
- if ($new_foto_array['images'] == "") $new_listimages = array(); else $new_listimages = explode("|||", $new_foto_array['images']);
- foreach ($new_listimages as $dataimage){
- if (!in_array($dataimage, $listimages)) $listimages[] = $dataimage;
- }
- $row['images'] = implode("|||", $listimages);
- $db->query("UPDATE " . PREFIX . "_twsf_images set images='$row[images]' WHERE author = '$user_name' AND post_id = '$add_id'");
- $db->query("DELETE FROM " . PREFIX . "_twsf_images WHERE author = '$user_name' AND post_id = '0'");
- }
- }
- }
- if ($attach_found && check_perm("upload", $CatForum[$for_ID]['moderators'], $CatForum[$for_ID]['auth_sendfile'])){
- $db->query("UPDATE " . PREFIX . "_twsf_files set post_id='$add_id' WHERE author = '$user_name' AND post_id = '0'");
- }
- }
- function check_poll ($stop, $vote_title, $frage, $vote_body){
- global $CN_HALT, $FLang, $ForConfig;
- if(strlen($vote_title) > 200){ $stop[] = $FLang['nt_err_3']; $CN_HALT = TRUE; }
- if(trim($frage) == "" or !$frage){ $stop[] = $FLang['nt_err_4']; $CN_HALT = TRUE; }
- if(strlen($frage) > 250){ $stop[] = $FLang['nt_err_5']; $CN_HALT = TRUE; }
- if(trim($vote_body) == "" or !$vote_body){ $stop[] = $FLang['nt_err_6']; $CN_HALT = TRUE; }
- else {
- $body = explode("<br />", $vote_body);
- if(count($body) > intval($ForConfig['max_poll'])){ $stop[] = $FLang['nt_err_7']; $CN_HALT = TRUE; }
- }
- return $stop;
- }
- function get_ready_text ($ForConfig, $adminedit=false){
- global $parse, $db, $config, $is_logged, $member_id;
- if (!$ForConfig['parser_save_mode']) $parse->safe_mode = false;
- if (!$ForConfig['word_filter']) $parse->filter_mode = false;
- if ($is_logged AND $member_id['user_group'] == '1')
- $parse->ParseFilter(Array(), Array(), 1, 1);
- $short_story = $db->safesql($parse->BB_Parse(parse_smiles($parse->process($_POST['short_story']), $adminedit), false));
- if ($short_story == "") return "";
- if(intval($ForConfig['auto_wrap'])){
- $short_story = auto_wrap($short_story, $ForConfig['auto_wrap']);
- }
- return $short_story;
- }
- function check_fpost ($stop, $title, $alt_name, $time, $topic_url=""){
- global $CN_HALT, $FLang, $db;
- if(trim($title) == "" or !$title){ $stop[] = $FLang['nt_err_8']; $CN_HALT = TRUE; }
- if(strlen($title) > 200){ $stop[] = $FLang['nt_err_9']; $CN_HALT = TRUE; }
- if ($CN_HALT == TRUE) $stop_er = true;
- else {
- if (!$topic_url) $stop_er = false;
- elseif ($alt_name != $topic_url) $stop_er = false;
- else $stop_er = true;
- }
- if ($stop_er != true) {
- $thisdate = date ("Y-m-d", $time);
- $db->query("SELECT topic_id from " . PREFIX . "_twsf_topics where topic_url='$alt_name' AND topic_time = '$thisdate'");
- if ($db->num_rows() > 0) { $stop[] = $FLang['nt_err_21']; $CN_HALT = TRUE; }
- $db->free();
- }
- return $stop;
- }
- function check_post_info ($stop, $is_logged, $name, $mail, $sec=false, $user_group=0, $ip=""){
- global $CN_HALT, $FLang, $db, $config, $ForConfig;
- if (!$is_logged and $CN_HALT != TRUE) {
- $db->query("SELECT name FROM " . USERPREFIX . "_users where LOWER(name) = '".strtolower($name)."'");
- if ($db->num_rows() > 0) { $stop[] = $FLang['nt_err_19']; $CN_HALT = TRUE; }
- $db->free();
- }
- if (empty($name)){ $stop[] = $FLang['nt_err_11']; $CN_HALT = TRUE; }
- if (strlen($name) > 50){ $stop[] = $FLang['nt_err_12']; $CN_HALT = TRUE; }
- if($mail != ""){
- $ok = FALSE;
- if(preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $mail)) $ok = TRUE;
- elseif($config['allow_url_instead_mail'] == "yes" and preg_match("/((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.-?]+)/", $mail)) $ok = TRUE;
- elseif($config['allow_url_instead_mail'] != "yes"){ $stop[] = $FLang['nt_err_13']; $CN_HALT = TRUE; }
- else { $stop[] = $FLang['nt_err_13']; $CN_HALT = TRUE; }
- }
- if( strlen($mail) > 50){ $stop[] = $FLang['nt_err_14']; $CN_HALT = TRUE; }
- if ($sec){
- if($user_group > 2 AND intval($ForConfig['flood']) AND $CN_HALT != TRUE){
- if (forum_flooder($ip) == TRUE){
- $stop[] = $FLang['nt_err_16']." ".$FLang['nt_err_17']." {$ForConfig['flood']} ".$FLang['nt_err_18'];
- $CN_HALT = TRUE;
- }
- }
- return $stop;
- }
- ?>
Add Comment
Please, Sign In to add comment