コード例 #1
0
ファイル: Module_Awards.lib.php プロジェクト: microlefes/Game
function Module_Awards_insert_award(&$msgs)
{
    global $db_game, $params;
    if (!Module_Awards_check_tag($params->awardTag)) {
        $msgs[] = "Tag has to match '^[0-9a-zA-Z]+\$'";
        return false;
    }
    $description = lib_bb_code($params->awardDescription);
    $sql = "INSERT INTO Awards (tag, title, description) " . "VALUES ('{$params->awardTag}', '{$params->awardTitle}', " . "'{$description}')";
    if (!$db_game->query($sql)) {
        $msgs[] = $db_game->get_error();
        return false;
    }
    return true;
}
コード例 #2
0
ファイル: Module_News.php プロジェクト: microlefes/Game
 function getContent($modus)
 {
     global $db_login, $params, $cfg;
     $content = "";
     switch ($modus) {
         case 'news_create':
             $template = tmpl_open("modules/Module_News/templates/create.ihtml");
             // Form Submitted
             if (isset($params->creator)) {
                 $sql = "INSERT INTO `Portal_news` (`newsID`, `category`, `archive`, " . "`author`, `date`, `title`, `content`) " . "VALUES (0, '" . $params->newsCategory . "', '" . "0" . "', '" . $params->newsAuthor . "', '" . $params->newsDate . "', '" . $params->newsTitle . "', '" . nl2br(lib_bb_code($params->newsContent)) . "')";
                 if (!$db_login->query($sql)) {
                     die("Datenbankfehler beim Eintragen der News!");
                 }
                 tmpl_set($template, "MESSAGE/message", "News eingetragen!");
             } else {
                 foreach ($cfg['news']['categories'] as $category) {
                     tmpl_iterate($template, '/FORM/CATEGORY');
                     tmpl_set($template, '/FORM/CATEGORY', array('text' => $category, 'value' => $category));
                 }
                 tmpl_set($template, '/FORM/date', date("d-m-Y"));
             }
             $content = tmpl_parse($template);
             break;
         case 'news_show':
             $template = tmpl_open("modules/Module_News/templates/show.ihtml");
             $sql = "SELECT * FROM Portal_news ORDER BY newsID DESC";
             $result = $db_login->query($sql);
             if (!$result || $result->isEmpty()) {
                 return "Error while retrieving news!";
             }
             $news = array();
             while ($row = $result->nextRow()) {
                 $news[] = $row;
             }
             tmpl_set($template, 'NEWS', $news);
             $content = tmpl_parse($template);
             break;
     }
     return $content;
 }