//$GLOBALS['baseUrl'] = "http://localhost/PHP/web/smiling-dolphin";
//$GLOBALS['baseDir'] = "D:\WebDir\PHP\web\smiling-dolphin";
$GLOBALS['baseUrl'] = "http://www.smiling-dolphin.com";
$GLOBALS['baseDir'] = "/home/sloki/user/t95902/sites/smiling-dolphin.com/www/";
$GLOBALS['baseUrlBaby'] = "http://www.smiling-dolphin.com/baby";
$GLOBALS['baseDirBaby'] = "/home/sloki/user/t95902/sites/smiling-dolphin.com/www/baby";
?>
$con = mysqli_connect("localhost","t95902_","blu3d0lphin5");
$db = mysqli_select_db("t95902_myweb",$con);
//$con = mysql_connect("localhost","","");
//$db = mysql_select_db("my_web",$con);
//$gloUrl = "http://localhost:8008/PHP/web/smiling-dolphin";
?>
function include_get_content($file)
{
ob_start();
require($file);
$output = ob_get_contents();
ob_end_clean();
return $output;
}
function getMonth($bln)
{
$nbulan[1]="Jan";
$nbulan[2]="Feb";
$nbulan[3]="Mar";
$nbulan[4]="Apr";
$nbulan[5]="May";
$nbulan[6]="Jun";
$nbulan[7]="Jul";
$nbulan[8]="Aug";
$nbulan[9]="Sep";
$nbulan[10]="Oct";
$nbulan[11]="Nov";
$nbulan[12]="Dec";
$bln = intval($bln);
return $nbulan[$bln];
}
function replaceSmiley($string)
{
global $baseUrl, $baseDir;
$string = html_entity_decode($string);
$content = str_replace("[:-)]", "", $string);
$content = str_replace("[:-p]", "", $content);
$content = str_replace(":p", "", $content);
$content = str_replace("[;-)]", "", $content);
$content = str_replace("[:-@]", "", $content);
$content = str_replace("[|-/]", "", $content);
$content = str_replace("[:'-|]", "", $content);
$content = str_replace("[:-D]", "", $content);
$content = str_replace(":D", "", $content);
$content = str_replace("[:-S]", "", $content);
$content = str_replace("[:-O]", "", $content);
$content = str_replace("[(F)]", "", $content);
$content = str_replace("[:-|]", "", $content);
$content = str_replace("^:)^", "", $content);
$content = str_replace(":$", "", $content);
$content = str_replace(":*", "", $content);
$content = str_replace("<:-P", "", $content);
$content = str_replace("[-(", "", $content);
return $content;
}
function getUrlFormat($text)
{
$text = strtolower($text);
$text = str_replace('^o^', '', $text);
$text = str_replace('^', '', $text);
$text = str_replace('.', ' ', $text);
$text = str_replace('!', '', $text);
$text = str_replace('?', '', $text);
$text = trim($text);
$patterns = array ('/ /','/,/','/-/','/:/','/@/','/&/','/\'/');
$replace = array ('_','','_','','','','');
$text = preg_replace($patterns, $replace, $text);
return $text;
}
function getPageTitleMenu($menu,$id,$subMenu=NULL)
{
global $con, $db;
if($id)
{
switch($menu)
{
case "book":
$title = "Book Reviews » ";
$SQL = "SELECT title FROM ms_books WHERE id='$id'";
break;
case "film":
$title = "Film Reviews » ";
$SQL = "SELECT title FROM ms_films WHERE id='$id'";
break;
case "p_love":
$title = "Love Poetry » ";
$SQL = "SELECT title FROM poet_love WHERE Id='$id'";
break;
case "p_life":
$title = "Life Poetry » ";
$SQL = "SELECT title FROM poet_life WHERE Id='$id'";
break;
case "p_friend":
$title = "Friendship Poetry » ";
$SQL = "SELECT title FROM poet_friendship WHERE Id='$id'";
break;
case "blog":
$title = "Vini's Blog » ";
$SQL = "SELECT title FROM blog WHERE Id='$id'";
break;
/* case "db":
if(!$submenu) $submenu = "javel_db";
$SQL = "SELECT title FROM ".$submenu." WHERE Id='$id'";
break; */
case "portfolio":
$title = "Vini's Portfolio » ";
$SQL = "SELECT judul AS title FROM bio_portfolio WHERE Id='$id'";
break;
}
if($SQL)
{
$q = mysql_query($SQL);
$d = mysql_fetch_array($q);
$title .= $d["title"];
}
return $title;
}
}
function showPaging($currPage=1, $rowsPerPage=5, $maxtotalpage=8, $rowCount, $totalPage, $url)
{
//Paging .....
$showstart = floor(($currPage-1)/$maxtotalpage) * $maxtotalpage + 1;
$buffPage = "Page : ";
if ((($showstart-1)*$rowsPerPage) > 1) {
$buffPage .= "« Prev ".$maxtotalpage." | ";
}
for ($i=$showstart,$j=1; $i <= $totalPage && ($j <= $maxtotalpage);$i++)
{
if($j>1) $buffPage .= "- ";
if ($i == $currPage)
{
if($i == 1)
$buffPage .= "".$i." ";
else
$buffPage .= "".$i." ";
}
else
{
if($i == 1)
$buffPage .= "".$i." ";
else
$buffPage .= "".$i." ";
}
$j++;
}
$next = $totalPage > $maxtotalpage ? $maxtotalpage : $totalPage;
if ((($i-1)*$rowsPerPage) < $rowCount) {
$buffPage .= "| Next ".$maxtotalpage." » ";
}
return $buffPage;
}
?>