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

📄 wapipbscript_v1_95.php

📁 WAP IPB Script for Mobilizing IPB for WML
💻 PHP
📖 第 1 页 / 共 5 页
字号:
                        $x = $x + 1;
                }
        }
        
        return $retval;
}

// Add language conversion for personal use (optional)
function convert_language($text) {
        global $lng;
        global $trans_lang_from;
        If (strlen(str_replace("\n", "", str_replace(" ", "", $text))) > 0) {
                usleep(120000); // Wait 1/2 Sec to prevent Google server flood (saves time)
                // The original language translation code is by Israel de Souza Rocha
                $f = @file("http://translate.google.com/translate_t?text=" . urlencode($text) . "&langpair=$trans_lang_from|$lng");
                if (!$f == false) {
                        foreach ( $f as $v ) {
                                if (strstr($v, '<textarea')) {
                                        $x = strstr($v, '<textarea');
                                }
                        }
                        $arr = explode('</textarea>', $x);
                        $arr = explode('wrap=PHYSICAL>', $arr[0]);
                        $text = $arr[1];
                }
        }
        flush();
        return $text;
}

function conv_lang($code) {
        $original = get_text($code);
        $new = replace_lang($code, $original);
        return $new;
}

function get_text($code) {
        $new_code = str_replace("<wml>", "<>", $code);
        $new_code = str_replace("</wml>", "<>", $new_code);
        $new_code = str_replace("<card id=\"index\"", "<>", $new_code);
        $new_code = str_replace("<card id=\"view\"", "<>", $new_code);
        $new_code = str_replace("<card id=\"viewcategory\"", "<>", $new_code);
        $new_code = str_replace("<card id=\"viewforum\"", "<>", $new_code);
        $new_code = str_replace("<card id=\"viewtopic\"", "<>", $new_code);
        $new_code = str_replace(" title=\"{$boardtitle}\">", "<>", $new_code);
        $new_code = str_replace("<small>", "<>", $new_code);
        $new_code = str_replace("</small>", "<>", $new_code);
        $new_code = str_replace("</card>", "<>", $new_code);
        $new_code = str_replace("<small>", "<>", $new_code);
        $new_code = str_replace("<br/>", "<>", $new_code);
        $new_code = str_replace("<b>", "<>", $new_code);
        $new_code = str_replace("</b>", "<>", $new_code);
        $new_code = str_replace("<p>", "<>", $new_code);
        $new_code = str_replace("</p>", "<>", $new_code);
        $new_code = str_replace("<i>", "<>", $new_code);
        $new_code = str_replace("</i>", "<>", $new_code);
        $new_code = str_replace("<p align=\"center\">", "<>", $new_code);
        $new_code = str_replace("</a>", "<>", $new_code);
        $new_code = str_replace("\">", "<>", $new_code);
        $new_code = str_replace("<a", "<>", $new_code);
        $new_code = str_replace("<img", "<>", $new_code);
        $new_code = str_replace("<><>", "<>", $new_code);
        $new_code = str_replace("<><>", "<>", $new_code);
        $new_code = str_replace(", ", "<>", $new_code);
        $new_code = wml_entity_decode($new_code);
        $new_code = split("<>", $new_code);
        
        return $new_code;
}

function replace_lang($original_code, $original_text) {
        global $PHP_SELF;
        global $lng;
        $output = $original_code;
        $x = 0;
        while ($x < count($original_text)) {
                $str = $original_text[$x];
                if (!substr_count($str, " href=\"") > 0 && !substr_count($str, " src=\"") > 0 && $x>1) {
                        $output = str_replace($str, wmlspecialchars(convert_language($str)), $output);
                }
                $x = $x + 1;
        }
        $output = str_replace(chr(9), "", $output);
        $output = str_replace($PHP_SELF, $PHP_SELF . "?lng=$lng&", $output);
        $output = str_replace("&?", "&", $output);
        $output = str_replace("\"\">", "\">", $output);
        $output = str_replace("lng=$lng&lng=$lng", "lng=$lng", $output);
        $output = str_replace("lng=$lng&lng=", "lng=", $output);
        return $output;
}

