Ejemplo n.º 1
0
function output_domain_block($project_id)
{
    foreach (ProjectInfo::$mDomainList as $domain_handle) {
        if ($domain_handle == 'home' || $domain_handle == 'misc') {
            continue;
        }
        $domain_link = ProjectInfo::assemblePath($project_id, $domain_handle);
        $domain_name = ProjectInfo::getDomainName($project_id, $domain_handle);
        $domain_desc = ProjectInfo::getDomainDesc($project_id, $domain_handle);
        switch ($domain_handle) {
            case 'download':
                $icon_name = 'download';
                break;
            case 'document':
                $icon_name = 'book';
                break;
            case 'community':
                $icon_name = 'group';
                break;
            case 'contribute':
                $icon_name = 'heart';
                break;
        }
        ?>
<div class="col-sm-3 col-md-3 col-lg-3 note-block">
	<div class="well text-center">
		<div class="note-icon">
			<a href="<?php 
        echo $domain_link;
        ?>
">
				<span class="glyphicon glyphicon-<?php 
        echo $icon_name;
        ?>
"></span>
			</a>
		</div>
		<div class="note-desc">
			<h2>
				<a href="<?php 
        echo $domain_link;
        ?>
">
					<?php 
        echo h5($domain_name);
        ?>
				</a>
			</h2>
			<p>
				<?php 
        echo h5($domain_desc);
        ?>
			</p>
		</div>
		</p>
	</div>
</div>
<?php 
    }
}
Ejemplo n.º 2
0
        echo "fsenDocLang={$doc_lang}&cID={$page_id}&projectID={$project_id}&domainHandle={$domain_handle}&volumeHandle={$volume_handle}&partHandle={$part_handle}";
        ?>
">
									<m class="glyphicon glyphicon-circle-plus"></m>
								</a>
							</span>
						</h2>
					</header>
					<ul>
<?php 
        $chapters = ProjectInfo::getAllChapters($project_id, $domain_handle, $volume_handle, $part_handle);
        foreach ($chapters as $cpt) {
            ?>
						<li class="list-unstyled">
							<a href="<?php 
            echo ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $parts[$p]['part_handle'], $cpt['chapter_handle']);
            ?>
">
								<p><span></span><?php 
            echo h5($cpt['chapter_name']);
            ?>
</p>
							</a>
						</li>
<?php 
        }
        ?>
					</ul>
				</nav>
<?php 
        $start_part++;
Ejemplo n.º 3
0
<?php 
$parts = ProjectInfo::getAllParts($project_id, $domain_handle, $volume_handle);
foreach ($parts as $prt) {
    $latest_chapters = ProjectInfo::getLatestChapters($project_id, $domain_handle, $volume_handle, $prt['part_handle']);
    ?>
						<li class="list-group-item">
							<ul class="list-group">
								<li class="list-group-item">
									<span class="badge"><?php 
    echo $prt['nr_chapters'];
    ?>
</span>
									<h3 class="list-group-item-heading">
										<a
											href="<?php 
    echo ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $prt['part_handle']);
    ?>
"><?php 
    echo h5($prt['part_name']);
    ?>
</a></h3>
									<p class="list-group-item-text"><?php 
    echo h5($prt['part_desc']);
    ?>
</p>
								</li>
<?php 
    if (count($latest_chapters) > 0) {
        foreach ($latest_chapters as $cpt) {
            $author_info = FSEInfo::getNameInfo($cpt['fse_id']);
            ?>
Ejemplo n.º 4
0
"
						title="<?php 
echo ProjectInfo::getDomainDesc($sys_project_id, 'misc');
?>
"
						class="inline-list small"><?php 
echo ProjectInfo::getDomainName($sys_project_id, 'misc');
?>
</a>
			</li>
<?php 
foreach ($volumes as $v) {
    ?>
		<li>
			<a href="<?php 
    echo ProjectInfo::assemblePath($sys_project_id, 'misc', $v['volume_handle']);
    ?>
"
					title="<?php 
    echo h5($v['volume_desc']);
    ?>
"
					class="inline-list small"><?php 
    echo h5($v['volume_name']);
    ?>
</a>
		</li>
<?php 
}
?>
		</ul>
Ejemplo n.º 5
0
			<li><a href="<?php 
echo ProjectInfo::assemblePath($project_id, 'home');
?>
"><?php 
echo ProjectInfo::getDomainName($project_id, 'home');
?>
</a></li>
			<li><a href="<?php 
echo ProjectInfo::assemblePath($project_id, $domain_handle);
?>
"><?php 
echo ProjectInfo::getDomainName($project_id, $domain_handle);
?>
</a></li>
			<li><a href="<?php 
echo ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle);
?>
"><?php 
echo ProjectInfo::getVolumeName($project_id, $domain_handle, $volume_handle);
?>
</a></li>
			<li class="active"><?php 
echo ProjectInfo::getPartName($project_id, $domain_handle, $volume_handle, $part_handle);
?>
</li>
		</ol>
	</nav>

	<article class="formal-content" lang="<?php 
echo $doc_lang;
?>
Ejemplo n.º 6
0
        ?>
">&laquo; <?php 
        echo h5($name);
        ?>
</a>
							</li>
<?php 
    }
    if ($idx_curr_part == count($parts) - 1) {
        ?>
							<li class="next disabled">
								<a href="#">&raquo;</a>
							</li>
<?php 
    } else {
        $href = ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $parts[$idx_curr_part + 1]['part_handle']);
        $name = $parts[$idx_curr_part + 1]['part_name'];
        ?>
							<li class="next">
								<a href="<?php 
        echo $href;
        ?>
