function cpmsg($message, $url_forward = '', $msgtype = 'message', $extra = '', $cancelurl = '') { extract($GLOBALS, EXTR_SKIP); eval("\$message = \"".(isset($msglang[$message]) ? $msglang[$message] : $message)."\";"); if($msgtype == 'form') { $message = "<form method=\"post\" action=\"$url_forward\"><input type=\"hidden\" name=\"formhash\" value=\"".FORMHASH."\">". "<br /><br /><br />$message$extra<br /><br /><br /><br />\n". "<input class=\"button\" type=\"submit\" name=\"confirmed\" value=\"$lang[ok]\"> \n". "<input class=\"button\" type=\"button\" value=\"$lang[cancel]\" onClick=\"". ($cancelurl == '' ? 'history.go(-1)' : 'location.href=\''.$cancelurl.'\''). ";\"></form><br />"; } else { if($url_forward) { $message .= "<br /><br /><br /><a href=\"$url_forward\">$lang[message_redirect]</a>"; $url_forward = transsid($url_forward); $message .= "<script>setTimeout(\"redirect('$url_forward');\", 2000);</script>"; } elseif(strpos($message, $lang['return'])) { $message .= "<br /><br /><br /><a href=\"javascript:history.go(-1);\" class=\"mediumtxt\">$lang[message_return]</a>"; } $message = "<br /><br /><br />$message$extra<br /><br />"; } ?> <br /><br /><br /><br /><br /><br /> <table width="500" border="0" cellpadding="0" cellspacing="0" align="center" class="tableborder"> <tr class="header"><td><?=$lang['discuz_message']?></td></tr><tr><td class="altbg2"><div align="center"> <?=$message?></div><br /><br /> </td></tr></table> <br /><br /><br /> <? cpfooter(); dexit(); }
function show_no_access() { cpheader(); cpmsg('action_noaccess', '', 'error'); cpfooter(); }
} elseif ($allowmassprune && $action == 'prune') { $cpscript = 'prune'; } elseif ($action == 'plugins') { $cpscript = 'plugins'; } elseif ($allowviewlog && ($action == 'ratelog' || $action == 'modslog' || $action == 'banlog')) { $cpscript = 'logs'; } } if ($cpscript) { require_once DISCUZ_ROOT . './admin/' . $cpscript . '.inc.php'; } else { cpheader(); cpmsg('noaccess'); } if ($action != 'menu' && $action != 'header') { cpfooter(); } } output(); function loginmsg($message, $url_forward = '', $msgtype = 'message') { extract($GLOBALS, EXTR_SKIP); $action = dhtmlspecialchars($action); $message = isset($msglang[$message]) ? $msglang[$message] : $message; if ($msgtype == 'message') { $message = '<tr><td> </td><td align="center" colspan="3" >' . $message; if ($url_forward) { $message .= "<br /><br /><a href=\"{$url_forward}\">{$lang['message_redirect']}</a>"; $url_forward = transsid($url_forward); $message .= "<script>setTimeout(\"redirect('{$url_forward}');\", 1250);</script><br /><br /><br /></td><td> </td></tr>"; } else {
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>'; } } }
function cpexport(){ extract($GLOBALS, EXTR_SKIP); cpheader(); ?> <form method="post" name="export" id="export" action="<?=$phpself?>?action=export"> <input type="hidden" name="setup" value="1"> <table width="100%" border="0" cellpadding="2" cellspacing="6"> <tr> <td> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder"> <tr class="header"> <td><div style="float:left; margin-left:0px; padding-top:8px">技巧提示</div><div style="float:right; margin-right:4px; padding-bottom:9px"></div> </td> </tr> <tbody id="menu_tip"> <tr> <td> <ul> <li>数据备份功能根据您的选择备份数据,导出的数据文件可用“数据恢复”功能或 phpMyAdmin 导入。</li> </ul> <ul> <li>全部备份均不包含模板文件和附件文件。模板、附件和用户自定义头像的备份只需通过 FTP 下载相应文件即可。</li> </ul> <ul> <li>MySQL Dump 的速度比 Discuz! 分卷备份快很多,但需要服务器支持相关的 Shell 权限,同时由于 MySQL 本身的兼容性问题,通常进行备份和恢复的服务器应当具有相同或相近的版本号才能顺利进行。因此 MySQL Dump 是有风险的:一旦进行备份或恢复操作的服务器其中之一禁止了 Shell,或由于版本兼容性问题导致导入失败,您将无法使用 MySQL Dump 备份或由备份数据恢复;Discuz! 分卷备份没有此限制。</li></ul> <ul> <li>数据备份选项中的设置,仅供高级用户的特殊用途使用,当您尚未对数据库做全面细致的了解之前,请使用默认参数备份,否则将导致备份数据错误等严重问题。</li> <li>十六进制方式可以保证备份数据的完整性,但是备份文件会占用更多的空间。</li> </ul> <ul> <li>压缩备份文件可以让您的备份文件占用更小的空间。</li> </ul> </td> </tr> </tbody> </table><br /> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder"> <tr class="header"> <td colspan="2">数据备份类型</td> </tr> <tr> <td class="altbg1" width="47%"><input class="radio" type="radio" value="alldata" name="type" onclick="javascript:showtables(0);" checked>全部数据</td> <td width="53%" class="altbg2"></td> </tr> <tr> <td class="altbg1"><input class="radio" type="radio" value="custom" name="type" onclick="javascript:showtables(1);">自定义备份</td> <td class="altbg2">根据需要自行选择需要备份的数据表</td> </tr> <tbody id="showtables" style="display:none;"> <tr> <td colspan="2"> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <?=$tablelist?> </table> </td> </tr> </tbody> <tr> <td class="altbg1"></td> <td class="altbg2" style="text-align: right;"><input class="checkbox" type="checkbox" value="1" onclick="javascript:advanceoption(this);">更多选项 </td> </tr> <tbody id="advanceoption" style="display:none;"> <tr class="header"> <td colspan="2">数据备份方式</td> </tr> <tr> <td class="altbg1"> <input class="radio" type="radio" name="method" value="shell" <?=$shelldisabled?> onclick="if(<?=intval($db->version() < '4.1')?>) {if(this.form.sqlcompat[2].checked==true) this.form.sqlcompat[0].checked=true; this.form.sqlcompat[2].disabled=true; this.form.sizelimit.disabled=true;} else {this.form.sqlcharset[0].checked=true; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=true;}}"> 系统 MySQL Dump (Shell) 备份 </td> <td class="altbg2"> </td> </tr> <tr> <td class="altbg1"> <input class="radio" type="radio" name="method" value="multivol" checked onclick="this.form.sqlcompat[2].disabled=false; this.form.sizelimit.disabled=false; for(var i=1; i<=5; i++) {if(this.form.sqlcharset[i]) this.form.sqlcharset[i].disabled=false;}"> Discuz! 分卷备份 - 文件长度限制(kb) </td> <td class="altbg2"><input type="text" size="40" name="sizelimit" value="2048"></td> </tr> <tr class="header"> <td colspan="2">数据备份选项</td> </tr> <tr> <td class="altbg1"> 使用扩展插入(Extended Insert)方式</td> <td class="altbg2"> <input class="radio" type="radio" name="extendins" value="1"> 是 <input class="radio" type="radio" name="extendins" value="0" checked> 否 </td> </tr> <tr> <td class="altbg1"> 建表语句格式</td> <td class="altbg2"> <input class="radio" type="radio" name="sqlcompat" value="" checked> 默认 <input class="radio" type="radio" name="sqlcompat" value="MYSQL40"> MySQL 3.23/4.0.x <input class="radio" type="radio" name="sqlcompat" value="MYSQL41"> MySQL 4.1.x/5.x </td> </tr> <tr> <td class="altbg1"> 强制字符集</td> <td class="altbg2"><?=$sqlcharsets?></td> </tr> <tr> <td class="altbg1"> 十六进制方式</td> <td class="altbg2"><input class="radio" type="radio" name="usehex" value="1" checked> 是 <input class="radio" type="radio" name="usehex" value="0"> 否</td> </tr> <? if(function_exists('gzcompress')) { ?> <tr> <td class="altbg1"> 压缩备份文件</td> <td class="altbg2"><input class="radio" type="radio" name="usezip" value="1"> 多分卷压缩成一个文件 <input class="radio" type="radio" name="usezip" value="2"> 每个分卷压缩成单独文件 <input class="radio" type="radio" name="usezip" value="0" checked> 不压缩</td> </tr> <? } ?> <tr> <td class="altbg1"> 备份文件名</td> <td class="altbg2"><input type="text" size="40" name="filename" value="<?=date('ymd').'_'.random(8)?>"> .sql</td> </tr> </tbody> </table> </td> </tr> </table> <center><input class="button" type="submit" name="exportsubmit" value="提 交"></center> </form> <?php cpfooter(); exit; }
function cpmsg($message, $url = '', $type = '', $extra = '', $halt = TRUE) { extract($GLOBALS, EXTR_SKIP); include language('admincp.msg'); eval("\$message = \"" . (isset($msglang[$message]) ? $msglang[$message] : $message) . "\";"); 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}\">{$message}</h4>"; 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=\"images/admincp/ajax_loader.gif\" class=\"marginbot\" /><br />" . '<p class="marginbot"><a href="###" onclick="$(\'loadingform\').submit();" 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="images/admincp/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>'; $url = transsid($url); $message .= "<script type=\"text/JavaScript\">setTimeout(\"redirect('{$url}');\", 2000);</script>"; } } elseif (strpos($message, $lang['return'])) { $message .= '<p class="marginbot"><a href="javascript:history.go(-1);" class="lightlink">' . lang('message_return') . '</a></p>'; } } if ($halt) { echo '<h3>' . lang('discuz_message') . '</h3><div class="infobox">' . $message . '</div>'; cpfooter(); dexit(); } else { echo '<div class="infobox">' . $message . '</div>'; } }