<?php // Define anchors define_anchor("pagesSettings"); define_anchor("pageSettingsForm"); define_anchor("processPageSettingsForm"); // Define hooks hook("form_main", "pagesSettingsForm"); hook("form_process", "processPagesSettingsForm"); hook("form_submit_primary", "submitButtons"); // Functions function submitButtons() { global $manager; $manager->form->add_input('submit', 'submit', 'Save', 'save'); } function processPagesSettingsForm() { global $manager; $index_page = $_POST['index_page']; if ($manager->clerk->updateSetting("index_page", array($index_page))) { $manager->message(1, false, "Settings updated!"); } else { $manager->message(0, true, "Settings could not be updated!"); } call_anchor("processPageSettingsForm"); } function pagesSettingsForm() { global $manager; // Variables
<?php hook("menu", "homeMenu"); hook("big_message", "cacheWritable"); function cacheWritable() { global $manager; $path = $manager->clerk->getSetting("cache_path", 1); if (is_writable($path) == false) { message("warning", "Oh no! The cache folder is out of order! Files cannot be uploaded because the folder is not writable.<br />The current path set to: <em>{$path}</em><br /><br />Double check that both the path and permissions are correct. You can update the path <a href=\"?cubicle=settings-general\">here</a>."); } } if ($manager->office->cubicle("REQUEST") == "home") { define_anchor("dashboard"); hook("before_form", "home"); } function homeMenu($menu) { $menu['home'] = array('sys_name' => 'home', 'dis_name' => 'Dashboard', 'order' => 0, 'url' => '', 'type' => '', 'hidden' => '', 'children' => array(array('sys_name' => 'back', 'dis_name' => 'Back to Dashboard', 'url' => '?cubicle=home'), array('sys_name' => 'about', 'dis_name' => 'About', 'hidden' => 1))); return $menu; } function home() { global $manager; echo '<div id="dashboard">'; call_anchor("dashboard"); echo '</div>'; }
<?php // Define anchors define_anchor("blogSettingsAfterThumbnails"); define_anchor("blogSettingsOtherSettings"); define_anchor("blogSettingsAfter"); // Define hooks hook("form_main", "blogSettingsForm"); hook("form_submit_primary", "submitButtons"); hook("form_process", "processBlogSettingsForm"); // Functions function submitButtons() { global $manager; $manager->form->add_input('submit', 'submit', 'Save', 'save'); } function processBlogSettingsForm() { global $manager; $upload_path = $_POST['upload_path']; $upload_url = "http://" . str_replace("http://", "", $_POST['upload_url']); $old_uploadpath = $_POST['old_uploadpath']; // Prepare path and url... if (strrchr($upload_path, "/") != "/") { $upload_path .= "/"; } if (strrchr($upload_url, "/") != "/") { $upload_url .= "/"; } if ($upload_path != $old_uploadpath) { // Need to move files then...
<?php // Define anchors define_anchor("themeEdit"); define_anchor("themeAfterSelectFiles"); define_anchor("themeBeforeFileEditor"); define_anchor("themeAfterFileEditor"); define_anchor("themeEditProcess"); define_anchor("themeFormButtons"); define_anchor("themeEditJs"); // Define hooks hook("start", "registerThemes"); if ($_GET['action'] == "select") { hook("start", "selectTheme", array($_GET['id']), 1); hook("big_message", "themeSelected", array($_GET['id']), 1); hook("form_main", "themeList", "", 1); } elseif ($_GET['action'] == "edit") { hook("breadcrumbActive", "themeTitle", array($_GET['id'])); hook("form_main", "themeEdit", array($_GET['id'])); hook("javascript", "themeEditJs"); hook("form_process", "themeEditProcess"); if (!empty($_GET['file'])) { hook("form_submit_primary", "submitButtons"); } } else { hook("form_main", "themeList"); } hook("css", "themeEditCss"); // Define needed variables $themes = array(); $manager->clerk->preserve_vars("code");
<?php // Define anchors define_anchor("displayersList"); define_anchor("projectsOverviewToolbar"); define_anchor("projectFilesToolbar"); define_anchor("projectFilesToolbarBottom"); define_anchor("projectFormAfterDetails"); define_anchor("projectFormAfterThumbnail"); define_anchor("projectFormBeforeFiles"); define_anchor("projectFormAfterFiles"); // Load required helpers $manager->load_helper("interface"); // Define hooks if ($_GET['mode'] == "edit") { hook("form_process", "processEditProjectForm"); $id = $_GET['id']; $project = $manager->clerk->query_fetchArray($manager->clerk->query_select("projects", "", "WHERE id= '{$id}' LIMIT 1")); if ($_POST['submit'] != "delete") { hook("breadcrumbActive", "projectTitle", array($project)); hook("form_submit_primary", "submitButtons", array(0)); hook("form_submit_secondary", "submitButtons", array(1)); hook("form_main", "editProjectForm", array($allowed_file_types, $project)); } } elseif ($_GET['mode'] == "delete" && !empty($_GET['id'])) { hook("big_message", "projectDelete"); } if ($_GET['mode'] == "edit" && $_POST['submit'] == "delete" || $_GET['mode'] != "edit") { hook("action_bar", "projectsOverviewToolbar", "", 1); hook("form_main", "projects", "", 2); }
function hook($anchor, $function, $params = "", $order = -1) { global $anchors; if (!isset($anchors[$anchor])) { define_anchor($anchor); } if ($order == -1) { $order = count($anchors[$anchor]) + 1; } $anchors[$anchor][$function] = array($function, $params, $order); usort($anchors[$anchor], 'sort_hooks'); }
<?php error_reporting(0); array_push($_POST, 'system'); $_POST['system'] = array('path' => $_POST['system_path'], 'url' => $_POST['system_url']); define("AJAX", true); require_once $_POST['system']['path'] . "assistants/launch.php"; require_once $_POST['system']['path'] . "assistants/helpers/file_uploader.inc.php"; require_once $_POST['system']['path'] . "assistants/helpers/ThumbLib.inc.php"; define_anchor("modifyFileThumbAfterSave"); define_anchor("modifyFileThumb"); $paths = $clerk->getSetting("projects_path"); $paths = array('path' => $paths['data1'], 'url' => $paths['data2']); if ($_POST['action'] == "uploadThumbnail") { $project = $clerk->query_fetchArray($clerk->query_select("projects", "", "WHERE id= '" . $_POST['id'] . "' LIMIT 1")); $id = $_POST['id']; $slug = $project['slug']; $destination = $_POST['uploadPath'] . $slug . "/"; $thumbnails = $clerk->getSetting("projects_thumbnail"); $thumbWidth = $thumbnails['data1']; $thumbHeight = $thumbnails['data2']; $resizeProjThumb = $clerk->getSetting("resizeProjThumb", 1); $intelliscaling = (bool) $clerk->getSetting("projects_intelliscaling", 1); $forceAdaptive = $thumbWidth == 0 || $thumbHeight == 0 ? true : false; // Create set folder if it doesn't already exist if (!is_dir($destination)) { mkdir(substr($destination, 0, -1), 0755); } $allowed_file_types = array('.jpg', '.jpeg', '.gif', '.png'); foreach ($_FILES['Thumbnail']['name'] as $key => $val) { $upload = upload('Thumbnail', $key, $destination, implode(",", $allowed_file_types), true);
<?php // Define anchors define_anchor("pages_manage_after_text"); define_anchor("pages_manage_after_type"); define_anchor("pageContentTypes"); // Load required helpers $manager->load_helper("interface"); // Define hooks if ($_GET['mode'] == "edit") { $id = $_GET['id']; $data = $manager->clerk->query_fetchArray($manager->clerk->query_select("pages", "", "WHERE id= '{$id}' LIMIT 1")); hook("form_process", "processForm"); if ($_POST['submit'] != "delete") { hook("breadcrumbActive", "breadCrumbActive", array($data)); hook("form_submit_primary", "submitButtons", array(0)); hook("form_submit_secondary", "submitButtons", array(1)); hook("form_main", "editForm"); } } elseif ($_GET['mode'] == "delete" && !empty($_GET['id'])) { hook("big_message", "pageDelete"); } if ($_GET['mode'] == "edit" && $_POST['submit'] == "delete" || $_GET['mode'] != "edit") { hook("action_bar", "page_overview_toolbar", "", 1); hook("form_main", "listPages", "", 2); } hook("javascript", "formJavascript"); hook("head_tags", "formCss"); hook("form_main", "hiddenFields"); // Functions function hiddenFields()
<?php // Variables $project = ""; $paths = $clerk->getSetting("projects_path"); define("PROJECTS_PATH", $paths['data1']); define("PROJECTS_URL", $paths['data2']); // Anchors define_anchor("textblockModify"); define_anchor("projectsRssDescription"); // Hooks hook("uri_router", "projects_routes"); hook("site_init", "catch_selected_project"); function projects_routes($routes) { $projects = getRemappedVar('projects'); $routes[$projects . '/tags/([a-zA-Z0-9\\-_]+)'] = 'project_tags=$1'; // domain.com/projects/tags/tag $routes[$projects . '/([a-zA-Z0-9\\-_]+)'] = $projects . '=$1'; // domain.com/projects/project-slug return $routes; } function catch_selected_project() { if (projectSelected() == true) { hook("site_begin", "projectDisplayers"); } else { hook("site_begin", "dirtiness"); } } function projects($options = "")
<?php // Load required helpers $manager->load_helper("interface"); $manager->load_helper("file_uploader.inc"); $manager->load_helper("ThumbLib.inc"); // Anchors define_anchor("modifyPostThumb"); define_anchor("modifyPostThumbAfterSave"); define_anchor("blogOverviewToolbar"); // Define hooks if ($_GET['mode'] == "edit") { hook("form_process", "processEditBlogForm", array($blogFileTypes)); $id = $_GET['id']; $post = $manager->clerk->query_fetchArray($manager->clerk->query_select("secretary_blog", "", "WHERE id= '{$id}' LIMIT 1")); if ($_POST['submit'] != "delete") { hook("breadcrumbActive", "postTitle", array($post)); hook("form_submit_primary", "submitButtons", array(0)); hook("form_submit_secondary", "submitButtons", array(1, $post)); hook("form_main", "editBlogForm", array($blogFileTypes)); } } elseif ($_GET['mode'] == "delete" && !empty($_GET['id'])) { hook("big_message", "postDelete"); } if ($_GET['action'] == "deleteImage" && !empty($_GET['id'])) { hook("big_message", "postDelete", array(true)); } if ($_GET['mode'] == "edit" && $_POST['submit'] == "delete" || $_GET['mode'] != "edit") { hook("action_bar", "blogOverviewToolbar", "", 1); hook("form_main", "posts", "", 2); }
<?php remapModuleVar("pages", "page"); // Anchors define_anchor("pageTextModify"); // Hooks hook("uri_router", "page_routes"); hook("site_begin", "define_page"); $page = ""; function page_routes($routes) { $pages = getRemappedVar('pages'); $routes['([a-zA-Z0-9\\-_]+)'] = $pages . '=$1'; // domain.com/page-slug $routes['([a-zA-Z0-9\\-_]+)/(page)/([0-9]+)'] = $pages . '=$1&p=$3'; // domain.com/page-slug/page/3 $routes['([a-zA-Z0-9\\-_]+)/([a-zA-Z0-9\\-_]+)'] = $pages . '=$1&id=$2'; // domain.com/page-slug/content-slug return $routes; } function define_page() { global $page; $page = pageInfo(PAGE); } function pages() { return pageList(); } function index_page() {
<?php define_anchor("prefsSiteSettings"); define_anchor("prefsPersonalSettings"); define_anchor("prefsCol1"); define_anchor("prefsCol2"); define_anchor("prefsMisc"); hook("form_main", "prefsForm"); hook("form_process", "processPrefsForm"); hook("form_submit_primary", "submitButtons"); hook("big_message", "emptyCache"); // Functions function emptyCache() { global $manager; if ((bool) $_GET['emptycache'] == false) { return; } emptyDir($manager->clerk->getSetting("cache_path", 1)); $manager->message(1, false, "Cache folder emptied!"); } function processPrefsForm() { global $manager; $username = $_POST['username']; $name = $_POST['display_name']; $password = $_POST['password']; $passwordConf = $_POST['password_conf']; $email = $_POST['email']; $siteName = $_POST['site_name']; $siteUrl = $_POST['site_url'];
<?php define_anchor("theme_css"); define_anchor("theme_css_ie"); hook("css_frontend", "themeCss", "", 0); hook("css_frontend", "themeIECss", "", 1); function themeCss() { global $clerk; $file = HQ_URL . 'site/themes/' . THEME . '/css/main.css'; echo '<link rel="stylesheet" href="' . $file . '" type="text/css" media="screen" />' . "\n"; call_anchor("theme_css"); } /* * Automatically include IE specific stylesheets in conditional comments. * Supports IE all, 6, 7 and 8. * Super simple and straightforward, could be modified to dynamically * recognise files by version number. * IE is bad news! */ function themeIECss() { global $clerk; if (file_exists(HQ . 'site/themes/' . THEME . '/css/ie/ie.css')) { $file = HQ_URL . 'site/themes/' . THEME . '/css/ie/ie.css'; echo '<!--[if IE]><link rel="stylesheet" href="' . $file . '" type="text/css" media="screen"><![endif]-->' . "\n"; } if (file_exists(HQ . 'site/themes/' . THEME . '/css/ie/ie6.css')) { $file = HQ_URL . 'site/themes/' . THEME . '/css/ie/ie6.css'; echo '<!--[if IE 6]><link rel="stylesheet" href="' . $file . '" type="text/css" media="screen"><![endif]-->' . "\n"; }
<?php // Define anchors define_anchor("projectSettingsAfterThumbnails"); define_anchor("projectSettingsOtherSettings"); define_anchor("projectSettingsAfter"); // Define hooks hook("form_main", "projectSettingsForm"); hook("form_submit_primary", "submitButtons"); hook("form_process", "processProjectSettingsForm"); // Functions function submitButtons() { global $manager; $manager->form->add_input('submit', 'submit', 'Save', 'save'); } function processProjectSettingsForm() { global $manager; $upload_path = $_POST['upload_path']; $upload_url = "http://" . str_replace("http://", "", $_POST['upload_url']); $old_uploadpath = $_POST['old_uploadpath']; // Prepare path and url... if (strrchr($upload_path, "/") != "/") { $upload_path .= "/"; } if (strrchr($upload_url, "/") != "/") { $upload_url .= "/"; } if ($upload_path != $old_uploadpath) { // Need to move files then...
<?php error_reporting(0); define("AJAX", true); require_once $_POST['system']['path'] . "assistants/launch.php"; define_anchor("displayersList"); $paths = $clerk->getSetting("projects_path"); $paths = array('path' => $paths['data1'], 'url' => $paths['data2']); function update() { global $clerk; $file_id = $_POST['file_id']; $title = $_POST['title']; $caption = $_POST['caption']; echo $clerk->query_edit("project_files", "title= '{$title}', caption= '{$caption}'", "WHERE id= '{$file_id}'"); } function delete() { global $clerk; $paths = $clerk->getSetting("projects_path"); $paths = array('path' => $paths['data1'], 'url' => $paths['data2']); $projectId = $_POST['project_id']; $file_id = $_POST['file_id']; $project = $clerk->query_fetchArray($clerk->query_select("projects", "", "WHERE id= '{$projectId}'")); $file = $clerk->query_fetchArray($clerk->query_select("project_files", "", "WHERE id= '{$file_id}'")); $big = $file['file']; $thumbnail = $file['thumbnail']; $ok = $clerk->query_delete("project_files", "WHERE id= '{$file_id}'"); echo $bigFile = $paths['path'] . $project['slug'] . "/" . $big; // $thumbFile= $paths['path'] . $project['slug'] . "/" . $thumbnail; if (file_exists($bigFile)) {
hook("big_message", "mmWritable"); // Text modifiers hook("pageTextModify", "mmText"); hook("blogPostModify", "mmText"); hook("textblockModify", "mmText"); // GUI hook("javascript", "mmJs"); // Actions hook("settings-filecabinet", "mmSettingsDelegate"); hook("minimenu", "mmMenu"); hook("settings_menu", "mmMenuBig"); hook("mediamanager-insert", "mmInsertDelegate"); hook("mediamanager-upload", "mmUploadDelegate"); // Anchors define_anchor("mmPatterns"); define_anchor("mmReplacements"); $mmUpload = array('success' => false, 'file' => ''); // Functions function mmWritable() { global $manager; $path = MMPATH; if (is_writable($path) == false) { message("warning", "Oh no! The File Cabinet is out of order: files cannot be uploaded because the folder is not writable.<br />The current path set to: <em>{$path}</em><br /><br />Double check that both the path and permissions are correct. You can update the path <a href=\"?cubicle=home-settings\">here</a>."); } } function mmDelete() { global $manager; if (unlink(MMPATH . $_GET['id'])) { echo "true";