Example #1
1
    public function decode($encrypted)
    {
        $decrypted = '';
        //        $encrypted = $_POST['merchantReciept'];
        $privateKey = <<<EOD
-----BEGIN PRIVATE KEY-----
MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAJuIUgSzNuWm3US8
0brZr/5cMSPue9f0IwUrEhka1gLlC4uQon6QjQem4TWQ8anoMKYwfYgRnCGQsbrT
KwOApwTA4Bt6dg9jKXlIE6rXqqO6g2C/uD+G2p+W4k0ZI1isuqqjjkup5ZPkNaeW
R9/961Qx3CyrWDk6n0OkzDJ6UNzLAgMBAAECgYEAh+/dv73jfVUaj7l4lZct+2MY
kA8grt7yvNGoP8j0xBLsxE7ltzkgClARBoBot9f4rUg0b3j0vWF59ZAbSDRpxJ2U
BfWEtlXWvN1V051KnKaOqE8TOkGK0PVWcc6P0JhPrbmOu9hhAN3dMu+jd7ABFKgC
4b8EIlHA8bl8po8gwAECQQDliMBTAzzyhB55FMW/pVGq9TBo2oXQsyNOjEO+rZNJ
zIwJzFrFhvuvFj7/7FekDAKmWgqpuOIk0NSYfHCR54FLAkEArXc7pdPgn386ikOc
Nn3Eils1WuP5+evoZw01he4NSZ1uXNkoNTAk8OmPJPz3PrtB6l3DUh1U/DEZjIiI
7z5igQJAFXvFNH/bFn/TMlYFZDie+jdUvpulZrE9nr52IMSyQngIq2obHN3TdMHK
R73hPhN5tAQ9d0E8uWFqZJNRHfbjHQJASY7pNV3Ov/QE0ALxqE3W3VDmJD/OjkOS
jriUPNIAwnnHBgp0OXHMCHkSYX4AHpLr1cWjARw9IKB1lBmF7+YFgQJAFqUgYj11
ioyuSf/CSotPIC7YyNEnr+TK2Ym0N/EWzqNXoOCDxDTgoWLQxM3Nfr65tWtV2097
BjCbFfbui/IyUw==
-----END PRIVATE KEY-----
EOD;
        $encrypted = base64_decode($encrypted);
        // decode the encrypted query string
        if (!openssl_private_decrypt($encrypted, $decrypted, $privateKey)) {
            die('Failed to decrypt data');
        }
        //        echo "Decrypted value: ". $decrypted;
        return $decrypted;
        //        $arr = explode('|', $decrypted);
        //        return $arr;
    }
