Empty commit

This commit is contained in:
Git 2013-12-15 08:00:49 +00:00
parent 9fd752b9fb
commit 3cdb1222f1
6 changed files with 1310 additions and 35 deletions

View File

@ -188,4 +188,18 @@ function validDate($DateString) {
list($Y, $M, $D) = $SplitDate;
return checkDate($M, $D, $Y);
}
function is_valid_date($Date) {
return is_valid_datetime($Date, 'Y-m-d');
}
function is_valid_time($Time) {
return is_valid_datetime($Time, 'H:i');
}
function is_valid_datetime($DateTime, $Format = 'Y-m-d H:i') {
$FormattedDateTime = DateTime::createFromFormat($Format, $DateTime);
return $FormattedDateTime && $FormattedDateTime->format($Format) == $DateTime;
}
?>

View File

@ -1,5 +1,8 @@
CHANGE LOG
2013-12-15 by Ajax
Introduced datetime picker JS, changed date picker in forum search, added date and time validation functions. Also proving a point.
2013-12-12 by Y
Transform Text into a static class

View File

@ -21,37 +21,17 @@
$ThreadAfterDate = db_string($_GET['thread_created_after']);
$ThreadBeforeDate = db_string($_GET['thread_created_before']);
$ThreadAfterDateDisplay = '';
$ThreadBeforeDateDisplay = '';
if (!empty($ThreadAfterDate) && !is_date($ThreadAfterDate)) {
error('Incorrect topic after date format');
} elseif (!empty($ThreadAfterDate)) {
$ThreadAfterDateDisplay = "value='" . date('Y-m-d', strtotime($ThreadAfterDate)) . "'";
}
if (!empty($ThreadBeforeDate) && !is_date($ThreadBeforeDate)) {
error('Incorrect topic before date format');
} elseif (!empty($ThreadBeforeDate)) {
$ThreadBeforeDateDisplay = "value='" . date('Y-m-d', strtotime($ThreadBeforeDate)) . "'";
if ((!empty($ThreadAfterDate) && !is_valid_date($ThreadAfterDate)) || (!empty($ThreadBeforeDate) && !is_valid_date($ThreadBeforeDate))) {
error("Incorrect topic created date");
}
$PostAfterDate = db_string($_GET['post_created_after']);
$PostBeforeDate = db_string($_GET['post_created_before']);
$PostAfterDateDisplay = '';
$PostBeforeDateDisplay = '';
if (!empty($PostAfterDate) && !is_date($PostAfterDate)) {
error('Incorrect post after date format');
} elseif (!empty($PostAfterDate)) {
$PostAfterDateDisplay = "value='" . date('Y-m-d', strtotime($PostAfterDate)) . "'";
if ((!empty($PostAfterDate) && !is_valid_date($PostAfterDate)) || (!empty($PostBeforeDate) && !is_valid_date($PostBeforeDate))) {
error("Incorrect post created date");
}
if (!empty($PostBeforeDate) && !is_date($PostBeforeDate)) {
error('Incorrect post before date format');
} elseif (!empty($PostBeforeDate)) {
$PostBeforeDateDisplay = "value='" . date('Y-m-d', strtotime($PostBeforeDate)) . "'";
}
// Searching for posts by a specific user
if (!empty($_GET['user'])) {
@ -75,11 +55,11 @@
$ForumArray = array();
foreach ($_GET['forums'] as $Forum) {
if (is_number($Forum)) {
$ForumArray[]=$Forum;
$ForumArray[] = $Forum;
}
}
if (count($ForumArray) > 0) {
$SearchForums = implode(', ',$ForumArray);
$SearchForums = implode(', ', $ForumArray);
}
}
@ -91,8 +71,8 @@
SELECT
Title
FROM forums_topics AS t
JOIN forums AS f ON f.ID=t.ForumID
WHERE t.ID=$ThreadID
JOIN forums AS f ON f.ID = t.ForumID
WHERE t.ID = $ThreadID
AND " . Forums::user_forums_sql();
$DB->query($SQL);
if (list($Title) = $DB->next_record()) {
@ -105,7 +85,7 @@
}
// Let's hope we got some results - start printing out the content.
View::show_header('Forums > Search', 'bbcode,forum_search');
View::show_header('Forums > Search', 'bbcode,forum_search,datetime_picker', 'datetime_picker');
?>
<div class="thin">
<div class="header">
@ -130,9 +110,9 @@
<td><strong>Topic created:</strong></td>
<td>
After:
<input type="date" name="thread_created_after" id="thread_created_after" <?=$ThreadAfterDateDisplay?>/>
<input type="text" class="date_picker" name="thread_created_after" id="thread_created_after" value="<?=$ThreadAfterDate?>" />
Before:
<input type="date" name="thread_created_before" id="thread_created_before" <?=$ThreadBeforeDateDisplay?> />
<input type="text" class="date_picker" name="thread_created_before" id="thread_created_before" value="<?=$ThreadBeforeDate?>" />
</td>
</tr>
<?
@ -141,9 +121,9 @@
<tr>
<td><strong>Search in:</strong></td>
<td>
<input type="radio" name="type" id="type_title" value="title" <? if ($Type == 'title') { echo 'checked="checked" '; } ?>/>
<input type="radio" name="type" id="type_title" value="title"<? if ($Type == 'title') { echo ' checked="checked"'; } ?> />
<label for="type_title">Titles</label>
<input type="radio" name="type" id="type_body" value="body" <? if ($Type == 'body') { echo 'checked="checked" '; } ?>/>
<input type="radio" name="type" id="type_body" value="body"<? if ($Type == 'body') { echo ' checked="checked"'; } ?> />
<label for="type_body">Post bodies</label>
</td>
</tr>
@ -151,9 +131,9 @@
<td><strong>Post created:</strong></td>
<td>
After:
<input type="date" name="post_created_after" id="post_created_after" <?=$PostAfterDateDisplay?>/>
<input type="text" class="date_picker" name="post_created_after" id="post_created_after" value="<?=$PostAfterDate?>" />
Before:
<input type="date" name="post_created_before" id="post_created_before" <?=$PostBeforeDateDisplay?> />
<input type="text" class="date_picker" name="post_created_before" id="post_created_before" value="<?=$PostBeforeDate?>" />
</td>
</tr>
<tr>

View File

@ -0,0 +1,20 @@
var dateFormat = 'Y-m-d';
var timeFormat = 'H:i';
var timeStep = 15;
$(document).ready(function() {
$.getScript("static/functions/jquery.datetimepicker.js", function() {
$(".date_picker").datetimepicker({
timepicker: false,
format: dateFormat,
});
$(".datetime_picker").datetimepicker({
format: dateFormat,
step: timeStep
});
$(".time_picker").datetimepicker({
format: timeFormat,
datepicker: false,
step: timeStep
});
});
});

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,275 @@
.xdsoft_datetimepicker{
box-shadow: 0px 5px 15px -5px rgba(0, 0, 0, 0.506);
background: #FFFFFF;
border-bottom: 1px solid #BBBBBB;
border-left: 1px solid #CCCCCC;
border-right: 1px solid #CCCCCC;
border-top: 1px solid #CCCCCC;
color: #333333;
display: block;
font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif;
padding: 8px;
padding-left: 0px;
padding-top: 2px;
position: absolute;
z-index: 9999;
box-sizing: border-box;
display:none;
}
.xdsoft_noselect{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.xdsoft_noselect::selection { background: transparent; }
.xdsoft_noselect::-moz-selection { background: transparent; }
.xdsoft_datetimepicker.xdsoft_inline{
display: inline-block;
position: static;
box-shadow: none;
}
.xdsoft_datetimepicker *{
-moz-box-sizing: border-box;
box-sizing: border-box;
padding:0px;
margin:0px;
}
.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker{
display:none;
}
.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active{
display:block;
}
.xdsoft_datetimepicker .xdsoft_datepicker{
width: 224px;
float:left;
margin-left:8px;
}
.xdsoft_datetimepicker .xdsoft_timepicker{
width: 58px;
float:left;
text-align:center;
margin-left:8px;
margin-top:0px;
}
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{
margin-top:8px;
}
.xdsoft_datetimepicker .xdsoft_mounthpicker{
position: relative;
text-align: center;
}
.xdsoft_datetimepicker .xdsoft_prev, .xdsoft_datetimepicker .xdsoft_next{
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAAAeCAYAAACR82geAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJ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dbraWXjHQPAokfVHCQWbL1mFgcLfNVmDgWKBR4oFHgQFHmnBYIeWgBRbAg4OabUE2LGJJMUmEltRrjh2wBaUK8LkcOjqg6oUjmhkYnXm24wq7qdoyO5vIv29ksM4zI7xFmAAj1yMVcKZ+nYAAAAASUVORK5CYII=');
}
.xdsoft_datetimepicker .xdsoft_prev{
float: left;
background-position:-20px 0px;
}
.xdsoft_datetimepicker .xdsoft_next{
float: right;
background-position:0px 0px;
}
.xdsoft_datetimepicker .xdsoft_next:active,.xdsoft_datetimepicker .xdsoft_prev:active{
}
.xdsoft_datetimepicker .xdsoft_next,.xdsoft_datetimepicker .xdsoft_prev {
background-color: transparent;
background-repeat: no-repeat;
border: 0px none currentColor;
cursor: pointer;
display: block;
height: 30px;
opacity: 0.5;
outline: medium none currentColor;
overflow: hidden;
padding: 0px;
position: relative;
text-indent: 100%;
white-space: nowrap;
width: 20px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next{
float:none;
background-position:-40px -15px;
height: 15px;
width: 30px;
display: block;
margin-left:14px;
margin-top:7px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev{
background-position:-40px 0px;
margin-bottom:7px;
margin-top:0px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box{
height:151px;
overflow:hidden;
border-bottom:1px solid #DDDDDD;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div{
background: #F5F5F5;
border-top:1px solid #DDDDDD;
color: #666666;
font-size: 12px;
text-align: center;
border-collapse:collapse;
cursor:pointer;
border-bottom-width:0px;
height:25px;
line-height:25px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{
border-top-width:0px;
}
.xdsoft_datetimepicker .xdsoft_next:hover,
.xdsoft_datetimepicker .xdsoft_prev:hover {
opacity: 1;
}
.xdsoft_datetimepicker .xdsoft_label{
display: inline;
position: relative;
z-index: 9999;
margin: 0;
padding: 5px 3px;
font-size: 14px;
line-height: 20px;
font-weight: bold;
background-color: #fff;
float:left;
width:182px;
text-align:center;
cursor:pointer;
}
.xdsoft_datetimepicker .xdsoft_label:hover{
text-decoration:underline;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select{
border:1px solid #ccc;
position:absolute;
display:block;
right:0px;
top:30px;
z-index:101;
display:none;
background:#fff;
max-height:160px;
overflow-y:hidden;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{right:-7px;}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{right:2px;}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{
color: #fff;
background: #ff8000;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option{
padding:2px 10px 2px 5px;
}
.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{
background: #33AAFF;
box-shadow: #178FE5 0px 1px 3px 0px inset;
color:#fff;
font-weight: 700;
}
.xdsoft_datetimepicker .xdsoft_month{
width:114px;
text-align:right;
}
.xdsoft_datetimepicker .xdsoft_calendar{
clear:both;
}
.xdsoft_datetimepicker .xdsoft_year{
width:56px;
}
.xdsoft_datetimepicker .xdsoft_calendar table{
border-collapse:collapse;
width:100%;
}
.xdsoft_datetimepicker .xdsoft_calendar td > div{
padding-right:5px;
}
.xdsoft_datetimepicker .xdsoft_calendar th{
height: 25px;
}
.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th{
width:14.2857142%;
text-align:center;
background: #F5F5F5;
border:1px solid #DDDDDD;
color: #666666;
font-size: 12px;
text-align: right;
padding:0px;
border-collapse:collapse;
cursor:pointer;
height: 25px;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today{
color:#33AAFF;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{
background: #33AAFF;
box-shadow: #178FE5 0px 1px 3px 0px inset;
color:#fff;
font-weight: 700;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month,
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled,
.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled{
opacity:0.5;
}
.xdsoft_datetimepicker .xdsoft_calendar td:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover{
color: #fff !important;
background: #ff8000 !important;
box-shadow: none !important;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover,
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover{
color: inherit !important;
background: inherit !important;
box-shadow: inherit !important;
}
.xdsoft_datetimepicker .xdsoft_calendar th{
font-weight: 700;
text-align: center;
color: #999;
cursor:default;
}
.xdsoft_datetimepicker .xdsoft_copyright{ color:#ccc !important; font-size:10px;clear:both;float:none;margin-left:8px;}
.xdsoft_datetimepicker .xdsoft_copyright a{ color:#eee !important;}
.xdsoft_datetimepicker .xdsoft_copyright a:hover{ color:#aaa !important;}
.xdsoft_time_box{
position:relative;
border:1px solid #ccc;
}
.xdsoft_scrollbar >.xdsoft_scroller{
background:#ccc !important;
height:20px;
border-radius:3px;
}
.xdsoft_scrollbar{
position:absolute;
width:7px;
width:7px;
right:0px;
top:0px;
bottom:0px;
cursor:pointer;
}
.xdsoft_scroller_box{
position:relative;
}