Location: PHPKode > projects > Exero CMS > upload/functions/adminfunctions.php
<?
/*========================================*\
| Exero CMS                                |
|==========================================|
|          http://ecms.getox.net           |
|https://sourceforge.net/projects/exerocms/|
|==========================================|
|     Exero CMS is released under the      |
|     GNU General Public License (GPL)     |
| opensource.org/licenses/gpl-license.php  |
\*========================================*/

// Interface Functions
// Top Frame
function print_admincp_header() {
	print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Exero CMS AdminCP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
	padding: 0px;
	background-color: #0B79CE;
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #FFFFFF;
}
#topheader {
	height: 69px;
	background: url(images/headerbg.jpg);
}
#topheader .head {
	height: 69px;
	background: url(images/header.jpg);
	background-repeat: no-repeat;
}
-->
</style>
</head>

<body>
<div id="topheader">
	<div class="head">
		<table width="100%" height="69" border="0" cellspacing="0" cellpadding="0" align="center">
		  <tr>
			<td valign="center">

			</td>
		  </tr>
		</table>
	</div>
</div>
</html>';
}

// Frameset
function print_frameset() {
 print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>Exero CMS AdminCP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-style: italic;
	font-weight: bold;
}
-->
</style>
</head>

<frameset rows="69,*" cols="*" frameborder="NO" border="0" framespacing="0">
  <frame src="index.php?do=top" name="topFrame" scrolling="NO" noresize >
  <frameset rows="*" cols="186,*" framespacing="0" frameborder="NO" border="0">
    <frame src="index.php?do=nav" name="leftFrame" scrolling="AUTO" noresize>
    <frame src="index.php?do=main" name="mainFrame">
  </frameset>
</frameset>
<noframes><body>
<span class="style1">Error: your browser does not support frames...
</span>
</body></noframes>
</html>';
}
// CP Header
function print_cp_header($title) {
    $currentFile = $_SERVER["SCRIPT_NAME"];
    $parts = explode('/', $currentFile);
    $currentFile = $parts[count($parts) - 1]; 
	$admindir = str_replace($currentFile,'',$_SERVER['REQUEST_URI']);
	$admindir = str_replace('modules/','',$admindir);
	$admindir = str_replace("?".$_SERVER['QUERY_STRING'],'',$admindir);
	print "<html>\n";
	print "<head>\n";
	print "<title>".$title." - Exero CMS Admin Control Panel</title>\n";
	print "<script language=\"JavaScript\" src=\"".$admindir."script.js\" type=\"text/JavaScript\"></script>\n";
	print "<link rel=\"stylesheet\" href=\"".$admindir."admincp.css\" />";
	print "</head>\n";
	print "<body style=\"margin:0px\" onload=\"set_cp_title();\">\n";
	print "<div id=\"cp_header\">".$title."</div>\n";
	print "<div style=\"margin:10px\">\n";
}
// CP Footer
function print_cp_footer() {
global $ecms;
	print "</div>\n";
	print "<p align=\"center\">Powered by Exero CMS ".$ecms->settings['appver']."<br>Copyright ".date("Y")." Dreamlight Software</p>\n";
	print "</body>\n";
	print "</html>\n";
}
// Nav Head
function print_nav_head() {
	print '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Exero CMS AdminCP</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	background-color: #246aab;
	background-image: url(images/navbg.jpg);
	background-repeat: repeat-y;
	background-position: right;
	margin-left: 5px;
	margin-top: 5px;
	padding-left: 0px;
	padding-top: 0px;
	
}
.title {
	background-image: url(images/bg1.jpg);
	background-repeat: repeat-x;
	background-color: #0271CA;
	color: #FFFFFF;
	font-weight: bold;
}
body,td,th {
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	color: #000000;
}
.style1 {color: #FFFFFF}
a {
	color: #FFFFFF;
	text-decoration: none;
	font-weight: normal;
}
a:hover {
	text-decoration: none;
}
-->
</style></head>
<body>';
}
// Nav Foot
function print_nav_foot() {
	echo '</body>
</html>';
}
// Nav Header
function print_nav_header($title) {
	echo "<table width=\"100%\"  border=\"0\" cellpadding=\"3\" cellspacing=\"1\" bgcolor=\"#164571\">
  <tr>
    <td class=\"title\">".$title."</td>
  </tr>\n";
}
// Nav Row

