📄 adminfunctions.php
字号:
echo iif($tableadded==1,"<tr id='submitrow'>\n<td colspan='$colspan' align='center'>","<p><center>");
echo "<p id='submitrow'><input type=\"submit\" value=\" $submitname \" accesskey=\"s\">\n";
if ($resetname!="") {
echo "<input type=\"reset\" value=\" $resetname \">\n";
}
if ($goback!="") {
echo "<input type=\"button\" value=\" $goback \" onclick=\"history.back(1)\">\n";
}
echo iif($tableadded==1,"</p></td>\n</tr>\n</table>\n</td>\n</tr>\n</table>\n","</p></center>\n");
echo "</form>\n";
}
function doformiddle ($ratval,$call=1) {
global $session,$bbuserinfo;
$retval="<form action=\"$phpscript.php\" ".iif($uploadform,"ENCTYPE=\"multipart/form-data\" ","")." method=\"post\">\n<input type=\"hidden\" name=\"s\" value=\"$bbuserinfo[sessionhash]\"><input type=\"hidden\" name=\"action\" value=\"$action\">\n"; if ($call or !$call) { $ratval=""; return $ratval; }
}
// ###################### Start dotablefooter #######################
function dotablefooter($colspan=2,$extra="") {
// identical to doformfooter but without a button row.
if ($extra!="") {
echo "<tr id='submitrow'>\n<td colspan='$colspan' align='center'>$extra</td></tr>\n";
}
echo "</table></td></tr></table></form>\n";
}
// ###################### Start makechoosercode #######################
function makechoosercode ($title,$name,$tablename,$selvalue=-1,$extra="",$size=0) {
// returns a combo box containing a list of titles in the $tablename table.
// allows specification of selected value in $selvalue
global $DB_site;
echo "<tr class='".getrowbg()."' valign='top'>\n<td><p>$title</p></td>\n<td><p><select name=\"$name\"".iif($size!=0," size=\"$size\"","").">\n";
$tableid="usergroupid";
$result=$DB_site->query("SELECT title,$tableid FROM $tablename ORDER BY $tableid DESC");
while ($currow=$DB_site->fetch_array($result)) {
if ($selvalue==$currow[$tableid]) {
echo "<option value=\"$currow[$tableid]\" SELECTED>$currow[title]</option>\n";
} else {
echo "<option value=\"$currow[$tableid]\">$currow[title]</option>\n";
}
} // for
if ($extra!="") {
if ($selvalue==-1) {
echo "<option value=\"-1\" SELECTED>$extra</option>\n";
} else {
echo "<option value=\"-1\">$extra</option>\n";
}
}
echo "</select>\n</p></td>\n</tr>\n";
}
// ###################### Start generateoptions #######################
function generateoptions() {
global $DB_site,$table;
$settings=$DB_site->query("SELECT varname,value FROM ".$table["setting"]);
while ($setting=$DB_site->fetch_array($settings)) {
$setting['value'] = str_replace( '\\', '\\\\', $setting['value'] );
$setting['value'] = str_replace( '$', '\$', $setting['value'] );
$setting['value'] = str_replace( '"', '\"', $setting['value'] );
$template .= "\$$setting[varname] = \"" . addslashes( $setting['value'] ) . "\";\n";
}
return $template;
}
// ###################### Start makelinkcode #######################
function makelinkcode($text,$url,$newwin=0,$popup="") {
return " <a href=\"$url\" class=\"lc\"".iif($newwin," target=\"_blank\"","").iif($popup!="","title=\"$popup\"","").">[$text]</a>";
}
// ###################### Start checklogperms #######################
// checks a single integer or a comma-separated list for $bbuserinfo[userid]
function checklogperms($idvar,$defaultreturnvar,$errmsg="") {
global $bbuserinfo;
if ($idvar=="") {
return $defaultreturnvar;
} else {
$perm = trim($idvar);
if (strstr($perm,",")) {
$logperms = explode(",",$perm);
$okay = 0;
while (list($key,$val)=each($logperms)) {
if ($bbuserinfo[userid]==intval($val)) {
$okay = 1;
}
}
if (!$okay) {
echo $errmsg;
return 0;
} else {
return 1;
}
} else {
if ($bbuserinfo[userid]!=intval($perm)) {
echo $errmsg;
return 0;
} else {
return 1;
}
}
}
}
// ###################### Start makenavoption #######################
// creates an <option> or <a href for the left-panel of index.php
// (depending on value of $cpnavjs)
// NOTE: '&s=$session[sessionhash]' will be AUTOMATICALLY added to the URL - do not add to your link!
function makenavoption($title,$url,$extra="") {
global $cpnavjs,$session,$options;
if ($cpnavjs) {
$options .= "<option class=\"opt\" value=\"$url\">> ".htmlspecialchars($title)."</option>\n";
} else {
$options .= "<a href=\"$url&s=$session[sessionhash]\"> ".htmlspecialchars($title)." </a> $extra\n";
}
}
// ###################### Start makenavselect #######################
// creates a <select> or <table> for the left panel of index.php
// (depending on value of $cpnavjs)
function makenavselect($title,$extra="",$chs="") {
global $cpnavjs,$options;
if ($cpnavjs) {
echo "<tr align=\"right\"><td>\n<select class=\"tblhead\" onchange=\"navlink(this.options[this.selectedIndex].value,this.form)\">\n";
echo "<option value=\"\">".htmlspecialchars($title)."</option>\n<option class=\"opt\" value=\"\"> </option>\n";
echo "$options<option class=\"opt\" value=\"\"> </option>\n<option value=\"\">- - - - - - - - - - - - - - -</option>\n</select>";
} else {
echo "<tr><td><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"2\" id=\"navtable\">\n";
maketableheader($title,"",1,1);
echo "</table>\n$options";
}
echo "</td></tr>$chs\n";
echo iif($extra!="","<tr><td>$extra</td></tr>","");
$options="";
}
// ###################### Start makeselect #######################
function makeselect($title,$varname) {
global $options,$selected;
echo "<tr align=\"left\" class='".getrowbg()."'><td>".htmlspecialchars($title)."</td><td>\n<select class=\"tblhead\" name=\"$varname\">\n";
echo "$options\n</select>";
echo "</td></tr>\n";
$options="";
$selected=0;
}
// ###################### Start makeoption #######################
function makeoption($title,$val="") {
global $options,$selected;
if ($val=="") {
$val = htmlspecialchars($title);
}
$options .= "<option class=\"opt\" value=\"$val\"".iif($selected!=1," selected","").">".htmlspecialchars($title)."</option>\n";
$selected=1;
}
// ###################### Start makesclasschoosercode #######################
function makesclasschoosercode ($title,$name,$tablename,$selvalue=-1,$extra="",$size=0) {
// returns a combo box containing a list of titles in the $tablename table.
// allows specification of selected value in $selvalue
global $DB_site;
echo "<tr class='".getrowbg()."' valign='top'>\n<td><p>$title</p></td>\n<td><p><select name=\"$name\"".iif($size!=0," size=\"$size\"","").">\n";
$tableid="SClassID";
$result=$DB_site->query("SELECT $tableid,SClassName FROM $tablename ORDER BY $tableid DESC");
while ($currow=$DB_site->fetch_array($result)) {
if ($selvalue==$currow[$tableid]) {
echo "<option value=\"$currow[$tableid]\" SELECTED>$currow[SClassName]</option>\n";
} else {
echo "<option value=\"$currow[$tableid]\">$currow[SClassName]</option>\n";
}
} // for
if ($extra!="") {
if ($selvalue==-1) {
echo "<option value=\"-1\" SELECTED>$extra</option>\n";
} else {
echo "<option value=\"-1\">$extra</option>\n";
}
}
echo "</select>\n</p></td>\n</tr>\n";
}
// ###################### Start makenclasschoosercode #######################
function makenclasschoosercode ($title,$name,$sclassid,$selvalue=-1,$extra="",$size=0) {
// returns a combo box containing a list of titles in the $tablename table.
// allows specification of selected value in $selvalue
global $DB_site,$table;
echo "<tr class='".getrowbg()."' valign='top'>\n<td><p>$title</p></td>\n<td><p><select name=\"$name\"".iif($size!=0," size=\"$size\"","").">\n";
$tableid="NClassID";
$result=$DB_site->query("SELECT $tableid,NClassName FROM $table[nclass] WHERE SClassID=$sclassid ORDER BY $tableid DESC");
while ($currow=$DB_site->fetch_array($result)) {
if ($selvalue==$currow[$tableid]) {
echo "<option value=\"$currow[$tableid]\" SELECTED>$currow[NClassName]</option>\n";
} else {
echo "<option value=\"$currow[$tableid]\">$currow[NClassName]</option>\n";
}
} // for
if ($extra!="") {
if ($selvalue==-1) {
echo "<option value=\"-1\" SELECTED>$extra</option>\n";
} else {
echo "<option value=\"-1\">$extra</option>\n";
}
}
echo "</select>\n</p></td>\n</tr>\n";
}
// ###################### Start makesettingchoosercode #######################
function makesettingchoosercode ($title,$name,$tablename,$selvalue=-1,$extra="",$size=0) {
// returns a combo box containing a list of titles in the $tablename table.
// allows specification of selected value in $selvalue
global $DB_site;
echo "<tr class='".getrowbg()."' valign='top'>\n<td><p>$title</p></td>\n<td><p><select name=\"$name\"".iif($size!=0," size=\"$size\"","").">\n";
$tableid="settinggroupid";
$result=$DB_site->query("SELECT title,$tableid FROM $tablename ORDER BY $tableid DESC");
while ($currow=$DB_site->fetch_array($result)) {
if ($selvalue==$currow[$tableid]) {
echo "<option value=\"$currow[$tableid]\" SELECTED>$currow[title]</option>\n";
} else {
echo "<option value=\"$currow[$tableid]\">$currow[title]</option>\n";
}
} // for
if ($extra!="") {
if ($selvalue==-1) {
echo "<option value=\"-1\" SELECTED>$extra</option>\n";
} else {
echo "<option value=\"-1\">$extra</option>\n";
}
}
echo "</select>\n</p></td>\n</tr>\n";
}
// ###################### Start makemtvchoosercode #######################
function makemtvchoosercode ($title,$name,$tablename,$infofield,$selfield,$selvalue=-1,$extra="",$size=0) {
// returns a combo box containing a list of titles in the $tablename table.
// allows specification of selected value in $selvalue
global $DB_site,$table;
echo "<tr class='".getrowbg()."' valign='top'>\n<td><p>$title</p></td>\n<td><p><select name=\"$name\"".iif($size!=0," size=\"$size\"","").">\n";
$result=$DB_site->query("SELECT * FROM ".$tablename." ORDER BY id");
while ($currow=$DB_site->fetch_array($result)) {
if ($selvalue==$currow[$selfield]) {
echo "<option value=\"$currow[$selfield]\" SELECTED>$currow[$infofield]</option>\n";
} else {
echo "<option value=\"$currow[$selfield]\">$currow[$infofield]</option>\n";
}
} // for
if ($extra!="") {
if ($selvalue==-1) {
echo "<option value=\"-1\" SELECTED>$extra</option>\n";
} else {
echo "<option value=\"-1\">$extra</option>\n";
}
}
echo "</select>\n</p></td>\n</tr>\n";
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -