Exemplo n.º 1
0
  ORDER BY date DESC
  LIMIT ' . $conf['guestbook']['nb_comment_page'] . ' OFFSET ' . $page['start'] . '
;';
    $result = pwg_query($query);
    while ($row = pwg_db_fetch_assoc($result)) {
        if (!empty($row['author'])) {
            $author = $row['author'];
            if ($author == 'guest') {
                $author = l10n('guest');
            }
        } else {
            $author = stripslashes($row['username']);
        }
        $tpl_comment = array('ID' => $row['id'], 'AUTHOR' => trigger_change('render_comment_author', $author), 'DATE' => format_date($row['date'], true), 'CONTENT' => trigger_change('render_comment_content', $row['content'], 'guestbook'), 'WEBSITE' => $row['website']);
        if ($conf['guestbook']['activate_rating']) {
            $tpl_comment['STARS'] = get_stars($row['rate'], get_root_url() . GUESTBOOK_PATH . 'template/jquery.raty/');
        }
        if (is_admin() and !empty($row['email'])) {
            $tpl_comment['EMAIL'] = $row['email'];
        }
        if (can_manage_comment('delete', $row['author_id'])) {
            $tpl_comment['U_DELETE'] = add_url_params($url_self, array('action' => 'delete_comment', 'comment_to_delete' => $row['id'], 'pwg_token' => get_pwg_token()));
        }
        if (can_manage_comment('edit', $row['author_id'])) {
            $tpl_comment['U_EDIT'] = add_url_params($url_self, array('action' => 'edit_comment', 'comment_to_edit' => $row['id']));
            if (isset($edit_comment) and $row['id'] == $edit_comment) {
                $tpl_comment['IN_EDIT'] = true;
                $tpl_comment['KEY'] = get_ephemeral_key(2);
                $tpl_comment['CONTENT'] = $row['content'];
                $tpl_comment['PWG_TOKEN'] = get_pwg_token();
                $tpl_comment['U_CANCEL'] = $url_self;
Exemplo n.º 2
0
/**
* holt alle sterne zu gegebenen constellationen
*
* @param $cids
* @return
*/
function get_svg_stars_of_cids($cids, &$fleet_symbols, &$fleet_routes, &$scans, &$systems)
{
    global $uid;
    global $map_info;
    $closest_stars = get_stars($cids);
    $system_user_type_defs = "<defs>";
    $system_user_type = "<g pointer-events=\"none\">";
    if (is_array($closest_stars)) {
        $scans = "<g pointer-events=\"none\" id=\"scanradien\">";
        $system_names = "<g style=\"font-size:7pt;fill:#A5D9FF;stroke:none;font-family:verdana,arial;letter-spacing:1pt;\" pointer-events=\"none\">";
        $systems = "<g onclick=\"clickOnStar(evt);\" onmouseover=\"mouseoverStar(evt);\" onmouseout=\"mouseoutStar(evt);\">";
        foreach ($closest_stars as $sid => $its_star) {
            if ($its_star["userstypes"]) {
                $system_user_type_defs .= $its_star["userstypes"];
                $system_user_type .= "<use xlink:href=\"#user_in_system_" . $sid . "\" x=\"" . $its_star[x] . "\" y=\"" . ($its_star[y] + 25) . "\"/>";
                // scanradien, wenn ein system ein system_user_type hat, ist jemand in dem system, können also scanradien vorhanden sein
                if ($map_info->is_own_star($sid)) {
                    $scanrange = $map_info->get_systemscanradius($sid);
                    $scans .= draw_scancircles($its_star[x], $its_star[y], $scanrange);
                }
            }
            $systems .= draw_star($its_star["x"], $its_star["y"], $sid, $its_star["scan"]);
            $system_names .= draw_system_name($sid, $its_star["scan"], $its_star["name"], $its_star["x"], $its_star["y"]);
            //___________________________ System Flotten
            if ($its_star["scan"] == SYSTEM_VISIBLE) {
                $system_fleets = $map_info->get_fids_by_sid($sid);
                if (is_array($system_fleets)) {
                    $fleet_symbols .= draw_fleets($its_star[x], $its_star[y], $system_fleets, $sid);
                    $fleet_routes .= get_fleet_routes($system_fleets);
                }
                $fleet_scans .= draw_fleet_scancircles($its_star[x], $its_star[y], $sid);
            }
            //___________________________ Spezial Symbole
            $special_symbols = $map_info->get_special_buildings_by_sid($sid, 1);
            if (is_array($special_symbols)) {
                $specials .= "<g id=\"specialSymbols_" . $sid . "\" pointer-events=\"none\">";
                $specials .= draw_special_symbols($its_star[x], $its_star[y], $special_symbols, $sid);
                $specials .= "<set attributeType=\"XML\" attributeName=\"display\" to=\"none\" begin=\"s" . $sid . ".mouseover\"/>";
                $specials .= "<set attributeType=\"XML\" attributeName=\"display\" to=\"inherit\" begin=\"s" . $sid . ".mouseout\"/>";
                $specials .= "</g>";
            }
        }
    }
    $system_user_type_defs .= "</defs>";
    $system_user_type .= "</g>";
    $system_names .= "</g>";
    $systems .= "</g>";
    $scans .= $fleet_scans;
    $scans .= "</g>";
    $systems = $system_user_type_defs . $system_user_type . $systems . $system_names . $specials;
}
Exemplo n.º 3
0
function show_file($file_id, $user, $success = null)
{
    global $LSP_URL, $DATA_DIR;
    $dbh =& get_db();
    $stmt = $dbh->prepare('SELECT licenses.name AS license, size, realname, filename, users.login, ' . 'categories.name AS category, subcategories.name AS subcategory,' . 'insert_date, update_date, description, downloads, files.id FROM files ' . 'INNER JOIN categories ON categories.id=files.category ' . 'INNER JOIN subcategories ON subcategories.id=files.subcategory ' . 'INNER JOIN users ON users.id=files.user_id ' . 'INNER JOIN licenses ON licenses.id=files.license_id ' . 'WHERE files.id=:file_id');
    $stmt->bindParam(':file_id', $file_id);
    $found = false;
    if ($stmt->execute()) {
        while ($object = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $title = array($object['category'], $object['subcategory'], get_file_url($file_id));
            if ($success == null) {
                echo '<div class="col-md-9">';
                create_title($title);
            } else {
                if ($success === true) {
                    display_success("Updated successfully", $title);
                    echo '<div class="col-md-9">';
                } else {
                    if ($success === false) {
                        display_error("Update failed.", $title);
                        echo '<div class="col-md-9">';
                    } else {
                        display_success("{$success}", $title);
                    }
                }
            }
            echo '<table class="table table-striped">';
            show_basic_file_info($object, false);
            // Bump the download button under details block
            $url = htmlentities('download_file.php?file=' . $object['id'] . '&name=' . $object['filename']);
            echo '<tr><td><strong>Name:</strong>&nbsp;' . $object['filename'];
            if (is_image($url)) {
                echo '<br><br><a href="' . $url . '"><img class="thumbnail" src="' . scale_image($DATA_DIR . $file_id, 300, parse_extension($url)) . '" alt=""></a>';
            }
            echo '</td><td class="lsp-file-info">';
            echo '<a href="' . $url . '" id="downloadbtn" class="lsp-dl-btn btn btn-primary">';
            echo '<span class="fa fa-download lsp-download"></span>&nbsp;Download</a>';
            echo '</td></tr>';
            echo '<tr><td colspan="2"><div class="well"><strong>Description:</strong><p>';
            echo $object['description'] != '' ? parse_links(newline_to_br($object['description'], true)) : 'No description available.';
            echo '</p></div></td></tr>';
            echo '<tr><td colspan="2">';
            echo '<nav id="lspnav" class="navbar navbar-default"><ul class="nav navbar-nav">';
            $can_edit = $object['login'] == $user || is_admin(get_user_id($user));
            $can_rate = !SESSION_EMPTY();
            $rate_self = $object['login'] == $user;
            global $LSP_URL;
            create_toolbar_item('Comment', "{$LSP_URL}?comment=add&file={$file_id}", 'fa-comment', $can_rate);
            create_toolbar_item('Edit', "{$LSP_URL}?content=update&file={$file_id}", 'fa-pencil', $can_edit);
            create_toolbar_item('Delete', "{$LSP_URL}?content=delete&file={$file_id}", 'fa-trash', $can_edit);
            $star_url = $LSP_URL . '?' . file_show_query_string() . '&rate=';
            create_toolbar_item(get_stars($file_id, $star_url, $rate_self ? false : $can_rate), '', null, $can_rate, $rate_self);
            echo '</ul></nav>';
            echo '<strong>Comments:</strong>';
            echo '</td></tr>';
            get_comments($file_id);
            echo '</table></div>';
            $found = true;
            break;
        }
    }
    if (!$found) {
        display_error('Invalid file: "' . sanitize($file_id) . '"');
    }
    $stmt = null;
    $dbh = null;
}
Exemplo n.º 4
0
// +-----------------------------------------------------------------------+
include GUESTBOOK_PATH . 'include/functions.inc.php';
$list = array();
$query = '
SELECT 
    c.id, 
    c.date, 
    c.author, 
    ' . $conf['user_fields']['username'] . ' AS username, 
    c.content,
    c.website,
    c.email,
    c.rate
  FROM ' . GUESTBOOK_TABLE . ' AS c
    LEFT JOIN ' . USERS_TABLE . ' AS u
      ON u.' . $conf['user_fields']['id'] . ' = c.author_id
  WHERE validated = \'false\'
  ORDER BY c.date DESC
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
    if (empty($row['author_id'])) {
        $author_name = $row['author'];
    } else {
        $author_name = stripslashes($row['username']);
    }
    $template->append('comments', array('ID' => $row['id'], 'AUTHOR' => trigger_change('render_comment_author', $author_name), 'DATE' => format_date($row['date'], true), 'CONTENT' => trigger_change('render_comment_content', $row['content'], 'guestbook'), 'EMAIL' => $row['email'], 'WEBSITE' => $row['website'], 'WEBSITE_NAME' => preg_replace('#^(https?:\\/\\/)#i', null, $row['website']), 'STARS' => get_stars($row['rate'], GUESTBOOK_PATH . 'template/jquery.raty/'), 'RATE' => $row['rate']));
    $list[] = $row['id'];
}
$template->assign(array('LIST' => implode(',', $list), 'F_ACTION' => GUESTBOOK_ADMIN . '-pending'));
$template->set_filename('guestbook', realpath(GUESTBOOK_PATH . 'admin/template/pending.tpl'));