Guest User

Untitled

a guest
Aug 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.05 KB | None | 0 0
  1. <?php
  2.  
  3. if(!defined('DATALIFEENGINE'))
  4. {
  5. die("Hacking attempt!");
  6. }
  7.  
  8.  
  9. function add_merge_info($dif, $fraze, $allow){
  10.  
  11. if (!$allow) return "";
  12.  
  13. $merged_sec = $dif % 60;
  14. $merged_min = ($dif/60) % 60;
  15. $merged_hours = ($dif/3600) % 24 ;
  16. $merged_days = ($dif/86400) % 31;
  17. $s_st = ($merged_sec) ? seconds_st($merged_sec) : '';
  18. $m_st = ($merged_min) ? minutes_st($merged_min) : '';
  19. $h_st = ($merged_hours) ? hours_st($merged_hours) : '';
  20. $d_st = ($merged_days) ? days_st($merged_days) : '';
  21.  
  22. return sprintf($fraze,$d_st,$h_st,$m_st,$s_st);
  23.  
  24. }
  25.  
  26. function auto_wrap($comments, $auto_wrap){
  27.  
  28. $comments = preg_split('((>)|(<))', $comments, -1, PREG_SPLIT_DELIM_CAPTURE);
  29. $n = count($comments);
  30.  
  31. for ($i = 0; $i < $n; $i++) {
  32. if ($comments[$i] == "<") {
  33. $i++; continue;
  34. }
  35.  
  36. $comments[$i] = preg_replace(
  37. "#([^\s\n\r]{".intval($auto_wrap)."})#i",
  38. "\\1<br />", $comments[$i]);
  39. }
  40.  
  41. $comments = join("", $comments);
  42.  
  43. return $comments;
  44. }
  45.  
  46.  
  47. function check_images_files ($for_ID, $user_name, $add_id, $attach_found, $full=false){
  48. global $db, $CatForum;
  49.  
  50. if (check_perm("images", $CatForum[$for_ID]['moderators'], $CatForum[$for_ID]['auth_images'])){
  51.  
  52. if (!$full){
  53. $db->query("UPDATE " . PREFIX . "_twsf_images set post_id='$add_id' WHERE author = '$user_name' AND post_id = '0'");
  54. } else {
  55.  
  56. $row = $db->super_query("SELECT id, images FROM " . PREFIX . "_twsf_images WHERE author = '$user_name' AND post_id = '$add_id'");
  57.  
  58. if (!$row['id']){
  59. $db->query("UPDATE " . PREFIX . "_twsf_images set post_id='$add_id' WHERE author = '$user_name' AND post_id = '0'");
  60. } else {
  61.  
  62. if ($row['images'] == "") $listimages = array(); else $listimages = explode("|||", $row['images']);
  63.  
  64. $new_foto_array = $db->super_query("SELECT images FROM " . PREFIX . "_twsf_images WHERE author = '$user_name' AND post_id = '0'");
  65.  
  66. if ($new_foto_array['images'] == "") $new_listimages = array(); else $new_listimages = explode("|||", $new_foto_array['images']);
  67.  
  68. foreach ($new_listimages as $dataimage){
  69. if (!in_array($dataimage, $listimages)) $listimages[] = $dataimage;
  70. }
  71.  
  72. $row['images'] = implode("|||", $listimages);
  73.  
  74. $db->query("UPDATE " . PREFIX . "_twsf_images set images='$row[images]' WHERE author = '$user_name' AND post_id = '$add_id'");
  75. $db->query("DELETE FROM " . PREFIX . "_twsf_images WHERE author = '$user_name' AND post_id = '0'");
  76.  
  77. }
  78.  
  79. }
  80.  
  81. }
  82.  
  83. if ($attach_found && check_perm("upload", $CatForum[$for_ID]['moderators'], $CatForum[$for_ID]['auth_sendfile'])){
  84. $db->query("UPDATE " . PREFIX . "_twsf_files set post_id='$add_id' WHERE author = '$user_name' AND post_id = '0'");
  85. }
  86.  
  87. }
  88.  
  89.  
  90. function check_poll ($stop, $vote_title, $frage, $vote_body){
  91. global $CN_HALT, $FLang, $ForConfig;
  92.  
  93. if(strlen($vote_title) > 200){ $stop[] = $FLang['nt_err_3']; $CN_HALT = TRUE; }
  94. if(trim($frage) == "" or !$frage){ $stop[] = $FLang['nt_err_4']; $CN_HALT = TRUE; }
  95. if(strlen($frage) > 250){ $stop[] = $FLang['nt_err_5']; $CN_HALT = TRUE; }
  96.  
  97. if(trim($vote_body) == "" or !$vote_body){ $stop[] = $FLang['nt_err_6']; $CN_HALT = TRUE; }
  98. else {
  99. $body = explode("<br />", $vote_body);
  100. if(count($body) > intval($ForConfig['max_poll'])){ $stop[] = $FLang['nt_err_7']; $CN_HALT = TRUE; }
  101. }
  102.  
  103. return $stop;
  104.  
  105. }
  106.  
  107.  
  108. function get_ready_text ($ForConfig, $adminedit=false){
  109. global $parse, $db, $config, $is_logged, $member_id;
  110.  
  111. if (!$ForConfig['parser_save_mode']) $parse->safe_mode = false;
  112. if (!$ForConfig['word_filter']) $parse->filter_mode = false;
  113.  
  114. if ($is_logged AND $member_id['user_group'] == '1')
  115. $parse->ParseFilter(Array(), Array(), 1, 1);
  116.  
  117. $short_story = $db->safesql($parse->BB_Parse(parse_smiles($parse->process($_POST['short_story']), $adminedit), false));
  118.  
  119. if ($short_story == "") return "";
  120.  
  121. if(intval($ForConfig['auto_wrap'])){
  122. $short_story = auto_wrap($short_story, $ForConfig['auto_wrap']);
  123. }
  124.  
  125. return $short_story;
  126. }
  127.  
  128.  
  129. function check_fpost ($stop, $title, $alt_name, $time, $topic_url=""){
  130. global $CN_HALT, $FLang, $db;
  131.  
  132. if(trim($title) == "" or !$title){ $stop[] = $FLang['nt_err_8']; $CN_HALT = TRUE; }
  133. if(strlen($title) > 200){ $stop[] = $FLang['nt_err_9']; $CN_HALT = TRUE; }
  134.  
  135. if ($CN_HALT == TRUE) $stop_er = true;
  136. else {
  137. if (!$topic_url) $stop_er = false;
  138. elseif ($alt_name != $topic_url) $stop_er = false;
  139. else $stop_er = true;
  140. }
  141.  
  142. if ($stop_er != true) {
  143. $thisdate = date ("Y-m-d", $time);
  144. $db->query("SELECT topic_id from " . PREFIX . "_twsf_topics where topic_url='$alt_name' AND topic_time = '$thisdate'");
  145.  
  146. if ($db->num_rows() > 0) { $stop[] = $FLang['nt_err_21']; $CN_HALT = TRUE; }
  147. $db->free();
  148. }
  149.  
  150. return $stop;
  151. }
  152.  
  153.  
  154. function check_post_info ($stop, $is_logged, $name, $mail, $sec=false, $user_group=0, $ip=""){
  155. global $CN_HALT, $FLang, $db, $config, $ForConfig;
  156.  
  157. if (!$is_logged and $CN_HALT != TRUE) {
  158. $db->query("SELECT name FROM " . USERPREFIX . "_users where LOWER(name) = '".strtolower($name)."'");
  159.  
  160. if ($db->num_rows() > 0) { $stop[] = $FLang['nt_err_19']; $CN_HALT = TRUE; }
  161.  
  162. $db->free();
  163. }
  164.  
  165. if (empty($name)){ $stop[] = $FLang['nt_err_11']; $CN_HALT = TRUE; }
  166. if (strlen($name) > 50){ $stop[] = $FLang['nt_err_12']; $CN_HALT = TRUE; }
  167.  
  168. if($mail != ""){
  169. $ok = FALSE;
  170. if(preg_match("/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $mail)) $ok = TRUE;
  171. elseif($config['allow_url_instead_mail'] == "yes" and preg_match("/((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.-?]+)/", $mail)) $ok = TRUE;
  172. elseif($config['allow_url_instead_mail'] != "yes"){ $stop[] = $FLang['nt_err_13']; $CN_HALT = TRUE; }
  173. else { $stop[] = $FLang['nt_err_13']; $CN_HALT = TRUE; }
  174. }
  175.  
  176. if( strlen($mail) > 50){ $stop[] = $FLang['nt_err_14']; $CN_HALT = TRUE; }
  177.  
  178. if ($sec){
  179.  
  180. if($user_group > 2 AND intval($ForConfig['flood']) AND $CN_HALT != TRUE){
  181. if (forum_flooder($ip) == TRUE){
  182. $stop[] = $FLang['nt_err_16']." ".$FLang['nt_err_17']." {$ForConfig['flood']} ".$FLang['nt_err_18'];
  183. $CN_HALT = TRUE;
  184. }
  185. }
  186.  
  187. return $stop;
  188. }
  189.  
  190.  
  191. ?>
Add Comment
Please, Sign In to add comment