public static function handleOnAfterInit()
 {
     // only allow GET requests
     if ($_SERVER['REQUEST_METHOD'] != 'GET' || defined('USE_FLASH') && (flash_get('success') != NULL || flash_get('error') != NULL)) {
         return;
     }
     $etagEnabled = ConfigOptions::getValue('three_o_four_etag_enabled');
     $cacheEnabled = ConfigOptions::getValue('three_o_four_response_cache_enabled');
     $engineEnabled = $etagEnabled || $cacheEnabled;
     if (!$engineEnabled) {
         return;
     }
     $request = self::_getRequest();
     $request->three_o_four_emit_etag = $etagEnabled;
     if ($cacheEnabled && isset(self::$_routeMap[$request->matched_route])) {
         $cacheOpts = self::$_routeMap[$request->matched_route];
         //$request->three_o_four_cache_response = self::_isCacheableRequest($request);
         $request->three_o_four_cache_response = true;
         $request->three_o_four_cache_opts = $cacheOpts;
         if (($cacheData = self::_getFromCache($request)) !== NULL) {
             // if the user has no view permissions, continue request as usual to output the standard 403
             if (self::_checkPermissions($cacheData, $request)) {
                 self::_sendResponse($cacheData['content'], $cacheData['contentLength'], $cacheData['etag'], $cacheData['headers']);
                 exit;
             }
         }
     }
     $application = application();
     $application->events_manager->listen('on_shutdown', 'onShutdown', THREE_O_FOUR_MODULE);
     ob_start();
     $request->three_o_four_buffering_started = true;
 }
Beispiel #2
0
/**
 * Returns the events
 *
 * @return array
 */
function evt_list()
{
    $events = flash_get("events");
    if (!$events) {
        return array();
    }
    return $events;
}
/**
 * Render smarty flash box
 * 
 * No parameters expected
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 */
function smarty_function_flash_box($params, &$smarty)
{
    if ($message = flash_get('success')) {
        $id = 'success';
    } elseif ($message = flash_get('error')) {
        $id = 'error';
    } else {
        return '';
    }
    // if
    //return '<p id="' . $id . '" class="flash"><span class="flash_inner">' . $message . '</span></p>';
    //bof:mod
    return '<p id="' . $id . '" class="flash"><span class="flash_inner">' . strip_tags(html_entity_decode($message)) . '</span></p>';
    //eof:mod
}
// if
?>
        <div id="innerContentWrapper">
<?php 
if (!is_null(flash_get('success'))) {
    ?>
          <div id="success" onclick="this.style.display = 'none'"><?php 
    echo clean(flash_get('success'));
    ?>
</div>
<?php 
}
if (!is_null(flash_get('error'))) {
    ?>
          <div id="error" onclick="this.style.display = 'none'"><?php 
    echo clean(flash_get('error'));
    ?>
</div>
<?php 
}
?>

          <h1 id="pageTitle"><?php 
echo get_page_title();
?>
</h1>
          <div id="pageContent">
            <div id="content">
              <!-- Content -->
              <?php 
echo $content_for_layout;
Beispiel #5
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
  <head>
    <title><?php echo get_page_title() ?></title>
<?php echo stylesheet_tag('dialog.css') ?>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<?php echo add_javascript_to_page('login.js') ?> 
<?php echo meta_tag('content-type', 'text/html; charset=utf-8', true) ?> 
<link rel="Shortcut Icon" href="<?php echo ROOT_URL ?>/favicon.ico?086" type="image/x-icon" />
<?php echo render_page_head() ?>
  </head>
  <body>
    <div style="margin: 150px auto; width: 414px; 1text-align: center;">
      <img src="public/files/logo.png" style="margin: 0 auto 10px;" />
      <div id="dialog">
        <h1><?php echo get_page_title() ?></h1>
        <?php foreach (array('success', 'error') as $message_type): if (!is_null(flash_get($message_type))): ?>
        <div class="flash-message" id="<?php echo $message_type ?>">
          <p><?php echo clean(flash_get($message_type)) ?></p>
          <div class="hide-flash">x</div>
          <div class="clear"></div>
        </div>
        <?php endif; endforeach; ?>
        <?php echo $content_for_layout ?>
      </div>
    </div>
  </body>
</html>
<?php } // if {?>
<?php } // foreach ?>
            </ul>
<?php } // if ?>
          </div>
        </div>
      </div>
      
      <!-- content wrapper -->
      <div id="outerContentWrapper">
        <div id="innerContentWrapper">
<?php if (!is_null(flash_get('success'))) { ?>
          <div id="success" onclick="this.style.display = 'none'"><?php echo clean(flash_get('success')) ?></div>
<?php } ?>
<?php if (!is_null(flash_get('error'))) { ?>
          <div id="error" onclick="this.style.display = 'none'"><?php echo clean(flash_get('error')) ?></div>
<?php } ?>

          <div id="pageHeader"><span id="pageTitle"><?php echo get_page_title() ?></span><?php include('pageoptions.php'); ?></div>
          <div id="pageContent">
            <div id="content">
              <!-- Content -->
              <?php echo $content_for_layout ?>
              <!-- /Content -->
            </div>
