Exemple #1
0
 /**
  * Retrieves Menu Level
  *
  * @access  public
  * @param   object  $model      Jaws_Model reference
  * @param   string  $tpl_str    XHTML template content passed by reference
  * @param   int     $gid        Group ID
  * @param   int     $pid
  * @return  string  XHTML template content
  */
 function GetMenuLevel(&$model, &$tpl_str, $gid, $pid)
 {
     $menus = $model->GetLevelsMenus($pid, $gid);
     if (Jaws_Error::IsError($menus) || empty($menus)) {
         return '';
     }
     $tpl = new Jaws_Template();
     $tpl->LoadFromString($tpl_str);
     $tpl->SetBlock('parent');
     foreach ($menus as $menu) {
         $tpl->SetBlock('parent/menu');
         $tpl->SetVariable('class_name', 'menu_levels');
         $tpl->SetVariable('mg_id', 'menu_' . $menu['id']);
         $tpl->SetVariable('icon', 'gadgets/Menu/Resources/images/menu-item.png');
         $tpl->SetVariable('title', $menu['title']);
         $tpl->SetVariable('js_edit_func', "editMenu({$menu['id']})");
         $tpl->SetVariable('add_title', _t('MENU_ADD_MENU'));
         $tpl->SetVariable('add_icon', STOCK_NEW);
         $tpl->SetVariable('js_add_func', "addMenu({$gid}, {$menu['id']})");
         $tpl->SetVariable('sub_menus', $this->GetMenuLevel($model, $tpl_str, $gid, $menu['id']));
         $tpl->ParseBlock('parent/menu');
     }
     $tpl->ParseBlock('parent');
     return $tpl->Get();
 }
Exemple #2
0
 /**
  * Loads the gadget template file in question
  *
  * @access  public
  * @param   string  $filename   Template file name
  * @param   string  $options    Load template options(e.g. loadFromTheme, loadRTLDirection)
  * @param   bool    $backend    Admin template file?
  * @return  object  Jaws_Template object
  */
 function &load($filename, $options = array(), $backend = false)
 {
     $filepath = dirname($filename);
     $filename = basename($filename);
     $loadFromTheme = isset($options['loadFromTheme']) ? $options['loadFromTheme'] : JAWS_SCRIPT == 'index';
     // if dirname returned dot ('.'), indicating no slashes in path(current directory)
     if ($filepath == '.') {
         $filepath = 'gadgets/' . $this->gadget->name . '/Templates/' . ($backend ? 'Admin' : '');
     }
     unset($options['loadFromTheme']);
     $tpl = new Jaws_Template($loadFromTheme);
     foreach ($options as $option => $value) {
         $tpl->{$option} = $value;
     }
     $tpl->Load($filename, $filepath);
     return $tpl;
 }
Exemple #3
0
 /**
  * Builds the upgader page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/100To110/templates');
     $tpl->SetBlock('100To110');
     $tpl->setVariable('lbl_info', _t('UPGRADE_VER_INFO', '1.0.0', '1.1.0'));
     $tpl->setVariable('lbl_notes', _t('UPGRADE_VER_NOTES'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->ParseBlock('100To110');
     return $tpl->Get();
 }
Exemple #4
0
 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Finished/templates');
     $tpl->SetBlock('Finished');
     $base_url = Jaws_Utils::getBaseURL('', true);
     $tpl->setVariable('lbl_info', _t('INSTALL_FINISH_INFO'));
     $tpl->setVariable('lbl_choices', _t('INSTALL_FINISH_CHOICES', "{$base_url}/", "{$base_url}/admin.php"));
     $tpl->setVariable('lbl_thanks', _t('INSTALL_FINISH_THANKS'));
     $tpl->SetVariable('move_log', _t('INSTALL_FINISH_MOVE_LOG'));
     $tpl->ParseBlock('Finished');
     // Kill the session
     session_destroy();
     return $tpl->Get();
 }
Exemple #5
0
 /**
  * Builds the upgrader page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     require_once JAWS_PATH . 'include/Jaws.php';
     $GLOBALS['app'] = jaws();
     $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false);
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Finished/templates');
     $tpl->SetBlock('Finished');
     $base_url = $GLOBALS['app']->getSiteURL();
     $tpl->setVariable('lbl_info', _t('UPGRADE_FINISH_INFO'));
     $tpl->setVariable('lbl_choices', _t('UPGRADE_FINISH_CHOICES', "{$base_url}/", "{$base_url}/admin.php"));
     $tpl->setVariable('lbl_thanks', _t('UPGRADE_FINISH_THANKS'));
     $tpl->SetVariable('move_log', _t('UPGRADE_FINISH_MOVE_LOG'));
     $tpl->ParseBlock('Finished');
     return $tpl->Get();
 }
Exemple #6
0
 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $request = Jaws_Request::getInstance();
     $use_log = $request->fetch('use_log', 'post');
     //Set main session-log vars
     if (isset($use_log)) {
         $_SESSION['use_log'] = $use_log === 'yes' ? JAWS_LOG_DEBUG : false;
     }
     _log(JAWS_LOG_DEBUG, "Generating new installation key");
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Customize/templates');
     $tpl->SetBlock('Customize');
     $tpl->SetVariable('customize_info', _t('INSTALL_CUSTOMIZE_INFO'));
     $paths = array('jaws_data', 'jaws_base_data', 'jaws_themes', 'jaws_base_themes', 'jaws_cache');
     foreach ($paths as $path) {
         $upper_path = strtoupper($path);
         $tpl->SetVariable($path, constant($upper_path));
         $tpl->SetVariable("checked_{$path}", isset($_SESSION[$upper_path]) ? 'checked="checked"' : '');
         $tpl->SetVariable("disabled_{$path}", isset($_SESSION[$upper_path]) ? '' : 'disabled="disabled"');
     }
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->ParseBlock('Customize');
     return $tpl->Get();
 }
Exemple #7
0
 /**
  * Shows the HTML of the Layout.
  *
  * @access  public
  */
 function Get($raw_content = false)
 {
     // Set Headers
     header('Content-Type: text/html; charset=utf-8');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
     $this->AddHeadMeta('generator', 'Jaws Project (http://jaws-project.com)');
     $use_rewrite = $GLOBALS['app']->Registry->fetch('map_use_rewrite', 'UrlMapper') == 'true';
     $use_rewrite = $use_rewrite && JAWS_SCRIPT == 'index';
     $this->AddHeadMeta('application-name', ($use_rewrite ? '' : BASE_SCRIPT) . ':' . $GLOBALS['app']->mainGadget . ':' . $GLOBALS['app']->mainAction);
     $headContent = $this->GetHeaderContent($this->_HeadLink, $this->_ScriptLink, $this->_HeadMeta, $this->_HeadOther);
     if (!empty($headContent)) {
         $this->_Template->SetBlock('layout/head');
         $this->_Template->SetVariable('ELEMENT', $headContent);
         $this->_Template->ParseBlock('layout/head');
     }
     if (JAWS_SCRIPT == 'index') {
         $this->PutTitle();
         $this->PutDescription();
         $this->PutMetaKeywords();
         $this->PutMetaLanguages();
     }
     // parse template an show the HTML
     $this->_Template->ParseBlock('layout');
     if ($raw_content) {
         return $this->_Template->Get();
     } else {
         $content = $this->_Template->Get();
         if ($GLOBALS['app']->GZipEnabled()) {
             if (false == strpos($GLOBALS['app']->GetBrowserEncoding(), 'x-gzip')) {
                 jaws()->request->update('restype', 'gzip');
             } else {
                 jaws()->request->update('restype', 'x-gzip');
             }
         }
         return $content;
     }
 }
Exemple #8
0
 /**
  * The preg_replace call back function
  *
  * @access  private
  * @param   string  $data   Matched strings from preg_replace_callback
  * @return  string  Gadget's action output or access message
  */
 function Prepare($data)
 {
     $users = $data[2];
     $groups = $data[4];
     $content =& $data[5];
     if ($GLOBALS['app']->Session->Logged()) {
         if (!$GLOBALS['app']->Session->IsSuperAdmin()) {
             $users = empty($users) ? array() : array_map('trim', explode(',', $users));
             $groups = empty($groups) ? array() : array_map('trim', explode(',', $groups));
             static $user_groups;
             $user = $GLOBALS['app']->Session->GetAttribute('username');
             if (!isset($user_groups)) {
                 $user_groups = $GLOBALS['app']->Session->GetAttribute('groups');
                 $user_groups = array_values($user_groups);
             }
             if (!empty($users) || !empty($groups)) {
                 if ((empty($users) || !in_array($user, $users)) && (empty($groups) || !count(array_intersect($groups, $user_groups)))) {
                     $tpl = new Jaws_Template();
                     $tpl->Load('AccessLimiter.html', 'plugins/AccessLimiter/Templates/');
                     $tpl->SetBlock('AccessLimiter');
                     $tpl->SetVariable('message', _t('GLOBAL_ERROR_ACCESS_DENIED'));
                     $tpl->ParseBlock('AccessLimiter');
                     return $tpl->Get();
                 }
             }
         }
         return $content;
     }
     $tpl = new Jaws_Template();
     $tpl->Load('AccessLimiter.html', 'plugins/AccessLimiter/Templates/');
     $tpl->SetBlock('AccessLimiter');
     $login_url = $GLOBALS['app']->Map->GetURLFor('Users', 'LoginBox');
     $register_url = $GLOBALS['app']->Map->GetURLFor('Users', 'Registration');
     $tpl->SetVariable('message', _t('GLOBAL_ERROR_ACCESS_RESTRICTED', $login_url, $register_url));
     $tpl->ParseBlock('AccessLimiter');
     return $tpl->Get();
 }
