Skip to content

Commit

Permalink
Merge branch '0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
julien1619 committed Feb 11, 2016
2 parents ea1eb8d + ecf8896 commit e15ab04
Show file tree
Hide file tree
Showing 1,272 changed files with 63,951 additions and 34,087 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#############
## wityCMS
#############
cache/[^.]*/
system/config/config.php
system/config/database.php
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "system/WTemplate"]
path = system/WTemplate
url = git://github.com/Creatiwity/WTemplate.git
url = https://github.com/Creatiwity/WTemplate.git
9 changes: 3 additions & 6 deletions .htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,13 @@ AddDefaultCharset UTF-8
<IfModule mod_rewrite.c>
# Activate rewriting
RewriteEngine on

# Rule to redirect on www site
#RewriteCond %{HTTP_HOST} ^site\.com$
#RewriteRule ^(.*) http://www.site.com/$1 [QSA,L,R=301]
# Redirect everything but a physical file to WityCMS

# Redirect everything but a physical file to wityCMS
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
</IfModule>

# Errors
ErrorDocument 404 index.php?app=404
22 changes: 22 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## License

The MIT License (MIT)

Copyright (c) 2013 - Julien Blatecky and Johan Dufau

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43 changes: 10 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WityCMS
# wityCMS

WityCMS is a simple Content Management System Model-View-Controller oriented in PHP.
wityCMS is a lightweight Content Management System (CMS) in PHP, Model-View-Controller oriented.

