forked from ZwiiCMS-Team/ZwiiCMS
plufin WIP + download en test
This commit is contained in:
parent
66c3636007
commit
4890b04baf
@ -9,9 +9,7 @@
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2020-2021, Sylvain Lelièvre
|
||||
* @copyright Copyright (C) 2018-2022, Frédéric Tempez
|
||||
* @author Sylvain Lelièvre <lelievresylvain@free.fr>
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
@ -100,51 +98,82 @@ class plugin extends common {
|
||||
* Installation d'un module
|
||||
* Fonction utilisée par upload et storeUpload
|
||||
*/
|
||||
private function install ($moduleName, $checkValid){
|
||||
$tempFolder = 'datamodules';//uniqid();
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($moduleName) === TRUE) {
|
||||
$notification = 'Archive ouverte';
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
// Archive de module ?
|
||||
$success = false;
|
||||
$notification = 'Ce n\'est pas l\'archive d\'un module !';
|
||||
$moduleDir = self::TEMP_DIR . $tempFolder . '/module';
|
||||
$moduleName = '';
|
||||
if ( is_dir( $moduleDir )) {
|
||||
// Lire le nom du module
|
||||
if ($dh = opendir( $moduleDir )) {
|
||||
while ( false !== ($file = readdir($dh)) ) {
|
||||
if ($file != "." && $file != "..") {
|
||||
$moduleName = $file;
|
||||
}
|
||||
}
|
||||
closedir($dh);
|
||||
}
|
||||
// Module normalisé ?
|
||||
if( is_file( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php' ) AND is_file( $moduleDir.'/'.$moduleName.'/view/index/index.php' ) ){
|
||||
private function install($moduleFileName, $checkValid){
|
||||
|
||||
// Lecture de la version et de la validation d'update du module pour validation de la mise à jour
|
||||
// Pour une version <= version installée l'utilisateur doit cocher 'Mise à jour forcée'
|
||||
$version = '0.0';
|
||||
$update = '0.0';
|
||||
$valUpdate = false;
|
||||
$file = file_get_contents( $moduleDir.'/'.$moduleName.'/'.$moduleName.'.php');
|
||||
$file = str_replace(' ','',$file);
|
||||
$file = str_replace("\t",'',$file);
|
||||
$pos1 = strpos($file, 'constVERSION');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$version = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
/**
|
||||
* Initialisation des variables
|
||||
*/
|
||||
//$tempFolder = uniqid() . '/';
|
||||
$tempFolder = 'truc/';
|
||||
$notification = '';
|
||||
// Numéro de version du module déjà installé
|
||||
$versionInstalled = '';
|
||||
|
||||
/**
|
||||
* Désarchivage
|
||||
*/
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($moduleFileName) === TRUE) {
|
||||
|
||||
/**
|
||||
* Création du dossier temporaire
|
||||
*/
|
||||
if (!is_dir (self::TEMP_DIR . $tempFolder) ) {
|
||||
mkdir (self::TEMP_DIR . $tempFolder, 0755);
|
||||
}
|
||||
$pos1 = strpos($file, 'constUPDATE');
|
||||
if( $pos1 !== false){
|
||||
$posdeb = strpos($file, "'", $pos1);
|
||||
$posend = strpos($file, "'", $posdeb + 1);
|
||||
$update = substr($file, $posdeb + 1, $posend - $posdeb - 1);
|
||||
|
||||
$zip->extractTo(self::TEMP_DIR . $tempFolder );
|
||||
// Lecture du descripteur de ressource
|
||||
$modulePath = self::TEMP_DIR . $tempFolder . 'module';
|
||||
if (file_exists(self::TEMP_DIR . $tempFolder . 'desc.json')
|
||||
) {
|
||||
$res = json_decode(file_get_contents(self::TEMP_DIR . $tempFolder . 'desc.json'), true);
|
||||
} else {
|
||||
return([
|
||||
'success' => false,
|
||||
'notification'=> 'Cette archive est invalide'
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* Structure lue
|
||||
* $res ['name'] = id du module, correspond à la classe
|
||||
* $res ['realname'] = Nom complet du module
|
||||
* $res ['version'] = version du module
|
||||
* $res ['dirs'] @array
|
||||
* 'dossier' => 'destination',
|
||||
* 'download" => 'module/download'
|
||||
*
|
||||
* Attention le dossier source est celui dans l'archive, la destination correspond à l’arborescence cible
|
||||
*/
|
||||
echo "<pre>";
|
||||
// Affectation
|
||||
$moduleName = $res ['name'];
|
||||
$modulePath = $res ['name'] . '/';
|
||||
$moduleFile = $res ['name'] . '.php' ;
|
||||
|
||||
/**
|
||||
* Validation des informations du descripteur
|
||||
*/
|
||||
if ( !is_dir ( self::TEMP_DIR . $tempFolder . $modulePath) ||
|
||||
!is_file (self::TEMP_DIR . $tempFolder . $modulePath . $moduleFile)
|
||||
) {
|
||||
return([
|
||||
'success' => false,
|
||||
'notification'=> 'Cette archive est invalide'
|
||||
]);
|
||||
}
|
||||
/**
|
||||
* Le module est-il installé ? Lire le numéro de version
|
||||
*/
|
||||
if (is_file( 'module/' . $modulePath . $moduleFile) ) {
|
||||
$c = helper::getModules();
|
||||
if (array_key_exists($moduleName, $c)) {
|
||||
$versionInstalled = $c[$moduleName]['version'];
|
||||
}
|
||||
}
|
||||
echo $versionInstalled;
|
||||
|
||||
die();
|
||||
// Si version actuelle >= version indiquée dans UPDATE la mise à jour est validée
|
||||
$infoModules = helper::getModules();
|
||||
if( $infoModules[$moduleName]['update'] >= $update ) $valUpdate = true;
|
||||
@ -195,7 +224,6 @@ class plugin extends common {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Supprimer le dossier temporaire même si le module est invalide
|
||||
$this->removeDir(self::TEMP_DIR . $tempFolder);
|
||||
$zip->close();
|
||||
|
1236
module/download/download.php
Normal file
1236
module/download/download.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
module/download/ressource/feed-icon-16.gif
Normal file
BIN
module/download/ressource/feed-icon-16.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 652 B |
38
module/download/vendor/FeedWriter/ATOM.php
vendored
Normal file
38
module/download/vendor/FeedWriter/ATOM.php
vendored
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper for creating ATOM feeds
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class ATOM extends Feed
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(Feed::ATOM);
|
||||
}
|
||||
|
||||
}
|
1017
module/download/vendor/FeedWriter/Feed.php
vendored
Normal file
1017
module/download/vendor/FeedWriter/Feed.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
33
module/download/vendor/FeedWriter/InvalidOperationException.php
vendored
Normal file
33
module/download/vendor/FeedWriter/InvalidOperationException.php
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
use \LogicException;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2016 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* The exception that is thrown when an invalid operation is performed on
|
||||
* the object.
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class InvalidOperationException extends LogicException
|
||||
{
|
||||
}
|
413
module/download/vendor/FeedWriter/Item.php
vendored
Normal file
413
module/download/vendor/FeedWriter/Item.php
vendored
Normal file
@ -0,0 +1,413 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
use \DateTime;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2008 Anis uddin Ahmad <anisniit@gmail.com>
|
||||
* Copyright (C) 2010-2013, 2015-2016 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Universal Feed Writer
|
||||
*
|
||||
* Item class - Used as feed element in Feed class
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
* @author Anis uddin Ahmad <anisniit@gmail.com>
|
||||
* @link http://www.ajaxray.com/projects/rss
|
||||
*/
|
||||
class Item
|
||||
{
|
||||
/**
|
||||
* Collection of feed item elements
|
||||
*/
|
||||
private $elements = array();
|
||||
|
||||
/**
|
||||
* Contains the format of this feed.
|
||||
*/
|
||||
private $version;
|
||||
|
||||
/**
|
||||
* Is used as a suffix when multiple elements have the same name.
|
||||
**/
|
||||
private $_cpt = 0;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param string $version constant (RSS1/RSS2/ATOM) RSS2 is default.
|
||||
*/
|
||||
public function __construct($version = Feed::RSS2)
|
||||
{
|
||||
$this->version = $version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an unique number
|
||||
*
|
||||
* @access private
|
||||
* @return int
|
||||
**/
|
||||
private function cpt()
|
||||
{
|
||||
return $this->_cpt++;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an element to elements array
|
||||
*
|
||||
* @access public
|
||||
* @param string $elementName The tag name of an element
|
||||
* @param string $content The content of tag
|
||||
* @param array $attributes Attributes (if any) in 'attrName' => 'attrValue' format
|
||||
* @param boolean $overwrite Specifies if an already existing element is overwritten.
|
||||
* @param boolean $allowMultiple Specifies if multiple elements of the same name are allowed.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the element name is not a string, empty or NULL.
|
||||
*/
|
||||
public function addElement($elementName, $content, array $attributes = null, $overwrite = FALSE, $allowMultiple = FALSE)
|
||||
{
|
||||
if (empty($elementName))
|
||||
throw new \InvalidArgumentException('The element name may not be empty or NULL.');
|
||||
if (!is_string($elementName))
|
||||
throw new \InvalidArgumentException('The element name must be a string.');
|
||||
|
||||
$key = $elementName;
|
||||
|
||||
// return if element already exists & if overwriting is disabled
|
||||
// & if multiple elements are not allowed.
|
||||
if (isset($this->elements[$elementName]) && !$overwrite) {
|
||||
if (!$allowMultiple)
|
||||
return $this;
|
||||
|
||||
$key .= '-' . $this->cpt();
|
||||
}
|
||||
|
||||
$this->elements[$key]['name'] = $elementName;
|
||||
$this->elements[$key]['content'] = $content;
|
||||
$this->elements[$key]['attributes'] = $attributes;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set multiple feed elements from an array.
|
||||
* Elements which have attributes cannot be added by this method
|
||||
*
|
||||
* @access public
|
||||
* @param array array of elements in 'tagName' => 'tagContent' format.
|
||||
* @return self
|
||||
*/
|
||||
public function addElementArray(array $elementArray)
|
||||
{
|
||||
foreach ($elementArray as $elementName => $content) {
|
||||
$this->addElement($elementName, $content);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the collection of elements in this feed item
|
||||
*
|
||||
* @access public
|
||||
* @return array All elements of this item.
|
||||
* @throws InvalidOperationException on ATOM feeds if either a content or link element is missing.
|
||||
* @throws InvalidOperationException on RSS1 feeds if a title or link element is missing.
|
||||
*/
|
||||
public function getElements()
|
||||
{
|
||||
// ATOM feeds have some specific requirements...
|
||||
if ($this->version == Feed::ATOM)
|
||||
{
|
||||
// Add an 'id' element, if it was not added by calling the setLink method.
|
||||
// Use the value of the title element as key, since no link element was specified.
|
||||
if (!array_key_exists('id', $this->elements))
|
||||
$this->setId(Feed::uuid($this->elements['title']['content'], 'urn:uuid:'));
|
||||
|
||||
// Either a 'link' or 'content' element is needed.
|
||||
if (!array_key_exists('content', $this->elements) && !array_key_exists('link', $this->elements))
|
||||
throw new InvalidOperationException('ATOM feed entries need a link or a content element. Call the setLink or setContent method.');
|
||||
}
|
||||
// ...same with RSS1 feeds.
|
||||
else if ($this->version == Feed::RSS1)
|
||||
{
|
||||
if (!array_key_exists('title', $this->elements))
|
||||
throw new InvalidOperationException('RSS1 feed entries need a title element. Call the setTitle method.');
|
||||
if (!array_key_exists('link', $this->elements))
|
||||
throw new InvalidOperationException('RSS1 feed entries need a link element. Call the setLink method.');
|
||||
}
|
||||
|
||||
return $this->elements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of this feed item
|
||||
*
|
||||
* @access public
|
||||
* @return string The feed type, as defined in Feed.php
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
// Wrapper functions ------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Set the 'description' element of feed item
|
||||
*
|
||||
* @access public
|
||||
* @param string $description The content of the 'description' or 'summary' element
|
||||
* @return self
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
$tag = ($this->version == Feed::ATOM) ? 'summary' : 'description';
|
||||
|
||||
return $this->addElement($tag, $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'content' element of the feed item
|
||||
* For ATOM feeds only
|
||||
*
|
||||
* @access public
|
||||
* @param string $content Content for the item (i.e., the body of a download post).
|
||||
* @return self
|
||||
* @throws InvalidOperationException if this method is called on non-ATOM feeds.
|
||||
*/
|
||||
public function setContent($content)
|
||||
{
|
||||
if ($this->version != Feed::ATOM)
|
||||
throw new InvalidOperationException('The content element is supported in ATOM feeds only.');
|
||||
|
||||
return $this->addElement('content', $content, array('type' => 'html'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'title' element of feed item
|
||||
*
|
||||
* @access public
|
||||
* @param string $title The content of 'title' element
|
||||
* @return self
|
||||
*/
|
||||
public function setTitle($title)
|
||||
{
|
||||
return $this->addElement('title', $title);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'date' element of the feed item.
|
||||
*
|
||||
* The value of the date parameter can be either an instance of the
|
||||
* DateTime class, an integer containing a UNIX timestamp or a string
|
||||
* which is parseable by PHP's 'strtotime' function.
|
||||
*
|
||||
* @access public
|
||||
* @param DateTime|int|string $date Date which should be used.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the given date was not parseable.
|
||||
*/
|
||||
public function setDate($date)
|
||||
{
|
||||
if (!is_numeric($date)) {
|
||||
if ($date instanceof DateTime)
|
||||
$date = $date->getTimestamp();
|
||||
else {
|
||||
$date = strtotime($date);
|
||||
|
||||
if ($date === FALSE)
|
||||
throw new \InvalidArgumentException('The given date string was not parseable.');
|
||||
}
|
||||
} elseif ($date < 0)
|
||||
throw new \InvalidArgumentException('The given date is not an UNIX timestamp.');
|
||||
|
||||
if ($this->version == Feed::ATOM) {
|
||||
$tag = 'updated';
|
||||
$value = date(\DATE_ATOM, $date);
|
||||
} elseif ($this->version == Feed::RSS2) {
|
||||
$tag = 'pubDate';
|
||||
$value = date(\DATE_RSS, $date);
|
||||
} else {
|
||||
$tag = 'dc:date';
|
||||
$value = date("Y-m-d", $date);
|
||||
}
|
||||
|
||||
return $this->addElement($tag, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'link' element of feed item
|
||||
*
|
||||
* @access public
|
||||
* @param string $link The content of 'link' element
|
||||
* @return self
|
||||
*/
|
||||
public function setLink($link)
|
||||
{
|
||||
if ($this->version == Feed::RSS2 || $this->version == Feed::RSS1) {
|
||||
$this->addElement('link', $link);
|
||||
} else {
|
||||
$this->addElement('link','',array('href'=>$link));
|
||||
$this->setId(Feed::uuid($link,'urn:uuid:'));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Attach a external media to the feed item.
|
||||
* Not supported in RSS 1.0 feeds.
|
||||
*
|
||||
* See RFC 4288 for syntactical correct MIME types.
|
||||
*
|
||||
* Note that you should avoid the use of more than one enclosure in one item,
|
||||
* since some RSS aggregators don't support it.
|
||||
*
|
||||
* @access public
|
||||
* @param string $url The URL of the media.
|
||||
* @param integer $length The length of the media.
|
||||
* @param string $type The MIME type attribute of the media.
|
||||
* @param boolean $multiple Specifies if multiple enclosures are allowed
|
||||
* @return self
|
||||
* @link https://tools.ietf.org/html/rfc4288
|
||||
* @throws \InvalidArgumentException if the length or type parameter is invalid.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
public function addEnclosure($url, $length, $type, $multiple = TRUE)
|
||||
{
|
||||
if ($this->version == Feed::RSS1)
|
||||
throw new InvalidOperationException('Media attachment is not supported in RSS1 feeds.');
|
||||
|
||||
// the length parameter should be set to 0 if it can't be determined
|
||||
// see http://www.rssboard.org/rss-profile#element-channel-item-enclosure
|
||||
if (!is_numeric($length) || $length < 0)
|
||||
throw new \InvalidArgumentException('The length parameter must be an integer and greater or equals to zero.');
|
||||
|
||||
// Regex used from RFC 4287, page 41
|
||||
if (!is_string($type) || preg_match('/.+\/.+/', $type) != 1)
|
||||
throw new \InvalidArgumentException('type parameter must be a string and a MIME type.');
|
||||
|
||||
$attributes = array('length' => $length, 'type' => $type);
|
||||
|
||||
if ($this->version == Feed::RSS2) {
|
||||
$attributes['url'] = $url;
|
||||
$this->addElement('enclosure', '', $attributes, FALSE, $multiple);
|
||||
} else {
|
||||
$attributes['href'] = $url;
|
||||
$attributes['rel'] = 'enclosure';
|
||||
$this->addElement('atom:link', '', $attributes, FALSE, $multiple);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'author' element of feed item.
|
||||
* Not supported in RSS 1.0 feeds.
|
||||
*
|
||||
* @access public
|
||||
* @param string $author The author of this item
|
||||
* @param string|null $email Optional email address of the author
|
||||
* @param string|null $uri Optional URI related to the author
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the provided email address is syntactically incorrect.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
public function setAuthor($author, $email = null, $uri = null)
|
||||
{
|
||||
if ($this->version == Feed::RSS1)
|
||||
throw new InvalidOperationException('The author element is not supported in RSS1 feeds.');
|
||||
|
||||
// Regex from RFC 4287 page 41
|
||||
if ($email != null && preg_match('/.+@.+/', $email) != 1)
|
||||
throw new \InvalidArgumentException('The email address is syntactically incorrect.');
|
||||
|
||||
if ($this->version == Feed::RSS2)
|
||||
{
|
||||
if ($email != null)
|
||||
$author = $email . ' (' . $author . ')';
|
||||
|
||||
$this->addElement('author', $author);
|
||||
}
|
||||
else
|
||||
{
|
||||
$elements = array('name' => $author);
|
||||
|
||||
if ($email != null)
|
||||
$elements['email'] = $email;
|
||||
|
||||
if ($uri != null)
|
||||
$elements['uri'] = $uri;
|
||||
|
||||
$this->addElement('author', $elements);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the unique identifier of the feed item
|
||||
*
|
||||
* On ATOM feeds, the identifier must begin with an valid URI scheme.
|
||||
*
|
||||
* @access public
|
||||
* @param string $id The unique identifier of this item
|
||||
* @param boolean $permaLink The value of the 'isPermaLink' attribute in RSS 2 feeds.
|
||||
* @return self
|
||||
* @throws \InvalidArgumentException if the permaLink parameter is not boolean.
|
||||
* @throws InvalidOperationException if this method is called on RSS1 feeds.
|
||||
*/
|
||||
public function setId($id, $permaLink = false)
|
||||
{
|
||||
if ($this->version == Feed::RSS2) {
|
||||
if (!is_bool($permaLink))
|
||||
throw new \InvalidArgumentException('The permaLink parameter must be boolean.');
|
||||
|
||||
$permaLink = $permaLink ? 'true' : 'false';
|
||||
|
||||
$this->addElement('guid', $id, array('isPermaLink' => $permaLink));
|
||||
} elseif ($this->version == Feed::ATOM) {
|
||||
// Check if the given ID is an valid URI scheme (see RFC 4287 4.2.6)
|
||||
// The list of valid schemes was generated from http://www.iana.org/assignments/uri-schemes
|
||||
// by using only permanent or historical schemes.
|
||||
$validSchemes = array('aaa', 'aaas', 'about', 'acap', 'acct', 'cap', 'cid', 'coap', 'coaps', 'crid', 'data', 'dav', 'dict', 'dns', 'example', 'fax', 'file', 'filesystem', 'ftp', 'geo', 'go', 'gopher', 'h323', 'http', 'https', 'iax', 'icap', 'im', 'imap', 'info', 'ipp', 'ipps', 'iris', 'iris.beep', 'iris.lwz', 'iris.xpc', 'iris.xpcs', 'jabber', 'ldap', 'mailserver', 'mailto', 'mid', 'modem', 'msrp', 'msrps', 'mtqp', 'mupdate', 'news', 'nfs', 'ni', 'nih', 'nntp', 'opaquelocktoken', 'pack', 'pkcs11', 'pop', 'pres', 'prospero', 'reload', 'rtsp', 'rtsps', 'rtspu', 'service', 'session', 'shttp', 'sieve', 'sip', 'sips', 'sms', 'snews', 'snmp', 'soap.beep', 'soap.beeps', 'stun', 'stuns', 'tag', 'tel', 'telnet', 'tftp', 'thismessage', 'tip', 'tn3270', 'turn', 'turns', 'tv', 'urn', 'vemmi', 'videotex', 'vnc', 'wais', 'ws', 'wss', 'xcon', 'xcon-userid', 'xmlrpc.beep', 'xmlrpc.beeps', 'xmpp', 'z39.50', 'z39.50r', 'z39.50s');
|
||||
$found = FALSE;
|
||||
$checkId = strtolower($id);
|
||||
|
||||
foreach($validSchemes as $scheme)
|
||||
if (strrpos($checkId, $scheme . ':', -strlen($checkId)) !== FALSE)
|
||||
{
|
||||
$found = TRUE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!$found)
|
||||
throw new \InvalidArgumentException("The ID must begin with an IANA-registered URI scheme.");
|
||||
|
||||
$this->addElement('id', $id, NULL, TRUE);
|
||||
} else
|
||||
throw new InvalidOperationException('A unique ID is not supported in RSS1 feeds.');
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
} // end of class Item
|
42
module/download/vendor/FeedWriter/README.md
vendored
Normal file
42
module/download/vendor/FeedWriter/README.md
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
# Generate **RSS 1.0**, **RSS 2.0** or **ATOM** Formatted Feeds
|
||||
|
||||
This package can be used to generate feeds in either **RSS 1.0**, **RSS 2.0** or **ATOM** format.
|
||||
|
||||
Applications can create a feed object, several feed item objects, set several types of properties of either feed and feed items, and add items to the feed.
|
||||
|
||||
Once a feed is fully composed with its items, the feed class can generate the necessary XML structure to describe the feed in **RSS** or **ATOM** format. This structure can be directly sent to the browser, or just returned as string.
|
||||
|
||||
## Requirements
|
||||
|
||||
- PHP 5.3 or higher
|
||||
|
||||
If you don't have **PHP 5.3** available on your system there is a version supporting **PHP 5.0** and above. See the `legacy-php-5.0` branch.
|
||||
|
||||
## Documentation
|
||||
|
||||
The documentation can be found in the `gh-pages` branch, or on [GitHub Pages](https://mibe.github.io/FeedWriter/).
|
||||
|
||||
See the `/examples` directory for usage examples.
|
||||
|
||||
See the `CHANGELOG.md` file for changes between the different versions.
|
||||
|
||||
## Authors
|
||||
|
||||
In chronological order:
|
||||
|
||||
- [Anis uddin Ahmad](https://github.com/ajaxray)
|
||||
- [Michael Bemmerl](https://github.com/mibe)
|
||||
- Phil Freo
|
||||
- Paul Ferrett
|
||||
- Brennen Bearnes
|
||||
- Michael Robinson
|
||||
- Baptiste Fontaine
|
||||
- Kristián Valentín
|
||||
- Brandtley McMinn
|
||||
- Julian Bogdani
|
||||
- Cedric Gampert
|
||||
- Yamek
|
||||
- Thielj
|
||||
- Pavel Khakhlou
|
||||
- Daniel
|
||||
- Tino Goratsch
|
37
module/download/vendor/FeedWriter/RSS1.php
vendored
Normal file
37
module/download/vendor/FeedWriter/RSS1.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper for creating RSS1 feeds
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class RSS1 extends Feed
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(Feed::RSS1);
|
||||
}
|
||||
}
|
37
module/download/vendor/FeedWriter/RSS2.php
vendored
Normal file
37
module/download/vendor/FeedWriter/RSS2.php
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
namespace FeedWriter;
|
||||
|
||||
/*
|
||||
* Copyright (C) 2012 Michael Bemmerl <mail@mx-server.de>
|
||||
*
|
||||
* This file is part of the "Universal Feed Writer" project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper for creating RSS2 feeds
|
||||
*
|
||||
* @package UniversalFeedWriter
|
||||
*/
|
||||
class RSS2 extends Feed
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(Feed::RSS2);
|
||||
}
|
||||
}
|
18
module/download/view/add/add.css
Normal file
18
module/download/view/add/add.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
54
module/download/view/add/add.js.php
Normal file
54
module/download/view/add/add.js.php
Normal file
@ -0,0 +1,54 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour enregistrer en brouillon
|
||||
*/
|
||||
$("#downloadAddDraft").on("click", function() {
|
||||
$("#downloadAddState").val(0);
|
||||
$("#downloadAddForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Options de commentaires
|
||||
*/
|
||||
$("#downloadAddCommentClose").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$("#downloadAddCommentNotification").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$("#downloadAddCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadAddCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$( document).ready(function() {
|
||||
|
||||
if ($("#downloadAddCloseComment").is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
|
||||
if ($("#downloadAddCommentNotification").is(':checked') ) {
|
||||
$("#downloadAddCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadAddCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
183
module/download/view/add/add.php
Normal file
183
module/download/view/add/add.php
Normal file
@ -0,0 +1,183 @@
|
||||
<?php echo template::formOpen('downloadAddForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadAddBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('downloadAddDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadAddState', [
|
||||
'value' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadAddPublish', [
|
||||
'value' => 'Publier'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations sur la ressource</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadAddTitle', [
|
||||
'label' => 'Titre'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadAddVersion', [
|
||||
'label' => 'Version'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::date('downloadAddversionDate', [
|
||||
'label' => 'Publiée le'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadAddAuthor', [
|
||||
'label' => 'Auteur'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadAddLicense', $module::$licenses, [
|
||||
'label' => 'Licence'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php if ($module::$categories) {
|
||||
echo template::select('downloadAddCategorie', $module::$categories, [
|
||||
'label' => 'Catégorie'
|
||||
]);
|
||||
} else {
|
||||
echo template::select('downloadAddCategorie', [''=>''], [
|
||||
'label' => 'Pas de catégorie',
|
||||
'disabled' => true
|
||||
]);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::file('downloadAddThumb', [
|
||||
'label' => 'Capture d\'écran',
|
||||
'type' => 1
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadAddRessourceType', $module::$ressourceType, [
|
||||
'label' => 'Type de ressource',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'ressourceType'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::file('downloadAddFile', [
|
||||
'label' => 'Fichier',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::text('downloadAddUrl', [
|
||||
'label' => 'URL',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'url']),
|
||||
'placeholder' => 'https://'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('downloadAddContent', [
|
||||
'class' => 'editorWysiwyg'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Options de publication</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadAddUserId', $module::$users, [
|
||||
'label' => 'Auteur',
|
||||
'selected' => $this->getUser('id'),
|
||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('downloadAddPublishedOn', [
|
||||
'help' => 'L\'item n\'est visible qu\'après la date de publication prévue.',
|
||||
'label' => 'Date de publication',
|
||||
'value' => time()
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadAddConsent', $module::$itemConsent , [
|
||||
'label' => 'Edition / Suppression',
|
||||
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'editConsent']),
|
||||
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Commentaires</h4>
|
||||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('downloadAddCommentClose', true, 'Fermer les commentaires', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentClose'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('downloadAddCommentApproved', true, 'Approbation par un modérateur', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentApproved']),
|
||||
''
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadAddCommentMaxlength', $module::$commentLength,[
|
||||
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.',
|
||||
'label' => 'Caractères par commentaire',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentMaxlength'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('downloadAddCommentNotification', true, 'Notification par email', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentNotification']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadAddCommentGroupNotification', $module::$groupNews, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
38
module/download/view/categories/categories.css
Normal file
38
module/download/view/categories/categories.css
Normal file
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
|
||||
.blockContainer {
|
||||
display : none;
|
||||
}
|
||||
|
||||
#info .zwiico-plus-circled {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.zwiico-minus-circled,
|
||||
#info .zwiico-minus-circled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.zwiico-minus-circled,
|
||||
.zwiico-plus-circled {
|
||||
cursor: pointer;
|
||||
}
|
70
module/download/view/categories/categories.js.php
Normal file
70
module/download/view/categories/categories.js.php
Normal file
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".categoriesDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cette catégorie ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Gestion des blocs dépliants
|
||||
*/
|
||||
$( document).ready(function() {
|
||||
|
||||
/**
|
||||
* Initialisation des blocs
|
||||
*/
|
||||
|
||||
var i = [ "params" ];
|
||||
$.each(i,function(e) {
|
||||
if (getCookie(i[e]) === "true") {
|
||||
$("#" + i[e]).find(".zwiico-plus-circled").hide();
|
||||
$("#" + i[e]).find(".zwiico-minus-circled").show();
|
||||
$("#" + i[e]).find(".blockContainer").show();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* Blocs dépliants
|
||||
*/
|
||||
|
||||
$("div .block").click(function(e) {
|
||||
$(this).find(".zwiico-plus-circled").toggle();
|
||||
$(this).find(".zwiico-minus-circled").toggle();
|
||||
$(this).find(".blockContainer").slideToggle();
|
||||
/*
|
||||
* Sauvegarder la position des blocs
|
||||
* true = bloc déplié
|
||||
*/
|
||||
document.cookie = $(this).attr('id') + "=" + $(this).find(".zwiico-minus-circled").is(":visible") + ";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;SameSite=Lax";
|
||||
}).on("click", "span > input, input, textarea, label, option, button, a:not(.inputFile), .blockContainer", function(e) {
|
||||
// Empêcher les déclenchements dans les blocs
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Lire un cookie s'il existe
|
||||
*/
|
||||
function getCookie(name) {
|
||||
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
||||
return v ? v[2] : null;
|
||||
}
|
50
module/download/view/categories/categories.php
Normal file
50
module/download/view/categories/categories.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php echo template::formOpen('categoriesForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('categoriesBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('categoriesSubmit', [
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block" id="params">
|
||||
<h4>Nouvelle catégorie
|
||||
<div class="openClose">
|
||||
<?php
|
||||
echo template::ico('plus-circled','right');
|
||||
echo template::ico('minus-circled','right');
|
||||
?>
|
||||
</div>
|
||||
</h4>
|
||||
<div class="blockContainer">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('categoriesTitle', [
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'categories', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<?php if($module::$categories): ?>
|
||||
<?php echo template::table([2, 6, 1, 1], $module::$categories, ['Nom', 'URL', '','']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune catégorie'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
18
module/download/view/categoryEdit/categoryEdit.css
Normal file
18
module/download/view/categoryEdit/categoryEdit.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
31
module/download/view/categoryEdit/categoryEdit.php
Normal file
31
module/download/view/categoryEdit/categoryEdit.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php echo template::formOpen('categoryEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('categoryEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/categories',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('categoryEditSubmit', [
|
||||
'value' => 'Valider'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Editer la catégorie</h4>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::text('categoryEditTitle', [
|
||||
'label' => 'Nom',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'categories', $this->getUrl(2)])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
18
module/download/view/comment/comment.css
Normal file
18
module/download/view/comment/comment.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
62
module/download/view/comment/comment.js.php
Normal file
62
module/download/view/comment/comment.js.php
Normal file
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".downloadCommentDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Supprimer le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation d'approbation
|
||||
*/
|
||||
$(".downloadCommentApproved").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Approuver le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de rejet
|
||||
*/
|
||||
$(".downloadCommentRejected").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
return core.confirm("Rejeter le commentaire de l'item " + nom + " ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Confirmation de suppression en masse
|
||||
*/
|
||||
$(".downloadCommentDeleteAll").on("click", function() {
|
||||
var _this = $(this);
|
||||
var nombre = "<?php echo count($this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'comment' ])); ?>";
|
||||
var nom = "<?php echo $this->getData(['module', $this->getUrl(0), $this->getUrl(2), 'title' ]); ?>";
|
||||
if( nombre === "1"){
|
||||
var message = "Supprimer le commentaire de l'item " + nom + " ?";
|
||||
} else{
|
||||
var message = "Supprimer les " + nombre + " commentaires de l'item " + nom + " ?";
|
||||
}
|
||||
return core.confirm(message, function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
22
module/download/view/comment/comment.php
Normal file
22
module/download/view/comment/comment.php
Normal file
@ -0,0 +1,22 @@
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadCommentBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
<?php if($module::$comments): ?>
|
||||
<div class="col2 offset8">
|
||||
<?php echo $module::$commentsDelete; ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<?php echo template::table([3, 5, 2, 1, 1], $module::$comments, ['Date', 'Contenu', 'Auteur', '', '']); ?>
|
||||
<?php echo $module::$pages.'<br/>'; ?>
|
||||
<?php else: ?>
|
||||
</div>
|
||||
<?php echo template::speech('Aucun commentaire.'); ?>
|
||||
<?php endif; ?>
|
37
module/download/view/config/config.css
Normal file
37
module/download/view/config/config.css
Normal file
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
||||
|
||||
.blockContainer {
|
||||
display : none;
|
||||
}
|
||||
|
||||
#info .zwiico-plus-circled {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
.zwiico-minus-circled,
|
||||
#info .zwiico-minus-circled {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
.zwiico-minus-circled,
|
||||
.zwiico-plus-circled {
|
||||
cursor: pointer;
|
||||
}
|
68
module/download/view/config/config.js.php
Normal file
68
module/download/view/config/config.js.php
Normal file
@ -0,0 +1,68 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".downloadConfigDelete").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir supprimer cet item ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Gestion des blocs dépliants
|
||||
*/
|
||||
$( document).ready(function() {
|
||||
|
||||
/**
|
||||
* Initialisation des blocs
|
||||
*/
|
||||
|
||||
var i = [ "params" ];
|
||||
$.each(i,function(e) {
|
||||
if (getCookie(i[e]) === "true") {
|
||||
$("#" + i[e]).find(".zwiico-plus-circled").hide();
|
||||
$("#" + i[e]).find(".zwiico-minus-circled").show();
|
||||
$("#" + i[e]).find(".blockContainer").show();
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
*
|
||||
* Blocs dépliants
|
||||
*/
|
||||
|
||||
$("div .block").click(function(e) {
|
||||
$(this).find(".zwiico-plus-circled").toggle();
|
||||
$(this).find(".zwiico-minus-circled").toggle();
|
||||
$(this).find(".blockContainer").slideToggle();
|
||||
/*
|
||||
* Sauvegarder la position des blocs
|
||||
* true = bloc déplié
|
||||
*/
|
||||
document.cookie = $(this).attr('id') + "=" + $(this).find(".zwiico-minus-circled").is(":visible") + ";expires=Fri, 31 Dec 9999 23:59:59 GMT;path=/;SameSite=Lax";
|
||||
}).on("click", "span > input, input, textarea, label, option, button, a:not(.inputFile), .blockContainer", function(e) {
|
||||
// Empêcher les déclenchements dans les blocs
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Lire un cookie s'il existe
|
||||
*/
|
||||
function getCookie(name) {
|
||||
var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
|
||||
return v ? v[2] : null;
|
||||
}
|
75
module/download/view/config/config.php
Normal file
75
module/download/view/config/config.php
Normal file
@ -0,0 +1,75 @@
|
||||
<?php echo template::formOpen('downloadConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . 'page/edit/' . $this->getUrl(0), 'items',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('downloadConfigSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block" id="params">
|
||||
<h4>Paramètres du module
|
||||
<div class="openClose">
|
||||
<?php
|
||||
echo template::ico('plus-circled','right');
|
||||
echo template::ico('minus-circled','right');
|
||||
?>
|
||||
</div>
|
||||
</h4>
|
||||
<div class="blockContainer">
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('downloadConfigShowFeeds', true, 'Lien du flux RSS', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'config', 'feeds']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::text('downloadConfigFeedslabel', [
|
||||
'label' => 'Etiquette du flux',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'config', 'feedsLabel'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('blogConfigItemsperPage', $module::$ItemsList, [
|
||||
'label' => 'Articles par page',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0),'config', 'itemsperPage'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadConfigCategories', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/categories',
|
||||
'value' => 'Catégories'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('downloadConfigAdd', [
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||
'ico' => 'plus',
|
||||
'value' => 'Ressource'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$items): ?>
|
||||
<?php echo template::table([2,2, 1, 2, 1, 1, 1, 1, 1], $module::$items, ['Titre', 'Catégorie ' . $module::$allCategories, 'Version', 'Du', 'Stats', 'État', 'Comm', '','']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucune ressource'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
||||
|
18
module/download/view/edit/edit.css
Normal file
18
module/download/view/edit/edit.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
77
module/download/view/edit/edit.js.php
Normal file
77
module/download/view/edit/edit.js.php
Normal file
@ -0,0 +1,77 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
// Lien de connexion
|
||||
$("#downloadEditMailNotification").on("change", function() {
|
||||
if($(this).is(":checked")) {
|
||||
$("#formConfigGroup").show();
|
||||
}
|
||||
else {
|
||||
$("#formConfigGroup").hide();
|
||||
}
|
||||
}).trigger("change");
|
||||
|
||||
|
||||
/**
|
||||
* Soumission du formulaire pour enregistrer en brouillon
|
||||
*/
|
||||
$("#downloadEditDraft").on("click", function() {
|
||||
$("#downloadEditState").val(0);
|
||||
$("#downloadEditForm").trigger("submit");
|
||||
});
|
||||
|
||||
/**
|
||||
* Options de commentaires
|
||||
*/
|
||||
$("#downloadEditCommentClose").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
});
|
||||
|
||||
$("#downloadEditCommentNotification").on("change", function() {
|
||||
if ($(this).is(':checked') ) {
|
||||
$("#downloadEditCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadEditCommentGroupNotification").slideUp();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$( document).ready(function() {
|
||||
|
||||
/** Gestion des commentaires */
|
||||
|
||||
if ($("#downloadEditCloseComment").is(':checked') ) {
|
||||
$(".commentOptionsWrapper").slideUp();
|
||||
} else {
|
||||
$(".commentOptionsWrapper").slideDown();
|
||||
}
|
||||
|
||||
if ($("#downloadEditCommentNotification").is(':checked') ) {
|
||||
$("#downloadEditCommentGroupNotification").slideDown();
|
||||
} else {
|
||||
$("#downloadEditCommentGroupNotification").slideUp();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Paramétrage du sélecteur de date
|
||||
* Supprimer les heures
|
||||
|
||||
const datepickr = flatpickr("#downloadEditversionDate", {});
|
||||
datepickr.set (enableTime, false);
|
||||
*/
|
||||
});
|
193
module/download/view/edit/edit.php
Normal file
193
module/download/view/edit/edit.php
Normal file
@ -0,0 +1,193 @@
|
||||
<?php echo template::formOpen('downloadEditForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('downloadEditBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3 offset5">
|
||||
<?php echo template::button('downloadEditDraft', [
|
||||
'uniqueSubmission' => true,
|
||||
'value' => 'Enregistrer en brouillon'
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadEditState', [
|
||||
'value' => true
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadEditSubmit', [
|
||||
'value' => 'Publier'
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Informations sur la ressource</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::text('downloadEditTitle', [
|
||||
'label' => 'Titre',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'title'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadEditVersion', [
|
||||
'label' => 'Version',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'version'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::date('downloadEditversionDate', [
|
||||
'label' => 'Publiée le',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'versionDate'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::text('downloadEditAuthor', [
|
||||
'label' => 'Auteur',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'author'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadEditLicense', $module::$licenses, [
|
||||
'label' => 'Licence',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'license'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php if ($module::$categories) {
|
||||
echo template::select('downloadEditCategorie', $module::$categories, [
|
||||
'label' => 'Catégorie',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'category'])
|
||||
]);
|
||||
} else {
|
||||
echo template::select('downloadEditCategorie', [''=>''], [
|
||||
'label' => 'Pas de catégorie',
|
||||
'disabled' => true
|
||||
]);
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::file('downloadEditThumb', [
|
||||
'label' => 'Capture d\'écran',
|
||||
'type' => 1,
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'thumb'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::select('downloadEditRessourceType', $module::$ressourceType, [
|
||||
'label' => 'Type de ressource',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'ressourceType'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::file('downloadEditFile', [
|
||||
'label' => 'Fichier',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'file'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::text('downloadEditUrl', [
|
||||
'label' => 'URL',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'url']),
|
||||
'placeholder' => 'https://'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::textarea('downloadEditContent', [
|
||||
'class' => 'editorWysiwyg',
|
||||
'value' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'content'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Options de publication</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadEditUserId', $module::$users, [
|
||||
'label' => 'Auteur',
|
||||
'selected' => $this->getUser('id'),
|
||||
'disabled' => $this->getUser('group') !== self::GROUP_ADMIN ? true : false
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::date('downloadEditPublishedOn', [
|
||||
'help' => 'L\'item n\'est visible qu\'après la date de publication prévue.',
|
||||
'label' => 'Date de publication',
|
||||
'value' => time()
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::select('downloadEditConsent', $module::$itemConsent , [
|
||||
'label' => 'Edition / Suppression',
|
||||
'selected' => is_numeric($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'editConsent'])) ? $module::EDIT_GROUP : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'editConsent']),
|
||||
'help' => 'Les utilisateurs des groupes supérieurs accèdent à l\'item sans restriction'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Commentaires</h4>
|
||||
<div class="row">
|
||||
<div class="col4 ">
|
||||
<?php echo template::checkbox('downloadEditCommentClose', true, 'Fermer les commentaires', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentClose'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper ">
|
||||
<?php echo template::checkbox('downloadEditCommentApproved', true, 'Approbation par un modérateur', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentApproved']),
|
||||
''
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadEditCommentMaxlength', $module::$commentLength,[
|
||||
'help' => 'Choix du nombre maximum de caractères pour chaque commentaire de l\'item, mise en forme html comprise.',
|
||||
'label' => 'Caractères par commentaire',
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentMaxlength'])
|
||||
]); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3 commentOptionsWrapper offset2">
|
||||
<?php echo template::checkbox('downloadEditCommentNotification', true, 'Notification par email', [
|
||||
'checked' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentNotification']),
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4 commentOptionsWrapper">
|
||||
<?php echo template::select('downloadEditCommentGroupNotification', $module::$groupNews, [
|
||||
'selected' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(2), 'commentGroupNotification']),
|
||||
'help' => 'Editeurs = éditeurs + administrateurs<br/> Membres = membres + éditeurs + administrateurs'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
69
module/download/view/index/index.css
Normal file
69
module/download/view/index/index.css
Normal file
@ -0,0 +1,69 @@
|
||||
.rowitem {
|
||||
margin-bottom: 10px !important;
|
||||
}
|
||||
.downloadPicture {
|
||||
float: none;
|
||||
border: 1px;
|
||||
}
|
||||
.downloadPicture img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
/*
|
||||
border:1px solid lightgray;
|
||||
box-shadow: 1px 1px 5px darkgray;
|
||||
*/
|
||||
}
|
||||
|
||||
.downloadPicture:hover {
|
||||
opacity: .7;
|
||||
}
|
||||
.row:after {
|
||||
content: " ";
|
||||
display: table;
|
||||
clear: both;
|
||||
}
|
||||
.downloadComment {
|
||||
padding-right: 10px;
|
||||
float: right;
|
||||
}
|
||||
h2{
|
||||
margin-bottom: 5px;
|
||||
margin-top: 0px;
|
||||
padding: 0px;
|
||||
|
||||
}
|
||||
.downloadContent {
|
||||
float: left;
|
||||
margin-top: 5px;
|
||||
}
|
||||
.downloadDate {
|
||||
font-size:0.8em;
|
||||
font-style: italic;
|
||||
/*
|
||||
color: grey;
|
||||
*/
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.downloadContent {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.downloadPicture img {
|
||||
width: 50% ;
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Flux RSS
|
||||
*/
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
67
module/download/view/index/index.php
Normal file
67
module/download/view/index/index.php
Normal file
@ -0,0 +1,67 @@
|
||||
<?php if($module::$items): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php foreach($module::$items as $itemId => $item): ?>
|
||||
<div class="row rowitem">
|
||||
<div class="col3 downloadLeft">
|
||||
<?php
|
||||
// Déterminer le nom de la miniature
|
||||
$parts = explode('/',$item['thumb']);
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $item['thumb']);
|
||||
// Créer la miniature si manquante
|
||||
if (!file_exists( self::FILE_DIR . 'thumb/' . $thumb) ) {
|
||||
$this->makeThumb( self::FILE_DIR . 'source/' . $item['thumb'],
|
||||
self::FILE_DIR . 'thumb/' . $thumb,
|
||||
self::THUMBS_WIDTH);
|
||||
}
|
||||
|
||||
?>
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>" class="downloadPicture">
|
||||
<img src="<?php echo helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb; ?>" alt="<?php echo $item['thumb']; ?>">
|
||||
</a>
|
||||
</div>
|
||||
<div class="col9 downloadRight">
|
||||
<article>
|
||||
<h2 class="downloadTitle">
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>">
|
||||
<?php echo $item['title']; ?>
|
||||
</a>
|
||||
</h2>
|
||||
<div class="downloadComment">
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>#comment">
|
||||
<?php if ($item['comment']): ?>
|
||||
<?php echo count($item['comment']); ?>
|
||||
<?php endif; ?>
|
||||
</a>
|
||||
<?php echo template::ico('comment', 'left'); ?>
|
||||
</div>
|
||||
<div class="downloadDate">
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $item['publishedOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $item['publishedOn'])
|
||||
: utf8_encode(strftime('%d %B %Y', $item['publishedOn'])); ?>
|
||||
</div>
|
||||
<p class="downloadContent">
|
||||
<?php echo helper::subword(strip_tags($item['content']), 0, 400); ?>...
|
||||
<a href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/' . $itemId; ?>">Lire la suite</a>
|
||||
</p>
|
||||
</article>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||
<div id="rssFeed">
|
||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||
<img src='module/download/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun item.'); ?>
|
||||
<?php endif; ?>
|
67
module/download/view/item/item.css
Normal file
67
module/download/view/item/item.css
Normal file
@ -0,0 +1,67 @@
|
||||
|
||||
#sectionTitle {
|
||||
margin-top: 0;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.downloadItemPicture {
|
||||
width: 100%;
|
||||
border:1px solid lightgray;
|
||||
box-shadow: 1px 1px 5px;
|
||||
}
|
||||
.downloadItemPictureleft {
|
||||
float: left;
|
||||
margin: 15px 10px 5px 0 ;
|
||||
}
|
||||
.downloadItemPictureright {
|
||||
float: right;
|
||||
margin: 15px 0 5px 10px ;
|
||||
}
|
||||
|
||||
|
||||
.pict20{
|
||||
width: 20%;
|
||||
}
|
||||
.pict30{
|
||||
width: 30%;
|
||||
}
|
||||
.pict40{
|
||||
width: 40%;
|
||||
}
|
||||
.pict50{
|
||||
width: 50%;
|
||||
}
|
||||
.pict100{
|
||||
width: 100%;
|
||||
margin: 15px 0 20px 0 ;
|
||||
}
|
||||
|
||||
#downloaditemCommentShow {
|
||||
cursor: text;
|
||||
}
|
||||
#downloaditemOr {
|
||||
padding: 10px;
|
||||
}
|
||||
.downloadDate {
|
||||
font-size:0.8em;
|
||||
font-style: italic;
|
||||
color: grey;
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.downloaditemPicture {
|
||||
height:auto;
|
||||
max-width: 100%;}
|
||||
}
|
||||
|
||||
|
||||
#rssFeed {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
#rssFeed p {
|
||||
display: inline;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.itemInfo, .itemContent {
|
||||
min-height: 25em;
|
||||
}
|
50
module/download/view/item/item.js.php
Normal file
50
module/download/view/item/item.js.php
Normal file
@ -0,0 +1,50 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Incrémente les stats
|
||||
*/
|
||||
$('#downloadItemFile').click(function() {
|
||||
$('#downloadStats').html(function(i, val) { return val*1+1 });
|
||||
});
|
||||
|
||||
/**
|
||||
* Affiche le bloc pour rédiger un commentaire
|
||||
*/
|
||||
var commentShowDOM = $("#downloadItemCommentShow");
|
||||
commentShowDOM.on("click focus", function() {
|
||||
$("#downloadItemCommentShowWrapper").fadeOut(function() {
|
||||
$("#downloadItemCommentWrapper").fadeIn();
|
||||
$("#downloadItemCommentContent").trigger("focus");
|
||||
});
|
||||
});
|
||||
if($("#downloadItemCommentWrapper").find("textarea.notice,input.notice").length) {
|
||||
commentShowDOM.trigger("click");
|
||||
}
|
||||
|
||||
/**
|
||||
* Cache le bloc pour rédiger un commentaire
|
||||
*/
|
||||
$("#downloadItemCommentHide").on("click focus", function() {
|
||||
$("#downloadItemCommentWrapper").fadeOut(function() {
|
||||
$("#downloadItemCommentShowWrapper").fadeIn();
|
||||
$("#downloadItemCommentContent").val("");
|
||||
$("#downloadItemCommentAuthor").val("");
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Force le scroll vers les commentaires en cas d'erreur
|
||||
*/
|
||||
$("#downloadItemCommentForm").on("submit", function() {
|
||||
$(location).attr("href", "#comment");
|
||||
});
|
235
module/download/view/item/item.php
Normal file
235
module/download/view/item/item.php
Normal file
@ -0,0 +1,235 @@
|
||||
<div class="row">
|
||||
<div class="col3 itemInfo">
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'thumb'])): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
$pictureSize = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']) === null ? '100' : $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'pictureSize']);
|
||||
$parts = explode('/',$this->getData(['module', $this->getUrl(0), 'items',$this->getUrl(1), 'thumb']));
|
||||
$thumb = str_replace ($parts[(count($parts)-1)],'mini_' . $parts[(count($parts)-1)], $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'thumb']));
|
||||
echo '<img class="downloadItemPicture" src="' . helper::baseUrl(false) . self::FILE_DIR . 'thumb/' . $thumb .
|
||||
'" alt="' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'thumb']) . '">';
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'ressourceType']) !== 'content'): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php
|
||||
switch ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'ressourceType'])) {
|
||||
case 'file':
|
||||
$href = helper::baseUrl() . $this->getUrl(0) . '/downloadFile/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];
|
||||
$target = '_self';
|
||||
break;
|
||||
case 'url' :
|
||||
$href = $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'url']);
|
||||
$target = '_blank';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
<?php echo template::button('downloadItemFile', [
|
||||
'href' => $href,
|
||||
'value' => 'Télécharger',
|
||||
'target'=> $target
|
||||
]);
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'version']) ): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php echo 'Version n°' . $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'version']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'date']) ): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'date'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'date']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'date'])));
|
||||
echo ' du ' . $date;
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Auteur :
|
||||
<?php echo $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'author']); ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Licence :
|
||||
<?php echo $module::$licenses[$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'license'])]; ?>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'file'])): ?>
|
||||
<div class="row">
|
||||
<div class="col12 textAlignCenter">
|
||||
<span>Téléchargements : <span id="downloadStats"><?php echo $module::$statSum;'<span>'?></span>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="col9">
|
||||
<div class="row">
|
||||
<div class="col12 itemContent">
|
||||
<?php echo $this->getData(['module', $this->getUrl(0),'items', $this->getUrl(1), 'content']); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row verticalAlignMiddle">
|
||||
<div class="col12 downloadDate">
|
||||
<?php echo $module::$itemSignature . ' - ';?>
|
||||
<i class="far fa-calendar-alt"></i>
|
||||
<?php $date = mb_detect_encoding(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(strftime('%d %B %Y', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])));
|
||||
$heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true)
|
||||
? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn']))
|
||||
: utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'publishedOn'])));
|
||||
echo $date . ' à ' . $heure;
|
||||
?>
|
||||
|
||||
<!-- Bouton d'édition -->
|
||||
<?php if (
|
||||
$this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')
|
||||
AND
|
||||
( // Propriétaire
|
||||
(
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === $module::EDIT_OWNER
|
||||
AND ( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'userId']) === $this->getUser('id')
|
||||
OR $this->getUser('group') === self::GROUP_ADMIN )
|
||||
)
|
||||
OR (
|
||||
// Groupe
|
||||
( $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === self::GROUP_ADMIN
|
||||
OR $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === self::GROUP_MODERATOR)
|
||||
AND $this->getUser('group') >= $this->getData(['module',$this->getUrl(0), 'items', $this->getUrl(1),'editConsent'])
|
||||
)
|
||||
OR (
|
||||
// Tout le monde
|
||||
$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1),'editConsent']) === $module::EDIT_ALL
|
||||
AND $this->getUser('group') >= $module::$actions['config']
|
||||
)
|
||||
)
|
||||
): ?>
|
||||
<a href ="<?php echo helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(1) . '/' . $_SESSION['csrf'];?>">
|
||||
<?php echo template::ico('pencil');?> Editer
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<!-- Bloc RSS-->
|
||||
<?php if ($this->getData(['module',$this->getUrl(0), 'config', 'feeds'])): ?>
|
||||
<div id="rssFeed">
|
||||
<a type="application/rss+xml" href="<?php echo helper::baseUrl() . $this->getUrl(0) . '/rss'; ?> ">
|
||||
<img src='module/download/ressource/feed-icon-16.gif' />
|
||||
<?php
|
||||
echo '<p>' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '</p>' ;
|
||||
?>
|
||||
</a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bloc commentaire -->
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php if($this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentClose'])): ?>
|
||||
<p>Cet item ne reçoit pas de commentaire.</p>
|
||||
<?php else: ?>
|
||||
<h3 id="comment">
|
||||
<?php //$commentsNb = count($module::$comments); ?>
|
||||
<?php $commentsNb = $module::$nbCommentsApproved; ?>
|
||||
<?php $s = $commentsNb === 1 ? '': 's' ?>
|
||||
<?php echo $commentsNb > 0 ? $commentsNb . ' ' . 'commentaire' . $s : 'Pas encore de commentaire'; ?>
|
||||
</h3>
|
||||
<?php echo template::formOpen('downloadItemForm'); ?>
|
||||
<?php echo template::text('downloadItemCommentShow', [
|
||||
'placeholder' => 'Rédiger un commentaire...',
|
||||
'readonly' => true
|
||||
]); ?>
|
||||
<div id="downloadItemCommentWrapper" class="displayNone">
|
||||
<?php if($this->getUser('password') === $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<?php echo template::text('downloadItemUserName', [
|
||||
'label' => 'Nom',
|
||||
'readonly' => true,
|
||||
'value' => $module::$editCommentSignature
|
||||
]); ?>
|
||||
<?php echo template::hidden('downloadItemUserId', [
|
||||
'value' => $this->getUser('id')
|
||||
]); ?>
|
||||
<?php else: ?>
|
||||
<div class="row">
|
||||
<div class="col9">
|
||||
<?php echo template::text('downloadItemAuthor', [
|
||||
'label' => 'Nom'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col1 textAlignCenter verticalAlignBottom">
|
||||
<div id="downloadItemOr">Ou</div>
|
||||
</div>
|
||||
<div class="col2 verticalAlignBottom">
|
||||
<?php echo template::button('downloadItemLogin', [
|
||||
'href' => helper::baseUrl() . 'user/login/' . str_replace('/', '_', $this->getUrl()) . '__comment',
|
||||
'value' => 'Connexion'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php echo template::textarea('downloadItemContent', [
|
||||
'label' => 'Commentaire avec maximum '.$this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength']).' caractères',
|
||||
'class' => 'editorWysiwygComment',
|
||||
'noDirty' => true,
|
||||
'maxlength' => $this->getData(['module', $this->getUrl(0), 'items', $this->getUrl(1), 'commentMaxlength'])
|
||||
]); ?>
|
||||
<div id="downloadItemContentAlarm"> </div>
|
||||
<?php if($this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')): ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php echo template::captcha('downloadItemCaptcha', [
|
||||
'limit' => $this->getData(['config','connect', 'captchaStrong']),
|
||||
'type' => $this->getData(['config','connect', 'captchaType'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<div class="row">
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('downloadItemCommentHide', [
|
||||
'class' => 'buttonGrey',
|
||||
'value' => 'Annuler'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2">
|
||||
<?php echo template::submit('downloadItemSubmit', [
|
||||
'value' => 'Envoyer',
|
||||
'ico' => ''
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<?php foreach($module::$comments as $commentId => $comment): ?>
|
||||
<div class="block">
|
||||
<h4><?php echo $module::$commentsSignature[$commentId]; ?>
|
||||
le <?php echo mb_detect_encoding(strftime('%d %B %Y - %H:%M', $comment['createdOn']), 'UTF-8', true)
|
||||
? strftime('%d %B %Y - %H:%M', $comment['createdOn'])
|
||||
: utf8_encode(strftime('%d %B %Y - %H:%M', $comment['createdOn']));
|
||||
?>
|
||||
<?php echo $comment['content']; ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo $module::$pages; ?>
|
1
module/download/view/list/list.php
Normal file
1
module/download/view/list/list.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- rien -->
|
1
module/download/view/rss/rss.php
Normal file
1
module/download/view/rss/rss.php
Normal file
@ -0,0 +1 @@
|
||||
<!-- rien -->
|
18
module/download/view/stats/stats.css
Normal file
18
module/download/view/stats/stats.css
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
22
module/download/view/stats/stats.js.php
Normal file
22
module/download/view/stats/stats.js.php
Normal file
@ -0,0 +1,22 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Confirmation de suppression
|
||||
*/
|
||||
$(".statsDeleteAll").on("click", function() {
|
||||
var _this = $(this);
|
||||
return core.confirm("Êtes-vous sûr de vouloir purger les statistiques ?", function() {
|
||||
$(location).attr("href", _this.attr("href"));
|
||||
});
|
||||
});
|
36
module/download/view/stats/stats.php
Normal file
36
module/download/view/stats/stats.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php echo template::formOpen('statsConfig'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('statsConfigBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::button('statsConfigAdd', [
|
||||
'class' => 'statsDeleteAll buttonRed',
|
||||
'href' => helper::baseUrl() . $this->getUrl(0) . '/statsDeleteAll' . '/' . $this->getUrl(2) . '/'. $_SESSION['csrf'] ,
|
||||
'ico' => 'cancel',
|
||||
'value' => 'Purger'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<h3> Nombre de téléchargements :
|
||||
<?php echo $module::$statSum; ?>
|
||||
</h3>
|
||||
</div>
|
||||
</div>
|
||||
<?php if($module::$items): ?>
|
||||
<?php echo template::table([6, 6], $module::$items, ['Date', 'Adresse IP']); ?>
|
||||
<?php echo $module::$pages; ?>
|
||||
<?php else: ?>
|
||||
<?php echo template::speech('Aucun item.'); ?>
|
||||
<?php endif; ?>
|
||||
<div class="moduleVersion">Version n°
|
||||
<?php echo $module::VERSION; ?>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user