SiteSupra ReadMe

This file consists of three sections

Requirements

Hardware requirements

The following are minimal hardware requirements to run SiteSupra:

Software requirements

The following software are required to run SiteSupra: *) We are recommending you use Apache version 1.3 rather than version 2.0. SiteSupra runs on Apache version 2.0 but was not fully tested yet.

Microsoft® Internet Explorer 5.5 or higher is required to manage website content.

Installing and Configuring Software

Install Apache with mod_rewrite module if you plan to hide index.php file name from URL address (please see virtual host configuration below). Install PHP as an Apache module and not as CGI. Enable zlib library for PHP. Install Zend Optimizer. Install MySQL.

Virtual Host Configuration

The below virtual host configuration has mod_rewrite rules added to hide index.php file name from URL address. Do not forget to set hideIndex parameter in .htsupra configuration file to 1. If you cannot use mod_rewrite then set hideIndex to 0. If you using Apache 2.0 add AcceptPathInfo On to virtual host configuation.

<VirtualHost *>
    DocumentRoot /www/yourwebsite
    ServerName www.yourcompany.com
    AddType application/x-httpd-php .php
    DirectoryIndex index.php
    RewriteEngine on
    RewriteRule (.*)/(/.*)  $1$2 [N,NS]
    RewriteRule ^(.*/)\.ht(.*) - [F,NS]
    RewriteRule ^/index.php/(.*)  /$1 [NS]
    RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -f
    RewriteRule ^ - [L,NS]
    RewriteRule ^/([^/]*) - [NS,E=SUFILE:/$1]
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUFILE} -f
    RewriteRule ^ - [L,NS]
    RewriteRule ^(.*)$ /index.php$1 [L,NS]
</VirtualHost>

Copying SiteSupra Files and Creating Database

Copy SiteSupra archive or files (if you already extracted SiteSupra archive) to your webserver's virtual directory. If you are copying files over FTP, make sure you are using binary mode.

note You should copy SiteSupra into the root of virtual directory. Otherwise, SiteSupra will not work. However, if you cannot allocate a new virtual host name for running SiteSupra, you can assign another port number to existing host name.

If you already run SiteSupra and plan to upgrade to a newer version, please consult our support first.

Creating Database

After you have installed the required software and copied SiteSupra files, the last step in installing SiteSupra is to create a MySQL server database and grant access rights to the database. Starting from version 3.0 MySQL user should have LOCK rights to the database.

The database is the content repository that SiteSupra uses to store content. Use one of sql script files from SiteSupra archive to create the database.

Configuring .htsupra

The .htsupra file stores website configuration parameters such as connection to MySQL server, languages information, and general website settings. SiteSupra reads the file with every page request. Since .htsupra is PHP script, you can add any valid PHP instructions into this file. For example, you can define constants or declare a function. Please note, that because .htsupra is the first file system looks for there are no SiteSupra API functions or variables available, as well as connection to the SiteSupra database is not established. Please note, because .htsupra is the first file system looks for, SiteSupra API functions and variables are not available at this moment, as well as connection to the SiteSupra database is not yet established.

The .htsupra configuration file initializes the following arrays: $suSQL, $suCONF, $suLANG, $suDEBUG, $suMODULES.

$suSQL

Stores MySQL configuration data.

<?
$suSQL
= Array(
    
'type'  => 'mysql',      // database type. Currently, SiteSupra supports MySQL only
    
'db'    => 'help',       // database name
    
'host'  => '127.0.0.1',  // host name or IP address
    
'port'  => '3306',       // MySQL port
    
'user'  => 'user',       // user name
    
'pswd'  => 'password'    // password
);
?>

$suCONF

Stores website specific settings.

<?
$suCONF
= Array(
    
'supra'             => 'supra',   // SiteSupra directory name
    
'supraExt'          => '.php',    // SiteSupra files extension
    
'blockDir'          => 'blocks',  // blocks directory name
    
'blockExt'          => '.php',    // blocks extension
    
'hideIndex'         => 1,         // specifies whether hide index.php file in URL address or not
    
'disableCache'      => 'all',     // disables specific cache. See table below for more settings.
    
'outputCompression' => 1|2,       // turns gzip compression on or off
    
'incBeforePage'     => '',        // PHP script to include before page process
    
'incInsideHead'     => '',        // PHP script to include inside head tag
    
'incStartBody'      => '',        // PHP script to include right after <body> tag
    
'incEndBody'        => '',        // PHP script to include before </body> tag
    
'incAfterPage'      => '',        // PHP script to include after page process
    
'incCache'          => 1|2|4,     // turns cache on or off for include files
                                      // 1 - cache incInsideHead script
                                      // 2 - cache incStartBody script
                                      // 4 - cache incEndBody script
    
'execMacro'         => 1|2,       // specifies the way how wrong macro commands will be processed.
                                      // 1 - ignore wrong macros, 2 - insert warning error into debugger window
    
'loopMacro'         => 3,         //
    
'phpTemplate'       => 1,         // specifies whether PHP is used in templates
    
'body' => Array(                  // general settings for <body> tag
        
'lmargin'       => '',
        
'tmargin'       => '',
        
'bgcolor'       => '',
        
'bgimage'       => '',
        
'text'          => '',
        
'link'          => '',
        
'alink'         => '',
        
'vlink'         => '',
        
'bodyother'     => '',
    ),
    
'meta' => Array(                  // general settings for <meta> tag
        
'expire'        => '',
        
'refresh'       => '',
        
'description'   => '',
        
'keywords'      => '',
        
'author'        => '',
    ),
    
'head' => Array(                  // general settings for <head> tag
        
'extcss'        => '/.css',
        
'intcss'        => '',
        
'extjs'         => '',
        
'intjs'         => '',
        
'favicon'       => '',
        
'headother'     => '',
    ),
    
'baseTitle'         => 'Sitesupra Manual: ',
    
'baseTitleAppend'   => '',
    
'baseTitle_en'         => 'Sitesupra Manual: ',
    
'baseTitleAppend_en'   => '',
    
'docType'           => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
    
'xmlns'             => 'http://www.w3.org/1999/xhtml',
);
?>