This CMS uses its own templating system, named [WTemplate](https://github.com/Creatiwity/WTemplate), developed as [a separate GitHub project](https://github.com/Creatiwity/WTemplate) but included here as a submodule.

Expand All @@ -10,38 +10,15 @@ This CMS uses its own templating system, named [WTemplate](https://github.com/Cr

* An **Apache server** with PHP 5.3+, *mod_rewrite* enabled and .htaccess files allowed;
* A **SQL server**, like *MySQL* or *MariaDB*, with a database available;
* A **FTP client**, like [Filezilla](https://filezilla-project.org/);
* Download the latest version of **WityCMS**: [zip](https://github.com/Creatiwity/WityCMS/archive/0.4.0.zip).
* A **FTP client**, like [FileZilla](https://filezilla-project.org/), to upload the files;
* Download the latest version of **wityCMS**: [zip](https://github.com/Creatiwity/wityCMS/archive/0.5.0.zip).

### Let's go

![Installer](https://raw.github.com/Creatiwity/WityCMS/0.4/installer.jpg)
![Installer](https://raw.githubusercontent.com/Creatiwity/wityCMS/0.5/installer/installer.jpg)

1. **Unzip** and **copy** WityCMS files on your Apache server thanks to Filezilla.
2. Open a navigator and **go to the URL** of your Apache server.
3. Here, the **installation page** should be asking you information about your server, and your admin account. Fill in all the required fields until the big blue button highlights.
4. **Click** on "Let's go".
5. **Congratulations!** WityCMS have just generated its configuration files (in `system/config`), created all its tables in the database and inserted the first user (you!) as an administrator. The system is ready to be used.

## License

The MIT License (MIT)

Copyright (c) 2013 - Julien Blatecky and Johan Dufau

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1. **Unzip** and **copy** wityCMS files on your web server using FileZilla.
2. Open a navigator and **go to the URL** of your web server.
3. Here, the **installation page** should be asking you information about your server, and your admin account. Fill in all the required fields until all the tabs are marked as valid.
4. **Click** on "Launch install".
5. **Congratulations!** wityCMS have just generated its configuration files (in `system/config`), created all its tables in the database and inserted the first user (you!) as an administrator. The system is ready to be used.
21 changes: 0 additions & 21 deletions apps/contact/admin/lang/en.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<lang value="en">
<!-- Actions -->
<item id="mail_history">Inbox</item>
<item id="mail_reply">Reply</item>
<item id="new_mail">Compose</item>
<item id="action_config">Configuration</item>

<!-- Mail history -->
<item id="emails_total">%s emails</item>
<item id="from_thead">From</item>
<item id="subject_thead">Subject</item>
<item id="date_thead">Date</item>
<item id="no_mail_found">No email found.</item>

<!-- Mail detail -->
<item id="missing_email_id">Email id is missing.</item>
<item id="not_found_email_id">Unable to find this email.</item>

<item id="from">From:</item>
<item id="close">Close</item>

<!-- Configuration -->
<item id="config_site_from_name">Sender's name</item>
<item id="config_site_from_email">Sender's email</item>
<item id="contact_config_updated">The configuration was updated.</item>
</lang>
30 changes: 15 additions & 15 deletions apps/contact/admin/lang/fr.xml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<lang value="fr">
<!-- Actions -->
<item id="mail_history">Boîte de réception</item>
<item id="mail_reply">Répondre</item>
<item id="new_mail">Nouveau message</item>
<item id="action_config">Configuration</item>
<item id="Inbox">Boîte de réception</item>
<item id="Configuration">Configuration</item>

<!-- Mail history -->
<item id="emails_total">%s emails</item>
<item id="from_thead">De</item>
<item id="subject_thead">Objet</item>
<item id="date_thead">Date</item>
<item id="no_mail_found">Aucun email trouvé.</item>
<item id="%s emails">%s emails</item>
<item id="From">De</item>
<item id="Subject">Objet</item>
<item id="Date">Date</item>
<item id="No email found.">Aucun email trouvé.</item>

<!-- Mail detail -->
<item id="missing_email_id">L'identifiatn de l'email est manquant.</item>
<item id="not_found_email_id">Impossible de trouver cet email.</item>
<item id="Email id is missing.">L'identifiant de l'email est manquant.</item>
<item id="Unable to find this email.">Impossible de trouver cet email.</item>

<item id="From:">De :</item>
<item id="Download attachment">Télécharger la pièce jointe</item>
<item id="Close">Fermer</item>
<item id="Save">Sauvegarder</item>

<item id="from">De :</item>
<item id="close">Fermer</item>

<!-- Configuration -->
<item id="config_site_from_name">Nom de l'expéditeur</item>
<item id="config_site_from_email">Email de l'expéditeur</item>
<item id="contact_config_updated">La configuration a été mise à jour.</item>
<item id="The configuration was updated.">La configuration a été mise à jour.</item>
</lang>
85 changes: 61 additions & 24 deletions apps/contact/admin/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
* Contact Application - Admin Controller
*/

defined('IN_WITY') or die('Access denied');
defined('WITYCMS_VERSION') or die('Access denied');

/**
* ContactAdminController is the Admin Controller of the Contact Application
*
*
* @package Apps\Contact\Admin
* @author Johan Dufau <johan.dufau@creatiwity.net>
* @author Julien Blatecky <julien.blatecky@creatiwity.net>
* @version 0.4.0-07-10-2013
* @version 0.5.0-11-02-2016
*/
class ContactAdminController extends WController {


private $upload_dir;

public function __construct() {
$this->upload_dir = WITY_PATH.'upload'.DS.'contact'.DS;
}

/**
* Returns the corresponding mails (page and sorting) stored in the database
*
*
* @param array $params
* @return array List model
*/
protected function mail_history(array $params) {
$n = 10; // number of emails per page
$n = 30; // number of emails per page

// Sorting criterias given by URL
$sort_by = '';
$sens = 'DESC';
Expand All @@ -34,11 +40,11 @@ protected function mail_history(array $params) {
$page = $page_input;
}
}

// SortingHelper
$sortingHelper = WHelper::load('SortingHelper', array(array('id', 'from', 'name', 'organism', 'to', 'object', 'created_date'), 'created_date', 'DESC'));
$sort = $sortingHelper->findSorting($sort_by, $sens);

// Define model
$model = array(
'emails' => $this->model->getEmailList(($page-1)*$n, $n, $sort[0], $sort[1] == 'ASC'),
Expand All @@ -47,54 +53,85 @@ protected function mail_history(array $params) {
'users_per_page' => $n,
'sortingHelper' => $sortingHelper
);

return $model;
}

/**
* Retrieves a detail of a contact request.
*
*
* @param array $params Get parameters containing the request ID
* @return array Contact request model
*/
protected function mail_detail(array $params) {
$id = intval(array_shift($params));
if (empty($id)) {
return WNote::error('missing_email_id', WLang::_('missing_email_id'));
return WNote::error('missing_email_id', WLang::get('Email id is missing.'));
}

$model = $this->model->getEmail($id);
if (!$model) {
return WNote::error('not_found_email_id', WLang::_('not_found_email_id'));
return WNote::error('not_found_email_id', WLang::get('Unable to find this email.'));
}

return $model;
}


protected function download(array $params) {
$id = intval(array_shift($params));
if (empty($id)) {
return WNote::error('missing_email_id', WLang::get('Email id is missing.'));
}

$model = $this->model->getEmail($id);

if (!empty($model)) {
if (file_exists($model['attachment'])) {
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $model['attachment']);
finfo_close($finfo);

header('Content-Description: File Transfer');
header('Content-Type: '.$mime);
header('Content-Disposition: attachment; filename='.basename($model['attachment']));
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($model['attachment']));
readfile($model['attachment']);
exit;
} else {
$this->setHeader('Location', Wroute::getDir().'contact');
}
}

return array();
}

/**
* Configuration handler
*
*
* @return array Config model
*/
protected function config() {
$data = WRequest::getAssoc(array('update', 'config'));
$config = $this->model->getConfig();

if ($data['update'] == 'true') {
foreach ($config as $name => $value) {
if (isset($data['config'][$name])) {
$config[$name] = $data['config'][$name];

$this->model->setConfig($name, $config[$name]);
}
}
WNote::success('contact_config_updated', WLang::get('contact_config_updated'));

WNote::success('contact_config_updated', WLang::get('The configuration was updated.'));
}

return $config;
}

}

?>
Loading

0 comments on commit e15ab04

Please sign in to comment.