Example #2
1
 public function getScriptingLogAction()
 {
     $this->request->restrictAccess(Acl::RESOURCE_LOGS_SCRIPTING_LOGS);
     $this->request->defineParams(['executionId' => ['type' => 'string']]);
     $info = $this->db->GetRow("SELECT * FROM scripting_log WHERE execution_id = ? LIMIT 1", [$this->getParam('executionId')]);
     if (!$info) {
         throw new Exception('Script execution log not found');
     }
     try {
         $dbServer = DBServer::LoadByID($info['server_id']);
         if (!in_array($dbServer->status, [SERVER_STATUS::INIT, SERVER_STATUS::RUNNING])) {
             throw new Exception();
         }
     } catch (Exception $e) {
         throw new Exception('This server has been terminated and its logs are no longer available');
     }
     //Note! We should not check not-owned-farms permission here. It's approved by Igor.
     if ($dbServer->envId != $this->environment->id) {
         throw new \Scalr_Exception_InsufficientPermissions();
     }
     $logs = $dbServer->scalarizr->system->getScriptLogs($this->getParam('executionId'));
     $msg = sprintf("STDERR:\n%s \n\n STDOUT:\n%s", base64_decode($logs->stderr), base64_decode($logs->stdout));
     $msg = nl2br(htmlspecialchars($msg));
     $this->response->data(['message' => $msg]);
 }
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->_objectId = 'id';
     $this->_blockGroup = 'massimporterpro';
     $this->_controller = 'adminhtml_priceupdater';
     $this->removeButton('back');
     $helper = Mage::helper('massimporterpro');
     $isValid = $helper->isValid();
     $isActive = $helper->isActive();
     $message = '';
     if (!$isActive) {
         $message = base64_decode('RXh0ZW5zaW9uIGhhcyBiZWVuIGRpc2FibGVkLiBQbGVhc2UgZW5hYmxlIGl0IGZyb20gTWFzcyBJbXBvcnRlciBQcm8gJnJhcXVvOyBNYW5hZ2UgU2V0dGluZ3M=');
     } else {
         if ($isActive && !$isValid) {
             $message = base64_decode('UGxlYXNlIGVudGVyIGEgdmFsaWQgbGljZW5zZSBrZXkgaW4gb3JkZXIgdG8gcnVuIHRoZSBleHRlbnNpb24=');
         }
     }
     if (!$isActive || $isActive && !$isValid) {
         $this->removeButton('save');
         $this->_addButton('dsave', array('label' => Mage::helper('massimporterpro')->__('Run Import'), 'onclick' => 'alert(\'' . $message . '.\')', 'class' => 'disabled'), -100);
     } else {
         $this->_updateButton('save', 'label', Mage::helper('massimporterpro')->__('Run Import'));
     }
     $this->_formScripts[] = "\n            function addUploadFile(){\n\t\t\t\tvar importFile = \$('import_file_upload').value;\n\t\t\t\tif(importFile == ''){\n\t\t\t\t\talert('Please select some import file.');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tvar ext = importFile.substring(importFile.lastIndexOf('.') + 1);\n\t\t\t\tif(ext.toLowerCase() != 'csv'){\n\t\t\t\t\talert('Please select valid import file (CSV).');\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t//tweak for required feilds: import file section, delimiter, enclosed\n\t\t\t\t\$('import_file').removeClassName('required-entry');\n\t\t\t\t\$('delimiter').removeClassName('required-entry');\n\t\t\t\t\$('enclosure').removeClassName('required-entry');\n                editForm.submit('" . Mage::helper('adminhtml')->getUrl('massimporterpro/adminhtml_priceupdater/uploadCsv') . "');\n            }\n        ";
 }
 private function inflate()
 {
     $this->name = $this->raw['activityTaskScheduledEventAttributes']['activityType']['name'];
     $this->version = $this->raw['activityTaskScheduledEventAttributes']['activityType']['version'];
     $this->control = $this->raw['activityTaskScheduledEventAttributes']['control'];
     $this->inputs = json_decode(base64_decode($this->raw['activityTaskScheduledEventAttributes']['input']), true);
 }
function list_ressource($automount)
{
    $sock = new sockets();
    $datas = $sock->getFrameWork("cmd.php?B64-dirdir=" . base64_encode("/automounts/{$automount}"));
    $files = unserialize(base64_decode(trim($datas)));
    if (!is_array($files)) {
        $_GET["cyrus-brows-comp"] = "/automounts/{$automount}";
        list_ressources2();
        return;
    }
    $html = "<table style='width:80%'>";
    if (is_array($files)) {
        while (list($num, $ligne) = each($files)) {
            if (!preg_match("#backup\\.[0-9\\-]+#", $ligne)) {
                continue;
            }
            $md5 = md5($num);
            $ligne = str_replace("backup.", "", $ligne);
            $js = "SelectMountRestoreLevel2('{$md5}','{$num}')";
            $html = $html . "\n\t\t\t<tr " . CellRollOver($js, "{select_this_container}") . ">\n\t\t\t\t<td with=1%><img src='img/folder-32-sh\tare.png'>\n\t\t\t\t<td width=99%><span style='font-size:14px'>{$ligne}</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td colspan=2><div id='{$md5}'><hr></div></td>\n\t\t\t</tR>\n\t\t\t\t\t\n\t\t\t";
        }
    }
    $html = $html . "</table>";
    return $html;
}
Example #6
0
 /**
  * Returns the ezcMailText part corresponding to the parsed message.
  *
  * @return ezcMailText
  */
 public function finish()
 {
     $charset = "us-ascii";
     // RFC 2822 default
     if (isset($this->headers['Content-Type'])) {
         preg_match('/\\s*charset\\s?=\\s?"?([^;"\\s]*);?/', $this->headers['Content-Type'], $parameters);
         if (count($parameters) > 0) {
             $charset = strtolower(trim($parameters[1], '"'));
         }
     }
     $encoding = strtolower($this->headers['Content-Transfer-Encoding']);
     if ($encoding == ezcMail::QUOTED_PRINTABLE) {
         $this->text = quoted_printable_decode($this->text);
     } else {
         if ($encoding == ezcMail::BASE64) {
             $this->text = base64_decode($this->text);
         }
     }
     $this->text = ezcMailCharsetConverter::convertToUTF8($this->text, $charset);
     $part = new ezcMailText($this->text, 'utf-8', ezcMail::EIGHT_BIT, $charset);
     $part->subType = $this->subType;
     $part->setHeaders($this->headers->getCaseSensitiveArray());
     ezcMailPartParser::parsePartHeaders($this->headers, $part);
     $part->size = strlen($this->text);
     return $part;
 }
