Exemplo n.º 1
0
 public function run()
 {
     $iAccountID = $this->get('id');
     $oAccount = new m\Account();
     $aDetail = $oAccount->getAccountDetail($iAccountID);
     if (empty($aDetail)) {
         c\Router::redirect(c\Router::genURL('Home'));
     }
     $aFields = $oAccount->getAccountFields($iAccountID);
     $oUser = new m\User();
     $aDefaultPassword = $oUser->getDefaultPassword();
     $aEmails = $oUser->getEmails();
     foreach ($aFields as $k => $v) {
         $aFields[$k]['display'] = u\Str::partCover($v['value'], 2, 1);
     }
     sort($aFields);
     $aFieldNames = array_map(function ($v) {
         foreach ($v as $key => $value) {
             if ($key !== 'name') {
                 unset($v[$key]);
             }
         }
         return $v;
     }, $aFields);
     $aAccountAll = $oAccount->getAllAccount();
     $aSiteList = [];
     foreach ($aAccountAll as $aAccountDetail) {
         $aSiteList[] = ['name' => 'link:' . $aAccountDetail['name']];
     }
     $aData = ['page_title' => 'Open Sesame - ' . $aDetail['name'], 'app' => $aDetail, 'fields' => $aFields, 'form_action_add' => c\Router::genURL('AddField'), 'form_action_del' => c\Router::genURL('DeleteField'), 'form_action_updatefield' => c\Router::genURL('UpdateField'), 'form_action_updateaccount' => c\Router::genURL('UpdateAccount'), 'site_list' => json_encode($aSiteList), 'field_names' => json_encode($aFieldNames), 'default_password' => $aDefaultPassword['data'], 'emails' => $aEmails['data']];
     return $aData;
 }
Exemplo n.º 2
0
 public function run()
 {
     global $argv;
     if (!isset($argv[2])) {
         c\cecho('搜索词呢?', 'error');
         return false;
     }
     $aConfig = c\Config::get('dsn');
     u\DB::connect($aConfig['data']);
     $sKeyword = $argv[2];
     $aList = (new m\Search())->handle($sKeyword);
     $aNumberMapping = [];
     foreach ($aList as $iIndex => $aAccount) {
         $iIndexNumber = $iIndex + 1;
         $sAccountInfo = ' (' . $aAccount['rowid'] . ') ' . $aAccount['name'] . ' - http://' . $aAccount['value'];
         $sMsg = str_pad($iIndexNumber, 4) . $sAccountInfo;
         $aNumberMapping[$iIndexNumber] = $aAccount['rowid'];
         c\cecho($sMsg, 'notice');
     }
     c\cecho("你要搜索啥?(请输入行首序号)");
     $iNumber = trim(fread(STDIN, 5));
     if (empty($iNumber)) {
         return false;
     }
     while (!empty($iNumber) && !is_numeric($iNumber)) {
         c\cecho('What are you 弄啥累', 'error');
         c\cecho("你要搜索啥?(请输入行首序号)");
         $iNumber = trim(fread(STDIN, 5));
     }
     $iNumber = (int) $iNumber;
     if ($iNumber > 0 && isset($aNumberMapping[$iNumber])) {
         $iAccountID = $aNumberMapping[$iNumber];
         $oAccount = new m\Account();
         $aDetail = $oAccount->getAccountDetail($iAccountID);
         $aFields = $oAccount->getAccountFields($iAccountID);
         c\cecho($aDetail['name'], 'error');
         foreach ($aFields as $aField) {
             $sMsg = $aField['name'] . ' ---- ' . $aField['value'];
             c\cecho($sMsg, 'notice');
         }
     }
 }
Exemplo n.º 3
0
 public function run()
 {
     global $argv;
     if (!isset($argv[2])) {
         c\cecho('帐号ID是多少?', 'error');
         return false;
     }
     $aConfig = c\Config::get('dsn');
     u\DB::connect($aConfig['data']);
     $iAccountID = $argv[2];
     $oAccount = new m\Account();
     $aDetail = $oAccount->getAccountDetail($iAccountID);
     if (empty($aDetail)) {
         c\cecho('非法ID', 'error');
         return false;
     }
     $aFields = $oAccount->getAccountFields($iAccountID);
     c\cecho($aDetail['name'], 'error');
     foreach ($aFields as $aField) {
         $sMsg = $aField['name'] . ' ---- ' . $aField['value'];
         c\cecho($sMsg, 'notice');
     }
 }