From de8af26f080dc405a69277fc76ef86927a464756 Mon Sep 17 00:00:00 2001 From: oldperl Date: Tue, 1 Aug 2017 13:13:16 +0000 Subject: [PATCH] localization --- .../class.content_allocation_article.php | 2 +- .../class.content_allocation_complexlist.php | 2 + .../class.content_allocation_treeview.php | 26 ++--- .../includes/config.autoloader.php | 4 + .../includes/functions.chains.php | 2 +- .../include.contentallocation_article.php | 108 +++++++++--------- .../includes/include.left_bottom.php | 22 ++++ .../includes/include.right_bottom.php | 87 +++++++------- 8 files changed, 141 insertions(+), 112 deletions(-) diff --git a/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_article.php b/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_article.php index f204f59..8e23e0c 100644 --- a/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_article.php +++ b/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_article.php @@ -103,7 +103,7 @@ class pApiContentAllocationArticle extends pApiTree { $this->tpl->next(); } - $this->tpl->set('s', "CATEGORY", i18n("Category")); + $this->tpl->set('s', "CATEGORY", i18n("Category", "content_allocation")); if ($return === true) { return $this->tpl->generate($this->template, true); diff --git a/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_complexlist.php b/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_complexlist.php index cbfb096..a3bfa68 100644 --- a/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_complexlist.php +++ b/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_complexlist.php @@ -108,5 +108,7 @@ class pApiContentAllocationComplexList extends pApiTree { return $tree; } } + } + ?> \ No newline at end of file diff --git a/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_treeview.php b/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_treeview.php index 2ebc4ab..7b15b03 100644 --- a/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_treeview.php +++ b/trunk/conlite/plugins/content_allocation/classes/class.content_allocation_treeview.php @@ -56,7 +56,7 @@ class pApiContentAllocationTreeView extends pApiTree { public function __construct($uuid) { global $cfg; - parent::pApiTree($uuid); + parent::__construct($uuid); $this->tpl = new Template; $this->template = $cfg['pica']['treetemplate']; } @@ -96,7 +96,7 @@ class pApiContentAllocationTreeView extends pApiTree { controller.focus(); function fieldCheck() { if (controller.value == "") { - alert("' . i18n("Please enter a category name") . '"); + alert("' . i18n("Please enter a category name", "content_allocation") . '"); controller.focus(); return false; } @@ -120,23 +120,23 @@ class pApiContentAllocationTreeView extends pApiTree { } $item['ITEMINDENT'] = $item_tmp['level'] * 15 + 3; - $item['ACTION_CREATE'] = '' . i18n('; + $item['ACTION_CREATE'] = '' . i18n('; - $item['ACTION_RENAME'] = '' . i18n('; - $item['ACTION_MOVE_UP'] = (count($result) >= 1) ? '' . i18n(' : ''; - $item['ACTION_MOVE_DOWN'] = (count($result) >= 1) ? '' . i18n(' : ''; + $item['ACTION_RENAME'] = '' . i18n('; + $item['ACTION_MOVE_UP'] = (count($result) >= 1) ? '' . i18n(' : ''; + $item['ACTION_MOVE_DOWN'] = (count($result) >= 1) ? '' . i18n(' : ''; $item['ACTION_MOVE_DOWN'] = ''; if ($item_tmp['online'] == 1) { // set offline - $item['ACTION_ONOFFLINE'] = '' . i18n('; + $item['ACTION_ONOFFLINE'] = '' . i18n('; } else { - $item['ACTION_ONOFFLINE'] = '' . i18n('; + $item['ACTION_ONOFFLINE'] = '' . i18n('; } if ($item_tmp['children']) { - $item['ACTION_DELETE'] = '' . i18n('; + $item['ACTION_DELETE'] = '' . i18n('; } else { - $item['ACTION_DELETE'] = '
' . str_replace("'", "\'", $item_tmp['name']) . '","deleteCategory(' . $item_tmp['idpica_alloc'] . ')");">' . i18n(
'; + $item['ACTION_DELETE'] = '
' . str_replace("'", "\'", $item_tmp['name']) . '","deleteCategory(' . $item_tmp['idpica_alloc'] . ')");">' . i18n(
'; } array_push($result, $item); @@ -172,7 +172,7 @@ class pApiContentAllocationTreeView extends pApiTree { controller.focus(); function fieldCheck() { if (controller.value == "") { - alert("' . i18n("Please enter a category name") . '"); + alert("' . i18n("Please enter a category name", "content_allocation") . '"); controller.focus(); return false; } @@ -219,8 +219,8 @@ class pApiContentAllocationTreeView extends pApiTree { $this->tpl->next(); } - $this->tpl->set('s', 'CATEGORY', i18n("Category")); - $this->tpl->set('s', 'ACTIONS', i18n("Actions")); + $this->tpl->set('s', 'CATEGORY', i18n("Category", "content_allocation")); + $this->tpl->set('s', 'ACTIONS', i18n("Actions", "content_allocation")); if ($return === true) { return $this->tpl->generate($this->template, true); diff --git a/trunk/conlite/plugins/content_allocation/includes/config.autoloader.php b/trunk/conlite/plugins/content_allocation/includes/config.autoloader.php index b367209..8bcd9b0 100644 --- a/trunk/conlite/plugins/content_allocation/includes/config.autoloader.php +++ b/trunk/conlite/plugins/content_allocation/includes/config.autoloader.php @@ -14,6 +14,10 @@ * $Id: config.autoloader.php 368 2015-10-27 10:32:42Z oldperl $ */ +if(!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + $sAutoloadClassPath = 'conlite/plugins/content_allocation/classes/'; return array( 'pApiContentAllocation' => $sAutoloadClassPath.'class.content_allocation.php', diff --git a/trunk/conlite/plugins/content_allocation/includes/functions.chains.php b/trunk/conlite/plugins/content_allocation/includes/functions.chains.php index 9743b67..6470cf3 100644 --- a/trunk/conlite/plugins/content_allocation/includes/functions.chains.php +++ b/trunk/conlite/plugins/content_allocation/includes/functions.chains.php @@ -58,7 +58,7 @@ function pica_RenderArticleAction ($idcat, $idart, $idartlang, $actionkey) if ($actionkey == "con_contentallocation") { - return ''; + return ''; } else { return ""; diff --git a/trunk/conlite/plugins/content_allocation/includes/include.contentallocation_article.php b/trunk/conlite/plugins/content_allocation/includes/include.contentallocation_article.php index e30a747..b4db379 100644 --- a/trunk/conlite/plugins/content_allocation/includes/include.contentallocation_article.php +++ b/trunk/conlite/plugins/content_allocation/includes/include.contentallocation_article.php @@ -1,4 +1,5 @@ have_perm_area_action($area, "storeallocation") || $perm->have_perm_area_action_item($area, "storeallocation", $idcat))) { - $notification->displayNotification("error", i18n("Permission denied")); +if (!($perm->have_perm_area_action($area, "storeallocation") || $perm->have_perm_area_action_item($area, "storeallocation", $idcat))) { + $notification->displayNotification("error", i18n("Permission denied", "content_allocation")); return; } cInclude("includes", "functions.pathresolver.php"); -function str_replace_recursive ($array) { - if (!is_array($array)) return false; - - $result = array(); - - foreach ($array as $value) { - $result[] = str_replace("e", "", $value); - } - - return $result; +function str_replace_recursive($array) { + if (!is_array($array)) + return false; + + $result = array(); + + foreach ($array as $value) { + $result[] = str_replace("e", "", $value); + } + + return $result; } // fetch idartlang for idart -$sql = "SELECT idartlang FROM ".$cfg['tab']['art_lang']." WHERE idart=".Contenido_Security::toInteger($idart)." AND idlang=".Contenido_Security::toInteger($lang); +$sql = "SELECT idartlang FROM " . $cfg['tab']['art_lang'] . " WHERE idart=" . Contenido_Security::toInteger($idart) . " AND idlang=" . Contenido_Security::toInteger($lang); $db->query($sql); $db->next_record(); $this_idartlang = $db->f('idartlang'); @@ -67,19 +68,19 @@ $oTree = new pApiContentAllocationComplexList('06bd456d-fe76-40cb-b041-b9ba90dc4 $oAlloc = new pApiContentAllocation; if ($_POST['action'] == 'storeallocation') { - $oAlloc->storeAllocations($this_idartlang, $_POST['allocation']); + $oAlloc->storeAllocations($this_idartlang, $_POST['allocation']); } if ($_GET['step'] == 'collapse') { - $oTree->setTreeStatus($_GET['idpica_alloc']); + $oTree->setTreeStatus($_GET['idpica_alloc']); } #build category path $catString = ''; prCreateURLNameLocationString($idcat, '/', $catString); -$oArticle = new Article ($idart, $client, $lang); +$oArticle = new Article($idart, $client, $lang); $sArticleTitle = $oArticle->getField('title'); -$sLocationString = "
".$catString.'/'.clHtmlSpecialChars($sArticleTitle)."
"; +$sLocationString = "
" . $catString . '/' . clHtmlSpecialChars($sArticleTitle) . "
"; // load allocations $loadedAllocations = $oAlloc->loadAllocations($this_idartlang); @@ -88,43 +89,44 @@ $oTree->setChecked($loadedAllocations); $result = $oTree->renderTree(true); if ($result == false) { - $result = $notification->returnNotification("warning", i18n('There is no Content Allocation tree.')); + $result = $notification->returnNotification("warning", i18n('There is no Content Allocation tree.', "content_allocation")); } else { - if (!is_object($tpl)) { $tpl = new Template; } - $hiddenfields = ' - - - - - '; - $tpl->set('s', 'HIDDENFIELDS', $hiddenfields); - - - if (sizeof($loadedAllocations) > 0) { - $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [' . implode(',', $loadedAllocations) . '];'); - } else { - $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [];'); - } - - $oDiv = new cHTMLDiv; - $oDiv->updateAttributes(array('style' => 'text-align: right; padding: 5px; width: 730px; border: 1px #B3B3B3 solid; background-color: #FFFFFF;')); - $oDiv->setContent(''); - $tpl->set('s', 'DIV', '
' . $oDiv->render()); - - $tpl->set('s', 'TREE', $result); + if (!is_object($tpl)) { + $tpl = new Template; + } + $hiddenfields = ' + + + + + '; + $tpl->set('s', 'HIDDENFIELDS', $hiddenfields); - $tpl->set('s', 'REMOVE_ALL', i18n("Remove all")); - $tpl->set('s', 'REMOVE', i18n("Remove")); - - $result = $tpl->generate($cfg['pica']['treetemplate_complexlist'], true); - - $script = ' - '; - $oPage->addScript('style', $script); + + if (sizeof($loadedAllocations) > 0) { + $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [' . implode(',', $loadedAllocations) . '];'); + } else { + $tpl->set('s', 'ARRAY_CHECKED_BOXES', 'var checkedBoxes = [];'); + } + + $oDiv = new cHTMLDiv; + $oDiv->updateAttributes(array('style' => 'text-align: right; padding: 5px; width: 730px; border: 1px #B3B3B3 solid; background-color: #FFFFFF;')); + $oDiv->setContent(''); + $tpl->set('s', 'DIV', '
' . $oDiv->render()); + + $tpl->set('s', 'TREE', $result); + + $tpl->set('s', 'REMOVE_ALL', i18n("Remove all", "content_allocation")); + $tpl->set('s', 'REMOVE', i18n("Remove", "content_allocation")); + + $result = $tpl->generate($cfg['pica']['treetemplate_complexlist'], true); + + $script = ' + '; + $oPage->addScript('style', $script); } -$oPage->setContent($sLocationString.$result . markSubMenuItem(5, true)); +$oPage->setContent($sLocationString . $result . markSubMenuItem(5, true)); $oPage->render(); - ?> \ No newline at end of file diff --git a/trunk/conlite/plugins/content_allocation/includes/include.left_bottom.php b/trunk/conlite/plugins/content_allocation/includes/include.left_bottom.php index e69de29..2f2e062 100644 --- a/trunk/conlite/plugins/content_allocation/includes/include.left_bottom.php +++ b/trunk/conlite/plugins/content_allocation/includes/include.left_bottom.php @@ -0,0 +1,22 @@ + + * @copyright 2017 CL-Team + * @link http://www.conlite.org + * + * $Id:$ + */ + +if(!defined('CON_FRAMEWORK')) { + die('Illegal call'); +} + +$oPage = new cPage(); +$oPage->setHtml5(); + +$oPage->render(); \ No newline at end of file diff --git a/trunk/conlite/plugins/content_allocation/includes/include.right_bottom.php b/trunk/conlite/plugins/content_allocation/includes/include.right_bottom.php index 3771185..c281d6e 100644 --- a/trunk/conlite/plugins/content_allocation/includes/include.right_bottom.php +++ b/trunk/conlite/plugins/content_allocation/includes/include.right_bottom.php @@ -1,4 +1,5 @@ escape($sName); - $aPostTreeItem['name'] = $sName; + $sName = stripslashes($_REQUEST['treeItemPost']['name']); + $sName = $db->escape($sName); + $aPostTreeItem['name'] = $sName; } $_GET['idpica_alloc'] = (int) $_GET['idpica_alloc']; @@ -65,41 +65,41 @@ $oPage->setMessageBox(); $oTree = new pApiContentAllocationTreeView('f7771624-4874-4745-8b7e-21a49a71a447'); // store item -if ($_POST['step'] == 'store') { - $pNotify = '
'; - $sMessage = sprintf(i18n("New Category %s successfully stored!"), $treeItem['name']); +if ($_POST['step'] == 'store') { + $pNotify = '
'; + $sMessage = sprintf(i18n("New Category %s successfully stored!", "content_allocation"), $treeItem['name']); $notification->displayNotification("info", $sMessage); - $pNotify .= '
'; - $oTree->storeItem($aPostTreeItem); + $pNotify .= '
'; + $oTree->storeItem($aPostTreeItem); } // rename item -if ($_POST['step'] == 'storeRename') { - $pNotify = '
'; - $sMessage = sprintf(i18n("Category %s successfully renamed!"), $treeItem['name']); +if ($_POST['step'] == 'storeRename') { + $pNotify = '
'; + $sMessage = sprintf(i18n("Category %s successfully renamed!", "content_allocation"), $treeItem['name']); $notification->displayNotification("info", $sMessage); - $pNotify .= '
'; - $oTree->storeItem($aPostTreeItem); + $pNotify .= '
'; + $oTree->storeItem($aPostTreeItem); } // rename item -if ($_GET['step'] == 'moveup') { - $oTree->itemMoveUp($_GET['idpica_alloc']); +if ($_GET['step'] == 'moveup') { + $oTree->itemMoveUp($_GET['idpica_alloc']); } if ($_GET['step'] == 'deleteItem') { // delete item - $pNotify = '
'; - $sMessage = i18n("Category successfully deleted!"); + $pNotify = '
'; + $sMessage = i18n("Category successfully deleted!", "content_allocation"); $notification->displayNotification("info", $sMessage); - $pNotify .= '
'; - $oTree->deleteItem($_GET['idpica_alloc']); + $pNotify .= '
'; + $oTree->deleteItem($_GET['idpica_alloc']); } if ($_GET['step'] == 'collapse') { - $oTree->setTreeStatus($_GET['idpica_alloc']); + $oTree->setTreeStatus($_GET['idpica_alloc']); } if ($_GET['step'] == 'online') { - $oTree->setOnline($_GET['idpica_alloc']); + $oTree->setOnline($_GET['idpica_alloc']); } if ($_GET['step'] == 'offline') { - $oTree->setOffline($_GET['idpica_alloc']); + $oTree->setOffline($_GET['idpica_alloc']); } $oDiv = new cHTMLDiv; @@ -107,19 +107,19 @@ $oDiv->updateAttributes(array('style' => 'padding: 5px; width: 400px; border: 1p $sTemp = ''; if ($_GET['step'] == 'createRoot') { // create new root item - $form = ' + $form = ' - - - - + + + + - + - @@ -129,37 +129,36 @@ if ($_GET['step'] == 'createRoot') { // create new root item controller.focus(); function fieldCheck() { if (controller.value == "") { - alert("'.i18n("Please enter a category name.").'"); + alert("' . i18n("Please enter a category name.", "content_allocation") . '"); controller.focus(); return false; } return true; } '; - $oDiv->setContent($form); - $sTemp = $oDiv->render(); + $oDiv->setContent($form); + $sTemp = $oDiv->render(); } else { - $newTree = ''.i18n("Create new tree").'
'; + $newTree = '' . i18n("Create new tree", "content_allocation") . '
'; } $result = $oTree->renderTree(true); if ($result === false) { - $result = ' '; + $result = ' '; } $js = ' '; $oPage->addScript('deleteCategory', $js); -$oPage->setContent($pNotify . $newTree . $sTemp. '
' . $result); +$oPage->setContent($pNotify . $newTree . $sTemp . '
' . $result); $oPage->render(); - ?> \ No newline at end of file
'.i18n("Create new tree").'
' . i18n("Create new tree", "content_allocation") . '
  +