function runcron($cronid = 0) { global $timestamp, $db, $tablepre, $_DCACHE; $query = $db->query("SELECT * FROM {$tablepre}crons WHERE " . ($cronid ? "cronid='{$cronid}'" : "available>'0' AND nextrun<='{$timestamp}'") . " ORDER BY nextrun LIMIT 1"); if ($cron = $db->fetch_array($query)) { $lockfile = DISCUZ_ROOT . './forumdata/runcron_' . $cron['cronid'] . '.lock'; $cron['filename'] = str_replace(array('..', '/', '\\'), '', $cron['filename']); $cronfile = DISCUZ_ROOT . './include/crons/' . $cron['filename']; if (is_writable($lockfile) && filemtime($lockfile) > $timestamp - 600) { return NULL; } else { @touch($lockfile); } @set_time_limit(1000); @ignore_user_abort(TRUE); $cron['minute'] = explode("\t", $cron['minute']); cronnextrun($cron); extract($GLOBALS, EXTR_SKIP); if (!@(include $cronfile)) { errorlog('CRON', $cron['name'] . ' : Cron script(' . $cron['filename'] . ') not found or syntax error', 0); } @unlink($lockfile); } $query = $db->query("SELECT nextrun FROM {$tablepre}crons WHERE available>'0' ORDER BY nextrun LIMIT 1"); $nextrun = $db->result($query, 0); if (!$nextrun === FALSE) { require_once DISCUZ_ROOT . './include/cache.func.php'; $_DCACHE['settings']['cronnextrun'] = $db->result($query, 0); updatesettings(); } }
public function LoadModel() { $act = ''; $act = $this->Model . "/" . ucfirst(strtolower($this->M . MODEL_CLASS_FX)) . ".class.php"; $act = str_replace("model", "Model", $act); if (is_file($act)) { $act_class = ucfirst(strtolower($this->M . MODEL_CLASS_FX)); $act_class = "\\Model\\" . str_replace("model", "Model", $act_class); require_once $act; $Model_obj = new $act_class(); $m = $this->M; $tm = get_class_methods($Model_obj); if (!in_array($m, $tm)) { if (DEBUG) { errorlog("struts.log", $act . "中 " . $m . "方法不存在"); } } $Model_obj->{$m}(); } else { if (DEBUG) { errorlog("struts.log", "没有找到该类" . $act); } echo "没有找到该类" . $act; } }
function runcron($cronid = 0, $debug = 0) { global $_SGLOBAL, $_SCONFIG, $_SBLOCK, $lang; //锁定 $lockfile = S_ROOT . './log/cron.lock.log'; if (file_exists($lockfile) && !$debug) { if ($_SGLOBAL['timestamp'] - filemtime($lockfile) < 300) { //5分钟 return; } } if (@($fp = fopen($lockfile, 'w'))) { fwrite($fp, "{$cronid}\n"); fclose($fp); } //读取cron列表缓存 if (empty($_SGLOBAL['crons'])) { errorlog('CRON', $cron['name'] . " : Cron script cache list is empty", 0); @unlink($lockfile); return; } @set_time_limit(1000); @ignore_user_abort(TRUE); $cronids = array(); $crons = $cronid ? array($cronid => $_SGLOBAL['crons'][$cronid]) : $_SGLOBAL['crons']; if (empty($crons) || !is_array($crons)) { errorlog('CRON', $cron['name'] . " : Cron script list is empty", 0); @unlink($lockfile); return; } foreach ($crons as $id => $cron) { if ($cron['nextrun'] <= $_SGLOBAL['timestamp'] || $id == $cronid) { $cronids[] = $id; if (empty($cron[filename])) { errorlog('CRON', "Cron script({$cron['filename']}) not found", 0); continue; } if ($debug) { if (!(include S_ROOT . ($cronfile = "./include/cron/{$cron['filename']}"))) { errorlog('CRON', $cron['name'] . " : Cron script({$cronfile}) syntax error", 0); } } else { if (!@(include S_ROOT . ($cronfile = "./include/cron/{$cron['filename']}"))) { errorlog('CRON', $cron['name'] . " : Cron script({$cronfile}) syntax error", 0); } } } } cronnextrun($cronids); @unlink($lockfile); }
function dftp_connect($ftphost, $ftpuser, $ftppass, $ftppath, $ftpport = 21, $ftpssl = 0, $silent = 0) { global $ftp; @set_time_limit(0); $ftphost = wipespecial($ftphost); $ftpport = intval($ftpport); $ftpssl = intval($ftpssl); $ftp['timeout'] = intval($ftp['timeout']); $func = $ftpssl && function_exists('ftp_ssl_connect') ? 'ftp_ssl_connect' : 'ftp_connect'; if ($func == 'ftp_connect' && !function_exists('ftp_connect')) { if ($silent) { return -4; } else { errorlog('FTP', "FTP not supported.", 0); } } if ($ftp_conn_id = @$func($ftphost, $ftpport, 20)) { if ($ftp['timeout'] && function_exists('ftp_set_option')) { @ftp_set_option($ftp_conn_id, FTP_TIMEOUT_SEC, $ftp['timeout']); } if (dftp_login($ftp_conn_id, $ftpuser, $ftppass)) { if ($ftp['pasv']) { dftp_pasv($ftp_conn_id, TRUE); } if (dftp_chdir($ftp_conn_id, $ftppath)) { return $ftp_conn_id; } else { if ($silent) { return -3; } else { errorlog('FTP', "Chdir '{$ftppath}' error.", 0); } } } else { if ($silent) { return -2; } else { errorlog('FTP', '530 Not logged in.', 0); } } } else { if ($silent) { return -1; } else { errorlog('FTP', "Couldn't connect to {$ftphost}:{$ftpport}.", 0); } } dftp_close($ftp_conn_id); return -1; }
public function show($str = '') { $cgf = new \Config(); if ($str == '') { $str = 'index.html'; } if (!is_file(APP_PATH . "/View" . $cgf->TP_PATH . "/" . $str)) { errorlog(ROOT_PATH . "/struts.log", APP_PATH . "/View" . $cgf->TP_PATH . "/" . $str . "模板文件不存在"); echo APP_PATH . "/View" . $cgf->TP_PATH . "/" . $str . "模板文件不存在"; exit; } $url = "Lin" . md5($_SERVER['REQUEST_URI']); $this->o->obj->display($str, $url); }
function runcron($cronid = 0) { global $_G, $_SGLOBAL, $_SBLOCK, $lang; //鎖定 $lockfile = B_ROOT . './log/cron.lock.log'; if (file_exists($lockfile)) { if ($_G['timestamp'] - filemtime($lockfile) < 300) { //5分鐘 return; } } if (@($fp = fopen($lockfile, 'w'))) { fwrite($fp, "\n"); fclose($fp); } //讀取cron列表緩存 if (empty($_SGLOBAL['crons'])) { return; } @set_time_limit(1000); @ignore_user_abort(true); $cronids = array(); $crons = $cronid ? array($cronid => $_SGLOBAL['crons'][$cronid]) : $_SGLOBAL['crons']; if (empty($crons) || !is_array($crons)) { return; } foreach ($crons as $id => $cron) { if ($cron['nextrun'] <= $_G['timestamp'] || $id == $cronid) { $cronids[] = $id; if (!@(include B_ROOT . ($cronfile = "./source/include/cron/{$cron['filename']}"))) { errorlog('CRON', $cron['name'] . " : Cron script({$cronfile}) not found or syntax error", 0); } } } cronnextrun($cronids); @unlink($lockfile); }
function newscreatesql() { global $pr, $sd, $debug; if (!$pr[82]) { return false; } // CFG OPT FUTURE disables script using checklogssql //if (!$pr[43]) { if ($debug) { errorlog("DEBUG checklogsql:Connection failure. Default host not set or SQL off. trying 127.0.0.1."); $pr[43] = "127.0.0.1"; } $dbtype = "mysql"; @($connect = dbs_connect($pr[43], $sd[14], $sd[17], $dbtype)); dbs_selectdb("dbscriptbk", $connect, $dbtype); if ($connect == false) { errorlog("DEBUG checklogsql:Connection failure. Default host lost. {$pr['43']}"); return false; } $mysqlanswer = 1; $prefix = $sd[30]; $tablename = "_dbs_" . $prefix . "_news43"; $query = "SHOW CREATE TABLE `dbscriptbk`.`_dbs_" . $prefix . "_news43`;"; $silent = 0; $e = dbs_query($query, $connect, $dbtype); if ($e == true) { $mysqlanswer = true; } if ($e == false) { echo "initalizing tables..._dbs_" . $prefix . "_news43 ..."; $query = "CREATE DATABASE IF NOT EXISTS `dbscriptbk`;"; $a = dbs_query($query, $connect, $dbtype); if ($a == false) { sqlerr(); } $query = "CREATE TABLE {$tablename} ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `user` text NOT NULL DEFAULT '0', `plevelview` int(2) unsigned NOT NULL DEFAULT '0', `subject` text NOT NULL, `gutentag` text NOT NULL, `video` text NOT NULL, `message` text NOT NULL, `data` text NOT NULL,PRIMARY KEY (`id`) )\tENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;"; $a = dbs_query($query, $connect, $dbtype); if ($a == false) { sqlerr(); $mysqlanswer = false; } else { $mysqlanswer = true; } // внимание записи ВСЕХ существующих копий дбскрипт будут попадать в эти базы- модификации названия таблиц и т.п. пока отсутствуют CFG OPT FUTURE ## end of creating tables } return $mysqlanswer; }
$log = explode("\t", fgets($fp, 50)); if ($_SGLOBAL['timestamp'] - $log[0] < 86400) { $errlog[$log[0]] = $log[1]; } } fclose($fp); } if (!in_array($dberrno, $errlog)) { $errlog[$_SGLOBAL['timestamp']] = $dberrno; @($fp = fopen(S_ROOT . './log/dberror.log', 'w')); @flock($fp, 2); foreach (array_unique($errlog) as $dateline => $errno) { @fwrite($fp, "{$dateline}\t{$errno}"); } @fclose($fp); if (function_exists('errorlog')) { errorlog('MySQL', basename($_SERVER['SCRIPT_NAME']) . " : {$dberror} - " . cutstr($sql, 120), 0); } echo "<br><br>An error report has been dispatched to our administrator."; $email_to = $_SCONFIG['adminemail']; $email_subject = '[SupeSite] MySQL Error Report'; $email_message = "There seems to have been a problem with the database of your SupeSite.\n\n" . strip_tags($errmsg) . "\n\n" . "Please check-up your MySQL server and forum scripts, similar errors will not be reported again in recent 24 hours\n" . "If you have troubles in solving this problem, please visit SupeSite Community http://www.SupeSite.com."; include S_ROOT . './function/sendmail.fun.php'; sendmail(array($email_to), $email_subject, $email_message); } else { echo '<br><br>Similar error report has beed dispatched to administrator before.'; } } echo '</p>'; exit; }
errorlog('Cron', srealpath($attachfilepath) . ' have no permission to be removed.', 0); } } else { errorlog('Cron', srealpath($attachfilepath) . ' not found.', 0); } } $deletethumbflag = true; if (!empty($attach['thumbpath'])) { $attachthumbpath = A_DIR . '/' . $attach['thumbpath']; if (file_exists($attachthumbpath)) { if (!@unlink($attachthumbpath)) { $deletethumbflag = false; errorlog('Cron', srealpath($attachthumbpath) . ' have no permission to be removed.', 0); } } else { errorlog('Cron', srealpath($attachthumbpath) . ' not found.', 0); } } if ($deletefileflag && $deletethumbflag) { $uid = $attach['uid']; $delaidarr[] = $attach['aid']; if (empty($delsizearr[$uid])) { $delsizearr[$uid] = $attach['size']; } else { $delsizearr[$uid] = $delsizearr[$uid] + $attach['size']; } } } if (!empty($delaidarr)) { $_SGLOBAL['db']->query('DELETE FROM ' . tname('attachments') . ' WHERE aid IN (' . simplode($delaidarr) . ')'); }
function handle_admin(&$admin, &$sockets, &$sockets_seq_data, &$sockets_next_seq, &$clientdata) { $from = ''; $rport = 0; $buf = ''; socket_recvfrom($admin, $buf, 2 * 1024 * 1024, 0, $from, $rport); #errorlog("BACKEND: ADMIN sockets='".var_export($sockets,TRUE)."'"); #errorlog("BACKEND: ADMIN Received '".$buf."' from ".$from); if ($buf == 'die') { return true; } else { $parts = split(":", $buf); if ($parts[0] == 'createSocket') { $socketNumber = $parts[1]; $targetHost = $parts[2]; $targetPort = $parts[3]; errorlog("BACKEND: createSocket with socketNumber " . $socketNumber . ", host " . $targetHost . ", port " . $targetPort); $socket = socket_create(AF_INET, SOCK_STREAM, getprotobyname('tcp')); if ($socket) { $result = socket_connect($socket, $targetHost, $targetPort); if ($result) { errorlog("BACKEND: Connection succeeded"); $key = $targetHost . ":" . $targetPort . ":" . $socketNumber; $sockets[$key] = $socket; errorlog("BACKEND: ADMIN sockets are now '" . var_export($sockets, TRUE) . "' after adding socket " . $socket . " with key ='" . $key . "'"); } else { errorlog("BACKEND: Connect failed"); } } else { errorlog("BACKEND: Cannot create socket"); } } else { if ($parts[0] == 'newData') { $socketNumber = $parts[1]; $targetHost = $parts[2]; $targetPort = $parts[3]; $sequenceNumber = $parts[4]; $sockkey = $targetHost . ":" . $targetPort . ":" . $socketNumber; $socket = $sockets[$sockkey]; if ($sequenceNumber == 0) { $sockets_next_seq[$sockkey] = 0; $sockets_seq_data = array(); } if ($parts[5] == '*') { errorlog("BACKEND: newData(" . $sequenceNumber . "), Client requested closing of socket " . $socket . " with key " . $sockkey); socket_close($socket); unset($sockets[$sockkey]); unset($sockets_next_seq[$sockkey]); unset($sockets_seq_data[$sockkey]); } else { if (!$socket) { errorlog("BACKEND: newData(" . $sequenceNumber . "), Client attempted to send '" . $parts[5] . "' to " . $sockkey); errorlog("BACKEND: newData(" . $sequenceNumber . "), available sockets are:" . var_export($sockets, TRUE)); array_push($clientdata, '[data]' . $sockkey . ":*"); } else { $data = str_replace(" ", "+", $parts[5]); $data = base64_decode($data); errorlog("BACKEND: newData(" . $sequenceNumber . ") with socketNumber " . $socketNumber . ", host " . $targetHost . ", port " . $targetPort . ", data '" . $data . "'"); $sockets_seq_data[$sockkey][$sequenceNumber] = $data; if ($sockets_next_seq[$sockkey] == $sequenceNumber) { while (array_key_exists($sockets_next_seq[$sockkey], $sockets_seq_data[$sockkey])) { if ($socket) { $ret = socket_send($socket, $data, strlen($data), 0); check_sock_error("BACKEND newData"); errorlog("BACKEND: newData(" . $sequenceNumber . "), socket send to '" . $sockkey . " returned " . $ret); } else { errorlog("BACKEND: newData(" . $sequenceNumber . "), Unknown socket " . $sockkey); } $sockets_next_seq[$sockkey]++; } } else { if ($sockets_next_seq[$sockkey] < $sequenceNumber) { error_log("BACKEND: newData(" . $sequenceNumber . ") has been queued, current sequence number required is " . $sockets_next_seq[$sockkey]); } else { } } } } } else { if ($parts[0] == 'getData') { $val = array_shift($clientdata); if ($val) { $ret = socket_sendto($admin, $val, strlen($val), 0, $from, $rport); check_sock_error("BACKEND getData with data"); errorlog("BACKEND: getData, Sent " . $ret . " bytes from " . strlen($val)); } else { $val = '[NO_NEW_DATA]'; $ret = socket_sendto($admin, $val, strlen($val), 0, $from, $rport); check_sock_error("BACKEND getData [NO_NEW_DATA]"); } } else { errorlog("BACKEND: Unknown part '" . $parts[0] . "'"); } } } } return false; }
function ftpupload($source, $dest, $havethumb = 0) { global $authkey, $ftp; if ($ftp['on']) { require_once DISCUZ_ROOT . './include/ftp.func.php'; if (!$ftp['connid']) { if (!($ftp['connid'] = dftp_connect($ftp['host'], $ftp['username'], authcode($ftp['password'], 'DECODE', md5($authkey)), $ftp['attachdir'], $ftp['port'], $ftp['ssl']))) { return 0; } $ftp['pwd'] = FALSE; } $tmp = explode('/', $dest); if (count($tmp) > 1) { if (!$ftp['pwd'] && !dftp_chdir($ftp['connid'], $tmp[0])) { if (!dftp_mkdir($ftp['connid'], $tmp[0])) { errorlog('FTP', "Mkdir '{$ftp['attachdir']}/{$tmp['0']}' error.", 0); return 0; } if (!function_exists('ftp_chmod') || !dftp_chmod($ftp['connid'], 0777, $tmp[0])) { dftp_site($ftp['connid'], "'CHMOD 0777 {$tmp['0']}'"); } if (!dftp_chdir($ftp['connid'], $tmp[0])) { errorlog('FTP', "Chdir '{$ftp['attachdir']}/{$tmp['0']}' error.", 0); return 0; } dftp_put($ftp['connid'], 'index.htm', $GLOBALS['attachdir'] . '/index.htm', FTP_BINARY); } $dest = $tmp[1]; $ftp['pwd'] = TRUE; } if (dftp_put($ftp['connid'], $dest, $source, FTP_BINARY)) { if ($havethumb) { if (dftp_put($ftp['connid'], $dest . '.thumb.jpg', $source . '.thumb.jpg', FTP_BINARY)) { @unlink($source); @unlink($source . '.thumb.jpg'); return 1; } else { dftp_delete($ftp['connid'], $dest); } } else { @unlink($source); return 1; } } errorlog('FTP', "Upload '{$source}' error.", 0); } return 0; }
$errlog[$log[0]] = $log[1]; } } fclose($fp); } if(!in_array($dberrno, $errlog)) { $errlog[$timestamp] = $dberrno; @$fp = fopen(NOWHERE_ROOT.'./forumdata/dberror.log', 'w'); @flock($fp, 2); foreach(array_unique($errlog) as $dateline => $errno) { @fwrite($fp, "$dateline\t$errno"); } @fclose($fp); if(function_exists('errorlog')) { errorlog('MySQL', basename($GLOBALS['_SERVER']['PHP_SELF'])." : $dberror - ".GlobalCore::cutstr($sql, 120), 0); } if($GLOBALS['dbreport']) { echo "<br><br>An error report has been dispatched to our administrator."; } } else { echo '<br><br>Similar error report has beed dispatched to administrator before.'; } } echo '</p>'; function_exists('chobits_exit') ? chobits_exit() : exit();
private function getValueFromChar($ch) { $val = ord($ch); try { if ($this->type == 'A') { if ($val > 95) { throw new Exception(' illegal barcode character ' . $ch . ' for code128A in ' . __FILE__ . ' on line ' . __LINE__); } if ($val < 32) { $val += 64; } else { $val -= 32; } } elseif ($this->type == 'B') { if ($val < 32 || $val > 127) { throw new Exception(' illegal barcode character ' . $ch . ' for code128B in ' . __FILE__ . ' on line ' . __LINE__); } else { $val -= 32; } } else { if (!is_numeric($ch) || (int) $ch < 0 || (int) $ch > 99) { throw new Exception(' illegal barcode character ' . $ch . ' for code128C in ' . __FILE__ . ' on line ' . __LINE__); } else { if (strlen($ch) == 1) { $ch .= '0'; } $val = (int) $ch; } } } catch (Exception $ex) { errorlog('die', $ex->getMessage()); } return $val; }
header("Location: r.php?tbl=files&m=4&vID=1&vID2="); } if ($write == cmsg("LST_SHA_FLS_DL")) { header("Location: r.php?tbl=files&m=7.9&vID=!0"); } if ($write == cmsg("LST_SHA_FLS_NO")) { header("Location: r.php?tbl=files&m=7.9&vID=0&fullfield=on"); } if ($dbsaa) { setcookie("dbsa", $dbsaa, time() + 1000); Header("Location: admin.php?cmd=myprof"); exit; } $enterpoint = $veradm; if ($encoder == "not installed") { errorlog("Dbscript need an php encoder - iconv or mb_string."); } // настройка префиксов для работы с любым языкомым cmd if ($cmd == "test") { testcfgs(); exit; } if ($cmd == "note") { bloknot(); exit; } if ($cmd == "asql") { asqledit(); exit; } if ($cmd == "cssed") {
$bbsforumarr[$fid]['allowshare'] = intval($_POST['allowshare'][$fid]); $bbsforumarr[$fid]['bbsname'] = stripslashes($fourm); $bbsforumarr[$fid]['pushsetting'] = $_POST['pushsetting'][$fid]; $setting = saddslashes(serialize($_POST['pushsetting'][$fid])); $bbsforumarr[$fid]['displayorder'] = intval($_POST['displayorder'][$fid]); $sqlarr[$fid] = "('{$fid}', '" . $bbsforumarr[$fid]['fup'] . "', '{$fourm}', '" . $bbsforumarr[$fid]['type'] . "', '" . $bbsforumarr[$fid]['allowshare'] . "', '{$setting}', '" . $bbsforumarr[$fid]['displayorder'] . "')"; } } $formsql = implode(',', $sqlarr); $formsql = 'INSERT INTO ' . tname('forums') . '(fid, fup, name, type, allowshare, pushsetting, displayorder) VALUES' . $formsql; $_SGLOBAL['db']->query($formsql); //¸üÐÂÅäÖûº´æ updatebbsforumset(); //Ö´ÐоۺÏÌû×Ӽƻ®ÈÎÎñ if (!@(include S_ROOT . "./include/cron/updatebbsforums.php")) { errorlog('CRON', "Cronid 7 : Cron script(./include/cron/updatebbsforums.php) not found or syntax error", 0); } showmessage('bbsforums_update_success', CPURL . '?action=bbsforums'); } $_SGLOBAL['grouparr'] = $forums = $showedforums = array(); $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('forums') . ' ORDER BY displayorder'); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $value['pushsetting'] = unserialize($value['pushsetting']); $_SGLOBAL['bbsforumarr'][$value['fid']] = $value; } $query = $_SGLOBAL['db_bbs']->query('SELECT type, fup, fid, name FROM ' . tname('forums', 1)); while ($forum = $_SGLOBAL['db_bbs']->fetch_array($query)) { $forums[] = $forum; } $thevalue['forumsstr'] = $class = ''; for ($i = 0; $i < count($forums); $i++) {
function delrobotfile($path) { if (file_exists($path) && !@unlink($path)) { errorlog('attachment', 'Unlink ' . $path . ' Error.'); } }
} $itemids = implode('\',\'', $_POST['item']); } else { $itemids = $_POST['itemids']; } $itemids = str_replace('\\\'', '\'', $itemids); if (empty($itemids)) { showmessage('you_have_no_choice_operation_annex'); } $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE aid IN ('{$itemids}')"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (!@unlink(A_DIR . '/' . $value['thumbpath'])) { errorlog('Attachment', 'Unlink ' . A_DIR . '/' . $value['thumbpath'] . ' Error.'); } if (!@unlink(A_DIR . '/' . $value['filepath'])) { errorlog('Attachment', 'Unlink ' . A_DIR . '/' . $value['filepath'] . ' Error.'); } } $_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE aid IN ('{$itemids}')"); showmessage('annex_success_of_the_operation', $theurl); } print <<<END <table summary="" id="pagehead" cellpadding="0" cellspacing="0" border="0" width="100%"> \t<tr> \t\t<td><h1>{$alang['batch_management_annex']}</h1></td> \t\t<td class="actions"> \t\t</td> \t</tr> </table> END; if (empty($listarr) && empty($itemidarr)) {
// Email Templates case 'emailtemp': include_once $globals['adminfiles'] . '/emailtemp.php'; emailtemp(); break; // Email Templates // Email Templates case 'editemailtemp': include_once $globals['adminfiles'] . '/editemailtemp.php'; editemailtemp(); break; // Error Logs // Error Logs case 'errorlog': include_once $globals['adminfiles'] . '/errorlog.php'; errorlog(); break; // Tasklist // Tasklist case 'tasklist': include_once $globals['adminfiles'] . '/tasklist.php'; tasklist(); break; } //Time Stops for no one - BUT Softaculous CAN! $end_time = microtime_float(); //Clean For XSS and Extra Slashes('\') if magic_quotes_gpc is ON $_GET = cleanVARS($_GET); $_POST = cleanVARS($_POST); /////////////////////////// // Load the theme settings
} else { echo json_encode(array("status" => "error", "type" => "Invalid list ID or email.")); errorlog("constantcontact", $ex->getErrors()); } } catch (Ctct\Exceptions\CtctException $ex) { foreach ($ex->getErrors() as $error) { echo json_encode(array("status" => "error", "type" => "Looks like something went wrong. Please try again later.")); foreach ($ex->getErrors() as $error) { errorlog("constantcontact", $error); } } } } catch (Ctct\Exceptions\CtctException $ex) { echo json_encode(array("status" => "error", "type" => "Looks like something went wrong. Please try again later.")); foreach ($ex->getErrors() as $error) { errorlog("constantcontact", $error); } } } else { echo json_encode(array("status" => "error", "type" => "Please select email storage type.")); } // ERROR DURING THE VALIDATION } else { echo json_encode(array("status" => "error", "type" => "ValidationError")); } } else { header('HTTP/1.1 403 Forbidden'); header('Status: 403 Forbidden'); } function errorlog($app, $details) {
$hournew[] = array($i, $i . ' ' . lang('tool_cron_hour')); } showsetting('cron_edit_hournew', array('hournew', $hournew), $cron['hour'], 'select'); showsetting('cron_edit_minutenew', 'minutenew', $cron['minute'], 'text'); showsetting('cron_edit_filenamenew', 'filenamenew', $cron['filename'], 'text'); showsubmit('editsubmit', 'submit', '', $extbutton . (!empty($from) ? '<input type="hidden" name="from" value="' . $from . '">' : '')); showtablefooter(); showformfooter(); bind_ajax_form(); } } elseif ($_GET['run']) { $query = DB::query("SELECT * FROM " . tname("crons") . " WHERE cronid = {$_GET['run']}"); $cron = DB::fetch($query); include_once B_ROOT . './source/function/cron.func.php'; if (!@(include B_ROOT . ($cronfile = "./source/include/cron/{$cron['filename']}"))) { errorlog('CRON', $cron['name'] . " : Cron script({$cronfile}) not found or syntax error", 0); cpmsg($cron['name'] . " : Cron script({$cronfile}) not found or syntax error"); } else { cronnextrun(array($_GET['run'])); updatecronscache(); cpmsg('message_success', 'admin.php?action=tool&operation=cron'); } } else { if (!empty($_POST['deletesubmit']) && $_POST['multiop'] != 'available' && (!empty($_POST['multiop']) || !empty($_POST['newname']) || !empty($_POST['cronid']))) { if (!empty($_POST['newname'])) { DB::query("INSERT INTO " . tname("crons") . " (`available`,`type`,`name`, `weekday`, `day`, `hour`, `minute`) VALUES ( 0, 'user', '{$_POST['newname']}', -1, -1, -1, '')"); } if (!empty($_POST['cronid'])) { foreach ($_POST['cronid'] as $key => $cronid) { DB::query("UPDATE " . tname("crons") . " SET available = " . ($_POST['available'][$cronid] ? 1 : 0) . " WHERE cronid = {$cronid}"); }
} elseif ($_POST['theop'] == 'deleteattach') { $filearr = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (!empty($value['filepath'])) { $filearr[] = A_DIR . '/' . $value['filepath']; } if (!empty($value['thumbpath'])) { $filearr[] = A_DIR . '/' . $value['thumbpath']; } } //删除附件 if (!empty($filearr)) { foreach ($filearr as $value) { if (!@unlink($value)) { errorlog('attachment', 'Unlink ' . $value . ' Error.'); } } } $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET haveattach=0 WHERE itemid IN ('{$itemids}')"); $_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')"); } elseif ($_POST['theop'] == 'deletecomment') { $_SGLOBAL['db']->query("DELETE FROM " . tname('spacecomments') . " WHERE itemid IN ('{$itemids}') AND url=''"); $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET replynum=0 WHERE itemid IN ('{$itemids}')"); } elseif ($_POST['theop'] == 'grade') { $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET grade='{$_POST['grade']}' WHERE itemid IN ('{$itemids}')"); } elseif ($_POST['theop'] == 'move') { $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET catid='{$_POST['catid']}' WHERE itemid IN ('{$itemids}')"); } elseif ($_POST['theop'] == 'changefolder') { $_SGLOBAL['db']->query("UPDATE " . tname('spaceitems') . " SET folder='{$_POST['folder']}' WHERE itemid IN ('{$itemids}')"); }
<?php /* [SupeSite] (C) 2007-2009 Comsenz Inc. $Id: tagcontent.php 10898 2008-12-31 02:58:50Z zhaofei $ */ if (!defined('IN_SUPESITE')) { exit('Access Denied'); } $cachefile = S_ROOT . './data/system/tag.cache.php'; $tagnamearr = array(); $query = $_SGLOBAL['db']->query('SELECT tagname FROM ' . tname('tags') . ' ORDER BY spacenewsnum DESC LIMIT 0,100'); while ($tag = $_SGLOBAL['db']->fetch_array($query)) { if (strlen($tag['tagname']) > 2) { $tagnamearr[] = $tag['tagname']; } } if (empty($tagnamearr)) { $text = ''; } else { $text = '$_SGLOBAL[\'tagcontent\']=\'' . implode('|', $tagnamearr) . '\';'; } if (!writefile($cachefile, $text, 'php', 'w', 0)) { errorlog('Cron', srealpath($cachefile) . ' Not found or have no access!', 0); }
//Add to error message $error = 1; //Set error check } } if ($error == 0) { $insert['name'] = $_POST['name']; $insert['description'] = $_POST['description']; $insert['type'] = $_POST['type']; $insert['effectiveness'] = $_POST['effectiveness']; $insert['price'] = $_POST['price']; $query = $db->autoexecute('blueprint_items', $insert, 'INSERT'); if (!$query) { $could_not_register = "Could not add the item, the administrator has been notified. <br /><br />"; $logmsg = "Player " . $player->username . " attempted to add and item, but an error occurred."; errorlog($logmsg, $db); } else { $insertid = $db->Insert_ID(); } include "./header.php"; echo $insert['name'] . " has been added to the database"; echo "<div align='right'><INPUT TYPE=\"BUTTON\" VALUE=\"Back\" ONCLICK=\"window.location.href='add_item.php'\"></div>"; include "./footer.php"; exit; } } $msg1 .= "</font>"; //Username error? $msg2 .= "</font>"; //Password error? $msg3 .= "</font>";
public function select() { $result = ''; $this->column = $this->column ? $this->column : "*"; $this->sql = "SELECT " . $this->column . " FROM " . $this->table . " " . $this->where . " " . $this->order . " " . $this->limit; $this->connection(); if (DEBUG === true) { if ($this->sql) { errorlog("struts.log", $this->sql); } } $rs = $this->excute($this->sql, $this->mysql); if ($rs) { while ($res = mysql_fetch_array($rs)) { $result[] = $res; } return $result; } return false; }
if (@($fp = fopen(DISCUZ_ROOT . './forumdata/dberror.log', 'r'))) { while (!feof($fp) && count($errlog) < 20) { $log = explode("\t", fgets($fp, 50)); if ($timestamp - $log[0] < 86400) { $errlog[$log[0]] = $log[1]; } } fclose($fp); } if (!in_array($dberrno, $errlog)) { $errlog[$timestamp] = $dberrno; @($fp = fopen(DISCUZ_ROOT . './forumdata/dberror.log', 'w')); @flock($fp, 2); foreach (array_unique($errlog) as $dateline => $errno) { @fwrite($fp, "{$dateline}\t{$errno}"); } @fclose($fp); if (function_exists('errorlog')) { errorlog('MySQL', basename($GLOBALS['_SERVER']['PHP_SELF']) . " : {$dberror} - " . cutstr($sql, 120), 0); } if ($GLOBALS['dbreport']) { echo "<br /><br />An error report has been dispatched to our administrator."; @sendmail($GLOBALS['adminemail'], '[Discuz!] MySQL Error Report', "There seems to have been a problem with the database of your Discuz! Board\n\n" . strip_tags($errmsg) . "\n\n" . "Please check-up your MySQL server and forum scripts, similar errors will not be reported again in recent 24 hours\n" . "If you have troubles in solving this problem, please visit Discuz! Community http://www.Discuz.net."); } } else { echo '<br /><br />Similar error report has beed dispatched to administrator before.'; } } echo '</p>'; exit; }
function deleteitems($colname, $idsarr, $undel = 0, $from = 0) { global $_SGLOBAL, $_SCONFIG; include_once S_ROOT . './function/tag.func.php'; if (is_array($idsarr)) { $ids = simplode($idsarr); } else { $ids = $idsarr; } if ($undel) { moveitemfolder($idsarr, $from, 2, $colname); //Òƶ¯µ½À¬»øÏä return true; } if (!$from) { $hasharr = $itemarr = array(); $itemidarr = array(); $uidarr = array(); $filearr = array(); //spaceitems//¸Ä±äÓû§Í³¼ÆÊý¾Ý $numarr = array(); $itemtypearr = array(); $itemuidarr = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceitems') . " WHERE {$colname} IN ({$ids})"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $type = $value['type']; $hasharr[] = md5($value['subject']); if (empty($itemarr[$type])) { $itemarr[$type] = array(); } if (empty($numarr[$value['uid']][$type])) { $numarr[$value['uid']][$type] = 0; } if (empty($numarr[$value['uid']]['all'])) { $numarr[$value['uid']]['all'] = 0; } $itemarr[$type][] = $value['itemid']; $uidarr[$value['uid']] = $value['uid']; $itemidarr[] = $value['itemid']; if ($type != 'news') { $numarr[$value['uid']]['all']++; $numarr[$value['uid']][$type]++; } $itemtypearr[$value['itemid']] = $value['type']; $itemuidarr[$value['itemid']] = $value['uid']; $delhtmlarr[$value['catid']][] = $value['itemid']; } if (empty($itemidarr)) { return false; } $itemids = implode('\',\'', $itemidarr); //ɾ³ý²É¼¯·ÀÖؼǼ if (!empty($hasharr)) { $hash = '\'' . implode('\',\'', $hasharr) . '\''; $_SGLOBAL['db']->query("DELETE FROM " . tname('robotlog') . " WHERE hash IN ({$hash})"); } //Ö÷ÌâÌù $_SGLOBAL['db']->query("DELETE FROM " . tname('spaceitems') . " WHERE itemid IN ('{$itemids}')"); //ÄÚÈÝ foreach ($_SGLOBAL['type'] as $type) { if (!in_array($type, $itemtypearr)) { continue; } $tablename = tname('spacenews'); $_SGLOBAL['db']->query("DELETE FROM {$tablename} WHERE itemid IN ('{$itemids}')"); } //attachments//²»¸Ä±äÓû§Í³¼ÆÊý¾Ý $uidattachs = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (!empty($value['filepath'])) { $filearr[] = A_DIR . '/' . $value['filepath']; } if (!empty($value['thumbpath'])) { $filearr[] = A_DIR . '/' . $value['thumbpath']; } } $_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$itemids}')"); //spacecomments $_SGLOBAL['db']->query("DELETE FROM " . tname('spacecomments') . " WHERE itemid IN ('{$itemids}')"); //ɾ³ý²¢¸ü±ítag×ÜÊý $tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array()); foreach ($itemidarr as $id) { postspacetag('update', $type, $id, $tagarr, '1'); } //¾Ù±¨ÐÅÏ¢ $_SGLOBAL['db']->query("DELETE FROM " . tname('reports') . " WHERE itemid IN ('{$itemids}')"); //ɾ³ý¸½¼þ if (!empty($filearr)) { foreach ($filearr as $value) { if (!@unlink($value)) { errorlog('attachment', 'Unlink ' . $value . ' Error.'); } } } //ɾ³ýhtmlÎļþ if ($_SCONFIG['makehtml'] == 1) { include_once S_ROOT . '/data/system/htmlcat.cache.php'; foreach ($delhtmlarr as $catid => $itemidarr) { foreach ($itemidarr as $itemid) { $htmlpath = S_ROOT . '/' . substr($_SCONFIG['newspath'], 2) . '/' . substr($catarr[$catid]['htmlpath'], 2); $syear = sgmdate($value['dateline'], 'Y'); $smoon = sgmdate($value['dateline'], 'n'); $file = $htmlpath . '/' . $syear . '/' . $smoon . '/' . $catarr[$catid]['pre_html'] . $itemid . '.html'; @unlink($file); } } showmessage('delete_html', 'admincp.php?action=makehtml&op=updatehtml&do=updatelisthtml'); } else { foreach ($itemidarr as $itemid) { if ($itemtypearr[$itemid] == 'news') { $id = $itemid; } else { $id = $itemuidarr[$itemid]; } $idvalue = $id > 9 ? substr($id, -2, 2) : $id; $filedir = H_DIR . '/' . $idvalue; if (is_dir($filedir)) { $filearr = sreaddir($filedir); foreach ($filearr as $file) { if (preg_match("/\\-{$itemid}(\\.|\\-)/i", $file)) { @unlink($filedir . '/' . $file); } } } } } updatecredit('delinfo', $uidarr); } else { $itemidarr = array(); $oitemidarr = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('postitems') . " WHERE {$colname} IN ({$ids})"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $itemidarr[] = $value['itemid']; $oitemidarr[] = $value['oitemid']; $tag_itemid[] = empty($value['oitemid']) ? $value['itemid'] : $value['oitemid']; } $itemids = implode('\',\'', $itemidarr); $oitemids = implode('\',\'', $oitemidarr); $_SGLOBAL['db']->query("DELETE FROM " . tname('postitems') . " WHERE itemid IN ('{$itemids}')"); $_SGLOBAL['db']->query("DELETE FROM " . tname('postmessages') . " WHERE itemid IN ('{$itemids}')"); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('attachments') . " WHERE itemid IN ('{$oitemids}')"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (!empty($value['filepath'])) { $filearr[] = A_DIR . '/' . $value['filepath']; } if (!empty($value['thumbpath'])) { $filearr[] = A_DIR . '/' . $value['thumbpath']; } } $_SGLOBAL['db']->query("DELETE FROM " . tname('attachments') . " WHERE itemid IN ('{$oitemids}')"); //ɾ³ý¸½¼þ if (!empty($filearr)) { foreach ($filearr as $value) { if (!@unlink($value)) { errorlog('attachment', 'Unlink ' . $value . ' Error.'); } } } //ɾ³ý²¢¸ü±ítag×ÜÊý $tagarr = array('existsname' => array(), 'nonename' => array(), 'closename' => array(), 'existsid' => array()); foreach ($tag_itemid as $id) { postspacetag('update', $type, $id, $tagarr, '0'); } } }
function ftpupload($source, $attach) { global $authkey, $ftp; $ftp['pwd'] = isset($ftp['pwd']) ? $ftp['pwd'] : FALSE; $dest = $attach['attachment']; if ($ftp['on'] && (!$ftp['allowedexts'] && !$ftp['disallowedexts'] || $ftp['allowedexts'] && in_array($attach['ext'], explode("\n", strtolower($ftp['allowedexts']))) || $ftp['disallowedexts'] && !in_array($attach['ext'], explode("\n", strtolower($ftp['disallowedexts'])))) && (!$ftp['minsize'] || $attach['size'] >= $ftp['minsize'] * 1024)) { require_once DISCUZ_ROOT . './include/ftp.func.php'; if (!$ftp['connid']) { if (!($ftp['connid'] = dftp_connect($ftp['host'], $ftp['username'], authcode($ftp['password'], 'DECODE', md5($authkey)), $ftp['attachdir'], $ftp['port'], $ftp['ssl']))) { if ($ftp['mirror'] == 1) { ftpupload_error($source, $attach); } else { return 0; } } $ftp['pwd'] = FALSE; } $tmp = explode('/', $dest); if (count($tmp) > 1) { if (!$ftp['pwd'] && !dftp_chdir($ftp['connid'], $tmp[0])) { if (!dftp_mkdir($ftp['connid'], $tmp[0])) { errorlog('FTP', "Mkdir '{$ftp['attachdir']}/{$tmp['0']}' error.", 0); if ($ftp['mirror'] == 1) { ftpupload_error($source, $attach); } else { return 0; } } if (!function_exists('ftp_chmod') || !dftp_chmod($ftp['connid'], 0777, $tmp[0])) { dftp_site($ftp['connid'], "'CHMOD 0777 {$tmp['0']}'"); } if (!dftp_chdir($ftp['connid'], $tmp[0])) { errorlog('FTP', "Chdir '{$ftp['attachdir']}/{$tmp['0']}' error.", 0); if ($ftp['mirror'] == 1) { ftpupload_error($source, $attach); } else { return 0; } } dftp_put($ftp['connid'], 'index.htm', $GLOBALS['attachdir'] . '/index.htm', FTP_BINARY); } $dest = $tmp[1]; $ftp['pwd'] = TRUE; } if (dftp_put($ftp['connid'], $dest, $source, FTP_BINARY)) { if ($attach['thumb']) { if (dftp_put($ftp['connid'], $dest . '.thumb.jpg', $source . '.thumb.jpg', FTP_BINARY)) { if ($ftp['mirror'] != 2) { @unlink($source); @unlink($source . '.thumb.jpg'); } return 1; } else { dftp_delete($ftp['connid'], $dest); } } else { if ($ftp['mirror'] != 2) { @unlink($source); } return 1; } } errorlog('FTP', "Upload '{$source}' error.", 0); $ftp['mirror'] == 1 && ftpupload_error($source, $attach); } return 0; }
if (isset($form['cfg']['antispamjs']) && isset($_POST[$form['cfg']['antispamjs']])) { if (!empty($_POST[$form['cfg']['antispamjs']])) { $error[] = $form['cfg']['spam']; } } if (count($error) == 0) { error_log('generate param for email sending'); if (function_exists("mb_internal_encoding")) { mb_internal_encoding($form['cfg']['charset']); } error_log('get fromName...'); $get_fromName = isset($form['fields'][$form['cfg']['from_name']]) && isset($getdata[$form['cfg']['from_name']]['value']) && mb_strlen($getdata[$form['cfg']['from_name']]['value']) > 2 ? $getdata[$form['cfg']['from_name']]['value'] : (mb_strlen($form['cfg']['from_name']) > 2 && !isset($_POST[$form['cfg']['from_name']]) ? $form['cfg']['from_name'] : 'Anonymous'); errorlog('pre send fromName: ' . $get_fromName); error_log('get fromEmail...'); $get_fromEmail = isset($form['fields'][$form['cfg']['from_email']]) && isset($getdata[$form['cfg']['from_email']]['value']) && mb_strpos('@', $getdata[$form['cfg']['from_email']]['value']) === false ? $getdata[$form['cfg']['from_email']]['value'] : (mb_strpos('@', $form['cfg']['from_email']) !== false ? $form['cfg']['from_email'] : 'no-reply@' . $host); errorlog('pre send fromEmail: ' . $get_fromEmail); $fromName = function_exists("mb_encode_mimeheader") ? mb_encode_mimeheader($get_fromName, $form['cfg']['charset'], "Q") : $get_fromName; error_log('get subject...'); $sb['subject'] = function_exists("mb_encode_mimeheader") ? mb_encode_mimeheader($form['cfg']['subject'], $form['cfg']['charset'], "Q") : $form['cfg']['subject']; $toName = trim($form['cfg']['to_name'], " ,"); $toEmail = trim($form['cfg']['to_email'], " ,"); if (strpos($toName, ",") !== false) { $exp_toName = explode(",", $toName); $c = count($exp_toName); for ($i = 0; $i < $c; $i++) { $exp_toName[$i] = function_exists("mb_encode_mimeheader") ? mb_encode_mimeheader(trim($exp_toName[$i]), $form['cfg']['charset'], "Q") : trim($exp_toName[$i]); } } else { $toName = function_exists("mb_encode_mimeheader") ? mb_encode_mimeheader($toName, $form['cfg']['charset'], "Q") : $toName; } if (strpos($toEmail, ",") !== false) {