Exemplo n.º 1
0
 /**
  * The action handler of kitForm - call this function after creating a new
  * instance of kitForm!
  *
  * @return string result
  */
 public function action()
 {
     // we can ignore calls by DropletsExtions...
     if (isset($_SESSION['DROPLET_EXECUTED_BY_DROPLETS_EXTENSION'])) {
         return '- passed call by DropletsExtension -';
     }
     // CSS laden?
     if (defined('CAT_VERSION')) {
         if ($this->params[self::PARAM_CSS]) {
             if (!CAT_Helper_Droplet::is_registered_droplet_css('kit_form', PAGE_ID)) {
                 CAT_Helper_Droplet::register_droplet_css('kit_form', PAGE_ID, 'kit_form', 'kit_form.css');
             }
         } elseif (CAT_Helper_Droplet::is_registered_droplet_css('kit_form', PAGE_ID)) {
             CAT_Helper_Droplet::unregister_droplet_css('kit_form', PAGE_ID);
         }
     } else {
         if ($this->params[self::PARAM_CSS]) {
             if (!is_registered_droplet_css('kit_form', PAGE_ID)) {
                 register_droplet_css('kit_form', PAGE_ID, 'kit_form', 'kit_form.css');
             }
         } elseif (is_registered_droplet_css('kit_form', PAGE_ID)) {
             unregister_droplet_css('kit_form', PAGE_ID);
         }
     }
     // check dependency
     $this->checkDependency();
     if ($this->isError()) {
         return sprintf('<a name="%s"></a><div class="error">%s</div>', self::FORM_ANCHOR, $this->getError());
     }
     /**
      * to prevent cross site scripting XSS it is important to look also to
      * $_REQUESTs which are needed by other KIT addons. Addons which need
      * a $_REQUEST with HTML should set a key in $_SESSION['KIT_HTML_REQUEST']
      */
     $html_allowed = array();
     if (isset($_SESSION['KIT_HTML_REQUEST'])) {
         $html_allowed = $_SESSION['KIT_HTML_REQUEST'];
     }
     $html = array();
     foreach ($html as $key) {
         $html_allowed[] = $key;
     }
     $_SESSION['KIT_HTML_REQUEST'] = $html_allowed;
     foreach ($_REQUEST as $key => $value) {
         if (stripos($key, 'amp;') == 0) {
             $key = substr($key, 4);
             $_REQUEST[$key] = $value;
             unset($_REQUEST['amp;' . $key]);
         }
         if (!in_array($key, $html_allowed)) {
             $_REQUEST[$key] = $this->xssPrevent($value);
         }
     }
     isset($_REQUEST[self::request_action]) ? $action = $_REQUEST[self::request_action] : ($action = self::action_default);
     switch ($action) {
         case self::action_feedback_unsubscribe:
             $result = $this->showFeedbackUnsubscribe();
             break;
         case self::action_feedback_unsubscribe_check:
             $result = $this->checkFeedbackUnsubscribe();
             break;
         case self::action_command:
             $result = $this->checkCommand();
             break;
         case self::action_check_form:
             $result = $this->checkForm();
             break;
         case self::action_activation_key:
             $result = $this->checkActivationKey();
             break;
         case self::action_default:
         default:
             $result = $this->showForm();
             break;
     }
     if ($this->isError()) {
         $result = sprintf('<a name="%s"></a><div class="error">%s</div>', self::FORM_ANCHOR, $this->getError());
     }
     return $result;
 }
$param_limit = isset($limit) ? (int) $limit : 5;
$param_title = isset($title) && strtolower($title) == 'false' ? false : true;
$param_css = isset($css) && strtolower($css) == 'false' ? false : true;
$param_link = isset($link) && strtolower($link) == 'false' ? false : true;
$param_link_content = isset($link_content) && strtolower($link_content) == 'true' ? true : false;
// exists dropletsExtension?
if (file_exists(WB_PATH . '/modules/droplets_extension/interface.php')) {
    // load dropletsExtension
    require_once WB_PATH . '/modules/droplets_extension/interface.php';
    if ($param_css) {
        // load CSS!
        if (!is_registered_droplet_css('wysiwyg_teaser', PAGE_ID)) {
            register_droplet_css('wysiwyg_teaser', PAGE_ID, 'wysiwyg', 'wysiwyg_teaser.css');
        }
    } elseif (is_registered_droplet_css('wysiwyg_teaser', PAGE_ID)) {
        unregister_droplet_css('wysiwyg_teaser', PAGE_ID);
    }
}
$result = '';
$SQL = "SELECT * FROM `" . TABLE_PREFIX . "mod_wysiwyg_teaser` WHERE `status`='ACTIVE' ORDER BY `date_publish` {$param_order} LIMIT {$param_limit}";
$query = $database->query($SQL);
if ($database->is_error()) {
    return $database->get_error();
}
if ($query->numRows() < 1) {
    // no active teaser
    $result = $I18n->translate('<p>- no active teaser -</p>');
} else {
    // build the teasers
    while (false !== ($teaser = $query->fetchRow(MYSQL_ASSOC))) {
        // build the link