コード例 #1
0
ファイル: Branch_Admin.php プロジェクト: HaldunA/phpwebsite
 /**
  * Form to create or edit a branch
  */
 public function edit_db($force = false)
 {
     $this->title = dgettext('branch', 'Setup branch database');
     $form = new PHPWS_Form('branch-form');
     $form->addHidden('module', 'branch');
     $form->addHidden('command', 'post_db');
     $form->addHidden('force', (int) $force);
     $form->addCheck('createdb', $this->createdb);
     $form->setLabel('createdb', dgettext('branch', 'Create new database'));
     $form->addSelect('dbtype', $this->db_list);
     $form->setMatch('dbtype', $this->dbtype);
     $form->setLabel('dbtype', dgettext('branch', 'Database syntax'));
     $form->addText('dbname', $this->dbname);
     $form->setLabel('dbname', dgettext('branch', 'Database name'));
     $form->addText('dbuser', $this->dbuser);
     $form->setLabel('dbuser', dgettext('branch', 'Permission user'));
     $form->addPassword('dbpass', $this->dbpass);
     $form->allowValue('dbpass');
     $form->setLabel('dbpass', dgettext('branch', 'User password'));
     $form->addText('dbprefix', $this->dbprefix);
     $form->setLabel('dbprefix', dgettext('branch', 'Table prefix'));
     $form->setSize('dbprefix', 5, 5);
     $form->addText('dbhost', $this->dbhost);
     $form->setLabel('dbhost', dgettext('branch', 'Database Host'));
     $form->setSize('dbhost', 40);
     $form->addText('dbport', $this->dbport);
     $form->setLabel('dbport', dgettext('branch', 'Connection Port'));
     $form->addTplTag('DB_LEGEND', dgettext('branch', 'Database information'));
     $form->addSubmit('plug', dgettext('branch', 'Use hub values'));
     $form->addSubmit('submit', dgettext('branch', 'Continue...'));
     $template = $form->getTemplate();
     $this->content = PHPWS_Template::process($template, 'branch', 'edit_db.tpl');
 }
コード例 #2
0
ファイル: Setup.php プロジェクト: HaldunA/phpwebsite
 public function databaseConfig()
 {
     $form = new PHPWS_Form();
     $form->addHidden('step', '2');
     $databases = array('mysqli' => 'MySQL', 'pgsql' => 'PostgreSQL');
     $formTpl['DBTYPE_DEF'] = dgettext('core', 'phpWebSite supports MySQL and PostgreSQL. Choose the type your server currently is running.');
     $formTpl['DBUSER_DEF'] = dgettext('core', 'This is the user name that phpWebSite will use to access its database.') . ' <br /><i>' . dgettext('core', 'Note: it is a good idea to give each phpWebSite installation its own user.') . '</i>';
     if (isset($this->messages['dbuser'])) {
         $formTpl['DBUSER_ERR'] = $this->messages['dbuser'];
     }
     $formTpl['DBPASS_DEF'] = dgettext('core', 'Enter the database\'s user password here.');
     if (isset($this->messages['dbpass'])) {
         $formTpl['DBPASS_ERR'] = $this->messages['dbpass'];
     }
     $formTpl['DBPREF_DEF'] = dgettext('core', 'If you are installing phpWebSite in a shared environment, you may assign a prefix to tables.<br />We recommend you run without one.');
     if (isset($this->messages['dbpref'])) {
         $formTpl['DBPREF_ERR'] = $this->messages['dbpref'];
     }
     $formTpl['DBHOST_DEF'] = dgettext('core', 'If your database is on the same server as your phpWebSite installation, leave this as &#x22;localhost&#x22;.') . '<br />' . dgettext('core', 'Otherwise, enter the ip or dns to the database server.');
     $formTpl['DBPORT_DEF'] = dgettext('core', 'If your host specification requires access via a specific port, enter it here.');
     $formTpl['DBNAME_DEF'] = dgettext('core', 'The database\'s name into which you are installing phpWebSite.') . '<br /><i>' . dgettext('core', 'Note: if you have not made this database yet, you should do so before continuing.') . '</i>';
     if (isset($this->messages['dbname'])) {
         $formTpl['DBNAME_ERR'] = $this->messages['dbname'];
     }
     $formTpl['TITLE'] = dgettext('core', 'Database configuration');
     $form->addSelect('dbtype', $databases);
     $form->setMatch('dbtype', $this->getConfigSet('dbtype'));
     $form->setLabel('dbtype', dgettext('core', 'Database Type'));
     $form->addText('dbuser', $this->getConfigSet('dbuser'));
     $form->setSize('dbuser', 20);
     $form->setLabel('dbuser', dgettext('core', 'Database User'));
     $form->addPassword('dbpass', $this->getConfigSet('dbpass'));
     $form->allowValue('dbpass');
     $form->setSize('dbpass', 20);
     $form->setLabel('dbpass', dgettext('core', 'Database Password'));
     $form->addText('dbprefix', $this->getConfigSet('dbprefix'));
     $form->setSize('dbprefix', 5, 5);
     $form->setLabel('dbprefix', dgettext('core', 'Table prefix'));
     $form->addText('dbhost', $this->getConfigSet('dbhost'));
     $form->setSize('dbhost', 20);
     $form->setLabel('dbhost', dgettext('core', 'Host Specification'));
     $form->addText('dbport', $this->getConfigSet('dbport'));
     $form->setSize('dbport', 6);
     $form->setLabel('dbport', dgettext('core', 'Host Specification Port'));
     $form->addText('dbname', $this->getConfigSet('dbname'));
     $form->setSize('dbname', 20);
     $form->setLabel('dbname', dgettext('core', 'Database Name'));
     $form->mergeTemplate($formTpl);
     $form->addSubmit('default_submit', dgettext('core', 'Continue'));
     $this->content = $this->createForm($form, 'databaseConfig.tpl');
     $this->title = dgettext('core', 'Configure phpWebSite');
     $this->display();
 }
コード例 #3
0
 /**
  * Signup form for new users
  */
 public static function signup_form($user, $message = NULL)
 {
     $form = new PHPWS_Form();
     $form->addHidden('module', 'users');
     $form->addHidden('action', 'user');
     $form->addHidden('command', 'submit_new_user');
     $form->addText('username', $user->getUsername());
     $form->setLabel('username', dgettext('users', 'Username'));
     $new_user_method = PHPWS_User::getUserSetting('new_user_method');
     $form->addPassword('password1', $user->getPassword());
     $form->allowValue('password1');
     $form->setLabel('password1', dgettext('users', 'Password'));
     $form->addPassword('password2', $user->getPassword());
     $form->allowValue('password2');
     $form->setLabel('password2', dgettext('users', 'Confirm'));
     $form->addText('email', $user->getEmail());
     $form->setLabel('email', dgettext('users', 'Email Address'));
     $form->setSize('email', 40);
     if (PHPWS_User::getUserSetting('graphic_confirm')) {
         $result = User_Form::confirmGraphic();
         if (PHPWS_Error::isError($result)) {
             PHPWS_Error::log($result);
         } else {
             $form->addTplTag('GRAPHIC', $result);
         }
     }
     $form->addSubmit('submit', dgettext('users', 'Sign up'));
     $template = $form->getTemplate();
     if (isset($message)) {
         foreach ($message as $tag => $error) {
             $template[$tag] = $error;
         }
     }
     $result = PHPWS_Template::process($template, 'users', 'forms/signup_form.tpl');
     return $result;
 }