Browse Source

Page duplication

pull/9/head
Fred Tempez 2 years ago
parent
commit
7edb7b4f0a
  1. 2
      CHANGES.md
  2. 1
      core/core.php
  3. 60
      core/module/page/page.php
  4. 11
      core/module/page/view/edit/edit.php
  5. 3
      core/vendor/zwiico/css/zwiico-codes.css
  6. 15
      core/vendor/zwiico/css/zwiico-embedded.css
  7. 3
      core/vendor/zwiico/css/zwiico-ie7-codes.css
  8. 3
      core/vendor/zwiico/css/zwiico-ie7.css
  9. 17
      core/vendor/zwiico/css/zwiico.css
  10. BIN
      core/vendor/zwiico/font/zwiico.eot
  11. 2
      core/vendor/zwiico/font/zwiico.svg
  12. BIN
      core/vendor/zwiico/font/zwiico.ttf
  13. BIN
      core/vendor/zwiico/font/zwiico.woff
  14. BIN
      core/vendor/zwiico/font/zwiico.woff2

2
CHANGES.md

@ -20,6 +20,8 @@
- Pages 403 (accès interdit) et 404 (page introuvable) personnalisables
- Sauvegarde du site dans une archive : animation d'attente avec message de confirmation ou d'erreur. ; le nom de l'archive prend le nom du sous-domaine s'il existe.
- Captcha : addition présentée en lettres sous la forme d'images, réponse en chiffres ; correction du nom de la fonction (capcha en captcha).
- Page :
- Duplication d'une page.
- Mise à jour :
- Script favicon-switcher 1.2.2

1
core/core.php

@ -2677,6 +2677,7 @@ class layout extends common {
if ($this->getData(['page', $this->getUrl(0),'moduleId'])) {
$leftItems .= '<li><a href="' . helper::baseUrl() . $this->getUrl(0) . '/config' . '" data-tippy-content="Configurer le module">' . template::ico('gear') . '</a></li>';
}
$leftItems .= '<li><a id="pageDuplicate" href="' . helper::baseUrl() . 'page/duplicate/' . $this->getUrl(0) . '&csrf=' . $_SESSION['csrf'] . '" data-tippy-content="Duliquer la page">' . template::ico('clone') . '</a></li>';
$leftItems .= '<li><a id="pageDelete" href="' . helper::baseUrl() . 'page/delete/' . $this->getUrl(0) . '&csrf=' . $_SESSION['csrf'] . '" data-tippy-content="Effacer la page">' . template::ico('trash') . '</a></li>';
}
}

60
core/module/page/page.php

