/** * A method to test the getPreset() method. */ function testGetPreset() { // Test with no dates set $oDaySpan = new OA_Admin_DaySpan(); unset($oDaySpan->oStartDate); unset($oDaySpan->oEndDate); $result = $oDaySpan->getPreset(); $this->assertNull($oDaySpan->oStartDate); $this->assertNull($oDaySpan->oEndDate); $this->assertEqual($result, 'specific'); // Test with "today" $oDaySpan = new OA_Admin_DaySpan(); $result = $oDaySpan->getPreset(); $this->assertEqual($result, 'today'); // Test with specific range $oDaySpan = new OA_Admin_DaySpan(); $oTestStartDate = new Date('1987-04-12 15:10:11'); $oTestEndDate = new Date('2004-10-12 23:59:59'); $oDaySpan->setSpanDays($oTestStartDate, $oTestEndDate); $result = $oDaySpan->getPreset(); $this->assertEqual($result, 'specific'); }
$period_start = htmlspecialchars(MAX_getStoredValue('period_start', date('Y-m-d'))); if (!strstr($period_start, '-')) { $period_start = date('Y-m-d', strtotime($period_start)); MAX_changeStoredValue('period_start', $period_start); } $period_end = htmlspecialchars(MAX_getStoredValue('period_end', date('Y-m-d'))); if (!strstr($period_end, '-')) { $period_end = date('Y-m-d', strtotime($period_end)); MAX_changeStoredValue('period_end', $period_end); } if (!empty($period_start) && !empty($period_end)) { $oStartDate = new Date($period_start); $oEndDate = new Date($period_end); $oDaySpan = new OA_Admin_DaySpan(); $oDaySpan->setSpanDays($oStartDate, $oEndDate); $periodFromDates = $oDaySpan->getPreset(); $_REQUEST['period_preset'] = $periodFromDates; $session['prefs']['GLOBALS']['period_preset'] = $periodFromDates; } else { $_REQUEST['period_preset'] = $periodPreset; $session['prefs']['GLOBALS']['period_preset'] = $periodPreset; } } phpAds_registerGlobal('breakdown', 'entity', 'agency_id', 'advertiser_id', 'clientid', 'campaignid', 'placement_id', 'ad_id', 'bannerid', 'publisher_id', 'affiliateid', 'zone_id', 'zoneid', 'start_date', 'end_date', 'sort', 'asc', 'show', 'expand', 'day', 'plugin', 'peroid_preset', 'tempPeriodPreset', 'GraphFile', 'graphFilter', 'graphFields', 'listorder', 'orderdirection'); $day = htmlspecialchars($day); $listorder = htmlspecialchars($listorder); $orderdirection = htmlspecialchars($orderdirection); if (!($orderdirection == 'up' || $orderdirection == 'down')) { if (stristr($orderdirection, 'down')) { $orderdirection = 'down'; } else {