Example #7
0
 /**
  * 位加密或解密
  * @param $string 加密或解密内容
  * @param $type 类型:1加密 2解密
  * @param $key
  * @return mixed|string
  */
 private static function cry($string, $type, $key)
 {
     self::createKey($key);
     $string = $type == 2 ? base64_decode($string) : substr(md5(self::$auth_key . $string), 0, 8) . $string;
     $str_len = strlen($string);
     $data = array();
     $auth_key_length = strlen(self::$auth_key);
     for ($i = 0; $i <= 256; $i++) {
         $data[$i] = ord(self::$auth_key[$i % $auth_key_length]);
     }
     $tmp = '';
     for ($i = $j = 1; $i < 256; $i++) {
         $j = $data[($i + $data[$i]) % 256];
         $tmp = $data[$i];
         $data[$i] = ord($data[$j]);
         $data[$j] = $tmp;
     }
     $code = '';
     $s = '';
     for ($n = $i = $j = 0; $i < $str_len; $i++) {
         $tmp = ($i + $i % 256) % 256;
         $j = $data[$tmp] % 256;
         $n = ($tmp + $j) % 256;
         $code = $data[($data[$j] + $data[$n]) % 256];
         $s .= chr(ord($string[$i]) ^ $code);
     }
     if ($type == 1) {
         return str_replace("=", "", base64_encode($s));
     } else {
         if (substr(md5(self::$auth_key . substr($s, 8)), 0, 8) == substr($s, 0, 8)) {
             return substr($s, 8);
         }
         return '';
     }
 }
 public static function parse($signature, $payload)
 {
     self::_validateSignature($signature, $payload);
     $xml = base64_decode($payload);
     $attributes = Braintree_Xml::buildArrayFromXml($xml);
     return self::factory($attributes['notification']);
 }
Example #9
0
 public function testVector()
 {
     $input = 'hello world';
     $pass = '******';
     $vector = base64_decode('vusXragCy83KQFo');
     $this->assertEquals($input, Otp::crypt($vector, $pass));
 }
 private function getAccessToken($code)
 {
     $curlWrapper = new CurlWrapper();
     $post_data = array("grant_type" => "authorization_code", "code" => $code, "redirect_uri" => $this->url_callback, "client_id" => $this->client_id, "client_secret" => $this->secret_id);
     $curlWrapper->setPostDataUrlEncode($post_data);
     $token_url = $this->getURLforService("token");
     $result = $curlWrapper->get($token_url);
     if ($curlWrapper->getHTTPCode() != 200) {
         if (!$result) {
             throw new Exception($curlWrapper->getLastError());
         }
         $result_array = json_decode($result, true);
         throw new Exception($result_array['error']);
     }
     $result_array = json_decode($result, true);
     $id_token = $result_array['id_token'];
     $all_part = explode(".", $id_token);
     $header = json_decode(base64_decode($all_part[0]), true);
     $payload = json_decode(base64_decode($all_part[1]), true);
     if ($payload['nonce'] != $_SESSION[self::OPENID_SESSION_NONCE]) {
         throw new Exception("La nonce ne correspond pas");
     }
     require_once __DIR__ . "/../ext/Akita_JOSE/JWS.php";
     $jws = Akita_JOSE_JWS::load($id_token, true);
     $verify = $jws->verify($this->secret_id);
     if (!$verify) {
         throw new Exception("Vérification du token : Echec");
     }
     unset($_SESSION[self::OPENID_SESSION_NONCE]);
     return $result_array['access_token'];
 }
