$i) { $j = 'db_'.$i; $$j = 'sed_'.$i; } /* ================== Replacements for PHP5-only functions ================== */ if (!function_exists('str_split')) { function str_split($txt, $length=1) { if ($length<1) { return(FALSE); } $res = array(); for ($i=0; $i $ml) { if(empty($mn[$ml])) { $sys['auth_log'][] = $area.".".$option.".".$ml."=0"; $res[] = FALSE; } elseif ($option=='any') { $cnt = 0; if (is_array($usr['auth'][$area])) { foreach($usr['auth'][$area] as $k => $g) { $cnt += (($g & $mn[$ml]) == $mn[$ml]); } } $cnt = ($cnt==0 && $usr['auth']['admin']['a'] && $ml=='A') ? 1 : $cnt; $sys['auth_log'][] = ($cnt>0) ? $area.".".$option.".".$ml."=1" : $area.".".$option.".".$ml."=0"; $res[] = ($cnt>0) ? TRUE : FALSE; } else { $sys['auth_log'][] = (($usr['auth'][$area][$option] & $mn[$ml]) == $mn[$ml]) ? $area.".".$option.".".$ml."=1" : $area.".".$option.".".$ml."=0"; $res[] = (($usr['auth'][$area][$option] & $mn[$ml]) == $mn[$ml]) ? TRUE : FALSE; } } if (count($res)==1) { return ($res[0]); } else { return($res); } } /* ------------------ */ function sed_auth_build($userid, $maingrp=0) { global $db_auth, $db_groups_users; $groups = array(); $authgrid = array(); $tmpgrid = array(); if ($userid==0 || $maingrp==0) { $groups[] = 1; } else { $groups[] = $maingrp; $sql = sed_sql_query("SELECT gru_groupid FROM $db_groups_users WHERE gru_userid='$userid'"); while ($row = sed_sql_fetcharray($sql)) { $groups[] = $row['gru_groupid']; } } $sql_groups = implode(',', $groups); $sql = sed_sql_query("SELECT auth_code, auth_option, auth_rights FROM $db_auth WHERE auth_groupid IN (".$sql_groups.") ORDER BY auth_code ASC, auth_option ASC"); while ($row = sed_sql_fetcharray($sql)) { $authgrid[$row['auth_code']][$row['auth_option']] |= $row['auth_rights']; } return($authgrid); } /* ------------------ */ function sed_auth_clear($id='all') { global $db_users; if($id=='all') { $sql = sed_sql_query("UPDATE $db_users SET user_auth='' WHERE 1"); } else { $sql = sed_sql_query("UPDATE $db_users SET user_auth='' WHERE user_id='$id'"); } return( sed_sql_affectedrows()); } /* ------------------ */ function sed_bbcode($text) { global $L, $skin, $sys, $cfg, $sed_groups; $text = sed_bbcode_autourls($text); $text = " ".$text; $bbcodes = array( '$' => '$', '[b]' => '', '[/b]' => '', '[p]' => '

', '[/p]' => '

', '[u]' => '', '[/u]' => '', '[i]' => '', '[/i]' => '', '[hr]' => '
', '[_]' => ' ', '[__]' => '   ', '[list]' => '', '[red]' => '', '[/red]' => '', '[white]' => '', '[/white]' => '', '[green]' => '', '[/green]' => '', '[blue]' => '', '[/blue]' => '', '[orange]' => '', '[/orange]' => '', '[yellow]' => '', '[/yellow]' => '', '[purple]' => '', '[/purple]' => '', '[black]' => '', '[/black]' => '', '[grey]' => '', '[/grey]' => '', '[pink]' => '', '[/pink]' => '', '[sky]' => '', '[/sky]' => '', '[sea]' => '', '[/sea]' => '', '[quote]' => '
'.$L['bbcodes_quote'].'
', '[/quote]' => '
', '[br]' => '
', '[more]' => '' ); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = str_replace($bbcode,$bbcodehtml,$text); } $bbcodes = array( '\\[img\\]([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\[/img\\]' => '', '\\[img=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/img\\]' => '', '\\[thumb=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/thumb\\]' => ' ', '\\[pfs]([^\\[]*)\\[/pfs\\]' => ' \\1', '\\[t=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/t\\]' => '', '\\[url=([^\\\'\;([]*)\\]([^\\[]*)\\[/url\\]' => '\\2', '\\[url\\]([^\\([]*)\\[/url\\]' => '\\1', '\\[color=([0-9A-F]{6})\\]([^\\[]*)\\[/color\\]' => '\\2', '\\[style=([1-9]{1})\\]([^\\[]*)\\[/style\\]' => '\\2', '\\[email=([._A-z0-9-]+@[A-z0-9-]+\.[.a-z]+)\\]([^\\[]*)\\[/email\\]' => '\\2', '\\[email\\]([._A-z0-9-]+@[A-z0-9-]+\.[.a-z]+)\\[/email\\]' => '\\1', '\\[user=([0-9]+)\\]([A-z0-9_\. -]+)\\[/user\\]' => '\\2', '\\[page=([0-9]+)\\]([^\\[]*)\\[/page\\]' => '\\2', '\\[page\\]([0-9]+)\\[/page\\]' => ''.$L['Page'].' #\\1', '\\[group=([0-9]+)\\]([^\\([]*)\\[/group\\]' => '\\2', '\\[topic\\]([0-9]+)\\[/topic\\]' => ''.$L['Topic'].' #\\1', '\\[post\\]([0-9]+)\\[/post\\]' => ''.$L['Post'].' #\\1', '\\[pm\\]([0-9]+)\\[/pm\\]' => '', '\\[f\\]([a-z][a-z])\\[/f\\]' => '', '\\[ac=([^\\[]*)\\]([^\\[]*)\\[/ac\\]' => '\\2', '\\[del\\]([^\\[]*)\\[/del\\]' => '\\1', '\\[quote=([^\\[]*)\\]' => '
\\1
', '\\[spoiler\\]' => '
', '\\[spoiler=([A-z0-9_\. -]+)\\]' => '
', '\\[/spoiler\\]' => '
'); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } if ($cfg['parser_vid']) { $bbcodes = array( '\\[youtube=([^\\[]*)\\]' => ' ', '\\[googlevideo=([^\\[]*)\\]' => ' ', '\\[metacafe=([^\\[]*)\\]' => ''); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } } $bbcodes = array( '\\[colleft\\]([^\\[]*)\\[/colleft\\]' => '
\\1
', '\\[colright\\]([^\\[]*)\\[/colright\\]' => '
\\1
', '\\[center\\]([^\\[]*)\\[/center\\]' => '
\\1
', '\\[right\\]([^\\[]*)\\[/right\\]' => '
\\1
', '\\[left\\]([^\\[]*)\\[/left\\]' => '
\\1
', '\\[c1\\:([^\\[]*)\\]([^\\[]*)\\[c2\\:([^\\[]*)\\]([^\\[]*)\\[c3\\]' => '
\\2\\4
' ); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } return(substr($text,1)); } /* ------------------ */ function sed_bbcode_autourls($text) { global $usr; if ($usr['maingrp']>0) { $text = ' '.$text; $text = preg_replace("#([\n ])([a-z0-9]+?)://([^\t \n\r]+)#i", "\\1[url]\\2://\\3[/url]", $text); $text = preg_replace("#([\n ])([a-z0-9-_.]+?@[A-z0-9-]+\.[^,\t \n\r]+)#i", "\\1[email]\\2[/email]", $text); return(substr($text,1)); } else { $text = ' '.$text; $text = preg_replace("#([\n ])([a-z0-9]+?)://([^\t \n\r]+)#i", " Linkleri görebilmek için ÜYE olmalısınız.", $text); $text = preg_replace("#\[url([^\t \n\r]+)#i", " Linkleri görebilmek için ÜYE olmalısınız.", $text); $text = preg_replace("#([\n ])([a-z0-9-_.]+?@[A-z0-9-]+\.[^,\t \n\r]+)#i", "\\1[email]\\2[/email]", $text); return(substr($text,1)); } } /* ------------------ */ function sed_bbcode_urls($text) { global $cfg; $bbcodes = array( '\\[img\\]([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\[/img\\]' => '\\1.\\2', '\\[thumb=([^\\\'\;\?([]*)\.(jpg|jpeg|gif|png)\\]([^\\[]*)\.(jpg|jpeg|gif|png)\\[/thumb\\]' => '\\1.\\2', '\\[pfs]([^\\[]*)\\[/pfs\\]' => $cfg['pfs_dir'].'\\1', ); foreach($bbcodes as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode,$bbcodehtml,$text); } return($text); } /* ------------------ */ function sed_block($allowed) { if (!$allowed) { global $sys; header("Location: message.php?msg=930&".$sys['url_redirect']); exit; } return(FALSE); } /* ------------------ */ function sed_blockguests() { global $usr, $sys; if ($usr['id']<1) { header("Location: message.php?msg=930&".$sys['url_redirect']); exit; } return(FALSE); } /* ------------------ */ function sed_build_addtxt($c1, $c2) { $result = " function addtxt(text) { document.".$c1.".".$c2.".value += text; document.".$c1.".".$c2.".focus(); } "; return($result); } /* ------------------ */ function sed_build_age($birth) { global $sys; if ($birth==1) { return ('?'); } $day1 = @date('d', $birth); $month1 = @date('m', $birth); $year1 = @date('Y', $birth); $day2 = @date('d', $sys['now_offset']); $month2 = @date('m', $sys['now_offset']); $year2 = @date('Y', $sys['now_offset']); $age = ($year2-$year1)-1; if ($month1<$month2 || ($month1==$month2 && $day1<=$day2)) { $age++; } if($age < 0) { $age += 136; } return ($age); } /* ------------------ */ function sed_build_bbcodes($c1, $c2, $title) { $result = "".$title.""; return($result); } /* ------------------ */ function sed_build_bbcodes_local($limit) { global $sed_bbcodes; reset ($sed_bbcodes); $result = '
'; while (list($i,$dat)=each($sed_bbcodes)) { $kk = 'bbcodes_'.$dat[1]; $result .= "\"\" "; } $result .= "
"; return($result); } /* ------------------ */ function sed_build_catpath($cat, $mask) { global $sed_cat, $cfg; $pathcodes = explode('.', $sed_cat[$cat]['path']); foreach($pathcodes as $k => $x) { $tmp[]= sprintf($mask, $x, $sed_cat[$x]['title']); } $result = implode(' '.$cfg['separator'].' ', $tmp); return ($result); } /* ------------------ */ function sed_build_comments($code, $url, $display) { global $db_com, $db_users, $cfg, $usr, $L, $sys; list($usr['auth_read_com'], $usr['auth_write_com'], $usr['isadmin_com']) = sed_auth('comments', 'a'); if ($cfg['disable_comments'] || !$usr['auth_read_com']) { return(array('', '', '')); } if ($display) { $ina = sed_import('ina','G','ALP'); $ind = sed_import('ind','G','INT'); if ($ina=='send' && $usr['auth_write_com']) { sed_shield_protect(); $rtext = sed_import('rtext','P','HTM'); /* == Hook for the plugins == */ $extp = sed_getextplugins('comments.send.first'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ $error_string .= (strlen($rtext)<2) ? $L['com_commenttooshort']."
" : ''; $error_string .= (strlen($rtext)>2000) ? $L['com_commenttoolong']."
" : ''; if (empty($error_string)) { $sql = sed_sql_query("INSERT INTO $db_com (com_code, com_author, com_authorid, com_authorip, com_text, com_date) VALUES ('".sed_sql_prep($code)."', '".sed_sql_prep($usr['name'])."', ".(int)$usr['id'].", '".$usr['ip']."', '".sed_sql_prep($rtext)."', ".(int)$sys['now_offset'].")"); /* == Hook for the plugins == */ $extp = sed_getextplugins('comments.send.new'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ sed_shield_update(20, "New comment"); header("Location: $url&comments=1"); exit; } } if ($ina=='delete' && $usr['isadmin_com']) { sed_check_xg(); $sql = sed_sql_query("SELECT * FROM $db_com WHERE com_id='$ind' LIMIT 1"); if ($row = sed_sql_fetchassoc($sql)) { if ($cfg['trash_comment']) { sed_trash_put('comment', $L['Comment']." #".$ind." (".$row['com_author'].")", $ind, $row); } $sql = sed_sql_query("DELETE FROM $db_com WHERE com_id='$ind'"); sed_log("Deleted comment #".$ind." in '".$code."'",'adm'); } header("Location: ".$url."&comments=1"); exit; } $error_string .= ($ina=='added') ? $L['com_commentadded']."
" : ''; $t = new XTemplate(sed_skinfile('comments')); /* == Hook for the plugins == */ $extp = sed_getextplugins('comments.main'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ $sql = sed_sql_query("SELECT c.*, u.user_avatar FROM $db_com AS c LEFT JOIN $db_users AS u ON u.user_id=c.com_authorid WHERE com_code='$code' ORDER BY com_id ASC"); if (!empty($error_string)) { $t->assign("COMMENTS_ERROR_BODY",$error_string); $t->parse("COMMENTS.COMMENTS_ERROR"); } if ($usr['auth_write_com']) { $bbcodes = ($cfg['parsebbcodecom']) ? sed_build_bbcodes("newcomment", "rtext", $L['BBcodes']) : ''; $smilies = ($cfg['parsesmiliescom']) ? sed_build_smilies("newcomment", "rtext", $L['Smilies']) : ''; $pfs = ($usr['id']>0) ? sed_build_pfs($usr['id'], "newcomment", "rtext", $L['Mypfs']) : ''; $pfs .= (sed_auth('pfs', 'a', 'A')) ? "   ".sed_build_pfs(0, "newcomment", "rtext", $L['SFS']) : ''; $post_main = "
".$bbcodes." ".$smilies." ".$pfs; } $t->assign(array( "COMMENTS_CODE" => $code, "COMMENTS_FORM_SEND" => $url."&comments=1&ina=send", "COMMENTS_FORM_AUTHOR" => $usr['name'], "COMMENTS_FORM_AUTHORID" => $usr['id'], "COMMENTS_FORM_TEXT" => $post_main, "COMMENTS_FORM_TEXTBOXER" => $post_main, "COMMENTS_FORM_BBCODES" => $bbcodes, "COMMENTS_FORM_SMILIES" => $smilies, "COMMENTS_FORM_MYPFS" => $pfs )); if ($usr['auth_write_com']) { /* == Hook for the plugins == */ $extp = sed_getextplugins('comments.newcomment.tags'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ $t->parse("COMMENTS.COMMENTS_NEWCOMMENT"); } if (sed_sql_numrows($sql)>0) { $i = 0; /* === Hook - Part1 : Set === */ $extp = sed_getextplugins('comments.loop'); /* ===== */ while ($row = sed_sql_fetcharray($sql)) { $i++; $com_author = sed_cc($row['com_author']); $com_text = sed_cc($row['com_text']); $com_admin = ($usr['isadmin_com']) ? $L['Ip'].":".sed_build_ipsearch($row['com_authorip'])."  ".$L['Delete'].":[x]" : '' ; $com_authorlink = ($row['com_authorid']>0) ? "".$com_author."" : $com_author ; $t-> assign(array( "COMMENTS_ROW_ID" => $row['com_id'], "COMMENTS_ROW_ORDER" => $i, "COMMENTS_ROW_URL" => $url."&comments=1#c".$row['com_id'], "COMMENTS_ROW_AUTHOR" => $com_authorlink, "COMMENTS_ROW_AUTHORID" => $row['com_authorid'], "COMMENTS_ROW_AVATAR" => sed_build_userimage($row['user_avatar']), "COMMENTS_ROW_TEXT" => sed_parse($com_text, $cfg['parsebbcodecom'], $cfg['parsesmiliescom'], 1), "COMMENTS_ROW_DATE" => @date($cfg['dateformat'], $row['com_date'] + $usr['timezone'] * 3600), "COMMENTS_ROW_ADMIN" => $com_admin, )); /* === Hook - Part2 : Include === */ if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ $t->parse("COMMENTS.COMMENTS_ROW"); } } else { $t-> assign(array( "COMMENTS_EMPTYTEXT" => $L['com_nocommentsyet'], )); $t->parse("COMMENTS.COMMENTS_EMPTY"); } /* == Hook for the plugins == */ $extp = sed_getextplugins('comments.tags'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ $t->parse("COMMENTS"); $res_display = $t->text("COMMENTS"); } else { $res_display = ''; } $res = "\"\""; if ($cfg['countcomments']) { $nbcomment = sed_sql_result(sed_sql_query("SELECT COUNT(*) FROM $db_com where com_code='$code'"), 0, "COUNT(*)"); $res .= " (".$nbcomment.")"; } $res .= ""; return(array($res, $res_display, $nbcomment)); } /* ------------------ */ function sed_build_country($flag) { global $sed_countries; $flag = (empty($flag)) ? '00' : $flag; $result = ''.$sed_countries[$flag].''; return($result); } /* ------------------ */ function sed_build_email($email, $hide=0) { global $L; if ($hide) { $result = $L['Hidden']; } elseif (!empty($email) && eregi('@', $email)) { $email = sed_cc($email); $result = "".$email.""; } return($result); } /* ------------------ */ function sed_build_flag($flag) { $flag = (empty($flag)) ? '00' : $flag; $result = ''; return($result); } /* ------------------ */ function sed_build_forums($sectionid, $title, $category, $link=TRUE) { global $sed_forums_str, $cfg; $pathcodes = explode('.', $sed_forums_str[$category]['path']); if ($link) { foreach($pathcodes as $k => $x) { $tmp[]= "".sed_cc($sed_forums_str[$x]['title']).""; } $tmp[]= "".sed_cc($title).""; } else { foreach($pathcodes as $k => $x) { $tmp[]= sed_cc($sed_forums_str[$x]['title']); } $tmp[]= sed_cc($title); } $result = implode(' '.$cfg['separator'].' ', $tmp); return($result); } /* ------------------ */ function sed_build_gallery($id, $c1, $c2, $title) { return("".$title.""); } /* ------------------ */ function sed_build_group($grpid) { global $sed_groups, $L; if (empty($grpid)) { $res = ''; } else { if ($sed_groups[$grpid]['hidden']) { if (sed_auth('users', 'a', 'A')) { $res = "".$sed_groups[$grpid]['title']." (".$L['Hidden'].')'; } else { $res = $L['Hidden']; } } else { $res = "".$sed_groups[$grpid]['title'].""; } } return($res); } /* ------------------ */ function sed_build_groupsms($userid, $edit=FALSE, $maingrp=0) { global $db_groups_users, $sed_groups, $L; $sql = sed_sql_query("SELECT gru_groupid FROM $db_groups_users WHERE gru_userid='$userid'"); while ($row = sed_sql_fetcharray($sql)) { $member[$row['gru_groupid']] = TRUE; } foreach($sed_groups as $k => $i) { $checked = ($member[$k]) ? "checked=\"checked\"" : ''; $checked_maingrp = ($maingrp==$k) ? "checked=\"checked\"" : ''; $readonly = (!$edit || $k==1 || $k==2 || $k==3 || ($k==5 && $userid==1)) ? "disabled=\"disabled\"" : ''; $readonly_maingrp = (!$edit || $k==1 || ($k==2 && $userid==1) || ($k==3 && $userid==1)) ? "disabled=\"disabled\"" : ''; if ($member[$k] || $edit) { if (!($sed_groups[$k]['hidden'] && !sed_auth('users', 'a', 'A'))) { $res .= " \n"; $res .= "\n"; $res .= ($k==1) ? $sed_groups[$k]['title'] : "".$sed_groups[$k]['title'].""; $res .= ($sed_groups[$k]['hidden']) ? ' ('.$L['Hidden'].')' : ''; $res .= "
"; } } } return($res); } /* ------------------ */ function sed_build_icq($text) { global $cfg; $text = sed_import($text, 'D', 'INT', 32); if ($text>0) { $text = $text." \"\""; } return($text); } /* ------------------ */ function sed_build_ipsearch($ip) { global $xk; if (!empty($ip)) { $result = "".$ip.""; } return($result); } /* ------------------ */ function sed_build_msn($msn) { if (!empty($msn) && eregi('@', $msn)) { $msn = sed_cc($msn); $result = "".$msn.""; } return($result); } /* ------------------ */ function sed_build_oddeven($number) { if ($number % 2 == 0 ) { return ('even'); } else { return ('odd'); } } /* ------------------ */ function sed_build_pfs($id, $c1, $c2, $title) { global $L, $cfg, $usr, $sed_groups; if ($cfg['disable_pfs']) { $res = ''; } else { if ($id==0) { $res = "".$title.""; } elseif ($sed_groups[$usr['maingrp']]['pfs_maxtotal']>0 && $sed_groups[$usr['maingrp']]['pfs_maxfile']>0 && sed_auth('pfs', 'a', 'R')) { $res = "".$title.""; } else { $res = ''; } } return($res); } /* ------------------ */ function sed_build_pm($user) { global $usr, $cfg, $L; $result = "\"\""; return($result); } /* ------------------ */ function sed_build_ratings($code, $url, $display) { global $db_ratings, $db_rated, $db_users, $cfg, $usr, $sys, $L; list($usr['auth_read_rat'], $usr['auth_write_rat'], $usr['isadmin_rat']) = sed_auth('ratings', 'a'); if ($cfg['disable_ratings'] || !$usr['auth_read_rat']) { return (array('','')); } $sql = sed_sql_query("SELECT * FROM $db_ratings WHERE rating_code='$code' LIMIT 1"); if ($row = sed_sql_fetcharray($sql)) { $rating_average = $row['rating_average']; $yetrated = TRUE; if ($rating_average<1) { $rating_average = 1; } elseif ($rating_average>10) { $rating_average = 10; } $rating_cntround = round($rating_average, 0); } else { $yetrated = FALSE; $rating_average = 0; $rating_cntround = 0; } $res = "\"\""; if ($display) { $ina = sed_import('ina','G','ALP'); $newrate = sed_import('newrate','P','INT'); if ($ina=='send' && $newrate>=1 && $newrate<=10 && $usr['auth_write_rat']) { /* == Hook for the plugins == */ $extp = sed_getextplugins('ratings.send.first'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ if (!$yetrated) { $sql = sed_sql_query("INSERT INTO $db_ratings (rating_code, rating_state, rating_average, rating_creationdate, rating_text) VALUES ('".sed_sql_prep($code)."', 0, ".(int)$newrate.", ".(int)$sys['now_offset'].", '') "); } $sql = sed_sql_query("INSERT INTO $db_rated (rated_code, rated_userid, rated_value) VALUES ('".sed_sql_prep($code)."', ".(int)$usr['id'].", ".(int)$newrate.")"); $sql = sed_sql_query("SELECT COUNT(*) FROM $db_rated WHERE rated_code='$code'"); $rating_voters = sed_sql_result($sql, 0, "COUNT(*)"); $ratingnewaverage = ($rating_average * ($rating_voters - 1) + $newrate) / ( $rating_voters ); $sql = sed_sql_query("UPDATE $db_ratings SET rating_average='$ratingnewaverage' WHERE rating_code='$code'"); /* == Hook for the plugins == */ $extp = sed_getextplugins('ratings.send.done'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ header("Location: $url&ratings=1&ina=added"); exit; } $votedcasted = ($ina=='added') ? 1 : 0; $rate_form = "\"\" 1 - ".$L['rat_choice1']."
\"\" 2 - ".$L['rat_choice2']."
\"\" 3 - ".$L['rat_choice3']."
\"\" 4 - ".$L['rat_choice4']."
\"\" 5 - ".$L['rat_choice5']."
\"\" 6 - ".$L['rat_choice6']."
\"\" 7 - ".$L['rat_choice7']."
\"\" 8 - ".$L['rat_choice8']."
\"\" 9 - ".$L['rat_choice9']."
\"\" 10 - ".$L['rat_choice10']; if ($usr['id']>0) { $sql1 = sed_sql_query("SELECT rated_value FROM $db_rated WHERE rated_code='$code' AND rated_userid='".$usr['id']."' LIMIT 1"); if ($row1 = sed_sql_fetcharray($sql1)) { $alreadyvoted = TRUE; $rating_uservote = $L['rat_alreadyvoted']." (".$row1['rated_value'].")"; } } $t = new XTemplate(sed_skinfile('ratings')); /* == Hook for the plugins == */ $extp = sed_getextplugins('ratings.main'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ if (!empty($error_string)) { $t->assign("RATINGS_ERROR_BODY",$error_string); $t->parse("RATINGS.RATINGS_ERROR"); } if ($yetrated) { $sql = sed_sql_query("SELECT COUNT(*) FROM $db_rated WHERE rated_code='$code' "); $rating_voters = sed_sql_result($sql, 0, "COUNT(*)"); $rating_average = $row['rating_average']; $rating_since = $L['rat_since']." ".date($cfg['dateformat'], $row['rating_creationdate'] + $usr['timezone'] * 3600); if ($rating_average<1) { $rating_average = 1; } elseif ($ratingaverage>10) { $rating_average = 10; } $rating = round($rating_average,0); $rating_averageimg = "\"\""; $sql = sed_sql_query("SELECT COUNT(*) FROM $db_rated WHERE rated_code='$code' "); $rating_voters = sed_sql_result($sql, 0, "COUNT(*)"); } else { $rating_voters = 0; $rating_since = ''; $rating_average = $L['rat_notyetrated']; $rating_averageimg = ''; } $t->assign(array( "RATINGS_AVERAGE" => $rating_average, "RATINGS_AVERAGEIMG" => $rating_averageimg, "RATINGS_VOTERS" => $rating_voters, "RATINGS_SINCE" => $rating_since )); if ($usr['id']>0 && $votedcasted) { $t->assign(array( "RATINGS_EXTRATEXT" => $L['rat_votecasted'], )); $t->parse("RATINGS.RATINGS_EXTRA"); } elseif ($usr['id']>0 && $alreadyvoted) { $t->assign(array( "RATINGS_EXTRATEXT" => $rating_uservote, )); $t->parse("RATINGS.RATINGS_EXTRA"); } elseif ($usr['id']==0) { $t->assign(array( "RATINGS_EXTRATEXT" => $L['rat_registeredonly'], )); $t->parse("MAIN.RATINGS_EXTRA"); } elseif ($usr['id']>0 && !$alreadyvoted) { $t->assign(array( "RATINGS_NEWRATE_FORM_SEND" => $url."&ratings=1&ina=send", "RATINGS_NEWRATE_FORM_VOTER" => $usr['name'], "RATINGS_NEWRATE_FORM_RATE" => $rate_form )); $t->parse("RATINGS.RATINGS_NEWRATE"); } /* == Hook for the plugins == */ $extp = sed_getextplugins('ratings.tags'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ===== */ $t->parse("RATINGS"); $res_display = $t->text("RATINGS"); } else { $res_display = ''; } return(array($res, $res_display)); } /* ------------------ */ function sed_build_smilies($c1, $c2, $title) { $result = "".$title.""; return($result); } /* ------------------ */ function sed_build_smilies_local($limit) { global $sed_smilies; $result = '
'; if (is_array($sed_smilies)) { reset ($sed_smilies); while (list($i,$dat) = each($sed_smilies)) { $result .= "\"\" "; } } $result .= "
"; return($result); } /* ------------------ */ function sed_build_stars($level) { global $skin; if ($level>0 and $level<100) { return("\"\""); } else { return(''); } } /* ------------------ */ function sed_build_timegap($t1,$t2) { global $L; $gap = $t2 - $t1; if ($gap<=0 || !$t2 || $gap>94608000) { $result = ''; } elseif ($gap<60) { $result = $gap.' '.$L['Seconds']; } elseif ($gap<3600) { $gap = floor($gap/60); $result = ($gap<2) ? '1 '.$L['Minute'] : $gap.' '.$L['Minutes']; } elseif ($gap<86400) { $gap1 = floor($gap/3600); $gap2 = floor(($gap-$gap1*3600)/60); $result = ($gap1<2) ? '1 '.$L['Hour'].' ' : $gap1.' '.$L['Hours'].' '; if ($gap2>0) { $result .= ($gap2<2) ? '1 '.$L['Minute'] : $gap2.' '.$L['Minutes']; } } else { $gap = floor($gap/86400); $result = ($gap<2) ? '1 '.$L['Day'] : $gap.' '.$L['Days']; } return($result); } /* ------------------ */ function sed_build_timezone($tz) { global $L; $result = 'GMT'; if ($tz==-1 OR $tz==1) { $result .= $tz.' '.$L['Hour']; } elseif ($tz!=0) { $result .= $tz.' '.$L['Hours']; } return($result); } /* ------------------ */ function sed_build_url($text, $maxlen=64) { global $cfg; if (!empty($text)) { if (!eregi('http://', $text)) { $text='http://'. $text; } $text = sed_cc($text); $text = "".sed_cutstring($text, $maxlen).""; } return($text); } /* ------------------ */ function sed_build_user($id, $user) {/* Function hack by Dvdbil $Web: www.seditio-tr.com $mail: dvdbil@seditio-tr.com */ global $cfg; if (($id==0 && !empty($user))) { $result = $user; } elseif ($id==0) { $result = ''; } else { $result = (!empty($user)) ? $user : '?'; } $sql = sed_sql_query("SELECT gru_groupid FROM sed_groups_users WHERE gru_userid='$id' LIMIT 1"); $row = sed_sql_fetcharray($sql); if ($row['gru_groupid']==5) { $result = "".$result.""; } elseif ($row['gru_groupid']==6) { $result = "".$result.""; } elseif ($row['gru_groupid']==11) { $result = "".$result.""; } elseif ($row['gru_groupid']==15) { $result = "".$result.""; } elseif ($row['gru_groupid']==10) { $result = "".$result.""; } elseif ($row['gru_groupid']==12) { $result = "".$result.""; } elseif ($row['gru_groupid']==16) { $result = "".$result.""; } elseif ($row['gru_groupid']==3) { $result = "".$result.""; } else { $result = "".$user.""; } return($result); } /* ------------------ */ function sed_build_userimage($image) { if (!empty($image)) { $result = "\"\""; } return($result); } /* ------------------ */ function sed_build_usertext($text) { global $cfg; if (!$cfg['usertextimg']) { $bbcodes_img = array( '\\[img\\]([^\\[]*)\\[/img\\]' => 'No [img] !', '\\[thumb=([^\\[]*)\\[/thumb\\]' => 'No [Thumbs] !', '\\[t=([^\\[]*)\\[/t\\]' => 'No [t] !', '\\[list\\]' => '', '\\[style=([^\\[]*)\\]' => 'No styles !', '\\[quote' => 'No quotes !', '\\[code' => 'No code !' ); foreach($bbcodes_img as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode, $bbcodehtml, $text); } } if ($cfg['usertextimg_nocolors']) { $bbcodes_img = array( '\\[red\\]' => '', '\\[/red\\]' => '', '\\[white\\]' => '', '\\[/white\\]' => '', '\\[green\\]' => '', '\\[/green\\]' => '', '\\[blue\\]' => '', '\\[/blue\\]' => '', '\\[orange\\]' => '', '\\[/orange\\]' => '', '\\[yellow\\]' => '', '\\[/yellow\\]' => '', '\\[purple\\]' => '', '\\[/purple\\]' => '', '\\[black\\]' => '', '\\[/black\\]' => '', '\\[grey\\]' => '', '\\[/grey\\]' => '', '\\[pink\\]' => '', '\\[/pink\\]' => '', '\\[sky\\]' => '', '\\[/sky\\]' => '', '\\[sea\\]' => '', '\\[/sea\\]' => '', '\\[color=([^\\[]*)\\]' => 'No colors !' ); foreach($bbcodes_img as $bbcode => $bbcodehtml) { $text = eregi_replace($bbcode, $bbcodehtml, $text); } } $text = sed_cc($text); if ($cfg['parsebbcodeusertext']) { $text = sed_bbcode($text); } $text = nl2br($text); if ($cfg['parsesmiliesusertext']) { $text = sed_smilies($text); } return($text); } /* ------------------ */ function sed_cache_clear($name) { global $db_cache; $sql = sed_sql_query("DELETE FROM $db_cache WHERE c_name='$name'"); return(TRUE); } /* ------------------ */ function sed_cache_clearall() { global $db_cache; $sql = sed_sql_query("DELETE FROM $db_cache"); return(TRUE); } /* ------------------ */ function sed_cache_get($name) { global $cfg, $sys, $db_cache; if (!$cfg['cache']) { return FALSE; } $sql = sed_sql_query("SELECT c_value FROM $db_cache WHERE c_name='$name' AND c_expire>'".$sys['now']."'"); if ($row = sed_sql_fetcharray($sql)) { return(unserialize($row['c_value'])); } else { return(FALSE); } } /* ------------------ */ function sed_cache_getall($auto="1") { global $cfg, $sys, $db_cache; if (!$cfg['cache']) { return FALSE; } $sql = sed_sql_query("DELETE FROM $db_cache WHERE c_expire<'".$sys['now']."'"); if ($auto) { $sql = sed_sql_query("SELECT c_name, c_value FROM $db_cache WHERE c_auto=1"); } else { $sql = sed_sql_query("SELECT c_name, c_value FROM $db_cache"); } if (sed_sql_numrows($sql)>0) { return($sql); } else { return(FALSE); } } /* ------------------ */ function sed_cache_store($name,$value,$expire,$auto="1") { global $db_cache, $sys, $cfg; if (!$cfg['cache']) { return(FALSE); } $sql = sed_sql_query("REPLACE INTO $db_cache (c_name, c_value, c_expire, c_auto) VALUES ('$name', '".sed_sql_prep(serialize($value))."', '".($expire + $sys['now'])."', '$auto')"); return(TRUE); } /* ------------------ */ function sed_cc($text) { // modified by dvdbil | seditio-tr.com $text = preg_replace('/&#([0-9]{2,4});/is','&#$1;',$text); $text = str_replace( array('%3C', '<', '{', '<', '>' , '$', '\'', '"', '\\', '&', ' '), array(' ', ' ', '{', '<', '>', '$', ''', '"', '\', '&amp;', '&nbsp;'), $text); return($text); } /* ------------------ */ function sed_check_xg() { global $xg, $cfg; if ($xg!=sed_sourcekey()) { sed_diefatal('Wrong parameter in the URL.'); } return (TRUE); } /* ------------------ */ function sed_check_xp() { global $xp; $sk = sed_sourcekey(); if ($_SERVER["REQUEST_METHOD"]=='POST' && !defined('SED_AUTH')) { if ( empty($xp) || $xp!=$sk) { sed_diefatal('Wrong parameter in the URL.'); } } return ($sk); } /* ------------------ */ function sed_cutstring($res,$l) { global $cfg; $enc = strtolower($cfg['charset']); if ($enc=='utf-8') { if(mb_strlen($res)>$l) { $res = mb_substr($res, 0, ($l-3), $enc).'...'; } } else { if(strlen($res)>$l) { $res = substr($res, 0, ($l-3)).'...'; } } return($res); } /* ------------------ */ function sed_createthumb($img_big, $img_small, $small_x, $small_y, $keepratio, $extension, $filen, $fsize, $textcolor, $textsize, $bgcolor, $bordersize, $jpegquality, $dim_priority="Width") { if (!function_exists('gd_info')) { return; } global $cfg; $gd_supported = array('jpg', 'jpeg', 'png', 'gif'); switch($extension) { case 'gif': $source = imagecreatefromgif($img_big); break; case 'png': $source = imagecreatefrompng($img_big); break; default: $source = imagecreatefromjpeg($img_big); break; } $big_x = imagesx($source); $big_y = imagesy($source); if (!$keepratio) { $thumb_x = $small_x; $thumb_y = $small_y; } elseif ($dim_priority=="Width") { $thumb_x = $small_x; $thumb_y = floor($big_y * ($small_x / $big_x)); } else { $thumb_x = floor($big_x * ($small_y / $big_y)); $thumb_y = $small_y; } if ($textsize==0) { if ($cfg['th_amode']=='GD1') { $new = imagecreate($thumb_x+$bordersize*2, $thumb_y+$bordersize*2); } else { $new = imagecreatetruecolor($thumb_x+$bordersize*2, $thumb_y+$bordersize*2); } $background_color = imagecolorallocate ($new, $bgcolor[0], $bgcolor[1] ,$bgcolor[2]); imagefilledrectangle ($new, 0,0, $thumb_x+$bordersize*2, $thumb_y+$bordersize*2, $background_color); if ($cfg['th_amode']=='GD1') { imagecopyresized($new, $source, $bordersize, $bordersize, 0, 0, $thumb_x, $thumb_y, $big_x, $big_y); } else { imagecopyresampled($new, $source, $bordersize, $bordersize, 0, 0, $thumb_x, $thumb_y, $big_x, $big_y); } } else { if ($cfg['th_amode']=='GD1') { $new = imagecreate($thumb_x+$bordersize*2, $thumb_y+$bordersize*2+$textsize*3.5+6); } else { $new = imagecreatetruecolor($thumb_x+$bordersize*2, $thumb_y+$bordersize*2+$textsize*3.5+6); } $background_color = imagecolorallocate($new, $bgcolor[0], $bgcolor[1] ,$bgcolor[2]); imagefilledrectangle ($new, 0,0, $thumb_x+$bordersize*2, $thumb_y+$bordersize*2+$textsize*4+14, $background_color); $text_color = imagecolorallocate($new, $textcolor[0],$textcolor[1],$textcolor[2]); if ($cfg['th_amode']=='GD1') { imagecopyresized($new, $source, $bordersize, $bordersize, 0, 0, $thumb_x, $thumb_y, $big_x, $big_y); } else { imagecopyresampled($new, $source, $bordersize, $bordersize, 0, 0, $thumb_x, $thumb_y, $big_x, $big_y); } imagestring ($new, $textsize, $bordersize, $thumb_y+$bordersize+$textsize+1, $big_x."x".$big_y." ".$fsize."kb", $text_color); } switch($extension) { case 'gif': imagegif($new, $img_small); break; case 'png': imagepng($new, $img_small); break; default: imagejpeg($new, $img_small, $jpegquality); break; } imagedestroy($new); imagedestroy($source); return; } /* ------------------ */ function sed_die($cond=TRUE) { if ($cond) { header("Location: message.php?msg=950"); exit; } return(FALSE); } /* ------------------ */ function sed_diefatal($text='Reason is unknown.', $title='Fatal error') { global $cfg; $disp = "".$cfg['maintitle']."
"; $disp .= @date('Y-m-d H:i').'
'.$title.' : '.$text; die($disp); } /* ------------------ */ function sed_dieifdisabled($disabled) { if ($disabled) { header("Location: message.php?msg=940"); exit; } return; } /* ------------------ */ function sed_forum_prunetopics($mode, $section, $param) { global $cfg, $sys, $db_forum_topics, $db_forum_posts, $db_forum_sections, $L; $num = 0; $num1 = 0; switch ($mode) { case 'updated': $limit = $sys['now'] - ($param*86400); $sql1 = sed_sql_query("SELECT * FROM $db_forum_topics WHERE ft_sectionid='$section' AND ft_updated<'$limit' AND ft_sticky='0'"); break; case 'single': $sql1 = sed_sql_query("SELECT * FROM $db_forum_topics WHERE ft_sectionid='$section' AND ft_id='$param'"); break; } if (sed_sql_numrows($sql1)>0) { while ($row1 = sed_sql_fetchassoc($sql1)) { $q = $row1['ft_id']; if ($cfg['trash_forum']) { $sql = sed_sql_query("SELECT * FROM $db_forum_posts WHERE fp_topicid='$q' ORDER BY fp_id DESC"); while ($row = sed_sql_fetchassoc($sql)) { sed_trash_put('forumpost', $L['Post']." #".$row['fp_id']." from topic #".$q, "p".$row['fp_id']."-q".$q, $row); } } $sql = sed_sql_query("DELETE FROM $db_forum_posts WHERE fp_topicid='$q'"); $num += sed_sql_affectedrows(); if ($cfg['trash_forum']) { $sql = sed_sql_query("SELECT * FROM $db_forum_topics WHERE ft_id='$q'"); while ($row = sed_sql_fetchassoc($sql)) { sed_trash_put('forumtopic', $L['Topic']." #".$q." (no post left)", "q".$q, $row); } } $sql = sed_sql_query("DELETE FROM $db_forum_topics WHERE ft_id='$q'"); $num1 += sed_sql_affectedrows(); } $sql = sed_sql_query("DELETE FROM $db_forum_topics WHERE ft_movedto='$q'"); $sql = sed_sql_query("UPDATE $db_forum_sections SET fs_topiccount=fs_topiccount-'$num1' WHERE fs_id='$section'"); $sql = sed_sql_query("UPDATE $db_forum_sections SET fs_postcount=fs_postcount-'$num' WHERE fs_id='$section'"); $sql = sed_sql_query("UPDATE $db_forum_sections SET fs_topiccount_pruned=fs_topiccount_pruned+'$num1' WHERE fs_id='$section'"); $sql = sed_sql_query("UPDATE $db_forum_sections SET fs_postcount_pruned=fs_postcount_pruned+'$num' WHERE fs_id='$section'"); } $num1 = ($num1=='') ? '0' : $num1; return($num1); } /* ------------------ */ function sed_forum_sectionsetlast($id) { global $db_forum_topics, $db_forum_sections; $sql = sed_sql_query("SELECT ft_id, ft_lastposterid, ft_lastpostername, ft_updated, ft_title, ft_poll FROM $db_forum_topics WHERE ft_sectionid='$id' AND ft_movedto='0' and ft_mode='0' ORDER BY ft_updated DESC LIMIT 1"); $row = sed_sql_fetcharray($sql); $sql = sed_sql_query("UPDATE $db_forum_sections SET fs_lt_id=".(int)$row['ft_id'].", fs_lt_title='".sed_sql_prep($row['ft_title'])."', fs_lt_date=".(int)$row['ft_updated'].", fs_lt_posterid=".(int)$row['ft_lastposterid'].", fs_lt_postername='".sed_sql_prep($row['ft_lastpostername'])."' WHERE fs_id='$id'"); return; } /* ------------------ */ function sed_getextplugins($hook, $cond='R') { global $sed_plugins, $usr; if (is_array($sed_plugins)) { foreach($sed_plugins as $i => $k) { if ($k['pl_hook']==$hook && sed_auth('plug', $k['pl_code'], $cond)) { $extplugins[$i] = $k; } } } return ($extplugins); } /* ------------------ */ function sed_htmlmetas() { global $cfg; $contenttype = ($cfg['doctypeid']>2 && $cfg['xmlclient']) ? "application/xhtml+xml" : "text/html"; $result = " "; return ($result); } /* ------------------ */ function sed_import($name, $source, $filter, $maxlen=0, $dieonerror=FALSE) { switch($source) { case 'G': $v = $_GET[$name]; $log = TRUE; break; case 'P': $v = $_POST[$name]; $log = TRUE; if ($filter=='ARR') { return($v); } break; case 'C': $v = $_COOKIE[$name]; $log = TRUE; break; case 'D': $v = $name; $log = FALSE; break; default: sed_diefatal('Unknown source for a variable :
Name = '.$name.'
Source = '.$source.' ? (must be G, P, C or D)'); break; } if (MQGPC && ($source='G' || $source='P' || $source='C') ) { $v = stripslashes($v); } if ($v=='') { return(''); } if ($maxlen>0) { $v = substr($v, 0, $maxlen); } $pass = FALSE; $defret = NULL; $filter = ($filter=='STX') ? 'TXT' : $filter; switch($filter) { case 'INT': if (is_numeric($v)==TRUE && floor($v)==$v) { $pass = TRUE; } break; case 'NUM': if (is_numeric($v)==TRUE) { $pass = TRUE; } break; case 'TXT': $v = trim($v); if (strpos($v, '<')===FALSE) { $pass = TRUE; } else { $defret = str_replace('<', '<', $v); } break; case 'SLU': $v = trim($v); $f = preg_replace('/[^a-zA-Z0-9_=\/]/', '', $v); if ($v == $f) { $pass = TRUE; } else { $defret = ''; } break; case 'ALP': $v = trim($v); $f = sed_alphaonly($v); if ($v == $f) { $pass = TRUE; } else { $defret = $f; } break; case 'PSW': $v = trim($v); $f = sed_alphaonly($v); $f = substr($f, 0 ,32); if ($v == $f) { $pass = TRUE; } else { $defret = $f; } break; case 'HTM': $v = trim($v); $pass = TRUE; break; case 'ARR': if (TRUE) // !!!!!!!!!!! { $pass = TRUE; } break; case 'BOL': if ($v=="1" || $v=="on") { $pass = TRUE; $v = "1"; } elseif ($v=="0" || $v=="off") { $pass = TRUE; $v = "0"; } else { $defret = "0"; } break; case 'LVL': if (is_numeric($v)==TRUE && $v>=0 && $v<=100 && floor($v)==$v) { $pass = TRUE; } else { $defret = NULL; } break; case 'NOC': $pass = TRUE; break; default: sed_diefatal('Unknown filter for a variable :
Var = '.$cv_v.'
Filter = '.$filter.' ?'); break; } if ($pass) { return($v); } else { if ($log) { sed_log_sed_import($source, $filter, $name, $v); } if ($dieonerror) { sed_diefatal('Wrong input.'); } else { return($defret); } } } /* ------------------ */ function sed_infoget($file, $limiter='SED', $maxsize=32768) { $result = array(); if ($fp = @fopen($file, 'r')) { $limiter_begin = "[BEGIN_".$limiter."]"; $limiter_end = "[END_".$limiter."]"; $data = fread($fp, $maxsize); $begin = strpos($data, $limiter_begin); $end = strpos($data, $limiter_end); if ($end>$begin && $begin>0) { $lines = substr($data, $begin+8+strlen($limiter), $end-$begin-strlen($limiter)-8); $lines = explode ("\n",$lines); foreach ($lines as $k => $line) { $linex = explode ("=", $line); $ii=1; while (!empty($linex[$ii])) { $result[$linex[0]] .= trim($linex[$ii]); $ii++; } } } else { $result['Error'] = 'Warning: No tags found in '.$file; } } else { $result['Error'] = 'Error: File '.$file.' is missing!'; } @fclose($fp); return ($result); } /* ------------------ */ function sed_javascript($more='') { $result = ""; return ($result); } /* ------------------ */ function sed_loadbbcodes() { global $location; $result = array(); $result[]=array('[b][/b]','bold'); $result[]=array('[u][/u]','underline'); $result[]=array('[i][/i]','italic'); $result[]=array('[left][/left]','left'); $result[]=array('[center][/center]','center'); $result[]=array('[right][/right]','right'); $result[]=array('[_]','spacer'); $result[]=array('[code][/code]','code'); $result[]=array('[quote][/quote]','quote'); $result[]=array('\n[list]1\n2\n3\[/list]','list'); $result[]=array('[t=thumbnail]fullsize[/t]','thumb'); $result[]=array('[img][/img]','image'); $result[]=array('[colleft][/colleft]','colleft'); $result[]=array('[colright][/colright]','colright'); $result[]=array('[url][/url]','url'); $result[]=array('[url=][/url]','urlp'); $result[]=array('[email][/email]','email'); $result[]=array('[email=][/email]','emailp'); $result[]=array('[user=][/user]','user'); $result[]=array('[page=][/page]','page'); $result[]=array('[link=][/link]','link'); $result[]=array('[p][/p]','p'); $result[]=array('[ac=][/ac]','ac'); $result[]=array('[topic=][/topic]','topic'); $result[]=array('[post=][/post]','post'); $result[]=array('[black][/black]','black'); $result[]=array('[grey][/grey]','grey'); $result[]=array('[sea][/sea]','sea'); $result[]=array('[blue][/blue]','blue'); $result[]=array('[sky][/sky]','sky'); $result[]=array('[green][/green]','green'); $result[]=array('[yellow][/yellow]','yellow'); $result[]=array('[orange][/orange]','orange'); $result[]=array('[red][/red]','red'); $result[]=array('[white][/white]','white'); $result[]=array('[pink][/pink]','pink'); $result[]=array('[purple][/purple]','purple'); $result[]=array('[hr]','hr'); $result[]=array('[f][/f]','flag'); $result[]=array('[style=1][/style]','style1'); $result[]=array('[style=2][/style]','style2'); $result[]=array('[style=3][/style]','style3'); $result[]=array('[style=4][/style]','style4'); $result[]=array('[style=5][/style]','style5'); $result[]=array('[style=6][/style]','style6'); $result[]=array('[style=7][/style]','style7'); $result[]=array('[style=8][/style]','style8'); $result[]=array('[style=9][/style]','style9'); if ($location=='Pages') { $result[]=array('[newpage]\n[title]...[/title]','multipages'); } elseif ($location=='Newstopic') { $result[]=array('[more]','more'); } return($result); } /* ------------------ */ function sed_load_structure() { global $db_structure, $cfg, $L; $res = array(); $sql = sed_sql_query("SELECT * FROM $db_structure ORDER BY structure_path ASC"); while ($row = sed_sql_fetcharray($sql)) { if (!empty($row['structure_icon'])) { $row['structure_icon'] = "\"\""; } $path2 = strrpos($row['structure_path'], '.'); $row['structure_tpl'] = (empty($row['structure_tpl'])) ? $row['structure_code'] : $row['structure_tpl']; if ($path2>0) { $path1 = substr($row['structure_path'],0,($path2)); $path[$row['structure_path']] = $path[$path1].'.'.$row['structure_code']; $tpath[$row['structure_path']] = $tpath[$path1].' '.$cfg['separator'].' '.$row['structure_title']; $row['structure_tpl'] = ($row['structure_tpl']=='same_as_parent') ? $parent_tpl : $row['structure_tpl']; } else { $path[$row['structure_path']] = $row['structure_code']; $tpath[$row['structure_path']] = $row['structure_title']; } $order = explode('.',$row['structure_order']); $parent_tpl = $row['structure_tpl']; $res[$row['structure_code']] = array ( 'path' => $path[$row['structure_path']], 'tpath' => $tpath[$row['structure_path']], 'rpath' => $row['structure_path'], 'tpl' => $row['structure_tpl'], 'title' => $row['structure_title'], 'desc' => $row['structure_desc'], 'icon' => $row['structure_icon'], 'group' => $row['structure_group'], 'order' => $order[0], 'way' => $order[1] ); } return($res); } /* ------------------ */ function sed_load_forum_structure() { global $db_forum_structure, $cfg, $L; $res = array(); $sql = sed_sql_query("SELECT * FROM $db_forum_structure ORDER BY fn_path ASC"); while ($row = sed_sql_fetcharray($sql)) { if (!empty($row['fn_icon'])) { $row['fn_icon'] = "\"\""; } $path2 = strrpos($row['fn_path'], '.'); $row['fn_tpl'] = (empty($row['fn_tpl'])) ? $row['fn_code'] : $row['fn_tpl']; if ($path2>0) { $path1 = substr($row['fn_path'],0,($path2)); $path[$row['fn_path']] = $path[$path1].'.'.$row['fn_code']; $tpath[$row['fn_path']] = $tpath[$path1].' '.$cfg['separator'].' '.$row['fn_title']; $row['fn_tpl'] = ($row['fn_tpl']=='same_as_parent') ? $parent_tpl : $row['fn_tpl']; } else { $path[$row['fn_path']] = $row['fn_code']; $tpath[$row['fn_path']] = $row['fn_title']; } $parent_tpl = $row['fn_tpl']; $res[$row['fn_code']] = array ( 'path' => $path[$row['fn_path']], 'tpath' => $tpath[$row['fn_path']], 'rpath' => $row['fn_path'], 'tpl' => $row['fn_tpl'], 'title' => $row['fn_title'], 'desc' => $row['fn_desc'], 'icon' => $row['fn_icon'], 'defstate' => $row['fn_defstate'] ); } return($res); } /* ------------------ */ function sed_log($text, $group='def') { global $db_logger, $sys, $usr, $_SERVER; $sql = sed_sql_query("INSERT INTO $db_logger (log_date, log_ip, log_name, log_group, log_text) VALUES (".(int)$sys['now_offset'].", '".$usr['ip']."', '".sed_sql_prep($usr['name'])."', '$group', '".sed_sql_prep($text.' - '.$_SERVER['REQUEST_URI'])."')"); return; } /* ------------------ */ function sed_log_sed_import($s, $e, $v, $o) { $text = "A variable type check failed, expecting ".$s."/".$e." for '".$v."' : ".$o; sed_log($text, 'sec'); return; } /* ------------------ */ function sed_mail($fmail, $subject, $body, $headers='') { global $cfg; if(empty($fmail)) { return(FALSE); } else { $headers = (empty($headers)) ? "From: \"".$cfg['maintitle']."\" <".$cfg['adminemail'].">\n"."Reply-To: <".$cfg['adminemail'].">\n"."Content-Type: text/plain; charset=".$cfg['charset']."\n" : $headers; $body .= "\n\n".$cfg['maintitle']." - ".$cfg['mainurl']."\n".$cfg['subtitle']; mail($fmail, $subject, $body, $headers); sed_stat_inc('totalmailsent'); return(TRUE); } } /* ------------------ */ function sed_mktime($hour = false, $minute = false, $second = false, $month = false, $date = false, $year = false) { // Code from http://www.php.net/date // Author rickenmeer at hotmail dot com // 12-Jan-2004 12:30 if ($hour === false) $hour = Date ('G'); if ($minute === false) $minute = Date ('i'); if ($second === false) $second = Date ('s'); if ($month === false) $month = Date ('n'); if ($date === false) $date = Date ('j'); if ($year === false) $year = Date ('Y'); if ($year >= 1970) return mktime ($hour, $minute, $second, $month, $date, $year); $m_days = Array (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if ($year % 4 == 0 && ($year % 100 > 0 || $year % 400 == 0)) { $m_days[1] = 29; } $d_year = 1970 - $year; $days = 0 - $d_year * 365; $days -= floor ($d_year / 4); $days += floor (($d_year - 70) / 100); $days -= floor (($d_year - 370) / 400); for ($i = 1; $i < $month; $i++) { $days += $m_days [$i - 1]; } $days += $date - 1; $stamp = $days * 86400; $stamp += $hour * 3600; $stamp += $minute * 60; $stamp += $second; return $stamp; } /* ------------------ */ function sed_outputfilters($output) { global $cfg; /* === Hook === */ $extp = sed_getextplugins('output'); if (is_array($extp)) { foreach($extp as $k => $pl) { include('plugins/'.$pl['pl_code'].'/'.$pl['pl_file'].'.php'); } } /* ==== */ $output = str_replace('', '', $output); $output = str_replace('', sed_xp().'', $output); return($output); } function sed_parse($text, $parse_bbcodes=TRUE, $parse_smilies=TRUE, $parse_newlines=TRUE) { global $sys, $sed_smilies, $L; $text = ' '.$text; $code = array(); $unique_seed = $sys['unique']; $ii = 10000; if ($parse_bbcodes) { $p1 = 1; $p2 = 1; while ($p1>0 && $p2>0 && $ii<10031) { $ii++; $p1 = strpos($text, '[code]'); $p2 = strpos($text, '[/code]'); if ($p2>$p1 && $p1>0) { $key = '**'.$ii.$unique_seed.'**'; $code[$key]= substr ($text, $p1+6, ($p2-$p1)-6); $code_len = strlen($code[$key])+13; $code[$key] = str_replace('\t','   ', $code[$key]); $code[$key] = str_replace(' ', '  ', $code[$key]); $code[$key] = str_replace(' ', '  ', $code[$key]); $code[$key] = str_replace( array('{', '<', '>' , '\'', '"', "