From aa748113e3583715f07b07043d02b97c5fdcd2d9 Mon Sep 17 00:00:00 2001 From: Ladislav Kubes Date: Thu, 9 Jun 2011 11:34:08 +0200 Subject: [PATCH 1/8] CZ translation for tinymce_ssbuttons plugin --- javascript/tinymce_ssbuttons/langs/cs.js | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 javascript/tinymce_ssbuttons/langs/cs.js diff --git a/javascript/tinymce_ssbuttons/langs/cs.js b/javascript/tinymce_ssbuttons/langs/cs.js new file mode 100644 index 00000000..5f8cfec0 --- /dev/null +++ b/javascript/tinymce_ssbuttons/langs/cs.js @@ -0,0 +1,5 @@ +tinyMCE.addI18n('cs.tinymce_ssbuttons', { +insertlink: 'Vložit odkaz', +insertimage: 'Vložit obrázek', +insertflash: 'Vložit Flash animaci' +}); \ No newline at end of file From 5d3ddafbd8cb69cbfd4ee846a413a6ab79948b9a Mon Sep 17 00:00:00 2001 From: Ladislav Kubes Date: Thu, 9 Jun 2011 16:18:35 +0200 Subject: [PATCH 2/8] Add some translation in cms core --- code/CMSMain.php | 2 +- lang/cs_CZ.php | 1 + lang/en_US.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/code/CMSMain.php b/code/CMSMain.php index f636617d..bac17118 100755 --- a/code/CMSMain.php +++ b/code/CMSMain.php @@ -377,7 +377,7 @@ JS; $siteConfig = SiteConfig::current_site_config(); $form->saveInto($siteConfig); $siteConfig->write(); - FormResponse::status_message('Saved site configuration', "good"); + FormResponse::status_message(_t('CMSMain.SAVEDSITECONFIGURATION', 'Saved site configuration'), "good"); FormResponse::add("$('Form_EditForm').resetElements();"); $title = Convert::raw2js($siteConfig->Title); diff --git a/lang/cs_CZ.php b/lang/cs_CZ.php index f81c9bf6..8757f96f 100644 --- a/lang/cs_CZ.php +++ b/lang/cs_CZ.php @@ -155,6 +155,7 @@ $lang['cs_CZ']['CMSMain']['VIEWING'] = 'Prohlížíte verzi #%s, vytvořenou %s $lang['cs_CZ']['CMSMain']['VISITRESTORE'] = 'navštívit restorepage/(ID)'; $lang['cs_CZ']['CMSMain']['WAITINGON'] = 'Čekáte na jiné lidi, než dokončí práci na těchto %d stránkách.'; $lang['cs_CZ']['CMSMain']['WORKTODO'] = 'Máte na těchto %d stránkách práci k udělání.'; +$lang['cs_CZ']['CMSMain']['SAVEDSITECONFIGURATION'] = 'Nastavení stránky uloženo'; $lang['cs_CZ']['CMSMain_dialog.ss']['BUTTONNOTFOUND'] = 'Systém nemůže nelézt jméno tlačítka'; $lang['cs_CZ']['CMSMain_dialog.ss']['NOLINKED'] = 'Nemůžete najít objekt window.linkedObject pro zaslání kliknutí na tlačítko zpět do hlavního okna.'; $lang['cs_CZ']['CMSMain_left.ss']['ADDEDNOTPUB'] = 'Přidáno do konceptů, ale ještě nezveřejněno'; diff --git a/lang/en_US.php b/lang/en_US.php index 9c1eb5e4..4f6100a7 100755 --- a/lang/en_US.php +++ b/lang/en_US.php @@ -154,6 +154,7 @@ $lang['en_US']['CMSMain']['VIEWING'] = array( PR_MEDIUM, 'Version number is a linked string, created is a relative time (e.g. 2 days ago), by a specific author' ); +$lang['en_US']['CMSMain']['SAVEDSITECONFIGURATION'] = 'Saved site configuration'; $lang['en_US']['CMSMain_dialog.ss']['BUTTONNOTFOUND'] = 'Couldn\'t find the button name'; $lang['en_US']['CMSMain_dialog.ss']['NOLINKED'] = 'Can\'t find window.linkedObject to send the button click back to the main window'; $lang['en_US']['CMSMain_left.ss']['ADDEDNOTPUB'] = 'Added to the draft site and not published yet'; From 1f0277b78166d0f4910ee1539d29f951740a641c Mon Sep 17 00:00:00 2001 From: Ladislav Kubes Date: Thu, 9 Jun 2011 17:21:49 +0200 Subject: [PATCH 3/8] Add some missing CZ translations in cms javascript --- javascript/lang/cs_CZ.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/javascript/lang/cs_CZ.js b/javascript/lang/cs_CZ.js index a915f502..9f5702fe 100644 --- a/javascript/lang/cs_CZ.js +++ b/javascript/lang/cs_CZ.js @@ -26,6 +26,15 @@ if(typeof(ss) == 'undefined' || typeof(ss.i18n) == 'undefined') { 'ModelAdmin.REALLYDELETE': "Skutečně chcete smazat?", 'ModelAdmin.DELETED': "Smazáno", 'LeftAndMain.PAGEWASDELETED': "Tato stránka byla smazána. Pro editaci stránky, vyberte ji vlevo.", - 'LeftAndMain.CONFIRMUNSAVED': "Určitě chcete opustit navigaci z této stránky?\n\nUPOZORNĚNÍ: Vaše změny nebyly uloženy.\n\nStlačte OK pro pokračovat, nebo Cancel, zůstanete na této stránce." + 'LeftAndMain.CONFIRMUNSAVED': "Určitě chcete opustit navigaci z této stránky?\n\nUPOZORNĚNÍ: Vaše změny nebyly uloženy.\n\nStlačte OK pro pokračovat, nebo Cancel, zůstanete na této stránce.", + 'WidgetAreaEditor.TOOMANY': 'Dosažen limit doplňků pro tuto oblast', + 'CMSMAIN.RollbackConfirmation': 'Opravdu chcete vrátit stav této stránky na verzi #%s?', + 'CMSMAIN.CopyPublishedConfirmation': 'Opravdu chcete zkopírovat publikovaný obsah do konceptu stránky?', + 'CMSMAIN.PageTypeSaveAlert': 'Typ stránky bude změněn po jejím uložení.', + 'LOADING': 'načítání...', + 'TABLEFIELD.DELETECONFIRMMESSAGEV2': '\nExistuje %s stránek, které tento soubor používají, zkontrolujte jejich seznam na záložce odkazy, než budete pokračovat.', + 'TABLEFIELD.SELECTUPLOAD': 'Vyberte, prosím, alespoň jeden soubor k narhární.', + 'TABLEFIELD.SELECTDELETE': 'Vyberte soubory ke smazání!', + 'TABLEFIELD.CONFIRMDELETEV2': 'Opravdu chcete smazat označené soubory?' }); } \ No newline at end of file From af0bf453b24356b7f5bea251ce1f467f2f961427 Mon Sep 17 00:00:00 2001 From: Julian Seidenberg Date: Wed, 31 Aug 2011 10:31:33 +1200 Subject: [PATCH 4/8] BUGFIX: fixing random changing of access tab radio buttons when refreshing the CMS with a URL such as /admin#Root_Access in Firefox. --- javascript/LeftAndMain.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 35d700cd..778c63b4 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -7,6 +7,13 @@ if(typeof(jQuery) != 'undefined') { $(document).ready(function() { window.onresize(true); }); + + //Turn off autocomplete to fix the access tab randomly switching radio buttons in Firefox when refresh the page + // with an anchor tag in the URL. E.g: /admin#Root_Access + //Autocomplete in the CMS also causes strangeness in other browsers, so this turns it off for all browsers. + //see the following for demo and explanation of the Firefox bug: + // http://www.ryancramer.com/journal/entries/radio_buttons_firefox/ + $("#Form_EditForm").attr("autocomplete", "off"); })(jQuery); } From b5ea2f68feab41f969a2e6f0589dd55015f74098 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 15 Sep 2011 14:36:47 +0200 Subject: [PATCH 5/8] BUGFIX Consistently using Convert::raw2sql() instead of DB::getConn()->addslashes() or PHP's deprecated addslashes() for database escaping --- code/AssetAdmin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/AssetAdmin.php b/code/AssetAdmin.php index 9939220d..bd5064c9 100755 --- a/code/AssetAdmin.php +++ b/code/AssetAdmin.php @@ -378,7 +378,7 @@ HTML; public function movemarked($urlParams, $form) { if($_REQUEST['DestFolderID'] && (is_numeric($_REQUEST['DestFolderID']) || ($_REQUEST['DestFolderID']) == 'root')) { $destFolderID = ($_REQUEST['DestFolderID'] == 'root') ? 0 : $_REQUEST['DestFolderID']; - $fileList = "'" . ereg_replace(' *, *',"','",trim(addslashes($_REQUEST['FileIDs']))) . "'"; + $fileList = "'" . ereg_replace(' *, *',"','",trim(Convert::raw2sql($_REQUEST['FileIDs']))) . "'"; $numFiles = 0; if($fileList != "''") { @@ -411,7 +411,7 @@ HTML; * Called and returns in same way as 'save' function */ public function deletemarked($urlParams, $form) { - $fileList = "'" . ereg_replace(' *, *',"','",trim(addslashes($_REQUEST['FileIDs']))) . "'"; + $fileList = "'" . ereg_replace(' *, *',"','",trim(Convert::raw2sql($_REQUEST['FileIDs']))) . "'"; $numFiles = 0; $folderID = 0; $deleteList = ''; From d15e8509b01ff2dbbe3028a055021a29b1065b22 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 8 Sep 2011 17:56:47 +0200 Subject: [PATCH 6/8] SECURITY Using JSON instead of serialize() to stringify user data in PageCommentsInterface --- code/sitefeatures/PageCommentInterface.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/sitefeatures/PageCommentInterface.php b/code/sitefeatures/PageCommentInterface.php index 84568ec8..92823f4c 100755 --- a/code/sitefeatures/PageCommentInterface.php +++ b/code/sitefeatures/PageCommentInterface.php @@ -222,7 +222,7 @@ class PageCommentInterface extends RequestHandler { foreach($fields as $field) { if(!$field instanceof HiddenField) $visibleFields[] = $field->Name(); } - $form->loadDataFrom(unserialize($cookie), false, $visibleFields); + $form->loadDataFrom(Convert::json2array($cookie), false, $visibleFields); } return $form; @@ -272,7 +272,7 @@ class PageCommentInterface extends RequestHandler { */ class PageCommentInterface_Form extends Form { function postcomment($data) { - Cookie::set("PageCommentInterface_Data", serialize($data)); + Cookie::set("PageCommentInterface_Data", Convert::raw2json($data)); // Spam filtering if(SSAkismet::isEnabled()) { @@ -333,7 +333,7 @@ class PageCommentInterface_Form extends Form { $comment->write(); unset($data['Comment']); - Cookie::set("PageCommentInterface_Data", serialize($data)); + Cookie::set("PageCommentInterface_Data", Convert::raw2json($data)); $moderationMsg = _t('PageCommentInterface_Form.AWAITINGMODERATION', "Your comment has been submitted and is now awaiting moderation."); From bb757d13a4142a4b0fab680240bde1a064c338a4 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Thu, 15 Sep 2011 16:17:47 +0200 Subject: [PATCH 7/8] ENHANCEMENT Allow editing of new File.ShowInSearch flag through AssetTableField --- code/AssetTableField.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/code/AssetTableField.php b/code/AssetTableField.php index 7d822cf0..84da21ed 100755 --- a/code/AssetTableField.php +++ b/code/AssetTableField.php @@ -194,6 +194,12 @@ class AssetTableField extends ComplexTableField { ) ); } + + if(!($childData instanceof Folder)) { + $mainTab->push( + new CheckboxField("ShowInSearch", $childData->fieldLabel('ShowInSearch')) + ); + } if($childData && $childData->hasMethod('BackLinkTracking')) { if(class_exists('Subsite')) Subsite::disable_subsite_filter(true); From 4abe136db5955de9dd263821f8db65d5b3e0db25 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Wed, 1 Feb 2012 18:30:24 +0100 Subject: [PATCH 8/8] API CHANGE silverstripe_version file now contains the plain version number, rather than an SVN path --- code/LeftAndMain.php | 27 +++++++-------------------- silverstripe_version | 1 - tests/LeftAndMainTest.php | 19 ------------------- 3 files changed, 7 insertions(+), 40 deletions(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 8e050593..c9c498eb 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -1109,34 +1109,21 @@ JS; /** * Return the version number of this application. * Uses the subversion path information in /silverstripe_version - * (automacially replaced $URL$ placeholder). + * (automacially replaced by build scripts). * * @return string */ public function CMSVersion() { - $sapphireVersionFile = file_get_contents(BASE_PATH . '/sapphire/silverstripe_version'); - $cmsVersionFile = file_get_contents(BASE_PATH . '/cms/silverstripe_version'); - - $sapphireVersion = $this->versionFromVersionFile($sapphireVersionFile); - $cmsVersion = $this->versionFromVersionFile($cmsVersionFile); + $cmsVersion = file_get_contents(BASE_PATH . '/cms/silverstripe_version'); + $sapphireVersion = file_get_contents(BASE_PATH . '/sapphire/silverstripe_version'); + if(!$cmsVersion || !$sapphireVersion) return; - if($sapphireVersion == $cmsVersion) { + if($cmsVersion == $sapphireVersion) { return $sapphireVersion; - } else { - return "cms: $cmsVersion, sapphire: $sapphireVersion"; - } - } - - /** - * Return the version from the content of a silverstripe_version file - */ - public function versionFromVersionFile($fileContent) { - if(preg_match('/\/trunk\/silverstripe_version/', $fileContent)) { - return "trunk"; } else { - preg_match("/\/(?:branches|tags\/rc|tags\/beta|tags\/alpha|tags)\/([A-Za-z0-9._-]+)\/silverstripe_version/", $fileContent, $matches); - return ($matches) ? $matches[1] : null; + return sprintf("cms: %s, sapphire: %s", $cmsVersion, $sapphireVersion); } + } /** diff --git a/silverstripe_version b/silverstripe_version index 8c6cfe75..e69de29b 100644 --- a/silverstripe_version +++ b/silverstripe_version @@ -1 +0,0 @@ -$URL$ diff --git a/tests/LeftAndMainTest.php b/tests/LeftAndMainTest.php index 295cba3f..6835f7c1 100644 --- a/tests/LeftAndMainTest.php +++ b/tests/LeftAndMainTest.php @@ -14,25 +14,6 @@ class LeftAndMainTest extends FunctionalTest { CMSMenu::populate_menu(); } - /** - * Test that CMS versions can be interpreted appropriately - */ - public function testCMSVersion() { - $l = new LeftAndMain(); - $this->assertEquals("2.4", $l->versionFromVersionFile( - '$URL: http://svn.silverstripe.com/open/modules/cms/branches/2.4/silverstripe_version $')); - $this->assertEquals("2.2.0", $l->versionFromVersionFile( - '$URL: http://svn.silverstripe.com/open/modules/cms/tags/2.2.0/silverstripe_version $')); - $this->assertEquals("trunk", $l->versionFromVersionFile( - '$URL: http://svn.silverstripe.com/open/modules/cms/trunk/silverstripe_version $')); - $this->assertEquals("2.4.0-alpha1", $l->versionFromVersionFile( - '$URL: http://svn.silverstripe.com/open/modules/cms/tags/alpha/2.4.0-alpha1/silverstripe_version $')); - $this->assertEquals("2.4.0-beta1", $l->versionFromVersionFile( - '$URL: http://svn.silverstripe.com/open/modules/cms/tags/beta/2.4.0-beta1/silverstripe_version $')); - $this->assertEquals("2.4.0-rc1", $l->versionFromVersionFile( - '$URL: http://svn.silverstripe.com/open/modules/cms/tags/rc/2.4.0-rc1/silverstripe_version $')); - } - /** * Check that all subclasses of leftandmain can be accessed */