checkPostToken($sPostToken)); if($bValidPost) { if($bRegister) { $oMyThougths->register($sLogin, $sPass); $sPage = 'r'; } elseif($sLogin!='' && $sPass!='') { $oMyThougths->logMeIn($sLogin, $sPass); } } //if loggued in if(!$oMyThougths->isLogguedIn()) { $oMyThougths->logonPage($sLogin); } else { $oMyThougths->activateMenu(); $oMyThougths->setCalendarDate(); switch($sPage) { case 'w': //write a thought if($bValidPost && $sThought!='' && $sThought!='Talk to me.') { if($iThoughtId==0) { $iThoughtId = $oMyThougths->addThought($sThought); } else { $oMyThougths->updateThought($iThoughtId, $sThought); } } if($bFinishedWriting) { $oMyThougths->readingPage(); } else { $oMyThougths->writingPage($iThoughtId); } break; case 'r': //read a thought (per day) if($iDay<=0 || !$oMyThougths->readingPage(strtotime($iDay))) { $oMyThougths->writingPage(); } break; case 's': // go to settings page if($bValidPost) { $asSettings = array_intersect_key($_POST, array_flip($oMyThougths->getSettingsList())); $oMyThougths->setSettings($asSettings); $oMyThougths->writingPage(); } else { $oMyThougths->settingsPage(); } break; case 'q': //quit $oMyThougths->logMeOut(); } if($iCalYear!=0 && $iCalMonth!=0) { $oMyThougths->setCalendarDate($iCalYear, $iCalMonth); } } echo $oMyThougths->getPage(); ?>