/** |--------------------------------------------------------------------------| | https://github.com/Bigjoos/ | |--------------------------------------------------------------------------| | Licence Info: GPL | |--------------------------------------------------------------------------| | Copyright (C) 2010 U-232 V5 | |--------------------------------------------------------------------------| | A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. | |--------------------------------------------------------------------------| | Project Leaders: Mindless, Autotron, whocares, Swizzles. | |--------------------------------------------------------------------------| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ ( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e ) \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ */ function docleanup($data) { global $INSTALLER09, $queries, $mc1; set_time_limit(1200); ignore_user_abort(1); //== Delete inactive user accounts $secs = 350 * 86400; $dt = TIME_NOW - $secs; $maxclass = UC_STAFF; sql_query("SELECT FROM users WHERE parked='no' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}"); //== Delete parked user accounts $secs = 675 * 86400; // change the time to fit your needs $dt = TIME_NOW - $secs; $maxclass = UC_STAFF; sql_query("SELECT FROM users WHERE parked='yes' AND status='confirmed' AND class < {$maxclass} AND last_access < {$dt}"); if ($queries > 0) { write_log("Inactive Clean -------------------- Inactive Clean Complete using {$queries} queries--------------------"); } if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated"; } if ($data['clean_log']) { cleanup_log($data); } }
function popular($skin_dir = 'basic', $pop_cnt = 7, $date_cnt = 3) { global $config, $g5; if (!$skin_dir) { $skin_dir = 'basic'; } $date_gap = date("Y-m-d", G5_SERVER_TIME - $date_cnt * 86400); $sql = " select pp_word, count(*) as cnt from {$g5['popular_table']} where pp_date between '{$date_gap}' and '" . G5_TIME_YMD . "' group by pp_word order by cnt desc, pp_word limit 0, {$pop_cnt} "; $result = sql_query($sql); for ($i = 0; $row = sql_fetch_array($result); $i++) { $list[$i] = $row; // 스크립트등의 실행금지 $list[$i]['pp_word'] = get_text($list[$i]['pp_word']); } ob_start(); if (G5_IS_MOBILE) { $popular_skin_path = G5_MOBILE_PATH . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir; $popular_skin_url = G5_MOBILE_URL . '/' . G5_SKIN_DIR . '/popular/' . $skin_dir; } else { $popular_skin_path = G5_SKIN_PATH . '/popular/' . $skin_dir; $popular_skin_url = G5_SKIN_URL . '/popular/' . $skin_dir; } include_once $popular_skin_path . '/popular.skin.php'; $content = ob_get_contents(); ob_end_clean(); return $content; }
function check_bans($ip, &$reason = '') { global $INSTALLER09, $mc1; $key = 'bans:::' . $ip; if (($ban = $mc1->get_value($key)) === false) { $nip = ip2long($ip); $ban_sql = sql_query('SELECT comment FROM bans WHERE (first <= ' . $nip . ' AND last >= ' . $nip . ') LIMIT 1'); if (mysqli_num_rows($ban_sql)) { $comment = mysqli_fetch_row($ban_sql); $reason = 'Manual Ban (' . $comment[0] . ')'; $mc1->cache_value($key, $reason, 86400); // 86400 // banned return true; } mysqli_free_result($ban_sql) || is_object($ban_sql) && get_class($ban_sql) == "mysqli_result" ? true : false; $mc1->cache_value($key, 0, 86400); // 86400 // not banned return false; } elseif (!$ban) { return false; } else { $reason = $ban; return true; } }
function scan_area($sector, $range) { $result = sql_query("SELECT * FROM s_sectors WHERE id={$sector}"); $sector = sql_fetchrow($result); echo "<table align=center border=1>\n"; echo " <tr><th colspan=4>Scanning from origin " . $sector['name'] . " ( " . $sector['distance'] . " / " . $sector['angle'] . " ) @ " . $range . " lightyears</th></tr>\n"; echo " <tr><td>Name</td><td>Race</td><td>D / A</td><td>Range</td></tr>\n"; $result = sql_query("SELECT * FROM g_vessels ORDER BY user_id"); while ($vessel = sql_fetchrow($result)) { $result2 = sql_query("SELECT * FROM s_species WHERE user_id = " . $vessel['user_id']); $race = sql_fetchrow($result2); if ($vessel['sector_id'] == 0) { $distance = calc_distance($sector['distance'], $sector['angle'], $vessel['distance'], $vessel['angle']); if ($distance <= $range) { echo "<tr><td>" . $vessel['name'] . " (" . $vessel['sector_id'] . ")</td><td>" . $race['name'] . "</td><td>" . $vessel['distance'] . " / " . $vessel['angle'] . "</td><td>" . $distance . "</td></tr>\n"; } } else { $result2 = sql_query("SELECT * FROM s_sectors WHERE id=" . $vessel['sector_id']); $vessel_sector = sql_fetchrow($result2); $distance = calc_distance($sector['distance'], $sector['angle'], $vessel_sector['distance'], $vessel_sector['angle']); if ($distance <= $range) { echo "<tr><td>" . $vessel['name'] . " (" . $vessel['sector_id'] . ")</td><td>" . $race['name'] . "</td><td>SECTOR: " . $vessel_sector['distance'] . " / " . $vessel_sector['angle'] . "</td><td>" . $distance . "</td></tr>\n"; } } } print "</table>"; print "<br><br>"; return; }
function show_owned_convoys($user_id) { assert(is_numeric($user_id)); echo "<table border=1 align=center>"; echo " <tr>"; echo " <th>Convoy Name</th>"; echo " <th>Flag Ship</th>"; echo " <th>Ships</th>"; echo " <th>Status</th>"; echo " </tr>"; $result = sql_query("SELECT c.* FROM s_convoys c, s_vessels v WHERE c.vessel_id=v.id AND v.user_id=" . $user_id); while ($convoy = sql_fetchrow($result)) { // Get the flag ship of the convoy $vesseltype = vessel_get_vessel_type($convoy['id']); // Count the number of ships $result2 = sql_query("SELECT c.* FROM s_convoys c, s_vessels v WHERE c.vessel_id=v.id AND v.user_id=" . $user_id); $tmp = csl_create_array($result2, "vessel_ids"); $shipcount = count($tmp); // Get the status of the convoy $status = $convoy['status']; echo "<tr>"; echo "<td> " . $convoy['name'] . " </td>"; echo "<td> " . $vesseltype['name'] . " </td>"; echo "<td> " . $shipcount . " </td>"; echo "<td> " . $status . " </td>"; echo "</tr>"; } echo "</table>"; }
protected function getDateClassrooms($id_date) { $query = "SELECT DISTINCT classroom" . " FROM %lms_course_date_day" . " WHERE id_date = " . $id_date; $result = sql_query($query); $array_classroom = array(); while (list($id_classroom) = sql_fetch_row($result)) { $array_classroom[$id_classroom] = $id_classroom; } $res = ''; $first = true; if (isset($array_classroom[0])) { $first = false; $res .= Lang::t('_NOT_ASSIGNED', 'admin_date'); } $query = "SELECT name" . " FROM %lms_classroom" . " WHERE idClassroom IN (" . implode(',', $array_classroom) . ")" . " ORDER BY name"; $result = sql_query($query); while (list($name) = sql_fetch_row($result)) { if ($first) { $first = false; $res .= $name; } else { $res .= ', ' . $name; } } return $res; }
function maj_vieille_base_1927_create() { global $tables_principales, $tables_auxiliaires, $tables_images, $tables_sequences, $tables_documents, $tables_mime; // ne pas revenir plusieurs fois (si, au contraire, il faut pouvoir // le faire car certaines mises a jour le demandent explicitement) # static $vu = false; # if ($vu) return; else $vu = true; foreach($tables_principales as $k => $v) spip_create_vieille_table($k, $v['field'], $v['key'], true); foreach($tables_auxiliaires as $k => $v) spip_create_vieille_table($k, $v['field'], $v['key'], false); foreach($tables_images as $k => $v) sql_query("INSERT IGNORE INTO spip_types_documents (extension, inclus, titre, id_type) VALUES ('$k', 'image', '" . (is_numeric($v) ? (strtoupper($k) . "', $v") : "$v', 0") . ")"); foreach($tables_sequences as $k => $v) sql_query("INSERT IGNORE INTO spip_types_documents (extension, titre, inclus) VALUES ('$k', '$v', 'embed')"); foreach($tables_documents as $k => $v) sql_query("INSERT IGNORE INTO spip_types_documents (extension, titre, inclus) VALUES ('$k', '$v', 'non')"); foreach ($tables_mime as $extension => $type_mime) sql_query("UPDATE spip_types_documents SET mime_type='$type_mime' WHERE extension='$extension'"); }
function docleanup($data) { global $INSTALLER09, $queries; set_time_limit(1200); ignore_user_abort(1); $sql = sql_query("SHOW TABLE STATUS FROM {$INSTALLER09['mysql_db']}"); $oht = ''; while ($row = mysqli_fetch_assoc($sql)) { if ($row['Data_free'] > 100) { $oht .= $row['Data_free'] . ','; } } $oht = rtrim($oht, ','); if ($oht != '') { $sql = sql_query("OPTIMIZE TABLE {$oht}"); } if ($queries > 0) { write_log("Auto-optimizedb--------------------Auto Optimization Complete using {$queries} queries --------------------"); } if ($oht != '') { $data['clean_desc'] = "MySQLCleanup optimized {$oht} table(s)"; } if ($data['clean_log']) { cleanup_log($data); } }
function preset_show_all_presets($user_id) { assert(is_numeric($user_id)); echo "<table align=center widht=75%>\n"; echo " <tr class=wb>\n"; echo " <th>Preset name</th>\n"; echo " <th>Distance</th>\n"; echo " <th>Angle</th>\n"; echo " <th> </th>\n"; echo " </tr>\n"; // Get all presets $result = sql_query("SELECT * FROM g_presets WHERE user_id=" . $user_id); while ($preset = sql_fetchrow($result)) { echo " <tr class=bl>\n"; echo " <td> " . $preset['name'] . " </td>\n"; echo " <td> " . $preset['distance'] . " </td>\n"; echo " <td> " . $preset['angle'] . " </td>\n"; echo " <td> [ <a href=vesselpreset.php?cmd=" . encrypt_get_vars("delete") . "&uid=" . encrypt_get_vars($user_id) . "&pid=" . encrypt_get_vars($preset['id']) . ">Delete</a> ] </td>\n"; echo " </tr>\n"; } // And add room to create a new one... echo " <tr class=bl>\n"; form_start(); echo " <input type=hidden name=cmd value=" . encrypt_get_vars("create") . ">\n"; echo " <input type=hidden name=uid value=" . encrypt_get_vars($user_id) . ">\n"; echo " <td><input type=text name=ne_name size=20 maxlength=20></td>\n"; echo " <td><input type=text name=ne_distance size=6 maxlength=6></td>\n"; echo " <td><input type=text name=ne_angle size=7 maxlength=7></td>\n"; echo " <td><input type=submit name=name=submit value=Add></td>\n"; form_end(); echo " </tr>\n"; echo "</table>\n"; }
function HookAnnotateAllRemoveannotations() { global $ref; sql_query("delete from annotate_notes where ref='{$ref}'"); sql_query("update resource set annotation_count=0 where ref='{$ref}'"); sql_query("delete from resource_keyword where resource='{$ref}' and annotation_ref>0"); }
public static function updatePass($username, $password, $secret) { $passhash = md5($secret . $wantpassword . $secret); $sql = "UPDATE `users` SET `passhash` = '{$passhash}' WHERE `username` = '{$username}'"; print $sql; sql_query($sql) or sqlerr(__FILE__, __LINE__); }
function docleanup($data) { global $INSTALLER09, $queries, $bdir; set_time_limit(0); ignore_user_abort(1); $mysql_host = $INSTALLER09['mysql_host']; $mysql_user = $INSTALLER09['mysql_user']; $mysql_pass = $INSTALLER09['mysql_pass']; $mysql_db = $INSTALLER09['mysql_db']; $bdir = $_SERVER["DOCUMENT_ROOT"] . "/include/backup"; $c1 = "mysqldump -h " . $mysql_host . " -u " . $mysql_user . " -p" . $mysql_pass . " " . $mysql_db . " -d > " . $bdir . "/db_structure.sql"; $c = "mysqldump -h " . $mysql_host . " -u " . $mysql_user . " -p" . $mysql_pass . " " . $mysql_db . " " . tables("peers|messages|sitelog") . " | bzip2 -cq9 > " . $bdir . "/db_" . date("m_d_y", TIME_NOW) . ".sql.bz2"; system($c1); system($c); $files = glob($bdir . "/db_*"); foreach ($files as $file) { if (TIME_NOW - filemtime($file) > 3 * 86400) { unlink($file); } } $ext = "db_" . date("m_d_y", TIME_NOW) . ".sql.bz2"; sql_query("INSERT INTO dbbackup (name, added, userid) VALUES (" . sqlesc($ext) . ", " . TIME_NOW . ", " . $INSTALLER09['site']['owner'] . ")") or sqlerr(__FILE__, __LINE__); if ($queries > 0) { write_log("Auto-dbbackup----------------------Auto Back Up Complete using {$queries} queries---------------------"); } if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated"; } if ($data['clean_log']) { cleanup_log($data); } }
function translation_statistics_category_lang($lang) { $list=array(); $sql_str="select category.* from category_current left join category on category_current.version=category.version"; $res=sql_query($sql_str); while($elem=pg_fetch_assoc($res)) { $tags=new tags(parse_hstore($elem['tags'])); $cat_lang=coalesce($tags->get("lang"), "en"); if(($s=$tags->get("name:$lang"))||(($s=$tags->get("name"))&&$lang==$cat_lang)) $list["category:{$elem['category_id']}:name"]=$s; if(($s=$tags->get("description:$lang"))||(($s=$tags->get("description"))&&$lang==$cat_lang)) $list["category:{$elem['category_id']}:description"]=$s; $sql_str="select * from category_rule where version='{$elem['version']}'"; $res_r=sql_query($sql_str); while($elem_r=pg_fetch_assoc($res_r)) { $tags_r=new tags(parse_hstore($elem_r['tags'])); if(($s=$tags_r->get("name:$lang"))||(($s=$tags_r->get("name"))&&$lang==$cat_lang)) $list["category:{$elem['category_id']}:{$elem_r['rule_id']}:name"]=$s; } } return $list; }
function wikipedia_streetnames_info($info_ret, $object) { global $data_lang; $text=""; if(!$object->tags->get("highway")) return; $res=sql_query("select * from osm_polygon where osm_way && geomfromtext('{$object->data['way']}', 900913) and CollectionIntersects(osm_way, geomfromtext('{$object->data['way']}', 900913)) and osm_tags @> 'boundary=>administrative' order by parse_number(osm_tags->'admin_level') desc"); while($elem=pg_fetch_assoc($res)) { $boundary=load_object($elem['osm_id']); $data=cache_search($boundary->id, "wikipedia:street_names:$data_lang"); if($data) { $data=unserialize($data); } else { $data=wikipedia_get_lang_page($boundary, "wikipedia:street_names"); $article=wikipedia_get_article($boundary, $data['page'], $data['lang']); $data['article']=$article; cache_insert($boundary->id, "wikipedia:street_names:$data_lang", serialize($data), "1 hour"); } if($data['article']) { $text.=wikipedia_streetnames_parse($data['article'], $object); if($text) { $text.="<br>".lang("source").": <a class='external' href='".wikipedia_url($boundary, $data['page'], $data['lang'])."'>Wikipedia</a>\n"; $info_ret[]=array("head"=>"wikipedia_streetnames", "content"=>$text, "doc"=>"plugin:wikipedia_streetnames/feature"); return; } } } }
function show_users($user_id) { global $_GALAXY; echo "<table border=0 align=center width=60%>\n"; // Show friends echo "<tr><th class=white colspan=2>Friendly Races</th></tr>\n"; $result = sql_query("SELECT gu.* FROM g_users AS gu, g_knownspecies AS gks WHERE FIND_IN_SET( gu.user_id, gks.csl_friend_id ) and gks.user_id=" . $user_id); while ($user = sql_fetchrow($result)) { echo "<tr class=bl><td><a href=user.php?cmd=" . encrypt_get_vars("showdetail") . "&uid=" . encrypt_get_vars($user['user_id']) . ">" . $user['race'] . " Race</a></td><td> </td></tr>\n"; } echo "<tr><td colspan=2> </td></tr>\n"; // Show neutral echo "<tr><th class=white colspan=2>Neutral Races</th></tr>\n"; $result = sql_query("SELECT gu.* FROM g_users AS gu, g_knownspecies AS gks WHERE FIND_IN_SET( gu.user_id, gks.csl_neutral_id ) and gks.user_id=" . $user_id); while ($user = sql_fetchrow($result)) { echo "<tr class=bl><td><a href=user.php?cmd=" . encrypt_get_vars("showdetail") . "&uid=" . encrypt_get_vars($user['user_id']) . ">" . $user['race'] . " Race</a></td><td> </td></tr>\n"; } echo "<tr><td colspan=2> </td></tr>\n"; // Show enemies echo "<tr><th class=white colspan=2>Enemy Races</th></tr>\n"; $result = sql_query("SELECT gu.* FROM g_users AS gu, g_knownspecies AS gks WHERE FIND_IN_SET( gu.user_id, gks.csl_enemy_id ) and gks.user_id=" . $user_id); while ($user = sql_fetchrow($result)) { echo "<tr class=bl><td><a href=user.php?cmd=" . encrypt_get_vars("showdetail") . "&uid=" . encrypt_get_vars($user['user_id']) . ">" . $user['race'] . " Race</a></td><td> </td></tr>\n"; } echo "<tr><td colspan=2> </td></tr>\n"; echo "</table>"; }
function docleanup($data) { global $INSTALLER09, $queries, $mc1; set_time_limit(0); ignore_user_abort(1); //== Delete old backup's $days = 3; $res = sql_query("SELECT id, name FROM dbbackup WHERE added < " . sqlesc(TIME_NOW - $days * 86400)) or sqlerr(__FILE__, __LINE__); if (mysqli_num_rows($res) > 0) { $ids = array(); while ($arr = mysqli_fetch_assoc($res)) { $ids[] = (int) $arr['id']; $filename = $INSTALLER09['backup_dir'] . '/' . $arr['name']; if (is_file($filename)) { unlink($filename); } } sql_query('DELETE FROM dbbackup WHERE id IN (' . implode(', ', $ids) . ')') or sqlerr(__FILE__, __LINE__); } //== end if ($queries > 0) { write_log("Backup Clean -------------------- Backup Clean Complete using {$queries} queries--------------------"); } if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated"; } if ($data['clean_log']) { cleanup_log($data); } }
function comment_like_unlike() { global $CURUSER, $type, $tb_fields, $the_id, $banned_users, $disabled_time; $userip = $_SERVER['REMOTE_ADDR']; $res = sql_query("SELECT user_likes,disabled_time FROM " . $tb_fields[$type[0]] . " LEFT OUTER JOIN manage_likes ON manage_likes.user_id = " . sqlesc($CURUSER['id']) . " WHERE " . $tb_fields[$type[0]] . ".id = " . sqlesc($the_id) . "") or sqlerr(__FILE__, __LINE__); $data = mysqli_fetch_row($res); if ($data[1] + $disabled_time > time()) { die($lang['ajlike_you_been_disabled']); } elseif (in_array($CURUSER['id'], $banned_users)) { die($lang['ajlike_you_been_banned']); } $exp = explode(',', $data[0]); if ($res && $type[1] == 'like' && array_key_exists($type[0], $tb_fields)) { if (!in_array($CURUSER['id'], $exp)) { $res2 = sql_query("UPDATE " . $tb_fields[$type[0]] . " SET user_likes = IF(LENGTH(user_likes),CONCAT(user_likes,','," . sqlesc((string) $CURUSER['id']) . ")," . sqlesc((string) $CURUSER['id']) . ") WHERE id = " . sqlesc($the_id) . "") or sqlerr(__FILE__, __LINE__); } else { die($lang['ajlike_you_already_liked']); } } elseif ($res && $type[1] == 'unlike' && array_key_exists($type[0], $tb_fields)) { if (in_array($CURUSER['id'], $exp)) { $key = array_search($CURUSER['id'], $exp); unset($exp[$key]); $exp = implode(",", $exp); $res2 = sql_query("UPDATE " . $tb_fields[$type[0]] . " SET user_likes = " . sqlesc($exp) . "WHERE id = " . sqlesc($the_id) . "") or sqlerr(__FILE__, __LINE__); } else { die($lang['ajlike_you_already_unliked']); } } else { die($lang['ajlike_get_lost']); } }
function verband_validate_form() { global $dbi; $ret = '<div style="color: red; padding: 5px;">'; if (empty($_REQUEST['vname'])) { $ret = $ret . 'Name required!<br/>'; } if (empty($_REQUEST['vcode'])) { $ret = $ret . 'Code required!<br/>'; } $ret = $ret . '</div>'; if (strcmp($ret, '<div style="color: red; padding: 5px;"></div>') == 0) { # valid $vname = $_REQUEST['vname']; $vcode = $_REQUEST['vcode']; $vlogic = $_REQUEST['vlogic']; $vactive = $_REQUEST['vactive']; $vid = $_REQUEST['vid']; $sql = 'INSERT INTO tverband (id, vcode, vname, vlogic, version, vactive) VALUES '; $sql = $sql . ' (0, "' . $vcode . '", "' . $vname . '", "' . $vlogic . '", "1", ' . $vactive . ') '; if (isset($vid) && !empty($vid)) { $sql = 'UPDATE tverband SET vname = "' . $vname . '", vcode = "' . $vcode . '", vlogic = "' . $vlogic . '", vactive = ' . $vactive . ' WHERE id = ' . $vid; } $insert_update_result = sql_query($sql, $dbi); if ($insert_update_result == TRUE) { $ret = $ret . '<script> window.location.href = "admin_verband_management.php?op=new_verband_created" </script>'; } else { $ret = $ret . '<div style="color: red;">Creation/update of a berband failed for unknown reasons!</div>'; } } else { $ret = $ret . verband_form(); } return $ret; }
function edit($table, $vyber, $id) { $error_msg = array(); if ($_POST[submit]) { $meno = sec_sql(sec_input($_POST["meno"])); $hodnota = sec_sql(sec_input($_POST["hodnota"])); if (strlen($meno) > 30 or strlen($meno) < 3) { $error_msg[] = "Meno môže mať od 4 do 30 znakov"; } if (strlen($hodnota) > 30 or strlen($hodnota) < 3) { $error_msg[] = "Hodnota môže mať od 4 do 30 znakov"; } //var_dump($error_msg); if (empty($error_msg)) { echo "ok"; } else { echo "<div id=error_message>" . implode("<br>", $error_msg) . "</div>"; } } $id = sec_sql($id); $query = "Select id, hodnota, meno from " . PREFIX . "{$table} WHERE id={$id}"; $value = sql_query($query); $value = $value[0]; echo "<form method=\"POST\">"; hidden("id", $value[id]); textfield("meno", $value[meno], "Meno", 50, 20); textfield("hodnota", $value[hodnota], "Hodnota", 40, 20); submit("submit", "Odoslať"); echo "</form>"; }
public function show() { require_once _base_ . '/lib/lib.navbar.php'; require_once _lms_ . '/lib/lib.middlearea.php'; $ma = new Man_MiddleArea(); $block_list = array(); //if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true; if ($ma->currentCanAccessObj('user_details_full')) { $block_list['user_details_full'] = true; } if ($ma->currentCanAccessObj('credits')) { $block_list['credits'] = true; } if ($ma->currentCanAccessObj('news')) { $block_list['news'] = true; } $query_home = "SELECT title, description FROM learning_webpages where publish=1 and in_home = 1 AND language = '" . getLanguage() . "' LIMIT 1"; $re_home = sql_query($query_home); list($titolo, $descrizione) = sql_fetch_row($re_home); if (!empty($block_list)) { $this->render('_tabs_block', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>", 'block_list' => $block_list)); } else { $this->render('_tabs', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>")); } }
function docleanup($data) { global $INSTALLER09, $queries, $mc1; set_time_limit(1200); ignore_user_abort(1); sql_query("UPDATE `freeslots` SET `addedup` = 0 WHERE `addedup` != 0 AND `addedup` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `freeslots` SET `addedfree` = 0 WHERE `addedfree` != 0 AND `addedfree` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("DELETE FROM `freeslots` WHERE `addedup` = 0 AND `addedfree` = 0") or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `free_switch` = 0 WHERE `free_switch` > 1 AND `free_switch` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `torrents` SET `free` = 0 WHERE `free` > 1 AND `free` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `downloadpos` = 1 WHERE `downloadpos` > 1 AND `downloadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `uploadpos` = 1 WHERE `uploadpos` > 1 AND `uploadpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `chatpost` = 1 WHERE `chatpost` > 1 AND `chatpost` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `avatarpos` = 1 WHERE `avatarpos` > 1 AND `avatarpos` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `immunity` = 0 WHERE `immunity` > 1 AND `immunity` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `warned` = 0 WHERE `warned` > 1 AND `warned` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `pirate` = 0 WHERE `pirate` > 1 AND `pirate` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); sql_query("UPDATE `users` SET `king` = 0 WHERE `king` > 1 AND `king` < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); if ($queries > 0) { write_log("User Clean -------------------- User Clean Complete using {$queries} queries--------------------"); } if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated"; } if ($data['clean_log']) { cleanup_log($data); } }
function write_staffs2() { global $lang; //==ids $t = '$INSTALLER09'; $iconfigfile = "<" . "?php\n/**\n{$lang['staffcfg_file_created']}" . date('M d Y H:i:s') . ".\n{$lang['staffcfg_mod_by']}\n**/\n"; $ri = sql_query("SELECT id, username, class FROM users WHERE class BETWEEN " . UC_STAFF . " AND " . UC_MAX . " ORDER BY id ASC") or sqlerr(__FILE__, __LINE__); $iconfigfile .= "" . $t . "['allowed_staff']['id'] = array("; while ($ai = mysqli_fetch_assoc($ri)) { $ids[] = $ai['id']; $usernames[] = "'" . $ai["username"] . "' => 1"; } $iconfigfile .= "" . join(",", $ids); $iconfigfile .= ");"; $iconfigfile .= "\n?" . ">"; $filenum = fopen('./cache/staff_settings.php', 'w'); ftruncate($filenum, 0); fwrite($filenum, $iconfigfile); fclose($filenum); //==names $t = '$INSTALLER09'; $nconfigfile = "<" . "?php\n/**\n{$lang['staffcfg_file_created']}" . date('M d Y H:i:s') . ".\n{$lang['staffcfg_mod_by']}\n**/\n"; $nconfigfile .= "" . $t . "['staff']['allowed'] = array("; $nconfigfile .= "" . join(",", $usernames); $nconfigfile .= ");"; $nconfigfile .= "\n?" . ">"; $filenum1 = fopen('./cache/staff_settings2.php', 'w'); ftruncate($filenum1, 0); fwrite($filenum1, $nconfigfile); fclose($filenum1); stderr($lang['staffcfg_success'], $lang['staffcfg_updated']); }
function save_themename() { global $baseurl, $link, $themename, $collection_column; $sql="update collection set " . $collection_column . "='" . getvalescaped("rename","") . "' where " . $collection_column . "='" . escape_check($themename)."'"; sql_query($sql); header("location:".$baseurl. "/pages/" . $link); }
function checksuspended() { testremote(); $db_a = tDataConnect(); $m_conn = mDataConnect(); $query_local = "select * from suspendedtoday"; $query_remote = "select * from " . trim($_SESSION["mServer"]) . "." . trim($_SESSION["mDatabase"]) . ".dbo.suspendedtoday"; $query = "select * from suspendedlist"; if ($_SESSION["standalone"] == 1) { if ($_SESSION["remoteDBMS"] == "mssql") { $result = mssql_query($query_local, $db_a); } else { $result = mysql_query($query, $db_a); } } else { if ($_SESSION["remoteDBMS"] == "mssql") { $result = sql_query($query_remote, $db_a); } else { $result = mysql_query($query, $m_conn); } } $num_rows = sql_fetch_array($result); if ($num_rows == 0) { return 0; } else { return 1; } sql_close($db_a); }
function docleanup($data) { global $INSTALLER09, $queries, $mc1; set_time_limit(1200); ignore_user_abort(1); //== delete torrents - ???? $days = 30; $dt = TIME_NOW - $days * 86400; sql_query("UPDATE torrents SET flags='1' WHERE added < {$dt} AND seeders='0' AND leechers='0'") or sqlerr(__FILE__, __LINE__); $res = sql_query("SELECT id, name FROM torrents WHERE mtime < {$dt} AND seeders='0' AND leechers='0' AND flags='1'") or sqlerr(__FILE__, __LINE__); while ($arr = mysqli_fetch_assoc($res)) { sql_query("DELETE files.*, comments.*, thankyou.*, thanks.*, thumbsup.*, bookmarks.*, coins.*, rating.*, xbt_files_users.* FROM xbt_files_users\n LEFT JOIN files ON files.torrent = xbt_files_users.fid\n LEFT JOIN comments ON comments.torrent = xbt_files_users.fid\n LEFT JOIN thankyou ON thankyou.torid = xbt_files_users.fid\n LEFT JOIN thanks ON thanks.torrentid = xbt_files_users.fid\n LEFT JOIN bookmarks ON bookmarks.torrentid = xbt_files_users.fid\n LEFT JOIN coins ON coins.torrentid = xbt_files_users.fid\n LEFT JOIN rating ON rating.torrent = xbt_files_users.fid\n LEFT JOIN thumbsup ON thumbsup.torrentid = xbt_files_users.fid\n WHERE xbt_files_users.fid =" . sqlesc($arr['id'])) or sqlerr(__FILE__, __LINE__); @unlink("{$INSTALLER09['torrent_dir']}/{$arr['id']}.torrent"); write_log("Torrent " . (int) $arr['id'] . " (" . htmlsafechars($arr['name']) . ") was deleted by system (older than {$days} days and no seeders)"); } if ($queries > 0) { write_log("Delete Old Torrents XBT Clean -------------------- Delete Old XBT Torrents cleanup Complete using {$queries} queries --------------------"); } if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items deleted/updated"; } if ($data['clean_log']) { cleanup_log($data); } }
/** |--------------------------------------------------------------------------| | https://github.com/Bigjoos/ | |--------------------------------------------------------------------------| | Licence Info: GPL | |--------------------------------------------------------------------------| | Copyright (C) 2010 U-232 V5 | |--------------------------------------------------------------------------| | A bittorrent tracker source based on TBDev.net/tbsource/bytemonsoon. | |--------------------------------------------------------------------------| | Project Leaders: Mindless, Autotron, whocares, Swizzles. | |--------------------------------------------------------------------------| _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ ( U | - | 2 | 3 | 2 )-( S | o | u | r | c | e )-( C | o | d | e ) \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ */ function docleanup($data) { global $INSTALLER09, $queries, $mc1; set_time_limit(0); ignore_user_abort(1); //=== Clean silver $res = sql_query("SELECT id, silver FROM torrents WHERE silver > 1 AND silver < " . TIME_NOW) or sqlerr(__FILE__, __LINE__); $Silver_buffer = array(); if (mysqli_num_rows($res) > 0) { while ($arr = mysqli_fetch_assoc($res)) { $Silver_buffer[] = '(' . $arr['id'] . ', \'0\')'; $mc1->begin_transaction('torrent_details_' . $arr['id']); $mc1->update_row(false, array('silver' => 0)); $mc1->commit_transaction($INSTALLER09['expires']['torrent_details']); } $count = count($Silver_buffer); if ($count > 0) { sql_query("INSERT INTO torrents (id, silver) VALUES " . implode(', ', $Silver_buffer) . " ON DUPLICATE key UPDATE silver=values(silver)") or sqlerr(__FILE__, __LINE__); write_log("Cleanup - Removed Silver from " . $count . " torrents"); } unset($Silver_buffer, $count); } //==End if ($queries > 0) { write_log("Free clean-------------------- Silver Torrents cleanup Complete using {$queries} queries --------------------"); } if (false !== mysqli_affected_rows($GLOBALS["___mysqli_ston"])) { $data['clean_desc'] = mysqli_affected_rows($GLOBALS["___mysqli_ston"]) . " items updated"; } if ($data['clean_log']) { cleanup_log($data); } }
function ElemInit() { $columns = sql_getRows("SHOW COLUMNS FROM " . $this->elem_table . "", true); if (!isset($columns['footer_text_radio'])) { sql_query("ALTER TABLE " . $this->elem_table . " ADD footer_text_radio TINYINT( 1 ) UNSIGNED NOT NULL DEFAULT '0' COMMENT '0 - редактор текста; 1 - html-код баннера'"); } if (!isset($columns['footer_title'])) { sql_query("ALTER TABLE {$this->elem_table} ADD footer_title VARCHAR( 255 ) NOT NULL COMMENT 'Название кнопки Подробнее';"); } if (!isset($columns['footer_title_link'])) { sql_query("ALTER TABLE {$this->elem_table} ADD footer_title_link VARCHAR( 255 ) NOT NULL COMMENT 'Ссылка на кнопке Подробнее';"); } $id = (int) get('id'); if ($id) { $infoblock_end = sql_getRow("SELECT * FROM " . $this->elem_table . " WHERE id = " . $id); if ($infoblock_end['footer_text_radio']) { $this->elem_fields['columns']['footer_text']['value'] = htmlspecialchars($infoblock_end['footer_text']); $this->elem_fields['columns']['footer_text_area']['value'] = $infoblock_end['footer_text']; } else { $this->elem_fields['columns']['footer_text_fck']['value'] = $infoblock_end['footer_text']; } } $this->script .= "\n\n function elem1(name) {\n return \$('#tr_fld\\\\[" . $this->tabname . "\\\\]\\\\[' + name + '\\\\]');\n }\n\n function elemName1(name) {\n return 'fld[" . $this->tabname . "][' + name + ']';\n };\n\n function getFck1(name) {\n name = elemName1(name);\n for(nameFck in CKEDITOR.instances) {\n if(name == nameFck) {\n return CKEDITOR.instances[name];\n }\n }\n }\n\n function open_fck_footer(name_fck, name_area) {\n var fck = getFck1(name_fck);\n var footer_text_fck = \$(elem1(name_fck));\n var footer_text_area = \$(elem1(name_area));\n\n footer_text_fck.children('span').show();\n footer_text_area.hide();\n\n var data = footer_text_area.children('textarea').val();\n if (data.length) fck.setData(data);\n\n fck.container.show();\n fck.updateElement();\n }\n\n function close_fck_footer(name_fck, name_area) {\n var fck = getFck1(name_fck);\n var footer_text_fck = \$(elem1(name_fck));\n var footer_text_area = \$(elem1(name_area));\n fck.container.hide();\n fck.updateElement();\n\n footer_text_fck.children('span').hide();\n footer_text_area.show();\n footer_text_area.children('textarea').css({\n 'width' : '98%',\n 'height' : fck.config.height\n });\n\n var data = fck.getData();\n if (data.length) footer_text_area.children('textarea').val(data);\n }\n\n \$(function () {\n var footer_text_radio = \$(elem1('footer_text_radio')).children('input');\n \$(footer_text_radio).click(function() {\n if(\$(this).val() == 1) {\n close_fck_footer('footer_text_fck', 'footer_text_area');\n } else {\n open_fck_footer('footer_text_fck', 'footer_text_area');\n }\n });\n\n CKEDITOR.on( 'instanceReady', function( ev )\n {\n " . (isset($infoblock_end) && $infoblock_end['footer_text_radio'] ? "close_fck_footer" : "open_fck_footer") . "('footer_text_fck', 'footer_text_area');\n });\n });\n "; TElems::ElemInit(); }
function startElement($parser, $tagname, $attrs) { global $pool, $already_to_assess, $currentfile, $doit, $prefix, $number_updated, $number_inserted, $db_assessments; if ($tagname == "file") $currentfile = $attrs["file"]; if ($tagname == "path") { if ($currentfile) { $xid = path2id($prefix.$currentfile,$attrs["path"]); if (!$xid) { print "<div style='color:red'>Can't convert $currentfile#$attrs[path]</div>"; } else { $x = $already_to_assess[$xid]; $query = false; if ($x == "N") { $query = "UPDATE $db_assessments SET in_pool='Y' where id_pool='$pool' AND xid=$xid"; $number_updated++; } elseif (!$x) { $query = "INSERT INTO $db_assessments (id_pool,in_pool,inferred,xid) VALUES ($pool,'Y','N',$xid)"; $number_inserted++; } if ($query) { // print "<div>$query</div>"; sql_query($query); } } } else { print "<div style='color:red'>No current file for path $attrs[path]</div>"; } } }
function iUsers($iname, $ipass, $imail) { global $admin_file, $CURUSER; if ($_SERVER["REQUEST_METHOD"] == "POST") { list($iclass) = mysql_fetch_row(sql_query('SELECT class FROM users WHERE username = '******'Администратор ' . $CURUSER['username'] . ' пробовал изменить учетные данные пользователя ' . $iname . ' классом выше!', 'red', 'error'); } else { $updateset = array(); if (!empty($ipass)) { $secret = mksecret(); $hash = md5($secret . $ipass . $secret); $updateset[] = "secret = " . sqlesc($secret); $updateset[] = "passhash = " . sqlesc($hash); } if (!empty($imail) && validemail($imail)) { $updateset[] = "email = " . sqlesc($imail); } if (count($updateset)) { $res = sql_query("UPDATE users SET " . implode(", ", $updateset) . " WHERE username = "******"Ошибка", "Смена пароля завершилась неудачей! Возможно указано несуществующее имя пользователя.", "error"); } else { stdmsg("Изменения пользователя прошло успешно", "Имя пользователя: " . $iname . (!empty($hash) ? "<br />Новый пароль: " . $ipass : "") . (!empty($imail) ? "<br />Новая почта: " . $imail : "")); } } } else { echo "<form method=\"post\" action=\"" . $admin_file . ".php?op=iUsers\">" . "<table border=\"0\" cellspacing=\"0\" cellpadding=\"3\">" . "<tr><td class=\"colhead\" colspan=\"2\">Смена пароля</td></tr>" . "<tr>" . "<td><b>Пользователь</b></td>" . "<td><input name=\"iname\" type=\"text\"></td>" . "</tr>" . "<tr>" . "<td><b>Новый пароль</b></td>" . "<td><input name=\"ipass\" type=\"password\"></td>" . "</tr>" . "<tr>" . "<td><b>Новая почта</b></td>" . "<td><input name=\"imail\" type=\"text\"></td>" . "</tr>" . "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" name=\"isub\" value=\"Сделать\"></td></tr>" . "</table>" . "<input type=\"hidden\" name=\"op\" value=\"iUsers\" />" . "</form>"; } }
function LocalDISCForm($UsrDef, $limit) { $content = '<input type="hidden" name="hduserid" id="hduserid" value="' . $_SESSION['userid'] . '">'; $content .= '<div id="content" class="col-md-12 " >'; $content .= '<div id="tableDISC" class="col-md-12" >'; $qsoal = sql_query("SELECT DISTINCT no_soal FROM soal_disc ORDER BY no_soal "); while ($soal = sql_fetchassoc($qsoal)) { $no = $soal['no_soal']; $content .= '<table class="table table-bordered" id="tableDISC_' . $no . '">'; $content .= '<tr>'; $content .= '<td style="text-align:center; vertical-align:middle;">' . $no . '</td>'; $qpernyataan = sql_query("SELECT sequence, pernyataan, komponen, tipe FROM soal_disc WHERE no_soal = '{$no}' ORDER BY sequence "); while ($pernyataan = sql_fetchassoc($qpernyataan)) { //#FFFFE8 $content .= '<td class="col-md-3"><input class="textbox inputdisc" type="text" size=35 disabled value="' . $pernyataan['pernyataan'] . '"> '; $content .= '<input class="textbox " type="text" size=1 maxlength="1" data-komponen="' . $pernyataan['komponen'] . '" data-tipe="' . $pernyataan['tipe'] . '" id="txtans_' . $no . '_' . $pernyataan['sequence'] . '" name="txtans_' . $no . '_' . $pernyataan['sequence'] . '" style="text-align:center; height:32px; font-size:13px !important;text-transform:uppercase;" onkeypress="return isMorL(event)" >'; } $content .= '</tr>'; $content .= '</table>'; /*$content .= "<input type=hidden name='hdans_".$no."' id='hdans_".$no."' value='".$soal['answer']."'>"; $content .= "<input type=hidden name='hdmulti_".$no."' id='hdmulti_".$no."' value='".$soal['multi_ans']."'>"; $content .= "<input type=hidden name='hdstatus_".$no."' id='hdstatus_".$no."' value='0'></td>";*/ } $content .= '</div>'; $content .= "<div align='center' class='col-md-4 col-md-offset-4' ><input type='button' class='button ' id='btnSave' value='Simpan'/></div>"; $content .= "</div>"; return $content; }