⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.php

📁 一个全功能的国外博客商业程序
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<?

// SET BLOGHOSTER VERSION
$bh_version = "1.21";

// COMPENSATE FOR NO MAGIC QUOTES
if(!@get_magic_quotes_gpc()) { 
$_GET = array_map('addslashes', $_GET); 
$_POST = array_map('addslashes', $_POST); 
$_COOKIE = array_map('addslashes', $_COOKIE); 
}

// SHOW HELP TIP
function tip($tip_id) {
global $admin_info;
$tip_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_tips WHERE tip_id='$tip_id'"));
if($admin_info[tips] == 1 & $tip_info[tip] != "") {
echo "&nbsp;<a href='#' onClick=\"var features='left='+((screen.width-400)/2)+', top='+((screen.height-300)/2)+', width=400,height=300,toolbar=0,resizable=0,scrollbars=1'; win3=window.open('../tip.php?tip_id=$tip_id','popup',features);\"><img src='../images/tip.gif' border='0'></a>";
}
}



// SHOW HELP TIP
function tip2($tip_id) {
global $admin_info;
$tip_info = mysql_fetch_assoc(mysql_query("SELECT * FROM bhost_tips WHERE tip_id='$tip_id'"));
if($admin_info[tips] == 1 & $tip_info[tip] != "") {
echo "&nbsp;<a href='#' onClick=\"var features='left='+((screen.width-400)/2)+', top='+((screen.height-300)/2)+', width=400,height=300,toolbar=0,resizable=0,scrollbars=1'; win3=window.open('tip.php?tip_id=$tip_id','popup',features);\"><img src='./images/tip.gif' border='0'></a>";
}
}


// ERROR MESSAGES
function error($id) {
global $user_info, $admin_info, $foot, $functions1, $functions2, $functions3, $functions4, $functions5, $functions6, $functions7, $functions8, $functions9, $functions10, $functions11, $functions12, $functions13, $functions14, $functions15, $functions16, $functions17, $functions18, $functions19, $functions20, $functions21, $functions22, $functions23, $functions24, $functions25, $functions26, $functions27, $functions28, $functions29, $functions30, $functions31, $functions32, $functions33, $functions34, $functions35, $functions36, $functions37, $functions38, $functions39, $functions40, $functions41, $functions42;

echo "<h2>$functions1</h2>";

if($id == 0) { $msg = "$functions2"; }
if($id == 1) { $msg = "$functions3"; }
if($id == 2) { $msg = "$functions4"; }
if($id == 3) { $msg = "$functions5"; }
if($id == 4) { $msg = "$functions6"; }
if($id == 5) { $msg = "$functions7"; }
if($id == 6) { $msg = "$functions8"; }
if($id == 7) { $msg = "$functions9"; }
if($id == 8) { $msg = "$functions10"; }
if($id == 9) { $msg = "$functions11"; }
if($id == 10) { $msg = "$functions12"; }
if($id == 11) { $msg = "$functions13"; }
if($id == 12) { $msg = "$functions14"; }
if($id == 13) { $msg = "$functions15"; }
if($id == 13) { $msg = "$functions16"; }
if($id == 14) { $msg = "$functions17"; }
if($id == 15) { $msg = "$functions18"; }
if($id == 16) { $msg = "$functions19"; }
if($id == 17) { $msg = "$functions20"; }
if($id == 18) { $msg = "$functions21"; }
if($id == 19) { $msg = "$functions22"; }
if($id == 20) { $msg = "$functions23"; }
if($id == 21) { $msg = "$functions24"; }
if($id == 22) { $msg = "$functions25"; }
if($id == 23) { $msg = "$functions26"; }
if($id == 24) { $msg = "$functions27"; }
if($id == 25) { $msg = "$functions28"; }
if($id == 26) { $msg = "$functions29"; }
if($id == 27) { $msg = "$functions30".cdate("$user_info[format_date]", time()); }
if($id == 28) { $msg = "$functions31"; }
if($id == 31) { $msg = "$functions34"; }
if($id == 32) { $msg = "$functions35"; }
if($id == 33) { $msg = "$functions36"; }
if($id == 34) { $msg = "$functions37"; }
if($id == 35) { $msg = "$functions38 ".cdate("$admin_info[signup_format_date]", time()); }


echo "$msg<br><br><input type='button' class='button' value='$functions39' onClick='history.go(-1);'>";
echo $foot;
exit();
} // END error() function







//RETURNS BEFORE, AFTER, AND BETWEEN FOR STRINGS
function before($this, $inthat) {
 return substr($inthat, 0, strpos($inthat, $this));
}

function after($this, $inthat) {
 if(!is_bool(strpos($inthat, $this))) {
  return substr($inthat, strpos($inthat,$this)+strlen($this));
 } else {
  return false;
 }
}

function between($this, $that, $inthat) {
 return before($that, after($this, $inthat));
}//END before(), after(), and between() functions


// FIND NUMBER OF OCCURRENCES OF CONTAINERS IN TEMPLATE
function occurrencecount($this, $that, $inthat, $count) {
 $newinthat = after("$that", after("$this", $inthat));
 if($newinthat != false) {
 $count = $count + 1;
 return occurrencecount($this, $that, $newinthat, $count);
 } else {
 return $count;
 }
}//END occurrencecount() function


