Beispiel #1
0
 /**
  * Get the HTML code for a Xoops\Form\Token object - provides a hidden token field
  * used in forms that do not use Xoops\Form elements
  *
  * @param string $name session token name
  *
  * @return string
  */
 public function getTokenHTML($name = 'XOOPS_TOKEN')
 {
     $token = new \Xoops\Form\Token($name);
     return $token->render();
 }
Beispiel #2
0
                               </button>
                               ' . $restore . '
                               <button class="ui-corner-all tooltip" type="button" onclick="$(\'#display_contenu\').hide();$(\'#display_form\').fadeIn(\'fast\');" title="' . XoopsLocale::A_CANCEL . '">
                                   <img src="' . system_AdminIcons('cancel.png') . '" alt="' . XoopsLocale::A_CANCEL . '" />
                               </button>
                               <div class="clear"></div>
                          </div>
                      </div>
                   </td>
               </tr>
               <tr>
                   <td><textarea id="code_mirror" name="templates" rows=24 cols=110>' . $content . '</textarea></td>
               </tr>
           </table>';
     $xoopsToken = new \Xoops\Form\Token();
     echo $xoopsToken->render();
     echo '<input type="hidden" name="path_file" value="' . $clean_path_file . '"><input type="hidden" name="file" value="' . trim($clean_file) . '"><input type="hidden" name="ext" value="' . $ext . '"></form>';
     break;
     // Restore backup file
 // Restore backup file
 case 'tpls_restore':
     $extensions = array('.tpl', '.html', '.htm', '.css');
     //check if the file is inside themes directory
     $valid_dir = stristr(realpath($_REQUEST['path_file']), realpath(\XoopsBaseConfig::get('root-path') . '/themes'));
     $old_file = $_REQUEST['path_file'] . '.back';
     $new_file = $_REQUEST['path_file'];
     $extension_verif = strrchr($new_file, '.');
     if ($valid_dir && in_array($extension_verif, $extensions) && XoopsLoad::fileExists($old_file) && XoopsLoad::fileExists($new_file)) {
         if (unlink($new_file)) {
             if (rename($old_file, $new_file)) {
                 echo $xoops->alert('info', SystemLocale::S_RESTORED);