/**
  * Resource methods
  */
 public function get()
 {
     $action = new Action('common/currency');
     $data = $action->execute($this->registry);
     $response['currencies'] = $this->processCurrencies($data['currencies']);
     $this->response->setOutput($response);
 }
 /**
  * Resource methods
  */
 public function get()
 {
     $action = new Action('common/language');
     $data = $action->execute($this->registry);
     $response['languages'] = $this->processLanguages($data['languages']);
     $this->response->setOutput($response);
 }
Пример #3
0
 public function get()
 {
     $action = new Action('common/length');
     $data = $action->execute($this->registry);
     $response['length_units'] = $data['length_units'];
     $this->response->setOutput($response);
 }
Пример #4
0
 public function index()
 {
     // Route
     if (isset($this->request->get['route'])) {
         $route = $this->request->get['route'];
     } else {
         $route = 'common/dashboard';
     }
     $data = array();
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if (!is_null($result)) {
         return $result;
     }
     $action = new Action($route);
     // Any output needs to be another Action object.
     $output = $action->execute($this->registry, $data);
     // Trigger the post events
     $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
Пример #5
0
 public function get()
 {
     $action = new Action('common/order_status');
     $data = $action->execute($this->registry);
     $response['order_status'] = $data['order_status'];
     $this->response->setOutput($response);
 }
Пример #6
0
 public function index()
 {
     // Route
     if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
         $route = $this->request->get['route'];
     } else {
         $route = $this->config->get('action_default');
     }
     $data = array();
     // Sanitize the call
     $route = preg_replace('/[^a-zA-Z0-9_\\/]/', '', (string) $route);
     // Trigger the pre events
     $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if (!is_null($result)) {
         return $result;
     }
     $action = new Action($route);
     // Any output needs to be another Action object.
     $output = $action->execute($this->registry, $data);
     // Trigger the post events
     $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
Пример #7
0
 public function index()
 {
     // Route
     if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
         $route = $this->request->get['route'];
     } else {
         $route = $this->config->get('action_default');
     }
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if (!is_null($result)) {
         return $result;
     }
     // We dont want to use the loader class as it would make an controller callable.
     $action = new Action($route);
     // Any output needs to be another Action object.
     $output = $action->execute($this->registry);
     // Trigger the post events
     $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$data, &$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
Пример #8
0
 public function execute()
 {
     $moduleMetadata = parent::execute();
     $columns = array();
     $values = array();
     foreach ($moduleMetadata['fields'] as $field => $def) {
         $name = $field;
         if (!empty($def['name'])) {
             $name = $def['name'];
         }
         if (!$this->source->existParam($name)) {
             continue;
         }
         $columns[] = $name . ' = :' . $name;
         $values[':' . $name] = $this->source->getParam($name);
     }
     $q = "UPDATE :table SET :columns WHERE id = :id";
     $sql = strtr($q, array(':table' => $this->table, ':columns' => implode(', ', $columns)));
     $stmt = $this->pdo->prepare($sql);
     $values[':id'] = $this->id;
     foreach ($values as $name => $value) {
         $stmt->bindValue($name, $value);
     }
     $stmt->execute();
 }
Пример #9
0
 public function controller($route, $args = array())
 {
     $this->trigger->fire('pre.load.controller', array(&$route, &$args));
     $action = new Action($route, $args);
     $ret = $action->execute($this->registry);
     $this->trigger->fire('post.load.controller', array(&$route, &$ret));
     return $ret;
 }
Пример #10
0
 public function controller($route, $args = array())
 {
     if ($this->factory) {
         $action = $this->factory->newAction($route, $args);
     } else {
         $action = new Action($route, $args);
     }
     return $action->execute($this->registry);
 }
Пример #11
0
	public function trigger($key, &$arg = array()) {
		if (isset($this->data[$key])) {
			usort($this->data[$key], array("Event", "cmpByPriority"));
			foreach ($this->data[$key] as $event) {
				$action = new Action($event['action'], $arg);
				$action->execute($this->registry);
			}
		}
	}
Пример #12
0
 /**
  * @param string $key
  * @param array  $arg
  *
  * @return void
  */
 public function trigger($key, &$arg = array())
 {
     if (isset($this->data[$key])) {
         foreach ($this->data[$key] as $event) {
             $action = new Action($event, $arg);
             $action->execute($this->registry);
         }
     }
 }
Пример #13
0
 protected function confirmPayment($paymentMethodCode)
 {
     // Do not intercept view data because the mail send to user when confirming the order
     // may contain html from templates which are loaded through the loader's view method.
     $this->load->setInterceptViewData(false);
     // Internally execute the confirmation route.
     $action = new Action($this->payment->getPaymentConfirmationRoute($paymentMethodCode));
     $action->execute($this->registry);
 }
Пример #14
0
 public function controller($route)
 {
     // function arguments
     $args = func_get_args();
     // Remove the route
     array_shift($args);
     $action = new Action($route, $args);
     return $action->execute($this->registry);
 }
Пример #15
0
 public function testProductUrlRewrite()
 {
     $this->db->query("INSERT INTO `" . DB_PREFIX . "url_alias` SET query = 'product_id=1', keyword = 'product-1'");
     $this->config->set('config_seo_url', 1);
     $urlAction = new Action('common/seo_url');
     $urlAction->execute($this->registry);
     $link = $this->url->link('product/product', 'product_id=1');
     $this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=1'");
     $this->assertEquals(HTTPS_SERVER . 'product-1', $link, "Could not construct URL's alias");
 }
Пример #16
0
 /**
  * Resource methods
  */
 public function get($id = NULL)
 {
     $settings = array();
     $settings['limit'] = isset($this->request->get['limit']) ? $this->request->get['limit'] : self::DEFAULT_LIMIT;
     $settings['width'] = isset($this->request->get['image_width']) ? $this->request->get['image_width'] : self::DEFAULT_IMAGE_WIDTH;
     $settings['height'] = isset($this->request->get['image_height']) ? $this->request->get['image_height'] : self::DEFAULT_IMAGE_HEIGHT;
     $action = new Action('module/latest', $settings);
     $data = $action->execute($this->registry);
     $latestProducts = array('products' => $this->getLatestProducts($data));
     $this->response->setOutput($latestProducts);
 }
Пример #17
0
 private function execute(Action $action)
 {
     $result = $action->execute($this->registry);
     if ($result instanceof Action) {
         return $result;
     }
     if ($result instanceof Exception) {
         $action = $this->error;
         $this->error = null;
         return $action;
     }
 }
Пример #18
0
 /**
  * @param Action $action
  *
  * @return bool|object
  */
 private function execute($action)
 {
     $result = $action->execute($this->registry);
     if (is_object($result)) {
         $action = $result;
     } elseif ($result === false) {
         $action = $this->error;
         $this->error = '';
     } else {
         $action = false;
     }
     return $action;
 }
Пример #19
0
 public function controller($route, $data = array())
 {
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if ($result) {
         return $result;
     }
     $action = new Action($route);
     $output = $action->execute($this->registry, array(&$data));
     // Trigger the post events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/after', array(&$route, &$data, &$output));
     if ($result) {
         return $result;
     }
     return $output;
 }
Пример #20
0
 public function controller($route, $data = array())
 {
     // Sanitize the call
     $route = preg_replace('/[^a-zA-Z0-9_\\/]/', '', (string) $route);
     // Trigger the pre events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if ($result) {
         return $result;
     }
     $action = new Action($route);
     $output = $action->execute($this->registry, array(&$data));
     // Trigger the post events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/after', array(&$route, &$data, &$output));
     if (!$output instanceof Exception) {
         return $output;
     } else {
         return false;
     }
 }
