| @@ -0,0 +1,48 @@ | ||
| <?php | ||
|
|
||
| if (isset($_POST['adduser'])) { | ||
|
|
||
| $usrs = $sbnc->Call('tcl', array('bncuserlist')); | ||
| $users = explode(" ", $usrs); | ||
|
|
||
| if (in_array($_POST['ident'], $users)) { | ||
| $isset = '1'; | ||
| $type = 'error'; | ||
| $message = $lang['ident_taken']; | ||
| } else { | ||
| if (empty($_POST['password'])) { | ||
| $password = generatePassword('8'); | ||
| } else { | ||
| $password = $_POST['password']; | ||
| } | ||
|
|
||
| $sbnc->Call('adduser', array($_POST['ident'], $password)); | ||
|
|
||
| $isset = '1'; | ||
| $type = 'success'; | ||
| $message = sprintf($lang['bnc_added'], $_POST['ident'], $password); | ||
| } | ||
| } | ||
|
|
||
| //Select template | ||
| $tpl = new Dwoo_Template_File('template/'.$templateDir.'/add.tpl'); | ||
| $data = new Dwoo_Data(); | ||
|
|
||
| $data->assign('errorSet', $isset); | ||
| $data->assign('errorType', $type); | ||
| $data->assign('errorMessage', $message); | ||
|
|
||
| $data->assign('passwordEmptyText', $lang['if_password_empty']); | ||
|
|
||
| $data->assign('identLangText', $lang['ident']); | ||
| $data->assign('passwordLangText', $lang['password']); | ||
| $data->assign('identName', 'ident'); | ||
| $data->assign('passwordName', 'password'); | ||
| $data->assign('adduserLangText', $lang['add_user']); | ||
| $data->assign('adduserName', 'adduser'); | ||
|
|
||
|
|
||
| //Get the page | ||
| $content .= $dwoo->get($tpl, $data); | ||
|
|
||
| ?> |
| @@ -19,7 +19,7 @@ | ||
|
|
||
| $isset = '1'; | ||
| $type = 'success'; | ||
| $message = $lang['settings_saved']; | ||
| } | ||
|
|
||
| //Select template | ||
| @@ -0,0 +1,68 @@ | ||
| <?php | ||
|
|
||
| if (isset($_POST['delident'])) { | ||
|
|
||
| $sbnc->Call('deluser', array($_POST['delident'])); | ||
|
|
||
| $isset = '1'; | ||
| $type = 'success'; | ||
| $message = sprintf($lang['user_deleted'], $_POST['delident']); | ||
|
|
||
| } | ||
|
|
||
| //Select template | ||
| $tpl = new Dwoo_Template_File('template/' . $templateDir . '/users.tpl'); | ||
| $data = new Dwoo_Data(); | ||
|
|
||
| //Get userlist and push into array | ||
| $users = explode(" ", $sbnc->Call('tcl', array('bncuserlist'))); | ||
|
|
||
| $i = '0'; | ||
| $numAdmins = '0'; | ||
| $numUsers = '0'; | ||
|
|
||
| while ($i < count($users)) { | ||
|
|
||
| $isAdmin = $sbnc->CallAs($users[$i], 'getvalue', array('admin')); | ||
|
|
||
| if ($isAdmin == '1') { | ||
|
|
||
| $numAdmins++; | ||
| $adminArray[$numAdmins]['ident'] = $users[$i]; | ||
| $adminArray[$numAdmins]['nick'] = $sbnc->CallAs($users[$i], 'getnick'); | ||
| $adminArray[$numAdmins]['lastseen'] = date("d.m.Y H:i:s", $sbnc->Call('tcl', array("getbncuser $users[$i] seen"))); | ||
|
|
||
| } else { | ||
|
|
||
| $numUsers++; | ||
| $userArray[$numUsers]['ident'] = $users[$i]; | ||
| $userArray[$numUsers]['nick'] = $sbnc->CallAs($users[$i], 'getnick'); | ||
| $userArray[$numUsers]['lastseen'] = date("d.m.Y H:i:s", $sbnc->Call('tcl', array("getbncuser $users[$i] seen"))); | ||
| } | ||
| $i++; | ||
| } | ||
|
|
||
| $data->assign('errorSet', $isset); | ||
| $data->assign('errorType', $type); | ||
| $data->assign('errorMessage', $message); | ||
|
|
||
| $data->assign('identText', $lang['ident']); | ||
| $data->assign('nickText', $lang['nickname']); | ||
| $data->assign('lastseenText', $lang['last_seen']); | ||
| $data->assign('actionText', $lang['action']); | ||
|
|
||
| $data->assign('userText', $lang['users']); | ||
| $data->assign('adminText', $lang['administrators']); | ||
|
|
||
| $data->assign('adminArray', $adminArray); | ||
| $data->assign('userArray', $userArray); | ||
|
|
||
| $data->assign('numAdmins', $numAdmins); | ||
| $data->assign('numUsers', $numUsers); | ||
|
|
||
| //Get the page | ||
| $content .= $dwoo->get($tpl, $data); | ||
|
|
||
| //var_dump($_POST); | ||
|
|
||
| ?> |
| @@ -0,0 +1,20 @@ | ||
| {if $errorSet == 1} | ||
| <div class="{$errorType}"> | ||
| {$errorMessage} | ||
| </div> | ||
| {/if} | ||
| <div class="info">{$passwordEmptyText}</div> | ||
| <form action="" method="POST"> | ||
| <table id="tbl" align="center" width="400"> | ||
| <tr> | ||
| <td width="40%">{$identLangText}:</td><td width="60%"><input type="text" name="{$identName}" size="33" /></td> | ||
| </tr> | ||
| <tr> | ||
| <td width="40%">{$passwordLangText}:</td><td width="60%"><input type="text" name="{$passwordName}" size="33" /></td> | ||
| </tr> | ||
| <tr> | ||
| <td colspan="2" align="center"><input type="submit" value="{$adduserLangText}" name="{$adduserName}" /></td> | ||
| </tr> | ||
| </table> | ||
| </form> | ||
|
|
| @@ -0,0 +1,38 @@ | ||
| {if $errorSet == 1} | ||
| <div class="{$errorType}"> | ||
| {$errorMessage} | ||
| </div> | ||
| {/if} | ||
| <table id="tbl" align="center" width="400"> | ||
| <tr> | ||
| <td colspan="4" align="center"><b>{$adminText}</b></td> | ||
| </tr> | ||
| <tr> | ||
| <td width="20%"><b>{$identText}</b></td><td width="20%"><b>{$nickText}</b></td><td width="35%"><b>{$lastseenText}</b></td><td width="13%"><b>{$actionText}</b></td> | ||
| </tr> | ||
| {foreach $adminArray admin} | ||
| <tr> | ||
| <td>{$admin.ident}</td><td class="bold">{$admin.nick}</td><td>{$admin.lastseen}</td><td style="text-align:center;"><form action="" method="post"><input type="hidden" value="{$admin.ident}" name="delident" /><input class="input-image" type="image" src="template/sbnciface/img/icons/delete.png" value="{$deleteText}" name="deluser" /><a href="?p=edit&u={$admin.ident}"> <img src="template/sbnciface/img/icons/pencil.png"></a></form></td> | ||
| </tr> | ||
| {/foreach} | ||
| <tr> | ||
| <td colspan="4" align="center"><b>{$numAdmins} Admins</b></td> | ||
| </tr> | ||
| </table> | ||
| <br /> | ||
| <table id="tbl" align="center" width="400"> | ||
| <tr> | ||
| <td colspan="4" align="center"><b>{$userText}</b></td> | ||
| </tr> | ||
| <tr> | ||
| <td width="20%"><b>{$identText}</b></td><td width="20%"><b>{$nickText}</b></td><td width="35%"><b>{$lastseenText}</b></td><td width="13%"><b>{$actionText}</b></td> | ||
| </tr> | ||
| {foreach $userArray user} | ||
| <tr> | ||
| <td>{$user.ident}</td><td class="bold">{$user.nick}</td><td>{$user.lastseen}</td><td style="text-align:center;"><form action="" method="post"><input type="hidden" value="{$user.ident}" name="delident" /><input class="input-image" type="image" src="template/sbnciface/img/icons/delete.png" value="{$deleteText}" name="deluser" /><a href="?p=edit&u={$admin.ident}"> <img src="template/sbnciface/img/icons/pencil.png"></a></form></td> | ||
| </tr> | ||
| {/foreach} | ||
| <tr> | ||
| <td colspan="4" align="center"><b>{$numUsers} Users</b></td> | ||
| </tr> | ||
| </table> |