This commit has been accessed 317 times via Git panel.
commit eb597ce52ad6f1781c2b1b5a9187c64d31de4845
tree 0b26a8594f42e9afdd43cf7c1c7c44de372508bb
parent d7adfb7e10d7ebffcdcd53250fc22e79bcaa3317
author Magie Antonio <magie@majcms.org> 1309777669 +0800
committer Magie Antonio <magie@majcms.org> 1309777669 +0800
Clean up core.php
diff --git a/core.php b/core.php
index ea49474..d0313de 100644
--- a/core.php
+++ b/core.php
@@ -11,6 +11,24 @@ if (isset($maj_logged_in_username) and ($_SESSION['user_agent'] != $_SERVER['HTT
header("Location: login.php");
}
+if (get_magic_quotes_gpc()) {
+
+ function stripslashes_array($data) {
+
+ if (is_array($data)) {
+
+ foreach ($data as $key => $value) {
+ $data[$key] = stripslashes_array($value);
+ }
+ return $data;
+ }
+ else {
+ return stripslashes($data);
+ }
+ }
+ $_REQUEST = stripslashes_array($_REQUEST);
+}
+
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
$maj_req_entry = trim($_REQUEST['entry']);
}
@@ -52,10 +70,10 @@ else {
}
if (file_exists("data/increase.txt")) {
- $maj_increase = file_get_contents("data/increase.txt");
+ $increase = file_get_contents("data/increase.txt");
}
else {
- $maj_increase = 5;
+ $increase = 5;
}
if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
@@ -74,7 +92,7 @@ $maj_wtable = $maj_wspace + $maj_wside + $maj_wspace + $maj_wmain + $maj_wspace
$maj_default_blog_title = "My Activity Journal";
$maj_default_username = "maj";
$maj_default_password = "php";
-$maj_default_blog_profile = 'This cool site is powered by My Activity Journal (<a href="http://majcms.org/" target="_maj">MAJ</a>), a simple <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://opensource.org/" target="_maj">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.';
+$maj_default_blog_profile = "This cool site is powered by My Activity Journal (<a href=\"http://majcms.org/\" target=\"_maj\">MAJ</a>), a simple <a href=\"http://php.net/\" target=\"_maj\">PHP</a>-based, <a href=\"http://opensource.org/\" target=\"_maj\">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.";
$maj_default_blog_author = "My Activity Journal";
if (!file_exists("data")) {
@@ -121,285 +139,309 @@ if (!file_exists("data/author.txt")) {
fclose($maj_fp_default_author_txt);
}
-function str_rand($maj_length = 8,$maj_seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
- $maj_str = '';
- $maj_seeds_count = strlen($maj_seeds);
+function str_rand($length=8,$seeds="abcdefghijklmnopqrstuvwxyz0123456789") {
+
+ $str = "";
+ $count = strlen($seeds);
- list($maj_usec,$maj_sec) = explode(' ',microtime());
- $maj_seed = (float) $maj_sec + ((float) $maj_usec * 100000);
- mt_srand($maj_seed);
+ list($usec,$sec) = explode(" ",microtime());
+
+ $seed = (float) $sec + ((float) $usec * 100000);
+
+ mt_srand($seed);
- for ($maj_i = 0; $maj_length > $maj_i; $maj_i++) {
- $maj_str .= $maj_seeds{mt_rand(0,$maj_seeds_count - 1)};
+ for ($i=0; $length>$i; $i++) {
+ $str .= $seeds{mt_rand(0,$count - 1)};
}
- return $maj_str;
+ return $str;
}
+
+function rmdirr($dir) {
- // 20100729 - aggregate recurring functions
-
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
- } //foreach ($data as $key => $value)
- return $data;
- } //if (is_array($data))
- else {
- return stripslashes($data);
- } //else
- } //function stripslashes_array($data)
- $_REQUEST = stripslashes_array($_REQUEST);
- } //if (get_magic_quotes_gpc())
-
-
- function rmdirr($dir) {
- if (!file_exists($dir)) {
- return false;
- } //if (!file_exists($dir))
+ if (!file_exists($dir)) {
+ return false;
+ }
- if (is_file($dir)) {
- return unlink($dir);
- } //if (is_file($dir))
+ if (is_file($dir)) {
+ return unlink($dir);
+ }
- $recurse = dir($dir);
+ $recurse = dir($dir);
- while (false !== $entry = $recurse->read()) {
- if ($entry == '.' || $entry == '..') {
- continue;
- } //if ($entry == '.' || $entry == '..')
-
- rmdirr("$dir/$entry");
- } //while (false !== $entry = $recurse->read())
+ while (false !== $entry = $recurse->read()) {
+
+ if ($entry == "." || $entry == "..") {
+ continue;
+ }
+ rmdirr("$dir/$entry");
+ }
- $recurse->close();
- return rmdir($dir);
- } //function rmdirr($dir)
-
+ $recurse->close();
+ return rmdir($dir);
+}
- function return_bytes($val) {
- $val = trim($val);
- $last = $val{strlen($val) - 1};
+function return_bytes($val) {
+
+ $val = trim($val);
+ $last = $val{strlen($val) - 1};
- switch ($last) {
- case 'k':
- case 'K':
- return(int)$val * 1024;
- break;
- case 'm':
- case 'M':
- return(int)$val * 1048576;
- break;
- default:
- return $val;
- } //switch ($last)
- } //function return_bytes($val)
-
+ switch ($last) {
+ case 'k':
+ case 'K':
+ return(int)$val * 1024;
+ break;
+ case 'm':
+ case 'M':
+ return(int)$val * 1048576;
+ break;
+ default:
+ return $val;
+ }
+}
- function entry2date($entry) {
- $entry_year = substr($entry, 0, 4);
- $entry_month = substr($entry, 4, 2);
- $entry_day = substr($entry, 6, 2);
- $entry_hour = substr($entry, 8, 2);
- $entry_min = substr($entry, 10, 2);
- $entry_sec = substr($entry, 12, 2);
+function entry2date($entry) {
+
+ $year = substr($entry, 0, 4);
+ $month = substr($entry, 4, 2);
+ $day = substr($entry, 6, 2);
+ $hour = substr($entry, 8, 2);
+ $min = substr($entry, 10, 2);
+ $sec = substr($entry, 12, 2);
- echo date("l, M j, Y, g:i A", mktime($entry_hour, $entry_min, $entry_sec, $entry_month, $entry_day, $entry_year));
- } //function entry2date($entry)
+ echo date("l, M j, Y, g:i A", mktime($hour, $min, $sec, $month, $day, $year));
+}
-
- function reformat_html($data) {
- $store_0 = split("<html>", $data);
- $data = "";
- $data .= $store_0[0];
+function reformat_html($data) {
+
+ $store_0 = split("<html>", $data);
+ $data = "";
+ $data .= $store_0[0];
- foreach ($store_0 as $item_0 => $ref_0) {
- if (eregi("</html>", $ref_0)) {
- $store_1 = split("</html>", $ref_0);
- $store_1[0] = eregi_replace("\n", "", $store_1[0]);
+ foreach ($store_0 as $item_0 => $ref_0) {
+
+ if (eregi("</html>", $ref_0)) {
+
+ $store_1 = split("</html>", $ref_0);
+ $store_1[0] = eregi_replace("\n", "", $store_1[0]);
- foreach ($store_1 as $item_1 => $ref_1) {
- if ($item_1 == 0)
- $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
- $data .= $ref_1;
- } //foreach ($store_1 as $item_1 => $ref_1)
- } //if (eregi("</html>", $ref_0))
- } //foreach ($store_0 as $item_0 => $ref_0)
- return $data;
- } //function reformat_html($data)
-
+ foreach ($store_1 as $item_1 => $ref_1) {
+
+ if ($item_1 == 0) {
+ $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
+ $data .= $ref_1;
+ }
+ }
+ }
+ }
+ return $data;
+}
- function reformat_code($data) {
- $store_0 = split("<code>", $data);
- $data = "";
- $data .= $store_0[0];
+function reformat_code($data) {
+
+ $store_0 = split("<code>", $data);
+ $data = "";
+ $data .= $store_0[0];
- foreach ($store_0 as $item_0 => $ref_0) {
- if (eregi("</code>", $ref_0)) {
- $store_1 = split("</code>", $ref_0);
- $store_1[0] = eregi_replace('<img src="images/smileys/crying.png" border="0">', ':((', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/frown.png" border="0">', ':(', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/lick.png" border="0">', ':P', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/smile.png" border="0">', ':)', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/wink.png" border="0">', ';)', $store_1[0]);
- $store_1[0] = htmlentities($store_1[0], ENT_NOQUOTES);
+ foreach ($store_0 as $item_0 => $ref_0) {
+
+ if (eregi("</code>", $ref_0)) {
+
+ $store_1 = split("</code>", $ref_0);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/crying.png\" border=\"0\">", ':((', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/frown.png\" border=\"0\">", ':(', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/indifferent.png\" border=\"0\">", ':|', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/laughing.png\" border=\"0\">", ':D', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/lick.png\" border=\"0\">", ':P', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/ohno.png\" border=\"0\">", ':O', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/smile.png\" border=\"0\">", ':)', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/surprised.png\" border=\"0\">", '=)', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/undecided.png\" border=\"0\">", ':\\', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/wink.png\" border=\"0\">", ';)', $store_1[0]);
+ $store_1[0] = htmlentities($store_1[0], ENT_NOQUOTES);
- foreach ($store_1 as $item_1 => $ref_1) {
- if ($item_1 == 0)
- $ref_1 = "<code>$ref_1</code>";
- $data .= $ref_1;
- } //foreach ($store_1 as $item_1 => $ref_1)
- } //if (eregi("</code>", $ref_0))
- } //foreach ($store_0 as $item_0 => $ref_0)
- return $data;
- } //function reformat_code($data)
-
-
- function format_title_put($data) {
- // 20100113 - auto-captialize title except articles, prepositions and conjunctions less tha 4 letters, and particle "to"
- $data = ucwords($data);
- $data = str_replace('<', '<', $data);
- $data = str_replace('>', '>', $data);
- $data = str_replace(' A ', ' a ', $data);
- $data = str_replace(' An ', ' an ', $data);
- $data = str_replace(' And ', ' and ', $data);
- $data = str_replace(' As ', ' as ', $data);
- $data = str_replace(' At ', ' at ', $data);
- $data = str_replace(' But ', ' but ', $data);
- $data = str_replace(' By ', ' by ', $data);
- $data = str_replace(' For ', ' for ', $data);
- $data = str_replace(' In ', ' in ', $data);
- $data = str_replace(' Of ', ' of ', $data);
- $data = str_replace(' On ', ' on ', $data);
- $data = str_replace(' Or ', ' or ', $data);
- $data = str_replace(' The ', ' the ', $data);
- $data = str_replace(' To ', ' to ', $data);
+ foreach ($store_1 as $item_1 => $ref_1) {
+
+ if ($item_1 == 0) {
+
+ $ref_1 = "<code>$ref_1</code>";
+ $data .= $ref_1;
+ }
+ }
+ }
+ }
+ return $data;
+}
+
+function format_title_put($data) {
+
+ // 20100113 - auto-captialize title except articles, prepositions and conjunctions less than 4 letters, and particle "to"
+ $data = ucwords($data);
+ $data = str_replace('<', '<', $data);
+ $data = str_replace('>', '>', $data);
+ $data = str_replace(' A ', ' a ', $data);
+ $data = str_replace(' An ', ' an ', $data);
+ $data = str_replace(' And ', ' and ', $data);
+ $data = str_replace(' As ', ' as ', $data);
+ $data = str_replace(' At ', ' at ', $data);
+ $data = str_replace(' But ', ' but ', $data);
+ $data = str_replace(' By ', ' by ', $data);
+ $data = str_replace(' For ', ' for ', $data);
+ $data = str_replace(' In ', ' in ', $data);
+ $data = str_replace(' Of ', ' of ', $data);
+ $data = str_replace(' On ', ' on ', $data);
+ $data = str_replace(' Or ', ' or ', $data);
+ $data = str_replace(' The ', ' the ', $data);
+ $data = str_replace(' To ', ' to ', $data);
- return $data;
- } //function format_title_put($data)
-
-
- function format_body_put($data) {
- $data = ucfirst($data);
- $data = str_replace("[html]", '<html>', $data);
- $data = str_replace("[/html]", '</html>', $data);
- $data = reformat_html($data);
- $data = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $data);
- $data = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $data);
- $data = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $data);
- $data = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $data);
- $data = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $data);
- $data = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $data);
- $data = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $data);
- $data = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $data);
- $data = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $data);
- $data = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $data);
- $data = str_replace('[code]', '<code>', $data);
- $data = str_replace('[/code]', '</code>', $data);
- $data = reformat_code($data);
- $data = str_replace("\n", '<br />', $data);
- $data = str_replace('[b]', '<b>', $data);
- $data = str_replace('[/b]', '</b>', $data);
- $data = str_replace('[i]', '<i>', $data);
- $data = str_replace('[/i]', '</i>', $data);
- $data = str_replace('[u]', '<u>', $data);
- $data = str_replace('[/u]', '</u>', $data);
- $data = str_replace('[strike]', '<strike>', $data);
- $data = str_replace('[/strike]', '</strike>', $data);
- $data = str_replace('[sup]', '<sup>', $data);
- $data = str_replace('[/sup]', '</sup>', $data);
- $data = str_replace('[sub]', '<sub>', $data);
- $data = str_replace('[/sub]', '</sub>', $data);
- $data = str_replace('[highlight]', '<highlight>', $data);
- $data = str_replace('[/highlight]', '</highlight>', $data);
- $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
- $data = str_replace('</highlight>', '</span>', $data);
- $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
+ return $data;
+}
+
+function format_body_put($data) {
+
+ $data = ucfirst($data);
+ $data = str_replace("[html]", '<html>', $data);
+ $data = str_replace("[/html]", '</html>', $data);
+ $data = reformat_html($data);
+ $data = str_replace(':((', "<img src=\"images/smileys/crying.png\" border=\"0\">", $data);
+ $data = str_replace(':(', "<img src=\"images/smileys/frown.png\" border=\"0\">", $data);
+ $data = str_replace(':|', "<img src=\"images/smileys/indifferent.png\" border=\"0\">", $data);
+ $data = str_replace(':D', "<img src=\"images/smileys/laughing.png\" border=\"0\">", $data);
+ $data = str_replace(':P', "<img src=\"images/smileys/lick.png\" border=\"0\">", $data);
+ $data = str_replace(':O', "<img src=\"images/smileys/ohno.png\" border=\"0\">", $data);
+ $data = str_replace(':)', "<img src=\"images/smileys/smile.png\" border=\"0\">", $data);
+ $data = str_replace('=)', "<img src=\"images/smileys/surprised.png\" border=\"0\">", $data);
+ $data = str_replace(':\\', "<img src=\"images/smileys/undecided.png\" border=\"0\">", $data);
+ $data = str_replace(';)', "<img src=\"images/smileys/wink.png\" border=\"0\">", $data);
+ $data = str_replace('[code]', '<code>', $data);
+ $data = str_replace('[/code]', '</code>', $data);
+ $data = reformat_code($data);
+ $data = str_replace("\n", '<br />', $data);
+ $data = str_replace('[b]', '<b>', $data);
+ $data = str_replace('[/b]', '</b>', $data);
+ $data = str_replace('[i]', '<i>', $data);
+ $data = str_replace('[/i]', '</i>', $data);
+ $data = str_replace('[u]', '<u>', $data);
+ $data = str_replace('[/u]', '</u>', $data);
+ $data = str_replace('[strike]', '<strike>', $data);
+ $data = str_replace('[/strike]', '</strike>', $data);
+ $data = str_replace('[sup]', '<sup>', $data);
+ $data = str_replace('[/sup]', '</sup>', $data);
+ $data = str_replace('[sub]', '<sub>', $data);
+ $data = str_replace('[/sub]', '</sub>', $data);
+ $data = str_replace('[highlight]', '<highlight>', $data);
+ $data = str_replace('[/highlight]', '</highlight>', $data);
+ $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
+ $data = str_replace('</highlight>', '</span>', $data);
+ $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
- return $data;
- } //function format_body_put($data)
-
+ return $data;
+}
- require("fpdf.php");
+require("fpdf.php");
- class PDF extends FPDF {
- var $B;
- var $I;
- var $U;
- var $HREF;
+class PDF extends FPDF {
+
+ var $B;
+ var $I;
+ var $U;
+ var $HREF;
- function PDF($orientation = 'P', $unit = 'mm', $format = 'letter') {
- $this->FPDF($orientation, $unit, $format);
- $this->B = 0;
- $this->I = 0;
- $this->U = 0;
- $this->HREF = '';
- } //function PDF($orientation = 'P', $unit = 'mm', $format = 'letter')
+ function PDF($orientation="P",$unit="mm",$format="letter") {
+
+ $this->FPDF($orientation, $unit, $format);
+ $this->B = 0;
+ $this->I = 0;
+ $this->U = 0;
+ $this->HREF = '';
+ }
- function WriteHTML($html) {
- $html = str_replace("\n", ' ', $html);
- $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
- foreach ($a as $i => $e) {
- if ($i % 2 == 0) {
- if ($this->HREF)
- $this->PutLink($this->HREF, $e);
- else
- $this->Write(5, $e);
- } //if ($i % 2 == 0)
- else {
- if ($e{0} == '/')
- $this->CloseTag(strtoupper(substr($e, 1)));
- else {
- $a2 = explode(' ', $e);
- $tag = strtoupper(array_shift($a2));
- $attr = array();
- foreach ($a2 as $v)
- if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3))
- $attr[strtoupper($a3[1])] = $a3[2];
- $this->OpenTag($tag, $attr);
- } //else
- } //else
- } //foreach ($a as $i => $e)
- } //function WriteHTML($html)
+ function WriteHTML($html) {
+
+ $html = str_replace("\n", ' ', $html);
+ $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ foreach ($a as $i => $e) {
+
+ if ($i % 2 == 0) {
+
+ if ($this->HREF) {
+ $this->PutLink($this->HREF, $e);
+ }
+ else {
+ $this->Write(5, $e);
+ }
+ }
+ else {
+ if ($e{0} == '/') {
+ $this->CloseTag(strtoupper(substr($e, 1)));
+ }
+ else {
+ $a2 = explode(' ', $e);
+ $tag = strtoupper(array_shift($a2));
+ $attr = array();
+
+ foreach ($a2 as $v) {
+
+ if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
+
+ $attr[strtoupper($a3[1])] = $a3[2];
+ $this->OpenTag($tag, $attr);
+ }
+ }
+ }
+ }
+ }
+ }
- function OpenTag($tag, $attr) {
- if ($tag == 'B' or $tag == 'I' or $tag == 'U')
- $this->SetStyle($tag, true);
- if ($tag == 'A')
- $this->HREF = $attr['HREF'];
- if ($tag == 'BR')
- $this->Ln(5);
- } //function OpenTag($tag, $attr)
+ function OpenTag($tag, $attr) {
+
+ if ($tag == 'B' or $tag == 'I' or $tag == 'U') {
+ $this->SetStyle($tag, true);
+ }
+
+ if ($tag == 'A') {
+ $this->HREF = $attr['HREF'];
+ }
+
+ if ($tag == 'BR') {
+ $this->Ln(5);
+ }
+ }
- function CloseTag($tag) {
- if ($tag == 'B' or $tag == 'I' or $tag == 'U')
- $this->SetStyle($tag, false);
- if ($tag == 'A')
- $this->HREF = '';
- } //function CloseTag($tag)
+ function CloseTag($tag) {
+
+ if ($tag == 'B' or $tag == 'I' or $tag == 'U') {
+ $this->SetStyle($tag, false);
+ }
+
+ if ($tag == 'A') {
+ $this->HREF = '';
+ }
+ }
- function SetStyle($tag, $enable) {
- $this->$tag += ($enable ? 1 : -1);
- $style = '';
- foreach (array('B', 'I', 'U') as $s)
- if ($this->$s > 0)
- $style .= $s;
- $this->SetFont('', $style);
- } //function SetStyle($tag, $enable)
+ function SetStyle($tag, $enable) {
+
+ $this->$tag += ($enable ? 1 : -1);
+ $style = '';
+
+ foreach (array('B', 'I', 'U') as $s) {
+
+ if ($this->$s > 0) {
+ $style .= $s;
+ $this->SetFont('', $style);
+ }
+ }
+ }
- function PutLink($URL, $txt) {
- $this->SetTextColor(0, 0, 255);
- $this->SetStyle('U', true);
- $this->Write(5, $txt, $URL);
- $this->SetStyle('U', false);
- $this->SetTextColor(0);
- } //function PutLink($URL, $txt)
- } //class PDF extends FPDF
+ function PutLink($URL, $txt) {
+
+ $this->SetTextColor(0, 0, 255);
+ $this->SetStyle('U', true);
+ $this->Write(5, $txt, $URL);
+ $this->SetStyle('U', false);
+ $this->SetTextColor(0);
+ }
+}
function show_maj_avatar_image($author_username,$max_img_width=80) {
tree 0b26a8594f42e9afdd43cf7c1c7c44de372508bb
parent d7adfb7e10d7ebffcdcd53250fc22e79bcaa3317
author Magie Antonio <magie@majcms.org> 1309777669 +0800
committer Magie Antonio <magie@majcms.org> 1309777669 +0800
Clean up core.php
diff --git a/core.php b/core.php
index ea49474..d0313de 100644
--- a/core.php
+++ b/core.php
@@ -11,6 +11,24 @@ if (isset($maj_logged_in_username) and ($_SESSION['user_agent'] != $_SERVER['HTT
header("Location: login.php");
}
+if (get_magic_quotes_gpc()) {
+
+ function stripslashes_array($data) {
+
+ if (is_array($data)) {
+
+ foreach ($data as $key => $value) {
+ $data[$key] = stripslashes_array($value);
+ }
+ return $data;
+ }
+ else {
+ return stripslashes($data);
+ }
+ }
+ $_REQUEST = stripslashes_array($_REQUEST);
+}
+
if (isset($_REQUEST['entry']) and !empty($_REQUEST['entry'])) {
$maj_req_entry = trim($_REQUEST['entry']);
}
@@ -52,10 +70,10 @@ else {
}
if (file_exists("data/increase.txt")) {
- $maj_increase = file_get_contents("data/increase.txt");
+ $increase = file_get_contents("data/increase.txt");
}
else {
- $maj_increase = 5;
+ $increase = 5;
}
if (file_exists("data/bb.txt") and file_exists("data/avatar.txt")) {
@@ -74,7 +92,7 @@ $maj_wtable = $maj_wspace + $maj_wside + $maj_wspace + $maj_wmain + $maj_wspace
$maj_default_blog_title = "My Activity Journal";
$maj_default_username = "maj";
$maj_default_password = "php";
-$maj_default_blog_profile = 'This cool site is powered by My Activity Journal (<a href="http://majcms.org/" target="_maj">MAJ</a>), a simple <a href="http://php.net/" target="_maj">PHP</a>-based, <a href="http://opensource.org/" target="_maj">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.';
+$maj_default_blog_profile = "This cool site is powered by My Activity Journal (<a href=\"http://majcms.org/\" target=\"_maj\">MAJ</a>), a simple <a href=\"http://php.net/\" target=\"_maj\">PHP</a>-based, <a href=\"http://opensource.org/\" target=\"_maj\">Open Source</a> content management system (CMS) that can be deployed as a blog, bulletin board (Internet forum or message board), and wiki.";
$maj_default_blog_author = "My Activity Journal";
if (!file_exists("data")) {
@@ -121,285 +139,309 @@ if (!file_exists("data/author.txt")) {
fclose($maj_fp_default_author_txt);
}
-function str_rand($maj_length = 8,$maj_seeds = 'abcdefghijklmnopqrstuvwxyz0123456789') {
- $maj_str = '';
- $maj_seeds_count = strlen($maj_seeds);
+function str_rand($length=8,$seeds="abcdefghijklmnopqrstuvwxyz0123456789") {
+
+ $str = "";
+ $count = strlen($seeds);
- list($maj_usec,$maj_sec) = explode(' ',microtime());
- $maj_seed = (float) $maj_sec + ((float) $maj_usec * 100000);
- mt_srand($maj_seed);
+ list($usec,$sec) = explode(" ",microtime());
+
+ $seed = (float) $sec + ((float) $usec * 100000);
+
+ mt_srand($seed);
- for ($maj_i = 0; $maj_length > $maj_i; $maj_i++) {
- $maj_str .= $maj_seeds{mt_rand(0,$maj_seeds_count - 1)};
+ for ($i=0; $length>$i; $i++) {
+ $str .= $seeds{mt_rand(0,$count - 1)};
}
- return $maj_str;
+ return $str;
}
+
+function rmdirr($dir) {
- // 20100729 - aggregate recurring functions
-
- if (get_magic_quotes_gpc()) {
- function stripslashes_array($data) {
- if (is_array($data)) {
- foreach ($data as $key => $value) {
- $data[$key] = stripslashes_array($value);
- } //foreach ($data as $key => $value)
- return $data;
- } //if (is_array($data))
- else {
- return stripslashes($data);
- } //else
- } //function stripslashes_array($data)
- $_REQUEST = stripslashes_array($_REQUEST);
- } //if (get_magic_quotes_gpc())
-
-
- function rmdirr($dir) {
- if (!file_exists($dir)) {
- return false;
- } //if (!file_exists($dir))
+ if (!file_exists($dir)) {
+ return false;
+ }
- if (is_file($dir)) {
- return unlink($dir);
- } //if (is_file($dir))
+ if (is_file($dir)) {
+ return unlink($dir);
+ }
- $recurse = dir($dir);
+ $recurse = dir($dir);
- while (false !== $entry = $recurse->read()) {
- if ($entry == '.' || $entry == '..') {
- continue;
- } //if ($entry == '.' || $entry == '..')
-
- rmdirr("$dir/$entry");
- } //while (false !== $entry = $recurse->read())
+ while (false !== $entry = $recurse->read()) {
+
+ if ($entry == "." || $entry == "..") {
+ continue;
+ }
+ rmdirr("$dir/$entry");
+ }
- $recurse->close();
- return rmdir($dir);
- } //function rmdirr($dir)
-
+ $recurse->close();
+ return rmdir($dir);
+}
- function return_bytes($val) {
- $val = trim($val);
- $last = $val{strlen($val) - 1};
+function return_bytes($val) {
+
+ $val = trim($val);
+ $last = $val{strlen($val) - 1};
- switch ($last) {
- case 'k':
- case 'K':
- return(int)$val * 1024;
- break;
- case 'm':
- case 'M':
- return(int)$val * 1048576;
- break;
- default:
- return $val;
- } //switch ($last)
- } //function return_bytes($val)
-
+ switch ($last) {
+ case 'k':
+ case 'K':
+ return(int)$val * 1024;
+ break;
+ case 'm':
+ case 'M':
+ return(int)$val * 1048576;
+ break;
+ default:
+ return $val;
+ }
+}
- function entry2date($entry) {
- $entry_year = substr($entry, 0, 4);
- $entry_month = substr($entry, 4, 2);
- $entry_day = substr($entry, 6, 2);
- $entry_hour = substr($entry, 8, 2);
- $entry_min = substr($entry, 10, 2);
- $entry_sec = substr($entry, 12, 2);
+function entry2date($entry) {
+
+ $year = substr($entry, 0, 4);
+ $month = substr($entry, 4, 2);
+ $day = substr($entry, 6, 2);
+ $hour = substr($entry, 8, 2);
+ $min = substr($entry, 10, 2);
+ $sec = substr($entry, 12, 2);
- echo date("l, M j, Y, g:i A", mktime($entry_hour, $entry_min, $entry_sec, $entry_month, $entry_day, $entry_year));
- } //function entry2date($entry)
+ echo date("l, M j, Y, g:i A", mktime($hour, $min, $sec, $month, $day, $year));
+}
-
- function reformat_html($data) {
- $store_0 = split("<html>", $data);
- $data = "";
- $data .= $store_0[0];
+function reformat_html($data) {
+
+ $store_0 = split("<html>", $data);
+ $data = "";
+ $data .= $store_0[0];
- foreach ($store_0 as $item_0 => $ref_0) {
- if (eregi("</html>", $ref_0)) {
- $store_1 = split("</html>", $ref_0);
- $store_1[0] = eregi_replace("\n", "", $store_1[0]);
+ foreach ($store_0 as $item_0 => $ref_0) {
+
+ if (eregi("</html>", $ref_0)) {
+
+ $store_1 = split("</html>", $ref_0);
+ $store_1[0] = eregi_replace("\n", "", $store_1[0]);
- foreach ($store_1 as $item_1 => $ref_1) {
- if ($item_1 == 0)
- $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
- $data .= $ref_1;
- } //foreach ($store_1 as $item_1 => $ref_1)
- } //if (eregi("</html>", $ref_0))
- } //foreach ($store_0 as $item_0 => $ref_0)
- return $data;
- } //function reformat_html($data)
-
+ foreach ($store_1 as $item_1 => $ref_1) {
+
+ if ($item_1 == 0) {
+ $ref_1 = "<!-- html -->$ref_1<!-- /html -->";
+ $data .= $ref_1;
+ }
+ }
+ }
+ }
+ return $data;
+}
- function reformat_code($data) {
- $store_0 = split("<code>", $data);
- $data = "";
- $data .= $store_0[0];
+function reformat_code($data) {
+
+ $store_0 = split("<code>", $data);
+ $data = "";
+ $data .= $store_0[0];
- foreach ($store_0 as $item_0 => $ref_0) {
- if (eregi("</code>", $ref_0)) {
- $store_1 = split("</code>", $ref_0);
- $store_1[0] = eregi_replace('<img src="images/smileys/crying.png" border="0">', ':((', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/frown.png" border="0">', ':(', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/indifferent.png" border="0">', ':|', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/laughing.png" border="0">', ':D', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/lick.png" border="0">', ':P', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/ohno.png" border="0">', ':O', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/smile.png" border="0">', ':)', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/surprised.png" border="0">', '=)', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/undecided.png" border="0">', ':\\', $store_1[0]);
- $store_1[0] = eregi_replace('<img src="images/smileys/wink.png" border="0">', ';)', $store_1[0]);
- $store_1[0] = htmlentities($store_1[0], ENT_NOQUOTES);
+ foreach ($store_0 as $item_0 => $ref_0) {
+
+ if (eregi("</code>", $ref_0)) {
+
+ $store_1 = split("</code>", $ref_0);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/crying.png\" border=\"0\">", ':((', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/frown.png\" border=\"0\">", ':(', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/indifferent.png\" border=\"0\">", ':|', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/laughing.png\" border=\"0\">", ':D', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/lick.png\" border=\"0\">", ':P', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/ohno.png\" border=\"0\">", ':O', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/smile.png\" border=\"0\">", ':)', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/surprised.png\" border=\"0\">", '=)', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/undecided.png\" border=\"0\">", ':\\', $store_1[0]);
+ $store_1[0] = eregi_replace("<img src=\"images/smileys/wink.png\" border=\"0\">", ';)', $store_1[0]);
+ $store_1[0] = htmlentities($store_1[0], ENT_NOQUOTES);
- foreach ($store_1 as $item_1 => $ref_1) {
- if ($item_1 == 0)
- $ref_1 = "<code>$ref_1</code>";
- $data .= $ref_1;
- } //foreach ($store_1 as $item_1 => $ref_1)
- } //if (eregi("</code>", $ref_0))
- } //foreach ($store_0 as $item_0 => $ref_0)
- return $data;
- } //function reformat_code($data)
-
-
- function format_title_put($data) {
- // 20100113 - auto-captialize title except articles, prepositions and conjunctions less tha 4 letters, and particle "to"
- $data = ucwords($data);
- $data = str_replace('<', '<', $data);
- $data = str_replace('>', '>', $data);
- $data = str_replace(' A ', ' a ', $data);
- $data = str_replace(' An ', ' an ', $data);
- $data = str_replace(' And ', ' and ', $data);
- $data = str_replace(' As ', ' as ', $data);
- $data = str_replace(' At ', ' at ', $data);
- $data = str_replace(' But ', ' but ', $data);
- $data = str_replace(' By ', ' by ', $data);
- $data = str_replace(' For ', ' for ', $data);
- $data = str_replace(' In ', ' in ', $data);
- $data = str_replace(' Of ', ' of ', $data);
- $data = str_replace(' On ', ' on ', $data);
- $data = str_replace(' Or ', ' or ', $data);
- $data = str_replace(' The ', ' the ', $data);
- $data = str_replace(' To ', ' to ', $data);
+ foreach ($store_1 as $item_1 => $ref_1) {
+
+ if ($item_1 == 0) {
+
+ $ref_1 = "<code>$ref_1</code>";
+ $data .= $ref_1;
+ }
+ }
+ }
+ }
+ return $data;
+}
+
+function format_title_put($data) {
+
+ // 20100113 - auto-captialize title except articles, prepositions and conjunctions less than 4 letters, and particle "to"
+ $data = ucwords($data);
+ $data = str_replace('<', '<', $data);
+ $data = str_replace('>', '>', $data);
+ $data = str_replace(' A ', ' a ', $data);
+ $data = str_replace(' An ', ' an ', $data);
+ $data = str_replace(' And ', ' and ', $data);
+ $data = str_replace(' As ', ' as ', $data);
+ $data = str_replace(' At ', ' at ', $data);
+ $data = str_replace(' But ', ' but ', $data);
+ $data = str_replace(' By ', ' by ', $data);
+ $data = str_replace(' For ', ' for ', $data);
+ $data = str_replace(' In ', ' in ', $data);
+ $data = str_replace(' Of ', ' of ', $data);
+ $data = str_replace(' On ', ' on ', $data);
+ $data = str_replace(' Or ', ' or ', $data);
+ $data = str_replace(' The ', ' the ', $data);
+ $data = str_replace(' To ', ' to ', $data);
- return $data;
- } //function format_title_put($data)
-
-
- function format_body_put($data) {
- $data = ucfirst($data);
- $data = str_replace("[html]", '<html>', $data);
- $data = str_replace("[/html]", '</html>', $data);
- $data = reformat_html($data);
- $data = str_replace(':((', '<img src="images/smileys/crying.png" border="0">', $data);
- $data = str_replace(':(', '<img src="images/smileys/frown.png" border="0">', $data);
- $data = str_replace(':|', '<img src="images/smileys/indifferent.png" border="0">', $data);
- $data = str_replace(':D', '<img src="images/smileys/laughing.png" border="0">', $data);
- $data = str_replace(':P', '<img src="images/smileys/lick.png" border="0">', $data);
- $data = str_replace(':O', '<img src="images/smileys/ohno.png" border="0">', $data);
- $data = str_replace(':)', '<img src="images/smileys/smile.png" border="0">', $data);
- $data = str_replace('=)', '<img src="images/smileys/surprised.png" border="0">', $data);
- $data = str_replace(':\\', '<img src="images/smileys/undecided.png" border="0">', $data);
- $data = str_replace(';)', '<img src="images/smileys/wink.png" border="0">', $data);
- $data = str_replace('[code]', '<code>', $data);
- $data = str_replace('[/code]', '</code>', $data);
- $data = reformat_code($data);
- $data = str_replace("\n", '<br />', $data);
- $data = str_replace('[b]', '<b>', $data);
- $data = str_replace('[/b]', '</b>', $data);
- $data = str_replace('[i]', '<i>', $data);
- $data = str_replace('[/i]', '</i>', $data);
- $data = str_replace('[u]', '<u>', $data);
- $data = str_replace('[/u]', '</u>', $data);
- $data = str_replace('[strike]', '<strike>', $data);
- $data = str_replace('[/strike]', '</strike>', $data);
- $data = str_replace('[sup]', '<sup>', $data);
- $data = str_replace('[/sup]', '</sup>', $data);
- $data = str_replace('[sub]', '<sub>', $data);
- $data = str_replace('[/sub]', '</sub>', $data);
- $data = str_replace('[highlight]', '<highlight>', $data);
- $data = str_replace('[/highlight]', '</highlight>', $data);
- $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
- $data = str_replace('</highlight>', '</span>', $data);
- $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
+ return $data;
+}
+
+function format_body_put($data) {
+
+ $data = ucfirst($data);
+ $data = str_replace("[html]", '<html>', $data);
+ $data = str_replace("[/html]", '</html>', $data);
+ $data = reformat_html($data);
+ $data = str_replace(':((', "<img src=\"images/smileys/crying.png\" border=\"0\">", $data);
+ $data = str_replace(':(', "<img src=\"images/smileys/frown.png\" border=\"0\">", $data);
+ $data = str_replace(':|', "<img src=\"images/smileys/indifferent.png\" border=\"0\">", $data);
+ $data = str_replace(':D', "<img src=\"images/smileys/laughing.png\" border=\"0\">", $data);
+ $data = str_replace(':P', "<img src=\"images/smileys/lick.png\" border=\"0\">", $data);
+ $data = str_replace(':O', "<img src=\"images/smileys/ohno.png\" border=\"0\">", $data);
+ $data = str_replace(':)', "<img src=\"images/smileys/smile.png\" border=\"0\">", $data);
+ $data = str_replace('=)', "<img src=\"images/smileys/surprised.png\" border=\"0\">", $data);
+ $data = str_replace(':\\', "<img src=\"images/smileys/undecided.png\" border=\"0\">", $data);
+ $data = str_replace(';)', "<img src=\"images/smileys/wink.png\" border=\"0\">", $data);
+ $data = str_replace('[code]', '<code>', $data);
+ $data = str_replace('[/code]', '</code>', $data);
+ $data = reformat_code($data);
+ $data = str_replace("\n", '<br />', $data);
+ $data = str_replace('[b]', '<b>', $data);
+ $data = str_replace('[/b]', '</b>', $data);
+ $data = str_replace('[i]', '<i>', $data);
+ $data = str_replace('[/i]', '</i>', $data);
+ $data = str_replace('[u]', '<u>', $data);
+ $data = str_replace('[/u]', '</u>', $data);
+ $data = str_replace('[strike]', '<strike>', $data);
+ $data = str_replace('[/strike]', '</strike>', $data);
+ $data = str_replace('[sup]', '<sup>', $data);
+ $data = str_replace('[/sup]', '</sup>', $data);
+ $data = str_replace('[sub]', '<sub>', $data);
+ $data = str_replace('[/sub]', '</sub>', $data);
+ $data = str_replace('[highlight]', '<highlight>', $data);
+ $data = str_replace('[/highlight]', '</highlight>', $data);
+ $data = str_replace('<highlight>', '<span style="background-color: #ffff00;">', $data);
+ $data = str_replace('</highlight>', '</span>', $data);
+ $data = preg_replace("/<([_\.0-9a-z-]+)@([0-9a-z][0-9a-z-]+)\.([_\.0-9a-z-]+)>/", '<$1@$2.$3>', $data);
- return $data;
- } //function format_body_put($data)
-
+ return $data;
+}
- require("fpdf.php");
+require("fpdf.php");
- class PDF extends FPDF {
- var $B;
- var $I;
- var $U;
- var $HREF;
+class PDF extends FPDF {
+
+ var $B;
+ var $I;
+ var $U;
+ var $HREF;
- function PDF($orientation = 'P', $unit = 'mm', $format = 'letter') {
- $this->FPDF($orientation, $unit, $format);
- $this->B = 0;
- $this->I = 0;
- $this->U = 0;
- $this->HREF = '';
- } //function PDF($orientation = 'P', $unit = 'mm', $format = 'letter')
+ function PDF($orientation="P",$unit="mm",$format="letter") {
+
+ $this->FPDF($orientation, $unit, $format);
+ $this->B = 0;
+ $this->I = 0;
+ $this->U = 0;
+ $this->HREF = '';
+ }
- function WriteHTML($html) {
- $html = str_replace("\n", ' ', $html);
- $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
- foreach ($a as $i => $e) {
- if ($i % 2 == 0) {
- if ($this->HREF)
- $this->PutLink($this->HREF, $e);
- else
- $this->Write(5, $e);
- } //if ($i % 2 == 0)
- else {
- if ($e{0} == '/')
- $this->CloseTag(strtoupper(substr($e, 1)));
- else {
- $a2 = explode(' ', $e);
- $tag = strtoupper(array_shift($a2));
- $attr = array();
- foreach ($a2 as $v)
- if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3))
- $attr[strtoupper($a3[1])] = $a3[2];
- $this->OpenTag($tag, $attr);
- } //else
- } //else
- } //foreach ($a as $i => $e)
- } //function WriteHTML($html)
+ function WriteHTML($html) {
+
+ $html = str_replace("\n", ' ', $html);
+ $a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+ foreach ($a as $i => $e) {
+
+ if ($i % 2 == 0) {
+
+ if ($this->HREF) {
+ $this->PutLink($this->HREF, $e);
+ }
+ else {
+ $this->Write(5, $e);
+ }
+ }
+ else {
+ if ($e{0} == '/') {
+ $this->CloseTag(strtoupper(substr($e, 1)));
+ }
+ else {
+ $a2 = explode(' ', $e);
+ $tag = strtoupper(array_shift($a2));
+ $attr = array();
+
+ foreach ($a2 as $v) {
+
+ if (ereg('^([^=]*)=["\']?([^"\']*)["\']?$', $v, $a3)) {
+
+ $attr[strtoupper($a3[1])] = $a3[2];
+ $this->OpenTag($tag, $attr);
+ }
+ }
+ }
+ }
+ }
+ }
- function OpenTag($tag, $attr) {
- if ($tag == 'B' or $tag == 'I' or $tag == 'U')
- $this->SetStyle($tag, true);
- if ($tag == 'A')
- $this->HREF = $attr['HREF'];
- if ($tag == 'BR')
- $this->Ln(5);
- } //function OpenTag($tag, $attr)
+ function OpenTag($tag, $attr) {
+
+ if ($tag == 'B' or $tag == 'I' or $tag == 'U') {
+ $this->SetStyle($tag, true);
+ }
+
+ if ($tag == 'A') {
+ $this->HREF = $attr['HREF'];
+ }
+
+ if ($tag == 'BR') {
+ $this->Ln(5);
+ }
+ }
- function CloseTag($tag) {
- if ($tag == 'B' or $tag == 'I' or $tag == 'U')
- $this->SetStyle($tag, false);
- if ($tag == 'A')
- $this->HREF = '';
- } //function CloseTag($tag)
+ function CloseTag($tag) {
+
+ if ($tag == 'B' or $tag == 'I' or $tag == 'U') {
+ $this->SetStyle($tag, false);
+ }
+
+ if ($tag == 'A') {
+ $this->HREF = '';
+ }
+ }
- function SetStyle($tag, $enable) {
- $this->$tag += ($enable ? 1 : -1);
- $style = '';
- foreach (array('B', 'I', 'U') as $s)
- if ($this->$s > 0)
- $style .= $s;
- $this->SetFont('', $style);
- } //function SetStyle($tag, $enable)
+ function SetStyle($tag, $enable) {
+
+ $this->$tag += ($enable ? 1 : -1);
+ $style = '';
+
+ foreach (array('B', 'I', 'U') as $s) {
+
+ if ($this->$s > 0) {
+ $style .= $s;
+ $this->SetFont('', $style);
+ }
+ }
+ }
- function PutLink($URL, $txt) {
- $this->SetTextColor(0, 0, 255);
- $this->SetStyle('U', true);
- $this->Write(5, $txt, $URL);
- $this->SetStyle('U', false);
- $this->SetTextColor(0);
- } //function PutLink($URL, $txt)
- } //class PDF extends FPDF
+ function PutLink($URL, $txt) {
+
+ $this->SetTextColor(0, 0, 255);
+ $this->SetStyle('U', true);
+ $this->Write(5, $txt, $URL);
+ $this->SetStyle('U', false);
+ $this->SetTextColor(0);
+ }
+}
function show_maj_avatar_image($author_username,$max_img_width=80) {