Exemplo n.º 1
0
function load_EditArea_js($type, $http_base, $base, $root, $element, $suffix)
{
    global $cfg;
    global $do_not_load;
    if ($do_not_load) {
        return '';
    }
    // return zip, nada, nothing
    /*
     * Make sure the EditArea language is set up correctly!
     *
     * If we don't do this here, then $cfg['editarea_language'] will not exist and we will croak further down below.
     */
    SetUpLanguageAndLocale($cfg['language'], true);
    $mce_basepath = merge_path_elems($base, get_remainder_upto_slash($element));
    /*MARKER*/
    require_once BASE_PATH . '/lib/includes/js/edit_area/edit_area/edit_area_compressor.php';
    // CONFIG
    $param['cache_duration'] = 3600 * 24 * 10;
    // 10 days util client cache expires
    $param['compress'] = $suffix == '_full' || $suffix == '';
    // Enable the code compression, should be activated but it can be useful to deactivate it for easier error diagnostics (true or false)
    $param['debug'] = $suffix == '_dev';
    // Enable this option if you need debugging info
    $param['use_disk_cache'] = false;
    // If you enable this option gzip files will be cached on disk.
    $param['use_gzip'] = false;
    // Enable gzip compression
    $param['plugins'] = true;
    // Include plugins in the compressed/flattened JS output.
    $param['echo2stdout'] = false;
    // Output generated JS to stdout; alternative is to store it in the object for later retrieval.
    $param['include_langs_and_syntaxes'] = true;
    // Set to FALSE for backwards compatibility: do not include the language files and syntax definitions in the flattened output.
    // END CONFIG
    $compressor = new Compressor($param);
    $my_content = $compressor->get_flattened();
    /*
    WARNING:
    
    because the 'trigger' file 'edit_area_ccms.js' is located in the PARENT directory of the edit_area_loader.js,
    the code in the latter will produce the WRONG this.baseURL value ('http://site.com/lib/includes/js/edit_area/'
    instead of 'http://site.com/lib/includes/js/edit_area/edit_area/').
    
    The culprit is the set_base_url() method, which derives the baseURL from the first JavaScript <script> element
    which contains a filepath which contains 'edit_area': hence it finds our edit_area_ccms.js load.
    
    There are several ways to solve this, but given the code of set_base_url(), we can simply predefine the 'baseURL'
    and it will NOT look at the <script> collection at all. HOWEVER, we cannot programmatically preset 'baseURL'...
    unless, for example, we derive our own editArea instance, hack the constructor around, and replace it, yada yada yada.
    
    Sounds like too much work where a fast hack will do the trick: bluntly replacing the line
    	t.baseURL="";
    in here, while we're producing the (possibly minified) EA code.
    
    We can do it here (and not patch the edit_area_compressor for this) because we won't be serving pre-GZIP-ped
    versions of this baby, EVER. If we GZIP at all, we will be doing it ourselves, AFTER we've gone through here.
    
    So in all scenarios, we're right on time right now to last-minute-patch the bugger.
    */
    $my_content = preg_replace('/t\\.baseURL\\s*=\\s*"";/', 't.baseURL="' . $cfg['rootdir'] . 'lib/includes/js/edit_area/edit_area";', $my_content);
    /*
    And because the lazyloader in edit_area itself, which is used to load any required language and/or syntax
    file, is not working for us on some browsers (Safari 5.0, for example), we circumvent the issue by allowing
    those items to be flattended into the output as well.
    
    Optimally, we'd flatten only the required-at-this-time items in there, but we don't mind about a few extra
    lines of language def's right now; besides, we don't need to touch up the ETag/cache hash code section in
    here when we do it this way.
    */
    return $my_content;
}
Exemplo n.º 2
0
 // feature: if a comment 'bookmark' was specified, jump to the matching 'page'...
 $commentID = getGETparam4Number('commentID');
 if ($commentID > 0) {
     $limit = $commentID - 1;
     $limit -= $limit % $max;
 }
 if ($limit >= $total) {
     $limit = $total - 1;
 }
 if ($limit < 0) {
     $limit = 0;
 }
 $offset = intval($limit / $max);
 $limit4sql = $offset * $max . ',' . $max;
 // Set front-end language
 SetUpLanguageAndLocale($rsLoc);
 // Load recordset
 $commentlist = $db->SelectObjects($cfg['db_prefix'] . 'modcomment', array('page_id' => MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER)), null, array('-commentTimestamp', '-commentID'), $limit4sql);
 if ($commentlist === false) {
     $db->Kill();
 }
 //echo "<pre>" . $db->GetLastSQL() . " -- $limit, $page_id, ".getGETparam4Number('offset')."\n";
 //var_dump($_GET);
 //echo "</pre>";
 // Start switch for comments, select all the right details
 if (count($commentlist) > 0) {
     $index = $limit;
     foreach ($commentlist as $rsComment) {
         $index++;
         // start numbering at 1 (+ N*pages)
         ?>
Exemplo n.º 3
0
//$pageID   = getGETparam4Filename('page');
$page_id = $ccms['page_id'];
$page_name = $ccms['page_name'];
$do = getGETparam4IdOrNumber('do');
$id = getGETparam4IdOrNumber('id');
$is_printing = $ccms['printing'] == 'Y';
if (!empty($page_id)) {
    $rsCfg = $db->SelectSingleRow($cfg['db_prefix'] . 'cfgnews', array('page_id' => MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER)));
    if ($db->ErrorNumber() != 0) {
        $db->Kill();
    }
}
$locale = $rsCfg ? $rsCfg->showLocale : $cfg['locale'];
// no need to check whether the given page is a news page; if it isn't we wouldn't have arrived here...
// Set front-end language
SetUpLanguageAndLocale($locale);
// Do actions for overview
$newsrows = false;
if (empty($id)) {
    $newsID = false;
    // Load recordset for all news on specific news page
    $newsrows = $db->QueryObjects("SELECT * FROM `" . $cfg['db_prefix'] . "modnews` n LEFT JOIN `" . $cfg['db_prefix'] . "users` u ON n.userID=u.userID WHERE newsPublished<>'0' AND page_id=" . MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER) . " ORDER BY newsModified DESC");
} else {
    // Do actions for specific news
    // Define requested news item
    $newsID = explode("-", $id, 2);
    // Load recordset for newsID
    $newsrows = $db->QueryObjects("SELECT * FROM `" . $cfg['db_prefix'] . "modnews` n LEFT JOIN `" . $cfg['db_prefix'] . "users` u ON n.userID=u.userID WHERE newsID=" . MySQL::SQLValue($newsID[0], MySQL::SQLVALUE_NUMBER) . " AND newsPublished<>'0' AND page_id=" . MySQL::SQLValue($page_id, MySQL::SQLVALUE_NUMBER));
}
if ($newsrows === false) {
    $db->Kill();
Exemplo n.º 4
0
}
/*
 * initiate database connection; do this AFTER checking for the _install directory, because
 * otherwise error reports from this init will have precedence over the _install-dir-exists
 * error report!
 */
$db = new MySQL();
// LANGUAGE ==
// multilingual support per page through language cfg override:
$language = getGETparam4IdOrNumber('lang');
if (empty($language)) {
    $language = $cfg['language'];
}
// blow away $cfg['language'] to ensure the language file(s) are loaded this time - it's our first anyhow.
unset($cfg['language']);
$language = SetUpLanguageAndLocale($language);
// SECURITY ==
// Include security file only for administration directory
$location = explode("/", $_SERVER['PHP_SELF']);
$php_src_is_admin_code = in_array("admin", $location);
if ($php_src_is_admin_code) {
    /*MARKER*/
    require_once BASE_PATH . '/admin/includes/security.inc.php';
}
// DATABASE ==
// All set! Now this statement will connect to the database
if (!$db->Open($cfg['db_name'], $cfg['db_host'], $cfg['db_user'], $cfg['db_pass'])) {
    $db->Kill($ccms['lang']['system']['error_database']);
}
// ENVIRONMENT ==
// Some variables to help this file orientate on its environment