Skip to content

Commit

Permalink
v2.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
kksidd committed Aug 13, 2019
1 parent 0a21dd2 commit 5bbbc68
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 2 deletions.
36 changes: 36 additions & 0 deletions couch/cms.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,42 @@ static function invoke( $ignore_level=0 ){
$content_type_header = 'Content-Type: '.$content_type.';';
$content_type_header .= ' charset='.K_CHARSET;

// Add our link to the document (if not commercial license)
// Apply only to text/html, text/html-sandboxed, application/xhtml+xml mime-types
// application/xml and text/xml can also be used to serve xhtml documents but we'll allow that.

if( !(K_PAID_LICENSE || K_REMOVE_FOOTER_LINK) ){
if( strpos($content_type, 'html')!==false ){
$_cnt = preg_match_all( "/<\/[^\S]*BODY[^\S]*>/is", $html, $matches, PREG_OFFSET_CAPTURE );
if( $_cnt ){
$_split_at = $matches[0][count($matches[0])-1][1];
}
else{
$_cnt = preg_match_all( "/<\/[^\S]*HTML[^\S]*>/is", $html, $matches, PREG_OFFSET_CAPTURE );
if( $_cnt ){
$_split_at = $matches[0][count($matches[0])-1][1];
}
}

$_link = "
<div style=\"clear:both; text-align: center; z-index:99999 !important; display:block !important; visibility:visible !important;\">
<div style=\"position:relative; top:0; margin-right:auto;margin-left:auto; z-index:99999; display:block !important; visibility:visible !important;\">
<center><a href=\"https://www.couchcms.com/\" title=\"CouchCMS - Simple Open-Source Content Management\" style=\"display:block !important; visibility:visible !important;\">Powered by CouchCMS</a></center><br />
</div>
</div>
";

if( $_split_at ){
$_pre = substr( $html, 0, $_split_at );
$_post = substr( $html, $_split_at );
$html = $_pre . $_link . $_post;
}
else{
$html .= $_link;
}
}
}

// HOOK: alter_final_page_output
$FUNCS->dispatch_event( 'alter_final_page_output', array(&$html, &$PAGE, &$k_cache_file, &$redirect_url, &$content_type_header) );

Expand Down
16 changes: 16 additions & 0 deletions couch/config.example.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,19 @@

// 99c. Footer content (Company name and link)
//define( 'K_ADMIN_FOOTER', '<a href="http://www.yourcompany.com">COMPANY NAME</a>' );

// 100.
// VERY IMPORTANT!
// If you wish to use this software under the free open source license, it is mandatory to have an attribution link
// on all pages rendered by the software. By default, a footer link will be automatically added if you do not
// have a commercial license for the site this file is being used on.
//
// Set the following to '1' if you want to prevent the link from being automatically added.
// You are, however, then REQUIRED to manually add the following link in the output of all pages rendered by this software.
// You are free to style the link in any manner so long as it remains legible and unobscured.
//
// <div id="copyright">Powered by
// <a href="https://www.couchcms.com/" title="CouchCMS - Simple Open-Source Content Management">CouchCMS</a></div>
//
// Failing to do so will constitute a violation of the CPAL license this software is provided under.
define( 'K_REMOVE_FOOTER_LINK', 0 );
2 changes: 1 addition & 1 deletion couch/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

if( !defined('K_COUCH_DIR') ) die(); // cannot be loaded directly

define( 'K_COUCH_VERSION', '2.2' ); // Changes with every release
define( 'K_COUCH_VERSION', '2.2.1' ); // Changes with every release
define( 'K_COUCH_BUILD', '20190417' ); // YYYYMMDD - do -

if( file_exists(K_COUCH_DIR.'config.php') ){
Expand Down
2 changes: 1 addition & 1 deletion couch/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
disable_uploader int(1) DEFAULT '0',
_html text COMMENT 'Internal',
dynamic text,
custom_params text,
custom_params mediumtext,
searchable int(1) DEFAULT '1',
class tinytext,
not_active text,
Expand Down
5 changes: 5 additions & 0 deletions couch/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,11 @@
};
$__fix_globals();
}
// upgrade to 2.2.1
if( version_compare("2.2.1", $_ver, ">") ){
$_sql = "ALTER TABLE `".K_TBL_FIELDS."` MODIFY `custom_params` mediumtext;";
$DB->_query( $_sql );
}

// Finally update version number
$_rs = $DB->update( K_TBL_SETTINGS, array('k_value'=>K_COUCH_VERSION), "k_key='k_couch_version'" );
Expand Down

0 comments on commit 5bbbc68

Please sign in to comment.