//CHANGES TIMEZONE
function timezone($time) {

global $user_info;
$time = $time-(date("Z")-(date("I")*3600));

if($user_info[timezone] == -12) { $new_time = $time - 43200; }
if($user_info[timezone] == -11) { $new_time = $time - 39600; }
if($user_info[timezone] == -10) { $new_time = $time - 33000; }
if($user_info[timezone] == -9) { $new_time = $time - 32400; }
if($user_info[timezone] == -8) { $new_time = $time - 28800; }
if($user_info[timezone] == -7) { $new_time = $time - 25200; }
if($user_info[timezone] == -6) { $new_time = $time - 21600; }
if($user_info[timezone] == -5) { $new_time = $time - 18000; }
if($user_info[timezone] == -4) { $new_time = $time - 14400; }
if($user_info[timezone] == -3.3) { $new_time = $time - 11880; }
if($user_info[timezone] == -3) { $new_time = $time - 10800; }
if($user_info[timezone] == -2) { $new_time = $time - 7200; }
if($user_info[timezone] == -1) { $new_time = $time - 3600; }
if($user_info[timezone] == 0) { $new_time = $time; }
if($user_info[timezone] == 1) { $new_time = $time + 3600; }
if($user_info[timezone] == 2) { $new_time = $time + 7200; }
if($user_info[timezone] == 3) { $new_time = $time + 10800; }
if($user_info[timezone] == 3.3) { $new_time = $time + 11880; }
if($user_info[timezone] == 4) { $new_time = $time + 14400; }
if($user_info[timezone] == 4.3) { $new_time = $time + 15480; }
if($user_info[timezone] == 5) { $new_time = $time + 18000; }
if($user_info[timezone] == 5.5) { $new_time = $time + 19800; }
if($user_info[timezone] == 6) { $new_time = $time + 21600; }
if($user_info[timezone] == 7) { $new_time = $time + 25200; }
if($user_info[timezone] == 8) { $new_time = $time + 28800; }
if($user_info[timezone] == 9) { $new_time = $time + 32400; }
if($user_info[timezone] == 9.3) { $new_time = $time + 33480; }
if($user_info[timezone] == 10) { $new_time = $time + 33000; }
if($user_info[timezone] == 11) { $new_time = $time + 39600; }
if($user_info[timezone] == 12) { $new_time = $time + 43200; }

return $new_time;

}//END timezone() function



//CHANGES TIME TO SERVER TIME
function untimezone($time) {

global $user_info;

if($user_info[timezone] == -12) { $time = $time + 43200; }
if($user_info[timezone] == -11) { $time = $time + 39600; }
if($user_info[timezone] == -10) { $time = $time + 33000; }
if($user_info[timezone] == -9) { $time = $time + 32400; }
if($user_info[timezone] == -8) { $time = $time + 28800; }
if($user_info[timezone] == -7) { $time = $time + 25200; }
if($user_info[timezone] == -6) { $time = $time + 21600; }
if($user_info[timezone] == -5) { $time = $time + 18000; }
if($user_info[timezone] == -4) { $time = $time + 14400; }
if($user_info[timezone] == -3.3) { $time = $time + 11880; }
if($user_info[timezone] == -3) { $time = $time + 10800; }
if($user_info[timezone] == -2) { $time = $time + 7200; }
if($user_info[timezone] == -1) { $time = $time + 3600; }
if($user_info[timezone] == 0) { $time = $time; }
if($user_info[timezone] == 1) { $time = $time - 3600; }
if($user_info[timezone] == 2) { $time = $time - 7200; }
if($user_info[timezone] == 3) { $time = $time - 10800; }
if($user_info[timezone] == 3.3) { $time = $time - 11880; }
if($user_info[timezone] == 4) { $time = $time - 14400; }
if($user_info[timezone] == 4.3) { $time = $time - 15480; }
if($user_info[timezone] == 5) { $time = $time - 18000; }
if($user_info[timezone] == 5.5) { $time = $time - 19800; }
if($user_info[timezone] == 6) { $time = $time - 21600; }
if($user_info[timezone] == 7) { $time = $time - 25200; }
if($user_info[timezone] == 8) { $time = $time - 28800; }
if($user_info[timezone] == 9) { $time = $time - 32400; }
if($user_info[timezone] == 9.3) { $time = $time - 33480; }
if($user_info[timezone] == 10) { $time = $time - 33000; }
if($user_info[timezone] == 11) { $time = $time - 39600; }
if($user_info[timezone] == 12) { $time = $time - 43200; }

$new_time = $time-((date("I")*3600)-date("Z"));

return $new_time;

}//END untimezone() function



// BUMP LOGIN LOG
function bumplog() {
$log_entries = mysql_num_rows(mysql_query("SELECT l_id FROM bhost_log"));
if($log_entries > 100) {
 $greatest_log = mysql_fetch_assoc(mysql_query("SELECT l_id FROM bhost_log ORDER BY l_id ASC LIMIT 0,1"));
 mysql_query("DELETE FROM bhost_log WHERE l_id='$greatest_log[l_id]'");
 bumplog();
}
}//END bumplog() function


//RANDOM CODE GENERATOR FUNCTION
function randomcode($len="8") {
$code = NULL;
for($i=0;$i<$len;$i++) {
$char = chr(rand(48,122));
while(!ereg("[a-zA-Z0-9]", $char)) {
if($char == $lchar) { continue; }
$char = chr(rand(48,90));
}
$pass .= $char;
$lchar = $char;
}
return $pass;
} //END randomcode() function


// CHECKS FOR DUPLICATE TIMES
function duplicatetime($date, $e_id) {
global $user_info;
if($e_id == 0) {
$other_entries = mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE u_id='$user_info[u_id]' AND date='$date'"));
} else {
$other_entries = mysql_num_rows(mysql_query("SELECT e_id FROM bhost_entries WHERE u_id='$user_info[u_id]' AND e_id <> '$e_id' AND date='$date'"));
}
if($other_entries == 0) {
return $date;
} else {
$newdate = $date+1;
return duplicatetime($newdate, $e_id);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -