|
1 | 1 | <?php |
2 | | -/* For licensing terms, see /license.txt */ |
3 | | - |
4 | | -/** |
5 | | - * Tests presence of course directories. |
6 | | - * |
7 | | - * @package vchamilo |
8 | | - * @category plugin |
9 | | - * |
10 | | - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL |
11 | | - */ |
12 | | - |
13 | | -// Loading configuration. |
14 | | -require_once __DIR__.'/../../../main/inc/global.inc.php'; |
15 | | - |
16 | | -api_protect_admin_script(); |
17 | | - |
18 | | -$plugin = VChamiloPlugin::create(); |
19 | | - |
20 | | -// Retrieve parameters for database connection test. |
21 | | -$dataroot = $_REQUEST['dataroot']; |
22 | | - |
23 | | -$absalternatecourse = Virtual::getConfig('vchamilo', 'course_real_root'); |
24 | | -if (!empty($absalternatecourse)) { |
25 | | - // this is the relocated case |
26 | | - $coursedir = str_replace('//', '/', $absalternatecourse.'/'.$dataroot); |
27 | | -} else { |
28 | | - // this is the standard local case |
29 | | - $coursedir = api_get_path(SYS_PATH).$dataroot; |
30 | | -} |
31 | | - |
32 | | -if (is_dir($coursedir)) { |
33 | | - $DIR = opendir($coursedir); |
34 | | - $cpt = 0; |
35 | | - $hasfiles = false; |
36 | | - while (($file = readdir($DIR)) && !$hasfiles) { |
37 | | - if (!preg_match("/^\\./", $file)) { |
38 | | - $hasfiles = true; |
39 | | - } |
40 | | - } |
41 | | - closedir($DIR); |
42 | | - |
43 | | - if ($hasfiles) { |
44 | | - echo '<div class="error">'.$plugin->get_lang('datapathnotavailable').'</div>'; |
45 | | - } else { |
46 | | - echo '<div class="success">'.$plugin->get_lang('datapathavailable').'</div>'; |
47 | | - } |
48 | | - echo stripslashes($coursedir); |
49 | | -} else { |
50 | | - if (@mkdir($coursedir, 02777, true)) { |
51 | | - echo '<div class="success">'.$plugin->get_lang('datapathcreated').'</div>'; |
52 | | - } else { |
53 | | - echo '<div class="error">'.$plugin->get_lang('couldnotcreatedataroot').'</div>'; |
54 | | - } |
55 | | - echo stripslashes($coursedir); |
56 | | -} |
57 | | - |
58 | | -echo "</p>"; |
59 | | - |
60 | | -$closestr = $plugin->get_lang('closewindow'); |
61 | | -echo "<center>"; |
62 | | -echo "<input class='btn' type=\"button\" name=\"close\" value=\"$closestr\" onclick=\"self.close();\" />"; |
63 | | -echo "</center>"; |
| 2 | +// Deprecated and vulnerable. Blanked as substitute to removal due to minor version update method. |
| 3 | +exit; |
0 commit comments