Ejemplo n.º 1
0
 public function testEncryptDecrypt()
 {
     $plainText = "plaintext";
     $encryptedText = Cipher::getInstance()->encrypt($plainText);
     // Assert that the encrypted text is not the same as the plain text
     $this->assertNotEquals($plainText, $encryptedText);
     // Assert that the encrypted text is equal to the plain text when decrypted
     $this->assertEquals($plainText, Cipher::getInstance()->decrypt($encryptedText));
 }
Ejemplo n.º 2
0
use Athens\CSRF\CSRF;
use Athens\Core\Settings\Settings;
use Athens\Encryption\Cipher;
if (REPORT_ERRORS) {
    ini_set('display_errors', 1);
    ini_set('display_startup_errors', 1);
    error_reporting(E_ALL);
}
// Initialize the session
session_start();
// Initialize CSRF Protection
CSRF::init();
// Setup Framework
Settings::getInstance()->addTemplateDirectories(dirname(__FILE__) . "/project-templates");
Settings::getInstance()->addAcronyms('ssn');
Cipher::createInstance(ATHENS_ENCRYPTION_PASSWORD);
// Setup Propel
$serviceContainer = Propel::getServiceContainer();
$serviceContainer->setAdapterClass(APPLICATION_NAME, 'mysql');
$manager = new ConnectionManagerSingle();
$manager->setConfiguration(array('dsn' => MYSQL_DSN, 'user' => MYSQL_USER, 'password' => MYSQL_PASSWORD));
$serviceContainer->setConnectionManager(APPLICATION_NAME, $manager);
// Include project-specific CSS
$fullCSSFilesnames = glob(dirname(__FILE__) . "/project-assets/css/*.css");
$relativeCSSFilesnames = str_replace(dirname(__FILE__) . "/", "", $fullCSSFilesnames);
foreach ($relativeCSSFilesnames as $file) {
    Settings::getInstance()->addProjectCSS($file);
}
// Include project-specific JS
$fullJSFilesnames = glob(dirname(__FILE__) . "/project-assets/js/*.js");
$relativeJSFilesnames = str_replace(dirname(__FILE__) . "/", "", $fullJSFilesnames);