示例#1
0
 function printForm()
 {
     $table = '';
     if (self::isNeeded($this->_dir)) {
         if ($this->_loggedIn) {
             $display = "style='display:none'";
             $table = "<div><h4 style='display:inline'>FTP is in Use</h4>&nbsp; <a id='showFtp' class='btn-sm btn-primary' title='See FTP Details' data-trigger='hover' data-placement='top' data-toggle='popover' data-content='<p>FTP is needed to update your application. Your credentials and serer details are already stored, and are being used. If you would like to inspect or modify them, please click here.</p>'><i class='glyphicon glyphicon-zoom-in icon-white'></i> See FTP Details</a></div>";
         } else {
             $display = '';
         }
         if (empty($this->status)) {
             $btn = "<a href='' class='btn-sm btn-success' title='Your FTP credentials look fine and are saved in your database. If you modify them below, click on this button to check again.' data-toggle='tooltip'><i class='glyphicon glyphicon-thumbs-up'></i> All Okay</a>";
         } else {
             $btn = "<a href='' class='btn-sm btn-warning' title='Your FTP credentials do not look right. Please re-enter them and click on this button to check again.' data-toggle='tooltip'><i class='glyphicon glyphicon-thumbs-down'></i> Check Again</a>";
         }
         $options = array();
         $options['ftp_server'] = array('name' => __('FTP Server', 'easy-paypal'), 'value' => 'localhost', 'validator' => 'notNull', 'help' => __('Enter your FPT server name.', 'easy-paypal'), 'dataTpl' => 'none', 'dataMode' => '');
         if (defined('FTP_HOST')) {
             $options['ftp_server']['value'] = FTP_HOST;
         }
         $options['ftp_user'] = array('name' => __('FTP User Name', 'easy-paypal'), 'value' => '', 'validator' => 'notNull', 'help' => __('Enter your FPT user name.', 'easy-paypal'), 'dataTpl' => 'none', 'dataMode' => '');
         if (defined('FTP_USER')) {
             $options['ftp_user']['value'] = FTP_USER;
         }
         $options['ftp_password'] = array('name' => __('FTP Password', 'easy-paypal'), 'value' => '', 'validator' => 'notNull', 'help' => __('Enter your FPT password.', 'easy-paypal'), 'dataTpl' => 'none', 'dataMode' => '');
         if (defined('FTP_PASS')) {
             $options['ftp_password']['value'] = FTP_PASS;
             if (!$this->isReady) {
                 $this->status .= " (Click on Check Again to verify.)";
             }
         }
         if ($this->_showRootDir) {
             $options['ftp_rootdir'] = array('name' => __('FTP Root Directory', 'easy-paypal'), 'value' => '', 'help' => __('When you logon to your server using FTP, it puts you in a folder. In most cases, we can discover this folder automatically. So you can start by leaving this option empty, but may have to come back and enter the value if prompted later.', 'easy-paypal'), 'dataTpl' => 'none', 'dataMode' => '');
         }
         $table .= "<div id='ftp' {$display}><h4>FTP Details</h4><p>Looks like FTP is needed to update your application. Please provide or verify the FTP details below. Note that FTP details will be stored in your database in plain text.</p><p class='red'><strong>{$this->status}</strong>&nbsp;&nbsp;{$btn}</p><table class='table table-striped table-bordered responsive'><tbody>";
         foreach ($options as $pk => $option) {
             $dbVal = EzGA::getGenOption($pk);
             if (empty($dbVal)) {
                 EzGA::putGenOption($pk, $option['value']);
             }
             $table .= EzGA::renderOption($pk, $option);
         }
         $table .= "</tbody></table></div>";
         $table .= "<script>var xeditHanlder = 'ajax/options.php'; var xparams ={}; \$('#showFtp').click(function() { \$(this).parent().hide();\$('#ftp').fadeIn();});</script>";
     }
     return $table;
 }