Example #11
0
 public static function readCallback($payload)
 {
     $crypt = new Encrypter(base64_decode(Config::get('services.etupay.key')), 'AES-256-CBC');
     $payload = json_decode($crypt->decrypt($payload));
     if ($payload && is_numeric($payload->service_data)) {
         $paymentId = $payload->service_data;
         $payment = Payment::findOrFail($paymentId);
         switch ($payload->step) {
             case 'INITIALISED':
                 $payment->state = 'returned';
                 break;
             case 'PAID':
             case 'AUTHORISATION':
                 $payment->state = 'paid';
                 break;
             case 'REFUSED':
             case 'CANCELED':
                 $payment->state = 'refused';
                 break;
             case 'REFUNDED':
                 $payment->state = 'refunded';
                 break;
         }
         $payment->informations = ['transaction_id' => $payload->transaction_id];
         $payment->save();
         if ($payment->newcomer) {
             $payment->newcomer->updateWei();
         } elseif ($payment->student) {
             $payment->student->updateWei();
         }
         return $payment;
     }
     return null;
 }
 /**
  * {@inheritdoc}
  */
 protected function processAutoLoginCookie(array $cookieParts, Request $request)
 {
     if (count($cookieParts) !== 4) {
         throw new AuthenticationException('The cookie is invalid.');
     }
     list($class, $username, $expires, $hash) = $cookieParts;
     if (false === ($username = base64_decode($username, true))) {
         throw new AuthenticationException('$username contains a character from outside the base64 alphabet.');
     }
     try {
         $user = $this->getUserProvider($class)->loadUserByUsername($username);
     } catch (\Exception $ex) {
         if (!$ex instanceof AuthenticationException) {
             $ex = new AuthenticationException($ex->getMessage(), $ex->getCode(), $ex);
         }
         throw $ex;
     }
     if (!$user instanceof UserInterface) {
         throw new \RuntimeException(sprintf('The UserProviderInterface implementation must return an instance of UserInterface, but returned "%s".', get_class($user)));
     }
     if (true !== $this->compareHashes($hash, $this->generateCookieHash($class, $username, $expires, $user->getPassword()))) {
         throw new AuthenticationException('The cookie\'s hash is invalid.');
     }
     if ($expires < time()) {
         throw new AuthenticationException('The cookie has expired.');
     }
     return $user;
 }
Example #13
0
 /**
  * Extracts salt from provided hash.
  *
  * @param string $hash salted hash previously returned from a call to ssha::get()
  * @return string salt of provided hash
  */
 public static function extractSalt($hash)
 {
     if (substr($hash, 0, 6) === '{SSHA}') {
         return substr(base64_decode(substr($hash, 6)), 20);
     }
     return substr($hash, 20);
 }
function save()
{
    $sock = new sockets();
    if ($_POST["ID"] == 0) {
        $ligne = unserialize(base64_decode($sock->GET_INFO("DansGuardianDefaultMainRule")));
        $ligne["bypass"] = $_POST["bypass"];
        $ligne["BypassSecretKey"] = $_POST["BypassSecretKey"];
        writelogs("Default rule, saving DansGuardianDefaultMainRule", __FUNCTION__, __FILE__, __LINE__);
        $sock->SaveConfigFile(base64_encode(serialize($ligne)), "DansGuardianDefaultMainRule");
        writelogs("Ask to compile rule...", __FUNCTION__, __FILE__, __LINE__);
        $sock->getFrameWork("webfilter.php?compile-rules=yes");
        return;
    }
    $q = new mysql_squid_builder();
    $sql = "UPDATE webfilter_rules SET bypass='******',BypassSecretKey='{$_POST["bypass"]}' WHERE ID='{$_POST["ID"]}'";
    $q->QUERY_SQL($sql);
    if (!$q->ok) {
        if (strpos($q->mysql_error, "Unknown column") > 0) {
            $q->CheckTables();
            $q->QUERY_SQL($sql);
        }
    }
    if (!$q->ok) {
        echo $q->mysql_error;
        return;
    }
    $sock->getFrameWork("webfilter.php?compile-rules=yes");
}
 public function createToken($username, $encryptedPass)
 {
     $nonce = $this->createNonce();
     $ts = date('c');
     $digest = base64_encode(sha1(base64_decode($nonce) . $ts . $this->apiSecret, true));
     return sprintf('AuthToken ApiKey="%s", TokenDigest="%s", Nonce="%s", Created="%s", Username="******", Password="******"', $this->apiKey, $digest, $nonce, $ts, $username, base64_encode($encryptedPass));
 }
