Example #1
0
    /**
     * Raises a new error message
     * @param integer $errNo
     * @param string $errMsg
     * @param string $file
     * @param integer $line
     * @return void
     * @access public
     */
    public function raise($errNo = false, $errMsg = 'An unidentified error occurred.', $file = false, $line = false)
    {
        // die if no errornum
        if (!$errNo) {
            return;
        }
        while (ob_get_level()) {
            ob_end_clean();
        }
        $errType = array(1 => "PHP Error", 2 => "PHP Warning", 4 => "PHP Parse Error", 8 => "PHP Notice", 16 => "PHP Core Error", 32 => "PHP Core Warning", 64 => "PHP Compile Error", 128 => "PHP Compile Warning", 256 => "PHP User Error", 512 => "PHP User Warning", 1024 => "PHP User Notice", 2048 => "Unknown", 4096 => "Unknown", 8192 => "Deprecated");
        $trace = array();
        $db = debug_backtrace();
        foreach ($db as $file_t) {
            if (isset($file_t['file'])) {
                $trace[] = array('file' => $file_t['file'], 'line' => $file_t['line'], 'function' => $file_t['function']);
            }
        }
        // determine uri
        if (is_object(app()->router) && method_exists(app()->router, 'fullUrl')) {
            $uri = router()->fullUrl();
        } else {
            $uri = $this->getServerValue('REQUEST_URI');
        }
        $error = array('application' => app()->config('application'), 'version_complete' => VERSION_COMPLETE, 'version' => VERSION, 'build' => BUILD, 'date' => date("Y-m-d H:i:s"), 'gmdate' => gmdate("Y-m-d H:i:s"), 'visitor_ip' => $this->getServerValue('REMOTE_ADDR'), 'referrer_url' => $this->getServerValue('HTTP_REFERER'), 'request_uri' => $uri, 'user_agent' => $this->getServerValue('HTTP_USER_AGENT'), 'error_type' => $errType[$errNo], 'error_message' => $errMsg, 'error_no' => $errNo, 'file' => $file, 'line' => $line, 'trace' => empty($trace) ? false : $trace);
        // if we're going to save to a db
        if (app()->config('save_error_to_db') && app()->checkDbConnection()) {
            $error_sql = sprintf('
				INSERT INTO error_log (
					application, version, date, visitor_ip, referer_url, request_uri,
					user_agent, error_type, error_file, error_line, error_message)
				VALUES ("%s","%s","%s","%s","%s","%s","%s","%s","%s","%s","%s")', mysql_real_escape_string($error['application']), mysql_real_escape_string($error['version_complete']), mysql_real_escape_string($error['date']), mysql_real_escape_string($error['visitor_ip']), mysql_real_escape_string($error['referrer_url']), mysql_real_escape_string($error['request_uri']), mysql_real_escape_string($error['user_agent']), mysql_real_escape_string($error['error_no']), mysql_real_escape_string($error['file']), mysql_real_escape_string($error['line']), mysql_real_escape_string($error['error_message']));
            if (!app()->db->Execute($error_sql)) {
                print 'There was an error trying to log the most recent error to the database:<p>' . app()->db->ErrorMsg() . '<p>Query was:</p>' . $error_sql;
                exit;
            }
        }
        // if logging exists, log this error
        if (isset(app()->log) && is_object(app()->log)) {
            app()->log->write(sprintf('ERROR (File: %s/%s: %s', $error['file'], $error['line'], $error['error_message']));
        }
        // If we need to display this error, do so
        if ($errNo <= app()->config('minimum_displayable_error')) {
            if (!app()->env->keyExists('SSH_CLIENT') && !app()->env->keyExists('TERM') && !app()->env->keyExists('SSH_CONNECTION') && app()->server->keyExists('HTTP_HOST')) {
                template()->setLayout('error');
                template()->display(array('error' => $error));
                exit;
            }
        }
        // post the errors to json-enabled api (snowy evening)
        if (app()->config('error_json_post_url')) {
            $params = array('api_key' => app()->config('error_json_post_api_key'), 'project_id' => app()->config('error_json_post_proj_id'), 'payload' => json_encode($error));
            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, app()->config('error_json_post_url'));
            curl_setopt($ch, CURLOPT_POST, count($error));
            curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $result = curl_exec($ch);
            curl_close($ch);
        }
    }
