Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Feb 6, 2016
1 parent 91d11c4 commit a45bf8a
Show file tree
Hide file tree
Showing 663 changed files with 139,422 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/admin.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require_once("functions/bootstrap.php");
require_once(CLASS_DIR."/admin.class.php");

$kibopage = new adminpage;
$kibopage->run();
?>
7 changes: 7 additions & 0 deletions src/attplan.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php
require_once("functions/bootstrap.php");
require_once(CLASS_DIR."/attplan.class.php");

$kibopage = new attplan;
$kibopage->run();
?>
71 changes: 71 additions & 0 deletions src/classes/Assert.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?php



class Assert {

public function isId($num, $message=null) {
$value = (int)$num;
if((string)$value !== (string)$num || $value < 1) {
if(!$message) {
$message = "positve not zero id expected. got '".$num."'";
}
trigger_error($message,E_USER_ERROR);
}
}

public function isNumeric($num, $message=null) {
if(is_numeric($num) === false) {
if(!$message) {
$message = "numeric value expected. got '".$num."'";
}
trigger_error($message,E_USER_ERROR);
}
}

public function isIdArray($num,$message=null) {
if(!$message) {
$message = "check for id array";
}
if(is_array($num)) {
if(count($num) > 0) {
for($i = 0; $i < count($num);$i++) {
Assert::isId($num[$i],$message.", id at index ".$i." invalid");
}
} else {
trigger_error($message.", id array is empty",E_USER_ERROR);
}
} else {
Assert::isId($num,$message.", ");
}
}

public function isTrue($value, $message=null) {
if($value !== true) {
if(!$message) {
$message = "expected true";
}
trigger_error($message,E_USER_ERROR);
}
}

public function notEmpty($value, $message=null) {
$result = false;
if( !is_numeric($value) ) {
if( is_array($value) ) { // Is array?
if( count($value, 1) < 1 ) $result = true;
}
elseif(!isset($value) || strlen(trim($value)) == 0) {
$result = true;
}
}
if($result === true) {
if(!$message) {
$message = "expected non empty value";
}
trigger_error($message,E_USER_ERROR);
}
}
}

?>
Loading

0 comments on commit a45bf8a

Please sign in to comment.