Example #16
0
function CacheDisableDel()
{
    $_POST["CacheDisableDel"] = base64_decode($_POST["CacheDisableDel"]);
    $freeweb = new freeweb($_POST["servername"]);
    unset($freeweb->Params["MOD_CACHE"]["CacheDisable"][$_POST["CacheDisableDel"]]);
    $freeweb->SaveParams();
}
Example #17
0
 /**
  * Method to auto-populate the model state.
  *
  * Note. Calling getState in this method will result in recursion.
  *
  * @return  void
  *
  * @since   1.6
  */
 protected function populateState($ordering = null, $direction = null)
 {
     $app = JFactory::getApplication('administrator');
     // Adjust the context to support modal layouts.
     if ($layout = $app->input->get('layout', 'default', 'cmd')) {
         $this->context .= '.' . $layout;
     }
     // Load the filter state.
     $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
     $this->setState('filter.search', $search);
     $active = $this->getUserStateFromRequest($this->context . '.filter.active', 'filter_active');
     $this->setState('filter.active', $active);
     $state = $this->getUserStateFromRequest($this->context . '.filter.state', 'filter_state');
     $this->setState('filter.state', $state);
     $groupId = $this->getUserStateFromRequest($this->context . '.filter.group', 'filter_group_id', null, 'int');
     $this->setState('filter.group_id', $groupId);
     $range = $this->getUserStateFromRequest($this->context . '.filter.range', 'filter_range');
     $this->setState('filter.range', $range);
     $groups = json_decode(base64_decode($app->input->get('groups', '', 'BASE64')));
     if (isset($groups)) {
         JArrayHelper::toInteger($groups);
     }
     $this->setState('filter.groups', $groups);
     $excluded = json_decode(base64_decode($app->input->get('excluded', '', 'BASE64')));
     if (isset($excluded)) {
         JArrayHelper::toInteger($excluded);
     }
     $this->setState('filter.excluded', $excluded);
     // Load the parameters.
     $params = JComponentHelper::getParams('com_users');
     $this->setState('params', $params);
     // List state information.
     parent::populateState('a.name', 'asc');
 }
Example #18
0
 /**
  * Verifies that the authentication sent by Google Checkout matches the
  * merchant id and key
  *
  * @param string $headers the headers from the request
  */
 function HttpAuthentication($headers = null, $die = true)
 {
     if (!is_null($headers)) {
         $_SERVER = $headers;
     }
     if (isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
         $compare_mer_id = $_SERVER['PHP_AUTH_USER'];
         $compare_mer_key = $_SERVER['PHP_AUTH_PW'];
     } else {
         if (isset($_SERVER['HTTP_AUTHORIZATION'])) {
             list($compare_mer_id, $compare_mer_key) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], strpos($_SERVER['HTTP_AUTHORIZATION'], " ") + 1)));
         } else {
             if (isset($_SERVER['Authorization'])) {
                 list($compare_mer_id, $compare_mer_key) = explode(':', base64_decode(substr($_SERVER['Authorization'], strpos($_SERVER['Authorization'], " ") + 1)));
             } else {
                 $this->SendFailAuthenticationStatus("Failed to Get Basic Authentication Headers", $die);
                 return false;
             }
         }
     }
     if ($compare_mer_id != $this->merchant_id || $compare_mer_key != $this->merchant_key) {
         $this->SendFailAuthenticationStatus("Invalid Merchant Id/Key Pair", $die);
         return false;
     }
     return true;
 }
Example #19
0
 public static function getPhotos($params)
 {
     $photos = $params->get('gallery');
     $photos = json_decode(base64_decode($photos));
     switch ($params->get('display_order', 'ordering')) {
         case 'title_asc':
             for ($i = 0; $i < count($photos) - 1; $i++) {
                 for ($j = $i + 1; $j < count($photos); $j++) {
                     $temp = $photos[$i];
                     if (strcmp($photos[$i]->title, $photos[$j]->title) > 0) {
                         $photos[$i] = $photos[$j];
                         $photos[$j] = $temp;
                     }
                 }
             }
             break;
         case 'title_desc':
             for ($i = 0; $i < count($photos) - 1; $i++) {
                 for ($j = $i + 1; $j < count($photos); $j++) {
                     $temp = $photos[$i];
                     if (strcmp($photos[$i]->title, $photos[$j]->title) < 0) {
                         $photos[$i] = $photos[$j];
                         $photos[$j] = $temp;
                     }
                 }
             }
             break;
         case 'random':
             shuffle($photos);
             break;
         default:
             break;
     }
     return $photos;
 }
Example #20
0
	/**
	 * Completes the last stuff required for a user to become setup from an invitation.  Similar to activate but without the password
	 *
	 * @return void
	 * @author Clark Endrizzi
	 **/
	public function complete_invite($user_id, $timestamp){
    	$this->db->set('user_status', true);
		$this->db->where('user_id', $user_id);
		$this->db->where('timestamp', base64_decode($timestamp));
		$this->db->update('cn_users');
		return $this->db->affected_rows();
    }	
