Exemple #1
0
/**
 *  2Moons
 *  Copyright (C) 2012 Jan Kröpke
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package 2Moons
 * @author Jan Kröpke <*****@*****.**>
 * @copyright 2012 Jan Kröpke <*****@*****.**>
 * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
 * @version 1.7.3 (2013-05-19)
 * @info $Id: BBCode.php 2640 2013-03-23 19:23:26Z slaver7 $
 * @link http://2moons.cc/
 */
function bbcode($text)
{
    require_once 'includes/classes/class.BBCode.php';
    $bbcode = new BBCode();
    $bbcode->addParser('list', 'bbcode_stripcontents');
    //Block-Elements
    $bbcode->addCode("quote", "callback_replace", "bbcode_quote", array(), "block", array("block"), array('inline', 'link', 'list'));
    $bbcode->addCode("align", "callback_replace", "bbcode_align", array(), "block", array("block"), array('inline', 'link', 'list'));
    $bbcode->addCode("spoiler", "simple_replace", null, array('start_tag' => '<div class="bbcode_spoiler"><p><b>Spoiler:</b></p><div>', 'end_tag' => '</div></div>'), "block", array("block"), array('inline', 'link', 'list'));
    $bbcode->addCode("bg", "usecontent?", "bbcode_background", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("bgcolor", "callback_replace", "bbcode_bgcolor", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    //Inline-Elements
    $bbcode->addCode("b", "simple_replace", null, array('start_tag' => '<b>', 'end_tag' => '</b>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("i", "simple_replace", null, array('start_tag' => '<i>', 'end_tag' => '</i>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("u", "simple_replace", null, array('start_tag' => '<u>', 'end_tag' => '</u>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("s", "simple_replace", null, array('start_tag' => '<s>', 'end_tag' => '</s>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("size", "callback_replace", "bbcode_size", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("color", "callback_replace", "bbcode_color", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("rouge", "callback_replace", "bbcode_rouge", array('start_tag' => '[rouge]', 'end_tag' => '[/rouge]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("orange", "callback_replace", "bbcode_orange", array('start_tag' => '[orange]', 'end_tag' => '[/orange]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("jaune", "callback_replace", "bbcode_jaune", array('start_tag' => '[jaune]', 'end_tag' => '[/jaune]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("chartreuse", "callback_replace", "bbcode_chartreuse", array('start_tag' => '[chartreuse]', 'end_tag' => '[/chartreuse]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("vert", "callback_replace", "bbcode_vert", array('start_tag' => '[vert]', 'end_tag' => '[/vert]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("cyan", "callback_replace", "bbcode_cyan", array('start_tag' => '[cyan]', 'end_tag' => '[/cyan]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("bleu", "callback_replace", "bbcode_bleu", array('start_tag' => '[bleu]', 'end_tag' => '[/bleu]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("violet", "callback_replace", "bbcode_violet", array('start_tag' => '[violet]', 'end_tag' => '[/violet]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("rose", "callback_replace", "bbcode_rose", array('start_tag' => '[rose]', 'end_tag' => '[/rose]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("gris", "callback_replace", "bbcode_gris", array('start_tag' => '[gris]', 'end_tag' => '[/gris]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("blanc", "callback_replace", "bbcode_blanc", array('start_tag' => '[blanc]', 'end_tag' => '[/blanc]'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    //Link-Elements
    $bbcode->addCode("url", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("link", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("mailto", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("email", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("mail", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    //Code-Elements
    $bbcode->addCode("code", "usecontent", "bbcode_code", array('php' => false), 'code', array('block'), array('inline', 'link', 'list'));
    $bbcode->addCode("php", "usecontent", "bbcode_code", array('php' => true), 'code', array('block'), array('inline', 'link', 'list'));
    //List-Elements
    $bbcode->addCode("list", "callback_replace", "bbcode_list", array(), "list", array('block', 'listitem'), array('inline', 'link'));
    $bbcode->addCode("*", "simple_replace", null, array('start_tag' => '<li>', 'end_tag' => '</li>'), "listitem", array('list'), array());
    //Image-Element
    $bbcode->addCode("img", "usecontent", "bbcode_img", array(), "image", array('block', 'inline', 'link', 'listitem'), array());
    //Flags
    $bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
    $bbcode->setGlobalCaseSensitive(false);
    //New-Line-Drops
    $bbcode->setCodeFlag('*', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
    $bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
    $bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
    $codes = array('code', 'php', 'quote', 'spoiler');
    $flags = array('opentag.before.newline', 'opentag.after.newline', 'closetag.before.newline', 'closetag.after.newline');
    foreach ($codes as $code) {
        foreach ($flags as $flag) {
            $bbcode->setCodeFlag($code, $flag, BBCODE_NEWLINE_DROP);
        }
    }
    return str_replace('&amp;amp;', '&amp;', makebr($bbcode->parse($text)));
}
function ShowSendMessagesPage()
{
    global $USER, $LNG;
    $ACTION = HTTP::_GP('action', '');
    if ($ACTION == 'send') {
        switch ($USER['authlevel']) {
            case AUTH_MOD:
                $class = 'mod';
                break;
            case AUTH_OPS:
                $class = 'ops';
                break;
            case AUTH_ADM:
                $class = 'admin';
                break;
            default:
                $class = '';
                break;
        }
        $Subject = HTTP::_GP('subject', '', true);
        $Message = HTTP::_GP('text', '', true);
        $Mode = HTTP::_GP('mode', 0);
        $Lang = HTTP::_GP('lang', '');
        if (!empty($Message) && !empty($Subject)) {
            require 'includes/classes/BBCode.class.php';
            if ($Mode == 0 || $Mode == 2) {
                $From = '<span class="' . $class . '">' . $LNG['user_level'][$USER['authlevel']] . ' ' . $USER['username'] . '</span>';
                $pmSubject = '<span class="' . $class . '">' . $Subject . '</span>';
                $pmMessage = '<span class="' . $class . '">' . BBCode::parse($Message) . '</span>';
                $USERS = $GLOBALS['DATABASE']->query("SELECT `id`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
                while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
                    $sendMessage = str_replace('{USERNAME}', $UserData['username'], $pmMessage);
                    PlayerUtil::sendMessage($UserData['id'], $USER['id'], $From, 50, $pmSubject, $sendMessage, TIMESTAMP, NULL, 1, Universe::getEmulated());
                }
            }
            if ($Mode == 1 || $Mode == 2) {
                require 'includes/classes/Mail.class.php';
                $userList = array();
                $USERS = $GLOBALS['DATABASE']->query("SELECT `email`, `username` FROM " . USERS . " WHERE `universe` = '" . Universe::getEmulated() . "'" . (!empty($Lang) ? " AND `lang` = '" . $GLOBALS['DATABASE']->sql_escape($Lang) . "'" : "") . ";");
                while ($UserData = $GLOBALS['DATABASE']->fetch_array($USERS)) {
                    $userList[$UserData['email']] = array('username' => $UserData['username'], 'body' => BBCode::parse(str_replace('{USERNAME}', $UserData['username'], $Message)));
                }
                Mail::multiSend($userList, strip_tags($Subject));
            }
            exit($LNG['ma_message_sended']);
        } else {
            exit($LNG['ma_subject_needed']);
        }
    }
    $sendModes = $LNG['ma_modes'];
    if (Config::get()->mail_active == 0) {
        unset($sendModes[1]);
        unset($sendModes[2]);
    }
    $template = new template();
    $template->assign_vars(array('langSelector' => array_merge(array('' => $LNG['ma_all']), $LNG->getAllowedLangs(false)), 'modes' => $sendModes));
    $template->show('SendMessagesPage.tpl');
}
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $sujet = ForumSubjects::where("id", $id)->first();
     $categorie = ForumCategories::find($sujet->category);
     foreach ($sujet->messages as $message) {
         Date::setLocale('fr');
         $date = new Date($message->created);
         $message->when = $date->format('j F Y');
         $message->message = $this::text_humanized($message->message);
         $message->message = BBCode::parse($message->message);
     }
     return view('forum.sujets.show', ['categorie' => $categorie, "sujet" => $sujet]);
 }
Exemple #4
0
function bbcode($text)
{
    require_once ROOT_PATH . 'includes/classes/class.BBCode.' . PHP_EXT;
    $bbcode = new BBCode();
    $bbcode->addParser('list', 'bbcode_stripcontents');
    //Block-Elements
    $bbcode->addCode("quote", "callback_replace", "bbcode_quote", array(), "block", array("block"), array('inline', 'link', 'list'));
    $bbcode->addCode("align", "callback_replace", "bbcode_align", array(), "block", array("block"), array('inline', 'link', 'list'));
    $bbcode->addCode("spoiler", "simple_replace", null, array('start_tag' => '<div class="bbcode_spoiler"><p><b>Spoiler:</b></p><div>', 'end_tag' => '</div></div>'), "block", array("block"), array('inline', 'link', 'list'));
    $bbcode->addCode("bg", "usecontent?", "bbcode_background", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("bgcolor", "callback_replace", "bbcode_bgcolor", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    //Inline-Elements
    $bbcode->addCode("b", "simple_replace", null, array('start_tag' => '<b>', 'end_tag' => '</b>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("i", "simple_replace", null, array('start_tag' => '<i>', 'end_tag' => '</i>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("u", "simple_replace", null, array('start_tag' => '<u>', 'end_tag' => '</u>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("s", "simple_replace", null, array('start_tag' => '<s>', 'end_tag' => '</s>'), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("size", "callback_replace", "bbcode_size", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    $bbcode->addCode("color", "callback_replace", "bbcode_color", array(), 'inline', array('block', 'inline', 'link', 'listitem'), array());
    //Link-Elements
    $bbcode->addCode("url", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("link", "usecontent?", "bbcode_url", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("mailto", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("email", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    $bbcode->addCode("mail", "usecontent?", "bbcode_mailto", array('usecontent_param' => 'default'), 'link', array('block', 'inline', 'listitem'), array('link'));
    //Code-Elements
    $bbcode->addCode("code", "usecontent", "bbcode_code", array('php' => false), 'code', array('block'), array('inline', 'link', 'list'));
    $bbcode->addCode("php", "usecontent", "bbcode_code", array('php' => true), 'code', array('block'), array('inline', 'link', 'list'));
    //List-Elements
    $bbcode->addCode("list", "callback_replace", "bbcode_list", array(), "list", array('block', 'listitem'), array('inline', 'link'));
    $bbcode->addCode("*", "simple_replace", null, array('start_tag' => '<li>', 'end_tag' => '</li>'), "listitem", array('list'), array());
    //Image-Element
    $bbcode->addCode("img", "usecontent", "bbcode_img", array(), "image", array('block', 'inline', 'link', 'listitem'), array());
    //Flags
    $bbcode->setCodeFlag('*', 'closetag', BBCODE_CLOSETAG_OPTIONAL);
    $bbcode->setGlobalCaseSensitive(false);
    //New-Line-Drops
    $bbcode->setCodeFlag('*', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
    $bbcode->setCodeFlag('list', 'opentag.before.newline', BBCODE_NEWLINE_DROP);
    $bbcode->setCodeFlag('list', 'closetag.before.newline', BBCODE_NEWLINE_DROP);
    $codes = array('code', 'php', 'quote', 'spoiler');
    $flags = array('opentag.before.newline', 'opentag.after.newline', 'closetag.before.newline', 'closetag.after.newline');
    foreach ($codes as $code) {
        foreach ($flags as $flag) {
            $bbcode->setCodeFlag($code, $flag, BBCODE_NEWLINE_DROP);
        }
    }
    return makebr($bbcode->parse($text));
}
Exemple #5
0
 private function getBlogsReviews($thislist, $type = 'reviews')
 {
     $this->data['settings'] = $thislist;
     $hash = md5(serialize($thislist));
     $this->data['settings_hash'] = $hash;
     if ($this->customer->isLogged()) {
         $customer_group_id = $this->customer->getCustomerGroupId();
     } else {
         $customer_group_id = $this->config->get('config_customer_group_id');
     }
     $rate = array();
     $this->language->load('record/blog');
     $this->load->model('catalog/comment');
     $this->load->model('catalog/blog');
     $this->load->model('tool/image');
     if (isset($thislist['title_list_latest'][$this->config->get('config_language_id')])) {
         $this->data['heading_title'] = $thislist['title_list_latest'][$this->config->get('config_language_id')];
     } else {
         $this->data['heading_title'] = "";
     }
     $this->data['text_comments'] = $this->language->get('text_comments');
     $this->data['text_viewed'] = $this->language->get('text_viewed');
     $row = $this->cache->get('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $customer_group_id . '.' . $hash);
     if (0 == 0 || empty($row)) {
         $comments = $this->model_catalog_comment->getCommentsByBlogsIN($thislist, 3);
         if (isset($comments) && count($comments) > 0) {
             foreach ($comments as $comment) {
                 if ($comment['type'] == 'blogs') {
                     $blog_href = $this->model_catalog_blog->getPathByBlog($comment['blog_id']);
                     $blog_link = $this->url->link('record/blog', 'blog_id=' . $blog_href['path']);
                     $record_link = $this->url->link('record/record', 'record_id=' . $comment['record_id'] . "&blog_id=" . $blog_href['path']);
                     $rate = $this->model_catalog_comment->getRatesByCommentId($comment['comment_id']);
                     $this->data['text_category'] = $this->language->get('text_blog');
                     $this->data['text_record'] = $this->language->get('text_record');
                 }
                 //$comment['type'] == 'blogs'
                 if ($comment['type'] == 'categories') {
                     if (isset($comment['review_id'])) {
                         $comment['comment_id'] = $comment['review_id'];
                     } else {
                         $comment['comment_id'] = '';
                     }
                     if (isset($comment['commentid'])) {
                         $comment['comment_id'] = $comment['commentid'];
                     } else {
                         $comment['comment_id'] = '';
                     }
                     if (isset($comment['product_id'])) {
                         $comment['record_id'] = $comment['product_id'];
                     } else {
                         if (!isset($comment['record_id'])) {
                             $comment['record_id'] = '';
                         }
                     }
                 }
                 //$comment['type'] == 'categories'
                 if ($comment['type'] == 'categories') {
                     $blog_href = $this->model_catalog_blog->getPathByCategory($comment['blog_id']);
                     $blog_link = $this->url->link('product/category', 'path=' . $blog_href['path']);
                     $record_link = $this->url->link('product/product', 'product_id=' . $comment['record_id'] . "&path=" . $blog_href['path']);
                     $rate = array();
                     $this->data['text_category'] = $this->language->get('text_category');
                     $this->data['text_record'] = $this->language->get('text_product');
                 }
                 //$comment['type'] == 'categories'
                 $rate_count = 0;
                 $rate_delta = 0;
                 $rate_delta_plus = 0;
                 $rate_delta_minus = 0;
                 foreach ($rate as $r) {
                     $rate_count = $r['rate_count'];
                     $rate_delta = $r['rate_delta'];
                     $rate_delta_plus = $r['rate_delta_plus'];
                     $rate_delta_minus = $r['rate_delta_minus'];
                 }
                 //$rate as $r
                 $this->load->model('tool/image');
                 if ($comment) {
                     if ($comment['image']) {
                         if (isset($thislist['avatar']['width']) && isset($thislist['avatar']['height']) && $thislist['avatar']['width'] != "" && $thislist['avatar']['height'] != "") {
                             $thumb = $this->model_tool_image->resize($comment['image'], $thislist['avatar']['width'], $thislist['avatar']['height'], 1);
                         } else {
                             $thumb = $this->model_tool_image->resize($comment['image'], 150, 150, 1);
                         }
                     } else {
                         $thumb = '';
                     }
                 } else {
                     $thumb = '';
                 }
                 if (!isset($comment['text'])) {
                     $comment['text'] = '';
                 }
                 //!isset($comment['text'])
                 if ($comment['text'] != '') {
                     $flag_desc = 'none';
                     if ($thislist['desc_symbols'] != '') {
                         $amount = $thislist['desc_symbols'];
                         $flag_desc = 'symbols';
                     }
                     //$thislist['desc_symbols'] != ''
                     if ($thislist['desc_words'] != '') {
                         $amount = $thislist['desc_words'];
                         $flag_desc = 'words';
                     }
                     //$thislist['desc_words'] != ''
                     if ($thislist['desc_pred'] != '') {
                         $amount = $thislist['desc_pred'];
                         $flag_desc = 'pred';
                     }
                     //$thislist['desc_pred'] != ''
                     switch ($flag_desc) {
                         case 'symbols':
                             $pattern = '/((.*?)\\S){0,' . $amount . '}/isu';
                             preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
                             $text = $out[0][0];
                             break;
                         case 'words':
                             $pattern = '/((.*?)\\x20){0,' . $amount . '}/isu';
                             preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
                             $text = $out[0][0];
                             break;
                         case 'pred':
                             $pattern = '/((.*?)\\.){0,' . $amount . '}/isu';
                             preg_match_all($pattern, strip_tags(html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8')), $out);
                             $text = $out[0][0];
                             break;
                         case 'none':
                             $text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8');
                             break;
                     }
                     //$flag_desc
                 }
                 //$comment['text'] != ''
                 if ($text == '') {
                     $text = html_entity_decode($comment['text'], ENT_QUOTES, 'UTF-8');
                 }
                 //$text == ''
                 if ($this->rdate($this->language->get('text_date')) == $this->rdate($this->language->get('text_date'), strtotime($comment['date_added']))) {
                     $date_str = $this->language->get('text_today');
                 } else {
                     $date_str = $this->language->get('text_date');
                 }
                 $date_available = $this->rdate($date_str . $this->language->get('text_hours'), strtotime($comment['date_added']));
                 require_once DIR_SYSTEM . 'library/bbcode.class.php';
                 $text = strip_tags($text);
                 $text = BBCode::parse($text);
                 $this->data['comments'][] = array('comment_id' => $comment['comment_id'], 'parent_id' => $comment['parent_id'], 'blog_id' => $comment['blog_id'], 'blog_name' => $comment['blog_name'], 'blog_href' => $blog_link, 'blog_path' => $blog_href['path'], 'record_id' => $comment['record_id'], 'record_comments' => $comment['record_comments'], 'record_viewed' => $comment['record_viewed'], 'record_name' => $comment['record_name'], 'record_rating' => (int) $comment['rating_avg'], 'record_href' => $record_link, 'customer_id' => $comment['customer_id'], 'author' => $comment['author'], 'text' => $text, 'rating' => (int) $comment['rating'], 'rate_count' => $rate_count, 'rate_delta' => $rate_delta, 'rate_delta_plus' => $rate_delta_plus, 'rate_delta_minus' => $rate_delta_minus, 'date' => $date_available, 'image' => $comment['image'], 'thumb' => $thumb, 'text_category' => $this->data['text_category'], 'text_record' => $this->data['text_record']);
             }
             //$comments as $comment
         }
         //isset($comments) && count($comments) > 0
         $this->cache->set('product.blog.reviews.' . (int) $this->config->get('config_language_id') . '.' . (int) $this->config->get('config_store_id') . '.' . (int) $customer_group_id . '.' . $hash, $this->data);
     } else {
         $this->data = $row;
     }
     return $this->data;
 }
Exemple #6
0
<?php

require '../include/mellivora.inc.php';
login_session_refresh();
head('Home');
if (cache_start('home', CONFIG_CACHE_TIME_HOME)) {
    require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
    $bbc = new BBCode();
    $bbc->SetEnableSmileys(false);
    $news = db_query_fetch_all('SELECT * FROM news ORDER BY added DESC');
    foreach ($news as $item) {
        echo '
        <div class="news-container">';
        section_head($item['title']);
        echo '
            <div class="news-body">
                ', $bbc->parse($item['body']), '
            </div>
        </div>
        ';
    }
    cache_end('home');
}
foot();
Exemple #7
0
 function view()
 {
     global $USER, $LNG;
     $ticketID = HTTP::_GP('id', 0);
     $answerResult = $GLOBALS['DATABASE']->query("SELECT a.*, t.categoryID, t.status FROM " . TICKETS_ANSWER . " a INNER JOIN " . TICKETS . " t USING(ticketID) WHERE a.ticketID = " . $ticketID . " ORDER BY a.answerID;");
     $answerList = array();
     $ticket_status = 0;
     require 'includes/classes/BBCode.class.php';
     while ($answerRow = $GLOBALS['DATABASE']->fetch_array($answerResult)) {
         if (empty($ticket_status)) {
             $ticket_status = $answerRow['status'];
         }
         $answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']);
         $answerRow['message'] = BBCode::parse($answerRow['message']);
         $answerList[$answerRow['answerID']] = $answerRow;
     }
     $GLOBALS['DATABASE']->free_result($answerResult);
     $categoryList = $this->ticketObj->getCategoryList();
     $this->tplObj->assign_vars(array('ticketID' => $ticketID, 'ticket_status' => $ticket_status, 'categoryList' => $categoryList, 'answerList' => $answerList));
     $this->tplObj->show('page.ticket.view.tpl');
 }
function send_email(array $receivers, $subject, $body, array $cc_list = null, array $bcc_list = null, $from_email = CONFIG_EMAIL_FROM_EMAIL, $from_name = CONFIG_EMAIL_FROM_NAME, $replyto_email = CONFIG_EMAIL_REPLYTO_EMAIL, $replyto_name = CONFIG_EMAIL_REPLYTO_NAME, $is_html = false)
{
    $mail = new PHPMailer();
    $mail->IsHTML($is_html);
    $mail->XMailer = ' ';
    $successfully_sent_to = array();
    try {
        if (CONFIG_EMAIL_USE_SMTP) {
            $mail->IsSMTP();
            $mail->SMTPDebug = CONFIG_EMAIL_SMTP_DEBUG_LEVEL;
            $mail->Host = CONFIG_EMAIL_SMTP_HOST;
            $mail->Port = CONFIG_EMAIL_SMTP_PORT;
            $mail->SMTPSecure = CONFIG_EMAIL_SMTP_SECURITY;
            $mail->SMTPAuth = CONFIG_EMAIL_SMTP_AUTH;
            $mail->Username = CONFIG_EMAIL_SMTP_USER;
            $mail->Password = CONFIG_EMAIL_SMTP_PASSWORD;
        }
        $mail->SetFrom($from_email, $from_name);
        if ($replyto_email) {
            $mail->AddReplyTo($replyto_email, $replyto_name);
        }
        // add the "To" receivers
        foreach ($receivers as $receiver) {
            if (!valid_email($receiver)) {
                continue;
            }
            $mail->AddAddress($receiver);
            $successfully_sent_to[] = $receiver;
        }
        if (empty($successfully_sent_to)) {
            message_error('There must be at least one valid "To" receiver of this email');
        }
        // add the "CC" receivers
        if (!empty($cc_list)) {
            foreach ($cc_list as $cc) {
                if (!valid_email($cc)) {
                    continue;
                }
                $mail->AddCC($cc);
                $successfully_sent_to[] = $cc;
            }
        }
        // add the "BCC" receivers
        if (!empty($bcc_list)) {
            foreach ($bcc_list as $bcc) {
                if (!valid_email($bcc)) {
                    continue;
                }
                $mail->AddBCC($bcc);
                $successfully_sent_to[] = $bcc;
            }
        }
        $mail->Subject = $subject;
        // HTML email
        if ($is_html) {
            require CONFIG_PATH_THIRDPARTY . 'nbbc/nbbc.php';
            $bbc = new BBCode();
            $bbc->SetEnableSmileys(false);
            // we assume the email has come to us in BBCode format
            $mail->MsgHTML($bbc->parse($body));
        } else {
            $mail->Body = $body;
        }
    } catch (Exception $e) {
        log_exception($e);
        message_error('Could not send email! An exception has been logged. Please contact ' . (CONFIG_EMAIL_REPLYTO_EMAIL ? CONFIG_EMAIL_REPLYTO_EMAIL : CONFIG_EMAIL_FROM_EMAIL));
    }
    return $successfully_sent_to;
}
Exemple #9
0
 private function signer($record_id, $record_info)
 {
     $record_settings = unserialize($record_info['comment']);
     if (isset($record_settings['signer']) && $record_settings['signer']) {
         $this->data['record_id'] = $record_id;
         $this->data['record_info'] = $record_info;
         $this->getChild('common/seoblog');
         $this->data['record_info']['link'] = $this->url->link('record/record', '&record_id=' . $this->data['record_id']);
         $this->language->load('agoo/signer/signer');
         $this->data['login'] = $this->customer->getFirstName() . " " . $this->customer->getLastName();
         $this->data['customer_id'] = $this->customer->getId();
         if (isset($this->request->server['HTTPS']) && ($this->request->server['HTTPS'] == 'on' || $this->request->server['HTTPS'] == '1')) {
             $server = $this->config->get('config_ssl');
         } else {
             $server = $this->config->get('config_url');
         }
         if ($this->config->get('config_logo') && file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
             $this->data['logo'] = $server . 'image/' . $this->config->get('config_logo');
         } else {
             $this->data['logo'] = false;
         }
         $this->load->model('agoo/signer/signer');
         $record_signers = $this->model_agoo_signer_signer->getStatusId($this->data['record_id'], 'record_id');
         if ($record_signers) {
             foreach ($record_signers as $par => $singers) {
                 $template = '/template/module/blog_signer_mail.tpl';
                 if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . $template)) {
                     $this->template = $this->config->get('config_template') . $template;
                 } else {
                     $this->template = 'default' . $template;
                 }
                 $this->data['theme'] = $this->config->get('config_template');
                 require_once DIR_SYSTEM . 'library/bbcode.class.php';
                 $this->request->post['text'] = strip_tags($this->request->post['text']);
                 $text = BBCode::parse($this->request->post['text']);
                 if ($this->rdate($this->language->get('text_date')) == $this->rdate($this->language->get('text_date'), strtotime(date('Y-m-d H:i:s')))) {
                     $date_str = $this->language->get('text_today');
                 } else {
                     $date_str = $this->language->get('text_date');
                 }
                 $date_added = $this->rdate($date_str . $this->language->get('text_hours'), strtotime(date('Y-m-d H:i:s')));
                 $customer = $this->model_agoo_signer_signer->getCustomer($singers['customer_id']);
                 foreach ($this->request->post as $comment) {
                     $this->data['data'] = array('text' => $text, 'comment' => $this->request->post, 'record' => $this->data['record_info'], 'date' => $date_added, 'shop' => $this->config->get('config_name'), 'signers' => serialize($singers), 'signer_customer' => $customer);
                 }
                 //$this->request->post as $comment
                 $html = $this->render();
                 $message = $html;
                 $subject = sprintf($this->language->get('text_subject'), $this->config->get('config_name'));
                 if ($singers['customer_id'] != $this->data['customer_id']) {
                     $mail = new Mail();
                     $mail->protocol = $this->config->get('config_mail_protocol');
                     $mail->parameter = $this->config->get('config_mail_parameter');
                     $mail->hostname = $this->config->get('config_smtp_host');
                     $mail->username = $this->config->get('config_smtp_username');
                     $mail->password = $this->config->get('config_smtp_password');
                     $mail->port = $this->config->get('config_smtp_port');
                     $mail->timeout = $this->config->get('config_smtp_timeout');
                     $mail->setTo($customer['email']);
                     $mail->setFrom($this->config->get('config_email'));
                     $mail->setSender($this->config->get('config_name'));
                     $mail->setSubject(html_entity_decode($subject, ENT_QUOTES, 'UTF-8'));
                     $mail->setHtml(html_entity_decode($message, ENT_QUOTES, 'UTF-8'));
                     $mail->send();
                 }
                 //$singers['customer_id'] != $this->data['customer_id']
             }
             //$record_signers as $par => $singers
         }
         //$record_signers
     }
     //isset($record_settings['signer']) && $record_settings['signer']
 }
Exemple #10
0
 public function parseBBCode($text)
 {
     require_once SPINDASH_TEXTPROC . 'bbcode.inc.php';
     $bbcode = new BBCode($this);
     return $bbcode->parse($text);
 }
<?php 
if (!$published || !empty($revision) || !empty($preview)) {
    ?>
<br /><br />
<blockquote>
<strong>Description:</strong><br />
<?php 
    echo $description;
    ?>
</blockquote>
<?php 
}
?>
	
	<p><?php 
echo BBCode::parse($body);
?>
</p>

<?php 
if (!empty($mlt)) {
    ?>
    <p><h4>More Like This:</h4>
<?php 
    foreach ($mlt as $fetched) {
        echo '<a href="' . Url::format('article/view/' . Id::create($fetched, 'news')) . '">' . $fetched['title'] . '</a><br />';
    }
    ?>
</p>
<?php 
}
Exemple #12
0
    ?>
)</em>
<table class="table table-bordered">
	<tbody>
	<tr>
		<th style="width: 10%">Title</th>
		<td><span><?php 
    echo $bug['title'];
    ?>
</span></td>
	</tr>
	<tr>
		<th>Description</th>
		<td><p><?php 
    echo BBCode::parse($bug['description'], '#');
    ?>
</p></td>
	</tr>
	<tr>
		<th>Steps to Reproduce</th>
		<td><p><?php 
    echo BBCode::parse($bug['reproduction'], '#');
    ?>
</p></td>
	</tr>
	</tbody>
</table>
<hr />
<?php 
    echo Partial::render('comment', array('id' => $bug['_id'], 'page' => $commentPage, 'pageLoc' => $commentPageLoc));
}
    protected function adminDetailApply()
    {
        global $LNG, $USER;
        if (!$this->rights['SEEAPPLY'] || !$this->rights['MANAGEAPPLY']) {
            $this->redirectToHome();
        }
        $id = HTTP::_GP('id', 0);
        $db = Database::get();
        $sql = 'SELECT
			r.`applyID`,
			r.`time`,
			r.`text`,
			u.`username`,
			u.`register_time`,
			u.`onlinetime`,
			u.`galaxy`,
			u.`system`,
			u.`planet`,
			CONCAT_WS(\':\', u.`galaxy`, u.`system`, u.`planet`) AS `coordinates`,
			@total_fights := u.`wons` + u.`loos` + u.`draws`,
			@total_fights_percentage := @total_fights / 100,
			@total_fights AS `total_fights`,
			u.`wons`,
			ROUND(u.`wons` / @total_fights_percentage, 2) AS `wons_percentage`,
			u.`loos`,
			ROUND(u.`loos` / @total_fights_percentage, 2) AS `loos_percentage`,
			u.`draws`,
			ROUND(u.`draws` / @total_fights_percentage, 2) AS `draws_percentage`,
			u.`kbmetal`,
			u.`kbcrystal`,
			u.`lostunits`,
			u.`desunits`,
			stat.`tech_rank`,
			stat.`tech_points`,
			stat.`build_rank`,
			stat.`build_points`,
			stat.`defs_rank`,
			stat.`defs_points`,
			stat.`fleet_rank`,
			stat.`fleet_points`,
			stat.`total_rank`,
			stat.`total_points`,
			p.`name`
		FROM
			%%ALLIANCE_REQUEST%% AS r
		LEFT JOIN
			%%USERS%% AS u ON r.userId = u.id
		INNER JOIN
			%%STATPOINTS%% AS stat
		LEFT JOIN
			%%PLANETS%% AS p ON p.id = u.id_planet
		WHERE
			applyID = :applyID;';
        $applyDetail = $db->selectSingle($sql, array(':applyID' => $id));
        if (empty($applyDetail)) {
            $this->printMessage($LNG['al_apply_not_exists'], array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=alliance&mode=admin&action=mangeApply')));
        }
        require 'includes/classes/BBCode.class.php';
        $applyDetail['text'] = BBCode::parse($applyDetail['text']);
        $applyDetail['kbmetal'] = pretty_number($applyDetail['kbmetal']);
        $applyDetail['kbcrystal'] = pretty_number($applyDetail['kbcrystal']);
        $applyDetail['lostunits'] = pretty_number($applyDetail['lostunits']);
        $applyDetail['desunits'] = pretty_number($applyDetail['desunits']);
        $this->assign(array('applyDetail' => $applyDetail, 'apply_time' => _date($LNG['php_tdformat'], $applyDetail['time'], $USER['timezone']), 'register_time' => _date($LNG['php_tdformat'], $applyDetail['register_time'], $USER['timezone']), 'onlinetime' => _date($LNG['php_tdformat'], $applyDetail['onlinetime'], $USER['timezone'])));
        $this->display('page.alliance.admin.detailApply.tpl');
    }
?>
</h1>
    <small>By <?php 
echo $lecturer;
$access = array();
if (CheckAcl::can('editLectures')) {
    array_push($access, '<a href="' . Url::format('lecture/edit/' . $_id) . '">Edit</a>');
}
if (CheckAcl::can('deleteLectures')) {
    array_push($access, '<a href="' . Url::format('lecture/delete/' . $_id) . '">Delete</a>');
}
if (!empty($access)) {
    echo ' - ' . implode(' - ', $access);
}
?>
</small>

    <p><?php 
echo BBCode::parse($description);
?>
</p>
    <em><?php 
echo Date::minuteFormat($time);
?>
 to 
    <?php 
echo Date::minuteFormat($time + $duration);
?>
</em>
</div>
Exemple #15
0
 public function Post()
 {
     if (!$this->isLoggedIn) {
         return;
     }
     if ($this->session->accept_token != REQUEST_TOKEN) {
         Request::redirect(HOST . 'login');
         return;
     }
     $content = stripslashes(Request::post(false)->content);
     #Faz a validação do HTML; HTMLPurifier <3
     require_once EXTENSIONS_DIR . 'HTMLPurifier/HTMLPurifier.includes.php';
     $config = HTMLPurifier_Config::createDefault();
     $config->set('Cache.DefinitionImpl', null);
     $config->set('HTML.TargetBlank', true);
     $config->set('HTML.SafeObject', true);
     $config->set('HTML.SafeEmbed', true);
     $config->set('HTML.SafeIframe', true);
     $config->set('Output.FlashCompat', true);
     $config->set('HTML.FlashAllowFullScreen', true);
     $config->set('HTML.Allowed', 'i, b, a[href], p, ul, ol, li, span[style], img[src|style], strike, br, hr, blockquote, div, object, param[name|value], embed[src|type|width|height|allowscriptaccess], iframe[src|width|height]');
     $config->set('CSS.AllowedProperties', 'color, float, height, width, margin, border');
     $config->set('AutoFormat.Linkify', true);
     $config->set('URI.MungeResources', true);
     $config->set('URI.SafeIframeRegexp', '#^https://((www.)?youtube.com/embed/|player.vimeo.com/video/)#');
     $HTMLPurifier = new HTMLPurifier($config);
     $content = $HTMLPurifier->purify($content);
     $content = preg_replace('/(?<=^|\\s|>)@([A-Za-z0-9_]{1,20})/', '<a class="profile-link" href="' . HOST . 'perfil/$1" data-login="******">@$1</a>', $content);
     $bbCodeTags = array('spoiler' => array('<div class="spoiler-alert"><span class="alert"><b>SPOILER ALERT!</b> <a href="javascript:void(0);">Clique aqui</a> para exibir.</span><span class="spoiler-content">', '<span></div>'));
     $content = BBCode::parse($content, $bbCodeTags);
     Phalanx::loadClasses('Profile', 'Badges', 'PostCategory');
     $m = Model::Factory('posts');
     $m->user_id = $this->session->user->id;
     if (trim($this->post->title) != "") {
         $m->title = $this->post->title;
     }
     $m->content = $content;
     $m->public = $this->post->post_privacy;
     $m->date = date('Y-m-d H:i:s');
     $m->like_count = 0;
     $m->dislike_count = 0;
     $m->comment_count = 0;
     $post_id = $m->insert();
     if (isset($this->post->categories)) {
         $categories = explode(",", $this->post->categories);
         foreach ($categories as $category) {
             $category = trim($category);
             $categoryID = PostCategory::get($category);
             $m = Model::Factory('posts_has_category');
             $m->posts_id = $post_id;
             $m->category_id = $categoryID;
             $m->insert();
         }
     }
     $view = new Views();
     $view->title = $this->post->title;
     $view->content = $content;
     $view->user = $this->session->user->login;
     $view->avatar = $this->session->user->other_data->avatar;
     $view->when = ' agora';
     $view->post_id = $post_id;
     $view->rating = new stdClass();
     $view->rating->whatever = 0;
     $view->rating->megaboga = 0;
     $view->my_rating = null;
     $view->its_mine = true;
     $view->experience = Profile::experience($this->session->user->id);
     $view->badges = Badges::from_user($this->session->user->id, 4);
     preg_match_all('/(?<=|(?<=[.A-Za-z0-9_-]))@([.A-Za-z0-9_-]+[.A-Za-z0-9_-]+)/', $this->post->content, $usernames);
     foreach ($usernames[1] as $username) {
         $user = Profile::get_user_info($username);
         if ($user) {
             $n = new Notification(Notification::TAGGED_IN_A_POST, $this->session->user->id, $post_id, $user->id);
         }
     }
     if ($this->post->post_to_twitter == 1 or $this->post->post_to_facebook == 1) {
         $o = new stdClass();
         $o->title = $this->post->title;
         $o->url = HOST . 'perfil/' . $this->session->user->login . '/post/' . $post_id . '-' . mb_strtolower(preg_replace('/--+/u', '-', preg_replace('/[^\\w\\-]+/u', '-', $this->post->title)));
         $o->uid = $this->session->user->id;
         $o->content = strip_tags($content);
         $o->avatar = MEDIA_DIR . 'images/avatar/big/' . $this->session->user->other_data->avatar;
         $o->post_id = $post_id;
         try {
             if ($this->post->post_to_facebook == 1) {
                 Phalanx::loadController('FacebookController');
                 $facebook = new FacebookController();
                 $facebook->callOpenGraphAction('write', array('article_' => $o->url));
             }
             if ($this->post->post_to_twitter == 1) {
                 Phalanx::loadController('TwitterController');
                 $twitter = new TwitterController();
                 $twitter->sharePost($o);
             }
         } catch (Exception $e) {
         }
     }
     header("Content-type: text/html; charset=utf-8");
     echo $view->render("post_body.phtml");
 }
     echo '
     <div class="challenge-description">
         ', $challenge['description'], '
     </div> <!-- / challenge-description -->';
 }
 if ($_GET['BAlert'] == "1") {
     echo '<script>window.onload = function(){bootbox.alert("You do not enough points to perform that transaction.");}</script>';
 }
 // only show the hints and flag submission form if we're not already correct and if the challenge hasn't expired
 if (!$challenge['correct_submission_added'] && $time < $challenge['available_until']) {
     // write out hints
     if (cache_start('hints_challenge_' . $challenge['id'], CONFIG_CACHE_TIME_HINTS)) {
         $hints = db_select_all('hints', array('*'), array('visible' => 1, 'challenge' => $challenge['id']));
         foreach ($hints as $hint) {
             if ($hint['value'] == 0) {
                 message_inline_yellow('<strong>Hint!</strong> ' . $bbc->parse($hint['body']), false);
             } else {
                 $hint1 = db_select_one('purchases', array('*'), array('hid' => $hint['id'], 'uid' => $_SESSION['id']));
                 if ($hint1['value'] > 0) {
                     message_inline_yellow('<strong>Hint!</strong> ' . $bbc->parse($hint['body']), false);
                 } else {
                     echo '<p><a href="actions/hints.php?action=purchase&id=' . $hint['id'] . '" class="btn btn-xs btn-info">Purchase hint</a><strong> [This hint is available for purchase at ' . $hint['value'] . ' points.]</strong></p>';
                 }
             }
         }
         cache_end('hints_challenge_' . $challenge['id']);
     }
     if ($remaining_submissions) {
         if ($challenge['num_submissions'] && !$challenge['automark'] && $challenge['marked']) {
             message_inline_blue('Your submission is awaiting manual marking.');
         }
 function view()
 {
     global $USER, $LNG;
     require 'includes/classes/BBCode.class.php';
     $db = Database::get();
     $ticketID = HTTP::_GP('id', 0);
     $sql = "SELECT a.*, t.categoryID, t.status FROM %%TICKETS_ANSWER%% a INNER JOIN %%TICKETS%% t USING(ticketID) WHERE a.ticketID = :ticketID ORDER BY a.answerID;";
     $answerResult = $db->select($sql, array(':ticketID' => $ticketID));
     $answerList = array();
     if (empty($answerResult)) {
         $this->printMessage(sprintf($LNG['ti_not_exist'], $ticketID), array(array('label' => $LNG['sys_back'], 'url' => 'game.php?page=ticket')));
     }
     $ticket_status = 0;
     foreach ($answerResult as $answerRow) {
         $answerRow['time'] = _date($LNG['php_tdformat'], $answerRow['time'], $USER['timezone']);
         $answerRow['message'] = BBCode::parse($answerRow['message']);
         $answerList[$answerRow['answerID']] = $answerRow;
         if (empty($ticket_status)) {
             $ticket_status = $answerRow['status'];
         }
     }
     $categoryList = $this->ticketObj->getCategoryList();
     $this->assign(array('ticketID' => $ticketID, 'categoryList' => $categoryList, 'answerList' => $answerList, 'status' => $ticket_status));
     $this->display('page.ticket.view.tpl');
 }
Exemple #18
0
function ShowAccountDataPage()
{
    global $USER, $reslist, $resource, $LNG;
    $template = new template();
    $id_u = HTTP::_GP('id_u', 0);
    if (!empty($id_u)) {
        $OnlyQueryLogin = $GLOBALS['DATABASE']->getFirstRow("SELECT `id`, `authlevel` FROM " . USERS . " WHERE `id` = '" . $id_u . "' AND `universe` = '" . Universe::getEmulated() . "';");
        if (!isset($OnlyQueryLogin)) {
            $template->message($LNG['ac_username_doesnt'], '?page=accoutdata');
        } else {
            foreach (array_merge($reslist['officier'], $reslist['tech']) as $ID) {
                $SpecifyItemsUQ .= "u.`" . $resource[$ID] . "`,";
            }
            // COMIENZA SAQUEO DE DATOS DE LA TABLA DE USUARIOS
            $SpecifyItemsU = "u.id,u.username,u.email,u.email_2,u.authlevel,u.id_planet,u.galaxy,u.system,u.planet,u.user_lastip,u.ip_at_reg,u.darkmatter,u.register_time,u.onlinetime,u.urlaubs_modus,u.\n\t\t\t urlaubs_until,u.ally_id,a.ally_name," . $SpecifyItemsUQ . "\n\t\t\t u.ally_register_time,u.ally_rank_id,u.bana,u.banaday";
            $UserQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsU . " FROM " . USERS . " as u LEFT JOIN " . ALLIANCE . " a ON a.id = u.ally_id WHERE u.`id` = '" . $id_u . "';");
            $reg_time = _date($LNG['php_tdformat'], $UserQuery['register_time'], $USER['timezone']);
            $onlinetime = _date($LNG['php_tdformat'], $UserQuery['onlinetime'], $USER['timezone']);
            $id = $UserQuery['id'];
            $nombre = $UserQuery['username'];
            $email_1 = $UserQuery['email'];
            $email_2 = $UserQuery['email_2'];
            $ip = $UserQuery['ip_at_reg'];
            $ip2 = $UserQuery['user_lastip'];
            $id_p = $UserQuery['id_planet'];
            $g = $UserQuery['galaxy'];
            $s = $UserQuery['system'];
            $p = $UserQuery['planet'];
            $info = $UserQuery['user_ua'];
            $alianza = $UserQuery['ally_name'];
            $nivel = $LNG['rank'][$UserQuery['authlevel']];
            $vacas = $LNG['one_is_yes'][$UserQuery['urlaubs_modus']];
            $suspen = $LNG['one_is_yes'][$UserQuery['bana']];
            $mo = "<a title=\"" . pretty_number($UserQuery['darkmatter']) . "\">" . shortly_number($UserQuery['darkmatter']) . "</a>";
            foreach ($reslist['officier'] as $ID) {
                $officier[] = $ID;
            }
            foreach ($reslist['tech'] as $ID) {
                $techno[] = $ID;
            }
            $techoffi = "";
            for ($i = 0; $i < max(count($reslist['officier']), count($reslist['tech'])); $i++) {
                $techoffi .= isset($techno[$i]) ? "<tr><td>" . $LNG['tech'][$techno[$i]] . ": <font color=aqua>" . $UserQuery[$resource[$techno[$i]]] . "</font></td>" : "<tr><td>&nbsp;</td>";
                $techoffi .= isset($officier[$i]) ? "<td>" . $LNG['tech'][$officier[$i]] . ": <font color=aqua>" . $UserQuery[$resource[$officier[$i]]] . "</font></td></tr>" : "<td>&nbsp;</td></tr>";
            }
            if ($UserQuery['bana'] != 0) {
                $mas = '<a ref="#" onclick="$(\'#banned\').slideToggle();return false"> ' . $LNG['ac_more'] . '</a>';
                $BannedQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT theme,time,longer,author FROM " . BANNED . " WHERE `who` = '" . $UserQuery['username'] . "';");
                $sus_longer = _date($LNG['php_tdformat'], $BannedQuery['longer'], $USER['timezone']);
                $sus_time = _date($LNG['php_tdformat'], $BannedQuery['time'], $USER['timezone']);
                $sus_reason = $BannedQuery['theme'];
                $sus_author = $BannedQuery['author'];
            }
            // COMIENZA EL SAQUEO DE DATOS DE LA TABLA DE PUNTAJE
            $SpecifyItemsS = "tech_count,defs_count,fleet_count,build_count,build_points,tech_points,defs_points,fleet_points,tech_rank,build_rank,defs_rank,fleet_rank,total_points,\n\t\t\tstat_type";
            $StatQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsS . " FROM " . STATPOINTS . " WHERE `id_owner` = '" . $id_u . "' AND `stat_type` = '1';");
            $count_tecno = pretty_number($StatQuery['tech_count']);
            $count_def = pretty_number($StatQuery['defs_count']);
            $count_fleet = pretty_number($StatQuery['fleet_count']);
            $count_builds = pretty_number($StatQuery['build_count']);
            $point_builds = pretty_number($StatQuery['build_points']);
            $point_tecno = pretty_number($StatQuery['tech_points']);
            $point_def = pretty_number($StatQuery['defs_points']);
            $point_fleet = pretty_number($StatQuery['fleet_points']);
            $ranking_tecno = $StatQuery['tech_rank'];
            $ranking_builds = $StatQuery['build_rank'];
            $ranking_def = $StatQuery['defs_rank'];
            $ranking_fleet = $StatQuery['fleet_rank'];
            $total_points = pretty_number($StatQuery['total_points']);
            // COMIENZA EL SAQUEO DE DATOS DE LA ALIANZA
            $AliID = $UserQuery['ally_id'];
            if ($alianza == 0 && $AliID == 0) {
                $alianza = $LNG['ac_no_ally'];
                $AllianceHave = "<span class=\"no_moon\"><img src=\"./styles/resource/images/admin/arrowright.png\" width=\"16\" height=\"10\"/> \n\t\t\t\t\t\t\t" . $LNG['ac_alliance'] . "&nbsp;" . $LNG['ac_no_alliance'] . "</span>";
            } elseif ($alianza != NULL && $AliID != 0) {
                include_once 'includes/classes/BBCode.class.php';
                $AllianceHave = '<a href="#" onclick="$(\'#alianza\').slideToggle();return false" class="link">
							<img src="./styles/resource/images/admin/arrowright.png" width="16" height="10"> ' . $LNG['ac_alliance'] . '</a>';
                $SpecifyItemsA = "ally_owner,id,ally_tag,ally_name,ally_web,ally_description,ally_text,ally_request,ally_image,ally_members,ally_register_time";
                $AllianceQuery = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsA . " FROM " . ALLIANCE . " WHERE `ally_name` = '" . $alianza . "';");
                $alianza = $alianza;
                $id_ali = " (" . $LNG['ac_ali_idid'] . "&nbsp;" . $AliID . ")";
                $id_aliz = $AllianceQuery['id'];
                $tag = $AllianceQuery['ally_tag'];
                $ali_nom = $AllianceQuery['ally_name'];
                $ali_cant = $AllianceQuery['ally_members'];
                $ally_register_time = _date($LNG['php_tdformat'], $AllianceQuery['ally_register_time'], $USER['timezone']);
                $ali_lider = $AllianceQuery['ally_owner'];
                $ali_web = $AllianceQuery['ally_web'] != NULL ? "<a href=" . $AllianceQuery['ally_web'] . " target=_blank>" . $AllianceQuery['ally_web'] . "</a>" : $LNG['ac_no_web'];
                if ($AllianceQuery['ally_description'] != NULL) {
                    $ali_ext2 = BBCode::parse($AllianceQuery['ally_description']);
                    $ali_ext = "<a href=\"#\" rel=\"toggle[externo]\">" . $LNG['ac_view_text_ext'] . "</a>";
                } else {
                    $ali_ext = $LNG['ac_no_text_ext'];
                }
                if ($AllianceQuery['ally_text'] != NULL) {
                    $ali_int2 = BBCode::parse($AllianceQuery['ally_text']);
                    $ali_int = "<a href=\"#\" rel=\"toggle[interno]\">" . $LNG['ac_view_text_int'] . "</a>";
                } else {
                    $ali_int = $LNG['ac_no_text_int'];
                }
                if ($AllianceQuery['ally_request'] != NULL) {
                    $ali_sol2 = BBCode::parse($AllianceQuery['ally_request']);
                    $ali_sol = "<a href=\"#\" rel=\"toggle[solicitud]\">" . $LNG['ac_view_text_sol'] . "</a>";
                } else {
                    $ali_sol = $LNG['ac_no_text_sol'];
                }
                if ($AllianceQuery['ally_image'] != NULL) {
                    $ali_logo2 = $AllianceQuery['ally_image'];
                    $ali_logo = "<a href=\"#\" rel=\"toggle[imagen]\">" . $LNG['ac_view_image2'] . "</a>";
                } else {
                    $ali_logo = $LNG['ac_no_img'];
                }
                $SearchLeader = $GLOBALS['DATABASE']->getFirstRow("SELECT `username` FROM " . USERS . " WHERE `id` = '" . $ali_lider . "';");
                $ali_lider = $SearchLeader['username'];
                $StatQueryAlly = $GLOBALS['DATABASE']->getFirstRow("SELECT " . $SpecifyItemsS . " FROM " . STATPOINTS . " WHERE `id_owner` = '" . $ali_lider . "' AND `stat_type` = '2';");
                $count_tecno_ali = pretty_number($StatQueryAlly['tech_count']);
                $count_def_ali = pretty_number($StatQueryAlly['defs_count']);
                $count_fleet_ali = pretty_number($StatQueryAlly['fleet_count']);
                $count_builds_ali = pretty_number($StatQueryAlly['build_count']);
                $point_builds_ali = pretty_number($StatQueryAlly['build_points']);
                $point_tecno_ali = pretty_number($StatQueryAlly['tech_points']);
                $point_def_ali = pretty_number($StatQueryAlly['defs_points']);
                $point_fleet_ali = pretty_number($StatQueryAlly['fleet_points']);
                $ranking_tecno_ali = pretty_number($StatQueryAlly['tech_rank']);
                $ranking_builds_ali = pretty_number($StatQueryAlly['build_rank']);
                $ranking_def_ali = pretty_number($StatQueryAlly['defs_rank']);
                $ranking_fleet_ali = pretty_number($StatQueryAlly['fleet_rank']);
                $total_points_ali = pretty_number($StatQueryAlly['total_points']);
            }
            foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) {
                $SpecifyItemsPQ .= "`" . $resource[$ID] . "`,";
                $RES[$resource[$ID]] = "<tr><td width=\"150\">" . $LNG['tech'][$ID] . "</td>";
            }
            $names = "<tr><th class=\"center\" width=\"150\">&nbsp;</th>";
            // COMIENZA EL SAQUEO DE DATOS DE LOS PLANETAS
            $SpecifyItemsP = "planet_type,id,name,galaxy,system,planet,destruyed,diameter,field_current,field_max,temp_min,temp_max,metal,crystal,deuterium,energy," . $SpecifyItemsPQ . "energy_used";
            $PlanetsQuery = $GLOBALS['DATABASE']->query("SELECT " . $SpecifyItemsP . " FROM " . PLANETS . " WHERE `id_owner` = '" . $id_u . "';");
            while ($PlanetsWhile = $GLOBALS['DATABASE']->fetch_array($PlanetsQuery)) {
                if ($PlanetsWhile['planet_type'] == 3) {
                    $Planettt = $PlanetsWhile['name'] . "&nbsp;(" . $LNG['ac_moon'] . ")<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>";
                    $MoonZ = 0;
                    $Moons = $PlanetsWhile['name'] . "&nbsp;(" . $LNG['ac_moon'] . ")<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>";
                    $MoonZ++;
                } else {
                    $Planettt = $PlanetsWhile['name'] . "<br><font color=aqua>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</font>";
                }
                if ($PlanetsWhile["destruyed"] == 0) {
                    $planets_moons .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $Planettt . "</td>\n\t\t\t\t\t\t<td>" . $PlanetsWhile['id'] . "</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['diameter']) . "</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['field_current']) . " / " . pretty_number(CalculateMaxPlanetFields($PlanetsWhile)) . " (" . pretty_number($PlanetsWhile['field_current']) . " / " . pretty_number($PlanetsWhile['field_max']) . ")</td>\n\t\t\t\t\t\t<td>" . pretty_number($PlanetsWhile['temp_min']) . " / " . pretty_number($PlanetsWhile['temp_max']) . "</td>" . (allowedTo('ShowQuickEditorPage') ? "<td><a href=\"javascript:openEdit('" . $PlanetsWhile['id'] . "', 'planet');\" border=\"0\"><img src=\"./styles/resource/images/admin/GO.png\" title=" . $LNG['se_search_edit'] . "></a></td>" : "") . "</tr>";
                    $SumOfEnergy = $PlanetsWhile['energy'] + $PlanetsWhile['energy_used'];
                    if ($SumOfEnergy < 0) {
                        $Color = "<font color=#FF6600>" . shortly_number($SumOfEnergy) . "</font>";
                    } elseif ($SumOfEnergy > 0) {
                        $Color = "<font color=lime>" . shortly_number($SumOfEnergy) . "</font>";
                    } else {
                        $Color = shortly_number($SumOfEnergy);
                    }
                    $resources .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $Planettt . "</td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['metal']) . "\">" . shortly_number($PlanetsWhile['metal']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['crystal']) . "\">" . shortly_number($PlanetsWhile['crystal']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($PlanetsWhile['deuterium']) . "\">" . shortly_number($PlanetsWhile['deuterium']) . "</a></td>\n\t\t\t\t\t\t<td><a title=\"" . pretty_number($SumOfEnergy) . "\">" . $Color . "</a>/<a title=\"" . pretty_number($PlanetsWhile['energy']) . "\">" . shortly_number($PlanetsWhile['energy']) . "</a></td>\n\t\t\t\t\t</tr>";
                    $names .= "<th class=\"center\" width=\"60\">" . $Planettt . "</th>";
                    foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) {
                        $RES[$resource[$ID]] .= "<td width=\"60\"><a title=\"" . pretty_number($PlanetsWhile[$resource[$ID]]) . "\">" . shortly_number($PlanetsWhile[$resource[$ID]]) . "</a></td>";
                    }
                    $MoonHave = $MoonZ != 0 ? '<a href="#" onclick="$(\'#especiales\').slideToggle();return false" class="link"><img src="./styles/resource/images/admin/arrowright.png" width="16" height="10"/> ' . $LNG['moon_build'] . "</a>" : "<span class=\"no_moon\"><img src=\"./styles/resource/images/admin/arrowright.png\" width=\"16\" height=\"10\"/>" . $LNG['moon_build'] . "&nbsp;" . $LNG['ac_moons_no'] . "</span>";
                }
                $DestruyeD = 0;
                if ($PlanetsWhile["destruyed"] > 0) {
                    $destroyed .= "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td>" . $PlanetsWhile['name'] . "</td>\n\t\t\t\t\t\t\t<td>" . $PlanetsWhile['id'] . "</td>\n\t\t\t\t\t\t\t<td>[" . $PlanetsWhile['galaxy'] . ":" . $PlanetsWhile['system'] . ":" . $PlanetsWhile['planet'] . "]</td>\n\t\t\t\t\t\t\t<td>" . date("d-m-Y   H:i:s", $PlanetsWhile['destruyed']) . "</td>\n\t\t\t\t\t\t</tr>";
                    $DestruyeD++;
                }
            }
            $names .= "</tr>";
            foreach (array_merge($reslist['fleet'], $reslist['build'], $reslist['defense']) as $ID) {
                $RES[$resource[$ID]] .= "</tr>";
            }
            foreach ($reslist['build'] as $ID) {
                $build .= $RES[$resource[$ID]];
            }
            foreach ($reslist['fleet'] as $ID) {
                $fleet .= $RES[$resource[$ID]];
            }
            foreach ($reslist['defense'] as $ID) {
                $defense .= $RES[$resource[$ID]];
            }
            $template->assign_vars(array('DestruyeD' => $DestruyeD, 'destroyed' => $destroyed, 'resources' => $resources, 'mo' => $mo, 'names' => $names, 'build' => $build, 'fleet' => $fleet, 'defense' => $defense, 'planets_moons' => $planets_moons, 'ali_lider' => $ali_lider, 'AllianceHave' => $AllianceHave, 'point_tecno' => $point_tecno, 'count_tecno' => $count_tecno, 'ranking_tecno' => $ranking_tecno, 'defenses_title' => $defenses_title, 'point_def' => $point_def, 'count_def' => $count_def, 'ranking_def' => $ranking_def, 'point_fleet' => $point_fleet, 'count_fleet' => $count_fleet, 'ranking_fleet' => $ranking_fleet, 'point_builds' => $point_builds, 'count_builds' => $count_builds, 'ranking_builds' => $ranking_builds, 'total_points' => $total_points, 'point_tecno_ali' => $point_tecno_ali, 'count_tecno_ali' => $count_tecno_ali, 'ranking_tecno_ali' => $ranking_tecno_ali, 'point_def_ali' => $point_def_ali, 'count_def_ali' => $count_def_ali, 'ranking_def_ali' => $ranking_def_ali, 'point_fleet_ali' => $point_fleet_ali, 'count_fleet_ali' => $count_fleet_ali, 'ranking_fleet_ali' => $ranking_fleet_ali, 'point_builds_ali' => $point_builds_ali, 'count_builds_ali' => $count_builds_ali, 'ranking_builds_ali' => $ranking_builds_ali, 'total_points_ali' => $total_points_ali, 'input_id' => $input_id, 'id_aliz' => $id_aliz, 'tag' => $tag, 'ali_nom' => $ali_nom, 'ali_ext' => $ali_ext, 'ali_ext' => $ali_ext2, 'ali_int' => $ali_int, 'ali_int' => $ali_int2, 'ali_sol2' => $ali_sol2, 'ali_sol' => $ali_sol, 'ali_logo' => $ali_logo, 'ali_logo2' => $ali_logo2, 'ali_web' => $ali_web, 'ally_register_time' => $ally_register_time, 'ali_cant' => $ali_cant, 'alianza' => $alianza, 'input_id' => $input_id, 'id' => $id, 'nombre' => $nombre, 'nivel' => $nivel, 'vacas' => $vacas, 'suspen' => $suspen, 'mas' => $mas, 'id_ali' => $id_ali, 'ip' => $ip, 'ip2' => $ip2, 'ipcheck' => true, 'reg_time' => $reg_time, 'onlinetime' => $onlinetime, 'id_p' => $id_p, 'g' => $g, 's' => $s, 'p' => $p, 'info' => $info, 'email_1' => $email_1, 'email_2' => $email_2, 'sus_time' => $sus_time, 'sus_longer' => $sus_longer, 'sus_reason' => $sus_reason, 'sus_author' => $sus_author, 'techoffi' => $techoffi, 'canedit' => allowedTo('ShowQuickEditorPage'), 'buildings_title' => $LNG['buildings_title'], 'buildings_title' => $LNG['buildings_title'], 'researchs_title	' => $LNG['researchs_title'], 'ships_title' => $LNG['ships_title'], 'defenses_title' => $LNG['defenses_title'], 'ac_recent_destroyed_planets' => $LNG['ac_recent_destroyed_planets'], 'ac_isnodestruyed' => $LNG['ac_isnodestruyed'], 'ac_note_k' => $LNG['ac_note_k'], 'ac_leyend' => $LNG['ac_leyend'], 'ac_account_data' => $LNG['ac_account_data'], 'ac_name' => $LNG['ac_name'], 'ac_mail' => $LNG['ac_mail'], 'ac_perm_mail' => $LNG['ac_perm_mail'], 'ac_auth_level' => $LNG['ac_auth_level'], 'ac_on_vacation' => $LNG['ac_on_vacation'], 'ac_banned' => $LNG['ac_banned'], 'ac_alliance' => $LNG['ac_alliance'], 'ac_reg_ip' => $LNG['ac_reg_ip'], 'ac_last_ip' => $LNG['ac_last_ip'], 'ac_checkip_title' => $LNG['ac_checkip_title'], 'ac_register_time' => $LNG['ac_register_time'], 'ac_act_time' => $LNG['ac_act_time'], 'ac_home_planet_id' => $LNG['ac_home_planet_id'], 'ac_home_planet_coord' => $LNG['ac_home_planet_coord'], 'ac_user_system' => $LNG['ac_user_system'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_see_ranking' => $LNG['ac_see_ranking'], 'ac_user_ranking' => $LNG['ac_user_ranking'], 'ac_points_count' => $LNG['ac_points_count'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_total_points' => $LNG['ac_total_points'], 'ac_suspended_title' => $LNG['ac_suspended_title'], 'ac_suspended_time' => $LNG['ac_suspended_time'], 'ac_suspended_longer' => $LNG['ac_suspended_longer'], 'ac_suspended_reason' => $LNG['ac_suspended_reason'], 'ac_suspended_autor' => $LNG['ac_suspended_autor'], 'ac_info_ally' => $LNG['ac_info_ally'], 'ac_leader' => $LNG['ac_leader'], 'ac_tag' => $LNG['ac_tag'], 'ac_name_ali' => $LNG['ac_name_ali'], 'ac_ext_text		' => $LNG['ac_ext_text'], 'ac_int_text' => $LNG['ac_int_text'], 'ac_sol_text' => $LNG['ac_sol_text'], 'ac_image' => $LNG['ac_image'], 'ac_ally_web' => $LNG['ac_ally_web'], 'ac_total_members' => $LNG['ac_total_members'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_see_ranking' => $LNG['ac_see_ranking'], 'ac_view_image' => $LNG['ac_view_image'], 'ac_urlnow' => $LNG['ac_urlnow'], 'ac_ally_ranking' => $LNG['ac_ally_ranking'], 'ac_points_count' => $LNG['ac_points_count'], 'ac_ranking' => $LNG['ac_ranking'], 'ac_total_points' => $LNG['ac_total_points'], 'ac_id_names_coords' => $LNG['ac_id_names_coords'], 'ac_name' => $LNG['ac_name'], 'ac_diameter' => $LNG['ac_diameter'], 'ac_fields' => $LNG['ac_fields'], 'ac_temperature' => $LNG['ac_temperature'], 'se_search_edit' => $LNG['se_search_edit'], 'resources_title' => $LNG['resources_title'], 'ac_name' => $LNG['ac_name'], 'Metal' => $LNG['tech'][901], 'Crystal' => $LNG['tech'][902], 'Deuterium' => $LNG['tech'][903], 'Energy' => $LNG['tech'][911], 'Darkmatter' => $LNG['tech'][921], 'buildings_title' => $LNG['buildings_title'], 'ships_title' => $LNG['ships_title'], 'defenses_title' => $LNG['defenses_title'], 'ac_officier_research' => $LNG['ac_officier_research'], 'researchs_title' => $LNG['researchs_title'], 'officiers_title' => $LNG['officiers_title'], 'ac_name' => $LNG['ac_name'], 'input_id' => $LNG['input_id'], 'ac_coords' => $LNG['ac_coords'], 'ac_time_destruyed' => $LNG['ac_time_destruyed']));
            $template->show('AccountDataPageDetail.tpl');
        }
        exit;
    }
    $Userlist = "";
    $UserWhileLogin = $GLOBALS['DATABASE']->query("SELECT `id`, `username`, `authlevel` FROM " . USERS . " WHERE `authlevel` <= '" . $USER['authlevel'] . "' AND `universe` = '" . Universe::getEmulated() . "' ORDER BY `username` ASC;");
    while ($UserList = $GLOBALS['DATABASE']->fetch_array($UserWhileLogin)) {
        $Userlist .= "<option value=\"" . $UserList['id'] . "\">" . $UserList['username'] . "&nbsp;&nbsp;(" . $LNG['rank'][$UserList['authlevel']] . ")</option>";
    }
    $template->loadscript('filterlist.js');
    $template->assign_vars(array('Userlist' => $Userlist, 'ac_enter_user_id' => $LNG['ac_enter_user_id'], 'bo_select_title' => $LNG['bo_select_title'], 'button_filter' => $LNG['button_filter'], 'button_deselect' => $LNG['button_deselect'], 'ac_select_id_num' => $LNG['ac_select_id_num'], 'button_submit' => $LNG['button_submit']));
    $template->show('AccountDataPageIntro.tpl');
}
Exemple #19
0
        echo '<li class="disabled">
        <a data-container="body" data-toggle="tooltip" data-placement="top" class="has-tooltip" title="Available in ' . time_remaining($cat['available_from']) . '.">', htmlspecialchars($cat['title']), '</a>
        </li>';
    } else {
        echo '<li ', $current_category['id'] == $cat['id'] ? ' class="active"' : '', '><a href="', CONFIG_SITE_URL, 'challenges?category=', htmlspecialchars($cat['id']), '">', htmlspecialchars($cat['title']), '</a></li>';
    }
}
echo '</ul>
</div>';
// check that the category is actually available for display
if ($time < $current_category['available_from'] || $time > $current_category['available_until']) {
    message_generic('Category unavailable', 'This category is not available. It is open from ' . date_time($current_category['available_from']) . ' (' . time_remaining($current_category['available_from']) . ' from now) until ' . date_time($current_category['available_until']) . ' (' . time_remaining($current_category['available_until']) . ' from now)', false);
}
// write out the category description, if one exists
if ($current_category['description']) {
    echo '<div id="category-description">', $bbc->parse($current_category['description']), '</div>';
}
// get all the challenges for the selected category
$challenges = db_query_fetch_all('
    SELECT
       c.id,
       c.title,
       c.description,
       c.available_from,
       c.available_until,
       c.points,
       c.num_attempts_allowed,
       c.min_seconds_between_submissions,
       c.automark,
       c.relies_on,
       IF(c.automark = 1, 0, (SELECT ss.id FROM submissions AS ss WHERE ss.challenge = c.id AND ss.user_id = :user_id_1 AND ss.marked = 0)) AS unmarked, -- a submission is waiting to be marked
Exemple #20
0
<?php

require '../include/mellivora.inc.php';
login_session_refresh();
if (!isset($_GET['show'])) {
    message_error(lang_get('please_request_page'));
}
$menu_data = db_select_one('dynamic_menu', array('internal_page'), array('permalink' => $_GET['show']));
if (!is_valid_id($menu_data['internal_page'])) {
    message_error(lang_get('not_a_valid_link'));
}
$content = db_select_one('dynamic_pages', array('id', 'title', 'body', 'visibility', 'min_user_class'), array('id' => $menu_data['internal_page']));
if ($content['visibility'] == 'private') {
    enforce_authentication($content['min_user_class']);
}
head($content['title']);
if (cache_start($content['id'], CONFIG_CACHE_TIME_DYNAMIC, CONST_CACHE_DYNAMIC_PAGES_GROUP)) {
    section_head($content['title']);
    require CONST_PATH_THIRDPARTY . 'nbbc/nbbc.php';
    $bbc = new BBCode();
    $bbc->SetEnableSmileys(false);
    echo $bbc->parse($content['body']);
    cache_end($content['id'], CONST_CACHE_DYNAMIC_PAGES_GROUP);
}
foot();