Beispiel #1
0
 public function processPost()
 {
     parent::processPost();
     copyArray($_POST, $fv, 'postId', 'title', 'content');
     $dao = DAO::getDAO('PostDAO');
     $dao->update("title = '{$fv['title']}', content = '{$fv['content']}' WHERE postId = {$fv['postId']}");
 }
Beispiel #2
0
	public function processPost()
	{		
		parent::processPost();

		copyArray($_POST, $fv, 'postId', 'title', 'content');
		$dao = DAO::getDAO('PostDAO');
		$dao->update("title = '$fv[title]', content = '$fv[content]' WHERE postId = $fv[postId]");
	}
	public function processPost()
	{		
		parent::processPost();

		copyArray($_POST, $fv, 'itemId', 'replyToId', 'name', 'email', 'content', 'parentCommentWeight');
		$dao = DAO::getDAO('CommentDAO');

		// #TODO: validate here...
		if (trim($fv['content']) != '')
		{
			$parentW = $fv['parentCommentWeight'];
			
			$dbNow = date( 'Y-m-d H:i:s' );
			$newComment = new Comment(
								array('type' => 1, 'itemId' => $fv['itemId'],
										'replyToId' => $fv['replyToId'],
										'authorName' => $fv['name'],
										'authorEmail' => $fv['email'],
										'content' => $fv['content'],
										'weight' => '0',
										'createTime' => $dbNow)
								);
			$err = $dao->insertInto("type, itemId, replyToId, weight, authorName, authorEmail, content, createTime", $newComment->getFields());		
			
			// update new Comment's Weight
			$weight = 0;			
			$newId = $dao->getDbHandler()->lastInsertId();			
			if ($parentW == '') {
				$weight = $newId;
			}
			else {
				if (strpos($parentW.'', '.') === false) {
					$weight = (double)($parentW.'.01');
				} else {
					$r = $dao->getLastComment($fv['replyToId']);
					if ($r == null) {	// no child comment
						$weight = $parentW.'01';
					}
					else {
						$lw = $r['weight'];		// last comment's weight, ex: 2.09				
						$floor_lw = floor($lw);	// = 2
						$sRemainder = fmod($lw, $floor_lw).''; // 2.22 % 2 = 0.09							
						$sRemainder = str_replace('0.', '1', $sRemainder); // = '109'
						$weight = $sRemainder + 1;	// = 110
						$sRemainderNew = substr($weight.'',	1); // '10'
						$weight = $floor_lw.'.'.$sRemainderNew;	// = 2.10
					}								
				}
			}			
			$dao->update('weight = ? WHERE commentId = ?', array($weight, $newId));
		}
	}
Beispiel #4
0
 public function processPost()
 {
     parent::processPost();
     copyArray($_POST, $fv, 'viewFile', 'jwEditor');
     $viewPath = BASEVIEW . '/' . currentViewDir() . '/' . $fv['viewFile'];
     $newContent = html_entity_decode($fv['jwEditor'], ENT_QUOTES);
     if (file_exists($viewPath)) {
         $f = fopen($viewPath, 'w');
         fwrite($f, $newContent);
         fclose($f);
     }
     header('Location: ' . $_SERVER['HTTP_REFERER']);
 }
 public function processPost()
 {
     parent::processPost();
     // #TODO: User submitted data. Save it to DB, email, etc.
     copyArray($_POST, $fv, 'ftoken', 'name', 'email', 'optin|checkbox', 'msg');
     session_start();
     if ($fv['ftoken'] != $_SESSION['ftoken']) {
         die('Error: invalid form token! Do not submit your form twice.');
     }
     unset($_SESSION['ftoken']);
     $v = $this->smarty;
     $v->assign('title', 'Thank you!');
     $v->assign(array('name' => sanitizeString($fv['name']), 'email' => sanitizeEmail($fv['email']), 'optin' => $fv['optin']));
     $v->assign('inc_content', v('contact_us_done.html'));
     $this->display($v, v('index.html'));
 }
Beispiel #6
0
 public function processPost()
 {
     parent::processPost();
     // #TODO: User submitted data. Save it to DB, email, etc.
     copyArray($_POST, $v, '*');
     $dao = DAO::getDAO('UserDAO');
     $newUser = new User(array('firstName' => 'First', 'lastName' => 'LastName', 'username' => $v['username'], 'email' => $v['email'], 'password' => $v['password'], 'createTime' => dbDateTime()));
     $ret = $dao->insertInto('firstName, lastName, username, email, password, createTime', $newUser->getFields());
     if ($ret[0] != '00000') {
         $err = "<span class='msgErr'>ERROR: {$ret['2']}</span>";
     }
     $v = $this->smarty;
     $v->assign('title', 'Thank you!');
     $v->assign('content', '<h2>Thank you!</h2><p>Thanks for your registration.</p><p>' . $err . '<p/><p><a href="/user-list">Check User List</a><p/>');
     $v->assign('inc_content', 'blank.html');
     $this->display($v, v('index.html'));
 }
Beispiel #7
0
	public function processPost()
	{
		parent::processPost();
		session_start();
		// #TODO: User submitted data. Save it to DB, email, etc.
		copyArray($_POST, $fv, 'ftoken', 'name', 'email', 'optin|checkbox', 'msg');
		
		checkFormToken('ftoken_contact_us', $fv['ftoken']);		

		$v = $this->smarty;
		$v->assign('title', 'Thank you!');
		$v->assign(array(
				'name' => sanitizeString($fv['name']),
				'email' => sanitizeEmail($fv['email']),
				'optin' => $fv['optin']
		));
		$v->assign('inc_content', v('contact_us_done.html'));
		$this->display($v, v('index.html'));
	}
Beispiel #8
0
 public function processPost()
 {
     parent::processPost();
     copyArray($_POST, $fv, 'username', 'password');
     // #TODO: check Username & Password from DB
     if ($fv['password'] == 'demo') {
         // successfully signed in!
         $ret = session_start();
         setLoggedInUsername($fv['username']);
         header('Location: ' . $_SERVER['HTTP_REFERER']);
     } else {
         $msg = '<font color="red">Invalid Username or Password!</font><p/> <a href="javascript:history.go(-1)">Go back</a>';
         $v = $this->smarty;
         $v->assign('title', 'Contact Us');
         $v->assign('hide_signin', '1');
         // MUST hide signin, otherwise it will cause infinite loop!!!
         $v->assign('inc_content', BASEEXT . '/authentication/view/signin_msg.html');
         $v->assign('message', $msg);
         $this->display($v, v('index.html'));
     }
 }