Ejemplo n.º 1
0
 /**
  * add an entry to the menu nav
  *
  * @static
  * @param int $priority a numberic priority to allow for ordering
  * @param string $link_txt text of the link that's going to be added
  * @param string $module name of the module we are going to add to the left nav
  * @param string $action (opitonal) the name of the action within the module to link to.
  * @access	public
  */
 public static function addMenuItem($priority, $link_txt, $module, $action = NULL)
 {
     $linkClass = self::$module == $module && $module != strtolower(self::$config->auth_class) ? "leftNavLinkActive" : "leftNavLink";
     self::$activeSection = (self::$module == $module || self::$activeSection) && $module != strtolower(self::$config->auth_class) ? TRUE : FALSE;
     // if the auth class exists, instantiate it.
     if (class_exists(self::$CertisInst->config->auth_class)) {
         if (!in_array($module, self::$CertisInst->authless)) {
             $classname = self::$CertisInst->config->auth_class;
             $auth_mod = new $classname();
             if (isset(self::$CertisInst->authed_user)) {
                 if ($auth_mod->validateUID(self::$CertisInst->authed_user)) {
                     $GLOBALS['leftNav'][$priority] = '<a class="' . $linkClass . '" href="' . API::printUrl($module, $action) . '">' . $link_txt . '</a>';
                 } else {
                     API::DEBUG("[API::addMenuItem()] Unable to validate uid '" . self::$CertisInst->authed_user . "'");
                 }
             } else {
                 API::DEBUG("[API::addMenuItem()] Non-Authless module {$module} and no authed_user set.");
             }
             //API::DEBUG("[API::addMenuItem()] leftNav now equals: " . print_r($GLOBALS['leftNav'][$priority] , true));
             unset($auth_mod);
             return;
         }
     }
     $GLOBALS['leftNav'][$priority] = '<a class="' . $linkClass . '" href="' . API::printUrl($module, $action) . '">' . $link_txt . '</a>';
     API::DEBUG("[API::addMenuItem()] leftNav now equals: " . print_r($GLOBALS['leftNav'][$priority], true));
 }