"><?php 
        echo h5($name);
        ?>
 &raquo;</a>
							</li>
<?php 
    }
    ?>
						</ul>
Ejemplo n.º 7
0
 public function delete_blog()
 {
     if (!fse_try_to_login()) {
         header("location:/fse_login");
         return;
     }
     $curr_page_id = $this->post('cID');
     $project_id = $this->post('projectID');
     $domain_handle = $this->post('domainHandle');
     $volume_handle = $this->post('volumeHandle');
     $part_handle = $this->post('partHandle');
     $chapter_handle = $this->post('chapterHandle');
     $curr_page_path = Page::getByID($curr_page_id)->getCollectionPath();
     $form_token_name = $this->post('formTokenName');
     $form_token = $this->post('formToken');
     if ($_SESSION[$form_token_name] != $form_token) {
         set_page_action_status($curr_page_id, t('Delete Blog'), 'error', t('Bad request or session expired!'));
         unset($_SESSION[$form_token_name]);
         header("Location: {$curr_page_path}");
         return;
     }
     unset($_SESSION[$form_token_name]);
     $cpt_page_path = ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle);
     $chapter_page = Page::getByPath($cpt_page_path);
     if ($chapter_page->getCollectionID() == false) {
         set_page_action_status($curr_page_id, t('Delete Blog'), 'error', t('No such blog page!'));
         header("Location: {$curr_page_path}");
         return;
     }
     $chapter_page->delete();
     $db = Loader::db();
     $doc_lang = substr($project_id, -2);
     $db->Execute("DELETE FROM fsen_chapter_tags_{$doc_lang} WHERE chapter_handle=?", array($chapter_handle));
     $db->Execute('DELETE FROM fsen_chapter_categories WHERE chapter_handle=?', array($chapter_handle));
     $db->Execute("DELETE FROM fsen_project_doc_volume_part_chapters_{$doc_lang}\n\tWHERE project_id=? AND domain_handle=? AND volume_handle=? AND part_handle=? AND chapter_handle=?", array($project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle));
     ProjectInfo::onDeleteBlog($project_id, $domain_handle, $volume_handle, $part_handle, $chapter_handle);
     set_page_action_status($curr_page_id, t('Delete Blog'), 'success', t('Succeed to delete the blog.'));
     header("Location: {$curr_page_path}");
 }
