示例#1
0
文件: sys_pdf.php 项目: mul14/FiyoCMS
function pdfParameter($value)
{
    $menu_id = Page_ID;
    $param = pageInfo($menu_id, 'parameter');
    $param = mod_param($value, $param);
    return 1;
}
示例#2
0
        $userFollows = Lib::query("SELECT * FROM followers WHERE user_id = ? AND topic_id = ?", $_SESSION["id"], $topic["id"]);
        $followed = false;
        if (count($userFollows) == 1) {
            $followed = true;
        }
        $counts = Lib::query("SELECT COUNT(*) AS count FROM posts WHERE topic_id = ?", $topic["id"]);
        $count = (int) $counts[0]["count"];
        $info = pageInfo($limit, $count);
        $rows = Lib::query("SELECT * FROM posts WHERE topic_id = ? ORDER BY id DESC LIMIT " . $info["start"] . ", " . $limit, $topic["id"]);
        $posts = formPosts($rows);
        render("topic.php", ["title" => $topic["name"], "topic" => $topic, "followed" => $followed, "posts" => $posts, "page" => $info["page"], "last" => $info["last"]]);
    } else {
        $limit = 15;
        $counts = Lib::query("SELECT COUNT(*) AS count FROM topics");
        $count = (int) $counts[0]["count"];
        $info = pageInfo($limit, $count);
        $topics = Lib::query("SELECT * FROM topics ORDER BY num_followers DESC LIMIT " . $info["start"] . ", " . $limit);
        render("topics.php", ["title" => "Topics", "topics" => $topics, "page" => $info["page"], "last" => $info["last"]]);
    }
} else {
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
        if (empty($_POST["name"])) {
            alert("Please name your new topic.", "danger");
            exit;
        }
        if (empty($_POST["description"])) {
            alert("Please describe your new topic", "danger");
            exit;
        }
        $shortname = shortname($_POST["name"]);
        $rows = Lib::query("SELECT * FROM topics WHERE (name = ? OR shortname = ?)", $_POST["name"], $shortname);
示例#3
0
            $pageType = $pageDetails['content_type'];
            $layout = $pageType;
            $activeModule = $pageType;
        }
        continue;
    }
    if (array_key_exists($module, $_GET)) {
        $layout = $key;
        $activeModule = $key;
        break;
    }
}
if (empty($layout) || $layout == "pages") {
    $layout = "default";
}
$index_page = pageInfo($clerk->getSetting("index_page", 1));
$index_page = $index_page['slug'];
$selectedPage = empty($_GET[getRemappedVar("pages")]) ? $index_page : $_GET[getRemappedVar("pages")];
foreach ($modules as $key => $val) {
    $module = getRemappedVar($key);
    if (!empty($_GET[getRemappedVar($key)]) && $module == getRemappedVar("pages")) {
        $selectedPage = $_GET[getRemappedVar($key)];
        break;
    } elseif (!empty($_GET[getRemappedVar($key)]) && $module != getRemappedVar("pages")) {
        $selectedPage = getRemappedVar($key);
        break;
    }
}
// Constants
call_anchor("site_init");
define("THEME", $clerk->getSetting("site_theme", 1));
示例#4
0
function prevProject($returnData = false)
{
    global $clerk;
    $projectsList = array();
    $orderedProjects = array();
    $currentProject = projectInfo(selectedProject());
    $currentIndex = 0;
    $count = 0;
    $page = pageInfo(currentPage());
    $options = prepare_settings($page['content_options']);
    $section = $clerk->query_fetchArray($clerk->query_select("project_sections", "", "WHERE name= '{$options['section']}' OR slug= '{$options['section']}' OR id='{$options['section']}'"));
    $section = $section['id'];
    if (!empty($section)) {
        $projects = $clerk->query_select("projects", "", "WHERE section= '{$section}' ORDER BY pos ASC");
    } else {
        $projects = $clerk->query_select("projects", "", "ORDER BY section, pos ASC");
    }
    while ($project = $clerk->query_fetchArray($projects)) {
        $projectsList[] = $project;
    }
    $getSections = $clerk->query_select("project_sections", "", "ORDER BY pos ASC");
    while ($section = $clerk->query_fetchArray($getSections)) {
        foreach ($projectsList as $p) {
            if ($p['section'] == $section['id']) {
                $orderedProjects[] = $p;
                if ($p['id'] == $currentProject['id']) {
                    $currentIndex = $count;
                }
                $count++;
            }
        }
    }
    if ($currentIndex == 0) {
        $prevProject = $orderedProjects[count($orderedProjects) - 1];
    } else {
        $prevProject = $orderedProjects[$currentIndex - 1];
    }
    if ($returnData) {
        $prevProject['link'] = linkToProject($prevProject['id']);
        return $prevProject;
    }
    return linkToProject($prevProject['id']);
}
示例#5
0
function page_type()
{
    global $page;
    $info = pageInfo(PAGE);
    return $info['content_type'];
}
示例#6
0
function prev_post($return_data = false)
{
    global $clerk, $blog;
    $post_list = array();
    $current_post = postInfo(selectedPost());
    $current_index = 0;
    $count = 0;
    $page = pageInfo(currentPage());
    $options = prepare_settings($page['content_options']);
    $defaults = array('order' => 'date', 'orderHow' => 'desc');
    $options = merge_settings($options, $defaults);
    $posts = $clerk->query_select("secretary_blog", "", "WHERE status= 1 ORDER BY {$options['order']} {$options['orderHow']}");
    while ($post = $clerk->query_fetchArray($posts)) {
        $post_list[] = $post;
        if ($post['id'] == $current_post['id']) {
            $current_index = $count;
        }
        $count++;
    }
    if ($current_index == 0) {
        $prev_post = $post_list[count($post_list) - 1];
    } else {
        $prev_post = $post_list[$current_index - 1];
    }
    if ($return_data) {
        $prev_post['link'] = post_link(false, $prev_post['id']);
        return $prev_post;
    }
    return post_link(false, $prev_post['id']);
}
示例#7
0
文件: site.php 项目: mul14/FiyoCMS
                    define('Page_ID', $pid);
                } else {
                    if (isset($_GET['pid']) and is_numeric($_GET['pid'])) {
                        define('Page_ID', pageInfo($_GET['pid'], 'id'));
                    } else {
                        define('Page_ID', oneQuery('menu', 'global', 1, 'id'));
                    }
                }
            }
        } else {
            if (SEF_URL) {
                if (!empty($pid) and $pid == menuInfo('id')) {
                    define('Page_ID', $pid);
                } else {
                    if (isset($_GET['pid']) and is_numeric($_GET['pid'])) {
                        define('Page_ID', pageInfo($_GET['pid'], 'id'));
                    } else {
                        $pid = @check_permalink('permalink', $_REQUEST['link'], 'pid');
                        if ($pid == 0) {
                            $pid = oneQuery('menu', 'global', 1, 'id');
                        }
                        if ($pid == 0) {
                            $pid = oneQuery('menu', 'home', 1, 'id');
                        }
                        define('Page_ID', $pid);
                    }
                }
            }
        }
    }
}