Commit a35fd43c authored by Florian Azizian's avatar Florian Azizian

clean old code + install tinymce

parent d8cab4a0
<?php
/*
* Copyright 2014 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework 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.
*
* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*
*
* @file
* @author <dev@maarch.org>
* @date $date$
* @version $Revision$
*/
require_once("core".DIRECTORY_SEPARATOR."class".DIRECTORY_SEPARATOR."class_request.php");
require_once("apps".DIRECTORY_SEPARATOR."maarch_entreprise".DIRECTORY_SEPARATOR."department_list.php");
$department = $_REQUEST['Input'];
echo "<ul>\n";
$authViewList = 0;
$flagAuthView = false;
foreach ($depts as $key => $value) {
if (stripos($value, $department) !== false) {
if ($authViewList >= 10) {
$flagAuthView = true;
}
echo "<li id=".$key.">".$key." - ".$value."</li>\n";
if($flagAuthView) {
echo "<li id=".$key.">...</li>\n";
break;
}
$authViewList++;
} else if ($key == $department) {
if ($authViewList >= 10) {
$flagAuthView = true;
}
echo "<li id=".$key.">".$key." - ".$value."</li>\n";
if($flagAuthView) {
echo "<li id=".$key.">...</li>\n";
break;
}
$authViewList++;
}
}
echo "</ul>";
\ No newline at end of file
......@@ -17,35 +17,6 @@ abstract class indexing_searching_app_Abstract extends Database
parent::__construct();
}
public function is_filetype_allowed($ext)
{
if (file_exists($_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'extensions.xml')) {
$path = $_SESSION['config']['corepath'].'custom'.DIRECTORY_SEPARATOR.$_SESSION['custom_override_id'].DIRECTORY_SEPARATOR.'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'extensions.xml';
} else {
$path = 'apps'.DIRECTORY_SEPARATOR.$_SESSION['config']['app_id'].DIRECTORY_SEPARATOR.'xml'.DIRECTORY_SEPARATOR.'extensions.xml';
}
$xmlconfig = simplexml_load_file($path);
$ext_list = array();
$i = 0;
foreach ($xmlconfig->FORMAT as $FORMAT) {
$ext_list[$i] = array('name' => (string) $FORMAT->name, 'mime' => (string) $FORMAT->mime);
++$i;
}
$type_state = false;
for ($i = 0; $i < count($ext_list); ++$i) {
if ($ext_list[$i]['name'] == strtoupper($ext)) {
$mime_type = $ext_list[$i]['mime'];
$type_state = true;
// $i = count($ext_list);
break;
}
}
return $type_state;
}
public function show_index_frame($ext)
{
if (empty($ext)) {
......
......@@ -462,8 +462,7 @@ abstract class lists_Abstract extends Database
$stmt = $db->query(
'SELECT distinct(r.type_id), t.description FROM '
.$this->params['tableName'].' r left join '.DOCTYPES_TABLE
.' t on t.type_id = r.type_id '.$where
.$this->params['tableName'].' r left join doctypes t on t.type_id = r.type_id '.$where
.' group by t.description, r.type_id order by t.description'
);
while ($res = $stmt->fetchObject()) {
......
......@@ -49,7 +49,8 @@ abstract class class_users_Abstract extends Database
* Return a array of user informations
*
*/
public function get_user($user_id) {
public function get_user($user_id)
{
require_once "modules" . DIRECTORY_SEPARATOR . "visa" . DIRECTORY_SEPARATOR. "class" . DIRECTORY_SEPARATOR. "class_user_signatures.php";
$us = new UserSignatures();
if (!empty($user_id)) {
......@@ -63,8 +64,8 @@ abstract class class_users_Abstract extends Database
$line = $stmt->fetchObject();
/* MODIFICATION POUR LES SIGNATURES */
$query = "SELECT path_template FROM "
. _DOCSERVERS_TABLE_NAME
$query = "SELECT path_template FROM "
. _DOCSERVERS_TABLE_NAME
. " WHERE docserver_id = 'TEMPLATES'";
$stmt = $db->query($query);
$resDs = $stmt->fetchObject();
......@@ -74,8 +75,8 @@ abstract class class_users_Abstract extends Database
$pathToSignature = array();
foreach ($tab_sign as $sign) {
$path = $pathToDs . str_replace(
"#",
DIRECTORY_SEPARATOR,
"#",
DIRECTORY_SEPARATOR,
$sign['signature_path']
)
. $sign['signature_file_name'];
......@@ -101,51 +102,4 @@ abstract class class_users_Abstract extends Database
return false;
}
}
/**
* Return where clause security for user(include baskets)
*
*/
public function get_global_security() {
if (!empty($_SESSION['user']['UserId'])) {
require_once 'core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_security.php';
$sec = new security();
$coll_id = 'letterbox_coll';
//group clause
$group_clause = $sec->get_where_clause_from_coll_id($coll_id);
//baskets clause
$basketQuery = '';
for (
$ind_bask = 0;
$ind_bask < count($_SESSION['user']['baskets']);
$ind_bask++
) {
if (
$_SESSION['user']['baskets'][$ind_bask]['coll_id'] == $coll_id
) {
if(
isset($_SESSION['user']['baskets'][$ind_bask]['clause'])
&& trim($_SESSION['user']['baskets'][$ind_bask]['clause']) <> ''
) {
$basketQuery .= ' or ('
. $_SESSION['user']['baskets'][$ind_bask]['clause']
. ')';
}
}
}
if ($basketQuery <> '') {
$basketQuery = preg_replace('/^ or/', '', $basketQuery);
}
$global_clause = $group_clause . ' OR ' . $basketQuery;
return $global_clause;
} else {
return false;
}
}
}
<?php
/*
*
* Copyright 2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework 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.
*
* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
require_once 'apps/'. $_SESSION['config']['app_id'] .'/class/contacts_controler_Abstract.php';
/**
* Class for controling docservers objects from database
*/
class contacts_controler extends contacts_controler_Abstract
{
// custom
}
<?php
/*
*
* Copyright 2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework 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.
*
* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
//Loads the required class
try {
require_once 'core/class/class_request.php';
require_once 'core/core_tables.php';
require_once 'core/class/ObjectControlerAbstract.php';
require_once 'core/class/ObjectControlerIF.php';
} catch (Exception $e) {
echo $e->getMessage() . ' // ';
}
/**
* Class for controling docservers objects from database
*/
abstract class contacts_controler_Abstract extends ObjectControler implements ObjectControlerIF
{
/**
* Save given object in database.
* Return true if succeeded.
* @param unknown_type $object
* @return boolean
*/
function save($object)
{
return true;
}
/**
* Return object with given id
* if found.
* @param $object_id
*/
function get($object_id)
{
return true;
}
/**
* Delete given object from
* database.
* Return true if succeeded.
* @param unknown_type $object
* @return boolean
*/
function delete($object)
{
return true;
}
}
\ No newline at end of file
<?php
/*
* Copyright 2008,2015 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework 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.
*
* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
//Remove html tags to avoid empty space
$sessionTemplateContent = trim(str_replace(
array('&nbsp;','<p>','</p>'),
'',
$_SESSION['template_content']
));
$sessionTemplateContent = strip_tags($sessionTemplateContent);
$sessionTemplateContent = trim(preg_replace(
'/\s*/m',
'',
$sessionTemplateContent));
$sessionTemplateContent = utf8_encode(html_entity_decode($sessionTemplateContent));
$requestTemplateContent = utf8_encode(html_entity_decode(strip_tags($_REQUEST['template_content'])));
$sessionTemplateContent = trim(str_replace(
"Â",
"",
$sessionTemplateContent
));
$sessionTemplateContent = trim(str_replace(
"\n",
"",
$sessionTemplateContent
));
$sessionTemplateContent = trim(preg_replace(
'/\s+/',
'',
$sessionTemplateContent));
$sessionTemplateContent = trim(str_replace(
"\r",
"",
$sessionTemplateContent
));
$sessionTemplateContent = trim(str_replace(
"\t",
"",
$sessionTemplateContent
));
$requestTemplateContent = trim(str_replace(
"\n",
"",
$requestTemplateContent
));
$requestTemplateContent = trim(str_replace(
" ",
"",
$requestTemplateContent
));
$requestTemplateContent = trim(str_replace(
"\r",
"",
$requestTemplateContent
));
$requestTemplateContent = trim(str_replace(
"\t",
"",
$requestTemplateContent
));
if ($sessionTemplateContent == $requestTemplateContent || empty($sessionTemplateContent)) {
$_SESSION['template_content_same'] = true;
echo "{status : '1, responseText : same content ! '}";
} else {
$_SESSION['template_modified_content'] = $_REQUEST['template_content'];
$_SESSION['template_modified_content'] = str_replace('[dates]', date('d-m-Y'), $_SESSION['template_modified_content']);
$_SESSION['template_modified_content'] = str_replace('[time]', date('G:i:s'), $_SESSION['template_modified_content']);
echo "{status : '0, responseText : " . addslashes(functions::xssafe($_REQUEST['template_content'])) . "'}";
}
exit;
<?php
/*
* Copyright 2008,2009 Maarch
*
* This file is part of Maarch Framework.
*
* Maarch Framework 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.
*
* Maarch Framework 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 Maarch Framework. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @brief Script called by an ajax object to return the content of a javascript file
*
* Script called by an ajax object to return the content of a javascript file
*
* @file
* @author Claire Figueras <dev@maarch.org>
* @date $date$
* @version $Revision$
* @ingroup apps
*/
header('content-type: text/javascript');
if (empty($_REQUEST['scripts'])) {
echo '';
exit();
}
$authorizedPaths = ['change_doctype.js'];
$arr_scripts = explode('$$', $_REQUEST['scripts']);
for ($i=0; $i<count($arr_scripts ); $i++) {
if ($arr_scripts[$i] <> '') {
$arr_scripts[$i] = str_replace("\\", "", $arr_scripts[$i]);
$arr_scripts[$i] = str_replace("/", "", $arr_scripts[$i]);
$arr_scripts[$i] = str_replace("..", "", $arr_scripts[$i]);
if (in_array($arr_scripts[$i], $authorizedPaths)) {
$arr_scripts[$i] = 'modules/templates/js/' . $arr_scripts[$i];
}
echo file_get_contents($arr_scripts[$i]);
}
}
exit();
<?php
/**
* File : user_info.php
*
* Page to show all data on a maarch user
*
* @package Maarch Framework 3.0
* @version 3.0
* @since 10/2005
* @license GPL
* @author Claire Figueras <dev@maarch.org>
*/
$core_tools = new core_tools();
$core_tools->load_lang();
$core_tools->load_html();
$core_tools->load_header('', true, false);
$func = new functions();
$db = new Database();
if($_REQUEST['id'] == "")
{
echo '<script type="text/javascript">window.resizeTo(400, 300);</script>';
echo '<br/><br/><center>'._YOU_MUST_SELECT_USER.'</center><br/><br/><div align="center">
<input name="close" type="button" value="'._CLOSE.'" onclick="self.close();" class="button" />
</div>';
}
else
{
$stmt = $db->query("SELECT * FROM ".$_SESSION['tablename']['users']." WHERE user_id = ?", array($_REQUEST['id']));
if($stmt->rowCount() == 0)
{
$_SESSION['error'] = _THE_USER.' '._NOT_EXISTS;
$state = false;
}
else
{
$user_data = array();
$line = $stmt->fetchObject();
$user_data['ID'] = $func->show_string($line->user_id);
$user_data['LASTNAME'] = $func->show_string($line->lastname);
$user_data['FIRSTNAME'] = $func->show_string($line->firstname);
$user_data['PHONE'] = $func->show_string($line->phone);
$user_data['MAIL'] = $func->show_string($line->mail);
}
?>
<!-- <script type="text/javascript">window.resizeTo(500, 350);</script> -->
<div class="popup_content" align="center">
<br/>
<h2 align="center"><i class="fa fa-user fa-2x"></i> <?php echo _USER_DATA;?></h2> <br/>
<form name="frmuserdata" id="frmuserdata" method="post" action="#" class="forms addforms">
<p id="lastname_p">
<label for="lastname"><?php echo _LASTNAME;?> : </label>
<input name="lastname" type="text" id="lastname" value="<?php functions::xecho($func->show_str($user_data['LASTNAME']));?>" readonly="readonly"/>
</p>
<p id="firstname_p">
<label for="firstname"><?php echo _FIRSTNAME;?> : </label>
<input name="firstname" type="text" id="firstname" value="<?php functions::xecho($func->show_str($user_data['FIRSTNAME']));?>" readonly="readonly"/>
</p>
<p>
<label for="phone"><?php echo _PHONE;?> : </label>
<input name="phone" type="text" id="phone" value="<?php functions::xecho($func->show_str($user_data['PHONE']));?>" readonly="readonly"/>
</p>
<p>
<label for="mail"><?php echo _MAIL;?> : </label>
<input name="mail" type="text" id="mail" value="<?php functions::xecho($func->show_str($user_data['MAIL']));?>" readonly="readonly"/>
</p>
<?php
if($core_tools->is_module_loaded('entities'))
{
require_once('modules'.DIRECTORY_SEPARATOR.'entities'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_manage_entities.php');
$ent = new entity();
$entities = $ent->get_entities_of_user($_REQUEST['id']);
?>
<p>
<label for="entities"><?php echo _ENTITIES;?></label>
<select multiple="multiple" name="entities" size="7">
<?php for($i=0; $i<count($entities);$i++)
{
?><option value=""><?php
if($entities[$i]['PRIMARY'] == 'Y')
{
echo '<b>'.functions::xssafe($entities[$i]['LABEL']).'</b>';
}
else
{
echo functions::xssafe($entities[$i]['LABEL']);
}
?></option><?php
}?>
</select>
</p>
<?php
}
if (isset($from_iframe) && !$from_iframe) { ?>
<p class="buttons">
<input name="close" type="button" value="<?php echo _CLOSE;?>" onclick="self.close();" class="button" />
</p>
<?php
}
?>
</form >
</div>
<?php
}
$core_tools->load_js();
......@@ -286,11 +286,6 @@
<parameter name="display" value="true"/>
</requestDefinition>
<requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="id_identifier" >
<parameter name="page" value="user_info"/>
<parameter name="display" value="true"/>
</requestDefinition>
<requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="only_id" >
<parameter name="page" value="print"/>
<parameter name="display" value="true"/>
......@@ -312,23 +307,6 @@
<parameter name="display" value="true"/>
</requestDefinition>
<requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="get_content_js" >
<parameter name="page" value="get_content_js"/>
<parameter name="display" value="true"/>
</requestDefinition>
<requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="get_content_js" >
<parameter name="page" value="get_content_js"/>
</requestDefinition>
<requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="get_content_js" >
<parameter name="page" value="get_content_js"/>
</requestDefinition>
<requestDefinition method="GET" path="/apps/maarch_entreprise/index.php" validationRule="get_content_js" >
<parameter name="page" value="get_content_js"/>
</requestDefinition>
<requestDefinition method="POST" path="/apps/maarch_entreprise/index.php" validationRule="static_filename" >
<parameter name="filename" value="static"/>
<parameter name="display" value="true"/>
......
......@@ -505,10 +505,6 @@
<parameter name="param1" type="string" />
</validationRule>
<validationRule name="get_content_js" extends="standardForm" mode="error">
<parameter name="scripts" type="filename_secure" />
</validationRule>
<validationRule name="static_filename" extends="standardForm" mode="error">
<parameter name="filename" type="boolean" />
</validationRule>
......
......@@ -80,39 +80,6 @@ class users_controler extends ObjectControler implements ObjectControlerIF
}
}
public function getLastName($userId)
{
$db = new Database();
$query = "select lastname from " . USERS_TABLE ." WHERE user_id=?";
$result = $db->query($query, array($userId));
$lastname = $result->fetchObject();
if (isset($lastname)) {
return $lastname->lastname;
} else {
return null;
}
}
public function getFirstName($userId)
{
$db = new Database();
$query = "select firstname from " . USERS_TABLE ." WHERE user_id=?";
$result = $db->query($query, array($userId));
$firstname = $result->fetchObject();
if (isset($firstname)) {
return $firstname->firstname;
} else {
return null;
}
}
/**
* Returns an user object based on a user identifier with PDO
*
......@@ -138,46 +105,6 @@ class users_controler extends ObjectControler implements ObjectControlerIF
}
/**
* Returns all users (enabled by default) from the database in an array
* of user objects (ordered by id by default)
*
* @param $orderStr string Order string passed to the query
* ("order by user_id asc" by default)
* @param $enabledOnly bool if true returns only the enabled users,
* otherwise returns even the disabled (true by default)
* @return Array of user objects with properties from the database
*/
public function getAllUsers(
$orderStr='order by user_id asc',
$enabledOnly=true
) {
$db = new Database();
$query = 'select * from ' . USERS_TABLE .' ';
if ($enabledOnly) {
$query .= "where enabled = 'Y'";
}
$query .= $orderStr;
try {
$stmt = $db->query($query);
} catch (Exception $e) {
}
$users = array();
while ($res = $stmt->fetchObject()) {
$user = new users();
$tmpArray = array(
'user_id' => $res->user_id,
'firstname' => $res->firstname,
'lastname' => $res->lastname,
);
$user->setArray($tmpArray);
array_push($users, $user);
}
return $users;
}
/**
* Returns in an array all the groups associated with a user (user_id,
* group_id and role)
*
......
......@@ -29,15 +29,8 @@
* @version $Revision$
* @ingroup core
*/
if (! defined('ACTIONS_TABLE')) {
define('ACTIONS_TABLE', 'actions');
}
if (! defined('ACTIONS_CATEGORIES_TABLE_NAME')) {
define('ACTIONS_CATEGORIES_TABLE_NAME', 'actions_categories');
}