Example #21
0
 public static function createTempFile($data)
 {
     $tmpFile = tmpfile();
     fwrite($tmpFile, base64_decode($data));
     fseek($tmpFile, 0);
     return $tmpFile;
 }
 public function validateDigest($digest, $nonce, $created, $secret)
 {
     // Generate created Token time difference
     $now = new \DateTime('now', new \DateTimeZone('UTC'));
     $then = new \Datetime($created, new \DateTimeZone('UTC'));
     $diff = $now->diff($then, true);
     // Check created time is not in the future
     if (strtotime($created) > time()) {
         throw new AuthenticationException("Back to the future...");
     }
     // Validate timestamp is recent within 5 minutes
     $seconds = time() - strtotime($created);
     if ($seconds > 300) {
         throw new AuthenticationException('Expired timestamp.  Seconds: ' . $seconds);
     }
     // Validate nonce is unique within 5 minutes
     if (file_exists($this->cacheDir . '/' . $nonce) && file_get_contents($this->cacheDir . '/' . $nonce) + 300 > time()) {
         throw new NonceExpiredException('Previously used nonce detected');
     }
     if (!is_dir($this->cacheDir)) {
         mkdir($this->cacheDir, 0777, true);
     }
     file_put_contents($this->cacheDir . '/' . $nonce, time());
     // Validate Secret
     $expected = base64_encode(sha1(base64_decode($nonce) . $created . $secret, true));
     // Return TRUE if our newly-calculated digest is the same as the one provided in the validateDigest() call
     return $expected === $digest;
 }
Example #23
0
 /**
  * Output binary image from base-64 encoded data.
  *
  * @deprecated 1.5.1
  *
  * @param string $imageData Base-64 encoded image data (via $_POST)
  */
 public static function outputBinaryImage()
 {
     Piwik::checkUserHasSomeViewAccess();
     $rawData = Piwik_Common::getRequestVar('imageData', '', 'string', $_POST);
     // returns false if any illegal characters in input
     $data = base64_decode($rawData);
     if ($data !== false) {
         // check for PNG header
         if (Piwik_Common::substr($data, 0, 8) === "‰PNG\r\n\n") {
             header('Content-Type: image/png');
             // more robust validation (if available)
             if (function_exists('imagecreatefromstring')) {
                 // validate image data
                 $imgResource = @imagecreatefromstring($data);
                 if ($imgResource !== false) {
                     // output image and clean-up
                     imagepng($imgResource);
                     imagedestroy($imgResource);
                     exit;
                 }
             } else {
                 echo $data;
                 exit;
             }
         }
     }
     Piwik::setHttpStatus('400 Bad Request');
     exit;
 }
Example #24
0
 public function index()
 {
     // Get all active scheduled items
     foreach (ORM::factory('scheduler')->where('scheduler_active', '1')->find_all() as $scheduler) {
         $scheduler_id = $scheduler->id;
         $scheduler_last = $scheduler->scheduler_last;
         // Next run time
         $scheduler_weekday = $scheduler->scheduler_weekday;
         // Day of the week
         $scheduler_day = $scheduler->scheduler_day;
         // Day of the month
         $scheduler_hour = $scheduler->scheduler_hour;
         // Hour
         $scheduler_minute = $scheduler->scheduler_minute;
         // Minute
         // Controller that performs action
         $scheduler_controller = $scheduler->scheduler_controller;
         if ($scheduler_day <= -1) {
             // Ran every day?
             $scheduler_day = "*";
         }
         if ($scheduler_weekday <= -1) {
             // Ran every day?
             $scheduler_weekday = "*";
         }
         if ($scheduler_hour <= -1) {
             // Ran every hour?
             $scheduler_hour = "*";
         }
         if ($scheduler_minute <= -1) {
             // Ran every minute?
             $scheduler_minute = "*";
         }
         $scheduler_cron = $scheduler_minute . " " . $scheduler_hour . " " . $scheduler_day . " * " . $scheduler_weekday;
         //Start new cron parser instance
         $cron = new CronParser($scheduler_cron);
         $lastRan = $cron->getLastRan();
         //Array (0=minute, 1=hour, 2=dayOfMonth, 3=month, 4=week, 5=year)
         $cronRan = mktime($lastRan[1], $lastRan[0], 0, $lastRan[3], $lastRan[2], $lastRan[5]);
         if (!($scheduler_last > $cronRan - 45) || $scheduler_last == 0) {
             // within 45 secs of cronRan time, so Execute control
             $site_url = "http://" . $_SERVER['SERVER_NAME'] . "/";
             $scheduler_status = remote::status($site_url . "scheduler/" . $scheduler_controller);
             // Set last time of last execution
             $schedule_time = time();
             $scheduler->scheduler_last = $schedule_time;
             $scheduler->save();
             // Record Action to Log
             $scheduler_log = new Scheduler_Log_Model();
             $scheduler_log->scheduler_id = $scheduler_id;
             $scheduler_log->scheduler_name = $scheduler->scheduler_name;
             $scheduler_log->scheduler_status = $scheduler_status;
             $scheduler_log->scheduler_date = $schedule_time;
             $scheduler_log->save();
         }
     }
     Header("Content-Type: image/gif");
     // Transparent GIF
     echo base64_decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
 }
