/** * Return the comments for a strip * * @param Strip $strip The strip for which we want obtain the comments * @param Lang $lang The language object is use when the connection with forum isn't ok * @access public * @static * @return string The comments for the strip or an error message if the connection with forum isn't ok */ public static function getComments(Strip $strip, Lang $lang) { $url = Config::getFluxbbForum() . '/extern.php?action=topic&ttitle=' . urlencode($strip->getTitle()) . '&max_subject_length=' . Config::getFluxbbMaxLength(); $text = file_get_contents($url); if ($text === false) { $text = $lang->getForumError(); } else { $text = utf8_encode($text); } return $text; }
} else { $id = $last; } // Obtain the strip $strip = Cache::getStrip($id); // Obtain the language if (isset($_GET['lang'])) { $lang = $_GET['lang']; } else { $lang = Config::getLanguage(); } $lang = getLang($lang); // Obtain the navigation list($nav_first, $nav_last, $nav_prev, $nav_next, $nav_gallery) = getNavigation($id, $last, $lang); $nav_forum_post = Config::getFluxbbForum() . '/post.php?ttitle=' . urlencode($strip->getTitle()) . '&fid=' . Config::getFluxbbForumId(); $nav_forum_view = Config::getFluxbbForum() . '/redirect_stripit.php?ttitle=' . urlencode($strip->getTitle()); $permanent_link = htmlentities(getPermanentLink($id, $lang)); // If necessary, obtain the forum data $comments = ''; $wotd = ''; if (Config::getUseFluxbb() === true) { $comments = Forum::getComments($strip, $lang); $wotd = Forum::getWotd($lang); } // show the template if (isset($_GET['ajax']) === true) { // it's an ajax call, return an XML header('Content-type: text/xml'); include_once Config::getTemplateFolder() . '/stripit.xml'; } else { include_once Config::getTemplateFolder() . '/' . Config::getTemplateName() . '/template.html';