Example #2
0
function action()
{
    router();
    if (empty($_GET[0]) || $_GET[0] == 'index.php') {
        $_GET[0] = SCRIPT_NAME;
    }
    if (empty($_GET[1])) {
        $_GET[1] = 'main';
    }
    //$_GET = array_map('strtolower', $_GET);
    // $file = CONTROLLERS_PATH . $_GET[0] . '.php';
    $file = CONTROLLERS_PATH . $_GET[0] . '.php';
    // var_dump($file ,__FILE__);exit;
    if (!file_exists($file)) {
        errors();
        exit;
        //die('The server is busy, please try again later.');
    }
    // echo  $_GET[1];eixt;
    $c = new index();
    // if( !method_exists( $c, $_GET[1] ) )
    // {
    // 	errors();
    // 	exit();
    // 	//die('The server is busy, please try again later.');
    // }
    $c->{$_GET}[1]();
    // $c->display($c->tpl);
}
Example #3
0
 public function execute()
 {
     $ctrl = router()->getControllerName();
     if (strtolower($ctrl) == 'auth') {
         theme()->setLayout('layout.auth.tpl');
     }
 }
Example #4
0
 /**
  * Loads our index/default welcome/dashboard screen
  */
 public function view()
 {
     $form = new Form('config');
     // add all config variables to our form
     $sql = sprintf('SELECT * FROM config');
     $model = model()->open('config');
     $records = $model->results();
     if ($records) {
         foreach ($records as $record) {
             $value = $record['current_value'] == '' ? $record['default_value'] : $record['current_value'];
             $form->addField($record['config_key'], $value, $value);
         }
     }
     // process the form if submitted
     if ($form->isSubmitted()) {
         foreach (app()->params->getRawSource('post') as $field => $value) {
             $model->update(array('current_value' => $value), $field, 'config_key');
         }
         sml()->say('Website settings have been updated successfully.');
         router()->redirect('view');
     }
     $data['form'] = $form;
     $model = model()->open('pages');
     $model->where('page_is_live', 1);
     $data['pages'] = $model->results();
     //		$data['mods'] = app()->moduleControls();
     $data['themes'] = $this->listThemes();
     $data['live'] = settings()->getConfig('active_theme');
     template()->addCss('style.css');
     template()->addJs('admin/jquery.qtip.js');
     template()->addJs('view.js');
     template()->display($data);
 }
Example #5
0
 /**
  * Activates the default loading of the 404 error
  */
 public function error_404()
 {
     router()->header_code(404);
     template()->setLayout('404');
     template()->display();
     exit;
 }