Changing SiteSupra directory name

If you changed SiteSupra directory name, please note that now to access SiteSupra edit mode you have to type in the following URL address http://www.company.com/?new_directory_name instead of http://www.company.com/?supra.

Hiding index.php file

When hiding index.php file from URL address, please make sure you have installed and properly configured Apache mod_rewrite module. See
Installing and Configuring Software for more details.

Disabling cache

However, SiteSupra cache can rise a web site productivity, it can also interfere when the web site is on development. You can turn off caching for a specific SiteSupra object. For combining multiple values use PHP OR operator. For more information see Using Cache.

Value Description
all Turn of cache
1 Do not cache blocks
2 Do not cache page templates
4 Do not cache external page layouts
8 Do not cache pages
16 Do not cache internal page layouts
32 Do not cache block templates
64 Do not cache macro commands
128 Do not caching global vartiables
256 Do not caching query results

Output compression

You can enable gzip compression for the data transferred between client and server in order to lower the time used for loading webpage. The outputCompression parameter may take the following values:

Value Description
0 Compression disabled
1 Compression enabled in public mode
2 Compression enabled in edit mode
3 Compression enabled in both edit and public modes
note Before turning on compression, please make sure that client browser and proxy servers are compatible with gzip defleted content.

$suLANG

Configures website languages.

<?
$suLANG
= Array(
    
'langs' => Array(
        
'en' => Array(
            
'id'      => 1,         // unique language id
            
'code'    => 'utf',     // internal SiteSupra language code
            
'charset' => 'UTF-8',   // page charset, for example, windows-1251
            
'name'    => 'English'  // Language name
        
)
    ),
    
'cookie' => 'supraLang'         // cookie name for storing language
);
?>

The code element may take the following values:

Charset Description
1250 Central European
1251 Cyrillic
1252 Western European
1253 Greek
1254 Turkish
1257 Baltic
utf Combination of above six encodings.

$suDEBUG

Stores configuration for SiteSupra debugger. See Debugging Your Application for more information.

<?
$suDEBUG
= Array(
    
'showStartupErrors' => 1,               // specifies whether to show errors,
                                            // which occurred before SiteSupra debugger was initialized
    
'adminCmd'          => 'cmd',           // command line prefix
    
'remoteAddr'        => '127.,10.0.1',   // list of IP addresses the debugger and command line are accessible to
    
'errorLog'          => 'report.log',    // log file name
    
'level'             => 1|2|4|8|64|2048  // debug levels
);
?>

Debug modes

Value Command line parameter Description
1 ERR Show errors
2 VAR Show function suDUMP() output.
4 TIM Show timer.
8 SND Show SendData() traffic. This parameter works in edit mode only.
16 GPC Show values of GET/POST/COOOKIE variables.
32 SRV Show value of $HTTP_SERVER_VARS.
64 SQL Show queries.
512 NON Do not show PHP notices.
1024 LOG Write debug info into file ($suDEBUG['errorLog'])
2048 PUB Show debug in public mode.
1048576 EXP Explain queries.
2097152 RES Show queries result.
4194304 CON Automaticaly show debug window with every page request.
8388608 STA Show file statistics.
16777216 SRC Show source code.
536870912 PHP backtrace.

$suMODULES

Stores configuration of external modules. The modules are loaded by SiteSupra with every page request.

<?
$suMODULES
= Array(
    
'track' => Array(           // module name
        
'dir'  => 'track',      // module directory
        
'mode' => 1|2           // specifies modes the module will work in. 1 - public, 2 - edit
    
)
);
?>

Configuring .htedit

The .htedit file stores configuration of SiteSupra edit mode. The .htedit configuration file is PHP script that initializes the following arrays: $suEDIT, $suUSERMENU, $suEVENTS.

$suEDIT