Example #25
0
 function decrypt($text, $salt)
 {
     if (!function_exists('mcrypt_encrypt') || !function_exists('mcrypt_decrypt')) {
         return $text;
     }
     return trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $salt, base64_decode($text), MCRYPT_MODE_ECB, mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB), MCRYPT_RAND)));
 }
Example #26
0
function page()
{
    $tpl = new templates();
    $sock = new sockets();
    $ID = $_GET["ID"];
    if (!is_numeric($ID)) {
        $ID = 0;
    }
    $page = CurrentPageName();
    $tpl = new templates();
    $users = new usersMenus();
    $TB_HEIGHT = 400;
    $TB_WIDTH = 874;
    $path = base64_decode($_GET["path"]);
    $md5path = md5($path);
    $mailboxes = $tpl->_ENGINE_parse_body("{mailboxes}");
    $domains = $tpl->javascript_parse_text("{domains}");
    $t = time();
    $new_entry = $tpl->_ENGINE_parse_body("{new_rule}");
    $files = $tpl->_ENGINE_parse_body("{files}");
    $deletemailbox_infos = $tpl->javascript_parse_text("{deletemailbox_infos}");
    $help = $tpl->_ENGINE_parse_body("{online_help}");
    $EnableVirtualDomainsInMailBoxes = $sock->GET_INFO("EnableVirtualDomainsInMailBoxes");
    if (!is_numeric($EnableVirtualDomainsInMailBoxes)) {
        $EnableVirtualDomainsInMailBoxes = 0;
    }
    if ($EnableVirtualDomainsInMailBoxes == 1) {
        $swicthdomains = "{name: '{$domains}', bclass: 'Search', onpress : domains{$t}},";
    }
    $title = $tpl->javascript_parse_text("{mailboxes}");
    $buttons = "\n\tbuttons : [\n\t{name: '{$help}', bclass: 'Help', onpress : ItemHelp{$t}},{$swicthdomains}\n\t],\t";
    $html = "\n\t<table class='flexRT{$t}' style='display: none' id='flexRT{$t}' style='width:99%'></table>\n<script>\nvar mem{$t}='';\n\$(document).ready(function(){\n\$('#flexRT{$t}').flexigrid({\n\turl: '{$page}?items-list=yes&t={$t}&domain=',\n\tdataType: 'json',\n\tcolModel : [\t\n\t\t{display: '&nbsp;', name : 'action', width :31, sortable : false, align: 'center'},\n\t\t{display: '{$mailboxes}', name : 'mailbox', width :757, sortable : false, align: 'left'},\n\t\t{display: '&nbsp;', name : 'action', width :31, sortable : false, align: 'center'},\n\n\t],\n\t{$buttons}\n\n\tsearchitems : [\n\t\t{display: '{$mailboxes}', name : 'files'},\n\t],\n\tsortname: 'files',\n\tsortorder: 'asc',\n\tusepager: true,\n\ttitle: '<span id=title-{$t} style=font-size:22px>{$title}</span>',\n\tuseRp: true,\n\trp: 50,\n\tshowTableToggleBtn: false,\n\twidth: '99%',\n\theight: {$TB_HEIGHT},\n\tsingleSelect: true,\n\trpOptions: [10, 20, 30, 50,100,200,500]\n\t\n\t});   \n});\n\nfunction ItemHelp{$t}(){\n\ts_PopUpFull('http://www.mail-appliance.org/index.php?cID=330','1024','900');\n}\n\nvar x_DeleteRealMailBox{$t}= function (obj) {\n\t\$('#flexRT{$t}').flexReload();\t\n}\n\nfunction domains{$t}(){\n\tYahooWin2('550','{$page}?list-domains=yes&t={$t}','{$domains}');\n\n}\n\nfunction DeleteRealMailBox{$t}(mbx,id){\n\tif(confirm('{$deletemailbox_infos}: '+mbx)){\n\t\tvar XHR = new XHRConnection();\n\t\tXHR.appendData('DeleteRealMailBox',mbx);\n\t\tmem{$t}=id;\n\t\tXHR.sendAndLoad('{$page}', 'POST',x_DeleteRealMailBox{$t});\t\t\t\n\t}\n\t\n}\n\n\n</script>\n";
    echo $html;
}
Example #27
0
 /**
  * @param string $encryptedText
  * @return string
  */
 public function decrypt($encryptedText)
 {
     $encryptedTextDecoded = base64_decode($encryptedText);
     $ivDecoded = substr($encryptedTextDecoded, 0, $this->size);
     $encryptedTextDecoded = substr($encryptedTextDecoded, $this->size);
     return trim(mcrypt_decrypt($this->cypher, $this->key, $encryptedTextDecoded, $this->mode, $ivDecoded));
 }
