Skip to content

Commit

Permalink
multisite support added in fronted, backend and messy template
Browse files Browse the repository at this point in the history
  • Loading branch information
uldisrudzitis committed Feb 14, 2014
1 parent 0fae9b4 commit beb259a
Show file tree
Hide file tree
Showing 19 changed files with 111 additions and 136 deletions.
76 changes: 29 additions & 47 deletions INSTALL/includes/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
include $ENGINE_ROOT . 'inc.page.php';
}



if(empty($settings['berta']['installed'])) {

function getStatus($isOk, $message, $failDesc = '', $isIndented = false, $isFatal = true) {
return '<li' . ($isIndented ? ' class="indented"' : '') . '><div class="status xVisualStatus' . ($isOk ? 'OK' : ($isFatal ? 'Fail' : 'Warning')) . '">' . ($isOk ? 'YES' : 'NO') . '</div>' . $message .
(!$isOk && $failDesc ? ('<div class="infoFail">' . $failDesc . '</div>') : '') .
return '<li' . ($isIndented ? ' class="indented"' : '') . '><div class="status xVisualStatus' . ($isOk ? 'OK' : ($isFatal ? 'Fail' : 'Warning')) . '">' . ($isOk ? 'YES' : 'NO') . '</div>' . $message .
(!$isOk && $failDesc ? ('<div class="infoFail">' . $failDesc . '</div>') : '') .
'</li>';
}

Expand Down Expand Up @@ -45,15 +43,15 @@ function getStatus($isOk, $message, $failDesc = '', $isIndented = false, $isFata
$gdInfo['JPEG Support'] = isset($gdInfo['JPEG Support']) ? $gdInfo['JPEG Support'] : (isset($gdInfo['JPG Support']) ? $gdInfo['JPG Support'] : false);
$listOk &= $gdInfo['JPEG Support'];
$listHasErrors |= (!$gdInfo['GIF Read Support'] || !$gdInfo['JPEG Support'] || !$gdInfo['PNG Support']);
$testOutput .= getStatus($gdInfo['GIF Read Support'], 'GIF read support', 'You won\'t be able to upload GIF images for your website', true, false);
$testOutput .= getStatus($gdInfo['JPEG Support'], 'JPEG support', 'You won\'t be able to upload JPEG images for your website. Berta won\'t be able to make thumbnails for your images... bad! Ask your server administrator for JPEG support.', true);
$testOutput .= getStatus($gdInfo['PNG Support'], 'PNG support', 'You won\'t be able to upload PNG images for your website', true, false);
$testOutput .= getStatus($gdInfo['GIF Read Support'], 'GIF read support', 'You won\'t be able to upload GIF images for your website', true, false);
$testOutput .= getStatus($gdInfo['JPEG Support'], 'JPEG support', 'You won\'t be able to upload JPEG images for your website. Berta won\'t be able to make thumbnails for your images... bad! Ask your server administrator for JPEG support.', true);
$testOutput .= getStatus($gdInfo['PNG Support'], 'PNG support', 'You won\'t be able to upload PNG images for your website', true, false);
}

// upload sizes ...
$isOk = floatval(ini_get('upload_max_filesize')) >= 256 && floatval(ini_get('post_max_size')) >= 256;
/*$listOk &= $isOk;*/ $listHasErrors |= !$isOk;
$testOutput .= getStatus($isOk, 'Large file uploads (for videos) allowed',
$testOutput .= getStatus($isOk, 'Large file uploads (for videos) allowed',
'Your server runs PHP in CGI mode, which doesn\'t allow tweaking PHP options in .htaccess files. Please tell this to your server administrator and ask for bigger file uploads (over 200Mb for larger videos).', false, false);


Expand All @@ -63,14 +61,12 @@ function getStatus($isOk, $message, $failDesc = '', $isIndented = false, $isFata
$isOk = file_exists($SITE_ROOT . 'storage') && is_writable($SITE_ROOT . 'storage');
$listOk &= $isOk; $listHasErrors |= !$isOk;
$testOutput .= getStatus($isOk, 'Storage folder exists and is writable', 'Please make sure the folder called "storage" in your Berta installation exists and is writable. Check step (3) in the installing instructions (located in the INSTALL folder) for details.');

$testOutput .= '</ul>';
$testOutput .= '<p>A green <span class="xVisualStatusOK">YES</span> means that you don\'t even need to read what it is about - it\'s just all fine. A yellow <span class="xVisualStatusWarning">NO</span> means that ' .
'Berta will still work, but the feature will not be available to you. The red <span class="xVisualStatusFail">NO</span> is the bad one - if there is one, it will have a suggestion ' .
$testOutput .= '<p>A green <span class="xVisualStatusOK">YES</span> means that you don\'t even need to read what it is about - it\'s just all fine. A yellow <span class="xVisualStatusWarning">NO</span> means that ' .
'Berta will still work, but the feature will not be available to you. The red <span class="xVisualStatusFail">NO</span> is the bad one - if there is one, it will have a suggestion ' .
'what can be done to correct the situation.</p>';



// if the test was ok without any warnings then redirect to the next step
if($listOk && !$listHasErrors) {
header('Location: .?_berta_install_step=2');
Expand All @@ -79,7 +75,6 @@ function getStatus($isOk, $message, $failDesc = '', $isIndented = false, $isFata
}



?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
Expand All @@ -102,84 +97,71 @@ function getStatus($isOk, $message, $failDesc = '', $isIndented = false, $isFata
</body><?php

} else {

?><body class="xLoginPageBody">
<div class="xMAlign-container xPanel">
<div class="xMAlign-outer">
<div class="xMAlign-inner justify">
<?php

if($listOk) {
$bottomNote = '<p class="xBottomNote">Note: This check-list is displayed only once. To re-enable it you will need to manually edit settings.xml file in your storage folder and delete the row that looks like <strong><code>' . htmlspecialchars('<installed><![CDATA[1]]></installed>') . '</code></strong>.</p>';

if(!$listHasErrors) {

// normally this is not visible because of a redirect earlier...

echo '<div id="xFirstTimeCheckResult">';
echo '<h2>Welcome!</h2>';
echo '<p class="emphasis">Berta has completed a small test to see if it has everything it needs. It turns out that everything is just perfect.</p>';
echo '<p><input type="button" value=" Start building your site! " id="xFirstTimeCheckContinue" onclick="window.location=\'' . $ENGINE_ABS_ROOT . '?_berta_install_step=2\'" /></p>';
echo '<p><input type="button" value=" Start building your site! " id="xFirstTimeCheckContinue" onclick="window.location=\'' . $ENGINE_ABS_ROOT . '?_berta_install_step=2'.(!empty($options['MULTISITE']) ? '&site='.$options['MULTISITE'] : '').'\'" /></p>';
echo '<br class="clear" /></div>';

echo '<p>Test results:</p>';
echo $testOutput;
echo $bottomNote;

} else {

// some warnings...

echo '<div id="xFirstTimeCheckResult">';
echo '<h2>Welcome...</h2>';
echo '<p class="emphasis">Berta has completed a small test to see if it has everything it needs.</p>';
echo '<p class="emphasis">It appears that there are some issues with the server or the installation. You will be able to use Berta, although with limited functionality. Please take a look at the results below.</p>';
echo '</div>';

echo $testOutput;
echo '<p><br />If you like to, you can ignore the errors and: <input type="button" value=" Start with Berta! " class="xCheckListContinue" onclick="window.location=\'' . $ENGINE_ABS_ROOT . '?_berta_install_step=2\'" /></p>';

echo '<p><br />If you like to, you can ignore the errors and: <input type="button" value=" Start with Berta! " class="xCheckListContinue" onclick="window.location=\'' . $ENGINE_ABS_ROOT . '?_berta_install_step=2'.(!empty($options['MULTISITE']) ? '&site='.$options['MULTISITE'] : '').'\'" /></p>';

echo $bottomNote;
}


} else {

// errors..

echo '<div id="checkResult">';
echo '<h2>Take action!</h2>';
echo '<p class="emphasis">Berta has completed a small test to see if it has everything it needs.</p>';
echo '<p class="emphasis">It turns out that there are some problems with the server or with the installation. Please take a look at the results below and follow the suggestions for each error, and then come back again! </p>';
echo '</div>';

echo $testOutput;

echo '<p><input type="button" value=" Run the test again... " id="xFirstTimeCheckContinue" onclick="window.location.reload()" /></p>';

}






?></div>
</div>
</div>
</body><?php


}


}

?></html><?php







?>
2 changes: 1 addition & 1 deletion INSTALL/includes/first_visit.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<div class="xMAlign-container xPanel">
<div class="xMAlign-outer">
<div class="xMAlign-inner">
<?php echo I18n::_('welcome_text__not_installed') ?>
<?php echo sprintf(I18n::_('welcome_text__not_installed'), $ENGINE_ABS_ROOT . (!empty($options['MULTISITE']) ? '?site='.$options['MULTISITE'] : '')) ?>
</div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions INSTALL/includes/wizzard.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
</body><?php

} else {

?><body class="xLoginPageBody" x_mode="settings">
<div class="xMAlign-container xPanel">
<div class="xMAlign-outer">
Expand All @@ -50,7 +50,7 @@
<h2><?php echo I18n::_('Setup your site') ?></h2>

<p class="emphasis"><?php echo I18n::_('setup_info_text') ?></p>


<p>1. <?php echo I18n::_('What is the title of your site?') ?></p>
<p class="subInfo"><?php echo I18n::_('Site title will be visible in all sections of your site.') ?></p>
Expand Down Expand Up @@ -81,7 +81,7 @@
<p class="subInfo"><?php echo I18n::_('Note: the fields that already have value appear yellow only when you roll over them with your mouse. Click on the text below to edit.') ?></p>
<p class="xFirstTimeField <?php echo $xEditSelectorSimple ?> xProperty-texts/metaDescription xRequired-<?php echo $berta->settings->isRequired('texts', 'metaDescription') ? '1': '0' ?>"><?php echo $berta->settings->get('texts', 'metaDescription', true) ?></p>

<p><input type="button" value=" <?php echo I18n::_('Done!') ?> " id="xFirstTimeCheckContinue" onclick="window.location='<?php echo $ENGINE_ABS_ROOT ?>?_berta_install_done=1'" /></p>
<p><input type="button" value=" <?php echo I18n::_('Done!') ?> " id="xFirstTimeCheckContinue" onclick="window.location='<?php echo $ENGINE_ABS_ROOT ?>?_berta_install_done=1<?php echo !empty($options['MULTISITE']) ? '&site='.$options['MULTISITE'] : '' ?>'" /></p>

</div>
<?php
Expand All @@ -90,7 +90,7 @@
</div>
</div>
</body><?php


}

Expand Down
Loading

0 comments on commit beb259a

Please sign in to comment.