1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-01 10:50:37 +02:00

Merge branch 'master'

This commit is contained in:
Awilum
2013-12-08 21:04:12 +04:00
7 changed files with 53 additions and 57 deletions

View File

@@ -83,7 +83,7 @@
<input name="login" class="input-xlarge" type="text" value="<?php echo $user_login; ?>" /> <input name="login" class="input-xlarge" type="text" value="<?php echo $user_login; ?>" />
<?php if (Option::get('captcha_installed') == 'true') { ?> <?php if (Option::get('captcha_installed') == 'true') { ?>
<label><?php echo __('Captcha'); ?><label> <label><?php echo __('Captcha', 'users'); ?></label>
<input type="text" name="answer" class="input-xlarge"> <input type="text" name="answer" class="input-xlarge">
<?php CryptCaptcha::draw(); ?> <?php CryptCaptcha::draw(); ?>
<?php } ?> <?php } ?>

View File

@@ -173,9 +173,10 @@ class Image
public function resize($width, $height = null, $aspect_ratio = null) public function resize($width, $height = null, $aspect_ratio = null)
{ {
// Redefine vars // Redefine vars
$width = (int) $width; $width = (int) $width;
$height = ($height === null) ? null : (int) $height; $height = ($height === null) ? null : (int) $height;
$aspect_ratio = ($aspect_ratio === null) ? null : (int) $aspect_ratio; $aspect_ratio = ($aspect_ratio === null) ? null : (int) $aspect_ratio;
$xpos = $ypos = 0;
// Resizes the image to {$width}% of the original size // Resizes the image to {$width}% of the original size
if ($height === null) { if ($height === null) {
@@ -186,13 +187,18 @@ class Image
} else { } else {
// Resizes the image to the smalles possible dimension while maintaining aspect ratio // Resizes the image to the smalles possible dimension while maintaining aspect ratio
if ($aspect_ratio === Image::AUTO) { if ($aspect_ratio === Image::AUTO || $aspect_ratio === null) {
// Calculate smallest size based on given height and width while maintaining aspect ratio // Calculate smallest size based on given height and width while maintaining aspect ratio
$percentage = min(($width / $this->width), ($height / $this->height)); $percentage = min(($width / $this->width), ($height / $this->height));
$new_width = round($this->width * $percentage); $new_width = round($this->width * $percentage);
$new_height = round($this->height * $percentage); $new_height = round($this->height * $percentage);
if ($aspect_ratio === null) {
$xpos = (int)(($width - $new_width) / 2);
$ypos = (int)(($height - $new_height) / 2);
}
// Resizes the image using the width to maintain aspect ratio // Resizes the image using the width to maintain aspect ratio
} elseif ($aspect_ratio === Image::WIDTH) { } elseif ($aspect_ratio === Image::WIDTH) {
@@ -216,31 +222,27 @@ class Image
} }
} }
// Create a new true color image width new width and height $old_image = $this->image;
$resized = imagecreatetruecolor($new_width, $new_height);
$transPng = imagecolorallocatealpha($resized, 0, 0, 0, 127); if ($aspect_ratio === null) {
imagefill($resized, 0, 0, $transPng); $this->image = imagecreatetruecolor($width, $height);
} else {
$this->image = imagecreatetruecolor($new_width, $new_height);
}
if ($this->type === IMAGETYPE_PNG) {
$bgcolor = imagecolorallocatealpha($this->image, 0, 0, 0, 127);
} else {
$bgcolor = imagecolorallocate($this->image, 255, 255, 255);
}
imagefill($this->image, 0, 0, $bgcolor);
// Copy and resize part of an image with resampling // Copy and resize part of an image with resampling
imagecopyresampled($resized, $this->image, 0, 0, 0, 0, $new_width, $new_height, $this->width, $this->height); imagecopyresampled($this->image, $old_image, $xpos, $ypos, 0, 0, $new_width, $new_height, $this->width, $this->height);
// Destroy an image // Destroy an image
imagedestroy($this->image); imagedestroy($old_image);
// Create a new true color image width new width and height
$this->image = imagecreatetruecolor($new_width, $new_height);
$transPng = imagecolorallocatealpha($this->image, 0, 0, 0, 127);
imagefill($this->image, 0, 0, $transPng);
// Copy and resize part of an image with resampling
imagecopyresampled($this->image, $resized, 0, 0, 0, 0, $new_width, $new_height, $new_width, $new_height);
// Destroy an image
imagedestroy($resized);
// Save new width and height
$this->width = $new_width;
$this->height = $new_height;
return $this; return $this;
} }
@@ -263,39 +265,27 @@ class Image
// Redefine vars // Redefine vars
$width = (int) $width; $width = (int) $width;
$height = (int) $height; $height = (int) $height;
$x = (int) $x; $x = (int) $x;
$y = (int) $y; $y = (int) $y;
// Calculate // Calculate
if ($x + $width > $this->width) $width = $this->width - $x; if ($x + $width > $this->width) $width = $this->width - $x;
if ($y + $height > $this->height) $height = $this->height - $y; if ($y + $height > $this->height) $height = $this->height - $y;
if ($width <= 0 || $height <= 0) return false; if ($width <= 0 || $height <= 0) return false;
// Create a new true color image $old_image = $this->image;
$crop = imagecreatetruecolor($width, $height);
$transPng = imagecolorallocatealpha($crop, 0, 0, 0, 127);
imagefill($crop, 0, 0, $transPng);
// Copy and resize part of an image with resampling
imagecopyresampled($crop, $this->image, 0, 0, $x, $y, $this->width, $this->height, $this->width, $this->height);
// Destroy an image
imagedestroy($this->image);
// Create a new true color image // Create a new true color image
$this->image = imagecreatetruecolor($width, $height); $this->image = imagecreatetruecolor($width, $height);
$transPng = imagecolorallocatealpha($this->image, 0, 0, 0, 127);
imagefill($this->image, 0, 0, $transPng); $transparent = imagecolorallocatealpha($this->image, 0, 0, 0, 127);
imagefill($this->image, 0, 0, $transparent);
// Copy and resize part of an image with resampling // Copy and resize part of an image with resampling
imagecopyresampled($this->image, $crop, 0, 0, 0, 0, $width, $height, $width, $height); imagecopyresampled($this->image, $old_image, 0, 0, 0, 0, $width, $height, $width, $height);
// Destroy an image // Destroy an image
imagedestroy($crop); imagedestroy($old_image);
// Save new width and height
$this->width = $width;
$this->height = $height;
return $this; return $this;
} }