Example #6
0
 function check()
 {
     $paypal = (new Paypal())->where('paypal_hash', router()->get('payment'))->oneOrFail();
     $accessToken = $this->getAccessToken();
     $arrData = ["payer_id" => $_GET['PayerID']];
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, "https://" . $this->config['endpoint'] . "/v1/payments/payment/" . $paypal->paypal_id . "/execute/");
     curl_setopt($ch, CURLOPT_HTTPHEADER, ["Authorization: Bearer " . $accessToken, "Content-Type: application/json"]);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($arrData));
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     $result = curl_exec($ch);
     curl_close($ch);
     if (empty($result)) {
         throw new Exception(__('error_title_cannot_execute_order'));
     } else {
         $json = json_decode($result);
         if (isset($json->state)) {
             // unknown error
             $paypal->set(["status" => $json->state, "paypal_payer_id" => $_GET['PayerID']])->save();
             /**
              * Handle successful payment.
              */
             if ($json->state == "approved") {
                 $this->order->getBills()->each(function (OrdersBill $ordersBill) use($paypal, $result) {
                     $ordersBill->confirm("Paypal " . $paypal->paypal_id . ' ' . $result, 'paypal');
                 });
             }
             if ($json->state == "pending") {
                 response()->redirect(url('derive.payment.waiting', ['handler' => 'paypal', 'order' => $this->order->getOrder()]));
                 /**
                  * Debug::addWarning(
                  * "Status naročila je <i>$json->state</i>. Ko bo naročilo potrjeno, vas bomo obvestili preko email naslova."
                  * );*/
             } else {
                 if ($json->state == "approved") {
                     response()->redirect(url('derive.payment.success', ['handler' => 'paypal', 'order' => $this->order->getOrder()]));
                 } else {
                     response()->redirect(url('derive.payment.error', ['handler' => 'paypal', 'order' => $this->order->getOrder()]));
                     /**
                      * Debug::addError(__('error_title_unknown_payment_status'));
                      *
                      */
                 }
             }
         } else {
             /*var_dump($json);
               echo '<pre>';
               print_r($json);
               echo '</pre>';
               echo $result;
               die("failed");*/
             response()->redirect(url('derive.payment.error', ['handler' => 'paypal', 'order' => $this->order->getOrder()]));
             /*Debug::addError(__('error_title_order_confirmation_failed'));*/
         }
     }
 }
Example #7
0
 public function authCheckRoute()
 {
     try {
         $route = (new RouteResolver())->resolve(router()->getUri());
     } catch (NotFound $e) {
         return true;
     }
     return $route->hasPermissionToView();
 }
Example #8
0
function start()
{
    if (!isset($_GET['page'])) {
        require 'views/home.php';
    } else {
        $page = $_GET['page'];
        router($page);
    }
}
Example #9
0
 public function isActive()
 {
     if (router()->getCleanUri() == $this->url) {
         return true;
     }
     if (router()->get('name') == 'dynamic.record.edit' && $this->url == '/dynamic/tables/list/' . explode('/', router()->getCleanUri())[4]) {
         return true;
     }
     return $this->isSubActive();
 }
Example #10
0
File: i18n.php Project: cruide/wasp
 public function __construct()
 {
     /**
      * Просматриваем какие языки есть
      */
     foreach ($this->lagnuages as $key => $val) {
         $LF = wasp_strtolower($key . '.php');
         if (!is_file(LANGUAGE_DIR . DIR_SEP . $LF)) {
             unset($this->lagnuages[$key]);
         }
     }
     unset($LF, $key, $val);
     /**
      * Смотрим язык установленный в конфиге
      */
     $config = cfg('config')->application;
     $DL = !empty($config->language) ? $config->language : null;
     if (!empty($DL) && array_key_isset($DL, $this->lagnuages)) {
         $this->DEFAULT_LANG = $this->CURRENT_LANG = wasp_strtoupper($DL);
     }
     unset($config, $DL);
     $cookie_lang = cookie()->get('LANG');
     if (!empty($cookie_lang) && array_key_isset($cookie_lang, $this->lagnuages)) {
         $this->CURRENT_LANG = $cookie_lang;
     }
     /**
      * Загружаем языковые пакеты
      */
     $this->strings = new stdObject();
     $default_lang_file = wasp_strtolower($this->DEFAULT_LANG . '.php');
     if (is_dir(LANGUAGE_DIR) && is_file(LANGUAGE_DIR . DIR_SEP . $default_lang_file)) {
         $default_lng_strings = (include LANGUAGE_DIR . DIR_SEP . $default_lang_file);
         if (array_count($default_lng_strings) > 0) {
             foreach ($default_lng_strings as $key => $val) {
                 if (is_varible_name($key) && is_scalar($val)) {
                     $this->strings->{$key} = $val;
                 }
             }
         }
     }
     if ($this->DEFAULT_LANG != $this->CURRENT_LANG) {
         $default_lang_file = wasp_strtolower($this->CURRENT_LANG . '.php');
         if (is_dir(LANGUAGE_DIR) && is_file(LANGUAGE_DIR . DIR_SEP . $default_lang_file)) {
             $default_lng_strings = (include LANGUAGE_DIR . DIR_SEP . $default_lang_file);
             if (array_count($default_lng_strings) > 0) {
                 foreach ($default_lng_strings as $key => $val) {
                     if (is_varible_name($key) && is_scalar($val)) {
                         $this->strings->{$key} = $val;
                     }
                 }
             }
         }
     }
     $this->getControllerLang(router()->getControllerName());
 }
