// Head // This will output code into the end of the head section of the HTML, this allows you to load in external CSS, JavaScript etc case 'head': break; // Show Module // This is where your module will output into the content div on the page // Show Module // This is where your module will output into the content div on the page default: // Switch $m (our second variable from the URL) and adjust ouput accordingly switch ($m) { // $m is set to tag the we want to filter our links page to only check this tag case 'tag': if ($x) { // turn $x back into a tag from a slug $x = squash_slug($x); if (isset($s)) { extract(safe_row('*', 'pixie_core', "page_name = '{$s}'")); } // find all the links with a matching tag to $x $rz = safe_rows('*', 'pixie_module_links', "tags REGEXP '[[:<:]]" . $x . "[[:>:]]'"); if ($rz) { echo "<div "; if (isset($s)) { echo "id=\"{$s}\""; } echo ">\n\t\t\t\t\t<h3>{$page_display_name}</h3>\n"; $num = count($rz); echo "\t\t\t\t\t<div id=\"{$x}\" class=\"link_list\">\n\t\t\t\t\t\t<h4>" . ucwords($x) . "</h4>\n\t\t\t\t\t\t<ul>\n"; $i = 0; // now loop out the results
function show_all($rs) { global $s, $m, $x, $p, $mtitle, $site_url, $comments, $lang, $date_format, $posts_per_page, $timezone; echo "<h3>{$mtitle}</h3>\n"; if (!$m) { if (isset($s)) { $page_description = safe_field('page_description', 'pixie_core', "page_name='{$s}'"); //echo "\t\t\t\t\t<div id=\"page_description\">$page_description</div>"; } } $i = 0; if ($rs) { while ($a = nextRow($rs)) { extract($a); $logunix = returnUnixtimestamp($posted); $date = safe_strftime($date_format, $logunix); $microformat = safe_strftime('%Y-%m-%dT%T%z', $logunix); $slug = $post_slug; $fullname = safe_field('realname', 'pixie_users', "user_name='{$author}'"); if (public_page_exists('profiles')) { $mauthor = "<a href=\"" . createURL('profiles', $author) . "\" class=\"url fn\" title=\"" . $lang['view'] . " {$fullname}'s " . $lang['profile'] . "\">{$fullname}</a>"; } else { $mauthor = "<a href=\"{$site_url}\" class=\"url fn\" title=\"{$site_url}\">{$fullname}</a>"; } if (isset($tags) && $tags) { $all_tags = strip_tags($tags); $all_tags = str_replace('"', "", $tags); $tags_array_temp = explode(" ", $all_tags); for ($count = 0; $count < count($tags_array_temp); $count++) { $current = $tags_array_temp[$count]; $first = $current[strlen($current) - strlen($current)]; if ($first == " ") { $current = substr($current, 1, strlen($current) - 1); } $ncurrent = make_slug($current); if (isset($s) && isset($current)) { if (!isset($tag_list)) { $tag_list = NULL; } $tag_list .= "<a href=\"" . createURL($s, 'tag', $ncurrent) . "\" title=\"{$lang['view']} {$lang['all_posts_tagged']}: {$current}\" rel=\"tag\" >{$current}</a>, "; } else { $tag_list = NULL; } if (isset($ncurrent) && $ncurrent != "") { if (!isset($class_list)) { $class_list = NULL; } $class_list .= "tag_{$ncurrent} "; } else { $class_list = NULL; } } $tag_list = substr($tag_list, 0, strlen($tag_list) - 2) . ""; } $comms = safe_rows('*', 'pixie_module_comments', "post_id = '{$post_id}'"); $no_comms = count($comms); if (isset($s)) { $permalink = createURL($s, 'permalink', $slug); } $authorclass = strtolower($author); $timeclass = safe_strftime('y%Y m%m d%d h%H', $logunix); if (is_even($i + 1)) { $type = 'post_even'; } else { $type = 'post_odd'; } $num = $i + 1; echo "\n\t\t\t\t\t<div class=\"section hentry author_{$authorclass} {$class_list}{$timeclass} {$type} post_" . $num . "\" id=\"post_{$post_id}\">\n\t\t\t\t\t\t<h4 class=\"entry-title\"><a href=\"{$permalink}\" rel=\"bookmark\">{$title}</a></h4>\n\t\t\t\t\t\t<ul class=\"post_links\">\n\t\t\t\t\t\t\t<li class=\"post_date\"><abbr class=\"published\" title=\"{$microformat}\">{$date}</abbr></li>\n\t\t\t\t\t\t\t<li class=\"post_permalink\"><a href=\"{$permalink}\" title=\"" . $lang['permalink_to'] . ": {$title}\">" . $lang['permalink'] . "</a></li>"; if (public_page_exists('comments')) { if ($comments == 'yes' or $no_comms) { echo "\n\t\t\t\t\t\t\t<li class=\"post_comments\"><a href=\"{$permalink}#comments\" title=\"" . $lang['comments'] . "\">" . $lang['comments'] . "</a> ({$no_comms})</li>"; } } if (isset($_COOKIE['pixie_login'])) { list($username, $cookie_hash) = explode(',', $_COOKIE['pixie_login']); $nonce = safe_field('nonce', 'pixie_users', "user_name='{$username}'"); if (md5($username . $nonce) == $cookie_hash) { $privs = safe_field('privs', 'pixie_users', "user_name='{$username}'"); if ($privs >= 1) { echo "\n\t\t\t\t\t\t\t<li class=\"post_edit\"><a href=\"" . $site_url . "admin/?s=publish&m=dynamic"; if (isset($s)) { echo '&x=' . $s; } echo "&edit={$post_id}\" title=\"" . $lang['edit_post'] . "\">" . $lang['edit_post'] . "</a></li>"; } } } echo "\n\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t<div class=\"post entry-content\">\n"; //<!--more--> $post = get_extended($content); echo "\t\t\t\t\t\t\t" . $post['main']; if ($post['extended']) { echo "\n\t\t\t\t\t\t\t<p><a href=\"{$permalink}\" class=\"read-more\" title=\"" . $lang['continue_reading'] . " {$title}\">" . $lang['continue_reading'] . " {$title}...</a></p>"; } echo "\n\t\t\t\t\t\t</div>\t\n\t\t\t\t\t\t<div class=\"post_credits\">\n\t\t\t\t\t\t \t<span class=\"vcard author\">" . $lang['by'] . " {$mauthor}</span>\n\t\t\t\t\t\t \t<span class=\"post_tags\">" . $lang['tagged'] . ": {$tag_list}</span>\n\t\t\t\t\t\t</div>\t\t\t\t\n\t\t\t\t\t</div>\n\n"; $tag_list = ""; $class_list = ""; $i++; } } echo "\t\t\t\t\t<div id=\"nav_pages\" class=\"dynamic_bottom_nav\">\n"; if (!$m or $m == 'page') { // how many posts do we have in total? if (isset($page_id)) { $totalposts = count(safe_rows('*', 'pixie_dynamic_posts', "page_id = '{$page_id}' and public = 'yes'")); } else { $totalposts = 0; } if ($m == 'page') { $currentnum = $posts_per_page * $x; $nextpage = $x + 1; $previouspage = $x - 1; } else { $nextpage = 2; $currentnum = $posts_per_page; } //print $totalposts." - ".$currentnum; if ($totalposts > $currentnum) { // then we need to link onto the next page echo "\t\t\t\t\t\t<div id=\"page_next\" class=\"link_next\"><a class=\"link_next_a\" href=\""; if (isset($s)) { echo createURL($s, 'page', $nextpage); } echo "\" title=\"" . $lang['next_page'] . ": {$nextpage}\">" . $lang['next_page'] . " »</a></div>\n"; } if ($m == 'page') { if ($x >= 2) { if ($previouspage == 1) { echo "\t\t\t\t\t\t<div id=\"page_previous\" class=\"link_previous\"><a class=\"link_prev_a\" href=\""; if (isset($s)) { echo createURL($s); } echo "\" title=\"" . $lang['previous_page'] . ": {$previouspage}\">« " . $lang['previous_page'] . "</a></div>\n"; } else { echo "\t\t\t\t\t\t<div id=\"page_previous\" class=\"link_previous\"><a class=\"link_prev_a\" href=\""; if (isset($s)) { echo createURL($s, 'page', $previouspage); } echo "\" title=\"" . $lang['previous_page'] . ": {$previouspage}\">« " . $lang['previous_page'] . "</a></div>\n"; } } } } else { if ($m == 'tag') { $p = squash_slug($p); $totalposts = count(safe_rows('*', 'pixie_dynamic_posts', "page_id = '{$page_id}' and public = 'yes' and tags REGEXP '[[:<:]]" . $x . "[[:>:]]'")); if ($p) { $currentnum = $posts_per_page * $p; $nextpage = $p + 1; $previouspage = $p - 1; } else { $nextpage = 2; $currentnum = $posts_per_page; } //print $totalposts." - ".$currentnum; if ($totalposts > $currentnum) { // then we need to link onto the next page echo "\t\t\t\t\t\t<div id=\"page_next\" class=\"link_next\"><a class=\"link_next_a\" href=\"" . createURL($s, $m, $x, $nextpage) . "\" title=\"" . $lang['next_page'] . ": {$nextpage}\">" . $lang['next_page'] . " »</a></div>\n"; } if ($p >= 2) { if ($previouspage == 1) { echo "\t\t\t\t\t\t<div id=\"page_previous\" class=\"link_previous\"><a class=\"link_prev_a\" href=\"" . createURL($s, $m, $x) . "\" title=\"" . $lang['previous_page'] . ": {$previouspage}\">« " . $lang['previous_page'] . "</a></div>\n"; } else { echo "\t\t\t\t\t\t<div id=\"page_previous\" class=\"link_previous\"><a class=\"link_prev_a\" href=\"" . createURL($s, $m, $x, $previouspage) . "\" title=\"" . $lang['previous_page'] . ": {$previouspage}\">« " . $lang['previous_page'] . "</a></div>\n"; } } // pagination for tags pages needs to be different... coming soon } } echo "\t\t\t\t\t</div>\n"; }
if (isset($ck) && $ck) { echo "<input type=\"hidden\" name=\"ck\" value=\"1\" />"; } if (isset($ckfile) && $ckfile) { echo "<input type=\"hidden\" name=\"ckfile\" value=\"1\" />"; } if (isset($ckimage) && $ckimage) { echo "<input type=\"hidden\" name=\"ckimage\" value=\"1\" />"; } echo "\t\t\t\t</div>\r\n\t\t\t\t\t\t</fieldset>\r\n\t\t\t\t\t\t</form>\r\n\t\t\t\t\t</div>"; $type = 'module'; admin_block_tag_cloud('pixie_files', 'file_id >= 0'); echo "\t\t\t\t</div>\n"; if (isset($tag) && $tag) { $title = $lang['file_manager_tagged'] . " " . $tag; $tag = squash_slug($tag); $rs = safe_rows_start('*', 'pixie_files', "tags REGEXP '[[:<:]]" . $tag . "[[:>:]]' order by file_name"); } else { $title = $lang['file_manager_latest']; $rs = safe_rows_start('*', 'pixie_files', "file_type != 'x' order by file_id desc limit 30"); } echo "\r\n\t\t\t\t<div id=\"pixie_content\" class=\"filemanager\">\r\n\t\t\t\t\t<h2>" . $lang['nav2_files'] . "</h2>"; if (isset($ck) && $ck) { $messageok = $lang['ck_select_file']; } echo "\t\t\t\t\t<div id=\"filemanager_table\">\r\n\t\t\t\t\t\t<table class=\"tbl\" summary=\"" . $title . " @ " . str_replace('http://', "", $site_url) . "\">\r\n\t\t\t\t\t\t<thead>\r\n\t\t\t\t\t\t\t<tr>\r\n\t\t\t\t\t\t\t\t<th class=\"tbl_heading\" id=\"theicon\"></th>\r\n\t\t\t\t\t\t\t\t<th class=\"tbl_heading\" id=\"thefilename\">" . $lang['filename'] . "</th>"; if (!isset($ck) or !$ck) { echo "<th class=\"tbl_heading\" id=\"thedatestamp\">" . $lang['filedate'] . "</th>"; } echo "\t\t\t\t\t\t\t<th class=\"tbl_heading\" id=\"thetags\">" . $lang['tags'] . "</th>\r\n\t\t\t\t\t\t\t\t<th class=\"tbl_heading\" id=\"thefile_view\"></th>\r\n\t\t\t\t\t\t\t\t<th class=\"tbl_heading\" id=\"thefile_delete\"></th>\r\n\t\t\t\t\t\t\t</tr>\r\n\t\t\t\t\t\t</thead>\r\n\t\t\t\t\t\t<tbody>"; if ($rs) {
function build_title() { global $site_name, $page_display_name, $page_type, $s, $m, $x, $p; // will probably need support for child pages! if ($page_type == 'dynamic' && $m == 'permalink') { $post_title = safe_field('title', 'pixie_dynamic_posts', "post_slug = '{$x}'"); if ($post_title) { echo "{$site_name} - {$page_display_name} - {$post_title}"; } else { echo "{$site_name}"; /* escaping other language characters can cause an error. */ } } else { if ($m == 'tag') { if ($p) { echo "{$site_name} - {$page_display_name} - Tag - " . simplify(squash_slug($x)) . " - Page {$p}"; } else { echo "{$site_name} - {$page_display_name} - Tag - " . simplify(squash_slug($x)); } } else { if ($m == 'page') { echo "{$site_name} - {$page_display_name} - " . simplify($m) . " " . simplify($x); } else { if ($m) { echo "{$site_name} - {$page_display_name} - " . simplify($m); } else { echo "{$site_name} - {$page_display_name}"; } } } } }
function admin_overview($table_name, $condition, $order_by, $asc_desc, $exclude = array(NULL), $view_number, $type) { global $page, $message, $s, $m, $x, $messageok, $search_submit, $field, $search_words, $tag, $lang; $table_name = adjust_prefix($table_name); $searchwords = trim($search_words); if ($page) { $searchwords = $search_submit; } if ($search_submit && isset($table_name)) { $searchwords = sterilise($searchwords, FALSE); //build search sql $r2 = safe_query("show fields from {$table_name}"); for ($j = 0; $j < mysql_num_rows($r2); $j++) { if ($F = mysql_fetch_array($r2)) { $an[$j] = $F['Field']; } if (last_word($an[$j]) != 'id') { if ($an[$j] != 'posted') { if ($an[$j] != 'author') { if ($an[$j] != 'comments') { if ($an[$j] != 'public') { if (first_word($an[$j]) != 'last') { if ($an[$j] != 'date') { $search_sql .= $an[$j] . " like '%" . $searchwords . "%' OR "; } } } } } } } } $search_sql = substr($search_sql, 0, strlen($search_sql) - 3) . ""; //echo $search_sql; } if (isset($tag)) { $tag = squash_slug($tag); } if (isset($table_name)) { if ($search_submit) { if ($m == 'dynamic') { $page_id = get_page_id($x); $r1 = safe_query("select * from {$table_name} where page_id = '{$page_id}' and (" . $search_sql . ") order by {$order_by} {$asc_desc}"); } else { $r1 = safe_query("select * from {$table_name} where " . $search_sql . " order by {$order_by} {$asc_desc}"); } } else { if (isset($tag) && $tag) { $r1 = safe_query("select * from {$table_name} where tags REGEXP '[[:<:]]" . $tag . "[[:>:]]' order by {$order_by} {$asc_desc}"); } else { $r1 = safe_query("select * from {$table_name} {$condition} order by {$order_by} {$asc_desc}"); } } } if ($r1) { $total = mysql_num_rows($r1); if (!isset($page) && isset($table_name)) { $lo = 0; $page = 1; if ($search_submit) { if ($m == 'dynamic') { $page_id = get_page_id($x); $r = safe_query("select * from {$table_name} where page_id = '{$page_id}' and (" . $search_sql . ") order by {$order_by} {$asc_desc}"); } else { $r = safe_query("select * from {$table_name} where " . $search_sql . " order by {$order_by} {$asc_desc}"); } } else { if (isset($tag) && $tag) { $r = safe_query("select * from {$table_name} where tags REGEXP '[[:<:]]" . $tag . "[[:>:]]' order by {$order_by} {$asc_desc}"); } else { $r = safe_query("select * from {$table_name} {$condition} order by {$order_by} {$asc_desc} limit {$lo},{$view_number}"); } } } else { if (isset($table_name)) { $lo = ($page - 1) * $view_number; if ($search_submit) { if ($m == 'dynamic') { $page_id = get_page_id($x); $r = safe_query("select * from {$table_name} where page_id = '{$page_id}' and (" . $search_sql . ") order by {$order_by} {$asc_desc}"); } else { $r = safe_query("select * from {$table_name} where " . $search_sql . " order by {$order_by} {$asc_desc}"); } } else { if (isset($tag) && $tag) { $r = safe_query("select * from {$table_name} where tags REGEXP '[[:<:]]" . $tag . "[[:>:]]' order by {$order_by} {$asc_desc}"); } else { $r = safe_query("select * from {$table_name} {$condition} order by {$order_by} {$asc_desc} limit {$lo},{$view_number}"); } } } } if ($r) { $rows = mysql_num_rows($r); $hi = $lo + $view_number; if ($hi > $total) { $finalmax = $total - $lo; $hi = $total; } $pages = ceil($total / $view_number); if ($pages < 1) { $pages = 1; } } /* Was : */ /* $a = &new Paginator_html($page, $total); */ /* but it's providing a "Assigning the return value of new by reference is deprecated" message. */ $a = new Paginator_html($page, $total); $a->set_Limit($view_number); $a->set_Links(4); $whereami = "?s={$s}&m={$m}&x={$x}"; if (isset($tag) && $tag) { $whereami = "?s={$s}&m={$m}&x={$x}&tag={$tag}"; } if ($search_submit) { $whereami = "?s={$s}&m={$m}&x={$x}&search_submit={$searchwords}"; } echo "\n\t\t\t\t\t<div class=\"admin_table_holder pcontent\">\n\t\t\t\t\t"; $wheream = "?s={$s}&m={$m}&x={$x}&page={$page}"; if (isset($table_name) && $rows) { if (isset($finalmax) && $finalmax) { } else { $finalmax = NULL; } $Table = new ShowTable($r, $exclude, $table_name, $view_number, $lo, $finalmax, $wheream, $type, $s); $Table->DrawBody(); $loprint = $lo + 1; echo "\n\t\t\t\t\t\t<div id=\"admin_table_overview\">\n\t\t\t\t\t\t\t<p>" . $lang['total_records'] . ": {$total} (" . $lang['showing_from_record'] . " {$loprint} " . $lang['to'] . " {$hi}) {$pages} " . $lang['page(s)'] . ".</p>\n\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t<div id=\"admin_table_pages\">\n\t\t\t\t\t\t\t"; echo "<p>"; $a->previousNext($whereami); echo "</p>"; echo "\n\t\t\t\t\t\t</div>"; } else { if ($search_submit or isset($tag) && $tag) { echo "<div class=\"helper\"><h3>" . $lang['help'] . "</h3><p>" . $lang['helper_search'] . "</p></div>"; } else { echo "<div class=\"helper\"><h3>" . $lang['help'] . "</h3><p>" . $lang['helper_nocontent'] . "</p></div>"; } echo "\n\t\t\t\t\t</div>\n"; } if ($rows) { echo "\n\t\t\t\t\t</div>\n"; } } }