Пример #21
0
 public function controller($route)
 {
     // Get args by reference
     $trace = debug_backtrace();
     $args = $trace[0]['args'];
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/before', $args);
     if (!is_null($result)) {
         return $result;
     }
     array_shift($args);
     $action = new Action($route);
     $output = $action->execute($this->registry, $args);
     // Trigger the post events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/after', array(&$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
Пример #22
0
 public function index()
 {
     if (isset($request->get['route'])) {
         $route = $request->get['route'];
     } else {
         $route = 'common/home';
     }
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/before');
     if (!is_null($result)) {
         return $result;
     }
     $action = new Action($route);
     $output = $action->execute($this->registry, $args);
     // Trigger the post events
     $result = $this->registry->get('event')->trigger('controller/' . $route . '/after', array(&$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
Пример #23
0
 public function controller($route, $args = array())
 {
     $action = new Action($route, $args);
     return $action->execute($this->registry);
 }
Пример #24
0
<div class="container">
	<div class="row">
		<div class="col-md-12">
		<h1>P&aacute;gina de prueba</h1>
		</div>
	</div>
	<hr>
	<div class="row">
		<div class="col-md-12">
	<?php 
Action::execute("actiontest", array("variable" => "un valor"));
?>
		</div>
	</div>
	<hr>
	<div class="row">
		<div class="col-md-12">
		<a href="index.php?action=actiontest" class="btn btn-primary">Visitar el action <b>actiontest</b> </a>
		</div>
	</div>

</div>
Пример #25
0
<?php

if (!isset($_SESSION["user_id"])) {
    Core::redir("./");
}
$frs = ConversationData::getConversations($_SESSION["user_id"]);
?>
<div class="container">
<div class="row">
    <div class="col-md-3">
<?php 
Action::execute("_userbadge", array("user" => Session::$user, "profile" => Session::$profile, "from" => "logged"));
Action::execute("_mainmenu", array());
?>
    </div>
    <div class="col-md-7">
    <h2>Conversaciones</h2>
    <?php 
if (count($frs) > 0) {
    ?>
      <table class="table table-bordered">
      <thead>
        <th>Amigo</th>
      </thead>
      <?php 
    foreach ($frs as $fr) {
        ?>
        <tr>
          <td>

          <?php 
Пример #26
0
?>
<div class="container">
<div class="row">
    <div class="col-md-3">
<?php 
Action::execute("_teambadge", array("user" => Session::$user, "team_id" => $_GET["id"]));
//Action::execute("_mainmenu",array());
?>
    </div>
    <div class="col-md-7">
    <!-- -->
    <?php 
Action::execute("_newteamstatus", array());
?>
    <?php 
echo Action::execute("_teamstatuses", array("user" => Session::$user, "team_id" => $_GET["id"]));
?>
      <!-- -->
    </div>
    <div class="col-md-2">
    </div>
  </div>
</div>


</div>
<script>
function like(type,id){
  var base = "lk";
  if(type==2){ base = "ilk"; }
  $.post("index.php?action=addheart","t="+type+"&r="+id,function(data){
Пример #27
0
$user = UserData::getById($_GET["uid"]);
$profile = ProfileData::getByUserId($user->id);
?>

<div class="container">
<div class="row">
    <div class="col-md-3">
<?php 
Action::execute("_userbadge", array("user" => $user, "profile" => $profile, "from" => "logged"));
Action::execute("_usermenu", array("user" => $user));
?>
    </div>
    <div class="col-md-7">
    <!-- -->
    <?php 
echo Action::execute("_photos", array("user" => $user, "profile" => $profile, "from" => "logged"));
?>
      <!-- -->
    </div>
    <div class="col-md-2">
    </div>
  </div>
</div>


</div>
<script>
function like(type,id){
  var base = "lk";
  if(type==2){ base = "ilk"; }
  $.post("index.php?action=addheart","t="+type+"&r="+id,function(data){
Пример #28
0


        </div><!-- /.navbar-collapse -->
      </nav>

      <div id="page-wrapper">

<?php 
// puedo cargar otras funciones iniciales
// dentro de la funcion donde cargo la vista actual
// como por ejemplo cargar el corte actual
if (isset($_SESSION["admin_id"])) {
    View::load("index");
} else {
    Action::execute("login", array());
}
?>



      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->

    <!-- JavaScript -->

<script type="text/javascript" src="js/jquery.min.js"></script>
<script src="res/bootstrap3/js/bootstrap.min.js"></script>

  </body>
Пример #29
0
date_default_timezone_set('PRC');
$time = time();
session_start();
require_once 'config.php';
require_once ENGINE . 'action.php';
require_once ENGINE . 'controller.php';
require_once ENGINE . 'loader.php';
require_once ENGINE . 'model.php';
require_once ENGINE . 'registry.php';
require_once ENGINE . 'request.php';
require_once ENGINE . 'response.php';
require_once ENGINE . 'session.php';
require_once ENGINE . 'zjhsql.php';
$registry = new Registry();
$req = new request();
$res = new Response();
$session = new Session();
$load = new Loader($registry);
$db = ZjhSql::getInstance(SERVERNAME, DBNAME, USERNAME, PASSWORD);
$res->addHeader('Content-Type: text/html; charset=utf-8');
$registry->set('req', $req);
$registry->set('res', $res);
$registry->set('session', $session);
$registry->set('load', $load);
$registry->set('db', $db);
$route = $req->server['REQUEST_URI'];
$action = new Action($route);
$output = $action->execute($registry);
$res->setOutput($output);
$res->output();
Пример #30
0
<?php

// $levels =LevelData::getAll();
$profile = ProfileData::getByUserId($_SESSION["user_id"]);
?>
<div class="container">
<div class="row">
    <div class="col-md-3">
<?php 
Action::execute("_userbadge", array("user" => Session::$user, "profile" => Session::$profile, "from" => "logged"));
Action::execute("_infomenu", array());
?>

    </div>
    <div class="col-md-7">
<h1>Editar Informacion</h1>

<form role="form" enctype="multipart/form-data" method="post" action="./?action=updateinformation">
  <div class="form-group">
    <label for="exampleInputFile">Imagen de Perfil (100x100)</label>
    <input type="file" name="image">
  </div>
  <div class="form-group">
    <label for="exampleInputEmail1">Titulo</label>
    <input type="text" name="title" value="<?php 
echo $profile->title;
?>
" class="form-control"  placeholder="A que te dedicas??">
  </div>

  <div class="form-group">