Example #11
0
 public function __construct()
 {
     $this->config = cfg('config');
     $this->cookie = cookie();
     $this->router = router();
     $this->input = input();
     $this->session = session();
     if (method_exists($this, '_prepare')) {
         $this->_prepare();
     }
 }
Example #12
0
 public function execute(callable $next)
 {
     if ($this->request->isGet() && !$this->request->isAjax()) {
         $output = $this->response->getOutput();
         if (is_string($output) && substr($output, 0, 5) !== '<html' && strtolower(substr($output, 0, 9)) != '<!doctype') {
             $template = router()->get()['pckg']['generic']['template'] ?? 'Pckg\\Generic:generic';
             $output = Reflect::create(Generic::class)->wrapIntoGeneric($output, $template);
             $this->response->setOutput($output);
         }
     }
     return $next();
 }
Example #13
0
File: Seo.php Project: pckg/manager
    public function getOgTags()
    {
        $image = $this->image ? htmlspecialchars(config('url') . str_replace(' ', '%20', $this->image)) : '';
        $title = trim(strip_tags($this->title));
        $description = trim(strip_tags($this->description));
        return '<meta property="og:title" content="' . $title . '" />
		<meta property="og:site_name" content="' . $title . '" />
		<meta property="og:description" content="' . $description . '" />
		<meta property="og:type" content="website" />
		<meta property="og:url" content="' . router()->getUri(false) . '" />
		<meta property="fb:admins" content="1197210626" />
		<meta property="fb:app_id" content="' . config('pckg.manager.seo.app_id') . '" />
		<meta property="og:image" content="' . $image . '" />';
    }
Example #14
0
 /**
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setAttribute('action', router()->getUri());
     $this->setID('form' . array_reverse(explode('\\', get_class($this)))[0]);
     $this->setName('form' . array_reverse(explode('\\', get_class($this)))[0]);
     $this->setMethod('post');
     $this->setMultipart();
     foreach ($this->handlerFactory->create([Step::class]) as $handler) {
         $this->addHandler($handler);
     }
     $this->formFactory = new FormFactory();
     $this->addFieldset();
 }
Example #15
0
 public function __construct()
 {
     $this->config = cfg('config');
     $this->session = session();
     $this->input = input();
     $this->cookie = cookie();
     $this->layout = theme();
     $this->router = router();
     $this->ui = new Ui();
     $this->ui->enableSecurity('Wasp_Smarty_Security');
     $this->ui->setTemplateDir($this->layout->getThemePath() . DIR_SEP . 'views' . DIR_SEP);
     $temp_dir = TEMP_DIR . DIR_SEP . 'smarty' . DIR_SEP . theme()->getThemeName() . DIR_SEP . 'views';
     if (!is_dir($temp_dir)) {
         wasp_mkdir($temp_dir);
     }
     $this->ui->setCompileDir($temp_dir . DIR_SEP);
     //        $this->ui->setCacheDir('');
 }
Example #16
0
 public function getBreadcrumbs()
 {
     $breadcrumbs = [];
     /**
      * Dashboard is always displayed.
      */
     $breadcrumbs['/maestro'] = __('breadcrumbs.dashboard');
     /**
      * Check for table listing.
      */
     if ($table = router()->resolved('table')) {
         $breadcrumbs['/dynamic/tables/list/' . $table->id] = $table->title;
     }
     /**
      * Add current page.
      */
     if (!array_key_exists(router()->getUri(), $breadcrumbs)) {
         $breadcrumbs[router()->getUri()] = __('breadcrumbs.current');
     }
     return $breadcrumbs;
 }
