Beispiel #1
0
/**
* cuePHP Content Processing file
* 
* @author Vikrant Labde <*****@*****.**>
* @version 1.0
*/
session_start();
/**
* INCLUDE CONFIGURATION FILE
*/
require_once "inc/config.inc.php";
/**
* DATA BASE OBJECT
*/
$hdlDb = clsDbUtil::fnConnectDB($_ARRDSN);
/**
* VALIDATE ACTION
*/
$strAction = trim($_GET["action"]);
$strAction = $strAction == "" ? "home" : $strAction;
/**
* BUILD CLASSNAME FROM ACTIONS ARRAY
*/
list($strModuleName, $strClassName) = explode(":", $_ARRMODULE[$strAction]["module"]);
$strModuleClass = "cls" . ucfirst($strModuleName);
$strClassName = "cls" . ucfirst($strClassName);
/**
* INCLUDE SECURITY CHECK
*/
require_once "inc/security.inc.php";
Beispiel #2
0
 /**
  * Function fnGetDateTimeDuration returns the string that contain information for the time and date duration of any post
  * @param string $strActualDateTime
  * @return string
  */
 function fnGetDateTimeDuration($strActualDateTime, $strDateFormat = "")
 {
     /*
     	About 1 second ago  ?1 second
     	A few seconds ago 	>1 second
     	About a minute ago 	?30 seconds
     	[x] minutes ago 	?1 minute, 30 seconds
     	[full time] 	>59 minutes
     	Today 	>1 hour, 30 minutes
     	Yesterday 	>today's date
     	[full date] 	>yesterday's date
     */
     if (!$strActualDateTime) {
         return;
     }
     $dateTempToday = clsDbUtil::fnSelectOne("SELECT NOW()", __FILE__, __FUNCTION__, __LINE__);
     $strDateDiff = strtotime($dateTempToday) - strtotime($strActualDateTime);
     if ($strDateDiff > 172800) {
         if ($strDateFormat == "") {
             $strTempVal = date("j F Y", strtotime($strActualDateTime));
         } else {
             $strTempVal = date($strDateFormat, strtotime($strActualDateTime));
         }
     } elseif ($strDateDiff > 86400) {
         //$strTempVal = round($strDateDiff/86400,0).' day';
         if ($strDateFormat == "") {
             $strTempVal = date("j F Y", strtotime($strActualDateTime));
         } else {
             $strTempVal = date($strDateFormat, strtotime($strActualDateTime));
         }
     } elseif ($strDateDiff > 3600 && $strDateDiff < 21600) {
         $strTempVal = 'About ' . round($strDateDiff / 3600, 0) . ' hours ago';
     } elseif ($strDateDiff >= 21600) {
         //echo $strDateDiff."<br>";
         //echo round($strDateDiff/60,0);	die;
         $strTempVal = 'Today';
     } elseif ($strDateDiff > 3600) {
         $strTempVal = round($strDateDiff / 3600, 0) . ' hour';
     } elseif ($strDateDiff >= 90) {
         $strTempVal = round($strDateDiff / 60, 0) . ' minutes ago';
     } elseif ($strDateDiff >= 30) {
         $strTempVal = 'About a minute ago';
     } elseif ($strDateDiff > 1) {
         $strTempVal = 'A few seconds ago';
     } elseif ($strDateDiff <= 1) {
         $strTempVal = 'About 1 second ago';
         //$strTempVal = 'A few seconds ago';
     }
     return $strTempVal;
 }