예제 #1
0
 public function getProjects()
 {
     $user_id = $_POST['userId'];
     $dbh = new PDO("mysql:host=" . $GLOBALS['db_host'] . ";dbname=" . $GLOBALS['db_db'], $GLOBALS['db_user'], $GLOBALS['db_pass']);
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $stmt = $dbh->prepare("select * from projects where userId = :userId");
     $stmt->execute(array('userId' => $user_id));
     if ($stmt->rowCount()) {
         $pagesArray = array();
         while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
             $pagesArray[] = array("projectName" => $row["ProjectName"], "projectId" => $row["ProjectID"]);
         }
         echo json_success_data("Successfully retrieved your projects", $pagesArray);
     } else {
         echo json_error_msg("You dont have any projects");
     }
 }
예제 #2
0
            break;
        case "deleteProject":
            $ProjectController->deleteProject();
            break;
        case "getProject":
            $ProjectController->getProject();
            break;
        case "getProjects":
            $ProjectController->getProjects();
            break;
            // Page Methods
        // Page Methods
        case "createPage":
            $PageController->createPage();
            break;
        case "deletePage":
            $PageController->deletePage();
            break;
        case "getPage":
            $PageController->getPage();
            break;
        case "getPages":
            $PageController->getPages();
            break;
        case "savePage":
            $PageController->savePage();
            break;
    }
} else {
    echo json_error_msg("Forgot Post['action'] in call" . $_POST['userFullName']);
}
예제 #3
0
 public function savePage()
 {
     $page_id = sanitize($_POST['pageId']);
     $page_js = htmlentities($_POST['pageJS']);
     $page_content = htmlentities($_POST['pageContent']);
     $dbh = new PDO("mysql:host=" . $GLOBALS['db_host'] . ";dbname=" . $GLOBALS['db_db'], $GLOBALS['db_user'], $GLOBALS['db_pass']);
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $stmt = $dbh->prepare("select * from pages where PageID = :pageId and PageContent = :pageContent");
     $stmt->execute(array('pageId' => $page_id, "pageContent" => $page_content));
     if ($stmt->rowCount()) {
         // Already exists!
         echo json_error_msg("Already exists");
     } else {
         $stmt = $dbh->prepare("update pages set PageContent = :pageContent, PageJS = :pageJS where PageID = :pageId");
         $stmt->execute(array("pageContent" => $page_content, "pageJS" => $page_js, "pageId" => $page_id));
         if ($stmt->rowCount()) {
             echo json_success_msg("Page Saved Sucessfully");
         } else {
             echo json_error_msg("Page NOT Saved Sucessfully");
         }
     }
 }
예제 #4
0
  exit();

} elseif ($action == 'send_url') {
///////////////////////////////////////////////////////////////////////////////
  if(OBM_Acl::areAllowed($obm['uid'], 'calendar',array($params['entity_id']), 'admin' ) || check_calendar_update_rights($params)) {
    $format = $params['format'];
    $params['others_attendees'][]=$params['mail'];
    $entity = get_user_info($params['entity_id']);
    $entity['token'] = get_calendar_entity_share($params['entity_id'],$params['entity_type'],$params['type']);
    run_query_insert_others_attendees($params);
    $sharemail = new shareCalendarMailer();
    $sharemail->addRecipient($params['mail']);
    $sharemail->send("userShare$format",array($entity));
    json_ok_msg("$l_share_calendar : $l_mail_ok");
  } else {
    json_error_msg("$l_rights : $l_of_right_err_user");
  }
  echo "({".$display['json'].",$msg})";
  exit();

}

display_page($display);

///////////////////////////////////////////////////////////////////////////////
// Stores in $params hash, Calendar parameters transmited
// returns : $params hash with parameters set
///////////////////////////////////////////////////////////////////////////////
function get_calendar_params() {
  global $ccalendar_first_hour, $ccalendar_last_hour, $obm;
예제 #5
0
 public function login()
 {
     $host = $GLOBALS['db_host'];
     $db = $GLOBALS['db_db'];
     $user = $GLOBALS['db_user'];
     $pass = $GLOBALS['db_pass'];
     // Username and Password
     $username = $_POST['username'];
     $password = sha1($_POST['password']);
     $dbh = new PDO("mysql:host={$host};dbname={$db}", $user, $pass);
     $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
     $stmt = $dbh->prepare("select * from users where Username = :username");
     $stmt->execute(array('username' => $username));
     // old way
     if ($stmt->rowCount()) {
         while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
             if ($row['UserPass'] == $password) {
                 $result[] = array("userEmail" => $row['UserEmail'], "adminStatus" => $row['UserAdminStatus'], "username" => $row["Username"], "userId" => $row["UserID"]);
                 $this->set_login_session($row["UserID"], $row["Username"], $row['UserAdminStatus']);
                 echo json_success_data("Welcome " . $username . "! You are logged in!", $result);
             } else {
                 echo json_error_msg("Incorrect Password! Please Try Again!");
             }
         }
     } else {
         echo json_error_msg("please register!");
     }
 }