function build_rss() { global $site_url, $site_name; if (public_page_exists('rss')) { $i = 0; /* Prevents insecure undefined variable $i */ $rs = safe_rows_start('*', 'pixie_module_rss', "1 order by feed_display_name desc"); $num = count($rs); if ($rs) { while ($a = nextRow($rs)) { extract($a); echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"{$feed_display_name}\" href=\"{$url}\" />\n\t"; $i++; } } } else { $rs = safe_rows('*', 'pixie_dynamic_settings', "rss = 'yes'"); $num = count($rs); if ($rs) { $i = 0; while ($i < $num) { $out = $rs[$i]; $page_id = $out['page_id']; $rs1 = safe_row('*', 'pixie_core', "page_id = '{$page_id}' limit 0,1"); extract($rs1); echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"{$site_name} - {$page_display_name}\" href=\"{$site_url}{$page_name}/rss/\" />\n\t"; $i++; } } } }
// show module default: if (isset($s)) { extract(safe_row('*', 'pixie_core', "page_name = '{$s}'")); } echo "<div "; if (isset($s)) { echo "id=\"{$s}\""; } echo ">\r\n\t \t\t\t\t<h3>{$page_display_name}</h3>\r\n\t \t\t\t\t<h4>Whats all this then?</h4>\r\n\t \t\t\t\t<p>RSS or Really Simple Syndication, is a way of reading new content from websites. It allows you to keep informed of the latest developments\r\n\t \t\t\t\twithout the need to constantly revisit a site. Most sites now offer this feature, to find out more have a read of the \r\n\t \t\t\t\t<a href=\"http://en.wikipedia.org/wiki/RSS_(protocol)\" title=\"RSS @ Wikipedia\">Wikipedia entry</a> on RSS.</p>\r\n\t \t\t\t\t<h4>RSS Tools</h4>\r\n\t \t\t\t\t<p>Clicking on a feed should open it in your default feed reader. If you do not have a reader I recommend using <a href=\"http://www.google.com/reader/\" title=\"Google Reader\">\r\n\t \t\t\t\tGoogle's online</a> reader to get started. Once you get used to the idea try a software based solution. \r\n\t \t\t\t\tFor Apple users I recommend using <a href=\"http://newsfirerss.com/\" title=\"Newsfire RSS reader\">Newsfire</a>, or the built in RSS reader in <a href=\"http://www.apple.com/macosx/features/safari/\" title=\"Safari RSS reader\">Safari</a>. \r\n\t \t\t\t\tWindows users try <a href=\"http://www.blogbridge.com\" title=\"BlogBridge RSS reader\">BlogBridge</a>, or <a href=\"http://www.rssowl.org/\" title=\"RSSOwl RSS reader\">RSSOwl</a>.</p>\n"; $rs = safe_rows('*', 'pixie_dynamic_settings', "rss = 'yes'"); $num = count($rs); if ($rs) { $i = 0; echo "\t\t\t\t\t<h4>Local Feeds</h4>\r\n\t\t\t\t\t\t<ul id=\"local_feeds\">\n"; if (public_page_exists('rss')) { $rs = safe_rows_start('*', 'pixie_module_rss', '1 order by feed_display_name desc'); $num = count($rs); if ($rs) { while ($a = nextRow($rs)) { extract($a); echo "\t\t\t\t\t\t<li><a href=\"{$url}\" title=\"{$feed_display_name}\" />{$feed_display_name}</a></li>\n"; $i++; } } } else { while ($i < $num) { $out = $rs[$i]; $page_id = $out['page_id']; $rs1 = safe_row('*', 'pixie_core', "page_id = '{$page_id}' limit 0,1"); extract($rs1);
function show_single() { global $s, $m, $x, $mtitle, $site_url, $comments, $page_display_name, $site_name, $comment_ok, $date_format, $lang, $error, $scream, $sname, $semail, $scomment, $sweb, $timezone; $rs = safe_row('*', 'pixie_dynamic_posts', "post_slug = '{$x}' and public = 'yes' limit 0,1"); if ($rs) { extract($rs); safe_update('pixie_dynamic_posts', "post_views = {$post_views} + 1", "post_id = '{$post_id}'"); $logunix = returnUnixtimestamp($posted); $date = safe_strftime($date_format, $logunix); $timeunix = returnUnixtimestamp($last_modified); $xdate = safe_strftime($date_format, $timeunix); $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($ncurrent)) { if (isset($tag_list)) { } else { $tag_list = NULL; } $tag_list .= "<a href=\"" . createURL($s, 'tag', $ncurrent) . "\" title=\"" . $lang['view'] . " " . $lang['all_posts_tagged'] . ": " . $current . "\" rel=\"tag\" >" . $current . "</a>, "; } if ($ncurrent != "") { if (isset($class_list)) { } else { $class_list = NULL; } $class_list .= "tag_{$ncurrent} "; } } $tag_list = substr($tag_list, 0, strlen($tag_list) - 2) . ""; } if (isset($s)) { $permalink = createURL($s, 'permalink', $slug); } $authorclass = strtolower($author); $timeclass = safe_strftime('y%Y m%m d%d h%H', $logunix); echo "\n\t\t\t\t\t<div class=\"section hentry author_{$authorclass} {$class_list}{$timeclass} single\" 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>"; 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 $post['extended']; } echo "\n\t\t\t\t\t\t</div>\t\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 \t<span class=\"post_updated\">" . $lang['last_updated'] . ": {$xdate} </span>\n\t\t\t\t\t\t</div>\t\t\t\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div id=\"nav_posts\" class=\"dynamic_bottom_nav\">\n"; // previous and next posts if (isset($s)) { $thisid = get_page_id($s); } // what post is next? $searchnext = safe_field('post_id', 'pixie_dynamic_posts', "page_id = '{$thisid}' and public = 'yes' and posted > '{$posted}' limit 0,1"); if ($searchnext) { $ntitle = safe_field('title', 'pixie_dynamic_posts', "post_id ='{$searchnext}'"); $nslug = safe_field('post_slug', 'pixie_dynamic_posts', "post_id ='{$searchnext}'"); echo "\t\t\t\t\t\t<div id=\"post_next\" class=\"link_next\"><a class=\"link_next_a\" href=\""; if (isset($s)) { echo createURL($s, 'permalink', $nslug); } echo "\" title=\"" . $lang['next_post'] . ": {$ntitle}\">" . $lang['next_post'] . " »</a></div>\n"; } // what post is previous? $searchprev = safe_field('post_id', 'pixie_dynamic_posts', "page_id = '{$thisid}' and public = 'yes' and posted < '{$posted}' order by posted desc limit 0,1"); if ($searchprev) { $ptitle = safe_field('title', 'pixie_dynamic_posts', "post_id ='{$searchprev}'"); $pslug = safe_field('post_slug', 'pixie_dynamic_posts', "post_id ='{$searchprev}'"); echo "\t\t\t\t\t\t<div id=\"post_previous\" class=\"link_previous\"><a class=\"link_prev_a\" href=\""; if (isset($s)) { echo createURL($s, 'permalink', $pslug); } echo "\" title=\"" . $lang['previous_post'] . ": "; if (isset($ptitle)) { echo $ptitle; } echo "\">« " . $lang['previous_post'] . "</a></div>\n"; } echo "\t\t\t\t\t</div>\n"; $comms = safe_rows('*', 'pixie_module_comments', "post_id = '{$post_id}'"); $no_comms = count($comms); // fix to remove commenting when plug in is removed if (public_page_exists('comments')) { if ($comments == 'yes' or $comms) { echo "\n\t\t\t\t\t<div id=\"comments\">\n\t\t\t\t\t\t<h4 id=\"comments_title\">" . $lang['comments'] . "</h4>"; 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) { $realname = safe_field('realname', 'pixie_users', "user_name='{$username}'"); $umail = safe_field('email', 'pixie_users', "user_name='{$username}'"); } } $r2 = safe_rows('*', 'pixie_module_comments', "post_id = '{$post_id}' order by posted asc"); if ($r2) { $i = 0; while ($i < $no_comms) { extract($r2[$i]); $default = "{$site_url}files/images/no_grav.jpg"; if (isset($email)) { $grav_url = 'http://www.gravatar.com/avatar.php?gravatar_id=' . md5($email) . '&default=' . urlencode($default) . '&size=40'; } $hash = $i + 1; if ($url) { $namepr = "<span class=\"message_name author\"><a href=\"{$permalink}#comment_{$hash}\" rel=\"bookmark\" class=\"comment_permalink\">#{$hash}</a> <a href=\"" . htmlentities($url) . "\" rel=\"external nofollow\" class=\"url fn\">{$name}</a></span>"; } else { $namepr = "<span class=\"message_name author\"><a href=\"{$permalink}#comment_{$hash}\" rel=\"bookmark\" class=\"comment_permalink\">#{$hash}</a> <span class=\"fn\">{$name}</span></span>"; } if (is_even($i + 1)) { $type = 'comment_even'; } else { $type = 'comment_odd'; } if ($admin_user == 'yes') { $atype = ' comment_admin'; } else { $atype = ""; } $logunix = returnUnixtimestamp($posted); $days_ago = safe_strftime('since', $logunix); $microformatcomment = safe_strftime('%Y-%m-%dT%T%z', $logunix); $commenttimeclass = safe_strftime('c_y%Y c_m%m c_d%d c_h%H', $logunix); echo "\n\t\t\t\t\t\t<div class=\"{$type} hentry comment comment_author_" . str_replace('-', '_', make_slug($name)) . " {$commenttimeclass}" . $atype . "\" id=\"comment_{$hash}\">\n\t\t\t\t\t\t\t<div class=\"comment_message\">\n\t\t\t\t\t\t\t\t<div class=\"message_details vcard\">\n\t\t\t\t\t\t\t\t\t<img src=\"{$grav_url}\" alt=\"Gravatar Image\" class=\"gr photo\" />\n\t\t\t\t\t\t\t\t\t{$namepr}\n\t\t\t\t\t\t\t\t\t<span class=\"message_time\"><abbr class=\"published\" title=\"{$microformatcomment}\">{$days_ago}</abbr></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"message_body entry-title entry-content\"><p>{$comment}</p></div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</div>"; $i++; } } else { echo "\n\t\t\t\t\t\t<span class=\"comments_none\">" . $lang['no_comments'] . "</span>"; } echo "\n\t\t\t\t\t</div>\n"; echo "\n\t\t\t\t\t<div class=\"comment_form\" id=\"commentform\">"; if ($comment_ok) { echo "\n\t\t\t\t\t\t\t<p class=\"success\">" . $lang['comment_thanks'] . '</p>'; } else { if ($comments == 'yes') { if (isset($s)) { $posty = createURL($s, $m, $x); } echo "\n\t\t\t\t\t\t<form accept-charset=\"UTF-8\" action=\"{$posty}#commentform\" method=\"post\" class=\"form\">\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t var blogTool = \"pixie\";\n\t\t\t\t\t\t var blogURL = \"{$site_url}\";\n\t\t\t\t\t\t var blogTitle = \"{$site_name} - {$page_display_name}\";\n\t\t\t\t\t\t var postURL = \"{$posty}\";\n\t\t\t\t\t\t var postTitle = \"{$title}\";\n\t\t\t\t\t\t var commentTextFieldName = \"comment\";\n\t\t\t\t\t\t var commentButtonName = \"comment_submit\";"; if (isset($realname) && $realname) { echo "\n\t\t\t\t\t\t var commentAuthorLoggedIn = true;"; } else { echo "\n\t\t\t\t\t\t var commentAuthorLoggedIn = false;"; } echo "\n\t\t\t\t\t\t var commentAuthorFieldName = \"name\";\n\t\t\t\t\t\t var commentFormID = \"commentform\";\n\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t\t\t<legend>" . $lang['comment_leave'] . "</legend>"; if (isset($error)) { echo "\n\t\t\t\t\t\t\t\t<p class=\"error\">{$error}</p>"; if (in_array('name', $scream)) { $name_style = 'form_highlight'; } if (in_array('comment', $scream)) { $comment_style = 'form_highlight'; } if (in_array('email', $scream)) { $email_style = 'form_highlight'; } if (in_array('web', $scream)) { $web_style = 'form_highlight'; } } else { echo "<p class=\"notice\">" . $lang['comment_form_info'] . "</p>"; } echo "\n\t\t\t\t\t\t\t\t<div class=\"form_row "; if (isset($name_style)) { echo $name_style; } echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment_name\">" . $lang['comment_name'] . " <span class=\"form_required\">" . $lang['form_required'] . "</span></label></div>"; if (isset($realname) && $realname) { echo "\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" disabled=\"disabled\" tabindex=\"1\" name=\"name\" class=\"form_text\" id=\"comment_name\""; if (isset($realname)) { echo " value=\"{$realname}\""; } echo " /></div>"; } else { echo "\n\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" tabindex=\"1\" name=\"name\" class=\"form_text\" id=\"comment_name\" value=\"{$sname}\"/></div>"; } if ($sweb == "") { $sweb = 'http://'; } if (isset($realname) && $realname) { $sweb = $site_url; $semail = $umail; } echo "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row "; if (isset($email_style)) { echo $email_style; } echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment_email\">" . $lang['comment_email'] . " <span class=\"form_required\">" . $lang['form_required'] . "</span></label></div>\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" tabindex=\"2\" name=\"email\" class=\"form_text\" id=\"comment_email\" value=\"{$semail}\" /></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row "; if (isset($web_style)) { echo $web_style; } echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment_web\">" . $lang['comment_web'] . " <span class=\"form_optional\">" . $lang['form_optional'] . "</span></label></div>\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><input type=\"text\" tabindex=\"2\" name=\"web\" class=\"form_text\" id=\"comment_web\" value=\"{$sweb}\" /></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row "; if (isset($comment_style)) { echo $comment_style; } echo "\">\n\t\t\t\t\t\t\t\t\t<div class=\"form_label\"><label for=\"comment\">" . $lang['comment'] . " <span class=\"form_required\">" . $lang['form_required'] . "</span></label></div>\n\t\t\t\t\t\t\t\t\t<div class=\"form_item\"><textarea name=\"comment\" tabindex=\"3\" id=\"comment\" class=\"form_text_area\" cols=\"25\" rows=\"5\">{$scomment}</textarea></div>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<div class=\"form_row_submit\">\n\t\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"comment_submit\" tabindex=\"4\" value=\"" . $lang['comment_button_leave'] . "\" class=\"form_submit\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"post\" value=\"{$post_id}\" />"; if (isset($realname) && $realname) { echo "\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"admin_user\" value=\"" . md5($nonce) . "\" />\n\t\t\t\t\t\t\t\t\t<input type=\"hidden\" name=\"name\""; if (isset($realname)) { echo " value=\"{$realname}\""; } echo " />"; } echo "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</fieldset>\n\t\t\t\t\t\t</form>"; } else { echo "\n\t\t\t\t\t\t<span class=\"comments_closed\">" . $lang['comment_closed'] . "</span>"; } } echo "\n\t\t\t\t\t</div>"; } // end if comments plugin enabled } } else { extract(safe_row('*', 'pixie_core', "page_name='404'")); extract(safe_row('*', 'pixie_static_posts', "page_id='{$page_id}'")); if (isset($s)) { echo "<div id=\"{$s}\">\n\t\t\t\t\t\t<h3>{$page_display_name}</h3>\n"; eval('?>' . $page_content . '<?php '); echo "\n\t\t\t\t\t</div>\n"; } } }
function ShowBody() { global $edit, $s, $m, $x, $page, $page_display_name, $lang, $type; // check $edit against $x - they need to represent the same page, if not redirect. $checkid = safe_field('page_id', 'pixie_core', "page_name='{$x}'"); if (isset($edit) && $edit && $m == 'static') { if ($edit != $checkid) { echo "<div class=\"helper\"><h3>" . $lang['help'] . "</h3><p>" . $lang['unknown_edit_url'] . "</p></div>"; $cancel = TRUE; } } if (isset($cancel)) { } else { $cancel_not_set = 1; } if ($cancel_not_set == 1) { $Nams = explode('|', substr($this->Nam, 0, strlen($this->Nam) - 1)); $Type = explode('|', substr($this->Typ, 0, strlen($this->Typ) - 1)); $Leng = explode('|', substr($this->Len, 0, strlen($this->Len) - 1)); $Flag = explode('|', substr($this->Flg, 0, strlen($this->Flg) - 1)); $Fild = explode('|', substr($this->Res, 0, strlen($this->Res) - 1)); if (!$page) { $page = 1; } if (isset($s) && $s == 'settings') { if (strpos($this->tablename, 'module')) { $formtitle = $lang['advanced'] . " " . $lang['page_settings']; } else { if (strpos($this->tablename, 'dynamic')) { $formtitle = $lang['advanced'] . " " . $lang['page_settings']; } else { $formtitle = $lang['page_settings']; } } } else { if (isset($edit) && $edit) { if ($m == 'static') { $formtitle = $lang['edit'] . " {$page_display_name} " . $lang['settings_page']; } else { $formtitle = $lang['edit'] . " {$page_display_name} " . str_replace('.', "", $lang['entry']) . " (#{$edit})"; } } else { $formtitle = $lang['new_entry'] . " {$page_display_name} " . str_replace('.', "", $lang['entry']); } } if (isset($s) && $s == 'settings') { $post = "?s={$s}&x={$x}"; } else { if ($m == 'static' && isset($edit)) { $post = "?s={$s}&m={$m}&x={$x}&edit={$edit}&page={$page}"; } else { $post = "?s={$s}&m={$m}&x={$x}&page={$page}"; } } echo "<form accept-charset=\"UTF-8\" action=\"{$post}\" method=\"post\" id=\"form_addedit\" class=\"form\">\n"; echo "\t\t\t\t\t\t<fieldset>\n\t\t\t\t\t\t<legend>{$formtitle}</legend>\n"; echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"table_name\" value=\"{$this->tablename}\" maxlength=\"80\" />\n"; for ($j = 0; $j < count($Nams); $j++) { // clears out the form as some of the fields populate if (!isset($edit) or !$edit) { $Fild[$j] = ""; } // if comments are disabled then hide the field if ($Nams[$j] == 'comments' && !public_page_exists('comments')) { echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"no\" maxlength=\"" . $Leng[$j] . "\" />\n"; $j++; } if (!in_array($Nams[$j], $this->exclude)) { //fields populated and output depending on type etc. //$searchfor = "_".first_word($Nams[$j]); if ($Leng[$j] < 40) { $ln = $Leng[$j]; } else { if ($Leng[$j] <= 400) { $ln = 50; } } $nullf = explode(" ", $Flag[$j]); if ($nullf[0] == 'not_null') { // label required fields if (isset($lang['form_' . $Nams[$j]])) { if ($Nams[$j] != 'page_name' or $type == 'static' or !isset($edit) or !$edit) { /* Prevents the editing of page_name which does not work in modules and dynamic pages */ $displayname = $lang['form_' . $Nams[$j]] . " <span class=\"form_required\">" . $lang['form_required'] . "</span>"; } else { $displayname = " <span style=\"display:none\" class=\"form_required\">" . $lang['form_required'] . "</span>"; } } else { $displayname = simplify($Nams[$j]) . " <span class=\"form_required\">" . $lang['form_required'] . "</span>"; } } else { if (isset($lang['form_' . $Nams[$j]]) && $lang['form_' . $Nams[$j]]) { $displayname = $lang['form_' . $Nams[$j]] . " <span class=\"form_optional\">" . $lang['form_optional'] . "</span>"; } else { $displayname = simplify($Nams[$j]) . " <span class=\"form_optional\">" . $lang['form_optional'] . "</span>"; } } // check language file for any form help if (isset($lang['form_help_' . $Nams[$j]]) && $lang['form_help_' . $Nams[$j]]) { if ($Nams[$j] != 'page_name' or $type == 'static' or !isset($edit) or !$edit) { /* Prevents the editing of page_name which does not work in modules and dynamic pages */ $form_help = "<span class=\"form_help\">" . $lang['form_help_' . $Nams[$j]] . "</span>"; } else { $form_help = "<span style=\"display:none\" class=\"form_help\">" . $lang['form_help_' . $Nams[$j]] . "</span>"; } } else { $form_help = ""; } if ($GLOBALS['rich_text_editor'] == 1) { $containsphp = strlen(stristr(utf8_decode($Fild[$j]), '<?php')) > 0; if ($containsphp) { $form_help .= " <span class=\"alert\">" . $lang['form_php_warning'] . '</span>'; } } echo "\t\t\t\t\t\t\t<div class=\"form_row\">\n\t\t\t\t\t\t\t\t<div class=\"form_label\">\n\t\t\t\t\t<label for=\"{$Nams[$j]}\">" . $displayname . "</label>{$form_help}</div>\n"; //$Type[$j] $Leng[$j] $Flag[$j] for field info //echo "$Nams[$j] - $Type[$j] - $Leng[$j] - $Flag[$j]"; // see form field properties if ($Type[$j] == 'timestamp' && !isset($edit) && !$edit) { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n"; if (isset($date)) { date_dropdown($date); } else { $date = NULL; date_dropdown($date); } echo "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if ($Type[$j] == 'timestamp' && isset($edit) && $edit) { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n"; date_dropdown($Fild[$j]); echo "\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; //} else if ($Type[$j] == "blob") { // echo "\t\t\t\t\t\t\t\t<div class=\"form_item_textarea\">\n\t\t\t\t\t\t\t\t<textarea name=\"$Nams[$j]\" class=\"form_item_textarea_no_ckeditor\">$Fild[$j]</textarea>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if ($Type[$j] == 'longtext' or $Leng[$j] > 800 or $Type[$j] == 'blob') { if ($GLOBALS['rich_text_editor'] == 1) { if (!$containsphp) { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_textarea_ckeditor\">\n\t\t\t\t\t\t\t\t\t\t<textarea name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" cols=\"50\" class=\"ck-textarea\" rows=\"10\">" . htmlentities($Fild[$j], ENT_QUOTES, 'UTF-8') . "</textarea>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>\n"; // id=\"$Nams[$j]\" } else { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_textarea\">\n\t\t\t\t\t\t\t\t<textarea name=\"{$Nams[$j]}\" class=\"form_item_textarea_no_ckeditor\">" . htmlspecialchars($Fild[$j], ENT_QUOTES, 'UTF-8') . "</textarea>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; // id=\"$Nams[$j]\" } } else { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_textarea\">\n\t\t\t\t\t\t\t\t<textarea name=\"{$Nams[$j]}\" class=\"form_item_textarea_no_ckeditor\">" . htmlspecialchars($Fild[$j], ENT_QUOTES, 'UTF-8') . "</textarea>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; // id=\"$Nams[$j]\" } } else { if ($Type[$j] == "set'yes','no'" or $Flag[$j] == 'not_null set') { if ($Fild[$j] == 'no') { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_radio\">\n\t\t\t\t\t\t\t\tYes<input type=\"radio\" name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" class=\"form_radio\" value=\"yes\" />\n\t \t\t\t\t\t\t \tNo<input checked=\"checked\" type=\"radio\" name=\"{$Nams[$j]}\" class=\"form_radio\" value=\"{$Fild[$j]}\" />\n\t\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t\t</div>\n"; } else { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_radio\">\n\t\t\t\t\t\t\t\tYes<input checked=\"checked\" type=\"radio\" name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" class=\"form_radio\" value=\"yes\" />\n\t \t\t\t\t\t\t \tNo<input type=\"radio\" name=\"{$Nams[$j]}\" class=\"form_radio\" value=\"no\"/>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } } else { if (first_word($Nams[$j]) == 'image') { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop image_preview\">\n"; db_dropdown('pixie_files', $Fild[$j], $Nams[$j], "file_type = 'Image' order by file_id desc"); echo "\n\t\t\t\t\t\t\t\t<span class=\"more_upload\">or <a href=\"#\" onclick=\"upswitch('" . $Nams[$j] . "'); return false;\" title=\"" . $lang['upload'] . "\">" . strtolower($lang['upload']) . "...</a></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if (first_word($Nams[$j]) == 'document') { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n"; db_dropdown('pixie_files', $Fild[$j], $Nams[$j], "file_type = 'Other' order by file_id desc"); echo "\n\t\t\t\t\t\t\t\t<span class=\"more_upload\">or <a href=\"#\" onclick=\"upswitch('" . $Nams[$j] . "'); return false;\" title=\"" . $lang['upload'] . "\">" . strtolower($lang['upload']) . "...</a></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if (first_word($Nams[$j]) == 'video') { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n"; db_dropdown('pixie_files', $Fild[$j], $Nams[$j], "file_type = 'Video' order by file_id desc"); echo "\n\t\t\t\t\t\t\t\t<span class=\"more_upload\">or <a href=\"#\" onclick=\"upswitch('" . $Nams[$j] . "'); return false;\" title=\"" . $lang['upload'] . "\">" . strtolower($lang['upload']) . "...</a></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if (first_word($Nams[$j]) == 'audio') { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n"; db_dropdown('pixie_files', $Fild[$j], $Nams[$j], "file_type = 'Audio' order by file_id desc"); echo "\n\t\t\t\t\t\t\t\t<span class=\"more_upload\">or <a href=\"#\" onclick=\"upswitch('" . $Nams[$j] . "'); return false;\" title=\"" . $lang['upload'] . "\">" . strtolower($lang['upload']) . "...</a></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if (first_word($Nams[$j]) == 'file') { echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n"; db_dropdown('pixie_files', $Fild[$j], $Nams[$j], "file_id >= '0' order by file_id desc"); echo "\n\t\t\t\t\t\t\t\t<span class=\"more_upload\">or <a href=\"#\" onclick=\"upswitch('" . $Nams[$j] . "'); return false;\" title=\"" . $lang['upload'] . "\">" . strtolower($lang['upload']) . "...</a></span>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if ($Nams[$j] == 'tags') { $tableid = 0; $condition = $tableid . " >= '0'"; form_tag($this->tablename, $condition); echo "\t\t\t\t\t\t\t\t<div class=\"form_item\">\n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_text\" name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" value=\"{$Fild[$j]}\" size=\""; if (isset($ln)) { echo $ln; } else { $ln = 25; echo $ln; } echo "\" maxlength=\"" . $Leng[$j] . "\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if ($Nams[$j] == 'page_blocks') { form_blocks(); echo "\t\t\t\t\t\t\t\t<div class=\"form_item\">\n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_text\" name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" value=\"{$Fild[$j]}\" size=\""; if (isset($ln)) { echo $ln; } else { $ln = 25; echo $ln; } echo "\" maxlength=\"" . $Leng[$j] . "\" />\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if ($Nams[$j] == 'privs') { if ($Fild[$j] == 2) { $adminclass = "selected=\"selected\""; $everyoneclass = NULL; } else { $everyoneclass = "selected=\"selected\""; $adminclass = NULL; } echo "\t\t\t\t\t\t\t\t<div class=\"form_item_drop\">\n\t\t\t\t\t\t\t\t\t<select class=\"form_select\" name=\"{$Nams[$j]}\" name=\"{$Nams[$j]}\">\n\t\t\t\t\t\t\t\t\t\t<option value=\"2\" {$adminclass}>Administrators only</option>\n\t\t\t\t\t\t\t\t\t\t<option value=\"1\" {$everyoneclass}>Administrators & Clients</option>\n\t\t\t\t\t\t\t\t\t</select>\n\t \t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n"; } else { if ($Nams[$j] != 'page_name' or $type == 'static' or !isset($edit) or !$edit) { /* Prevents the editing of page_name which does not work in modules and dynamic pages */ echo "\t\t\t\t\t\t\t\t<div class=\"form_item\">\n\t\t\t\t\t\t\t\t<input type=\"text\" class=\"form_text\" name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" value=\"" . htmlspecialchars($Fild[$j], ENT_QUOTES, 'UTF-8') . "\" size=\""; if (isset($ln)) { echo $ln; } else { $ln = 25; echo $ln; } echo "\" maxlength=\"" . $Leng[$j] . "\" />\n\t\t\t\t\t\t\t\t</div>"; } else { echo "\t\t\t\t\t\t\t\t<div style=\"display:none\" class=\"form_item\">\n\t\t\t\t\t\t\t\t<input style=\"display:none\" type=\"text\" class=\"form_text\" name=\"{$Nams[$j]}\" id=\"{$Nams[$j]}\" value=\"" . htmlspecialchars($Fild[$j], ENT_QUOTES, 'UTF-8') . "\" size=\""; if (isset($ln)) { echo $ln; } else { $ln = 25; echo $ln; } echo "\" maxlength=\"" . $Leng[$j] . "\" />\n\t\t\t\t\t\t\t\t</div>"; } echo "\n\t\t\t\t\t\t\t</div>\n"; } } } } } } } } } } } } //other field types still to come: File uploads...? //hidden fields populated } else { if ($Nams[$j] == 'page_id' && isset($s) && $s == 'publish' && $m == 'dynamic') { $page_id = get_page_id($x); echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"{$page_id}\" maxlength=\"" . $Leng[$j] . "\" />\n"; } else { if (last_word($Nams[$j]) == 'id') { echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"{$Fild[$j]}\" maxlength=\"" . $Leng[$j] . "\" />\n"; } else { if ($Nams[$j] == 'author') { if (isset($edit) && $edit) { $output = $Fild[$j]; } else { if (!isset($GLOBALS['pixie_user'])) { $GLOBALS['pixie_user'] = NULL; } $output = $GLOBALS['pixie_user']; } echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"" . $output . "\" maxlength=\"" . $Leng[$j] . "\" />\n"; } else { if ($Type[$j] == "timestamp") { echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"" . returnSQLtimestamp(time()) . "\" maxlength=\"" . $Leng[$j] . "\" />\n"; } else { if ($Nams[$j] == 'page_type') { if ($type) { $output = $type; } else { if (isset($edit)) { $output = safe_field('page_type', 'pixie_core', "page_id='{$edit}'"); } } echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"" . $output . "\" maxlength=\"" . $Leng[$j] . "\" />\n"; } else { if ($Nams[$j] == 'publish' && !$edit) { echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"yes\" maxlength=\"0\" />\n"; } else { if ($Nams[$j] == 'page_content') { // do nothing } else { if ($Nams[$j] == 'admin') { // do nothing } else { echo "\t\t\t\t\t\t\t<input type=\"hidden\" class=\"form_text\" name=\"{$Nams[$j]}\" value=\"{$Fild[$j]}\" maxlength=\"" . $Leng[$j] . "\" />\n"; } } } } } } } } } } if (isset($edit) && $edit) { echo "\t\t\t\t\t\t\t<div class=\"form_row_button\">\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"submit_edit\" class=\"form_submit\" value=\"" . $lang['form_button_update'] . "\" />\n\t\t\t\t\t\t\t</div>\n"; } else { if (isset($go) && $go == 'new') { // do a save draft and save button button?? - when everything can be saved as a draft and is autosaved using AJAX } else { echo "\t\t\t\t\t\t\t<div class=\"form_row_button\" id=\"form_button\">\n\t\t\t\t\t\t\t\t<input type=\"submit\" name=\"submit_new\" class=\"form_submit\" value=\"" . $lang['form_button_save'] . "\" />\n\t\t\t\t\t\t\t</div>\n"; } } if ($m != 'static') { echo "\t\t\t\t\t\t\t<div class=\"form_row_button\">\n\t\t\t\t\t\t\t\t<span class=\"form_button_cancel\"><a href=\"?s={$s}&m={$m}&x={$x}\" title=\"" . $lang['form_button_cancel'] . "\">" . $lang['form_button_cancel'] . "</a></span>\n\t\t\t\t\t\t\t</div>\n"; } echo "\t\t\t\t\t\t\t<div class=\"safclear\"></div>\n\t\t\t\t\t\t</fieldset>\n"; echo "\t\t\t\t\t</form>"; } }