Example #1
0
?>
</td>
          <td>开启</td>
        </tr>
      </table>
      <table width="100%">
        <tr>
          <td class="td1">目录、文件权限检查</td>
          <td class="td1" width="25%">写入</td>
          <td class="td1" width="25%">读取</td>
        </tr>
<?php 
foreach ($folder as $dir) {
    $Testdir = SITEDIR . $dir;
    dir_create($Testdir);
    if (TestWrite($Testdir)) {
        $w = '<span class="correct_span">&radic;</span>可写 ';
    } else {
        $w = '<span class="correct_span error_span">&radic;</span>不可写 ';
        $err++;
    }
    if (is_readable($Testdir)) {
        $r = '<span class="correct_span">&radic;</span>可读';
    } else {
        $r = '<span class="correct_span error_span">&radic;</span>不可读';
        $err++;
    }
    ?>
        <tr>
          <td><?php 
    echo $dir;
Example #2
0
//完成安装
if ($step == 9999) {
    ReWriteConfigAuto();
    UpDateCatCache();
    include './templates/step-5.html';
    exit;
}
//用户选择的模块列表缓存文件
if (!file_exists($moduleCacheFile)) {
    $msg = "<font color='red'>由于无法找到模块缓存文件,安装可选模块失败,请登录后在模块管理处安装。</font><br /><br />";
    $msg .= "<a href='module-install.php?step=9999' target='_top'>点击此完成安装 &gt;&gt;</a>";
    ShowMsg($msg, 'javascript:;');
    exit;
}
//模块文件夹权限
if (!TestWrite($moduleDir)) {
    $msg = "<font color='red'>目录 {$moduleDir} 不支持写入,不能安装模块,请登录后在模块管理处安装。</font><br /><br />";
    $msg .= "<a href='module-install.php?step=9999' target='_top'>点击此完成安装 &gt;&gt;</a>";
    ShowMsg($msg, "javascript:;");
    exit;
}
include $moduleCacheFile;
$modules = split(',', $selModule);
$totalMod = count($modules);
if ($step >= $totalMod) {
    $msg = "<font color='red'>完成所有模块的安装!</font><br /><br />";
    $msg .= "<a href='module-install.php?step=9999' target='_top'>点击此进行下一步操作 &gt;&gt;</a>";
    ShowMsg($msg, 'javascript:;');
    exit;
}
$moduleHash = $modules[$step];
Example #3
0
                            <td>
                                <?php 
if (is_readable('Config')) {
    ?>
<font color="green">[√]读</font><?php 
} else {
    $isok = 0;
    ?>
                                    <font color="red">[×]读</font>
                                    <?php 
}
?>
                            </td><td>

                                <?php 
if (TestWrite('Runtime')) {
    ?>
                                    <font color="green">[√]写</font>
                                    <?php 
} else {
    $isok = 0;
    ?>
                                    <font color="red">[×]写</font>
                                <?php 
}
?>

                            </td>
                        </tr>
                    </tbody></table>
/**
 * Form: Database connection info
 */
function ViewForm($Data)
{
    $forums = GetValue('Supported', $Data, array());
    $msg = GetValue('Msg', $Data, '');
    $Info = GetValue('Info', $Data, '');
    $CanWrite = GetValue('CanWrite', $Data, NULL);
    if ($CanWrite === NULL) {
        $CanWrite = TestWrite();
    }
    PageHeader();
    ?>
   <div class="Info">
      Welcome to the Vanilla Porter, an application for exporting your forum to the Vanilla 2 import format.
      For help using this application, 
      <a href="http://vanillaforums.com/blog/help-topics/importing-data" style="text-decoration:underline;">see these instructions</a>.
   </div>
   <form action="<?php 
    echo $_SERVER['PHP_SELF'];
    ?>
" method="post">
      <input type="hidden" name="step" value="info" />
      <div class="Form">
         <?php 
    if ($msg != '') {
        ?>
         <div class="Messages Errors">
            <ul>
               <li><?php 
        echo $msg;
        ?>
</li>
            </ul>
         </div>
         <?php 
    }
    ?>
         <ul>
            <li>
               <label>Source Forum Type</label>
               <select name="type" id="ForumType" onchange="updatePrefix();">
               <?php 
    foreach ($forums as $forumClass => $forumInfo) {
        ?>
                  <option value="<?php 
        echo $forumClass;
        ?>
"<?php 
        if (GetValue('type') == $forumClass) {
            echo ' selected="selected"';
        }
        ?>
><?php 
        echo $forumInfo['name'];
        ?>
</option>
               <?php 
    }
    ?>
               </select>
            </li>
            <li>
               <label>Table Prefix <span>Most installations have a database prefix. If you&rsquo;re sure you don&rsquo;t have one, leave this blank.</span></label>
               <input class="InputBox" type="text" name="prefix" value="<?php 
    echo urlencode(GetValue('prefix')) != '' ? urlencode(GetValue('prefix')) : $forums['vanilla1']['prefix'];
    ?>
" id="ForumPrefix" />
            </li>
            <li>
               <label>Database Host <span>Usually "localhost".</span></label>
               <input class="InputBox" type="text" name="dbhost" value="<?php 
    echo urlencode(GetValue('dbhost', '', 'localhost'));
    ?>
" />
            </li>
            <li>
               <label>Database Name</label>
               <input class="InputBox" type="text" name="dbname" value="<?php 
    echo urlencode(GetValue('dbname'));
    ?>
" />
            </li>
            <li>
               <label>Database Username</label>
               <input class="InputBox" type="text" name="dbuser" value="<?php 
    echo urlencode(GetValue('dbuser'));
    ?>
" />
            </li>
            <li>
               <label>Database Password</label>
               <input class="InputBox" type="password" name="dbpass" value="<?php 
    echo GetValue('dbpass');
    ?>
" />
            </li>
            <?php 
    if ($CanWrite) {
        ?>
            <li>
               <label>
                  <input class="CheckBox" type="checkbox" id="savefile" name="savefile" value="savefile" <?php 
        if (GetValue('savefile')) {
            echo 'checked="checked"';
        }
        ?>
 />
                  Save the export file to the server
               </label>
            </li>
            <?php 
    }
    ?>
         </ul>
         <div class="Button">
            <input class="Button" type="submit" value="Begin Export" />
         </div>
      </div>
   </form>
   <script type="text/javascript">
   //<![CDATA[
      function updatePrefix() {
         var type = document.getElementById('ForumType').value;
         switch(type) {
            <?php 
    foreach ($forums as $ForumClass => $ForumInfo) {
        ?>
            case '<?php 
        echo $ForumClass;
        ?>
': document.getElementById('ForumPrefix').value = '<?php 
        echo $ForumInfo['prefix'];
        ?>
'; break;
            <?php 
    }
    ?>
         }
      }
   //]]>
   </script> 

   <?php 
    PageFooter();
}
Example #5
0
include 'class.phpbb2.php';
include 'class.phpbb3.php';
include 'class.bbpress.php';
include 'class.simplepress.php';
// Make sure a default time zone is set
if (ini_get('date.timezone') == '') {
    date_default_timezone_set('America/Montreal');
}
// Instantiate the appropriate controller or display the input page.
if (isset($_POST['type']) && array_key_exists($_POST['type'], $Supported)) {
    // Mini-Factory
    $class = ucwords($_POST['type']);
    $Controller = new $class();
    $Controller->DoExport();
} else {
    $CanWrite = TestWrite();
    ViewForm(array('Supported' => $Supported, 'CanWrite' => $CanWrite));
}
/**
 * Write out a value passed as bytes to its most readable format.
 */
function FormatMemorySize($Bytes, $Precision = 1)
{
    $Units = array('B', 'K', 'M', 'G', 'T');
    $Bytes = max((int) $Bytes, 0);
    $Pow = floor(($Bytes ? log($Bytes) : 0) / log(1024));
    $Pow = min($Pow, count($Units) - 1);
    $Bytes /= pow(1024, $Pow);
    $Result = round($Bytes, $Precision) . $Units[$Pow];
    return $Result;
}
Example #6
0
        } else {
            return false;
        }
    }
}
$darr = array('/include/*', '/data/*', '/data/cache/*', '/uploads/*', '/templates/*', '/install');
//define('WEB_INCLUDE', ereg_replace("[/\\]{1,}",'/',dirname(__FILE__) ));
//define('WEB_DR', ereg_replace("[/\\]{1,}",'/',substr(WEB_INC,0,-8) ) );
define('WEB_DR', preg_replace("/(\\/|\\\\)+/", '/', substr(WEB_INC, 0, -8)));
//echo WEB_INCLUDE;
//echo WEB_INC;
//echo WEB_DR;
foreach ($darr as $dir) {
    $filldir = WEB_DR . str_replace('/*', '', $dir);
    $isread = is_readable($filldir) ? '<font color=green>[√]读</font>' : '<font color=red>[×]读</font>';
    $iswrite = TestWrite($filldir) ? '<font color=green>[√]写</font>' : '<font color=red>[×]写</font>';
    echo "<tr><td>{$dir}</td><td>{$isread}</td><td>{$iswrite}</td></tr>";
    //$rsta = (is_readable($filldir) ? '<font color=green>[√]读</font>' : '<font color=red>[×]读</font>');
    //$wsta = (TestWrite($filldir) ? '<font color=green>[√]写</font>' : '<font color=red>[×]写</font>');
    //echo "<td>$rsta</td><td>$wsta</td>\r\n";
}
?>
      </table>
    </li>
    <li class="installhr">
      <hr>
    </li>
    <LI class=SubmitBox>
      <INPUT class="btn" type="button" onclick="location.href='index.php?a=step2'" value="进入下一步" name=Submit>
    </LI>
  </UL>
