Removing require_once

1.10.x
Julio Montoya 10 years ago
parent 1fd7dee3c4
commit a8fd964f96
  1. 1
      main/exercice/exercise.lib.php
  2. 3
      main/glossary/glossary_ajax_request.php
  3. 3
      main/glossary/index.php
  4. 2
      main/help/allowed_html_tags.php
  5. 3
      main/inc/lib/add_courses_to_session_functions.lib.php
  6. 25
      main/inc/lib/api.lib.php
  7. 1
      main/inc/lib/formvalidator/FormValidator.class.php
  8. 2
      main/inc/lib/formvalidator/Rule/Filetype.php
  9. 21
      main/inc/lib/message.lib.php
  10. 15
      main/inc/lib/social.lib.php
  11. 3
      main/inc/lib/sortable_table.class.php
  12. 30
      main/inc/lib/svg-edit/extensions/imagelib/groups.php
  13. 15
      main/inc/lib/svg-edit/extensions/imagelib/index.php
  14. 1
      main/inc/lib/userportal.lib.php
  15. 1
      main/install/index.php
  16. 5
      main/webservices/registration.soap.php
  17. 6
      plugin/dashboard/block_session/block_session.class.php
  18. 11
      plugin/dashboard/block_student/block_student.class.php
  19. 11
      plugin/dashboard/block_student_graph/block_student_graph.class.php
  20. 1
      plugin/kannelsms/config.php
  21. 7
      plugin/kannelsms/lib/kannelsms.lib.php
  22. 1
      plugin/openmeetings/config.php
  23. 1
      plugin/rss/plugin.php
  24. 8
      src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php

