Пример #1
0
 public function showYearAndTermAction()
 {
     $sql = "select Eva_year_term from evaluate order by Eva_year_term desc limit 1";
     require_once $_SERVER['DOCUMENT_ROOT'] . '/school' . '/model/pod.php';
     $pod = new POD();
     $result = $pod->query($sql);
 }
 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']}RemoteResponseLogs 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 = '', $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;
 }
Пример #4
0
 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));
     }
 }
Пример #5
0
 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($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 = '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;
 }
Пример #8
0
 /** NOTICE : PARTS BELOW EXTENDS DBQuery Class WHICH IS THE BASE OF POD
     AND WORKS ONLY WITH 'PageCache' Component in Textcube **/
 public static function queryWithDBCache($query, $prefix = null, $type = 'both', $count = -1)
 {
     $cache = queryCache::getInstance();
     $cache->reset($query, $prefix);
     if (!$cache->load()) {
         $cache->contents = POD::query($query, $type, $count);
         $cache->update();
     }
     return $cache->contents;
 }
Пример #9
0
 public function showScoreAction()
 {
     $sql1 = "select c.Course_ID,c.Course,sc.Score,c.Property,c.credit,c.intro from Course as c,Stu_Course as sc where c.Course_ID = sc.Course_ID and c.Course_year_term = {$_POST['Course_year_term']} and sc.Stu_ID = {$_POST['Account']}";
     require_once $_SERVER['DOCUMENT_ROOT'] . '/school' . '/model/pod.php';
     $pod = new POD();
     $pod->connect();
     $result = $pod->query($sql1);
     foreach ($result as $key => $value) {
         $where = $result[$key]['Course_ID'];
         $sql2 = "select Stu_ID from Stu_Course where Course_ID='{$where}' order by Score desc";
         $ids = $pod->query($sql2);
         foreach ($ids as $rank => $id) {
             if ($id['Stu_ID'] == $_POST['Account']) {
                 $result[$key]['rank'] = $rank + 1;
                 break;
             }
         }
     }
     $pod->close();
     return json_encode($result);
 }
Пример #10
0
 public function messageLinkContent($req, $lk, $arg)
 {
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $map = array('messageContentItem' => 'message', 'messageContraceItem' => 'message_interconnect');
     $table = array('message', 'message_interconnect');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     $res = $db->query($sql);
     return $res;
 }
Пример #11
0
 public function awardLinkTeacher($req, $lk, $arg)
 {
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $map = array('teacherInfoItem' => 'teacher_basic_info', 'teacherAwardItem' => 'teacher_award');
     $table = array('teacher_award', 'teacher_basic_info');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     $res = $db->query($sql);
     return $res;
 }
Пример #12
0
 public function projectLinkGroup($req, $lk, $arg)
 {
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $map = array('researchGroupProjectItem' => 'res_group_achievement', 'researchGroupItem' => 'res_group');
     $table = array('res_group_achievement', 'res_group');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     $res = $db->query($sql);
     return $res;
 }
Пример #13
0
 public function logLinkGroupMember($req, $lk, $arg)
 {
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $map = array('researchGroupMemberItem' => 'res_member', 'researchGroupLogItem' => 'res_group_log');
     $table = array('res_member', 'res_group_log');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     $res = $db->query($sql);
     return $res;
 }
Пример #14
0
 public function leaderLinkStudent($req, $lk, $arg)
 {
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $map = array('classLeaderItem' => 'class_leader', 'studentInfoItem' => 'stu_basic_info');
     $table = array('class_leader', 'stu_basic_info');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     $res = $db->query($sql);
     return $res;
 }
Пример #15
0
 public function stuLinkClass($req, $lk, $arg)
 {
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $map = array('studentIdentityItem' => 'stu_identification_info', 'studentInfoItem' => 'stu_basic_info');
     $table = array('stu_identification_info', 'stu_basic_info');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     $res = $db->query($sql);
     return $res;
 }
