Exemplo n.º 1
0
function Table_of_Files($full_list)
{
    //****************************************
    global $_, $ONESCRIPT, $ipath, $param1, $ftypes, $fclasses, $excluded_list, $stypes, $SHOWALLFILES;
    //dummy input to make sure files[] is always an array in js for Select_All() & Confirm_Ready().
    echo '<INPUT TYPE=hidden NAME="files[]" VALUE="">';
    echo '<table class="index_T">';
    foreach ($full_list as $file) {
        $excluded = FALSE;
        if (in_array($file, $excluded_list)) {
            $excluded = TRUE;
        }
        //Get file type & check against $stypes (files types to show)
        $filename_parts = explode(".", strtolower($file));
        $ext = end($filename_parts);
        if ($SHOWALLFILES || in_array($ext, $stypes)) {
            $SHOWTYPE = TRUE;
        } else {
            $SHOWTYPE = FALSE;
        }
        //Used to not show rename & delete options for active copy of OneFileCMS.
        $IS_OFCMS = false;
        if ($ipath . $file == trim($_SERVER['SCRIPT_NAME'], '/')) {
            $IS_OFCMS = true;
        }
        if ($SHOWTYPE && !$excluded || is_dir($ipath . $file)) {
            $HREF_params = $ONESCRIPT . $param1;
            //Set icon type based on if dir, or file type ($ext).
            if (is_dir($ipath . $file)) {
                $f_or_f = 'folder';
                $type = 'dir';
                $HREF_params .= URLencode_path($file) . '/';
                $param3 = '';
                $DS = ' /';
                //End with a forward slash to indicate a folder.
            } else {
                $f_or_f = "file";
                $type = $fclasses[array_search($ext, $ftypes)];
                $HREF_params .= '&amp;f=' . rawurlencode($file);
                $param3 = '&amp;p=edit';
                $DS = '';
            }
            List_File($file, $type, $f_or_f, $DS, $IS_OFCMS, $HREF_params, $param3);
        }
        //end if !is_dir...
    }
    //end foreach file
    echo '</table>';
}
Exemplo n.º 2
0
function List_Backups_and_Logs()
{
    //********************************************
    global $_, $ONESCRIPT_backup, $ONESCRIPT_file, $ONESCRIPT_file_backup, $CONFIG_backup, $CONFIG_FILE_backup, $LOGIN_LOG_url, $LOGIN_LOG_file;
    //Indicate if a login log or backups (from a prior p/w or u/n change) exist.
    $CONFIG_FILE_backup_OS = Convert_encoding($CONFIG_FILE_backup);
    $ONESCRIPT_file_backup_OS = Convert_encoding($ONESCRIPT_file_backup);
    $LOGIN_LOG_file_OS = Convert_encoding($LOGIN_LOG_file);
    clearstatcache();
    $backup_found = $log_found = false;
    if (is_file($ONESCRIPT_file_backup_OS) || is_file($CONFIG_FILE_backup_OS)) {
        $backup_found = true;
    }
    if (is_file($LOGIN_LOG_file_OS)) {
        $log_found = true;
    }
    if ($backup_found || $log_found) {
        echo '<table class="index_T">';
        if ($log_found) {
            List_File($LOGIN_LOG_file, $LOGIN_LOG_url);
        }
        if (is_file($ONESCRIPT_file_backup_OS)) {
            List_File($ONESCRIPT_file_backup, $ONESCRIPT_backup);
        }
        if (is_file($CONFIG_FILE_backup_OS)) {
            List_File($CONFIG_FILE_backup, $CONFIG_backup);
        }
        echo '</table>';
        if ($backup_found) {
            echo '<p style="margin-top: .5em"><b>' . hsc($_['admin_txt_00']) . '</b></p>';
            echo '<p>' . hsc($_['admin_txt_01']);
        }
        echo '<hr>';
    }
    //end of check for backup
}