當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Network::islocal方法代碼示例

本文整理匯總了PHP中Network::islocal方法的典型用法代碼示例。如果您正苦於以下問題:PHP Network::islocal方法的具體用法?PHP Network::islocal怎麽用?PHP Network::islocal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Network的用法示例。


在下文中一共展示了Network::islocal方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: displaydir

    public function displaydir($file_list, $srvid, $filename = false, $tpl_browse = false)
    {
        if (GPXDEBUG) {
            echo "DEBUG: Server ID: {$srvid}, Filename: {$filename}, Browsing Templates: {$tpl_browse}<br>";
        }
        // Use correct img path
        if (isset($_SESSION['gpx_admin'])) {
            $bk_path = '../';
        } else {
            $bk_path = '';
        }
        // Setup language
        require DOCROOT . '/lang.php';
        #$back_link  = '<span class="links" onClick="javascript:load_dir('.$srvid.',\'\',1);" title="Go Back">&lt; Go Back</span><br /><br />';
        $back_link = '<div class="links" style="margin-top:10px;margin-bottom:5px;" onClick="javascript:load_dir(' . $srvid . ',\'\',1,' . $tpl_browse . ');"><img src="' . $bk_path . 'images/icons/small/back.png" width="28" height="28" border="0" style="margin-top:5px;" /> ' . $lang['go_back'] . '</div>';
        // Unable to read due to permissions etc
        if ($file_list == 'err_opendir') {
            die($back_link . '<br />Sorry, unable to read this directory.');
        }
        ####################################################
        // Not a directory; show file contents
        if (!is_array($file_list)) {
            if ($tpl_browse) {
                return 'Sorry, cannot edit files in template browse mode.';
            }
            # require(DOCROOT.'/lang.php');
            echo '<div class="infobox" style="display:none;"></div> ' . $back_link . '<textarea id="filecontent_cur" class="txteditor" style="white-space:pre;">' . $file_list . '</textarea><br />
            <div class="button" onClick="javascript:file_savecontent(' . $srvid . ',\'' . $filename . '\');">' . $lang['save'] . '</div>';
            exit;
        }
        ####################################################
        // Setup file/dir sorting
        $arr_files = array();
        $arr_dirs = array();
        #echo '<pre>';
        #var_dump($file_list);
        #echo '</pre>';
        #exit;
        foreach ($file_list as $filename => $file_arr) {
            $file_type = $file_arr['type'];
            #$filename  = strval($filename);
            if (is_numeric($filename)) {
                $filename .= ' ';
            }
            #echo "Name: $filename<br>";
            if ($file_type == '1') {
                $arr_files[$filename][] = $file_arr;
            } else {
                $arr_dirs[$filename][] = $file_arr;
            }
        }
        // Sort arrays by filename
        ksort($arr_files);
        ksort($arr_dirs);
        # Combine, dirs first
        $file_list = array_merge($arr_dirs, $arr_files);
        // OLD/unorganized - Make new array to sort directories together
        #$array = array($file_list,array_keys($file_list));
        #array_multisort($array[0], SORT_DESC,  $array[1], SORT_DESC);
        #$file_list = array_combine($array[1], $array[0]);
        #unset($array);
        ####################################################
        // Check if server is local
        $Network = new Network();
        $is_local = $Network->islocal($srvid);
        // Setup language
        #require(DOCROOT.'/lang.php');
        ####################################################
        // File Uploads - Allow if local
        if ($is_local) {
            echo '<div align="center">
                      <div id="file_up"></div>
                  </div>
                  
                  <script type="text/javascript">
                  $(document).ready(function(){
                      createUploader();
                  });
                  </script>';
        }
        ####################################################
        // Allow back button
        if (!empty($_SESSION['curdir'])) {
            // If tpl browsing, add "use this directory" option
            if ($tpl_browse) {
                $cur_dir = $_SESSION['curdir'];
                echo '<div align="center"><span class="links" onClick="javascript:template_browse_select(\'' . $cur_dir . '\');">Click to use this folder for this template</span></div>';
            }
            #$backdir  = $_SESSION['curdir']; //dirname($_SESSION['curdir']);
            echo $back_link;
        }
        // Show current directory
        if ($_SESSION['curdir']) {
            echo '<div style="width:100%;height:20px;line-height:20px;font-family:Arial;font-size:11pt;color:#777;"><b>' . $lang['working_dir'] . ':</b> ' . htmlspecialchars(stripslashes($_SESSION['curdir'])) . '</div>';
        }
        echo '<div class="infobox" style="display:none;"></div>';
        echo '<div class="box">
        <div class="box_title" id="box_servers_title">' . $lang['files'] . '</div>
        <div class="box_content" id="box_servers_content">

//.........這裏部分代碼省略.........
開發者ID:fritz-net,項目名稱:GamePanelX-V3,代碼行數:101,代碼來源:files.php


注:本文中的Network::islocal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。