idgnarn
BMForum开发部 
信息  来自 火星 
发帖 752 帖
精华 5 帖
积分 164 点
货币 21320 蓝魔币
注册 2005-02-19
|
|
|
|
JAR文件详细信息及JAD动态生成
|
以下是代码:
- -----------------------------------------------------------------------------------
- 直接替换安装请吧topic.func.php传到include目录下覆盖,post.php传到根目录覆盖
- -----------------------------------------------------------------------------------
- 修改安装请用EmEditor打开include/topic.func.php
- 查找
- =============================================================
- } elseif (eregi(".(swf)$", $showdes[0])) {
- if ($checkattachpic == 1 && $somepostinfo[5] != "yes" && $bcode_post['flash']) {
- $uploadfileshow .= "<a target='_blank' href='attachment.php?am=$ias&filename=$filename&article={$lineid}'><img src='images/attach/swf.gif' border='0' alt='' /> $read_post[26] $showdesa$showdesb $showdtim</a><br />".bmbconvert("[swf=400,300]attachment.php?am=$ias&filename=$filename&article={$lineid}[/swf]", $bmfcode_post)."<br />";
- } else {
- $uploadfileshow .= "<a target='_blank' href='attachment.php?am=$ias&filename=$filename&article={$lineid}'><img src='images/attach/swf.gif' border='0' alt='' /> $read_post[26] $showdesa$showdesb $showdtim</a><br />";
- }
- ===============================================================
- 在下面添加
- ===============================================================
- } elseif (eregi(".(jar)$", $showdes[0])) {
- if(file_exists("datafile/jar_temp/upload/$showdes[0]/META-INF/MANIFEST.MF")){
- $metafile = readfromfile("datafile/jar_temp/upload/$showdes[0]/META-INF/MANIFEST.MF");
- preg_match("/MIDlet-Name:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['name'] = $jarmatches[1];
- preg_match("/MIDlet-Vendor:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['vendor'] = $jarmatches[1];
- preg_match("/MicroEdition-Profile:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['midp'] = $jarmatches[1];
- preg_match("/MIDlet-Description:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['description'] = $jarmatches[1];
- $jarinfo['jadurl'] = "upload/jad/".md5($showdes[3]).".jad";
- $uploadfileshow .= "<table align='center' border='0' cellspacing='1' cellpadding='5' class='tableborder' width='100%'>
- <tr>
- <td colspan='4' align='center' class='tile_back_title'><b>JAR文件信息</b></td>
- </tr><tr bgcolor='#FFFFFF'>
- <td width='10%'>文件名:</td>
- <td colspan='3'>JAR下载 <a target='_blank' href='attachment.php?am={$ias}&filename={$filename}&article={$lineid}'><b>$showdes[3]</b></a><br />
- JAD下载 <a target='_blank' href='{$jarinfo['jadurl']}'><b>{$showdes[3]}.jad</b></a> (请右键另存为)</td>
- </tr>
- <tr bgcolor='#FFFFFF'>
- <td>程序名称:</td>
- <td width='50%'>{$jarinfo['name']}</td>
- <td width='10%'>文件大小:</td>
- <td>{$showdes[4]}kb</td>
- </tr><tr bgcolor='#FFFFFF'>
- <td>提供者:</td><td>{$jarinfo['vendor']}</td>
- <td>MIDP版本:</td>
- <td>{$jarinfo['midp']}</td>
- </tr><tr bgcolor='#FFFFFF'>
- <td>描述:</td>
- <td colspan='3'>{$jarinfo['description']}</td>
- </tr>
- </table>";
- $filepath = "[url=http://{$_SERVER['SERVER_NAME']}".str_replace('topic.php']http://{$_SERVER['SERVER_NAME']}".str_replace('topic.php'[/url], '', $_SERVER['PHP_SELF'])."upload/{$showdes[0]}";
-
- if(trim($metafile) <> '') writetofile("upload/jad/".md5($showdes[3]).".jad", "MIDlet-Jar-Size: ".intval($showdes[4]*1024 + 0.5)."nMIDlet-Jar-URL: {$filepath}n". $metafile);
-
- deldir("datafile/jar_temp/upload");
- }elseif(file_exists("upload/jad/".md5($showdes[3]).".jad")){
- $metafile = readfromfile("upload/jad/".md5($showdes[3]).".jad");
- preg_match("/MIDlet-Name:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['name'] = $jarmatches[1];
- preg_match("/MIDlet-Vendor:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['vendor'] = $jarmatches[1];
- preg_match("/MicroEdition-Profile:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['midp'] = $jarmatches[1];
- preg_match("/MIDlet-Description:(.*?)n/is", $metafile, $jarmatches);
- $jarinfo['description'] = $jarmatches[1];
- $jarinfo['jadurl'] = "upload/jad/".md5($showdes[3]).".jad";
- $uploadfileshow .= "<table align='center' border='0' cellspacing='1' cellpadding='5' class='tableborder' width='100%'>
- <tr>
- <td colspan='4' align='center' class='tile_back_title'><b>JAR文件信息</b></td>
- </tr><tr bgcolor='#FFFFFF'>
- <td width='10%'>文件名:</td>
- <td colspan='3'>JAR下载 <a target='_blank' href='attachment.php?am={$ias}&filename={$filename}&article={$lineid}'><b>{$showdes[3]}</b></a><br />
- JAD下载 <a target='_blank' href='{$jarinfo['jadurl']}'><b>{$showdes[3]}.jad</b></a> (请右键另存为)</td>
- </tr>
- <tr bgcolor='#FFFFFF'>
- <td>程序名称:</td>
- <td width='50%'>{$jarinfo['name']}</td>
- <td width='10%'>文件大小:</td>
- <td>{$showdes[4]}kb</td>
- </tr><tr bgcolor='#FFFFFF'>
- <td>提供者:</td><td>{$jarinfo['vendor']}</td>
- <td>MIDP版本:</td>
- <td>{$jarinfo['midp']}</td>
- </tr><tr bgcolor='#FFFFFF'>
- <td>描述:</td>
- <td colspan='3'>{$jarinfo['description']}</td>
- </tr>
- </table>";
- }else{
- $uploadfileshow .= "<a target='_blank' href='attachment.php?am=$ias&filename=$filename&article={$lineid}'><img border='0' src='images/attach/attach.gif' alt='' /> $read_post[26] $showdesa$showdesb $showdtim</a><br />";
- }
- ===================================================================
- 查找
- ====================================================================
- function print_mode()
- ====================================================================
-
- 在上面添加
- ====================================================================
- function deldir($dir) {
- $dh=opendir($dir);
- while ($file = readdir($dh)) {
- if($file != "." && $file!="..") {
- $fullpath=$dir."/".$file;
- if(!is_dir($fullpath)) {
- @unlink($fullpath);
- } else {
- deldir($fullpath);
- }
- }
- }
- closedir($dh);
- if(rmdir($dir)) {
- return true;
- } else {
- return false;
- }
- }
- =====================================================================
-
- 打开post.php
- 查找
- ====================================================================
- if ($bmfopt['watermark'] && $attach_saved === true) {
- if (eregi(".(jpg|jpeg|png)$", $source)) {
- include_once('include/markpic.php');
- makethumb($source, $source);
- }
- }
- =====================================================================
- 在下面添加
- ======================================================================
- if (eregi(".(jar)$", $source)) {
- include_once('include/zip.class.php');
- @set_time_limit(0);
- $z = new Zip;
- $z->Extract($source, 'datafile/jar_temp/'. $source);
- clearstatcache();
- }
- ======================================================================
- Enjoy it!
-
这个插件主要是给想做手机站的用户的,口黑口黑:smoking:
[此帖于 2006-10-06 16:22 idgnarn 编辑]
压缩包附件: jar2jad.rar (附件大小:30.85kb, 下载次数:23)
|
|
| 2006-10-06 16:21 |
|
|
idgnarn
BMForum开发部 
信息  来自 火星 
发帖 752 帖
精华 5 帖
积分 164 点
货币 21320 蓝魔币
注册 2005-02-19
|
|
| 2006-10-07 19:18 |
|
|
idgnarn
BMForum开发部 
信息  来自 火星 
发帖 752 帖
精华 5 帖
积分 164 点
货币 21320 蓝魔币
注册 2005-02-19
|
|
| 2006-11-07 15:10 |
|
|