コード例 #1
0
ファイル: Textcube.Data.php プロジェクト: Avantians/Textcube
 function removeAll($removeAttachments = true)
 {
     global $database;
     $blogid = getBlogId();
     POD::query("UPDATE {$database['prefix']}BlogStatistics SET visits = 0 WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid}");
     if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
         unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
     }
     if ($removeAttachments) {
         Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
     }
 }
コード例 #2
0
ファイル: Textcube.Data.Feed.php プロジェクト: ni5am/Textcube
 function open($filter = '', $fields = 'f.*, g.groupid', $sort = 'id')
 {
     global $database;
     if (is_numeric($filter)) {
         $filter = 'AND id = ' . $filter;
     } else {
         if (!empty($filter)) {
             $filter = 'AND ' . $filter;
         }
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT {$fields} FROM {$database['prefix']}Feeds f JOIN {$database['prefix']}FeedGroupRelations g ON f.id = g.feed WHERE g.blogid = " . getBlogId() . " {$filter} {$sort}");
     if ($this->_result) {
         if ($this->_count = POD::num_rows($this->_result)) {
             return $this->shift();
         } else {
             POD::free($this->_result);
         }
     }
     unset($this->_result);
     return false;
 }
コード例 #3
0
 function load($fields = '*')
 {
     global $database;
     $blogid = getBlogId();
     $this->reset();
     $query = DBModel::getInstance();
     $query->reset('BlogSettings');
     if ($query->doesExist()) {
         $query->setQualifier('blogid', 'equals', $blogid);
         $blogSettings = $query->getAll('name,value');
         if (isset($blogSettings)) {
             foreach ($blogSettings as $blogSetting) {
                 $name = $blogSetting['name'];
                 $value = $blogSetting['value'];
                 switch ($name) {
                     case 'logo':
                         $name = 'banner';
                         break;
                     case 'entriesOnPage':
                         $name = 'postsOnPage';
                         break;
                     case 'entriesOnList':
                         $name = 'postsOnList';
                         break;
                     case 'entriesOnRSS':
                         $name = 'postsOnFeed';
                         break;
                     case 'publishWholeOnRSS':
                         $name = 'publishWholeOnFeed';
                         break;
                     case 'allowWriteOnGuestbook':
                         $name = 'acceptGuestComment';
                         break;
                     case 'allowWriteDblCommentOnGuestbook':
                         $name = 'acceptcommentOnGuestComment';
                         break;
                     case 'defaultDomain':
                     case 'useSloganOnPost':
                     case 'useSloganOnCategory':
                     case 'useSloganOnTag':
                     case 'acceptGuestComment':
                     case 'acceptcommentOnGuestComment':
                         $value = $value ? true : false;
                         break;
                 }
                 $this->{$name} = $value;
             }
         }
         return true;
     }
     return false;
 }
コード例 #4
0
ファイル: image.php プロジェクト: hinablue/TextCube
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);
    }
    if (!is_dir(ROOT . "/cache/thumbnail/" . getBlogId())) {
        @mkdir(ROOT . "/cache/thumbnail/" . getBlogId());
        @chmod(ROOT . "/cache/thumbnail/" . getBlogId(), 0777);
    }
    $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];
    }
    if (preg_match('/height="([1-9][0-9]*)"/i', $imgString, $temp)) {
        $tempHeight = $temp[1];
    }
    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;
            }
        }
    }
    if ($resizeImage === false) {
        return $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;
}
コード例 #5
0
ファイル: index.php プロジェクト: Avantians/Textcube
function FM_Modern_editorinit($editor)
{
    global $entry;
    $context = Model_Context::getInstance();
    $blogid = getBlogId();
    if (is_null($context->getProperty('plugin.config', null))) {
        $config = array('paragraphdelim' => 'BR', 'defaultmode' => 'WYSIWYG');
    } else {
        $config = $context->getProperty('plugin.config');
    }
    if (in_array(Setting::getBlogSettingGlobal('defaultFormatter', 'html'), array('markdown', 'textile')) || in_array($entry['contentformatter'], array('markdown', 'textile'))) {
        $config['defaultmode'] = 'TEXTAREA';
    } else {
        if (!isset($config['defaultmode'])) {
            $config['defaultmode'] = 'WYSIWYG';
        }
    }
    ob_start();
    ?>
			if (typeof(document.execCommand) == "undefined" || !(STD.isIE || STD.isFirefox || (STD.isWebkit && STD.engineVersion >= 419.3))) return null;
			var editor = new TTModernEditor();
			editor.fixPosition = <?php 
    echo Setting::getBlogSettingGlobal('editorPropertyPositionFix', 0);
    ?>
;
			editor.hasGD = <?php 
    echo extension_loaded('gd') ? 'true' : 'false';
    ?>
;
			editor.propertyFilePath = "<?php 
    echo $context->getProperty('service.path');
    ?>
/attach/<?php 
    echo $blogid;
    ?>
/";
			editor.editMode = "<?php 
    echo $config['defaultmode'];
    ?>
";
			editor.newLineToParagraph = <?php 
    echo isset($config['paragraphdelim']) && $config['paragraphdelim'] == 'P' ? 'true' : 'false';
    ?>
;
			return editor;
<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
コード例 #6
0
ファイル: index.php プロジェクト: ragi79/Textcube
function Xquared_editorinit($editor)
{
    global $configVal, $entry, $pluginURL;
    $blogid = getBlogId();
    if (is_null($configVal) || empty($configVal)) {
        $config = array('paragraphdelim' => 'BR', 'defaultmode' => 'WYSIWYG');
    } else {
        $config = Setting::fetchConfigVal($configVal);
    }
    if (in_array(Setting::getBlogSettingGlobal('defaultFormatter', 'html'), array('markdown', 'textile')) || in_array($entry['contentformatter'], array('markdown', 'textile'))) {
        $config['defaultmode'] = 'TEXTAREA';
    } else {
        if (!isset($config['defaultmode'])) {
            $config['defaultmode'] = 'WYSIWYG';
        }
    }
    ob_start();
    ?>
			var editor = new xq.Editor("editWindow");
			editor.config.contentCssList = ["<?php 
    echo $pluginURL;
    ?>
/stylesheets/xq_contents.css"];
			editor.config.imagePathForDefaultToolbar = '<?php 
    echo $pluginURL;
    ?>
/images/toolbar/';
			editor.setEditMode('wysiwyg');
			editor.origInitialize = editor.initialize;
			editor.origFinalize = editor.finalize;
			editor.initialize = function() {
				this.origInitialize();
			}
			editor.finalize = function() {
				this.origFinalize();
			}
			editor.syncTextarea = function(){
				var oForm = document.getElementById('editor-form');
				oForm.content.value = this.getCurrentContent();
			}

			return editor;
<?php 
    $result = ob_get_contents();
    ob_end_clean();
    return $result;
}
コード例 #7
0
 function removeAll($removeAttachments = true)
 {
     global $database;
     $blogid = getBlogId();
     $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("UPDATE {$database['prefix']}BlogStatistics SET visits = 0 WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}");
     //POD::query("DELETE FROM {$database['prefix']}UserSettings WHERE user = $blogid");
     POD::query("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}");
     POD::query("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid} AND id <> 0");
     if (count($tags) > 0) {
         $tagliststr = implode(', ', $tags);
         $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )");
         if (count($nottargets) > 0) {
             $nottargetstr = implode(', ', $nottargets);
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) AND id NOT IN ( {$nottargetstr} )");
         } else {
             POD::execute("DELETE FROM {$database['prefix']}Tags WHERE id IN ( {$tagliststr} ) ");
         }
     }
     if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml")) {
         unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/{$blogid}.xml");
     }
     if ($removeAttachments) {
         Path::removeFiles(Path::combine(ROOT, 'attach', $blogid));
         POD::query("UPDATE {$database['prefix']}BlogSettings SET logo = '' WHERE blogid = {$blogid}");
     }
 }