Пример #16
0
function getTags($blogid, $entry)
{
    global $database;
    $tags = array();
    if (doesHaveOwnership()) {
        $result = POD::query("SELECT t.* FROM {$database['prefix']}Tags t\n\t\t\tINNER JOIN {$database['prefix']}TagRelations r ON r.blogid = {$blogid} AND r.tag = t.id AND r.entry = {$entry} AND r.tag = t.id\n\t\t\tGROUP BY r.tag, t.id, t.name \n\t\t\tORDER BY t.name");
    } else {
        $result = POD::query("SELECT t.* FROM {$database['prefix']}Tags t\n\t\t\tINNER JOIN {$database['prefix']}TagRelations r ON r.blogid = {$blogid} AND r.entry = {$entry} AND r.tag = t.id\n\t\t\tINNER JOIN {$database['prefix']}Entries e ON e.id = r.entry AND e.visibility > 0\n\t\t\tGROUP BY r.tag, t.id, t.name\n\t\t\tORDER BY t.name");
    }
    if ($result) {
        while ($tag = POD::fetch($result)) {
            array_push($tags, $tag);
        }
    }
    return $tags;
}
Пример #17
0
function CountAndShow($target, $mother)
{
    global $database, $service, $suri, $blogid;
    $now_timestamp = time();
    $output = '';
    if ($suri['directive'] != "/rss" && $suri['directive'] != "/m" && $suri['directive'] != "/i/entry" && $suri['directive'] != "/atom" && $suri['directive'] != "/sync") {
        if (SaveReadToCookie($blogid, $mother)) {
            if (!POD::queryCount("UPDATE {$database['prefix']}EntryReadCount SET readcounts = readcounts + 1, lastaccess = {$now_timestamp} WHERE blogid={$blogid} AND id={$mother}")) {
                POD::query("INSERT INTO {$database['prefix']}EntryReadCount (blogid, id, readcounts, lastaccess) VALUES ({$blogid}, {$mother}, 1, {$now_timestamp})");
            }
        }
        $readcount = POD::queryCell("SELECT readcounts FROM {$database['prefix']}EntryReadCount WHERE blogid={$blogid} AND id={$mother}");
        $output .= "<span class=\"c_cnt\">views: {$readcount} times </span><br />";
    }
    return $output . $target;
}
 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($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 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}");
     }
 }
 function load()
 {
     global $database;
     $this->reset();
     if ($result = POD::query("SELECT visits FROM {$database['prefix']}BlogStatistics WHERE blogid = " . getBlogId())) {
         if ($row = POD::fetch($result)) {
             foreach ($row as $name => $value) {
                 if ($name == 'owner') {
                     continue;
                 }
                 $this->{$name} = $value;
             }
             POD::free($result);
             return true;
         }
         POD::free($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} FROM {$database['prefix']}LinkCategories WHERE blogid = " . getBlogId() . " {$filter} {$sort}");
     if ($this->_result) {
         $this->_count = POD::num_rows($this->_result);
     }
     return $this->shift();
 }
Пример #23
0
 public function test2Action()
 {
     require $_SERVER['DOCUMENT_ROOT'] . '/school' . '/model/pod.php';
     $db = new POD();
     $p = $db->connect();
     if ($p == false) {
         throw new Exception('Database connect failed');
     }
     $req = array();
     $lk = array('account');
     $req[0] = array('key' => 'account', 'account' => '111', 'table' => 'p');
     $arg = array('name', 'password');
     $table = array('Person', 'Account');
     $map = array('p' => 'Person', 'a' => 'Account');
     $sql = $db->genLinkSql($req, $lk, $arg, $table, $map);
     //echo $sql;
     //exit;
     $res = $db->query($sql);
     return $res;
 }
Пример #24
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;
 }
