broadcast message
Showing
application/views/chat.php
0 → 100644
This diff is collapsed.
Click to expand it.
This diff is collapsed.
Click to expand it.
assets/images/tick.png
0 → 100644
4.72 KB
assets/js/chat/angular.min.js
0 → 100644
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
assets/js/chat/angularfire.min.js
0 → 100644
This diff is collapsed.
Click to expand it.
assets/js/chat/chat-page.js
0 → 100644
assets/js/chat/dist/ng-scrollbar.css
0 → 100644
assets/js/chat/dist/ng-scrollbar.js
0 → 100644
assets/js/chat/dist/ng-scrollbar.min.css
0 → 100644
assets/js/chat/dist/ng-scrollbar.min.js
0 → 100644
/** | ||
* ng-scrollbar | ||
* @version v0.0.7 - 2015-06-19 | ||
* @link https://github.com/asafdav/ng-scrollbar | ||
* @author Asaf David <[email protected]> | ||
* @license MIT License, http://www.opensource.org/licenses/MIT | ||
*/ | ||
"use strict";angular.module("ngScrollbar",[]).directive("ngScrollbar",["$parse","$window",function(a,b){return{restrict:"A",replace:!0,transclude:!0,scope:{showYScrollbar:"=?isBarShown"},link:function(a,c,d){var e,g,h,i,j,k,l,m,n,o,p,q={bottom:d.hasOwnProperty("bottom")},r=angular.element(b),s=!!r[0].addEventListener,t=!!r[0].removeEventListener,u={top:0},v={top:0},w=function(){l={position:"relative",overflow:"hidden","max-width":"100%",height:"100%"},v.height&&(l.height=v.height+"px"),m={position:"absolute",height:u.height+"px",top:u.top+"px"},n={position:"relative","line-height":u.height+"px"},o={position:"relative",top:v.top+"px",overflow:"hidden"}},x=function(){i.css("top",u.top+"px");var a=u.top/v.height;v.top=-Math.round(v.scrollHeight*a),g.css("top",v.top+"px")},y=function(a){var b=a.hasOwnProperty("offsetY")?a.offsetY:a.layerY,c=Math.max(0,Math.min(parseInt(u.trackHeight,10)-parseInt(u.height,10),b));u.top=c,x(),a.stopPropagation()},z=function(a){var b=40,c=a,d=c.detail,e=c.wheelDelta,g=225,h=g-1;return d=d?e&&(f=e/d)?d/f:-d/1.35:e/120,d=1>d?-1>d?(-Math.pow(d,2)-h)/g:d:(Math.pow(d,2)+h)/g,a.delta=Math.min(Math.max(d/2,-1),1),a.delta=a.delta*b,u.top=Math.max(0,Math.min(parseInt(v.height,10)-parseInt(u.height,10),parseInt(u.top,10)-a.delta)),x(),a.preventDefault?void a.preventDefault():!1},A=0,B=function(a,b,c){u.top=Math.max(0,Math.min(parseInt(u.trackHeight,10)-parseInt(u.height,10),c)),a.stopPropagation()},C=function(a){var b=0,c=a.pageY-i[0].scrollTop-A;B(a,b,c),x()},D=function(a){r.off("mousemove",C),r.off("mouseup",D),a.stopPropagation()},E=function(a){var b=0,c=a.originalEvent.changedTouches[0].pageY-i[0].scrollTop-A;B(a,b,c),x()},F=function(a){r.off("touchmove",E),r.off("touchend",F),a.stopPropagation()},G=function(a){var b=void 0!==r[0].onmousewheel?"mousewheel":"DOMMouseScroll";s?a.addEventListener(b,z,!1):a.attachEvent("onmousewheel",z)},H=function(a){var b=void 0!==r[0].onmousewheel?"mousewheel":"DOMMouseScroll";t?a.removeEventListener(b,z,!1):a.detachEvent("onmousewheel",z)},I=function(b){b=q.bottom||b,e=angular.element(c.children()[0]),g=angular.element(e.children()[0]),h=angular.element(e.children()[1]),i=angular.element(angular.element(h.children()[0]).children()[0]),j=angular.element(i.children()[0]),k=angular.element(angular.element(h.children()[0]).children()[1]),v.height=c[0].offsetHeight,v.scrollHeight=g[0].scrollHeight,v.height<v.scrollHeight?(a.showYScrollbar=!0,a.$emit("scrollbar.show"),u.height=Math.round(v.height/v.scrollHeight*v.height),u.trackHeight=v.height,w(),c.css({overflow:"hidden"}),e.css(l),g.css(o),i.css(m),j.css(n),k.bind("click",y),G(g[0]),i.on("mousedown",function(a){A=a.pageY-i[0].offsetTop,r.on("mouseup",D),r.on("mousemove",C),a.preventDefault()}),i.on("touchstart",function(a){A=a.originalEvent.changedTouches[0].pageY-i[0].offsetTop,r.on("touchend",F),r.on("touchmove",E),a.preventDefault()}),b?(q.bottom=!1,u.top=parseInt(v.height,10)-parseInt(u.height,10)):u.top=Math.max(0,Math.min(parseInt(v.height,10)-parseInt(u.height,10),parseInt(u.top,10))),x()):(a.showYScrollbar=!1,a.$emit("scrollbar.hide"),i.off("mousedown"),H(g[0]),g.attr("style","position:relative;top:0"),e.css({height:"100%"}))},J=function(b,c){null!=p&&clearTimeout(p);var d=!!c&&!!c.rollToBottom;p=setTimeout(function(){v.height=null,I(d),a.$$phase||a.$digest(),a.$parent.$$phase||a.$parent.$digest()},72)};I(),d.rebuildOn&&d.rebuildOn.split(" ").forEach(function(b){a.$on(b,J)}),d.hasOwnProperty("rebuildOnResize")&&r.on("resize",J)},template:'<div><div class="ngsb-wrap"><div class="ngsb-container" ng-transclude></div><div class="ngsb-scrollbar" style="position: absolute; display: block;" ng-show="showYScrollbar"><div class="ngsb-thumb-container"><div class="ngsb-thumb-pos" oncontextmenu="return false;"><div class="ngsb-thumb" ></div></div><div class="ngsb-track"></div></div></div></div></div>'}}]); | ||
\ No newline at end of file |
assets/js/chat/factory.js
0 → 100644
assets/js/chat/jquery.js
0 → 100644
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
... | ... | @@ -11,7 +11,8 @@ |
"source": "https://github.com/bcit-ci/CodeIgniter" | ||
}, | ||
"require": { | ||
"php": ">=5.3.7" | ||
"php": ">=5.3.7", | ||
"ktamas77/firebase-php": "dev-master" | ||
}, | ||
"suggest": { | ||
"paragonie/random_compat": "Provides better randomness in PHP 5.x" | ||
... | ... |
composer.phar
0 → 100644
File added
firebase/firebaseLib.php
0 → 100644
<?php | ||
namespace Firebase; | ||
require_once __DIR__ . '/firebaseInterface.php'; | ||
use \Exception; | ||
/** | ||
* Firebase PHP Client Library | ||
* | ||
* @author Tamas Kalman <[email protected]> | ||
* @url https://github.com/ktamas77/firebase-php/ | ||
* @link https://www.firebase.com/docs/rest-api.html | ||
*/ | ||
/** | ||
* Firebase PHP Class | ||
* | ||
* @author Tamas Kalman <[email protected]> | ||
* @link https://www.firebase.com/docs/rest-api.html | ||
*/ | ||
class FirebaseLib implements FirebaseInterface | ||
{ | ||
private $_baseURI; | ||
private $_timeout; | ||
private $_token; | ||
private $_curlHandler; | ||
/** | ||
* Constructor | ||
* | ||
* @param string $baseURI | ||
* @param string $token | ||
*/ | ||
function __construct($baseURI = '', $token = '') | ||
{ | ||
if ($baseURI == '') { | ||
trigger_error('You must provide a baseURI variable.', E_USER_ERROR); | ||
} | ||
if (!extension_loaded('curl')) { | ||
trigger_error('Extension CURL is not loaded.', E_USER_ERROR); | ||
} | ||
$this->setBaseURI($baseURI); | ||
$this->setTimeOut(10); | ||
$this->setToken($token); | ||
$this->initCurlHandler(); | ||
} | ||
/** | ||
* Initializing the CURL handler | ||
* | ||
* @return void | ||
*/ | ||
public function initCurlHandler() | ||
{ | ||
$this->_curlHandler = curl_init(); | ||
} | ||
/** | ||
* Closing the CURL handler | ||
* | ||
* @return void | ||
*/ | ||
public function closeCurlHandler() | ||
{ | ||
curl_close($this->_curlHandler); | ||
} | ||
/** | ||
* Sets Token | ||
* | ||
* @param string $token Token | ||
* | ||
* @return void | ||
*/ | ||
public function setToken($token) | ||
{ | ||
$this->_token = $token; | ||
} | ||
/** | ||
* Sets Base URI, ex: http://yourcompany.firebase.com/youruser | ||
* | ||
* @param string $baseURI Base URI | ||
* | ||
* @return void | ||
*/ | ||
public function setBaseURI($baseURI) | ||
{ | ||
$baseURI .= (substr($baseURI, -1) == '/' ? '' : '/'); | ||
$this->_baseURI = $baseURI; | ||
} | ||
/** | ||
* Returns with the normalized JSON absolute path | ||
* | ||
* @param string $path Path | ||
* @param array $options Options | ||
* @return string | ||
*/ | ||
private function _getJsonPath($path, $options = array()) | ||
{ | ||
$url = $this->_baseURI; | ||
if ($this->_token !== '') { | ||
$options['auth'] = $this->_token; | ||
} | ||
$path = ltrim($path, '/'); | ||
return $url . $path . '.json?' . http_build_query($options); | ||
} | ||
/** | ||
* Sets REST call timeout in seconds | ||
* | ||
* @param integer $seconds Seconds to timeout | ||
* | ||
* @return void | ||
*/ | ||
public function setTimeOut($seconds) | ||
{ | ||
$this->_timeout = $seconds; | ||
} | ||
/** | ||
* Writing data into Firebase with a PUT request | ||
* HTTP 200: Ok | ||
* | ||
* @param string $path Path | ||
* @param mixed $data Data | ||
* @param array $options Options | ||
* | ||
* @return array Response | ||
*/ | ||
public function set($path, $data, $options = array()) | ||
{ | ||
return $this->_writeData($path, $data, 'PUT', $options); | ||
} | ||
/** | ||
* Pushing data into Firebase with a POST request | ||
* HTTP 200: Ok | ||
* | ||
* @param string $path Path | ||
* @param mixed $data Data | ||
* @param array $options Options | ||
* | ||
* @return array Response | ||
*/ | ||
public function push($path, $data, $options = array()) | ||
{ | ||
return $this->_writeData($path, $data, 'POST', $options); | ||
} | ||
/** | ||
* Updating data into Firebase with a PATH request | ||
* HTTP 200: Ok | ||
* | ||
* @param string $path Path | ||
* @param mixed $data Data | ||
* @param array $options Options | ||
* | ||
* @return array Response | ||
*/ | ||
public function update($path, $data, $options = array()) | ||
{ | ||
return $this->_writeData($path, $data, 'PATCH', $options); | ||
} | ||
/** | ||
* Reading data from Firebase | ||
* HTTP 200: Ok | ||
* | ||
* @param string $path Path | ||
* @param array $options Options | ||
* | ||
* @return array Response | ||
*/ | ||
public function get($path, $options = array()) | ||
{ | ||
try { | ||
$ch = $this->_getCurlHandler($path, 'GET', $options); | ||
$return = curl_exec($ch); | ||
} catch (Exception $e) { | ||
$return = null; | ||
} | ||
return $return; | ||
} | ||
/** | ||
* Deletes data from Firebase | ||
* HTTP 204: Ok | ||
* | ||
* @param string $path Path | ||
* @param array $options Options | ||
* | ||
* @return array Response | ||
*/ | ||
public function delete($path, $options = array()) | ||
{ | ||
try { | ||
$ch = $this->_getCurlHandler($path, 'DELETE', $options); | ||
$return = curl_exec($ch); | ||
} catch (Exception $e) { | ||
$return = null; | ||
} | ||
return $return; | ||
} | ||
/** | ||
* Returns with Initialized CURL Handler | ||
* | ||
* @param string $path Path | ||
* @param string $mode Mode | ||
* @param array $options Options | ||
* | ||
* @return resource Curl Handler | ||
*/ | ||
private function _getCurlHandler($path, $mode, $options = array()) | ||
{ | ||
$url = $this->_getJsonPath($path, $options); | ||
$ch = $this->_curlHandler; | ||
curl_setopt($ch, CURLOPT_URL, $url); | ||
curl_setopt($ch, CURLOPT_TIMEOUT, $this->_timeout); | ||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->_timeout); | ||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); | ||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $mode); | ||
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); | ||
return $ch; | ||
} | ||
private function _writeData($path, $data, $method = 'PUT', $options = array()) | ||
{ | ||
$jsonData = json_encode($data); | ||
$header = array( | ||
'Content-Type: application/json', | ||
'Content-Length: ' . strlen($jsonData) | ||
); | ||
try { | ||
$ch = $this->_getCurlHandler($path, $method, $options); | ||
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); | ||
curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData); | ||
$return = curl_exec($ch); | ||
} catch (Exception $e) { | ||
$return = null; | ||
} | ||
return $return; | ||
} | ||
} |