bool CompatibilityManager::razorPortalDatabaseUpgrade(const shared_ptr<IPortalDatabase> &database) { PovID povID = database->getPortal()->getPovID(); #ifdef OS_NOOBJECTID ObjectID userID = povID; #else ObjectID userID = ObjectID::generate(portalObjectTypeUser, povID.getString()); #endif migrateAccounts(database); String portalName = database->getPortal()->getOptions()->getName(); String portalDescription = static_cast<String>(database->getPortal()->getOptions()->getOptionValue("description")); // Clean old snapshot database->execute(_S("delete from os_snapshot_objects")); database->execute(_S("delete from os_snapshot_users")); //database->execute(_S("delete from os_snapshot_profiles")); database->execute(_S("delete from os_discussions_stats")); //database->execute(_S("delete from os_forums_forum_stats")); //database->execute(_S("delete from os_forums_section_stats")); database->execute(_S("delete from os_polls_stats")); database->execute(_S("delete from os_polls_options_stats")); database->execute(_S("delete from os_users_stats")); // Old database->execute(_S("drop table if exists os_forums_forum_stats")); database->execute(_S("drop table if exists os_forums_section_stats")); // Reset acceptable database->execute(_S("update os_entries set rank=-2")); // Clean signatures database->execute(_S("update os_attributes set signature=x'00'")); database->execute(_S("update os_avatars set signature=x'00'")); database->execute(_S("update os_calendar_events set signature=x'00'")); database->execute(_S("update os_files set signature=x'00'")); database->execute(_S("update os_instances set signature=x'00'")); database->execute(_S("update os_models set signature=x'00'")); database->execute(_S("update os_polls set signature=x'00'")); database->execute(_S("update os_polls_options set signature=x'00'")); database->execute(_S("update os_polls_votes set signature=x'00'")); database->execute(_S("update os_posts set signature=x'00'")); database->execute(_S("update os_private_messages set signature=x'00'")); database->execute(_S("update os_reputations set signature=x'00'")); database->execute(_S("update os_sections set signature=x'00'")); database->execute(_S("update os_tags set signature=x'00'")); database->execute(_S("update os_texts set signature=x'00'")); database->execute(_S("update os_users set signature=x'00'")); database->execute(_S("update os_votes set signature=x'00'")); // Other conversions database->execute(_S("update os_entries set entity=null where entity='';\r\n")); database->execute(_S("update os_calendar_events set entity=null where entity='';\r\n")); database->execute(_S("update os_files set entity=null where entity='';\r\n")); database->execute(_S("update os_instances set entity=null where entity='';\r\n")); database->execute(_S("update os_models set entity=null where entity='';\r\n")); database->execute(_S("update os_polls set entity=null where entity='';\r\n")); database->execute(_S("update os_polls_options set entity=null where entity='';\r\n")); database->execute(_S("update os_posts set entity=null where entity='';\r\n")); database->execute(_S("update os_sections set entity=null where entity='';\r\n")); database->execute(_S("update os_tags set entity=null where entity='';\r\n")); database->execute(_S("update os_texts set entity=null where entity='';\r\n")); database->execute(_S("update os_attributes set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_avatars set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_calendar_events set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_files set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_instances set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_models set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_polls set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_polls_options set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_polls_votes set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_posts set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_private_messages set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_reputations set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_sections set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_tags set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_texts set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_users set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_votes set pov='") + povID.toUTF16() + _S("';\r\n")); database->execute(_S("update os_entries set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_calendar_events set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_files set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_instances set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_models set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_polls set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_polls_options set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_posts set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_sections set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_tags set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_texts set entity=ifnull(entity,id);\r\n")); database->execute(_S("update os_calendar_events set entity_author=(select author from os_entries where os_entries.id = os_calendar_events.entity);\r\n")); database->execute(_S("update os_files set entity_author=(select author from os_entries where os_entries.id = os_files.entity);\r\n")); database->execute(_S("update os_instances set entity_author=(select author from os_entries where os_entries.id = os_instances.entity);\r\n")); database->execute(_S("update os_models set entity_author=(select author from os_entries where os_entries.id = os_models.entity);\r\n")); database->execute(_S("update os_polls set entity_author=(select author from os_entries where os_entries.id = os_polls.entity);\r\n")); database->execute(_S("update os_polls_options set entity_author=(select author from os_entries where os_entries.id = os_polls_options.entity);\r\n")); database->execute(_S("update os_posts set entity_author=(select author from os_entries where os_entries.id = os_posts.entity);\r\n")); database->execute(_S("update os_sections set entity_author=(select author from os_entries where os_entries.id = os_sections.entity);\r\n")); database->execute(_S("update os_tags set entity_author=(select author from os_entries where os_entries.id = os_tags.entity);\r\n")); database->execute(_S("update os_texts set entity_author=(select author from os_entries where os_entries.id = os_texts.entity);\r\n")); database->execute(_S("update os_calendar_events set entity_date=(select submit_date from os_entries where os_entries.id = os_calendar_events.entity);\r\n")); database->execute(_S("update os_files set entity_date=(select submit_date from os_entries where os_entries.id = os_files.entity);\r\n")); database->execute(_S("update os_instances set entity_date=(select submit_date from os_entries where os_entries.id = os_instances.entity);\r\n")); database->execute(_S("update os_models set entity_date=(select submit_date from os_entries where os_entries.id = os_models.entity);\r\n")); database->execute(_S("update os_polls set entity_date=(select submit_date from os_entries where os_entries.id = os_polls.entity);\r\n")); database->execute(_S("update os_polls_options set entity_date=(select submit_date from os_entries where os_entries.id = os_polls_options.entity);\r\n")); database->execute(_S("update os_posts set entity_date=(select submit_date from os_entries where os_entries.id = os_posts.entity);\r\n")); database->execute(_S("update os_sections set entity_date=(select submit_date from os_entries where os_entries.id = os_sections.entity);\r\n")); database->execute(_S("update os_tags set entity_date=(select submit_date from os_entries where os_entries.id = os_tags.entity);\r\n")); database->execute(_S("update os_texts set entity_date=(select submit_date from os_entries where os_entries.id = os_texts.entity);\r\n")); database->execute(_S("update os_calendar_events set entity_parent=(select parent from os_entries where os_entries.id = os_calendar_events.entity);\r\n")); database->execute(_S("update os_files set entity_parent=(select parent from os_entries where os_entries.id = os_files.entity);\r\n")); database->execute(_S("update os_instances set entity_parent=(select parent from os_entries where os_entries.id = os_instances.entity);\r\n")); database->execute(_S("update os_models set entity_parent=(select parent from os_entries where os_entries.id = os_models.entity);\r\n")); database->execute(_S("update os_polls set entity_parent=(select parent from os_entries where os_entries.id = os_polls.entity);\r\n")); database->execute(_S("update os_polls_options set entity_parent=(select parent from os_entries where os_entries.id = os_polls_options.entity);\r\n")); database->execute(_S("update os_posts set entity_parent=(select parent from os_entries where os_entries.id = os_posts.entity);\r\n")); database->execute(_S("update os_sections set entity_parent=(select parent from os_entries where os_entries.id = os_sections.entity);\r\n")); database->execute(_S("update os_tags set entity_parent=(select parent from os_entries where os_entries.id = os_tags.entity);\r\n")); database->execute(_S("update os_texts set entity_parent=(select parent from os_entries where os_entries.id = os_texts.entity);\r\n")); database->execute(_S("CREATE INDEX os_files_index_entity_temp on os_files (entity asc);\r\n")); database->execute(_S("CREATE INDEX os_texts_index_entity_temp on os_texts (entity asc);\r\n")); database->execute(_S("CREATE INDEX os_posts_index_entity_temp on os_posts (entity asc);\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_calendar_events where os_entries.entity = os_calendar_events.entity) where type=16;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_files where os_entries.entity = os_files.entity) where type=8;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_instances where os_entries.entity = os_instances.entity) where type=4;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_models where os_entries.entity = os_models.entity) where type=15;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_polls where os_entries.entity = os_polls.entity) where type=12;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_polls_options where os_entries.entity = os_polls_options.entity) where type=13;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_posts where os_entries.entity = os_posts.entity) where type=6;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_sections where os_entries.entity = os_sections.entity) where type=3;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_tags where os_entries.entity = os_tags.entity) where type=9;\r\n")); database->execute(_S("update os_entries set entity_author=(select entity_author from os_texts where os_entries.entity = os_texts.entity) where type=5;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_calendar_events where os_entries.entity = os_calendar_events.entity) where type=16;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_files where os_entries.entity = os_files.entity) where type=8;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_instances where os_entries.entity = os_instances.entity) where type=4;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_models where os_entries.entity = os_models.entity) where type=15;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_polls where os_entries.entity = os_polls.entity) where type=12;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_polls_options where os_entries.entity = os_polls_options.entity) where type=13;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_posts where os_entries.entity = os_posts.entity) where type=6;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_sections where os_entries.entity = os_sections.entity) where type=3;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_tags where os_entries.entity = os_tags.entity) where type=9;\r\n")); database->execute(_S("update os_entries set entity_date=(select entity_date from os_texts where os_entries.entity = os_texts.entity) where type=5;\r\n")); database->execute(_S("update os_entries set entity=null,entity_author=null,entity_date=null where type not in (16,8,4,15,12,13,6,3,9,5);\r\n")); database->execute(_S("drop index os_files_index_entity_temp;\r\n")); database->execute(_S("drop index os_texts_index_entity_temp;\r\n")); database->execute(_S("drop index os_posts_index_entity_temp;\r\n")); // Object header cleaning - Entity database->execute(_S("update os_entries set entity=substr(entity,9);\r\n")); database->execute(_S("update os_calendar_events set entity=substr(entity,9);\r\n")); database->execute(_S("update os_files set entity=substr(entity,9);\r\n")); database->execute(_S("update os_instances set entity=substr(entity,9);\r\n")); database->execute(_S("update os_models set entity=substr(entity,9);\r\n")); database->execute(_S("update os_polls set entity=substr(entity,9);\r\n")); database->execute(_S("update os_polls_options set entity=substr(entity,9);\r\n")); database->execute(_S("update os_posts set entity=substr(entity,9);\r\n")); database->execute(_S("update os_sections set entity=substr(entity,9);\r\n")); database->execute(_S("update os_tags set entity=substr(entity,9);\r\n")); database->execute(_S("update os_texts set entity=substr(entity,9);\r\n")); database->execute(_S("update os_entries set parent=substr(parent,9);\r\n")); database->execute(_S("update os_calendar_events set parent=substr(parent,9);\r\n")); database->execute(_S("update os_files set parent=substr(parent,9);\r\n")); database->execute(_S("update os_instances set parent=substr(parent,9);\r\n")); database->execute(_S("update os_models set parent=substr(parent,9);\r\n")); database->execute(_S("update os_polls set parent=substr(parent,9);\r\n")); database->execute(_S("update os_polls_options set parent=substr(parent,9);\r\n")); database->execute(_S("update os_posts set parent=substr(parent,9);\r\n")); database->execute(_S("update os_sections set parent=substr(parent,9);\r\n")); database->execute(_S("update os_tags set parent=substr(parent,9);\r\n")); database->execute(_S("update os_texts set parent=substr(parent,9);\r\n")); database->execute(_S("update os_calendar_events set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_files set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_instances set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_models set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_polls set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_polls_options set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_posts set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_sections set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_tags set entity_parent=substr(entity_parent,9);\r\n")); database->execute(_S("update os_texts set entity_parent=substr(entity_parent,9);\r\n")); // Object header cleaning - ObjectID database->execute(_S("update os_entries set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_entries set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_entries set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_attributes set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_attributes set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_avatars set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_avatars set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_local_messages set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_local_messages set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_polls_votes set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_polls_votes set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_polls_votes set reference=substr(reference,9) where length(reference)=48;\r\n")); database->execute(_S("update os_votes set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_votes set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_votes set reference=substr(reference,9) where length(reference)=48;\r\n")); database->execute(_S("update os_private_messages set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_private_messages set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_private_messages set adressee=substr(adressee,9) where length(adressee)=48;\r\n")); database->execute(_S("update os_reputations set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_reputations set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_reputations set reference=substr(reference,9) where length(reference)=48;\r\n")); database->execute(_S("update os_users set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_calendar_events set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_calendar_events set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_calendar_events set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_files set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_files set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_files set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_instances set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_instances set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_instances set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_models set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_models set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_models set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_polls set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_polls set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_polls set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_polls_options set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_polls_options set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_polls_options set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_posts set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_posts set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_posts set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_sections set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_sections set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_sections set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_tags set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_tags set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_tags set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); database->execute(_S("update os_texts set id=substr(id,9) where length(id)=48;\r\n")); database->execute(_S("update os_texts set author=substr(author,9) where length(author)=48;\r\n")); database->execute(_S("update os_texts set entity_author=substr(entity_author,9) where length(entity_author)=48;\r\n")); // Special for Osiris Official database->execute(_S("update os_entries set author='3CCB3260950B80505CBB062C0B9B65E7028BD53F' where author='EFA5BEDD264F19D35BA92F05E503AD477D432E9F' and type=3;\r\n")); database->execute(_S("update os_entries set author='3CCB3260950B80505CBB062C0B9B65E7028BD53F' where author='EFA5BEDD264F19D35BA92F05E503AD477D432E9F' and type=8;\r\n")); database->execute(_S("update os_files set author='3CCB3260950B80505CBB062C0B9B65E7028BD53F',entity_author='3CCB3260950B80505CBB062C0B9B65E7028BD53F' where author='EFA5BEDD264F19D35BA92F05E503AD477D432E9F';\r\n")); database->execute(_S("update os_sections set author='3CCB3260950B80505CBB062C0B9B65E7028BD53F',entity_author='3CCB3260950B80505CBB062C0B9B65E7028BD53F' where author='EFA5BEDD264F19D35BA92F05E503AD477D432E9F';\r\n")); // Cleaning... issue found in some old portals. database->execute(_S("delete from os_models where id not in (select id from os_entries);\r\n")); database->execute(_S("drop table if exists os_commentables_stats;\r\n")); //if(database->execute(patch) == false) // return false; // Default POV Options { String povOptions; povOptions += _S("<options>"); povOptions += _S("<option name=\"acp.objects.allow_unsigned\" value=\"true\"/>"); povOptions += _S("<option name=\"acp.portal.name\" value=\"") + HtmlParser::instance()->encode(portalName) + _S("\"/>"); povOptions += _S("<option name=\"acp.portal.description\" value=\"") + HtmlParser::instance()->encode(portalDescription) + _S("\"/>"); povOptions += _S("</options>"); String sql = _S("update os_users set options=") + Convert::toSQL(povOptions) + _S(" where id=") + Convert::toSQL(userID.toUTF16()) + _S(";"); database->execute(sql); } // Rename changed ID renameIDS(database); // Update contents { if(upgradeContentOML(database, _S("os_calendar_events"), _S("content"), false) == false) return false; if(upgradeContentOML(database, _S("os_files"), _S("content"), false) == false) return false; if(upgradeContentOML(database, _S("os_models"), _S("content"), false) == false) return false; if(upgradeContentOML(database, _S("os_polls"), _S("content"), false) == false) return false; if(upgradeContentOML(database, _S("os_posts"), _S("content"), false) == false) return false; if(upgradeContentOML(database, _S("os_texts"), _S("content"), false) == false) return false; if(upgradeContentOML(database, _S("os_users"), _S("mark"), false) == false) return false; if(upgradeContentOML(database, _S("os_instances"), _S("data"), true) == false) return false; if(upgradeContentOML(database, _S("os_sections"), _S("data"), true) == false) return false; if(upgradeContentOML(database, _S("os_sections"), _S("component"), false) == false) return false; if(upgradeContentOML(database, _S("os_instances"), _S("module"), false) == false) return false; } String filename = utils::makeFilePath(Options::instance()->getLogPath(), _S("migration_") + database->getPortal()->getPortalID().toWide() + _S(".log")); shared_ptr<File> file(OS_NEW File()); if(file->open(filename, File::ofWrite) == false) return false; std::string debugAscii = m_DebugLog.to_ascii(); file->write(debugAscii.data(), static_cast<uint32>(debugAscii.size())); file->close(); return true; }
void IdeMailBox::renderMessage(const ObjectID &id, shared_ptr<XMLNode> node) { shared_ptr<ObjectsMessage> message; shared_ptr<DataLocalMessage> local_message = getPortal()->getMessenger()->getMessage(getPage()->getDatabase(), getSessionAccount(), id, true); if(local_message != nullptr) { // Decodifica il messaggio message = local_message->decode(getSessionAccount()->getPrivateKey()); } if(message == nullptr) return; shared_ptr<OMLContext> messageContext = getPage()->parseOmlEx(message->body, false, true, getSecure(), false, omlRenderModeOsiris, String::EMPTY, String::EMPTY); if(messageContext == nullptr) return; shared_ptr<XMLPortalExporter> messageExporter(OS_NEW XMLPortalExporter(node, getPage(), XMLPortalExporter::emFull)); local_message->exportXML(messageExporter, message->subject, messageContext->getOutput(), messageContext->getSecureCheck()); shared_ptr<XMLNode> node_actions = node->addChild(_S("actions")); shared_ptr<ObjectsUser> author = objects_user_cast(getPage()->getObject(local_message->author)); if(author != nullptr) { shared_ptr<XMLNode> action_reply = node_actions->addChild(_S("action")); action_reply->setAttributeString(_S("name"), _S("reply")); ordered_map<std::wstring, std::wstring> params; params.set(OS_URL_PARAM_QUOTE, (_W("re: ") + message->subject).to_wide()); action_reply->setAttributeString(_S("href"), getPortal()->getSendMessageLink(author->id, params)); } if(local_message->folder == static_cast<uint32>(messageFolderTrash)) { shared_ptr<XMLNode> action_delete = node_actions->addChild(_S("action")); action_delete->setAttributeString(_S("name"), _S("restore")); action_delete->setAttributeString(_S("href"), getEventCommand(EVENT_ONRESTOREMESSAGE, id.toUTF16())); } else { shared_ptr<XMLNode> action_delete = node_actions->addChild(_S("action")); action_delete->setAttributeString(_S("name"), _S("delete")); action_delete->setAttributeString(_S("href"), getEventCommand(EVENT_ONDELETEMESSAGE, id.toUTF16())); } if(getSecure()) { bool unsafe = messageContext->getSecureCheck() == false; if(unsafe == false) { shared_ptr<ObjectsUser> messageAuthor = objects_user_cast(getPage()->getObject(local_message->author)); if(messageAuthor != nullptr) { shared_ptr<OMLContext> markContext = getPage()->parseOmlEx(messageAuthor->mark, false, true, getSecure(), false, omlRenderModeOsiris, String::EMPTY, String::EMPTY); if(markContext != nullptr) unsafe = markContext->getSecureCheck() == false; } } if(unsafe) { shared_ptr<XMLNode> action_delete = node_actions->addChild(_S("action")); action_delete->setAttributeString(_S("name"), _S("show")); action_delete->setAttributeString(_S("href"), getPortal()->getPrivateMessageLink(id, false)); } } }