コード例 #1
0
ファイル: Status.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * Check page files for orphaned data files
  *
  */
 protected function CheckPageFiles()
 {
     global $dataDir, $gp_index;
     $pages_dir = $dataDir . '/data/_pages';
     $all_files = \gp\tool\Files::ReadDir($pages_dir, 'php');
     foreach ($all_files as $key => $file) {
         $all_files[$key] = $pages_dir . '/' . $file . '.php';
     }
     $page_files = array();
     foreach ($gp_index as $slug => $index) {
         $page_files[] = \gp\tool\Files::PageFile($slug);
     }
     $diff = array_diff($all_files, $page_files);
     if (!count($diff)) {
         return;
     }
     echo '<h2>Orphaned Data Files</h2>';
     echo '<p>The following data files appear to be orphaned and are most likely no longer needed. Before completely removing these files, we recommend backing them up first.</p>';
     echo '<table class="bordered"><tr><th>File</th></tr>';
     foreach ($diff as $file) {
         echo '<tr><td>' . $file . '</td></tr>';
     }
     echo '</table>';
 }
コード例 #2
0
ファイル: Addons.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * Get a list of available addons
  *
  */
 function GetAvailAddons()
 {
     global $dataDir;
     $addonPath = $dataDir . '/addons';
     if (!file_exists($addonPath)) {
         message('Warning: The /addons folder "<em>' . $addonPath . '</em>" does not exist on your server.');
         return array();
     }
     $installed_path = $dataDir . '/data/_addoncode';
     $folders = \gp\tool\Files::ReadDir($addonPath, 1);
     $versions = array();
     $avail = array();
     foreach ($folders as $value) {
         $fullPath = $addonPath . '/' . $value;
         $info = $this->GetAvailInstall($fullPath);
         if (!$info) {
             continue;
         }
         $info['upgrade_key'] = \gp\admin\Addon\Tools::UpgradePath($info);
         $avail[$value] = $info;
         if (isset($info['Addon_Version']) && isset($info['Addon_Unique_ID'])) {
             $id = $info['Addon_Unique_ID'];
             if (!isset($versions[$id])) {
                 $versions[$id] = $info['Addon_Version'];
             } elseif (version_compare($versions[$id], $info['Addon_Version'], '<')) {
                 $versions[$id] = $info['Addon_Version'];
                 continue;
             }
         }
         if (!$info['upgrade_key']) {
             $this->avail_count++;
         }
     }
     if (gp_unique_addons) {
         $avail = self::FilterUnique($avail, $versions);
     }
     return $avail;
 }
コード例 #3
0
ファイル: Session.php プロジェクト: Bouhnosaure/Typesetter
 /**
  * Clean old files and folders from the temporary folder
  * Delete after 36 hours (129600 seconds)
  *
  */
 public static function CleanTemp()
 {
     global $dataDir;
     $temp_folder = $dataDir . '/data/_temp';
     $files = \gp\tool\Files::ReadDir($temp_folder, false);
     foreach ($files as $file) {
         if ($file == 'index.html') {
             continue;
         }
         $full_path = $temp_folder . '/' . $file;
         $mtime = (int) filemtime($full_path);
         $diff = time() - $mtime;
         if ($diff < 129600) {
             continue;
         }
         \gp\tool\Files::RmAll($full_path);
     }
 }
コード例 #4
0
ファイル: Port.php プロジェクト: Bouhnosaure/Typesetter
 public function SetExported()
 {
     $this->exported = \gp\tool\Files::ReadDir($this->export_dir, $this->all_extenstions);
     arsort($this->exported);
 }
コード例 #5
0
ファイル: Edit.php プロジェクト: Bouhnosaure/Typesetter
 public function SelectContent_Areas($param, $count_gadgets)
 {
     global $dataDir, $langmessage, $config;
     $addQuery = 'cmd=addcontent&where=' . rawurlencode($param);
     echo '<div id="area_lists">';
     //extra content
     echo '<div id="layout_extra_content">';
     echo '<table class="bordered">';
     echo '<tr><th colspan="2">&nbsp;</th></tr>';
     $extrasFolder = $dataDir . '/data/_extra';
     $files = \gp\tool\Files::ReadDir($extrasFolder);
     asort($files);
     foreach ($files as $file) {
         $extraName = $file;
         echo '<tr><td>';
         echo str_replace('_', ' ', $extraName);
         echo '</td><td class="add">';
         echo \gp\tool::Link($this->layout_slug, $langmessage['add'], $addQuery . '&insert=Extra:' . $extraName, array('data-cmd' => 'creq'));
         echo '</td></tr>';
     }
     //new extra area
     echo '<tr><td>';
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="new_extra" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     echo '<input type="text" name="extra_area" value="" size="15" class="gpinput"/>';
     $types = \gp\tool\Output\Sections::GetTypes();
     echo '<select name="type" class="gpselect">';
     foreach ($types as $type => $info) {
         echo '<option value="' . $type . '">' . $info['label'] . '</option>';
     }
     echo '</select> ';
     echo ' <input type="submit" name="" value="' . $langmessage['Add New Area'] . '" class="gpbutton"/>';
     echo '</form>';
     echo '</td><td colspan="2" class="add">';
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</form>';
     echo '</td></tr>';
     echo '</table>';
     echo '</div>';
     //gadgets
     if ($count_gadgets > 0) {
         echo '<div id="layout_gadgets" class="nodisplay">';
         echo '<table class="bordered">';
         echo '<tr><th colspan="2">&nbsp;</th></tr>';
         foreach ($config['gadgets'] as $gadget => $info) {
             echo '<tr>';
             echo '<td>';
             echo str_replace('_', ' ', $gadget);
             echo '</td>';
             echo '<td class="add">';
             echo \gp\tool::Link($this->layout_slug, $langmessage['add'], $addQuery . '&insert=' . $gadget, array('data-cmd' => 'creq'));
             echo '</td>';
             echo '</tr>';
         }
         echo '<tr><td colspan="2" class="add">';
         echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
         echo '</td></tr>';
         echo '</table>';
         echo '</div>';
     }
     //menus
     echo '<div id="layout_menus" class="nodisplay">';
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="preset_menu" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     echo '<table class="bordered">';
     $this->PresetMenuForm();
     echo '<tr><td colspan="2" class="add">';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '<div id="layout_custom" class="nodisplay">';
     //custom area
     echo '<form action="' . \gp\tool::GetUrl($this->layout_slug) . '" method="post">';
     echo '<input type="hidden" name="cmd" value="addcontent" />';
     echo '<input type="hidden" name="addtype" value="custom_menu" />';
     echo '<input type="hidden" name="where" value="' . htmlspecialchars($param) . '" />';
     $this->CustomMenuForm();
     echo '<tr><td colspan="2" class="add">';
     echo '<input type="submit" name="" value="' . $langmessage['Add New Menu'] . '" class="gpsubmit" />';
     echo ' <input type="submit" name="cmd" value="' . $langmessage['cancel'] . '" class="admin_box_close gpcancel" />';
     echo '</td></tr>';
     echo '</table>';
     echo '</form>';
     echo '</div>';
     echo '</div>';
 }