diff --git a/admin/editor-js.php b/admin/editor-js.php index a41f29f8..b1aed329 100644 --- a/admin/editor-js.php +++ b/admin/editor-js.php @@ -214,7 +214,7 @@ $(document).ready(function () { // 编辑预览切换 - var edittab = $('.editor').prepend('
'), + var edittab = $('.editor').prepend(''), editarea = $(textarea.parent()).attr("id", "wmd-editarea"); $(".wmd-edittab a").click(function() { diff --git a/admin/media.php b/admin/media.php index 399127df..6ef70c5b 100644 --- a/admin/media.php +++ b/admin/media.php @@ -27,7 +27,7 @@ Typecho_Widget::widget('Widget_Contents_Attachment_Edit')->to($attachment); diff --git a/admin/menu.php b/admin/menu.php index 92bba9e4..3f17e74d 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -9,7 +9,7 @@ if ($user->logged > 0) { _e('最后登录: %s', Typecho_I18n::dateWord($user->logged + $options->timezone, $options->gmtTime + $options->timezone)); } - ?>" href="adminUrl('profile.php'); ?>" class="author">screenName(); ?>网站 + ?>" href="adminUrl('profile.php'); ?>" class="author">screenName(); ?> diff --git a/var/Typecho/I18n/GetText.php b/var/Typecho/I18n/GetText.php index 81b858d2..36aa5498 100644 --- a/var/Typecho/I18n/GetText.php +++ b/var/Typecho/I18n/GetText.php @@ -78,17 +78,14 @@ class Typecho_I18n_GetText // Caching can be turned off $this->enable_cache = $enable_cache; - - // $MAGIC1 = (int)0x950412de; //bug in PHP 5 - $MAGIC1 = (int) - 1794895138; - // $MAGIC2 = (int)0xde120495; //bug - $MAGIC2 = (int) - 569244523; - $this->STREAM = @fopen($file, 'rb'); - $magic = $this->readint(); - if ($magic == $MAGIC1) { + + $unpacked = unpack('c', $this->read(4)); + $magic = array_shift($unpacked); + + if (-34 == $magic) { $this->BYTEORDER = 0; - } elseif ($magic == $MAGIC2) { + } elseif (-107 == $magic) { $this->BYTEORDER = 1; } else { $this->error = 1; // not MO file @@ -103,6 +100,24 @@ class Typecho_I18n_GetText $this->translations = $this->readint(); } + /** + * read + * + * @param mixed $count + * @access private + * @return void + */ + private function read($count) + { + $count = abs($count); + + if ($count > 0) { + return fread($this->STREAM, $count); + } + + return NULL; + } + /** * Reads a 32bit Integer from the Stream * @@ -111,7 +126,7 @@ class Typecho_I18n_GetText */ private function readint() { - $end = unpack($this->BYTEORDER == 0 ? 'V' : 'N', fread($this->STREAM, 4)); + $end = unpack($this->BYTEORDER == 0 ? 'V' : 'N', $this->read(4)); return array_shift($end); } @@ -123,7 +138,7 @@ class Typecho_I18n_GetText */ private function readintarray($count) { - return unpack(($this->BYTEORDER == 0 ? 'V' : 'N') . $count, fread($this->STREAM, 4 * $count)); + return unpack(($this->BYTEORDER == 0 ? 'V' : 'N') . $count, $this->read(4 * $count)); } /**