function siteTitle() { global $clerk; $title = $clerk->getSetting("site", 1); $title = call_anchor("siteTitle", $title); return $title; }
function home() { global $manager; echo '<div id="dashboard">'; call_anchor("dashboard"); echo '</div>'; }
function blogSettingsForm() { global $manager; $paths = $manager->clerk->getSetting("blog_path"); $upload_path = $paths['data1']; $upload_url = $paths['data2']; $thumbnail = $manager->clerk->getSetting("blog_thumbnail"); $intelliScaling = $manager->clerk->getSetting("blog_intelliscaling", 1); // Rules $manager->form->add_rule("upload_path"); $manager->form->add_rule("upload_url"); // Begin form $manager->form->add_to_form('<div class="col-4 last">'); $manager->form->add_fieldset("File Storage", "fileStorage"); $manager->form->add_input("text", "upload_path", "Upload Path", $upload_path, "", "", "This is the <strong>absolute path</strong> to the folder where images should be uploaded to. It should look something like this: <em>/home/user/mydomain.com/files/</em>"); $manager->form->add_input("text", "upload_url", "Upload URL", $upload_url, "", "", "This is the <strong>URL</strong> to the folder where images should be uploaded to. It should look something like this: <em>http://www.mydomain.com/files/</em>."); $manager->form->add_input("hidden", "old_uploadpath", "", $upload_path); $manager->form->close_fieldset(); $manager->form->add_to_form('</div><div class="col-2">'); $manager->form->add_fieldset("Post Thumbnails", "postThumbnails"); $manager->form->add_input("text", "thumbWidth", "Width", $thumbnail['data1']); $manager->form->add_input("text", "thumbHeight", "Height", $thumbnail['data2']); $manager->form->add_input("checkbox", "intelligentScaling", " ", $intelliScaling, array("Intelligent Scaling" => 1), "", ""); call_anchor("blogSettingsAfterThumbnails"); $manager->form->close_fieldset(); call_anchor("blogSettingsOtherSettings"); $manager->form->add_to_form('</div>'); call_anchor("blogSettingsAfter"); }
function settingsMenu($menu) { global $totalModules; $children = array(array('sys_name' => 'general', 'dis_name' => 'General Settings', 'url' => '', 'type' => '', 'hidden' => '')); $children = call_anchor("settings_menu", $children); $menu['settings'] = array('sys_name' => 'settings', 'dis_name' => 'Settings', 'order' => $totalModules, 'url' => '?cubicle=settings-general', 'type' => '', 'hidden' => '', 'children' => $children); return $menu; }
public function generateMenu() { if (MINI) { $menu = call_anchor("minimenu", array()); $menu = call_anchor("minimenu_modify", $menu); $this->menu = array($menu); } else { $menu = call_anchor("menu", array()); $menu = call_anchor("menu_modify", $menu); $this->menu = array($menu); } uasort($this->menu[0], array("Office", "menu_SortOrder")); $this->menu_html = $this->menu_MakeHTML($this->menu[0]); }
function pagesSettingsForm() { global $manager; // Variables $currentIndex = $manager->clerk->getSetting("index_page", 1); $pages = array("None" => "0"); $getPages = $manager->clerk->query_select("pages", "", "ORDER BY pos ASC"); while ($page = $manager->clerk->query_fetchArray($getPages)) { $pages[$page['name']] = $page['id']; } // Begin form $manager->form->add_fieldset("General Settings", "generalSettings"); $manager->form->add_select("index_page", "Site Index/Home Page", $pages, $currentIndex); $manager->form->close_fieldset(); call_anchor("pageSettingsForm"); }
function one_by_one($project, $files, $group) { global $clerk; foreach ($files as $file => $data) { if ($data['filegroup'] == $group['num']) { // Handle resizing of large image $settings = $clerk->getSetting("projects_fullsizeimg"); $do_scale = (bool) $settings['data3']; $intelliscale = (int) $settings['data2']; if ($do_scale) { list($width, $height) = explode("x", $settings['data1']); $image = dynamicThumbnail($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale); } else { list($width, $height) = getimagesize(PROJECTS_PATH . $project['slug'] . '/' . $data['file']); $image = '<img src="' . PROJECTS_URL . $project['slug'] . '/' . $data['file'] . '" width="' . $width . '" height="' . $height . '" alt="" />'; } switch ($data['type']) { case "image": $html .= '<div class="file"> ' . $image; // $html.= call_anchor( "onebyone_image_html", $add_html ); break; case "video": $html .= '<div class="file">' . mediaplayer($data, $project); break; case "audio": $html .= '<div class="file">' . audioplayer($data, $project); break; } if ($clerk->getSetting("projects_hideFileInfo", 1) == false && (!empty($data['title']) || !empty($data['caption']))) { $info_html = '<div class="info"> <span class="title">' . $data['title'] . '</span> <span class="caption">' . html_entity_decode($data['caption']) . '</span>'; $info_html = call_anchor("onebyone_info", array('html' => $info_html, 'file' => $data)); $info = $info_html['html'] . '</div>'; } $html .= $info . '</div>'; } $info = ""; } return $html; }
function makeDynamicThumbnail() { global $clerk; if (isset($_GET['dynamic_thumbnail']) == false) { return; } load_helper("ThumbLib.inc"); $file = $_GET['file']; $width = $_GET['width']; $height = $_GET['height']; $adaptive = $_GET['adaptive']; $file_extension = substr($file, strrpos($file, '.')); $cache_dir = $clerk->getSetting("cache_path", 1); $cache_file_name = str_replace($file_extension, "", basename($file)) . "." . $width . "x" . $height . "_" . $adaptive . ".jpg"; $path = $cache_dir . "/" . $cache_file_name; if (!is_dir($cache_dir)) { mkdir($cache_dir); } $thumb = PhpThumbFactory::create($file, array('resizeUp' => true)); $thumb->setFormat("JPG"); if ($adaptive == 0 || ($width == 0 || $height == 0)) { $thumb->resize($width, $height); } else { $thumb->adaptiveResize($width, $height); } $thumb->save($path); $data = call_anchor("modifyDynamicThumbnail", array("path" => $path, "filename" => $cache_file_name, "orig_filename" => basename($file), "thumb" => $thumb)); // Sharpen filter // for nicer thumbnails $path = $data['path']; $i = imagecreatefromjpeg($path); $sharpen_matrix = array(array(0.0, -0.8, 0.0), array(-0.8, 6.5, -0.8), array(0.0, -0.8, 0.0)); $divisor = array_sum(array_map('array_sum', $sharpen_matrix)); imageconvolution($i, $sharpen_matrix, $divisor, 0); imagejpeg($i, $path, 100); $path = $data['path']; header('Content-type: image/jpeg'); $image = imagecreatefromjpeg($path); imagejpeg($image, null, 100); imagedestroy($image); exit; }
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"; } if (file_exists(HQ . 'site/themes/' . THEME . '/css/ie/ie7.css')) { $file = HQ_URL . 'site/themes/' . THEME . '/css/ie/ie7.css'; echo '<!--[if IE 7]><link rel="stylesheet" href="' . $file . '" type="text/css" media="screen"><![endif]-->' . "\n"; } if (file_exists(HQ . 'site/themes/' . THEME . '/css/ie/ie8.css')) { $file = HQ_URL . 'site/themes/' . THEME . '/css/ie/ie8.css'; echo '<!--[if IE 8]><link rel="stylesheet" href="' . $file . '" type="text/css" media="screen"><![endif]-->' . "\n"; } call_anchor("theme_css_ie"); }
function themeEdit($id) { global $manager, $themes; $manager->form->add_fieldset("Theme Files", "edit"); $files = scanFolder(BASE_PATH . "site/themes/" . $id); $list = array(); $other = array("Other Files" => "OPTG"); foreach ($files as $f => $path) { if (is_dir($path)) { $list[$f] = "OPTG"; } elseif (is_file($path)) { if (strstr($path, ".jpg") || strstr($path, ".jpeg") || strstr($path, ".gif") || strstr($path, ".png")) { continue; } $val = $manager->office->URIquery("file", "file=" . $f); if (strstr($f, "/")) { $list[$f] = $val; } else { $other[$f] = $val; } } } $list = array_merge($list, $other); $manager->form->set_template("select_template", "select_jschange", true); $manager->form->add_select("files", "Select a file to edit", $list); $manager->form->reset_template("select_template"); call_anchor("themeAfterSelectFiles"); $manager->form->close_fieldset(); if (!empty($_GET['file'])) { call_anchor("themeBeforeFileEditor"); $manager->form->add_fieldset("File Editor: " . $_GET['file'], "fileEditor"); $manager->form->add_input("hidden", "file", "", $_GET['file']); $code = file_get_contents(BASE_PATH . "site/themes/" . $id . "/" . $_GET['file']); $code = htmlspecialchars($code); // Because Receptionist has some parsing issues... $manager->form->add_to_form('<textarea id="code" name="code" cols="140" rows="40" class="code">' . $code . '</textarea>'); $manager->form->close_fieldset(); call_anchor("themeAfterFileEditor"); } }
$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); $upload_file = $upload[0]; $upload_error = $upload[1]; } if (empty($upload_error)) { $currentThumb = $_POST['uploadPath'] . $slug . "/" . $project['thumbnail']; $deleteCurrent = file_exists($currentThumb) && is_file($currentThumb) ? unlink($currentThumb) : true; $file_extension = substr($upload_file, strrpos($upload_file, '.')); $thumbnail_name = $clerk->simple_name(str_replace(array_merge($allowed_file_types, array(".thumbnail", ".thumb")), "", $upload_file)) . ".project" . $file_extension; rename($destination . $upload_file, $destination . $thumbnail_name); call_anchor("modifyProjectThumbAfterSave", array($thumb, $destination . $thumbnail_name)); if ($clerk->query_edit("projects", "thumbnail= '{$thumbnail_name}'", "WHERE id= '{$id}'") && $deleteCurrent) { echo '<img src="' . $_POST['uploadUrl'] . $slug . '/' . $thumbnail_name . '" alt="" />'; } } else { echo $upload_error; } }
} 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)); define("THEME_URL", HQ_URL . "site/themes/" . THEME . "/"); define("LAYOUT", "layout_" . $layout . ".php"); define("ACTIVE_MODULE", $activeModule); define("PAGE", $selectedPage); // Check if layout exists. if (file_exists(HQ . "site/themes/" . THEME . "/" . LAYOUT) == false) { echo "Oops! Looks like your theme is missing the layout file, <em>" . LAYOUT . "</em>.<br /><br />Create this file and upload it to the root of your theme's folder. Don't forget to fill it with template tags and your custom HTML!"; exit; } call_anchor("site_begin"); require_once "themes/" . THEME . "/" . LAYOUT;
function projectSettingsForm() { global $manager; $paths = $manager->clerk->getSetting("projects_path"); $upload_path = $paths['data1']; $upload_url = $paths['data2']; $projThumb = $manager->clerk->getSetting("projects_thumbnail"); $fileThumb = $manager->clerk->getSetting("projects_filethumbnail"); $intelliScaling = $manager->clerk->getSetting("projects_intelliscaling", 1); $hideSections = $manager->clerk->getSetting("projects_hideSections", 1); $hideFileInfo = $manager->clerk->getSetting("projects_hideFileInfo", 1); $resizeProjThumb = $manager->clerk->getSetting("resizeProjThumb", 1); $projects_thumbnailIntelliScaling = $manager->clerk->getSetting("projects_thumbnailIntelliScaling", 1); $fullsizeimg = $manager->clerk->getSetting("projects_fullsizeimg"); $fullsizeimg_wh = explode("x", $fullsizeimg['data1']); $slideshow_opts = unserialize($manager->clerk->getSetting("slideshow_opts", 1)); // Rules $manager->form->add_rule("upload_path"); $manager->form->add_rule("upload_url"); // Begin form $manager->form->add_to_form('<div class="col-4 last">'); $manager->form->add_fieldset("File Storage", "fileStorage"); $manager->form->add_input("text", "upload_path", "Upload Path", $upload_path, "", "", "This is the <strong>absolute path</strong> to the folder where images should be uploaded to. It should look something like this: <em>/home/user/mydomain.com/files/</em>"); $manager->form->add_input("text", "upload_url", "Upload URL", $upload_url, "", "", "This is the <strong>URL</strong> to the folder where images should be uploaded to. It should look something like this: <em>http://www.mydomain.com/files/</em>."); $manager->form->add_input("hidden", "old_uploadpath", "", $upload_path); $manager->form->close_fieldset(); $manager->form->add_to_form('</div><div class="col-2">'); $manager->form->add_fieldset("Project Thumbnails", "projectThumbnails"); $manager->form->add_input("text", "projThumbWidth", "Width", $projThumb['data1']); $manager->form->add_input("text", "projThumbHeight", "Height", $projThumb['data2']); $manager->form->set_template("row_start", "row_start_blank", true); $manager->form->add_input("checkbox", "resizeProjThumb", " ", $resizeProjThumb, array("Resize project thumbnails" => 1), "", ""); $manager->form->add_input("checkbox", "projects_thumbnailIntelliScaling", " ", $projects_thumbnailIntelliScaling, array("Intelligent Scaling" => 1), "", ""); call_anchor("projectThumbnailSettings_Checkboxes"); $manager->form->reset_template("row_start"); $manager->form->close_fieldset(); $manager->form->add_fieldset("File/Image Thumbnails", "fileThumbnails"); $manager->form->add_input("text", "fileThumbWidth", "Width", $fileThumb['data1']); $manager->form->add_input("text", "fileThumbHeight", "Height", $fileThumb['data2']); $manager->form->add_input("checkbox", "image_intelligentScaling", " ", $intelliScaling, array("Intelligent Scaling " => 1), "", ""); $manager->form->close_fieldset(); $manager->form->add_fieldset("Full-size Images", "fullsize_images"); $manager->form->add_input("text", "fullsizeimg_width", "Width", $fullsizeimg_wh[0]); $manager->form->add_input("text", "fullsizeimg_height", "Height", $fullsizeimg_wh[1]); $manager->form->add_input("checkbox", "fullsizeimg_do_scale", " ", $fullsizeimg['data3'], array("Resize Images " => 1), "", ""); $manager->form->add_input("checkbox", "fullsizeimg_intelli", " ", $fullsizeimg['data2'], array("Intelligent Scaling " => 1), "", ""); $manager->form->close_fieldset(); $manager->form->add_to_form('</div><div class="col-2 last">'); $manager->form->add_fieldset("Other Settings", "otherSettings"); $manager->form->set_template("row_start", "row_start_blank", true); $manager->form->set_template("row_end", '<span class="caption">(depends on theme)</span></div>'); $manager->form->add_input("checkbox", "hideSections", " ", $hideSections, array('Hide Section Titles' => 1)); $manager->form->reset_template("row_end"); $manager->form->add_input("checkbox", "hideFileInfo", " ", $hideFileInfo, array("Hide File Captions & Titles" => 1)); $manager->form->reset_template("row_start"); call_anchor("projectSettingsOtherSettings"); $manager->form->close_fieldset(); $manager->form->add_fieldset("Slideshow Options", "slideshow_opts"); $manager->form->add_input("radio", "slideshow_nav_pos", "Navigation Position", $slideshow_opts['nav_pos'], array("Top" => "top", "Bottom" => "bottom")); $manager->form->add_to_form('<div class="field"><label>Navigation</label><br />'); $manager->form->set_template("row_start", ""); $manager->form->set_template("row_end", ""); $manager->form->set_template("text_template", "text_short_html5", true); $manager->form->add_input("text", "prev", "Previous", $slideshow_opts['prev'], ""); $manager->form->add_input("text", "divider", "Divider", $slideshow_opts['divider'], ""); $manager->form->add_input("text", "next", "Next ", $slideshow_opts['next'], ""); $manager->form->add_input("text", "of", "(# of total)", $slideshow_opts['of'], ""); $manager->form->add_to_form('</div>'); $manager->form->reset_template("text_template"); $manager->form->reset_template("row_start"); $manager->form->reset_template("row_end"); $transitions = array('Fade' => 'fade', 'Blind Horizontal' => 'blindX', 'Blind Vertical' => 'blindY', 'Scroll Up' => 'scrollUp', 'Scroll Down' => 'scrollDown', 'Scroll Left' => 'scrollLeft', 'Scroll Right' => 'scrollRight', 'Uncover' => 'uncover', 'None' => 'none'); $manager->form->add_select("slideshow_fx", "Transition", $transitions, $slideshow_opts['fx']); $manager->form->close_fieldset(); $manager->form->add_to_form('</div>'); call_anchor("projectSettingsAfter"); }
function projects_rss() { global $clerk, $project; $feed = new FeedWriter(RSS2); $title = $clerk->getSetting("site", 1); $feed->setTitle($title . ' / Projects Feed'); $feed->setLink(linkToSite()); $feed->setDescription('Live feed of projects on ' . $title); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); $projects = $clerk->query_select("projects", "", "WHERE publish= 1 ORDER BY id DESC"); while ($project = $clerk->query_fetchArray($projects)) { $newItem = $feed->createNewItem(); $newItem->setTitle($project['title']); $newItem->setLink(html_entity_decode(linkToProject($project['id']))); $newItem->setDate($project['date']); $desc = projectThumbnail(); $desc = call_anchor("projectsRssDescription", $desc); $newItem->setDescription('' . $desc . ''); $newItem->addElement('guid', linkToProject($project['id']), array('isPermaLink' => 'true')); $feed->addItem($newItem); $count = 0; $desc = ""; } $feed->genarateFeed(); }
function editForm() { global $manager; // Define required variables $id = $_GET['id']; $data = $manager->clerk->query_fetchArray($manager->clerk->query_select("pages", "", "WHERE id= '{$id}' LIMIT 1")); // Rules $manager->form->add_rule("name"); // Begin form $manager->form->add_to_form('<div class="col-2">'); $manager->form->add_fieldset("Page Details", "pageDetails"); $manager->form->add_input("hidden", "id", NULL, $id); $manager->form->add_input("text", "name", "Name", $data['name']); $manager->form->add_input("text", "slug", "Simple Name / Slug", $data['slug']); $manager->form->add_input("text", "url", "Link", $data['url'], "", "", "Use this option to override this page's link in your menu. This is useful if you want to link to an external blog, forum or page from within your menu."); $manager->form->set_template("textarea_template", "textareaWithEditor", true); $manager->form->add_textarea("text", "Text", "15", "", $data['text']); $manager->form->reset_template("textarea_template"); call_anchor("pages_manage_after_text", $data); $manager->form->add_input("checkbox", "hidden", " ", $data['hidden'], array("Hide from menu" => 1)); $manager->form->close_fieldset(); $manager->form->add_to_form('</div><div class="col-2 last">'); $manager->form->add_fieldset("Page Type", "pageType"); $manager->form->set_template("text_template", "textSuperLong", true); $manager->form->set_template("select_template", "selectLong", true); $contentTypes = array("None" => "none"); foreach ($manager->office->getMenu() as $key => $module) { if ($module['type'] == "content") { $contentTypes[$module['dis_name']] = $module['sys_name']; } } $contentTypes = call_anchor("pageContentTypes", $contentTypes); $selectedType = empty($data['content_type']) ? "None" : $data['content_type']; $manager->form->add_select("content_type", "Type", $contentTypes, $selectedType, "Choose the type of content you would like to attach to this page."); $manager->form->add_input("text", "content_options", "Options", $data['content_options'], "", "Enter a comma separated list of options"); $manager->form->reset_template("text_template"); $manager->form->reset_template("select_template"); $manager->form->message('Need help with this? Read the <a href="http://help.thesecretary.org/kb/faq/what-is-the-page-type-and-how-do-i-use-it" class="external">how to</a> in the User Guide.'); call_anchor("pages_manage_after_type", $data); $manager->form->close_fieldset(); $manager->form->add_to_form('</div>'); }
function newGroup() { global $clerk, $anchors; $groupNum = $_POST['groupNum']; $displayers = call_anchor("displayersList", array()); $count = 0; foreach ($displayers as $d) { $count++; if ($count == 1) { $sel = ' selected= "selected"'; } else { $sel = ""; } $displayersList .= '<option value="' . $d . '"' . $sel . '>' . array_search($d, $displayers) . '</option>'; } $html = <<<HTML \t\t\t<ul id="file_group-{$groupNum}" class="fileGroup" data-type="group"> \t\t\t\t<li> \t\t\t\t\t<div class="controls"> \t\t\t\t\t\t<ul> \t\t\t\t\t\t\t<li class="handle"> \t\t\t\t\t\t\t\tDrag \t\t\t\t\t\t\t</li> \t\t\t\t\t\t\t<li class="title"> \t\t\t\t\t\t\t\tGroup {$groupNum} \t\t\t\t\t\t\t</li> \t\t\t\t\t\t\t<li class="displayer"> \t\t\t\t\t\t\t\t<select class="displayType" onchange="setGroupDisplayer({$groupNum}, this)"> \t\t\t\t\t\t\t\t\t{$displayersList} \t\t\t\t\t\t\t\t</select> \t\t\t\t\t\t\t</li> \t\t\t\t\t\t\t<li class="delete"> \t\t\t\t\t\t\t\t<a href="#" onclick="deleteGroup({$groupNum}); return false;">Delete</a> \t\t\t\t\t\t\t</li> \t\t\t\t\t\t</ul> \t\t\t\t\t</div> \t\t\t\t</li> \t\t\t</ul> HTML; echo $html; }
function process() { global $manager; $_POST = $manager->clerk->clean($_POST); call_anchor("form_process"); }
function mmTextTransform($matches) { global $clerk; $chars = '.*?'; $patterns = array('/{image:(' . $chars . ')(\\s)}/', '/{image:(' . $chars . ')}/', '/{(\\s)image:(' . $chars . ')(\\s)}/', '/{(\\s)image:(' . $chars . ')}/', '/{thumb:(' . $chars . ')(\\s)}/', '/{thumb:(' . $chars . ')}/', '/{(\\s)thumb:(' . $chars . ')(\\s)}/', '/{(\\s)thumb:(' . $chars . ')}/', '/{file:(' . $chars . '):(' . $chars . ')}/', '/{file:(' . $chars . ')}/'); $patterns = call_anchor("mmPatterns", $patterns); $file = $matches[2]; $size = @getimagesize(MMPATH . $file); $size = $size[3]; // $file is an image if ($size) { $thumbWidth = $clerk->getSetting("mediamanager_thumbnail", 1); $thumbHeight = $clerk->getSetting("mediamanager_thumbnail", 2); $thumb = dynamicThumbnail($file, MMPATH, $thumbWidth, $thumbHeight, 1, "short"); $thumbWidth = $thumbWidth == 0 ? "auto" : $thumbWidth; $thumbHeight = $thumbHeight == 0 ? "auto" : $thumbHeight; $thumbSize = 'width="' . $thumbWidth . '" height="' . $thumbHeight . '"'; } else { $parts = explode(":", $matches[1]); $text = empty($parts[0]) ? $parts[1] : $parts[0]; $file = count($parts) == 1 ? $parts[0] : $parts[1]; } $replacements = array('<img src="' . MMURL . $file . '" alt="" class="align-left" ' . $size . ' />', '<img src="' . MMURL . $file . '" alt="" ' . $size . ' />', '<img src="' . MMURL . $file . '" alt="" class="align-center" ' . $size . ' />', '<img src="' . MMURL . $file . '" alt="" class="align-right" ' . $size . ' />', '<img src="' . $thumb . '" alt="" class="align-left" ' . $thumbSize . ' />', '<img src="' . $thumb . '" alt="" ' . $thumbSize . ' />', '<img src="' . $thumb . '" alt="" class="align-center" ' . $thumbSize . ' />', '<img src="' . $thumb . '" alt="" class="align-right" ' . $thumbSize . ' />', '<a href="' . MMURL . $file . '">' . $text . '</a>', '<a href="' . MMURL . $file . '">' . $file . '</a>'); $replacements = call_anchor("mmReplacements", $replacements); $text = preg_replace($patterns, $replacements, $matches[0]); return $text; }
function prefsForm() { global $manager; // Variables $self = $manager->clerk->query_fetchArray($manager->clerk->query_select("users", "", "WHERE username= '******'USERNAME') . "' AND password= '******'PASSWORD') . "'")); $site = $manager->clerk->getSetting("site"); $site = array('name' => $site['data1'], 'url' => $site['data2']); $cleanUrls = $manager->form->submitted() ? $_POST['clean_urls'] : $manager->clerk->getSetting("clean_urls", 1); $cache_path = $manager->clerk->getSetting("cache_path", 1); $cache_url = $manager->clerk->getSetting("cache_path", 2); // Rules $manager->form->add_rule("email", "/^[A-Z0-9._%\\-]+@[A-Z0-9._%\\-]+\\.[A-Z]{2,4}\$/i", "", $manager->form->e_message['email']); $manager->form->add_rule("site_name"); $manager->form->add_rule("site_url"); $manager->form->add_rule("cache_path"); $manager->form->add_rule("cache_url"); // Begin form // $manager->form->add_to_form( '<div class="col-2">' ); $manager->form->add_fieldset("Personal Settings", "personalSettings"); $manager->form->add_input("text", "username", "Username", $self['username']); $manager->form->add_input("text", "display_name", "Name", $self['display_name']); $manager->form->add_input("password", "password", "New Password"); $manager->form->add_input("password", "password_conf", "Confirm Password"); $manager->form->add_input("text", "email", "E-mail*", $self['email']); call_anchor("prefsPersonalSettings"); $manager->form->close_fieldset(); call_anchor("prefsCol1"); // $manager->form->add_to_form( '</div><div class="col-2 last>"' ); $manager->form->add_fieldset("Site Settings", "siteSettings"); $manager->form->add_input("text", "site_name", "Site Name", $site['name']); $manager->form->add_input("text", "site_url", "Site URL", $site['url']); $manager->form->add_input("checkbox", "clean_urls", " ", $cleanUrls, array("Clean URLs" => 1)); call_anchor("prefsSiteSettings"); $manager->form->close_fieldset(); $manager->form->add_fieldset("Cache", "cache"); $manager->form->add_input("text", "cache_path", "Cache Path", $cache_path, "", "", "This is the <strong>absolute path</strong> to the folder where cached files should be saved to. It should look something like this: <em>/home/user/mydomain.com/files/cache/</em>"); $manager->form->add_input("text", "cache_url", "Cache URL", $cache_url, "", "", "This is the <strong>URL</strong> to the folder where cached files should be saved to. It should look something like this: <em>http://www.mydomain.com/files/cache/</em>."); $manager->form->add_input("hidden", "old_cache_path", "", $cache_path); $manager->form->add_to_form('Empty Cache Folders: <span class="delete singleButton"><a href="' . $manager->office->URIquery("", "emptycache=true") . '">EMPTY</a></span>'); $manager->form->close_fieldset(); call_anchor("prefsCol2"); // $manager->form->add_to_form( '</div>' ); call_anchor("prefsMisc"); }
function pop($project, $files, $group) { global $clerk; $html = ""; $slides = ""; $totalFiles = 0; foreach ($files as $file => $data) { if ($data['filegroup'] == $group['num']) { $totalFiles++; // Handle resizing of large image $settings = $clerk->getSetting("projects_fullsizeimg"); $do_scale = (bool) $settings['data3']; $intelliscale = $settings['data2']; if ($do_scale) { list($width, $height) = explode("x", $settings['data1']); $fullsize = dynamicThumbnail($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale, "short"); if (dynamic_thumb_saved($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale)) { list($width, $height) = getimagesize(get_dynamic_thumb($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale)); } else { $width = $width == 0 ? "auto" : $width; $height = $height == 0 ? "auto" : $height; } } else { list($width, $height) = getimagesize(PROJECTS_PATH . $project['slug'] . '/' . $data['file']); $fullsize = PROJECTS_URL . $project['slug'] . '/' . $data['file']; } // Handle thumbnail $thumbFile = $data['file']; $thumbWidth = $clerk->getSetting("projects_filethumbnail", 1); $thumbHeight = $clerk->getSetting("projects_filethumbnail", 2); $intelliScaling = $clerk->getSetting("projects_intelliscaling", 1); $location = PROJECTS_PATH . $project['slug'] . "/"; $thumbnail = dynamicThumbnail($thumbFile, $location, $thumbWidth, $thumbHeight, $intelliScaling, "short"); switch ($data['type']) { case "image": $thumbWidth = $thumbWidth == 0 ? "auto" : $thumbWidth; $thumbHeight = $thumbHeight == 0 ? "auto" : $thumbHeight; $slides .= '<div class="file" id="file' . $data['id'] . '"> <a class="popper" onclick="popper(\'' . $data['id'] . '\', \'' . $width . '\', \'' . $height . '\');return false;" href="#"><img src="' . $thumbnail . '" width="' . $thumbWidth . '" height="' . $thumbHeight . '" alt="' . $fullsize . '" alt="" /></a>'; break; case "video": $title = empty($data['title']) ? "Video" : $data['title']; $mediaThumb = empty($data['thumbnail']) ? $title : '<img src="' . $thumbnail . '" width="' . $thumbWidth . '" height="' . $thumbHeight . '" />'; $slides .= '<div class="file" id="file' . $data['id'] . '"><a class="popper" href="#" onclick="popper(\'' . $data['id'] . '\', \'' . $width . '\', \'' . $height . '\', true);return false;">' . $mediaThumb . '</a><div class="popcontent">' . mediaplayer($data, $project) . '</div>'; break; case "audio": $title = empty($data['title']) ? "Audio" : $data['title']; $mediaThumb = empty($data['thumbnail']) ? $title : '<img src="' . $thumbnail . '" width="' . $thumbWidth . '" height="' . $thumbHeight . '" />'; $slides .= '<div class="file" id="file' . $data['id'] . '"><a class="popper" href="#" onclick="popper(\'' . $data['id'] . '\', \'' . $width . '\', \'' . $height . '\', true);return false;">' . $mediaThumb . '</a><div class="popcontent">' . audioplayer($data, $project) . '</div>'; break; } if ($clerk->getSetting("projects_hideFileInfo", 1) == false && (!empty($data['title']) || !empty($data['caption']))) { $info_html = '<div class="info"> <span class="title">' . $data['title'] . '</span> <span class="caption">' . html_entity_decode($data['caption']) . '</span>'; $info_html = call_anchor("pop_info", array('html' => $info_html, 'file' => $data)); $info = $info_html['html'] . '</div>'; } $slides .= $info . '</div>'; } $info = ""; } return $slides; }
$clerk->query_insert("project_files", "file, thumbnail, width, height, project_id, pos, type, filegroup", "'{$file}', '{$thumbnail_name}', '{$width}', '{$height}', '{$id}', '{$pos}', '{$type}', '{$group}'"); $fileId = mysql_insert_id(); $thumb_path = $paths['path'] . $slug . "/" . $thumbnail_sysname; $thumb_url = $paths['url'] . $slug . "/" . $thumbnail_sysname; $big_path = $paths['path'] . $slug . "/" . $file; if ($type == "image") { $thumb_path = $paths['path'] . $slug . '/' . $file; $file_extension = substr($file, strrpos($file, '.')); $cache_file_name = str_replace($file_extension, "", $file) . "." . 100 . "x" . 100 . "_1.jpg"; $dynamic_thumb = file_exists($clerk->getSetting("cache_path", 1) . $cache_file_name) ? $clerk->getSetting("cache_path", 2) . $cache_file_name : $clerk->getSetting("site", 2) . "?dynamic_thumbnail&file=" . $thumb_path . '&width=' . 100 . '&height=' . 100 . '&adaptive=1'; $thumb = '<img src="' . $dynamic_thumb . '" alt="" />'; } else { $thumb = '<span class="media">' . $file . '</span>'; } $file_data = array('id' => $fileId, 'file' => $file, 'thumbnail' => $thumbnail_name, 'width' => $width, 'height' => $height, 'project_id' => $id, 'pos' => $pos, 'type' => $type, 'group' => $group); $file_toolbar = call_anchor("project_file_toolbar", array('html' => "", 'file' => $file_data)); $html = ' <li class="filebox" id="file_' . $fileId . '"> <div class="thumbnail"> ' . $thumb . ' </div> <ul class="toolbar"> <li onmouseover="toolbar_show(' . $fileId . ')" onmouseout="toolbar_hide(' . $fileId . ')"> <a href="#" class="edit">Edit</a> <ul class="options"> <li><a href="#" onclick="toolbar_delete(' . $fileId . '); return false;">Delete</a></li> <li><a href="#" onclick="toolbar_details(' . $fileId . '); return false;">Edit details</a></li> ' . $file_toolbar['html'] . ' </ul> </li>
function editProjectForm($allowed_file_types) { global $manager; // Define required variables $id = $_GET['id']; $project = $manager->clerk->query_fetchArray($manager->clerk->query_select("projects", "", "WHERE id= '{$id}' LIMIT 1")); $paths = $manager->getSetting("projects_path"); $paths = array('path' => $paths['data1'], 'url' => $paths['data2']); $displayersOptList = array(); $displayers = call_anchor("displayersList", array()); $currentThumb = empty($project['thumbnail']) ? "" : '<img src="' . $paths['url'] . $project['slug'] . '/' . $project['thumbnail'] . '" alt="" />'; $deleteLink = empty($project['thumbnail']) ? " hide" : ""; // Rules $manager->form->add_rule("title"); // Begin Form $manager->form->add_fieldset("Project Details", "projectDetails"); $manager->form->add_input("hidden", "id", NULL, $id); $manager->form->add_input("hidden", "oldslug", NULL, $project['slug']); $manager->form->add_to_form('<div class="col-2">'); $manager->form->add_input("text", "title", "Title", $project['title']); $manager->form->add_input("text", "slug", "Simple Name / Slug", $project['slug']); $manager->form->set_template("row_end", ""); $manager->form->set_template("text_template", "text_supershort", true); $manager->form->add_to_form('<div class="field date"><label>Date</label><br />'); $current_month = date("F"); $months = array("January" => "1", "February" => "2", "March" => "3", "April" => "4", "May" => "5", "June" => "6", "July" => "7", "August" => "8", "September" => "9", "October" => "10", "November" => "11", "December" => "12"); $manager->form->add_select("date_month", NULL, $months, date("F", $project['date'])); $current_day = date("j"); for ($i = 1; $i <= 31; $i++) { if ($i <= 9) { $day = "0" . $i; } else { $day = $i . " "; } $days[$day] = $i; } $manager->form->set_template("select_template", "select_supershort", true); $manager->form->set_template("option_template", "options_supershort", true); $manager->form->add_select("date_day", NULL, $days, date("j", $project['date'])); $current_year = date("Y"); for ($i = 2000; $i <= $current_year + 5; $i++) { $year = $i . " "; $years[$year] = $i; } $manager->form->add_input("text", "date_year", NULL, date("Y", $project['date'])); // $manager->form->add_to_form('</div>'); $manager->form->reset_template("text_template"); $manager->form->reset_template("option_template"); $manager->form->reset_template("select_template"); $manager->form->reset_template("row_end"); $tags = array(); $getTags = $manager->clerk->query_select("projects_to_tags", "", "WHERE projectid= '{$id}' ORDER BY id ASC"); while ($tag = $manager->clerk->query_fetchArray($getTags)) { $tags[] = $tag['tag']; } $manager->form->add_input("text", "tags", "Tags", implode(",", $tags)); $manager->form->add_input("checkbox", "publish", " ", $project['publish'], array("Publish" => 1)); call_anchor("projectFormAfterDetails"); $manager->form->add_to_form('</div>'); $manager->form->add_to_form('<div class="col-2 last">'); $manager->form->add_to_form('<div id="thumbnailForm">'); $manager->form->add_input("file", "Thumbnail", 'Project Thumbnail <span class="delete singleButton' . $deleteLink . '"><a href="#" onclick="deleteProjThumbnail(); return false;">Delete</a></span>'); $manager->form->add_to_form('<button type="submit" id="uploadThumbnail" name="uploadThumbnail" value="upload">Upload</button>'); $manager->form->add_input("hidden", "asstPath", "", $manager->clerk->config('ASSISTANTS_PATH')); $manager->form->add_input("hidden", "uploadPath", "", $paths['path']); $manager->form->add_input("hidden", "uploadUrl", "", $paths['url']); $manager->form->add_input("hidden", "id", "", $id); $manager->form->add_input("hidden", "action", "", "uploadThumbnail"); $manager->form->add_to_form('<div id="theThumb">' . $currentThumb . '</div>'); $manager->form->add_to_form('</div>'); call_anchor("projectFormAfterThumbnail"); $manager->form->add_to_form('</div>'); $manager->form->close_fieldset(); // call_anchor("projectFormBeforeFiles"); $manager->form->add_fieldset("Images, Video, Audio and Text", "files"); $tools = array('<a href="#" onclick="newGroup(\'top\'); return false;" class="button-new">New Group</a>', '<a href="#" onclick="addTextBlock(\'top\'); return false;" class="button-new">Add text block</a>'); $tools = call_anchor("projectFilesToolbar", $tools); $toolbar = new Toolbar(array("id" => "top", "tools" => $tools)); $manager->form->add_to_form('<div id="uploadForm">'); $manager->form->add_input("hidden", "asstPath", "", $manager->clerk->config('ASSISTANTS_PATH')); $manager->form->add_input("hidden", "uploadPath", "", $paths['path']); $manager->form->add_input("hidden", "uploadUrl", "", $paths['url']); $manager->form->add_input("hidden", "action", "", "upload"); $manager->form->add_input("hidden", "id", "", $id); // Valums File Uploader $manager->form->add_to_form('<div id="file-uploader">upload files <span class="explanation">(<strong>Max ' . str_replace("M", "mb", ini_get("upload_max_filesize")) . '</strong> per file)</span></div>'); $manager->form->add_to_form('</div>'); $manager->form->add_to_form($toolbar->html); $flow = explode(",", $project['flow']); $projectFiles = array(); $getFiles = $manager->clerk->query_select("project_files", "", "WHERE project_id= '{$id}' ORDER BY pos ASC"); while ($file = $manager->clerk->query_fetchArray($getFiles)) { $projectFiles[$file['id']] = $file; } foreach ($flow as $part) { if (strstr($part, "textblock")) { $fileID = str_replace("textblock", "", $part); $textblock_toolbar = array('html' => '<li class="delete"><a href="#" onclick="deleteGroup(' . $fileID . '); return false;">Delete</a></li>', 'file_id' => $fileID, 'file' => $projectFiles[$fileID]); $textblock_toolbar = call_anchor("projects_textblock_toolbar", $textblock_toolbar); $grouped .= ' <div id="file_group-' . $fileID . '" class="fileGroup textBlock" data-type="textblock"> <div class="controls"> <ul> <li class="handle"> Drag </li> <li class="textblockToolbar"> <div id="toolbar-textBlock_' . $fileID . '"></div> </li> ' . $textblock_toolbar['html'] . ' </ul> </div> <textarea id="textBlock_' . $fileID . '" class="textblock" rows="8" cols="50">' . html_entity_decode($projectFiles[$fileID]['caption']) . '</textarea> </div> '; } elseif (strstr($part, "group")) { $groupNum = preg_replace('/(group)([0-9]+)(:)*([a-zA-Z0-9-]+)?/', '$2', $part); $groupType = preg_replace('/(group)([0-9]+)(:)*([a-zA-Z0-9-]+)?/', '$4', $part); $list = displayersOptList($displayers, $groupType); $group_toolbar = array('html' => '<li class="delete"><a href="#" onclick="deleteGroup(' . $groupNum . '); return false;">Delete</a></li>', 'group_id' => $groupNum); $group_toolbar = call_anchor("projects_filegroup_toolbar", $group_toolbar); $grouped .= ' <ul id="file_group-' . $groupNum . '" class="fileGroup" data-type="group"> <li> <div class="controls"> <ul> <li class="handle"> Drag </li> <li class="title"> Group ' . $groupNum . ' </li> <li class="displayer"> <select class="displayType" onchange="setGroupDisplayer(' . $groupNum . ', this)"> ' . $list . ' </select> </li> ' . $group_toolbar['html'] . ' </ul> </div> </li> '; foreach ($projectFiles as $file => $data) { $fileID = $data['id']; if ($data['filegroup'] == $groupNum) { if ($data['type'] == "image") { $thumb_path = $manager->clerk->getSetting("projects_path", 1) . $project['slug'] . '/' . $data['file']; $file_extension = substr($data['file'], strrpos($data['file'], '.')); $cache_file_name = str_replace($file_extension, "", $data['file']) . "." . 100 . "x" . 100 . "_1.jpg"; $dynamic_thumb = file_exists($manager->clerk->getSetting("cache_path", 1) . $cache_file_name) ? $manager->clerk->getSetting("cache_path", 2) . $cache_file_name : $manager->clerk->getSetting("site", 2) . "?dynamic_thumbnail&file=" . $thumb_path . '&width=' . 100 . '&height=' . 100 . '&adaptive=1'; $thumb = empty($data['thumbnail']) == false ? '<img src="' . $dynamic_thumb . '" />' : ""; } else { $thumb = '<span class="media">' . $data['file'] . '</span>'; } $file_toolbar = call_anchor("project_file_toolbar", array('html' => "", 'file' => $data)); $grouped .= ' <li class="filebox" id="file_' . $fileID . '"> <div class="thumbnail"> ' . $thumb . ' </div> <ul class="toolbar"> <li onmouseover="toolbar_show(' . $fileID . ');" onmouseout="toolbar_hide(' . $fileID . ');"> <a href="#" class="edit">Edit</a> <ul class="options"> <li><a href="#" onclick="toolbar_delete(' . $fileID . '); return false;">Delete</a></li> <li><a href="#" onclick="toolbar_details(' . $fileID . '); return false;">Edit details</a></li> ' . $file_toolbar['html'] . ' </ul> </li> </ul> </li> '; unset($projectFiles[$file]); } } $grouped .= ' </ul> '; } else { $others = call_anchor("project_content_flow_backend", array('part' => $part, 'grouped' => "")); $grouped .= $others['grouped']; } } foreach ($projectFiles as $file => $data) { $fileID = $data['id']; if ($data['filegroup'] == 0 && $data['type'] != "text") { if ($data['type'] == "image") { $thumb_path = $manager->clerk->getSetting("projects_path", 1) . $project['slug'] . '/' . $data['file']; $file_extension = substr($data['file'], strrpos($data['file'], '.')); $cache_file_name = str_replace($file_extension, "", $data['file']) . "." . 100 . "x" . 100 . "_1.jpg"; $dynamic_thumb = file_exists($manager->clerk->getSetting("cache_path", 1) . $cache_file_name) ? $manager->clerk->getSetting("cache_path", 2) . $cache_file_name : $manager->clerk->getSetting("site", 2) . "?dynamic_thumbnail&file=" . $thumb_path . '&width=' . 100 . '&height=' . 100 . '&adaptive=1'; $thumb = empty($data['thumbnail']) == false ? '<img src="' . $dynamic_thumb . '" />' : ""; } elseif ($data['type'] == "video" || $data['type'] == "audio") { $thumb = '<span class="media">' . $data['file'] . '</span>'; } else { continue; } $file_toolbar = call_anchor("project_file_toolbar", array('html' => "", 'file' => $data)); $waiting .= ' <li class="filebox" id="file_' . $fileID . '"> <div class="thumbnail"> ' . $thumb . ' </div> <ul class="toolbar"> <li onmouseover="toolbar_show(' . $fileID . ');" onmouseout="toolbar_hide(' . $fileID . ');"> <a href="#" class="edit">Edit</a> <ul class="options"> <li><a href="javascript:void(0)" onclick="toolbar_delete(' . $fileID . ')">Delete</a></li> <li><a href="javascript:void(0)" onclick="toolbar_details(' . $fileID . ')">Edit details</a></li> ' . $file_toolbar['html'] . ' </ul> </li> </ul> </li> '; } } $hide = empty($waiting) ? " hide" : ""; $manager->form->add_to_form(' <div id="groupedFiles"> <ul id="waitingRoom" class="fileGroup' . $hide . '"> <li> <div class="controls"> <ul> <li class="formMessage"> <strong>Ungrouped Files</strong> / Drag these files to a group </li> </ul> </div> </li> ' . $waiting . ' </ul> '); $manager->form->add_to_form($grouped . ' </div> '); if (count($flow) < 3) { $bottomToolbarClass = " hide"; } $tools = array('<a href="#" onclick="newGroup(\'bottom\'); return false;" class="button-new">New Group</a>', '<a href="#" onclick="addTextBlock(\'bottom\'); return false;" class="button-new">Add text block</a>'); $tools = call_anchor("projectFilesToolbarBottom", $tools); $toolbar = new Toolbar(array("id" => "bottom", "class" => $bottomToolbarClass, "tools" => $tools)); $manager->form->add_to_form($toolbar->html); $manager->form->close_fieldset(); call_anchor("projectFormAfterFiles"); }
function slideshow($project, $files, $group) { global $clerk; $html = ""; $slides = ""; $totalFiles = 0; foreach ($files as $file => $data) { if ($data['filegroup'] == $group['num']) { $totalFiles++; // Handle resizing of large image $settings = $clerk->getSetting("projects_fullsizeimg"); $do_scale = (bool) $settings['data3']; $intelliscale = (int) $settings['data2']; if ($do_scale) { list($width, $height) = explode("x", $settings['data1']); $image = dynamicThumbnail($data['file'], PROJECTS_PATH . $project['slug'] . '/', $width, $height, $intelliscale); } else { list($width, $height) = getimagesize(PROJECTS_PATH . $project['slug'] . '/' . $data['file']); $image = '<img src="' . PROJECTS_URL . $project['slug'] . '/' . $data['file'] . '" width="' . $width . '" height="' . $height . '" alt="" />'; } switch ($data['type']) { case "image": $slides .= '<div class="file"> ' . $image; break; case "video": $slides .= '<div class="file">' . mediaplayer($data, $project); break; case "audio": $slides .= '<div class="file">' . audioplayer($data, $project); break; } if ($clerk->getSetting("projects_hideFileInfo", 1) == false && (!empty($data['title']) || !empty($data['caption']))) { $info = ""; $info_html = '<div class="info"> <span class="title">' . $data['title'] . '</span> <span class="caption">' . html_entity_decode($data['caption']) . '</span>'; $info_html = call_anchor("slideshow_info", array('html' => $info_html, 'file' => $data)); $info = $info_html['html'] . '</div>'; } $slides .= $info . '</div>'; } $info = ""; } if ($totalFiles == 0) { return; } $opts = unserialize($clerk->getSetting("slideshow_opts", 1)); foreach ($opts as $key => $val) { $opts[$key] = html_entity_decode($val); } $of = str_replace(array("#", "total"), array('<span class="currentSlide">1</span>', $totalFiles), $opts['of']); $nav_html = <<<HTML \t\t\t<div class="slideshow-nav"><a href="#" class="prev">{$opts['prev']}</a> {$opts['divider']} <a href="#" class="next">{$opts['next']}</a> {$of}</div> HTML; $nav = call_anchor("slideshow_nav", array("html" => $nav_html, "total_files" => $totalFiles)); $jquery_slideshow_opts = call_anchor("jquery_slideshow_opts", array('js' => '', 'project' => $project, 'group' => $group)); if (empty($jquery_slideshow_opts['js']) == false) { $jquery_slideshow_opts['js'] = "," . $jquery_slideshow_opts['js']; } if (empty($opts['fx'])) { $opts['fx'] = "fade"; } if ($opts['nav_pos'] == "top") { $html = <<<HTML \t\t\t{$nav['html']} \t\t\t<div class="slides"> \t\t\t\t{$slides} \t\t\t</div> HTML; } else { $html = <<<HTML \t\t\t<div class="slides"> \t\t\t\t{$slides} \t\t\t</div> \t\t\t{$nav['html']} HTML; } $html .= <<<HTML \t\t\t<script type="text/javascript" charset="utf-8"> \t\t\t\tjQuery(window).load( function() \t\t\t\t{ \t\t\t\t\tjQuery("#{$project['slug']}-{$group['num']} .slides").cycle( \t\t\t\t\t\t{ \t\t\t\t\t\t\tfx: '{$opts['fx']}', \t\t\t\t\t\t\tslideExpr: '.file', \t\t\t\t\t\t\ttimeout: 0, \t\t\t\t\t\t\tspeed: 500, \t\t\t\t\t\t\tnext: '#{$project['slug']}-{$group['num']} .next, #{$project['slug']}-{$group['num']} .file', \t\t\t\t\t\t\tprev: '#{$project['slug']}-{$group['num']} .prev', \t\t\t\t\t\t\tprevNextClick: function(isNext, index, el) \t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\tjQuery("#{$project['slug']}-{$group['num']} .currentSlide").text(index + 1); \t\t\t\t\t\t\t}, \t\t\t\t\t\t\tbefore: function(curr, next, opts, fwd) \t\t\t\t\t\t\t{ \t\t\t\t\t\t\t\tvar ht = jQuery(next).height(); \t\t\t\t\t\t\t \tjQuery(this).parent().animate({height: ht}); \t\t\t\t\t\t\t} \t\t\t\t\t\t\t{$jquery_slideshow_opts['js']} \t\t\t\t\t\t} \t\t\t\t\t); \t\t\t\t}); \t\t\t</script> HTML; return $html; }
function pageText($id = "") { global $clerk; $id = empty($id) ? PAGE : $id; if (!empty($id)) { $page = $clerk->query_fetchArray($clerk->query_select("pages", "", "WHERE id='{$id}' OR slug='{$id}' LIMIT 1")); $text = call_anchor("pageTextModify", array('original' => $page['text'], 'modified' => textOutput($page['text']))); return $text['modified']; } }
function blog_rss() { global $clerk, $blog; $feed = new FeedWriter(RSS2); $title = $clerk->getSetting("site", 1); $feed->setTitle($title . ' / Blog Feed'); $feed->setLink(linkToSite()); $feed->setDescription('Live feed of blog posts on ' . $title); $feed->setChannelElement('pubDate', date(DATE_RSS, time())); $get = $clerk->query_select("secretary_blog", "", "ORDER BY date DESC"); while ($blog = $clerk->query_fetchArray($get)) { $newItem = $feed->createNewItem(); $newItem->setTitle($blog['title']); $newItem->setLink(html_entity_decode(linkToPost(false, $blog['id']))); $newItem->setDate($blog['date']); $desc = postImage() . '<br />' . postText(); $desc = call_anchor("blogRssDescription", $desc); $newItem->setDescription('' . $desc . ''); $newItem->addElement('guid', linkToPost(), array('isPermaLink' => 'true')); $feed->addItem($newItem); $count = 0; $desc = ""; } $feed->genarateFeed(); }
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title><?php echo siteTitle(); ?> </title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <?php call_anchor("css_frontend"); call_anchor("js_frontend"); ?> </head> <body> <div id="header"> <div id="title"> <a href="<?php echo linkToSite(); ?> "><?php echo siteTitle(); ?> </a> </div> <div id="menu"> <?php echo pageList(); ?> <?php echo projectList(); ?>
function processEditBlogForm($blogFileTypes) { global $manager; $id = $_POST['id']; $title = $_POST['title']; $slug = empty($_POST['slug']) ? $manager->clerk->simple_name($title) : $_POST['slug']; $oldSlug = $_POST['oldslug']; $now = getdate($_POST['date_timestamp']); $date = mktime($now["hours"], $now["minutes"], $now["seconds"], $_POST["date_month"], $_POST["date_day"], $_POST["date_year"]); $post = $_POST['post']; $currentImage = $_POST['currentImage']; $status = $_POST['status']; $paths = $manager->getSetting("blog_path"); $paths = array('path' => $paths['data1'], 'url' => $paths['data2']); $postFolder = $paths['path'] . $oldSlug . '/'; if ($_POST['submit'] == "save") { if ($manager->clerk->query_countRows("secretary_blog", "WHERE slug= '{$slug}' AND id != '{$id}'") >= 1) { $manager->message(0, false, 'A post with the simple name/slug <em>"' . $slug . '"</em> already exists! Please choose a new one.'); return false; } // Handle image if (!is_dir($postFolder)) { mkdir($postFolder, 0777); } $thumbWidth = $manager->clerk->getSetting("blog_thumbnail", 1); $thumbHeight = $manager->clerk->getSetting("blog_thumbnail", 2); $intelliscaling = (bool) $manager->clerk->getSetting("blog_intelliscaling", 1); $forceAdaptive = $thumbWidth == 0 || $thumbHeight == 0 ? true : false; $newImage = true; foreach ($_FILES['image']['name'] as $key => $val) { if (empty($val)) { $newImage = false; continue; } $file_extension = substr(basename($val), strrpos(basename($val), '.')); $image = $manager->clerk->simple_name(str_replace($blogFileTypes, "", basename($val))) . $file_extension; if ($image == $currentImage) { $newImage = false; } $upload = upload('image', $key, $postFolder, implode(",", $blogFileTypes)); $upload_file = $upload[0]; $upload_error = $upload[1]; rename($postFolder . $upload_file, $postFolder . $image); if (empty($upload_error)) { $thumb = PhpThumbFactory::create($postFolder . $image); $thumbnail_name = str_replace($blogFileTypes, "", $image) . ".thumb" . substr($image, strrpos($image, '.')); if ($intelliscaling == true && $forceAdaptive == false) { $thumb->adaptiveResize($thumbWidth, $thumbHeight); } else { $thumb->resize($thumbWidth, $thumbHeight); } call_anchor("modifyPostThumb", $thumb); $thumb->save($postFolder . $thumbnail_name); call_anchor("modifyPostThumbAfterSave", array($thumb, $postFolder . $thumbnail_name)); } } if ($newImage == false) { $image = $currentImage; } if ($newImage && file_exists($postFolder . $currentImage) && is_file($postFolder . $currentImage)) { $currentImageThumb = str_replace($blogFileTypes, "", $currentImage) . ".thumb" . substr($currentImage, strrpos($currentImage, '.')); unlink($postFolder . $currentImage); unlink($postFolder . $currentImageThumb); } if (empty($upload['error']) && $manager->clerk->query_edit("secretary_blog", "title= '{$title}', slug= '{$slug}', date= '{$date}', post= '{$post}', image= '{$image}', status='{$status}'", "WHERE id= '{$id}'")) { $manager->message(1, false, "Post <em>{$title}</em> saved!"); // Handle renaming if ($slug != $oldSlug && is_dir($paths['path'] . $oldSlug)) { rename($paths['path'] . $oldSlug, $paths['path'] . $slug); } if ($newImage) { $pic = PhpThumbFactory::create($paths['path'] . $slug . '/' . $image); $pic->resize(400, 0); $pic->save($paths['path'] . $slug . '/' . $image); } } else { $manager->message(0, true, "This post could not be saved!"); } } elseif ($_POST['submit'] == "delete") { rmdirr($paths['path'] . $oldSlug); if (file_exists($postFolder . '/' . $currentImage) && is_file($postFolder . '/' . $currentImage)) { unlink($postFolder . '/' . $currentImage); } if ($manager->clerk->query_delete("secretary_blog", "WHERE id= '{$id}'")) { $manager->message(1, false, "Post <em>{$title}</em> deleted!"); } else { $manager->message(0, true, "Could not delete post!"); } } }