View File

@@ -10,7 +10,7 @@
'Create New Block' => 'Erstelle einen neuen Block', 'Create New Block' => 'Erstelle einen neuen Block',
'New Block' => 'Neuer Block', 'New Block' => 'Neuer Block',
'Edit Block' => 'Bearbeite Block', 'Edit Block' => 'Bearbeite Block',
'Save' => 'Save', 'Save' => 'Speichern',
'Save and Exit' => 'Speichern und Schließen', 'Save and Exit' => 'Speichern und Schließen',
'Actions' => 'Aktionen', 'Actions' => 'Aktionen',
'Required field' => 'Erforderliches Feld', 'Required field' => 'Erforderliches Feld',
@@ -19,9 +19,9 @@
'Delete block: :block' => 'Lösche Block: :block', 'Delete block: :block' => 'Lösche Block: :block',
'Block content' => 'Block-Inhalt', 'Block content' => 'Block-Inhalt',
'Block <i>:name</i> deleted' => 'Block <i>:name</i> gelöscht', 'Block <i>:name</i> deleted' => 'Block <i>:name</i> gelöscht',
'Your changes to the block <i>:name</i> have been saved.' => 'Deine Änderungen für den Block <i>:name</i> wurden übernommen.', 'Your changes to the block <i>:name</i> have been saved.' => 'Deine Änderungen für den Block <i>:name</i> wurden gespeichert.',
'Delete block: :block' => 'Lösche Block: :block', 'Delete block: :block' => 'Lösche Block: :block',
'View Embed Code' => 'View Embed Code', 'View Embed Code' => 'Zeige Embed Code',
'Embed Code' => 'Embed Code', 'Embed Code' => 'Embed Code',
'Shortcode' => 'Shortcode', 'Shortcode' => 'Shortcode',
'PHP Code' => 'PHP Code', 'PHP Code' => 'PHP Code',

View File