<?
$suEDIT
= Array(
    
'jsEdit'                => 0,                            // specifies whether to allow JavaScript or not
    
'userint'               => 'Page type',                  // caption for userint field
    
'userintList'           => Array(                        // specifies elements of userint drop-down menu
                                    
0 => 'None',
                                    
1 => 'Press release',
                                    
2 => 'News',
                                    
3 => 'Product'
                               
),
    
'userstr'               => '',                           // caption for userstr field
    
'userbit'               => 'Main menu|Public',           // captions for userbit field
    
'showHead'              => 1,                            // specifies whether to allow SiteSupra user change <head> tag of a page
    
'showMeta'              => 1,                            // specifies whether to allow SiteSupra user change <meta> tag of a page
    
'showBody'              => 1,                            // specifies whether to allow SiteSupra user change <body> tag of a page
    
'uiLang'                => 'english',                    // user interface language
    
'idleTime'              => 3600,                         // time out in seconds until SiteSupra user will  
    
'stylePrefix'           => '.',                          // XHTML editor will show styles, which names started with dot
                                                             // in its style drop down menu
    
'chmod'                 => 0640,                         // parameter for chmod operation that File Manager will
                                                             // execute for every uploaded file
    
'chmoddir'              => 0750,                         // parameter for chmod operation that File Manager will
                                                             // for every directory new directory
    
'dateTimeFormat'        => 'd-M-y H:i',                  // date format for page properties mode
    
'leftMenu'              => 1                             // defines position of SiteSupra console
);
?>

For more information on userint, userbit, and userstr refer to Using of userint, userbit, and userstr.

$suUSERMENU

Contains description of user modules available for SiteSupra user.

<?
$suUSERMENU
= Array(
    
'users'=>Array
    (
        
'dialog'  => '#users/um',       // path to the module file
        
'icon'    => 'users.gif',       // icon for the module button
        
'title'   => 'User Manager',    // module name
        
'key'     => 'CTRL+SHIFT+U',    // shortcut keys
    
),
    
'track' => Array(
        
'dialog'  => '#track/tracker',
        
'icon'    => 'track.gif',
        
'title'   => 'SupraTrack',
        
'key'     => 'CTRL+SHIFT+T'
    
),

);
?>

Modules configuration

If path to the module file starts with #, SiteSupra will search for the file under /supra/modules directory. In the above example SiteSupra will load file /supra/modules/users/um. If symbol # is omitted, then SiteSupra look for the file under the blocks directory.

$suEVENTS

Configures events handlers.

<?
$suEVENTS
= Array(
    
'onLoadSupra'       => '',
    
'onLoadPage'        => '',
    
'onGenerateSearch'  => '_mysearch:mySearch'
);
?>

Configuring .hthtml

The .hthtml file configures user-defined filters for xHTML Editor. The filters may remove unnecessary tags and attributes after you copied a text from a MS Word or Excel file. You can use the filters to make replacements in the text, for example, you can remove extra line breaks or replace two &nbsp; entities with one, and so on.

The filters are working in the following order:

userFilterInHTML


function userFilterInHTML(html)
{
  
html = html.replace((/<a name=("*)([^>"]*)("*)><^/a>/gi, '{AN:$2}');    // replaces anchors <a name="xxx"></a> to {AN:xxx}
  return html;
}

userFilterElement


function userFilterElement(el)
{
  switch(
el.tagName)
  {
    case
"DIV":                      // removes <div>
      
el.removeNode();
      break;
  }

  if(
el.tagName != 'IMG')
    
el.removeAttribute("style");     // removes style attribute for al tags excepting <img>

  
el.removeAttribute("className");   // removes class attribute
}

userFilterOutHTML


function userFilterOutHTML(html)
{
  
html = html.replace(/<(^/)?strong/gi, '<$1b');               // replaces <strong> to <b>
  
html = html.replace(/<(^/)?em/gi, '<$1i');                   // replaces <em> to <i>
  
html = html.replace(/(&nbsp;)+/g, '&nbsp;');                 // replaces more than one &nbsp; to one &nbsp;
  
html = html.replace(/&nbsp; /g, ' ');                        // replaces &amp;nbsp; and space combination to single space
  
html = html.replace(/  /g, ' ');                             // replaces two spaces to one space
  
html = html.replace(/ <^/b>/g, '</b> ');                     // replaces space</b> to </b>space
  
html = html.replace(/ <^/i>/g, '</i> ');                     // replaces space</i> to </i>space
  
html = html.replace(/ <^/a>/g, '</a> ');                     // replaces space</a> to </a>space
  
html = html.replace(/{AN:([^}]*)}/g, '<a name="$1"></a>');   // replaces {AN:xxx} to <a name="xxx"></a>
  
html = html.replace(/href="^/#/gi, 'href="#');
  
return html;
}

The .hthtml file has another useful option that allows you to add buttons into the XHTML editor window and assign your functions to them.

<?
$htmlFilters
= Array(
  
'Bold SiteSupra' => Array(
    
'func' => 'myF1()',         // function to call
    
'icon' => 1,                // number on the button's icon
    
'key'  => 'CTRL+SHIFT+1'    // shortcut keys
  
),
  
'Insert User Text' => Array(
    
'func' => 'myF2()',        
    
'icon' => 2,
    
'key'  => 'CTRL+SHIFT+2',
  )
);
?>

SiteSupra links