Verified Commit 6188f642 authored by AtjonTV's avatar AtjonTV
Browse files

Release 1.2 (Patch 1)



Signed-off-by: AtjonTV's avatarAtjonTV <thomas.obernosterer@atvg-studios.com>
parent bc39ceb3
......@@ -3,6 +3,15 @@
----
# 1.2
### 1.2.0.1
(02.01.2019)
[Based on OpenCAD 0.2.3.2]
* Add: jsimport for simpler JS imports
* Fix: Show update password dialog
* Fix: Enable missing JS features
* Del: Unused plugin captcha
### 1.2.0.0
(25.11.2018)
[Based on Opencad 0.2.3.2]
......
......@@ -112,7 +112,6 @@ function changePassword()
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASSWORD);
} catch(PDOException $ex)
{
header('Location: '.BASE_URL.'/plugins/error/index.php');
$_SESSION['error_blob'] = $ex;
header('Location: '.BASE_URL.'/plugins/error/index.php');
die();
......@@ -143,12 +142,12 @@ function changePassword()
die();
}
$_SESSION['changePassword'] = '<div class="alert alert-success"><span>Password successfully updated.</span></div>';
$_SESSION['profileUpdate'] = '<div class="alert alert-success"><span>Password successfully updated.</span></div>';
$pdo = null;
sleep(1); //Seconds to wait
echo $_SESSION['changePassword'];
header("Location: ".BASE_URL."/profile.php?changePassword=true");
echo $_SESSION['profileUpdate'];
header("Location: ".BASE_URL."/profile.php");
}
function getRanks()
......
......@@ -132,12 +132,12 @@ function getOpenCADHash()
function getATVGCADVersion()
{
$data['version'] = "1.2.0.0";
$data['version'] = "1.2.0.1";
$out = array();
exec("git log",$out);
$data['build'] = substr($out[0], strlen('commit '));
if(empty($data['build']))
$data['build'] = "511.2307";
$data['build'] = "21.53";
$data['base'] = "0.2.3.2";
return $data;
}
......
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Pluggin QapTcha : captcha system with jQuery</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="jquery/QapTcha.jquery.css" type="text/css" />
<style type="text/css">
form{margin:30px;width:300px}
label{float:left;clear:both;width:100px;margin-top:10px}
input{float:left;margin-top:10px}
.clr{clear:both}
.notice {background-color:#d8e6fc;color:#35517c;border:1px solid #a7c3f0;padding:10px}
.code {
margin:30px;
border:1px solid #F0F0F0;
background-color:#F8F8F8;
padding:10px;
color:#777;
}
</style>
</head>
<body>
<h1>QapTcha Plugin v3.0</h1>
<p><a href="http://www.myjqueryplugins.com/QapTcha">Home Page QapTcha</a></p>
<p><a href="http://www.myjqueryplugins.com/QapTcha/demo">Online Demo QapTcha</a></p>
<?php
// if form is submit
if(isset($_POST['submit']))
{
$response = '<div class="notice">';
if(isset($_POST['iQapTcha']) && empty($_POST['iQapTcha']) && isset($_SESSION['iQaptcha']) && $_SESSION['iQaptcha'])
{
$response .= 'Form can be submited';
unset($_SESSION['iQaptcha']);
}
else
$response .= 'Form can not be submited';
$response .= '</div>';
echo $response;
}
?>
<form method="post" action="">
<fieldset>
<label>First Name</label> <input type="text" name="firstname" />
<label>Last Name</label> <input type="text" name="lastname" />
<div class="clr"></div>
<div class="QapTcha"></div>
<input type="submit" name="submit" value="Submit form" />
</fieldset>
</form>
<div class="code">
<pre>
<?php
echo htmlentities('<!--HTML-->
<form method="post" action="">
<fieldset>
<label>First Name</label> <input type="text" name="firstname" />
<label>Last Name</label> <input type="text" name="lastname" />
<div class="clr"></div>
<!-- Add this line in your form -->
<div class="QapTcha"></div>
<input type="submit" name="submit" value="Submit form" />
</fieldset>
</form>
<!-- JS -->
<script type="text/javascript">
$(document).ready(function(){
$(\'.QapTcha\').QapTcha();
});
</script>');
?>
</pre>
</div>
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jquery-ui.js"></script>
<script type="text/javascript" src="jquery/jquery.ui.touch.js"></script>
<script type="text/javascript" src="jquery/QapTcha.jquery.js"></script>
<script type="text/javascript">
$('.QapTcha').QapTcha({});
</script>
</body>
</html>
/*****************/
/** QapTcha CSS **/
/*****************/
.QapTcha {
padding:10px;
border:1px solid #F4F4F4;
background:url('../images/bg_QapTcha.png') repeat;
margin-top:10px;
}
.QapTcha .clr{clear:both}
.QapTcha #bgSlider {
width:202px;
height:22px;
background:transparent url('../images/sprites.png') no-repeat 0 -22px;
float:left
}
.QapTcha #Slider {
width:48px;
height:22px;
background:transparent url('../images/sprites.png') no-repeat -32px 0;
cursor:e-resize
}
.QapTcha #Icons {
float:left;
width:16px;
height:16px;
background:transparent url('../images/sprites.png') no-repeat 0 0;
margin-top:3px;
margin-left:10px;
}
.QapTcha #TxtStatus {
width:202px;
margin-top:7px;
text-align:center;
font-family:Verdana;
font-size:10px;
clear:both
}
/** States **/
.QapTcha .dropSuccess {
color:#568E2F
}
.QapTcha .dropError {
color:#bb2828
}
\ No newline at end of file
/************************************************************************
*************************************************************************
@Name : QapTcha - jQuery Plugin
@Revison : 3.0
@Date : 20/09/2011
@Author: ALPIXEL - (www.myjqueryplugins.com - www.alpixel.fr)
@License : Open Source - MIT License : http://www.opensource.org/licenses/mit-license.php
**************************************************************************
*************************************************************************/
jQuery.QapTcha = {
build : function(options)
{
var defaults = {
txtLock : 'Locked : form can\'t be submited',
txtUnlock : 'Unlocked : form can be submited',
disabledSubmit : true,
autoRevert : false,
PHPfile : '../admin/plugins/captcha/php/Qaptcha.jquery.php'
};
if(this.length>0)
return jQuery(this).each(function(i) {
/** Vars **/
var
opts = $.extend(defaults, options),
$this = $(this),
form = $('form').has($this),
Clr = jQuery('<div>',{'class':'clr'}),
bgSlider = jQuery('<div>',{id:'bgSlider'}),
Slider = jQuery('<div>',{id:'Slider'}),
Icons = jQuery('<div>',{id:'Icons'}),
TxtStatus = jQuery('<div>',{id:'TxtStatus','class':'dropError',text:opts.txtLock}),
inputQapTcha = jQuery('<input>',{name:'iQapTcha',value:generatePass(),type:'hidden'});
/** Disabled submit button **/
if(opts.disabledSubmit) form.find('input[type=\'submit\']').attr('disabled','disabled');
/** Construct DOM **/
bgSlider.appendTo($this);
Icons.insertAfter(bgSlider);
Clr.insertAfter(Icons);
TxtStatus.insertAfter(Clr);
inputQapTcha.appendTo($this);
Slider.appendTo(bgSlider);
$this.show();
Slider.draggable({
revert: function(){
if(opts.autoRevert)
{
if(parseInt(Slider.css("left")) > 150) return false;
else return true;
}
},
containment: bgSlider,
axis:'x',
stop: function(event,ui){
if(ui.position.left > 150)
{
// set the SESSION iQaptcha in PHP file
$.post(opts.PHPfile,{
action : 'qaptcha'
},
function(data) {
if(!data.error)
{
Slider.draggable('disable').css('cursor','default');
inputQapTcha.val("");
TxtStatus.text(opts.txtUnlock).addClass('dropSuccess').removeClass('dropError');
Icons.css('background-position', '-16px 0');
form.find('input[type=\'submit\']').removeAttr('disabled');
}
},'json');
}
}
});
function generatePass() {
var chars = 'azertyupqsdfghjkmwxcvbn23456789AZERTYUPQSDFGHJKMWXCVBN';
var pass = '';
for(i=0;i<10;i++){
var wpos = Math.round(Math.random()*chars.length);
pass += chars.substring(wpos,wpos+1);
}
return pass;
}
});
}
}; jQuery.fn.QapTcha = jQuery.QapTcha.build;
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
/**
* jQuery.UI.iPad plugin
* Copyright (c) 2010 Stephen von Takach
* licensed under MIT.
* Date: 27/8/2010
*
* Project Home:
* http://code.google.com/p/jquery-ui-for-ipad-and-iphone/
*/
$(function() {
//
// Extend jQuery feature detection
//
$.extend($.support, {
touch: "ontouchend" in document
});
//
// Hook up touch events
//
if ($.support.touch) {
var obj = document.getElementsByClassName('QapTcha');
for(i=0; i<obj.length;i++){
obj[i].addEventListener("touchstart", iPadTouchHandler, false);
obj[i].addEventListener("touchmove", iPadTouchHandler, false);
obj[i].addEventListener("touchend", iPadTouchHandler, false);
obj[i].addEventListener("touchcancel", iPadTouchHandler, false);
}}
});
var lastTap = null; // Holds last tapped element (so we can compare for double tap)
var tapValid = false; // Are we still in the .6 second window where a double tap can occur
var tapTimeout = null; // The timeout reference
function cancelTap() {
tapValid = false;
}
var rightClickPending = false; // Is a right click still feasible
var rightClickEvent = null; // the original event
var holdTimeout = null; // timeout reference
var cancelMouseUp = false; // prevents a click from occuring as we want the context menu
function cancelHold() {
if (rightClickPending) {
window.clearTimeout(holdTimeout);
rightClickPending = false;
rightClickEvent = null;
}
}
function startHold(event) {
if (rightClickPending)
return;
rightClickPending = true; // We could be performing a right click
rightClickEvent = (event.changedTouches)[0];
holdTimeout = window.setTimeout("doRightClick();", 800);
}
function doRightClick() {
rightClickPending = false;
//
// We need to mouse up (as we were down)
//
var first = rightClickEvent,
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent("mouseup", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, 0, null);
first.target.dispatchEvent(simulatedEvent);
//
// emulate a right click
//
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent("mousedown", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, 2, null);
first.target.dispatchEvent(simulatedEvent);
//
// Show a context menu
//
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent("contextmenu", true, true, window, 1, first.screenX + 50, first.screenY + 5, first.clientX + 50, first.clientY + 5,
false, false, false, false, 2, null);
first.target.dispatchEvent(simulatedEvent);
//
// Note:: I don't mouse up the right click here however feel free to add if required
//
cancelMouseUp = true;
rightClickEvent = null; // Release memory
}
//
// mouse over event then mouse down
//
function iPadTouchStart(event) {
var touches = event.changedTouches,
first = touches[0],
type = "mouseover",
simulatedEvent = document.createEvent("MouseEvent");
//
// Mouse over first - I have live events attached on mouse over
//
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, 0, null);
first.target.dispatchEvent(simulatedEvent);
type = "mousedown";
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, 0, null);
first.target.dispatchEvent(simulatedEvent);
if (!tapValid) {
lastTap = first.target;
tapValid = true;
tapTimeout = window.setTimeout("cancelTap();", 600);
startHold(event);
}
else {
window.clearTimeout(tapTimeout);
//
// If a double tap is still a possibility and the elements are the same
// Then perform a double click
//
if (first.target == lastTap) {
lastTap = null;
tapValid = false;
type = "click";
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, 0/*left*/, null);
first.target.dispatchEvent(simulatedEvent);
type = "dblclick";
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, 0/*left*/, null);
first.target.dispatchEvent(simulatedEvent);
}
else {
lastTap = first.target;
tapValid = true;
tapTimeout = window.setTimeout("cancelTap();", 600);
startHold(event);
}
}
}
function iPadTouchHandler(event) {
var type = "",
button = 0; /*left*/
if (event.touches.length > 1)
return;
switch (event.type) {
case "touchstart":
if ($(event.changedTouches[0].target).is("select")) {
return;
}
iPadTouchStart(event); /*We need to trigger two events here to support one touch drag and drop*/
event.preventDefault();
return false;
break;
case "touchmove":
cancelHold();
type = "mousemove";
event.preventDefault();
break;
case "touchend":
if (cancelMouseUp) {
cancelMouseUp = false;
event.preventDefault();
return false;
}
cancelHold();
type = "mouseup";
break;
default:
return;
}
var touches = event.changedTouches,
first = touches[0],
simulatedEvent = document.createEvent("MouseEvent");
simulatedEvent.initMouseEvent(type, true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, button, null);
first.target.dispatchEvent(simulatedEvent);
if (type == "mouseup" && tapValid && first.target == lastTap) { // This actually emulates the ipads default behaviour (which we prevented)
simulatedEvent = document.createEvent("MouseEvent"); // This check avoids click being emulated on a double tap
simulatedEvent.initMouseEvent("click", true, true, window, 1, first.screenX, first.screenY, first.clientX, first.clientY,
false, false, false, false, button, null);
first.target.dispatchEvent(simulatedEvent);
}
}
<?php
session_start();
$aResponse['error'] = false;
$_SESSION['iQaptcha'] = false;
if(isset($_POST['action']))
{
if(htmlentities($_POST['action'], ENT_QUOTES, 'UTF-8') == 'qaptcha')
{
$_SESSION['iQaptcha'] = true;
if($_SESSION['iQaptcha'])
echo json_encode($aResponse);
else
{
$aResponse['error'] = true;
echo json_encode($aResponse);
}
}
else
{
$aResponse['error'] = true;
echo json_encode($aResponse);
}
}
else
{
$aResponse['error'] = true;
echo json_encode($aResponse);
}
\ No newline at end of file
<?php
function jsimport($imports = ["jquery"], $prefix = "!"){
echo "<!-- JS-Import -->";
foreach ($imports as $import) {
switch ($import) {
case 'jquery2':
$import = "jquery-2.1.3.min";
break;
default:
# code...
break;
}
if($prefix != "!"){
echo "<script src'".$prefix."js/$import.js'></script>";
}else{
echo "<script src'".BASE_URL."/js/$import.js'></script>";
}
}
echo "<!-- JS-Import END -->";
}
\ No newline at end of file
......@@ -33,22 +33,22 @@ This program comes with ABSOLUTELY NO WARRANTY; Use at your own risk.
$passwordUpdate = $_SESSION['passwordUpdate'];
unset($_SESSION['passwordUpdate']);
}
if (isset($_SESSION['password']))
if (isset($_SESSION['password']))
{
$password = $_SESSION['password'];
$password = $_SESSION['password'];
}
$con = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
$result = mysqli_query($con, "SELECT * FROM `users`") or die(mysqli_error($con));
$row = mysqli_fetch_array($result);
$id = $row['id'];
$password = $row['password'];
$id = $_SESSION['id'];
if (isset