// Post New Thread
function new_topic($fid, $title, $desc, $post) {
        global $REMOTE_ADDR;
        global $username;
        global $memid;
        global $tid;
        global $tableprefix;
        If (post_time()) {
        $last_tid = mysql_fetch_array(mysql_query("SELECT tid FROM " . $tableprefix . "topics ORDER BY tid DESC LIMIT 1"));
        $last_tid = $last_tid['tid'];
        $tid = $last_tid + 1;
        $time = time();
        // Create new topic
        mysql_query("INSERT INTO " . $tableprefix . "topics SET tid = $tid, " .
                "title = '$title', " .
                "description = '$desc', " .
                "state = 'open', " .
                "posts = 0, " .
                "starter_id = '$memid', " .
                "start_date = '$time', " .
                "last_poster_id = '$memid', " .
                "last_post = '$time', " .
                "icon_id = 0, " .
                "starter_name = '$username', " .
                "last_poster_name = '$username', " .
                "poll_state = 0, " .
                "last_vote = 0, " .
                "views = 0, " .
                "forum_id = '$fid', " .
                "approved = 1, " .
                "author_mode = 1, " .
                "pinned = 0, " .
                "total_votes = 0");
                
        // Add post
        mysql_query("INSERT INTO " . $tableprefix . "posts SET append_edit = 0, " .
                "pid = '', " .
                "author_id = '$memid', " .
                "author_name = '$username', " .
                "use_sig = 1, " .
                "use_emo = 1, " .
                "ip_address = '$REMOTE_ADDR', " .
                "post_date = '$time', " .
                "icon_id = 0, " .
                "post = '$post', " .
                "queued = 0, " .
                "topic_id = '$tid', " .
                "forum_id = '$fid', " .
                "new_topic = 1");
        mysql_query("UPDATE " . $tableprefix . "forums SET last_title='$title', ".
                "last_id='$tid', ".
                "last_post='$time', ".
                "last_poster_name='$username', ".
                "last_poster_id='$memid', ".
                "posts=posts+1 ".
                "WHERE id='$fid'");
        mysql_query("UPDATE " . $tableprefix . "topics SET last_poster_id='$memid', ".
                "last_poster_name='$username', ".
                "last_post='$time', ".
                "posts=0 ".
                "WHERE tid='$tid'");
        mysql_query("UPDATE " . $tableprefix . "stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
        mysql_query("UPDATE " . $tableprefix . "members SET posts=posts+1 WHERE id='$memid'");
        }
}

// Post Reply
function reply($post) {
        global $REMOTE_ADDR;
        global $username;
        global $memid;
        global $tid;
        global $fid;
        global $tableprefix;
        If (post_time()) {
        $time = time();
        mysql_query("INSERT INTO " . $tableprefix . "posts SET append_edit = 0, " .
                "pid = '', " .
                "author_id = '$memid', " .
                "author_name = '$username', " .
                "use_sig = 1, " .
                "use_emo = 1, " .
                "ip_address = '$REMOTE_ADDR', " .
                "post_date = '$time', " .
                "icon_id = 0, " .
                "post = '$post', " .
                "queued = 0, " .
                "topic_id = '$tid', " .
                "forum_id = '$fid', " .
                "new_topic = 0");
        mysql_query("UPDATE " . $tableprefix . "forums SET last_title=last_title, ".
                "last_id='$tid', ".
                "last_post='$time', ".
                "last_poster_name='$username', ".
                "last_poster_id='$memid', ".
                "posts=posts+1 ".
                "WHERE id='$fid'");
        mysql_query("UPDATE " . $tableprefix . "topics SET last_poster_id='$memid', ".
                "last_poster_name='$username', ".
                "last_post='$time', ".
                "posts=posts+1 ".
                "WHERE tid='$tid'");
        mysql_query("UPDATE " . $tableprefix . "stats SET TOTAL_REPLIES=TOTAL_REPLIES+1");
        mysql_query("UPDATE " . $tableprefix . "members SET posts=posts+1 WHERE id='$memid'");
        }
}

function parse_emoticons($code) {
        global $furl;
        global $emoticon_dir;
        global $post_emoticons;
        global $tableprefix;
        If ($post_emoticons==1) {
                $emoticons = mysql_query("SELECT * FROM " . $tableprefix . "emoticons");
                while ($emoticon = mysql_fetch_array($emoticons)) {
                        $code = str_replace($emoticon['typed'], "<!--emo&" . $emoticon['typed'] . "--><img src=\'http://" . $furl . $emoticon_dir . $emoticon['image'] . "\' border=\'0\' style=\'vertical-align:middle\' alt=\'" . $emoticon['image'] . "\'/><!--endemo-->", $code);
                }
        }
        
        return $code;
}

function post_time() {
        global $post_limit;
        global $username;
        global $tableprefix;
        $last_post = mysql_fetch_array(mysql_query("SELECT `post_date` FROM `" . $tableprefix . "posts` WHERE author_name='$username' ORDER BY `post_date` DESC LIMIT 1"));
        $last_post = $last_post['post_date'];
        If ((time() - $last_post) < $post_limit) {
                return false;
        } else {
                return true;
        }
}

// Manage IPB Sessions
If ($manageses==1) {
        mysql_query("DELETE " . $tableprefix . $sessionstable . " WHERE running_time < '" . (time() - $sesdeltime) . "'");
}

// Get User Login & Set Persmissions
If (!substr($pid, 0 , 1)=="f") {
$allowpost = 1;
$memid = 0;
$guestinfo = mysql_fetch_array(mysql_query("SELECT mgroup, name FROM " . $tableprefix . $memberstable . " WHERE id=0 LIMIT 1"));
$memgroup = $guestinfo['mgroup'];
$guestname = $guestinfo['name'];
If (mysql_num_rows(mysql_query("SELECT * FROM " . $tableprefix . $sessionstable . " WHERE id='" . $REMOTE_ADDR . "'")) > 0) {
        mysql_query("UPDATE " . $tableprefix . $sessionstable . " SET id='" . $REMOTE_ADDR . "', $ip_address_column='" . $REMOTE_ADDR . "', running_time='" . time() . "' WHERE id='" . $REMOTE_ADDR . "' LIMIT 1");
} else {
        mysql_query("INSERT INTO " . $tableprefix . $sessionstable . " SET id='" . $REMOTE_ADDR . "', $ip_address_column='" . $REMOTE_ADDR . "', running_time='" . time() . "'");
}
$login_out = "";
If ($allowlogin==1) {
        $sesinfo = mysql_fetch_array(mysql_query("SELECT * FROM " . $tableprefix . $sessionstable . " WHERE id = '" . $REMOTE_ADDR . "' AND $running_time_column > '" . (time() - (60 * $loginsesmin)) . "'"));
        If (!$sesinfo[$member_name_column]=="") {
                $memid = $sesinfo['member_id'];
                If ($REMOTE_ADDR==$sesinfo[$ip_address_column]) {
                        $username = $sesinfo[$member_name_column];

⌨️ 快捷键说明

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