function print_nav_row($link,$title,$target='mainFrame') {
	print "  <tr>
    <td bgcolor=\"#458fd4\"><a href=\"".$link."\" target=\"".$target."\">".$title."</a></td>
  </tr>\n";
}
// Nav Footer
function print_nav_footer() {
	print "</table><br>\n";
}
// Row BG Class
function fetch_row_bgclass()
{
	global $bgcounter;
	return ($bgcounter++ % 2) == 0 ? 'alt1' : 'alt2';
}
// Table Header
function print_table_header($title,$collspan='0',$cpad='0',$cspace='0',$width='100%',$border='ignore') {
	print "<table width=\"".$width."\" cellpadding=\"".$cpad."\" cellspacing=\"".$cspace."\" class=\"tborder\"";
	if($border == "noborder") {
		print " style=\"border: 0px;\"";
	} else if($border == "ignore") {
	}
	print ">\n";
	print "<tr>\n";
	print "<td id=\"table_header\" colspan=\"".$collspan."\">".$title."</td>\n";
	print "</tr>\n";
	$bgcounter = 0;
}
// Table Row
function print_table_row($text,$colspan='0') {
$id = fetch_row_bgclass();
	print "<tr>\n";
	print "<td id=\"".$id."\" colspan=\"".$colspan."\">".$text."</td>\n";
	print "</tr>\n";
}
// Table Row2
function print_table_row2($text,$text2,$width='100%') {	$id = fetch_row_bgclass();
	print "<tr>\n";
	print "<td id=\"".$id."\" width=\"".$width."\"><strong>".$text."</strong></td>\n";
	print "<td id=\"".$id."\">".$text2."</td>\n";
	print "</tr>\n";
}
// Option Row
function print_table_optiontitle($text,$title='',$colspan='0') {
	print "<tr>\n";
	print "<td colspan=\"$colspan\" title=\"$title\" id=\"optiontitle\">".$text."</td>\n";
	print "</tr>\n";
}
// Table Footer
function print_table_footer() {
	print "</table><br>\n";
}
// Form Header
function print_form_header($action,$name='form1',$mothod='POST') {
	print "<form name=\"".$name."\" action=\"".$action."\" method=\"".$mothod."\" enctype=\"multipart/form-data\">\n";
}
// Form Footer
function print_form_footer() {
	print "</form>\n";
}
// Form Textbox
function print_form_textbox($text,$name,$value='') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\" width=\"120\"><input type=\"text\" name=\"".$name."\" value=\"".$value."\" id=\"textbox\"></td>\n";
	print "</tr>\n";
}
// Form Passbox
function print_form_passbox($text,$name,$value='') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\"><input type=\"password\" name=\"".$name."\" value=\"".$value."\" id=\"textbox\"></td>\n";
	print "</tr>\n";
}
// Form Upload
function print_form_upload($text,$name) {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\" width=\"120\"><input type=\"file\" name=\"".$name."\" id=\"filebox\"></td>\n";
	print "</tr>\n";
}
// Form Textarea
function print_form_textarea($text,$name,$value='',$cols='',$rows='',$textareawidth='200px') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\" width=\"120\"><textarea name=\"".$name."\" cols=\"".$cols."\" rows=\"".$rows."\" style=\"width: $textareawidth;\">".$value."</textarea></td>\n";
	print "</tr>\n";
}
// Form Textarea Row
function print_form_textarearow($name,$value='',$colspan='0',$cols='',$rows='',$textareawidth='200px') {	
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\" colspan=\"".$colspan."\" align=\"center\"><textarea name=\"".$name."\" cols=\"".$cols."\" rows=\"".$rows."\" style=\"width: $textareawidth;\">".$value."</textarea></td>\n";
	print "</tr>\n";
}
// Form Submit
function print_form_submit($text,$colspan='0',$reset='1') {
	print "<tr valign=\"top\">\n";
	print "<td id=\"form_submit_td\" colspan=\"".$colspan."\"><div align=\"center\"><button type=\"submit\">".$text."</button>&nbsp;&nbsp;&nbsp;".iif($reset,"<button type=\"reset\">Reset</button>")."</div></td>\n";
	print "</tr>";
}
// Form Hiddenfield
function print_form_hiddenfield($name,$value) {
	print "<input type=\"hidden\" name=\"".$name."\" value=\"".$value."\">\n";
}
// Form Select
function print_form_select($text,$name,$size,$options,$selected='',$shownone='1') {
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\">\n<select name=\"$name\" size=\"$size\">\n";
	if($shownone) {
		print "<option>None</option>\n";
	}
	//print_r($options);
	$selected = explode(',',$selected);
	foreach($options as $value => $option) {
		if(in_array($value,$selected)) {
			print "<option value=\"$value\" selected>$option</option>\n";
		} else {
			print "<option value=\"$value\">$option</option>\n";
		}
	}
	print "</select>\n</td>\n";
	print "</tr>\n";
}
// Theme Select
function print_themeselect($text,$name,$size,$selected='') {
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\">\n<select name=\"$name\" size=\"$size\">\n";
	$handle = opendir("../themes");
	$themes = array();
	while(false !== ($folder = readdir($handle))) {
		if($folder != "." && $folder != "..") {
			if($folder == $selected) {
				print "<option value=\"$folder\" selected>$folder</option>\n";
			} else {
				print "<option value=\"$folder\">$folder</option>\n";
			}
		}
	}
	print "</select>\n</td>\n";
	print "</tr>\n";
}
// Default Module Select
function print_defaultmoduleselect($text,$name,$size,$selected='') {
global $ecms, $db;
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\">\n<select name=\"$name\" size=\"$size\">\n";
	$handle = opendir("../modules");
	while(false !== ($folder = readdir($handle))) {
		if($folder != "." && $folder != "..") {
			$moduleinfo = $db->query_first("SELECT * FROM modules WHERE directory='".$folder."' LIMIT 1");
			if(!$moduleinfo['indexcapable'] == "") {
				print "<optgroup label=\"$folder\">";
				$files = opendir("../modules/".$folder);
				
				$indexcapable = explode(',',$moduleinfo['indexcapable']);
				while(false !== ($file = readdir($files))) {
					if($file != "." && $file != "..") {
						$thisfile = $folder."/".$file;
						if(in_array($file,$indexcapable)) {
							if($ecms->settings['defaultmod'] == $thisfile) {
								print "<option value=\"$folder/$file\" selected>-- $file</option>\n";
							} else {
								print "<option value=\"$folder/$file\">-- $file</option>\n";
							}
						}
					}
				}
				print "</optgroup>";
			}
		}
	}
	print "</select>\n</td>\n";
	print "</tr>\n";
}
// Form Multiselect
function print_form_multiselect($text,$name,$size,$options,$selected) {
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\">\n<select name=\"$name\" size=\"$size\" multiple=\"multiple\">\n";
	print "<option>None</option>\n";
	//print_r($options);
	$selected = explode(',',$selected);
	foreach($options as $value => $option) {
		if(in_array($value,$selected)) {
			print "<option value=\"$value\" selected>$option</option>\n";
		} else {
			print "<option value=\"$value\">$option</option>\n";
		}
	}
	print "</select>\n</td>\n";
	print "</tr>\n";
}
function print_block_multiselect($text,$name,$size,$selected) {
	global $db;
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	print "<td id=\"".$id."\"width=\"120\">\n<select name=\"$name\" size=\"$size\" multiple=\"multiple\">\n";
	print "<option value=\"\">None</option>\n";
	//print_r($options);
	$selected = explode(',',$selected);
	$blocks = $db->query("SELECT * FROM ".TABLE_PREFIX."blocks");
	while($blockinfo = $db->fetch_array($blocks)) {
		if(in_array($blockinfo['id'],$selected)) {
			print "<option value=\"".$blockinfo['id']."\" selected>".$blockinfo['title']."</option>\n";
		} else {
			print "<option value=\"".$blockinfo['id']."\">".$blockinfo['title']."</option>\n";
		}
	}
	print "</select>\n</td>\n";
	print "</tr>\n";
}
// Top Menu
function print_topmenu($items,$fontsize='12',$fontweight='normal',$fontalign='center') {
	$id = fetch_row_bgclass();
	print "<table class=\"tborder\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">\n";
	print "<tr>\n";
	foreach($items as $href => $text) {
		print "<td id=\"$id\" style=\"font-size: $fontsize; text-align: $fontalign; font-weight: $fontweight;\"><a href=\"$href\">$text</a></td>\n";
	}
	print "</tr>\n";
	print "</table>\n<br />\n";
}
function print_multicol_row($cols,$rowclass='default') {
	if($rowclass == "default") {
		$rowid = fetch_row_bgclass();
	} else {
		$rowid = $rowclass;
	}
	print "<tr>\n";
	foreach($cols as $title => $width) {
		$title = explode('[align:',$title);
		$title = str_replace(']','',$title);
		if($title['1'] == "") {
			$title['1'] = "center";
		}
		print "<td id=\"$rowid\" width=\"$width\"><div align=\"$title[1]\">$title[0]</div></td>\n";
	}
	print "</tr>\n";
}
// Redirect
function print_redirect($location,$message,$title='') {
	//print_cp_header($title);
	//print "<meta http-equiv=\"refresh\" content=\"2;URL=".$location."\">".$message."<br /><a href=\"$location\">>> Continue</a>";
	//print_cp_footer();
	print_cp_header($title);
	
	print "<center>";
	print "<meta http-equiv=\"refresh\" content=\"2;URL=".$location."\">";
	print_table_header($title,'2','2','0',"500");
	print_table_row($message);
	print_table_row("<center><a href=\"".$location."\">Continue</a></center>");
	print_table_footer();
	print "</center>";
	
	print_cp_footer();
}
// Version check
function doversioncheck() {
global $app;
	print "<!--<script type=\"text/javascript\" src=\"http://ecms.getox.net/script/script.js?site=".$_SERVER['HTTP_HOST']."\"></script>-->\n";
	print "	<script type=\"text/javascript\">\n";
	print "<!--\n";
	print "var current_ver = \"$app[version]\";\n";
	print "var current_build = \"$app[build]\";\n";
	print "if(latestbuild > current_build) {\n";
	print "document.write(\"<table width='100%' cellspacing='0' cellpadding='0' class='tborder'>\");\n";
	print "document.write(\"<tr>\");\n";
	print "document.write(\"<td id='table_header'>New Version Available!</td>\");\n";
	print "document.write(\"</tr>\");\n";
	print "document.write(\"<tr>\");\n";
	print "document.write(\"<td id='alt2'><center><b>Latest Version:</b> \"+latestver+\"<br>You are running version: \"+current_ver+\"</center></td>\");\n";
	print "document.write(\"</tr>\");\n";
	print "document.write(\"</table><br>\");\n";
	print "}";
	print "//-->";
	print "</script>";
}
// Login
function print_login($url='index.php') {
    $currentFile = $_SERVER["SCRIPT_NAME"];
    $parts = Explode('/', $currentFile);
    $currentFile = $parts[count($parts) - 1]; 
	$admindir = str_replace($currentFile,'',$_SERVER['REQUEST_URI']);
	$admindir = str_replace('modules/','',$admindir);
	$admindir = str_replace("?".$_SERVER['QUERY_STRING'],'',$admindir);
	print "<html>\n";
	print "<head>\n";
	print "<title>Administrator Login - Exero CMS Admin Control Panel</title>\n";
	print "<link rel=\"stylesheet\" href=\"".$admindir."admincp.css\" />\n";
	print "</head>\n";
	print "<body>\n";
	print "<div id=\"topheader\"><div class=\"head\"></div></div>\n";
	print "<div id=\"login\" align=\"center\">\n";
	
	print_form_header($admindir."login.php","login");
	print_table_header("Administrator Login",'2','2','0',"500");
	//print_table_optiontitle("Please enter your Username and Password to login.",'',2);
	print_form_hiddenfield("redir",$_SERVER["SCRIPT_NAME"]."?".$_SERVER['QUERY_STRING']);
	print_form_textbox("Username","username");
	print_form_passbox("Password","password");
	print_form_submit("Login",2);
	print_table_footer();
	print_form_footer();
	
	print "</div>\n";
	print "</body>\n";
	print "</html>";
}
//	No Permissions
function print_no_permission() {
	print_cp_header("No Permission");
	
	print "<center>";
	print_table_header("No Permission",'2','2','0',"500");
	print_table_row("You do not have permission to access this page.");
	print_table_footer();
	print "</center>";
	
	print_cp_footer();
}
// Yes No Options
function print_form_yesno($text,$name,$value='') {
	$id = fetch_row_bgclass();
	print "<tr valign=\"top\">\n";
	print "<td id=\"".$id."\">".$text."</td>";
	if($value == "1") {
		print "<td id=\"".$id."\" width=\"120\"><label><input name=\"".$name."\" type=\"radio\" value=\"1\" checked>Yes</label> <label><input name=\"".$name."\" type=\"radio\" value=\"0\">No</label></td>\n";
	} else {
		print "<td id=\"".$id."\" width=\"120\"><label><input name=\"".$name."\" type=\"radio\" value=\"1\">Yes</label> <label><input name=\"".$name."\" type=\"radio\" value=\"0\" checked>No</label></td>\n";
	}
	print "</tr>\n";
}
// Module Manager Inferface
function print_modulemanager_head() {
	print "<tr>\n";
	print "<td id=\"optiontitle\">Module</td>\n";
	print "<td id=\"optiontitle\" width=\"100\">Options</td>\n";
	print "</tr>\n";
}
function print_modulemanager_row($module,$ident,$status,$settings=0) {
	$id = fetch_row_bgclass();
	print "<tr>\n";
	print "<td id=\"$id\">$module</td>\n";
	print "<td id=\"$id\" width=\"100\">";
	if($settings == 1) {
		print "<a href=\"modules.php?do=settings&ident=$ident\">Settings</a><br />";
	}
	print "<a href=\"modules.php?do=blocksettings&ident=$ident\">Block Settings</a><br />";
	if($status == 1) {
		print "<a href=\"modules.php?do=deactivate&ident=$ident\">Deactivate</a>";
	} else {
		print "<a href=\"modules.php?do=activate&ident=$ident\">Activate</a>";
	}
	print "</td>\n";
	print "</tr>\n";
}
// Block Manager Inferface
function print_blockmanager_head() {
	print "<tr>\n";
	print "<td id=\"optiontitle\">Block</td>\n";
	print "<td id=\"optiontitle\" width=\"100\">Options</td>\n";
	print "</tr>\n";
}
function print_blockmanager_row($block,$bid,$status,$settings=0) {
	$id = fetch_row_bgclass();
	print "<tr>\n";
	print "<td id=\"$id\">$block</td>\n";
	print "<td id=\"$id\" width=\"100\">";
	print "<a href=\"items.php?do=listitems&block=$bid\">Items</a><br />";
	if($settings == 1) {
		print "<a href=\"blocks.php?do=settings&id=$bid\">Settings</a><br />";
	}
	if($status == 1) {
		print "<a href=\"blocks.php?do=deactivate&id=$bid\">Deactivate</a>";
	} else {
		print "<a href=\"blocks.php?do=activate&id=$bid\">Activate</a>";
	}
	print "<br /><a href=\"blocks.php?do=edit&block=$bid\">Edit</a>, ";
	print "<a href=\"blocks.php?do=delete&id=$bid\">Delete</a>";
	print "</td>\n";
	print "</tr>\n";
}
function print_error($error) {
	$error = implode("<br>",$error);
	print "<div id=\"error\">".$error."</div><br />";
}
// Admin Functions
// Check Admin Session
function checkadminsession() {
global $ecms, $db, $user;
	$sessioninfo = $db->query_first("SELECT userid,sessionid,lastactive FROM admin_sessions WHERE userid='".$user->userinfo['uid']."' LIMIT 1");
	if($_SERVER['REMOTE_ADDR'] == "127.0.0.1") {
		$timelimit = (60 * 60 + $sessioninfo['lastactive']);
	} else {
		$timelimit = (15 * 60 + $sessioninfo['lastactive']);
	}
	if(time() < $timelimit) {
		return 1;
	} else {
		return 0;
	}
}
// Make usergroup array
function grouparray($area='all',$value='1') {
global $db;
	$grouparray = array();
	if($area == "all") {
		$getgroups = $db->query("SELECT * FROM groups ORDER BY title ASC");
	} else {
		$getgroups = $db->query("SELECT * FROM groups WHERE $area='$value' ORDER BY title ASC");
	}
	while($groupinfo = $db->fetch_array($getgroups)) {
		//array_push($grouparray,$groupinfo['gid']);
		$grouparray[$groupinfo['gid']] = $groupinfo['title'];
	}
	return $grouparray;
}
// Make module array
function modulearray() {
global $db;
	$modulearray = array();
	$getmodules = $db->query("SELECT * FROM modules WHERE active='1' ORDER BY title ASC");
	while($moduleinfo = $db->fetch_array($getmodules)) {
		$modulearray[$moduleinfo['ident']] = $moduleinfo['title'];
	}
	return $modulearray;
}
// Change Array Order
function changeorder($array,$move,$where) {
/* Believe it or not, but this one actually took a while to get it right */
	$array = explode(',',$array);
	$arraycount = count($array);
	$arraycount = ($arraycount - 1);
	for($i = 0; $i<=$arraycount; $i++) {
		if($array[$i] == $move) {
			if($where == "up") {
				$arraybefore = ($i - 1);
				if(!$array[$arraybefore] == "") {
					$array[$i] = $array[$arraybefore];
					$array[$arraybefore] = $move;
					return implode(',',$array);
				} else {
					return implode(',',$array);
				}
			} else if($where == "down") {
				$arrayafter = ($i + 1);
				if(!$array[$arrayafter] == "") {
					$array[$i] = $array[$arrayafter];
					$array[$arrayafter] = $move;
					return implode(',',$array);
				} else {
					return implode(',',$array);
				}
			}
		}
	}
}
// Remove Array Key
function array_pull($array,$remove) {
	$array = explode(',',$array);
	$arraycount = (count($array) - 1);
	for($i = 0; $i<=$arraycount; $i++) {
		if($array[$i] == $remove) {
			unset($array[$i]);
			return implode(',',$array);
		}
	}
}
// Check Permission
function adminpermissions($action) {
global $db, $user;
	$permissioninfo = $db->query_first("SELECT * FROM admin_permissions WHERE groupid='".$user->groupid."'");
	if($permissioninfo[$action]) {
		return 1;
	} else {
		return 0;
	}
}
?>
Return current item: Exero CMS