diff --git a/documents/manual_config.txt b/documents/manual_config.txt index 2a9c2481c..a8e402636 100644 --- a/documents/manual_config.txt +++ b/documents/manual_config.txt @@ -51,4 +51,6 @@ $database['port'] = 3639; // Database port number $database['dbms'] = 'MySQL'; // DBMS. (MySQL, MySQLi, PostgreSQL, Cubrid.) $service['memcached'] = false; // Using memcache to handle session and cache $memcached['server'] = 'localhost'; // Where memcache server is. -?> \ No newline at end of file +// From Textcube 1.8.4 +$service['requirelogin'] = false; // Force log-in process to every blogs. (for private blog service) +?> diff --git a/documents/manual_workflow.txt b/documents/manual_workflow.txt index 14e90357f..05d7bf050 100644 --- a/documents/manual_workflow.txt +++ b/documents/manual_workflow.txt @@ -15,6 +15,8 @@ Dispatching +------+------+ +------+------+ | rewrite.php + | + /framework/Dispatcher.php | + /config.php (Context / URL / configuration loading) | @@ -23,9 +25,11 @@ Dispatching +------+------+ | -------------------------------------- library/preprocessor.php (Preprocessing) ----------------- | - Base components loading + Base components loading ( /framework/boot ) + Environment Normalization (Unification) + Core component loading + + Component / library autoload setting + + Authenticating settings | Validation + Basic POST/GET value validation @@ -44,22 +48,20 @@ Dispatching +------+------+ /library/include.php | + /library/config.php | + /config.php (override) - | + /library/component/~ - | [Loading mandatory models / views] | + /library/model/~ | + /library/view/~ ------------ | Initializing | | If database needed, - +------------------------------+--------------=====----------+ + +------------------------------+-----------------------------+ | | | Initializing database I/O | - | + /library/components/Needlworks.DBMS.XXX.php | + | + /framework/data/DBModel.php | | | | Loading memcache module (if use) | | Creating Session (if requested) | - | + /library/components/Textcube.Data.Session.XXX.php | + | + /framework/legacy/Textcube.Data.Session.XXX.php | +------------------------------+-----------------------------+ | If initialization needed, diff --git a/framework/boot/30-Auth.php b/framework/boot/30-Auth.php index 436197244..9283557ea 100644 --- a/framework/boot/30-Auth.php +++ b/framework/boot/30-Auth.php @@ -260,7 +260,6 @@ function authorize( $domain, $userid ) { $data->setQualifier('userid','equals',intval($userid)); $data->setAttribute('lastLogin',Timestamp::getUNIXtime()); $data->update(); -// POD::execute("UPDATE {$this->context->getProperty('database.prefix')}Privileges SET lastLogin = ".Timestamp::getUNIXtime()." WHERE blogid = $blogid AND userid = $userid"); return; } diff --git a/framework/legacy/Textcube.Core.php b/framework/legacy/Textcube.Core.php index ae97b8c83..7b06504e0 100644 --- a/framework/legacy/Textcube.Core.php +++ b/framework/legacy/Textcube.Core.php @@ -6,8 +6,6 @@ /* This component contains 'User', 'Blog' and 'Transaction' class. NOTE : Classes described below are actually not object. Usually they are static.*/ -requireComponent('Textcube.Control.Auth'); - // for Global Cache global $__gCacheUserNames; $__gCacheUserNames = array(); diff --git a/framework/legacy/Textcube.Data.Post.php b/framework/legacy/Textcube.Data.Post.php index e4faf9342..d3e1b7f8b 100644 --- a/framework/legacy/Textcube.Data.Post.php +++ b/framework/legacy/Textcube.Data.Post.php @@ -497,13 +497,13 @@ function updateRemoteResponses($id = null) { return false; $succeeded = true; foreach ($posts as $id) { - $trackbacks = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}RemoteResponses WHERE blogid = ".$this->blogid." AND entry = $id AND isfiltered = 0 AND type = 'trackback'"); + $trackbacks = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}RemoteResponses WHERE blogid = ".$this->blogid." AND entry = $id AND isfiltered = 0 AND responsetype = 'trackback'"); if (!is_null($trackbacks)) { if (!POD::execute("UPDATE {$database['prefix']}Entries SET trackbacks = $trackbacks WHERE blogid = ".$this->blogid." AND id = $id")) $succeeded = false; } - $pingbacks = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}RemoteResponses WHERE blogid = ".$this->blogid." AND entry = $id AND isFiltered = 0 AND type = 'pingback'"); + $pingbacks = POD::queryCell("SELECT COUNT(*) FROM {$database['prefix']}RemoteResponses WHERE blogid = ".$this->blogid." AND entry = $id AND isFiltered = 0 AND responsetype = 'pingback'"); if (!is_null($pingbacks)) { if (!POD::execute("UPDATE {$database['prefix']}Entries SET pingbacks = $pingbacks WHERE blogid = ".$this->blogid." AND id = $id")) diff --git a/framework/legacy/Textcube.Data.RemoteResponse.php b/framework/legacy/Textcube.Data.RemoteResponse.php index 9e8bcdf91..fba1e1ffc 100644 --- a/framework/legacy/Textcube.Data.RemoteResponse.php +++ b/framework/legacy/Textcube.Data.RemoteResponse.php @@ -30,7 +30,7 @@ function open($filter = '', $fields = '*', $sort = 'written') { if (!empty($sort)) $sort = 'ORDER BY ' . $sort; $this->close(); - $this->_result = POD::query("SELECT $fields FROM {$database['prefix']}RemoteResponses WHERE blogid = ".getBlogId()." AND type = 'trackback' $filter $sort"); + $this->_result = POD::query("SELECT $fields FROM {$database['prefix']}RemoteResponses WHERE blogid = ".getBlogId()." AND responsetype = 'trackback' $filter $sort"); if ($this->_result) { if ($this->_count = POD::num_rows($this->_result)) return $this->shift(); @@ -114,7 +114,7 @@ function _buildQuery() { $query = DBModel::getInstance(); $query->reset('RemoteResponses'); $query->setQualifier('blogid', getBlogId()); - $query->setQualifier('type', 'trackback'); + $query->setQualifier('responsetype', 'trackback'); if (isset($this->id)) { if (!Validator::number($this->id, 1)) return $this->_error('id'); @@ -196,7 +196,7 @@ function open($filter = '', $fields = '*', $sort = 'written') { if (!empty($sort)) $sort = 'ORDER BY ' . $sort; $this->close(); - $this->_result = POD::query("SELECT $fields FROM {$database['prefix']}RemoteResponses WHERE blogid = ".getBlogId()." AND type = 'pingback' $filter $sort"); + $this->_result = POD::query("SELECT $fields FROM {$database['prefix']}RemoteResponses WHERE blogid = ".getBlogId()." AND responsetype = 'pingback' $filter $sort"); if ($this->_result) { if ($this->_count = POD::num_rows($this->_result)) return $this->shift(); @@ -282,7 +282,7 @@ function _buildQuery() { $query = DBModel::getInstance(); $query->reset('RemoteResponses'); $query->setQualifier('blogid', getBlogId()); - $query->setQualifier('type', 'pingback'); + $query->setQualifier('responsetype', 'pingback'); if (isset($this->id)) { if (!Validator::number($this->id, 1)) return $this->_error('id'); diff --git a/framework/legacy/Textcube.Function.Image.php b/framework/legacy/Textcube.Function.Image.php index de1c17b02..8615ea2e4 100644 --- a/framework/legacy/Textcube.Function.Image.php +++ b/framework/legacy/Textcube.Function.Image.php @@ -2,518 +2,10 @@ /// Copyright (c) 2004-2010, Needlworks / Tatter Network Foundation /// All rights reserved. Licensed under the GPL. /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) -class Image { - function Image() { - $this->reset(); - } - - function reset() { - $this->extraPadding = 0; - $this->imageFile = NULL; - $this->resultImageDevice = NULL; - } - - function resample($width, $height) { - if (empty($width) && empty($height)) - return false; - if (empty($this->imageFile) || !file_exists($this->imageFile)) - return false; - - // create an image device as image format. - switch ($this->getImageType($this->imageFile)) { - case "gif": - if (imagetypes() & IMG_GIF) { - $originImageDevice = imagecreatefromgif($this->imageFile); - } else { - return false; - } - break; - case "jpg": - if (imagetypes() & IMG_JPG) { - $originImageDevice = imagecreatefromjpeg($this->imageFile); - } else { - return false; - } - break; - case "png": - if ((imagetypes() & IMG_PNG) && function_exists('imagecreatefrompng')) { - $originImageDevice = imagecreatefrompng($this->imageFile); - } else { - return false; - } - break; - case "wbmp": - if (imagetypes() & IMG_WBMP) { - $originImageDevice = imagecreatefromwbmp($this->imageFile); - } else { - return false; - } - break; - case "xpm": - if (imagetypes() & IMG_XPM) { - $originImageDevice = imagecreatefromxpm($this->imageFile); - } else { - return false; - } - break; - default: - return false; - break; - } - // 리샘플링은 최종단계에서 리샘플링만을 하는 기능임. 시스템을 예로 들면 OS의 기능에 해당함. - // 이미지 프로세스는 어플리케이션의 기능으로 볼 수 있고, 따라서 이미지 리샘플링 중에는 이벤트가 끼어들면 안 됨. - //$originImageDevice = fireEvent('BeforeResizeImage', $originImageDevice, $this); - - if (Path::getExtension($this->imageFile) == ".gif") { - $this->resultImageDevice = imagecreate($width, $height); - } else { - $this->resultImageDevice = imagecreatetruecolor($width, $height); - } - - $bgColorBy16 = $this->hexRGB("FFFFFF"); - $temp = imagecolorallocate($this->resultImageDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); - imagefilledrectangle($this->resultImageDevice, 0, 0, $width, $height, $temp); - imagecopyresampled($this->resultImageDevice, $originImageDevice, 0, 0, 0, 0, $width, $height, imagesx($originImageDevice), imagesy($originImageDevice)); - imagedestroy($originImageDevice); - //$this->resultImageDevice = fireEvent('AfterResizeImage', $this->resultImageDevice, $this); - - return true; - } - - function resizeImageToContent($property, $originSrc, $imageWidth) { - if ( !is_readable($originSrc) ) { - return array($property, false); - } - - list($originWidth, $originHeight, $type, $attr) = getimagesize($originSrc); - $attributes = Misc::getAttributesFromString($property, false); - - // 단위 변환. - $onclickFlag = false; - if (array_key_exists('width', $attributes)) { - if (preg_match('/(.+)(%?)/', $attributes['width'], $matches)) { - if($matches[2] == '%') - $attributes['width'] = round($originWidth * $matches[1] / 100); - else - $attributes['width'] = intval($matches[1]); - - } - } - - if (array_key_exists('height', $attributes)) { - if (preg_match('/(.+)(%?)/', $attributes['height'], $matches)) { - if ($matches[2] == '%') - $attributes['height'] = round($originHeight * $matches[1] / 100); - else - $attributes['height'] = intval($matches[1]); - - } - } - - // 가로, 세로 어느 쪽이든 0이면 이미지는 표시되지 않음. 따라서 계산할 필요 없음. - if ((isset($attributes['width']) && $attributes['width'] <= 0) || (isset($attributes['height']) && $attributes['height'] <= 0)) { - return array($property, false); - } - // 가로만 지정된 이미지의 경우. - if (isset($attributes['width']) && !isset($attributes['height'])) { - // 비어있는 세로를 가로의 크기를 이용하여 계산. - $attributes['height'] = floor($originHeight * $attributes['width'] / $originWidth); - // 세로만 지정된 이미지의 경우. - } else if (!isset($attributes['width']) && isset($attributes['height'])) { - // 비어있는 가로를 세로의 크기를 이용하여 계산. - $attributes['width'] = floor($originWidth * $attributes['height'] / $originHeight); - // 둘 다 지정되지 않은 이미지의 경우. - } else if (!isset($attributes['width']) && !isset($attributes['height'])) { - // 둘 다 비어 있을 경우는 오리지널 사이즈로 대치. - $attributes['width'] = $originWidth; - $attributes['height'] = $originHeight; - } +/// Legacy code for plugins. See /framework/utils/Image.php for working codes. - if ($attributes['width'] > $imageWidth) { - $attributes['height'] = floor($attributes['height'] * $imageWidth / $attributes['width']); - $attributes['width'] = $imageWidth; - } - - if ($attributes['width'] < $originWidth || $attributes['height'] < $originHeight) { - $onclickFlag = true; - } else { - $onclickFlag = false; - } - - $properties = array(); - ksort($attributes); - foreach($attributes as $key => $value) { - array_push($properties, "$key=\"$value\""); - } - - return array(implode(' ', $properties), $onclickFlag); - } - - function impressWaterMark($waterMarkFile, $position="left=10|bottom=10", $gamma=100) { - if ($this->getImageType($waterMarkFile) == "png") - return $this->_impressWaterMarkCore("PNG", $waterMarkFile, $position); - else - return $this->_impressWaterMarkCore("GIF", $waterMarkFile, $position, $gamma); - } - - function _impressWaterMarkCore($type, $waterMarkFile, $position, $gamma=100) { - if (empty($waterMarkFile)) - return false; - if (!file_exists($waterMarkFile)) - return false; - if (empty($this->resultImageDevice)) - return false; - - // validate gamma. - if (!is_int($gamma)) { - $gamma = 100; - } else if ($gamma < 0) { - $gamma = 0; - } else if ($gamma > 100) { - $gamma = 100; - } - - list($waterMarkWidth, $waterMarkHeight, $waterMakrType) = getimagesize($waterMarkFile); - - // position of watermark. - if (preg_match("/^(-?[0-9A-Z]+) (-?[0-9A-Z]+)$/i", $position, $temp)) { - $resultWidth = imagesx($this->resultImageDevice); - $resultHeight = imagesy($this->resultImageDevice); - - switch ($temp[1]) { - case "left": - $xPosition = $this->extraPadding; - break; - case "center": - $xPosition = $resultWidth / 2 - $waterMarkWidth / 2; - break; - case "right": - $xPosition = $resultWidth - $waterMarkWidth - $this->extraPadding; - break; - default: - // if positive, calculate x value from left. - if (preg_match("/^([1-9][0-9]*)$/", $temp[1], $extra)) { - if ($extra[1] > $resultWidth - $waterMarkWidth) { - $xPosition = $resultWidth - $waterMarkWidth; - } else { - $xPosition = $extra[1]; - } - // if negative, calculate x value from right. - } else if (preg_match("/^(-?[1-9][0-9]*)$/", $temp[1], $extra)) { - if ($resultWidth - $waterMarkWidth - abs($extra[1]) < 0) { - $xPosition = 0; - } else { - $xPosition = $resultWidth - $waterMarkWidth - abs($extra[1]); - } - // in the case of 0. - } else if ($temp[1] == "0") { - $xPosition = 0; - // the others. calculate x value from left. - } else { - $xPosition = $resultWidth - $waterMarkWidth - $this->extraPadding; - } - } - - switch ($temp[2]) { - case "top": - $yPosition = $this->extraPadding; - break; - case "middle": - $yPosition = $resultHeight / 2 - $waterMarkHeight / 2; - break; - case "bottom": - $yPosition = $resultHeight - $waterMarkHeight - $this->extraPadding; - break; - default: - // if positive, calculate y value from top. - if (preg_match("/^([1-9][0-9]*)$/", $temp[2], $extra)) { - if ($extra[1] > $resultHeight - $waterMarkHeight) { - $yPosition = $resultHeight - $waterMarkHeight; - } else { - $yPosition = $extra[1]; - } - // if negative, calculate y value from bottom. - } else if (preg_match("/^(-?[1-9][0-9]*)$/", $temp[2], $extra)) { - if ($resultHeight - $waterMarkHeight - abs($extra[1]) < 0) { - $yPosition = 0; - } else { - $yPosition = $resultHeight - $waterMarkHeight - abs($extra[1]); - } - // in the case of 0. - } else if ($temp[1] == "0") { - $yPosition = 0; - // the others. calculate y value from bottom. - } else { - $yPosition = $resultHeight - $waterMarkHeight - $this->extraPadding; - } - } - } else { - $xPosition = $resultWidth - $waterMarkWidth - $this->extraPadding; - $yPosition = $resultHeight - $waterMarkHeight - $this->extraPadding; - } - - // create watermark image device. - switch ($waterMakrType) { - case 1: - $waterMarkDevice = imagecreatefromgif($waterMarkFile); - break; - case 2: - $waterMarkDevice = imagecreatefromjpeg($waterMarkFile); - break; - case 3: - $waterMarkDevice = imagecreatefrompng($waterMarkFile); - break; - } - - // PHP >= 4.0.6 - if (strtolower($type) == "png" && function_exists("imagealphablending")) { - imagealphablending($this->resultImageDevice, true); - imagecopy($this->resultImageDevice, $waterMarkDevice, $xPosition, $yPosition, 0, 0, $waterMarkWidth, $waterMarkHeight); - } else { - // if not support alpha channel, support GIF transparency. - $tempWaterMarkDevice = imagecreatetruecolor($waterMarkWidth, $waterMarkHeight); - - $bgColorBy16 = $this->hexRGB("FF00FF"); - $temp = imagecolorallocate($tempWaterMarkDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); - imagecolortransparent($this->resultImageDevice, $temp); - imagefill($tempWaterMarkDevice, 0, 0, $temp); - imagecopy($tempWaterMarkDevice, $waterMarkDevice, 0, 0, 0, 0, $waterMarkWidth, $waterMarkHeight); - - if (function_exists("imagecopymerge")) - imagecopymerge($this->resultImageDevice, $tempWaterMarkDevice, $xPosition, $yPosition, 0, 0, $waterMarkWidth, $waterMarkHeight, $gamma); - else - imagecopy($this->resultImageDevice, $tempWaterMarkDevice, $xPosition, $yPosition, 0, 0, $waterMarkWidth, $waterMarkHeight); - - imagedestroy($tempWaterMarkDevice); - } - - imagedestroy($waterMarkDevice); - return true; - } - - function cropRectByCoordinates($startX, $startY, $finishX, $finishY) { - $width = $finishX - $startX; - $height = $finishY - $startY; - - $targetDevice = imagecreatetruecolor($width, $height); - $bgColorBy16 = $this->hexRGB('FFFFFF'); - imagecolorallocate($tempWaterMarkDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); - imagecopy($targetDevice, $this->resultImageDevice, 0, 0, $startX, $startY, $width, $height); - $this->resultImageDevice = $targetDevice; - unset($targetDevice); - - return true; - } - - function cropRectBySize($width, $height, $align='center', $valign='middle') { - switch ($align) { - case 'left': - $srcX = 0; - break; - case 'center': - $srcX = floor((imagesx($this->resultImageDevice) - $width) / 2); - break; - case 'right': - $srcX = imagesx($this->resultImageDevice) - $width; - break; - } - - switch ($valign) { - case 'top': - $srcY = 0; - break; - case 'middle': - $srcY = floor((imagesy($this->resultImageDevice) - $height) / 2); - break; - case 'bottom': - $srcY = imagesy($this->resultImageDevice) - $height; - break; - } - - $targetDevice = imagecreatetruecolor($width, $height); - $bgColorBy16 = $this->hexRGB('FFFFFF'); - imagecolorallocate($targetDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); - imagecopy($targetDevice, $this->resultImageDevice, 0, 0, $srcX, $srcY, $width, $height); - $this->resultImageDevice = $targetDevice; - unset($targetDevice); - - return true; - } - - function saveAsFile($fileName) { - return $this->createThumbnailIntoFile($fileName); - } - - function createThumbnailIntoFile($fileName) { - if (empty($this->resultImageDevice)) - return false; - - imageinterlace($this->resultImageDevice); - switch ($this->getImageType($this->imageFile)) { - case "gif": - imagegif($this->resultImageDevice, $fileName); - break; - case "png": - imagepng($this->resultImageDevice, $fileName); - break; - case "wbmp": - imagewbmp($this->resultImageDevice, $fileName); - break; - case "jpg": - default: - imagejpeg($this->resultImageDevice, $fileName, 80); - break; - } - - $this->resultImageDevice = NULL; - - return true; - } - - function saveAsCache() { - return $this->createThumbnailIntoCache(); - } - - function createThumbnailIntoCache() { - header("Content-type: image/jpeg"); - imagejpeg($this->resultImageDevice); - - $originImageDevice = NULL; - $this->resultImageDevice = NULL; - - return true; - } - - function calcOptimizedImageSize($argWidth, $argHeight, $boxWidth=NULL, $boxHeight=NULL, $resizeFlag="reduce") { - if (empty($boxWidth) && empty($boxHeight)) { - return array($argWidth, $argHeight); - } else if (!empty($boxWidth) && empty($boxHeight)) { - if ($argWidth > $boxWidth) { - $newWidth = $boxWidth; - $newHeight = floor($argHeight * $newWidth / $argWidth); - } else { - $newWidth = $argWidth; - $newHeight = $argHeight; - } - } else if (empty($boxWidth) && !empty($boxHeight)) { - if ($argHeight > $boxHeight) { - $newHeight = $boxHeight; - $newWidth = floor($argWidth * $newHeight / $argHeight); - } else { - $newWidth = $argWidth; - $newHeight = $argHeight; - } - } else { - if ($argWidth > $boxWidth) { - $newWidth = $boxWidth; - $newHeight = floor($argHeight * $newWidth / $argWidth); - } else { - $newWidth = $argWidth; - $newHeight = $argHeight; - } - - if ($newHeight > $boxHeight) { - $tempHeight = $newHeight; - $newHeight = $boxHeight; - $newWidth = floor($newWidth * $newHeight / $tempHeight); - } - } - - if ($argWidth * $argHeight > $newWidth * $newHeight) { - if ($resizeFlag == "reduce" || $resizeFlag == "both") { - $imgWidth = $newWidth; - $imgHeight = $newHeight; - } else { - $imgWidth = $argWidth; - $imgHeight = $argHeight; - } - } else if ($argWidth * $argHeight == $newWidth * $newHeight) { - $imgWidth = $argWidth; - $imgHeight = $argHeight; - } else if ($argWidth * $argHeight < $newWidth * $newHeight) { - if ($resizeFlag == "enlarge" || $resizeFlag == "both") { - $imgWidth = $newWidth; - $imgHeight = $newHeight; - } else { - $imgWidth = $argWidth; - $imgHeight = $argHeight; - } - } - - return array($imgWidth, $imgHeight); - } - - function getImageType($filename) { - if (file_exists($filename)) { - if (function_exists("exif_imagetype")) { - $imageType = exif_imagetype($filename); - } else { - $tempInfo = getimagesize($filename); - $imageType = $tempInfo[2]; - } - - switch ($imageType) { - case IMAGETYPE_GIF: - $extension = 'gif'; - break; - case IMAGETYPE_JPEG: - $extension = 'jpg'; - break; - case IMAGETYPE_PNG: - $extension = 'png'; - break; - case IMAGETYPE_SWF: - $extension = 'swf'; - break; - case IMAGETYPE_PSD: - $extension = 'psd'; - break; - case IMAGETYPE_BMP: - $extension = 'bmp'; - break; - case IMAGETYPE_TIFF_II: - case IMAGETYPE_TIFF_MM: - $extension = 'tiff'; - break; - case IMAGETYPE_JPC: - $extension = 'jpc'; - break; - case IMAGETYPE_JP2: - $extension = 'jp2'; - break; - case IMAGETYPE_JPX: - $extension = 'jpx'; - break; - case IMAGETYPE_JB2: - $extension = 'jb2'; - break; - case IMAGETYPE_SWC: - $extension = 'swc'; - break; - case IMAGETYPE_IFF: - $extension = 'aiff'; - break; - case IMAGETYPE_WBMP: - $extension = 'wbmp'; - break; - case IMAGETYPE_XBM: - $extension = 'xbm'; - break; - default: - $extension = false; - } - } else { - $extension = false; - } - - return $extension; - } - - /* "FFFFFF" => array(255, 255, 255) */ - function hexRGB($hexstr) { - $int = hexdec($hexstr); - return array('R' => 0xFF & ($int >> 0x10), 'G' => 0xFF & ($int >> 0x8), 'B' => 0xFF & $int); +if(!class_exists('Image')) { + class Image extends Utils_Image { } } -?> diff --git a/framework/locales/Locales.php b/framework/locales/Locales.php index bccf45693..944baee11 100644 --- a/framework/locales/Locales.php +++ b/framework/locales/Locales.php @@ -146,8 +146,8 @@ function _f($t) { // _t() follows the admin panel locale setting, however _text() follows the skin locale setting. function _text($t) { $locale = Locales::getInstance(); - if(isset($locale->resource['blog']) && isset($locale->resource['blog'][$t])) { - return $locale->resource['blog'][$t]; + if(isset($locale->resource[$locale->domain]) && isset($locale->resource[$locale->domain][$t])) { + return $locale->resource[$locale->domain][$t]; } else return $t; } diff --git a/framework/model/URIHandler.php b/framework/model/URIHandler.php index e0e52b4f6..d8c5e2a51 100644 --- a/framework/model/URIHandler.php +++ b/framework/model/URIHandler.php @@ -31,7 +31,7 @@ private function __URIParser() { $this->context->useNamespace('service'); $url = $this->uri['fullpath']; - $defaultblogid = Setting::getServiceSetting("defaultBlogId",1); + $defaultblogid = Setting::getServiceSetting("defaultBlogId",1,true); $this->suri = array('url' => $url, 'value' => ''); $this->blogid = null; $this->uri['isStrictBlogURL'] = true; @@ -51,18 +51,18 @@ private function __URIParser() { } else { $domain = explode('.', $_SERVER['HTTP_HOST'], 2); if ($domain[1] == $this->context->getProperty('domain')) { - $this->blogid = $this->__getBlogidByName($domain[0]); + $this->blogid = $this->__getBlogIdByName($domain[0]); if ($this->blogid === null) - $this->blogid = $this->__getBlogidBySecondaryDomain($_SERVER['HTTP_HOST']); + $this->blogid = $this->__getBlogIdBySecondaryDomain($_SERVER['HTTP_HOST']); } else { - $this->blogid = $this->__getBlogidBySecondaryDomain($_SERVER['HTTP_HOST']); + $this->blogid = $this->__getBlogIdBySecondaryDomain($_SERVER['HTTP_HOST']); } } } else { // Path-based service if ($url == '/') { $this->blogid = $defaultblogid; } else if (preg_match('@^/+([^/]+)(.*)$@', $url, $matches)) { - $this->blogid = $this->__getBlogidByName(strtok($matches[1],'?')); + $this->blogid = $this->__getBlogIdByName(strtok($matches[1],'?')); if ($this->blogid === null) { $this->blogid = $defaultblogid; $this->uri['isStrictBlogURL']= false; diff --git a/framework/utils/Image.php b/framework/utils/Image.php new file mode 100644 index 000000000..bd76a364c --- /dev/null +++ b/framework/utils/Image.php @@ -0,0 +1,524 @@ +reset(); + } + + public static function getInstance() { + return self::_getInstance(__CLASS__); + } + + function reset() { + $this->extraPadding = 0; + $this->imageFile = NULL; + $this->resultImageDevice = NULL; + } + + function resample($width, $height) { + if (empty($width) && empty($height)) + return false; + if (empty($this->imageFile) || !file_exists($this->imageFile)) + return false; + + // create an image device as image format. + switch ($this->getImageType($this->imageFile)) { + case "gif": + if (imagetypes() & IMG_GIF) { + $originImageDevice = imagecreatefromgif($this->imageFile); + } else { + return false; + } + break; + case "jpg": + if (imagetypes() & IMG_JPG) { + $originImageDevice = imagecreatefromjpeg($this->imageFile); + } else { + return false; + } + break; + case "png": + if ((imagetypes() & IMG_PNG) && function_exists('imagecreatefrompng')) { + $originImageDevice = imagecreatefrompng($this->imageFile); + } else { + return false; + } + break; + case "wbmp": + if (imagetypes() & IMG_WBMP) { + $originImageDevice = imagecreatefromwbmp($this->imageFile); + } else { + return false; + } + break; + case "xpm": + if (imagetypes() & IMG_XPM) { + $originImageDevice = imagecreatefromxpm($this->imageFile); + } else { + return false; + } + break; + default: + return false; + break; + } + // 리샘플링은 최종단계에서 리샘플링만을 하는 기능임. 시스템을 예로 들면 OS의 기능에 해당함. + // 이미지 프로세스는 어플리케이션의 기능으로 볼 수 있고, 따라서 이미지 리샘플링 중에는 이벤트가 끼어들면 안 됨. + //$originImageDevice = fireEvent('BeforeResizeImage', $originImageDevice, $this); + + if (Path::getExtension($this->imageFile) == ".gif") { + $this->resultImageDevice = imagecreate($width, $height); + } else { + $this->resultImageDevice = imagecreatetruecolor($width, $height); + } + + $bgColorBy16 = $this->hexRGB("FFFFFF"); + $temp = imagecolorallocate($this->resultImageDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); + imagefilledrectangle($this->resultImageDevice, 0, 0, $width, $height, $temp); + imagecopyresampled($this->resultImageDevice, $originImageDevice, 0, 0, 0, 0, $width, $height, imagesx($originImageDevice), imagesy($originImageDevice)); + imagedestroy($originImageDevice); + //$this->resultImageDevice = fireEvent('AfterResizeImage', $this->resultImageDevice, $this); + + return true; + } + + function resizeImageToContent($property, $originSrc, $imageWidth) { + if ( !is_readable($originSrc) ) { + return array($property, false); + } + + list($originWidth, $originHeight, $type, $attr) = getimagesize($originSrc); + $attributes = Misc::getAttributesFromString($property, false); + + // 단위 변환. + $onclickFlag = false; + if (array_key_exists('width', $attributes)) { + if (preg_match('/(.+)(%?)/', $attributes['width'], $matches)) { + if($matches[2] == '%') + $attributes['width'] = round($originWidth * $matches[1] / 100); + else + $attributes['width'] = intval($matches[1]); + + } + } + + if (array_key_exists('height', $attributes)) { + if (preg_match('/(.+)(%?)/', $attributes['height'], $matches)) { + if ($matches[2] == '%') + $attributes['height'] = round($originHeight * $matches[1] / 100); + else + $attributes['height'] = intval($matches[1]); + + } + } + + // 가로, 세로 어느 쪽이든 0이면 이미지는 표시되지 않음. 따라서 계산할 필요 없음. + if ((isset($attributes['width']) && $attributes['width'] <= 0) || (isset($attributes['height']) && $attributes['height'] <= 0)) { + return array($property, false); + } + + // 가로만 지정된 이미지의 경우. + if (isset($attributes['width']) && !isset($attributes['height'])) { + // 비어있는 세로를 가로의 크기를 이용하여 계산. + $attributes['height'] = floor($originHeight * $attributes['width'] / $originWidth); + // 세로만 지정된 이미지의 경우. + } else if (!isset($attributes['width']) && isset($attributes['height'])) { + // 비어있는 가로를 세로의 크기를 이용하여 계산. + $attributes['width'] = floor($originWidth * $attributes['height'] / $originHeight); + // 둘 다 지정되지 않은 이미지의 경우. + } else if (!isset($attributes['width']) && !isset($attributes['height'])) { + // 둘 다 비어 있을 경우는 오리지널 사이즈로 대치. + $attributes['width'] = $originWidth; + $attributes['height'] = $originHeight; + } + + if ($attributes['width'] > $imageWidth) { + $attributes['height'] = floor($attributes['height'] * $imageWidth / $attributes['width']); + $attributes['width'] = $imageWidth; + } + + if ($attributes['width'] < $originWidth || $attributes['height'] < $originHeight) { + $onclickFlag = true; + } else { + $onclickFlag = false; + } + + $properties = array(); + ksort($attributes); + foreach($attributes as $key => $value) { + array_push($properties, "$key=\"$value\""); + } + + return array(implode(' ', $properties), $onclickFlag); + } + + function impressWaterMark($waterMarkFile, $position="left=10|bottom=10", $gamma=100) { + if ($this->getImageType($waterMarkFile) == "png") + return $this->_impressWaterMarkCore("PNG", $waterMarkFile, $position); + else + return $this->_impressWaterMarkCore("GIF", $waterMarkFile, $position, $gamma); + } + + function _impressWaterMarkCore($type, $waterMarkFile, $position, $gamma=100) { + if (empty($waterMarkFile)) + return false; + if (!file_exists($waterMarkFile)) + return false; + if (empty($this->resultImageDevice)) + return false; + + // validate gamma. + if (!is_int($gamma)) { + $gamma = 100; + } else if ($gamma < 0) { + $gamma = 0; + } else if ($gamma > 100) { + $gamma = 100; + } + + list($waterMarkWidth, $waterMarkHeight, $waterMakrType) = getimagesize($waterMarkFile); + + // position of watermark. + if (preg_match("/^(-?[0-9A-Z]+) (-?[0-9A-Z]+)$/i", $position, $temp)) { + $resultWidth = imagesx($this->resultImageDevice); + $resultHeight = imagesy($this->resultImageDevice); + + switch ($temp[1]) { + case "left": + $xPosition = $this->extraPadding; + break; + case "center": + $xPosition = $resultWidth / 2 - $waterMarkWidth / 2; + break; + case "right": + $xPosition = $resultWidth - $waterMarkWidth - $this->extraPadding; + break; + default: + // if positive, calculate x value from left. + if (preg_match("/^([1-9][0-9]*)$/", $temp[1], $extra)) { + if ($extra[1] > $resultWidth - $waterMarkWidth) { + $xPosition = $resultWidth - $waterMarkWidth; + } else { + $xPosition = $extra[1]; + } + // if negative, calculate x value from right. + } else if (preg_match("/^(-?[1-9][0-9]*)$/", $temp[1], $extra)) { + if ($resultWidth - $waterMarkWidth - abs($extra[1]) < 0) { + $xPosition = 0; + } else { + $xPosition = $resultWidth - $waterMarkWidth - abs($extra[1]); + } + // in the case of 0. + } else if ($temp[1] == "0") { + $xPosition = 0; + // the others. calculate x value from left. + } else { + $xPosition = $resultWidth - $waterMarkWidth - $this->extraPadding; + } + } + + switch ($temp[2]) { + case "top": + $yPosition = $this->extraPadding; + break; + case "middle": + $yPosition = $resultHeight / 2 - $waterMarkHeight / 2; + break; + case "bottom": + $yPosition = $resultHeight - $waterMarkHeight - $this->extraPadding; + break; + default: + // if positive, calculate y value from top. + if (preg_match("/^([1-9][0-9]*)$/", $temp[2], $extra)) { + if ($extra[1] > $resultHeight - $waterMarkHeight) { + $yPosition = $resultHeight - $waterMarkHeight; + } else { + $yPosition = $extra[1]; + } + // if negative, calculate y value from bottom. + } else if (preg_match("/^(-?[1-9][0-9]*)$/", $temp[2], $extra)) { + if ($resultHeight - $waterMarkHeight - abs($extra[1]) < 0) { + $yPosition = 0; + } else { + $yPosition = $resultHeight - $waterMarkHeight - abs($extra[1]); + } + // in the case of 0. + } else if ($temp[1] == "0") { + $yPosition = 0; + // the others. calculate y value from bottom. + } else { + $yPosition = $resultHeight - $waterMarkHeight - $this->extraPadding; + } + } + } else { + $xPosition = $resultWidth - $waterMarkWidth - $this->extraPadding; + $yPosition = $resultHeight - $waterMarkHeight - $this->extraPadding; + } + + // create watermark image device. + switch ($waterMakrType) { + case 1: + $waterMarkDevice = imagecreatefromgif($waterMarkFile); + break; + case 2: + $waterMarkDevice = imagecreatefromjpeg($waterMarkFile); + break; + case 3: + $waterMarkDevice = imagecreatefrompng($waterMarkFile); + break; + } + + // PHP >= 4.0.6 + if (strtolower($type) == "png" && function_exists("imagealphablending")) { + imagealphablending($this->resultImageDevice, true); + imagecopy($this->resultImageDevice, $waterMarkDevice, $xPosition, $yPosition, 0, 0, $waterMarkWidth, $waterMarkHeight); + } else { + // if not support alpha channel, support GIF transparency. + $tempWaterMarkDevice = imagecreatetruecolor($waterMarkWidth, $waterMarkHeight); + + $bgColorBy16 = $this->hexRGB("FF00FF"); + $temp = imagecolorallocate($tempWaterMarkDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); + imagecolortransparent($this->resultImageDevice, $temp); + imagefill($tempWaterMarkDevice, 0, 0, $temp); + imagecopy($tempWaterMarkDevice, $waterMarkDevice, 0, 0, 0, 0, $waterMarkWidth, $waterMarkHeight); + + if (function_exists("imagecopymerge")) + imagecopymerge($this->resultImageDevice, $tempWaterMarkDevice, $xPosition, $yPosition, 0, 0, $waterMarkWidth, $waterMarkHeight, $gamma); + else + imagecopy($this->resultImageDevice, $tempWaterMarkDevice, $xPosition, $yPosition, 0, 0, $waterMarkWidth, $waterMarkHeight); + + imagedestroy($tempWaterMarkDevice); + } + + imagedestroy($waterMarkDevice); + return true; + } + + function cropRectByCoordinates($startX, $startY, $finishX, $finishY) { + $width = $finishX - $startX; + $height = $finishY - $startY; + + $targetDevice = imagecreatetruecolor($width, $height); + $bgColorBy16 = $this->hexRGB('FFFFFF'); + imagecolorallocate($tempWaterMarkDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); + imagecopy($targetDevice, $this->resultImageDevice, 0, 0, $startX, $startY, $width, $height); + $this->resultImageDevice = $targetDevice; + unset($targetDevice); + + return true; + } + + function cropRectBySize($width, $height, $align='center', $valign='middle') { + switch ($align) { + case 'left': + $srcX = 0; + break; + case 'center': + $srcX = floor((imagesx($this->resultImageDevice) - $width) / 2); + break; + case 'right': + $srcX = imagesx($this->resultImageDevice) - $width; + break; + } + + switch ($valign) { + case 'top': + $srcY = 0; + break; + case 'middle': + $srcY = floor((imagesy($this->resultImageDevice) - $height) / 2); + break; + case 'bottom': + $srcY = imagesy($this->resultImageDevice) - $height; + break; + } + + $targetDevice = imagecreatetruecolor($width, $height); + $bgColorBy16 = $this->hexRGB('FFFFFF'); + imagecolorallocate($targetDevice, $bgColorBy16['R'], $bgColorBy16['G'], $bgColorBy16['B']); + imagecopy($targetDevice, $this->resultImageDevice, 0, 0, $srcX, $srcY, $width, $height); + $this->resultImageDevice = $targetDevice; + unset($targetDevice); + + return true; + } + + function saveAsFile($fileName) { + return $this->createThumbnailIntoFile($fileName); + } + + function createThumbnailIntoFile($fileName) { + if (empty($this->resultImageDevice)) + return false; + + imageinterlace($this->resultImageDevice); + switch ($this->getImageType($this->imageFile)) { + case "gif": + imagegif($this->resultImageDevice, $fileName); + break; + case "png": + imagepng($this->resultImageDevice, $fileName); + break; + case "wbmp": + imagewbmp($this->resultImageDevice, $fileName); + break; + case "jpg": + default: + imagejpeg($this->resultImageDevice, $fileName, 80); + break; + } + + $this->resultImageDevice = NULL; + + return true; + } + + function saveAsCache() { + return $this->createThumbnailIntoCache(); + } + + function createThumbnailIntoCache() { + header("Content-type: image/jpeg"); + imagejpeg($this->resultImageDevice); + + $originImageDevice = NULL; + $this->resultImageDevice = NULL; + + return true; + } + + function calcOptimizedImageSize($argWidth, $argHeight, $boxWidth=NULL, $boxHeight=NULL, $resizeFlag="reduce") { + if (empty($boxWidth) && empty($boxHeight)) { + return array($argWidth, $argHeight); + } else if (!empty($boxWidth) && empty($boxHeight)) { + if ($argWidth > $boxWidth) { + $newWidth = $boxWidth; + $newHeight = floor($argHeight * $newWidth / $argWidth); + } else { + $newWidth = $argWidth; + $newHeight = $argHeight; + } + } else if (empty($boxWidth) && !empty($boxHeight)) { + if ($argHeight > $boxHeight) { + $newHeight = $boxHeight; + $newWidth = floor($argWidth * $newHeight / $argHeight); + } else { + $newWidth = $argWidth; + $newHeight = $argHeight; + } + } else { + if ($argWidth > $boxWidth) { + $newWidth = $boxWidth; + $newHeight = floor($argHeight * $newWidth / $argWidth); + } else { + $newWidth = $argWidth; + $newHeight = $argHeight; + } + + if ($newHeight > $boxHeight) { + $tempHeight = $newHeight; + $newHeight = $boxHeight; + $newWidth = floor($newWidth * $newHeight / $tempHeight); + } + } + + if ($argWidth * $argHeight > $newWidth * $newHeight) { + if ($resizeFlag == "reduce" || $resizeFlag == "both") { + $imgWidth = $newWidth; + $imgHeight = $newHeight; + } else { + $imgWidth = $argWidth; + $imgHeight = $argHeight; + } + } else if ($argWidth * $argHeight == $newWidth * $newHeight) { + $imgWidth = $argWidth; + $imgHeight = $argHeight; + } else if ($argWidth * $argHeight < $newWidth * $newHeight) { + if ($resizeFlag == "enlarge" || $resizeFlag == "both") { + $imgWidth = $newWidth; + $imgHeight = $newHeight; + } else { + $imgWidth = $argWidth; + $imgHeight = $argHeight; + } + } + + return array($imgWidth, $imgHeight); + } + + function getImageType($filename) { + if (file_exists($filename)) { + if (function_exists("exif_imagetype")) { + $imageType = exif_imagetype($filename); + } else { + $tempInfo = getimagesize($filename); + $imageType = $tempInfo[2]; + } + + switch ($imageType) { + case IMAGETYPE_GIF: + $extension = 'gif'; + break; + case IMAGETYPE_JPEG: + $extension = 'jpg'; + break; + case IMAGETYPE_PNG: + $extension = 'png'; + break; + case IMAGETYPE_SWF: + $extension = 'swf'; + break; + case IMAGETYPE_PSD: + $extension = 'psd'; + break; + case IMAGETYPE_BMP: + $extension = 'bmp'; + break; + case IMAGETYPE_TIFF_II: + case IMAGETYPE_TIFF_MM: + $extension = 'tiff'; + break; + case IMAGETYPE_JPC: + $extension = 'jpc'; + break; + case IMAGETYPE_JP2: + $extension = 'jp2'; + break; + case IMAGETYPE_JPX: + $extension = 'jpx'; + break; + case IMAGETYPE_JB2: + $extension = 'jb2'; + break; + case IMAGETYPE_SWC: + $extension = 'swc'; + break; + case IMAGETYPE_IFF: + $extension = 'aiff'; + break; + case IMAGETYPE_WBMP: + $extension = 'wbmp'; + break; + case IMAGETYPE_XBM: + $extension = 'xbm'; + break; + default: + $extension = false; + } + } else { + $extension = false; + } + + return $extension; + } + + /* "FFFFFF" => array(255, 255, 255) */ + function hexRGB($hexstr) { + $int = hexdec($hexstr); + return array('R' => 0xFF & ($int >> 0x10), 'G' => 0xFF & ($int >> 0x8), 'B' => 0xFF & $int); + } +} +?> diff --git a/interface/blog/checkup.php b/interface/blog/checkup.php index 6fd52fa74..870461c70 100644 --- a/interface/blog/checkup.php +++ b/interface/blog/checkup.php @@ -769,7 +769,16 @@ function clearCache() { else { showCheckupMessage(false); } - } + } + /* From Textcube 1.8.4 */ + if (!POD::queryExistence("DESC {$database['prefix']}RemoteResponseLogs responsetype")) { + $changed = true; + echo '
  • ', _text('트랙백과 핑백의 출력을 위하여 필드 속성을 변경합니다.'), ': '; + if (POD::execute("ALTER TABLE {$database['prefix']}RemoteResponseLogs CHANGE type responsetype ENUM('trackback','pingback') NOT NULL DEFAULT 'trackback'")) + showCheckupMessage(true); + else + showCheckupMessage(false); + } } /***** Common parts. *****/ diff --git a/interface/blog/comment/add/index.php b/interface/blog/comment/add/index.php index b23e0d67b..2b28f49ca 100644 --- a/interface/blog/comment/add/index.php +++ b/interface/blog/comment/add/index.php @@ -25,7 +25,7 @@ requireStrictRoute(); header('Content-Type: text/xml; charset=utf-8'); if (!isset($_GET['__T__']) || !isset($_POST['key']) || $_POST['key'] != md5(filemtime(ROOT . '/config.php')) || !Setting::getBlogSettingGlobal('acceptComments',1)) { - print ("0"); + Respond::PrintResult(array('error' => 0, 'commentBlock' => '', 'recentCommentBlock' => '')); exit; } $userName = isset($_POST["name_$entryId"]) ? trim($_POST["name_$entryId"]) : ''; @@ -34,9 +34,11 @@ $userHomepage = isset($_POST["homepage_$entryId"]) ? trim($_POST["homepage_$entryId"]) : ''; $userComment = isset($_POST["comment_$entryId"]) ? trim($_POST["comment_$entryId"]) : ''; if (!doesHaveMembership() && !doesHaveOwnership() && $userName == '') { - echo '2'; + Respond::PrintResult(array('error' => 2, 'description' => _text('이름을 입력해 주십시오.'))); + exit; } else if ($userComment == '') { - echo '2'; + Respond::PrintResult(array('error' => 2, 'description' => _text('본문을 입력해 주십시오.'))); + exit; } else { if (!empty($userName)) { setcookie('guestName', $userName, time() + 2592000, $context->getProperty('uri.blog')."/"); @@ -82,9 +84,12 @@ $errorString = _text('귀하는 차단되었으므로 사용하실 수 없습니다.'); break; } - echo '1'; + Respond::PrintResult(array('error' => 1, 'description' => $errorString)); + exit; + } else if ($result === false) { - echo '2'; + Respond::PrintResult(array('error' => 2, 'description' => _text('댓글을 달 수 없습니다.'))); + exit; } else { $entry = array(); $entry['id'] = $entryId; @@ -119,7 +124,12 @@ $commentCount = 0; $recentCommentBlock = escapeCData(revertTempTags(getRecentCommentsView(getRecentComments($blogid), $skin->recentComment, $skin->recentCommentItem))); } - echo '0'.$commentCount.''; + Respond::PrintResult(array('error' => 0, + 'commentView' => $commentView, + 'commentCount' => $commentCount, + 'commentBlock' => $commentBlock, + 'recentCommentBlock' => $recentCommentBlock)); + exit; } } ?> diff --git a/interface/blog/comment/load/index.php b/interface/blog/comment/load/index.php index 6813b79cf..6503bd104 100644 --- a/interface/blog/comment/load/index.php +++ b/interface/blog/comment/load/index.php @@ -12,11 +12,12 @@ $entry['slogan'] = getSloganById($blogid, $entry['id']); $IV = array( 'POST' => array( - 'page' => array('int',1) + 'page' => array('int',1), + 'listOnly' => array('int',0,1) ) ); $result['error'] = 0; -$result['commentBlock'] = revertTempTags(removeAllTags(getCommentView($entry, $skin, true, $_POST['page'], 20))); - +$result['commentBlock'] = revertTempTags(removeAllTags(getCommentView($entry, $skin, ($_POST['listOnly'] ? false:true), + $_POST['page'], 20,true))); Respond::PrintResult($result); -?> \ No newline at end of file +?> diff --git a/interface/common/blog/begin.php b/interface/common/blog/begin.php index ea0ebe4ae..c87957826 100644 --- a/interface/common/blog/begin.php +++ b/interface/common/blog/begin.php @@ -18,9 +18,13 @@ $view = str_replace('[##_SKIN_body_start_##]',getUpperView(isset($paging) ? $paging : null).'[##_SKIN_body_start_##]', $view); $view = str_replace('[##_SKIN_body_end_##]',getLowerView().getScriptsOnFoot().'[##_SKIN_body_end_##]', $view); // care the order for js function overloading issue. -$automaticLink = "getProperty('uri.service')."/resources/style/system.css\" type=\"text/css\" media=\"screen\" />\n"; +$automaticLink = " getProperty('uri.service')."/resources/style/system.css\" type=\"text/css\" media=\"screen\" />\n"; dress('SKIN_head_end', $automaticLink."[##_SKIN_head_end_##]", $view); +if($context->getProperty('blog.useBlogIconAsIphoneShortcut') == true && file_exists(ROOT."/attach/".$context->getProperty('blog.id')."/index.gif")) { + dress('SKIN_head_end', ''."[##_SKIN_head_end_##]",$view); +} + if (defined('__TEXTCUBE_COVER__')) { dress('body_id',"tt-body-cover",$view); } else if (!empty($category)) { diff --git a/interface/common/blog/end.php b/interface/common/blog/end.php index 8925ed12e..dd4e3f5f1 100644 --- a/interface/common/blog/end.php +++ b/interface/common/blog/end.php @@ -29,8 +29,8 @@ $searchView = $skin->search; dress('search_name', 'search', $searchView); dress('search_text', isset($search) ? htmlspecialchars($search) : '', $searchView); -dress('search_onclick_submit', 'searchBlog()', $searchView); -dress('search', '
    '.$searchView.'
    ', $view); +dress('search_onclick_submit', 'searchBlog();return false;', $searchView); +dress('search', '
    '.$searchView.'
    ', $view); $totalPosts = getEntriesTotalCount($blogid); $categories = getCategories($blogid); diff --git a/interface/common/blog/entries.php b/interface/common/blog/entries.php index 6d58d1e57..7a3e2e3b4 100644 --- a/interface/common/blog/entries.php +++ b/interface/common/blog/entries.php @@ -146,7 +146,7 @@ dress('article_rep_date_modified', fireEvent('ViewPostDate', Timestamp::format5($entry['modified']), $entry['modified']), $entryView); dress('entry_archive_link', $context->getProperty('uri.blog')."/archive/" . Timestamp::getDate($entry['published']), $entryView); if ($entry['acceptcomment'] || ($entry['comments'] > 0)) - dress('article_rep_rp_link', "loadComment({$entry['id']},1,false); return false", $entryView); + dress('article_rep_rp_link', "loadComment({$entry['id']},1,false,false); return false", $entryView); else dress('article_rep_rp_link', "return false", $entryView); diff --git a/interface/common/owner/header.php b/interface/common/owner/header.php index 1dcc8220a..41dc3a089 100755 --- a/interface/common/owner/header.php +++ b/interface/common/owner/header.php @@ -276,6 +276,11 @@ if($browser->isMobile()) { ?> +getProperty('blog.useBlogIconAsIphoneShortcut') == true && file_exists(ROOT."/attach/".$context->getProperty('blog.id')."/index.gif")) { +?> + " /> 0)); } else { diff --git a/interface/control/action/user/makeToken/index.php b/interface/control/action/user/makeToken/index.php index 775e74832..d236461e0 100644 --- a/interface/control/action/user/makeToken/index.php +++ b/interface/control/action/user/makeToken/index.php @@ -13,7 +13,7 @@ requirePrivilege('group.creators'); $authtoken = md5(User::__generatePassword()); -$result = POD::query("INSERT INTO `{$database['prefix']}UserSettings` (userid, name, value) VALUES ('".$_GET['userid']."', 'AuthToken', '$authtoken')"); +$result = POD::query("REPLACE INTO `{$database['prefix']}UserSettings` (userid, name, value) VALUES ('".$_GET['userid']."', 'AuthToken', '$authtoken')"); if ($result) { Respond::PrintResult(array('error' => 0)); echo "s"; diff --git a/interface/control/server/config/index.php b/interface/control/server/config/index.php index 442e55421..51672709f 100644 --- a/interface/control/server/config/index.php +++ b/interface/control/server/config/index.php @@ -6,6 +6,7 @@ $IV = array( 'POST' => array( 'allowBlogVisibility' => array('int'), + 'requireLogin' => array('int',0,1), 'disableEolinSuggestion' => array('int',0,1), 'encoding' => array('string'), 'faviconDailyTraffic' => array('int'), @@ -51,6 +52,7 @@ 'externalResourceURL'=>'resourceURL', 'disableEolinSuggestion'=>'disableEolinSuggestion', 'allowBlogVisibility' => 'allowBlogVisibilitySetting', + 'requireLogin' => 'requirelogin', 'flashClipboardPoter' => 'flashclipboardpoter', 'flashUploader' => 'flashuploader', 'useDebugMode' =>'debugmode', diff --git a/interface/control/server/index.php b/interface/control/server/index.php index 2c9a6eded..d9095ef0b 100644 --- a/interface/control/server/index.php +++ b/interface/control/server/index.php @@ -62,6 +62,8 @@ function setConfigFile() { else disableEolinSuggestion = 1; // Note that it is reversed! if(document.getElementById('allowBlogVisibilitySetting').checked) allowBlogVisibilitySetting = 1; else allowBlogVisibilitySetting = 0; + if(document.getElementById('requireLogin').checked) requireLogin = 1; + else requireLogin = 0; if(document.getElementById('flashClipboardPoter').checked) flashClipboardPoter = 1; else flashClipboardPoter = 0; if(document.getElementById('flashUploader').checked) flashUploader = 1; @@ -82,6 +84,7 @@ function setConfigFile() { param += 'useEncodedURL='+useEncodedURL +'&'; param += 'disableEolinSuggestion='+disableEolinSuggestion +'&'; param += 'allowBlogVisibility='+allowBlogVisibilitySetting +'&'; + param += 'requireLogin='+requireLogin +'&'; param += 'flashClipboardPoter='+flashClipboardPoter +'&'; param += 'flashUploader='+flashUploader +'&'; param += 'useDebugMode='+useDebugMode +'&'; @@ -321,6 +324,12 @@ function setDefault() { /> +
    +
    +
    + /> +
    +
    diff --git a/interface/i/imageResizer/index.php b/interface/i/imageResizer/index.php index f940eb38e..94a9580d7 100644 --- a/interface/i/imageResizer/index.php +++ b/interface/i/imageResizer/index.php @@ -17,7 +17,7 @@ if (file_exists($imagePath)) { $imageInfo = getimagesize($imagePath); $cropSize = $_GET['m']; - $objThumbnail = new Image(); + $objThumbnail = new Utils_Image(); if ($imageInfo[0] > $imageInfo[1]) list($tempWidth, $tempHeight) = $objThumbnail->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $cropSize); else diff --git a/interface/login/index.php b/interface/login/index.php index e41caf2c7..8a74e22e2 100644 --- a/interface/login/index.php +++ b/interface/login/index.php @@ -58,6 +58,10 @@ if (!doesHaveMembership() && isLoginId(getBlogId(), $_POST['loginid'])){ $showPasswordReset = true; } + } else { + if (!doesHaveOwnership()) { + $message = _text('서비스의 회원이지만 이 블로그의 구성원이 아닙니다. 주소를 확인해 주시기 바랍니다.'); + } } } $authResult = fireEvent('LOGIN_try_auth', false); diff --git a/interface/owner/center/about/index.php b/interface/owner/center/about/index.php index c94cb07e5..92176ab1b 100644 --- a/interface/owner/center/about/index.php +++ b/interface/owner/center/about/index.php @@ -16,7 +16,7 @@ Omnis mundi creatura quasi liber et pictura nobis est, et speculum

    - +
    Valid XHTML 1.1!
    diff --git a/interface/owner/entry/add/index.php b/interface/owner/entry/add/index.php index 437496a80..a53f998b2 100644 --- a/interface/owner/entry/add/index.php +++ b/interface/owner/entry/add/index.php @@ -48,7 +48,7 @@ $entry['draft'] = empty($_POST['draft']) ? 0 : $_POST['draft']; if ($id = addEntry($blogid, $entry)) { fireEvent('AddPost', $id, $entry); - setBlogSetting('LatestEditedEntry_user'.getUserId(),$id); + Setting::setBlogSettingGlobal('LatestEditedEntry_user'.getUserId(),$id); } $result = array(); $result['error'] = (($id !== false) === true ? 0 : 1); diff --git a/interface/owner/entry/edit/index.php b/interface/owner/entry/edit/index.php index 8a149de7a..5eff11c86 100644 --- a/interface/owner/entry/edit/index.php +++ b/interface/owner/entry/edit/index.php @@ -749,10 +749,16 @@ function returnToList() { - + +
    +
    -

    -
    +

    +
    -

    +

    @@ -834,6 +840,8 @@ function returnToList() {
    +

    +
    - +
    diff --git a/interface/owner/entry/line/index.php b/interface/owner/entry/line/index.php index 69370b58a..867cc5939 100644 --- a/interface/owner/entry/line/index.php +++ b/interface/owner/entry/line/index.php @@ -17,7 +17,7 @@ require ROOT . '/library/preprocessor.php'; require ROOT . '/interface/common/owner/header.php'; - +//fireEvent('Cron10m',null,null); if(isset($_GET['category'])) $_POST['category'] = $_GET['category']; if(isset($_POST['search'])) $searchKeyword = $_POST['search']; diff --git a/interface/owner/setting/account/index.php b/interface/owner/setting/account/index.php index 7bfc71532..084177c72 100644 --- a/interface/owner/setting/account/index.php +++ b/interface/owner/setting/account/index.php @@ -147,6 +147,7 @@ function chooseBlogPassword() { } blogApiPassword.value = value; } + function setDelegate() { try { var odlg = document.getElementById( 'openid_for_delegation' ); @@ -235,7 +236,12 @@ function sendInvitation() { return this.getText("/response/error") == 0; } request.onSuccess = function() { - PM.showMessage("", "center", "bottom"); + msg = this.getText("/response/message"); + if(msg) { + PM.showMessage(msg, "center", "bottom"); + } else { + PM.showMessage("", "center", "bottom"); + } window.location.href='getProperty('uri.blog');?>/owner/setting/account/'; } request.onError = function() { @@ -637,7 +643,7 @@ function cancelInvite(userid, caller) { - +
    diff --git a/interface/owner/setting/account/invite/index.php b/interface/owner/setting/account/invite/index.php index d0583cd5f..7b82c053b 100644 --- a/interface/owner/setting/account/invite/index.php +++ b/interface/owner/setting/account/invite/index.php @@ -28,6 +28,11 @@ } Respond::ResultPage($blogadd); } -$result = sendInvitationMail(null, User::getUserIdByEmail($_POST['email']),$_POST['name'],$_POST['comment'], $_POST['senderName'], $_POST['senderEmail']); -Respond::ResultPage($result); +if(User::getEmail() == $_POST['email']) { + $result = array('error'=>0,'message'=>_t('이 계정에 새로운 블로그를 추가하였습니다.')); + Respond::ResultPage($result); +} else { + $result = sendInvitationMail(null, User::getUserIdByEmail($_POST['email']),$_POST['name'],$_POST['comment'], $_POST['senderName'], $_POST['senderEmail']); + Respond::ResultPage($result); +} ?> diff --git a/library/function/html.php b/library/function/html.php index 265147999..130609606 100644 --- a/library/function/html.php +++ b/library/function/html.php @@ -123,7 +123,7 @@ function str_tag_off($str) { } function str_tag_truncate($str) { - return strip_tags(preg_replace('/\[##.+##\]/', '', $str)); + return strip_tags(preg_replace('/\[##(.+?)##\]/', '', $str)); } function str_cut($str, $maxlen, $type) { diff --git a/library/function/image.php b/library/function/image.php index 8faf02b7c..2c32550dc 100644 --- a/library/function/image.php +++ b/library/function/image.php @@ -4,13 +4,14 @@ /// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT) // img의 width/height에 맞춰 이미지를 리샘플링하는 함수. 썸네일 함수가 아님! 주의. -function resampleImage($imgString, $originSrc, $useAbsolutePath) { - global $database, $serviceURL, $pathURL, $defaultURL; - - if (!extension_loaded('gd') || !file_exists($originSrc)) { +function resampleImage($imgString, $filename, $useAbsolutePath = true) { + $blogid = getBlogId(); + $context = Model_Context::getInstance(); + + if (!extension_loaded('gd') || !file_exists(ROOT . "/attach/{$blogid}/{$filename}")) { return $imgString; } - + if (!is_dir(ROOT."/cache/thumbnail")) { @mkdir(ROOT."/cache/thumbnail"); @chmod(ROOT."/cache/thumbnail", 0777); @@ -21,52 +22,153 @@ function resampleImage($imgString, $originSrc, $useAbsolutePath) { @chmod(ROOT."/cache/thumbnail/".getBlogId(), 0777); } - $originFileName = basename($originSrc); - - // 여기로 넘어오는 값은 이미 getAttachmentBinder() 함수에서 고정값으로 변환된 값이므로 % 값은 고려할 필요 없음. - if (preg_match('/width="([1-9][0-9]*)"/i', $imgString, $temp)) { + $origImageSrc = ($useAbsolutePath ? $context->getProperty('uri.service') : $context->getProperty('uri.path')) . "/attach/{$blogid}/{$filename}"; + $tempWidth = $tempHeight = ''; + if (preg_match('/width="([1-9][0-9]*)"/i', $imgString, $temp)) $tempWidth = $temp[1]; - } else { - $tempWidth = ''; - } - if (preg_match('/height="([1-9][0-9]*)"/i', $imgString, $temp)) { + if (preg_match('/height="([1-9][0-9]*)"/i', $imgString, $temp)) $tempHeight = $temp[1]; - } else { - $tempHeight = ''; - } + + if (!empty($tempWidth) && is_numeric($tempWidth) && !empty($tempHeight) && is_numeric($tempHeight)) + $resizeImage = getImageResizer($filename, array('width' => $tempWidth, 'height' => $tempHeight, 'absolute' => $useAbsolutePath)); + else if (!empty($tempWidth) && !is_numeric($tempWidth) && empty($tempHeight)) + $resizeImage = getImageResizer($filename, array('width' => $tempWidth, 'absolute' => $useAbsolutePath)); + else if (empty($tempWidth) && !empty($tempHeight) && is_numeric($tempHeight)) + $resizeImage = getImageResizer($filename, array('height' => $tempHeight, 'absolute' => $useAbsolutePath)); + else + return $imgString; - $newTempFileName = preg_replace("/\\.([[:alnum:]]+)$/i", ".w{$tempWidth}-h{$tempHeight}.\\1", $originFileName); - $tempSrc = ROOT."/cache/thumbnail/".getBlogId()."/".$newTempFileName; + if ($resizeImage === false) return $imgString; - //$tempURL = "{$pathURL}/thumbnail/".getBlogId()."/".$newTempFileName; -// if ($useAbsolutePath == true) { - // From Textcube 1.6, thumbnail's URLs are also treated as absolute Path. - $tempURL = "{$serviceURL}/thumbnail/".getBlogId()."/".$newTempFileName; -// } - - if (file_exists($tempSrc)) { - $imgString = preg_replace('/src="([^"]+)"/i', 'src="'.$tempURL.'"', $imgString); - $imgString = preg_replace('/width="([^"]+)"/i', 'width="'.$tempWidth.'"', $imgString); - $imgString = preg_replace('/height="([^"]+)"/i', 'height="'.$tempHeight.'"', $imgString); - $imgString = preg_replace('/onclick="open_img\(\'([^\']+)\'\)"/', "onclick=\"open_img('$serviceURL/attach/".getBlogId()."/".$originFileName."')\"", $imgString); - } else { - $AttachedImage = new Image(); - $AttachedImage->imageFile = $originSrc; - - // 리샘플링 시작. - if ($AttachedImage->resample($tempWidth, $tempHeight)) { - // 리샘플링된 파일 저장. - $AttachedImage->createThumbnailIntoFile($tempSrc); - $imgString = preg_replace('/src="([^"]+)"/i', 'src="'.$tempURL.'"', $imgString); - $imgString = preg_replace('/width="([^"]+)"/i', 'width="'.$tempWidth.'"', $imgString); - $imgString = preg_replace('/height="([^"]+)"/i', 'height="'.$tempHeight.'"', $imgString); - $imgString = preg_replace('/onclick="open_img\(\'([^\']+)\'\)"/', "onclick=\"open_img('$serviceURL/attach/".getBlogId()."/".$originFileName."')\"", $imgString); + if (basename($resizeImage[0]) == $filename) return $imgString; + + $resizeImageSrc = $resizeImage[0]; + $resizeImageWidth = $resizeImage[1]; + $resizeImageHeight = $resizeImage[2]; + + $imgString = preg_replace('/src="([^"]+)"/i', 'src="'.$resizeImageSrc.'"', $imgString); + $imgString = preg_replace('/width="([^"]+)"/i', 'width="'.$resizeImageWidth.'"', $imgString); + $imgString = preg_replace('/height="([^"]+)"/i', 'height="'.$resizeImageHeight.'"', $imgString); + $imgString = preg_replace('/onclick="open_img\(\'([^\']+)\'\)"/', "onclick=\"open_img('{$origImageSrc}')\"", $imgString); + + return $imgString; +} + +// 본문으로 부터 포함된 모든 첨부이미지 파일명 추출 +function getAttachmentExtracts($content, $blogid = null){ + if (is_null($blogid)) $blogid = getBlogId(); + + $result = $temp = array(); + if (preg_match_all('/\[##_(1R|1L|1C|2C|3C|iMazing|Gallery)\|[^|]*\.(gif|jpg|jpeg|png|GIF|JPG|JPEG|PNG)\|(.[^\[]*)_##\]/mi', $content, $matches)) { + foreach ($matches[0] as $image) { + $split = explode("|", $image); + if (!in_array($split[1], $temp)) $temp[] = $split[1]; } + } - unset($AttachedImage); + if (preg_match_all('/]+?src=("|\')?([^\'">]*?)("|\')/mi', $content, $matches)) { + foreach ($matches[2] as $image) + if (!in_array(basename($image), $temp)) $temp[] = basename($image); } - return $imgString; + foreach($temp as $filename) { + if (preg_match('/(.+)\.w(\d{1,})\-h(\d{1,})\.(.+)/', $filename, $matches)) + $filename = $matches[1].'.'.$matches[4]; + + if (file_exists(ROOT."/attach/{$blogid}/{$filename}") && !in_array($filename, $result)) + $result[] = $filename; + } + + return $result; +} + +function getImageResizer($filename, $options = null, $blogid = null) { + // version 1.2.2 + // usages : + // $options = array('size'=>100) // resize & crop to square + // $options = array('width'=>100) // resize by width + // $options = array('width'=>100, 'height'=>50) // resize & crop by width and height + // $options = array('force'=>true) // refresh image + // $options = array('absolute'=>true) // use absolute path + + $context = Model_Context::getInstance(); + + if (is_null($blogid)) $blogid = getBlogId(); + $force = isset($options['force']) ? $options['force'] : false; + $absolute = isset($options['absolute']) ? $options['absolute'] : true; + + $originSrc = ROOT."/attach/{$blogid}/{$filename}"; + $originURL = ($absolute ? $context->getProperty('uri.service'):$context->getProperty('uri.path'))."/attach/{$blogid}/{$filename}"; + + if (!file_exists($originSrc)) return false; + + $imageInfo = getimagesize($originSrc); + if ($imageInfo === false || count($imageInfo) < 1) return false; + $originWidth = $imageInfo[0]; + $originHeight = $imageInfo[1]; + + if (!extension_loaded('gd')) return array($originURL, $originWidth, $originHeight); + + if (!is_dir(ROOT."/cache/thumbnail")) { + @mkdir(ROOT."/cache/thumbnail"); + @chmod(ROOT."/cache/thumbnail", 0777); + } + if (!is_dir(ROOT."/cache/thumbnail/" . $blogid)) { + @mkdir(ROOT."/cache/thumbnail/" .$blogid); + @chmod(ROOT."/cache/thumbnail/" . $blogid, 0777); + } + + $objResize = new Utils_Image(); + $objResize->imageFile = $originSrc; + if (isset($options['size']) && is_numeric($options['size'])) { + if ($imageInfo[0] > $imageInfo[1]) + list($tempWidth, $tempHeight) = $objResize->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $options['size']); + else + list($tempWidth, $tempHeight) = $objResize->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], $options['size'], null); + $resizeWidth = $resizeHeight = $options['size']; + $resizeFilename = preg_replace("/\\.([[:alnum:]]+)$/i", ".w{$resizeWidth}-h{$resizeHeight}.\\1", $filename); + } else if (isset($options['width']) && is_numeric($options['width']) && isset($options['height']) && is_numeric($options['height'])) { + if ($options['width'] / $options['height'] > intval($imageInfo[0]) / intval($imageInfo[1])) + list($tempWidth, $tempHeight) = $objResize->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], $options['width'], NULL); + else + list($tempWidth, $tempHeight) = $objResize->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $options['height']); + $resizeWidth = $tempWidth; + $resizeHeight = $tempHeight; + $resizeFilename = preg_replace("/\\.([[:alnum:]]+)$/i", ".w{$options['width']}-h{$options['height']}.\\1", $filename); + } else { + if (isset($options['width']) && is_numeric($options['width'])) { + list($tempWidth, $tempHeight) = $objResize->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], $options['width'], NULL); + } elseif (isset($options['height']) && is_numeric($options['height'])) { + list($tempWidth, $tempHeight) = $objResize->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $options['height']); + } else { + unset($objResize); + return array($originURL, $originWidth, $originHeight); + } + $resizeWidth = $tempWidth; + $resizeHeight = $tempHeight; + $resizeFilename = preg_replace("/\\.([[:alnum:]]+)$/i", ".w{$resizeWidth}-h{$resizeHeight}.\\1", $filename); + } + $resizeSrc = ROOT . "/cache/thumbnail/{$blogid}/{$resizeFilename}"; + $resizeURL = ($absolute ? $context->getProperty('uri.service'):$context->getProperty('uri.path')) . "/cache/thumbnail/{$blogid}/{$resizeFilename}"; + + if($force) @unlink($resizeSrc); + + if (file_exists($resizeSrc)) { + unset($objResize); + return array($resizeURL, $resizeWidth, $resizeHeight); + } + if ($objResize->resample($tempWidth, $tempHeight)) { + if (isset($options['size']) && is_numeric($options['size'])) + @$objResize->cropRectBySize($options['size'], $options['size']); + if (isset($options['width']) && is_numeric($options['width']) && isset($options['height']) && is_numeric($options['height'])) + @$objResize->cropRectBySize($options['width'], $options['height']); + if ($objResize->saveAsFile($resizeSrc)) { + unset($objResize); + return array($resizeURL, $resizeWidth, $resizeHeight); + } + } + unset($objResize); + return array($originURL, $originWidth, $originHeight); } ?> diff --git a/library/model/blog.blogSetting.php b/library/model/blog.blogSetting.php index 694370a53..42ace2c65 100644 --- a/library/model/blog.blogSetting.php +++ b/library/model/blog.blogSetting.php @@ -46,18 +46,21 @@ function getBlogTags($blogid) { function removeBlogLogo($blogid) { $context = Model_Context::getInstance(); + $skin = new Skin($context->getProperty('skin.skin')); requireModel('blog.attachment'); if(Setting::setBlogSettingGlobal('logo','') === false) return false; else { deleteAttachment($blogid, - 1, $context->getProperty('blog.logo')); $context->setProperty('blog.logo',''); + $skin->purgeCache(); return true; } } function changeBlogLogo($blogid, $file) { $context = Model_Context::getInstance(); + $skin = new Skin($context->getProperty('skin.skin')); requireModel('blog.attachment'); if (($attachment = addAttachment($blogid, - 1, $file)) === false) { return false; @@ -68,6 +71,7 @@ function changeBlogLogo($blogid, $file) { } if(Setting::setBlogSettingGlobal('logo',$attachment['name'])) { deleteAttachment($blogid, - 1, $context->getProperty('blog.logo')); + $skin->purgeCache(); return true; } return false; @@ -157,9 +161,9 @@ function useBlogSlogan($blogid, $useSloganOnPost, $useSloganOnCategory, $useSlog ) { return false; }*/ - setBlogSetting('useSloganOnPost',$useSloganOnPost); - setBlogSetting('useSloganOnCategory',$useSloganOnCategory); - setBlogSetting('useSloganOnTag',$useSloganOnTag); + Setting::setBlogSettingGlobal('useSloganOnPost',$useSloganOnPost); + Setting::setBlogSettingGlobal('useSloganOnCategory',$useSloganOnCategory); + Setting::setBlogSettingGlobal('useSloganOnTag',$useSloganOnTag); $blog['useSloganOnPost'] = $useSloganOnPost; $blog['useSloganOnCategory'] = $useSloganOnCategory; @@ -173,12 +177,12 @@ function useBlogSlogan($blogid, $useSloganOnPost, $useSloganOnCategory, $useSlog } function setEntriesOnRSS($blogid, $entriesOnRSS) { - global $blog; + $context = Model_Context::getInstance(); requireModel('blog.feed'); - if ($entriesOnRSS == $blog['entriesOnRSS']) + if ($entriesOnRSS == $context->getProperty('blog.entriesOnRSS')) return true; if(Setting::setBlogSettingGlobal('entriesOnRSS',$entriesOnRSS) === false) return false; - $blog['entriesOnRSS'] = $entriesOnRSS; + $context->setProperty('blog.entriesOnRSS',$entriesOnRSS); clearFeed(); return true; } @@ -571,12 +575,12 @@ function removeBlog($blogid) { function setSmtpServer( $useCustomSMTP, $smtpHost, $smtpPort ) { if( empty($useCustomSMTP) ) { - setServiceSetting( 'useCustomSMTP', 0 ); + Setting::setServiceSettingGlobal( 'useCustomSMTP', 0 ); return true; } - if( !setServiceSetting( 'useCustomSMTP', 1 ) ) return false; - if( !setServiceSetting( 'smtpHost', $smtpHost ) ) return false; - if( !setServiceSetting( 'smtpPort', $smtpPort ) ) return false; + if( !Setting::setServiceSettingGlobal( 'useCustomSMTP', 1 ) ) return false; + if( !Setting::setServiceSettingGlobal( 'smtpHost', $smtpHost ) ) return false; + if( !Setting::setServiceSettingGlobal( 'smtpPort', $smtpPort ) ) return false; return true; } @@ -584,7 +588,7 @@ function setDefaultBlog( $blogid ) { if(!Acl::check("group.creators")) { return false; } - $result = setServiceSetting("defaultBlogId", $_GET['blogid']); + $result = Setting::setServiceSettingGlobal("defaultBlogId", $_GET['blogid']); return $result; } ?> diff --git a/library/model/blog.service.php b/library/model/blog.service.php index fc032ab85..17e51b7c2 100644 --- a/library/model/blog.service.php +++ b/library/model/blog.service.php @@ -30,7 +30,7 @@ function getSkinSettings($blogid, $forceReload = false) { function getDefaultURL($blogid) { $context = Model_Context::getInstance(); - $blog = Setting::getBlogSettingsGlobal($blogid); + $blog = Setting::getBlogSettingsGlobal($blogid); // Load specific blog's setting switch ($context->getProperty('service.type')) { case 'domain': if (!empty($blog['defaultDomain']) && !empty($blog['secondaryDomain'])) diff --git a/library/preprocessor.php b/library/preprocessor.php index ea88a6e5c..ba8d98f9c 100644 --- a/library/preprocessor.php +++ b/library/preprocessor.php @@ -191,7 +191,6 @@ if(!defined('NO_LOCALE')) { if($context->getProperty('uri.interfaceType') == 'reader') { $languageDomain = 'owner'; } else $languageDomain = $context->getProperty('uri.interfaceType'); - if($languageDomain == 'owner') { $language = $context->getProperty('blog.language') !== null ? $context->getProperty('blog.language') : $context->getProperty('service.language'); } else { @@ -244,11 +243,15 @@ ----------------------------------- Checks privilege setting and block user (or connection). */ - if($context->getProperty('uri.interfaceType') == 'blog' && !defined('__TEXTCUBE_LOGIN__')) { $blogVisibility = Setting::getBlogSettingGlobal('visibility',2); - if($blogVisibility == 0) requireOwnership(); - else if($blogVisibility == 1) requireMembership(); + if($context->getProperty('service.requirelogin',false) == true) { + if($blogVisibility == 0) requireOwnership(); + else requireMembership(); + } else { + if($blogVisibility == 0) requireOwnership(); + else if($blogVisibility == 1) requireMembership(); + } } if(in_array($context->getProperty('uri.interfaceType'), array('owner','reader'))) { diff --git a/library/view/iphoneView.php b/library/view/iphoneView.php index dcbc1f590..dabbbfa75 100644 --- a/library/view/iphoneView.php +++ b/library/view/iphoneView.php @@ -321,10 +321,9 @@ function printIphoneCropProcess($blogid, $filename, $cropSize) { $thumbnailSrc = ROOT . "/cache/thumbnail/{$blogid}/iphoneThumbnail/th_{$filename}"; if (file_exists($originSrc)) { - requireComponent('Textcube.Function.Image'); $imageInfo = getimagesize($originSrc); - $objThumbnail = new Image(); + $objThumbnail = new Utils_Image(); if ($imageInfo[0] > $imageInfo[1]) list($tempWidth, $tempHeight) = $objThumbnail->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $cropSize); else diff --git a/library/view/ownerView.php b/library/view/ownerView.php index 98410cbd9..7888506f0 100644 --- a/library/view/ownerView.php +++ b/library/view/ownerView.php @@ -139,7 +139,7 @@ function getEditor() { if($id == $setEditor) { getEditorInfo($id); // explicitly loads plugin code ($pluginURL, $pluginName returned as global) if (isset($editor['initfunc']) && function_exists($editor['initfunc'])) { - echo "\t\t\n".call_user_func($editor['initfunc'], &$editor)."\t\t\n"; + echo "\t\t\n".call_user_func($editor['initfunc'], $editor)."\t\t\n"; $pluginURL = $pluginName = ""; } } diff --git a/library/view/view.php b/library/view/view.php index a6dfaeef1..783a004b5 100644 --- a/library/view/view.php +++ b/library/view/view.php @@ -224,7 +224,7 @@ function getTrackbacksView($entry, $skin, $accepttrackback) { return $trackbacksView; } -function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = null) { +function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = null, $listBlock = true) { global $contentContainer, $skinSetting, $skin; static $dressCommentBlock = false; $context = Model_Context::getInstance(); @@ -237,12 +237,12 @@ function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = n } if(!isset($entry)) $entry['id'] = 0; $blogid = getBlogId(); - $useAjaxBlock = $context->getProperty('blog.useAjaxComment',true); requireModel("common.setting"); requireModel("blog.entry"); requireModel("blog.comment"); requireLibrary('blog.skin'); $authorized = doesHaveOwnership(); + $useAjaxBlock = $context->getProperty('blog.useAjaxComment',true); $useMicroformat = $context->getProperty('blog.useMicroformat',3); $fn = ''; $fn_nickname = ''; @@ -259,140 +259,144 @@ function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = n } $commentView = ($isComment ? $skin->comment : $skin->guest); $commentItemsView = ''; - if ($isComment == false) { - global $comments; - if(!isset($comments)) { - list($comments, $paging) = getCommentsWithPagingForGuestbook($blogid, $context->getProperty('suri.page'), $skinSetting['commentsOnGuestbook']); - } - foreach ($comments as $key => $value) { - if ($value['secret'] == 1) { - if (!$authorized) { - if( !doesHaveOpenIDPriv($value) ) { - $comments[$key]['name'] = _text('비밀방문자'); - $comments[$key]['homepage'] = ''; - $comments[$key]['comment'] = _text('관리자만 볼 수 있는 방명록입니다.'); - } else { - $comments[$key]['name'] = _text('비밀방문자') .' '. $comments[$key]['name']; + if ($listBlock === true) { + if ($isComment == false) { + global $comments; + if(!isset($comments)) { + list($comments, $paging) = getCommentsWithPagingForGuestbook($blogid, $context->getProperty('suri.page'), $skinSetting['commentsOnGuestbook']); + } + foreach ($comments as $key => $value) { + if ($value['secret'] == 1) { + if (!$authorized) { + if( !doesHaveOpenIDPriv($value) ) { + $comments[$key]['name'] = _text('비밀방문자'); + $comments[$key]['homepage'] = ''; + $comments[$key]['comment'] = _text('관리자만 볼 수 있는 방명록입니다.'); + } else { + $comments[$key]['name'] = _text('비밀방문자') .' '. $comments[$key]['name']; + } } } } - } - } else { - if($useAjaxBlock) { - list($comments, $paging) = getCommentsWithPagingByEntryId($blogid, $entry['id'], $page, $count,'loadComment','('.$entry['id'].',',',true);return false;'); } else { - $comments = getComments($entry['id']); + if($useAjaxBlock) { + list($comments, $paging) = getCommentsWithPagingByEntryId($blogid, $entry['id'], $page, $count,'loadComment','('.$entry['id'].',',',true,true);return false;'); + } else { + $comments = getComments($entry['id']); + } } - } - if(empty($skin->dressCommentBlock)) { - if( $dressCommentBlock ) { - if($isComment) $skin->commentGuest = $dressCommentBlock; - else $skin->guestGuest = $dressCommentBlock; - } else { - if($isComment) $dressCommentBlock = $skin->commentGuest = addOpenIDPannel( $skin->commentGuest, 'rp' ); - else $dressCommentBlock = $skin->guestGuest = addOpenIDPannel( $skin->guestGuest, 'guest' ); + if(empty($skin->dressCommentBlock)) { + if( $dressCommentBlock ) { + if($isComment) $skin->commentGuest = $dressCommentBlock; + else $skin->guestGuest = $dressCommentBlock; + } else { + if($isComment) $dressCommentBlock = $skin->commentGuest = addOpenIDPannel( $skin->commentGuest, 'rp' ); + else $dressCommentBlock = $skin->guestGuest = addOpenIDPannel( $skin->guestGuest, 'guest' ); + } + $skin->dressCommentBlock = true; } - $skin->dressCommentBlock = true; - } - foreach ($comments as $commentItem) { - $commentItemView = ($isComment ? $skin->commentItem : $skin->guestItem); - $commentSubItemsView = ''; - $subComments = getCommentComments($commentItem['id'],$commentItem); - foreach ($subComments as $commentSubItem) { - $commentSubItemView = ($isComment ? $skin->commentSubItem : $skin->guestSubItem); + /// Dressing comments + foreach ($comments as $commentItem) { + $commentItemView = ($isComment ? $skin->commentItem : $skin->guestItem); + $commentSubItemsView = ''; + $subComments = getCommentComments($commentItem['id'],$commentItem); + foreach ($subComments as $commentSubItem) { + $commentSubItemView = ($isComment ? $skin->commentSubItem : $skin->guestSubItem); + + $commentSubItem['name'] = htmlspecialchars($commentSubItem['name']); + $commentSubItem['comment'] = htmlspecialchars($commentSubItem['comment']); + + $rp_class = $prefix1 . '_general'; + if ($blogid == $commentSubItem['replier']) + $rp_class = $prefix1 . '_admin'; + else if ($commentSubItem['secret'] == 1) { + $rp_class = $prefix1 . '_secret'; + if ($authorized) { + $commentSubItem['comment'] = '' . _text('[비밀댓글]') . ' ' . $commentSubItem['comment']; + } else { + $rp_class .= ' hiddenComment'; + $commentSubItem['name'] = '' . _text('비밀방문자') . ''.(doesHaveOpenIDPriv($commentSubItem)?' '.$commentSubItem['name']:''); + } + } + dress($prefix1 . '_rep_class', $rp_class, $commentSubItemView); + + if (dress($prefix1 . '_rep_id',($entry['id'] == 0 ? 'guestbook' : 'comment') . $commentSubItem['id'], $commentSubItemView) == false) { + $commentSubItemView = "" . $commentSubItemView; + } + if (empty($commentSubItem['homepage']) || + (($commentSubItem['secret'] == 1) && !doesHaveOwnership())) { + dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), "".$commentSubItem['name']."", $commentSubItem), $commentSubItemView); + } else { + dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), '' . $commentSubItem['name'] . '', $commentSubItem), $commentSubItemView); + } + $contentContainer["{$prefix1}_{$commentSubItem['id']}"] = fireEvent(($isComment ? 'ViewCommentContent' : 'ViewGuestCommentContent'), nl2br(addLinkSense($commentSubItem['comment'], ' onclick="return openLinkInNewWindow(this)"')), $commentSubItem); + dress($prefix1 . '_rep_desc', setTempTag("{$prefix1}_{$commentSubItem['id']}"), $commentSubItemView); + dress($prefix1 . '_rep_date', fireEvent(($isComment ? 'ViewCommentDate' : 'ViewGuestCommentDate'), Timestamp::format5($commentSubItem['written']), $commentSubItem['written']), $commentSubItemView); + dress($prefix1 . '_rep_link',$context->getProperty('uri.blog')."/".($entry['id'] == 0 ? "guestbook/{$commentItem['id']}#guestbook{$commentSubItem['id']}" : ($context->getProperty('blog.useSloganOnPost') ? "entry/".URL::encode($entry['slogan'],$context->getProperty('service.useEncodedURL')) : $entry['id'])."#comment{$commentSubItem['id']}"), $commentSubItemView); + dress($prefix1 . '_rep_onclick_delete', "deleteComment({$commentSubItem['id']}); return false;", $commentSubItemView); + + $commentSubItemsView .= $commentSubItemView; + } + $commentSubContainer = ($isComment ? $skin->commentSubContainer : $skin->guestSubContainer); + dress(($isComment ? 'rp2_rep' : 'guest_reply_rep'), $commentSubItemsView, $commentSubContainer); + if (count($subComments) > 0) { + dress(($isComment ? 'rp2_container' : 'guest_reply_container'), $commentSubContainer, $commentItemView); + } - $commentSubItem['name'] = htmlspecialchars($commentSubItem['name']); - $commentSubItem['comment'] = htmlspecialchars($commentSubItem['comment']); + $commentItem['name'] = htmlspecialchars($commentItem['name']); + $commentItem['comment'] = htmlspecialchars($commentItem['comment']); $rp_class = $prefix1 . '_general'; - if ($blogid == $commentSubItem['replier']) + if ($blogid == $commentItem['replier']) $rp_class = $prefix1 . '_admin'; - else if ($commentSubItem['secret'] == 1) { + else if ($commentItem['secret'] == 1) { $rp_class = $prefix1 . '_secret'; if ($authorized) { - $commentSubItem['comment'] = '' . _text('[비밀댓글]') . ' ' . $commentSubItem['comment']; + $commentItem['comment'] = '' . _text('[비밀댓글]') . ' ' . $commentItem['comment']; } else { $rp_class .= ' hiddenComment'; - $commentSubItem['name'] = '' . _text('비밀방문자') . ''.(doesHaveOpenIDPriv($commentSubItem)?' '.$commentSubItem['name']:''); + $commentItem['name'] = '' . _text('비밀방문자') . ''.(doesHaveOpenIDPriv($commentItem)?' '.$commentItem['name']:''); } } - dress($prefix1 . '_rep_class', $rp_class, $commentSubItemView); - - if (dress($prefix1 . '_rep_id',($entry['id'] == 0 ? 'guestbook' : 'comment') . $commentSubItem['id'], $commentSubItemView) == false) { - $commentSubItemView = "" . $commentSubItemView; + dress($prefix1 . '_rep_class', $rp_class, $commentItemView); + if (dress($prefix1 . '_rep_id', ($entry['id'] == 0 ? 'guestbook' : 'comment') . $commentItem['id'], $commentItemView) == false) { + $commentItemView = "" . $commentItemView; } - if (empty($commentSubItem['homepage']) || - (($commentSubItem['secret'] == 1) && !doesHaveOwnership())) { - dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), "".$commentSubItem['name']."", $commentSubItem), $commentSubItemView); + if (empty($commentItem['homepage']) || + (($commentItem['secret'] == 1) && !doesHaveOwnership())) { + dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), "".$commentItem['name']."", $commentItem), $commentItemView); } else { - dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), '' . $commentSubItem['name'] . '', $commentSubItem), $commentSubItemView); + dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), '' . $commentItem['name'] . '', $commentItem), $commentItemView); } - $contentContainer["{$prefix1}_{$commentSubItem['id']}"] = fireEvent(($isComment ? 'ViewCommentContent' : 'ViewGuestCommentContent'), nl2br(addLinkSense($commentSubItem['comment'], ' onclick="return openLinkInNewWindow(this)"')), $commentSubItem); - dress($prefix1 . '_rep_desc', setTempTag("{$prefix1}_{$commentSubItem['id']}"), $commentSubItemView); - dress($prefix1 . '_rep_date', fireEvent(($isComment ? 'ViewCommentDate' : 'ViewGuestCommentDate'), Timestamp::format5($commentSubItem['written']), $commentSubItem['written']), $commentSubItemView); - dress($prefix1 . '_rep_link',$context->getProperty('uri.blog')."/".($entry['id'] == 0 ? "guestbook/{$commentItem['id']}#guestbook{$commentSubItem['id']}" : ($context->getProperty('blog.useSloganOnPost') ? "entry/".URL::encode($entry['slogan'],$context->getProperty('service.useEncodedURL')) : $entry['id'])."#comment{$commentSubItem['id']}"), $commentSubItemView); - dress($prefix1 . '_rep_onclick_delete', "deleteComment({$commentSubItem['id']}); return false;", $commentSubItemView); - - $commentSubItemsView .= $commentSubItemView; - } - $commentSubContainer = ($isComment ? $skin->commentSubContainer : $skin->guestSubContainer); - dress(($isComment ? 'rp2_rep' : 'guest_reply_rep'), $commentSubItemsView, $commentSubContainer); - if (count($subComments) > 0) { - dress(($isComment ? 'rp2_container' : 'guest_reply_container'), $commentSubContainer, $commentItemView); - } - - $commentItem['name'] = htmlspecialchars($commentItem['name']); - $commentItem['comment'] = htmlspecialchars($commentItem['comment']); - - $rp_class = $prefix1 . '_general'; - if ($blogid == $commentItem['replier']) - $rp_class = $prefix1 . '_admin'; - else if ($commentItem['secret'] == 1) { - $rp_class = $prefix1 . '_secret'; - if ($authorized) { - $commentItem['comment'] = '' . _text('[비밀댓글]') . ' ' . $commentItem['comment']; + $contentContainer["{$prefix1}_{$commentItem['id']}"] = fireEvent(($isComment ? 'ViewCommentContent' : 'ViewGuestCommentContent'), nl2br(addLinkSense($commentItem['comment'], ' onclick="return openLinkInNewWindow(this)"')), $commentItem); + dress($prefix1 . '_rep_desc', setTempTag("{$prefix1}_{$commentItem['id']}"), $commentItemView); + dress($prefix1 . '_rep_date', fireEvent(($isComment ? 'ViewCommentDate' : 'ViewGuestCommentDate'), Timestamp::format5($commentItem['written']), $commentItem['written']), $commentItemView); + if ($prefix1 == 'guest' && $authorized != true && $context->getProperty('blog.allowWriteDblCommentOnGuestbook') == 0) { + $doubleCommentPermissionScript = 'alert(\'' . _text('댓글을 사용할 수 없습니다.') . '\'); return false;'; } else { - $rp_class .= ' hiddenComment'; - $commentItem['name'] = '' . _text('비밀방문자') . ''.(doesHaveOpenIDPriv($commentItem)?' '.$commentItem['name']:''); + $doubleCommentPermissionScript = ''; } + dress($prefix1 . '_rep_onclick_reply', $doubleCommentPermissionScript . "commentComment({$commentItem['id']}); return false", $commentItemView); + dress($prefix1 . '_rep_onclick_delete', "deleteComment({$commentItem['id']});return false", $commentItemView); + dress($prefix1 . '_rep_link', + $context->getProperty('uri.blog')."/".($entry['id'] == 0 ? "guestbook/{$commentItem['id']}#guestbook{$commentItem['id']}" : + ($context->getProperty('blog.useSloganOnPost') ? "entry/".URL::encode($entry['slogan'],$context->getProperty('service.useEncodedURL')) : $entry['id'])."?commentId=".$commentItem['id']."#comment{$commentItem['id']}"), $commentItemView); + + $commentItemsView .= $commentItemView; } - dress($prefix1 . '_rep_class', $rp_class, $commentItemView); - if (dress($prefix1 . '_rep_id', ($entry['id'] == 0 ? 'guestbook' : 'comment') . $commentItem['id'], $commentItemView) == false) { - $commentItemView = "" . $commentItemView; - } - if (empty($commentItem['homepage']) || - (($commentItem['secret'] == 1) && !doesHaveOwnership())) { - dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), "".$commentItem['name']."", $commentItem), $commentItemView); - } else { - dress($prefix1 . '_rep_name', fireEvent(($isComment ? 'ViewCommenter' : 'ViewGuestCommenter'), '' . $commentItem['name'] . '', $commentItem), $commentItemView); - } - $contentContainer["{$prefix1}_{$commentItem['id']}"] = fireEvent(($isComment ? 'ViewCommentContent' : 'ViewGuestCommentContent'), nl2br(addLinkSense($commentItem['comment'], ' onclick="return openLinkInNewWindow(this)"')), $commentItem); - dress($prefix1 . '_rep_desc', setTempTag("{$prefix1}_{$commentItem['id']}"), $commentItemView); - dress($prefix1 . '_rep_date', fireEvent(($isComment ? 'ViewCommentDate' : 'ViewGuestCommentDate'), Timestamp::format5($commentItem['written']), $commentItem['written']), $commentItemView); - if ($prefix1 == 'guest' && $authorized != true && $context->getProperty('blog.allowWriteDblCommentOnGuestbook') == 0) { - $doubleCommentPermissionScript = 'alert(\'' . _text('댓글을 사용할 수 없습니다.') . '\'); return false;'; - } else { - $doubleCommentPermissionScript = ''; + /// Merging comments with its paging links. + $commentContainer = ($isComment ? $skin->commentContainer : $skin->guestContainer); + dress(($isComment ? 'rp_rep' : 'guest_rep'), $commentItemsView, $commentContainer); + if (count($comments) > 0) { + if($isComment && $useAjaxBlock) { + $pagingView = Paging::getPagingView($paging, $skin->paging, $skin->pagingItem, false, 'onclick'); + } else $pagingView = ''; + dress($prefix1 . '_container', "
    ".$commentContainer.$pagingView."
    ", $commentView); } - dress($prefix1 . '_rep_onclick_reply', $doubleCommentPermissionScript . "commentComment({$commentItem['id']}); return false", $commentItemView); - dress($prefix1 . '_rep_onclick_delete', "deleteComment({$commentItem['id']});return false", $commentItemView); - dress($prefix1 . '_rep_link', - $context->getProperty('uri.blog')."/".($entry['id'] == 0 ? "guestbook/{$commentItem['id']}#guestbook{$commentItem['id']}" : - ($context->getProperty('blog.useSloganOnPost') ? "entry/".URL::encode($entry['slogan'],$context->getProperty('service.useEncodedURL')) : $entry['id'])."?commentId=".$commentItem['id']."#comment{$commentItem['id']}"), $commentItemView); - - $commentItemsView .= $commentItemView; - } - - $commentContainer = ($isComment ? $skin->commentContainer : $skin->guestContainer); - dress(($isComment ? 'rp_rep' : 'guest_rep'), $commentItemsView, $commentContainer); - if (count($comments) > 0) { - if($isComment && $useAjaxBlock) { - $pagingView = Paging::getPagingView($paging, $skin->paging, $skin->pagingItem, false, 'onclick'); - } else $pagingView = ''; - dress($prefix1 . '_container', $commentContainer.$pagingView, $commentView); + } else { + dress($prefix1 . '_container', '', $commentView); } - - // Comment write block + /// Comment write block if($inputBlock == true) { if(!empty($entry['acceptcomment'])) { $acceptcomment = $entry['acceptcomment']; @@ -408,8 +412,8 @@ function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = n $openid_identity = Acl::getIdentity('openid'); if ($isComment) { if (!($skin->commentForm == '')) { - $commentRrevView = $commentView; - $commentView = $skin->commentForm; + $commentRrevView = $commentView; /// Comment Lists. + $commentView = $skin->commentForm; /// Comment write block. $useForm = true; } } else { @@ -470,7 +474,10 @@ function getCommentView($entry, $skin, $inputBlock = true, $page = 1, $count = n } else { $commentView = "
    getProperty('uri.blog')."/comment/add/{$entry['id']}\" onsubmit=\"return false\" style=\"margin: 0\">" . $commentView . ''; } + } else { + dress($prefix1 . '_input_form', "", $commentView); } + /// Adding feed links. dress('article_rep_rp_atomurl', $context->getProperty('uri.default').'/atom/comment/'.$entry['id'], $commentView); dress('article_rep_rp_rssurl', $context->getProperty('uri.default').'/rss/comment/'.$entry['id'], $commentView); return $commentView; @@ -1230,7 +1237,7 @@ function getEntryContentView($blogid, $id, $content, $formatter, $keywords = arr $tempAttributes = Misc::getAttributesFromString($images[$i][2]); $tempOriginInfo = getimagesize(ROOT . "/attach/{$blogid}/{$tempFileName}"); if (isset($tempAttributes['width']) && ($tempOriginInfo[0] > $tempAttributes['width'])) - $newImage = resampleImage($images[$i][0], ROOT . "/attach/{$blogid}/{$tempFileName}", $useAbsolutePath); + $newImage = resampleImage($images[$i][0], $tempFileName, $useAbsolutePath); else $newImage = $images[$i][0]; } else { diff --git a/manifest.xml b/manifest.xml new file mode 100644 index 000000000..ef4ef8d3c --- /dev/null +++ b/manifest.xml @@ -0,0 +1,9 @@ + + + + + diff --git a/parameters.xml b/parameters.xml new file mode 100644 index 000000000..7ed352f98 --- /dev/null +++ b/parameters.xml @@ -0,0 +1,136 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/plugins/CL_OpenID/index.xml b/plugins/CL_OpenID/index.xml index 1c3ad8faf..ea2d37c1c 100644 --- a/plugins/CL_OpenID/index.xml +++ b/plugins/CL_OpenID/index.xml @@ -1,8 +1,8 @@ - OpenID(일본어판) - OpenID(Japanese) - OpenID(日本語版) + OpenID + OpenID + OpenID http://www.needlworks.org/ 1.0 This plugin enables OpenID facility. diff --git a/plugins/CT_RecentRP_Default/index.xml b/plugins/CT_RecentRP_Default/index.xml index 840456207..2b5ce4822 100644 --- a/plugins/CT_RecentRP_Default/index.xml +++ b/plugins/CT_RecentRP_Default/index.xml @@ -1,8 +1,8 @@ - Recent Replies(Japanese) - 최근 댓글(일본어판) - 新着コメント(日本語版) + Recent Replies + 최근 댓글 + 新着コメント http://needlworks.org/ 1.8 Shows recent replies diff --git a/plugins/CT_Start_Default/index.xml b/plugins/CT_Start_Default/index.xml index 88d54cebe..fc2f42319 100644 --- a/plugins/CT_Start_Default/index.xml +++ b/plugins/CT_Start_Default/index.xml @@ -1,8 +1,8 @@ - Start(Japanese) - 시작하기(일본어판) - スタート(日本語版) + Start + 시작하기 + スタート http://needlworks.org/ 1.6 Adds shortcuts to start tasks what you want to with Textcube. diff --git a/plugins/FM_Markdown/ttml.php b/plugins/FM_Markdown/ttml.php index 5076bdce2..d7350bcc7 100644 --- a/plugins/FM_Markdown/ttml.php +++ b/plugins/FM_Markdown/ttml.php @@ -1,11 +1,12 @@ ' . _text('확대') . ''; + $buf .= '
    ' . _text('확대') . ''; $buf .= '
    @@ -486,5 +483,18 @@ function _GMap_printFooterForUI($jsName) { function _GMap_normalizeAddress($address) { return trim(implode(' ', explode('/', $address))); } + +function _GMap_convertLegacyMapType($type) { + $names = Array( + 'G_NORMAL_MAP' => 'ROADMAP', + 'G_SATELLITE_MAP' => 'SATELLITE', + 'G_HYBRID_MAP' => 'HYBRID', + 'G_PHYSICAL_MAP' => 'TERRAIN' + ); + if ($names[$type]) + return $names[$type]; + return $type; +} + /* vim: set noet ts=4 sts=4 sw=4: */ ?> diff --git a/plugins/GoogleMap/index.xml b/plugins/GoogleMap/index.xml index 74320a88c..6c4d30ecf 100644 --- a/plugins/GoogleMap/index.xml +++ b/plugins/GoogleMap/index.xml @@ -17,7 +17,6 @@ - @@ -30,9 +29,6 @@
    - -
    - @@ -54,9 +50,6 @@
    - -
    - diff --git a/plugins/GoogleMap/locale/en.php b/plugins/GoogleMap/locale/en.php index 0f5c72736..c7211bc7a 100644 --- a/plugins/GoogleMap/locale/en.php +++ b/plugins/GoogleMap/locale/en.php @@ -14,8 +14,16 @@ $__text['세로'] = 'Height'; $__text['적용'] = 'Apply'; $__text['이용 안내'] = 'Help'; -$__text['현재 위치 알아내기'] = 'Attach current location'; +$__text['현재 위치 첨부하기'] = 'Attach current location'; +$__text['첨부된 위치 제거하기'] = 'Remove attached location'; +$__text['첨부된 위치 정보를 제거하시겠습니까?'] = 'Are you sure to remove the location attached to this post?'; $__text['웹브라우저가 제공하는 Geolocation 서비스를 이용하여 현재 위치 정보를 가져옵니다. 정확도는 사용하고 계신 기기나 지역에 따라 다를 수 있습니다.'] = 'Get the current location which is provided by your web browser. The accuracy may be different depending on what device you are using, or the location where you are.'; $__text['자세히 알아보기'] = 'More details'; -$__text['구글맵 추가하기'] = 'Add a Google Map'; +$__text['지도 삽입하기'] = 'Insert a Map'; +$__text['권한 없음'] = 'Permission denied'; +$__text['위치정보 없음'] = 'Not available'; +$__text['시간 제한 초과'] = 'Timeout'; +$__text['알 수 없는 오류'] = 'Unknown error'; +$__text['위치 정보를 가져오지 못하였습니다.'] = 'Could not retrieve your location.'; +$__text['현재 웹브라우저는 Geolocation 기능을 지원하지 않습니다.'] = 'Your web browser does not provide Geolocation functions.'; ?> diff --git a/plugins/GoogleMap/scripts/common.js b/plugins/GoogleMap/scripts/common.js index d12371b27..f1ece71bb 100644 --- a/plugins/GoogleMap/scripts/common.js +++ b/plugins/GoogleMap/scripts/common.js @@ -1,41 +1,63 @@ // Google Map Plugin Common Library // depends on Google Maps API -var geocoder = null; - -function GMap_normalizeAddress(address) { - return address.split('/').join(' '); -} +window.plugin = window.plugin || {}; +plugin.gmap = { + activeInfoWindow: null, + geocoder: null, + closeActiveInfoWindow: function() { + if (this.activeInfoWindow) + this.activeInfoWindow.close(); + this.activeInfoWindow = null; + }, + detectMobileSafari: function() { + return navigator.userAgent.indexOf('iPhone') != -1 || navigator.userAgent.indexOf('iPod') != -1 || navigator.userAgent.indexOf('iPad') != -1; + }, + normalizeAddress: function(address) { + return address.split('/').join(' '); + }, + sendCache: function(original_path, path, lat, lng) { + jQuery.ajax({ + 'type': 'POST', + 'url': servicePath + '/plugin/GMapCache/', + 'data': { + 'original_path': original_path, + 'path': path, + 'lat': lat, + 'lng': lng + } + }); + // Here, we don't need the cache result actually. + } +}; -function GMap_sendCache(original_path, path, lat, lng) { - var xh = GXmlHttp.create(); - xh.open('POST', servicePath + '/plugin/GMapCache/', true); - xh.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - xh.send('original_path=' + encodeURIComponent(original_path) + '&path=' + encodeURIComponent(path) + (lat != null ? '&lat='+lat+'&lng='+lng : '')); - // Here, we don't need the cache result actually. -} /** * @brief 지역로그와 연동되어 특정 위치와 연관된 엔트리 정보를 marker 형태로 맵에 추가한다. - * @param Object response GGlientGeocoder::getLocations() 메소드 호출에 의한 서버 응답 오브젝트 - * @param GMap2 gmap GMap2 타입의 오브젝트 + * @param Array. results Geocoder::geocode() 메소드 호출의 결과 + * @param GeocodeStatus status Geocoder::geocode() 메소드 호출에 의한 서버 응답 + * @param Map gmap Map object * @param string address 화면에 표시될 주소 문자열 * @param string title 화면에 표시될 링크 이름 문자열 * @param string link 엔트리의 링크 URL - * @param GLatLngBounds boundary 모든 marker를 포함하는 최소 영역을 알기 위한 GLatLngBounds 객체 + * @param LatLngBounds boundary 모든 marker를 포함하는 최소 영역을 알기 위한 LatLngBounds 객체 * @param Array locations 같은 위치에 여러 엔트리가 관련된 경우를 처리하기 위해 이미 처리된 엔트리들과 marker 정보를 담은 배열 */ function GMap_addLocationMark(gmap, location_path, title, link, boundary, locations) { - if (!geocoder) - geocoder = new GClientGeocoder(); - var address = GMap_normalizeAddress(location_path); - geocoder.getLocations(address, function(response) {GMap_findLocationCallback(response, gmap, {'address': address, 'path': location_path, 'original_path': location_path}, title, link, boundary, locations);}); + if (!plugin.gmap.geocoder) + plugin.gmap.geocoder = new google.maps.Geocoder(); + var address = plugin.gmap.normalizeAddress(location_path); + plugin.gmap.geocoder.geocode({ + 'address': address + }, function(results, status) { + GMap_findLocationCallback(results, status, gmap, {'address': address, 'path': location_path, 'original_path': location_path}, title, link, boundary, locations); + }); } function GMap_addLocationMarkDirect(gmap, location_info, title, link, point, boundary, locations, cache) { var prev = null; var i; - // Check duplicated locations + // Retrieve if any duplicated location exists for the given. for (i = 0; i < locations.length; i++) { if (locations[i].point.equals(point)) { prev = locations[i]; @@ -43,27 +65,38 @@ function GMap_addLocationMarkDirect(gmap, location_info, title, link, point, bou } } if (prev == null) { - // Create a new marker for this location - var marker = new GMarker(point, {'title': location_info.address.split(' ').pop()}); + // Create a new marker for this location. + var marker = new google.maps.Marker({ + 'position': point, + 'title': location_info.address.split(' ').pop(), + 'map': gmap + }); + var info = new google.maps.InfoWindow({ + 'position': point + }); var locative = { 'point': point, 'marker': marker, + 'infoWindow': info, 'address': location_info.address, 'address_parts': location_info.path.split('/'), 'entries': new Array({'title': title, 'link': link}) }; locations.push(locative); - marker.bindInfoWindowHtml(GMap_buildLocationInfoHTML(locative)); - gmap.addOverlay(marker); + info.setContent(GMap_buildLocationInfoHTML(locative)); + google.maps.event.addListener(marker, 'click', function() { + plugin.gmap.closeActiveInfoWindow(); + info.open(marker.getMap(), marker); + plugin.gmap.activeInfoWindow = info; + }); boundary.extend(point); } else { - // Add information to the existing marker for here + // Add information to the existing marker for here. prev.entries.push({'title': title, 'link': link}); - prev.marker.bindInfoWindowHtml(null); - prev.marker.bindInfoWindowHtml(GMap_buildLocationInfoHTML(prev)); + prev.infoWindow.setContent(GMap_buildLocationInfoHTML(prev)); } if (cache) - GMap_sendCache(location_info.original_path, location_info.path, point.lat(), point.lng()); + plugin.gmap.sendCache(location_info.original_path, location_info.path, point.lat(), point.lng()); if (process_count != undefined) process_count++; } @@ -85,12 +118,12 @@ function GMap_buildLocationInfoHTML(locative) { /** * @brief (내부용 함수) geocoder.getLocations()에 의해 호출되는 비동기 콜백 함수 */ -function GMap_findLocationCallback(response, gmap, location_info, title, link, boundary, locations) { - if (!response || response.Status.code != 200) { +function GMap_findLocationCallback(results, status, gmap, location_info, title, link, boundary, locations) { + if (status == google.maps.GeocoderStatus.ZERO_RESULTS) { var new_path_parts = location_info.path.split('/').slice(0,-1); if (new_path_parts.length < 2) { // give up search... - GMap_sendCache(location_info.original_path, location_info.path, null, null); + plugin.gmap.sendCache(location_info.original_path, location_info.path, null, null); if (process_count != undefined) process_count++; } else { @@ -98,13 +131,14 @@ function GMap_findLocationCallback(response, gmap, location_info, title, link, b var new_address = new_path_parts.join(' '); var new_path = new_path_parts.join('/'); if (new_path[0] != '/') new_path = '/' + new_path; - geocoder.getLocations(new_address, function(response) { - GMap_findLocationCallback(response, gmap, {'address': new_address, 'path': new_path, 'original_path': location_info.original_path}, title, link, boundary, locations); + geocoder.geocode({ + 'address': new_address + }, function(results, status) { + GMap_findLocationCallback(results, status, gmap, {'address': new_address, 'path': new_path, 'original_path': location_info.original_path}, title, link, boundary, locations); }); } - } else { - var place = response.Placemark[0]; - var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); + } else if (status == google.maps.GeocoderStatus.OK) { + var point = new google.maps.LatLng(results[0].geometry.location.lat(), results[0].geometry.location.lng()); GMap_addLocationMarkDirect(gmap, location_info, title, link, point, boundary, locations, true); } } @@ -112,26 +146,39 @@ function GMap_findLocationCallback(response, gmap, location_info, title, link, b function GMap_CreateMap(container, options) { container.style.width = options.width + 'px'; container.style.height = options.height + 'px'; - var map = new GMap2(container); + var map = new google.maps.Map(container, { + 'center': new google.maps.LatLng(options.center.latitude, options.center.longitude), + 'zoom': options.zoom, + 'mapTypeId': eval('google.maps.MapTypeId.' + options.type) || google.maps.MapTypeId.ROADMAP, + 'mapTypeControl': true, + 'navigationControl': true, + 'scaleControl': true + }); var i; - map.setMapType(eval(options.type) || G_HYBRID_MAP); - map.addMapType(G_PHYSICAL_MAP); - map.addControl(new GHierarchicalMapTypeControl()); - map.addControl(new GLargeMapControl()); - map.addControl(new GScaleControl()); - map.setCenter(new GLatLng(options.center.latitude, options.center.longitude), options.zoom); if (options.user_markers != undefined) { for (i = 0; i < options.user_markers.length; i++) { var um = options.user_markers[i]; - var marker = new GMarker(new GLatLng(um.lat, um.lng)); - if (um.title.trim() != '') - marker.bindInfoWindowHtml('

    '+um.title+'

    '+um.desc+'

    '); - map.addOverlay(marker); + var marker = new google.maps.Marker({ + 'position': new google.maps.LatLng(um.lat, um.lng) + }); + if (um.title.trim() != '') { + var info = new google.maps.InfoWindow({ + 'content': '

    '+um.title+'

    '+um.desc+'

    ', + 'map': map + }); + google.maps.event.addListener(marker, 'click', function() { + plugin.gmap.closeActiveInfoWindow(); + info.open(marker.getMap(), marker); + plugin.gmap.activeInfoWindow = info; + }); + } } } return map; } +/* +//TODO:v3 GProgressControl = function() {} GProgressControl.prototype = new GControl(); GProgressControl.prototype.initialize = function(map) { @@ -176,5 +223,6 @@ GProgressControl.prototype.setLabel = function(text) { GProgressControl.prototype.setProgress = function(val) { // val in 0..1 this._progress_meter.style.width = parseInt(val * 100) + '%'; } +*/ /* vim: set noet ts=4 sts=4 sw=4: */ diff --git a/plugins/GoogleMap/scripts/editor.js b/plugins/GoogleMap/scripts/editor.js index c83c3d7d0..15d51e8bd 100644 --- a/plugins/GoogleMap/scripts/editor.js +++ b/plugins/GoogleMap/scripts/editor.js @@ -1,12 +1,90 @@ // Google Map Plugin WYSISYG Helper -// - depends on EAF4.js, Google Map API v2, and jQuery 1.3.2 or higher included in Textcube 1.8 or higher. +// - depends on EAF4.js, Google Map API v3, and jQuery 1.4 or higher included in Textcube 1.8 or higher. -function GMapTool_insertMap() { +(function ($) { +window.GMapTool_insertMap = function() { window.open(blogURL + '/plugin/GMapCustomInsert/', 'GMapTool_Insert', 'menubar=no,toolbar=no,width=550,height=680,scrollbars=yes'); } -function GMapTool_getLocation() { - window.open(blogURL + '/plugin/GMapGetLocation/', 'GMapTool_GetLocation', 'menubar=no,toolbar=no,width=550,height=600,scrollbars=no'); +window.GMapTool_attachLocation = function() { + if (plugin.gmap.isLocationAttached) { + if (confirm(_t('첨부된 위치 정보를 제거하시겠습니까?'))) { + $('input[name=latitude]').val(''); + $('input[name=longitude]').val(''); + plugin.gmap.isLocationAttached = false; + $('#googlemap-attachLocation').text(_t('현재 위치 첨부하기')); + } + } else { + if (navigator.geolocation) { + var offset = $('#googlemap-attachLocation').offset(); + var height = parseInt($('#googlemap-attachLocation').outerHeight() - (plugin.gmap.detectMobileSafari() ? $(window).scrollTop() : 0)); + $('#googlemap-geolocation-preview') + .css({'width': '240px'}) + .empty().append('

     Loading...

    '); + $('#googlemap-geolocation-container').css({'top': parseInt(offset.top + height), 'left': parseInt(offset.left - 75)}).show(); + navigator.geolocation.getCurrentPosition(function(pos) { + $('#googlemap-geolocation-preview') + .empty().append($('').attr('id', 'googlemap-geolocation-preview-close').attr('href', '#close').text('close')) + .append($('').attr('src', 'http://maps.google.com/maps/api/staticmap?center=' + pos.coords.latitude + ',' + pos.coords.longitude + '&zoom=12&size=240x160&maptype=roadmap&sensor=true&markers=color:red|' + pos.coords.latitude + ',' + pos.coords.longitude)); + $('input[name=latitude]').val(pos.coords.latitude); + $('input[name=longitude]').val(pos.coords.longitude); + $('#googlemap-geolocation-preview-close').click(function(e) { + $('#googlemap-geolocation-container').hide(); + e.preventDefault(); + return false; + }); + plugin.gmap.isLocationAttached = true; + $('#googlemap-attachLocation').text(_t('첨부된 위치 제거하기')); + }, function(error) { + switch (error.code) { + case 1: + msg = _t('권한 없음'); + break; + case 2: + msg = _t('위치정보 없음'); + break; + case 3: + msg = _t('시간 제한 초과'); + break; + default: + msg = _t('알 수 없는 오류'); + } + alert(_t('위치 정보를 가져오지 못하였습니다.') + ' (' + msg + ')'); + $('#googlemap-geolocation-container').hide(); + }); + } else { + alert(_t('현재 웹브라우저는 Geolocation 기능을 지원하지 않습니다.')); + } + } } -STD.addUnloadEventListener(function() { GUnload(); }); +$(document).ready(function() { + // Create the hiidden input fields for location coordinates. + plugin.gmap.isLocationAttached = false; + if ($('input[name=latitude]').length == 0) { + $('#editor-form').append(''); + } else { + if ($('input[name=latitude]').val() && $('input[name=longitude]').val()) { + plugin.gmap.isLocationAttached = true; + $('#googlemap-attachLocation').text(_t('첨부된 위치 제거하기')); + } + } + $('body').append(''); + // Make a small arrow indicating the get locaction button. + var e = document.getElementById('googlemap-geolocation-container-arrow'); + if (e.getContext) { + var ctx = e.getContext('2d'); + ctx.fillStyle = $('#googlemap-geolocation-preview').css('background-color'); + ctx.beginPath(); + ctx.moveTo(5, 0); ctx.lineTo(10, 7); ctx.lineTo(0, 7); + ctx.fill(); + ctx.strokeStyle = $('#googlemap-geolocation-preview').css('border-top-color'); + ctx.beginPath(); + ctx.moveTo(5, 0); ctx.lineTo(10, 7); + ctx.closePath(); ctx.stroke(); + ctx.beginPath(); + ctx.moveTo(5, 0); ctx.lineTo(0, 7); + ctx.closePath(); ctx.stroke(); + } +}); +})(jQuery); diff --git a/plugins/GoogleMap/scripts/getlocation.js b/plugins/GoogleMap/scripts/getlocation.js deleted file mode 100644 index 1cc0e5e87..000000000 --- a/plugins/GoogleMap/scripts/getlocation.js +++ /dev/null @@ -1,54 +0,0 @@ -// Google Map Plugin UI Helper -// - depends on jQuery 1.3.2, jQuery UI plugin 1.7.2, and Google Maps API - -var mode = 'started'; -var position; - -$(document).ready(function() { - if (navigator.geolocation) { - $('#availability').html('현재 웹브라우저는 Geolocation 기능을 지원합니다. ') - $('#getLocation').click(function() { - if (mode == 'started') { - $('#status').html('가져오는 중...'); - navigator.geolocation.getCurrentPosition(function(pos) { - map.setCenter(new GLatLng(pos.coords.latitude, pos.coords.longitude), 10); - position = pos; - $('#status').html('가져오기 성공.'); - $('#getLocation').text('좌표 설정하기'); - mode = 'set'; - }, function(error) { - switch (error.code) { - case 1: - msg = '권한 없음'; - break; - case 2: - msg = '위치정보 없음' - break; - case 3: - msg = '시간 제한 초과' - break; - default: - msg = '알 수 없는 오류'; - } - $('#status').html('실패 ('+msg+')'); - }); - } else if (mode == 'set') { - if (confirm('('+position.coords.latitude+', '+position.coords.longitude+') 이 좌표를 현재 작성 중인 포스트의 좌표로 설정하시겠습니까?')) { - var opener = window.opener; - if (!opener) { - alert('Error: The editor is not accessible.'); - return; - } - if (opener.jQuery('input[name=latitude]').length == 0) { - opener.jQuery('#editor-form').append(''); - } - opener.jQuery('input[name=latitude]').val(position.coords.latitude); - opener.jQuery('input[name=longitude]').val(position.coords.longitude); - window.close(); - } - } - }); - } else { - $('#availability').html('현재 웹브라우저는 Geolocation 기능을 지원하지 않습니다.') - } -}); diff --git a/plugins/GoogleMap/scripts/insert.js b/plugins/GoogleMap/scripts/insert.js index 75d4899d9..6f4a3c39c 100644 --- a/plugins/GoogleMap/scripts/insert.js +++ b/plugins/GoogleMap/scripts/insert.js @@ -7,9 +7,9 @@ var user_markers = {}; var query_markers = {}; var icon_blue; -$(document).ready(function() { - var container = $(map.getContainer()); - container +function initializeCustomizableMap() { + var $container = $(map.getDiv()); + $container .resizable({ minWidth:300, maxWidth:800, minHeight:200, maxHeight:800, @@ -17,8 +17,8 @@ $(document).ready(function() { }) .bind('resize', function(ev) { map.checkResize(); - $('#inputWidth').val(container.width()); - $('#inputHeight').val(container.height()); + $('#inputWidth').val($container.width()); + $('#inputHeight').val($container.height()); }) .bind('mousewheel', function(ev) { ev.stopPropagation(); }); $('#toggleMarkerAddingMode') @@ -26,21 +26,21 @@ $(document).ready(function() { .click(function(ev) { $(ev.target).toggleClass('toggled'); if ($(ev.target).hasClass('toggled')) { - listener_onclick = GEvent.addListener(map, 'click', GMap_onClick); + listener_onclick = google.maps.event.addListener(map, 'click', GMap_onClick); } else { - GEvent.removeListener(listener_onclick); + google.maps.event.removeListener(listener_onclick); } }); $('#queryLocation').click(queryLocation); $('#inputQuery').bind('keypress', function(ev) { if (ev.which == 13) queryLocation(); }); $('#applyBasicSettings').click(function() { var w = $('#inputWidth').val(), h = $('#inputHeight').val(); - container.width(w).height(h); + $container.width(w).height(h); }); $('#doInsert').click(function() { if (!map) return; - map.closeInfoWindow(); + plugin.gmap.closeActiveInfoWindow(); var editor = window.opener.editor; if (!editor) { alert('The editor is not accessible.'); @@ -50,8 +50,8 @@ $(document).ready(function() { var center = map.getCenter(); options.center = {latitude: center.lat(), longitude: center.lng()}; options.zoom = map.getZoom(); - options.width = container.width(); - options.height = container.height(); + options.width = $container.width(); + options.height = $container.height(); options.type = getMapTypeStr(); var compact_user_markers = new Array(); var i = 0, id = ''; @@ -59,8 +59,8 @@ $(document).ready(function() { compact_user_markers[i] = { 'title': user_markers[id].title, 'desc': user_markers[id].desc, - 'lat': user_markers[id].marker.getLatLng().lat(), - 'lng': user_markers[id].marker.getLatLng().lng() + 'lat': user_markers[id].marker.getPosition().lat(), + 'lng': user_markers[id].marker.getPosition().lng() }; i++; } @@ -68,70 +68,88 @@ $(document).ready(function() { editor.command('Raw', '[##_GoogleMap|' + $.toJSON(options) + '|_##]'); self.close(); }); - //accordion = new Accordion($$('h2'), $$('.accordion-elem')); - - icon_blue = new GIcon(G_DEFAULT_ICON, pluginURL + '/images/marker_blue.png'); -}); + icon_blue = new google.maps.MarkerImage(pluginURL + '/images/marker_blue.png'); +} function queryLocation() { - if (!geocoder) - geocoder = new GClientGeocoder(); + if (!plugin.gmap.geocoder) + plugin.gmap.geocoder = new google.maps.Geocoder(); var q = $('#inputQuery').val(); closeQueryResult(); - geocoder.getLocations(q, function(response) { - if (!response || response.Status.code != 200) { + plugin.gmap.geocoder.geocode({'address': q}, function(results, status) { + if (status == google.maps.GeocoderStatus.ZERO_RESULTS) { $('
    검색 결과가 없습니다.
    ').insertAfter('#GoogleMapPreview'); - } else { + } else if (status == google.maps.GeocoderStatus.OK) { $('
      ').insertAfter('#GoogleMapPreview'); - for (var i = 0; i < response.Placemark.length; i++) { - var place = response.Placemark[i]; - var point = new GLatLng(place.Point.coordinates[1], place.Point.coordinates[0]); + for (var i = 0; i < results.length; i++) { + var position = results[i].geometry.location; var id = 'qm' + (new Date).valueOf() + (Math.ceil(Math.random()*90)+10); - $('
    1. '+place.address+'
    2. ').appendTo('#queryResult ol'); - map.setCenter(point); - map.setZoom(17); - var marker = new GMarker(point, {'title': '['+(i+1)+'] ' + place.address, 'icon': icon_blue}); - marker.bindInfoWindowHtml('

      '+place.address+'

      마커 고정시키기

      '); - map.addOverlay(marker); - query_markers[id] = {'marker': marker, 'id': id, 'address': place.address, 'query': q}; + var address = '', j; + for (j = 0; j < results[i].address_components.length; j++) + address += results[i].address_components[j].long_name + ' '; + $('
    3. '+address.trim()+'
    4. ').appendTo('#queryResult ol'); + map.setCenter(position); + map.setZoom(15); + var marker = new google.maps.Marker({ + 'position': position, + 'title': '['+(i+1)+'] ' + address, + 'icon': icon_blue + }); + var info = new google.maps.InfoWindow({ + 'content': '' + }); + google.maps.event.addListener(marker, 'click', function() { + plugin.gmap.closeActiveInfoWindow(); + info.open(map, marker); + plugin.gmap.activeInfoWindow = info; + }); + query_markers[id] = { + 'id': id, + 'marker': marker, + 'info': info, + 'address': address, + 'query': q + }; } + } else { + $('
      오류가 발생하였습니다. (' + status + ')
      ').insertAfter('#GoogleMapPreview'); } - var container = map.getContainer(); - var pos = $(container).offset(); + var $container = $(map.getDiv()); + var pos = $container.offset(); // TODO: get the height of the whole document in a cross-browsing way - var from_bottom = document.body.scrollHeight - (pos.top + $(container).height()); + var from_bottom = document.body.scrollHeight - (pos.top + $container.height()); $('').appendTo('#queryResult'); - $('#queryResult').css({'z-index':100000, bottom:(from_bottom + 40)+'px', left:(pos.left + 60)+'px'}).fadeIn(400).fadeTo(200, 1); + $('#queryResult').css({'z-index':100000, bottom:(from_bottom + 40)+'px', left:(pos.left + 60)+'px'}).fadeIn(400); }); } function closeQueryResult() { $('#queryResult').remove(); for (id in query_markers) { - map.removeOverlay(query_markers[id].marker); + query_markers[id].marker.setMap(null); } query_markers = {}; } function convertToUserMarker(id) { - var um = GMap_onClick(null, query_markers[id].marker.getLatLng(), null); - map.removeOverlay(query_markers[id].marker); + var um = GMap_onClick(query_markers[id].marker.getPosition()); + query_markers[id].marker.setMap(null); um.title = query_markers[id].query; um.desc = query_markers[id].address; delete query_markers[id]; } function getMapTypeStr() { - switch (map.getCurrentMapType()) { - case G_PHYSICAL_MAP: - return 'G_PHYSICAL_MAP'; - case G_SATELLITE_MAP: - return 'G_SATELLITE_MAP'; - case G_HYBRID_MAP: - return 'G_HYBRID_MAP'; - case G_NORMAL_MAP: + switch (map.getMapTypeId()) { + case google.maps.MapTypeId.TERRAIN: + return 'TERRAIN'; + case google.maps.MapTypeId.SATELLITE: + return 'SATELLITE'; + case google.maps.MapTypeId.HYBRID: + return 'HYBRID'; + case google.maps.MapTypeId.ROADMAP: default: - return 'G_NORMAL_MAP'; + return 'ROADMAP'; } } @@ -153,27 +171,39 @@ function findUserMarkerById(id) { } function removeUserMarker(id) { - map.removeOverlay(user_markers[id].marker); + user_markers[id].marker.setMap(null); delete user_markers[id]; } -function GMap_onClick(overlay, latlng, overlaylatlng) { - if (overlay == null) { // when empty area is clicked - if (user_markers.length == 20) { - alert('Too many markers!'); - return; - } - var marker = new GMarker(latlng, {'clickable': true, 'draggable': true, 'bouncy': true, 'title': 'Click to edit'}); - var id = 'um' + (new Date).valueOf() + (Math.ceil(Math.random()*90)+10); - GEvent.addListener(marker, 'click', GMarker_onClick); - GEvent.addListener(marker, 'infowindowbeforeclose', function() { - user_markers[id].title = $('#info_title').val(); - user_markers[id].desc = $('#info_desc').val(); - }); - user_markers[id] = {'marker': marker, 'title': '', 'desc': '', 'id': id}; - map.addOverlay(marker); - return user_markers[id]; +function GMap_onClick(latlng) { + if (user_markers.length == 20) { + alert('Too many markers!'); + return; } + var id = 'um' + (new Date).valueOf() + (Math.ceil(Math.random()*90)+10); + var marker = new google.maps.Marker({ + 'position': latlng, + 'map': map, + 'title': 'Click to edit', + 'draggable': true + }); + var info = new google.maps.InfoWindow({ + 'content' : '' + }); + gogole.maps.event.addListener(marker, 'click', GMarker_onClick); + google.maps.event.addListener(info, 'closeclick', function() { + user_markers[id].title = $('#info_title').val(); + user_markers[id].desc = $('#info_desc').val(); + this.setContent(''); + }); + user_markers[id] = { + 'id': id, + 'marker': marker, + 'info': info, + 'title': '', + 'desc': '' + }; + return user_markers[id]; } function GMarker_onClick(latlng) { @@ -182,5 +212,7 @@ function GMarker_onClick(latlng) { form += '

      '; form += '

      '; form += ''; - this.openInfoWindowHtml(form); + plugin.gmap.closeActiveInfoWindow(); + um.info.setContent(form); + um.info.open(map, um.marker); } diff --git a/plugins/GoogleMap/common.css b/plugins/GoogleMap/styles/common.css similarity index 54% rename from plugins/GoogleMap/common.css rename to plugins/GoogleMap/styles/common.css index 7a1a6e22f..738320a48 100644 --- a/plugins/GoogleMap/common.css +++ b/plugins/GoogleMap/styles/common.css @@ -71,10 +71,59 @@ dl#toolbox-googlemap dd.command-box a.button:hover { text-decoration: none; } -dl#toolbox-googlemap dd.command-box #gmap-insertMap { - background-image: url(./images/toolbox-map.png); +dl#toolbox-googlemap dd.command-box #googlemap-insertMap { + background-image: url(../images/toolbox-map.png); } -dl#toolbox-googlemap dd.command-box #gmap-getLocation { - background-image: url(./images/toolbox-location.png); +dl#toolbox-googlemap dd.command-box #googlemap-attachLocation { + background-image: url(../images/toolbox-location.png); +} + +#googlemap-geolocation-container { + position: absolute; + left: 0; + top: 0; + margin: 0; + padding: 0; + background: transparent; +} + +#googlemap-geolocation-container-arrow { + position: relative; + left: 88px; + top: 0; + margin: 0; + z-index: 200; +} + +#googlemap-geolocation-preview { + position: relative; + top: -4px; + border: 1px solid #aaa; + background: white; + color: #999; + margin: 0; + padding: 4px; + box-shadow: 0px 2px 5px rgba(0,0,0,0.3); + -moz-box-shadow: 0px 2px 5px rgba(0,0,0,0.3); + -webkit-box-shadow: 0px 2px 5px rgba(0,0,0,0.3); + text-align: right; + line-height: 1.0; + z-index: 100; +} + +#googlemap-geolocation-preview a#googlemap-geolocation-preview-close { + position: absolute; + top: 0; + right: 0; + display: inline-block; + padding: 3px; + background: white; + color: #c00; +} + +#googlemap-geolocation-preview img { + border: 0 none; + margin: 0; + padding: 0; } diff --git a/plugins/GoogleMap/popup.css b/plugins/GoogleMap/styles/popup.css similarity index 89% rename from plugins/GoogleMap/popup.css rename to plugins/GoogleMap/styles/popup.css index 0672e498b..ac2d10342 100644 --- a/plugins/GoogleMap/popup.css +++ b/plugins/GoogleMap/styles/popup.css @@ -20,7 +20,7 @@ h1 { h2 { font-size: 1.0em; - background: #f2f2f2 url(./images/bg-h2.png) repeat-x left top; + background: #f2f2f2 url(../images/bg-h2.png) repeat-x left top; color: white; text-shadow: 0 0 2px black; margin: 10px 4px; @@ -84,8 +84,8 @@ h2 { .ui-resizable-s { cursor: s-resize; height: 8px; width: 100%; bottom: -8px; left: 0px; } .ui-resizable-e { cursor: e-resize; width: 8px; right: -8px; top: 0px; height: 100%; } .ui-resizable-w { cursor: w-resize; width: 8px; left: -8px; top: 0px; height: 100%; } -.ui-resizable-se { cursor: se-resize; width: 8px; height: 8px; right: -8px; bottom: -8px; background-image: url(./images/ui-resizable-grabber-se.gif); background-repeat: no-repeat; background-position: right bottom; } -.ui-resizable-sw { cursor: sw-resize; width: 8px; height: 8px; left: -8px; bottom: -8px; background-image: url(./images/ui-resizable-grabber-sw.gif); background-repeat: no-repeat; background-position: left bottom;} +.ui-resizable-se { cursor: se-resize; width: 8px; height: 8px; right: -8px; bottom: -8px; background-image: url(../images/ui-resizable-grabber-se.gif); background-repeat: no-repeat; background-position: right bottom; } +.ui-resizable-sw { cursor: sw-resize; width: 8px; height: 8px; left: -8px; bottom: -8px; background-image: url(../images/ui-resizable-grabber-sw.gif); background-repeat: no-repeat; background-position: left bottom;} .ui-resizable-nw { cursor: nw-resize; width: 8px; height: 8px; left: -8px; top: -8px; } .ui-resizable-ne { cursor: ne-resize; width: 8px; height: 8px; right: -8px; top: -8px;} @@ -119,7 +119,7 @@ input, textarea { right: 60px; padding: 8px 8px 8px 15px; background: white; - background-color: rgba(255,255,255,0.85); + background-color: rgba(255,255,255,0.75); box-shadow: 0 2px 5px rgba(0,0,0,0.7); -moz-box-shadow: 0 1px 5px rgba(0,0,0,0.7); -webkit-box-shadow: 0 1px 5px rgba(0,0,0,0.7); diff --git a/plugins/MT_Meta_RecentPS_Default/index.php b/plugins/MT_Meta_RecentPS_Default/index.php index 75aff7007..b52b742c9 100644 --- a/plugins/MT_Meta_RecentPS_Default/index.php +++ b/plugins/MT_Meta_RecentPS_Default/index.php @@ -182,7 +182,7 @@ function MT_Cover_getCropProcess($blogid, $filename, $cropSize) { requireComponent('Textcube.Function.Image'); $imageInfo = getimagesize($originSrc); - $objThumbnail = new Image(); + $objThumbnail = new Utils_Image(); if ($imageInfo[0] > $imageInfo[1]) list($tempWidth, $tempHeight) = $objThumbnail->calcOptimizedImageSize($imageInfo[0], $imageInfo[1], NULL, $cropSize); else diff --git a/plugins/PN_Subscription_Default/index.xml b/plugins/PN_Subscription_Default/index.xml index 0ae69f658..1d40c33f4 100644 --- a/plugins/PN_Subscription_Default/index.xml +++ b/plugins/PN_Subscription_Default/index.xml @@ -2,7 +2,7 @@ Feed Subscription Log 피드 구독 통계 - RSSフィード統計(日本語版) + RSSフィード統計 http://needlworks.org/ 2.1 Shows Feed Subscription Log using Textcube Components. diff --git a/plugins/PN_Visitor_Default/index.xml b/plugins/PN_Visitor_Default/index.xml index b208e93ff..6c1d6f26f 100644 --- a/plugins/PN_Visitor_Default/index.xml +++ b/plugins/PN_Visitor_Default/index.xml @@ -1,8 +1,8 @@ - Visitors(Japanese) - 방문자 기록(일본어판) - 詳細統計(日本語版) + Visitors + 방문자 기록 + 詳細統計 http://needlworks.org/ 1.1.1.1 Default Visitor log Plugin diff --git a/plugins/SB_Spacer/index.php b/plugins/SB_Spacer/index.php index 03dd12ed4..79a66d72e 100644 --- a/plugins/SB_Spacer/index.php +++ b/plugins/SB_Spacer/index.php @@ -38,7 +38,6 @@ function SB_Spacer($target) } function SB_Spacer_DataSet($data){ - requireComponent('Textcube.Function.misc'); if(!is_integer(intval($data['height']))) return false; $cfg = Setting::fetchConfigVal($data); return true; diff --git a/plugins/SB_Spacer/index.xml b/plugins/SB_Spacer/index.xml index d9ad4dd3e..77cef7541 100644 --- a/plugins/SB_Spacer/index.xml +++ b/plugins/SB_Spacer/index.xml @@ -3,7 +3,7 @@ Spacer 빈 줄 표시 http://needlworks.org/ - 1.1 + 1.8 Insert spacers on sidebar. 사이드바 플러그인 사이의 간격 조절을 위한 빈 줄을 출력해 줍니다. GPL @@ -11,7 +11,7 @@ - 1.5 + 1.8 diff --git a/plugins/ST_TeamBlogSettings/index.php b/plugins/ST_TeamBlogSettings/index.php index c588d61a2..f7109bfc1 100644 --- a/plugins/ST_TeamBlogSettings/index.php +++ b/plugins/ST_TeamBlogSettings/index.php @@ -221,10 +221,10 @@ function getTeamBlogSettings() { <?php echo _t('프로필 사진');?>
      (Size : x )
      -
      mypictr.com에서 사진 편집.
      + mypictr.com에서 사진 편집.
      변경 저장됩니다)'); ?>
      - /> + />
      diff --git a/resources/locale/owner/en.php b/resources/locale/owner/en.php index 51e967505..621080265 100644 --- a/resources/locale/owner/en.php +++ b/resources/locale/owner/en.php @@ -66,7 +66,7 @@ $__text['%1개의 피드를 가져왔습니다.\n피드를 업데이트 해 주십시오.'] = '%1 new feed(s) received.\\nPlease update the reading list.'; $__text['%1에 글을 공개합니다.'] = 'Publish to %1.'; $__text['%1은 올바른 이메일이 아닙니다.'] = '%1 is not a valid e-mail address.'; -//$__text['© 2004 - 2009. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; +//$__text['© 2004 - 2010. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; $__text['(로그인시 ID로 사용됩니다)'] = '(Default ID)'; $__text['(분류 없음)'] = '(No Category)'; $__text['(비공개)'] = '(Private)'; diff --git a/resources/locale/owner/ja.php b/resources/locale/owner/ja.php index 2f00284ad..88aac8f93 100644 --- a/resources/locale/owner/ja.php +++ b/resources/locale/owner/ja.php @@ -122,7 +122,7 @@ $__text['%1에 글을 공개합니다.'] = '%1に記事発行'; $__text['%1은 올바른 이메일이 아닙니다.'] = '%1 は正しい形式のメールアドレスではありません。'; $__text['%Y:년, %M:월, %D:일'] = '%Y:年, %M:月, %D:日'; -$__text['© 2004 - 2009. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = '© 2004-2010.
      全ての著作権は開発者とその貢献者がお持ちしております。
      TextcubeはNeedlworks/TNFから開発しております。
      TextcubeとそのロゴはNeedlworksのトレードマークであります。'; +$__text['© 2004 - 2010. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = '© 2004-2010.
      全ての著作権は開発者とその貢献者がお持ちしております。
      TextcubeはNeedlworks/TNFから開発しております。
      TextcubeとそのロゴはNeedlworksのトレードマークであります。'; $__text['(로그인시 ID로 사용됩니다)'] = '(サインイン時に IDとして利用)'; $__text['(분류 없음)'] = '(分類なし)'; $__text['(비공개)'] = '(非公開)'; diff --git a/resources/locale/owner/ko.php b/resources/locale/owner/ko.php index 4a1a9f957..e29353a60 100644 --- a/resources/locale/owner/ko.php +++ b/resources/locale/owner/ko.php @@ -65,7 +65,7 @@ //$__text['%1개의 피드를 가져왔습니다.\n피드를 업데이트 해 주십시오.'] = ''; //$__text['%1에 글을 공개합니다.'] = ''; //$__text['%1은 올바른 이메일이 아닙니다.'] = ''; -//$__text['© 2004 - 2009. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; +//$__text['© 2004 - 2010. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; //$__text['(로그인시 ID로 사용됩니다)'] = ''; //$__text['(분류 없음)'] = ''; //$__text['(비공개)'] = ''; diff --git a/resources/locale/owner/vi.php b/resources/locale/owner/vi.php index 0bdcd58d3..8b37572f7 100644 --- a/resources/locale/owner/vi.php +++ b/resources/locale/owner/vi.php @@ -64,7 +64,7 @@ $__text['%1개의 피드를 가져왔습니다.\n피드를 업데이트 해 주십시오.'] = 'Đã nhận được %1 Feed mới.\\nXin vui lòng cập nhận danh sách.'; $__text['%1에 글을 공개합니다.'] = 'Gửi lên %1.'; $__text['%1은 올바른 이메일이 아닙니다.'] = 'Email %1 không hợp lệ.'; -//$__text['© 2004 - 2009. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; +//$__text['© 2004 - 2010. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; $__text['(로그인시 ID로 사용됩니다)'] = '(ID mặc định)'; $__text['(분류 없음)'] = '(Không)'; $__text['(비공개)'] = '(Riêng tư)'; diff --git a/resources/locale/owner/zh-CN.php b/resources/locale/owner/zh-CN.php index 2612d490a..4a78d72f0 100644 --- a/resources/locale/owner/zh-CN.php +++ b/resources/locale/owner/zh-CN.php @@ -57,7 +57,7 @@ $__text['%1개의 피드를 가져왔습니다.\n피드를 업데이트 해 주십시오.'] = '读取了%1个FEED。\\n请确认更新。'; $__text['%1에 글을 공개합니다.'] = '在%1公开文章。'; $__text['%1은 올바른 이메일이 아닙니다.'] = '信箱地址%1的格式不正确。'; -//$__text['© 2004 - 2009. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; +//$__text['© 2004 - 2010. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; $__text['(로그인시 ID로 사용됩니다)'] = '(此为登入后台管理时所使用的 ID)'; $__text['(분류 없음)'] = '(暂无分类)'; $__text['(비공개)'] = '(不公开)'; diff --git a/resources/locale/owner/zh-TW.php b/resources/locale/owner/zh-TW.php index 9be323d31..507b7fbf4 100644 --- a/resources/locale/owner/zh-TW.php +++ b/resources/locale/owner/zh-TW.php @@ -57,7 +57,7 @@ $__text['%1개의 피드를 가져왔습니다.\n피드를 업데이트 해 주십시오.'] = '讀取了%1個FEED。\\n請確認更新。'; $__text['%1에 글을 공개합니다.'] = '在%1公開文章。'; $__text['%1은 올바른 이메일이 아닙니다.'] = '信箱地址%1的格式不正確。'; -//$__text['© 2004 - 2009. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; +//$__text['© 2004 - 2010. 모든 저작권은 개발자 및 공헌자에게 있습니다.
      텍스트큐브는 니들웍스/TNF에서 개발합니다.
      텍스트큐브와 텍스트큐브 로고는 니들웍스의 상표입니다.'] = ''; $__text['(로그인시 ID로 사용됩니다)'] = '(此為登入後台管理時所使用的 ID)'; $__text['(분류 없음)'] = '(暫無分類)'; $__text['(비공개)'] = '(不公開)'; diff --git a/resources/script/common2.js b/resources/script/common2.js index 3849c35d5..4b6288d9b 100644 --- a/resources/script/common2.js +++ b/resources/script/common2.js @@ -229,6 +229,22 @@ function toggleLayer(id) { } return true; } + +function focusLayer(id, others) { + try { + var obj = document.getElementById(id); + obj.style.display = "block"; + for (x in others) { + if(others[x] != id) { + var obj = document.getElementById(others[x]); + obj.style.display = "none"; + } + } + } catch (e) { + } + return true; +} + function showLayer(id) { document.getElementById(id).style.display = "block"; return true; @@ -1014,6 +1030,7 @@ function addComment(caller, entryId) { } var request = new HTTPRequest("POST", oForm.action); request.onSuccess = function () { + PM.removeRequest(this); commentSavingNow = false; document.getElementById("entry" + entryId + "Comment").innerHTML = this.getText("/response/commentBlock"); if(getObject("recentComments") != null) @@ -1024,6 +1041,7 @@ function addComment(caller, entryId) { document.getElementById("commentCountOnRecentEntries" + entryId).innerHTML = "(" + this.getText("/response/commentCount") + ")"; } request.onError = function() { + PM.removeRequest(this); commentSavingNow = false; alert(this.getText("/response/description")); } @@ -1102,6 +1120,7 @@ function addComment(caller, entryId) { } } commentSavingNow = true; + PM.addRequest(request,"Saving Comments..."); request.send(queryString); } @@ -1234,9 +1253,16 @@ function recallLastComment(caller,entryId) { } } -function loadComment(entryId, page, force) { +function loadComment(entryId, page, force, listOnly) { + var listView; + if(listOnly == true) { + listView = 1; + var o = document.getElementById("entry" + entryId + "CommentList"); + } else { + listView = 0; + var o = document.getElementById("entry" + entryId + "Comment"); + } var request = new HTTPRequest("POST", blogURL + '/comment/load/' + entryId); - var o = document.getElementById("entry" + entryId + "Comment"); if ((!force && o.style.display == 'none') || force) { request.onSuccess = function () { PM.removeRequest(this); @@ -1248,7 +1274,7 @@ function loadComment(entryId, page, force) { PM.showErrorMessage("Loading Failed.","center","bottom"); }; PM.addRequest(request,"Loading Comments..."); - request.send('&page='+page); + request.send('&page='+page+'&listOnly='+listView); } if (!force) o.style.display = (o.style.display == 'none') ? 'block' : 'none'; diff --git a/resources/setup/initialize.MySQL.sql b/resources/setup/initialize.MySQL.sql index 4a3e52e18..44a5cbe61 100644 --- a/resources/setup/initialize.MySQL.sql +++ b/resources/setup/initialize.MySQL.sql @@ -359,7 +359,7 @@ CREATE TABLE [##_dbPrefix_##]RemoteResponseLogs ( blogid int(11) NOT NULL default '0', id int(11) NOT NULL, entry int(11) NOT NULL default '0', - type enum('trackback','pingback') NOT NULL default 'trackback', + responsetype enum('trackback','pingback') NOT NULL default 'trackback', url varchar(255) NOT NULL default '', written int(11) NOT NULL default '0', PRIMARY KEY (blogid, entry, id), diff --git a/resources/setup/initialize.PostgreSQL.sql b/resources/setup/initialize.PostgreSQL.sql index 8bacd2ece..f468f0f16 100644 --- a/resources/setup/initialize.PostgreSQL.sql +++ b/resources/setup/initialize.PostgreSQL.sql @@ -357,7 +357,7 @@ CREATE TABLE [##_dbPrefix_##]RemoteResponseLogs ( blogid integer NOT NULL default 0, id integer NOT NULL, entry integer NOT NULL default 0, - type varchar(10) NOT NULL default 'trackback', + responsetype varchar(10) NOT NULL default 'trackback', url varchar(255) NOT NULL default '', written integer NOT NULL default 0, PRIMARY KEY (blogid, entry, id) diff --git a/web.config.1 b/web.config.1 new file mode 100644 index 000000000..3e0dcb2a4 --- /dev/null +++ b/web.config.1 @@ -0,0 +1,44 @@ + + + + + +
      +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/wpi-init-install.sql b/wpi-init-install.sql new file mode 100644 index 000000000..0625d3d2d --- /dev/null +++ b/wpi-init-install.sql @@ -0,0 +1,15 @@ +USE PlaceholderForDbName; + +DROP PROCEDURE IF EXISTS add_user ; + +CREATE PROCEDURE add_user() +BEGIN +DECLARE EXIT HANDLER FOR 1044 BEGIN END; +GRANT ALL PRIVILEGES ON PlaceholderForDbName.* to 'PlaceholderForDbUser'@'localhost' IDENTIFIED BY 'PlaceholderForDbPassword'; +FLUSH PRIVILEGES; +END +; + +CALL add_user() ; + +DROP PROCEDURE IF EXISTS add_user ;
      구글맵 API 키 얻기 (구글 계정 필요)]]> Get your API key for Google Maps (Google Account needed)]]>