$ret_info->status = 'success';
$nr = 0;
foreach ($sections as $pst) {
    if ($nr >= $nr_requested) {
        break;
    }
    $author_info = FSEInfo::getNameInfo($pst['author_id']);
    if ($author_info == false) {
        continue;
    }
    $comments = DocSectionManager::getCachedComments($domain_handle, $pst['id']);
    if (count($comments) == 0) {
        continue;
    }
    $plain_content = DocSectionManager::getPlainContent($pst['id'], $pst['curr_ver_code']);
    $link = ProjectInfo::assemblePath($pst['project_id'], $pst['domain_handle'], $pst['volume_handle'], $pst['part_handle'], $pst['chapter_handle']);
    $link .= '#section-' . $pst['id'];
    if (strlen($plain_content['title']) == 0) {
        $page = Page::getByID($pst['page_id']);
        $plain_content['title'] = $page->getCollectionName();
    }
    $ret_info->detail .= '
<div class="panel panel-default">
<div class="panel-body">
	<div class="media" style="margin-top:15px">
		<a class="media-left" href="' . FSEInfo::getPersonalHomeLink($author_info) . '">
			<img class="middle-avatar" src="' . $author_info['avatar_url'] . '" alt="' . $author_info['nick_name'] . '">
		</a>
		<div class="media-body">
			<h4 class="media-heading">
				<a href="' . $link . '">' . h5($plain_content['title']) . '</a>
Ejemplo n.º 9
0
        }
        $volumes = $db->getAll("SELECT * FROM fsen_project_doc_volumes\n\tWHERE project_id=? AND domain_handle=? ORDER BY display_order", array($project_id, $d['domain_handle']));
        foreach ($volumes as $v) {
            $volume_path = ProjectInfo::assemblePath($project_id, $d['domain_handle'], $v['volume_handle']);
            $volume_page = Page::getByPath($volume_path);
            if ($volume_page->getCollectionID() == false) {
                $volume_page = ProjectInfo::addVolumePage($project_id, $domain_page, $d['domain_handle'], $v['volume_handle'], $v['volume_name'], $v['volume_desc']);
                echo '		Added volume page for ';
                echo $v['volume_handle'];
                echo '<br/>';
                flush();
                ob_flush();
            }
            $parts = $db->getAll("SELECT * FROM fsen_project_doc_volume_parts\nWHERE project_id=? AND domain_handle=? AND volume_handle=? ORDER BY display_order", array($project_id, $d['domain_handle'], $v['volume_handle']));
            foreach ($parts as $p) {
                $part_path = ProjectInfo::assemblePath($project_id, $d['domain_handle'], $v['volume_handle'], $p['part_handle']);
                $part_page = Page::getByPath($volume_path);
                if ($part_page->getCollectionID() == false) {
                    $part_page = ProjectInfo::addPartPage($project_id, $d['domain_handle'], $volume_page, $p['part_handle'], $p['part_name'], $p['part_desc']);
                    echo '			Add part page for ';
                    echo $p['part_handle'];
                    echo '<br/>';
                    flush();
                    ob_flush();
                }
            }
        }
    }
}
Cache::flush();
exit(0);
Ejemplo n.º 10
0
?>
" class="tab-item"><span
		class="glyphicon glyphicon-book"></span></a>
	<a <?php 
echo $domain_handle == 'download' ? 'class="active"' : '';
?>
		href="<?php 
echo ProjectInfo::assemblePath($project_id, 'download');
?>
" class="tab-item"><span
		class="glyphicon glyphicon-download"></span></a>
	<a <?php 
echo $domain_handle == 'home' ? 'class="active"' : '';
?>
		href="<?php 
echo ProjectInfo::assemblePath($project_id, 'home');
?>
" class="tab-item"><span
		class="glyphicon glyphicon-home"></span></a>

