function listPosts($filter = '', $l = 0)
{
    global $conn;
    $rs_posts = $conn->getPosts($filter);
    if ($rs_posts) {
        foreach ($rs_posts as $p) {
            ?>
<ul class="posts_list">
		    <li><a href="post.php?idp=<?php 
            echo $p['ID'];
            ?>
"><?php 
            echo_utf8($p['post_title']);
            ?>
</a>&nbsp;(<a href="posts.php?pt=<?php 
            echo $p['post_type'];
            ?>
"><?php 
            echo $p['post_type'];
            ?>
</a>)
		    
		    <?php 
            unset($filter['post_type']);
            $filter['post_parent'] = 'AND post_parent = ' . $p['ID'];
            listPosts($filter, $l + 1);
            ?>
		    </li>
		</ul><?php 
        }
    } else {
        echo "sem registos!";
    }
}
<?php 
function listPosts($filter = array(), $l = 0)
{
    global $conn;
    $rs_posts = $conn->getPosts($filter);
    if ($rs_posts) {
        while ($p = $rs_posts->fetch_object()) {
            ?>
<ul class="posts_list">
		    <li><a href="post.php?idp=<?php 
            echo $p->ID;
            ?>
"><?php 
            echo_utf8($p->post_title);
            ?>
</a>&nbsp;(<a href="posts.php?pt=<?php 
            echo $p->post_type;
            ?>
"><?php 
            echo $p->post_type;
            ?>
</a>)
		    </li>
		</ul><?php 
        }
    } else {
        echo "sem registos!";
    }
}
listPosts();
示例#3
0
文件: index.php 项目: hardkap/pritlog
function mainLogic()
{
    global $debugMode, $option, $requestCategory, $optionValue, $serverName;
    //$category = $data[4];
    switch ($option) {
        case "newEntry":
            if ($debugMode == "on") {
                echo "Calling newEntryPass()";
            }
            newEntryForm();
            break;
        case "newEntryForm":
            if ($debugMode == "on") {
                echo "Calling newEntryForm()";
            }
            newEntryForm();
            break;
        case "newEntrySubmit":
            newEntrySubmit();
            break;
        case "newEntrySuccess":
            newEntrySuccess();
            break;
        case "mainPage":
            $requestCategory = '';
            listPosts();
            $referrer = $serverName . $_SERVER['REQUEST_URI'];
            $_SESSION['referrer'] = $referrer;
            break;
        case "adminPage":
            adminPage();
            break;
        case "adminPageBasic":
            if ($debugMode == "on") {
                echo "adminPageBasic  " . $_POST['process'] . "<br>";
            }
            adminPageBasic();
            break;
        case "adminPageBasicSubmit":
            if ($debugMode == "on") {
                echo "adminPageBasicSubmit  " . $_POST['process'] . "<br>";
            }
            adminPageBasicSubmit();
            break;
        case "adminPageAdvanced":
            if ($debugMode == "on") {
                echo "adminPageAdvanced  " . $_POST['process'] . "<br>";
            }
            adminPageAdvanced();
            break;
        case "adminPageAdvancedSubmit":
            if ($debugMode == "on") {
                echo "adminPageAdvancedSubmit  " . $_POST['process'] . "<br>";
            }
            adminPageAdvancedSubmit();
            break;
        case "adminPageAuthors":
            if ($debugMode == "on") {
                echo "adminPageAuthors  " . $_POST['process'] . "<br>";
            }
            adminPageAuthors();
            break;
        case "adminAuthorsAdd":
            if ($debugMode == "on") {
                echo "adminAuthorsAdd  " . $_POST['process'] . "<br>";
            }
            adminAuthorsAdd();
            break;
        case "adminAuthorsEdit":
            if ($debugMode == "on") {
                echo "adminAuthorsEdit  " . $_POST['process'] . "<br>";
            }
            adminAuthorsEdit();
            break;
        case "adminPluginsSubmit":
        case "adminPagePlugins":
            adminPagePlugins();
            break;
        case "adminPageModerate":
        case "adminModerateSubmit":
            adminPageModerate();
            break;
        case "deleteEntry":
            if ($debugMode == "on") {
                echo "deleteEntry  " . $_POST['process'] . "<br>";
            }
            //deleteEntrySubmit();
            if ($_POST['process'] !== "deleteEntrySubmit") {
                deleteEntryForm();
            } else {
                deleteEntrySubmit();
            }
            break;
        case "editEntry":
            if ($debugMode == "on") {
                echo "editEntry  " . $_POST['process'] . "<br>";
            }
            editEntryForm();
            $referrer = $serverName . $_SERVER['REQUEST_URI'];
            $_SESSION['referrer'] = $referrer;
            break;
        case "editEntryForm":
            editEntryForm();
            break;
        case "editEntrySubmit":
            editEntrySubmit();
            break;
        case "posts":
            viewEntry();
            break;
        case "archives":
            viewArchive();
            break;
        case "month":
            viewArchiveMonth();
            break;
        case "category":
            $requestCategory = $optionValue;
            listPosts();
            $referrer = $serverName . $_SERVER['REQUEST_URI'];
            $_SESSION['referrer'] = $referrer;
            break;
        case "searchPosts":
            searchPosts();
            break;
        case "sendComment":
            sendComment();
            break;
        case "sendCommentSuccess":
            sendCommentSuccess();
            break;
        case "listAllComments":
            listAllComments();
            break;
        case "deleteComment":
            if ($debugMode == "on") {
                echo "deleteEntry  " . $_POST['process'] . "<br>";
            }
            $process = isset($_POST['process']) ? $_POST['process'] : "";
            if ($process !== "deleteCommentSubmit") {
                deleteCommentForm();
            } else {
                deleteCommentSubmit();
            }
            break;
        case "loginPage":
            loginPage();
            break;
        case "logoutPage":
            logoutPage();
            break;
        case "registerPage":
            registerPage();
            break;
        case "registerPageSubmit":
            registerPageSubmit();
            break;
        case "forgotPass":
            forgotPass();
            break;
        case "forgotPassSubmit":
            forgotPassSubmit();
            break;
        case "activation":
            activation();
            break;
        case "myProfile":
            myProfile();
            break;
        case "myProfileSubmit":
            myProfileSubmit();
            break;
        case "pluginFunction1":
            pluginFunction1();
            break;
        case "pluginFunction2":
            pluginFunction2();
            break;
        case "pluginFunction3":
            pluginFunction3();
            break;
        case "pluginFunction4":
            pluginFunction4();
            break;
        case "pluginFunction5":
            pluginFunction5();
            break;
    }
}
示例#4
0
文件: blog.php 项目: nicolasH/nnmc
function printBlogPosts($request)
{
    $dir = BASE_PATH . BLOG_DIR;
    $uri = BASE_URI . BLOG_DIR;
    //"blog/2008/"
    //blog/2008/01/"
    //blog/2008/01/14/"
    //blog/2008/q1/""
    //blog/2008/01/14/01"
    if (strpos($request, "/list") > 0) {
        return printBlogPostsList($request);
        //return;
    }
    $date = getDateFields($request);
    $filter = getDateFilterRegexp($date);
    $file = getBlogFileFromRequest($request);
    $html = '<div id="blog">';
    if (file_exists($dir . $file)) {
        //print "<hr>file exist somehow !!!!<br/>\n";
        $dirFiles = getFileList($dir, $empty);
        rsort($dirFiles);
        //previous and next ?
        $preNextFile = getPreNext($dirFiles, $file);
        //$html.=printPostNav($uri,$dir,$preNextFile["pre"],$preNextFile["nxt"],"left");
        $html .= printFile($dir, $file, $uri);
        $html .= "</div>";
        #end id=blog div
        $html .= printPostNav($uri, $dir, $preNextFile["pre"], $preNextFile["nxt"], "right");
    } else {
        $html .= listPosts($request, $filter);
        #end id=blog div
    }
    return $html;
}
示例#5
0
            echo $cat->name;
            ?>
</a></h3>
							<?php 
            listPosts('courses', $cat->slug);
        }
        ?>

					<h2 class='bordered'>Teachers</h2>
					<?php 
        listPosts('teachers', '');
        ?>

					<h2 class='bordered'>Alumni's Blog posts</h2>
					<?php 
        listPosts('post', '');
        ?>

				<?php 
    }
    ?>
			
			<?php 
} else {
    ?>
						
				<?php 
    get_template_part('includes/404');
    ?>

			<?php