@@ -1,5 +1,11 @@
<ul> <ul>
<?php foreach ($pages as $page) { ?> <?php
foreach ($pages as $page) {
if ($page['status'] == 'published') {
?>
<li><a href="<?php echo $page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a></li> <li><a href="<?php echo $page['parent'].'/'.$page['slug']; ?>"><?php echo $page['title']; ?></a></li>
<?php } ?> <?php
}
}
?>
</ul> </ul>

View File

@@ -8,12 +8,12 @@
'Password' => 'Passwort', 'Password' => 'Passwort',
'Registered' => 'Registriert', 'Registered' => 'Registriert',
'Email' => 'Email', 'Email' => 'Email',
'Role' => 'Rolle', 'Role' => 'Funktion',
'Roles' => 'Rollen', 'Roles' => 'Funktionen',
'Edit' => 'Bearbeiten', 'Edit' => 'Bearbeiten',
'Actions' => 'Aktionen', 'Actions' => 'Aktionen',
'Delete' => 'Löschen', 'Delete' => 'Löschen',
'Log In' => 'Log In', 'Log In' => 'Einloggen',
'Log Out' => 'Ausloggen', 'Log Out' => 'Ausloggen',
'Register New User' => 'Registriere Neuen Benutzer', 'Register New User' => 'Registriere Neuen Benutzer',
'New User Registration' => 'Neuen Benutzer registrieren', 'New User Registration' => 'Neuen Benutzer registrieren',
@@ -40,7 +40,7 @@
'Captcha' => 'Captcha', 'Captcha' => 'Captcha',
'Registration' => 'Registrierung', 'Registration' => 'Registrierung',
'Username' => 'Benutzername', 'Username' => 'Benutzername',
'User email is invalid' => 'Benutzer Email ist nicht gültig', 'User email is invalid' => 'Benutzer-Email ist nicht gültig',
'Reset Password' => 'Passwort zurücksetzen', 'Reset Password' => 'Passwort zurücksetzen',
'Send New Password' => 'Neues Passwort zusenden', 'Send New Password' => 'Neues Passwort zusenden',
'This user doesnt alredy exist' => 'Dieser Benutzer ist nocht nicht vorhanden', 'This user doesnt alredy exist' => 'Dieser Benutzer ist nocht nicht vorhanden',

View File

@@ -16,7 +16,7 @@
?> ?>
<?php if (Option::get('captcha_installed') == 'true') { ?> <?php if (Option::get('captcha_installed') == 'true') { ?>
<label><?php echo __('Captcha'); ?><label> <label><?php echo __('Captcha', 'users'); ?></label>
<input type="text" name="answer" class="input-large"><?php if (isset($errors['users_captcha_wrong'])) echo Html::nbsp(3).'<span class="error">'.$errors['users_captcha_wrong'].'</span>'; ?> <input type="text" name="answer" class="input-large"><?php if (isset($errors['users_captcha_wrong'])) echo Html::nbsp(3).'<span class="error">'.$errors['users_captcha_wrong'].'</span>'; ?>
<?php CryptCaptcha::draw(); ?> <?php CryptCaptcha::draw(); ?>
<?php } ?> <?php } ?>

View File

@@ -21,7 +21,7 @@
if (isset($errors['users_invalid_email'])) echo Html::nbsp(3).'<span class="error">'.$errors['users_invalid_email'].'</span>'; if (isset($errors['users_invalid_email'])) echo Html::nbsp(3).'<span class="error">'.$errors['users_invalid_email'].'</span>';
?> ?>
<?php if (Option::get('captcha_installed') == 'true') { ?> <?php if (Option::get('captcha_installed') == 'true') { ?>
<label><?php echo __('Captcha'); ?><label> <label><?php echo __('Captcha', 'users'); ?></label>
<input type="text" name="answer" class="input-large"><?php if (isset($errors['users_captcha_wrong'])) echo Html::nbsp(3).'<span class="error">'.$errors['users_captcha_wrong'].'</span>'; ?> <input type="text" name="answer" class="input-large"><?php if (isset($errors['users_captcha_wrong'])) echo Html::nbsp(3).'<span class="error">'.$errors['users_captcha_wrong'].'</span>'; ?>
<?php CryptCaptcha::draw(); ?> <?php CryptCaptcha::draw(); ?>
<?php } ?> <?php } ?>