Exemplo n.º 1
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     // user pages
     $sql = "\n\t\t\tCREATE TABLE `user_pages` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\t`author` int(11) NOT NULL,\n\t\t\t\t`owner` int(11) NOT NULL,";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL DEFAULT '',";
     }
     foreach ($list as $language) {
         $sql .= "`content_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "`editable` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\tPRIMARY KEY ( `id` ),\n\t\t\t\tKEY `author` (`author`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // user page items
     $sql = "\n\t\t\tCREATE TABLE `user_page_items` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`page` int(11) NOT NULL,\n\t\t\t\t`type` int(11) NOT NULL,\n\t\t\t\t`item` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY ( `id` ),\n\t\t\t\tKEY `page` (`page`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 2
0
 /**
  * Get language constants for specified array
  */
 private function json_GetTextArray()
 {
     // check if we were asked to get languages from specific module
     if (isset($_REQUEST['from_module']) && class_exists($_REQUEST['from_module'])) {
         $module = call_user_func(array(escape_chars($_REQUEST['from_module']), 'getInstance'));
         $language_handler = $module->language;
     } else {
         $language_handler = MainLanguageHandler::getInstance();
     }
     // prepare variables
     $constants = fix_chars($_REQUEST['constants']);
     $result = array('text' => array());
     // get constants
     if (count($constants) > 0) {
         foreach ($constants as $constant) {
             $result['text'][$constant] = $language_handler->getText($constant);
         }
     }
     print json_encode($result);
 }
Exemplo n.º 3
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     $sql = "\n\t\t\tCREATE TABLE `tips` (\n\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,";
     foreach ($list as $language) {
         $sql .= "`content_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY ( `id` )\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 4
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     // News
     $sql = "\n\t\t\tCREATE TABLE `news` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\t`author` int(11) NOT NULL,";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL DEFAULT '',";
     }
     foreach ($list as $language) {
         $sql .= "`content_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "`visible` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\tPRIMARY KEY ( `id` ),\n\t\t\t\tKEY `author` (`author`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // News Membership
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `news_membership` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`news` int(11) NOT NULL,\n\t\t\t\t`group` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tKEY `group` (`group`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // News Groups
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `news_groups` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` varchar(32) COLLATE utf8_bin NULL,";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL,";
     }
     $sql .= "PRIMARY KEY (`id`),\n\t\t\t\tKEY `text_id` (`text_id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // News Feeds
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `news_feeds` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`group` int(11) NOT NULL,\n\t\t\t\t`news_count` int(11) NOT NULL,";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL,";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL,";
     }
     $sql .= "`active` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tKEY `active` (`active`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 5
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     // predefined settings stored in system wide tables
     $this->saveSetting('use_smtp', 0);
     $this->saveSetting('sender_name', '');
     $this->saveSetting('sender_address', '*****@*****.**');
     $this->saveSetting('recipient_name', '');
     $this->saveSetting('recipient_address', '*****@*****.**');
     $this->saveSetting('smtp_server', 'smtp.gmail.com');
     $this->saveSetting('smtp_port', '465');
     $this->saveSetting('use_ssl', 1);
     $this->saveSetting('save_copy', 0);
     $this->saveSetting('save_location', '');
     // templates table
     $sql = "\n\t\t\tCREATE TABLE `contact_form_templates` (\n\t\t\t\t`id` int NOT NULL AUTO_INCREMENT ,\n\t\t\t\t`text_id` varchar(32) NULL ,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` varchar(50) NOT NULL DEFAULT '',";
         $sql .= "`subject_{$language}` varchar(255) NOT NULL DEFAULT '',";
         $sql .= "`plain_{$language}` text NOT NULL,";
         $sql .= "`html_{$language}` text NOT NULL,";
     }
     $sql .= "\n\t\t\t\tPRIMARY KEY(`id`),\n\t\t\t\tINDEX `contact_form_templates_by_text_id` (`text_id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // contact form table
     $sql = "\n\t\t\tCREATE TABLE `contact_forms` (\n\t\t\t\t`id` int NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` varchar(32) NULL,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` varchar(50) NOT NULL DEFAULT '',";
     }
     $sql .= "\n\t\t\t\t`action` varchar(255) NULL,\n\t\t\t\t`template` varchar(32) NOT NULL,\n\t\t\t\t`use_ajax` boolean NOT NULL DEFAULT '1',\n\t\t\t\t`show_submit` boolean NOT NULL DEFAULT '1',\n\t\t\t\t`show_reset` boolean NOT NULL DEFAULT '1',\n\t\t\t\t`show_cancel` boolean NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY(`id`),\n\t\t\t\tINDEX `contact_forms_by_text_id` (`text_id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // table for storing contact form fields
     $sql = "\n\t\t\tCREATE TABLE `contact_form_fields` (\n\t\t\t\t`id` int NOT NULL AUTO_INCREMENT,\n\t\t\t\t`form` int NOT NULL,\n\t\t\t\t`name` varchar(32) NULL,\n\t\t\t\t`type` varchar(32) NOT NULL,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`label_{$language}` varchar(100) NOT NULL DEFAULT '',";
         $sql .= "`placeholder_{$language}` varchar(100) NOT NULL DEFAULT '',";
     }
     $sql .= "\n\t\t\t\t`min` int NOT NULL,\n\t\t\t\t`max` int NOT NULL,\n\t\t\t\t`maxlength` int NOT NULL,\n\t\t\t\t`value` varchar(255) NOT NULL,\n\t\t\t\t`pattern` varchar(255) NOT NULL,\n\t\t\t\t`disabled` boolean NOT NULL DEFAULT '0',\n\t\t\t\t`required` boolean NOT NULL DEFAULT '0',\n\t\t\t\t`autocomplete` boolean NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY(`id`),\n\t\t\t\tINDEX `contact_form_fields_by_form` (`form`),\n\t\t\t\tINDEX `contact_form_fields_by_form_and_type` (`form`, `type`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // form submissions table
     $sql = "\n\t\t\tCREATE TABLE `contact_form_submission` (\n\t\t\t\t`id` int NOT NULL AUTO_INCREMENT,\n\t\t\t\t`form` int NOT NULL,\n\t\t\t\t`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,\n\t\t\t\t`address` varchar(45) NOT NULL,\n\t\t\t\tPRIMARY KEY(`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // form submission fields table
     $sql = "\n\t\t\tCREATE TABLE `contact_form_submission_fields` (\n\t\t\t\t`id` int NOT NULL AUTO_INCREMENT,\n\t\t\t\t`submission` int NOT NULL,\n\t\t\t\t`field` int NULL,\n\t\t\t\t`value` text NOT NULL,\n\t\t\t\tPRIMARY KEY(`id`),\n\t\t\t\tINDEX `contact_form_submissions` (`submission`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 6
0
Session::start();
// unpack parameters if needed
if ($url_rewrite) {
    url_UnpackValues();
}
// set default values for variables
if (!isset($_SESSION['level']) || empty($_SESSION['level'])) {
    $_SESSION['level'] = 0;
}
if (!isset($_SESSION['logged']) || empty($_SESSION['logged'])) {
    $_SESSION['logged'] = false;
}
$section = !isset($_REQUEST['section']) || empty($_REQUEST['section']) ? 'home' : fix_chars($_REQUEST['section']);
$action = !isset($_REQUEST['action']) || empty($_REQUEST['action']) ? '_default' : fix_chars($_REQUEST['action']);
// get main language handler instance
$language_handler = MainLanguageHandler::getInstance();
if (!isset($_REQUEST['language'])) {
    // no language change was specified, check session
    if (!isset($_SESSION['language']) || empty($_SESSION['language'])) {
        $_SESSION['language'] = $language_handler->getDefaultLanguage();
    }
} else {
    // language change was specified, make sure it's valid
    if (array_key_exists($_REQUEST['language'], $language_handler->getLanguages())) {
        $_SESSION['language'] = fix_chars($_REQUEST['language']);
    } else {
        // set language without asking if module is backend
        if (in_array($section, array('backend', 'backend_module'))) {
            $_SESSION['language'] = fix_chars($_REQUEST['language']);
        } else {
            $_SESSION['language'] = $language_handler->getDefaultLanguage();
Exemplo n.º 7
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     $sql = "\n\t\t\tCREATE TABLE `articles` (\n\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t`group` int(11) DEFAULT NULL ,\n\t\t\t\t`text_id` VARCHAR (32) NULL ,\n\t\t\t\t`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL DEFAULT '',";
         $sql .= "`content_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "\n\t\t\t\t`author` INT NOT NULL ,\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT '0',\n\t\t\t\t`views` INT NOT NULL DEFAULT '0',\n\t\t\t\t`votes_up` INT NOT NULL DEFAULT '0',\n\t\t\t\t`votes_down` INT NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY ( `id` ),\n\t\t\t\tINDEX ( `author` ),\n\t\t\t\tINDEX ( `group` ),\n\t\t\t\tINDEX ( `text_id` )\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // article groups
     $sql = "\n\t\t\tCREATE TABLE `article_groups` (\n\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t`text_id` VARCHAR (32) NULL ,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL DEFAULT '',";
         $sql .= "`description_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\tPRIMARY KEY ( `id` ),\n\t\t\t\tINDEX ( `text_id` )\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "CREATE TABLE `article_votes` (\n\t\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t\t`address` VARCHAR( 15 ) NOT NULL ,\n\t\t\t\t\t`article` INT NOT NULL ,\n\t\t\t\tPRIMARY KEY (  `id` ),\n\t\t\t\tINDEX ( `address`, `article` )\n\t\t\t\t) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 8
0
 /**
  * Get shopping cart summary.
  *
  * @param integer $type
  * @param string $transaction_id
  * @param array $recipient
  * @return array
  */
 private function getCartSummary($type, $recipient, $transaction_id)
 {
     $result = array();
     $default_language = MainLanguageHandler::getInstance()->getDefaultLanguage();
     // prepare params
     $shipping = 0;
     $handling = 0;
     $total_money = 0;
     $total_weight = 0;
     $delivery_method = null;
     $items_by_uid = array();
     $items_for_checkout = array();
     $delivery_items = array();
     $delivery_prices = array();
     $map_id_to_uid = array();
     if (isset($_SESSION['recurring_plan'])) {
         $plan_name = $_SESSION['recurring_plan'];
         $payment_method = $this->getPaymentMethod(null);
         // get selected recurring plan
         $plans = $payment_method->get_recurring_plans();
         if (isset($plans[$plan_name])) {
             $plan = $plans[$plan_name];
             $handling = $plan['setup_price'];
             $total_money = $plan['price'];
         }
     } else {
         // colect ids from session
         $cart = isset($_SESSION['shopping_cart']) ? $_SESSION['shopping_cart'] : array();
         $ids = array_keys($cart);
         if (count($cart) == 0) {
             return $result;
         }
         // get managers
         $manager = ShopItemManager::getInstance();
         // get items from database and prepare result
         $items = $manager->getItems($manager->getFieldNames(), array('uid' => $ids));
         // parse items from database
         foreach ($items as $item) {
             $db_item = array('id' => $item->id, 'name' => $item->name, 'price' => $item->price, 'tax' => $item->tax, 'weight' => $item->weight);
             $items_by_uid[$item->uid] = $db_item;
             $map_id_to_uid[$item->id] = $item->uid;
         }
         // prepare items for checkout
         foreach ($cart as $uid => $item) {
             // include all item variations in preparation
             if (count($item['variations']) > 0) {
                 foreach ($item['variations'] as $variation_id => $data) {
                     // add items to checkout list
                     $properties = $data;
                     foreach ($this->excluded_properties as $key) {
                         if (isset($properties[$key])) {
                             unset($properties[$key]);
                         }
                     }
                     $new_item = $items_by_uid[$uid];
                     $new_item['count'] = $data['count'];
                     $new_item['description'] = implode(', ', array_values($properties));
                     // add item to list for delivery estimation
                     $delivery_items[] = array('properties' => array(), 'package' => 1, 'weight' => 0.5, 'package_type' => 0, 'width' => 2, 'height' => 5, 'length' => 15, 'units' => 1, 'count' => $data['count']);
                     // add item to the list
                     $items_for_checkout[] = $new_item;
                     // include item data in summary
                     $tax = $new_item['tax'];
                     $price = $new_item['price'];
                     $weight = $new_item['weight'];
                     $total_money += $price * (1 + $tax / 100) * $data['count'];
                     $total_weight += $weight * $data['count'];
                 }
             }
         }
     }
     // only get delivery method prices if request was made by client-side script
     if (_AJAX_REQUEST) {
         // get prefered method
         if (isset($_SESSION['delivery_method']) && array_key_exists($_SESSION['delivery_method'], $this->delivery_methods)) {
             $delivery_method = $this->delivery_methods[$_SESSION['delivery_method']];
         }
         // if there is a delivery method selected, get price estimation for items
         // TODO: Instead of picking up the first warehouse we need to choose proper one based on item property.
         if (!is_null($delivery_method)) {
             $currency_manager = ShopCurrenciesManager::getInstance();
             $warehouse_manager = ShopWarehouseManager::getInstance();
             $warehouse = $warehouse_manager->getSingleItem($warehouse_manager->getFieldNames(), array());
             // get currency associated with transaction
             $currency = $currency_manager->getSingleItem($currency_manager->getFieldNames(), array('id' => $currency_id));
             if (is_object($currency)) {
                 $preferred_currency = $currency->currency;
             } else {
                 $preferred_currency = 'EUR';
             }
             if (is_object($warehouse)) {
                 $shipper = array('street' => array($warehouse->street, $warehouse->street2), 'city' => $warehouse->city, 'zip_code' => $warehouse->zip, 'state' => $warehouse->state, 'country' => $warehouse->country);
                 // get types and prices from delivery method provider
                 $delivery_prices = $delivery_method->getDeliveryTypes($delivery_items, $shipper, $recipient, $transaction_id, $preferred_currency);
                 // convert prices and format timestamps
                 $language_handler = MainLanguageHandler::getInstance();
                 $date_format = $language_handler->getText('format_date');
                 if (count($delivery_prices) > 0) {
                     for ($i = 0; $i < count($delivery_prices); $i++) {
                         $delivery = $delivery_prices[$i];
                         // format starting date
                         if (!is_null($delivery[3])) {
                             $delivery[3] = date($date_format, $delivery[3]);
                         }
                         // format ending date
                         if (!is_null($delivery[4])) {
                             $delivery[4] = date($date_format, $delivery[4]);
                         }
                         // store delivery back to the original array
                         $delivery_prices[$i] = $delivery;
                     }
                 }
             }
         }
     }
     $result = array('items_for_checkout' => $items_for_checkout, 'shipping' => $shipping, 'handling' => $handling, 'weight' => $total_weight, 'total' => $total_money, 'delivery_method' => is_null($delivery_method) ? '' : $delivery_method->getName(), 'delivery_prices' => $delivery_prices);
     return $result;
 }
Exemplo n.º 9
0
 /**
  * Check if currently selected language is right-to-left.
  *
  * @return boolean
  */
 public static function isRTL()
 {
     if (!isset(self::$handler)) {
         self::$handler = MainLanguageHandler::getInstance();
     }
     return self::$handler->isRTL();
 }
Exemplo n.º 10
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     $sql = "\n\t\t\tCREATE TABLE `gallery` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT ,\n\t\t\t\t`text_id` VARCHAR( 32 ) NOT NULL,\n\t\t\t\t`group` int(11) DEFAULT NULL ,";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` VARCHAR( 255 ) NOT NULL DEFAULT '',";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "`size` BIGINT NOT NULL ,\n\t\t\t\t`filename` VARCHAR( 40 ) NOT NULL ,\n\t\t\t\t`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\t`protected` BOOLEAN NOT NULL DEFAULT '0',\n\t\t\t\t`slideshow` BOOLEAN NOT NULL DEFAULT '0',\n\t\t\t\tPRIMARY KEY ( `id` ),\n\t\t\t\tKEY `text_id` (`text_id`),\n\t\t\t\tKEY `group` (`group`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `gallery_groups` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` varchar(32) COLLATE utf8_bin NULL,";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` VARCHAR( 50 ) NOT NULL,";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL,";
     }
     $sql .= "`thumbnail` int(11) NULL,\n\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `gallery_containers` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` varchar(32) COLLATE utf8_bin NULL,";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` VARCHAR( 50 ) NOT NULL,";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL,";
     }
     $sql .= "PRIMARY KEY (`id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `gallery_group_membership` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`group` int(11) NOT NULL,\n\t\t\t\t`container` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tKEY `container` (`container`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     if (!array_key_exists('image_extensions', $this->settings)) {
         $this->saveSetting('image_extensions', 'jpg,jpeg,png');
     }
 }
Exemplo n.º 11
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     $sql = "CREATE TABLE `chat_log` (\n\t\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t\t`user` INT NOT NULL ,\n\t\t\t\t\t`room` INT NOT NULL ,\n\t\t\t\t\t`timestamp` TIMESTAMP NOT NULL ,\n\t\t\t\t\t`message` VARCHAR(255) NOT NULL ,\n\t\t\t\t\tPRIMARY KEY (`id`) ,\n\t\t\t\t\tINDEX `index_by_user` (`user` ASC) ,\n\t\t\t\t\tINDEX `index_by_room` (`room` ASC)\n\t\t\t\t)\n\t\t\t\tENGINE = MyISAM\n\t\t\t\tDEFAULT CHARACTER SET = utf8\n\t\t\t\tCOLLATE = utf8_bin\n\t\t\t\tAUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "CREATE TABLE `chat_rooms` (\n\t\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t\t`text_id` VARCHAR(45) NOT NULL DEFAULT '',";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` VARCHAR(45) NOT NULL ,";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "\t`limit` SMALLINT NOT NULL DEFAULT 0 ,\n\t\t\t\t\t`password` VARCHAR(45) NOT NULL ,\n\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t)\n\t\t\t\tENGINE = MyISAM\n\t\t\t\tDEFAULT CHARACTER SET = utf8\n\t\t\t\tCOLLATE = utf8_bin\n\t\t\t\tAUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "CREATE TABLE `chat_admins` (\n\t\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t\t`user` INT NOT NULL ,\n\t\t\t\t\t`room` INT NOT NULL ,\n\t\t\t\t\tPRIMARY KEY (`id`) ,\n\t\t\t\t\tINDEX `index1` (`user` ASC, `room` ASC)\n\t\t\t\t)\n\t\t\t\tENGINE = MyISAM\n\t\t\t\tDEFAULT CHARACTER SET = utf8\n\t\t\t\tCOLLATE = utf8_bin\n\t\t\t\tAUTO_INCREMENT=0;";
     $db->query($sql);
     $sql = "CREATE TABLE `chat_users` (\n\t\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,\n\t\t\t\t\t`temp` TINYINT(1)  NOT NULL DEFAULT 1 ,\n\t\t\t\t\t`username` VARCHAR(45) NOT NULL ,\n\t\t\t\t\t`password` VARCHAR(45) NOT NULL ,\n\t\t\t\t\t`display_name` VARCHAR(45) NOT NULL ,\n\t\t\t\t\t`last_active` TIMESTAMP NOT NULL ,\n\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t)\n\t\t\t\tENGINE = MyISAM\n\t\t\t\tDEFAULT CHARACTER SET = utf8\n\t\t\t\tCOLLATE = utf8_bin\n\t\t\t\tAUTO_INCREMENT=0;";
     $db->query($sql);
     if (!array_key_exists('update_interval', $this->settings)) {
         $this->saveSetting('update_interval', 2000);
     }
 }
Exemplo n.º 12
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     // get list of languages
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     // store global settings
     $this->saveSetting('api_username', '');
     $this->saveSetting('api_password', '');
     $this->saveSetting('api_signature', '');
     $this->saveSetting('express_enabled', 1);
     $this->saveSetting('direct_enabled', 1);
     // create tables
     $sql = "\n\t\t\tCREATE TABLE `paypal_recurring_plans` (\n\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` VARCHAR (32) NULL,";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` VARCHAR(255) NOT NULL DEFAULT '',";
     }
     $sql .= "\n\t\t\t\t`trial` INT NOT NULL DEFAULT '0',\n\t\t\t\t`trial_count` INT NOT NULL DEFAULT '0',\n\t\t\t\t`interval` INT NOT NULL DEFAULT '0',\n\t\t\t\t`interval_count` INT NOT NULL DEFAULT '0',\n\t\t\t\t`price` DECIMAL(8,2) NOT NULL,\n\t\t\t\t`setup_price` DECIMAL(8,2) NOT NULL,\n\t\t\t\t`start_time` TIMESTAMP NULL,\n\t\t\t\t`group_name` varchar(64) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tINDEX (`text_id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 13
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     // create videos table
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `youtube_video` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` VARCHAR (32) NULL ,\n\t\t\t\t`video_id` varchar(11) COLLATE utf8_bin NOT NULL,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`title_{$language}` varchar(255) COLLATE utf8_bin NOT NULL,";
     }
     $sql .= "PRIMARY KEY (`id`),\n\t\t\t\tINDEX (`text_id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // create groups table
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `youtube_groups` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`text_id` VARCHAR (32) NULL ,\n\t\t\t";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` varchar(255) COLLATE utf8_bin NOT NULL,";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT '1',\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tINDEX (`text_id`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
     // create group membership table
     $sql = "\n\t\t\tCREATE TABLE IF NOT EXISTS `youtube_group_membership` (\n\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t`group` int(11) NOT NULL,\n\t\t\t\t`video` int(11) NOT NULL,\n\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\tINDEX (`group`)\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 14
0
 /**
  * Constructor
  *
  * @global resource $db
  * @param string $table_name
  * @return db_item
  */
 protected function __construct($table_name)
 {
     $this->table_name = $table_name;
     $this->languages = MainLanguageHandler::getInstance()->getLanguages(false);
     sort($this->languages, SORT_STRING);
 }
Exemplo n.º 15
0
 /**
  * Parse loaded template
  *
  * @param integer $level Current level of parsing
  * @param array $tags Leave blank, used for recursion
  * @param boolean $parent_block If parent tag is block element
  */
 public function parse($tags = array())
 {
     global $section, $action, $language, $template_path, $system_template_path;
     if (!$this->active && empty($tags)) {
         return;
     }
     // get language handler for later
     $language_handler = MainLanguageHandler::getInstance();
     // take the tag list for parsing
     $tag_array = empty($tags) ? $this->engine->document->tagChildren : $tags;
     // start parsing tags
     $count = count($tag_array);
     for ($i = 0; $i < $count; $i++) {
         $tag = $tag_array[$i];
         // if tag has eval set
         if (isset($tag->tagAttrs['cms:eval']) || isset($tag->tagAttrs['eval'])) {
             // get evaluation values
             if (isset($tag->tagAttrs['eval'])) {
                 $value = $tag->tagAttrs['eval'];
             } else {
                 $value = $tag->tagAttrs['cms:eval'];
             }
             $eval_params = explode(',', $value);
             foreach ($eval_params as $param) {
                 // prepare module includes for evaluation
                 $settings = array();
                 if (!is_null($this->module)) {
                     $settings = $this->module->settings;
                 }
                 $params = $this->params;
                 $to_eval = $tag->tagAttrs[$param];
                 $tag->tagAttrs[$param] = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
             }
             // unset param
             unset($tag->tagAttrs['cms:eval']);
         }
         if (isset($tag->tagAttrs['cms:optional'])) {
             // get evaluation values
             $optional_params = explode(',', $tag->tagAttrs['cms:optional']);
             foreach ($optional_params as $param) {
                 // prepare module includes for evaluation
                 $settings = array();
                 if (!is_null($this->module)) {
                     $settings = $this->module->settings;
                 }
                 $params = $this->params;
                 $to_eval = $tag->tagAttrs[$param];
                 $value = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
                 if ($value == false) {
                     unset($tag->tagAttrs[$param]);
                 } else {
                     $tag->tagAttrs[$param] = $value;
                 }
             }
             // unset param
             unset($tag->tagAttrs['cms:optional']);
         }
         // implement tooltip
         if (isset($tag->tagAttrs['cms:tooltip'])) {
             if (!is_null($this->module)) {
                 $value = $this->module->getLanguageConstant($tag->tagAttrs['cms:tooltip']);
             } else {
                 $value = $language_handler->getText($tag->tagAttrs['cms:tooltip']);
             }
             $tag->tagAttrs['data-tooltip'] = $value;
             unset($tag->tagAttrs['cms:tooltip']);
         }
         // implement constants
         if (isset($tag->tagAttrs['cms:constant'])) {
             $params = explode(',', $tag->tagAttrs['cms:constant']);
             if (count($params) > 0) {
                 foreach ($params as $param) {
                     if (!is_null($this->module)) {
                         $tag->tagAttrs[$param] = $this->module->getLanguageConstant($tag->tagAttrs[$param]);
                     } else {
                         $tag->tagAttrs[$param] = $language_handler->getText($tag->tagAttrs[$param]);
                     }
                 }
             }
             unset($tag->tagAttrs['cms:constant']);
         }
         // check if specified tag shouldn't be cached
         $skip_cache = false;
         if (isset($tag->tagAttrs['skip_cache'])) {
             // unset param
             unset($tag->tagAttrs['skip_cache']);
             // get cache handler
             $cache = CacheHandler::getInstance();
             // only if current URL is being cached, we start dirty area
             if ($cache->isCaching()) {
                 $cache->startDirtyArea();
                 $skip_cache = true;
                 // reconstruct template for cache,
                 // ugly but we are not doing it a lot
                 $data = $this->getDataForCache($tag);
                 $cache->setCacheForDirtyArea($data);
             }
         }
         // now parse the tag
         switch ($tag->tagName) {
             // handle tag used for setting session variable
             case '_session':
             case 'cms:session':
                 $name = $tag->tagAttrs['name'];
                 // allow setting referral only once per seesion
                 if (isset($tag->tagAttrs['once'])) {
                     $only_once = in_array($tag->tagAttrs['once'], array(1, 'yes'));
                 } else {
                     $only_once = false;
                 }
                 $should_set = $only_once && !isset($_SESSION[$name]) || !$only_once;
                 // store value
                 if (!in_array($name, $this->protected_variables) && $should_set) {
                     $_SESSION[$name] = $tag->tagAttrs['value'];
                 }
                 break;
                 // transfer control to module
             // transfer control to module
             case '_module':
             case 'cms:module':
                 if (class_exists($tag->tagAttrs['name'])) {
                     $module = call_user_func(array($tag->tagAttrs['name'], 'getInstance'));
                     $module->transferControl($tag->tagAttrs, $tag->tagChildren);
                 }
                 break;
                 // load other template
             // load other template
             case '_template':
             case 'cms:template':
                 $file = $tag->tagAttrs['file'];
                 $path = key_exists('path', $tag->tagAttrs) ? $tag->tagAttrs['path'] : '';
                 if (!is_null($this->module)) {
                     $path = preg_replace('/^%module%/i', $this->module->path, $path);
                     $path = preg_replace('/^%templates%/i', $template_path, $path);
                 }
                 $new = new TemplateHandler($file, $path);
                 $new->setLocalParams($this->params);
                 $new->parse();
                 break;
                 // raw text copy
             // raw text copy
             case '_raw':
             case 'cms:raw':
                 if (key_exists('file', $tag->tagAttrs)) {
                     // if file attribute is specified
                     $file = $tag->tagAttrs['file'];
                     $path = key_exists('path', $tag->tagAttrs) ? $tag->tagAttrs['path'] : $template_path;
                     $text = file_get_contents($path . $file);
                 } elseif (key_exists('text', $tag->tagAttrs)) {
                     // if text attribute is specified
                     $text = $tag->tagAttrs['text'];
                 } else {
                     // in any other case we display data inside tag
                     $text = $tag->tagData;
                 }
                 echo $text;
                 break;
                 // multi language constants
             // multi language constants
             case '_text':
             case 'cms:text':
                 $constant = $tag->tagAttrs['constant'];
                 $language = key_exists('language', $tag->tagAttrs) ? $tag->tagAttrs['language'] : $language;
                 $text = "";
                 // check if constant is module based
                 if (key_exists('module', $tag->tagAttrs)) {
                     if (class_exists($tag->tagAttrs['module'])) {
                         $module = call_user_func(array($tag->tagAttrs['module'], 'getInstance'));
                         $text = $module->getLanguageConstant($constant, $language);
                     }
                 } else {
                     // use default language handler
                     $text = MainLanguageHandler::getInstance()->getText($constant, $language);
                 }
                 echo $text;
                 break;
                 // support for markdown
             // support for markdown
             case 'cms:markdown':
                 $char_count = isset($tag->tagAttrs['chars']) ? fix_id($tag->tagAttrs['chars']) : null;
                 $end_with = isset($tag->tagAttrs['end_with']) ? fix_id($tag->tagAttrs['end_with']) : null;
                 $name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
                 $multilanguage = isset($tag->tagAttrs['multilanguage']) ? $tag->tagAttrs['multilanguage'] == 'yes' : false;
                 // get content for parsing
                 if (is_null($name)) {
                     $content = $tag->tagData;
                 }
                 $content = $multilanguage ? $this->params[$name][$language] : $this->params[$name];
                 // convert to HTML
                 $content = Markdown($content);
                 // limit words if specified
                 if (!is_null($char_count)) {
                     if (is_null($end_with)) {
                         $content = limit_words($content, $char_count);
                     } else {
                         $content = limit_words($content, $char_count, $end_with);
                     }
                 }
                 echo $content;
                 break;
                 // call section specific data
             // call section specific data
             case '_section_data':
             case 'cms:section_data':
                 if (!is_null($this->module)) {
                     $file = $this->module->getSectionFile($section, $action, $language);
                     $new = new TemplateHandler(basename($file), dirname($file) . '/');
                     $new->setLocalParams($this->params);
                     $new->setMappedModule($this->module);
                     $new->parse();
                 } else {
                     // log error
                     trigger_error('Mapped module is not loaded! File: ' . $this->file, E_USER_WARNING);
                 }
                 break;
                 // print multilanguage data
             // print multilanguage data
             case '_language_data':
             case 'cms:language_data':
                 $name = isset($tag->tagAttrs['param']) ? $tag->tagAttrs['param'] : null;
                 if (!isset($this->params[$name]) || !is_array($this->params[$name]) || is_null($name)) {
                     break;
                 }
                 $template = new TemplateHandler('language_data.xml', $system_template_path);
                 $template->setMappedModule($this->module);
                 foreach ($this->params[$name] as $lang => $data) {
                     $params = array('param' => $name, 'language' => $lang, 'data' => $data);
                     $template->restoreXML();
                     $template->setLocalParams($params);
                     $template->parse();
                 }
                 break;
                 // replace tag data string with matching params
             // replace tag data string with matching params
             case '_replace':
             case 'cms:replace':
                 $pool = isset($tag->tagAttrs['param']) ? $this->params[$tag->tagAttrs['param']] : $this->params;
                 $keys = array_keys($pool);
                 $values = array_values($pool);
                 foreach ($keys as $i => $key) {
                     $keys[$i] = "%{$key}%";
                 }
                 // we can't replact string with array, only matching data types
                 foreach ($values as $i => $value) {
                     if (is_array($value)) {
                         unset($keys[$i]);
                         unset($values[$i]);
                     }
                 }
                 echo str_replace($keys, $values, $tag->tagData);
                 break;
                 // conditional tag
             // conditional tag
             case '_if':
             case 'cms:if':
                 $settings = !is_null($this->module) ? $this->module->settings : array();
                 $params = $this->params;
                 $condition = true;
                 // check if section is specified and matches
                 if (isset($tag->tagAttrs['section'])) {
                     $condition &= $tag->tagAttrs['section'] == $section;
                 }
                 // check if action is specified and matches
                 if (isset($tag->tagAttrs['action'])) {
                     $condition &= $tag->tagAttrs['action'] == $action;
                 }
                 // check custom condition
                 if (isset($tag->tagAttrs['condition'])) {
                     $to_eval = $tag->tagAttrs['condition'];
                     $eval_result = eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';') == true;
                     $condition &= $eval_result;
                 }
                 // parse children
                 if ($condition) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for desktop version
             // conditional tag parsed for desktop version
             case 'cms:desktop':
                 if (_DESKTOP_VERSION) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for mobile version
             // conditional tag parsed for mobile version
             case 'cms:mobile':
                 if (_MOBILE_VERSION) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for users that are logged in
             // conditional tag parsed for users that are logged in
             case 'cms:user':
                 if ($_SESSION['logged']) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // conditional tag parsed for guests
             // conditional tag parsed for guests
             case 'cms:guest':
                 if (!$_SESSION['logged']) {
                     $this->parse($tag->tagChildren);
                 }
                 break;
                 // variable
             // variable
             case '_var':
             case 'cms:var':
                 $settings = array();
                 if (!is_null($this->module)) {
                     $settings = $this->module->settings;
                 }
                 $params = $this->params;
                 $to_eval = $tag->tagAttrs['name'];
                 echo eval('global $section, $action, $language, $language_rtl, $language_handler; return ' . $to_eval . ';');
                 break;
                 // support for script tag
             // support for script tag
             case 'cms:script':
                 if (class_exists('head_tag')) {
                     $head_tag = head_tag::getInstance();
                     $head_tag->addTag('script', $tag->tagAttrs);
                 }
                 break;
                 // support for collection module
             // support for collection module
             case 'cms:collection':
                 if (array_key_exists('include', $tag->tagAttrs) && class_exists('collection')) {
                     $scripts = fix_chars(explode(',', $tag->tagAttrs['include']));
                     $collection = collection::getInstance();
                     $collection->includeScript($scripts);
                 }
                 break;
                 // support for link tag
             // support for link tag
             case 'cms:link':
                 if (class_exists('head_tag')) {
                     $head_tag = head_tag::getInstance();
                     $head_tag->addTag('link', $tag->tagAttrs);
                 }
                 break;
                 // support for parameter based choice
             // support for parameter based choice
             case 'cms:choice':
                 $param_value = null;
                 if (array_key_exists('param', $tag->tagAttrs)) {
                     // grap param value from GET or POST parameters
                     $param_name = fix_chars($tag->tagAttrs['param']);
                     $param_value = isset($_REQUEST[$param_name]) ? fix_chars($_REQUEST[$param_name]) : null;
                 } else {
                     if (array_key_exists('value', $tag->tagAttrs)) {
                         // use param value specified
                         $param_value = fix_chars($tag->tagAttrs['value']);
                     }
                 }
                 // parse only option
                 foreach ($tag->tagChildren as $option) {
                     if (!$option->tagName == 'option') {
                         continue;
                     }
                     $option_value = isset($option->tagAttrs['value']) ? $option->tagAttrs['value'] : null;
                     $option_default = isset($option->tagAttrs['default']) ? $option->tagAttrs['default'] == 1 : false;
                     // values match or option is default, parse its content
                     if ($option_value == $param_value || $option_default) {
                         $this->parse($option->tagChildren);
                         break;
                     }
                 }
                 break;
                 // default action for parser, draw tag
             // default action for parser, draw tag
             default:
                 if (in_array($tag->tagName, array_keys($this->handlers))) {
                     // custom tag handler is set...
                     $handle = $this->handlers[$tag->tagName];
                     $obj = $handle['object'];
                     $function = $handle['function'];
                     $obj->{$function}($tag->tagAttrs, $tag->tagChildren);
                 } else {
                     // default tag handler
                     echo '<' . $tag->tagName . $this->getTagParams($tag->tagAttrs) . '>';
                     if (count($tag->tagChildren) > 0) {
                         $this->parse($tag->tagChildren);
                     }
                     if (count($tag->tagData) > 0) {
                         echo $tag->tagData;
                     }
                     $close_tag = $this->close_all_tags ? true : !in_array($tag->tagName, $this->tags_without_end);
                     if ($close_tag) {
                         echo '</' . $tag->tagName . '>';
                     }
                 }
                 break;
         }
         // end cache dirty area if initialized
         if ($skip_cache) {
             $cache->endDirtyArea();
         }
     }
 }
Exemplo n.º 16
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     $sql = "\n\t\t\tCREATE TABLE `downloads` (\n\t\t\t\t`id` INT NOT NULL AUTO_INCREMENT ,";
     foreach ($list as $language) {
         $sql .= "`name_{$language}` VARCHAR( 100 ) NOT NULL ,";
     }
     foreach ($list as $language) {
         $sql .= "`description_{$language}` TEXT NOT NULL ,";
     }
     $sql .= "`count` INT NOT NULL DEFAULT  '0',\n\t\t\t\t`filename` VARCHAR( 100 ) NOT NULL ,\n\t\t\t\t`size` INT NOT NULL ,\n\t\t\t\t`visible` BOOLEAN NOT NULL DEFAULT  '1',\n\t\t\t\t`timestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ,\n\t\t\t\tPRIMARY KEY (  `id` )\n\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=0;";
     $db->query($sql);
 }
Exemplo n.º 17
0
 /**
  * Set page description for current execution.
  *
  * @param array $tag_params
  * @param array $children
  */
 private function setDescription($tag_params, $children)
 {
     global $language;
     // set from language constant
     if (isset($tag_params['constant'])) {
         $language_handler = MainLanguageHandler::getInstance();
         $constant = fix_chars($tag_params['constant']);
         $this->page_description = $language_handler->getText($constant);
         // set from article
     } else {
         if (isset($tag_params['article']) && class_exists('articles')) {
             $manager = ArticleManager::getInstance();
             $text_id = fix_chars($tag_params['article']);
             // get article from database
             $item = $manager->getSingleItem(array('content'), array('text_id' => $text_id));
             if (is_object($item)) {
                 $content = strip_tags(Markdown($item->content[$language]));
                 $data = explode("\n", utf8_wordwrap($content, 150, "\n", true));
                 if (count($data) > 0) {
                     $this->page_description = $data[0];
                 }
             }
         }
     }
 }
Exemplo n.º 18
0
 /**
  * Event triggered upon module initialization
  */
 public function onInit()
 {
     global $db;
     $list = MainLanguageHandler::getInstance()->getLanguages(false);
     $sql = "CREATE TABLE IF NOT EXISTS `leads_entries` (\n\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t`type` int(11) NOT NULL DEFAULT 0,\n\t\t\t\t\t`address` varchar(50) NOT NULL,\n\t\t\t\t\t`referral` varchar(255) NOT NULL,\n\t\t\t\t\t`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,\n\t\t\t\t\tPRIMARY KEY (`id`),\n\t\t\t\t\tKEY `type` (`type`)\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
     $db->query($sql);
     $sql = "CREATE TABLE IF NOT EXISTS `leads_types` (\n\t\t\t\t\t`id` int(11) NOT NULL AUTO_INCREMENT,\n\t\t\t\t\t`name` varchar(30) NOT NULL,\n\t\t\t\t\t`fields` varchar(255) NOT NULL,\n\t\t\t\t\t`unique_address` BOOLEAN NOT NULL DEFAULT '0',\n\t\t\t\t\t`send_email` BOOLEAN NOT NULL DEFAULT '0',\n\t\t\t\t\tPRIMARY KEY (`id`)\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";
     $db->query($sql);
     $sql = "CREATE TABLE IF NOT EXISTS `leads_entry_data` (\n\t\t\t\t\t`entry` int(11) NOT NULL,\n\t\t\t\t\t`name` varchar(30) NOT NULL,\n\t\t\t\t\t`value` varchar(255) NOT NULL,\n\t\t\t\t\tKEY `entry` (`entry`)\n\t\t\t\t) ENGINE=MyISAM DEFAULT CHARSET=utf8;";
     $db->query($sql);
 }