@ -735,7 +735,6 @@ function showQuestion(
// Question is a HOT_SPOT
//checking document/images visibility
if (api_is_platform_admin() || api_is_course_admin()) {
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
$course = api_get_course_info();
$doc_id = DocumentManager::get_document_id($course, '/images/'.$pictureName);
if (is_numeric($doc_id)) {

@ -11,9 +11,6 @@
// Including the global initialization file.
require_once '../inc/global.inc.php';
// Including additional libraries.
require_once api_get_path(LIBRARY_PATH).'glossary.lib.php';
/**
* Search a term and return description from a glossary.
*/

@ -11,9 +11,6 @@ $language_file = array('glossary', 'admin');
// Including the global initialization file.
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'glossary.lib.php';
require_once api_get_path(LIBRARY_PATH).'export.lib.inc.php';
require_once api_get_path(LIBRARY_PATH).'import.lib.php';
$current_course_tool = TOOL_GLOSSARY;

@ -15,8 +15,6 @@
$language_file = 'help';
require '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php';
require_once api_get_path(LIBRARY_PATH).'formvalidator/Rule/HTML.php';
header('Content-Type: text/html; charset='.api_get_system_encoding());
?>

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once dirname(__FILE__).'/xajax/xajax.inc.php';
//require_once (api_get_path(SYS_CODE_PATH).'admin/add_courses_to_session.php');
/**
* Class AddCourseToSession
*/

@ -477,6 +477,31 @@ define ('SKILL_TYPE_REQUIREMENT', 'required');
define ('SKILL_TYPE_ACQUIRED', 'acquired');
define ('SKILL_TYPE_BOTH', 'both');
// Message
define('MESSAGE_STATUS_NEW', '0');
define('MESSAGE_STATUS_UNREAD', '1');
//2 ??
define('MESSAGE_STATUS_DELETED', '3');
define('MESSAGE_STATUS_OUTBOX', '4');
define('MESSAGE_STATUS_INVITATION_PENDING', '5');
define('MESSAGE_STATUS_INVITATION_ACCEPTED', '6');
define('MESSAGE_STATUS_INVITATION_DENIED', '7');
define('MESSAGE_STATUS_WALL', '8');
define('MESSAGE_STATUS_WALL_DELETE', '9');
define('MESSAGE_STATUS_WALL_POST', '10');
// Images
define('IMAGE_WALL_SMALL_SIZE', 200);
define('IMAGE_WALL_MEDIUM_SIZE', 500);
define('IMAGE_WALL_BIG_SIZE', 2000);
define('IMAGE_WALL_SMALL', 'small');
define('IMAGE_WALL_MEDIUM', 'medium');
define('IMAGE_WALL_BIG', 'big');
// Social PLUGIN PLACES
define('SOCIAL_LEFT_PLUGIN', 1);
define('SOCIAL_CENTER_PLUGIN', 2);
define('SOCIAL_RIGHT_PLUGIN', 3);
define('CUT_GROUP_NAME', 50);
/**
* Inclusion of internationalization libraries

@ -604,7 +604,6 @@ EOT;
*/
function html_filter($html, $mode = NO_HTML)
{
require_once api_get_path(LIBRARY_PATH) . 'formvalidator/Rule/HTML.php';
$allowed_tags = HTML_QuickForm_Rule_HTML::get_allowed_tags($mode);
$cleaned_html = kses($html, $allowed_tags);
return $cleaned_html;

@ -1,8 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once 'HTML/QuickForm/Rule.php';
/**
* QuickForm rule to check if a filetype
*/

@ -1,27 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once api_get_path(LIBRARY_PATH).'online.inc.php';
define('MESSAGE_STATUS_NEW', '0');
define('MESSAGE_STATUS_UNREAD', '1');
//2 ??
define('MESSAGE_STATUS_DELETED', '3');
define('MESSAGE_STATUS_OUTBOX', '4');
define('MESSAGE_STATUS_INVITATION_PENDING', '5');
define('MESSAGE_STATUS_INVITATION_ACCEPTED', '6');
define('MESSAGE_STATUS_INVITATION_DENIED', '7');
define('MESSAGE_STATUS_WALL', '8');
define('MESSAGE_STATUS_WALL_DELETE', '9');
define('MESSAGE_STATUS_WALL_POST', '10');
// Images
define('IMAGE_WALL_SMALL_SIZE', 200);
define('IMAGE_WALL_MEDIUM_SIZE', 500);
define('IMAGE_WALL_BIG_SIZE', 2000);
define('IMAGE_WALL_SMALL', 'small');
define('IMAGE_WALL_MEDIUM', 'medium');
define('IMAGE_WALL_BIG', 'big');
/**
* Class MessageManager
*

@ -1,15 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
// PLUGIN PLACES
define('SOCIAL_LEFT_PLUGIN', 1);
define('SOCIAL_CENTER_PLUGIN', 2);
define('SOCIAL_RIGHT_PLUGIN', 3);
define('CUT_GROUP_NAME', 50);
//This require is necessary because we use constants that need to be loaded before the SocialManager class
require_once api_get_path(LIBRARY_PATH).'message.lib.php';
/**
* Class SocialManager
*
@ -1277,7 +1268,7 @@ class SocialManager extends UserManager
$messages[] = $row;
}
}
return $messages;
}
@ -1569,8 +1560,8 @@ class SocialManager extends UserManager
}
/**
* Delete messages delete logic
* @param int $id indice message to delete.
* @return status query
* @param int $id id message to delete.
* @return bool status query
*/
public static function deleteMessage($id)
{

@ -1,9 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
require_once 'pear/HTML/Table.php';
require_once 'pear/Pager/Pager.php';
/**
* This class allows you to display a sortable data-table. It is possible to
* split the data in several pages.

@ -3,10 +3,8 @@
* @author Juan Carlos Raña Trabado
* @since 25/september/2010
*/
//Chamilo load libraries
require_once '../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
require_once api_get_path(LIBRARY_PATH).'groupmanager.lib.php';
//Add security from Chamilo
api_protect_course_script();
@ -24,7 +22,7 @@ $group_web_path = api_get_path(WEB_COURSE_PATH).$course_info['path'].'/documen
//get all group files and folders
$docs_and_folders = DocumentManager::get_all_document_data($course_info, $groupdirpath, api_get_group_id(), null, $is_allowed_to_edit, false);
//get all group filenames
$array_to_search = is_array($docs_and_folders) ? $docs_and_folders : array();
@ -33,7 +31,7 @@ if (count($array_to_search) > 0) {
$all_files[] = basename($array_to_search[$key]['path']);
}
}
//get all svg and png group files
$accepted_extensions = array('.svg', '.png');
@ -61,23 +59,23 @@ $style .='</style>';
echo '<h2>'.get_lang('GroupSingle').': '.$group_properties['name'].'</h2>';
if (($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'], $_SESSION['_gid']))) || $group_properties['doc_state'] == 1){
if (!empty($png_svg_files)) {
echo '<h3>'.get_lang('SelectSVGEditImage').'</h3>';
echo '<ul>';
foreach($png_svg_files as $filename) {
$image = $group_disk_path.$filename;
foreach($png_svg_files as $filename) {
$image = $group_disk_path.$filename;
if (strpos($filename, "svg")){
$new_sizes['width'] = 60;
$new_sizes['height'] = 60;
}
else {
$new_sizes = api_resize_image($image, 60, 60);
}
}
echo '<li style="display:inline; padding:8px;">';
echo '<a href = "'.$group_web_path.$filename.'" alt="'.$filename.'" title="'.$filename.'">';
echo '<img src = "'.$group_web_path.$filename.'" width = "'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
echo '<img src = "'.$group_web_path.$filename.'" width = "'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
echo '</ul>';
}
@ -91,8 +89,8 @@ if (($group_properties['doc_state'] == 2 && ($is_allowed_to_edit || GroupManager
$('a').click(function() {
var href = this.href;
// Convert Non-SVG images to data URL first
// Convert Non-SVG images to data URL first
// (this could also have been done server-side by the library)
if(this.href.indexOf('.svg') === -1) {
@ -101,7 +99,7 @@ $('a').click(function() {
id: href
});
window.top.postMessage(meta_str, "*");
var img = new Image();
img.onload = function() {
var canvas = document.createElement("canvas");
@ -132,10 +130,10 @@ $('a').click(function() {
data = '|' + href + '|' + data;
// This is where the magic happens!
window.top.postMessage(data, "*");
}, 'html'); // 'html' is necessary to keep returned data as a string
}
return false;
});
</script>
</script>

@ -5,7 +5,6 @@
*/
//Chamilo load libraries
require_once '../../../../../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'document.lib.php';
//Add security from Chamilo
api_protect_course_script();
@ -62,7 +61,7 @@ if (!empty($png_svg_files)) {
echo '<ul>';
foreach($png_svg_files as $filename) {
$image=$disk_path.$filename;
if (strpos($filename, "svg")){
$new_sizes['width'] = 60;
$new_sizes['height'] = 60;
@ -70,7 +69,7 @@ if (!empty($png_svg_files)) {
else {
$new_sizes = api_resize_image($image, 60, 60);
}
echo '<li style="display:inline; padding:8px;"><a href="'.$web_path.$filename.'" alt "'.$filename.'" title="'.$filename.'"><img src="'.$web_path.$filename.'" width="'.$new_sizes['width'].'" height="'.$new_sizes['height'].'" border="0"></a></li>';
}
echo '</ul>';
@ -82,8 +81,8 @@ if (!empty($png_svg_files)) {
<script>
$('a').click(function() {
var href = this.href;
// Convert Non-SVG images to data URL first
// Convert Non-SVG images to data URL first
// (this could also have been done server-side by the library)
if(this.href.indexOf('.svg') === -1) {
@ -92,7 +91,7 @@ $('a').click(function() {
id: href
});
window.top.postMessage(meta_str, "*");
var img = new Image();
img.onload = function() {
var canvas = document.createElement("canvas");
@ -123,9 +122,9 @@ $('a').click(function() {
data = '|' + href + '|' + data;
// This is where the magic happens!
window.top.postMessage(data, "*");
}, 'html'); // 'html' is necessary to keep returned data as a string
}
return false;
});
</script>
</script>

@ -771,7 +771,6 @@ class IndexManager
function return_classes_block() {
$html = '';
if (api_get_setting('show_groups_to_users') == 'true') {
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
$usergroup = new Usergroup();
$usergroup_list = $usergroup->get_usergroup_by_user(api_get_user_id());
$classes = '';

@ -756,7 +756,6 @@ if (@$_POST['step2']) {
if ($installType == 'update') {
require_once api_get_path(LIBRARY_PATH).'fileUpload.lib.php';
remove_memory_and_time_limits();
database_server_connect();
// Initialization of the database connection encoding intentionaly is not done.

@ -319,7 +319,6 @@ function WSCreateUsers($params) {
if ($result) {
//echo "id returned";
$return = Database::insert_id();
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
if ($_configuration['multiple_access_urls']) {
if (api_get_current_access_url_id() != -1) {
UrlManager::add_user_to_url($return, api_get_current_access_url_id());
@ -521,7 +520,6 @@ function WSCreateUser($params) {
if ($result) {
//echo "id returned";
$return = Database::insert_id();
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
if ($_configuration['multiple_access_urls']) {
if (api_get_current_access_url_id() != -1) {
UrlManager::add_user_to_url($return, api_get_current_access_url_id());
@ -813,7 +811,6 @@ function WSCreateUsersPasswordCrypted($params) {
if ($result) {
//echo "id returned";
$return = Database::insert_id();
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
if ($_configuration['multiple_access_urls']) {
if (api_get_current_access_url_id() != -1) {
UrlManager::add_user_to_url($return, api_get_current_access_url_id());
@ -1056,8 +1053,6 @@ function WSCreateUserPasswordCrypted($params) {
if ($result) {
$return = Database::insert_id();
//Multiple URL
require_once api_get_path(LIBRARY_PATH).'urlmanager.lib.php';
$url_id = api_get_current_access_url_id();
UrlManager::add_user_to_url($return, $url_id);
if ($debug) error_log("Adding user_id = $return to URL id $url_id ");

@ -6,11 +6,6 @@
* @author Christian Fasanando
*/
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
/**
* This class is used like controller for this session block plugin,
* the class name must be registered inside path.info file
@ -19,7 +14,6 @@ require_once api_get_path(LIBRARY_PATH).'course_description.lib.php';
*/
class BlockSession extends Block
{
private $user_id;
private $sessions;
private $path;

@ -6,16 +6,6 @@
* @author Christian Fasanando
*/
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
/**
* This class is used like controller for student block plugin,
* the class name must be registered inside path.info file (e.g: controller = "BlockStudent"), so dashboard controller will be instantiate it
@ -23,7 +13,6 @@ require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
*/
class BlockStudent extends Block
{
private $user_id;
private $students;
private $path;

@ -9,17 +9,6 @@
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* required files for getting data
*/
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/gradebookitem.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/evaluation.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/result.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/linkfactory.class.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/be/category.class.php';
use CpChart\Classes\pData as pData;
use CpChart\Classes\pImage as pImage;
use CpChart\Classes\pCache as pCache;

@ -8,7 +8,6 @@
* @author Imanol Losada <imanol.losada@beeznest.com>
*/
require_once __DIR__ . '/../../main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'plugin.class.php';
require_once 'lib/kannelsms.lib.php';
require_once 'vendor/kannelsms_api.php';

@ -4,7 +4,7 @@
/**
* Class Kannelsms
* This script handles incoming SMS information, process it and sends an SMS if everything is right
*
*
* @package chamilo.plugin.kannelsms.lib
* @author Imanol Losada <imanol.losada@beeznest.com>
*
@ -42,14 +42,11 @@ class Kannelsms
/**
* getMobilePhoneNumberById (retrieves a user mobile phone number by user id)
* @param int User id
* @param int $userId User id
* @return int User's mobile phone number
*/
private function getMobilePhoneNumberById($userId)
{
require_once api_get_path(LIBRARY_PATH).'extra_field.lib.php';
require_once api_get_path(LIBRARY_PATH).'extra_field_value.lib.php';
$mobilePhoneNumberExtraField = new ExtraField('user');
$mobilePhoneNumberExtraField = $mobilePhoneNumberExtraField->get_handler_field_info_by_field_variable('mobile_phone_number');

@ -4,7 +4,6 @@
/* Openmeetings parameters that will be registered in the course settings */
require_once '../../main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'plugin.class.php';
require_once 'lib/openmeetings.class.php';
require_once 'lib/openmeetings_plugin.class.php';

@ -9,7 +9,6 @@
* @author Laurent Opprecht
*/
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
require_once dirname(__FILE__) . '/lib/rss_plugin.class.php';
$plugin_info = RssPlugin::create()->get_info();

@ -11,6 +11,10 @@ use Chamilo\CoreBundle\Component\Editor\Toolbar;
*/
class Basic extends Toolbar
{
/**
* Default plugins that will be use in all toolbars
* @var array
*/
public $defaultPlugins = array(
'oembed',
'video',
@ -19,6 +23,10 @@ class Basic extends Toolbar
'justify'
);
/**
* Plugins this toolbar
* @var array
*/
public $plugins = array();
/**

Loading…
Cancel
Save