\$('#surcharge').text('{$surstr}'); } }); EOS; } $jsloads[] = <<<EOS \$('#pplus_submit').click(function() { lock_inputs(); \$('#pplus_container input').blur(); //trigger sanitize/validate functions unlock_inputs(); if (\$('input.error').length > 0) { \$('input.error:first').focus(); return false; } return true; }); \$('.watermark').watermark(); EOS; $jsincs[] = '<script type="text/javascript" src="' . $baseurl . '/include/jquery.watermark.min.js"></script>'; if ($jsloads) { $jsfuncs[] = '$(document).ready(function() { '; $jsfuncs = array_merge($jsfuncs, $jsloads); $jsfuncs[] = '}); '; } $tplvars['jsfuncs'] = $jsfuncs; echo StripeGate\Utils::ProcessTemplate($this, 'payplus.tpl', $tplvars);
//set relevant secret key if (isset($params['account'])) { $row = $db->GetRow('SELECT usetest,privtoken,testprivtoken FROM ' . cms_db_prefix() . 'module_sgt_account WHERE account_id=?', array($params['account'])); } else { $row = $db->GetRow('SELECT usetest,privtoken,testprivtoken FROM ' . cms_db_prefix() . 'module_sgt_account WHERE isdefault>0 AND isdefault>0'); } if ($row) { if ($row['usetest']) { if ($row['testprivtoken']) { $privkey = StripeGate\Utils::decrypt_value($this, $row['testprivtoken']); } else { $privkey = FALSE; } } else { if ($row['privtoken']) { $privkey = StripeGate\Utils::decrypt_value($this, $row['privtoken']); } else { $privkey = FALSE; } } } else { $privkey = FALSE; } if ($privkey) { Stripe\Stripe::setApiKey($privkey); //retrieve the request's body and parse it as JSON $input = @file_get_contents("php://input"); $event_json = json_decode($input); //TODO do something with $event_json echo 'WEBHOOK PROCESSING NOT YET SUPPORTED'; } else {
$mtype = mime_content_type($tmpname); $img = strpos($mtype, 'image/') === 0; } if (!$img) { $message = $this->Lang('err_file'); } } if (empty($message)) { $fp = StripeGate\Utils::GetUploadsPath($this); if ($fp) { $fp = cms_join_path($fp, $file_data['name']); if (!chmod($file_data['tmp_name'], 0644) || !cms_move_uploaded_file($file_data['tmp_name'], $fp)) { $message = $this->Lang('err_upload'); } else { //all good $sql = 'UPDATE ' . $pref . 'module_sgt_account SET iconfile=? WHERE account_id=?'; $db->Execute($sql, array($file_data['name'], $params['account_id'])); } } else { $message = $this->Lang('err_upload'); } } if (empty($message)) { $message = FALSE; } $this->Redirect($id, 'update', $returnid, array('account_id' => $params['account_id'], 'message' => $message)); } $name = $db->GetOne('SELECT name FROM ' . $pref . 'module_sgt_account WHERE account_id=?', array($params['account_id'])); $tplvars = array('start_form' => $this->CreateFormStart($id, 'upload_icon', $returnid, 'post', 'multipart/form-data'), 'end_form' => $this->CreateFormEnd(), 'hidden' => $this->CreateInputHidden($id, 'account_id', $params['account_id']), 'title' => $this->Lang('title_iconfile2', $name), 'chooser' => $this->CreateInputFile($id, 'iconfile', 'image/*', 48, 64), 'apply' => $this->CreateInputSubmit($id, 'upstart', $this->Lang('upload')), 'cancel' => $this->CreateInputSubmit($id, 'upcancel', $this->Lang('cancel')), 'help' => $this->Lang('help_iconupload')); echo StripeGate\Utils::ProcessTemplate($this, 'chooser.tpl', $tplvars);
$tplvars['title_updir'] = $this->Lang('title_updir'); $tplvars['input_updir'] = $this->CreateInputText($id, 'uploads_dir', $this->GetPreference('uploads_dir'), 30, 60) . '<br />' . $this->Lang('help_updir'); $tplvars['title_password'] = $this->Lang('title_password'); $pw = $this->GetPreference('masterpass'); if ($pw) { $pw = StripeGate\Utils::unfusc($pw); } $tplvars['input_password'] = $this->CreateTextArea(false, $id, $pw, 'masterpass', 'cloaked', $id . 'passwd', '', '', 40, 2); $jsincs[] = '<script type="text/javascript" src="' . $baseurl . '/include/jquery-inputCloak.min.js"></script>'; $jsloads[] = <<<EOS \$('#{$id}passwd').inputCloak({ type:'see4', symbol:'\\u25CF' }); EOS; if ($padm) { $tplvars['submit'] = $this->CreateInputSubmit($id, 'submit', $this->Lang('submit')); $tplvars['cancel'] = $this->CreateInputSubmit($id, 'cancel', $this->Lang('cancel')); } if ($jsloads) { $jsfuncs[] = '$(document).ready(function() { '; $jsfuncs = array_merge($jsfuncs, $jsloads); $jsfuncs[] = '}); '; } $tplvars['jsfuncs'] = $jsfuncs; $tplvars['jsincs'] = $jsincs; echo StripeGate\Utils::ProcessTemplate($this, 'adminpanel.tpl', $tplvars);
/** Export: @mod: reference to current StripeGate module object @account_id: optional account id, or array of such id's, default FALSE @record_id: optional record_id, or array of such id's, default FALSE @sep: optional field-separator for exported content, default ',' At least one of @account_id or @record_id must be provided. Returns: TRUE on success, or lang key for error message upon failure */ public function Export(&$mod, $account_id = FALSE, $record_id = FALSE, $sep = ',') { if (!($account_id || $record_id)) { return 'err_parameter'; } $fname = self::ExportName($mod, $account_id, $record_id); if ($mod->GetPreference('export_file', FALSE)) { $updir = StripeGate\Utils::GetUploadsPath($mod); if ($updir) { $filepath = $updir . DIRECTORY_SEPARATOR . $fname; $fp = fopen($filepath, 'w'); if ($fp) { $success = self::CSV($mod, $account_id, $record_id, $fp, $sep); fclose($fp); if ($success) { $url = StripeGate\Utils::GetUploadsUrl($mod) . '/' . $fname; @ob_clean(); @ob_clean(); header('Location: ' . $url); return TRUE; } } } } else { $csv = self::CSV($mod, $account_id, $record_id, FALSE, $sep); if ($csv) { $config = cmsms()->GetConfig(); if (!empty($config['default_encoding'])) { $defchars = trim($config['default_encoding']); } else { $defchars = 'UTF-8'; } if (ini_get('mbstring.internal_encoding') !== FALSE) { //conversion is possible $expchars = $mod->GetPreference('export_file_encoding', 'ISO-8859-1'); $convert = strcasecmp($expchars, $defchars) != 0; } else { $expchars = $defchars; $convert = FALSE; } @ob_clean(); @ob_clean(); header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private', FALSE); header('Content-Description: File Transfer'); //note: some older HTTP/1.0 clients did not deal properly with an explicit charset parameter header('Content-Type: text/csv; charset=' . $expchars); header('Content-Length: ' . strlen($csv)); header('Content-Disposition: attachment; filename=' . $fname); if ($convert) { echo mb_convert_encoding($csv, $expchars, $defchars); } else { echo $csv; } return TRUE; } } return 'err_export'; }
/* $oneset = new stdClass(); $oneset->title = $this->Lang(''); if ($pmod) $oneset->input = $this->CreateInput(); elseif () $oneset->input = else $oneset->input = $empty; $oneset->help = $this->Lang(''); $settings[] = $oneset; */ $tplvars['settings'] = $settings; if ($pmod) { $tplvars['submit'] = $this->CreateInputSubmit($id, 'submit', $this->Lang('submit')); $tplvars['cancel'] = $this->CreateInputSubmit($id, 'cancel', $this->Lang('cancel')); } else { $tplvars['submit'] = NULL; $tplvars['cancel'] = $this->CreateInputSubmit($id, 'cancel', $this->Lang('close')); } if ($jsloads) { $jsfuncs[] = '$(document).ready(function() { '; $jsfuncs = array_merge($jsfuncs, $jsloads); $jsfuncs[] = '}); '; } $tplvars['jsfuncs'] = $jsfuncs; $tplvars['jsincs'] = $jsincs; echo StripeGate\Utils::ProcessTemplate($this, 'update.tpl', $tplvars);