public function testEquals() { verify(5)->equals(5); verify("hello")->equals("hello"); verify("user have 5 posts", 5)->equals(5); verify(3)->notEquals(5); verify_file(__FILE__)->equals(__FILE__); verify_file(__FILE__)->notEquals(__DIR__ . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'composer.json'); }
} } $newim = imagerotate($im, $degree, 0); imagedestroy($im); if ($mime['mime'] == 'image/pjpeg' || $mime['mime'] == 'image/jpeg') { imagejpeg($newim, $targetimg, $_SESSION['tinybrowser']['imagequality']); } elseif ($mime['mime'] == 'image/x-png' || $mime['mime'] == 'image/png') { imagepng($newim, $targetimg, substr($_SESSION['tinybrowser']['imagequality'], 0, 1)); } elseif ($mime['mime'] == 'image/gif') { imagegif($newim, $targetimg); } imagedestroy($newim); $rotateqty++; // delete and recreate thumbnail image $targetthumb = $_SESSION['tinybrowser']['docroot'] . $editpath . '_thumbs/_' . $_POST['actionfile'][$rotatethis]; verify_file($targetthumb); if (file_exists($targetthumb)) { unlink($targetthumb); } $mime = getimagesize($targetimg); $im = convert_image($targetimg, $mime['mime']); resizeimage($im, $_SESSION['tinybrowser']['thumbsize'], $_SESSION['tinybrowser']['thumbsize'], $targetthumb, $_SESSION['tinybrowser']['thumbquality'], $mime['mime']); imagedestroy($im); } else { $errorqty++; } } } } // Read directory contents and populate $file array $dh = opendir($_SESSION['tinybrowser']['docroot'] . $editpath);
function test_verify($filename) { $data = read_file($filename); $json = json_decode($data, true); import_key($json['digital_signature']['key_location'][0]); $signature = $json['digital_signature']['signature']; $testHash = get_hash_from_signature($signature); $signData = format_data_to_sign($json); if ($signData == $testHash) { $resultList = verify_file($data, $signature); $result = $resultList[0]; if ($result->isValid()) { echo "Valid", "\n"; } } }