Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove layout engine #31

Merged
merged 19 commits into from
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
15eeb42
FIX base when dirname ends with directory separator
sigee Jun 20, 2017
6d3e854
FIX css issues
sigee Jun 20, 2017
0e87f82
Move header layout settings / printing from init() to the header.html…
sigee Jun 20, 2017
7de664c
Move footer layout printing from shutdown.php to the footer.html temp…
sigee Jun 20, 2017
a656117
Replace LayoutEngine to Fat-Free Template inside Home controller
sigee Jun 20, 2017
11ead9e
Inline displaySitemapEdit() function into SiteMap->parse()
sigee Jun 20, 2017
360b2bc
Replace LayoutEngine to Fat-Free Template inside SiteMap->parse() action
sigee Jun 20, 2017
b97cdb6
Replace LayoutEngine to Fat-Free Template inside Update controller
sigee Jun 20, 2017
c5c244f
Replace LayoutEngine to Fat-Free Template inside SiteMap->submitPageT…
sigee Jun 20, 2017
2f2e5cd
Inline writeSitemapUserinput() function into SiteMap->writeSiteMapUse…
sigee Jun 20, 2017
d103ae0
Add view printing to the SiteMap->writeSiteMapUserInput() action
sigee Jun 20, 2017
f2f6a81
Replace edit_files.php to Fat-Free Template
sigee Jun 20, 2017
af85ebe
Replace setup_expert.php to Fat-Free Template
sigee Jun 20, 2017
18da51d
Add a new dependency
sigee Jun 22, 2017
e21d7c5
Add a logger implementation
sigee Jun 22, 2017
0ff04e1
Change LayoutEngine info, warning, debug, error, etc. to Logger
sigee Jun 22, 2017
1331d20
Remove fclose, because it is not needed in case of filehandler is fal…
sigee Jun 22, 2017
4c04a3e
Add phpDoc and remove unneeded php closing tags
sigee Jun 22, 2017
c3f6bd5
Merge remote-tracking branch 'origin/master' into remove-layout-engine
sigee Jul 4, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
],
"require": {
"php": ">=5.5.0",
"bcosca/fatfree": "3.6.1"
"bcosca/fatfree": "3.6.1",
"psr/log": "1.0.2"
},
"require-dev": {
"phpunit/phpunit": "4.8.35"
Expand Down
51 changes: 49 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions cron.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@
// check settings
if ($SETTINGS['website'] == "") {
// no settings yet, force user to setup this first
$LAYOUT->addError('Please edit the settings <a href="index.php">here</a> and store them to the file system!', 'No valid settings found!');
\Sitepod\Log\Logger::instance()->error('No valid settings found! Please edit the settings <a href="index.php">here</a> and store them to the file system!');
} else { // settings exists, lets start = (German:) los gehts. :)
$FILE = parseFilesystem();


if (count($FILE) > 0) {
if (!writeSitemap($FILE)) {
$LAYOUT->addError('', 'Could not create sitemap file, giving up!');
\Sitepod\Log\Logger::instance()->error('Could not create sitemap file, giving up!');
} else {
$LAYOUT->addSuccess('Sitemap has been created and written to filesystem!', 'Sitemap successful created');
\Sitepod\Log\Logger::instance()->info('Sitemap successful created: Sitemap has been created and written to filesystem!');
if ($SETTINGS[PSNG_PINGGOOGLE]) {
submitPageToGoogle();
$LAYOUT->addSuccess('Sitemap has been submitted to Google!', 'Finished my job');
\Sitepod\Log\Logger::instance()->info('Finished my job: Sitemap has been submitted to Google!');
} else {
$LAYOUT->addInfo('Value for submit to google not set in settings', 'Sitemap not submitted to Google');
\Sitepod\Log\Logger::instance()->info('Sitemap not submitted to Google: Value for submit to google not set in settings');
}
}
} else {
$LAYOUT->addError('Will not write sitemap to filesystem nor submit it to Google!', 'Result from plugins was empty!');
\Sitepod\Log\Logger::instance()->error('Result from plugins was empty! Will not write sitemap to filesystem nor submit it to Google!');
}
}

Expand Down
2 changes: 1 addition & 1 deletion inc/Ontology.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@

define("PSNG_URL_UPDATESTATUS", 'http://enarion.net/google/phpsitemapng/status.php?version='.PSNG_VERSION);
define("PSNG_URL_DOWNLOAD", 'https://github.com/nasa/sitepod');
?>

59 changes: 14 additions & 45 deletions inc/functions/functions.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,9 @@
* along with Sitepod. If not, see <http://www.gnu.org/licenses/>.
*/

/**
/*
* misc functions
*/
function info($param, $msg = '') {
global $LAYOUT;

if ($param == "" && $msg == "") {
return;
}
if (is_array($param)) {
$LAYOUT->addInfo(\Sitepod\Util::arrToStringReadable($param, "<br>\n"), $msg);
} else {
$LAYOUT->addInfo($param, $msg);
}
}

function debug($param, $msg = '') {
global $SETTINGS, $LAYOUT;

if (isset($_SESSION[PSNG_DEBUG]) && isset($SETTINGS[PSNG_DEBUG]))
{
if ($SETTINGS[PSNG_DEBUG] === TRUE && $_SESSION[PSNG_DEBUG] === TRUE) {
if ($param == "" && $msg == "") {
return;
}
if (is_array($param)) {
$LAYOUT->addDebug(\Sitepod\Util::arrToStringReadable($param, "<br>\n"),$msg);
} else {
$LAYOUT->addDebug($param, $msg);
}
}
}
}

// source: http://de2.php.net/microtime
function microtime_float(){
Expand All @@ -57,6 +27,9 @@ function microtime_float(){

/**
* returns a filehandle if file is accessable
* @param string $filename
* @param bool $writable
* @return bool|resource
*/
function openFile($filename, $writable = FALSE) {
global $openFile_error;
Expand All @@ -83,7 +56,6 @@ function openFile($filename, $writable = FALSE) {
$filehandle = @fopen($filename, $accessLevel);
if ($filehandle === FALSE) {
$openFile_error = "File $filename could not be opened, don't know why";
@fclose($filehandle);

if (!file_exists($filename)) {
$openFile_error = "File $filename does not exist and I do not have the rights to create it!";
Expand All @@ -99,14 +71,11 @@ function openFile($filename, $writable = FALSE) {
* set and return action
*/
function init() {
global $SETTINGS, $_REQUEST, $LAYOUT;
global $SETTINGS, $_REQUEST;

session_start();

Base::instance()->set('base', $SETTINGS['base']);
// set layout engine
$LAYOUT = new Sitepod\LayoutEngine("Sitepod");
$LAYOUT->switchOffBuffer();

/* repair NOTICES mk/2005-11-08 */
if (isset($_REQUEST[PSNG_DEBUG]))
Expand All @@ -115,17 +84,17 @@ function init() {
if ($_REQUEST[PSNG_DEBUG] == 'on') {
$SETTINGS[PSNG_DEBUG] = TRUE;
$_SESSION[PSNG_DEBUG] = TRUE;
debug('', 'Debug on');
\Sitepod\Log\Logger::instance()->debug('Debug on');
} elseif ($_REQUEST[PSNG_DEBUG] == 'off') {
debug('', 'Debug off');
\Sitepod\Log\Logger::instance()->debug('Debug off');
$SETTINGS[PSNG_DEBUG] = FALSE;
$_SESSION[PSNG_DEBUG] = FALSE;
}
/* repair NOTICES mk/2005-11-08 */
}
else # mk assume off
{
debug('', 'Debug off');
\Sitepod\Log\Logger::instance()->debug( 'Debug off');
$SETTINGS[PSNG_DEBUG] = FALSE;
$_SESSION[PSNG_DEBUG] = FALSE;
}
Expand All @@ -145,10 +114,10 @@ function init() {
Base::instance()->set('displayViewSiteMapLink', true);
}

debug('version: '.PSNG_VERSION, 'This is Sitepod');
debug($SETTINGS, 'Merged settings');
\Sitepod\Log\Logger::instance()->debug('This is Sitepod version: '.PSNG_VERSION);
\Sitepod\Log\Logger::instance()->debug('Merged settings: ' . \Sitepod\Util::arrToStringReadable($SETTINGS, ','));

debug($SETTINGS[PSNG_SETTINGS_STATE], 'last state');
\Sitepod\Log\Logger::instance()->debug('Last state: ' . $SETTINGS[PSNG_SETTINGS_STATE]);
$action = '';
if (isset($_REQUEST[PSNG_ACTION])) {
$action = $_REQUEST[PSNG_ACTION];
Expand All @@ -161,7 +130,7 @@ function init() {
}

$SETTINGS[PSNG_SETTINGS_STATE] = $action;
debug($SETTINGS[PSNG_SETTINGS_STATE], "current state");
\Sitepod\Log\Logger::instance()->debug("Current state: " . $SETTINGS[PSNG_SETTINGS_STATE]);


$SETTINGS[PSNG_SETTINGS_EXECUTED][$action] = TRUE;
Expand Down Expand Up @@ -189,6 +158,8 @@ function resetFiles() {
/**
* checks a given filename if it exists and is writable
* returns empty string, if okay; otherwise the error message
* @param string $filename
* @return string
*/
function checkFile($filename) {
$file = @ fopen($filename, "r");
Expand Down Expand Up @@ -261,5 +232,3 @@ function storeSettings($SETTINGS, $filename, $keyname) {

return NULL;
}

?>
Loading