usercenter.php (3185B)
1 <h2>User-Center</h2> 2 <?php 3 /* 4 UserCake Version: 2.0.2 5 http://usercake.com 6 */ 7 8 require_once($root."/core/backend/admin/modules/modul_normal-login/models/config.php"); 9 if (!securePage($_SERVER['PHP_SELF'])){die();} 10 $pageId = $_GET['page_id']; 11 12 //Check if selected pages exist 13 if(!pageIdExists($pageId)){ 14 header("Location: admin.php#user_pages"); die(); 15 } 16 17 $pageDetails = fetchPageDetails($pageId); //Fetch information specific to page 18 19 //Forms posted 20 if(!empty($_POST)){ 21 $update = 0; 22 23 if(!empty($_POST['private'])){ $private = $_POST['private']; } 24 25 //Toggle private page setting 26 if (isset($private) AND $private == 'Yes'){ 27 if ($pageDetails['private'] == 0){ 28 if (updatePrivate($pageId, 1)){ 29 $successes[] = lang("PAGE_PRIVATE_TOGGLED", array("private")); 30 } 31 else { 32 $errors[] = lang("SQL_ERROR"); 33 } 34 } 35 } 36 elseif ($pageDetails['private'] == 1){ 37 if (updatePrivate($pageId, 0)){ 38 $successes[] = lang("PAGE_PRIVATE_TOGGLED", array("public")); 39 } 40 else { 41 $errors[] = lang("SQL_ERROR"); 42 } 43 } 44 45 //Remove permission level(s) access to page 46 if(!empty($_POST['removePermission'])){ 47 $remove = $_POST['removePermission']; 48 if ($deletion_count = removePage($pageId, $remove)){ 49 $successes[] = lang("PAGE_ACCESS_REMOVED", array($deletion_count)); 50 } 51 else { 52 $errors[] = lang("SQL_ERROR"); 53 } 54 55 } 56 57 //Add permission level(s) access to page 58 if(!empty($_POST['addPermission'])){ 59 $add = $_POST['addPermission']; 60 if ($addition_count = addPage($pageId, $add)){ 61 $successes[] = lang("PAGE_ACCESS_ADDED", array($addition_count)); 62 } 63 else { 64 $errors[] = lang("SQL_ERROR"); 65 } 66 } 67 68 $pageDetails = fetchPageDetails($pageId); 69 } 70 71 $pagePermissions = fetchPagePermissions($pageId); 72 $permissionData = fetchAllPermissions(); 73 74 echo resultBlock($errors,$successes); 75 76 echo " 77 <form name='adminPage' action='".$_SERVER['PHP_SELF']."?id=".$pageId."' method='post'> 78 <input type='hidden' name='process' value='1'> 79 <table class='admin'> 80 <tr><td> 81 <h3>Page Information</h3> 82 <div id='regbox'> 83 <p> 84 <label>ID:</label> 85 ".$pageDetails['id']." 86 </p> 87 <p> 88 <label>Name:</label> 89 ".$pageDetails['page']." 90 </p> 91 <p> 92 <label>Private:</label>"; 93 94 //Display private checkbox 95 if ($pageDetails['private'] == 1){ 96 echo "<input type='checkbox' name='private' id='private' value='Yes' checked>"; 97 } 98 else { 99 echo "<input type='checkbox' name='private' id='private' value='Yes'>"; 100 } 101 102 echo " 103 </p> 104 </div></td><td> 105 <h3>Page Access</h3> 106 <div id='regbox'> 107 <p> 108 Remove Access:"; 109 110 //Display list of permission levels with access 111 foreach ($permissionData as $v1) { 112 if(isset($pagePermissions[$v1['id']])){ 113 echo "<br><input type='checkbox' name='removePermission[".$v1['id']."]' id='removePermission[".$v1['id']."]' value='".$v1['id']."'> ".$v1['name']; 114 } 115 } 116 117 echo" 118 </p><p>Add Access:"; 119 120 //Display list of permission levels without access 121 foreach ($permissionData as $v1) { 122 if(!isset($pagePermissions[$v1['id']])){ 123 echo "<br><input type='checkbox' name='addPermission[".$v1['id']."]' id='addPermission[".$v1['id']."]' value='".$v1['id']."'> ".$v1['name']; 124 } 125 } 126 127 echo" 128 </p> 129 </div> 130 </td> 131 </tr> 132 </table> 133 <p> 134 <label> </label> 135 <input type='submit' value='Update' class='submit' /> 136 </p> 137 </form>"; 138 139 ?>