public function createChecklist($newClArr)
 {
     $sqlInsert = "";
     $sqlValues = "";
     foreach ($newClArr as $k => $v) {
         $sqlInsert .= ',' . $k;
         if ($v) {
             $sqlValues .= ',"' . $this->cleanInStr($v) . '"';
         } else {
             $sqlValues .= ',NULL';
         }
     }
     $sql = "INSERT INTO fmchecklists (" . substr($sqlInsert, 1) . ") VALUES (" . substr($sqlValues, 1) . ")";
     //echo $sql; exit;
     $newClId = 0;
     if ($this->conn->query($sql)) {
         $newClId = $this->conn->insert_id;
         //Set permissions to allow creater to be an editor
         $this->conn->query('INSERT INTO userroles (uid, role, tablename, tablepk) VALUES(' . $GLOBALS["SYMB_UID"] . ',"ClAdmin","fmchecklists",' . $newClId . ') ');
         //$this->conn->query("INSERT INTO userpermissions (uid, pname) VALUES(".$GLOBALS["symbUid"].",'ClAdmin-".$newClId."') ");
         $newPManager = new ProfileManager();
         $newPManager->setUserName($GLOBALS['USERNAME']);
         $newPManager->authenticate();
     }
     return $newClId;
 }
Esempio n. 2
0
include_once '../config/symbini.php';
include_once $serverRoot . '/classes/PermissionsManager.php';
include_once $serverRoot . '/classes/ProfileManager.php';
header("Content-Type: text/html; charset=" . $charset);
$loginAs = array_key_exists("loginas", $_REQUEST) ? trim($_REQUEST["loginas"]) : "";
$searchTerm = array_key_exists("searchterm", $_REQUEST) ? trim($_REQUEST["searchterm"]) : "";
$userId = array_key_exists("userid", $_REQUEST) ? $_REQUEST["userid"] : "";
$delRole = array_key_exists("delrole", $_REQUEST) ? $_REQUEST["delrole"] : "";
$tablePk = array_key_exists("tablepk", $_REQUEST) ? $_REQUEST["tablepk"] : "";
$userManager = new PermissionsManager();
if ($isAdmin) {
    if ($loginAs) {
        $pHandler = new ProfileManager();
        $pHandler->setUserName($loginAs);
        $pHandler->authenticate();
        header("Location: ../index.php");
    } elseif ($delRole) {
        $userManager->deletePermission($userId, $delRole, $tablePk);
    } elseif (array_key_exists("apsubmit", $_POST)) {
        foreach ($_POST["p"] as $pname) {
            $role = $pname;
            $tablePk = '';
            if (strpos($pname, '-')) {
                $tok = explode('-', $pname);
                $role = $tok[0];
                $tablePk = $tok[1];
            }
            $userManager->addPermission($userId, $role, $tablePk);
        }
    }
Esempio n. 3
0
}
if (!is_numeric($resetPwd)) {
    $resetPwd = 0;
}
if ($action && !preg_match('/^[a-zA-Z0-9\\s_]+$/', $action)) {
    $action = '';
}
if ($remMe) {
    $pHandler->setRememberMe(true);
}
if ($action == "logout") {
    $pHandler->reset();
    header("Location: ../index.php");
} elseif ($action == "Login") {
    $password = trim($_POST["password"]);
    if ($pHandler->authenticate($password)) {
        if (!$refUrl || strtolower(substr($refUrl, 0, 4)) == 'http' || strpos($refUrl, 'newprofile.php')) {
            header("Location: ../index.php");
        } else {
            header("Location: " . $refUrl);
        }
    } else {
        $statusStr = 'Your username or password was incorrect. Please try again.<br/> If you are unable to remember your login credentials,<br/> use the controls below to retrieve your login or reset your password.';
    }
} elseif ($action == "Retrieve Login") {
    if ($emailAddr) {
        if ($pHandler->lookupUserName($emailAddr)) {
            $statusStr = "Your login name will be emailed to you.";
        } else {
            $statusStr = $pHandler->getErrorStr();
        }
 public function createChecklist($postArr)
 {
     $sqlInsert = "";
     $sqlValues = "";
     $fieldArr = array('name' => 's', 'authors' => 's', 'type' => 's', 'locality' => 's', 'publication' => 's', 'abstract' => 's', 'notes' => 's', 'latcentroid' => 'n', 'longcentroid' => 'n', 'pointradiusmeters' => 'n', 'footprintWKT' => 's', 'parentclid' => 'n', 'access' => 's', 'uid' => 'n');
     foreach ($fieldArr as $fieldName => $fieldType) {
         $sqlInsert .= ',' . $fieldName;
         $v = $this->cleanInStr($postArr[$fieldName]);
         if ($fieldName != 'abstract') {
             $v = strip_tags($v, '<i><u><b><a>');
         }
         if ($v) {
             if ($fieldType == 's') {
                 $sqlValues .= ',"' . $v . '"';
             } else {
                 if (is_numeric($v)) {
                     $sqlValues .= ',' . $v;
                 } else {
                     $sqlValues .= ',NULL';
                 }
             }
         } else {
             $sqlValues .= ',NULL';
         }
     }
     $sql = "INSERT INTO fmchecklists (" . substr($sqlInsert, 1) . ") VALUES (" . substr($sqlValues, 1) . ")";
     $newClId = 0;
     if ($this->conn->query($sql)) {
         $newClId = $this->conn->insert_id;
         //Set permissions to allow creater to be an editor
         $this->conn->query('INSERT INTO userroles (uid, role, tablename, tablepk) VALUES(' . $GLOBALS["SYMB_UID"] . ',"ClAdmin","fmchecklists",' . $newClId . ') ');
         //$this->conn->query("INSERT INTO userpermissions (uid, pname) VALUES(".$GLOBALS["symbUid"].",'ClAdmin-".$newClId."') ");
         $newPManager = new ProfileManager();
         $newPManager->setUserName($GLOBALS['USERNAME']);
         $newPManager->authenticate();
     }
     return $newClId;
 }