Exemple #9
0
 /**
  * Displays banners(all-time visibles and random ones)
  *
  * @access  public
  * @param   int     $gid    Group ID
  * @return  string  XHTML template content
  */
 function Banners($gid = 0)
 {
     $id = (int) $this->gadget->request->fetch('id', 'get');
     $abs_url = false;
     if (!empty($id)) {
         $gid = $id;
         header(Jaws_XSS::filter($_SERVER['SERVER_PROTOCOL']) . " 200 OK");
         $abs_url = true;
     }
     $groupModel = $this->gadget->model->load('Groups');
     $group = $groupModel->GetGroup($gid);
     if (Jaws_Error::IsError($group) || empty($group) || !$group['published']) {
         return false;
     }
     $bannerModel = $this->gadget->model->load('Banners');
     $banners = $bannerModel->GetVisibleBanners($gid, $group['limit_count']);
     if (Jaws_Error::IsError($banners) || empty($banners)) {
         return false;
     }
     $tpl = $this->gadget->template->load('Banners.html');
     switch ($group['show_type']) {
         case 1:
         case 2:
             $type_block = 'banners_type_' . $group['show_type'];
             break;
         default:
             $type_block = 'banners';
     }
     $tpl->SetBlock($type_block);
     $tpl->SetVariable('gid', $gid);
     if ($group['show_title']) {
         $tpl->SetBlock("{$type_block}/title");
         $tpl->SetVariable('title', _t('BANNER_ACTIONS_BANNERS_TITLE', $group['title']));
         $tpl->ParseBlock("{$type_block}/title");
     }
     foreach ($banners as $banner) {
         $tpl->SetBlock("{$type_block}/banner");
         $tpl_template = new Jaws_Template();
         $tpl_template->LoadFromString('<!-- BEGIN x -->' . $banner['template'] . '<!-- END x -->');
         $tpl_template->SetBlock('x');
         $tpl_template->SetVariable('title', $banner['title']);
         if (file_exists(JAWS_DATA . $this->gadget->DataDirectory . $banner['banner'])) {
             $tpl_template->SetVariable('banner', $GLOBALS['app']->getDataURL($this->gadget->DataDirectory . $banner['banner']));
         } else {
             $tpl_template->SetVariable('banner', $banner['banner']);
         }
         if (empty($banner['url'])) {
             $tpl_template->SetVariable('link', 'javascript:void(0);');
             $tpl_template->SetVariable('target', '_self');
         } else {
             $tpl_template->SetVariable('link', $this->gadget->urlMap('Click', array('id' => $banner['id']), $abs_url));
             $tpl_template->SetVariable('target', '_blank');
         }
         $tpl_template->ParseBlock('x');
         $tpl->SetVariable('template', $tpl_template->Get());
         unset($tpl_template);
         $tpl->ParseBlock("{$type_block}/banner");
         $bannerModel->ViewBanner($banner['id']);
     }
     $tpl->ParseBlock($type_block);
     return $tpl->Get();
 }
Exemple #10
0
 /**
  * Builds the upgrader page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     // Get values
     $values = $this->_Defaults;
     foreach ($this->_Defaults as $name => $value) {
         if (isset($_SESSION['upgrade']['Database'][$name])) {
             $values[$name] = $_SESSION['upgrade']['Database'][$name];
         }
     }
     $data = array();
     if (isset($_SESSION['upgrade']['data']['Database'])) {
         $data = $_SESSION['upgrade']['data']['Database'];
     }
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Database/templates');
     $tpl->SetBlock('Database');
     $tpl->setVariable('db_info', _t('UPGRADE_DB_INFO'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     if ($_SESSION['secure']) {
         $JCrypt = Jaws_Crypt::getInstance(array('pvt_key' => $_SESSION['pvt_key'], 'pub_key' => $_SESSION['pub_key']));
         if (!Jaws_Error::IsError($JCrypt)) {
             $tpl->SetVariable('length', $JCrypt->length());
             $tpl->SetVariable('modulus', $JCrypt->modulus());
             $tpl->SetVariable('exponent', $JCrypt->exponent());
             $tpl->SetVariable('func_onsubmit', 'EncryptPassword(this)');
         } else {
             $_SESSION['secure'] = false;
             $tpl->SetVariable('func_onsubmit', 'true');
         }
     } else {
         $_SESSION['pub_key'] = '';
         $_SESSION['pvt_key'] = '';
         $tpl->SetVariable('func_onsubmit', 'true');
     }
     $fields = 0;
     if (!isset($data['host'])) {
         $fields++;
         $tpl->SetBlock('Database/host');
         $tpl->setVariable('lbl_host', _t('UPGRADE_DB_HOST'));
         $tpl->setVariable('host_info', _t('UPGRADE_DB_HOST_INFO', 'localhost'));
         $tpl->SetVariable('host', $values['host']);
         $tpl->ParseBlock('Database/host');
     }
     if (!isset($data['user'])) {
         $fields++;
         $tpl->SetBlock('Database/user');
         $tpl->setVariable('lbl_user', _t('UPGRADE_DB_USER'));
         $tpl->setVariable('is_db_admin', _t('UPGRADE_DB_IS_ADMIN'));
         $tpl->SetVariable('user', $values['user']);
         $tpl->SetVariable('isdba_checked', empty($values['isdba']) || $values['isdba'] == 'false' ? '' : 'checked="checked"');
         $tpl->ParseBlock('Database/user');
     }
     if (!isset($data['password'])) {
         $fields++;
         $tpl->SetBlock('Database/password');
         $tpl->setVariable('lbl_pass', _t('UPGRADE_DB_PASS'));
         $tpl->SetVariable('dbpass', '');
         $tpl->ParseBlock('Database/password');
     }
     if (!isset($data['name'])) {
         $fields++;
         $tpl->SetBlock('Database/name');
         $tpl->setVariable('lbl_db_name', _t('UPGRADE_DB_NAME'));
         $tpl->SetVariable('name', $values['name']);
         $tpl->ParseBlock('Database/name');
     }
     if (!isset($data['path'])) {
         $fields++;
         $tpl->SetBlock('Database/path');
         $tpl->setVariable('lbl_db_path', _t('UPGRADE_DB_PATH'));
         $tpl->setVariable('path_info', _t('UPGRADE_DB_PATH_INFO'));
         $tpl->SetVariable('path', $values['path']);
         $tpl->ParseBlock('Database/path');
     }
     if (!isset($data['port'])) {
         $fields++;
         $tpl->SetBlock('Database/port');
         $tpl->setVariable('lbl_port', _t('UPGRADE_DB_PORT'));
         $tpl->setVariable('port_info', _t('UPGRADE_DB_PORT_INFO'));
         $tpl->SetVariable('port', $values['port']);
         $tpl->ParseBlock('Database/port');
     }
     if (!isset($data['prefix'])) {
         $fields++;
         $tpl->SetBlock('Database/prefix');
         $tpl->setVariable('lbl_prefix', _t('UPGRADE_DB_PREFIX'));
         $tpl->setVariable('prefix_info', _t('UPGRADE_DB_PREFIX_INFO'));
         $tpl->SetVariable('prefix', $values['prefix']);
         $tpl->ParseBlock('Database/prefix');
     }
     // drivers
     if (!isset($data['driver'])) {
         $fields++;
         $tpl->SetBlock('Database/drivers');
         $tpl->setVariable('lbl_driver', _t('UPGRADE_DB_DRIVER'));
         $drivers = array('mysqli' => array('ext' => 'mysqli', 'title' => 'MySQLi (4.1.3 and above)'), 'mysql' => array('ext' => 'mysql', 'title' => 'MySQL'), 'pgsql' => array('ext' => 'pgsql', 'title' => 'PostgreSQL'), 'oci8' => array('ext' => 'oci8', 'title' => 'Oracle'), 'mssql' => array('ext' => 'mssql', 'title' => 'MSSQL Server'), 'sqlsrv' => array('ext' => 'sqlsrv', 'title' => 'MSSQL Server(Microsoft Driver)'), 'ibase' => array('ext' => 'interbase', 'title' => 'Interbase/Firebird'));
         $modules = get_loaded_extensions();
         $modules = array_map('strtolower', $modules);
         foreach ($drivers as $driver => $driver_info) {
             _log(JAWS_LOG_DEBUG, "Checking if " . $driver_info['title'] . "(" . $driver_info['ext'] . ") driver is available");
             if (!in_array($driver_info['ext'], $modules)) {
                 $available = false;
                 //However... mssql support exists in some Linux distros with the sybase package
                 if ($driver_info['ext'] == 'mssql' && function_exists('mssql_connect')) {
                     $available = true;
                 }
                 if ($available === false) {
                     _log(JAWS_LOG_DEBUG, "Driver " . $driver_info['title'] . "(" . $driver_info['ext'] . ") is NOT available");
                     continue;
                 }
             }
             _log(JAWS_LOG_DEBUG, "Driver " . $driver_info['title'] . "(" . $driver_info['ext'] . ") is available");
             $tpl->setBlock('Database/drivers/driver');
             $tpl->setVariable('d_name', $driver);
             $tpl->setVariable('d_realname', $driver_info['title']);
             if (!empty($values['driver']) && $values['driver'] == $driver) {
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             $tpl->setVariable('d_selected', $selected);
             $tpl->ParseBlock('Database/drivers/driver');
         }
         $tpl->ParseBlock('Database/drivers');
     }
     if ($fields === 0 && !isset($GLOBALS['message'])) {
         $_SESSION['upgrade']['Database']['skip'] = '1';
         header('Location: index.php');
     }
     $tpl->ParseBlock('Database');
     return $tpl->Get();
 }
Exemple #11
0
 /**
  * Shows a given month/year
  */
 function ShowMonth($month, $year = null)
 {
     if (empty($year)) {
         $year = $this->Today['year'];
     }
     $tpl = new Jaws_Template();
     $tpl->Load('Calendar.html', $this->_TemplateDir);
     $tpl->SetBlock('calendar');
     $tpl->setVariable('title', _t('BLOG_LAYOUT_CALENDAR'));
     $objDate = Jaws_Date::getInstance();
     // Obtain first week day of month
     $date = $objDate->GetDateInfo($year, $month, 1, 12, 0, 0);
     $first = $date['wday'];
     if ($first == 0 && START_WEEKDAY != 0) {
         $first += 7;
     }
     // Move to date to first week day.
     $date = $objDate->GetDateInfo($year, $month, START_WEEKDAY + 1 - $first, 12, 0, 0);
     // type cast to int
     $date['year'] = (int) $date['year'];
     $date['mon'] = (int) $date['mon'];
     $date['mday'] = (int) $date['mday'];
     // Set header
     if (isset($this->Arrow['left'])) {
         $left_arrow = '<a href="' . $this->Arrow['left']['url'] . '">' . $this->Arrow['left']['text'] . '</a>';
         $tpl->setVariable('left_arrow', $left_arrow);
     }
     if ($this->Arrow['right']) {
         $right_arrow = '<a href="' . $this->Arrow['right']['url'] . '">' . $this->Arrow['right']['text'] . '</a>';
         $tpl->setVariable('right_arrow', $right_arrow);
     }
     $tpl->SetVariable('month', $objDate->MonthString($month));
     $tpl->SetVariable('year', $year);
     // weekdays
     $wd = START_WEEKDAY;
     for ($i = 0; $i <= 6; $i++) {
         $tpl->SetBlock('calendar/weekday');
         $tpl->SetVariable('weekday', $objDate->DayShortString($wd));
         $tpl->ParseBlock('calendar/weekday');
         $wd < 6 ? $wd++ : ($wd = 0);
     }
     // days
     $end = false;
     while (!$end) {
         $tpl->SetBlock('calendar/week');
         for ($iDay = 0; $iDay <= 6; $iDay++) {
             $tpl->SetBlock('calendar/week/day');
             if ($date['mday'] == $this->Today['mday'] && $date['mon'] == $this->Today['mon'] && $date['year'] == $this->Today['year']) {
                 $style = 'today';
             } elseif ($date['mday'] == $this->Day && $date['mon'] == $this->Month && $date['year'] == $this->Year) {
                 $style = 'selectedday';
             } elseif ($date['mon'] == $month) {
                 $style = 'day';
             } else {
                 $style = 'noday';
                 // TODO: Simplify this condition ;-)
                 if (($date['mon'] > $month || $date['mon'] == 1 && $month == 12) && !($date['mon'] == 12 && $month == 1)) {
                     $end = true;
                 }
             }
             $tpl->SetVariable('style', $style);
             $url = $title = '';
             // Got URL?
             if (isset($this->Items[$date['year']][$date['mon']][$date['mday']]['url'])) {
                 $url = $this->Items[$date['year']][$date['mon']][$date['mday']]['url'];
             }
             if (isset($this->Items[$date['year']][$date['mon']][$date['mday']]['title'])) {
                 $title = $this->Items[$date['year']][$date['mon']][$date['mday']]['title'];
             }
             if (!empty($url)) {
                 $tpl->SetVariable('day', '<a href="' . $url . '" title="' . $title . '">' . $date['mday'] . '</a>');
             } else {
                 $tpl->SetVariable('day', $date['mday']);
             }
             $date = $objDate->GetDateInfo($date['year'], $date['mon'], $date['mday'] + 1, 12, 0, 0);
             // type cast to int
             $date['year'] = (int) $date['year'];
             $date['mon'] = (int) $date['mon'];
             $date['mday'] = (int) $date['mday'];
             $tpl->ParseBlock('calendar/week/day');
         }
         $tpl->ParseBlock('calendar/week');
     }
     $tpl->ParseBlock('calendar');
     return $tpl->Get();
 }