<?php 
if ($domain_handle != 'home') {
    ?>
		<img src="<?php 
    echo get_url_from_file_id($project_info['icon_file_id'], '/files/images/icon-fsen-144.png');
    ?>
"/ alt="Logo Icon" />
		<h1><?php 
    echo h5($project_info['name']);
    ?>
</h1>
Ejemplo n.º 11
0
    public function delete_account()
    {
        $delete_intent = $this->post('deleteIntent');
        $user_name = $this->post('userName');
        $hashed_passwd = $this->post('hashedPasswd');
        if (!fse_try_to_login()) {
            header("location:/fse_login");
        }
        if ($delete_intent != 'delete my account') {
            $this->set('error', t('You did not confirm your intent!'));
            return;
        }
        if ($_SESSION['FSEInfo']['user_name'] != $user_name) {
            $this->set('error', t('Wrong username!'));
            return;
        }
        if ($_SESSION['FSEInfo']['hashed_passwd'] != $hashed_passwd) {
            $this->set('error', t('Wrong password!'));
            return;
        }
        $db = Loader::db();
        $projects = $db->getAll('SELECT project_id, doc_lang FROM fsen_projects WHERE fse_id=?', array($_SESSION['FSEInfo']['fse_id']));
        foreach ($projects as $p) {
            $db->Execute("DELETE FROM fsen_projects WHERE project_id=?", array($p['project_id']));
            /* delete project pages */
            $page = Page::getByPath(ProjectInfo::assemblePath($p['project_id'], 'home'));
            if ($page->getCollectionID() > 0) {
                $page->delete();
            }
            ProjectInfo::onDeleteProject($p['project_id']);
        }
        if (preg_match("/^zh/i", $_SESSION['FSEInfo']['def_locale'])) {
            $doc_lang = 'zh';
        } else {
            $doc_lang = 'en';
        }
        ProjectInfo::deleteProjectDocPart(SYSTEM_PROJECT_SHORTNAME . '-' . $doc_lang, 'document', 'blog', $user_name);
        $page = Page::getByPath("/{$doc_lang}/engineer/{$user_name}");
        if ($page->getCollectionID() > 0) {
            $page->delete();
        }
        $db->query("DELETE FROM fse_basic_profiles WHERE user_name=?", array($user_name));
        $nick_name = $_SESSION['FSEInfo']['nick_name'];
        $email_box = $_SESSION['FSEInfo']['email_box'];
        $url_register = BASE_URL . '/fse_register';
        $mail_subject = t('[FSEN] Your account have been deleted!');
        $mail_body = t('Dear %s,

We have deleted your account at FSEN (FullStackEngineer.Net)!

We welcome you to sign up a new account at FSEN at any time:

	%s

Good luck and regards,
Your friends at FSEN', $nick_name, $url_register);
        $mh = Loader::helper('mail');
        $mh->setSubject($mail_subject);
        $mh->setBody($mail_body);
        $mh->from(EMAIL_DEFAULT_FROM_ADDRESS, EMAIL_DEFAULT_FROM_NAME);
        if (defined('EMAIL_DEFAULT_BCC_ADDRESS')) {
            $mh->bcc(EMAIL_DEFAULT_BCC_ADDRESS, EMAIL_DEFAULT_BCC_NAME);
        }
        $mh->to($email_box, $nick_name);
        $mh->sendMail();
        unset($_SESSION['FSEInfo']);
        setcookie("FSEID", null, time() - 3600 * 24 * 365, DIR_REL . '/');
        setcookie("HashedPasswd", null, time() - 3600 * 24 * 365, DIR_REL . '/');
        header("location:/");
        exit(0);
    }
Ejemplo n.º 12
0
						<?php 
echo t('Other Blogs');
?>
					</h3>
				</header>
<?php 
if (count($normal_blogs) > 0) {
    ?>
				<ul class="list-group">
<?php 
    foreach ($normal_blogs as $blg) {
        ?>
					<li class="list-group-item">
						<p>
							<a href="<?php 
        echo ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $part_handle, $blg['chapter_handle']);
        ?>
"><?php 
        echo h5($blg['chapter_name']);
        ?>
</a>
						</p>
					</li>
<?php 
    }
    ?>
				</ul>
<?php 
}
?>
Ejemplo n.º 13
0
function output_domain_struct($project_id, $domain_handle, $domain_title, $domain_desc, $domain_long_desc)
{
    $doc_lang = $_REQUEST['fsenDocLang'];
    if (!isset($doc_lang)) {
        $doc_lang = 'en';
    }
    if (in_array($domain_handle, array('document', 'community'))) {
        $dialog_href = "/index.php/tools/add_new_doc_part.php?fsenDocLang={$doc_lang}&projectID={$project_id}&domainHandle={$domain_handle}";
    } else {
        $dialog_href = "/index.php/tools/add_new_doc_volume.php?fsenDocLang={$doc_lang}&projectID={$project_id}&domainHandle={$domain_handle}";
    }
    ?>
<h2><span
		title="Doc domain name."
		contenteditable="true"
		data-project="<?php 
    echo $project_id;
    ?>
"
		data-domain="<?php 
    echo $domain_handle;
    ?>
"
		data-item="name"
		data-org="<?php 
    echo h5($domain_title);
    ?>
"><?php 
    echo h5($domain_title);
    ?>
</span>
		<a
				href="<?php 
    echo ProjectInfo::assemblePath($project_id, $domain_handle);
    ?>
"><span
						class="glyphicon glyphicon-link"></span></a>
			(<span
					title="<?php 
    echo t('Page domain\'s short description, which will be displayed on project homepage.');
    ?>
"
					contenteditable="true"
					data-project="<?php 
    echo $project_id;
    ?>
"
					data-domain="<?php 
    echo $domain_handle;
    ?>
"
					data-item="desc"
					data-org="<?php 
    echo h5($domain_desc);
    ?>
"><?php 
    echo h5($domain_desc);
    ?>
</span>)
<?php 
    if ($domain_handle != 'home') {
        ?>
		<span>
			<a class="launch-modal" href="<?php 
        echo $dialog_href;
        ?>
"> (&#10010;)</a>
		</span>
<?php 
    }
    ?>
	</h2>

	<p><span
		title="<?php 
    echo t('Page domain\'s long description, which will be displayed on domain homepage. Markdown enabled.');
    ?>
"
		contenteditable="true"
		data-project="<?php 
    echo $project_id;
    ?>
"
		data-domain="<?php 
    echo $domain_handle;
    ?>
"
		data-item="long_desc"
		data-org="<?php 
    echo h5($domain_long_desc);
    ?>
"><?php 
    echo h5($domain_long_desc);
    ?>
</span></p>
<?php 
    $db = Loader::db();
    $volumes = $db->getAll("SELECT volume_handle, volume_name, volume_desc FROM fsen_project_doc_volumes\n\tWHERE project_id=? AND domain_handle=? ORDER BY display_order", array($project_id, $domain_handle));
    echo '<div>';
    foreach ($volumes as $v) {
        ?>
	<p style="margin-left:10px;"><span
		title="<?php 
        echo t('Volume name');
        ?>
"
		contenteditable="true"
		data-project="<?php 
        echo $project_id;
        ?>
"
		data-domain="<?php 
        echo $domain_handle;
        ?>
"
		data-volume="<?php 
        echo $v['volume_handle'];
        ?>
"
		data-item="name"
		data-org="<?php 
        echo h5($v['volume_name']);
        ?>
"><?php 
        echo h5($v['volume_name']);
        ?>
</span> (<span
			title="<?php 
        echo t('Volume description');
        ?>
"
			contenteditable="true"
			data-project="<?php 
        echo $project_id;
        ?>
"
			data-domain="<?php 
        echo $domain_handle;
        ?>
"
			data-volume="<?php 
        echo $v['volume_handle'];
        ?>
"
			data-item="desc"
			data-org="<?php 
        echo h5($v['volume_desc']);
        ?>
"><?php 
        echo h5($v['volume_desc']);
        ?>
</span>)</p>
<?php 
        $parts = $db->getAll("SELECT part_handle, part_name, part_desc FROM fsen_project_doc_volume_parts\n\tWHERE project_id=? AND domain_handle=? AND volume_handle=? ORDER BY display_order", array($project_id, $domain_handle, $v['volume_handle']));
        foreach ($parts as $p) {
            ?>
	<p style="margin-left:20px;"><span
		title="<?php 
            echo t('Part name');
            ?>
"
		contenteditable="true"
		data-project="<?php 
            echo $project_id;
            ?>
"
		data-domain="<?php 
            echo $domain_handle;
            ?>
"
		data-volume="<?php 
            echo $v['volume_handle'];
            ?>
"
		data-part="<?php 
            echo $p['part_handle'];
            ?>
"
		data-item="name"
		data-org="<?php 
            echo h5($p['part_name']);
            ?>
"><?php 
            echo h5($p['part_name']);
            ?>
</span> (<span
			title="<?php 
            echo t('Part description');
            ?>
"
			contenteditable="true"
			data-project="<?php 
            echo $project_id;
            ?>
"
			data-domain="<?php 
            echo $domain_handle;
            ?>
"
			data-volume="<?php 
            echo $v['volume_handle'];
            ?>
"
			data-part="<?php 
            echo $p['part_handle'];
            ?>
"
			data-item="desc"
			data-org="<?php 
            echo h5($p['part_desc']);
            ?>
"><?php 
            echo h5($p['part_desc']);
            ?>
</span>)</p>
<?php 
        }
    }
    echo '</div>';
}
Ejemplo n.º 14
0
        ?>
">&laquo; <?php 
        echo h5($name);
        ?>
</a>
					</li>
<?php 
    }
    if ($idx_curr_chapter == count($chapters) - 1) {
        ?>
					<li class="next disabled">
						<a href="#">&raquo;</a>
					</li>
<?php 
    } else {
        $href = ProjectInfo::assemblePath($project_id, $domain_handle, $volume_handle, $part_handle, $chapters[$idx_curr_chapter + 1]['chapter_handle']);
        $name = $chapters[$idx_curr_chapter + 1]['chapter_name'];
        ?>
					<li class="next">
						<a href="<?php 
        echo $href;
        ?>
"><?php 
        echo h5($name);
        ?>
 &raquo;</a>
					</li>
<?php 
    }
    ?>
				</ul>