function open($filter = '', $fields = '*', $sort = 'subscribed DESC')
 {
     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']}SubscriptionStatistics WHERE 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;
 }
 function open($filter = '', $fields = '*', $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}\n\t\t\tFROM {$database['prefix']}Comments\n\t\t\tWHERE blogid = " . getBlogId() . "\n\t\t\t\tAND entry = 0\n\t\t\t\t{$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;
 }
 function open($filter = '', $fields = '*', $sort = 'datemark DESC')
 {
     $ctx = Model_Context::getInstance();
     if (is_numeric($filter)) {
         $filter = 'AND datemark = ' . $filter;
     } else {
         if (!empty($filter)) {
             $filter = 'AND ' . $filter;
         }
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT {$fields} FROM " . $ctx->getProperty('database.prefix') . "DailyStatistics WHERE 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;
 }
Esempio n. 4
0
 function open($filter = '', $fields = '*', $sort = 'written')
 {
     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']}RemoteResponses WHERE blogid = " . getBlogId() . " AND responsetype = 'trackback' {$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;
 }
 function open($filter = '', $sort = 'id')
 {
     global $database;
     if (is_numeric($filter)) {
         $filter = 'AND id = ' . $filter;
     } else {
         if (!empty($filter)) {
             $filter = 'AND filtertype = \'' . $filter . '\'';
         }
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT * FROM {$database['prefix']}Filters WHERE 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;
 }
 function open($name = '', $fields = '*', $sort = 'name')
 {
     global $database;
     if (!empty($name)) {
         $name = 'WHERE name = \'' . $name . '\'';
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT {$fields} FROM {$database['prefix']}ServiceSettings {$name} {$sort}");
     if ($this->_result) {
         $this->_count = POD::num_rows($this->_result);
     }
     return $this->shift();
 }
 function open($name = '', $fields = '*', $sort = 'name')
 {
     global $database;
     if (!empty($name)) {
         $name = 'AND name = \'' . $name . '\'';
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT {$fields} FROM {$database['prefix']}Plugins WHERE blogid = " . getBlogId() . " {$name} {$sort}");
     if ($this->_result) {
         $this->_count = POD::num_rows($this->_result);
     }
     return $this->shift();
 }
 function open($filter = '', $fields = '*', $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']}LinkCategories WHERE blogid = " . getBlogId() . " {$filter} {$sort}");
     if ($this->_result) {
         $this->_count = POD::num_rows($this->_result);
     }
     return $this->shift();
 }
Esempio n. 9
0
function EntriesWithTags($target, $mother)
{
    global $suri, $defaultURL, $blogURL, $pluginURL, $configVal, $blog, $service, $blogid, $database;
    requireComponent('Textcube.Function.misc');
    $html = '';
    if ($suri['directive'] != "/rss" && $suri['directive'] != "/atom" && $suri['directive'] != "/m" && $suri['directive'] != "/i/entry" && $suri['directive'] != "/sync") {
        $html = '
		<div class="entries-with-tags-box">
			<strong>&nbsp;' . _t("Related entries") . '&nbsp;</strong>
			<ul>';
        $data = misc::fetchConfigVal($configVal);
        $entries = isset($data['entries']) ? $data['entries'] : 5;
        $conEntry = POD::queryRow("SELECT userid, category FROM {$database['prefix']}Entries WHERE blogid = {$blogid} AND id = {$mother}");
        $result = POD::query("SELECT DISTINCT e.id, e.slogan, e.title, e.created, e.comments, e.trackbacks\n\t\t\t\t\t\t\t\tFROM {$database['prefix']}TagRelations AS r\n\t\t\t\t\t\t\t\tLEFT JOIN {$database['prefix']}TagRelations AS t ON t.tag = r.tag \n\t\t\t\t\t\t\t\tLEFT JOIN {$database['prefix']}Entries AS e ON e.id = t.entry \n\t\t\t\t\t\t\t\tWHERE r.entry ={$mother}\n\t\t\t\t\t\t\t\tAND r.blogid ={$blogid}\n\t\t\t\t\t\t\t\tAND t.entry !={$mother}\n\t\t\t\t\t\t\t\tAND e.userid ={$conEntry['userid']} \n\t\t\t\t\t\t\t\tAND e.category = {$conEntry['category']} \n\t\t\t\t\t\t\t\tORDER BY t.entry DESC\n\t\t\t\t\t\t\t\tLIMIT {$entries}");
        if (POD::num_rows($result) > 0) {
            while ($row = POD::fetch($result, 'array')) {
                $entry = $row['id'];
                $slogan = rawurlencode($row['slogan']);
                $title = $row['title'];
                $created = date("Y/m/d H:m", $row['created']);
                $comments = $row['comments'];
                $trackbacks = $row['trackbacks'];
                if ($suri['directive'] == "/category") {
                    $permalink = $blog['useSloganOnCategory'] ? "{$defaultURL}/entry/{$slogan}" : "{$defaultURL}/{$entry}";
                } elseif ($suri['directive'] == "/tag") {
                    $permalink = $blog['useSloganOnTag'] ? "{$defaultURL}/entry/{$slogan}" : "{$defaultURL}/{$entry}";
                } else {
                    $permalink = $blog['useSloganOnPost'] ? "{$defaultURL}/entry/{$slogan}" : "{$defaultURL}/{$entry}";
                }
                $html .= "<li><a href=\"{$permalink}\">{$title}</a>,<span>Comments:&nbsp;{$comments}&nbsp;|&nbsp;Trackbacks:&nbsp;{$trackbacks}&nbsp;|&nbsp;{$created}</span></li>";
            }
        } else {
            $html .= "<li>" . _t("No related entries.") . "</li>";
        }
        $html .= <<<EOF
\t\t</ul>
\t</div>
EOF;
    }
    return $target . $html;
}
 function open($filter = 'True', $fields = '*', $sort = 'id')
 {
     global $database;
     if (is_numeric($filter)) {
         $filter = 'id = ' . $filter;
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT {$fields} FROM {$database['prefix']}CommentsNotifiedSiteInfo WHERE {$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;
 }
Esempio n. 11
0
 function open($filter = '', $fields = '*', $sort = 'published DESC')
 {
     global $database;
     $this->close();
     $this->init();
     if (is_numeric($filter)) {
         $filter = 'AND id = ' . $filter;
     } else {
         if (!empty($filter)) {
             $filter = 'AND ' . $filter;
         }
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->_result = POD::query("SELECT {$fields} FROM {$database['prefix']}Entries WHERE blogid = {$this->blogid} AND draft = 0 AND category >= 0 {$filter} {$sort}");
     if ($this->_result) {
         $this->_count = POD::num_rows($this->_result);
     }
     return $this->shift();
 }
Esempio n. 12
0
 function open($filter = '', $fields = '*', $sort = 'attached')
 {
     global $database;
     $blogid = getBlogId();
     if (!empty($filter)) {
         $filter = 'AND ' . $filter;
     }
     if (!empty($sort)) {
         $sort = 'ORDER BY ' . $sort;
     }
     $this->close();
     $this->_result = POD::query("SELECT {$fields} FROM {$database['prefix']}Attachments WHERE blogid = {$blogid} {$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;
 }
Esempio n. 13
0
 function open($filter = '', $fields = 'i.*', $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}\n\t\t\t\tFROM {$database['prefix']}FeedItems i \n\t\t\t\tJOIN {$database['prefix']}FeedGroupRelations g ON i.feed = g.feed \n\t\t\t\tWHERE g.blogid = {$blogid} {$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;
 }
Esempio n. 14
0
 function remove($id)
 {
     global $database;
     $this->init();
     if (is_numeric($id)) {
         return false;
     }
     $result = POD::query("DELETE FROM {$database['prefix']}Entries WHERE blogid = " . getBlogId() . " AND category = -2 AND id = {$id}");
     if ($result && ($this->_count = POD::num_rows($result))) {
         return true;
     }
     return false;
 }
Esempio n. 15
0
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;
}