16
Templates & Styles (Requests & Discussions) / Re: Registertext
« on: September 24, 2009, 10:08:49 PM »
in / lang / <yourlanguage> / main.php:
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
i finish step 18 all fine and isee icon for pm in commants but when i click on it i got this error
Warning: Invalid argument supplied for foreach() in /home/arabcine/public_html/test/pm.php on line 414
//-----------------------------------------------------
//--- BBCode ------------------------------------------
//-----------------------------------------------------
$lang['code'] = "Code";
$lang['quote'] = "Quote";
$lang['wrote'] = "wrote";
$lang['close_tags'] = "Close Tags";
$lang['close_window'] = "Close Window";
$lang['all_emoticons'] = "All";
$lang['all'] = "All";
$lang['bbc_help_default'] = "Tip: Use bbcode or smilies.";
$lang['bbc_help'] = array(
"b" => "Bold: [b]text[/b] (alt+b)",
"i" => "Kursiv: [i]text[/i] (alt+i)",
"u" => "Underline: [u]text[/u] (alt+u)",
"q" => "Quote: [quote]text[/quote] or [quote=name]text[/quote] (alt+q)",
"c" => "Code: [code][list]text[/code ] (alt+c)",
"l" => "List: [list]text[/list] (alt+l)",
"o" => "Ordered list: [list=]text[/list] (alt+o)",
"p" => "Insert Image: [img]http://image_url[/img] (alt+p)",
"w" => "Insert URL: [url=http://url]http://url[/url] or [url=http://url]URL text[/url] (alt+w)",
"a" => "Close all open bbCode tags",
"sf" => "Font color: [color=red]text[color]",
"f" => "Font size: [size=x-small]small text[/size]",
"sh" => "Shadow: [shadow=red,left,1]text[/shadow]",
"g" => "Glow: [glow=red,2,1]text[/glow]",
"al" => "Align: [align=center]text[/align]",
"t" => "Teletype: [tt]text[/tt]",
"ff" => "Font face: [font=verdana]text[/font]",
"h" => "Horisontal line: [hr]",
"m" => "Move: [move]text[/move]",
"fl" => "Flash: [flash=200,200]http://URL[/flash]",
"sb" => "Subscript: [sub]text[/sub]",
"sp" => "Superscript: [sup]text[/sup]",
"s" => "Line through: [s]text[/s] (alt+s)",
"e" => "Insert email: [email]name@domain[/email] or [email=name@domain]email text[/email] (alt+e)",
"sm" => "Emoticons"
);
[/code]
now when i do http://www.????.com/test/pm.php
i got this error Fatal error: Call to undefined function format_text() in /home/arabcine/public_html/test/includes/functions.php on line 1290
what i can to do now ? please help me
//PM V2
define('PM_TABLE', $table_prefix.'pm');
define('PM_RDLT', 0); //Recipient deleted message (message only in: Sender's Setbox)
define('PM_SDLT', 1); //Sender deleted message (message only in: Recipient's Inbox)
define('PM_SENT', 2); //Recipient read message (message in: Sender's Sentbox and Recipient's Inbox)
define('PM_UNREAD', 3); //Recipient not read message (message in: Sender's Outbox and Recipient's Inbox - New Message)
define('PM_USDLT', 4);
$site_template->register_vars(array(
"home_url" => ROOT_PATH
"media_url" => MEDIA_PATH,
//-----------------------------------------------------
//--- pm ---------------------------------------------
//-----------------------------------------------------
$inbox = "";
$outbox = "";
$sentbox = "";
$newpm = "";
$pm_popup_script = "";
$pm_popup_head = "";
$pm = "";
if ($config['pm'] && $user_info['user_level'] >= USER) {
$sql = "SELECT COUNT(pm_id) AS total
FROM ".PM_TABLE."
WHERE pm_to = ".$user_info['user_id']." AND (pm_type = ".PM_SENT." OR pm_type = ".PM_SDLT." OR pm_type = ".PM_UNREAD." OR pm_type = ".PM_USDLT.")";
$result = $site_db->query_firstrow($sql);
$pm_inbox = $result['total'];
$sql = "SELECT COUNT(pm_id) AS total
FROM ".PM_TABLE."
WHERE pm_from = ".$user_info['user_id']." AND (pm_type = ".PM_UNREAD." OR pm_type = ".PM_USDLT.")";
$result = $site_db->query_firstrow($sql);
$pm_outbox = $result['total'];
$sql = "SELECT COUNT(pm_id) AS total
FROM ".PM_TABLE."
WHERE pm_from = ".$user_info['user_id']." AND (pm_type = ".PM_SENT." OR pm_type = ".PM_RDLT.")";
$result = $site_db->query_firstrow($sql);
$pm_sentbox = $result['total'];
$sql = "SELECT COUNT(pm_id) AS new
FROM ".PM_TABLE."
WHERE pm_to = ".$user_info['user_id']." AND (pm_type = ".PM_UNREAD." OR pm_type = ".PM_USDLT.")
ORDER BY pm_date DESC";
$result = $site_db->query_firstrow($sql);
$pm_new_count = $result['new'];
$sql = "SELECT pm_date
FROM ".PM_TABLE."
WHERE pm_to = ".$user_info['user_id']." AND (pm_type = ".PM_UNREAD." OR pm_type = ".PM_USDLT.")
ORDER BY pm_date DESC";
$result = $site_db->query_firstrow($sql);
$pm_new = "<a href=\"".$site_sess->url(ROOT_PATH."pm.php")."\">".(($pm_new_count) ? "<blink>".$pm_new_count."</blink>" : 0)."</a>";
$pm = preg_replace("/".$site_template->start."msg_new_count".$site_template->end."/siU", $pm_new, $lang['pm_link']);
$pm = preg_replace("/".$site_template->start."inbox".$site_template->end."/siU", "<a href=\"".$site_sess->url(ROOT_PATH."pm.php")."\">".$lang['pm_inbox']."</a>", $pm);
$blink = "<script language=\"JavaScript\">\n<!--\nvar flg=0;\nfunction blink(){\nvar myElement=document.getElementById('blnk');\nflg^=1;\nif(flg==1){\nmyElement.style.visibility='hidden';\n}\nelse{\nmyElement.style.visibility='visible';\n}\ntimerID = setTimeout( 'blink()' , 500 );\n}\n//-->\n</script>\n";
$show_inbox = ($pm_new_count) ? $blink."<span id=\"blnk\">".$lang['pm_inbox']."</span><script language=\"JavaScript\">blink();</script>" : $lang['pm_inbox'];
$inbox = "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=inbox")."\" title=\"".(($pm_new_count) ? $lang['pm_new_messages'].": ".$pm_new_count."\n" : "").$lang['pm_total'].": ".$pm_inbox."\">".$show_inbox."</a>";
$sentbox = "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=sentbox")."\" title=\"".$lang['pm_total'].": ".$pm_sentbox."\">".$lang['pm_sentbox']."</a>";
$outbox = "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=outbox")."\" title=\"".$lang['pm_total'].": ".$pm_outbox."\">".$lang['pm_outbox']."</a>";
$newpm = "<a href=\"".$site_sess->url(ROOT_PATH."pm.php?action=new")."\">".$lang['pm_new']."</a>";
if ($result && $user_info['user_pm_popup']) {
$cookie_name = (defined("COOKIE_NAME")) ? COOKIE_NAME : "4images_";
$cookie_pmnewpopup = isset($HTTP_COOKIE_VARS[$cookie_name.'pmnewpopup']) ? unserialize(stripslashes($HTTP_COOKIE_VARS[$cookie_name.'pmnewpopup'])) : 0;
if ($cookie_pmnewpopup < $result['pm_date']) {
if (ereg("pm.php", $self_url) && $action == "inbox") {
$cookie_expire = time() + 60 * 60 * 24 * 90;
setcookie($cookie_name.'pmnewpopup', serialize($result['pm_date']), $cookie_expire, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
}elseif (!ereg("pm.php", $self_url) || (ereg("pm.php", $self_url) && ($action == "sentbox" || $action == "outbox"))){
$cookie_expire = gmdate('D, d M Y H:i:s \G\M\T', time() + 60 * 60 * 24 * 90);
$pm_popup_script = " <script language=\"JavaScript\">
<!--
function SetCookie (name, value, expire, path, domain, secure) {
document.cookie = name + '=' + escape(value) + ((expire)?(';expires=' + expire):'') + ((path)?';path=' + path:'') + ((domain)?';domain=' + domain:'') + ((secure && (secure == true))?'; secure':'');
}
function confirm_newpm() {
input_box=confirm('".$lang['pm_popup_confirm']."');
if (input_box==true) { // Output when OK is clicked
second_box=confirm('".$lang['pm_popup_newwindow']."');
if (second_box==true) {
SetCookie('".$cookie_name."pmnewpopup','".serialize($result['pm_date'])."','".$cookie_expire."','".COOKIE_PATH."','".COOKIE_DOMAIN."','".COOKIE_SECURE."');
window.open('".$site_sess->url(ROOT_PATH."pm.php")."','pmnew','width=600,height=500,menubar=yes,scrollbars=yes,toolbar=yes,location=yes,directories=yes,resizable=yes,top=50,left=50');
} else {
SetCookie('".$cookie_name."pmnewpopup','".serialize($result['pm_date'])."','".$cookie_expire."','".COOKIE_PATH."','".COOKIE_DOMAIN."','".COOKIE_SECURE."');
window.location='".$site_sess->url(ROOT_PATH."pm.php")."';
}
} else {
SetCookie('".$cookie_name."pmnewpopup','".serialize($result['pm_date'])."','".$cookie_expire."','".COOKIE_PATH."','".COOKIE_DOMAIN."','".COOKIE_SECURE."');
}
}
// -->
</script>";
$pm_popup_header = " onload=\"Javascript:confirm_newpm()\"";
}
}
}
}
$site_template->register_vars(array(
"pm" => $pm,
"pm_boxes" => ($inbox) ? $inbox." | ".$sentbox." | ".$outbox." | ".$newpm : "",
"pm_inbox" => $inbox,
"pm_sentbox" => $sentbox,
"pm_outbox" => $outbox,
"pm_newpm" => $newpm,
"pm_popup_script" => $pm_popup_script,
"pm_popup_header" => $pm_popup_header,
"bbcode2" => (BBCODE == "bbcode") ? 0 : 1,
"pm_inbox_total" => ($pm_inbox) ? $pm_inbox : 0,
"pm_outbox_total" => ($pm_outbox) ? $pm_outbox : 0,
"pm_sentbox_total" => ($pm_sentbox) ? $pm_sentbox : 0,
"pm_new_total" => ($pm_new_count) ? $pm_new_count : 0,
"home_url" => ROOT_PATH,
"media_url" => MEDIA_PATH,
function format_text($text, $html = 0, $word_wrap = 0, $bbcode = 0, $bbcode_img = 0) {
if ($word_wrap && $text != "") {
$text = preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i", " \\1\n", $text);
}
if ($html == 0 || $html == 2) {
$text = safe_htmlspecialchars($text);
}
// Replace { to prevent parsing in templates
global $site_template;
$text = preg_replace(
'='.preg_quote($site_template->start).'([A-Z0-9_]+)'.preg_quote($site_template->end).'=Usi',
'{\1}',
$text
);
if ($html !== 2) {
$text = nl2br(trim($text));
$text = replace_url($text);
}
if ($bbcode == 1) {
$search_array = array(
"/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/siU",
"/(\[)(list)(])(.*)(\[\/list\])/siU",
"/(\[\*\])/siU",
"/(\[\/\*\])/siU",
"/(\[)(url)(=)(['\"]?)(www\.)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
"/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
"/(\[)(url)(])(www\.)([^\"]*)(\[\/url\])/siU",
"/(\[)(url)(])([^\"]*)(\[\/url\])/siU",
"/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/siU",
"/javascript:/si",
"/about:/si"
);
$replace_array = array(
"<ol type=\"\\5\">\\7</ol>",
"<ul>\\4</ul>",
"<li>",
"</li>",
"<a href=\"http://www.\\6\" target=\"_blank\" rel=\"nofollow\">\\8</a>",
"<a href=\"\\5\" target=\"_blank\" rel=\"nofollow\">\\7</a>",
"<a href=\"http://www.\\5\" target=\"_blank\" rel=\"nofollow\">www.\\5</a>",
"<a href=\"\\4\" target=\"_blank\" rel=\"nofollow\">\\4</a>",
"<pre>Code:<hr size=1>\\5<hr size=1></pre>",
"java script:",
"about :"
);
$text = preg_replace($search_array, $replace_array, $text);
if (!$bbcode_img) {
$text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<a href=\"\\5\" target=\"_blank\">\\5</a>", $text);
}
else {
$text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<img src=\"\\5\">", $text);
}
$text = preg_replace("/(\[)(b)(])(\r\n)*([^\"]*)(\[\/b\])/siU", "<b>\\5</b>", $text);
$text = preg_replace("/(\[)(i)(])(\r\n)*([^\"]*)(\[\/i\])/siU", "<i>\\5</i>", $text);
$text = preg_replace("/(\[)(u)(])(\r\n)*([^\"]*)(\[\/u\])/siU", "<u>\\5</u>", $text);
$text = replace_badwords($text);
}
$text = str_replace("\\'", "'", $text);
return $text;
}
/*
function format_text($text, $html = 0, $word_wrap = 0, $bbcode = 0, $bbcode_img = 0) {
if ($word_wrap && $text != "") {
$text = preg_replace("/([^\n\r ?&\.\/<>\"\\-]{".$word_wrap."})/i", " \\1\n", $text);
}
if ($html == 0 || $html == 2) {
$text = safe_htmlspecialchars($text);
}
// Replace { to prevent parsing in templates
global $site_template;
$text = preg_replace(
'='.preg_quote($site_template->start).'([A-Z0-9_]+)'.preg_quote($site_template->end).'=Usi',
'{\1}',
$text
);
if ($html !== 2) {
$text = nl2br(trim($text));
$text = replace_url($text);
}
if ($bbcode == 1) {
$search_array = array(
"/(\[)(list)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/list)(((=)(\\4)([^\"']*)(\\4]))|(\]))/siU",
"/(\[)(list)(])(.*)(\[\/list\])/siU",
"/(\[\*\])/siU",
"/(\[\/\*\])/siU",
"/(\[)(url)(=)(['\"]?)(www\.)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
"/(\[)(url)(=)(['\"]?)([^\"']*)(\\4])(.*)(\[\/url\])/siU",
"/(\[)(url)(])(www\.)([^\"]*)(\[\/url\])/siU",
"/(\[)(url)(])([^\"]*)(\[\/url\])/siU",
"/(\[)(code)(])(\r\n)*(.*)(\[\/code\])/siU",
"/javascript:/si",
"/about:/si"
);
$replace_array = array(
"<ol type=\"\\5\">\\7</ol>",
"<ul>\\4</ul>",
"<li>",
"</li>",
"<a href=\"http://www.\\6\" target=\"_blank\" rel=\"nofollow\">\\8</a>",
"<a href=\"\\5\" target=\"_blank\" rel=\"nofollow\">\\7</a>",
"<a href=\"http://www.\\5\" target=\"_blank\" rel=\"nofollow\">www.\\5</a>",
"<a href=\"\\4\" target=\"_blank\" rel=\"nofollow\">\\4</a>",
"<pre>Code:<hr size=1>\\5<hr size=1></pre>",
"java script:",
"about :"
);
$text = preg_replace($search_array, $replace_array, $text);
if (!$bbcode_img) {
$text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<a href=\"\\5\" target=\"_blank\">\\5</a>", $text);
}
else {
$text = preg_replace("/(\[)(img)(])(\r\n)*([^\"]*)(\[\/img\])/siU", "<img src=\"\\5\">", $text);
}
$text = preg_replace("/(\[)(b)(])(\r\n)*([^\"]*)(\[\/b\])/siU", "<b>\\5</b>", $text);
$text = preg_replace("/(\[)(i)(])(\r\n)*([^\"]*)(\[\/i\])/siU", "<i>\\5</i>", $text);
$text = preg_replace("/(\[)(u)(])(\r\n)*([^\"]*)(\[\/u\])/siU", "<u>\\5</u>", $text);
$text = replace_badwords($text);
}
$text = str_replace("\\'", "'", $text);
return $text;
}
*/
Thank you. It was changed since v1.7.2
I've updated the installation instructions, also I think fixed step 7.4
show_table_separator($lang['terms'], 2);
show_terms_select($lang['terms'], 'terms', $result['terms'], $lang['terms_array']);
show_terms_select($lang['terms_msg'], 'terms_msg', $result['terms_msg'], $lang['terms_agreement']);
show_table_separator($lang['terms'], 2);
show_terms_select($lang['terms'], 'terms', $cat_row['terms'], $lang['terms_array']);
show_terms_select($lang['terms_msg'], 'terms_msg', $cat_row['terms_msg'], $lang['terms_agreement']);
Hi! Is there a current HowTo to install this mod PM v2? reagrds clubsocietyIt's not working in 1.7.7
no, www.mysite.com and mysite.com are two different domains. they might point to the same server, but they are different.
add both domains in you recaptcha account.
$recaptcha_domains['test.com'] = array("Enter your public key", "Enter your private key");
if ($captcha_enable && $captcha_recaptcha
&& (isset($recaptcha_domains[$captcha_recaptcha])
|| isset($recaptcha_domains[strtolower($_SERVER["HTTP_HOST"])])))
{
$captcha_recaptcha = (isset($recaptcha_domains[$captcha_recaptcha]))
? $recaptcha_domains[$captcha_recaptcha]
: $recaptcha_domains[strtolower($_SERVER["HTTP_HOST"])];
}
else
{
$captcha_recaptcha = 0;
}
preg_match('/(?P<domain>[a-z0-9][a-z0-9\-]{1,63}\.[a-z\.]{2,6})$/', $_SERVER['HTTP_HOST'],$domaincatch);
if ($captcha_enable && $captcha_recaptcha
&& (isset($recaptcha_domains[$captcha_recaptcha])
|| isset($recaptcha_domains[strtolower($domaincatch[0])])))
{
$captcha_recaptcha = (isset($recaptcha_domains[$captcha_recaptcha]))
? $recaptcha_domains[$captcha_recaptcha]
: $recaptcha_domains[strtolower($domaincatch[0])];
}
else
{
$captcha_recaptcha = 0;
}
}