<?php if (isset($content_for_sidebar)) { ?>
            <div id="sidebar"><?php echo $content_for_sidebar ?></div>
<?php } // if ?>
            <div class="clear"></div>
          </div>
        </div>
Beispiel #7
0
<?php
set_page_title(lang("error"));
echo flash_get("error");
?>
Beispiel #8
0
<?php foreach (page_actions() as $page_action) { ?>
                <li><a href="<?php echo $page_action->getURL() ?>"><?php echo clean($page_action->getTitle()) ?></a></li>
<?php } // foreach ?>
              </ul>
            </div>
          </div>
        </div>
<?php } else { // if ?>
        <div style="height:1px"></div>
<?php } // if ?>
        <div id="innerContentWrapper">
<?php if (!is_null(flash_get('success'))) { ?>
          <div id="success"><?php echo clean(flash_get('success')) ?></div>
<?php } ?>
<?php if (!is_null(flash_get('error'))) { ?>
          <div id="error"><?php echo clean(flash_get('error')) ?></div>
<?php } ?>

          <h1 id="pageTitle"><?php echo get_page_title() ?></h1>
          <div id="pageContent">
            <div id="content">
              <!-- Content -->
              <?php echo $content_for_layout ?>
              <!-- /Content -->
            </div>
<?php if (isset($content_for_sidebar)) { ?>
            <div id="sidebar"><?php echo $content_for_sidebar ?></div>
<?php } // if ?>
            <div class="clear"></div>
          </div>
        </div>
 public function testForFlashSetterGetter()
 {
     // 1.
     $msg = 'This is success flash message.';
     flash_set($msg);
     $msg = '<span class="success">' . $msg . '</span>';
     $expectedOutput = '<div class="message success" style="display:block;"><ul><li>' . $msg . '</li></ul></div>';
     $this->assertEqual(flash_get(), $expectedOutput);
     // 2.
     $msg = 'This is error flash message.';
     flash_set($msg, null, 'error');
     $msg = '<span class="error">' . $msg . '</span>';
     $expectedOutput = '<div class="message error" style="display:block;"><ul><li>' . $msg . '</li></ul></div>';
     $this->assertEqual(flash_get(), $expectedOutput);
     // 3.
     $msg = array('(1) This is array of flash messages.', '(2) This is array of flash messages.');
     flash_set($msg, null, 'error');
     $expectedOutput = '<div class="message error" style="display:block;"><ul>';
     $expectedOutput .= '<li><span class="error">(1) This is array of flash messages.</span></li>';
     $expectedOutput .= '<li><span class="error">(2) This is array of flash messages.</span></li>';
     $expectedOutput .= '</ul></div>';
     $this->assertEqual(flash_get(), $expectedOutput);
 }
Beispiel #10
0
<div class="container-box">
    <form method="post" id="frmLogin">
    <div class="box">
        <div class="logo"><img src="<?php 
echo _img('logo.png');
?>
" /></div>
        <div class="form">
            <?php 
if ($msg = flash_get()) {
    echo $msg;
} else {
    ?>
                <div class="message error"></div>
            <?php 
}
?>
            <div class="row">
                <div class="entry"><input type="text" name="txtUsername" id="txtUsername" class="large full-width" placeholder="<?php 
echo _t('Username');
?>
" /></div>
            </div>
            <div class="row">
                <div class="entry pwd">
                    <input type="password" name="txtPwd" id="txtPwd" class="large full-width" placeholder="<?php 
echo _t('Password');
?>
" />
                    <a href="#" title="<?php 
echo _t('Forgot password?');
Beispiel #11
0
/**
 * The view.php (required) is a visual output representation to user using data provided by query.php.
 * It generally should contain HTML between <body> and </body>.
 */
include _i('inc/tpl/header.php');
?>

<h3><?php 
echo $pageTitle;
?>
</h3>
<p>This is an example page which shows generic file upload handling.</p>
<p>
    <form id="frmUpload" method="post" class="no-ajax" enctype="multipart/form-data">
        <?php 
echo flash_get('file-upload-success');
?>
        <div class="message"></div>
        <div class="table">
            <div class="row">
                <input type="file" name="filImage" id="filImage" />
            </div>
            <div class="row">
                <input type="submit" name="btnUpload" value="<?php 
echo _t('Upload');
?>
" class="button green" />
            </div>
        </div>
        <?php 
form_token();
Beispiel #12
0
/**
 * The view.php (required) is a visual output representation to user using data provided by query.php.
 * It generally should contain HTML between <body> and </body>.
 */
include _i('inc/tpl/header.php');
?>

<h3><?php 
echo $pageTitle;
?>
</h3>
<p>This is an example page which shows generic form handling without AJAX.</p>
<p>
    <form id="frmComment" method="post" class="no-ajax">
        <?php 
echo flash_get('comment_posted');
?>
        <div class="message"></div>
        <div class="table">
            <div class="row">
                <input type="text" name="txtName" size="40" value="<?php 
echo form_value('txtName');
?>
" placeholder="<?php 
echo _t('Enter your name *');
?>
" />
            </div>
            <div class="row">
                <input type="text" name="txtEmail" size="50" value="<?php 
echo form_value('txtEmail');