当前位置: 首页>>代码示例>>PHP>>正文


PHP User::setup方法代码示例

本文整理汇总了PHP中Model\User::setup方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setup方法的具体用法?PHP User::setup怎么用?PHP User::setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model\User的用法示例。


在下文中一共展示了User::setup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: install

 public function install($db_type)
 {
     $f3 = \Base::instance();
     $db_type = strtoupper($db_type);
     if ($db = storage::instance()->get($db_type)) {
         $f3->set('DB', $db);
     } else {
         $f3->error(256, 'no valid DB specified');
     }
     // setup the models
     \Model\Post::setup();
     \Model\Tag::setup();
     \Model\Comment::setup();
     \Model\User::setup();
     // create demo admin user
     $user = new \Model\User();
     $user->load(array('username = ?', 'admin'));
     if ($user->dry()) {
         $user->username = 'admin';
         $user->name = 'Administrator';
         $user->password = 'fabulog';
         $user->save();
         \Flash::instance()->addMessage('Admin User created,' . ' username: admin, password: fabulog', 'success');
     }
     \Flash::instance()->addMessage('Setup complete', 'success');
 }
开发者ID:xfra35,项目名称:fabulog,代码行数:26,代码来源:setup.php

示例2: install

 /**
  * Installs tables with default user
  * @param $db_type
  */
 public function install($db_type)
 {
     $f3 = \Base::instance();
     $db_type = strtoupper($db_type);
     if ($db = DBHandler::instance()->get($db_type)) {
         $f3->set('DB', $db);
     } else {
         $f3->error(256, 'no valid Database Type specified');
     }
     // setup the models
     \Model\User::setup();
     \Model\Payload::setup();
     \Model\Webot::setup();
     // create demo admin user
     $user = new \Model\User();
     $user->load(array('username = ?', 'mth3l3m3nt'));
     if ($user->dry()) {
         $user->username = 'mth3l3m3nt';
         $user->name = 'Framework Administrator';
         $user->password = 'mth3l3m3nt';
         $user->email = 'placeholder_mail@mth3l3m3nt.com';
         $user->save();
         //migrate payloads successfully
         $payload_file = $f3->ROOT . $f3->BASE . '/db_dump_optional/mth3l3m3nt_payload';
         if (file_exists($payload_file)) {
             $payload = new \Model\Payload();
             $payload_file_data = $f3->read($payload_file);
             $payloadarray = json_decode($payload_file_data, true);
             foreach ($payloadarray as $payloaddata) {
                 $payload->pName = $payloaddata['pName'];
                 $payload->pType = $payloaddata['pType'];
                 $payload->pCategory = $payloaddata['pCategory'];
                 $payload->pDescription = $payloaddata['pDescription'];
                 $payload->payload = $payloaddata['payload'];
                 $payload->save();
                 //ensures values set to null before continuing update
                 $payload->reset();
             }
             //migtate payloads
             \Flash::instance()->addMessage('Payload StarterPack: ,' . 'All Starter Pack Payloads added New database', 'success');
         } else {
             \Flash::instance()->addMessage('Payload StarterPack: ,' . 'StarterPack Database not Found no payloads installed ', 'danger');
         }
         \Flash::instance()->addMessage('Admin User created,' . ' username: mth3l3m3nt, password: mth3l3m3nt', 'success');
     }
     \Flash::instance()->addMessage('New Database Setup Completed', 'success');
 }
开发者ID:theralfbrown,项目名称:OWASP-mth3l3m3nt-framework,代码行数:51,代码来源:setup.php


注:本文中的Model\User::setup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。