function cpmsg($message, $url = '', $type = '', $extra = '', $halt = true, $goback = false, $checkresults = array(), $redirecttime = 2000) { global $_G; extract($GLOBALS, EXTR_SKIP); include_once B_ROOT . './language/admin.lang.php'; $vars = explode(':', $message); if (count($vars) == 2 && isset($scriptlang[$vars[0]][$vars[1]])) { @eval("\$message = \"" . str_replace('"', '\\"', $scriptlang[$vars[0]][$vars[1]]) . "\";"); } elseif (!empty($messsage)) { @eval("\$message = \"" . (isset($lang[$message]) ? $lang[$message] : $message) . "\";"); } if ($_G['inajax'] == 1) { showxmlheader($_G['charset']); echo '<root>'; if (!empty($checkresults)) { echo '<status>FAILED</status>'; foreach ($checkresults as $error) { echo showarraytoxml($error, $_G['charset'], 1); } } else { echo '<status>OK</status>'; echo '<url><![CDATA[' . $url . ']]></url>'; } echo '<message><![CDATA[' . lang($message) . ']]></message>'; echo '</root>'; exit; } else { switch ($type) { case 'succeed': $classname = 'infotitle2'; break; case 'error': $classname = 'infotitle3'; break; case 'loading': $classname = 'infotitle1'; break; default: $classname = 'marginbot normal'; break; } $message = "<h4 class=\"{$classname}\">" . cplang($message) . "</h4>"; $url .= !empty($scrolltop) ? '&scrolltop=' . intval($scrolltop) : ''; if ($type == 'form') { $message = "<form method=\"post\" action=\"{$url}\"><input type=\"hidden\" name=\"formhash\" value=\"" . FORMHASH . "\">" . "<br />{$message}{$extra}<br />" . "<p class=\"margintop\"><input type=\"submit\" class=\"btn\" name=\"confirmed\" value=\"{$lang['ok']}\"> \n" . "<input type=\"button\" class=\"btn\" value=\"{$lang['cancel']}\" onClick=\"history.go(-1);\"></p></form><br />"; } elseif ($type == 'loadingform') { $message = "<form method=\"post\" action=\"{$url}\" id=\"loadingform\"><input type=\"hidden\" name=\"formhash\" value=\"" . FORMHASH . "\"><br />{$message}{$extra}<img src=\"static/image/admin/ajax_loader.gif\" class=\"marginbot\" /><br />" . '<p class="marginbot"><a href="' . $url . '" onclick="$(\'loadingform\').submit();return false;" class="lightlink">' . lang('message_redirect') . '</a></p></form><br /><script type="text/JavaScript">setTimeout("$(\'loadingform\').submit();", 2000);</script>'; } else { $message .= $extra . ($type == 'loading' ? '<img src="static/image/admin/ajax_loader.gif" class="marginbot" />' : ''); if ($url) { if ($type == 'button') { $message = "<br />{$message}<br /><p class=\"margintop\"><input type=\"submit\" class=\"btn\" name=\"submit\" value=\"{$lang['start']}\" onclick=\"location.href='{$url}'\" />"; } else { $message .= '<p class="marginbot"><a href="' . $url . '" class="lightlink">' . lang('message_redirect') . '</a></p>'; } $message .= "<script type=\"text/JavaScript\">setTimeout(\"redirect('{$url}');\", {$redirecttime});</script>"; } elseif (strpos($message, $lang['return'])) { $message .= '<p class="marginbot"><a href="javascript:history.go(-1);" class="lightlink">' . lang('message_return') . '</a></p>'; } $message .= $goback ? "<script>setTimeout(\"history.go(-1);\", {$redirecttime});</script>" : ''; } if ($halt) { echo '<h3>' . lang('pk_message') . '</h3><div class="infobox">' . $message . '</div>'; cpfooter(); exit; } else { echo '<div class="infobox">' . $message . '</div>'; } } }
} } if ($i == 0) { echo '<script relatedtype="text/javascript" charset="' . $_G['charset'] . '">alert(\'' . lang('noresult_content') . '\')</script>'; } } elseif ($opt == 'previewconsume') { $id = intval($_GET['id']); $shopid = intval($_GET['shopid']); $coupon_title = trim($_GET['coupon_title']); $brief = trim($_GET['brief']); $exception = trim($_GET['exception']); $shopinfo = DB::fetch(DB::query("SELECT subject, address, tel FROM " . tname('shopitems') . " WHERE itemid='{$shopid}'")); $coupon_title = biconv($coupon_title, 'UTF-8', $_G['charset']); $brief = biconv($brief, 'UTF-8', $_G['charset']); $exception = biconv($exception, 'UTF-8', $_G['charset']); $createimgarr = array('preview' => 1, 'id' => $id, 'coupon_title' => $coupon_title, 'dealer_name' => $shopinfo['subject'], 'begin_date' => $_GET['begin_date'], 'end_date' => $_GET['end_date'], 'brief' => $brief, 'exception' => $exception, 'address' => $shopinfo['address'], 'hotline' => $shopinfo['tel']); require_once B_ROOT . './source/adminfunc/tool.func.php'; if ($consumeimgpath = image_text($createimgarr)) { echo '<img width="750px" height="466px" src="' . getattachurl($consumeimgpath) . '?time=' . $_G['timestamp'] . '">'; } } elseif ($opt == 'getThread' && $_GET['tid'] > 0) { //管理員專用 require_once B_ROOT . './api/bbs_pic.php'; showxmlheader('GBK'); echo '<threadinfo>'; echo showarraytoxml(list_threads(intval($_GET['tid'])), 'GBK'); echo '</threadinfo>'; } else { //其他情況 echo "<option value=\"0\" selected=\"selected\">" . lang('please_select') . "</option>\n"; }