Example #1
0
         $origplugin = $helpfile['plugin'];
     }
 }
 $selectionlabel = '<code class="path">';
 //$selectionlabel .= $strfilestoredin;
 $selectionlabel .= $uselocal ? "{$currentlang}_local" : $currentlang;
 $selectionlabel .= '/help/</code>';
 popup_form("{$CFG->wwwroot}/{$CFG->admin}/lang.php?mode=helpfiles&amp;currentfile=", $menufiles, "choosefile", $currentfile, $strchoosefiletoedit, '', '', false, 'self', $selectionlabel);
 helpbutton('langswitchstorage', $strfilestoredinhelp, 'moodle');
 print_box_end();
 if (!empty($currentfile)) {
     if (!file_exists("{$saveto}/{$currentfile}")) {
         $dbg .= "File does not exist: {$saveto}/{$currentfile}\n";
         //check if directory exist
         if (!file_exists(dirname("{$saveto}/{$currentfile}"))) {
             if (!lang_make_directory(dirname("{$saveto}/{$currentfile}"))) {
                 echo 'Cannot create directory: ' . dirname("{$saveto}/{$currentfile}");
             }
         }
         //
         // file doesn't exist - let's check webserver's permission to create it
         //
         if (!@touch("{$saveto}/{$currentfile}")) {
             //
             // webserver is unable to create new file
             //
             notify(get_string('filemissing', '', "{$saveto}/{$currentfile}"));
             notify(get_string('makeeditable', '', "{$saveto}/{$currentfile}"));
             $editable = false;
         } else {
             //
Example #2
0
 if (!file_exists($langbase)) {
     if (!lang_make_directory($langbase)) {
         error('ERROR: Could not create base lang directory ' . $langbase);
     } else {
         echo '<div class="notifysuccess">Created directory ' . $langbase . '</div>' . "<br />\n";
     }
 }
 if (!$uselocal && !file_exists($langdir)) {
     if (!lang_make_directory($langdir)) {
         error('ERROR: Could not create directory ' . $langdir);
     } else {
         echo '<div class="notifysuccess">Created directory ' . $langdir . '</div>' . "<br />\n";
     }
 }
 if ($uselocal && !file_exists($locallangdir)) {
     if (!lang_make_directory($locallangdir)) {
         echo '<div class="notifyproblem">ERROR: Could not create directory ' . $locallangdir . '</div>' . "<br />\n";
         $uselocal = 0;
     } else {
         echo '<div class="notifysuccess">Created directory ' . $locallangdir . '</div>' . "<br />\n";
     }
 }
 if (isset($_POST['currentfile'])) {
     // Save a file
     if (!confirm_sesskey()) {
         error(get_string('confirmsesskeybad', 'error'));
     }
     $newstrings = array();
     foreach ($_POST as $postkey => $postval) {
         $stringkey = lang_file_string_key($postkey);
         $newstrings[$stringkey] = $postval;