コード例 #8
0
ファイル: index.php プロジェクト: ragi79/Textcube
function KeywordUI_bindTag($target, $mother)
{
    global $blogURL, $pluginURL, $configVal;
    requireModel('blog.keyword');
    $blogid = getBlogId();
    if (isset($mother) && isset($target)) {
        $tagsWithKeywords = array();
        $keywordNames = getKeywordNames($blogid);
        foreach ($target as $tag => $tagLink) {
            if (in_array($tag, $keywordNames) == true) {
                $tagsWithKeywords[$tag] = $tagLink . "<a href=\"#\" class=\"key1\" onclick=\"openKeyword('{$blogURL}/keylog/" . URL::encode($tag) . "'); return false\"><img src=\"" . $pluginURL . "/images/flag_green.gif\" alt=\"Keyword " . $tag . "\"/></a>";
            } else {
                $tagsWithKeywords[$tag] = $tagLink;
            }
        }
        $target = $tagsWithKeywords;
    }
    return $target;
}
コード例 #9
0
ファイル: auth.php プロジェクト: ni5am/Textcube
function login($loginid, $password, $expires = null)
{
    $ctx = Model_Context::getInstance();
    $loginid = POD::escapeString($loginid);
    $blogid = getBlogId();
    $userid = Auth::authenticate($blogid, $loginid, $password);
    if ($userid === false) {
        return false;
    }
    if (empty($_POST['save'])) {
        setcookie('TSSESSION_LOGINID', '', time() - 31536000, $ctx->getProperty('service.path') . '/', $ctx->getProperty('service.domain'));
    } else {
        setcookie('TSSESSION_LOGINID', $loginid, time() + 31536000, $ctx->getProperty('service.path') . '/', $ctx->getProperty('service.domain'));
    }
    if (in_array("group.writers", Acl::getCurrentPrivilege())) {
        Session::authorize($blogid, $userid, $expires);
    }
    return true;
}
コード例 #10
0
ファイル: index.php プロジェクト: Avantians/Textcube
function KeywordUI_bindTag($target, $mother)
{
    $context = Model_Context::getInstance();
    importlib('model.blog.keyword');
    $blogid = getBlogId();
    $blogURL = $context->getProperty("uri.blog");
    $pluginURL = $context->getProperty("plugin.uri");
    if (isset($mother) && isset($target)) {
        $tagsWithKeywords = array();
        $keywordNames = getKeywordNames($blogid);
        foreach ($target as $tag => $tagLink) {
            if (in_array($tag, $keywordNames) == true) {
                $tagsWithKeywords[$tag] = $tagLink . "<a href=\"#\" class=\"key1\" onclick=\"openKeyword('{$blogURL}/keylog/" . URL::encode($tag) . "'); return false\"><img src=\"" . $pluginURL . "/images/flag_green.gif\" alt=\"Keyword " . $tag . "\"/></a>";
            } else {
                $tagsWithKeywords[$tag] = $tagLink;
            }
        }
        $target = $tagsWithKeywords;
    }
    return $target;
}
コード例 #11
0
ファイル: index.php プロジェクト: Avantians/Textcube
function CT_Statistics_Default($target)
{
    $blogid = getBlogId();
    $stats = Statistics::getStatistics($blogid);
    $target .= '<ul class="CT_Statistics_Default">';
    $target .= '<li class="TotalCount"><h4>Total Counts</h4><div style="text-align:right; width:100%">';
    $target .= '<span style="font-size:200%">';
    $target .= number_format($stats['total']);
    $target .= '</span>';
    $target .= '</div></li>';
    $target .= '<li class="TodayCount"><h4>Today</h4><div style="text-align:right; width:100%">';
    $target .= '<span style="font-size:200%">';
    $target .= number_format($stats['today']);
    $target .= '</span>';
    $target .= '</div></li>';
    $target .= '<li class="YesterdayCount"><h4>Yesterday</h4><div style="text-align:right; width:100%">';
    $target .= '<span style="font-size:200%">';
    $target .= number_format($stats['yesterday']);
    $target .= '</span>';
    $target .= '</div></li>';
    $target .= '</ul>';
    return $target;
}
コード例 #12
0
ファイル: index.php プロジェクト: Avantians/Textcube
<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('id' => array('int', 'min' => 1)));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
$line = Model_Line::getInstance();
$line->reset();
$line->setFilter(array('blogid', 'equals', getBlogId()));
$line->setFilter(array('id', 'equals', $_POST['id']));
if ($line->remove()) {
    fireEvent('DeleteLine', 0, $line);
    Respond::ResultPage(0);
} else {
    fireEvent('DeleteLine', -1, $line);
    Respond::ResultPage(-1);
}
コード例 #13
0
ファイル: index.php プロジェクト: webhacking/Textcube
<?php