Exemple #12
0
 /**
  * Builds the upgrader page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $request = Jaws_Request::getInstance();
     $use_log = $request->fetch('use_log', 'post');
     //Set main session-log vars
     if (isset($use_log)) {
         $_SESSION['use_log'] = $use_log === 'yes' ? JAWS_LOG_DEBUG : false;
     }
     _log(JAWS_LOG_DEBUG, "Generating new installation key");
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Authentication/templates');
     $tpl->SetBlock('Authentication');
     $tpl->SetVariable('key_path_info', _t('UPGRADE_AUTH_PATH_INFO', 'key.txt', UPGRADE_PATH));
     $tpl->SetVariable('rsa_security', _t('UPGRADE_AUTH_ENABLE_SECURITY'));
     $tpl->SetVariable('auth_upload', _t('UPGRADE_AUTH_UPLOAD'));
     $tpl->SetVariable('key_file_info', _t('UPGRADE_AUTH_KEY_INFO'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->SetVariable('key', $_SESSION['upgrade']['Authentication']['key']);
     $tpl->SetVariable('checked', $_SESSION['secure'] ? 'checked="checked"' : '');
     $tpl->ParseBlock('Authentication');
     return $tpl->Get();
 }
Exemple #13
0
 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Introduction/templates');
     $tpl->SetBlock('Introduction');
     $tpl->SetVariable('welcome', _t('INSTALL_INTRO_WELCOME'));
     $tpl->SetVariable('title_info', _t('INSTALL_INTRO_INSTALLER'));
     $tpl->SetVariable('db_info', _t('INSTALL_INTRO_DATABASE'));
     $tpl->SetVariable('ftp_info', _t('INSTALL_INTRO_FTP'));
     $tpl->SetVariable('mail_info', _t('INSTALL_INTRO_MAIL'));
     $tpl->SetVariable('language', _t('GLOBAL_LANGUAGE'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $langs = Jaws_Utils::GetLanguagesList();
     $selected_lang = isset($_SESSION['install']['language']) ? $_SESSION['install']['language'] : 'en';
     foreach ($langs as $code => $fullname) {
         $tpl->SetBlock('Introduction/lang');
         $tpl->SetVariable('selected', $code == $selected_lang ? 'selected="selected"' : '');
         $tpl->SetVariable('code', $code);
         $tpl->SetVariable('fullname', $fullname);
         $tpl->ParseBlock('Introduction/lang');
     }
     $tpl->ParseBlock('Introduction');
     return $tpl->Get();
 }
Exemple #14
0
 /**
  * Builds the upgrader page stage
  *
  * @access  public
  * @return  string  A block of valid XHTML to display the requirements
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->load('display.html', 'stages/Requirements/templates');
     $tpl->setBlock('Requirements');
     $tpl->setVariable('requirements', _t('UPGRADE_REQUIREMENTS'));
     $tpl->setVariable('requirement', _t('UPGRADE_REQ_REQUIREMENT'));
     $tpl->setVariable('optional', _t('UPGRADE_REQ_OPTIONAL'));
     $tpl->setVariable('recommended', _t('UPGRADE_REQ_RECOMMENDED'));
     $tpl->setVariable('directive', _t('UPGRADE_REQ_DIRECTIVE'));
     $tpl->setVariable('actual', _t('UPGRADE_REQ_ACTUAL'));
     $tpl->setVariable('result', _t('UPGRADE_REQ_RESULT'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $modules = get_loaded_extensions();
     $modules = array_map('strtolower', $modules);
     _log(JAWS_LOG_DEBUG, "Checking requirements...");
     // PHP version
     $tpl->setBlock('Requirements/req_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_PHP_VERSION'));
     $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_GREATER_THAN', MIN_PHP_VERSION));
     $tpl->setVariable('item_actual', phpversion());
     if (version_compare(phpversion(), MIN_PHP_VERSION, ">=") == 1) {
         _log(JAWS_LOG_DEBUG, "PHP installed version looks ok (>= " . MIN_PHP_VERSION . ")");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "PHP installed version (" . phpversion() . ") is not supported");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/req_item');
     // config directory
     $tpl->setBlock('Requirements/req_item');
     $result = $this->_check_path('config', 'r');
     $tpl->setVariable('item', _t('UPGRADE_REQ_DIRECTORY', 'config'));
     $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_READABLE'));
     $tpl->setVariable('item_actual', $this->_get_perms('config'));
     if ($result) {
         _log(JAWS_LOG_DEBUG, "config directory has read-permission privileges");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "config directory doesn't have read-permission privileges");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/req_item');
     // data directory
     $tpl->setBlock('Requirements/req_item');
     $result = $this->_check_path('data', 'rw');
     $tpl->setVariable('item', _t('UPGRADE_REQ_DIRECTORY', 'data'));
     $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_WRITABLE'));
     $tpl->setVariable('item_actual', $this->_get_perms('data'));
     if ($result) {
         _log(JAWS_LOG_DEBUG, "data directory has read and write permission privileges");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "data directory doesn't have read and write permission privileges");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/req_item');
     // Database drivers
     $tpl->setBlock('Requirements/req_item');
     $tpl->setVariable('item', implode('<br/>', $this->_db_drivers));
     $tpl->setVariable('item_requirement', _t('GLOBAL_YES'));
     $actual = '';
     $db_state = false;
     foreach (array_keys($this->_db_drivers) as $ext) {
         $db_state = $db_state || in_array($ext, $modules);
         $actual .= (!empty($actual) ? '<br />' : '') . (in_array($ext, $modules) ? $ext : '-----');
     }
     $tpl->setVariable('item_actual', $actual);
     if ($db_state) {
         _log(JAWS_LOG_DEBUG, "Available database drivers: {$actual}");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "No database driver found");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/req_item');
     // XML extension
     $tpl->setBlock('Requirements/req_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'XML'));
     $tpl->setVariable('item_requirement', _t('GLOBAL_YES'));
     $tpl->setVariable('item_actual', in_array('xml', $modules) ? _t('GLOBAL_YES') : _t('GLOBAL_NO'));
     if (in_array('xml', $modules)) {
         _log(JAWS_LOG_DEBUG, "xml support is enabled");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "xml support is not enabled");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/req_item');
     // File Upload
     $tpl->setBlock('Requirements/rec_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_FILE_UPLOAD'));
     $tpl->setVariable('item_requirement', _t('GLOBAL_YES'));
     $check = (bool) ini_get('file_uploads');
     $tpl->setVariable('item_actual', $check ? _t('GLOBAL_YES') : _t('GLOBAL_NO'));
     if ($check) {
         _log(JAWS_LOG_DEBUG, "PHP accepts file uploads");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "PHP doesn't accept file uploads");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/rec_item');
     // Safe mode
     $tpl->setBlock('Requirements/rec_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_SAFE_MODE'));
     $tpl->setVariable('item_requirement', _t('UPGRADE_REQ_OFF'));
     $safe_mode = (bool) ini_get('safe_mode');
     $tpl->setVariable('item_actual', $safe_mode ? _t('UPGRADE_REQ_ON') : _t('UPGRADE_REQ_OFF'));
     if ($safe_mode) {
         _log(JAWS_LOG_DEBUG, "PHP has safe-mode turned on");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "PHP has safe-mode turned off");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/rec_item');
     // GD/ImageMagick
     $tpl->setBlock('Requirements/rec_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'GD/ImageMagick'));
     $tpl->setVariable('item_requirement', _t('GLOBAL_YES'));
     $actual = in_array('gd', $modules) ? 'GD' : '';
     $actual .= in_array('magickwand', $modules) ? (empty($actual) ? '' : ' + ') . 'ImageMagick' : '';
     $actual = empty($actual) ? 'No' : $actual;
     $tpl->setVariable('item_actual', $actual);
     if (in_array('gd', $modules) || in_array('magickwand', $modules)) {
         _log(JAWS_LOG_DEBUG, "PHP has GD or ImageMagick turned on");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "PHP has GD or ImageMagick turned off");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/rec_item');
     // Exif extension
     $tpl->setBlock('Requirements/rec_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'Exif'));
     $tpl->setVariable('item_requirement', _t('GLOBAL_YES'));
     $tpl->setVariable('item_actual', in_array('exif', $modules) ? _t('GLOBAL_YES') : _t('GLOBAL_NO'));
     if (in_array('exif', $modules)) {
         _log(JAWS_LOG_DEBUG, "exif support is enabled");
         $result_txt = '<span style="color: #0b0;">' . _t('UPGRADE_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "exif support is not enabled");
         $result_txt = '<span style="color: #b00;">' . _t('UPGRADE_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/rec_item');
     // OpenSSL extension
     $tpl->setBlock('Requirements/rec_item');
     $tpl->setVariable('item', _t('UPGRADE_REQ_EXTENSION', 'OpenSSL'));
     $tpl->setVariable('item_requirement', _t('GLOBAL_YES'));
     $tpl->setVariable('item_actual', in_array('openssl', $modules) ? _t('GLOBAL_YES') : _t('GLOBAL_NO'));
     if (in_array('openssl', $modules)) {
         _log(JAWS_LOG_DEBUG, "openssl extension is loaded");
         $result_txt = '<span style="color: #0b0;">' . _t('INSTALL_REQ_OK') . '</span>';
     } else {
         _log(JAWS_LOG_DEBUG, "openssl extension is not loaded");
         $result_txt = '<span style="color: #b00;">' . _t('INSTALL_REQ_BAD') . '</span>';
     }
     $tpl->setVariable('result', $result_txt);
     $tpl->parseBlock('Requirements/rec_item');
     $tpl->parseBlock('Requirements');
     return $tpl->get();
 }
Exemple #15
0
 /**
  * Builds the upgrader page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     // Create application
     include_once JAWS_PATH . 'include/Jaws.php';
     $GLOBALS['app'] = jaws();
     $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false);
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Cleanup/templates');
     _log(JAWS_LOG_DEBUG, "Preparing cleanup stage");
     $tpl->SetBlock('cleanup');
     $tpl->setVariable('lbl_info', _t('UPGRADE_CLEANUP_INFO'));
     $cleanup_required = false;
     $cleanup_items = @file_get_contents(JAWS_PATH . 'upgrade/stages/Cleanup/folders.txt');
     $cleanup_items = array_filter(explode("\n", $cleanup_items));
     foreach ($cleanup_items as $item) {
         if (file_exists(JAWS_PATH . $item)) {
             $cleanup_required = true;
             $tpl->SetBlock('cleanup/item');
             $tpl->setVariable('type', '1');
             $tpl->setVariable('item_path', $item);
             $tpl->ParseBlock('cleanup/item');
         }
     }
     $cleanup_items = @file_get_contents(JAWS_PATH . 'upgrade/stages/Cleanup/files.txt');
     $cleanup_items = array_filter(explode("\n", $cleanup_items));
     foreach ($cleanup_items as $item) {
         if (file_exists(JAWS_PATH . $item)) {
             $cleanup_required = true;
             $tpl->SetBlock('cleanup/item');
             $tpl->setVariable('type', '0');
             $tpl->setVariable('item_path', $item);
             $tpl->ParseBlock('cleanup/item');
         }
     }
     if (!$cleanup_required) {
         $tpl->SetBlock('cleanup/not_required');
         $tpl->setVariable('message', _t('UPGRADE_CLEANUP_NOT_REQUIRED'));
         $tpl->ParseBlock('cleanup/not_required');
     }
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->ParseBlock('cleanup');
     return $tpl->Get();
 }
Exemple #16
0
 /**
  * Get HTTP status reponse
  *
  * @access  public
  * @param   int     $code       Status code
  * @param   string  $title      Reponse page title
  * @param   string  $message    Response message
  * @return  string  HTML template content
  */
 static function Get($code, $title = null, $message = null)
 {
     header('Content-Type: text/html; charset=utf-8');
     header('Cache-Control: no-cache, must-revalidate');
     header('Pragma: no-cache');
     // Let everyone know a HTTP error has been happened
     $result = $GLOBALS['app']->Listener->Shout('HTTPError', 'HTTPError', $code, 'UrlMapper');
     if (!Jaws_Error::IsError($result) && !empty($result)) {
         $code = empty($result['code']) ? $code : $result['code'];
     }
     switch ($code) {
         case 401:
             $realm = $GLOBALS['app']->Registry->fetch('realm', 'Settings');
             jaws()->http_response_code(401);
             // using invalid authentication type for avoid popup login box
             header('WWW-Authenticate: LoginBox realm="' . $realm . '"');
             $urlLogin = $GLOBALS['app']->Map->GetURLFor('Users', 'LoginBox', array('referrer' => bin2hex(Jaws_Utils::getRequestURL(true))));
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_401') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_401', $urlLogin) : $message;
             break;
         case 403:
             jaws()->http_response_code(403);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_403') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_403') : $message;
             break;
         case 404:
             $uri = Jaws_XSS::filter(Jaws_Utils::getRequestURL(false));
             if (empty($message)) {
                 $message = _t('GLOBAL_HTTP_ERROR_CONTENT_404', $uri);
             }
             jaws()->http_response_code(404);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_404') : $title;
             break;
         case 410:
             jaws()->http_response_code(410);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_410') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_410') : $message;
             break;
         case 500:
             jaws()->http_response_code(500);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_500') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_500') : $message;
             break;
         case 503:
             jaws()->http_response_code(503);
             $title = empty($title) ? _t('GLOBAL_HTTP_ERROR_TITLE_503') : $title;
             $message = empty($message) ? _t('GLOBAL_HTTP_ERROR_CONTENT_503') : $message;
             break;
         default:
             $title = empty($title) ? _t("GLOBAL_HTTP_ERROR_TITLE_{$code}") : $title;
             $message = empty($message) ? _t("GLOBAL_HTTP_ERROR_CONTENT_{$code}") : $message;
     }
     // if current theme has a error code html file, return it, if not return the messages.
     $theme = $GLOBALS['app']->GetTheme();
     $site_name = $GLOBALS['app']->Registry->fetch('site_name', 'Settings');
     if (file_exists($theme['path'] . "{$code}.html")) {
         $tpl = new Jaws_Template();
         $tpl->Load("{$code}.html", $theme['path']);
         $tpl->SetBlock($code);
         //set global site config
         $direction = _t('GLOBAL_LANG_DIRECTION');
         $dir = $direction == 'rtl' ? '.' . $direction : '';
         $brow = $GLOBALS['app']->GetBrowserFlag();
         $brow = empty($brow) ? '' : '.' . $brow;
         $tpl->SetVariable('.dir', $dir);
         $tpl->SetVariable('.browser', $brow);
         $tpl->SetVariable('site-name', $site_name);
         $tpl->SetVariable('site-title', $site_name);
         $tpl->SetVariable('site-slogan', $GLOBALS['app']->Registry->fetch('site_slogan', 'Settings'));
         $tpl->SetVariable('site-author', $GLOBALS['app']->Registry->fetch('site_author', 'Settings'));
         $tpl->SetVariable('site-copyright', $GLOBALS['app']->Registry->fetch('copyright', 'Settings'));
         $tpl->SetVariable('site-description', $GLOBALS['app']->Registry->fetch('site_description', 'Settings'));
         $tpl->SetVariable('title', $title);
         $tpl->SetVariable('content', $message);
         $tpl->ParseBlock($code);
         return $tpl->Get();
     }
     return "<div class=\"gadget_header\"><div class=\"gadget_title\"><h3>{$title}</h3></div></div>" . "<div class=\"gadget_container\"><div class=\"content\">{$message}</div></div>";
 }
