-
-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #371 from causefx/cero-dev
Cero dev
- Loading branch information
Showing
20 changed files
with
1,189 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
header( "HTTP/1.1 200 OK" ); | ||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | ||
header("Cache-Control: post-check=0, pre-check=0", false); | ||
header("Pragma: no-cache"); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
// Disable Compression | ||
@ini_set('zlib.output_compression', 'Off'); | ||
@ini_set('output_buffering', 'Off'); | ||
@ini_set('output_handler', ''); | ||
// Headers | ||
header( "HTTP/1.1 200 OK" ); | ||
// Download follows... | ||
header('Content-Description: File Transfer'); | ||
header('Content-Type: application/octet-stream'); | ||
header('Content-Disposition: attachment; filename=random.dat'); | ||
header('Content-Transfer-Encoding: binary'); | ||
// Never cache me | ||
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); | ||
header("Cache-Control: post-check=0, pre-check=0", false); | ||
header("Pragma: no-cache"); | ||
// Generate data | ||
$data=openssl_random_pseudo_bytes(1048576); | ||
// Deliver chunks of 1048576 bytes | ||
for($i=0;$i<intval($_GET["ckSize"]);$i++){ | ||
echo $data; | ||
flush(); | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
echo $_SERVER['REMOTE_ADDR']; | ||
?> |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
<?php | ||
|
||
$data = false; | ||
|
||
ini_set("display_errors", 1); | ||
ini_set("error_reporting", E_ALL | E_STRICT); | ||
|
||
require_once("user.php"); | ||
require_once("functions.php"); | ||
|
||
$USER = new User("registration_callback"); | ||
|
||
$dbfile = DATABASE_LOCATION.'users.db'; | ||
|
||
$file_db = new PDO("sqlite:" . $dbfile); | ||
$file_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); | ||
|
||
$dbOptions = $file_db->query('SELECT name FROM sqlite_master WHERE type="table" AND name="options"'); | ||
|
||
$hasOptions = "No"; | ||
|
||
foreach($dbOptions as $row) : | ||
|
||
if (in_array("options", $row)) : | ||
$hasOptions = "Yes"; | ||
endif; | ||
|
||
endforeach; | ||
|
||
if($hasOptions == "No") : | ||
|
||
$title = "Organizr"; | ||
$topbar = "#333333"; | ||
$topbartext = "#66D9EF"; | ||
$bottombar = "#333333"; | ||
$sidebar = "#393939"; | ||
$hoverbg = "#AD80FD"; | ||
$activetabBG = "#F92671"; | ||
$activetabicon = "#FFFFFF"; | ||
$activetabtext = "#FFFFFF"; | ||
$inactiveicon = "#66D9EF"; | ||
$inactivetext = "#66D9EF"; | ||
$loading = "#66D9EF"; | ||
$hovertext = "#000000"; | ||
|
||
endif; | ||
|
||
if($hasOptions == "Yes") : | ||
|
||
$resulto = $file_db->query('SELECT * FROM options'); | ||
foreach($resulto as $row) : | ||
|
||
$title = isset($row['title']) ? $row['title'] : "Organizr"; | ||
$topbartext = isset($row['topbartext']) ? $row['topbartext'] : "#66D9EF"; | ||
$topbar = isset($row['topbar']) ? $row['topbar'] : "#333333"; | ||
$bottombar = isset($row['bottombar']) ? $row['bottombar'] : "#333333"; | ||
$sidebar = isset($row['sidebar']) ? $row['sidebar'] : "#393939"; | ||
$hoverbg = isset($row['hoverbg']) ? $row['hoverbg'] : "#AD80FD"; | ||
$activetabBG = isset($row['activetabBG']) ? $row['activetabBG'] : "#F92671"; | ||
$activetabicon = isset($row['activetabicon']) ? $row['activetabicon'] : "#FFFFFF"; | ||
$activetabtext = isset($row['activetabtext']) ? $row['activetabtext'] : "#FFFFFF"; | ||
$inactiveicon = isset($row['inactiveicon']) ? $row['inactiveicon'] : "#66D9EF"; | ||
$inactivetext = isset($row['inactivetext']) ? $row['inactivetext'] : "#66D9EF"; | ||
$loading = isset($row['loading']) ? $row['loading'] : "#66D9EF"; | ||
$hovertext = isset($row['hovertext']) ? $row['hovertext'] : "#000000"; | ||
|
||
endforeach; | ||
|
||
endif; | ||
?> | ||
|
||
<!DOCTYPE html> | ||
|
||
<html lang="en" class="no-js"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="msapplication-tap-highlight" content="no" /> | ||
|
||
<title><?=$title;?> Chat</title> | ||
|
||
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css"> | ||
<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css"> | ||
<link rel="stylesheet" href="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.css"> | ||
<script src="js/menu/modernizr.custom.js"></script> | ||
|
||
<link rel="stylesheet" href="bower_components/animate.css/animate.min.css"> | ||
|
||
<link rel="stylesheet" href="css/style.css?v=<?php echo INSTALLEDVERSION; ?>"> | ||
|
||
<!--Scripts--> | ||
<script src="bower_components/jquery/dist/jquery.min.js"></script> | ||
<script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> | ||
<script src="bower_components/moment/min/moment.min.js"></script> | ||
<script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script> | ||
<script src="bower_components/slimScroll/jquery.slimscroll.min.js"></script> | ||
<script src="bower_components/malihu-custom-scrollbar-plugin/jquery.mCustomScrollbar.js"></script> | ||
<script src="bower_components/jquery.nicescroll/jquery.nicescroll.min.js"></script> | ||
<script src="bower_components/cta/dist/cta.min.js"></script> | ||
<script src="bower_components/fullcalendar/dist/fullcalendar.js"></script> | ||
|
||
<script src="js/jqueri_ui_custom/jquery-ui.min.js"></script> | ||
<script src="js/jquery.mousewheel.min.js" type="text/javascript"></script> | ||
|
||
<!--Other--> | ||
<script src="js/ajax.js?v=<?php echo INSTALLEDVERSION; ?>"></script> | ||
<script src="chatjs.php" defer="true"></script> | ||
|
||
<!--[if lt IE 9]> | ||
<script src="bower_components/html5shiv/dist/html5shiv.min.js"></script> | ||
<script src="bower_components/respondJs/dest/respond.min.js"></script> | ||
<![endif]--> | ||
<style> | ||
<?php if(CUSTOMCSS == "true") : | ||
$template_file = "custom.css"; | ||
$file_handle = fopen($template_file, "rb"); | ||
echo fread($file_handle, filesize($template_file)); | ||
fclose($file_handle); | ||
echo "\n"; | ||
endif; ?> | ||
</style> | ||
</head> | ||
|
||
<body class="scroller-body" style="padding: 0px;"> | ||
<div class="main-wrapper" style="position: initial;"> | ||
<div id="content" class="container-fluid"> | ||
<br> | ||
<div class="row"> | ||
<div class="col-lg-12"> | ||
<div class="content-box big-box chat"> | ||
<div class="content-title i-block"> | ||
<h4 class="zero-m">Welcome To The Chat <?php echo $USER->username;?></h4> | ||
</div> | ||
<div class="box" style="overflow: hidden; width: auto; height: 500px;"> | ||
<ul id="messages" class="chat-double chat-container"></ul> | ||
</div> | ||
<form id="message_form"> | ||
<input id="writehere" type="text" class="form-control" placeholder="Enter your text"> | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</body> | ||
|
||
<script> | ||
|
||
$(".box").niceScroll({ | ||
railpadding: {top:0,right:0,left:0,bottom:0}, | ||
scrollspeed: 30, | ||
mousescrollstep: 60 | ||
}); | ||
</script> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<?php | ||
|
||
define("CHATDB", "chat.db"); | ||
|
||
if (!file_exists(CHATDB)) { | ||
|
||
try{ | ||
$db = new PDO('sqlite:'.CHATDB); | ||
|
||
$sql =" | ||
CREATE TABLE IF NOT EXISTS MESSAGES | ||
(ID INTEGER PRIMARY KEY AUTOINCREMENT, | ||
USER TEXT NOT NULL, | ||
EMAIL TEXT NOT NULL, | ||
MESSAGE TEXT NOT NULL, | ||
TIME TIMESTAMP NOT NULL DEFAULT((julianday('now') - 2440587.5)*86400.0))"; | ||
|
||
$ret = $db->exec($sql); | ||
sleep(0.5); | ||
$ret = $db->exec('PRAGMA journal_mode = wal;'); | ||
sleep(0.5); | ||
|
||
|
||
header("Refresh:0"); | ||
} | ||
catch(PDOException $e){ | ||
die('Failed to execute query:'. $e->getMessage()); | ||
} | ||
|
||
$db=null; | ||
|
||
}elseif(file_exists(CHATDB)) { | ||
|
||
try{ | ||
$db = new PDO('sqlite:'.CHATDB); | ||
} | ||
catch(PDOException $e){ | ||
die('Failed to connect:'. $e->getMessage()); | ||
} | ||
} | ||
|
||
//check to see if the ajax call was to update db | ||
|
||
if (isset($_POST['text'])){ | ||
|
||
$msg=$_POST['text']; | ||
$us=$_POST['user']; | ||
$email=$_POST['email']; | ||
|
||
$sql ="INSERT INTO MESSAGES (USER,MESSAGE,EMAIL) VALUES(?, ?, ?)"; | ||
|
||
try{ | ||
$ret = $db->prepare($sql); | ||
$ret->execute([$us,$msg, $email]); | ||
} | ||
catch(PDOException $e){ | ||
console.log('Failed to update db:'. $e->getMessage()); | ||
} | ||
}else{ | ||
//the script will run for 20 seconds after the initial ajax call | ||
$time=time()+20; | ||
|
||
while(time()<$time){ | ||
if ($_POST['time']){ | ||
$prevtime=$_POST['time']; | ||
} | ||
else { | ||
$prevtime=0; | ||
} | ||
//query to see if there are new messages | ||
|
||
$sql ="SELECT TIME,USER,MESSAGE,EMAIL FROM MESSAGES WHERE TIME>? ORDER BY TIME ASC"; | ||
|
||
try{ | ||
$ret = $db->prepare($sql); | ||
$ret->execute([$prevtime]); | ||
|
||
$resarr = $ret->fetchAll(PDO::FETCH_ASSOC); | ||
|
||
//if there are no new messages in the db, sleep for half a second and then run loop again | ||
if (!$resarr) | ||
sleep(0.5); | ||
else{ | ||
echo json_encode($resarr); | ||
break; | ||
} | ||
} | ||
catch(PDOException $e){ | ||
console.log('Failed to get messages:'. $e->getMessage()); | ||
} | ||
} | ||
} | ||
|
||
$db=null; | ||
|
||
?> |
Oops, something went wrong.