function xp_get($var) { if (XCACHE_ENABLED && xcache_isset(XCACHE_PREFIX . $var)) { return xcache_get(XCACHE_PREFIX . $var); } $data = unserialize(file_get_contents("./cache/" . XCACHE_PREFIX . $var)); xp_set($var, $data, 1); return $data; }
print "ERROR: Unable to fetch file {$file}<br />\n"; continue; } } $xdccList = str_replace(array(chr(2), chr(3), chr(16), chr(31), chr(13)), "", $xdccList); //remove irc formatting (or something <_<) if (preg_match("/\\s+\\*\\*\\s+(?:To|Pour)\\s+(?:request|télécharger)\\s+(?:a|un)\\s+(?:file|fichier),\\s+(?:type|tape)\\s+\"\\/msg\\s+(.*?)\\s+xdcc\\s+send|get\\s+#x\"\\s+\\*\\*\\s+\\W/mi", $xdccList, $data['nick'])) { $bot = array(); $match = $config['group'] ? ".*" . str_replace(array("^", ".", "*", "\\", "+", "?", "\$"), array("\\^", "\\.", "\\*", "\\\\", "\\+", "\\?", "\\\$"), $config['group']) . ".*" : ".*"; eval("preg_match_all(\"/#(\\d+)\\s+\\d+x\\s+\\[.*?(\\d+\\.?\\d+?)(\\D)\\]\\s+(\\d+\\.\\d+\\.\\d+\\s+\\d+:\\d+\\s+)?(" . $match . ")\\W/mi\",\$xdccList,\$bot['packs']);"); $bot['nick'] = $data['nick'][1]; for ($i = 0; $i < count($bot['packs'][0]); $i++) { $bot['packs'][2][$i] = round($bot['packs']['2'][$i] * doubleval($sizes[$bot['packs'][3][$i]])); $bot['packs'][4][$i] = preg_replace("/(.+)(\\[|\\()[a-f0-9]{8}(\\]|\\))/i", "\$1", $bot['packs'][5][$i]); // 5 = file with crc, 4 = file without crc // time stamp support will be added in 2.0. let's just overwrite it for now... } //clean up excess variables for ($i = 6; $i <= count($bot['packs']) - 1; $i++) { unset($bot['packs'][$i]); } unset($bot['packs'][0], $bot['packs'][3]); $bots[] = $bot; } else { print "ERROR: Unable to parse {$file}<br />\n"; } } $time = time(); xp_set("bots", $bots); xp_set("time", $time);
} break; case 'commitbookmark': if ($_REQUEST['bmname'] && $_REQUEST['bmval']) { if (!$_REQUEST['bm_id']) { if (empty($bookmarks)) { $_REQUEST['bm_id'] = 1; } else { $_REQUEST['bm_id'] = array_pop(array_keys($bookmarks)) + 1; } } $bookmarks[$_REQUEST['bm_id']] = array(stripslashes($_REQUEST['bmname']), stripslashes($_REQUEST['bmval'])); xp_set("bookmarks", $bookmarks); } break; case 'commitgroup': $config['group'] = stripslashes($_REQUEST['groupname']); xp_set("config", $config); $refresh = 1; break; case 'refresh': $refresh = 1; break; } if ($refresh) { require_once "refresh.php"; } $s->assign("bots", $botconfig); $s->assign("config", $config); $s->assign("bookmarks", $bookmarks); $s->display("adminindex.tpl");