Ejemplo n.º 2
0
 public function authCheckAction()
 {
     API::DEBUG("[Auth_LDAPController::authCheckAction] In Function", 8);
     if (!isset($this->authed_user) || $this->authed_user == 0) {
         API::DEBUG("[Auth_LDAPController::authCheckAction] authed_user is not " . $this->authed_user, 8);
         API::Redirect(API::printUrl(strtolower(self::$config->auth_class), 'login'));
     } else {
         API::DEBUG("[Auth_LDAPController::authCheckAction] validating authed_user as " . $this->authed_user, 8);
         if (!$this->_model->validateUID($this->authed_user)) {
             API::Redirect(API::printUrl(strtolower(self::$config->auth_class), 'login'));
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * default delete action pretty straight forward
  *
  * @return none
  */
 public function deleteAction()
 {
     if (!isset($this->params['cancel'])) {
         if ($this->_model->name == "admin") {
             API::Message("You cannot delete 'admin'");
         } else {
             // XXX: Maybe do some hook call validation here?
             // auto call the hooks for this module/action
             API::callHooks(self::$module, $this->action, 'controller', $this->req_id);
             // delete an entry
             $host = $this->_model->delete();
         }
     }
     API::redirect(API::printUrl($this->_redirect));
 }
Ejemplo n.º 4
0
 /**
  * sets the proper elements from $data into the fields on this instance of the model
  *
  *@access    public
  *@param     array   $data   the array of data to set
  *@param     bool    $insert Is this an insert or an update?
  *@param		string	$auth_mod	The authmod this person should be updated for.
  */
 public function set_data($data, $insert = 0, $auth_mod = NULL)
 {
     if ($auth_mod == NULL) {
         $auth_mod = self::$config->auth_class;
     }
     if (isset($data['set_perms'])) {
         if (!self::$CertisInst->Perms->checkPerm($this->authed_user, 'perms_admin')) {
             error_log("[Prefs::check_input()] Security Violation (perms_admin) ERR_SEC.  ");
             // effectively log off the user
             $_SESSION['authed_user'] = NULL;
             $this->authed_user = NULL;
             // set display messages to the user.
             $_SESSION['errors'] = $errors;
             // redirect them to the home page.
             API::Redirect("/");
         }
         $perms = 0;
         if (isset($data['perms'])) {
             foreach ($data['perms'] as $perm) {
                 if ($perm == -1) {
                     $perms = -1;
                     continue;
                 }
                 $perms = $perms | 1 << $perm;
             }
         }
         $data['perms'] = $perms;
         unset($data['set_perms']);
         $do_redirect = API::printUrl("perms", "display", NULL, "uid=" . $data['uid']);
     }
     if ($insert === TRUE) {
         return $this->insert($data);
     } else {
         $where_tmp = new WhereClause('uid', $data['uid']);
         $where_tmp->w_and('auth_mod', $auth_mod);
         $this->where_clause($where_tmp);
         API::DEBUG("[Prefs::set_data()] data is " . print_r($data, true), 8);
         $this->update($data);
         API::Message("User Information Saved!");
         if (isset($do_redirect)) {
             API::Redirect($do_redirect);
         }
         return NULL;
     }
 }
Ejemplo n.º 5
0
<a class="lt_box" href="<?php 
echo API::printUrl($view->module, "display");
?>
">Add New Host</a><br /><br />
<?php 
$view->printPages();
foreach ($data['info'] as $host) {
    ?>
<a class="lt_box" href="<?php 
    echo API::printUrl($view->module, 'display', $host->id);
    ?>
"><?php 
    echo $host->name;
    ?>
</a> &nbsp;
<a class="lt_box" href="<?php 
    echo API::printUrl($view->module, 'delete_confirm', $host->id);
    ?>
">X</a><br />

<?php 
}
?>
<br /><br /><?php 
$view->printPages();
Ejemplo n.º 6
0

  <form action="<?php 
echo API::printUrl($view->module, $data['action']);
?>
" method="post">
	<div class="hostPrimaryInfo">
  		<input type="hidden" name="id" value="<?php 
echo $view->getInfoValue('id');
?>
" />

	  	<div><label>Host: </label><input type="text" name="name" value="<?php 
echo $view->getInfoValue("name");
?>
" /><br /></div>
  		<div><label>Alias: </label><input type="text" name="alias" value="<?php 
echo $view->getInfoValue("alias");
?>
" /><br /></div>
  		<div><label>Primary<br />MAC Address: </label><input style="margin-top: 12px;" type="text" name="primary_mac" value="<?php 
echo $view->getInfoValue("primary_mac");
?>
" /><br /></div>
  	</div>
  	<br />
  	
  	<!--  BEGIN HOSTS HOOKS -->
  	<div class="hostHookInfo">
  		<?php 
API::callHooks($view->module, $view->action, 'display', $view->getInfoValue('id'));
Ejemplo n.º 7
0
        ?>
<br />

	<?php 
    }
} elseif (is_object($data['info'])) {
    ?>
	<a class="lt_box" href="<?php 
    echo API::printUrl($view->module, 'display', $data['info']->uid);
    ?>
"><?php 
    echo $data['info']->name;
    ?>
</a> &nbsp;
	<?php 
    if ($user->name != "admin") {
        ?>
	<a class="lt_box" href="<?php 
        echo API::printUrl($view->module, 'delete_confirm', $user->uid);
        ?>
">X</a>
	<?php 
    }
    ?>
<br />
<?php 
}
?>

<br /><br /><?php 
$view->printPages();
 /**
  * default action processing new requests passed in from the display action.  Does
  * not use a template. Uses the 'set_data' function on the model object of the implementing
  * class to do data verification.
  *
  * @return none
  */
 public function newAction()
 {
     # process the new entry form.
     # check the post data and filter it.
     if (isset($_POST['cancel'])) {
         API::Redirect(API::printUrl($this->_redirect));
     }
     $input_check = $this->_model->check_input($_POST);
     if (is_array($input_check)) {
         API::Error($input_check);
         // redirect to index and displayed an error there.
         API::redirect(API::printUrl($this->_redirect));
     }
     // all hooks will stack their errors onto the API::Error stack
     // but WILL NOT redirect.
     API::callHooks(self::$module, 'validate', 'controller', $_POST);
     if (API::hasErrors()) {
         API::redirect(API::printUrl($this->_redirect));
     }
     // set the id into the post var for any hooks.
     $_POST['id'] = $this->_model->set_data($_POST, TRUE);
     // auto call the hooks for this module/action
     API::callHooks(self::$module, 'save', 'controller', $_POST);
     if (isset($this->params['redir'])) {
         API::Redirect($this->params['redir']);
     }
     API::redirect(API::printUrl($this->_redirect));
 }
Ejemplo n.º 9
0
	<h2>Login</h2>
	<div class="errors">

	</div>
  	<form action="<?php 
echo API::printUrl($view->module, $view->action);
?>
" method="post">
  	<div class="loginFrm">
  		<label for="uname">Username: </label> <input type="text" name="uname" value="" size="30" maxlength="40"/><br />
  		<label for="password">Password: </label><input type="password" name="password" size="30" maxlength="40"/><br />
  		<input class="formButton" type="submit" name="login" value="Login" />
  	</div>
  	</form>



Ejemplo n.º 10
0
<h2>Editing Preferences for <?php 
echo $view->getInfoValue('fname');
?>
 <?php 
echo $view->getInfoValue('lname');
?>
</h2>
<br /><br />
<div id="prefsForm" style="width:300px">
<strong>General:</strong>
<hr />
<form action="<?php 
echo API::printUrl($view->module, 'edit');
?>
" method="post">
<input type="hidden" name="uid" value="<?php 
echo $view->getInfoValue('uid');
?>
" />
<div><label>First Name</label><span class="frmTxtInput"><input type="text" name="fname" value="<?php 
echo $view->getInfoValue('fname');
?>
" /></span></div>
<div><label>Last Name</label><span class="frmTxtInput"><input type="text" name="lname" value="<?php 
echo $view->getInfoValue('lname');
?>
" /></span></div>
<?php 
echo API::callHooks("prefs", "index", "view", $data);
?>
<div><span class="frmButtons"><input class="formButton" type="submit" name="save" value="Save" /><input class="formButton" type="submit" name="cancel" id="btn_Cancel" value="Cancel" /></span></div>