/home/coolpkct/www/websites/cake3.cool.rocks/admin/classes/filesscreen.php
<?php
/**
 * Part of Showkase web site management package
 *
 * @package Showkase
 * @author Jack Hardie {@link http://www.jhardie.com}
 * @copyright Copyright (c) 2013, SimpleViewer Inc.
 */
defined('SK_ACCESS')||die('<h1>403: Forbidden</h1>');
require_once 'classes'.DIRECTORY_SEPARATOR.'screen.php';
require_once 'classes'.DIRECTORY_SEPARATOR.'systembuttonbar.php';
 
/**
 * Repair screen
 *
 * @package Showkase
 */
class FilesScreen extends Screen
{
    /**
     * Constructs Screen
     *
     * @access public
     * @return void
     * @param string content for html title tag
     * @param string body id
     */
    public function __construct($htmlTitle, $bodyId='', $bodyClass='allpages')
    {
         parent::__construct($htmlTitle, $bodyId, $bodyClass);
         $bb = new SystemButtonbar();
         $this->subNavHtml = $bb->getHtml();
    }


    /**
     * Returns list of pages as html table
     * @access public
     * @return string html table
     * @param array context
     */
    function getContentHtml($context)
    {
      $scanData = $context['scanData'];
      $html = '
    <div class="subhead">
      <div class="hgroup">
        <h2>File Permissions</h2>
      </div>
      <ul class="buttons">
        <li><button type="button" onclick="window.location=\'index.php\';" class="btn btn-danger">Cancel</button></li>
      </ul>
    </div>
    <div class="prompt">
      <p>The following files and folders have been found in your web content directory. Advanced users may occasionally wish to edit these files manually. Be especially careful when changing system files. Backup your site first.</p>
      <p>On some servers you may need to make the files writable before you can edit or delete them. You can do this by clicking on the <i>make writeable</i> link.</p>
    </div>
    <table class="showkase-actions">
      <tr>
        <th>Folder or file name</th>
        <th>Type</th>
        <th>Permissions</th>
        <th>Change</th>
      </tr>
';

      foreach ($scanData as $key=>$value) {
          $baseName = basename($value['pagePath']);
          $html .= '
      <tr>
        <td>'.$baseName.'</td>
        <td class="'.strtolower($value['pageType']).'">'.$value["pageType"].'</td>
        <td>'.substr(sprintf('%o', fileperms($value['pagePath'])), -4).'</td>
        <td class="actionunwriteable commit"><a href="index.php?cmd=files&amp;file='.rawurlencode($value['pagePath']).'&amp;token='.$context['token'].'" title="Change permissions">make&nbsp;writeable</a></td>
      </tr>';
      }
      $html .= '
    </table>
';
      return $html;
    }
}