@ -19,7 +19,8 @@ class page extends common {
public static $actions = [
'add' => self::GROUP_MODERATOR,
'delete' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR
'edit' => self::GROUP_MODERATOR,
'duplicate' => self::GROUP_MODERATOR
];
public static $pagesNoParentId = [
'' => 'Aucune'
@ -65,6 +66,49 @@ class page extends common {
'children' => 'Le sous-menu de la page parente'
];
/**
* Duplication
*/
public function duplicate() {
// Adresse sans le token
$url = explode('&',$this->getUrl(2));
// La page n'existe pas
if($this->getData(['page', $url[0]]) === null) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} // Jeton incorrect
elseif(!isset($_GET['csrf'])) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
'notification' => 'Jeton invalide'
]);
}
elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
'notification' => 'Suppression non autorisée'
]);
}
$pageTitle = $this->getData(['page',$url[0],'title']);
$pageId = helper::increment(helper::filter($pageTitle, helper::FILTER_ID), $this->getData(['page']));
$data = $this->getData([
'page',
$url[0]
]);
$this->setData (['page',$pageId,$data]);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $pageId,
'notification' => 'Page dupliquée',
'state' => true
]);
}
/**
* Création
*/
@ -121,6 +165,20 @@ class page extends common {
$this->addOutput([
'access' => false
]);
} // Jeton incorrect
elseif(!isset($_GET['csrf'])) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
'notification' => 'Jeton invalide'
]);
}
elseif ($_GET['csrf'] !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'page/edit/' . $url[0],
'notification' => 'Suppression non autorisée'
]);
}
// Impossible de supprimer la page d'accueil
elseif($url[0] === $this->getData(['config', 'homePageId'])) {

11
core/module/page/view/edit/edit.php

@ -5,7 +5,7 @@ echo template::formOpen('pageEditForm');
<div class="row">
<div class="col2">
<?php $href = helper::baseUrl() . $this->getUrl(2); ?>
<?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?>
<?php if ($this->getData(['page', $this->getUrl(2), 'moduleId']) === 'redirection' || 'code')$href = helper::baseUrl(); ?>
<?php echo template::button('pageEditBack', [
'class' => 'buttonGrey',
'href' => $href,
@ -13,7 +13,14 @@ echo template::formOpen('pageEditForm');
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset6">
<div class="col2 offset4">
<?php echo template::button('pageEditDuplicate', [
'href' => helper::baseUrl() . 'page/duplicate/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],
'value' => 'Dupliquer',
'ico' => 'clone'
]); ?>
</div>
<div class="col2">
<?php echo template::button('pageEditDelete', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'page/delete/' . $this->getUrl(2) . '&csrf=' . $_SESSION['csrf'],

3
core/vendor/zwiico/css/zwiico-codes.css vendored

@ -44,4 +44,5 @@
.zwiico-youtube:before { content: '\f167'; } /* '' */
.zwiico-instagram:before { content: '\f16d'; } /* '' */
.zwiico-brush:before { content: '\f1fc'; } /* '' */
.zwiico-pinterest:before { content: '\f231'; } /* '' */
.zwiico-pinterest:before { content: '\f231'; } /* '' */
.zwiico-clone:before { content: '\f24d'; } /* '' */

15
core/vendor/zwiico/css/zwiico-embedded.css vendored

File diff suppressed because one or more lines are too long

3
core/vendor/zwiico/css/zwiico-ie7-codes.css vendored

@ -44,4 +44,5 @@
.zwiico-youtube { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf167;&nbsp;'); }
.zwiico-instagram { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf16d;&nbsp;'); }
.zwiico-brush { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf1fc;&nbsp;'); }
.zwiico-pinterest { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf231;&nbsp;'); }
.zwiico-pinterest { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf231;&nbsp;'); }
.zwiico-clone { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf24d;&nbsp;'); }

3
core/vendor/zwiico/css/zwiico-ie7.css vendored

@ -55,4 +55,5 @@
.zwiico-youtube { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf167;&nbsp;'); }
.zwiico-instagram { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf16d;&nbsp;'); }
.zwiico-brush { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf1fc;&nbsp;'); }
.zwiico-pinterest { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf231;&nbsp;'); }
.zwiico-pinterest { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf231;&nbsp;'); }
.zwiico-clone { *zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '&#xf24d;&nbsp;'); }

17
core/vendor/zwiico/css/zwiico.css vendored

@ -1,11 +1,11 @@
@font-face {
font-family: 'zwiico';
src: url('../font/zwiico.eot?19955984');
src: url('../font/zwiico.eot?19955984#iefix') format('embedded-opentype'),
url('../font/zwiico.woff2?19955984') format('woff2'),
url('../font/zwiico.woff?19955984') format('woff'),
url('../font/zwiico.ttf?19955984') format('truetype'),
url('../font/zwiico.svg?19955984#zwiico') format('svg');
src: url('../font/zwiico.eot?5225631');
src: url('../font/zwiico.eot?5225631#iefix') format('embedded-opentype'),
url('../font/zwiico.woff2?5225631') format('woff2'),
url('../font/zwiico.woff?5225631') format('woff'),
url('../font/zwiico.ttf?5225631') format('truetype'),
url('../font/zwiico.svg?5225631#zwiico') format('svg');
font-weight: normal;
font-style: normal;
}
@ -15,7 +15,7 @@
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'zwiico';
src: url('../font/zwiico.svg?19955984#zwiico') format('svg');
src: url('../font/zwiico.svg?5225631#zwiico') format('svg');
}
}
*/
@ -100,4 +100,5 @@
.zwiico-youtube:before { content: '\f167'; } /* '' */
.zwiico-instagram:before { content: '\f16d'; } /* '' */
.zwiico-brush:before { content: '\f1fc'; } /* '' */
.zwiico-pinterest:before { content: '\f231'; } /* '' */
.zwiico-pinterest:before { content: '\f231'; } /* '' */
.zwiico-clone:before { content: '\f24d'; } /* '' */

BIN
core/vendor/zwiico/font/zwiico.eot vendored

Binary file not shown.

2
core/vendor/zwiico/font/zwiico.svg vendored

@ -97,6 +97,8 @@
<glyph glyph-name="brush" unicode="&#xf1fc;" d="M901 850q39 0 69-26t29-65q0-35-25-84-185-351-260-420-54-51-121-51-71 0-121 52t-51 123q0 71 52 118l356 323q33 30 72 30z m-507-577q22-42 59-73t84-42l1-40q2-118-72-193t-195-75q-68 0-121 26t-85 71-49 102-16 123q4-3 23-17t35-25 32-20 26-9q23 0 31 20 14 37 32 63t39 42 49 27 57 14 70 6z" horiz-adv-x="1000" />
<glyph glyph-name="pinterest" unicode="&#xf231;" d="M0 517q0 60 21 113t58 93 85 69 103 44 113 14q88 0 164-37t123-108 47-160q0-54-10-105t-34-99-56-83-80-58-106-21q-38 0-75 18t-54 49q-5-22-15-63t-14-53-11-40-15-39-17-35-26-44-35-48l-7-3-5 6q-9 88-9 105 0 51 12 115t37 161 29 113q-18 36-18 94 0 47 29 87t74 41q34 0 53-23t19-57q0-37-24-106t-25-105q0-35 25-58t61-23q31 0 57 14t44 38 31 53 21 61 11 62 4 56q0 96-61 150t-160 54q-111 0-186-72t-75-183q0-25 7-48t15-36 15-26 7-17q0-15-8-40t-21-25q-1 0-9 1-29 9-51 31t-34 53-18 60-6 60z" horiz-adv-x="714.3" />
<glyph glyph-name="clone" unicode="&#xf24d;" d="M929-61v607q0 8-6 13t-12 5h-607q-8 0-13-5t-5-13v-607q0-7 5-12t13-6h607q7 0 12 6t6 12z m71 607v-607q0-37-26-63t-63-26h-607q-37 0-63 26t-27 63v607q0 37 27 64t63 26h607q37 0 63-26t26-64z m-214 215v-90h-72v90q0 7-5 12t-13 6h-607q-7 0-12-6t-6-12v-607q0-8 6-13t12-5h90v-72h-90q-36 0-63 27t-26 63v607q0 37 26 63t63 26h607q37 0 64-26t26-63z" horiz-adv-x="1000" />
</font>
</defs>
</svg>

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 21 KiB

BIN
core/vendor/zwiico/font/zwiico.ttf vendored

Binary file not shown.

BIN
core/vendor/zwiico/font/zwiico.woff vendored

Binary file not shown.

BIN
core/vendor/zwiico/font/zwiico.woff2 vendored

Binary file not shown.
Loading…
Cancel
Save