diff --git a/main/exercice/Hpdownload.php b/main/exercice/Hpdownload.php index 6b047ac8a6..2ff7136582 100644 --- a/main/exercice/Hpdownload.php +++ b/main/exercice/Hpdownload.php @@ -137,7 +137,7 @@ if ($content_type == 'text/html') { $newcontent = str_replace($mit, $js_content, $content); $prehref = "javascript:void(0);"; - $posthref = $_configuration['root_web']."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; + $posthref = api_get_path(WEB_CODE_PATH)."exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid; $newcontent = str_replace($prehref, $posthref, $newcontent); diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index b0a8de05b7..ed0b816ce3 100644 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -362,7 +362,7 @@ class UserManager $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstName, $lastName)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $loginName ."\n". get_lang('Pass')." : ".stripslashes($original_password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } } else { - $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstName, $lastName)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $loginName ."\n". get_lang('Pass')." : ".stripslashes($original_password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); + $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstName, $lastName)).",\n\n".get_lang('YouAreReg')." ".api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $loginName ."\n". get_lang('Pass')." : ".stripslashes($original_password)."\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". api_get_path(WEB_PUBLIC_PATH) ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } /* MANAGE EVENT WITH MAIL */ @@ -816,7 +816,7 @@ class UserManager $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username . (($reset_password > 0) ? "\n". get_lang('Pass')." : ".stripslashes($original_password) : "") . "\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $url['url'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } } else { - $emailbody=get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username . (($reset_password > 0) ? "\n". get_lang('Pass')." : ".stripslashes($original_password) : "") . "\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". $_configuration['root_web'] ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); + $emailbody=get_lang('Dear')." ".stripslashes(api_get_person_name($firstname, $lastname)).",\n\n".get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".get_lang('Username')." : ". $username . (($reset_password > 0) ? "\n". get_lang('Pass')." : ".stripslashes($original_password) : "") . "\n\n" .get_lang('Address') ." ". api_get_setting('siteName') ." ". get_lang('Is') ." : ". api_get_path(WEB_PUBLIC_PATH) ."\n\n". get_lang('Problem'). "\n\n". get_lang('Formula').",\n\n".api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". get_lang('Manager'). " ".api_get_setting('siteName')."\nT. ".api_get_setting('administratorTelephone')."\n" .get_lang('Email') ." : ".api_get_setting('emailAdministrator'); } @api_mail_html($recipient_name, $email, $emailsubject, $emailbody, $sender_name, $email_admin); } diff --git a/main/user/user_add.php b/main/user/user_add.php index 750fc08a52..b9e8a35464 100644 --- a/main/user/user_add.php +++ b/main/user/user_add.php @@ -163,8 +163,7 @@ if($register) { MAIL NOTIFICATION TO NEW USER ----------------------------*/ - if ($platformRegSucceed) - { + if ($platformRegSucceed) { $emailto = "$lastname_form $firstname_form <$email_form>"; $emailfromaddr = $administratorEmail; @@ -181,7 +180,7 @@ if($register) { $sender_name = api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'), null, PERSON_NAME_EMAIL_ADDRESS); $email_admin = api_get_setting('emailAdministrator'); - $portal_url = $_configuration['root_web']; + $portal_url = api_get_path(WEB_PUBLIC_PATH); if ($_configuration['multiple_access_urls']) { $access_url_id = api_get_current_access_url_id(); if ($access_url_id != -1 ){ diff --git a/tests/test_webservices.php b/tests/test_webservices.php index ebaf899546..13fe606122 100644 --- a/tests/test_webservices.php +++ b/tests/test_webservices.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** * Set of unit tests for the web services - * + * * @author Guillaume Viguier * @package chamilo.tests */ @@ -19,20 +19,20 @@ require_once(dirname(__FILE__).'/simpletest/autorun.php'); */ class TestSoapWebService extends UnitTestCase { protected $_secret_key; - + protected $_encrypt_method; - + protected $_client; - + public function __construct() { $configuration = $GLOBALS['_configuration']; $security_key = $configuration['security_key']; $ip_address = '::1'; $this->_secret_key = sha1($ip_address.$security_key); $this->_encrypt_method = $configuration['password_encryption']; - $this->_client = new SoapClient($configuration['root_web'].'main/webservices/soap.php?wsdl'); + $this->_client = new SoapClient(api_get_path(WEB_CODE_PATH).'webservices/soap.php?wsdl'); } - + protected function getUserArray() { $user = array( 'firstname' => 'Guillaume', @@ -51,7 +51,7 @@ class TestSoapWebService extends UnitTestCase { 'extras' => array()); return $user; } - + protected function getCourseArray() { $course = array( 'title' => 'My test course', @@ -66,7 +66,7 @@ class TestSoapWebService extends UnitTestCase { 'extras' => array()); return $course; } - + protected function getSessionArray() { $end_date = date('Y') + 1; $end_date .= '-'.date('m-d'); @@ -80,33 +80,33 @@ class TestSoapWebService extends UnitTestCase { 'visibility' => 1, 'user_id_field_name' => 'chamilo_user_id', 'user_id_value' => '1', - 'session_id_field_name' => 'chamilo_session_id', + 'session_id_field_name' => 'chamilo_session_id', 'session_id_value' => '', 'extras' => array()); return $session; } - + protected function soapCall($method, $arguments) { return $this->_client->__soapCall($method, $arguments); } - + protected function createUser() { $user = $this->getUserArray(); $result = $this->soapCall('WSUser.CreateUser', array_merge(array('secret_key' => $this->_secret_key), $user)); return $result; } - + protected function createCourse() { $course = $this->getCourseArray(); $result = $this->soapCall('WSCourse.CreateCourse', array_merge(array('secret_key' => $this->_secret_key), $course)); return $result; } - + public function testTest() { $result = $this->soapCall('WS.test', array()); $this->assertEqual($result, "success"); } - + public function testInvalidKey() { $secret_key = 'invalid'; try { @@ -116,7 +116,7 @@ class TestSoapWebService extends UnitTestCase { $this->pass(); } } - + public function testCreateUser() { $user = $this->getUserArray(); $result = $this->soapCall('WSUser.CreateUser', array_merge(array('secret_key' => $this->_secret_key), $user)); @@ -124,7 +124,7 @@ class TestSoapWebService extends UnitTestCase { //Delete user created $this->soapCall('WSUser.DeleteUser', array('secret_key' => $this->_secret_key, 'user_id_field_name' => 'chamilo_user_id', 'user_id_value' => $result)); } - + public function testCreateUserEncrypted() { $user = $this->getUserArray(); $user['encrypt_method'] = $this->_encrypt_method; @@ -139,7 +139,7 @@ class TestSoapWebService extends UnitTestCase { //Delete user created $this->soapCall('WSUser.DeleteUser', array('secret_key' => $this->_secret_key, 'user_id_field_name' => 'chamilo_user_id', 'user_id_value' => $result)); } - + public function testCourseCreation() { $course = $this->getCourseArray(); $result = $this->soapCall('WSCourse.CreateCourse', array_merge(array('secret_key' => $this->_secret_key), $course)); @@ -147,7 +147,7 @@ class TestSoapWebService extends UnitTestCase { // Delete course created $this->soapCall('WSCourse.DeleteCourse', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id', 'course_id_value' => $result)); } - + /*public function testCourseSubscriptionAndUnsubscription() { //$course_id = $this->createCourse(); //$user_id = $this->createUser(); @@ -155,7 +155,7 @@ class TestSoapWebService extends UnitTestCase { //$this->soapCall('WSCourse.SubscribeUserToCourse', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id', 'course_id_value' => 8, 'user_id_field_name' => 'chamilo_user_id', 'user_id_value' => 38, 'status' => 1)); //$this->soapCall('WSCourse.UnsubscribeUserFromCourse', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id', 'course_id_value' => 8, 'user_id_field_name' => 'chamilo_user_id', 'user_id_value' => 38)); }*/ - + /*public function testCourseDescriptions() { //$this->soapCall('WSCourse.EditCourseDescription', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id', 'course_id_value' => 8, 'course_desc_id' => 1, 'course_desc_title' => 'My description', 'course_desc_content' => 'This is my new description')); //$result = $this->soapCall('WSCourse.GetCourseDescriptions', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id', 'course_id_value' => 8)); @@ -163,20 +163,20 @@ class TestSoapWebService extends UnitTestCase { $result = $this->soapCall('WSCourse.ListCourses', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id')); var_dump($result); }*/ - + public function testSessionCreation() { $session = $this->getSessionArray(); $result = $this->soapCall('WSSession.CreateSession', array_merge(array('secret_key' => $this->_secret_key), $session)); $this->assertIsA($result, 'int'); $this->soapCall('WSSession.DeleteSession', array('secret_key' => $this->_secret_key, 'session_id_field_name' => 'chamilo_session_id', 'session_id_value' => $result)); } - + /*public function testUserSessionSubscriptionAndUnsubscription() { $this->soapCall('WSSession.UnsubscribeCourseFromSession', array('secret_key' => $this->_secret_key, 'course_id_field_name' => 'chamilo_course_id', 'course_id_value' => 8, 'session_id_field_name' => 'chamilo_session_id', 'session_id_value' => 3)); //$this->soapCall('WSSession.UnsubscribeUserFromSession', array('secret_key' => $this->_secret_key, 'user_id_field_name' => 'chamilo_user_id', 'user_id_value' => 38, 'session_id_field_name' => 'chamilo_session_id', 'session_id_value' => 3)); }*/ - - + + }