[ghelda-devel] [61] Completely delete plugin Requests |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/ghelda-devel Archives
]
Revision: 61
Author: odyx
Date: 2009-07-21 20:58:43 +0200 (Tue, 21 Jul 2009)
Log Message:
-----------
Completely delete plugin Requests
Removed Paths:
-------------
trunk/plugins/Requests/config_core.php
trunk/plugins/Requests.php
Deleted: trunk/plugins/Requests/config_core.php
===================================================================
--- trunk/plugins/Requests/config_core.php 2009-07-21 18:58:41 UTC (rev 60)
+++ trunk/plugins/Requests/config_core.php 2009-07-21 18:58:43 UTC (rev 61)
@@ -1,27 +0,0 @@
-<?php
-/*
- * Ghelda - Gestion Hiérarchisée En Ligne D'Adresses
- * - Online Hierarchical Handling Of Adresses
- *
- * Copyright (C) 2009 Didier Raboud
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-// All fields values _must_ be lowercase due to MSDB2 weird handling of field names.
-
-// Required
-$conf['n_conditions_per_plugin'] = 1;
-
-?>
\ No newline at end of file
Deleted: trunk/plugins/Requests.php
===================================================================
--- trunk/plugins/Requests.php 2009-07-21 18:58:41 UTC (rev 60)
+++ trunk/plugins/Requests.php 2009-07-21 18:58:43 UTC (rev 61)
@@ -1,186 +0,0 @@
-<?php
-/*
- * Ghelda - Gestion Hiérarchisée En Ligne D'Adresses
- * - Online Hierarchical Handling Of Adresses
- *
- * Copyright (C) 2009 Didier Raboud
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-
-define('G_REQUESTS_URL_MODE','mode');
-define('G_REQUESTS_DEFAULT_MODE','list');
-define('G_REQUESTS_ID_NEW','-1');
-define('G_REQUESTS_ID','request_id');
-
-class Requests extends Plugin {
-
- // List of the modes
- private $modes = array('edit','list','new','del');
- // Actual mode
- private $mode;
-
- //! Constructor
- function __construct(&$parentRef,$name)
- {
- $to_return = parent::__construct(&$parentRef,$name);
- return $to_return;
- }
-
- function modesMenu()
- {
- $this->startTrad();
- $targets['Tname'] = T_('Requests');
- $targets['new']['name'] = T_('New');
- $targets['list']['name'] = T_('List');
- $this->stopTrad();
- return $targets;
- }
-
- function main()
- { $this->startTrad();
-
- // Take the mode from the URL or take the default mode
- $this->mode =
- array_key_exists(G_REQUESTS_URL_MODE,$this->url->querystring)
- ? $this->url->querystring[G_REQUESTS_URL_MODE]
- : G_REQUESTS_DEFAULT_MODE;
-
- // If the mode is not know, trigger an error
- if(array_search($this->mode,$this->modes) === false) {
- trigger_error(T_('Intrusion tentative detected: ').T_("Don't try to use undefined mode names!"), G_E_LOG);
- return false;
- }
-
- // Only execute if the user is authentified
- if($this->authH->getAuth()) {
- // From here, we are in know mode
- // Get the Id from a query or edit myself
- $request_id = array_key_exists(G_REQUESTS_ID,$_GET) ? $_GET[G_REQUESTS_ID] : G_REQUESTS_ID_NEW;
-
- switch($this->mode) {
- case 'edit':
- $this->m_edit($request_id,$this->fields);
- break;
- case 'list':
- $this->m_list();
- break;
- case 'new':
- $this->m_edit(G_REQUESTS_ID_NEW,$this->fields);
- break;
- case 'del':
- $this->m_del($request_id);
- break;
- }
- }
-
- $this->stopTrad();
- }
-
- function functionality($funcStr,$funcArgs = '')
- {
- switch($funcStr) {
- case "main":
- $this->main();
- break;
- }
- }
-
- private function m_edit($id,&$fieldsSpec)
- {
- // SELECT
- // FieldsList
- // `G_groups`.`group_id`,
- // `G_groups`.`type`,
- // `G_groups`.`name`,
- // `G_people_groups`.`people_group_id`,
- // `G_people_groups`.`group_id`,
- // `G_people_groups`.`start_date`,
- // `G_people_groups`.`end_date`,
- // `G_people_groups`.`role`
- // FROM
- // TablesList (exhaustive)
- // `G_people_groups`,
- // `G_groups`
- // WHERE
- // Conditions (linkers)
- // `G_people_groups`.`group_id` = `G_groups`.`group_id`
- // AND
- // Binders
- // `people_id` = '1'
- // ORDER BY
- // Ordering
- // `G_people_groups`.`start_date` DESC
- // Modification asked
-
- if($_POST[$this->configH['URL']['action']] == 'change') {
- $functionalityResult = $this->_parent->functionality('Requests.FormattedRequest', $_POST);
- }
-
- // This functionality expects an array with two keyed values:
- // "name" => Translated name of the plugin
- // "values" => keyed array of the various values
- $functionalityResult = $this->_parent->functionality('Requests.FieldsList');
-
- // Go along the plugins to mungle what they provided
- foreach($functionalityResult as $pluginName => $pFunctionalityResult){
- // For the selection of fields
- $fieldsSpec[$pluginName.'[]']['type'] = 'SELECT';
- $fieldsSpec[$pluginName.'[]']['name'] = $pFunctionalityResult['name'];
- $fieldsSpec[$pluginName.'[]']['multiple'] = true;
- // Go along all fields and attribute to each the name and the name only
- foreach($pFunctionalityResult['fieldsList'] as $fieldIdentifier => $fieldSpec){
- if( array_key_exists('noShow',$fieldSpec) ||
- array_key_exists('dontRequest', $fieldSpec) )
- continue;
- $name = $fieldSpec['name'];
- $fieldsSpec[$pluginName.'[]']['values'][$fieldIdentifier] = is_array($name) ? $name[0] : $name;
- }
- // Get the fieldNames
- $values = array(0 => '');
- $values = array_merge($values,$fieldsSpec[$pluginName.'[]']['values']);
-
- // For the selection of conditions on the fields
- for( $i = 0; $i < $this->configH[$this->name]['n_conditions_per_plugin']; $i++) {
- $fieldsSpec[$pluginName.'_condition_field['.$i.']'] = array(
- "type" => 'SELECT',
- "name" => sprintf(T_('Condition #%d'),$i+1),
- "multiple" => false,
- "values" => $values
- );
- // !!! BIG WARNING !!! This IS VULNERABLE TO SQL INJECTION.
- $fieldsSpec[$pluginName.'_condition_val['.$i.']'] = array(
- "type" => 'VARCHAR( 256 )',
- "name" => '',
- );
- }
- }
- // Create the index field and its value
- $fieldsSpec[G_REQUESTS_ID] = array(
- "restricted" => true,
- 'type' => 'INT( 10 )',
- 'noShow' => true
- );
- $fieldsValues[G_REQUESTS_ID] = G_REQUESTS_ID_NEW;
-
- $displayOptions['title'] = T_('New request');
- $displayOptions['id'] = 'Requests_edit';
- $displayOptions['command'] = T_('Create request');
- $displayOptions['target'] = $this->url->getURL();
- $displayOptions['action'] = 'change';
-
- $this->output->displayFields($fieldsSpec,$fieldsValues,$displayOptions,$this->name);
- }
-}
-?>
\ No newline at end of file