Exemple #17
0
 /**
  * Overrides, Parses the text
  *
  * @access  public
  * @param   string  $html   HTML to be parsed
  * @return  string  Parsed content
  */
 function ParseText($html)
 {
     while (preg_match_all('#\\[(\\w+|\\*)[=]?(.*?)\\][\\n]?(.+?)\\[/\\1\\]#isu', $html, $matches)) {
         foreach ($matches[0] as $key => $match) {
             list($tag, $params, $innertext) = array($matches[1][$key], $matches[2][$key], $matches[3][$key]);
             $params = explode(' ', $params);
             $first = array_shift($params);
             $params = implode(' ', $params);
             switch ($tag) {
                 case 'dir':
                     $replacement = "<div dir=\"{$first}\">{$innertext}</div>";
                     break;
                 case 'indent':
                     $first = floatval($first);
                     $style = 'margin-' . (!empty($params) ? $params : 'left');
                     $replacement = "<div style=\"{$style}:{$first}em;\">{$innertext}</div>";
                     break;
                 case 'h':
                     $first = (int) $first == 0 ? 3 : (int) $first;
                     $replacement = "<h{$first}>{$innertext}</h{$first}>";
                     break;
                 case 'hr':
                     $replacement = "<hr/>";
                     break;
                 case 'b':
                     $replacement = "<strong>{$innertext}</strong>";
                     break;
                 case 'i':
                     $replacement = "<em>{$innertext}</em>";
                     break;
                 case 'h1':
                 case 'h2':
                 case 'h3':
                 case 'h4':
                 case 'h5':
                 case 'h6':
                 case 's':
                 case 'u':
                 case 'li':
                 case 'tr':
                 case 'th':
                 case 'td':
                 case 'sup':
                 case 'sub':
                 case 'table':
                     $replacement = "<{$tag}>{$innertext}</{$tag}>";
                     break;
                 case 'code':
                 case 'noparse':
                     $replacement = '<pre><code>' . str_replace(array('[', ']', '{', '}'), array('&lsqb;', '&rsqb;', '&lcub;', '&rcub;'), $innertext) . '</code></pre>';
                     break;
                 case 'list':
                     $tag = empty($first) ? 'ul' : 'ol';
                 case 'ul':
                 case 'ol':
                     switch ($first) {
                         case '1':
                             $replacement = "<ol style=\"list-style-type:decimal;\">{$innertext}</ol>";
                             break;
                         case 'a':
                             $replacement = "<ol style=\"list-style-type:lower-alpha;\">{$innertext}</ol>";
                             break;
                         case 'A':
                             $replacement = "<ol style=\"list-style-type:upper-alpha;\">{$innertext}</ol>";
                             break;
                         case 'i':
                             $replacement = "<ol style=\"list-style-type:lower-roman;\">{$innertext}</ol>";
                             break;
                         case 'I':
                             $replacement = "<ol style=\"list-style-type:upper-roman;\">{$innertext}</ol>";
                             break;
                         default:
                             $replacement = "<{$tag}>{$innertext}</{$tag}>";
                     }
                     break;
                 case '*':
                     $replacement = "<li>{$innertext}</li>";
                     break;
                 case 'size':
                     $first .= is_numeric($first) ? 'px' : '';
                     $replacement = "<span style=\"font-size:{$first};\">{$innertext}</span>";
                     break;
                 case 'color':
                     $replacement = "<span style=\"color:{$first};\">{$innertext}</span>";
                     break;
                 case 'bgcolor':
                     $replacement = "<span style=\"background-color:{$first};\">{$innertext}</span>";
                     break;
                 case 'align':
                     $replacement = "<div style=\"text-align:{$first};\">{$innertext}</div>";
                     break;
                 case 'quote':
                     $replacement = $first ? "<cite>{$first}:</cite>" : '';
                     $replacement = "<blockquote>{$replacement}<div>{$innertext}</div></blockquote>";
                     break;
                 case 'url':
                     $replacement = '<a href="' . ($first ? $first : $innertext) . "\" rel=\"nofollow\">{$innertext}</a>";
                     break;
                 case 'email':
                     $replacement = '<a href="mailto:' . ($first ? $first : $innertext) . "\">{$innertext}</a>";
                     break;
                 case 'img':
                     @(list($width, $height) = preg_split('#x#i', $first));
                     $replacement = "<img src=\"{$innertext}\" ";
                     $replacement .= is_numeric($width) ? "width=\"{$width}\" " : '';
                     $replacement .= is_numeric($height) ? "height=\"{$height}\" " : '';
                     $replacement .= !empty($params) ? "alt=\"{$params}\" " : '';
                     $replacement .= '/>';
                     break;
                 case 'media':
                     @(list($width, $height) = preg_split('#x#i', $first));
                     $mSource = 'youtube';
                     if (!empty($params)) {
                         $mSource = preg_replace('/[^[:alnum:]_-]/', '', $params);
                     }
                     $replacement = '';
                     $mSourcePath = JAWS_PATH . "plugins/BBCode/Templates/{$mSource}.html";
                     if (file_exists($mSourcePath)) {
                         $tpl = new Jaws_Template();
                         $tpl->Load("{$mSource}.html", 'plugins/BBCode/Templates/');
                         $tpl->SetBlock('media');
                         $tpl->SetVariable('vid', $innertext);
                         if (is_numeric($width)) {
                             $tpl->SetBlock('media/width');
                             $tpl->SetVariable('width', $width);
                             $tpl->ParseBlock('media/width');
                         }
                         if (is_numeric($height)) {
                             $tpl->SetBlock('media/height');
                             $tpl->SetVariable('height', $height);
                             $tpl->ParseBlock('media/height');
                         }
                         $tpl->ParseBlock('media');
                         $replacement = $tpl->Get();
                     }
                     break;
                 case 'video':
                     @(list($width, $height) = preg_split('#x#i', $first));
                     $size = is_numeric($width) ? "width=\"{$width}\" " : '';
                     $size .= is_numeric($height) ? "height=\"{$height}\" " : '';
                     $replacement = "<video {$size} controls>";
                     $replacement .= "<source src=\"{$innertext}.ogg\" type=\"video/ogg\">";
                     $replacement .= "<source src=\"{$innertext}.webm\" type=\"video/webm\">";
                     $replacement .= "<source src=\"{$innertext}.mp4\" type=\"video/mp4\">";
                     $replacement .= 'Your browser does not support the HTML5 video tag.';
                     $replacement .= '</video>';
                     break;
                 case 'audio':
                     @(list($width, $height) = preg_split('#x#i', $first));
                     $size = is_numeric($width) ? "style='width:{$width}px;' " : '';
                     $replacement = "<audio {$size}" . $params . ' controls>';
                     $replacement .= "<source src=\"{$innertext}.ogg\" type=\"audio/ogg\">";
                     $replacement .= "<source src=\"{$innertext}.mp3\" type=\"audio/mpeg\">";
                     $replacement .= "<source src=\"{$innertext}.wav\" type=\"audio/wav\">";
                     $replacement .= 'Your browser does not support the HTML5 audio tag.';
                     $replacement .= '</audio>';
                     break;
                 default:
                     $replacement = str_replace(array('[', ']'), array('&lsqb;', '&rsqb;'), $match);
             }
             $html = str_replace($match, $replacement, $html);
         }
     }
     return $html;
 }
