/** * Disconect one user after 600 seconds of inactivity * * @author Jonathan Sandoval <*****@*****.**> */ function timeOut() { //Get Offline to user that are 600 second out $users = self::getAllUsers('id', -1); foreach ($users as $singleUser) { if (time() - intval($singleUser->getLastActivityTime()) > 600) { $singleUser->setOffline(1); self::updateUser($singleUser); } } if (isset($_SESSION["user_id"]) && $_SESSION["user_id"] !== NULL) { //Put the new time activity $userOnline = self::getCurrentUser(); $userOnline->setLastActivityTime(time()); self::updateUser($userOnline); LanguageSupport::changeLanguage($userOnline->getLanguage()); } }
/** * Check if the current search is correct and return a correct verse number * @author Jonathan Sandoval <[jonathan_s_pisis@yahoo.com.mx]> * * @param integer $book The number of Book * @param integer $chapter The number of Charapter * @param integer $verse The number of Verse * @return integer A valid numberic verse */ static function nextVerse($book = 1, $chapter = 1, $verse = 1) { $prevLang = LanguageSupport::getActualLanguage(); //getting the text of the book LanguageSupport::changeLanguage('en'); $text = self::getBookText($book, 'en'); LanguageSupport::changeLanguage($prevLang); //find the verse $verseNotation = "{" . $chapter . ":" . $verse . "}"; $vers = $verse; $posVerse = false; while ($posVerse === false && $vers > 0) { //Eval verse $posVerse = stripos($text, $verseNotation); if ($posVerse === false) { //update vers $vers = round($vers / 2); $verseNotation = "{" . $chapter . ":" . $vers . "}"; } } return $vers; }