$current_ver_code = $_REQUEST['currentVerCode']; if (!fse_try_to_login()) { $error_info = t('You are not signed in.'); } else { if (preg_match("/^[a-f0-9]{32}\$/", $section_id) && in_array($domain_handle, ProjectInfo::$mDomainList)) { $db = Loader::db(); $section_info = DocSectionManager::getSectionInfo($domain_handle, $section_id); if (count($section_info) == 0) { $error_info = t('No such section ID!'); } else { if ($current_ver_code == 0 || $current_ver_code > $section_info['max_ver_code']) { $error_info = t('Bad request!'); } else { $project_id = $section_info['project_id']; $doc_lang = substr($project_id, -2); $project_info = ProjectInfo::getBasicInfo($project_id); if ($project_info == false) { $error_info = t('Bad project'); } else { $curr_fse_id = $_SESSION['FSEInfo']['fse_id']; $user_rights = ProjectInfo::getUserRights($project_id, $curr_fse_id); if (($section_info['status'] == DocSectionManager::SS_ADMIN_DELETED || $section_info['status'] == DocSectionManager::SS_ADMIN_SHIELDED) && $user_rights[2] != 't') { $error_info = t('You have no right to recover a deleted/shielded post by the administrator.'); } else { if ($user_rights[2] != 't' && $section_info['author_id'] != $curr_fse_id) { $error_info = t('You have no right to recover the post.'); } } } $form_action = "/fse_settings/projects/recover_post"; }
public static function addOwnerMemberSection($project_id, $fse_info = false) { /* add owner member section on misc page */ if ($fse_info == false) { $project_info = ProjectInfo::getBasicInfo($project_id); if ($project_info == false) { exit(0); } $fse_info = FSEInfo::getNameInfo($project_info['fse_id']); $fse_info = FSEInfo::getBasicProfile($fse_info['user_name']); } else { $fse_info['avatar_url'] = get_url_from_file_id($fse_info['avatar_file_id']); } $page_path = self::assemblePath($project_id, 'misc'); $about_page = Page::getByPath($page_path); $type_handle = 'member:markdown_safe:' . $fse_info['user_name'] . ':primary:none'; $section_content = sprintf(self::OWNER_MARKDOWN_TEXT, FSEInfo::getPersonalHomeLink($fse_info, true), FSEInfo::getPersonalHomeLink($fse_info), $fse_info['avatar_url'], ProjectInfo::$mRoleDescriptions[substr($project_id, -2)]['owner'], h5($fse_info['self_desc'])); $section_manager = new DocSectionManager(); $res = $section_manager->addNewSection($fse_info['fse_id'], $about_page->getCollectionID(), 'Members', $project_id, 'misc', 'na', 'na', 'na', $type_handle, '', $section_content, '[]'); }
public function add_new_ref_link_list() { if (!fse_try_to_login()) { header("location:/fse_login"); return; } $page_id = $this->post('cID'); $project_id = $this->post('projectID'); $area_handle = $this->post('areaHandle'); $domain_handle = $this->post('domainHandle'); $volume_handle = $this->post('volumeHandle'); $part_handle = $this->post('partHandle'); $chapter_handle = $this->post('chapterHandle'); $page_path = ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle); if (!isset($_SESSION['FSEInfo'])) { set_page_action_status($page_id, t('New Reference'), 'error', t('You do not sign in or session expired.')); header("Location: {$page_path}"); return; } $project_info = ProjectInfo::getBasicInfo($project_id); if ($project_info == false) { set_page_action_status($page_id, t('New Reference'), 'error', t('No such project!')); header("Location: {$page_path}"); return; } $fse_id = $_SESSION['FSEInfo']['fse_id']; if ($domain_handle == 'community' && $part_handle != 'na') { } else { if (substr(ProjectInfo::getUserRights($project_id, $fse_id), 1, 1) != 't') { set_page_action_status($page_id, t('New Reference'), 'error', t('You have no right to edit the content of this project.')); header("Location: {$page_path}"); return; } } $type_handle = 'post-reference:markdown_extra:none:none:none'; $section_subject = t('Reference'); $section_content = ''; for ($i = 0; $i < DocSectionManager::MAX_ATTACHED_FILES; $i++) { $ref_title = $this->post("refTitle{$i}"); $ref_link = $this->post("refLink{$i}"); if (strlen($ref_title) > 0 && strlen($ref_link) > DocSectionManager::MIN_LINK_STRLEN) { $section_content .= "1. [{$ref_title}]({$ref_link})\n"; } } if (mb_strlen($section_content) < self::MIN_CONTENT_LEN) { set_page_action_status($page_id, t('New Reference'), 'error', t('Too short content!')); header("Location: {$page_path}"); return; } $section_manager = new DocSectionManager(); $res = $section_manager->addNewSection($fse_id, $page_id, $area_handle, $project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle, $type_handle, $section_subject, $section_content, '[]'); if ($res != DocSectionManager::EC_OK) { set_page_action_status($page_id, t('New Reference'), 'error', t('Failed to add a new section: %s', $section_manager->getErrorMessage($res))); header("Location: {$page_path}"); return; } set_page_action_status($page_id, t('New Reference'), 'success', t('Succeed to add new reference.')); ProjectInfo::onChangeThreads($project_id, $domain_handle, $volume_handle, $part_handle); header("Location: {$page_path}"); }
</ul> <!-- Tab panes --> <div class="tab-content"> <!-- Projects --> <div role="tabpanel" class="tab-pane fade in active" id="divProjects"> <div class="v-seperator"> </div> <?php if ($nr_projects > 0) { ?> <ul class="list-group"> <?php foreach ($my_projects as $prj) { $info = ProjectInfo::getBasicInfo($prj['project_id']); $icon_url = ProjectInfo::getIconURL($info['icon_file_id']); $link = '/' . $info['doc_lang'] . '/project/' . $info['project_id']; $owner_info = FSEInfo::getNameInfo($info['fse_id']); ?> <li class="list-group-item"> <div class="media"> <a class="media-left" href="<?php echo $link; ?> "> <img class="middle-icon" src="<?php echo $icon_url; ?> " alt="Project Icon"> </a>