Exemple #18
0
            break;
        case JAWS_ERROR_ERROR:
            $type = 'error';
            break;
    }
    $tpl->setBlock('page/message');
    $tpl->setVariable('text', $GLOBALS['message']->getMessage());
    $tpl->setVariable('type', $type);
    $tpl->parseBlock('page/message');
}
$tpl->ParseBlock('page');
// Defines where the layout template should be loaded from.
$direction = _t('GLOBAL_LANG_DIRECTION');
$dir = $direction == 'rtl' ? '.' . $direction : '';
// Display the layout
$layout = new Jaws_Template(false, false);
$layout->Load('layout.html', 'templates');
$layout->SetBlock('layout');
// Basic setup
$layout->SetVariable('BASE_URL', Jaws_Utils::getBaseURL('/install/'));
$layout->SetVariable('.dir', $dir);
$layout->SetVariable('site-title', 'Jaws ' . JAWS_VERSION);
$layout->SetVariable('site-name', 'Jaws ' . JAWS_VERSION);
$layout->SetVariable('site-slogan', JAWS_VERSION_CODENAME);
// Load js files
$layout->SetBlock('layout/head');
$layout->SetVariable('ELEMENT', '<script type="text/javascript" src="../libraries/js/rsa.lib.js"></script>');
$layout->ParseBlock('layout/head');
// Display the stage
$layout->SetBlock('layout/main');
$layout->SetVariable('ELEMENT', $tpl->Get());
Exemple #19
0
 /**
  * Displays the next level of parent menu
  *
  * @access  public
  * @param   object  $model      Jaws_Model reference
  * @param   string  $tpl_str    XHTML template content passed by reference
  * @param   int     $gid        Group ID
  * @param   int     $pid
  * @return  string  XHTML template content with sub menu items
  */
 function GetNextLevel(&$model, &$tpl_str, $gid, $pid)
 {
     $menus = $model->GetLevelsMenus($pid, $gid, true);
     if (Jaws_Error::IsError($menus) || empty($menus)) {
         return '';
     }
     $tpl = new Jaws_Template();
     $tpl->LoadFromString($tpl_str);
     $tpl->SetBlock('levels');
     $len = count($menus);
     static $level = -1;
     for ($i = 0; $i < $len; $i++) {
         // check ACL
         if ($menus[$i]['menu_type'] != 'url' && !empty($menus[$i]['key_name']) && !$GLOBALS['app']->Session->GetPermission($menus[$i]['menu_type'], $menus[$i]['acl_key_name'], $menus[$i]['acl_key_subkey'])) {
             continue;
         }
         $level++;
         $tpl->SetVariable('level', $level);
         $tpl->SetBlock('levels/menu_item');
         $tpl->SetVariable('mid', $menus[$i]['id']);
         $tpl->SetVariable('title', $menus[$i]['title']);
         $tpl->SetVariable('url', $menus[$i]['url']);
         $tpl->SetVariable('target', $menus[$i]['url_target'] == 0 ? '_self' : '_blank');
         if (!empty($menus[$i]['image'])) {
             $src = $this->gadget->urlMap('LoadImage', array('id' => $menus[$i]['id']));
             $image =& Piwi::CreateWidget('Image', $src, $menus[$i]['title']);
             $image->SetID('');
             $tpl->SetVariable('image', $image->get());
         } else {
             $tpl->SetVariable('image', '');
         }
         //menu selected?
         $selected = str_replace(BASE_SCRIPT, '', urldecode($menus[$i]['url'])) == $this->_ReqURL;
         //get sub level menus
         $subLevel = $this->GetNextLevel($model, $tpl_str, $gid, $menus[$i]['id']);
         if ($i == 0) {
             $tpl->SetBlock('levels/menu_item/first');
             $tpl->ParseBlock('levels/menu_item/first');
         }
         if ($i == $len - 1) {
             $tpl->SetBlock('levels/menu_item/last');
             $tpl->ParseBlock('levels/menu_item/last');
         }
         if ($selected) {
             $tpl->SetBlock('levels/menu_item/current');
             $tpl->ParseBlock('levels/menu_item/current');
         }
         if (!empty($subLevel)) {
             $tpl->SetBlock('levels/menu_item/super');
             $tpl->ParseBlock('levels/menu_item/super');
         }
         $tpl->SetVariable('sub_menu', $subLevel);
         $tpl->ParseBlock('levels/menu_item');
         $level--;
     }
     $tpl->ParseBlock('levels');
     return $tpl->Get();
 }