Example #28
0
 /**
  * @param string $uuid
  * @param Profile\ApiClient $apiClient
  * @throws \RuntimeException
  * @return Profile
  */
 public static function fromUuid($uuid, ApiClient $apiClient = null)
 {
     if (is_null($apiClient)) {
         $apiClient = static::createApiClient();
     }
     $json = $apiClient->profileApi($uuid);
     if (is_null($json) || !isset($json->properties) || empty($json->properties) || !isset($json->properties[0]->value)) {
         throw new \RuntimeException('Error parsing JSON for UUID ' . $uuid);
     }
     $properties = base64_decode($json->properties[0]->value);
     if ($properties === false) {
         throw new \RuntimeException('Error parsing base64 properties for UUID ' . $uuid);
     }
     $properties = json_decode($properties);
     if (is_null($properties)) {
         throw new \RuntimeException('Error parsing JSON encoded properties for UUID ' . $uuid);
     }
     $profile = new Profile();
     $profile->uuid = $json->id;
     $profile->name = $json->name;
     if (isset($properties->isPublic)) {
         $profile->public = $properties->isPublic;
     }
     if (isset($properties->textures)) {
         if (isset($properties->textures->SKIN) && isset($properties->textures->SKIN->url)) {
             $profile->skinUrl = $properties->textures->SKIN->url;
         }
         if (isset($properties->textures->CAPE) && isset($properties->textures->CAPE->url)) {
             $profile->capeUrl = $properties->textures->CAPE->url;
         }
     }
     return $profile;
 }
 public static function base64_decode($string = null)
 {
     if (!is_string($string)) {
         return null;
     }
     return base64_decode(strtr($string, '-_,', '+/='));
 }
Example #30
0
 function __construct($id)
 {
     $db = Database::getDatabase();
     $this->data = $db->querySingle(sprintf("select * from exception_logging where id = %d", $id));
     if (!$this->data) {
         throw new NotFound();
     }
     $this->data['error_info'] = unserialize(base64_decode($this->data['error_info']));
     $pr = preg_quote(c()->getValue('report_format', 'app_root'), '#');
     if (!$this->data['error_info']['callstack']) {
         $this->data['error_info']['callstack'] = array();
     }
     $this->data['error_info']['callstack'] = array_merge(array(array('line' => $this->data['error_info']['line'], 'file' => $this->data['error_info']['file'], 'function' => 'throw', 'args' => array())), $this->data['error_info']['callstack']);
     foreach ($this->data['error_info']['callstack'] as &$csi) {
         if ($pr) {
             $csi['base_file'] = preg_replace("#^{$pr}/?#", '', $csi['file']);
             $csi['file'] = preg_replace("#^{$pr}/?#", '<R>/', $csi['file']);
             $csi['scm_link'] = $this->getWebSCMLink($csi['base_file'], $csi['line']);
         }
         if ($csi['class']) {
             $csi['call'] = sprintf('%s%s%s(%s)', $csi['class'], $csi['type'], $csi['function'], implode(', ', array_map(array($this, 'formatArgument'), $csi['args'])));
         } else {
             $csi['call'] = sprintf('%s(%s)', $csi['function'], implode(', ', array_map(array($this, 'formatArgument'), $csi['args'])));
         }
     }
     if ($fs = c()->getValue('report_format', 'interesting_custom_fields')) {
         $fs = explode(',', $fs);
         foreach ($fs as $f) {
             $this->data[$f] = $this->data['error_info'][$f];
         }
     }
 }