function forum_threads_updated($count = 5, $inforumid = 0, $notforumid = 0, $template = 'updated') { require_once BASEDIR . getmodulepath('forum') . 'functions.php'; global $set, $apx, $db; $count = (int) $count; //Erlaubte Foren if (is_int($forumid)) { $inforum = array($inforumid); } else { $inforum = intlist($inforumid); } if (is_int($notforumid)) { $notforum = array($notforumid); } else { $notforum = intlist($notforumid); } $forumids = forum_allowed_forums($inforum, $notforum); //Daten auslesen $fields = implode(',', array('threadid', 'prefix', 'title', 'opener_userid', 'opener', 'opentime', 'lastposter_userid', 'lastposter', 'lastposttime', 'posts', 'views')); if (count($forumids)) { $data = $db->fetch("SELECT " . $fields . " FROM " . PRE . "_forum_threads WHERE ( del=0 AND moved=0 AND forumid IN (" . implode(',', $forumids) . ") ) ORDER BY lastposttime DESC " . iif($count, "LIMIT " . $count)); } else { $data = array(); } forum_threads_print($data, $template, 'lastposttime'); }
function cron_twitter_real($lastexec) { global $set, $db, $apx; $twitter = null; if (version_compare(phpversion(), '5', '<')) { return; } if (!$set['twitter']['oauth_token'] || !$set['twitter']['oauth_secret']) { return; } if (!function_exists('curl_init')) { return; } //CURL benötigt $apx->lang->drop('twitter', 'twitter'); //News if ($apx->is_module('news') && $set['twitter']['news']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title, a.subtitle, b.title AS cattitle\n\t\t\tFROM " . PRE . "_news AS a\n\t\t\tLEFT JOIN " . PRE . "_news_cat AS b ON a.catid=b.id\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postNewsTwitter($data, $twitter); } } //Artikel if ($apx->is_module('articles') && $set['twitter']['articles']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title, a.subtitle, a.type, b.title AS cattitle\n\t\t\tFROM " . PRE . "_articles AS a\n\t\t\tLEFT JOIN " . PRE . "_articles_cat AS b ON a.catid=b.id\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postArticlesTwitter($data, $twitter); } } //Videos if ($apx->is_module('videos') && $set['twitter']['videos']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title, b.title AS cattitle\n\t\t\tFROM " . PRE . "_videos AS a\n\t\t\tLEFT JOIN " . PRE . "_videos_cat AS b ON a.catid=b.id\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postVideosTwitter($data, $twitter); } } //Downloads if ($apx->is_module('downloads') && $set['twitter']['downloads']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title, b.title AS cattitle\n\t\t\tFROM " . PRE . "_downloads AS a\n\t\t\tLEFT JOIN " . PRE . "_downloads_cat AS b ON a.catid=b.id\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postDownloadsTwitter($data, $twitter); } } //Galerien if ($apx->is_module('gallery') && $set['twitter']['gallery']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title\n\t\t\tFROM " . PRE . "_gallery AS a\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postGalleryTwitter($data, $twitter); } } //Links if ($apx->is_module('links') && $set['twitter']['links']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title, b.title AS cattitle\n\t\t\tFROM " . PRE . "_links AS a\n\t\t\tLEFT JOIN " . PRE . "_links_cat AS b ON a.catid=b.id\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postLinksTwitter($data, $twitter); } } //Glossar if ($apx->is_module('glossar') && $set['twitter']['glossar']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.title, b.title AS cattitle\n\t\t\tFROM " . PRE . "_glossar AS a\n\t\t\tLEFT JOIN " . PRE . "_glossar_cat AS b ON a.catid=b.id\n\t\t\tWHERE starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postGlossarTwitter($data, $twitter); } } //Termine if ($apx->is_module('calendar') && $set['twitter']['events']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.title, b.title AS cattitle\n\t\t\tFROM " . PRE . "_calendar_events AS a\n\t\t\tLEFT JOIN " . PRE . "_calendar_cat AS b ON a.catid=b.id\n\t\t\tWHERE a.active>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postEventsTwitter($data, $twitter); } } //Forum if ($apx->is_module('forum') && $set['twitter']['forum']) { require_once BASEDIR . getmodulepath('forum') . 'functions.php'; $forumids = forum_allowed_forums(); if (count($forumids)) { $data = $db->fetch("\n\t\t\t\tSELECT a.threadid, a.title\n\t\t\t\tFROM " . PRE . "_forum_threads AS a\n\t\t\t\tWHERE del=0 AND moved=0 AND forumid IN (" . implode(',', $forumids) . ") AND opentime>'" . $lastexec . "'\n\t\t\t\tORDER BY opentime DESC\n\t\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postForumTwitter($data, $twitter); } } } //Umfragen if ($apx->is_module('poll') && $set['twitter']['poll']) { $data = $db->fetch("\n\t\t\tSELECT a.id, a.secid, a.question AS title\n\t\t\tFROM " . PRE . "_poll AS a\n\t\t\tWHERE " . time() . " BETWEEN starttime AND endtime AND starttime>'" . $lastexec . "'\n\t\t\tORDER BY starttime DESC\n\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postPollTwitter($data, $twitter); } } //Benuter if ($apx->is_module('user')) { //Blogs if ($set['twitter']['user_blog']) { $data = $db->fetch("\n\t\t\t\tSELECT a.id, a.userid, a.title\n\t\t\t\tFROM " . PRE . "_user_blog AS a\n\t\t\t\tWHERE a.time>'" . $lastexec . "'\n\t\t\t\tORDER BY a.time DESC\n\t\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postUserBlogTwitter($data, $twitter); } } //Galerien if ($set['twitter']['user_gallery']) { $data = $db->fetch("\n\t\t\t\tSELECT a.id, a.owner, a.title\n\t\t\t\tFROM " . PRE . "_user_gallery AS a\n\t\t\t\tWHERE a.addtime>'" . $lastexec . "' AND a.password=''\n\t\t\t\tORDER BY a.addtime DESC\n\t\t\t"); if (count($data)) { if (is_null($twitter)) { $twitter = twitter_connect(); } postUserGalleryTwitter($data, $twitter); } } } }