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

📄 wapipbscript_v1_95.php

📁 WAP IPB Script for Mobilizing IPB for WML
💻 PHP
📖 第 1 页 / 共 5 页
字号:
// Send Header
If (!substr($pid, 0 , 1)=="f") {
        header("Content-type: text/vnd.wap.wml");
}

// Connect to Database
$dbcn = @mysql_connect($dbserver, $dbuser, $dbpass);
if (!$dbcn) {
        echo("Unable to connect to Database server");
        exit();
}
if (!@mysql_select_db($dbname) ) {
        echo("Unable to connect to Database");
        exit();
}

// Split Variables (Some devices can't handle multiple variables well)
If (!$tid_page==Null) {
        $array_tid_page = split("_", $tid_page);
        $tid = $array_tid_page[0];
        $page = $array_tid_page[1];
}
If (!$fid_page==Null) {
        $array_fid_page = split("_", $fid_page);
        $fid = $array_fid_page[0];
        $page = $array_fid_page[1];
}
If (!$page_action==Null) {
        $array_page_action = split("_", $page_action);
        $page = $array_page_action[0];
        $action = $array_page_action[1];
}
If (!$tid_pid_page==Null) {
        $array_tid_pid_page = split("_", $tid_pid_page);
        $ptid = $array_tid_pid_page[0];
        $ppid = $array_tid_pid_page[1];
        $ppage = $array_tid_pid_page[2];
}

If (!$tid_fid==Null) {
        $array_tid_fid = split("_", $tid_fid);
        $tid = $array_tid_fid[0];
        $fid = $array_tid_fid[1];
}

If (!$tid_fid_newreply==Null) {
        $array_tid_fid_newreply = split("_", $tid_fid_newreply);
        $tid = $array_tid_fid_newreply[0];
        $fid = $array_tid_fid_newreply[1];
        $newreply = $array_tid_fid_newreply[2];
}

If (!$tid_fid_newreply_reply==Null) {
        $array_tid_fid_newreply_reply = split("_", $tid_fid_newreply_reply);
        $tid = $array_tid_fid_newreply_reply[0];
        $fid = $array_tid_fid_newreply_reply[1];
        $newreply = $array_tid_fid_newreply_reply[2];
        $reply = $array_tid_fid_newreply_reply[3];
}

If (!$action_login==Null) {
        $array_action_login = split("_", $action_login);
        $action = $array_action_login[0];
        $LoginUsername = $array_action_login[1];
        $LoginPassword = $array_action_login[2];
}

If (!$fid_title_desc_topicpost==Null) {
        $array_fid_title_desc_topicpost = split("_", $fid_title_desc_topicpost);
        $fid = $array_fid_title_desc_topicpost[0];
        $title = $array_fid_title_desc_topicpost[1];
        $desc = $array_fid_title_desc_topicpost[2];
        $topicpost = $array_fid_title_desc_topicpost[3];
}

// Convert HTML to WML Code
function html2wml($boardcode){
        global $enemoticons;
        $boardcode = str_replace("<i>", "", $boardcode);
        $boardcode = str_replace("</i>", "", $boardcode);
        $boardcode = str_replace("<!--QuoteEEnd-->", "</i>", $boardcode);
        $boardcode = str_replace("<!--QuoteEBegin-->", "<i>", $boardcode);
        If ($enemoticons == 1) {
                $keepstr = "<br><img><i><br>";
        } else {
                $keepstr = "<br><i><br>";
        }
        $boardcode = str_replace("</br>", "<br/>", str_replace("<br>", "<br/>", str_replace(":/mlink:", "\">MOBILE LINK</a>", str_replace(":mlink:", "<a href=\"", strip_tags($boardcode, $keepstr)))));
        $boardcode = str_replace("<br/><br/>", "<br/>", $boardcode);
        $boardcode = str_replace("<br/><br/>", "<br/>", $boardcode);
        $boardcode = html_entity_decode2($boardcode);
        $boardcode = wmlspecialchars($boardcode);
        $boardcode = str_replace(wmlspecialchars("<br/>"), "<br/>", $boardcode);
        $boardcode = str_replace(wmlspecialchars("<i>"), "<i>", $boardcode);
        $boardcode = str_replace(wmlspecialchars("</i>"), "</i>", $boardcode);
        If ($enemoticons == 1) {
                $boardcode = str_replace(wmlspecialchars("<img src='http://"), "<img src=\"http://", $boardcode);
                $boardcode = str_replace(wmlspecialchars("' border='0' style='vertical-align:middle' alt='"), "\" alt=\"", $boardcode);
                $boardcode = str_replace(wmlspecialchars("' border='0' alt='"), "\" alt=\"", $boardcode);
                $boardcode = str_replace(wmlspecialchars("' />"), "\" />", $boardcode);
        }
        return $boardcode;
}

// Convert Special Characters to WML
function wmlspecialchars($wml) {
        $wml = str_replace("&#036;", "$", $wml);
        $wml = str_replace("&#064;", "@", $wml);
        $wml = str_replace("&#39;", "'", $wml);
        $wml = str_replace("&#33;", "!", $wml);
        $wml = str_replace("$", "$$", $wml);
        $wml = str_replace("&", "&amp;", $wml);
        $wml = str_replace("<", "&lt;", $wml);
        $wml = str_replace(">", "&gt;", $wml);
        $wml = str_replace("'", "&apos;", $wml);
        $wml = str_replace("\"", "&quot;", $wml);
        $wml = str_replace("  ", "&nbsp; ", $wml);
        $wml = str_replace(" &nbsp;", "&nbsp;&nbsp;", $wml);
        return $wml;
}

