function do_sidebar_top() { global $db, $dblang, $range_values, $range_names; echo '<div id="sidebar">' . "\n"; echo '<ul class="main-menu">' . "\n"; echo '<li>' . "\n"; echo '<div class="column-select-us">' . "\n"; echo '<ul>' . "\n"; if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } for ($i = 0; $i < count($range_values); $i++) { if ($i == $current_range) { echo '<li class="thiscat">' . $range_names[$i] . '</li>' . "\n"; } else { echo '<li><a href="cloud.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n"; } } echo '</ul>' . "\n"; echo '</div>' . "\n"; echo '</li>' . "\n"; do_standard_links(); echo '</ul>'; echo '</div>'; }
/** * Validates int * @param mixed $data * @param int $param */ public static function check_integer($data, $param) { if (check_integer($data, $param) == 0) { echo 'Error validate integer'; exit; } }
function get_current_page() { if ($var = check_integer('page')) { //return value of 'page', in support to above method return $var; } else { //return 1, if it wasnt set before, page=1 return 1; } }
function print_period_tabs() { global $globals, $current_user, $range_values, $range_names; if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } echo '<ul class="tabsub-shakeit">' . "\n"; for ($i = 0; $i < count($range_values) - 1; $i++) { if ($i == $current_range) { $active = ' class="tabsub-this"'; } else { $active = ""; } echo '<li><a ' . $active . 'href="sitescloud.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n"; } echo '</ul>' . "\n"; }
function print_period_tabs() { global $globals, $current_user, $range_values, $range_names; if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } echo '<ul class="subheader">' . "\n"; for ($i = 0; $i < count($range_values); $i++) { if ($i == $current_range) { $active = ' class="selected"'; } else { $active = ""; } echo '<li' . $active . '><a href="topcommented.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n"; } echo '</ul>' . "\n"; }
function print_period_tabs() { global $globals, $current_user, $range_values, $range_names, $month, $year; if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } echo '<ul class="tabsub-shakeit">' . "\n"; if ($month > 0 && $year > 0) { echo '<li><a class="tabsub-this" href="topstories.php?month=' . $month . '&year=' . $year . '">' . "{$month}-{$year}" . '</a></li>' . "\n"; $current_range = -1; } elseif (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } for ($i = 0; $i < count($range_values); $i++) { if ($i == $current_range) { $active = ' class="tabsub-this"'; } else { $active = ""; } echo '<li><a ' . $active . 'href="topstories.php?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n"; } echo '</ul>' . "\n"; }
} if ($_REQUEST['category']) { if (!($cat = check_integer('category'))) { $thecat = get_cached_category_data('category_safe_name', sanitize($_REQUEST['category'], 1)); $cat = $thecat->category_id; if (!$cat) { header("Location: {$my_pligg_base}/storyrss.php?title=" . urlencode($_REQUEST['category'])); die; } } $where .= " AND link_category IN (SELECT category_ID from " . table_categories . " where category_id={$cat} OR category_parent={$cat} )"; $category_name = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE category_id = {$cat} AND category_lang='{$dblang}'"); $title .= " | " . htmlspecialchars($category_name); } if (isset($_REQUEST['group'])) { if (!($group = check_integer('group'))) { $group = $db->get_var("SELECT group_id FROM " . table_groups . " WHERE group_safename = '" . $db->escape(strip_tags($_REQUEST['group'])) . "';"); } $group_name = $db->get_var("SELECT group_name FROM " . table_groups . " WHERE group_id = '{$group}'"); if ($group_name) { $title .= " | " . $group_name; $where .= " AND link_group_id = '{$group}' "; } } // This doesn't seem to work -kb if ($search) { $where .= $search; $title = htmlspecialchars(sanitize($_GET['search'], 3)); } $order_by = " ORDER BY {$order_field} DESC "; $last_modified = $db->get_var($sql = "SELECT UNIX_TIMESTAMP(max({$order_field})) {$from} {$where}");
global $db; if ($current_user->user_id != 0) { $action = isset($_GET['action']) ? sanitize($_GET['action'], 3) : ''; if ($action == 'add') { if (!($linkid = check_integer('link'))) { die("Invalid Link ID"); } $link = new Link(); $link->id = $linkid; $link->read(); $title = $db->get_var("SELECT link_title_url FROM " . table_links . " WHERE link_id = {$linkid}"); $count = $db->get_var("SELECT count(*) FROM " . table_saved_links . " WHERE saved_link_id = {$linkid} AND saved_user_id = {$current_user->user_id}"); if ($count == 0) { $sql = "INSERT INTO " . table_saved_links . " (saved_user_id, saved_link_id) VALUES ({$current_user->user_id}, {$linkid})"; $db->query($sql); } } elseif ($action == 'remove') { if (!($linkid = check_integer('link'))) { die("Invalid Link ID"); } $link = new Link(); $link->id = $linkid; $link->read(); $title = $db->get_var("SELECT link_title_url FROM " . table_links . " WHERE link_id = {$linkid}"); $count = $db->get_var("SELECT count(*) FROM " . table_saved_links . " WHERE saved_link_id = {$linkid} AND saved_user_id = {$current_user->user_id}"); if ($count != 0) { $sql = "DELETE FROM " . table_saved_links . " WHERE saved_user_id={$current_user->user_id} AND saved_link_id={$linkid}"; $db->query($sql); } } }
function print_period_tabs() { global $globals, $current_user, $range_values, $range_names, $month, $year; if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } echo '<ul class="subheader">' . "\n"; if ($month > 0 && $year > 0) { echo '<li class="selected"><a href="popular?month=' . $month . '&year=' . $year . '">' . "{$month}-{$year}" . '</a></li>' . "\n"; $current_range = -1; } elseif (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } for ($i = 0; $i < count($range_values); $i++) { if ($i == $current_range) { $active = ' class="selected"'; } else { $active = ""; } echo '<li' . $active . '><a href="popular?range=' . $i . '">' . $range_names[$i] . '</a></li>' . "\n"; } echo '</ul>' . "\n"; }
} $title = _('Menéame') . ": " . htmlspecialchars(strip_tags($_REQUEST['q'])); } if ($meta = check_integer('meta')) { $cat_list = meta_get_categories_list($meta); if (!$cat_list) { not_found(); } $from_where .= " AND link_category in ({$cat_list})"; $meta_name = $db->get_var("SELECT category_name FROM categories WHERE category_id = {$meta} AND category_parent=0"); $title .= " -{$meta_name}-"; } elseif ($cat = check_integer('category')) { $from_where .= " AND link_category={$cat} "; $category_name = $db->get_var("SELECT category_name FROM categories WHERE category_id = {$cat} AND category_lang='{$dblang}'"); $title .= " -{$category_name}-"; } elseif ($uid = check_integer('personal')) { $categories = $db->get_col("SELECT pref_value FROM prefs WHERE pref_user_id = {$uid} and pref_key = 'category' "); $user_login = $db->get_var("select user_login from users where user_id={$uid}"); $title .= " -{$user_login}-"; if ($categories) { $cats = implode(',', $categories); $from_where .= " AND link_category in ({$cats}) "; } } $order_by = " ORDER BY {$order_field} DESC "; $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP({$order_field}) {$from_where} {$order_by} LIMIT 1"); if ($if_modified > 0) { $from_where .= " AND {$order_field} > FROM_UNIXTIME({$if_modified})"; } $sql = "SELECT link_id {$from_where} {$order_by} LIMIT {$rows}"; }
function show() { global $db, $dblang, $URLMethod, $tags_words_limit, $tags_min_pts, $tags_max_pts; // if we didnt set a word limit, use the default set in the config.php if ($this->word_limit == NULL) { $this->word_limit = $tags_words_limit; } // if we didnt set the minimum font points, use the default set in the config.php if ($this->min_points == NULL) { $this->min_points = $tags_min_pts; } // if we didnt set the maximum font points, use the default set in the config.php if ($this->max_points == NULL) { $this->max_points = $tags_max_pts; } // see if we clicked on a link to filter to a specific time range if (($from = check_integer('range')) >= 0 && $from < count($this->range_values) && $this->range_values[$from] > 0) { $from_time = time() - $this->range_values[$from]; $from_where = "FROM " . table_tags . ", " . table_links . " WHERE tag_lang='{$dblang}' and tag_date > FROM_UNIXTIME({$from_time}) and link_id = tag_link_id and "; $time_query = "&from={$from_time}"; $this->smarty_variable->assign('time_query', $time_query); } else { $from_where = "FROM " . table_tags . ", " . table_links . " WHERE tag_lang='{$dblang}' and link_id = tag_link_id and "; } if ($this->filterTo == 'all') { $from_where .= " link_status!='discard' "; } if ($this->filterTo == 'queued') { $from_where .= " link_status='queued' "; } if ($this->filterTo == 'published') { $from_where .= " link_status='published' "; } if ($this->filterCategory > 0) { $from_where .= " and link_category='" . $this->filterCategory . "' "; } $from_where .= " GROUP BY tag_words"; $max = max($db->get_var("select count(*) as words {$from_where} order by words desc limit 1"), 2); $coef = ($this->max_points - $this->min_points) / ($max - 1); $sql = "select tag_words, count(*) as count {$from_where} order by count desc limit {$this->word_limit}"; //echo $sql; $res = $db->get_results($sql); if ($res) { foreach ($res as $item) { //echo $item->tag_words; $words[$item->tag_words] = $item->count; } ksort($words); $tag_number = array(); $tag_name = array(); $tag_count = array(); $tag_size = array(); $tag_url = array(); $tagnumber = 0; foreach (array_keys($words) as $theword) { $tag_number[$tagnumber] = tagnumber; $tag_name[$tagnumber] = $theword; $tag_count[$tagnumber] = $words[$theword]; $tag_size[$tagnumber] = $tags_min_pts + ($tag_count[$tagnumber] - 1) * $coef; if (isset($time_query)) { $tag_url[$tagnumber] = getmyurl('tag2', $tag_name[$tagnumber], $from_time); } else { $tag_url[$tagnumber] = getmyurl('tag', urlencode($tag_name[$tagnumber])); } $tagnumber = $tagnumber + 1; } } // Set the smarty variables if (isset($words)) { $this->smarty_variable->assign('words', $words); } if (isset($tag_number)) { $this->smarty_variable->assign('tag_number', $tag_number); } else { $this->smarty_variable->assign('tag_number', 0); } if (isset($tag_name)) { $this->smarty_variable->assign('tag_name', $tag_name); } if (isset($tag_count)) { $this->smarty_variable->assign('tag_count', $tag_count); } if (isset($tag_size)) { $this->smarty_variable->assign('tag_size', $tag_size); } if (isset($tag_url)) { $this->smarty_variable->assign('tag_url', $tag_url); } $this->smarty_variable->assign('tags_words_limit', $this->word_limit); $this->smarty_variable->assign('tags_min_pts', $this->min_points); $this->smarty_variable->assign('tags_max_pts', $this->max_points); $this->smarty_variable->assign('tags_largest_tag', $max); $this->smarty_variable->assign('tags_coef', $coef); }
function do_sidebar_shake() { global $db, $dblang, $globals; echo '<div id="sidebar">'; echo '<ul class="main-menu">'; echo '<li>' . "\n"; echo '<div class="note-temp">' . "\n"; echo '<strong>'._('¡Tu voto es importante!').'</strong><br/><br/>'; //echo _('Menea las noticias que te parecen más interesantes. Cuando reciba suficientes votos será promovida a la página principal. ') . '<br/><br/>'; echo '<strong>'._('Usa las categorías para conseguir que la lista sea más corta. ').'</strong>'._(' Así no te perderás entradas interesantes de tus temas preferidos.')."\n"; echo '</div>' . "\n"; echo '</li>' . "\n"; // echo '<li><div class="boxed"><div>'; // Categories box do_categories ('shakeit', check_integer('category')); echo '<li>'. "\n"; echo '<div class="shakeit-form">'. "\n"; echo '<label for="search">'._('búsqueda en pendientes').'</label>'; "\n"; echo '<form class="shakeit-form" action="">'; "\n"; echo '<input class="shakeit-form-input" type="text" id="search2" name="search" value="'; "\n"; if (!empty($_REQUEST['search'])) echo htmlspecialchars(strip_tags($_REQUEST['search'])); echo '"/>'; "\n"; echo '<input class="shakeit-form-submit" type="submit" id="search-button" value="'._('buscar').'" />'; "\n"; echo '</form>'. "\n"; echo '</div>'. "\n"; echo '</li>'. "\n"; //do_banner_right_a(); // right side banner echo '<li><div class="mnu-bugs"><a href="http://meneame.wikispaces.com/Bugs">'._("reportar un bug").'</a></div></li>' . "\n"; do_rss_box(); echo '</ul>'. "\n"; echo '</div>'. "\n"; }
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include '../config.php'; include_once mnminclude . 'ban.php'; header('Content-Type: application/json; charset=UTF-8'); array_push($globals['cache-control'], 'no-cache'); http_cache(); if (check_ban_proxy()) { error(_('IP no permitida')); } if (!($id = check_integer('id'))) { error(_('falta el ID del partido')); } $vote = check_integer('vote'); if (!in_array($vote, array(0, 1, 2))) { error(_('falta el valor del voto')); } if (empty($_REQUEST['user']) && $_REQUEST['user'] !== '0') { error(_('falta el código de usuario')); } if (!check_security_key($_REQUEST['key'])) { error(_('clave de control incorrecta')); } $match = new Match($id); if (!$match->read_basic()) { error(_('partido inexistente')); } if (!$match->is_votable()) { error(_('votos cerrados'));
$order_field = 'link_date'; $link_date = "date"; $home = "/upcoming.php"; break; case 'all': $title = ""; $order_field = 'link_date'; $link_date = "date"; break; } if ($status == 'all') { $from_where = "FROM " . table_links . " WHERE link_status!='discard' "; } else { $from_where = "FROM " . table_links . " WHERE link_status='{$status}' "; } if ($cat = check_integer('category')) { $from_where .= " AND link_category={$cat} "; $category_name = $db->get_var("SELECT category_name FROM " . table_categories . " WHERE category_id = {$cat} AND category_lang='{$dblang}'"); $title .= " / " . htmlspecialchars($category_name); } if ($search) { $from_where .= $search; $title = _(PLIGG_Visual_RSS_RSSFeed) . ": " . htmlspecialchars($_REQUEST['search']); } $order_by = " ORDER BY {$order_field} DESC "; $last_modified = $db->get_var("SELECT UNIX_TIMESTAMP(max({$order_field})) links {$from_where}"); $sql = "SELECT link_id {$from_where} {$order_by} LIMIT {$rows}"; } do_rss_header($title); $link = new Link(); $links = $db->get_col($sql);
function get_current_page() { if ($var = check_integer('page')) { return $var; } else { return 1; } }
} if ($nb_erreur == 0) { # we check if it does not already exist $sgbd = sql_connect(); $sql_verif = sql_replace($sql['member']['verif_presence_member'], $_POST); $res_verif = sql_query($sql_verif); $nb_res = sql_num_rows($res_verif); sql_free_result($res_verif); sql_close($sgbd); if ($nb_res != "0") { $page['erreur'][$nb_erreur]['message'] = $lang['member']['E_exist_member']; $nb_erreur++; } } # size et weight if (isset($_POST['size']) and !empty($_POST['size']) and !check_integer($_POST['size'])) { $page['erreur'][$nb_erreur]['message'] = $lang['member']['E_invalid_size']; $nb_erreur++; } # email if (isset($_POST['email']) and !empty($_POST['email']) and !check_email($_POST['email'])) { $page['erreur'][$nb_erreur]['message'] = $lang['member']['E_invalid_email']; $nb_erreur++; } elseif (isset($_POST['email']) and !empty($_POST['email'])) { $sgbd = sql_connect(); $sql_verif_email = sql_replace($sql['member']['verif_member_email'], $_POST); $res = sql_query($sql_verif_email); $nb_res = sql_num_rows($res); sql_free_result($res); sql_close($sgbd); if ($nb_res != "0") {
// The client requests version number if (!empty($_GET['getv'])) { echo $sneak_version; die; } $link_id = intval($_GET['link']); if (!$link_id > 0) { die; } $now = time(); $linkdb = $db->get_row("select link_votes, link_anonymous, link_negatives, link_karma, link_comments, unix_timestamp(link_date) as date from links where link_id = {$link_id}"); if (!$linkdb || $now - $linkdb->date > $globals['time_enabled_comments']) { error(_('noticia antigua o no existente')); die; } if (!($time = check_integer('time')) > 0) { $time = 0; $dbtime = date("YmdHis", $time - 86400); } else { $dbtime = date("YmdHis", $time); } $last_timestamp = $time; if (!empty($_GET['items']) && intval($_GET['items']) > 0) { $max_items = intval($_GET['items']); } else { $max_items = 10; } header('Content-Type: text/html; charset=utf-8'); $client_version = $_GET['v']; if (empty($client_version) || $client_version != -1 && $client_version != $sneak_version) { echo "window.location.reload(true);";
if ($nb_season == 0) { $var['link_season'] = convert_url("index.php?r=" . $lang['general']['idurl_competition'] . "&v1=season_list&fen=pop"); $page['erreur'][$nb_erreur]['message'] = text_replace($lang['match']['E_empty_season'], $var); $nb_erreur++; } else { $ligne_season = sql_fetch_array($res_season); $_POST['season'] = $ligne_season['season_id']; // on stocke la season } sql_free_result($res_season); } if (isset($_POST['hour']) and !empty($_POST['hour']) and !check_hour($_POST['hour'])) { $page['erreur'][$nb_erreur]['message'] = $lang['match']['E_invalid_hour']; $nb_erreur++; } if (isset($_POST['spectators']) and !empty($_POST['spectators']) and !check_integer($_POST['spectators'])) { $page['erreur'][$nb_erreur]['message'] = $lang['match']['E_invalid_spectators']; $nb_erreur++; } # on verifie qu'il n'est pas deja present if ($nb_erreur == 0) { $_POST['date_hour'] = convert_date_sql($_POST['date']) . " " . $_POST['hour']; $sgbd = sql_connect(); $sql_verif = sql_replace($sql['match']['verif_presence_match'], $_POST); $res_verif = sql_query($sql_verif); $nb_res = sql_num_rows($res_verif); sql_free_result($res_verif); sql_close($sgbd); if ($nb_res != "0") { $page['erreur'][$nb_erreur]['message'] = $lang['match']['E_exist_match']; $nb_erreur++;
<?php // The source code packaged with this file is Free Software, Copyright (C) 2005 by // Ricardo Galli <gallir at uib dot es>. // It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include '../config.php'; include_once mnminclude . 'ban.php'; header('Content-Type: application/json; charset=UTF-8'); if (check_ban_proxy()) { error(_('IP no permitida')); } if (!($id = check_integer('id'))) { error(_('falta el ID del comentario')); } if (empty($_REQUEST['user'])) { error(_('falta el código de usuario')); } if ($current_user->user_id != $_REQUEST['user']) { error(_('usuario incorrecto') . $current_user->user_id . '-' . htmlspecialchars($_REQUEST['user'])); } if (!check_security_key($_REQUEST['key'])) { error(_('clave de control incorrecta')); } if (empty($_REQUEST['value']) || !is_numeric($_REQUEST['value'])) { error(_('falta valor del voto')); } if ($current_user->user_karma < $globals['min_karma_for_post_votes']) { error(_('karma bajo para votar comentarios'));
function get_current_page() { if ($var = check_integer('page')) { return $var; } else { return 1; } // return $_GET['page']>0 ? $_GET['page'] : 1; }
// It's licensed under the AFFERO GENERAL PUBLIC LICENSE unless stated otherwise. // You can get copies of the licenses here: // http://www.affero.org/oagpl.html // AFFERO GENERAL PUBLIC LICENSE is also included in the file called "COPYING". include '../config.php'; include mnminclude . 'link.php'; include mnminclude . 'user.php'; include mnminclude . 'sneak.php'; $foo_link = new Link(); // The client requests version number if (!empty($_REQUEST['getv'])) { echo $sneak_version; die; } $now = $globals['now']; if (!($time = check_integer('time')) > 0 || $now - $time > 1200) { $time = $now - 1200; } $dbtime = date("YmdHis", $time); $last_timestamp = $time; if (!empty($_REQUEST['items']) && intval($_REQUEST['items']) > 0) { $max_items = intval($_REQUEST['items']); } if ($max_items < 1 || $max_items > 50) { $max_items = 50; // Avoid abuse } header('Content-Type: text/html; charset=utf-8'); $client_version = $_REQUEST['v']; if (empty($client_version) || $client_version != -1 && $client_version != $sneak_version) { echo "window.location.reload(true);";
/** * Creates new page * @param $params - set of fields * @param $copy_to_other_langs */ public function PageCreate($params = array(), $copy_to_other_langs = 'yes') { // Get input parameters if (isset($params['content_type'])) { $this->page['content_type'] = $params['content_type']; } if (isset($params['link_url'])) { $this->page['link_url'] = $params['link_url']; } if (isset($params['link_target'])) { $this->page['link_target'] = $params['link_target']; } if (isset($params['page_title'])) { $this->page['page_title'] = $params['page_title']; } if (isset($params['page_key'])) { $this->page['page_key'] = $params['page_key']; } if (isset($params['page_text'])) { $this->page['page_text'] = $params['page_text']; } if (isset($params['menu_id'])) { $this->page['menu_id'] = $params['menu_id']; } if (isset($params['menu_link'])) { $this->page['menu_link'] = $params['menu_link']; } if (isset($params['is_published'])) { $this->page['is_published'] = $params['is_published']; } if (isset($params['language_id'])) { $this->page['language_id'] = $params['language_id']; } if (isset($params['comments_allowed'])) { $this->page['comments_allowed'] = $params['comments_allowed']; } if (isset($params['show_in_search'])) { $this->page['show_in_search'] = $params['show_in_search']; } if (isset($params['priority_order'])) { $this->page['priority_order'] = $params['priority_order']; } if (isset($params['access_level'])) { $this->page['access_level'] = $params['access_level']; } if (isset($params['finish_publishing'])) { $this->page['finish_publishing'] = $params['finish_publishing']; } if (isset($params['tag_title'])) { $this->page['tag_title'] = $params['tag_title']; } if (isset($params['tag_keywords'])) { $this->page['tag_keywords'] = $params['tag_keywords']; } if (isset($params['tag_description'])) { $this->page['tag_description'] = $params['tag_description']; } // Menu link cannot be more then 40 characters if (strlen($this->page['menu_link']) > 40) { $this->error = _PAGE_LINK_TOO_LONG; return false; } else { if ($this->page['page_title'] == '') { $this->error = _PAGE_HEADER_EMPTY; return false; } else { if ($this->page['content_type'] == 'link' && $this->page['link_url'] == '') { $this->error = str_replace('_FIELD_', '<b>' . _LINK . '</b>', _FIELD_CANNOT_BE_EMPTY); $this->focusOnField = 'link_url'; return false; } else { if (!check_integer($this->page['priority_order']) || $this->page['priority_order'] < 0) { $this->error = str_replace('_FIELD_', '<b>' . _ORDER . '</b>', _FIELD_MUST_BE_NUMERIC_POSITIVE); $this->focusOnField = 'priority_order'; return false; } else { if (strlen($this->page['tag_title']) > 255) { $msg_text = str_replace('_FIELD_', '<b>TITLE</b>', _FIELD_LENGTH_ALERT); $msg_text = str_replace('_LENGTH_', '255', $msg_text); $this->error = $msg_text; $this->focusOnField = 'tag_title'; return false; } else { if (strlen($this->page['tag_keywords']) > 512) { $msg_text = str_replace('_FIELD_', '<b>KEYWORDS</b>', _FIELD_LENGTH_ALERT); $msg_text = str_replace('_LENGTH_', '512', $msg_text); $this->error = $msg_text; $this->focusOnField = 'tag_keywords'; return false; } else { if (strlen($this->page['tag_description']) > 512) { $msg_text = str_replace('_FIELD_', '<b>DESCRIPTION</b>', _FIELD_LENGTH_ALERT); $msg_text = str_replace('_LENGTH_', '512', $msg_text); $this->error = $msg_text; $this->focusOnField = 'tag_description'; return false; } } } } } } } if (strtolower(SITE_MODE) == 'demo') { $this->error = _OPERATION_BLOCKED; return false; } else { if ($copy_to_other_langs == 'yes') { $total_languages = Languages::GetAllActive(); } else { $total_languages = Languages::GetAllLanguages(' priority_order ASC', '', 'abbreviation=\'' . $this->page['language_id'] . '\''); } $page_code = get_random_string(10); for ($i = 0; $i < $total_languages[1]; $i++) { // Create new record $sql = 'INSERT INTO ' . TABLE_PAGES . '( id, page_code, language_id, content_type, link_url, link_target, page_key, page_title, page_text, menu_id, menu_link, tag_title, tag_keywords, tag_description, comments_allowed, show_in_search, date_created, date_updated, finish_publishing, is_published, is_system_page, system_page, status_changed, access_level, priority_order )VALUES( NULL, \'' . $page_code . '\', \'' . $total_languages[0][$i]['abbreviation'] . '\', \'' . $this->page['content_type'] . '\', \'' . encode_text($this->page['link_url']) . '\', \'' . $this->page['link_target'] . '\', \'\', \'' . encode_text($this->page['page_title']) . '\', \'' . encode_text($this->page['page_text']) . '\', ' . (int) $this->GetMenuIdByLang($this->page['menu_id'], $total_languages[0][$i]['abbreviation']) . ', \'' . encode_text($this->page['menu_link']) . '\', \'' . encode_text($this->page['tag_title']) . '\', \'' . encode_text($this->page['tag_keywords']) . '\', \'' . encode_text($this->page['tag_description']) . '\', ' . (int) $this->page['comments_allowed'] . ', ' . (int) $this->page['show_in_search'] . ', \'' . date('Y-m-d H:i:s') . '\', \'0000-00-00 00:00:00\', \'' . $this->page['finish_publishing'] . '\', ' . (int) $this->page['is_published'] . ', 0, \'\', \'0000-00-00 00:00:00\', \'' . $this->page['access_level'] . '\', ' . (int) $this->page['priority_order'] . ' )'; if (database_void_query($sql)) { // Update page_key $last_insert_id = mysql_insert_id(); $sql = 'UPDATE ' . TABLE_PAGES . ' SET page_key=\'' . $this->page['page_key'] . '\' WHERE id=' . (int) $last_insert_id; if (database_void_query($sql)) { // ok $this->page_id = $last_insert_id; } else { $this->error = _TRY_LATER; return false; } } else { $this->error = _TRY_LATER; return false; } } return true; } }
function show() { // CDPDF old = global $db, $dblang, $URLMethod, $tags_words_limit, $tags_min_pts, $tags_max_pts; global $db, $dblang, $URLMethod, $tags_words_limit, $tags_min_pts, $tags_max_pts, $thecat; // if we didnt set a word limit, use the default set in the config.php if ($this->word_limit == NULL) { $this->word_limit = $tags_words_limit; } // if we didnt set the minimum font points, use the default set in the config.php if ($this->min_points == NULL) { $this->min_points = $tags_min_pts; } // if we didnt set the maximum font points, use the default set in the config.php if ($this->max_points == NULL) { $this->max_points = $tags_max_pts; } // see if we clicked on a link to filter to a specific time range if (($from = check_integer('range')) >= 0 && $from < count($this->range_values) && $this->range_values[$from] > 0) { $from_time = time() - $this->range_values[$from]; $from_where = "FROM " . table_tags . ", " . table_links . " WHERE tag_lang='{$dblang}' and tag_date > FROM_UNIXTIME({$from_time}) and link_id = tag_link_id and "; $time_query = "&from={$from_time}"; $this->smarty_variable->assign('time_query', $time_query); } else { $from_where = "FROM " . table_tags . ", " . table_links . " WHERE tag_lang='{$dblang}' and link_id = tag_link_id and "; $cache_possible = 1; } if ($this->filterTo == 'all') { $from_where .= " (link_status='published' OR link_status='new') "; $cache_possible++; } if ($this->filterTo == 'new') { $from_where .= " link_status='new' "; } if ($this->filterTo == 'published') { $from_where .= " link_status='published' "; } if (is_numeric($this->filterCategory) && $this->filterCategory > 0) { $catId = $this->filterCategory; $child_cats = ''; // do we also search the subcategories? if (Independent_Subcategories == true) { $child_array = ''; // get a list of all children and put them in $child_array. children_id_to_array($child_array, table_categories, $catId); if ($child_array != '') { // build the sql foreach ($child_array as $child_cat_id) { $child_cat_sql .= ' OR `link_category` = ' . $child_cat_id . ' '; if (Multiple_Categories) { $child_cat_sql .= ' OR ac_cat_id = ' . $child_cat_id . ' '; } } } } if (Multiple_Categories) { $child_cat_sql .= " OR ac_cat_id = {$catId} "; } $from_where .= " AND (link_category={$catId} " . $child_cat_sql . ")"; $cache_possible = 0; } //CDPDF if (isset($_REQUEST['category'])) { $catId = $db->get_var("SELECT category_id from " . table_categories . " where category_safe_name = '" . $db->escape($_REQUEST['category']) . "';"); $category_name = $db->get_var("SELECT category_name from " . table_categories . " where category_safe_name = '" . $db->escape($_REQUEST['category']) . "';"); $this->smarty_variable->assign('category_name', $category_name); //$catId = get_category_id($this->category); if (isset($catId)) { $child_cats = ''; // do we also search the subcategories? if (!Independent_Subcategories) { $child_array = ''; // get a list of all children and put them in $child_array. children_id_to_array($child_array, table_categories, $catId); if ($child_array != '') { // build the sql foreach ($child_array as $child_cat_id) { $child_cat_sql .= ' OR `link_category` = ' . $child_cat_id . ' '; if (Multiple_Categories) { $child_cat_sql .= ' OR ac_cat_id = ' . $child_cat_id . ' '; } } } } if (Multiple_Categories) { $child_cat_sql .= " OR ac_cat_id = {$catId} "; } $cache_possible = 0; $from_where .= " AND (link_category={$catId} " . $child_cat_sql . ")"; // Search on additional categories if (Multiple_Categories) { $from_where = str_replace("WHERE", " LEFT JOIN " . table_additional_categories . " ON ac_link_id=link_id WHERE", $from_where); } } } //CDPDF $from_where .= " GROUP BY tag_words"; /*CDPDF : we calculate the coefficient with the following queries $max = max($db->get_var("select count(*) as words $from_where order by words desc limit 1"), 2); $coef = ($this->max_points - $this->min_points)/($max-1); CDPDF */ if ($cache_possible == 2) { $sql = "select * FROM " . table_tag_cache . " limit {$this->word_limit}"; $res = $db->get_results($sql); } else { $sql = "select tag_words, count(DISTINCT link_id) as count {$from_where} order by count desc limit {$this->word_limit}"; //echo $sql; $res = $db->get_results($sql); } if ($res) { foreach ($res as $item) { //echo $item->tag_words; $words[$item->tag_words] = $item->count; $tagcount[] = $item->count; } //CDPDF modification $max = max($tagcount); // DB 12/10/08 if ($max != 1) { $coef = ($this->max_points - $this->min_points) / ($max - 1); } else { $coef = 0; } ///// //cdpdf mofiification ksort($words); $tag_number = array(); $tag_name = array(); $tag_count = array(); $tag_size = array(); $tag_url = array(); $tagnumber = 0; foreach (array_keys($words) as $theword) { $tag_number[$tagnumber] = $tagnumber; $tag_name[$tagnumber] = $theword; $tag_count[$tagnumber] = $words[$theword]; $tag_size[$tagnumber] = $tags_min_pts + ($tag_count[$tagnumber] - 1) * $coef; if (isset($time_query)) { $tag_url[$tagnumber] = getmyurl('tag2', urlencode($tag_name[$tagnumber]), $from_time); } else { $tag_url[$tagnumber] = getmyurl('tag', urlencode($tag_name[$tagnumber])); } $tagnumber = $tagnumber + 1; } } // Set the smarty variables if (isset($words)) { $this->smarty_variable->assign('words', $words); } if (isset($tag_number)) { $this->smarty_variable->assign('tag_number', $tag_number); } else { $this->smarty_variable->assign('tag_number', 0); } if (isset($tag_name)) { $this->smarty_variable->assign('tag_name', $tag_name); } if (isset($tag_count)) { $this->smarty_variable->assign('tag_count', $tag_count); } if (isset($tag_size)) { $this->smarty_variable->assign('tag_size', $tag_size); } if (isset($tag_url)) { $tag_url = str_replace(" ", "+", $tag_url); // Steef 2k7-07 tag search fix $this->smarty_variable->assign('tag_url', $tag_url); } $this->smarty_variable->assign('tags_words_limit', $this->word_limit); $this->smarty_variable->assign('tags_min_pts', $this->min_points); $this->smarty_variable->assign('tags_max_pts', $this->max_points); $this->smarty_variable->assign('tags_largest_tag', $max); $this->smarty_variable->assign('tags_coef', $coef); }
$main_smarty = do_sidebar($main_smarty); // put the names of the tabs in an array for the tag cloud tpl file $range_names = array($main_smarty->get_config_vars('PLIGG_Visual_Tags_All'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_48_Hours'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_This_Week'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_This_Month'), $main_smarty->get_config_vars('PLIGG_Visual_Tags_This_Year')); // give each name a value $range_values = array(0, 172800, 604800, 2592000, 31536000); // show the tag cloud $cloud = new TagCloud(); $cloud->smarty_variable = $main_smarty; // pass smarty to the function so we can set some variables $cloud->range_values = $range_values; if (isset($_GET['categoryID']) && is_numeric($_GET['categoryID'])) { $cloud->filterCategory = $_GET['categoryID']; } $cloud->show(); $main_smarty = $cloud->smarty_variable; // get the updated smarty back from the function // give smarty data for the links to filter by time if (!($current_range = check_integer('range')) || $current_range < 1 || $current_range >= count($range_values)) { $current_range = 0; } // misc smarty $main_smarty->assign('current_range', $current_range); $main_smarty->assign('range_names', $range_names); $main_smarty->assign('range_values', $range_values); $main_smarty->assign('count_range_values', count($range_values)); // pagename define('pagename', 'cloud'); $main_smarty->assign('pagename', pagename); // show the template $main_smarty->assign('tpl_center', $the_template . '/tag_cloud_center'); $main_smarty->display($the_template . '/pligg.tpl');
if (!@mysql_connect($_POST['host'], $_POST['user_base'], $_POST['pass_base'])) { $page['erreur'][$nb_erreur]['message'] = $lang['administration']['E_invalid_connection_base']; $nb_erreur++; } elseif (!mysql_select_db($_POST['name_base'])) { $page['erreur'][$nb_erreur]['message'] = $lang['administration']['E_invalid_selection_base']; $nb_erreur++; } # we check that content settings are numbers $content_settings = array('nb_news', 'nb_club', 'nb_team', 'nb_member', 'nb_match', 'nb_competition', 'nb_field', 'nb_forum_topic', 'nb_forum_message', 'home_nb_news', 'home_nb_match'); $nb_erreur_empty = 0; $nb_erreur_integer = 0; $nb_erreur_range = 0; foreach ($content_settings as $id => $value) { if ($_POST[$value] == '') { $nb_erreur_empty++; } elseif (!check_integer($_POST[$value])) { $nb_erreur_integer++; } elseif ($_POST[$value] < 1 or $_POST[$value] > 100) { $nb_erreur_range++; } } if ($nb_erreur_empty != 0) { $page['erreur'][$nb_erreur]['message'] = $lang['administration']['E_empty_content_settings']; $nb_erreur++; } if ($nb_erreur_integer != 0) { $page['erreur'][$nb_erreur]['message'] = $lang['administration']['E_invalid_content_settings_integer']; $nb_erreur++; } if ($nb_erreur_range != 0) { $page['erreur'][$nb_erreur]['message'] = $lang['administration']['E_invalid_content_settings_range'];
break; } $from_where = ''; if ($_REQUEST['q']) { $order_field = 'link_date'; // Because sub_statuses is not used if ($search) { $from_where = "FROM links WHERE {$search} "; } else { $from_where = "FROM links WHERE false "; // Force to return empty set } $title = $site_info->name . ": " . htmlspecialchars(strip_tags($_REQUEST['q'])); } elseif ($status == 'all' || $status == 'all_local') { $from_where = "FROM links, sub_statuses WHERE id = {$site_id} AND status in ('published', 'queued') AND link_id = link"; } elseif ($uid = check_integer('subs')) { $subs = $db->get_col("SELECT pref_value FROM prefs WHERE pref_user_id = {$uid} and pref_key = 'sub_follow' order by pref_value LIMIT 1000"); $user_login = $db->get_var("select user_login from users where user_id={$uid}"); $title .= " -{$user_login}-"; if ($subs) { $subs = implode(',', $subs); $from_where = "FROM sub_statuses, links WHERE sub_statuses.id in ({$subs}) AND status='{$status}' AND link_id = link"; } } if (empty($from_where)) { $from_where = "FROM sub_statuses, links WHERE id = {$site_id} AND status='{$status}' AND link_id = link"; } $order_by = " ORDER BY {$order_field} DESC "; $sql = "SELECT link_id {$from_where} {$order_by} LIMIT {$rows}"; } if (!empty($sql)) {
if ($_POST['name_round'][$key] == "" and $name_erreur == 0) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_empty_name_round']; $nb_erreur++; $name_erreur = 1; } if ($_POST['standings'][$key] == 1 and (!check_integer($_POST['point_win_at_home'][$key]) or !check_integer($_POST['point_win_away'][$key]) or !check_integer($_POST['point_tie_at_home'][$key]) or !check_integer($_POST['point_tie_away'][$key]) or !check_integer($_POST['point_defeat_at_home'][$key]) or !check_integer($_POST['point_defeat_away'][$key])) and $point_erreur == 0) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_invalid_point']; $nb_erreur++; $point_erreur = 1; } if (!empty($_POST['group'][$key]) and !check_integer($_POST['group'][$key]) and $group_erreur == 0) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_invalid_group']; $nb_erreur++; $group_erreur = 1; } if (!empty($_POST['day'][$key]) and !check_integer($_POST['day'][$key]) and $day_erreur == 0) { $page['erreur'][$nb_erreur]['message'] = $lang['competition']['E_invalid_day']; $nb_erreur++; $day_erreur = 1; } } } # there is no error in submited datas if ($nb_erreur == 0) { # case : new item to add if (!isset($_POST['id']) or empty($_POST['id']) and $right_user['add_competition']) { $sql_add = sql_replace($sql['competition']['insert_competition'], $_POST); $sgbd = sql_connect(); $execution = sql_query($sql_add); if ($execution) { $page['L_message_competition'] = $lang['competition']['form_competition_add_1'];