Example #17
0
File: app.php Project: cruide/wasp
 private function _prepare()
 {
     $theme_url = theme()->getThemeUrl();
     $vars = ['base_url' => BASE_URL, 'content_url' => CONTENT_URL, 'core_name' => CORE_NAME, 'core_version' => CORE_VERSION, 'core_version_name' => CORE_VERSION_NAME, 'framework' => FRAMEWORK, 'timer_varible' => time(), 'theme_url' => $theme_url, 'css_url' => $theme_url . '/css', 'js_url' => $theme_url . '/js', 'images_url' => $theme_url . '/images', 'action' => router()->getAction(), 'controller_name' => router()->getControllerName(), 'method_name' => router()->getMethodName()];
     $config = cfg('config')->application;
     if (!empty($config->url_suffix)) {
         $vars['url_suffix'] = (string) $config->url_suffix;
     } else {
         $vars['url_suffix'] = '.html';
     }
     $msg = unserialize(pickup_temp('redirect'));
     if (!empty($msg['message'])) {
         $vars['redirect_message'] = $msg['message'];
     }
     if (!empty($msg['error'])) {
         $vars['redirect_error'] = $msg['error'];
     }
     $smarty = new \Smarty();
     foreach ($vars as $key => $val) {
         $smarty->assignGlobal($key, $val);
     }
     unset($theme, $config, $msg, $smarty, $key, $val);
 }
Example #18
0
					<a href="#" id="manage-langs">Manage Languages</a>
				</li>
				<li>
					<label for="specialties" class="required">Specialties:</label>
					<select id="specialties" name="Contact_specialties[]"  size="7" multiple="multiple"></select>
					<a href="#" id="manage-specialties">Manage Specialties</a>
				</li>
				<li>
					<label for="file_path">Picture:</label>
					<?php 
