public function add_new_member() { if (!fse_try_to_login()) { header("location:/fse_login"); return; } $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'); $member_username = $this->post('memberUsername'); $member_display_name = $this->post('memberDisplayName'); $member_desc = $this->post('memberDescription'); $member_roles = array('g-mmb'); for ($i = 0; $i < ProjectInfo::NR_ROLES; $i++) { $role = $this->post("memberRole{$i}"); if (in_array($role, ProjectInfo::$mMemberRoleList)) { $member_roles[] = $role; } } $member_roles = array_unique($member_roles); $role_description = ''; $doc_lang = substr($project_id, -2); foreach ($member_roles as $role) { $role_description .= ProjectInfo::$mRoleDescriptions[$doc_lang][$role]; $role_description .= ' '; } $member_roles = implode('|', $member_roles); $page_path = ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle); $page_id = Page::getByPath($page_path)->getCollectionID(); if ($page_id <= 0) { header("Location: /"); return; } if (!fse_try_to_login()) { set_page_action_status($page_id, t('Add/Edit Member Roles'), 'error', t('You do not sign in or session expired.')); header("Location: {$page_path}"); return; } $curr_fse_id = $_SESSION['FSEInfo']['fse_id']; $curr_rights = ProjectInfo::getUserRights($project_id, $curr_fse_id); if ($curr_rights[0] != 't') { set_page_action_status($page_id, t('Add/Edit Member Roles'), 'error', t('You have no right to edit member roles.')); header("Location: {$page_path}"); return; } $fse_info = FSEInfo::getBasicProfile($member_username); if ($fse_info == false) { set_page_action_status($page_id, t('Add/Edit Member Roles'), 'error', t('No such user!')); header("Location: {$page_path}"); return; } if (strlen($member_display_name) == 0) { $member_display_name = $fse_info['nick_name']; } $member_rights = ProjectInfo::setUserRoles($project_id, $fse_info['fse_id'], $member_display_name, $member_desc, $member_roles); if (substr($member_rights, 0, 3) == 'ttt') { $style = "primary"; } else { if ($member_rights[0] == 't') { $style = "success"; } else { if ($member_rights[1] == 't') { $style = "info"; } else { if ($member_rights[2] == 't') { $style = "warning"; } else { $style = "default"; } } } } $type_handle = "member:markdown_safe:{$member_username}:{$style}:none"; $section_content = sprintf(self::MEMBER_MARKDOWN_TEXT, $member_display_name, FSEInfo::getPersonalHomeLink($fse_info), $role_description, h5($member_desc), h5($fse_info['self_desc']), $fse_info['avatar_url']); $section_manager = new DocSectionManager(); $res = $section_manager->addNewSection($curr_fse_id, $page_id, $area_handle, $project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle, $type_handle, '', $section_content, '[]'); if ($res != DocSectionManager::EC_OK) { set_page_action_status($page_id, t('Add/Edit Member Roles'), 'error', t('Failed to add/edit member: %s', $section_manager->getErrorMessage($res))); header("Location: {$page_path}"); return; } set_page_action_status($page_id, t('Add/Edit Member Roles'), 'success', t('Succeed to add a new member.')); header("Location: {$page_path}"); }
<span class="badge"><?php echo $cpt['nr_sections'] - 1; ?> </span> <h4 class="list-group-item-heading"> <a href="<?php echo "{$page_path}/" . $prt['part_handle'] . '/' . $cpt['chapter_handle']; ?> "><?php echo h5($cpt['chapter_name']); ?> </a> </h4> <p class="list-group-item-text"> <?php echo FSEInfo::getPersonalHomeLink($author_info, true); ?> </p> </li> <?php } } ?> </ul> </li> <?php } ?> </ul> </div> <div class="panel-footer">
<p> ' . $plain_content['content'] . ' </p> <hr/>'; foreach ($comments as $comment) { $author_info = FSEInfo::getNameInfo($comment['author_id']); if ($author_info == false) { continue; } $replied_name_info = false; if (preg_match("/^[0-9a-f]{32}\$/", $comment['replied_author_id'])) { $replied_name_info = FSEInfo::getNameInfo($comment['replied_author_id']); } $ret_info->detail .= ' <div class="media" style="margin-top:5px;"> <a class="media-left" href="' . FSEInfo::getPersonalHomeLink($author_info) . '"> <img class="small-avatar" src="' . $author_info['avatar_url'] . '" alt="' . $author_info['nick_name'] . '"> </a> <div class="media-body"> <p style="line-height: 1; margin-top:0; margin-bottom:0;"> <small><strong class="text-info">' . $author_info['nick_name'] . '</strong></small> </p> <p style="line-height: 1; margin-top:0; margin-bottom:0;"> <small>'; if ($replied_name_info != false) { $ret_info->detail .= t('Reply to ') . '<strong class="text-info">' . $replied_name_info['nick_name'] . ': </strong>'; } $ret_info->detail .= h5($comment['body']) . '</small> </p> </div>
if (!preg_match("/^[0-9a-f]{32}\$/", $hashed_passwd)) { $ret_info->detail = t('Bad password!'); echo $json->encode($ret_info); exit(0); } $db = Loader::db(); $row = $db->getRow("SELECT * FROM fse_basic_profiles WHERE user_name=?", array($user_name)); if (count($row) == 0 || $row['hashed_passwd'] != $hashed_passwd) { $ret_info->detail = t('Bad user or password!'); echo $json->encode($ret_info); exit(0); } $_SESSION['FSEInfo'] = $row; $db->Execute("UPDATE fse_basic_profiles SET last_login_time=NOW() WHERE user_name=?", array($user_name)); $ret_info->status = 'ok'; if (strlen($redirect_url)) { $ret_info->detail = $redirect_url; } else { $ret_info->detail = FSEInfo::getPersonalHomeLink($row); } if ($save_passwd != "on") { echo $json->encode($ret_info); exit(0); } setcookie("FSEID", $row['fse_id'], time() + 3600 * 24 * 7, DIR_REL . '/'); setcookie("HashedPasswd", $hashed_passwd, time() + 3600 * 24 * 7, DIR_REL . '/'); echo $json->encode($ret_info); exit(0); ?>
public function login($is_mobile_theme = false, $project_id = false) { $ret_info = new ReturnInfo(); $ret_info->status = 'bad'; $ret_info->detail = ''; $ret_info->user_name = 'na'; $ret_info->nick_name = 'na'; $ret_info->project_rights = '0123456789abcdef'; if (fse_try_to_login()) { $ret_info->status = 'ok'; $ret_info->user_name = $_SESSION['FSEInfo']['user_name']; $ret_info->nick_name = $_SESSION['FSEInfo']['nick_name']; if ($project_id && ProjectInfo::getDomainName($project_id, 'home')) { $res = ProjectInfo::getUserRights($project_id, $_SESSION['FSEInfo']['fse_id']); if ($res) { $ret_info->project_rights = $res; } } $link = FSEInfo::getPersonalHomeLink(); if ($is_mobile_theme == 'true') { $ret_info->detail = ' <li> <a class="menu-item with-icon" href="' . $link . '" title="Personal homepage"> <span class="glyphicon glyphicon-user"></span> ' . $ret_info->nick_name . '</a> </li> <li> <a class="menu-item with-icon" href="/fse_settings"> <span class="glyphicon glyphicon-cogwheel"></span> ' . t('Settings') . ' </a> </li> <li> <a class="menu-item with-icon" href="/fse_logout/logout"> <span class="glyphicon glyphicon-log-out"></span> ' . t('Sign out') . ' </a> </li>'; } else { $ret_info->detail = ' <li> <a class="inline-list" href="' . $link . '" title="Personal homepage"> <span class="glyphicon glyphicon-user"></span> ' . $ret_info->nick_name . '</a> </li> <li> <a class="inline-list only-icon" href="/fse_settings" title="Settings"> <span class="glyphicon glyphicon-cogwheel"></span></a> </li> <li> <a class="inline-list only-icon" href="/fse_logout/logout" title="Sign out"> <span class="glyphicon glyphicon-log-out"></span></a> </li>'; } } else { if ($is_mobile_theme == 'true') { $ret_info->detail = ' <li> <a class="menu-item" href="/fse_login">' . t('Sign in') . '</a> </li> <li> <a class="menu-item" href="/fse_register">' . t('Sign up') . '</a> </li>'; } else { $ret_info->detail = ' <li> <a class="button" href="/fse_login">' . t('Sign in') . '</a> </li> <li> <a class="button button-blue" href="/fse_register">' . t('Sign up') . '</a> </li>'; } } $js = Loader::helper('json'); echo $js->encode($ret_info); exit(0); }
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, '[]'); }
echo FSEInfo::getPersonalHomeLink($author_name_info, true, $link_style); ?> <span class="glyphicon glyphicon-clock"></span> <?php echo $edit_time; ?> </small> </p> <?php if (isset($last_author_id)) { ?> <p> <small><span class="glyphicon glyphicon-edit"></span> <?php echo FSEInfo::getPersonalHomeLink($last_author_name_info, true, $link_style); ?> <span class="glyphicon glyphicon-clock"></span> <?php echo $last_edit_time; ?> </small> </p> <?php } ?> </div> </div> </div> </div>
" alt="Project Icon"> </a> <div class="media-body"> <span class="badge"><?php echo $info['heat_level']; ?> </span> <h4 class="media-heading"><a href="<?php echo $link; ?> "><?php echo h5($info['name']); ?> </a></h4> <h5 class="media-heading"><?php echo FSEInfo::getPersonalHomeLink($owner_info, true); ?> </h5> <p><?php echo h5($info['short_desc']); ?> </p> </div> </div> </li> <?php } ?> </ul> <?php } else {
} if ($comment['action'] == DocSectionManager::COMMENT_ACTION_PRAISE) { $body = '<span class="glyphicon glyphicon-thumbs-up" style="color:#eb7350;"></span>'; } else { $body = ''; } $ret_info->detail .= ' <li id="liComment' . $comment['id'] . '" class="list-group-item" data-value="' . $comment['id'] . '"> <div class="media"> <span class="badge">14</span> <a class="media-left" href="#"> <img class="small-avatar" src="' . $author_name_info['avatar_url'] . '" alt="avatar"> </a> <section class="media-body"> <h6 class="media-heading"> ' . FSEInfo::getPersonalHomeLink($author_name_info, true) . ' </h6> <p> <small>' . $body . '</small> </p> </section><!-- media-body --> <footer class="comment-block"> <div class="block-left"> <p> <span class="glyphicon glyphicon-clock"></span> ' . $comment['create_time'] . ' </p> </div> <div class="block-right"> <ul> <li><a class="reply-comment" href="#" data-name="' . $author_name_info['nick_name'] . '"
?> "> <img class="small-avatar" src="<?php echo $author_name_info['avatar_url']; ?> " alt="avatar"> </a> <section class="media-body"> <h6 class="media-heading"> <?php echo FSEInfo::getPersonalHomeLink($author_name_info, true); ?> </h6> <p><small> <?php echo (isset($replied_name_info) ? t('Reply to ') . FSEInfo::getPersonalHomeLink($replied_name_info, true) . ': ' : '') . $body; ?> </small></p> </section><!-- media-body --> <footer class="comment-block"> <div class="block-left"> <p> <span class="glyphicon glyphicon-clock"></span> <?php echo $comment['create_time']; ?> </p> </div> <div class="block-right"> <ul> <li><a class="reply-comment" href="#" data-name="<?php
?> "> <img class="small-avatar" src="<?php echo $author_name_info['avatar_url']; ?> " alt="avatar"> </a> <section class="media-body"> <h6 class="media-heading"> <?php echo FSEInfo::getPersonalHomeLink($author_name_info, true); ?> </h6> <p><small> <?php echo (isset($replied_name_info) ? t('Reply to ') . FSEInfo::getPersonalHomeLink($replied_name_info, true) . ': ' : '') . h5($comment['body']); ?> </small></p> </section><!-- media-body --> <footer class="comment-block"> <div class="block-left"> <p> <span class="glyphicon glyphicon-clock"></span> <?php echo $comment['create_time']; ?> </p> </div> <div class="block-right"> <ul> <li><a class="reply-comment" href="#" data-name="<?php
echo '<a class="thumbnail" href="' . $fv->getURL() . '">'; echo '<img class="attached-file" src="' . $fv->getThumbnail(1, false) . '"' . 'title="' . htmlspecialchars($fv->getTitle(), ENT_QUOTES | ENT_HTML5) . '"' . 'data-desc="' . htmlspecialchars($fv->getDescription(), ENT_QUOTES | ENT_HTML5) . '"' . 'data-type="' . $fv->getGenericTypeText() . '"' . 'data-mime-type="' . $fv->getMimeType() . '"' . 'data-value="' . $fv->getURL() . '" />' . PHP_EOL; echo '</a>' . PHP_EOL; echo '</section>' . PHP_EOL; } } echo '</div>' . PHP_EOL; } ?> </section> <footer class="section-block"> <section class="author-info"> <p> <?php echo FSEInfo::getPersonalHomeLink($author_name_info, true) . PHP_EOL; ?> <?php echo $edit_time . PHP_EOL; ?> </p> </section> <section class="block-left <?php echo $visible_class; ?> "> <p> <a title="<?php echo $edit_dialog_title; ?> " class="<?php
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ defined('C5_EXECUTE') or die("Access Denied."); require_once 'helpers/fsen/FSEInfo.php'; $wiki_id = $_GET['WikiID']; $prefix = substr($wiki_id, 0, 3); if ($prefix == 'FSP') { $project_id = substr($wiki_id, 3); $doc_lang = substr($project_id, -2); header("location:/{$doc_lang}/project/{$project_id}"); exit(0); } else { if ($prefix == 'FSE') { $fse_user_name = substr($wiki_id, 3); $fse_info = FSEInfo::getBasicProfile($fse_user_name); if ($fse_info) { $home_link = FSEInfo::getPersonalHomeLink($fse_info); header("location:{$home_link}"); exit(0); } } else { if ($prefix == 'htt') { header("location:{$wiki_id}"); exit(0); } } } header('location:/');