<?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('GET' => array('item' => array('string'))); require ROOT . '/library/preprocessor.php'; requireStrictRoute(); requirePrivilege('group.creators'); $items = explode(",", $_GET['item']); if (in_array(getServiceSetting("defaultBlogId", 1), $items)) { $result = _t('대표 블로그는 삭제할 수 없습니다.'); Respond::PrintResult(array('error' => -1, 'result' => $result)); } foreach ($items as $item) { $result = removeBlog($item); if ($result !== true) { Respond::PrintResult(array('error' => -1, 'result' => $result)); } } Respond::PrintResult(array('error' => 0));
</tbody> </table> </div> </div> <?php if (Acl::check('group.owners')) { $urlRule = getBlogURLRule(); ?> <div id="part-setting-invite" class="part"> <h2 class="caption"><span class="main-text"><?php echo _t('새로운 사람을 블로그의 필진으로 초대합니다'); ?> </span></h2> <?php if (!function_exists('mail') && !getServiceSetting('useCustomSMTP', 0)) { ?> <div class="main-explain-box"> <p class="explain"><?php echo _t('시스템에 자체에서 메일을 보낼 수가 없습니다. 외부 메일 서버를 지정해주세요.'); ?> <a href="<?php echo $context->getProperty('uri.blog'); ?> /owner/control/server"><?php echo _t('메일 서버 설정 바로가기'); ?> </a></p> </div> <?php } else {
function getPluginTableName() { requireModel('common.setting'); global $database; $likeEscape = array('/_/', '/%/'); $likeReplace = array('\\_', '\\%'); $escapename = preg_replace($likeEscape, $likeReplace, $database['prefix']); $dbtables = POD::tableList($escapename); $dbCaseInsensitive = getServiceSetting('lowercaseTableNames'); if ($dbCaseInsensitive === null) { $result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'"); $dbCaseInsensitive = $result['Value'] == 1 ? 1 : 0; setServiceSetting('lowercaseTableNames', $dbCaseInsensitive); } $definedTables = getDefinedTableNames(); $dbtables = array_values(array_diff($dbtables, $definedTables)); if ($dbCaseInsensitive == 1) { $tempTables = $definedTables; $definedTables = array(); foreach ($tempTables as $table) { $table = strtolower($table); array_push($definedTables, $table); } $tempTables = $dbtables; $dbtables = array(); foreach ($tempTables as $table) { $table = strtolower($table); array_push($dbtables, $table); } $dbtables = array_values(array_diff($dbtables, $definedTables)); } return $dbtables; }
function removeBlog($blogid) { global $database; if (getServiceSetting("defaultBlogId", 1) == $blogid) { return false; } $tags = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}"); $feeds = POD::queryColumn("SELECT DISTINCT feeds FROM {$database['prefix']}FeedGroupRelations WHERE blogid = {$blogid}"); //Clear Tables POD::execute("DELETE FROM {$database['prefix']}Attachments WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}BlogSettings WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}BlogStatistics WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Categories WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Comments WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}CommentsNotified WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}CommentsNotifiedQueue WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}DailyStatistics WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Entries WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}EntriesArchive WHERE blogid = {$blogid}"); // POD::execute("DELETE FROM {$database['prefix']}FeedGroupRelations WHERE blogid = $blogid"); POD::execute("DELETE FROM {$database['prefix']}FeedGroups WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}FeedReads WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}FeedStarred WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}FeedSettings WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Filters WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Links WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}LinkCategories WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}PageCacheLog WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Plugins WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}RefererLogs WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}RefererStatistics WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}RemoteResponses WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}RemoteResponseLogs WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}SkinSettings WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}TagRelations WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}Privileges WHERE blogid = {$blogid}"); POD::execute("DELETE FROM {$database['prefix']}XMLRPCPingSettings WHERE blogid = {$blogid}"); //Delete Tags if (count($tags) > 0) { $tagliststr = implode(', ', $tags); // Tag id used at deleted blog. $nottargets = POD::queryColumn("SELECT DISTINCT tag FROM {$database['prefix']}TagRelations WHERE tag in ( {$tagliststr} )"); // Tag id used at other blogs. 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} ) "); } } //Delete Feeds if (count($feeds) > 0) { foreach ($feeds as $feedId) { deleteFeed($blogid, $feedId); } } //Clear Plugin Database // TODO : encapsulate with 'value' $query = "SELECT name, value FROM {$database['prefix']}ServiceSettings WHERE name like 'Database\\_%'"; $plugintablesraw = POD::queryAll($query); foreach ($plugintablesraw as $table) { $dbname = $database['prefix'] . substr($table['name'], 9); POD::execute("DELETE FROM {$database['prefix']}{$dbname} WHERE blogid = {$blogid}"); } //Clear RSS Cache if (file_exists(ROOT . "/cache/rss/{$blogid}.xml")) { unlink(ROOT . "/cache/rss/{$blogid}.xml"); } //Delete Attachments Path::removeFiles(Path::combine(ROOT, 'attach', $blogid)); return true; }
function mailNotifyComment($target, $mother) { global $blogid, $hostURL, $blogURL, $database, $service, $configVal, $serviceURL, $pluginURL; requireComponent('TextCube.Function.misc'); include_once ROOT . "/library/contrib/phpmailer/class.phpmailer.php"; $mail = new PHPMailer(); $data = misc::fetchConfigVal($configVal); $type = 1; // comment if ($mother['entry'] == 0) { $type = 3; } // guestbook $notifyType = isset($data['notifysetting']) && (int) $data['notifysetting'] === 1 ? true : false; $notifyGuestbook = isset($data['notifyguestbook']) && (int) $data['notifyguestbook'] === 1 ? true : false; $userid = getUserId(); if ($userid === 0) { $userid = POD::queryCell("SELECT `userid` FROM `{$database['prefix']}Privileges` WHERE `acl`='16' AND `blogid`='{$blogid}' LIMIT 1"); } $mailselfcheck = $mother['replier'] === $userid ? true : false; $mailercheck = false; if (1 === $type || 3 === $type && $notifyGuestbook) { if ($notifyType === true) { if ($mailselfcheck === false) { $email = isset($data['mail']) && !empty($data['mail']) ? $data['mail'] : POD::queryCell("SELECT `loginid` FROM `{$database['prefix']}Users` WHERE `userid`='{$userid}' LIMIT 1"); $name = POD::queryCell("SELECT `name` FROM `{$database['prefix']}Users` WHERE `userid`={$userid} LIMIT 1"); $mail->AddAddress($email, $name); $mailercheck = true; } } else { $result = POD::query("SELECT `u`.`userid`, `u`.`loginid` AS email, `u`.`name` FROM `{$database['prefix']}Users` AS u\r\n LEFT JOIN `{$database['prefix']}Privileges` AS p ON `p`.`userid` = `u`.`userid` WHERE `p`.`blogid`='{$blogid}'"); if (POD::num_rows($result) > 0) { while ($row = POD::fetch($result, 'array')) { if ($row['userid'] === $userid || $row['userid'] === $mother['replier']) { $mail->AddAddress($row['email'], $row['name']); } else { $mail->AddCC($row['email'], $row['name']); } $mailercheck = true; } } } } if ($mailercheck === true) { $link = $type === 1 ? "{$hostURL}{$blogURL}/{$mother['entry']}" : (!is_null($mother['parent']) && $mother['parent'] > 0 ? "{$hostURL}{$blogURL}/guestbook/" . $mother['parent'] . "#guestbook" . $mother['entry'] : "{$hostURL}{$blogURL}/guestbook/" . $mother['entry']); $message = "<html xmlns=\"http://www.w3.org/1999/xhtml\">\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\r\n</head>\r\n<body>\r\n<div style=\"text-align:left;\">\r\n<table style=\"width:100%;border:1px solid #000;\">\r\n<tr><th colspan=\"2\"> " . _f('You have a new %1 %2.', $mother['secret'] === true ? _t('secret') : '', $type === 1 ? _t('comment.') : _t('message.')) . " </th></tr>\r\n<tr><td style=\"width:150px;\">" . _t('link') . "</td><td><a href=\"" . $link . "\">" . _t('link') . "</a></td></tr>\r\n<tr><td style=\"width:150px;\">" . _t('nickname') . "</td><td>" . $mother['name'] . "</td></tr>\r\n<tr><td colspan=\"2\">" . _t('content') . "</td></tr>\r\n<tr><td colspan=\"2\">" . nl2br($mother['comment']) . "<br /><br />via IP:" . $mother['ip'] . "</td></tr>\r\n</table>\r\n</div>\r\n<p style=\"text-align:center;color:#999999;font-size: 0.75em;\">MailNotification By TextCube.</p>\r\n</body>\r\n</html>"; ob_start(); $mail->SetLanguage('en', ROOT . "/library/contrib/phpmailer/language/"); $mail->IsHTML(true); $mail->CharSet = 'utf-8'; $mail->From = "noreply@" . $service['domain']; $mail->FromName = "TextCube Mail Notification"; $mail->Subject = !isset($data['emailsubject']) || empty($data['emailsubject']) ? _t("[TextCube] New message notification.") : $data['emailsubject']; $mail->Body = $message; $mail->AltBody = 'To view this email message, open the email with html enabled mailer.'; if (!getServiceSetting('useCustomSMTP', 0)) { $mail->IsMail(); } else { $mail->IsSMTP(); $mail->Host = getServiceSetting('smtpHost', '127.0.0.1'); $mail->Port = getServiceSetting('smtpPort', 25); } $mail->Send(); $mail->ClearAddresses(); $mail->ClearCCs(); ob_end_clean(); } return $target; }