コード例 #1
0
ファイル: League.php プロジェクト: GallardoAlba/Meneame
 public function __construct($id = NULL)
 {
     global $globals;
     if (!is_null($id)) {
         $this->id = intval($id);
     }
     if (empty($globals['security_key'])) {
         $globals['security_key'] = get_security_key();
     }
 }
コード例 #2
0
ファイル: html1-mobile.php プロジェクト: GallardoAlba/Meneame
function do_header($title, $id = 'home')
{
    global $current_user, $dblang, $globals;
    check_auth_page();
    header('Content-type: text/html; charset=utf-8');
    header('X-Frame-Options: SAMEORIGIN');
    http_cache();
    $globals['security_key'] = get_security_key();
    setcookie('k', $globals['security_key'], 0, $globals['base_url']);
    $vars = compact('title', 'id');
    return Haanga::Load("mobile/header.html", $vars);
}
コード例 #3
0
ファイル: html1.php プロジェクト: manelio/woolr
function do_header($title, $id = 'home', $options = false)
{
    global $current_user, $dblang, $globals, $db;
    check_auth_page();
    header('Content-Type: text/html; charset=utf-8');
    header('X-Frame-Options: SAMEORIGIN');
    header('X-UA-Compatible: IE=edge,chrome=1');
    http_cache();
    $globals['security_key'] = get_security_key();
    setcookie('k', $globals['security_key'], 0, $globals['base_url']);
    if (!empty($_REQUEST['q'])) {
        $globals['q'] = $_REQUEST['q'];
    }
    $sites = $db->get_results("select * from subs where visible order by id asc");
    $this_site = SitesMgr::get_info();
    if ($this_site->nsfw) {
        $globals['ads'] = false;
    }
    /*
    echo "<pre>";
    print_r($this_site);
    exit;
    */
    if (!is_array($options)) {
        $left_options = array();
        //$left_options[] = new MenuOption(_('portada'), $globals['base_url'], $id, _('página principal'));
        // $left_options[] = new MenuOption(_('Nuevas'), $globals['base_url'].'queue', $id, _('menear noticias pendientes'), array(), 'nuevas');
        $left_options[] = new MenuOption(_('Populares'), $globals['base_url'] . 'popular', $id, _('historias más votadas'), array(), 'populares');
        $left_options[] = new MenuOption(_('Más visitadas'), $globals['base_url'] . 'top_visited', $id, _('historias más visitadas/leídas'), array(), 'más visitadas');
        //$left_options[] = new MenuOption(_('destacadas'), $globals['base_url'].'top_active', $id, _('historias más activas'));
        if ($this_site->enabled) {
            $left_options[] = new MenuOption(_('Enviar noticia'), $globals['base_url'] . 'submit', $id, _('enviar nueva historia'), array('class' => 'link-send-story'), 'enviar historia');
        }
        $right_options = array();
        $right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'), array(), 'm/');
        $right_options[] = new MenuOption(_('Actividad'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'), array(), 'fisgona');
        $right_options[] = new MenuOption(_('Notas y mensajes privados'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'), array(), 'nótame');
        $right_options[] = new MenuOption(_('Galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
    } else {
        $left_options = $options;
        $right_options = array();
        //$right_options[] = new MenuOption(_('portada'), $globals['base_url'], '', _('página principal'));
        // $right_options[] = new MenuOption(_('Nuevas'), $globals['base_url'].'queue', '', _('menear noticias pendientes'));
        $right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'), array(), 'm/');
        $right_options[] = new MenuOption(_('Actividad'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'), array(), 'fisgona');
        $right_options[] = new MenuOption(_('Notas y mensajes privados'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'), array(), 'nótame');
        $right_options[] = new MenuOption(_('Galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
    }
    $vars = compact('title', 'greeting', 'id', 'left_options', 'right_options', 'sites', 'this_site', 'themes');
    return Haanga::Load('header.html', $vars);
}
コード例 #4
0
ファイル: html1.php プロジェクト: brainsqueezer/fffff
function do_header($title, $id = 'home', $options = false)
{
    global $current_user, $dblang, $globals, $db;
    check_auth_page();
    header('Content-Type: text/html; charset=utf-8');
    header('X-Frame-Options: SAMEORIGIN');
    header('X-UA-Compatible: IE=edge,chrome=1');
    http_cache();
    if (!empty($globals['link_id'])) {
        // Pingback autodiscovery
        // http://www.hixie.ch/specs/pingback/pingback
        header('X-Pingback: http://' . get_server_name() . $globals['base_url'] . 'xmlrpc.php');
    }
    $globals['security_key'] = get_security_key();
    setcookie('k', $globals['security_key'], 0, $globals['base_url']);
    if (!empty($_REQUEST['q'])) {
        $globals['q'] = $_REQUEST['q'];
    }
    /*
    	if ($globals['greetings']) $greeting = array_rand($globals['greetings'], 1);
    	else $greeting = _('hola');
    */
    if (!is_array($options)) {
        $left_options = array();
        $left_options[] = new MenuOption(_('enviar historia'), $globals['base_url'] . 'submit.php', $id, _('enviar nueva historia'));
        $left_options[] = new MenuOption(_('portada'), $globals['base_url'], $id, _('página principal'));
        $left_options[] = new MenuOption(_('pendientes'), $globals['base_url'] . 'shakeit.php', $id, _('menear noticias pendientes'));
        $left_options[] = new MenuOption(_('populares'), $globals['base_url'] . 'topstories.php', $id, _('historias más votadas'));
        $left_options[] = new MenuOption(_('más visitadas'), $globals['base_url'] . 'topclicked.php', $id, _('historias más visitadas/leídas'));
        $left_options[] = new MenuOption(_('destacadas'), $globals['base_url'] . 'topactive.php', $id, _('historias más activas'));
        $right_options = array();
        $right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak.php', $id, _('visualizador en tiempo real'));
        $right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
        $right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
    } else {
        $left_options = $options;
        $right_options = array();
        //$right_options[] = new MenuOption(_('portada'), $globals['base_url'], '', _('página principal'));
        $right_options[] = new MenuOption(_('pendientes'), $globals['base_url'] . 'shakeit.php', '', _('menear noticias pendientes'));
        $right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak.php', $id, _('visualizador en tiempo real'));
        $right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
        $right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
    }
    $sites = $db->get_results("select * from subs where visible order by id asc");
    $this_site = SitesMgr::get_info();
    $vars = compact('title', 'greeting', 'id', 'left_options', 'right_options', 'sites', 'this_site');
    return Haanga::Load('header.html', $vars);
}
コード例 #5
0
ファイル: html1.php プロジェクト: brainsqueezer/fffff
function do_js_includes()
{
    global $globals, $current_user;
    //echo '<script src="'.$globals['base_static'].'js/jquery-1.3.2.min.js" type="text/javascript"></script>' . "\n";
    // See http://code.google.com/apis/ajaxlibs/documentation/#jquery
    echo '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>' . "\n";
    // Cache for Ajax
    echo '<script src="' . $globals['base_url'] . 'js/' . $globals['js_main'] . '" type="text/javascript" charset="utf-8"></script>' . "\n";
    do_js_from_array($globals['extra_js']);
    if ($globals['extra_js_text']) {
        echo '<script type="text/javascript">' . "\n";
        echo $globals['extra_js_text'] . "\n";
        echo '</script>' . "\n";
    }
    echo '<script type="text/javascript">' . "\n";
    echo 'if(top.location != self.location)top.location = self.location;' . "\n";
    echo 'var base_key="' . get_security_key() . '";' . "\n";
    echo '</script>' . "\n";
}
コード例 #6
0
ファイル: bar.php プロジェクト: GallardoAlba/Meneame
// AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING".
include 'config.php';
$globals['force_ssl'] = False;
// We open the bar always as http to allow loading no https pages
include mnminclude . 'html1.php';
$url_args = $globals['path'];
$id = intval($globals['path'][1]);
if (!$id > 0 || !($link = Link::from_db($id))) {
    do_error(_('enlace no encontrado'), 404);
}
// Mark as read, add click if necessary
$link->add_click();
if ($globals['https'] && !preg_match('/^https:/', $link->url)) {
    redirect($link->url);
    die;
}
$link->title = text_to_summary($link->title, 80);
// From libs/html1.php do_header()
header('Content-Type: text/html; charset=utf-8');
$globals['security_key'] = get_security_key();
setcookie('k', $globals['security_key'], 0, $globals['base_url']);
// From libks/link.php print_summary()
$link->is_votable();
$link->permalink = $link->get_permalink();
$link->can_vote_negative = !$link->voted && $link->votes_enabled && $link->negatives_allowed(true);
$link->get_box_class();
$vars = compact('type');
$vars['self'] = $link;
$globals['extra_css'] = 'bar.css';
do_header($link->title, 'post');
Haanga::Load("link_bar.html", $vars);
コード例 #7
0
ファイル: html1-mobile.php プロジェクト: brainsqueezer/fffff
function do_js_includes()
{
    global $globals;
    echo '<script src="' . $globals['base_url'] . 'js/' . $globals['js_main'] . '" type="text/javascript"></script>' . "\n";
    do_js_from_array($globals['extra_js']);
    if ($globals['extra_js_text']) {
        echo '<script type="text/javascript">' . "\n";
        echo $globals['extra_js_text'] . "\n";
        echo '</script>' . "\n";
    }
    echo '<script type="text/javascript">' . "\n";
    echo 'if(top.location != self.location)top.location = self.location;' . "\n";
    echo 'var base_key="' . get_security_key() . '";' . "\n";
    echo '</script>' . "\n";
}
コード例 #8
0
ファイル: html1.php プロジェクト: GallardoAlba/Meneame
function do_header($title, $id = 'home', $options = false)
{
    global $current_user, $dblang, $globals, $db;
    header('Content-Type: text/html; charset=utf-8');
    // Security headers
    header('X-Frame-Options: SAMEORIGIN');
    header('X-UA-Compatible: IE=edge,chrome=1');
    if ($globals['force_ssl'] && $globals['https']) {
        header('Strict-Transport-Security: max-age=15638400');
        // 181 days, ssllabs doesn't like less than 180
    }
    http_cache();
    $globals['security_key'] = get_security_key();
    setcookie('k', $globals['security_key'], 0, $globals['base_url_general']);
    if (!empty($_REQUEST['q'])) {
        $globals['q'] = $_REQUEST['q'];
    }
    if ($current_user->user_id > 0) {
        $globals['extra_js'][] = 'jquery.form.min.js';
    }
    $sites = $db->get_results("select * from subs where visible order by id asc");
    $this_site = SitesMgr::get_info();
    $this_site_properties = SitesMgr::get_extended_properties();
    if ($this_site->sub) {
        $this_site->url = $this_site->base_url . 'm/' . $this_site->name;
    } else {
        $this_site->url = $this_site->base_url;
    }
    // Check if the sub has a logo and calculate the width
    if ($this_site->media_id > 0 && $this_site->media_dim1 > 0 && $this_site->media_dim2 > 0) {
        $r = $this_site->media_dim1 / $this_site->media_dim2;
        if ($globals['mobile']) {
            $this_site->logo_height = $globals['media_sublogo_height_mobile'];
        } else {
            $this_site->logo_height = $globals['media_sublogo_height'];
        }
        $this_site->logo_width = round($r * $this_site->logo_height);
        $this_site->logo_url = Upload::get_cache_relative_dir($this_site->id) . '/media_thumb-sub_logo-' . $this_site->id . '.' . $this_site->media_extension . '?' . $this_site->media_date;
    }
    if ($this_site->nsfw) {
        $globals['ads'] = false;
    }
    if (!empty($this_site_properties['post_html'])) {
        $globals['post_html'] = $this_site_properties['post_html'];
    }
    if (!is_array($options)) {
        $left_options = array();
        if ($this_site->enabled && empty($this_site_properties['new_disabled'])) {
            $left_options[] = new MenuOption(_('enviar historia'), $globals['base_url'] . 'submit', $id, _('enviar nueva historia'));
        }
        $left_options[] = new MenuOption(_('portada'), $globals['base_url'], $id, _('página principal'));
        $left_options[] = new MenuOption(_('nuevas'), $globals['base_url'] . 'queue', $id, _('menear noticias pendientes'));
        $left_options[] = new MenuOption(_('populares'), $globals['base_url'] . 'popular', $id, _('historias más votadas'));
        $left_options[] = new MenuOption(_('más visitadas'), $globals['base_url'] . 'top_visited', $id, _('historias más visitadas/leídas'));
        $left_options[] = new MenuOption(_('destacadas'), $globals['base_url'] . 'top_active', $id, _('historias más activas'));
        $right_options = array();
        $right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'));
        $right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'));
        $right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
        $right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
    } else {
        $left_options = $options;
        $right_options = array();
        //$right_options[] = new MenuOption(_('portada'), $globals['base_url'], '', _('página principal'));
        $right_options[] = new MenuOption(_('nuevas'), $globals['base_url'] . 'queue', '', _('menear noticias pendientes'));
        $right_options[] = new MenuOption(_('m/'), $globals['base_url_general'] . 'subs', $id, _('sub menéames'));
        $right_options[] = new MenuOption(_('fisgona'), $globals['base_url'] . 'sneak', $id, _('visualizador en tiempo real'));
        $right_options[] = new MenuOption(_('nótame'), post_get_base_url(), $id, _('leer o escribir notas y mensajes privados'));
        $right_options[] = new MenuOption(_('galería'), 'javascript:fancybox_gallery(\'all\');', false, _('las imágenes subidas por los usuarios'));
    }
    $vars = compact('title', 'greeting', 'id', 'left_options', 'right_options', 'sites', 'this_site', 'this_site_properties');
    return Haanga::Load('header.html', $vars);
}
コード例 #9
0
ファイル: html1.php プロジェクト: rasomu/chuza
function do_js_includes()
{
    global $globals, $current_user;
    //echo '<script src="'.$globals['base_static'].'js/jquery-1.3.2.min.js" type="text/javascript"></script>' . "\n";
    // See http://code.google.com/apis/ajaxlibs/documentation/#jquery
    echo '<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" type="text/javascript"></script>' . "\n";
    // Cache for Ajax
    echo '<script src="' . $globals['base_url'] . 'js/' . $globals['js_main'] . '" type="text/javascript" charset="utf-8"></script>' . "\n";
    do_js_from_array($globals['extra_js']);
    if ($globals['extra_js_text']) {
        echo '<script type="text/javascript">' . "\n";
        echo $globals['extra_js_text'] . "\n";
        echo '</script>' . "\n";
    }
    echo '<script type="text/javascript">' . "\n";
    echo 'if(top.location != self.location)top.location = self.location;' . "\n";
    echo 'var base_key="' . get_security_key() . '";' . "\n";
    echo '</script>' . "\n";
    // April's fool translate joke
    if ($globals["1stApril"]) {
        echo '<script type="text/javascript">

      function translateText(text) {
        if (typeof text.data == "undefined") return;
        $($("h1 a")[text.data.translations[2].translatedText]).html(text.data.translations[0].translatedText);
        $($("div.news-body p")[text.data.translations[2].translatedText]).html(text.data.translations[1].translatedText);
      }

      $(document).ready( function() {

      var titleEl= $("h1 a");
      var sourceEl = $("div.news-body p");

      var k1 = 0;
      titleEl.each( function() {
        var newScript = document.createElement("script");
        newScript.type = "text/javascript";

        titleText = escape($(this).html());
        sourceText = escape($(sourceEl[k1]).html());
        var source = "https://www.googleapis.com/language/translate/v2?key=AIzaSyB104i2P2sEKZNrPRwIMcmPmHEfF4xYu5I&source=pt&target=fr&callback=translateText&q="+titleText+"&q=" + sourceText + "&q="+k1;
        newScript.src = source;
        
        // When we add this script to the head, the request is sent off.
        document.getElementsByTagName("head")[0].appendChild(newScript);
        k1++;
      });
    
  });
  </script>';
    }
}
コード例 #10
0
ファイル: bans.php プロジェクト: brainsqueezer/fffff
function admin_bans($ban_type)
{
    global $db, $globals, $offset, $page_size, $ban_text_length, $ban_comment_length, $current_user;
    require_once mnminclude . 'ban.php';
    $key = get_security_key();
    if ($current_user->user_level == "god" && check_security_key($_REQUEST["key"])) {
        if (!empty($_REQUEST["new_ban"])) {
            insert_ban($ban_type, $_POST["ban_text"], $_POST["ban_comment"], $_POST["ban_expire"]);
        } elseif (!empty($_REQUEST["edit_ban"])) {
            insert_ban($ban_type, $_POST["ban_text"], $_POST["ban_comment"], $_POST["ban_expire"], $_POST["ban_id"]);
        } elseif (!empty($_REQUEST["new_bans"])) {
            $array = preg_split("/\\s+/", $_POST["ban_text"]);
            $size = count($array);
            for ($i = 0; $i < $size; $i++) {
                insert_ban($ban_type, $array[$i], $_POST["ban_comment"], $_POST["ban_expire"]);
            }
        } elseif (!empty($_REQUEST["del_ban"])) {
            del_ban($_REQUEST["del_ban"]);
        }
    }
    // ex container-wide
    echo '<div class="genericform" style="margin:0">';
    echo '<div style="float:right;">' . "\n";
    echo '<form method="get" action="' . $globals['base_url'] . 'admin/bans.php">';
    echo '<input type="hidden" name="admin" value="' . $ban_type . '" />';
    echo '<input type="hidden" name="key" value="' . $key . '" />';
    echo '<input type="text" name="s" ';
    if ($_REQUEST["s"]) {
        $_REQUEST["s"] = clean_text($_REQUEST["s"]);
        echo ' value="' . $_REQUEST["s"] . '" ';
    } else {
        echo ' value="' . _('buscar') . '..." ';
    }
    echo 'onblur="if(this.value==\'\') this.value=\'' . _('buscar') . '...\';" onfocus="if(this.value==\'' . _('buscar') . '...\') this.value=\'\';" />';
    echo '&nbsp;<input style="padding:2px;" type="image" align="top" value="' . _('buscar') . '" alt="' . _('buscar') . '" src="' . $globals['base_static'] . 'img/common/search-03.png" />';
    echo '</form>';
    echo '</div>';
    if ($current_user->user_level == "god") {
        echo '&nbsp; [ <a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=new">' . _('Nuevo ban') . '</a> ]';
        echo '&nbsp; [ <a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=news">' . _('Múltiples bans') . '</a> ]';
    }
    if (!empty($_REQUEST["op"])) {
        echo '<form method="post" name="newban" action="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '">';
        echo '<input type="hidden" name="key" value="' . $key . '" />';
    }
    echo '<table class="decorated" style="font-size: 10pt">';
    echo '<tr><th width="25%"><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_text">' . $ban_type . '</a></th>';
    echo '<th width="30%"><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_comment">' . _('comentario') . '</a></th>';
    echo '<th><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_date">' . _('fecha creación') . '</a></th>';
    echo '<th><a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;';
    if ($_REQUEST["s"]) {
        echo 's=' . $_REQUEST["s"] . '&amp;';
    }
    echo 'orderby=ban_expire">' . _('fecha caducidad') . '</a></th>';
    echo '<th>' . _('Editar / Borrar') . '</th></tr>';
    switch ($_REQUEST["op"]) {
        case 'new':
            echo '<tr><td>';
            echo '<input type="text" id="ban_text" name="ban_text" size="30" maxlength="' . $ban_text_length . '" value="" />';
            echo '&nbsp;<span id="checkit"><input type="button" id="checkbutton1" value="' . _('verificar') . '" onclick="checkfield(\'ban_' . $ban_type . '\', this.form, this.form.ban_text)"/></span>' . "\n";
            echo '<br /><span id="ban_' . $ban_type . 'checkitvalue"></span>' . "\n";
            echo '</td><td>';
            echo '<input class="form-full" type="text" name="ban_comment" id="ban_comment" />';
            echo '</td><td>';
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="new_ban" value="1" />';
            echo '<input type="submit" name="submit" value="' . _('Crear ban') . '" />';
            echo '</td></tr>';
            break;
        case 'news':
            echo '<tr><td>';
            echo '<textarea id="ban_text" name="ban_text" /></textarea>';
            echo '</td><td>';
            echo '<input class="form-full" type="text" name="ban_comment" id="ban_comment" />';
            echo '</td><td>';
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="new_bans" value="1" />';
            echo '<input type="submit" name="submit" value="' . _('Crear bans') . '" />';
            echo '</td></tr>';
            break;
        case 'edit':
            $ban = new Ban();
            $ban->ban_id = (int) $_REQUEST["id"];
            $ban->read();
            echo '<tr><td>';
            echo '<input type="text" name="ban_text" id="ban_text" size="30" maxlength="' . $ban_text_length . '" value="' . $ban->ban_text . '" />';
            echo '</td><td>';
            echo '<input type="text" class="form-full" name="ban_comment" id="ban_comment" value="' . $ban->ban_comment . '" />';
            echo '</td><td>';
            echo $ban->ban_date;
            echo '</td><td>';
            echo '<select name="ban_expire" id="ban_expire">';
            echo '<option value="' . $ban->ban_expire . '">' . $ban->ban_expire . '</option>';
            print_expiration_dates();
            echo '</select>';
            echo '</td><td>';
            echo '<input type="hidden" name="ban_id" value="' . $ban->ban_id . '" />';
            echo '<input type="submit" name="edit_ban" value="' . _('Editar ban') . '" />';
            echo '</td></tr>';
            break;
    }
    if (empty($_REQUEST["op"])) {
        //listado de bans
        if (empty($_REQUEST["orderby"])) {
            $_REQUEST["orderby"] = "ban_text";
        } else {
            $_REQUEST["orderby"] = preg_replace('/[^a-z_]/i', '', $_REQUEST["orderby"]);
            if ($_REQUEST["orderby"] == 'ban_date') {
                $order = "DESC";
            }
        }
        $where = "WHERE ban_type='" . $ban_type . "'";
        if ($_REQUEST["s"]) {
            $search_text = $db->escape($_REQUEST["s"]);
            $where .= " AND (ban_text LIKE '%{$search_text}%' OR ban_comment LIKE '%{$search_text}%')";
        }
        $bans = $db->get_col("SELECT ban_id FROM bans " . $where . " ORDER BY " . $_REQUEST["orderby"] . " {$order} LIMIT {$offset},{$page_size}");
        $rows = $db->get_var("SELECT count(*) FROM bans " . $where);
        if ($bans) {
            $ban = new Ban();
            foreach ($bans as $ban_id) {
                $ban->ban_id = $ban_id;
                $ban->read();
                echo '<tr>';
                echo '<td onmouseover="return tooltip.ajax_delayed(event, \'get_ban_info.php\', ' . $ban->ban_id . ');" onmouseout="tooltip.clear(event);" >' . clean_text($ban->ban_text) . '</td>';
                echo '<td style="overflow: hidden;white-space: nowrap;" onmouseover="return tooltip.ajax_delayed(event, \'get_ban_info.php\', ' . $ban->ban_id . ');" onmouseout="tooltip.clear(event);">' . clean_text(txt_shorter($ban->ban_comment, 50)) . '</td>';
                echo '<td>' . $ban->ban_date . '</td>';
                echo '<td>' . $ban->ban_expire . '</td>';
                echo '<td>';
                if ($current_user->user_level == "god") {
                    echo '<a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;op=edit&amp;id=' . $ban->ban_id . '" title="' . _('Editar') . '"><img src="' . $globals['base_static'] . 'img/common/sneak-edit-notice01.png" alt="' . 'Editar' . '" /></a>';
                    echo '&nbsp;/&nbsp;';
                    echo '<a href="' . $globals['base_url'] . 'admin/bans.php?admin=' . $ban_type . '&amp;del_ban=' . $ban->ban_id . '&amp;key=' . $key . '" title="' . _('Eliminar') . '"><img src="' . $globals['base_static'] . 'img/common/sneak-reject01.png" alt="' . 'Eliminar' . '" /></a>';
                }
                echo '</td>';
                echo '</tr>';
            }
        }
    }
    echo '</table>';
    if (!empty($_REQUEST["op"])) {
        echo "</form>\n";
    }
    do_pages($rows, $page_size, false);
}
コード例 #11
0
ファイル: utils.php プロジェクト: rasomu/chuza
function check_security_key($key) {
	global $globals, $current_user, $site_key;

	$time_key = preg_split('/-/', $key);
	if (count($time_key) != 2) return false;
	if ($globals['now'] - intval($time_key[0]) > 7200) return false;
	return $key == get_security_key($time_key[0]);
}