Skip to content
This repository was archived by the owner on Dec 6, 2019. It is now read-only.

Commit fe3d579

Browse files
author
Nabeel Shahzad
committed
VMS-267 VMS-268 VMS-269 VMS-273 VMS-274 VMS-275 VMS-276 VMS-277 #closed fixed
1 parent 6aa1493 commit fe3d579

19 files changed

+456
-108
lines changed

admin/index.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@
7272
$BaseTemplate->template_path = SITE_ROOT . '/admin/lib/'.$tplname;
7373
$BaseTemplate->Set('title', SITE_NAME);
7474

75-
if(isset($_GLOBALS['NAVBAR']))
76-
Template::Set('MODULE_NAV_INC', $_GLOBALS['NAVBAR']);
77-
78-
if(isset($_GLOBALS['HTMLHead']))
79-
Template::Set('MODULE_HEAD_INC', $_GLOBALS['HTMLHead']);
75+
76+
Template::Set('MODULE_NAV_INC', $NAVBAR);
77+
Template::Set('MODULE_HEAD_INC', $HTMLHead);
8078

8179
$BaseTemplate->Show('header.tpl');
8280

admin/modules/Dashboard/Dashboard.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*/
2424

2525
class Dashboard extends CodonModule
26-
{
26+
{
2727
public function HTMLHead()
2828
{
2929
$this->set('sidebar', 'sidebar_dashboard.tpl');
@@ -39,10 +39,6 @@ public function index()
3939

4040
$this->set('unexported_count', count(PIREPData::getReportsByExportStatus(false)));
4141
$this->render('dashboard.tpl');
42-
43-
44-
/*$this->set('allpilots', PilotData::GetPendingPilots());
45-
$this->render('pilots_pending.tpl');*/
4642
}
4743

4844
public function pirepcounts()
@@ -93,7 +89,6 @@ public function CheckForUpdates()
9389

9490
# Default to fopen(), if that fails it'll use CURL
9591
$file = new CodonWebService();
96-
//$file->setType('fopen');
9792
$contents = @$file->get($url);
9893

9994
# Something should have been returned

admin/modules/Maintenance/Maintenance.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,31 @@ public function resetacars()
198198

199199
}
200200

201+
public function clearcache()
202+
{
203+
echo '<h3>Clearing Cache</h3>';
204+
205+
$dir_iterator = new RecursiveDirectoryIterator(CACHE_PATH);
206+
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
207+
208+
foreach ($iterator as $file)
209+
{
210+
if($file->getType() != 'file')
211+
{
212+
continue;
213+
}
214+
215+
$file_name = $file->getBaseName();
216+
if($file_name === 'index.php')
217+
continue;
218+
219+
echo "Removing \"{$file_name}\"<br />";
220+
unlink($file);
221+
}
222+
223+
echo 'Cache cleared!';
224+
}
225+
201226
public function calculateranks()
202227
{
203228
echo '<h3>Resetting Ranks</h3>';
@@ -273,7 +298,7 @@ public function resetpirepfinance()
273298
echo '<h3>Reset PIREP Data</h3>
274299
Resetting PIREPs...<br />';
275300

276-
PIREPData::PopulateEmptyPIREPS();
301+
//PIREPData::PopulateEmptyPIREPS();
277302

278303
echo 'Complete';
279304

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<?php
2+
/**
3+
* phpVMS - Virtual Airline Administration Software
4+
* Copyright (c) 2008 Nabeel Shahzad
5+
* For more information, visit www.phpvms.net
6+
* Forums: http://www.phpvms.net/forum
7+
* Documentation: http://www.phpvms.net/docs
8+
*
9+
* phpVMS is licenced under the following license:
10+
* Creative Commons Attribution Non-commercial Share Alike (by-nc-sa)
11+
* View license.txt in the root, or visit http://creativecommons.org/licenses/by-nc-sa/3.0/
12+
*
13+
* @author Nabeel Shahzad
14+
* @copyright Copyright (c) 2008, Nabeel Shahzad
15+
* @link http://www.phpvms.net
16+
* @license http://creativecommons.org/licenses/by-nc-sa/3.0/
17+
*/
18+
19+
class TemplateDiffs extends CodonModule
20+
{
21+
22+
public function index()
23+
{
24+
echo '<h3>Template Diff Viewer</h3>
25+
<p>This lists any templates which are found to have changes (based on the current selected skin)</p>
26+
<ul>';
27+
$dir_iterator = new RecursiveDirectoryIterator(Config::Get('BASE_TEMPLATE_PATH').DS.$file);
28+
$iterator = new RecursiveIteratorIterator($dir_iterator, RecursiveIteratorIterator::SELF_FIRST);
29+
30+
$custom_found = false;
31+
foreach ($iterator as $file)
32+
{
33+
if($file->getType() != 'file')
34+
{
35+
continue;
36+
}
37+
38+
$filename = $file->getBaseName();
39+
40+
$custom_path = SKINS_PATH.DS.$filename;
41+
42+
if(file_exists($custom_path))
43+
{
44+
$custom_found = true;
45+
echo '<li><strong>'.$filename.':</strong> <a href="'.adminurl('/templatediffs/showdiff/'.$filename).'">View changes</a></li>';
46+
}
47+
else
48+
{
49+
//echo 'No changes<br>';
50+
}
51+
}
52+
53+
if($custom_found === false)
54+
{
55+
echo '<li>No customized templates found in this skin\'s folder</li>';
56+
}
57+
58+
echo '</ul>';
59+
}
60+
61+
62+
public function showdiff($file)
63+
{
64+
$this->render('diff_showdiff.tpl');
65+
66+
# Paths
67+
$base = Config::Get('BASE_TEMPLATE_PATH').DS.$file;
68+
$custom = SKINS_PATH.DS.$file;
69+
70+
if(!file_exists($custom))
71+
{
72+
echo '<strong>Error: </strong>The file "'.$file.'" has not been modified';
73+
return;
74+
}
75+
76+
# Load the diffs
77+
include CORE_LIB_PATH.DS.'diff'.DS.'diff.php';
78+
$diff = new filediff();
79+
$text = $diff->inline($base, $custom, 2);
80+
echo count($diff->changes).' changes';
81+
echo $text;
82+
}
83+
}

0 commit comments

Comments
 (0)