Example #7
0
{
    // Create file
    $file = 'vanilla2test.txt';
    @touch($file);
    if (is_writable($file)) {
        @unlink($file);
        return true;
    } else {
        return false;
    }
}
// Files
include 'class.exportmodel.php';
include 'views.php';
include 'class.exportcontroller.php';
foreach ($supported as $file => $info) {
    include 'class.' . $file . '.php';
}
// Logic
if (isset($_POST['type']) && array_key_exists($_POST['type'], $supported)) {
    // Mini-Factory
    $class = ucwords($_POST['type']);
    new $class();
} else {
    // View form or error
    if (TestWrite()) {
        ViewForm($supported);
    } else {
        ViewNoPermission("This script has detected that it does not have permission to create files in the current directory. Please rectify this and retry.");
    }
}
Example #8
0
/**
 * Form: Database connection info.
 */
function ViewForm($Data)
{
    $forums = GetValue('Supported', $Data, array());
    $msg = GetValue('Msg', $Data, '');
    $CanWrite = GetValue('CanWrite', $Data, null);
    if ($CanWrite === null) {
        $CanWrite = TestWrite();
    }
    if (!$CanWrite) {
        $msg = 'The porter does not have write permission to write to this folder. You need to give the porter permission to create files so that it can generate the export file.' . $msg;
    }
    if (defined('CONSOLE')) {
        echo $msg . "\n";
        return;
    }
    PageHeader();
    ?>
    <div class="Info">
        Howdy, stranger! Glad to see you headed our way.
        For help,
        <a href="http://docs.vanillaforums.com/developers/importing/porter" style="text-decoration:underline;"
           target="_blank">peek at the docs</a>.
        To see what data we can grab from your platform,
        <a href="?features=1" style="text-decoration:underline;">see this table</a>.
    </div>
    <form action="<?php 
    echo $_SERVER['PHP_SELF'] . '?' . http_build_query($_GET);
    ?>
" method="post">
        <input type="hidden" name="step" value="info"/>

        <div class="Form">
            <?php 
    if ($msg != '') {
        ?>
                <div class="Messages Errors">
                    <ul>
                        <li><?php 
        echo $msg;
        ?>
</li>
                    </ul>
                </div>
            <?php 
    }
    ?>
            <ul>
                <li>
                    <label>Source Forum Type</label>
                    <select name="type" id="ForumType" onchange="updatePrefix();">
                        <?php 
    foreach ($forums as $forumClass => $forumInfo) {
        ?>
                            <option value="<?php 
        echo $forumClass;
        ?>
"<?php 
        if (GetValue('type') == $forumClass) {
            echo ' selected="selected"';
        }
        ?>
><?php 
        echo $forumInfo['name'];
        ?>
</option>
                        <?php 
    }
    ?>
                    </select>
                </li>
                <li>
                    <label>Table Prefix <span>Most installations have a database prefix. If you&rsquo;re sure you don&rsquo;t have one, leave this blank.</span></label>
                    <input class="InputBox" type="text" name="prefix"
                           value="<?php 
    echo htmlspecialchars(GetValue('prefix')) != '' ? htmlspecialchars(GetValue('prefix')) : $forums['vanilla1']['prefix'];
    ?>
"
                           id="ForumPrefix"/>
                </li>
                <li>
                    <label>Database Host <span>Usually "localhost".</span></label>
                    <input class="InputBox" type="text" name="dbhost"
                           value="<?php 
    echo htmlspecialchars(GetValue('dbhost', '', 'localhost'));
    ?>
"/>
                </li>
                <li>
                    <label>Database Name</label>
                    <input class="InputBox" type="text" name="dbname"
                           value="<?php 
    echo htmlspecialchars(GetValue('dbname'));
    ?>
"/>
                </li>
                <li>
                    <label>Database Username</label>
                    <input class="InputBox" type="text" name="dbuser"
                           value="<?php 
    echo htmlspecialchars(GetValue('dbuser'));
    ?>
"/>
                </li>
                <li>
                    <label>Database Password</label>
                    <input class="InputBox" type="password" name="dbpass" value="<?php 
    echo GetValue('dbpass');
    ?>
"/>
                </li>
                <li>
                    <label>Export Type</label>
                    <select name="tables" id="ExportTables">
                        <option value="">All supported data</option>
                        <option value="User,Role,UserRole,Permission">Only users and roles</option>
                    </select>
                </li>
            </ul>
            <div class="Button">
                <input class="Button" type="submit" value="Begin Export"/>
            </div>
        </div>
    </form>
    <script type="text/javascript">
        //<![CDATA[
        function updatePrefix() {
            var type = document.getElementById('ForumType').value;
            switch (type) {
                <?php 
    foreach ($forums as $ForumClass => $ForumInfo) {
        ?>
                case '<?php 
        echo $ForumClass;
        ?>
':
                    document.getElementById('ForumPrefix').value = '<?php 
        echo $ForumInfo['prefix'];
        ?>
';
                    break;
                <?php 
    }
    ?>
            }
        }
        //]]>
    </script>

    <?php 
    PageFooter();
}