Exemple #20
0
 /**
  * Build the XHTML
  *
  * @access  public
  * @return  void
  */
 function buildXHTML()
 {
     static $alreadyLoaded;
     $alreadyLoaded = isset($alreadyLoaded) ? true : false;
     $plugins = array();
     $lang = $GLOBALS['app']->GetLanguage();
     $pluginDir = JAWS_PATH . 'libraries/tinymce/plugins/';
     if (is_dir($pluginDir)) {
         $dirs = scandir($pluginDir);
         foreach ($dirs as $dir) {
             if ($dir[0] != '.' && is_dir($pluginDir . $dir)) {
                 $plugins[] = $dir;
             }
         }
     }
     $plugins = implode(',', $plugins);
     $label = $this->_Label->GetValue();
     if (!empty($label)) {
         $this->_Container->PackStart($this->_Label);
     }
     $this->_Container->PackStart($this->TextArea);
     $this->_Container->SetWidth($this->_Width);
     $this->_XHTML .= $this->_Container->Get();
     $ibrowser = '';
     if (Jaws_Gadget::IsGadgetInstalled('Phoo')) {
         $ibrowser = $GLOBALS['app']->getSiteURL() . '/' . BASE_SCRIPT . '?gadget=Phoo&action=BrowsePhoo';
     }
     $fbrowser = '';
     if (Jaws_Gadget::IsGadgetInstalled('FileBrowser')) {
         $fbrowser = $GLOBALS['app']->getSiteURL() . '/' . BASE_SCRIPT . '?gadget=FileBrowser&action=BrowseFile';
     }
     $mbrowser = '';
     if (Jaws_Gadget::IsGadgetInstalled('Directory')) {
         $mbrowser = $GLOBALS['app']->getSiteURL() . '/' . BASE_SCRIPT . '?gadget=Directory&action=Browse';
     }
     if (JAWS_SCRIPT == 'admin') {
         $plugins = str_replace(',bbcode,', ',', $plugins);
         $block = 'tinymce_backend';
     } else {
         $block = 'tinymce_frontend';
     }
     $tpl = new Jaws_Template();
     $tpl->Load('TinyMCE.html', 'include/Jaws/Resources');
     $tpl->SetBlock($block);
     $tpl->SetVariable('ibrowser', $ibrowser);
     $tpl->SetVariable('fbrowser', $fbrowser);
     $tpl->SetVariable('mbrowser', !empty($mbrowser) ? $mbrowser : $fbrowser);
     $tpl->SetVariable('mode', $this->_Mode);
     $tpl->SetVariable('lang', $lang);
     $tpl->SetVariable('theme', $this->_Theme);
     $tpl->SetVariable('plugins', $plugins);
     // set toolbars
     $index = 0;
     foreach ($this->toolbars as $key => $toolbar) {
         $tpl->SetBlock("{$block}/toolbar");
         $index = $key + 1;
         $tpl->SetVariable('theme', $this->_Theme);
         $tpl->SetVariable('key', $index);
         $tpl->SetVariable('toolbar', $toolbar);
         $tpl->ParseBlock("{$block}/toolbar");
     }
     $index = $index + 1;
     $tpl->SetVariable('key', $index);
     $tpl->SetVariable('browsers', implode($this->_Browsers, ','));
     $tpl->SetVariable('dir', _t('GLOBAL_LANG_DIRECTION'));
     $tpl->SetVariable('valid_elements', $this->_ExtendedValidElements);
     $tpl->SetVariable('invalid_elements', $this->_InvalidElements);
     $tpl->SetVariable('class', $this->_Class);
     $tpl->ParseBlock($block);
     $this->_XHTML .= $tpl->Get();
 }