if ($images) {
    foreach ($images as $image) {
        ?>
					<div>
						<img src="<?php 
        print router()->getUploadsUrl() . '/contacts/' . $form->cv('id') . '/' . $image['filename_thumb'];
        ?>
" width="<?php 
        print $image['width_thumb'];
        ?>
" height="<?php 
        print $image['height_thumb'];
        ?>
" alt="Contact Profile Picture" />
						<a href="#" class="delete del-img" id="del-<?php 
        print $image['id'];
        ?>
">Delete</a>
					</div>
					<?php 
    }
Example #19
0
define('CORE_PATH', str_replace('\\', '/', dirname(__FILE__)));
require CORE_PATH . '/core.php';
if (!get_magic_quotes_gpc()) {
    !empty($_GET) && ($_GET = addslashes_deep($_GET));
    !empty($_POST) && ($_POST = addslashes_deep($_POST));
    !empty($_COOKIE) && ($_COOKIE = addslashes_deep($_COOKIE));
}
if (isset($_REQUEST['session_id'])) {
    session_id(trim($_REQUEST['session_id']));
}
session_start();
$router = array();
if (file_exists(APP_PATH . 'router.php')) {
    $router = (include APP_PATH . 'router.php');
}
$_uri = router($router);
define('MODULE', $_uri['module']);
define('ACTION', $_uri['action']);
require CORE_PATH . '/db.php';
$db = new db();
if (isset($config['DB_DRIVER'])) {
    $db->set_driver($config['DB_DRIVER']);
}
if (isset($config['DB_PREFIX'])) {
    $db->prefix($config['DB_PREFIX']);
}
$db_host = $config['DB_HOST'] . (isset($config['DB_PORT']) ? ':' . $config['DB_PORT'] : '');
$db->setting($db_host, $config['DB_USER'], $config['DB_PSWD'], $config['DB_NAME']);
$script = APP_PATH . 'action/' . MODULE . 'Action.php';
if (!file_exists($script)) {
    error_404('Can not find the action ' . MODULE . 'Action.php');
Example #20
0
<h2><?php 
print $this->text('success:title');
?>
</h2>
<p><?php 
print $this->text('success:intro');
?>
</p>
<p><a href="<?php 
print router()->interfaceUrl();
?>
"><?php 
print $this->text('success:link');
?>
</a></p>
Example #21
0
 /**
  * Processes a logout
  * @access public
  */
 public function logout()
 {
     user()->logout();
     router()->redirectToUrl(router()->interfaceUrl());
 }
Example #22
0
<?php

define('MODULE_DIR', dirname(__FILE__) . "/modules/");
//define('MODULE_DIR', ROOT_DIR."modules/");
require_once "./../Core/router.php";
echo "load home/view.php <br />";
router('home', 'view');
echo "View not found <br />";
router('home', '21212s');
//echo "module and view not found <br />";
//router('contacts', 'form');
Example #23
0
require_once "system/smtp.php";
require_once "model/required.fields.php";
onlineSystem();
// Inclui o controle solicitado na URL
if (router(0) != "") {
    // Para inclusão dos arquivos Model
    if (router(0) == "model") {
        if (file_exists("model/" . router(1) . ".php") == true) {
            include_once "model/" . router(1) . ".php";
        } else {
            // Carrega o contador sempre que chamar a home
            insertVisitor();
            insertDevice();
            include_once "controller/home.php";
        }
    } else {
        if (file_exists("controller/" . router(0) . ".php") == true) {
            // Carrega o contador de visitas apenas nos controladores de view
            insertVisitor();
            insertDevice();
            include_once "controller/" . router(0) . ".php";
        } else {
            include_once "controller/404.php";
        }
    }
} else {
    // Carrega o contador sempre que chamar a home
    insertVisitor();
    insertDevice();
    include_once "controller/home.php";
}
Example #24
0
<?php

/**
 * 微站管理
 * [WeEngine System] Copyright (c) 2013 WE7.CC
 */
define('IN_MOBILE', true);
require 'source/bootstrap.inc.php';
include model('mobile');
$actions = array('channel', 'module', 'auth', 'entry', 'cash');
if (in_array($_GPC['act'], $actions)) {
    $action = $_GPC['act'];
} else {
    $action = 'channel';
}
$controller = 'mobile';
require router($controller, $action);
Example #25
0
 * Template: Basic Image
 */
?>

<?php 
// check for valid large image
$image_loc = router()->getUploadsUrl() . DS . $content['image_filename'];
$server_loc = app()->config('upload_server_path') . DS . $content['image_filename'];
if (empty($content['image_filename']) || !file_exists($server_loc)) {
    $image_loc = router()->interfaceUrl('admin') . '/img/noImageAvailable.jpg';
}
// check for valid thumbnail
$image_thm = router()->getUploadsUrl() . DS . $content['image_thumbname'];
$server_loc = app()->config('upload_server_path') . DS . $content['image_thumbname'];
if (empty($content['image_filename']) || !file_exists($server_loc)) {
    $image_thm = router()->interfaceUrl('admin') . '/img/noImageAvailable.jpg';
}
$image_alt = empty($content['image_alt']) ? $content['title'] : $content['image_alt'];
?>

<div class="text-image-section">
<a href="'.$image_loc.'" class="thumb-display" rel="images[display]" title="'.$image_alt.'">
	<img class="thumb" src="'.$image_thm.'" alt="'.$image_alt.'" /></a>
<?php 
if (!empty($content['title']) && $content['show_title']) {
    ?>
<h4><?php 
    print htmlentities($content['title'], ENT_QUOTES, 'UTF-8');
    ?>
</h4>
<?php 
Example #26
0
}
?>
					<li>
						<label><?php 
if ($form->cv('id')) {
    ?>
Replace File:<?php 
} else {
    ?>
Upload File<?php 
}
?>
</label>
						<input type="file" name="pdf_filename" id="pdf_filename" />
						<a class="help" href="<?php 
print router()->moduleUrl();
?>
/help/news-pdf_attachment.htm" title="PDF Attachment">Help</a>
					</li>
				</ol>
			</fieldset>
			<?php 
if ($form->cv('id')) {
    ?>
			<a class="dark-button confirm" href="<?php 
    print $this->xhtmlUrl('delete', array('id' => $form->cv('id')));
    ?>
" title="Delete "><span>Delete</span></a>
			<?php 
}
?>
Example #27
0
  
  <script src="assets/js/jquery.min.js"></script>
  <script type="text/javascript">
    window.NREUM||(NREUM={});NREUM.info={"beacon":"bam.nr-data.net","errorBeacon":"bam.nr-data.net","licenseKey":"bceadb921a","applicationID":"3976906,3970295","transactionName":"JlpeF0ENCggEExtXTRZBXw5WEEkUDhNAVVRKXlI8UhASDQINUUcXFl1fFA==","queueTime":0,"applicationTime":179,"agent":"js-agent.newrelic.com/nr-741.min.js"}
  </script>
  <script src="https://content.jwplatform.com/libraries/XeGdlzmk.js"></script>
  <script src="assets/js/semantic-ui/semantic.min.js"></script>
  <script src="assets/js/semantic-ui/form.min.js"></script>
  <script src="assets/js/main.js"></script>

</head>
<body>


<?php 
router();
?>

<div class="ui fullscreen modal transition  scrolling" style="max-width:900px" >
    <i class="close icon"></i>
    <div class="header">
      Video arası test
    </div>
    <div class="content">
      <div class="ui form">
        <h4 class="ui dividing header">Videonun bu kısmına kadar anlatılanlardan, anladıklarınızı yazınız.</h4>
        <div class="field">
          <label>Cevap</label>
          <textarea></textarea>
        </div>
        <div class="field">
Example #28
0
 public function postStartPartial()
 {
     $payment = (new BraintreeEntity())->where('braintree_hash', router()->get('payment'))->oneOrFail();
     $price = $this->order->getTotal();
     $order = $this->order->getOrder();
     /**
      * @T00D00
      */
     if (false && !$order->getIsConfirmedAttribute()) {
         $order->ordersUser->each(function (OrdersUser $ordersUser) {
             if (!$ordersUser->packet->getAvailableStockAttribute()) {
                 response()->bad('Sold out!');
             }
         });
     }
     $payment->price = $price;
     $payment->save();
     $braintreeNonce = request()->post('payment_method_nonce');
     if (!$braintreeNonce) {
         response()->bad('Missing payment method nonce.');
     }
     if ($braintreeNonce == $payment->braintree_payment_method_nonce) {
         //User pressed F5. Load existing transaction.
         $result = Transaction::find($payment->braintree_transaction_id);
     } else {
         //Create a new transaction
         $transactionSettings = ['amount' => $this->getTotal(), 'paymentMethodNonce' => $braintreeNonce, 'options' => ['submitForSettlement' => true]];
         /**this was never set in old code
          * if (defined('BRAINTREE_MERCHANT_ACCOUNT_ID') && BRAINTREE_MERCHANT_ACCOUNT_ID) {
          * $transactionSettings['merchantAccountId'] = BRAINTREE_MERCHANT_ACCOUNT_ID;
          * }*/
         $result = Transaction::sale($transactionSettings);
     }
     //Check for errors
     if (!$result->success) {
         $payment->set(["state" => 'error', "braintree_payment_method_nonce" => $braintreeNonce, "error" => json_encode($result)])->save();
         /**
          * @T00D00 - redirect to error page with error $result->message
          */
         $this->environment->redirect($this->environment->url('derive.payment.error', ['handler' => 'braintree', 'order' => $this->order->getOrder()]));
     }
     //If everything went fine, we got a transaction object
     $transaction = $result->transaction;
     //Write what we got to the database
     $payment->set(["braintree_transaction_id" => $transaction->id, "braintree_payment_method_nonce" => $braintreeNonce, "state" => 'BT:' . $transaction->status]);
     $payment->save();
     //SUBMITTED_FOR_SETTLEMENT means it's practically paid
     if ($transaction->status == Transaction::SUBMITTED_FOR_SETTLEMENT) {
         $this->order->getBills()->each(function (OrdersBill $ordersBill) use($transaction) {
             $ordersBill->confirm("Braintree #" . $transaction->id, 'braintree');
         });
         $this->environment->redirect($this->environment->url('derive.payment.success', ['handler' => 'braintree', 'order' => $this->order->getOrder()]));
     } else {
         if ($transaction->status == Transaction::PROCESSOR_DECLINED) {
             $payment->set(["state" => 'BT:' . $transaction->status, "error" => print_r(["processorResponseCode" => $transaction->processorResponseCode, "processorResponseText" => $transaction->processorResponseText, "additionalProcessorResponse" => $transaction->additionalProcessorResponse], true)]);
             $payment->save();
             /**
              * @T00D00 - redirect to error page with error $transaction->processorResponseText
              */
             $this->environment->redirect($this->environment->url('derive.payment.error', ['handler' => 'braintree', 'order' => $this->order->getOrder()]));
         } else {
             if ($transaction->status == Transaction::GATEWAY_REJECTED) {
                 $payment->set(["state" => 'BT:' . $transaction->status, "error" => print_r(["gatewayRejectionReason" => $transaction->gatewayRejectionReason], true)]);
                 $payment->save();
                 /**
                  * @T00D00 - redirect to error page with error $transaction->gatewayRejectionReason
                  */
                 $this->environment->redirect($this->environment->url('derive.payment.error', ['handler' => 'braintree', 'order' => $this->order->getOrder()]));
             } else {
                 /**
                  * @T00D00 - redirect to error page with error 'Unknown payment error'
                  */
                 $this->environment->redirect($this->environment->url('derive.payment.error', ['handler' => 'braintree', 'order' => $this->order->getOrder()]));
             }
         }
     }
 }
Example #29
0
_template" name="page_sections[<?php 
print $next_id;
?>
][template]">
				<option value="0">--</option>
				<?php 
$template = isset($section['content']['template']) ? $section['content']['template'] : NULL;
if (is_array($templates)) {
    foreach ($templates as $option) {
        print '<option value="' . $option['FILENAME'] . '"' . ($template == $option['FILENAME'] ? ' selected="selected"' : '') . '>' . $option['NAME'] . '</option>';
    }
}
?>
				</select>
				<a class="help" href="<?php 
print router()->moduleUrl('Pages_Admin');
?>
/help/section-basic-placement_group.htm" title="Placement Group">Help</a>
			</li>
			<li class="tmce">
				<label for="basic_<?php 
print $next_id;
?>
_content">Content:</label>
				<textarea class="mce-editor content-area" name="page_sections[<?php 
print $next_id;
?>
][content]" id="basic_<?php 
print $next_id;
?>
_content" cols="40" rows="5"><?php 
Example #30
0
<?php

// Default index page
router('GET', '^/$', function () {
    // Redirect request to controller
    $controller = new \App\Controller\IndexController();
    $controller->index();
});
// Page
router('GET', '^/company$', function () {
    echo "ACME";
});
// Sub page, available for GET and POST method
// /page/page2
router(['GET', 'POST'], '^/page/page2$', function () {
    echo "Yeah!";
});
// With named groups
// /hello/max/100
router('GET', '^/hello/(?<name>\\w+)/(?<id>\\d+)$', function ($params) {
    echo "Hello:";
    print_r($params);
});
header("HTTP/1.0 404 Not Found");
echo '404 Not Found';