public function save_importer() { $miID = $this->post('miID'); $mi = MailImporter::getByID($miID); if (is_object($mi)) { $mi->update($this->post()); $this->redirect('/dashboard/settings/mail', 'importer_updated'); } }
public function save_importer() { if (!Loader::helper('validation/token')->validate('save_importer')) { $this->error->add(t('Invalid Token.')); return; } $miID = $this->post('miID'); $mi = MailImporter::getByID($miID); if (is_object($mi)) { $mi->update($this->post()); $this->redirect('/dashboard/system/mail/importers', 'importer_updated'); } }
public function run() { Loader::library('mail/importer'); $list = MailImporter::getEnabledList(); foreach ($list as $mi) { // for each one, we connect and retrieve any mail messages we haven't seen $messages = $mi->getPendingMessages(); foreach ($messages as $me) { if ($me->validate()) { $mi->process($me); $mi->cleanup($me); } } } }
public function run() { Loader::library('mail/importer'); $list = MailImporter::getEnabledList(); foreach($list as $mi) { // for each one, we connect and retrieve any mail messages we haven't seen $messages = $mi->getPendingMessages(); foreach($messages as $me) { if ($me->validate()) { $mi->process($me); $mi->cleanup($me); } else { $mh = Loader::helper('mail'); $mh->to($me->getOriginalSender()); $mh->from($mi->getMailImporterEmail()); $mh->addParameter('originalSubject', $me->getSubject()); $mh->addParameter('error', $mi->getValidationErrorMessage()); $mh->load('mail_importer_error'); $mh->sendMail(); } } } }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); Loader::model('single_page'); Loader::library('mail/importer'); Loader::model('job'); Loader::model('collection_types'); Loader::model('system/captcha/library'); Loader::model('system/antispam/library'); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['permission_categories'] = PermissionKeyCategory::getListByPackage($this); $items['permission_access_entity_types'] = PermissionAccessEntityType::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['group_sets'] = GroupSet::getListByPackage($this); $items['page_types'] = CollectionType::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['configuration_values'] = Config::getListByPackage($this); $items['block_types'] = BlockTypeList::getByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $items['permissions'] = PermissionKey::getListByPackage($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this); $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); $items['workflow_types'] = WorkflowType::getListByPackage($this); ksort($items); return $items; }
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')); }
/** * Returns the relevant content of the email message, minus any quotations, and the line that includes the validation hash */ public function getProcessedBody() { $r = preg_split(MailImporter::getMessageBodyHashRegularExpression(), $this->body, $matches); $message = $r[0]; $r = preg_replace(array( '/^On (.*) at (.*), (.*) wrote:/sm', '/[\n\r\s\>]*\Z/i' ), '', $message); return $r; }
public function sendPrivateMessage($recipient, $subject, $text, $inReplyTo = false) { Loader::model('user_private_message'); if(UserPrivateMessageLimit::isOverLimit($this->getUserID())) { return UserPrivateMessageLimit::getErrorObject(); } $subject = ($subject == '') ? t('(No Subject)') : $subject; $db = Loader::db(); $dt = Loader::helper('date'); $v = array($this->getUserID(), $dt->getLocalDateTime(), $subject, $text, $recipient->getUserID()); $db->Execute('insert into UserPrivateMessages (uAuthorID, msgDateCreated, msgSubject, msgBody, uToID) values (?, ?, ?, ?, ?)', $v); $msgID = $db->Insert_ID(); if ($msgID > 0) { // we add the private message to the sent box of the sender, and the inbox of the recipient $v = array($db->Insert_ID(), $this->getUserID(), $this->getUserID(), UserPrivateMessageMailbox::MBTYPE_SENT, 0, 1); $db->Execute('insert into UserPrivateMessagesTo (msgID, uID, uAuthorID, msgMailboxID, msgIsNew, msgIsUnread) values (?, ?, ?, ?, ?, ?)', $v); $v = array($db->Insert_ID(), $recipient->getUserID(), $this->getUserID(), UserPrivateMessageMailbox::MBTYPE_INBOX, 1, 1); $db->Execute('insert into UserPrivateMessagesTo (msgID, uID, uAuthorID, msgMailboxID, msgIsNew, msgIsUnread) values (?, ?, ?, ?, ?, ?)', $v); } // If the message is in reply to another message, we make a note of that here if (is_object($inReplyTo)) { $db->Execute('update UserPrivateMessagesTo set msgIsReplied = 1 where uID = ? and msgID = ?', array($this->getUserID(), $inReplyTo->getMessageID())); } // send the email notification if ($recipient->getAttribute('profile_private_messages_notification_enabled')) { $mh = Loader::helper('mail'); $mh->addParameter('msgSubject', $subject); $mh->addParameter('msgBody', $text); $mh->addParameter('msgAuthor', $this->getUserName()); $mh->addParameter('msgDateCreated', $msgDateCreated); $mh->addParameter('profileURL', BASE_URL . View::url('/profile', 'view', $this->getUserID())); $mh->addParameter('profilePreferencesURL', BASE_URL . View::url('/profile/edit')); $mh->to($recipient->getUserEmail()); Loader::library('mail/importer'); $mi = MailImporter::getByHandle("private_message"); if (is_object($mi) && $mi->isMailImporterEnabled()) { $mh->load('private_message_response_enabled'); // we store information ABOUT the message here. The mail handler has to know how to handle this. $data = new stdClass; $data->msgID = $msgID; $data->toUID = $recipient->getUserID(); $data->fromUID = $this->getUserID(); $mh->enableMailResponseProcessing($mi, $data); } else { $mh->load('private_message'); } $mh->sendMail(); } }
/** * @param MailImporter $importer * @param array $data * @return void */ public function enableMailResponseProcessing($importer, $data) { foreach($this->to as $em) { $importer->setupValidation($em[0], $data); } $this->from($importer->getMailImporterEmail()); $this->body = $importer->setupBody($this->body); }
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); }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); Loader::model('single_page'); Loader::model('dashboard/homepage'); Loader::library('mail/importer'); Loader::model('job'); Loader::model('collection_types'); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['page_types'] = CollectionType::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['dashboard_modules'] = DashboardHomepageView::getModules($this); $items['configuration_values'] = Config::getListByPackage($this); $items['block_types'] = BlockTypeList::getByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $tp = new TaskPermissionList(); $items['task_permissions'] = $tp->populatePackagePermissions($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); ksort($items); return $items; }
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')); }
/** * Returns an array of package items (e.g. blocks, themes) */ public function getPackageItems() { $items = array(); Loader::model('single_page'); Loader::library('mail/importer'); Loader::model('job'); Loader::model('collection_types'); Loader::model('system/captcha/library'); Loader::model('system/antispam/library'); $items['attribute_categories'] = AttributeKeyCategory::getListByPackage($this); $items['attribute_keys'] = AttributeKey::getListByPackage($this); $items['attribute_sets'] = AttributeSet::getListByPackage($this); $items['page_types'] = CollectionType::getListByPackage($this); $items['mail_importers'] = MailImporter::getListByPackage($this); $items['configuration_values'] = Config::getListByPackage($this); $items['block_types'] = BlockTypeList::getByPackage($this); $items['page_themes'] = PageTheme::getListByPackage($this); $tp = new TaskPermissionList(); $items['task_permissions'] = $tp->populatePackagePermissions($this); $items['single_pages'] = SinglePage::getListByPackage($this); $items['attribute_types'] = AttributeType::getListByPackage($this); $items['captcha_libraries'] = SystemCaptchaLibrary::getListByPackage($this); $items['antispam_libraries'] = SystemAntispamLibrary::getListByPackage($this); $items['jobs'] = Job::getListByPackage($this); ksort($items); return $items; }