Exemple #21
0
 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $values = $this->_Fields;
     $keys = array_keys($values);
     $request = Jaws_Request::getInstance();
     $post = $request->fetch($keys, 'post');
     foreach ($this->_Fields as $key => $value) {
         if ($post[$key] !== null) {
             $values[$key] = $post[$key];
         }
     }
     $data = array();
     if (isset($_SESSION['install']['data']['Settings'])) {
         $data = $_SESSION['install']['data']['Settings'];
     }
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Settings/templates');
     $tpl->SetBlock('Settings');
     $tpl->setVariable('lbl_info', _t('INSTALL_SETTINGS_INFO'));
     $tpl->setVariable('lbl_site_name', _t('INSTALL_SETTINGS_SITE_NAME'));
     $tpl->setVariable('site_name_info', _t('INSTALL_SETTINGS_SITE_NAME_INFO'));
     $tpl->setVariable('lbl_site_slogan', _t('INSTALL_SETTINGS_SLOGAN'));
     $tpl->setVariable('site_slogan_info', _t('INSTALL_SETTINGS_SLOGAN_INFO'));
     $tpl->setVariable('lbl_site_language', _t('INSTALL_SETTINGS_SITE_LANGUAGE'));
     $tpl->setVariable('site_language_info', _t('INSTALL_SETTINGS_SITE_LANGUAGE_INFO'));
     $tpl->setVariable('lbl_site_sample', _t('INSTALL_SETTINGS_SITE_SAMPLE'));
     $tpl->setVariable('site_sample_info', _t('INSTALL_SETTINGS_SITE_SAMPLE_INFO'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->SetVariable('site_name', $values['site_name']);
     $tpl->SetVariable('site_slogan', $values['site_slogan']);
     // fill languages combo box
     $languages = Jaws_Utils::GetLanguagesList();
     foreach ($languages as $k => $v) {
         $tpl->SetBlock('Settings/lang');
         $tpl->setVariable('code', $k);
         $tpl->setVariable('title', $v);
         if ($values['site_language'] == $k) {
             $tpl->setVariable('selected', 'selected="selected"');
         } else {
             $tpl->setVariable('selected', '');
         }
         $tpl->ParseBlock('Settings/lang');
     }
     $tpl->ParseBlock('Settings');
     return $tpl->Get();
 }
Exemple #22
0
 /**
  * Internal recursive function to build the menu
  *
  * @access  private
  * @param   array   $items
  * @param   string  $tplString
  * @param   int     $level
  * @return  string  XHTML menu
  */
 function DisplayMenu(&$items, &$tplString, $level = 1)
 {
     $tpl = new Jaws_Template();
     $tpl->LoadFromString($tplString);
     $tpl->SetBlock('branch');
     $tpl->SetVariable('level', $level);
     if (count($items) > 0) {
         foreach ($items as $item) {
             $tpl->SetBlock('branch/menu');
             $tpl->SetVariable('level', $level);
             $tpl->SetVariable('url', $item['url']);
             $tpl->SetVariable('title', $item['title']);
             $active = '';
             if ($GLOBALS['app']->mainGadget == 'Sitemap' && jaws()->request->fetch('path', 'get') == $item['path']) {
                 $active = 'active';
             }
             $tpl->SetVariable('active', $active);
             if (count($item['childs']) > 0) {
                 $tpl->SetVariable('submenu', $this->DisplayMenu($item['childs'], $tplString, $level + 1));
             } else {
                 $tpl->SetVariable('submenu', '');
             }
             $tpl->ParseBlock('branch/menu');
         }
     }
     $tpl->ParseBlock('branch');
     return $tpl->Get();
 }
Exemple #23
0
 /**
  * Builds the upgrader page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display the status of old/current jaws versions
  */
 function Display()
 {
     include_once JAWS_PATH . 'include/Jaws/DB.php';
     $objDatabase = Jaws_DB::getInstance('default', $_SESSION['upgrade']['Database']);
     require_once JAWS_PATH . 'include/Jaws.php';
     $GLOBALS['app'] = jaws();
     if (!isset($_SESSION['upgrade']['InstalledVersion'])) {
         $_SESSION['upgrade']['InstalledVersion'] = $GLOBALS['app']->Registry->Init();
     }
     $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false);
     $supportedversions = array(array('version' => '1.2.0', 'stage' => '9'), array('version' => '1.1.1', 'stage' => '8'), array('version' => '1.1.0', 'stage' => '7'), array('version' => '1.0.0', 'stage' => '6'), array('version' => '0.9.3', 'stage' => null), array('version' => '0.9.2', 'stage' => null), array('version' => '0.9.1', 'stage' => null), array('version' => '0.9.0', 'stage' => null));
     _log(JAWS_LOG_DEBUG, "Checking/Reporting previous missed installations");
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Report/templates');
     $tpl->SetBlock('Report');
     $tpl->setVariable('lbl_info', _t('UPGRADE_REPORT_INFO', JAWS_VERSION));
     $tpl->setVariable('lbl_message', _t('UPGRADE_REPORT_MESSAGE'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $versions_to_upgrade = 0;
     $_SESSION['upgrade']['stagedVersions'] = array();
     foreach ($supportedversions as $supported) {
         $tpl->SetBlock('Report/versions');
         $tpl->SetBlock('Report/versions/version');
         $tpl->SetVariable('description', $supported['version']);
         $_SESSION['upgrade']['versions'][$supported['version']] = array('version' => $supported['version'], 'stage' => $supported['stage'], 'file' => isset($supported['file']) ? $supported['file'] : '', 'script' => isset($supported['script']) ? $supported['script'] : '');
         if (version_compare($supported['version'], $_SESSION['upgrade']['InstalledVersion'], '<=')) {
             if ($supported['version'] == JAWS_VERSION) {
                 $tpl->SetVariable('status', _t('UPGRADE_REPORT_NO_NEED_CURRENT'));
                 _log(JAWS_LOG_DEBUG, $supported['version'] . " does not requires upgrade(is current)");
             } else {
                 $tpl->SetVariable('status', _t('UPGRADE_REPORT_NO_NEED'));
                 _log(JAWS_LOG_DEBUG, $supported['version'] . " does not requires upgrade");
             }
             $_SESSION['upgrade']['versions'][$supported['version']]['status'] = true;
         } else {
             $tpl->SetVariable('status', _t('UPGRADE_REPORT_NEED'));
             $_SESSION['upgrade']['versions'][$supported['version']]['status'] = false;
             $versions_to_upgrade++;
             _log(JAWS_LOG_DEBUG, $supported['version'] . " requires upgrade");
             $_SESSION['upgrade']['versions'][$supported['version']]['status'] = false;
         }
         if (!is_null($supported['stage'])) {
             $_SESSION['upgrade']['stagedVersions'][] = $supported['version'];
         }
         $tpl->ParseBlock('Report/versions/version');
         $tpl->ParseBlock('Report/versions');
     }
     $_SESSION['upgrade']['versions_to_upgrade'] = $versions_to_upgrade;
     arsort($_SESSION['upgrade']['versions']);
     krsort($_SESSION['upgrade']['stagedVersions']);
     $tpl->ParseBlock('Report');
     return $tpl->Get();
 }
Exemple #24
0
 /**
  *
  *
  */
 function UpdateTheme($theme, $theme_locality)
 {
     $theme = preg_replace('/[^[:alnum:]_\\-]/', '', $theme);
     $layout_path = ($theme_locality == 0 ? JAWS_THEMES : JAWS_BASE_THEMES) . $theme;
     $tpl = new Jaws_Template(false);
     $tpl->Load('Layout.html', $layout_path);
     // Validate theme
     if (!isset($tpl->Blocks['layout'])) {
         $GLOBALS['app']->Session->PushLastResponse(_t('LAYOUT_ERROR_NO_BLOCK', $theme, 'layout'), RESPONSE_ERROR);
         return false;
     }
     if (!isset($tpl->Blocks['layout']->InnerBlock['head'])) {
         $GLOBALS['app']->Session->PushLastResponse(_t('LAYOUT_ERROR_NO_BLOCK', $theme, 'head'), RESPONSE_ERROR);
         return false;
     }
     if (!isset($tpl->Blocks['layout']->InnerBlock['main'])) {
         $GLOBALS['app']->Session->PushLastResponse(_t('LAYOUT_ERROR_NO_BLOCK', $theme, 'main'), RESPONSE_ERROR);
         return false;
     }
     $this->gadget->registry->update('theme', serialize(array('name' => $theme, 'locality' => $theme_locality)), null, 'Settings');
     $GLOBALS['app']->Session->PushLastResponse(_t('LAYOUT_THEME_CHANGED'), RESPONSE_NOTICE);
 }
Exemple #25
0
 /**
  * Builds the upgrader page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     // Create application
     include_once JAWS_PATH . 'include/Jaws.php';
     $GLOBALS['app'] = jaws();
     $GLOBALS['app']->loadPreferences(array('language' => $_SESSION['upgrade']['language']), false);
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/WriteConfig/templates');
     _log(JAWS_LOG_DEBUG, "Preparing configuaration file");
     $tpl->SetBlock('WriteConfig');
     $config_path = JAWS_PATH . 'config' . DIRECTORY_SEPARATOR;
     $tpl->setVariable('lbl_info', _t('UPGRADE_CONFIG_INFO'));
     $tpl->setVariable('lbl_solution', _t('UPGRADE_CONFIG_SOLUTION'));
     $tpl->setVariable('lbl_solution_permission', _t('UPGRADE_CONFIG_SOLUTION_PERMISSION', $config_path));
     $tpl->setVariable('lbl_solution_upload', _t('UPGRADE_CONFIG_SOLUTION_UPLOAD', $config_path . 'JawsConfig.php'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->SetVariable('config', $this->BuildConfig());
     $tpl->ParseBlock('WriteConfig');
     return $tpl->Get();
 }
Exemple #26
0
 /**
  * Builds the upgader page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Introduction/templates');
     $tpl->SetBlock('Introduction');
     $tpl->SetVariable('welcome', _t('UPGRADE_INTRO_WELCOME'));
     $tpl->SetVariable('title_info', _t('UPGRADE_INTRO_UPGRADER'));
     $tpl->SetVariable('db_info', _t('UPGRADE_INTRO_DATABASE'));
     $tpl->SetVariable('ftp_info', _t('UPGRADE_INTRO_FTP'));
     $tpl->SetVariable('language', _t('GLOBAL_LANGUAGE'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     if (is_writable(JAWS_PATH . 'data/logs') && is_dir(JAWS_PATH . 'data/logs')) {
         $tpl->SetVariable('log_use', _t('UPGRADE_INTRO_LOG', 'data/logs/upgrade.txt'));
         $tpl->SetBlock('Introduction/logcheckbox');
         $tpl->ParseBlock('Introduction/logcheckbox');
     } else {
         $tpl->SetVariable('log_use', _t('UPGRADE_INTRO_LOG_ERROR', 'data/logs'));
     }
     $langs = Jaws_Utils::GetLanguagesList();
     $selected_lang = isset($_SESSION['upgrade']['language']) ? $_SESSION['upgrade']['language'] : 'en';
     foreach ($langs as $code => $fullname) {
         $tpl->SetBlock('Introduction/lang');
         $tpl->SetVariable('selected', $code == $selected_lang ? 'selected="selected"' : '');
         $tpl->SetVariable('code', $code);
         $tpl->SetVariable('fullname', $fullname);
         $tpl->ParseBlock('Introduction/lang');
     }
     $tpl->ParseBlock('Introduction');
     return $tpl->Get();
 }
Exemple #27
0
 /**
  * Build the XHTML
  *
  * @access  public
  * @return  string  XHTML content
  */
 function buildXHTML()
 {
     $label = $this->_Label->GetValue();
     if (!empty($label)) {
         $this->_Container->PackStart($this->_Label);
     }
     $this->_Container->PackStart($this->TextArea);
     $this->_Container->SetWidth($this->_Width);
     $this->_XHTML .= $this->_Container->Get();
     $extraPlugins = array();
     $pluginDir = JAWS_PATH . 'libraries/ckeditor/plugins/';
     if (is_dir($pluginDir)) {
         $dirs = scandir($pluginDir);
         foreach ($dirs as $dir) {
             if ($dir[0] != '.' && is_dir($pluginDir . $dir)) {
                 if (!in_array($dir, $this->_DefaultPlugins)) {
                     $extraPlugins[] = $dir;
                 }
             }
         }
     }
     $tpl = new Jaws_Template();
     $tpl->Load('CKEditor.html', 'include/Jaws/Resources');
     $block = JAWS_SCRIPT == 'admin' ? 'ckeditor_backend' : 'ckeditor_frontend';
     $tpl->SetBlock($block);
     $tpl->SetVariable('name', $this->_Name);
     $tpl->SetVariable('baseUrl', Jaws_Utils::getBaseURL('/', true));
     $tpl->SetVariable('contentsLangDirection', $this->_Direction);
     $tpl->SetVariable('language', $this->_Language);
     $tpl->SetVariable('AutoDetectLanguage', 'false');
     $tpl->SetVariable('autoParagraph', 'false');
     $tpl->SetVariable('height', $this->_Height);
     $tpl->SetVariable('skin', $this->_Skin);
     $tpl->SetVariable('theme', $this->_Theme);
     $tpl->SetVariable('readOnly', $this->_IsEnabled ? 'false' : 'true');
     $tpl->SetVariable('resize_enabled', $this->_IsResizable ? 'true' : 'false');
     $tpl->SetVariable('toolbar', json_encode($this->toolbars));
     if (!empty($extraPlugins)) {
         $tpl->SetBlock("{$block}/extra");
         $tpl->SetVariable('extraPlugins', implode(',', $extraPlugins));
         $tpl->ParseBlock("{$block}/extra");
     }
     // removed plugins
     $tpl->SetVariable('removePlugins', $this->_RemovePlugins);
     // direction
     if ('rtl' == $this->_Direction) {
         $tpl->SetVariable('contentsCss', 'gadgets/ControlPanel/Resources/ckeditor.rtl.css');
     } else {
         $tpl->SetVariable('contentsCss', 'gadgets/ControlPanel/Resources/ckeditor.css');
     }
     // FileBrowser
     if (Jaws_Gadget::IsGadgetInstalled('FileBrowser')) {
         $tpl->SetBlock("{$block}/filebrowser");
         $tpl->SetVariable('filebrowserBrowseUrl', BASE_SCRIPT . '?gadget=FileBrowser&action=BrowseFile');
         $tpl->SetVariable('filebrowserFlashBrowseUrl', BASE_SCRIPT . '?gadget=FileBrowser&action=BrowseFile');
         $tpl->ParseBlock("{$block}/filebrowser");
     }
     // Phoo
     if (Jaws_Gadget::IsGadgetInstalled('Phoo')) {
         $tpl->SetBlock("{$block}/phoo");
         $tpl->SetVariable('filebrowserImageBrowseUrl', BASE_SCRIPT . '?gadget=Phoo&action=BrowsePhoo');
         $tpl->ParseBlock("{$block}/phoo");
     }
     // Directory
     if (Jaws_Gadget::IsGadgetInstalled('Directory')) {
         $tpl->SetBlock("{$block}/directory");
         $tpl->SetVariable('filebrowserFlashBrowseUrl', BASE_SCRIPT . '?gadget=Directory&action=Browse');
         $tpl->ParseBlock("{$block}/directory");
     }
     $tpl->ParseBlock($block);
     $this->_XHTML .= $tpl->Get();
 }
Exemple #28
0
 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     _log(JAWS_LOG_DEBUG, "Preparing configuration file");
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/WriteConfig/templates');
     $tpl->SetBlock('WriteConfig');
     $config_path = JAWS_PATH . 'config' . DIRECTORY_SEPARATOR;
     $tpl->setVariable('lbl_info', _t('INSTALL_CONFIG_INFO'));
     $tpl->setVariable('lbl_solution', _t('INSTALL_CONFIG_SOLUTION'));
     $tpl->setVariable('lbl_solution_permission', _t('INSTALL_CONFIG_SOLUTION_PERMISSION', $config_path));
     $tpl->setVariable('lbl_solution_upload', _t('INSTALL_CONFIG_SOLUTION_UPLOAD', $config_path . 'JawsConfig.php'));
     $tpl->SetVariable('lbl_loglevel', _t('INSTALL_CONFIG_LOGLEVEL'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $request = Jaws_Request::getInstance();
     $loglevel = $request->fetch('loglevel', 'post');
     $loglevel = is_null($loglevel) ? JAWS_LOG_ERROR : (int) $loglevel;
     $_SESSION['install']['LogLevel'] = $loglevel;
     $tpl->SetVariable('config', $this->BuildConfig());
     $log_levels_messages = $GLOBALS['log']->_Log_Priority_Str;
     array_unshift($log_levels_messages, 'LOG_DISABLED');
     foreach ($log_levels_messages as $level => $title) {
         $tpl->SetBlock('WriteConfig/loglevel');
         $tpl->setVariable('level', $level);
         $tpl->setVariable('title', $title);
         $tpl->SetVariable('selected', $level == $loglevel ? 'selected="selected"' : '');
         $tpl->ParseBlock('WriteConfig/loglevel');
     }
     $tpl->ParseBlock('WriteConfig');
     return $tpl->Get();
 }
Exemple #29
0
 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Authentication/templates');
     $tpl->SetBlock('Authentication');
     $tpl->SetVariable('key_path_info', _t('INSTALL_AUTH_PATH_INFO', 'key.txt', INSTALL_PATH));
     $tpl->SetVariable('rsa_security', _t('INSTALL_AUTH_ENABLE_SECURITY'));
     $tpl->SetVariable('auth_upload', _t('INSTALL_AUTH_UPLOAD'));
     $tpl->SetVariable('key_file_info', _t('INSTALL_AUTH_KEY_INFO'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->SetVariable('key', $_SESSION['install']['Authentication']['key']);
     $tpl->SetVariable('checked_secure', $_SESSION['secure'] ? 'checked="checked"' : '');
     $tpl->SetVariable('checked_customize', $_SESSION['customize'] ? 'checked="checked"' : '');
     $tpl->SetVariable('custom_installation', _t('INSTALL_AUTH_CUSTOM_INSTALL'));
     $tpl->ParseBlock('Authentication');
     return $tpl->Get();
 }
Exemple #30
0
 /**
  * Sends notify to user
  *
  * @access  public
  * @param   array   $users      Users properties associated array
  * @param   string  $title      Notification title
  * @param   string  $summary    Notification summary
  * @param   string  $content    Notification content
  * @return  mixed   Jaws_Error on failure
  */
 function notify($users, $title, $summary, $content)
 {
     $this->object->reset();
     $this->object->SetFrom();
     foreach ($users as $user) {
         $this->object->AddRecipient($user['email']);
     }
     $this->object->SetSubject($title);
     $tpl = new Jaws_Template(true);
     $tpl->loadRTLDirection = $this->attributes['site_direction'] == 'rtl';
     $tpl->Load('Notification.html', 'include/Jaws/Resources');
     $tpl->SetBlock('notification');
     $tpl->SetVariable('site-url', $this->attributes['site_url']);
     $tpl->SetVariable('site-direction', $this->attributes['site_direction']);
     $tpl->SetVariable('site-name', $this->attributes['site_name']);
     $tpl->SetVariable('site-slogan', $this->attributes['site_slogan']);
     $tpl->SetVariable('site-comment', $this->attributes['site_comment']);
     $tpl->SetVariable('site-author', $this->attributes['site_author']);
     $tpl->SetVariable('site-license', $this->attributes['site_license']);
     $tpl->SetVariable('site-copyright', $this->attributes['site_copyright']);
     $tpl->SetVariable('content', $content);
     $tpl->ParseBlock('notification');
     $this->object->SetBody($tpl->Get());
     unset($tpl);
     return $this->object->send();
 }