@@ -7,88 +7,88 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | require_once('tc_date_main.php');
|
| 9 | 9 | |
| 10 | -class tc_date extends tc_date_main{
|
|
| 10 | +class tc_date extends tc_date_main {
|
|
| 11 | 11 | var $compatible; |
| 12 | 12 | |
| 13 | - function tc_date(){
|
|
| 13 | + function tc_date() {
|
|
| 14 | 14 | //check if we should use DateTime that comes with 5.3.0 and later |
| 15 | - if (version_compare(PHP_VERSION, '5.3.0') <= 0) {
|
|
| 15 | + if (version_compare(PHP_VERSION, '5.3.0')<=0) {
|
|
| 16 | 16 | $this->compatible = false; |
| 17 | 17 | }else $this->compatible = true; |
| 18 | 18 | |
| 19 | - if(!$this->compatible){
|
|
| 19 | + if (!$this->compatible) {
|
|
| 20 | 20 | $this->tc_date_main(); |
| 21 | - }else{
|
|
| 21 | + }else {
|
|
| 22 | 22 | $this->mydate = new DateTime('now');
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - function getDayOfWeek($cdate = ""){
|
|
| 27 | - if(!$this->compatible){
|
|
| 26 | + function getDayOfWeek($cdate = "") {
|
|
| 27 | + if (!$this->compatible) {
|
|
| 28 | 28 | return tc_date_main::getDayOfWeek($cdate); |
| 29 | - }else{
|
|
| 30 | - if(($cdate != "" && $this->validDate($cdate)) || $cdate == ""){
|
|
| 29 | + }else {
|
|
| 30 | + if (($cdate != "" && $this->validDate($cdate)) || $cdate == "") {
|
|
| 31 | 31 | $tmp_date = ($cdate != "") ? new DateTime($cdate) : $this->mydate; |
| 32 | 32 | return $tmp_date->format('w');
|
| 33 | 33 | }else return ""; |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - function getWeekNumber($cdate = ""){
|
|
| 38 | - if(!$this->compatible){
|
|
| 37 | + function getWeekNumber($cdate = "") {
|
|
| 38 | + if (!$this->compatible) {
|
|
| 39 | 39 | return tc_date_main::getWeekNumber($cdate); |
| 40 | - }else{
|
|
| 41 | - if(($cdate != "" && $this->validDate($cdate)) || $cdate == ""){
|
|
| 40 | + }else {
|
|
| 41 | + if (($cdate != "" && $this->validDate($cdate)) || $cdate == "") {
|
|
| 42 | 42 | $tmp_date = ($cdate != "") ? new DateTime($cdate) : $this->mydate; |
| 43 | 43 | return $tmp_date->format('W');
|
| 44 | 44 | }else return ""; |
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - function setDate($sdate){
|
|
| 49 | - if(!$this->compatible){
|
|
| 48 | + function setDate($sdate) {
|
|
| 49 | + if (!$this->compatible) {
|
|
| 50 | 50 | tc_date_main::setDate($sdate); |
| 51 | - }else{
|
|
| 52 | - if(tc_date_main::validDate($sdate)) |
|
| 51 | + }else {
|
|
| 52 | + if (tc_date_main::validDate($sdate)) |
|
| 53 | 53 | $this->mydate = new DateTime($sdate); |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - function getDate($format = "Y-m-d", $cdate = ""){
|
|
| 58 | - if(!$this->compatible){
|
|
| 57 | + function getDate($format = "Y-m-d", $cdate = "") {
|
|
| 58 | + if (!$this->compatible) {
|
|
| 59 | 59 | return tc_date_main::getDate($format, $cdate); |
| 60 | - }else{
|
|
| 61 | - if(($cdate != "" && $this->validDate($cdate)) || $cdate == ""){
|
|
| 60 | + }else {
|
|
| 61 | + if (($cdate != "" && $this->validDate($cdate)) || $cdate == "") {
|
|
| 62 | 62 | $tmp_date = ($cdate != "") ? new DateTime($cdate) : $this->mydate; |
| 63 | 63 | return $tmp_date->format($format); |
| 64 | 64 | }else return ""; |
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - function setTimestamp($stime){
|
|
| 69 | - if(!$this->compatible){
|
|
| 68 | + function setTimestamp($stime) {
|
|
| 69 | + if (!$this->compatible) {
|
|
| 70 | 70 | tc_date_main::setTimestamp($stime); |
| 71 | - }else{
|
|
| 71 | + }else {
|
|
| 72 | 72 | $this->mydate->setTimestamp($stime); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - function getTimestamp($cdate = ""){
|
|
| 77 | - if(!$this->compatible){
|
|
| 76 | + function getTimestamp($cdate = "") {
|
|
| 77 | + if (!$this->compatible) {
|
|
| 78 | 78 | return tc_date_main::getTimestamp($cdate); |
| 79 | - }else{
|
|
| 80 | - if(($cdate != "" && $this->validDate($cdate)) || $cdate == ""){
|
|
| 79 | + }else {
|
|
| 80 | + if (($cdate != "" && $this->validDate($cdate)) || $cdate == "") {
|
|
| 81 | 81 | $tmp_date = ($cdate != "") ? new DateTime($cdate) : $this->mydate; |
| 82 | 82 | return $tmp_date->getTimestamp(); |
| 83 | 83 | }else return 0; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - function getDateFromTimestamp($stime, $format = 'Y-m-d'){
|
|
| 88 | - if($stime){
|
|
| 89 | - if(!$this->compatible){
|
|
| 87 | + function getDateFromTimestamp($stime, $format = 'Y-m-d') {
|
|
| 88 | + if ($stime) {
|
|
| 89 | + if (!$this->compatible) {
|
|
| 90 | 90 | return tc_date_main::getDateFromTimestamp($stime, $format); |
| 91 | - }else{
|
|
| 91 | + }else {
|
|
| 92 | 92 | $tmp_date = new DateTime(); |
| 93 | 93 | $tmp_date->setTimestamp($stime); |
| 94 | 94 | return $tmp_date->format($format); |
@@ -96,35 +96,35 @@ discard block |
||
| 96 | 96 | }else return ""; |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - function addDay($format = "Y-m-d", $timespan, $cdate = ""){
|
|
| 100 | - if(!$this->compatible){
|
|
| 99 | + function addDay($format = "Y-m-d", $timespan, $cdate = "") {
|
|
| 100 | + if (!$this->compatible) {
|
|
| 101 | 101 | return tc_date_main::addDay($format, $timespan, $cdate); |
| 102 | - }else{
|
|
| 102 | + }else {
|
|
| 103 | 103 | $timespan = "P".$timespan."D"; |
| 104 | 104 | return $this->addDate($format, $timespan, $cdate); |
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - function addMonth($format = "Y-m-d", $timespan, $cdate = ""){
|
|
| 109 | - if(!$this->compatible){
|
|
| 108 | + function addMonth($format = "Y-m-d", $timespan, $cdate = "") {
|
|
| 109 | + if (!$this->compatible) {
|
|
| 110 | 110 | return tc_date_main::addMonth($format, $timespan, $cdate); |
| 111 | - }else{
|
|
| 111 | + }else {
|
|
| 112 | 112 | $timespan = "P".$timespan."M"; |
| 113 | 113 | return $this->addDate($format, $timespan, $cdate); |
| 114 | 114 | } |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | - function addYear($format = "Y-m-d", $timespan, $cdate = ""){
|
|
| 118 | - if(!$this->compatible){
|
|
| 117 | + function addYear($format = "Y-m-d", $timespan, $cdate = "") {
|
|
| 118 | + if (!$this->compatible) {
|
|
| 119 | 119 | return tc_date_main::addYear($format, $timespan, $cdate); |
| 120 | - }else{
|
|
| 120 | + }else {
|
|
| 121 | 121 | $timespan = "P".$timespan."Y"; |
| 122 | 122 | return $this->addDate($format, $timespan, $cdate); |
| 123 | 123 | } |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - function addDate($format = "Y-m-d", $timespan, $cdate = ""){
|
|
| 127 | - if($this->compatible){
|
|
| 126 | + function addDate($format = "Y-m-d", $timespan, $cdate = "") {
|
|
| 127 | + if ($this->compatible) {
|
|
| 128 | 128 | $tmp_date = ($cdate != "") ? new DateTime($cdate) : $this->mydate; |
| 129 | 129 | $tmp_date->add(new DateInterval($timespan)); |
| 130 | 130 | return $tmp_date->format($format); |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | //return the number of day different between date1 and date2 |
| 135 | 135 | //if date1 omitted use set date |
| 136 | - function differentDate($date2, $date1 = ""){
|
|
| 137 | - if(!$this->compatible){
|
|
| 136 | + function differentDate($date2, $date1 = "") {
|
|
| 137 | + if (!$this->compatible) {
|
|
| 138 | 138 | return tc_date_main::differentDate($date2, $date1); |
| 139 | - }else{
|
|
| 139 | + }else {
|
|
| 140 | 140 | $date1 = ($date1 != "") ? $date1 : $this->getDate('Y-m-d');
|
| 141 | 141 | |
| 142 | 142 | $date1 = new DateTime($date1); |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | //check if date1 is before date2 |
| 150 | 150 | //if date1 omitted use set date |
| 151 | - function dateBefore($date2, $date1 = "", $equal = true){
|
|
| 152 | - if(!$this->compatible){
|
|
| 151 | + function dateBefore($date2, $date1 = "", $equal = true) {
|
|
| 152 | + if (!$this->compatible) {
|
|
| 153 | 153 | return tc_date_main::dateBefore($date2, $date1, $equal); |
| 154 | - }else{
|
|
| 154 | + }else {
|
|
| 155 | 155 | $date1 = ($date1 != "") ? $date1 : $this->getDate('Y-m-d');
|
| 156 | 156 | |
| 157 | 157 | $date1 = new DateTime($date1); |
@@ -162,10 +162,10 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | //check if date1 is after date2 |
| 164 | 164 | //if date1 omitted use set date |
| 165 | - function dateAfter($date2, $date1 = "", $equal = true){
|
|
| 166 | - if(!$this->compatible){
|
|
| 165 | + function dateAfter($date2, $date1 = "", $equal = true) {
|
|
| 166 | + if (!$this->compatible) {
|
|
| 167 | 167 | return tc_date_main::dateAfter($date2, $date1, $equal); |
| 168 | - }else{
|
|
| 168 | + }else {
|
|
| 169 | 169 | $date1 = ($date1 != "") ? $date1 : $this->getDate('Y-m-d');
|
| 170 | 170 | |
| 171 | 171 | $date1 = new DateTime($date1); |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -function filterInput($str, $type = "text"){
|
|
| 3 | - switch(strtolower($type)){
|
|
| 2 | +function filterInput($str, $type = "text") {
|
|
| 3 | + switch (strtolower($type)) {
|
|
| 4 | 4 | case "number": |
| 5 | - if(is_numeric($str)) |
|
| 5 | + if (is_numeric($str)) |
|
| 6 | 6 | return array(true, $str); |
| 7 | 7 | else return array(false, "Invalid input - '$str', required number"); |
| 8 | 8 | break; |
| 9 | 9 | case "boolean": |
| 10 | - if($str == "" || $str == 0 || $str == 1 || is_bool($str)) |
|
| 10 | + if ($str == "" || $str == 0 || $str == 1 || is_bool($str)) |
|
| 11 | 11 | return array(true, $str); |
| 12 | 12 | else return array(false, "Invalid input - '$str', required boolean"); |
| 13 | 13 | break; |
@@ -19,23 +19,23 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function getParameter($name, $type='text', $default=""){
|
|
| 22 | +function getParameter($name, $type = 'text', $default = "") {
|
|
| 23 | 23 | $v = isset($_REQUEST[$name]) ? trim($_REQUEST[$name]) : $default; |
| 24 | 24 | |
| 25 | 25 | $results = filterInput($v, $type); |
| 26 | 26 | $result_txt = isset($results[1]) ? $results[1] : ""; |
| 27 | - if(isset($results[0]) && $results[0] === true){
|
|
| 27 | + if (isset($results[0]) && $results[0] === true) {
|
|
| 28 | 28 | return $result_txt; |
| 29 | 29 | }else exit("Error returned '$name' - ".$result_txt);
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | -function getTranslatedTxt($txt, $allow_tag = false, $maps = array()){
|
|
| 32 | +function getTranslatedTxt($txt, $allow_tag = false, $maps = array()) {
|
|
| 33 | 33 | $content = $txt; |
| 34 | 34 | |
| 35 | 35 | //$content = unhtmlentities($content); |
| 36 | 36 | $content = htmlspecialchars_decode($content, ENT_QUOTES); |
| 37 | 37 | |
| 38 | - foreach($maps as $map_key=>$map_value){
|
|
| 38 | + foreach ($maps as $map_key=>$map_value) {
|
|
| 39 | 39 | $content = str_replace($map_key, $map_value, $content); |
| 40 | 40 | } |
| 41 | 41 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | $content = stripslashes($content); |
| 44 | 44 | $content = stripslashes($content); |
| 45 | 45 | |
| 46 | - if(!$allow_tag){
|
|
| 46 | + if (!$allow_tag) {
|
|
| 47 | 47 | $content = strip_tags($content); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -2,9 +2,9 @@ discard block |
||
| 2 | 2 | require_once("classes/tc_calendar.php");
|
| 3 | 3 | require_once("classes/tc_date.php");
|
| 4 | 4 | |
| 5 | -if(!isset($show_calendar_info)) $show_calendar_info = true; |
|
| 6 | -if(!isset($show_fb_info)) $show_fb_info = true; |
|
| 7 | -if(!isset($show_servertime_info)) $show_servertime_info = true; |
|
| 5 | +if (!isset($show_calendar_info)) $show_calendar_info = true; |
|
| 6 | +if (!isset($show_fb_info)) $show_fb_info = true; |
|
| 7 | +if (!isset($show_servertime_info)) $show_servertime_info = true; |
|
| 8 | 8 | |
| 9 | 9 | $tobj = new tc_calendar("");
|
| 10 | 10 | $version = $tobj->version; |
@@ -12,22 +12,22 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $tdate = new tc_date(); |
| 14 | 14 | |
| 15 | -if(!isset($timezone)) $timezone = date_default_timezone_get(); |
|
| 15 | +if (!isset($timezone)) $timezone = date_default_timezone_get(); |
|
| 16 | 16 | |
| 17 | 17 | $wan_enabled = 0; |
| 18 | 18 | $new_version = 0; |
| 19 | -if($wan_enabled = @fsockopen("www.google.com", 80, $errno, $errstr, 1)){
|
|
| 20 | - if($check_version && $wan_enabled){
|
|
| 21 | - if(function_exists("file_get_contents")){
|
|
| 19 | +if ($wan_enabled = @fsockopen("www.google.com", 80, $errno, $errstr, 1)) {
|
|
| 20 | + if ($check_version && $wan_enabled) {
|
|
| 21 | + if (function_exists("file_get_contents")) {
|
|
| 22 | 22 | $new_version = @file_get_contents("http://www.triconsole.com/php/tc_calendar_version.php?v=".$version);
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | } |
| 26 | -elseif(function_exists("file_get_contents")){
|
|
| 26 | +elseif (function_exists("file_get_contents")) {
|
|
| 27 | 27 | $ctx = stream_context_create(array('http' => array('timeout' => 1)));
|
| 28 | - $wan_enabled = @file_get_contents("http://www.google.com",null,$ctx,0,1);
|
|
| 29 | - if($check_version && $wan_enabled){
|
|
| 30 | - if(function_exists("file_get_contents")){
|
|
| 28 | + $wan_enabled = @file_get_contents("http://www.google.com", null, $ctx, 0, 1);
|
|
| 29 | + if ($check_version && $wan_enabled) {
|
|
| 30 | + if (function_exists("file_get_contents")) {
|
|
| 31 | 31 | # $new_version = @file_get_contents("http://www.triconsole.com/php/tc_calendar_version.php?v=".$version);
|
| 32 | 32 | } |
| 33 | 33 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | define("L_ABOUT", "<b>PHP Datepicker Calendar</b><br />Version: <b>".strval($version)."</b>".($new_version ? "<br /><b><font color=\"red\">Update available <a href=\"$WEB_SUPPORT\" target=\"_blank\">here</a> !</font></b>" : "").($wan_enabled ? ($show_fb_info ? "<br /><div class=\"fb-like\" data-href=\"https://www.facebook.com/DatePicker\" data-send=\"false\" data-layout=\"button_count\" data-show-faces=\"false\" data-font=\"tahoma\" ref=\"std_about_info\"></div>" : "") : "")."<br />©2006-".$tdate->getDate("Y")." <b><a href=\"$WEB_SUPPORT\" target=\"_blank\" title=\"http://triconsole.com\">$AUTHOR</a></b>".($show_servertime_info ? "<br />Server Timezone:".($timezone ? "<br />$timezone" : "")."<br /><span id=\"timecontainer\">".$tdate->getDate("Y-m-d H:i:s")."</span>" : ""));
|
| 37 | 37 | |
| 38 | 38 | ?> |
| 39 | -<?php if($wan_enabled && $show_fb_info){ ?>
|
|
| 39 | +<?php if ($wan_enabled && $show_fb_info) { ?>
|
|
| 40 | 40 | <link href="calendar_info.css" rel="stylesheet" type="text/css" /> |
| 41 | 41 | <div id="fb-root"></div> |
| 42 | 42 | <script> |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | //timezone var, need to setup before any other tasks |
| 14 | 14 | $timezone = getParameter("tmz");
|
| 15 | 15 | |
| 16 | -if(!$timezone) $timezone = date_default_timezone_get(); |
|
| 16 | +if (!$timezone) $timezone = date_default_timezone_get(); |
|
| 17 | 17 | @date_default_timezone_set($timezone); |
| 18 | 18 | |
| 19 | 19 | $cdate = new tc_date(); |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | $slm = getParameter("selected_month");
|
| 24 | 24 | $sly = getParameter("selected_year");
|
| 25 | 25 | |
| 26 | -if(!is_numeric($sld)) $sld = "00"; |
|
| 27 | -if(!is_numeric($slm)) $slm = "00"; |
|
| 28 | -if(!is_numeric($sly)) $sly = "0000"; |
|
| 26 | +if (!is_numeric($sld)) $sld = "00"; |
|
| 27 | +if (!is_numeric($slm)) $slm = "00"; |
|
| 28 | +if (!is_numeric($sly)) $sly = "0000"; |
|
| 29 | 29 | |
| 30 | 30 | $year_start = getParameter("year_start", "number", 0);
|
| 31 | 31 | $year_end = getParameter("year_end", "number", 0);
|
@@ -73,63 +73,63 @@ discard block |
||
| 73 | 73 | $theme = getParameter("thm");
|
| 74 | 74 | |
| 75 | 75 | //check year to be select in case of date_allow is set |
| 76 | -if(!$show_not_allow){
|
|
| 76 | +if (!$show_not_allow) {
|
|
| 77 | 77 | if ($ta1_set && $cdate->validDate($time_allow1)) $year_start = $cdate->getDate('Y', $time_allow1);
|
| 78 | 78 | if ($ta2_set && $cdate->validDate($time_allow2)) $year_end = $cdate->getDate('Y', $time_allow2);
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | -if(isset($_REQUEST["m"])) |
|
| 81 | +if (isset($_REQUEST["m"])) |
|
| 82 | 82 | $m = getParameter("m", "number");
|
| 83 | -else{
|
|
| 84 | - if($slm != "00"){
|
|
| 83 | +else {
|
|
| 84 | + if ($slm != "00") {
|
|
| 85 | 85 | $m = $slm; |
| 86 | - }else{
|
|
| 87 | - if($ta2_set && $year_end > 0){
|
|
| 86 | + }else {
|
|
| 87 | + if ($ta2_set && $year_end>0) {
|
|
| 88 | 88 | //compare which one is more |
| 89 | 89 | $year_allow2 = $cdate->getDate('Y', $time_allow2);
|
| 90 | - if($year_allow2 >= $year_end){
|
|
| 90 | + if ($year_allow2>=$year_end) {
|
|
| 91 | 91 | //use time_allow2 |
| 92 | 92 | $m = ($cdate->dateBefore($time_allow2)) ? $cdate->getDate("m") : $cdate->getDate('m', $time_allow2);
|
| 93 | - }else{
|
|
| 93 | + }else {
|
|
| 94 | 94 | //use year_end |
| 95 | - $m = ($year_end > $cdate->getDate("Y")) ? $cdate->getDate("m") : 12;
|
|
| 95 | + $m = ($year_end>$cdate->getDate("Y")) ? $cdate->getDate("m") : 12;
|
|
| 96 | 96 | } |
| 97 | - }elseif($ta2_set){
|
|
| 97 | + }elseif ($ta2_set) {
|
|
| 98 | 98 | $m = ($cdate->dateBefore($time_allow2)) ? $cdate->getDate("m") : $cdate->getDate('m', $time_allow2);
|
| 99 | - }elseif($year_end > 0){
|
|
| 100 | - $m = ($year_end > $cdate->getDate("Y")) ? $cdate->getDate("m") : 12; //date('m')
|
|
| 101 | - }else{
|
|
| 99 | + }elseif ($year_end>0) {
|
|
| 100 | + $m = ($year_end>$cdate->getDate("Y")) ? $cdate->getDate("m") : 12; //date('m')
|
|
| 101 | + }else {
|
|
| 102 | 102 | $m = $cdate->getDate("m");
|
| 103 | 103 | } |
| 104 | 104 | } |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | -if($m < 1 && $m > 12) $m = $cdate->getDate("m");
|
|
| 107 | +if ($m<1 && $m>12) $m = $cdate->getDate("m");
|
|
| 108 | 108 | |
| 109 | 109 | $m = str_pad($m, 2, "0", STR_PAD_LEFT); |
| 110 | 110 | |
| 111 | 111 | $cyr = ($sly != "0000") ? true : false; |
| 112 | -if($cyr && $sly && $sly < $year_start) $sly = $year_start; |
|
| 113 | -if($cyr && $sly && $sly > $year_end) $sly = $year_end; |
|
| 112 | +if ($cyr && $sly && $sly<$year_start) $sly = $year_start; |
|
| 113 | +if ($cyr && $sly && $sly>$year_end) $sly = $year_end; |
|
| 114 | 114 | |
| 115 | -if(isset($_REQUEST["y"])) |
|
| 115 | +if (isset($_REQUEST["y"])) |
|
| 116 | 116 | $y = getParameter("y", "number");
|
| 117 | 117 | else |
| 118 | 118 | $y = ($cyr) ? $sly : $cdate->getDate("Y");
|
| 119 | 119 | |
| 120 | -if($y <= 0) $y = $cdate->getDate("Y");
|
|
| 120 | +if ($y<=0) $y = $cdate->getDate("Y");
|
|
| 121 | 121 | |
| 122 | 122 | // ensure m-y fits date allow range |
| 123 | 123 | if (!$show_not_allow) {
|
| 124 | 124 | if ($ta1_set) {
|
| 125 | 125 | $m1 = $cdate->getDate('m', $time_allow1);
|
| 126 | 126 | $y1 = $cdate->getDate('Y', $time_allow1);
|
| 127 | - if ($y == $y1 && (int)$m < (int)$m1) $m = $m1; |
|
| 127 | + if ($y == $y1 && (int) $m<(int) $m1) $m = $m1; |
|
| 128 | 128 | } |
| 129 | 129 | if ($ta2_set) {
|
| 130 | 130 | $m2 = $cdate->getDate('m', $time_allow2);
|
| 131 | 131 | $y2 = $cdate->getDate('Y', $time_allow2);
|
| 132 | - if ($y == $y2 && (int)$m > (int)$m2) $m = $m2; |
|
| 132 | + if ($y == $y2 && (int) $m>(int) $m2) $m = $m2; |
|
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
@@ -147,15 +147,15 @@ discard block |
||
| 147 | 147 | $cobj->setTimezone($timezone); //set for further usage, nothing for now |
| 148 | 148 | |
| 149 | 149 | $theme_path = ($theme != "") ? $cobj->getThemePath($theme) : ""; |
| 150 | -if(!is_file($theme_path)) $theme_path = ""; |
|
| 150 | +if (!is_file($theme_path)) $theme_path = ""; |
|
| 151 | 151 | |
| 152 | 152 | //check and show default calendar month and year on valid range of date_allow |
| 153 | -if(!isset($_REQUEST["m"])){
|
|
| 154 | - if($time_allow1 != ""){
|
|
| 153 | +if (!isset($_REQUEST["m"])) {
|
|
| 154 | + if ($time_allow1 != "") {
|
|
| 155 | 155 | //get date of time allow1 |
| 156 | - if($cdate->validDate($time_allow1)){
|
|
| 156 | + if ($cdate->validDate($time_allow1)) {
|
|
| 157 | 157 | //check valid if today is after date_allow1 |
| 158 | - if(!$cdate->dateAfter($time_allow1, $today)){
|
|
| 158 | + if (!$cdate->dateAfter($time_allow1, $today)) {
|
|
| 159 | 159 | //reset default calendar display |
| 160 | 160 | $y = $cdate->getDate('Y', $time_allow1);
|
| 161 | 161 | $m = $cdate->getDate('m', $time_allow1);
|
@@ -168,23 +168,23 @@ discard block |
||
| 168 | 168 | $year_end = $cobj->year_end; |
| 169 | 169 | |
| 170 | 170 | //check year display in valid range |
| 171 | -if($y >= $year_end) $y = $year_end; |
|
| 172 | -if($y <= $year_start) $y = $year_start; |
|
| 171 | +if ($y>=$year_end) $y = $year_end; |
|
| 172 | +if ($y<=$year_start) $y = $year_start; |
|
| 173 | 173 | |
| 174 | 174 | $total_thismonth = $cobj->total_days($m, $y); |
| 175 | 175 | |
| 176 | -if($m == 1){
|
|
| 176 | +if ($m == 1) {
|
|
| 177 | 177 | $previous_month = 12; |
| 178 | 178 | $previous_year = $y-1; |
| 179 | -}else{
|
|
| 179 | +}else {
|
|
| 180 | 180 | $previous_month = $m-1; |
| 181 | 181 | $previous_year = $y; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | -if($m == 12){
|
|
| 184 | +if ($m == 12) {
|
|
| 185 | 185 | $next_month = 1; |
| 186 | 186 | $next_year = $y+1; |
| 187 | -}else{
|
|
| 187 | +}else {
|
|
| 188 | 188 | $next_month = $m+1; |
| 189 | 189 | $next_year = $y; |
| 190 | 190 | } |
@@ -193,13 +193,13 @@ discard block |
||
| 193 | 193 | |
| 194 | 194 | $firstdate = $cdate->getDayOfWeek($y."-".$m."-1"); //first date of month, 0 (for Sunday) through 6 (for Saturday) |
| 195 | 195 | |
| 196 | -if($firstdate == $startDate){
|
|
| 196 | +if ($firstdate == $startDate) {
|
|
| 197 | 197 | //skip last month |
| 198 | 198 | $startwrite = $total_lastmonth+1; |
| 199 | -}elseif($firstdate < $startDate){
|
|
| 200 | - $startwrite = $total_lastmonth - (6-($startDate-$firstdate)); |
|
| 201 | -}else{
|
|
| 202 | - $startwrite = $total_lastmonth - ($firstdate - $startDate - 1); |
|
| 199 | +}elseif ($firstdate<$startDate) {
|
|
| 200 | + $startwrite = $total_lastmonth-(6-($startDate-$firstdate)); |
|
| 201 | +}else {
|
|
| 202 | + $startwrite = $total_lastmonth-($firstdate-$startDate-1); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | //-------------------------------- |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | $row_count = 0; |
| 213 | 213 | |
| 214 | 214 | //write previous month |
| 215 | -for($day=$startwrite; $day<=$total_lastmonth; $day++){
|
|
| 215 | +for ($day = $startwrite; $day<=$total_lastmonth; $day++) {
|
|
| 216 | 216 | $calendar_rows[$row_count][] = array($day, "", "othermonth", ""); |
| 217 | 217 | $dayinweek_counter++; |
| 218 | 218 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $prev_d = $y."-".$prev_m."-".$day; |
| 221 | 221 | |
| 222 | 222 | $wknum = $cdate->getWeekNumber($prev_d); |
| 223 | - if(!isset($week_rows[$row_count][$wknum])){
|
|
| 223 | + if (!isset($week_rows[$row_count][$wknum])) {
|
|
| 224 | 224 | $week_rows[$row_count][$wknum] = 1; |
| 225 | 225 | }else $week_rows[$row_count][$wknum] = $week_rows[$row_count][$wknum]+1; |
| 226 | 226 | } |
@@ -228,31 +228,31 @@ discard block |
||
| 228 | 228 | $pvMonthTime = $previous_year."-".$previous_month."-".$total_lastmonth; |
| 229 | 229 | |
| 230 | 230 | //check lastmonth is on allowed date |
| 231 | -if($ta1_set && !$show_not_allow){
|
|
| 232 | - if($cdate->dateBefore($pvMonthTime, $time_allow1)){
|
|
| 231 | +if ($ta1_set && !$show_not_allow) {
|
|
| 232 | + if ($cdate->dateBefore($pvMonthTime, $time_allow1)) {
|
|
| 233 | 233 | $show_previous = true; |
| 234 | 234 | }else $show_previous = false; |
| 235 | 235 | }else $show_previous = true; //always show when not set |
| 236 | 236 | |
| 237 | 237 | $date_num = $cdate->getDayOfWeek(($previous_year."-".$previous_month."-".$total_lastmonth)); |
| 238 | -if(($startDate == 0 && $date_num == 6) || ($startDate > 0 && $date_num == $startDate-1) && $startwrite<$total_lastmonth){
|
|
| 239 | - if(isset($calendar_rows[0])) $row_count++; |
|
| 238 | +if (($startDate == 0 && $date_num == 6) || ($startDate>0 && $date_num == $startDate-1) && $startwrite<$total_lastmonth) {
|
|
| 239 | + if (isset($calendar_rows[0])) $row_count++; |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | $dp_time = ($date_pair_value) ? $date_pair_value : ""; |
| 243 | 243 | |
| 244 | 244 | $select_days = array(); |
| 245 | -if($sld>0 && $slm>0 && $sly>0){
|
|
| 245 | +if ($sld>0 && $slm>0 && $sly>0) {
|
|
| 246 | 246 | $sldate = "$sly-$slm-$sld"; |
| 247 | 247 | |
| 248 | - for($i=0; $i<$interval; $i++){
|
|
| 248 | + for ($i = 0; $i<$interval; $i++) {
|
|
| 249 | 249 | $this_day = $cdate->addDay("Y-m-d", $i, $sldate);
|
| 250 | 250 | $select_days[] = $this_day; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | //write current month |
| 255 | -for($day=1; $day<=$total_thismonth; $day++){
|
|
| 255 | +for ($day = 1; $day<=$total_thismonth; $day++) {
|
|
| 256 | 256 | $date_str = $y."-".str_pad($m, 2, "0", STR_PAD_LEFT)."-".str_pad($day, 2, "0", STR_PAD_LEFT); |
| 257 | 257 | |
| 258 | 258 | $date_num = $cdate->getDayOfWeek($date_str); |
@@ -267,40 +267,40 @@ discard block |
||
| 267 | 267 | $dateLink = true; |
| 268 | 268 | |
| 269 | 269 | //check date allowed |
| 270 | - if($ta1_set && $ta2_set){
|
|
| 270 | + if ($ta1_set && $ta2_set) {
|
|
| 271 | 271 | //both date specified |
| 272 | 272 | $dateLink = ($cdate->dateBefore($date_str, $time_allow1) && $cdate->dateAfter($date_str, $time_allow2)) ? true : false; |
| 273 | - }elseif($ta1_set){
|
|
| 273 | + }elseif ($ta1_set) {
|
|
| 274 | 274 | //only date 1 specified |
| 275 | 275 | $dateLink = $cdate->dateBefore($date_str, $time_allow1) ? true : false; |
| 276 | - }elseif($ta2_set){
|
|
| 276 | + }elseif ($ta2_set) {
|
|
| 277 | 277 | //only date 2 specified |
| 278 | 278 | $dateLink = $cdate->dateAfter($date_str, $time_allow2) ? true : false; |
| 279 | - }else{
|
|
| 279 | + }else {
|
|
| 280 | 280 | //no date allow specified, assume show all |
| 281 | 281 | $dateLink = true; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if($dateLink){
|
|
| 284 | + if ($dateLink) {
|
|
| 285 | 285 | //check for disable days |
| 286 | - if(in_array(strtolower($day_txt), $cobj->dsb_days) !== false){
|
|
| 286 | + if (in_array(strtolower($day_txt), $cobj->dsb_days) !== false) {
|
|
| 287 | 287 | $dateLink = false; |
| 288 | 288 | } |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | //check specific date |
| 292 | - if($dateLink){
|
|
| 293 | - if(is_array($sp_dates) && sizeof($sp_dates) > 0){
|
|
| 292 | + if ($dateLink) {
|
|
| 293 | + if (is_array($sp_dates) && sizeof($sp_dates)>0) {
|
|
| 294 | 294 | //check if it is current date |
| 295 | 295 | $sp_found = false; |
| 296 | 296 | |
| 297 | 297 | //check on yearly recursive |
| 298 | - if(isset($sp_dates[2]) && is_array($sp_dates[2])){
|
|
| 299 | - foreach($sp_dates[2] as $sp_time){
|
|
| 300 | - if($sp_time != ""){
|
|
| 301 | - $sp_time_md = (int)$cdate->getDate('md', $sp_time); //date('md', $sp_time);
|
|
| 302 | - $this_md = (int)$cdate->getDate('md', $date_str); //date('md', $currentTime);
|
|
| 303 | - if($sp_time_md == $this_md){
|
|
| 298 | + if (isset($sp_dates[2]) && is_array($sp_dates[2])) {
|
|
| 299 | + foreach ($sp_dates[2] as $sp_time) {
|
|
| 300 | + if ($sp_time != "") {
|
|
| 301 | + $sp_time_md = (int) $cdate->getDate('md', $sp_time); //date('md', $sp_time);
|
|
| 302 | + $this_md = (int) $cdate->getDate('md', $date_str); //date('md', $currentTime);
|
|
| 303 | + if ($sp_time_md == $this_md) {
|
|
| 304 | 304 | $sp_found = true; |
| 305 | 305 | break; |
| 306 | 306 | } |
@@ -309,11 +309,11 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | //check on monthly recursive |
| 312 | - if(isset($sp_dates[1]) && is_array($sp_dates[1]) && !$sp_found){
|
|
| 313 | - foreach($sp_dates[1] as $sp_time){
|
|
| 314 | - if($sp_time != "" && $sp_time > 0){
|
|
| 315 | - $sp_time_d = (int)$cdate->getDate('d', $sp_time); //date('d', $sp_time);
|
|
| 316 | - if($sp_time_d == $day){
|
|
| 312 | + if (isset($sp_dates[1]) && is_array($sp_dates[1]) && !$sp_found) {
|
|
| 313 | + foreach ($sp_dates[1] as $sp_time) {
|
|
| 314 | + if ($sp_time != "" && $sp_time>0) {
|
|
| 315 | + $sp_time_d = (int) $cdate->getDate('d', $sp_time); //date('d', $sp_time);
|
|
| 316 | + if ($sp_time_d == $day) {
|
|
| 317 | 317 | $sp_found = true; |
| 318 | 318 | break; |
| 319 | 319 | } |
@@ -322,11 +322,11 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | //check on no recursive |
| 325 | - if(isset($sp_dates[0]) && is_array($sp_dates[0]) && !$sp_found){
|
|
| 325 | + if (isset($sp_dates[0]) && is_array($sp_dates[0]) && !$sp_found) {
|
|
| 326 | 326 | $sp_found = in_array($date_str, $sp_dates[0]); |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - switch($sp_type){
|
|
| 329 | + switch ($sp_type) {
|
|
| 330 | 330 | case 0: |
| 331 | 331 | default: |
| 332 | 332 | //disabled specific and enabled others |
@@ -340,23 +340,23 @@ discard block |
||
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - if($date_pair_value){
|
|
| 343 | + if ($date_pair_value) {
|
|
| 344 | 344 | //check date_pair1 & 2 |
| 345 | - if($date_pair1 && $date_pair_value != "0000-00-00" && $cdate->dateAfter($date_pair_value, $date_str) && (($slm>0 && $sld>0 && $sly>0) && $cdate->dateBefore("$sly-$slm-$sld", $date_str))){ //set date only after date_pair1
|
|
| 346 | - if(!in_array("select", $htmlClass))
|
|
| 345 | + if ($date_pair1 && $date_pair_value != "0000-00-00" && $cdate->dateAfter($date_pair_value, $date_str) && (($slm>0 && $sld>0 && $sly>0) && $cdate->dateBefore("$sly-$slm-$sld", $date_str))) { //set date only after date_pair1
|
|
| 346 | + if (!in_array("select", $htmlClass))
|
|
| 347 | 347 | $htmlClass[] = "select"; |
| 348 | 348 | } |
| 349 | 349 | |
| 350 | - if($date_pair2 && $date_pair_value != "0000-00-00" && $cdate->dateBefore($date_pair_value, $date_str) && (($slm>0 && $sld>0 && $sly>0) && $cdate->dateAfter("$sly-$slm-$sld", $date_str))){ //set date only before date_pair2
|
|
| 351 | - if(!in_array("select", $htmlClass))
|
|
| 350 | + if ($date_pair2 && $date_pair_value != "0000-00-00" && $cdate->dateBefore($date_pair_value, $date_str) && (($slm>0 && $sld>0 && $sly>0) && $cdate->dateAfter("$sly-$slm-$sld", $date_str))) { //set date only before date_pair2
|
|
| 351 | + if (!in_array("select", $htmlClass))
|
|
| 352 | 352 | $htmlClass[] = "select"; |
| 353 | 353 | } |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | $htmlClass[] = strtolower($day_txt); |
| 357 | 357 | |
| 358 | - if($dateLink){
|
|
| 359 | - if(in_array($date_str, $select_days) && !in_array("select", $htmlClass)){
|
|
| 358 | + if ($dateLink) {
|
|
| 359 | + if (in_array($date_str, $select_days) && !in_array("select", $htmlClass)) {
|
|
| 360 | 360 | $htmlClass[] = "select"; |
| 361 | 361 | } |
| 362 | 362 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | $class = implode(" ", $htmlClass);
|
| 365 | 365 | |
| 366 | 366 | $calendar_rows[$row_count][] = array($day, "javascript:selectDay('".str_pad($day, 2, "0", STR_PAD_LEFT)."');", $class, "$y".str_pad($m, 2, "0", STR_PAD_LEFT).str_pad($day, 2, "0", STR_PAD_LEFT));
|
| 367 | - }else{
|
|
| 367 | + }else {
|
|
| 368 | 368 | $htmlClass[] = "disabledate"; |
| 369 | 369 | $class = implode(" ", $htmlClass);
|
| 370 | 370 | |
@@ -372,12 +372,12 @@ discard block |
||
| 372 | 372 | $calendar_rows[$row_count][] = array($day, "", $class, "$y".str_pad($m, 2, "0", STR_PAD_LEFT).str_pad($day, 2, "0", STR_PAD_LEFT)); |
| 373 | 373 | |
| 374 | 374 | //check if selected date is a disabled date |
| 375 | - if($date_str == $sly."-".str_pad($slm, 2, "0", STR_PAD_LEFT)."-".str_pad($sld, 2, "0", STR_PAD_LEFT)){
|
|
| 375 | + if ($date_str == $sly."-".str_pad($slm, 2, "0", STR_PAD_LEFT)."-".str_pad($sld, 2, "0", STR_PAD_LEFT)) {
|
|
| 376 | 376 | //disabled |
| 377 | 377 | //$sly = $slm = $sld = ""; |
| 378 | 378 | } |
| 379 | 379 | } |
| 380 | - if(($startDate == 0 && $date_num == 6) || ($startDate > 0 && $date_num == $startDate-1)){
|
|
| 380 | + if (($startDate == 0 && $date_num == 6) || ($startDate>0 && $date_num == $startDate-1)) {
|
|
| 381 | 381 | $row_count++; |
| 382 | 382 | |
| 383 | 383 | $dayinweek_counter = 0; |
@@ -385,19 +385,19 @@ discard block |
||
| 385 | 385 | |
| 386 | 386 | $wknum = $cdate->getWeekNumber(($y."-".$m."-".$day)); |
| 387 | 387 | |
| 388 | - if(!isset($week_rows[$row_count][$wknum])){
|
|
| 388 | + if (!isset($week_rows[$row_count][$wknum])) {
|
|
| 389 | 389 | $week_rows[$row_count][$wknum] = 1; |
| 390 | 390 | }else $week_rows[$row_count][$wknum] = $week_rows[$row_count][$wknum]+1; |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | //write next other month |
| 394 | 394 | $write_end_days = (6-$dayinweek_counter)+1; |
| 395 | -if($write_end_days > 0){
|
|
| 396 | - for($day=1; $day<=$write_end_days; $day++){
|
|
| 395 | +if ($write_end_days>0) {
|
|
| 396 | + for ($day = 1; $day<=$write_end_days; $day++) {
|
|
| 397 | 397 | $calendar_rows[$row_count][] = array($day, "", "othermonth", ""); |
| 398 | 398 | |
| 399 | 399 | $wknum = $cdate->getWeekNumber($cdate->addMonth("Y-m-d", 1, ($y."-".$m."-".$day))); //date('W', mktime(0,0,0, $m+1, $day, $y));
|
| 400 | - if(!isset($week_rows[$row_count][$wknum])){
|
|
| 400 | + if (!isset($week_rows[$row_count][$wknum])) {
|
|
| 401 | 401 | $week_rows[$row_count][$wknum] = 1; |
| 402 | 402 | }else $week_rows[$row_count][$wknum] = $week_rows[$row_count][$wknum]+1; |
| 403 | 403 | } |
@@ -405,14 +405,14 @@ discard block |
||
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | //write fulfil row to 6 rows |
| 408 | -for($day=$row_count; $day<6; $day++){
|
|
| 408 | +for ($day = $row_count; $day<6; $day++) {
|
|
| 409 | 409 | $tmpday = $write_end_days+1; |
| 410 | - for($f=$tmpday; $f<=($tmpday+6); $f++){
|
|
| 410 | + for ($f = $tmpday; $f<=($tmpday+6); $f++) {
|
|
| 411 | 411 | $calendar_rows[$row_count][] = array($f, "", "othermonth", ""); |
| 412 | 412 | |
| 413 | 413 | $wknum = $cdate->getWeekNumber($cdate->addMonth("Y-m-d", 1, ($y."-".$m."-".$f))); //date('W', mktime(0,0,0, $m+1, $f, $y));
|
| 414 | 414 | |
| 415 | - if(!isset($week_rows[$row_count][$wknum])){
|
|
| 415 | + if (!isset($week_rows[$row_count][$wknum])) {
|
|
| 416 | 416 | $week_rows[$row_count][$wknum] = 1; |
| 417 | 417 | }else $week_rows[$row_count][$wknum] = $week_rows[$row_count][$wknum]+1; |
| 418 | 418 | } |
@@ -420,20 +420,20 @@ discard block |
||
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | //check next month is on allowed date |
| 423 | -if($ta2_set && !$show_not_allow){
|
|
| 423 | +if ($ta2_set && !$show_not_allow) {
|
|
| 424 | 424 | $nxMonthTime = $next_year."-".$next_month."-1"; |
| 425 | - if($cdate->dateAfter($nxMonthTime, $time_allow2)){
|
|
| 425 | + if ($cdate->dateAfter($nxMonthTime, $time_allow2)) {
|
|
| 426 | 426 | $show_next = true; |
| 427 | 427 | }else $show_next = false; |
| 428 | 428 | }else $show_next = true; //always show when not set |
| 429 | 429 | ?> |
| 430 | 430 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 431 | -<html xmlns="http://www.w3.org/1999/xhtml"<?php if($rtl) echo(" dir=\"rtl\""); ?>>
|
|
| 431 | +<html xmlns="http://www.w3.org/1999/xhtml"<?php if ($rtl) echo(" dir=\"rtl\""); ?>>
|
|
| 432 | 432 | <head> |
| 433 | 433 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 434 | 434 | <title>TriConsole.com - PHP Calendar Date Picker</title> |
| 435 | 435 | <link href="calendar.css" rel="stylesheet" type="text/css" /> |
| 436 | -<?php if($theme_path){ ?>
|
|
| 436 | +<?php if ($theme_path) { ?>
|
|
| 437 | 437 | <link href="<?php echo($theme_path); ?>" rel="stylesheet" type="text/css" /> |
| 438 | 438 | <?php } ?> |
| 439 | 439 | <script type="text/javascript"> |
@@ -442,8 +442,8 @@ discard block |
||
| 442 | 442 | var today_month = "<?php echo($cdate->getDate('m')); ?>";
|
| 443 | 443 | var today_year = "<?php echo($cdate->getDate('Y')); ?>";
|
| 444 | 444 | var obj_name = "<?php echo($objname); ?>"; |
| 445 | -var current_month = "<?php echo($m);?>"; |
|
| 446 | -var current_year = "<?php echo($y);?>"; |
|
| 445 | +var current_month = "<?php echo($m); ?>"; |
|
| 446 | +var current_year = "<?php echo($y); ?>"; |
|
| 447 | 447 | |
| 448 | 448 | var this_time = "<?php echo(date("F d, Y H:i:s", time())); ?>";
|
| 449 | 449 | //--> |
@@ -454,12 +454,12 @@ discard block |
||
| 454 | 454 | function submitNow(dvalue, mvalue, yvalue){
|
| 455 | 455 | <?php |
| 456 | 456 | //write auto submit script |
| 457 | - if($auto_submit){
|
|
| 457 | + if ($auto_submit) {
|
|
| 458 | 458 | echo("if(yvalue>0 && mvalue>0 && dvalue>0){\n");
|
| 459 | - if($form_name){
|
|
| 459 | + if ($form_name) {
|
|
| 460 | 460 | //submit value by post form |
| 461 | 461 | echo("window.parent.document.".$form_name.".submit();\n");
|
| 462 | - }elseif($target_url){
|
|
| 462 | + }elseif ($target_url) {
|
|
| 463 | 463 | //submit value by get method |
| 464 | 464 | echo("var date_selected = yvalue + \"-\" + mvalue + \"-\" + dvalue;\n");
|
| 465 | 465 | echo("window.parent.location.href='".$target_url."?".$objname."='+date_selected;\n");
|
@@ -474,25 +474,25 @@ discard block |
||
| 474 | 474 | <body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> |
| 475 | 475 | <span id="calendar-page" class="font"> |
| 476 | 476 | <div id="calendar-header" align="center"> |
| 477 | - <?php if($show_calendar_info) include("calendar_info.php"); ?>
|
|
| 478 | - <?php if($dp && !$auto_hide){ ?>
|
|
| 477 | + <?php if ($show_calendar_info) include("calendar_info.php"); ?>
|
|
| 478 | + <?php if ($dp && !$auto_hide) { ?>
|
|
| 479 | 479 | <div style="float: right;" class="closeme"><a href="javascript:closeMe();"><img src="images/close.gif" border="0" alt="Close" title="Close" /></a></div> |
| 480 | 480 | <?php } ?> |
| 481 | 481 | |
| 482 | 482 | <?php |
| 483 | - if(sizeof($cobj->warning_msgs)>0){
|
|
| 483 | + if (sizeof($cobj->warning_msgs)>0) {
|
|
| 484 | 484 | echo("<div id=\"calendar-alert\">".implode(", ", $cobj->warning_msgs)."</div>");
|
| 485 | 485 | } |
| 486 | 486 | ?> |
| 487 | 487 | |
| 488 | - <form id="calendarform" name="calendarform" method="post" action="<?php echo($thispage);?>"> |
|
| 488 | + <form id="calendarform" name="calendarform" method="post" action="<?php echo($thispage); ?>"> |
|
| 489 | 489 | <table align="center" cellpadding="1" cellspacing="0"> |
| 490 | 490 | <tr> |
| 491 | 491 | <td align="right"><select name="m" onchange="javascript:submitCalendar();" class="font"> |
| 492 | 492 | <?php |
| 493 | 493 | $monthnames = $cobj->getMonthNames(); |
| 494 | - for($f=1; $f<=sizeof($monthnames); $f++){
|
|
| 495 | - $selected = ($f == (int)$m) ? " selected='selected'" : ""; |
|
| 494 | + for ($f = 1; $f<=sizeof($monthnames); $f++) {
|
|
| 495 | + $selected = ($f == (int) $m) ? " selected='selected'" : ""; |
|
| 496 | 496 | echo("<option value=\"".str_pad($f, 2, "0", STR_PAD_LEFT)."\"".$selected.">".$monthnames[$f-1]."</option>");
|
| 497 | 497 | } |
| 498 | 498 | ?> |
@@ -501,7 +501,7 @@ discard block |
||
| 501 | 501 | $thisyear = $cdate->getDate('Y');
|
| 502 | 502 | |
| 503 | 503 | //write year options |
| 504 | - for($year=$year_end; $year>=$year_start; $year--){
|
|
| 504 | + for ($year = $year_end; $year>=$year_start; $year--) {
|
|
| 505 | 505 | $selected = ($year == $y) ? " selected='selected'" : ""; |
| 506 | 506 | echo("<option value=\"".$year."\"".$selected.">".$year."</option>");
|
| 507 | 507 | } |
@@ -510,44 +510,44 @@ discard block |
||
| 510 | 510 | </td> |
| 511 | 511 | </tr> |
| 512 | 512 | </table> |
| 513 | - <input name="selected_day" type="hidden" id="selected_day" value="<?php echo($sld);?>" /> |
|
| 514 | - <input name="selected_month" type="hidden" id="selected_month" value="<?php echo($slm);?>" /> |
|
| 515 | - <input name="selected_year" type="hidden" id="selected_year" value="<?php echo($sly);?>" /> |
|
| 516 | - <input name="year_start" type="hidden" id="year_start" value="<?php echo($cobj->year_start_input);?>" /> |
|
| 517 | - <input name="year_end" type="hidden" id="year_end" value="<?php echo($cobj->year_end_input);?>" /> |
|
| 518 | - <input name="objname" type="hidden" id="objname" value="<?php echo($objname);?>" /> |
|
| 519 | - <input name="dp" type="hidden" id="dp" value="<?php echo($dp);?>" /> |
|
| 520 | - |
|
| 521 | - <input name="da1" type="hidden" id="da1" value="<?php echo($time_allow1);?>" /> |
|
| 522 | - <input name="da2" type="hidden" id="da2" value="<?php echo($time_allow2);?>" /> |
|
| 523 | - <input name="sna" type="hidden" id="sna" value="<?php echo($show_not_allow);?>" /> |
|
| 524 | - <input name="aut" type="hidden" id="aut" value="<?php echo($auto_submit);?>" /> |
|
| 525 | - <input name="frm" type="hidden" id="frm" value="<?php echo($form_name);?>" /> |
|
| 526 | - <input name="tar" type="hidden" id="tar" value="<?php echo($target_url);?>" /> |
|
| 527 | - <input name="inp" type="hidden" id="inp" value="<?php echo($show_input);?>" /> |
|
| 528 | - <input name="fmt" type="hidden" id="fmt" value="<?php echo($date_format);?>" /> |
|
| 529 | - <input name="dis" type="hidden" id="dis" value="<?php echo($dsb_txt);?>" /> |
|
| 530 | - |
|
| 531 | - <input name="pr1" type="hidden" id="pr1" value="<?php echo($date_pair1);?>" /> |
|
| 532 | - <input name="pr2" type="hidden" id="pr2" value="<?php echo($date_pair2);?>" /> |
|
| 533 | - <input name="prv" type="hidden" id="prv" value="<?php echo($date_pair_value);?>" /> |
|
| 534 | - <input name="pth" type="hidden" id="pth" value="<?php echo($path);?>" /> |
|
| 535 | - |
|
| 536 | - <input name="spd" type="hidden" id="spd" value="<?php echo(htmlspecialchars($cobj->check_json_encode($sp_dates), ENT_QUOTES));?>" /> |
|
| 537 | - <input name="spt" type="hidden" id="spt" value="<?php echo($sp_type);?>" /> |
|
| 538 | - |
|
| 539 | - <input name="och" type="hidden" id="och" value="<?php echo(urldecode($tc_onchanged));?>" /> |
|
| 540 | - |
|
| 541 | - <input name="str" type="hidden" id="str" value="<?php echo($startDate);?>" /> |
|
| 542 | - <input name="rtl" type="hidden" id="rtl" value="<?php echo($rtl);?>" /> |
|
| 543 | - <input name="wks" type="hidden" id="wks" value="<?php echo($show_weeks);?>" /> |
|
| 544 | - <input name="int" type="hidden" id="int" value="<?php echo($interval);?>" /> |
|
| 545 | - |
|
| 546 | - <input name="hid" type="hidden" id="hid" value="<?php echo($auto_hide);?>" /> |
|
| 547 | - <input name="hdt" type="hidden" id="hdt" value="<?php echo($auto_hide_time);?>" /> |
|
| 548 | - |
|
| 549 | - <input name="tmz" type="hidden" id="tmz" value="<?php echo($timezone);?>" /> |
|
| 550 | - <input name="thm" type="hidden" id="thm" value="<?php echo($theme);?>" /> |
|
| 513 | + <input name="selected_day" type="hidden" id="selected_day" value="<?php echo($sld); ?>" /> |
|
| 514 | + <input name="selected_month" type="hidden" id="selected_month" value="<?php echo($slm); ?>" /> |
|
| 515 | + <input name="selected_year" type="hidden" id="selected_year" value="<?php echo($sly); ?>" /> |
|
| 516 | + <input name="year_start" type="hidden" id="year_start" value="<?php echo($cobj->year_start_input); ?>" /> |
|
| 517 | + <input name="year_end" type="hidden" id="year_end" value="<?php echo($cobj->year_end_input); ?>" /> |
|
| 518 | + <input name="objname" type="hidden" id="objname" value="<?php echo($objname); ?>" /> |
|
| 519 | + <input name="dp" type="hidden" id="dp" value="<?php echo($dp); ?>" /> |
|
| 520 | + |
|
| 521 | + <input name="da1" type="hidden" id="da1" value="<?php echo($time_allow1); ?>" /> |
|
| 522 | + <input name="da2" type="hidden" id="da2" value="<?php echo($time_allow2); ?>" /> |
|
| 523 | + <input name="sna" type="hidden" id="sna" value="<?php echo($show_not_allow); ?>" /> |
|
| 524 | + <input name="aut" type="hidden" id="aut" value="<?php echo($auto_submit); ?>" /> |
|
| 525 | + <input name="frm" type="hidden" id="frm" value="<?php echo($form_name); ?>" /> |
|
| 526 | + <input name="tar" type="hidden" id="tar" value="<?php echo($target_url); ?>" /> |
|
| 527 | + <input name="inp" type="hidden" id="inp" value="<?php echo($show_input); ?>" /> |
|
| 528 | + <input name="fmt" type="hidden" id="fmt" value="<?php echo($date_format); ?>" /> |
|
| 529 | + <input name="dis" type="hidden" id="dis" value="<?php echo($dsb_txt); ?>" /> |
|
| 530 | + |
|
| 531 | + <input name="pr1" type="hidden" id="pr1" value="<?php echo($date_pair1); ?>" /> |
|
| 532 | + <input name="pr2" type="hidden" id="pr2" value="<?php echo($date_pair2); ?>" /> |
|
| 533 | + <input name="prv" type="hidden" id="prv" value="<?php echo($date_pair_value); ?>" /> |
|
| 534 | + <input name="pth" type="hidden" id="pth" value="<?php echo($path); ?>" /> |
|
| 535 | + |
|
| 536 | + <input name="spd" type="hidden" id="spd" value="<?php echo(htmlspecialchars($cobj->check_json_encode($sp_dates), ENT_QUOTES)); ?>" /> |
|
| 537 | + <input name="spt" type="hidden" id="spt" value="<?php echo($sp_type); ?>" /> |
|
| 538 | + |
|
| 539 | + <input name="och" type="hidden" id="och" value="<?php echo(urldecode($tc_onchanged)); ?>" /> |
|
| 540 | + |
|
| 541 | + <input name="str" type="hidden" id="str" value="<?php echo($startDate); ?>" /> |
|
| 542 | + <input name="rtl" type="hidden" id="rtl" value="<?php echo($rtl); ?>" /> |
|
| 543 | + <input name="wks" type="hidden" id="wks" value="<?php echo($show_weeks); ?>" /> |
|
| 544 | + <input name="int" type="hidden" id="int" value="<?php echo($interval); ?>" /> |
|
| 545 | + |
|
| 546 | + <input name="hid" type="hidden" id="hid" value="<?php echo($auto_hide); ?>" /> |
|
| 547 | + <input name="hdt" type="hidden" id="hdt" value="<?php echo($auto_hide_time); ?>" /> |
|
| 548 | + |
|
| 549 | + <input name="tmz" type="hidden" id="tmz" value="<?php echo($timezone); ?>" /> |
|
| 550 | + <input name="thm" type="hidden" id="thm" value="<?php echo($theme); ?>" /> |
|
| 551 | 551 | |
| 552 | 552 | <!-- focus var //--> |
| 553 | 553 | <input name="fcs" type="hidden" id="fcs" value="0" /> |
@@ -564,15 +564,15 @@ discard block |
||
| 564 | 564 | if ($show_weeks) echo("<td align=\"center\" class=\"header wk-hdr\"><div>".$cobj->week_hdr."</div></td>");
|
| 565 | 565 | |
| 566 | 566 | //write calendar day header |
| 567 | - foreach($day_headers as $dh){
|
|
| 567 | + foreach ($day_headers as $dh) {
|
|
| 568 | 568 | echo("<td align=\"center\" class=\"header\"><div>".$dh."</div></td>");
|
| 569 | 569 | } |
| 570 | 570 | echo("</tr>");
|
| 571 | 571 | |
| 572 | - for($row=0; $row<sizeof($calendar_rows); $row++){
|
|
| 572 | + for ($row = 0; $row<sizeof($calendar_rows); $row++) {
|
|
| 573 | 573 | echo("<tr>");
|
| 574 | 574 | |
| 575 | - if ($show_weeks){
|
|
| 575 | + if ($show_weeks) {
|
|
| 576 | 576 | asort($week_rows[$row]); |
| 577 | 577 | |
| 578 | 578 | //get week number with highest member |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | echo("<td align=\"center\" class=\"wk\"><div>".$cw_keys[(sizeof($cw_keys)-1)]."</div></td>");
|
| 582 | 582 | } |
| 583 | 583 | |
| 584 | - foreach($calendar_rows[$row] as $column){
|
|
| 584 | + foreach ($calendar_rows[$row] as $column) {
|
|
| 585 | 585 | $this_day = isset($column[0]) ? $column[0] : ""; |
| 586 | 586 | $this_link = isset($column[1]) ? $column[1] : ""; |
| 587 | 587 | $this_class = isset($column[2]) ? $column[2] : ""; |
@@ -589,9 +589,9 @@ discard block |
||
| 589 | 589 | |
| 590 | 590 | $id_str = ($this_id) ? " id=\"".$this_id."\"" : ""; |
| 591 | 591 | |
| 592 | - if($this_link){
|
|
| 592 | + if ($this_link) {
|
|
| 593 | 593 | echo("<td".$id_str." align=\"center\" class=\"".$this_class."\"><div><a href=\"".$this_link."\">".$this_day."</a></div></td>");
|
| 594 | - }else{
|
|
| 594 | + }else {
|
|
| 595 | 595 | echo("<td".$id_str." align=\"center\" class=\"".$this_class."\"><div>".$this_day."</div></td>");
|
| 596 | 596 | } |
| 597 | 597 | } |
@@ -602,21 +602,21 @@ discard block |
||
| 602 | 602 | </div> |
| 603 | 603 | |
| 604 | 604 | <?php |
| 605 | - if(($previous_year >= $year_start || $next_year <= $year_end) && ($show_previous || $show_next)){
|
|
| 605 | + if (($previous_year>=$year_start || $next_year<=$year_end) && ($show_previous || $show_next)) {
|
|
| 606 | 606 | ?> |
| 607 | 607 | <div id="calendar-footer"> |
| 608 | 608 | <div style="float: <?php echo($rtl ? "right" : "left"); ?>;" class="btn"> |
| 609 | 609 | <?php |
| 610 | - if($previous_year >= $year_start && $show_previous){
|
|
| 611 | - ?><a href="javascript:move('<?php echo(str_pad($previous_month, 2, "0", STR_PAD_LEFT));?>', '<?php echo($previous_year);?>');"><img src="images/btn_<?php echo($rtl ? "next" : "previous"); ?>.gif" width="16" height="16" border="0" alt="Previous" title="Previous" /></a>
|
|
| 610 | + if ($previous_year>=$year_start && $show_previous) {
|
|
| 611 | + ?><a href="javascript:move('<?php echo(str_pad($previous_month, 2, "0", STR_PAD_LEFT)); ?>', '<?php echo($previous_year); ?>');"><img src="images/btn_<?php echo($rtl ? "next" : "previous"); ?>.gif" width="16" height="16" border="0" alt="Previous" title="Previous" /></a>
|
|
| 612 | 612 | <?php |
| 613 | 613 | }else echo(" ");
|
| 614 | 614 | ?> |
| 615 | 615 | </div> |
| 616 | 616 | <div style="float: <?php echo($rtl ? "left" : "right"); ?>;" class="btn"> |
| 617 | 617 | <?php |
| 618 | - if($next_year <= $year_end && $show_next){
|
|
| 619 | - ?><a href="javascript:move('<?php echo(str_pad($next_month, 2, "0", STR_PAD_LEFT));?>', '<?php echo($next_year);?>');"><img src="images/btn_<?php echo($rtl ? "previous" : "next"); ?>.gif" width="16" height="16" border="0" alt="Next" title="Next" /></a>
|
|
| 618 | + if ($next_year<=$year_end && $show_next) {
|
|
| 619 | + ?><a href="javascript:move('<?php echo(str_pad($next_month, 2, "0", STR_PAD_LEFT)); ?>', '<?php echo($next_year); ?>');"><img src="images/btn_<?php echo($rtl ? "previous" : "next"); ?>.gif" width="16" height="16" border="0" alt="Next" title="Next" /></a>
|
|
| 620 | 620 | <?php |
| 621 | 621 | }else echo(" ");
|
| 622 | 622 | ?> |
@@ -625,13 +625,13 @@ discard block |
||
| 625 | 625 | <?php |
| 626 | 626 | $footer_links = array(); |
| 627 | 627 | |
| 628 | - if($cobj->validTodayDate() && ($m != $cdate->getDate('m') || $y != $cdate->getDate('Y')))
|
|
| 628 | + if ($cobj->validTodayDate() && ($m != $cdate->getDate('m') || $y != $cdate->getDate('Y')))
|
|
| 629 | 629 | $footer_links[] = "<a href=\"javascript:today();\" class=\"txt\" alt=\"Today\" title=\"Today\">Today</a>"; |
| 630 | 630 | |
| 631 | - if($sld>0 && $slm>0 && $sly>0) |
|
| 631 | + if ($sld>0 && $slm>0 && $sly>0) |
|
| 632 | 632 | $footer_links[] = "<a href=\"javascript:unsetValue();\" class=\"txt\" alt=\"Unset\" title=\"Unset\">Unset</a>"; |
| 633 | 633 | |
| 634 | - if(sizeof($footer_links)>0){
|
|
| 634 | + if (sizeof($footer_links)>0) {
|
|
| 635 | 635 | echo(implode(" | ", $footer_links));
|
| 636 | 636 | } |
| 637 | 637 | ?> |
@@ -1,16 +1,16 @@ discard block |
||
| 1 | 1 | #!/usr/bin/php |
| 2 | 2 | <?php |
| 3 | 3 | /* Config */ |
| 4 | -$path='/web/RBL/'; |
|
| 4 | +$path = '/web/RBL/'; |
|
| 5 | 5 | include_once($path.'config.php'); |
| 6 | 6 | require_once($path.'function.php'); |
| 7 | -if ( !isset($version) ) { |
|
| 7 | +if (!isset($version)) { |
|
| 8 | 8 | openlog('myRBLemergency', LOG_PID, LOG_LOCAL0); |
| 9 | - syslog (LOG_EMERG, 'unknown: I can\'t read the config files. Do you have configured the $path in getip.php?'); |
|
| 9 | + syslog(LOG_EMERG, 'unknown: I can\'t read the config files. Do you have configured the $path in getip.php?'); |
|
| 10 | 10 | closelog(); |
| 11 | 11 | exit(255); |
| 12 | 12 | } |
| 13 | -include_once(dirname(__FILE__) . '/function.php'); |
|
| 13 | +include_once(dirname(__FILE__).'/function.php'); |
|
| 14 | 14 | $conf = parse_ini_file($confImap_file); |
| 15 | 15 | |
| 16 | 16 | |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | openlog($tag, LOG_PID, $fac); |
| 20 | 20 | |
| 21 | 21 | |
| 22 | -if ( !$imapListActive ) { |
|
| 23 | - syslog (LOG_INFO, $conf['user'].': This plugin isn\'t active.'); |
|
| 22 | +if (!$imapListActive) { |
|
| 23 | + syslog(LOG_INFO, $conf['user'].': This plugin isn\'t active.'); |
|
| 24 | 24 | closelog(); |
| 25 | 25 | exit(255); |
| 26 | 26 | } |
@@ -31,20 +31,20 @@ discard block |
||
| 31 | 31 | $arr_tpl_data = array(date("Y-m-d", time())); |
| 32 | 32 | |
| 33 | 33 | |
| 34 | -if ( !$conf['onlyReport'] ) { |
|
| 34 | +if (!$conf['onlyReport']) { |
|
| 35 | 35 | |
| 36 | 36 | /* check you select a right list */ |
| 37 | - if ( !$tables[$conf['list']['spam']]['bl'] ) { |
|
| 37 | + if (!$tables[$conf['list']['spam']]['bl']) { |
|
| 38 | 38 | syslog(LOG_EMERG, $conf['user'].': <'.$conf['list']['spam'].'> is not a blocklist. Are you stupid? Do you want to whitelist a spammer? I refuse to continue.'); |
| 39 | 39 | exit (254); |
| 40 | 40 | } |
| 41 | - if ( $tables[$conf['list']['ham']]['bl'] ) { |
|
| 41 | + if ($tables[$conf['list']['ham']]['bl']) { |
|
| 42 | 42 | syslog(LOG_EMERG, $conf['user'].': <'.$conf['list']['ham'].'> is a blocklist. Are you stupid? Do you want to block a legitimate sender? I refuse to continue.'); |
| 43 | 43 | exit (254); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | /* Make MYSQL connection Array */ |
| 47 | - $mysqlconf= array( |
|
| 47 | + $mysqlconf = array( |
|
| 48 | 48 | 'dbhost' => $dbhost, |
| 49 | 49 | 'userdb' => $userdb, |
| 50 | 50 | 'pwd' => $pwd, |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | else { |
| 57 | 57 | $mysqlconf = NULL; |
| 58 | - syslog(LOG_INFO, $conf['user'].': Report only, no listing activated in configuration.') ; |
|
| 58 | + syslog(LOG_INFO, $conf['user'].': Report only, no listing activated in configuration.'); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -67,16 +67,16 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | |
| 69 | 69 | /* The hard work has hidden in imapReport */ |
| 70 | -$learnfromArray = array('ham','spam'); |
|
| 71 | -foreach ( $learnfromArray as $learnfrom ) { |
|
| 70 | +$learnfromArray = array('ham', 'spam'); |
|
| 71 | +foreach ($learnfromArray as $learnfrom) { |
|
| 72 | 72 | $conf['reportFile']["$learnfrom"] = str_replace($arr_tpl_vars, $arr_tpl_data, $conf['reportFile']["$learnfrom"]); |
| 73 | 73 | $conf['badreportFile']["$learnfrom"] = str_replace($arr_tpl_vars, $arr_tpl_data, $conf['badreportFile']["$learnfrom"]); |
| 74 | - imapReport ($conf,$mysqlconf,$splservice,$tables,$learnfrom); |
|
| 74 | + imapReport($conf, $mysqlconf, $splservice, $tables, $learnfrom); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | -if ( !$conf['onlyReport'] ) { |
|
| 77 | +if (!$conf['onlyReport']) { |
|
| 78 | 78 | /* Close connection */ |
| 79 | - syslog (LOG_INFO, $conf['user'].': Successfully end of session.'); |
|
| 79 | + syslog(LOG_INFO, $conf['user'].': Successfully end of session.'); |
|
| 80 | 80 | } |
| 81 | 81 | closelog(); |
| 82 | 82 | ?> |
@@ -15,15 +15,15 @@ |
||
| 15 | 15 | openlog($tag, LOG_PID, $fac); |
| 16 | 16 | $mysqli = new mysqli($dbhost, $userdb, $pwd, $db, $dbport); |
| 17 | 17 | if ($mysqli->connect_error) { |
| 18 | - syslog (LOG_EMERG, $user.': Connect Error (' . $mysqli->connect_errno . ') ' |
|
| 18 | + syslog(LOG_EMERG, $user.': Connect Error ('.$mysqli->connect_errno.') ' |
|
| 19 | 19 | . $mysqli->connect_error); |
| 20 | - die($user.': Connect Error (' . $mysqli->connect_errno . ') ' |
|
| 20 | + die($user.': Connect Error ('.$mysqli->connect_errno.') ' |
|
| 21 | 21 | . $mysqli->connect_error); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -syslog (LOG_INFO, $user.': Successfully connected to ' . $mysqli->host_info ); |
|
| 24 | +syslog(LOG_INFO, $user.': Successfully connected to '.$mysqli->host_info); |
|
| 25 | 25 | |
| 26 | -expire($mysqli,$user,$tables,$expireTime); |
|
| 26 | +expire($mysqli, $user, $tables, $expireTime); |
|
| 27 | 27 | $mysqli->close(); |
| 28 | 28 | closelog(); |
| 29 | 29 | ?> |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | require_once('config.php'); |
| 3 | 3 | require_once('function.php'); |
| 4 | -$typedesc=$_POST['type']; |
|
| 4 | +$typedesc = $_POST['type']; |
|
| 5 | 5 | $type = $tables["$typedesc"]['field']; |
| 6 | 6 | $table = $tables["$typedesc"]['name']; |
| 7 | 7 | ?> |
@@ -11,14 +11,14 @@ discard block |
||
| 11 | 11 | $user = username(); |
| 12 | 12 | $mysqli = new mysqli($dbhost, $userdb, $pwd, $db, $dbport); |
| 13 | 13 | if ($mysqli->connect_error) { |
| 14 | - syslog (LOG_EMERG, $user.': Connect Error (' . $mysqli->connect_errno . ') ' |
|
| 14 | + syslog(LOG_EMERG, $user.': Connect Error ('.$mysqli->connect_errno.') ' |
|
| 15 | 15 | . $mysqli->connect_error); |
| 16 | - exit ($user.': Connect Error (' . $mysqli->connect_errno . ') ' |
|
| 16 | + exit ($user.': Connect Error ('.$mysqli->connect_errno.') ' |
|
| 17 | 17 | . $mysqli->connect_error); |
| 18 | 18 | } |
| 19 | -syslog(LOG_INFO, $user.': Successfully connected to ' . $mysqli->host_info) ; |
|
| 19 | +syslog(LOG_INFO, $user.': Successfully connected to '.$mysqli->host_info); |
|
| 20 | 20 | |
| 21 | -if (changestatus($mysqli,username(),$_POST['value'],'0',$type,$table)) |
|
| 21 | +if (changestatus($mysqli, username(), $_POST['value'], '0', $type, $table)) |
|
| 22 | 22 | print 'OK '.$_POST["type"].' <'.$_POST['value'].'> delisted.'; |
| 23 | 23 | else |
| 24 | 24 | print 'ERROR in delist <'.$_POST['value'].'>; check log'; |
@@ -1,9 +1,9 @@ |
||
| 1 | 1 | <?php |
| 2 | - $typedesc=$_POST["typedesc"]; |
|
| 2 | + $typedesc = $_POST["typedesc"]; |
|
| 3 | 3 | $type = $tables["$typedesc"]['field']; |
| 4 | 4 | $table = $tables["$typedesc"]['name']; |
| 5 | 5 | $adm = unserialize($_POST["adm"]); |
| 6 | - if (in_array($_POST["user"],array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>'; |
|
| 6 | + if (in_array($_POST["user"], array_keys(array_filter($adm)))) $extopt = '<option value="MONTH">MONTHS</option><option value="YEAR">YEARS</option>'; |
|
| 7 | 7 | else $extopt = NULL; |
| 8 | 8 | ?> |
| 9 | 9 | |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | <h1> DNSBL Lookup</h1> |
| 12 | 12 | <?php |
| 13 | 13 | |
| 14 | -$_POST['Value'] = str_replace('_','.',array_keys($_GET)[0]); |
|
| 14 | +$_POST['Value'] = str_replace('_', '.', array_keys($_GET)[0]); |
|
| 15 | 15 | $_POST['genere'] = 'Spam IP'; |
| 16 | 16 | require_once('result.php'); |
| 17 | 17 | ?> |