/// Copyright (c) 2004-2016, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
require ROOT . '/library/preprocessor.php';
if (CacheControl::flushAll(getBlogId())) {
    Respond::ResultPage(0);
} else {
    Respond::ResultPage(-1);
}
コード例 #14
0
ファイル: index.php プロジェクト: ragi79/Textcube
														<input type="radio" id="publishedPreserve" class="radio" name="published" value="2" <?php 
echo isset($entry['appointed']) ? 'checked="checked"' : '';
?>
 /><label for="publishedPreserve" onclick="document.getElementById('appointed').select()"><?php 
echo _t('예약');
?>
</label>
														<input type="text" id="appointed" class="input-text" name="appointed" value="<?php 
echo Timestamp::format5(isset($entry['appointed']) ? $entry['appointed'] : $entry['published']);
?>
" onfocus="document.getElementById('editor-form').published[document.getElementById('editor-form').published.length - 1].checked = true" onkeypress="return preventEnter(event);" />
													</div>
												</dd>
											</dl>
<?php 
$countResult = POD::queryExistence("SELECT id FROM {$database['prefix']}Entries WHERE blogid = " . getBlogId() . " AND visibility = 3");
?>
											<dl id="status-line" class="line">
												<dt><span class="label"><?php 
echo _t('공개여부');
?>
</span></dt>
												<dd>
													<div id="status-private" class="status-private"><input type="radio" id="visibility_private" class="radio" name="visibility" value="0"<?php 
