Added Add Admin

This commit is contained in:
Deon George
2014-10-28 16:56:56 +11:00
parent 80c8971a46
commit 43bd45d43e
7 changed files with 108 additions and 12 deletions

View File

@@ -20,19 +20,19 @@ class Controller_User_Node extends Controller_Node {
}
public function action_add() {
$n = ORM::factory('NODE')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
if ($n->count() >= $this->ao->max_nodes) {
SystemMessage::add(array(
'title'=>_('Maximum nodes created'),
'type'=>'info',
'body'=>_('Additional nodes cannot be created for your account, you have already reached your maximum. If you really need more, please contact us.'),
));
HTTP::redirect(URL::link('user','welcome'));
}
if ($this->request->post()) {
$n = ORM::factory('NODE')->where('EMAIL_ADDRESS','=',$this->ao->email)->find_all();
if (FALSE AND $n->count() > $this->ao->max_nodes) {
SystemMessage::add(array(
'title'=>_('Maximum nodes created'),
'type'=>'info',
'body'=>_('Additional nodes cannot be created for your account, you have already reached your maximum. If you really need more, please contact us.'),
));
HTTP::redirect(URL::link('user','welcome'));
}
// Find a free name.
for ($i=1;$i<$n->count();$i++)
if (! Object::in_array('NODE_NAME',$this->node_name($i),$n->as_array()))