好心的大大,幫忙一下(xoops的問題)

edited 十月 2013 in XOOPS
小弟安裝 xcgal 模組,基本上是沒遇到什麼困難,
但是在後台管理居然突然選單都不見了,經過辛苦的除錯後發現,
問題是發生在設定基本組態的那一頁(modules/system/admin.php),
設定好按下送出鈕之後,程式會引入include/cp_functions.php,
並且程式會呼叫其中一個function,如下:

function xoops_module_write_admin_menu($content)
{
if (!xoopsfwrite()) {
return false;
}

$filename = XOOPS_CACHE_PATH.'/adminmenu.php';
if ( !$file = fopen($filename, "w") ) {
echo 'failed open file';
return false;
}
if ( fwrite($file, $content) == -1 ) {
echo 'failed write file';
return false;
}
fclose($file);
return true;
}
?>
我如果echo $content;
$content的值會如下
<?php
$xoops_admin_menu_js = "function popUpL1() {
shutdown();
popUp(\"L1\",true);
}
function popUpL16() {
shutdown();
popUp(\"L16\",true);
}
";
$xoops_admin_menu_ml[1] = "setleft('L1',105);
settop('L1',150);
";
$xoops_admin_menu_ml[2] = "setleft('L16',105);
settop('L16',165);
";
$xoops_admin_menu_sd[1] = "popUp('L1',false);
";
$xoops_admin_menu_sd[2] = "popUp('L16',false);
";
$xoops_admin_menu_ft[1] = "<a href='".XOOPS_URL."/modules/system/admin.php' onmouseover='moveLayerY(\"L1\", currentY,event) ; popUpL1();'><img src='".XOOPS_URL."/modules/system/images/system_slogo.png' alt='' /></a><br />
";
$xoops_admin_menu_ft[2] = "<a href='".XOOPS_URL."/modules/xcgal/admin/index.php' onmouseover='moveLayerY(\"L16\", currentY,event) ; popUpL16();'><img src='".XOOPS_URL."/modules/xcgal/images/slogo.png' alt='' /></a><br />
";
$xoops_admin_menu_dv = "<div id='L1' style='position: absolute; visibility: hidden; z-index:1000;'><table class='outer' width='150' cellspacing='1'><tr><th nowrap='nowrap'>系統管理區</th></tr><tr><td class='even' nowrap='nowrap'><img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=banners' onmouseover='popUpL1();'>廣告管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=blocksadmin' onmouseover='popUpL1();'>區塊管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=groups' onmouseover='popUpL1();'>群組管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=images' onmouseover='popUpL1();'>圖檔管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=modulesadmin' onmouseover='popUpL1();'>模組管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=preferences' onmouseover='popUpL1();'>系統設定</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=smilies' onmouseover='popUpL1();'>表情圖</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=userrank' onmouseover='popUpL1();'>等級管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=users' onmouseover='popUpL1();'>編輯會員</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=findusers' onmouseover='popUpL1();'>搜尋會員</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=mailusers' onmouseover='popUpL1();'>Mail/傳訊給會員</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=avatars' onmouseover='popUpL1();'>大頭照管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=tplsets' onmouseover='popUpL1();'>樣板管理</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=comments' onmouseover='popUpL1();'>評論管理</a><br />
<div style='margin-top: 5px; font-size: smaller; text-align: right;'><a href='#' onmouseover='shutdown();'>[關閉]</a></div></td></tr><tr><th style='font-size: smaller; text-align: left;'><img src='".XOOPS_URL."/modules/system/images/system_slogo.png' alt='' /><br /><b>"._VERSION.":</b> 1<br /><b>"._DESCRIPTION.":</b> 網站系統管理區.</th></tr></table></div>
<div id='L16' style='position: absolute; visibility: hidden; z-index:1000;'><table class='outer' width='150' cellspacing='1'><tr><th nowrap='nowrap'>xcGallery</th></tr><tr><td class='even' nowrap='nowrap'><img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/xcgal/admin/index.php' onmouseover='popUpL16();'>管理 概要</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/xcgal/admin/catmgr.php' onmouseover='popUpL16();'>類別</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/xcgal/admin/usermgr.php' onmouseover='popUpL16();'>使用者</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/xcgal/admin/groupmgr.php' onmouseover='popUpL16();'>群組</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/xcgal/admin/ecardmgr.php' onmouseover='popUpL16();'>Ecards</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/xcgal/admin/searchnew.php' onmouseover='popUpL16();'>批次新增圖片</a><br />
<img src='".XOOPS_URL."/images/pointer.gif' width='8' height='8' alt='' /> <a href='".XOOPS_URL."/modules/system/admin.php?fct=preferences&op=showmod&mod=2' onmouseover='popUpL16();'>設定</a><br />
<div style='margin-top: 5px; font-size: smaller; text-align: right;'><a href='#' onmouseover='shutdown();'>[關閉]</a></div></td></tr><tr><th style='font-size: smaller; text-align: left;'><img src='".XOOPS_URL."/modules/xcgal/images/slogo.png' alt='' /><br /><b>"._VERSION.":</b> 1.1<br /><b>"._DESCRIPTION.":</b> Gallery module based on Coppermine 1.10 c Gr嶲ory DEMAR (http://coppermine.sourceforge.net)</th></tr></table></div>
<script language='JavaScript'>
<!--
moveLayers();
loaded = 1;
// -->
</script>
";

?>
但是執行完成卻發現檔案並沒有寫進cache/adminmenu.php,
該檔案的大小為0byte,也就是說fopen()有成功但是無法寫入,
如果我把$content的值手動加進cache/adminmenu.php,
系統就又都正常,我該怎麼辦......

另外補充
cache 的資料夾確實已經是 777
而 adminmenu.php 是644 檔案擁有者是apache
而且我如果直接把內容複製到adminmenu.php,
會暫時正常,但是只要一重新設定基本組態,
adminmenu.php就會又被清空...
而且我肯定該函數只被呼叫過一次,
我如果echo "a";他只會印出一個a,
並且也不是在其他地方有用到該檔案,
我試過多開一個檔案,也把檔案寫進去,
結果只是產生另一個0位元的檔案。
不知道會不會是寫入檔案的函式被鎖定或是.....

原始討論: http://twpug.net/x/modules/newbb/viewtopic.php?topic_id=271

評論

Sign In or Register to comment.