function wml_entity_decode($wml) {
        $wml = str_replace("&amp;", "&", $wml);
        $wml = str_replace("&quot;", "\"", $wml);
        $wml = str_replace("&apos;", "'", $wml);
        $wml = str_replace("&gt;", ">", $wml);
        $wml = str_replace("&lt;", "<", $wml);
        $wml = str_replace("$$", "$", $wml);

        return $wml;
}

// Add-on to html_enity_decode for some characters
function html_entity_decode2($html) {
        $html = str_replace("&#036;", "$", $html);
        $html = str_replace("&#39;", "'", $html);
        $html = str_replace("&#33;", "!", $html);
        $html = str_replace("&#91;", "[", $html);
        $html = str_replace("&#93;", "]", $html);
        $html = html_entity_decode($html, ENT_QUOTES);
        return $html;
}

// Create Page Navigation
function topicpagenav($result, $page, $tid){
        global $PHP_SELF;
        global $topicpostsperpage;
        $returnstr = "";
        $num = (int)((mysql_num_rows($result) - 1)/ $topicpostsperpage);
        If (($page - 3)>0) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_0#viewtopic\">1</a>...";
        }
        If (($page - 3) > -1) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . ($page - 3) . "#viewtopic\">" . (intval($page) - 2) . "</a>";
        }
        If (($page - 2) > -1) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . ($page - 2) . "#viewtopic\">" . (intval($page) - 1) . "</a>";
        }
        If (($page - 1) > -1) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . ($page - 1) . "#viewtopic\">" . (intval($page)) . "</a>";
        }
        $returnstr = $returnstr . ($page + 1);
        If (($page) < $num) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . ($page + 1) . "#viewtopic\">" . (intval($page) + 2) . "</a>";
        }
        If (($page + 1) < $num) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . ($page + 2) . "#viewtopic\">" . (intval($page) + 3) . "</a>";
        }
        If (($page + 2) < $num) {
                $returnstr = $returnstr . "<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . ($page + 3) . "#viewtopic\">" . (intval($page) + 4) . "</a>";
        }
        If (($page + 3) < $num) {
                $returnstr = $returnstr . "...<a href=\"" . $PHP_SELF . "?tid_page=" . $tid . "_" . $num . "#viewtopic\">" . ($num + 1) . "</a>";
        }
        return $returnstr;
}

// Limit text on Forum Views & Convert Lines
function docharlimit($msgtext){
        global $msgcharlimit;
        $msgtext = str_replace("<br/>", " ", $msgtext);
        $msgtext = str_replace("  ", "&nbsp; ", $msgtext);
        $msgtext = strip_tags($msgtext);
        $varx = 0;
        $newmsgtext = "";
        if ($msgcharlimit < strlen($msgtext)) {
                $msgwordarray = split(" ", $msgtext);
                $continuemsgtrim = true;
                while ($varx < count($msgwordarray) && $continuemsgtrim == true) {
                        If ($msgcharlimit > strlen($newmsgtext . " " . $msgwordarray[$varx + 1])) {
                                $newmsgtext = $newmsgtext . $msgwordarray[$varx + 1] . " ";
                        } else {
                                $continuemsgtrim = false;
                        }
                        $varx = $varx + 1;
                }
                $newmsgtext = substr($newmsgtext, 0, strlen($newmsgtext) - 1) . "...";
        } else {
                $newmsgtext = $msgtext;
        }

        return $newmsgtext;
}

function dosimplecharlimit($msgtext, $tid, $pid, $page){
        global $topiccharlimit;
        global $PHP_SELF;
        $varx = 0;
        $newmsgtext = "";
        if ($topiccharlimit < strlen($msgtext)) {
                $msgtext = strip_tags($msgtext, "<br/>");
                $msgwordarray = split(" ", $msgtext);
                $continuemsgtrim = true;
                while ($varx < count($msgwordarray) && $continuemsgtrim == true) {
                        If ($topiccharlimit > strlen($newmsgtext . " " . $msgwordarray[$varx + 1])) {
                                $newmsgtext = $newmsgtext . $msgwordarray[$varx + 1] . " ";
                        } else {
                                $continuemsgtrim = false;
                        }
                        $varx = $varx + 1;
                }
                $newmsgtext = substr($newmsgtext, 0, strlen($newmsgtext) - 1) . "...<br/><a href=\"" . $PHP_SELF . "?tid_pid_page=" . $tid . "_" . $pid . "_" . $page . "#viewtopic\">View Full Post</a>";
        } else {
                $newmsgtext = $msgtext;
        }

        return $newmsgtext;
}

function getperm($fid, $perm) {
        global $memgroup;
        global $tableprefix;
        global $forumstable;
        global $followperms;
        $group = mysql_fetch_array(mysql_query("SELECT g_perm_id FROM " . $tableprefix . "groups WHERE g_id='" . $memgroup . "'"));
        $permid = $group['g_perm_id'];
        $perminfo = mysql_fetch_array(mysql_query("SELECT " . $perm . "_perms FROM " . $tableprefix . $forumstable . " WHERE id='" . $fid . "'"));
        $forumperms = $perminfo[$perm . "_perms"];
        If ($forumperms == "*") {
                $retval = true;
        } elseif ($followperms == 0) {
                $retval = true;
        } else {
                $forumperms = split(",", $forumperms);
                $x = 0;
                $retval = false;
                while ($x < count($forumperms)) {
                        If ($permid == $forumperms[$x]) {
                                $retval = true;
                        }

⌨️ 快捷键说明

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