echo abs($entry['visibility']) == 0 ? ' checked="checked"' : '';
?>
 /><label for="visibility_private"><?php 
echo _t('비공개');
?>
</label></div>
													<div id="status-protected" class="status-protected"<?php 
コード例 #15
0
 function _buildQuery()
 {
     global $database;
     $query = DBModel::getInstance();
     $query->reset('Comments');
     $query->setQualifier('blogid', 'equals', getBlogId());
     $query->setQualifier('entry', 'equals', 0);
     if (isset($this->id)) {
         if (!Validator::number($this->id, 1)) {
             return $this->_error('id');
         }
         $query->setQualifier('id', 'equals', $this->id);
     }
     if (isset($this->parent)) {
         if (!Validator::number($this->parent, 1)) {
             return $this->_error('parent');
         }
     }
     $query->setAttribute('parent', $this->parent);
     if (isset($this->commenter)) {
         if (!Validator::number($this->commenter, 1)) {
             return $this->_error('commenter');
         }
         if (!($this->name = User::getName($this->commenter))) {
             return $this->_error('commenter');
         }
         $query->setAttribute('replier', $this->commenter);
     }
     if (isset($this->name)) {
         $this->name = Utils_Unicode::lessenAsEncoding(trim($this->name), 80);
         if (empty($this->name)) {
             return $this->_error('name');
         }
         $query->setAttribute('name', $this->name, true);
     }
     if (isset($this->openid)) {
         $this->openid = Utils_Unicode::lessenAsEncoding(trim($this->openid), 128);
         if (empty($this->openid)) {
             return $this->_error('openid');
         }
         $query->setAttribute('openid', $this->openid, true);
     }
     if (isset($this->homepage)) {
         $this->homepage = Utils_Unicode::lessenAsEncoding(trim($this->homepage), 80);
         if (empty($this->homepage)) {
             return $this->_error('homepage');
         }
         $query->setAttribute('homepage', $this->homepage, true);
     }
     if (isset($this->ip)) {
         if (!Validator::ip($this->ip)) {
             return $this->_error('ip');
         }
         $query->setAttribute('ip', $this->ip, true);
     }
     if (isset($this->secret)) {
         $query->setAttribute('secret', Validator::getBit($this->secret));
     }
     if (isset($this->content)) {
         $this->content = trim($this->content);
         if (empty($this->content)) {
             return $this->_error('content');
         }
         $query->setAttribute('comment', $this->content, true);
     }
     if (isset($this->written)) {
         if (!Validator::timestamp($this->written)) {
             return $this->_error('written');
         }
         $query->setAttribute('written', $this->written);
     }
     if (isset($this->isfiltered)) {
         $query->setAttribute('isfiltered', Validator::getBit($this->isfiltered));
     }
     if (isset($this->password)) {
         $this->password = Utils_Unicode::lessenAsEncoding($this->password, 32);
         $query->setAttribute('password', $this->password, true);
         $this->password = null;
     }
     return $query;
 }
コード例 #16
0
ファイル: 30-Auth.php プロジェクト: Avantians/Textcube
 static function getCurrentPrivilege($blogid = null)
 {
     if (is_null($blogid)) {
         $blogid = getBlogId();
     }
     if (Acl::isAvailable($blogid)) {
         return $_SESSION['acl']["blog.{$blogid}"];
     }
     return array();
 }