Пример #26
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;
 }
 function __commit()
 {
     global $database;
     if (false == $this->usable) {
         return $this->usable;
     }
     if (false == is_array($this->configVal)) {
         return false;
     }
     $element = '';
     foreach ($this->configVal as $key => $value) {
         $element .= "<field name=\"{$key}\" type=\"text\" ><![CDATA[{$value}]]></field>";
     }
     $xml = '<?xml version="1.0" encoding="utf-8"?><config>' . $element . '</config>';
     $xml = POD::escapeString($xml);
     if (defined('__TISTORY__')) {
         expireGlobalDressing($this->blogid);
         DataCache::expireData('SkinCache', $this->blogid);
         globalCacheExpire($this->blogid);
     }
     return POD::query("REPLACE INTO {$database['prefix']}Plugins (blogid, name, settings) VALUES({$this->blogid},'{$this->pluginName}', '{$xml}')");
 }
Пример #28
0
function myPlurk_UpdatePlurk($target, $mother)
{
    global $blogid, $service, $database, $configVal;
    requireComponent('Textcube.Function.misc');
    require_once "libs/plurk_api.php";
    $data = misc::fetchConfigVal($configVal);
    $autoPlurkEntries = (int) $data['autoPlurkEntries'];
    $plurkwithslogan = (int) $data['plurkwithslogan'];
    $plurklang = Setting::getBlogSettingGlobal('blogLanguage', '');
    $plurk = new plurk_api();
    $googl = new googleURLShortner();
    $plurkNickname = isset($data['plurknickname']) ? $data['plurknickname'] : "";
    $plurkPassword = isset($data['plurkpassword']) ? $data['plurkpassword'] : "";
    $plurk_api = 'iMCH3JDDda7c4bs0qiOchZcxAx7t8PA7';
    if ($mother['category'] >= 0 && ($autoPlurkEntries == 1 && $mother['visibility'] >= 2 || $autoPlurkEntries == 2 && $mother['visibility'] >= 3) && !empty($plurkNickname) && !empty($plurkPassword) && $plurk->login($plurk_api, $plurkNickname, $plurkPassword) && !POD::queryCount("UPDATE {$database['prefix']}PlurkEntries SET lastaccess = UNIX_TIMESTAMP() WHERE blogid={$blogid} AND id={$target}")) {
        $slogan = POD::queryCell("SELECT `slogan` FROM `{$database['prefix']}Entries` WHERE `id`={$target}");
        $permalink = getBlogURL() . "/" . (Setting::getBlogSettingGlobal('useSloganOnPost', true) ? "entry/" . URL::encode($slogan, $service['useEncodedURL']) : $target);
        $url = $googl->shortner($permalink);
        $url = $url !== false ? $url : $permalink;
        $lang = "en";
        switch ($plurklang) {
            case "zh-TW":
                $lang = "tr_ch";
                break;
            case "zh-CN":
                $lang = "cn";
            default:
                $lang = "en";
        }
        if (1 === $plurkwithslogan) {
            $content = $url . " (" . $mother['title'] . ") via " . Setting::getBlogSettingGlobal('title', '') . " with Textcube Plurk-API.";
        } else {
            $content = $mother['title'] . " via " . $url . " (" . Setting::getBlogSettingGlobal('title', '') . ") with Textcube Plurk-API.";
        }
        $acceptComment = $mother['acceptComment'] == 1 ? true : false;
        $response = $plurk->add_plurk($lang, "shares", $content, NULL, $acceptComment);
        if (isset($response->plurk_id) && $response->plurk_id > 0) {
            $plurk_id = $response->plurk_id;
            POD::query("INSERT INTO {$database['prefix']}PlurkEntries (blogid, id, plurkid, lastaccess) VALUES ('{$blogid}', '{$target}', '{$plurk_id}', UNIX_TIMESTAMP())");
        }
    }
    return $target;
}
 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%'");
 }
Пример #30
0
 public function discard()
 {
     $this->_query = 'DROP ' . $this->table;
     if (POD::query($this->_query)) {
         return true;
     }
     return false;
 }