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; }
<?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('confirmativePassword' => array('string', 'mandatory' => false), 'removeAttachments' => array(array('0', '1'), 'dafault' => null))); require ROOT . '/library/preprocessor.php'; requireStrictRoute(); if (empty($_POST['confirmativePassword']) || !User::confirmPassword(User::getBlogOwner(getBlogId()), $_POST['confirmativePassword'])) { Respond::ResultPage(1); } DataMaintenance::removeAll(Validator::getBool(@$_POST['removeAttachments'])); CacheControl::flushAll(); Respond::ResultPage(0);
function pretty_dress($view) { global $blogid, $blog, $database, $service, $stats, $skinSetting; /* local static */ global $pd_category, $pd_categoryXhtml, $pd_archive, $pd_calendar, $pd_tags, $pd_notices, $pd_recentEntry; global $pd_recentComment, $pd_recentTrackback, $pd_link, $pd_authorList; if (isset($_REQUEST['safe'])) { // safe mode return '<div class="sidebar-element-safebox">…</div>'; } if (isset($_REQUEST['tag'])) { // safe mode return '<div class="sidebar-element-safebox"><p>' . nl2br(htmlspecialchars($view, ENT_QUOTES)) . '</p></div>'; } $writer = POD::queryCell("SELECT name FROM {$database['prefix']}Users WHERE userid = " . User::getBlogOwner($blogid)); $pageTitle = _t('페이지 제목'); dress('page_title', htmlspecialchars($pageTitle), $view); dress('blogger', htmlspecialchars($writer), $view); dress('title', htmlspecialchars($context->getProperty('blog.title')), $view); dress('desc', htmlspecialchars($context->getProperty('blog.description')), $view); if (!empty($context->getProperty('blog.logo'))) { dress('image', "{$context->getProperty('service.path')}/attach/{$blogid}/{$context->getProperty('blog.logo')}", $view); } else { dress('image', "{$context->getProperty('service.path')}/resources/image/spacer.gif", $view); } dress('blog_link', "{$context->getProperty}('uri.blog')/", $view); dress('keylog_link', "{$context->getProperty}('uri.blog')/keylog", $view); dress('localog_link', "{$context->getProperty}('uri.blog')/location", $view); dress('taglog_link', "{$context->getProperty}('uri.blog')/tag", $view); dress('guestbook_link', "{$context->getProperty}('uri.blog')/guestbook", $view); list($view, $searchView) = Skin::cutSkinTag($view, 'search'); dress('search_name', 'search', $searchView); dress('search_text', isset($search) ? htmlspecialchars($search) : '', $searchView); dress('search_onclick_submit', 'searchBlog()', $searchView); dress('search', '<form id="TTSearchForm" action="' . $context->getProperty('uri.blog') . '/search/" method="get" onsubmit="return searchBlog()">' . $searchView . '</form>', $view); dress('category', $pd_category, $view); dress('category_list', $pd_categoryXhtml, $view); dress('count_total', $stats['total'], $view); dress('count_today', $stats['today'], $view); dress('count_yesterday', $stats['yesterday'], $view); list($view, $archiveView) = Skin::cutSkinTag($view, 'archive_rep'); dress('archive_rep', getArchivesView($pd_archive, $archiveView), $view); dress('calendar', $pd_calendar, $view); list($view, $randomView) = Skin::cutSkinTag($view, 'random_tags'); dress('random_tags', getRandomTagsView($pd_tags, $randomView), $view); list($view, $recentNoticeItem) = Skin::cutSkinTag($view, 'rct_notice_rep'); list($view, $noticeView) = Skin::cutSkinTag($view, 'rct_notice'); $notices = $pd_notices; if (sizeof($notices) == 0) { $notices = array(array('title' => _t('공지 제목'), 'id' => -1)); } if (sizeof($notices) > 0) { $itemsView = ''; foreach ($notices as $notice) { $itemView = $recentNoticeItem; dress('notice_rep_title', htmlspecialchars(fireEvent('ViewNoticeTitle', Utils_Unicode::lessenAsEm($notice['title'], $skinSetting['recentNoticeLength']), $notice['id'])), $itemView); dress('notice_rep_link', "{$context->getProperty}('uri.blog')/notice/" . ($blog['useSloganOnPost'] ? URL::encode($notice['slogan'], $itemView) : $notice['id']), $itemView); $itemsView .= $itemView; } dress('rct_notice_rep', $itemsView, $noticeView); dress('rct_notice', $noticeView, $view); } list($view, $authorList) = Skin::cutSkinTag($view, 'author_rep'); dress('author_rep', getAuthorListView($pd_authorList, $authorList), $view); list($view, $recentEntry) = Skin::cutSkinTag($view, 'rctps_rep'); dress('rctps_rep', getRecentEntriesView($pd_recentEntry, $recentEntry), $view); list($view, $recentComments) = Skin::cutSkinTag($view, 'rctrp_rep'); dress('rctrp_rep', getRecentCommentsView($pd_recentComment, $recentComments), $view); list($view, $recentTrackback) = Skin::cutSkinTag($view, 'rcttb_rep'); dress('rcttb_rep', getRecentTrackbacksView($pd_recentTrackback, $recentTrackback), $view); list($view, $s_link_rep) = Skin::cutSkinTag($view, 'link_rep'); dress('link_rep', getLinksView($pd_link, $s_link_rep), $view); dress('rss_url', "{$context->getProperty}('uri.blog')/rss", $view); dress('owner_url', "{$context->getProperty}('uri.blog')/owner", $view); dress('textcube_name', TEXTCUBE_NAME, $view); dress('textcube_version', TEXTCUBE_VERSION, $view); $tagSearches = array('@<a @i', '@</a *>@i', '@ id *= *".*"@isU', '@ onkey(down|up|press) *="@i', '@ on(click|load|unload) *="@i', '@<input +@i', '@<script.*</script *>@siU', '@<form @siU', '@</form>@siU'); $tagReplaces = array('<span ', '</span>', '', ' onnothing="', ' onnothing="', '<input disabled="disabled" ', '', '<div ', '</div>'); $view = preg_replace($tagSearches, $tagReplaces, $view); return correctSidebarImage($view); }
function deleteUser($blogid = null, $userid, $clean = true) { $context = Model_Context::getInstance(); $pool = DBModel::getInstance(); if ($blogid == null) { $blogid = getBlogId(); } $pool->reset("Entries"); $pool->setAttribute("userid", User::getBlogOwner($blogid)); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("userid", "eq", $userid); $pool->update(); // Delete ACL relation. $pool->reset("Privileges"); $pool->setQualifier("blogid", "eq", $blogid); $pool->setQualifier("userid", "eq", $userid); if (!$pool->delete()) { return false; } // And if there is no blog related to the specific user, delete user. $pool->reset("Privileges"); $pool->setQualifier("userid", "eq", $userid); if ($clean && !$pool->getAll()) { User::removePermanent($userid); } return true; }