public function run() { $db = Loader::db(); Cache::disableLocalCache(); Loader::model('attribute/categories/collection'); Loader::model('attribute/categories/file'); Loader::model('attribute/categories/user'); $collectionErrors = array(); $fileErrors = array(); $userErrors = array(); //add the new collection attribute keys $this->installCoreAttributeItems(); $dict = NewDataDictionary($db->db, DB_TYPE); $tables = $db->MetaTables(); if (in_array('_CollectionAttributeKeys', $tables)) { $collectionErrors = $this->upgradeCollectionAttributes(); } if (in_array('_FileAttributeKeys', $tables)) { $fileErrors = $this->upgradeFileAttributes(); } if (in_array('_UserAttributeKeys', $tables)) { $userErrors = $this->upgradeUserAttributes(); } $cak=CollectionAttributeKey::getByHandle('exclude_sitemapxml'); if (!is_object($cak)) { $cak = CollectionAttributeKey::add('exclude_sitemapxml', t('Exclude From sitemap.xml'), true, null, 'BOOLEAN'); } //change the page/tab name of the dashboard users registration page $dashboardRegistrationPage=Page::getByPath('/dashboard/users/registration'); if( intval($dashboardRegistrationPage->cID) ) $dashboardRegistrationPage->update(array('cName'=>t('Login & Registration'))); Config::save('LOGIN_ADMIN_TO_DASHBOARD', 1); //profile friends page install Loader::model('single_page'); $friendsPage=Page::getByPath('/profile/friends'); if( !intval($friendsPage->cID)) { SinglePage::add('/profile/friends'); } $membersPage =Page::getByPath('/members'); if( !intval($membersPage->cID)) { SinglePage::add('/members'); } $messagesPage =Page::getByPath('/profile/messages'); if( !intval($messagesPage->cID)) { SinglePage::add('/profile/messages'); } $ppme = UserAttributeKey::getByHandle('profile_private_messages_enabled'); if (!is_object($ppme)) { UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_enabled', 'akName' => t('I would like to receive private messages.'), 'akIsSearchable' => true)); } $ppmne = UserAttributeKey::getByHandle('profile_private_messages_notification_enabled'); if (!is_object($ppmne)) { UserAttributeKey::add('BOOLEAN', array('akHandle' => 'profile_private_messages_notification_enabled', 'akName' => t('Send me email notifications when I receive a private message.'), 'akIsSearchable' => true)); } $em = Page::getByPath('/dashboard/settings'); if (!$em->isError()) { $em = SinglePage::getByID($em->getCollectionID()); $em->refresh(); } $em1=Page::getByPath('/dashboard/settings/mail'); if ($em1->isError()) { $em1 = SinglePage::add('/dashboard/settings/mail'); $em1->update(array('cName'=>t('Email'), 'cDescription'=>t('Enable post via email and other settings.'))); } // remove adodb database logs $databaseReports = Page::getByPath('/dashboard/reports/database'); if (!$databaseReports->isError()) { $databaseReports->delete(); } if (in_array('adodb_logsql', $tables)) { @$db->query('DROP TABLE adodb_logsql'); } Loader::library('mail/importer'); $mi = MailImporter::getByHandle("private_message"); if (!is_object($mi)) { MailImporter::add(array('miHandle' => 'private_message')); } Loader::model("job"); Job::installByHandle('process_email'); Cache::enableLocalCache(); return array_merge($collectionErrors, $fileErrors, $userErrors); }
public function add_users() { // insert the default groups // create the groups our site users // have to add these in the right order so their IDs get set // starting at 1 w/autoincrement $g1 = Group::add(t("Guest"), t("The guest group represents unregistered visitors to your site.")); $g2 = Group::add(t("Registered Users"), t("The registered users group represents all user accounts.")); $g3 = Group::add(t("Administrators"), ""); // insert admin user into the user table if (defined('INSTALL_USER_PASSWORD')) { $uPassword = INSTALL_USER_PASSWORD; $uPasswordEncrypted = User::encryptPassword($uPassword, PASSWORD_SALT); } else { $uPasswordEncrypted = INSTALL_USER_PASSWORD_HASH; } $uEmail = INSTALL_USER_EMAIL; UserInfo::addSuperUser($uPasswordEncrypted, $uEmail); $u = User::getByUserID(USER_SUPER_ID, true, false); Loader::library('mail/importer'); MailImporter::add(array('miHandle' => 'private_message')); }
public function add_users() { // insert the default groups // create the groups our site users // specify the ID's since auto increment may not always be +1 $g1 = Group::add(tc("GroupName", "Guest"), tc("GroupDescription", "The guest group represents unregistered visitors to your site."), GUEST_GROUP_ID); $g2 = Group::add(tc("GroupName", "Registered Users"), tc("GroupDescription", "The registered users group represents all user accounts."), REGISTERED_GROUP_ID); $g3 = Group::add(tc("GroupName", "Administrators"), "", ADMIN_GROUP_ID); // insert admin user into the user table if (defined('INSTALL_USER_PASSWORD')) { Loader::library('3rdparty/phpass/PasswordHash'); $hasher = new PasswordHash(PASSWORD_HASH_COST_LOG2, PASSWORD_HASH_PORTABLE); $uPassword = INSTALL_USER_PASSWORD; $uPasswordEncrypted = $hasher->HashPassword($uPassword); } else { $uPasswordEncrypted = INSTALL_USER_PASSWORD_HASH; } $uEmail = INSTALL_USER_EMAIL; UserInfo::addSuperUser($uPasswordEncrypted, $uEmail); $u = User::getByUserID(USER_SUPER_ID, true, false); Loader::library('mail/importer'); MailImporter::add(array('miHandle' => 'private_message')); }