コード例 #1
0
 function install(&$pluginAPI, &$dbDriver, $siteDefaultLanguage)
 {
     $uM = new UserManager($dbDriver);
     $uM->installAllTables();
     $pageM = new pageManager($dbDriver);
     $t =& $pluginAPI->getI18NManager();
     $site = $pageM->getSitePage();
     $myaccount = $pageM->newPage();
     $regform = $pageM->newPage();
     $lostpass = $pageM->newPage();
     $regform->initFromArray(array('name' => 'MorgOS_RegisterForm', 'parent_page_id' => $site->getID(), 'action' => 'userRegisterForm', 'place_in_menu' => MORGOS_MENU_INVISIBLE, 'plugin_id' => MORGOS_USER_PLUGINID));
     $myaccount->initFromArray(array('name' => 'MorgOS_User_MyAccount', 'parent_page_id' => $site->getID(), 'action' => 'userMyAccount', 'place_in_menu' => MORGOS_MENU_INVISIBLE, 'plugin_id' => MORGOS_USER_PLUGINID));
     $lostpass->initFromArray(array('name' => 'MorgOS_User_ForgotPasswordForm', 'parent_page_id' => $site->getID(), 'action' => 'userForgotPasswordForm', 'place_in_menu' => MORGOS_MENU_INVISIBLE, 'plugin_id' => MORGOS_USER_PLUGINID));
     $pageM->addPageToDatabase($regform);
     $pageM->addPageToDatabase($myaccount);
     $pageM->addPageToDatabase($lostpass);
     $tMyAccount = $pageM->newTranslatedPage();
     $tRegForm = $pageM->newTranslatedPage();
     $tLostPass = $pageM->newTranslatedPage();
     $tMyAccount->initFromArray(array('language_code' => $siteDefaultLanguage, 'translated_title' => $t->translate('My Account'), 'translated_content' => $t->translate('This is your account page.')));
     $tRegForm->initFromArray(array('language_code' => $siteDefaultLanguage, 'translated_title' => $t->translate('Registration'), 'translated_content' => $t->translate('Give up all your user details in order to registrate to this site.')));
     $tLostPass->initFromArray(array('language_code' => $siteDefaultLanguage, 'translated_title' => $t->translate('Recover Passwrd'), 'translated_content' => $t->translate('Fill in your password OR your email. Your new password will be sent to you.')));
     $regform->addTranslation($tRegForm);
     $myaccount->addTranslation($tMyAccount);
     $lostpass->addTranslation($tLostPass);
     $this->_adminPlugin->install($pluginAPI, $dbDriver, $siteDefaultLanguage);
     // install 2 morgos -> user extensions
     $skinTable = new dbField('skin', DB_TYPE_STRING, 40);
     $langTable = new dbField('contentLanguage', DB_TYPE_STRING, 100);
     $uM->addExtraFieldForTable('users', $skinTable);
     $uM->addExtraFieldForTable('users', $langTable);
     $anonUser = $uM->getAnonymousUser();
     $anonGroup = $anonUser->getUserGroup();
     $anonGroup->assignPermission('view_page_' . $myaccount->getID(), false);
 }