Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
2 parents 495fa8c + f9724c8 commit 1401459a9fd5531422d6a6a6fb38f9bbc056f092 @h4rdc0m committed Jan 31, 2012
@@ -24,17 +24,19 @@ public function view() {
$timeStr = '%x ' . t('at') . ' %I:%M %p';
} else {
$timeStr = '%x ' . t('at') . ' %l:%M %p';
- }
- $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
- $this->set('uName', $ui->getUserName());
- $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
- $llu = UserStatistics::getLastLoggedInUser();
- if ($llu->getUserID() == $u->getUserID()) {
- $this->set('lastLoginSite', t('Your login is the most recent.'));
- } else {
- $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
}
- Loader::block('form');
+ if (is_object($ui)) {
+ $this->set('uLastLogin', strftime($timeStr, $ui->getLastLogin('user')));
+ $this->set('uName', $ui->getUserName());
+ $this->set('lastEditSite', strftime($timeStr, strtotime(PageStatistics::getSiteLastEdit('user'))));
+ $llu = UserStatistics::getLastLoggedInUser();
+ if ($llu->getUserID() == $u->getUserID()) {
+ $this->set('lastLoginSite', t('Your login is the most recent.'));
+ } else {
+ $this->set('lastLoginSite', strftime($timeStr, $llu->getLastLogin()));
+ }
+ Loader::block('form');
+ }
$this->set('totalFormSubmissions', FormBlockStatistics::getTotalSubmissions());
$this->set('totalFormSubmissionsToday', FormBlockStatistics::getTotalSubmissions(date('Y-m-d')));
}
@@ -107,6 +107,10 @@
define("LANGUAGE_DOMAIN_CORE", "messages");
+if (!defined('FILE_PERMISSIONS_MODE')) {
+ define('FILE_PERMISSIONS_MODE', 0775);
+}
+
# Path to the core files shared between all concrete 5 installations
if (!defined('DIR_BASE_CORE')) {
define('DIR_BASE_CORE', dirname(__FILE__) . '/..');
@@ -1,3 +1,3 @@
<?
defined('C5_EXECUTE') or die("Access Denied.");
-$APP_VERSION = '5.5.2a1';
+$APP_VERSION = '5.5.1.1';
@@ -124,7 +124,7 @@ private function setOptionalItems() {
$this->set('diffTest', false);
}
- if (version_compare(PHP_VERSION, '5.2.0', '>')) {
+ if (version_compare(PHP_VERSION, '5.2.0', '>=')) {
$phpVtest = true;
} else {
$phpVtest = false;
@@ -187,6 +187,7 @@ public function run_routine($pkgHandle, $routine) {
} catch(Exception $e) {
$js->error = true;
$js->message = $e->getMessage();
+ $this->reset();
}
print $jsx->encode($js);
exit;
@@ -230,6 +231,23 @@ protected function validateDatabase($e) {
return $e;
}
+ public function reset() {
+ // remove site.php so that we can try again ?
+ if (is_resource($this->fp)) {
+ fclose($this->fp);
+ }
+ if (file_exists(DIR_CONFIG_SITE . '/site_install.php')) {
+ unlink(DIR_CONFIG_SITE . '/site_install.php');
+ }
+ if (file_exists(DIR_CONFIG_SITE . '/site_install_user.php')) {
+ unlink(DIR_CONFIG_SITE . '/site_install_user.php');
+ }
+
+ if (file_exists(DIR_CONFIG_SITE . '/site.php')) {
+ unlink(DIR_CONFIG_SITE . '/site.php');
+ }
+ }
+
public function configure() {
try {
@@ -302,7 +320,9 @@ public function configure() {
$res = fwrite($this->fpu, $configuration);
fclose($this->fpu);
chmod(DIR_CONFIG_SITE . '/site_install_user.php', 0700);
- $this->redirect('/');
+ if (PHP_SAPI != 'cli') {
+ $this->redirect('/');
+ }
} else {
throw new Exception(t('Unable to open config/site_user.php for writing.'));
}
@@ -317,13 +337,7 @@ public function configure() {
}
} catch (Exception $e) {
- // remove site.php so that we can try again ?
- if (is_resource($this->fp)) {
- fclose($this->fp);
- }
- if (file_exists(DIR_CONFIG_SITE . '/site.php')) {
- unlink(DIR_CONFIG_SITE . '/site.php');
- }
+ $this->reset();
$this->set('error', $e);
}
}
@@ -24,12 +24,10 @@
<h6><?=t("All Attributes")?></h6>
<div class="ccm-block-type-search-wrapper ">
- <form onsubmit="return ccmPageAttributeSearchFormCheckResults()">
<div class="ccm-block-type-search">
<?=$form->text('ccmSearchAttributeListField', array('tabindex' => 1, 'autocomplete' => 'off', 'style' => 'width: 155px'))?>
</div>
- </form>
</div>
<?
@@ -92,16 +92,24 @@ public function mapSystemPath($prefix, $filename, $createDirectories = false, $b
$d3 = substr($prefix, 8);
if ($createDirectories) {
+ if (!is_dir($base)) {
+ @mkdir($base, FILE_PERMISSIONS_MODE, TRUE);
+ @chmod($base, FILE_PERMISSIONS_MODE);
+ @touch($base . '/' . $d1 . '/index.html');
+ }
if (!is_dir($base . '/' . $d1)) {
- @mkdir($base . '/' . $d1, 0777, TRUE);
+ @mkdir($base . '/' . $d1, FILE_PERMISSIONS_MODE, TRUE);
+ @chmod($base . '/' . $d1, FILE_PERMISSIONS_MODE);
@touch($base . '/' . $d1 . '/index.html');
}
if (!is_dir($base . '/' . $d1 . '/' . $d2)) {
- @mkdir($base . '/' . $d1 . '/' . $d2, 0777, TRUE);
+ @mkdir($base . '/' . $d1 . '/' . $d2, FILE_PERMISSIONS_MODE, TRUE);
+ @chmod($base . '/' . $d1 . '/' . $d2, FILE_PERMISSIONS_MODE);
@touch($base . '/' . $d1 . '/' . $d2 . '/index.html');
}
if (!is_dir($base . '/' . $d1 . '/' . $d2 . '/' . $d3)) {
- @mkdir($base . '/' . $d1 . '/' . $d2 . '/' . $d3, 0777, TRUE);
+ @mkdir($base . '/' . $d1 . '/' . $d2 . '/' . $d3, FILE_PERMISSIONS_MODE, TRUE);
+ @chmod($base . '/' . $d1 . '/' . $d2 . '/' . $d3, FILE_PERMISSIONS_MODE);
@touch($base . '/' . $d1 . '/' . $d2 . '/' . $d3 . '/index.html');
}
}
@@ -63,7 +63,7 @@ public function unfilename($filename) {
* @param string $target Place to copy the source
* @param int $mode What to chmod the file to
*/
- public function copyAll($source, $target, $mode = 0777) {
+ public function copyAll($source, $target, $mode = FILE_PERMISSIONS_MODE) {
if (is_dir($source)) {
@mkdir($target, $mode);
@chmod($target, $mode);
@@ -139,7 +139,8 @@ public function forceDownload($file) {
*/
public function getTemporaryDirectory() {
if (!is_dir(DIR_TMP)) {
- mkdir(DIR_TMP, 0777);
+ mkdir(DIR_TMP, FILE_PERMISSIONS_MODE);
+ chmod(DIR_TMP, FILE_PERMISSIONS_MODE);
touch(DIR_TMP . '/index.html');
}
return DIR_TMP;
@@ -178,6 +178,8 @@ public function create($originalPath, $newPath, $width, $height, $crop = false)
}
}
}
+
+ @chmod($newPath, FILE_PERMISSIONS_MODE);
}
/**
@@ -91,7 +91,9 @@ private function storeFile($prefix, $pointer, $filename, $fr = false) {
if ($path == false) {
$path = $fi->mapSystemPath($prefix, $filename, true);
}
- return @copy($pointer, $path);
+ $r = @copy($pointer, $path);
+ @chmod($path, FILE_PERMISSIONS_MODE);
+ return $r;
}
/**
@@ -155,22 +155,28 @@ public function make_directories() {
Cache::flush();
if (!is_dir(DIR_FILES_UPLOADED_THUMBNAILS)) {
- mkdir(DIR_FILES_UPLOADED_THUMBNAILS);
+ mkdir(DIR_FILES_UPLOADED_THUMBNAILS, FILE_PERMISSIONS_MODE);
+ chmod(DIR_FILES_UPLOADED_THUMBNAILS, FILE_PERMISSIONS_MODE);
}
if (!is_dir(DIR_FILES_INCOMING)) {
mkdir(DIR_FILES_INCOMING);
+ chmod(DIR_FILES_INCOMING, FILE_PERMISSIONS_MODE);
}
if (!is_dir(DIR_FILES_TRASH)) {
- mkdir(DIR_FILES_TRASH);
+ mkdir(DIR_FILES_TRASH, FILE_PERMISSIONS_MODE);
+ chmod(DIR_FILES_TRASH, FILE_PERMISSIONS_MODE);
}
if (!is_dir(DIR_FILES_CACHE)) {
- mkdir(DIR_FILES_CACHE);
+ mkdir(DIR_FILES_CACHE, FILE_PERMISSIONS_MODE);
+ chmod(DIR_FILES_CACHE, FILE_PERMISSIONS_MODE);
}
if (!is_dir(DIR_FILES_CACHE_DB)) {
- mkdir(DIR_FILES_CACHE_DB);
+ mkdir(DIR_FILES_CACHE_DB, FILE_PERMISSIONS_MODE);
+ chmod(DIR_FILES_CACHE_DB, FILE_PERMISSIONS_MODE);
}
if (!is_dir(DIR_FILES_AVATARS)) {
- mkdir(DIR_FILES_AVATARS);
+ mkdir(DIR_FILES_AVATARS, FILE_PERMISSIONS_MODE);
+ chmod(DIR_FILES_AVATARS, FILE_PERMISSIONS_MODE);
}
}
@@ -71,9 +71,9 @@ protected static function regenerateSession() {
unset($_SESSION['dashboardMenus']);
$tmpSession = $_SESSION;
session_write_close();
- setcookie(session_name(), session_id(), time()-100000);
+ @setcookie(session_name(), session_id(), time()-100000);
session_id(sha1(mt_rand()));
- session_start();
+ @session_start();
$_SESSION = $tmpSession;
}
@@ -5,9 +5,12 @@
if (REDIRECT_TO_BASE_URL == true) {
$protocol = 'http://';
$base_url = BASE_URL;
- if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS']) && ($base_url_ssl = Config::get('BASE_URL_SSL'))) {
+ if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'])) {
$protocol = 'https://';
- $base_url = $base_url_ssl;
+ $base_url_ssl = Config::get('BASE_URL_SSL');
+ if ($base_url_ssl) {
+ $base_url = $base_url_ssl;
+ }
}
$uri = $_SERVER['REQUEST_URI'];
@@ -21,5 +24,4 @@
exit;
}
-}
-
+}
View
No changes.

0 comments on commit 1401459

Please sign in to comment.