$aVals[] = array('password', cAuthentication::cyphrePassword($_POST['passw'])); $aVals[] = array('role', $_POST['role'], false); /// insert values /// if (!$DB->insert('core_users', $aVals)) { throw new cException("Some error during insert operation!"); } $aAlerts[] = "New user was added."; } catch (cException $e) { $msg = $e->getDbMessageError(__METHOD__ . '(line:' . __LINE__ . ')', $query); $aErrors[] = $msg; cLogsDb::addFileLog($msg); } } } /// end of POST data sent /// $roles = admin_getAllRoles(); $Logs->addLog($roles, "admin_getAllRoles"); ########################################################################################### ##################################### code to print ####################################### foreach ($aErrors as $error) { print "<div class='error'>{$error}</div>"; } foreach ($aAlerts as $alert) { print "<div class='alert'>{$alert}</div>"; } $name = ""; $surname = ""; $roleid = ""; $login = ""; if (isset($_POST['add_user'])) { $name = $_POST['name'];
function _showCapabilities() { global $Logs; $data = admin_getAllCapabWithRights(); $roles = admin_getAllRoles(); ?> <h3>Edit capabilities</h3> <form action="?show=capa" name="fc_capabilities" method="post"> <table border="1"> <thead> <tr> <td>Capability</td> <td>Description</td> <?php foreach ($roles as $role) { ?> <td> <strong><?php print $role['name']; ?> </strong><br /> <?php $parent = arraySearch($role['parentid'], $roles, 'id'); ?> <?php if ($parent !== false) { print "(" . $roles[$parent]['name'] . ")"; } ?> </td> <?php } ?> <!-- td>Odstranit</td--> </tr> </thead> <?php foreach ($data as $cap) { ?> <tr> <th><?php print $cap['name']; ?> </th> <td><?php print $cap['description']; ?> </td> <?php foreach ($roles as $role) { $checkName = "caprole_" . $cap['id'] . "_" . $role['id']; $checked = in_array($role['id'], $cap['aRoles']) ? 'checked="checked"' : ""; ?> <td> <input <?php print $checked; ?> type="checkbox" name="<?php print $checkName; ?> " /> </td> <?php } ?> <!-- td> <a href="<?php getUrl('admin'); ?> ?action=deleteCap&id=<?php print $cap['id']; ?> ">odstranit</a> </td--> </tr> <?php } ?> </table> <input type="submit" value="Save" name="update_capab" /> </form> <?php }