コード例 #17
0
ファイル: index.php プロジェクト: webhacking/Textcube
    if (!Acl::check("group.editors")) {
        if (getUserIdOfEntry(getBlogId(), $suri['id']) != getUserId()) {
            Respond::ResultPage(-1);
            exit;
        }
    }
    if ($isAjaxRequest) {
        if (deleteEntry($blogid, $suri['id']) === true) {
            Respond::ResultPage(0);
        } else {
            Respond::ResultPage(-1);
        }
    } else {
        deleteEntry($blogid, $suri['id']);
        header("Location: " . $_SERVER['HTTP_REFERER']);
    }
} else {
    foreach (explode(',', $_POST['targets']) as $target) {
        // TeamBlog check
        if (!Acl::check('group.writers', 'entry.delete.' . $target)) {
            if (getUserIdOfEntry(getBlogId(), $suri['id']) != getUserId()) {
                Respond::ResultPage(-1);
                exit;
            }
        }
        if (!deleteEntry($blogid, $target)) {
            Respond::ResultPage(-1);
        }
    }
    Respond::ResultPage(0);
}
コード例 #18
0
ファイル: index.php プロジェクト: ragi79/Textcube
<?php

/// Copyright (c) 2004-2012, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('page' => array('int', 'min' => 1), 'lines' => array('int', 'min' => 1, 'default' => 15), 'category' => array('string', 'mandatory' => false), 'keyword' => array('string', 'mandatory' => false)));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
$conditions = array();
$conditions['blogid'] = getBlogId();
$conditions['page'] = $_POST['page'];
if (isset($_POST['category'])) {
    $conditions['category'] = $_POST['category'];
}
if (isset($_POST['keyword'])) {
    $conditions['keyword'] = $_POST['keyword'];
}
$conditions['linesforpage'] = $_POST['lines'];
$d = _t('삭제');
$conditions['template'] = <<<EOS
\t\t\t<dl id="line_[##_id_##]" class="line">
\t\t\t\t<dt class="date">[##_date_##]</dt>
\t\t\t\t<dd class="content">[##_content_##]</dd>
\t\t\t\t<dd class="permalink"><a href="[##_permalink_##]" class="permalink">at [##_root_##]</a></dd>
\t\t\t\t<dd class="delete input-button" onclick="deleteLine('[##_id_##]');return false;"><span class="text">{$d}</span></dd>
\t\t\t</dl>
EOS;
$conditions['dress'] = array('id' => 'id', 'date' => 'created', 'content' => 'content', 'permalink' => 'permalink', 'root' => 'root');
$line = Model_Line::getInstance();
$contentView = $line->getFormattedList($conditions);
if (empty($contentView)) {
コード例 #19
0
ファイル: index.php プロジェクト: Avantians/Textcube
<?php

/// Copyright (c) 2004-2015, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
define('NO_SESSION', true);
define('__TEXTCUBE_LOGIN__', true);
define('__TEXTCUBE_CUSTOM_HEADER__', true);
require ROOT . '/library/preprocessor.php';
importlib("model.blog.feed");
requireStrictBlogURL();
$children = array();
$cache = pageCache::getInstance();
$cache->reset('linesRSS');
if (!$cache->load()) {
    $result = getLinesFeed(getBlogId(), 'public', 'rss');
    if ($result !== false) {
        $cache->reset('linesRSS');
        $cache->contents = $result;
        $cache->update();
    }
}
header('Content-Type: application/rss+xml; charset=utf-8');
fireEvent('FeedOBStart');
echo fireEvent('ViewLinesRSS', $cache->contents);
fireEvent('FeedOBEnd');
コード例 #20
0
ファイル: ownerView.php プロジェクト: ni5am/Textcube
function printEntryFileUploadButton($entryId)
{
    $context = Model_Context::getInstance();
    $blogid = getBlogId();
    ?>
											<script type="text/javascript">
												//<![CDATA[

													var fileUploadNestOriginal = false;

													function makeCrossDamainSubmit(uri,userAgent) {
														var property =new Array();
														property['ie'] = new Array();
														property['ie']['width'] = '225px';
														property['ie']['height'] = '25px';

														property['moz'] = new Array();
														property['moz']['width'] = '215px';
														property['moz']['height'] = '22px';

														property['etc'] = new Array();
														property['etc']['width'] = '240px';
														property['etc']['height'] = '22px';

														if(fileUploadNestOriginal == false) {
															fileUploadNestOriginal = document.getElementById('fileUploadNest').innerHTML;
														}
														var str = '<iframe id="attachHiddenNest" src="' + uri + '" style="display: block; height: ' + property[userAgent]['height']+'; width: ' + property[userAgent]['width'] + ';" frameborder="no" scrolling="no"><\/iframe>';
														document.getElementById('fileUploadNest').innerHTML = str + fileUploadNestOriginal;
														/*if (document.getElementById('attachHiddenNest_' + (attachId - 1))) {
															document.getElementById('attachHiddenNest_' + (attachId - 1)).style.display = "none";
															document.getElementById('attachHiddenNest_' + (attachId - 1)).style.width = 0;
															document.getElementById('attachHiddenNest_' + (attachId - 1)).style.height = 0;
														}
														attachId++;*/
													}

													function refreshUploadButton() {
														if (getUploadObj()) {

														} else {
															if(isIE) {
																makeCrossDamainSubmit(blogURL + "/owner/entry/attach/" + entryManager.entryId,"ie");
															} else if(isMoz) {
																makeCrossDamainSubmit(blogURL + "/owner/entry/attach/" + entryManager.entryId,"moz");
															} else {
																makeCrossDamainSubmit(blogURL + "/owner/entry/attach/" + entryManager.entryId,"etc");
															}
														}
													}
												//]]>
											</script>
										<div id="fileUploadNest" class="container">
											<div id="fileSize">
<?php 
    echo getAttachmentSizeLabel($blogid, $entryId);
    ?>
											</div>
											<div id="fileDownload" class="system-message" style="display: none;"></div>
										</div>
										<script type="text/javascript">
										//<![CDATA[
										if (!DetectFlashVer(8, 0, 0) || !(isIE || isMoz || isMinSafari3) || <?php 
    echo $context->getProperty('service.flashuploader', true) ? 'false' : 'true';
    ?>
) {
											var deleteButtonContainer = document.getElementById('fileUploadNest');
											deleteButtonContainer.innerHTML = '<input type="button" id="deleteBtn" class="input-button" value="<?php 
    echo _t('삭제하기');
    ?>
" onclick="deleteAttachment();return false" />' + deleteButtonContainer.innerHTML;
											deleteButtonContainer.style.marginTop = '5px';
										}
										//]]>
										</script>
<?php 
}
コード例 #21
0
 function flushDBCache($prefix = null)
 {
     global $database;
     return POD::query("DELETE FROM {$database['prefix']}PageCacheLog\n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\tAND name like '%" . (!empty($prefix) ? $prefix . '\\_' : '') . "queryCache%'");
 }
コード例 #22
0
ファイル: index.php プロジェクト: Avantians/Textcube
 function retrieveCallback($lines, $uid)
 {
     $this->appendUid($uid);
     $mail = $this->pop3->parse($lines);
     if (isset($mail['date_string'])) {
         $slogan = $mail['date_string'];
         $docid = $mail['time_string'];
     } else {
         $slogan = date("Y-m-d");
         $docid = date("H:i:s");
     }
     if (in_array($mail['subject'], array('제목없음'))) {
         $mail['subject'] = '';
     }
     if (!$this->isAllowed($mail)) {
         return false;
     }
     if (false && empty($mail['attachments'])) {
         $this->logMail($mail, "SKIP");
         return false;
     }
     $post = new Post();
     $moblog_begin = "\n<div class=\"moblog-entry\">";
     $moblog_end = "\n</div>\n";
     if ($post->open("slogan = '{$slogan}'")) {
         $post->loadTags();
         $this->log("* 기존 글을 엽니다. (SLOGAN:{$slogan})");
         if (empty($post->tags)) {
             $post->tags = array();
         }
         $tags = $this->extractTags($mail);
         /* mail content will be changed */
         $post->tags = array_merge($post->tags, $tags);
         $post->content .= $moblog_begin . $this->_getDecoratedContent($mail, $docid);
         $post->modified = $mail['date'];
         $post->visibility = $this->visibility;
     } else {
         $this->log("* 새 글을 작성합니다. (SLOGAN:{$slogan})");
         if (isset($mail['date_year'])) {
             $post->title = str_replace(array('%Y', '%M', '%D'), array($mail['date_year'], $mail['date_month'], $mail['date_day']), $this->subject);
         } else {
             $post->title = str_replace(array('%Y', '%M', '%D'), array(date("Y"), date("m"), date("d")), $this->subject);
         }
         $post->userid = $this->userid;
         $post->category = $this->category;
         $post->tags = $this->extractTags($mail);
         /* Go with csv string, Tag class supports both string and array */
         $post->content = $moblog_begin . $this->_getDecoratedContent($mail, $docid);
         $post->contentformatter = getDefaultFormatter();
         $post->contenteditor = getDefaultEditor();
         $post->created = time();
         $post->acceptcomment = true;
         $post->accepttrackback = true;
         $post->visibility = $this->visibility;
         $post->published = time();
         $post->modified = $mail['date'];
         $post->slogan = $slogan;
         if (!$post->add()) {
             $this->logMail($mail, "ERROR");
             $this->log(_t("실패: 글을 추가하지 못하였습니다") . " : " . $post->error);
             return false;
         } else {
             CacheControl::flushCategory($post->category);
         }
     }
     /* 슬로건을 지워야만 문제가 발생하지 않습니다. */
     //unset($post->slogan);
     if (isset($mail['attachments']) && count($mail['attachments'])) {
         importlib("model.blog.api");
         $post->content .= "<div class=\"moblog-attachments\">\n";
         foreach ($mail['attachments'] as $mail_att) {
             $this->log("* " . _t("첨부") . " : {$mail_att['filename']}");
             $att = api_addAttachment(getBlogId(), $post->id, array('name' => $mail_att['filename'], 'content' => $mail_att['decoded_content'], 'size' => $mail_att['length']));
             if (!$att) {
                 $this->logMail($mail, "ERROR");
                 $this->log(_t("실패: 첨부파일을 추가하지 못하였습니다") . " : " . $post->error);
                 return false;
             }
             $alt = htmlentities($mail_att['filename'], ENT_QUOTES, 'utf-8');
             $content = '[##_1C|$FILENAME|width="$WIDTH" height="$HEIGHT" alt="' . $alt . '"|_##]';
             $content = str_replace('$FILENAME', $att['name'], $content);
             $content = str_replace('$WIDTH', $att['width'], $content);
             $content = str_replace('$HEIGHT', $att['height'], $content);
             $post->content .= $content;
         }
         $post->content .= "\n</div>";
     }
     $post->content .= $moblog_end;
     if (!$post->update()) {
         $this->logMail($mail, "ERROR");
         $this->log(_t("실패: 첨부파일을 본문에 연결하지 못하였습니다") . ". : " . $post->error);
         return false;
     }
     $this->logMail($mail, "OK");
     return true;
 }
コード例 #23
0
ファイル: index.php プロジェクト: ragi79/Textcube
<?php

/// Copyright (c) 2004-2012, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
$IV = array('POST' => array('group' => array('int'), 'url' => array('url')));
require ROOT . '/library/preprocessor.php';
requireStrictRoute();
if (strpos($_POST['url'], 'http://') !== 0) {
    $_POST['url'] = 'http://' . $_POST['url'];
}
$result = array('error' => addFeed(getBlogId(), $_POST['group'], $_POST['url']));
ob_start();
printFeeds($blogid, $_POST['group']);
$result['view'] = escapeCData(ob_get_contents());
ob_end_clean();
Respond::PrintResult($result);
コード例 #24
0
ファイル: index.php プロジェクト: ragi79/Textcube
        }
        $categoryTitle = $suri['value'];
    } else {
        // If no category is mentioned, redirect it to total atom.
        header("Location: " . $context->getProperty('uri.host') . $context->getProperty('uri.blog') . "/atom");
        exit;
    }
}
$cache->reset('categoryATOM-' . $categoryId);
if (!$cache->load()) {
    $categoryIds = array($categoryId);
    $parent = getParentCategoryId(getBlogId(), $categoryId);
    if ($parent === null) {
        // It's parent. let's find childs.
        $children = getChildCategoryId(getBlogId(), $categoryId);
        if (!empty($children)) {
            $categoryIds = array_merge($categoryIds, $children);
        }
    }
    requireModel("blog.feed");
    $result = getCategoryFeedByCategoryId(getBlogId(), $categoryIds, 'atom', $categoryTitle);
    if ($result !== false) {
        $cache->reset('categoryATOM-' . $categoryId);
        $cache->contents = $result;
        $cache->update();
    }
}
header('Content-Type: application/atom+xml; charset=utf-8');
fireEvent('FeedOBStart');
echo fireEvent('ViewCategoryATOM', $cache->contents);
fireEvent('FeedOBEnd');
コード例 #25
0
 function setBlogSettingRowsPerPage($value)
 {
     return Setting::setBlogSettingGlobal('rowsPerPage', $value, getBlogId());
 }
コード例 #26
0
ファイル: index.php プロジェクト: ragi79/Textcube
<?php

/// Copyright (c) 2004-2012, Needlworks  / Tatter Network Foundation
/// All rights reserved. Licensed under the GPL.
/// See the GNU General Public License for more details. (/documents/LICENSE, /documents/COPYRIGHT)
define('NO_SESSION', true);
define('__TEXTCUBE_CUSTOM_HEADER__', true);
define('__TEXTCUBE_LOGIN__', true);
require ROOT . '/library/preprocessor.php';
requireStrictBlogURL();
$context = Model_Context::getInstance();
$period = $suri['id'];
$blogid = getBlogId();
$cache = pageCache::getInstance();
$cache->reset('archiveAtom-' . $period);
if (!$cache->load()) {
    requireModel("blog.feed");
    list($entries, $paging) = getEntriesWithPagingByPeriod($blogid, $period, 1, 1, 1);
    //var_dump($entries);
    if (empty($entries)) {
        header("Location: " . $context->getProperty('uri.host') . $context->getProperty('uri.blog') . "/atom");
        exit;
    }
    $result = getFeedWithEntries($blogid, $entries, _textf('%1 기간의 글 목록', $period), 'atom');
    if ($result !== false) {
        $cache->reset('archiveAtom-' . $period);
        $cache->contents = $result;
        $cache->update();
    }
}
header('Content-Type: application/rss+xml; charset=utf-8');
コード例 #27
0
ファイル: api.php プロジェクト: Avantians/Textcube
function metaWeblog_newMediaObject()
{
    $context = Model_Context::getInstance();
    $params = func_get_args();
    $result = api_login($params[1], $params[2]);
    if ($result) {
        return $result;
    }
    $file = array('name' => $params[3]['name'], 'content' => $params[3]['bits'], 'size' => count($params[3]['bits']));
    $attachment = api_addAttachment(getBlogId(), 0, $file);
    if (!$attachment) {
        return new XMLRPCFault(1, "Can't create file");
    }
    $attachurl = array('url' => $context->getProperty('uri.host') . $context->getProperty('service.path') . "/attach/" . $blogid . "/" . $attachment['name']);
    return $attachurl;
}
コード例 #28
0
ファイル: index.php プロジェクト: ni5am/Textcube
function PN_Visitor_Default_set()
{
    $blogid = getBlogId();
    $isAjaxRequest = isset($_REQUEST['ajaxcall']) ? true : false;
    if ($isAjaxRequest) {
        $result = Statistics::setTotalStatistics($blogid) ? 0 : -1;
        header('Content-Type: text/xml; charset=utf-8');
        print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<response>\n<error>{$result}</error>\n</response>";
        exit;
    } else {
        header("Location: " . $_SERVER['HTTP_REFERER']);
    }
}
コード例 #29
0
 function refresh()
 {
     if (file_exists(__TEXTCUBE_CACHE_DIR__ . "/rss/" . getBlogId() . ".xml")) {
         @unlink(__TEXTCUBE_CACHE_DIR__ . "/rss/" . getBlogId() . ".xml");
     }
 }
コード例 #30
0
ファイル: Textcube.Core.php プロジェクト: ragi79/Textcube
 function deleteUser($blogid = null, $userid, $clean = true)
 {
     global $database;
     if ($blogid == null) {
         $blogid = getBlogId();
     }
     POD::execute("UPDATE {$database['prefix']}Entries\n\t\t\tSET userid = " . User::getBlogOwner($blogid) . "\n\t\t\tWHERE blogid = " . $blogid . " AND userid = " . $userid);
     // Delete ACL relation.
     if (!POD::execute("DELETE FROM {$database['prefix']}Privileges WHERE blogid='{$blogid}' and userid='{$userid}'")) {
         return false;
     }
     // And if there is no blog related to the specific user, delete user.
     if ($clean && !POD::queryAll("SELECT * FROM {$database['prefix']}Privileges WHERE userid = '{$userid}'")) {
         User::removePermanent($userid);
     }
     return true;
 }