diff options
-rw-r--r-- | account.php | 108 | ||||
-rw-r--r-- | admin.php | 3 | ||||
-rw-r--r-- | cron.php | 2 | ||||
-rw-r--r-- | discussion.php | 4 | ||||
-rw-r--r-- | error.php | 2 | ||||
-rw-r--r-- | includes/common.inc | 16 | ||||
-rw-r--r-- | includes/theme.inc | 162 | ||||
-rw-r--r-- | includes/widget.inc | 105 | ||||
-rw-r--r-- | index.php | 2 | ||||
-rw-r--r-- | module.php | 2 | ||||
-rw-r--r-- | modules/backend.module | 2 | ||||
-rw-r--r-- | modules/diary.module | 3 | ||||
-rw-r--r-- | modules/faq.module | 2 | ||||
-rw-r--r-- | modules/wishlist.module | 4 | ||||
-rw-r--r-- | search.php | 2 | ||||
-rw-r--r-- | submission.php | 2 | ||||
-rw-r--r-- | submit.php | 2 | ||||
-rw-r--r-- | themes/marvin/marvin.theme | 121 | ||||
-rw-r--r-- | themes/unconed/unconed.theme | 129 |
19 files changed, 367 insertions, 306 deletions
diff --git a/account.php b/account.php index e1df7c2c6..c17d7a4b9 100644 --- a/account.php +++ b/account.php @@ -1,24 +1,12 @@ <? -include "includes/theme.inc"; +include "includes/common.inc"; function account_get_user($uname) { $result = db_query("SELECT * FROM users WHERE userid = '$uname'"); return db_fetch_object($result); } -function account_login() { - $output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n"; - $output .= " <TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"2\">\n"; - $output .= " <TR><TH ALIGN=\"right\">Username:</TH><TD><INPUT NAME=\"userid\"></TD></TR>\n"; - $output .= " <TR><TH ALIGN=\"right\">Password:</TH><TD><INPUT NAME=\"passwd\" TYPE=\"password\"></TD></TR>\n"; - $output .= " <TR><TD ALIGN=\"right\" COLSPAN=\"2\"><INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Login\"></TD></TR>\n"; - $output .= " </TABLE>\n"; - $output .= "</FORM>\n"; - - return $output; -} - function account_email() { $output .= "<P>Lost your password? Fill out your username and e-mail address, and your password will be mailed to you.</P>\n"; $output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n"; @@ -36,7 +24,7 @@ function account_create($user = "", $error = "") { global $theme; if ($error) $output .= "<B><FONT COLOR=\"red\">Failed to register.</FONT>$error</B>\n"; - else $output .= "<P>Registering allows you to comment on stories, to moderate comments and pending stories, to maintain an online diary, to customize the look and feel of the site and generally helps you interact with the site more efficiently.</P><P>To create an account, simply fill out this form an click the `Create account' button below. An e-mail will then be sent to you with instructions on how to validate your account.</P>\n"; + else $output .= "<P>Registering allows you to comment on stories, to moderate comments and pending stories, to customize the look and feel of the site and generally helps you interact with the site more efficiently.</P><P>To create an account, simply fill out this form an click the `Create account' button below. An e-mail will then be sent to you with instructions on how to validate your account.</P>\n"; $output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n"; $output .= "<P>\n"; @@ -119,15 +107,15 @@ function account_user_edit() { } else { $theme->header(); - $theme->box("Login", account_login()); + $theme->box("Create user account", account_create()); $theme->box("E-mail password", account_email()); - $theme->box("Create new account", account_create()); $theme->footer(); } } function account_user_save($edit) { global $user; + if ($user->id) { $data[name] = $edit[name]; $data[fake_email] = $edit[fake_email]; @@ -141,7 +129,7 @@ function account_user_save($edit) { } } -function account_page_edit() { +function account_site_edit() { global $theme, $themes, $user; if ($user->id) { @@ -164,7 +152,12 @@ function account_page_edit() { $output .= "<SELECT NAME=\"edit[timezone]\">\n$options2</SELECT><BR>\n"; $output .= "<I>Select what time you currently have and your timezone settings will be set appropriate.</I><P>\n"; $output .= "<B>Maximum number of stories:</B><BR>\n"; - $output .= "<INPUT NAME=\"edit[stories]\" MAXLENGTH=\"3\" SIZE=\"3\" VALUE=\"$user->stories\"><P>\n"; + + for ($stories = 10; $stories <= 30; $stories += 5) { + $options3 .= "<OPTION VALUE=\"$stories\"". (($user->stories == $stories) ? " SELECTED" : "") .">$stories</OPTION>\n"; + } + + $output .= "<SELECT NAME=\"edit[stories]\">\n$options3</SELECT><BR>\n"; $output .= "<I>The maximum number of stories that will be displayed on the main page.</I><P>\n"; $options = "<OPTION VALUE=\"nested\"". ($user->mode == "nested" ? " SELECTED" : "") .">Nested</OPTION>"; $options .= "<OPTION VALUE=\"flat\"". ($user->mode == "flat" ? " SELECTED" : "") .">Flat</OPTION>"; @@ -186,7 +179,9 @@ function account_page_edit() { $output .= "<B>Comment threshold:</B><BR>\n"; $output .= "<SELECT NAME=\"edit[threshold]\">$options</SELECT><BR>\n"; $output .= "<I>Comments that scored less than this setting will be ignored. Anonymous comments start at 0, comments of people logged on start at 1 and moderators can add and subtract points.</I><P>\n"; - $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save page settings\"><BR>\n"; + + + $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save site settings\"><BR>\n"; $output .= "</FORM>\n"; $theme->header(); @@ -195,15 +190,15 @@ function account_page_edit() { } else { $theme->header(); - $theme->box("Login", account_login()); + $theme->box("Create user account", account_create()); $theme->box("E-mail password", account_email()); - $theme->box("E-mail password", account_create()); $theme->footer(); } } -function account_page_save($edit) { +function account_site_save($edit) { global $user; + if ($user->id) { $data[theme] = $edit[theme]; $data[timezone] = $edit[timezone]; @@ -215,6 +210,53 @@ function account_page_save($edit) { } } +function account_block_edit() { + global $theme, $user; + + if ($user->id) { + $output .= "<FORM ACTION=\"account.php\" METHOD=\"post\">\n"; + + $output .= "<B>Blocks:</B><BR>\n"; + + $result = db_query("SELECT * FROM blocks WHERE status = 1"); + while ($block = db_fetch_object($result)) { + $entry = db_fetch_object(db_query("SELECT * FROM layout WHERE block = '$block->name' AND user = '$user->id'")); + + $options = ""; + for ($weight = 0; $weight < 10; $weight++) { + $options .= "<OPTION VALUE=\"$weight\"". (($entry->weight == $weight) ? " SELECTED" : "") .">". (($weight == 0) ? "off" : $weight) ."</OPTION>\n"; + } + + $output .= "<SELECT NAME=\"edit[$block->name]\">\n$options</SELECT>"; + $output .= "$block->name<BR>"; + } + + $output .= "<I>You can more or less position your blocks by assigning them weights. The heavy blocks sink down whereas the light blocks will be positioned on top.</I><P>\n"; + $output .= "<INPUT TYPE=\"submit\" NAME=\"op\" VALUE=\"Save block settings\"><BR>\n"; + $output .= "</FORM>\n"; + + $theme->header(); + $theme->box("Edit your blocks", $output); + $theme->footer(); + } + else { + $theme->header(); + $theme->box("Create user account", account_create()); + $theme->box("E-mail password", account_email()); + $theme->footer(); + } +} + +function account_block_save($edit) { + global $user; + if ($user->id) { + db_query("DELETE FROM layout WHERE user = $user->id"); + foreach ($edit as $block=>$weight) { + db_query("INSERT INTO layout (user, block, weight) VALUES ('". check_input($user->id) ."', '". check_input($block) ."', '". check_input($weight) ."')"); + } + } +} + function account_user($uname) { global $user, $theme; @@ -268,9 +310,8 @@ function account_user($uname) { else { ### Display login form: $theme->header(); - $theme->box("Login", account_login()); + $theme->box("Create user account", account_create()); $theme->box("E-mail password", account_email()); - $theme->box("Create new account", account_create()); $theme->footer(); } } @@ -333,7 +374,7 @@ function account_create_submit($userid, $email) { if ($rval = account_validate($new)) { $theme->header(); - $theme->box("Create new account", account_create($new, $rval)); + $theme->box("Create user account", account_create($new, $rval)); $theme->footer(); } else { @@ -351,7 +392,7 @@ function account_create_submit($userid, $email) { mail($new[real_email], "Account details for $site_name", $message, "From: noreply"); $theme->header(); - $theme->box("Create new account", "Congratulations! Your member account has been sucessfully created and further instructions on how to activate your account have been sent to your e-mail address."); + $theme->box("Create user account", "Congratulations! Your member account has been sucessfully created and further instructions on how to activate your account have been sent to your e-mail address."); $theme->footer(); } } @@ -514,10 +555,14 @@ switch ($op) { account_user_save($edit); account_user($user->userid); break; - case "Save page settings": - account_page_save($edit); + case "Save site settings": + account_site_save($edit); header("Location: account.php?op=info"); break; + case "Save block settings": + account_block_save($edit); + account_user($user->userid); + break; case "logout": account_session_close(); header("Location: account.php?op=info"); @@ -551,8 +596,11 @@ switch ($op) { case "user": account_user_edit(); break; - case "page": - account_page_edit(); + case "site": + account_site_edit(); + break; + case "block": + account_block_edit(); break; default: header("Location: module.php?mod=diary&op=add&name=$user->userid"); @@ -3,8 +3,7 @@ // validate user permission: if (!$user->id || ($user->permissions != 1 && $user->id > 1)) exit(); -include_once "includes/theme.inc"; -include_once "includes/cron.inc"; +include "includes/common.inc"; function admin_page($mod) { global $repository, $menu, $modules; @@ -1,6 +1,6 @@ <? -include "includes/theme.inc"; +include "includes/common.inc"; function cron_run($cron) { global $repository; diff --git a/discussion.php b/discussion.php index 3ebd689cf..a540fbdcb 100644 --- a/discussion.php +++ b/discussion.php @@ -272,7 +272,7 @@ function comment_post($pid, $sid, $subject, $comment) { } } -include "includes/theme.inc"; +include "includes/common.inc"; include "includes/comment.inc"; ### Security check: @@ -313,4 +313,4 @@ switch($op) { $theme->footer(); } -?> +?>
\ No newline at end of file @@ -39,7 +39,7 @@ function error_httpd() { print "</PRE>\n"; } -include "includes/theme.inc"; +include "includes/common.inc"; switch ($op) { case "flood": diff --git a/includes/common.inc b/includes/common.inc new file mode 100644 index 000000000..7886b9b65 --- /dev/null +++ b/includes/common.inc @@ -0,0 +1,16 @@ +<? + +include_once "includes/". getenv("HTTP_HOST") .".conf"; +include_once "includes/database.inc"; +include_once "includes/watchdog.inc"; +include_once "includes/function.inc"; +include_once "includes/droplet.inc"; +include_once "includes/module.inc"; +include_once "includes/theme.inc"; +include_once "includes/user.inc"; + +global $user; + +$theme = load_theme(); + +?> diff --git a/includes/theme.inc b/includes/theme.inc index 583bc0044..63024432c 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -1,16 +1,154 @@ <? -include_once "includes/". getenv("HTTP_HOST") .".conf"; -include_once "includes/database.inc"; -include_once "includes/watchdog.inc"; -include_once "includes/function.inc"; -include_once "includes/droplet.inc"; -include_once "includes/module.inc"; -include_once "includes/widget.inc"; -include_once "includes/user.inc"; - -global $user; - -$theme = load_theme(); +function theme_account($theme) { + global $user, $site_name; + + if ($user->id) { + + function submission_number() { + $result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1"); + return ($result) ? db_result($result, 0) : 0; + } + + ### Display account settings: + $content .= "<LI><A HREF=\"account.php?op=track&topic=comments\">track your comments</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=track&topic=stories\">track your stories</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=track&topic=site\">track $site_name</A></LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"submission.php\">submission queue</A> (<FONT COLOR=\"red\">". submission_number() ."</FONT>)</LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=diary\">edit your diary</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=user\">edit your information</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=site\">edit your settings</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=block\">edit your blocks</A></LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"account.php?op=view&topic=diary\">view your diary</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=view&topic=info\">view your information</A></LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"account.php?op=logout\">logout</A></LI>\n"; + + $theme->box("$user->userid's configuration", "$content"); + } + else { + $output .= "<CENTER>\n"; + $output .= " <FORM ACTION=\"account.php?op=Login\" METHOD=\"post\">\n"; + $output .= " <P><B>Username:</B><BR><INPUT NAME=\"userid\" SIZE=\"15\"></P>\n"; + $output .= " <P><B>Password:</B><BR><INPUT NAME=\"passwd\" SIZE=\"15\" TYPE=\"password\"></P>\n"; + $output .= " <P><INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Login\"></P>\n"; + $output .= " <P><A HREF=\"account.php\">REGISTER</A></P>\n"; + $output .= " </FORM>\n"; + $output .= "</CENTER>\n"; + + $theme->box("Login", $output); + } +} + + +function theme_main_blocks($theme) { + global $PHP_SELF, $user, $id; + + switch (strtok($PHP_SELF, ".")) { + case "/discussion": + if ($user->id) $story = db_fetch_object(db_query("SELECT * FROM stories WHERE id = '$id'")); + if ($story->status == 1) theme_moderation_results($theme, $story); + else theme_new_headlines($theme); + break; + default: + theme_account($theme); + } +} + +function theme_user_blocks($theme) { + global $PHP_SELF, $repository, $user; + if ($user->id && strstr($PHP_SELF, "index.php")) { + $result = db_query("SELECT * FROM layout l LEFT JOIN blocks b ON l.block = b.name WHERE l.user = '$user->id' AND l.weight > 0 AND b.status = '1' ORDER BY weight DESC"); + while ($block = db_fetch_object($result)) { + $blocks = module_execute($block->module, "block"); + $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]); + } + } +} + +function theme_morelink($theme, $story) { + return ($story->article) ? "[ <A HREF=\"discussion.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\"><B>read more</B></FONT></A> | ". strlen($story->article) ." bytes | <A HREF=\"discussion.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]" : "[ <A HREF=\"discussion.php?id=$story->id\"><FONT COLOR=\"$theme->hlcolor2\">". format_plural($story->comments, "comment", "comments") ."</FONT></A> ]"; +} + +function theme_moderation_results($theme, $story) { + global $user; + + if ($user->id && $story->id && $vote = user_getHistory($user->history, "s$story->id")) { + $output .= "<P><B>You voted `$vote'.</B></P>\n"; + $output .= "<P>\n"; + $output .= "<B>Other people voted:</B><BR>\n"; + + $result = db_query("SELECT * FROM users WHERE id != $user->id AND history LIKE '%s$story->id%'"); + while ($account = db_fetch_object($result)) { + $output .= "". format_username($account->userid) ." voted `". user_getHistory($account->history, "s$story->id") ."'.<BR>"; + } + + $theme->box("Moderation results", $output); + } +} + +function theme_related_links($theme, $story) { + ### Parse story for <A HREF="">-tags: + $text = stripslashes("$story->abstract $story->updates $story->article"); + while ($text = stristr($text, "<A HREF=")) { + $link = substr($text, 0, strpos(strtolower($text), "</a>") + 4); + $text = stristr($text, "</A>"); + if (!stristr($link, "mailto:")) $content .= "<LI>$link</LI>"; + } + + ### Stories in the same category: + $content .= " <LI>More about <A HREF=\"search.php?category=". urlencode($story->category) ."\">$story->category</A>.</LI>"; + + ### Stories from the same author: + if ($story->userid) $content .= " <LI>Also by <A HREF=\"search.php?author=". urlencode($story->userid) ."\">$story->userid</A>.</LI>"; + + $theme->box("Related links", $content); +} + +function theme_old_headlines($theme, $num = 10) { + global $user; + + if ($user->stories) $result = db_query("SELECT id, subject, timestamp FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT $user->stories, $num"); + else $result = db_query("SELECT id, subject, timestamp FROM stories WHERE status = 2 ORDER BY timestamp DESC LIMIT $num, $num"); + + while ($story = db_fetch_object($result)) { + if ($time != date("F jS", $story->timestamp)) { + $content .= "<P><B>". date("l, M jS", $story->timestamp) ."</B></P>\n"; + $time = date("F jS", $story->timestamp); + } + $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A></LI>\n"; + } + $content .= "<P ALIGN=\"right\">[ <A HREF=\"search.php\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>"; + + $theme->box("Older headlines", $content); +} + +function theme_comment_moderation($id, $author, $score, $votes) { + global $user, $comment_votes; + + if ($user->id && $user->userid != $author && !user_getHistory($user->history, "c$id")) { + $output .= "<SELECT NAME=\"moderate[$id]\">\n"; + foreach ($comment_votes as $key=>$value) $output .= " <OPTION VALUE=\"$value\">$key</OPTION>\n"; + $output .= "</SELECT>\n"; + } + else { + $output .= "<TABLE BORDER=\"0\" CELLSPACING=\"1\" CELLPADDING=\"0\"><TR><TD>score:</TD><TD>". format_data($score) ."</TD></TR><TR><TD>votes:</TD><TD>". format_data($votes) ."</TR></TABLE>"; + } + + return $output; +} + +function theme_new_headlines($theme, $num = 10) { + global $user; + + $content = ""; + $result = db_query("SELECT id, subject FROM stories WHERE status = 2 ORDER BY id DESC LIMIT $num"); + while ($story = db_fetch_object($result)) $content .= "<LI><A HREF=\"discussion.php?id=$story->id\">$story->subject</A></LI>\n"; + $content .= "<P ALIGN=\"right\">[ <A HREF=\"search.php\"><FONT COLOR=\"$theme->hlcolor2\">more</FONT></A> ]</P>"; + $theme->box("Latest headlines", $content); +} ?> diff --git a/includes/widget.inc b/includes/widget.inc index 96fe68ab4..ffb883334 100644 --- a/includes/widget.inc +++ b/includes/widget.inc @@ -1,19 +1,72 @@ <? -function display_module_blocks() { - global $repository, $theme; - - function display_block($name, $module) { - global $theme; - - if ($blocks = module_execute($name, "block")) { - foreach ($blocks as $id=>$block) { - $theme->box($block["subject"], $block["content"]); - } +function display_account($theme) { + global $user, $site_name; + + if ($user->id) { + + function submission_number() { + $result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1"); + return ($result) ? db_result($result, 0) : 0; } + + ### Display account settings: + $content .= "<LI><A HREF=\"account.php?op=track&topic=comments\">track your comments</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=track&topic=stories\">track your stories</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=track&topic=site\">track $site_name</A></LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"submission.php\">submission queue</A> (<FONT COLOR=\"red\">". submission_number() ."</FONT>)</LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=diary\">edit your diary</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=user\">edit your information</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=site\">edit your settings</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=edit&topic=block\">edit your blocks</A></LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"account.php?op=view&topic=diary\">view your diary</A></LI>\n"; + $content .= "<LI><A HREF=\"account.php?op=view&topic=info\">view your information</A></LI>\n"; + $content .= "<P>\n"; + $content .= "<LI><A HREF=\"account.php?op=logout\">logout</A></LI>\n"; + + $theme->box("$user->userid's configuration", "$content"); + } + else { + $output .= "<CENTER>\n"; + $output .= " <FORM ACTION=\"account.php?op=Login\" METHOD=\"post\">\n"; + $output .= " <P><B>Username:</B><BR><INPUT NAME=\"userid\" SIZE=\"15\"></P>\n"; + $output .= " <P><B>Password:</B><BR><INPUT NAME=\"passwd\" SIZE=\"15\" TYPE=\"password\"></P>\n"; + $output .= " <P><INPUT NAME=\"op\" TYPE=\"submit\" VALUE=\"Login\"></P>\n"; + $output .= " <P><A HREF=\"account.php\">REGISTER</A></P>\n"; + $output .= " </FORM>\n"; + $output .= "</CENTER>\n"; + + $theme->box("Login", $output); } +} - module_iterate("display_block"); + +function display_main_blocks($theme) { + global $PHP_SELF, $user, $id; + + switch (strtok($PHP_SELF, ".")) { + case "/discussion": + if ($user->id) $story = db_fetch_object(db_query("SELECT * FROM stories WHERE id = '$id'")); + if ($story->status == 1) display_moderation_results($theme, $story); + else display_new_headlines($theme); + break; + default: + display_account($theme); + } +} + +function display_user_blocks($theme) { + global $repository, $user; + if ($user->id) { + $result = db_query("SELECT * FROM layout l LEFT JOIN blocks b ON l.block = b.name WHERE l.user = '$user->id' AND l.weight > 0 AND b.status = '1' ORDER BY weight DESC"); + while ($block = db_fetch_object($result)) { + $blocks = module_execute($block->module, "block"); + $theme->box($blocks[$block->offset]["subject"], $blocks[$block->offset]["content"]); + } + } } function display_morelink($theme, $story) { @@ -98,34 +151,4 @@ function display_new_headlines($theme, $num = 10) { $theme->box("Latest headlines", $content); } -function display_account($theme) { - global $user, $site_name; - - if ($user->id) { - - function submission_number() { - $result = db_query("SELECT COUNT(id) FROM stories WHERE status = 1"); - return ($result) ? db_result($result, 0) : 0; - } - - ### Display account settings: - $content .= "<LI><A HREF=\"account.php?op=track&topic=comments\">track your comments</A></LI>\n"; - $content .= "<LI><A HREF=\"account.php?op=track&topic=stories\">track your stories</A></LI>\n"; - $content .= "<LI><A HREF=\"account.php?op=track&topic=site\">track $site_name</A></LI>\n"; - $content .= "<P>\n"; - $content .= "<LI><A HREF=\"submission.php\">submission queue</A> (<FONT COLOR=\"red\">". submission_number() ."</FONT>)</LI>\n"; - $content .= "<P>\n"; - $content .= "<LI><A HREF=\"account.php?op=edit&topic=diary\">edit your diary</A></LI>\n"; - $content .= "<LI><A HREF=\"account.php?op=edit&topic=user\">edit your information</A></LI>\n"; - $content .= "<LI><A HREF=\"account.php?op=edit&topic=site\">edit your settings</A></LI>\n"; - $content .= "<P>\n"; - $content .= "<LI><A HREF=\"account.php?op=view&topic=diary\">view your diary</A></LI>\n"; - $content .= "<LI><A HREF=\"account.php?op=view&topic=info\">view your information</A></LI>\n"; - $content .= "<P>\n"; - $content .= "<LI><A HREF=\"account.php?op=logout\">logout</A></LI>\n"; - - $theme->box("$user->userid's account", "$content", "NOWRAP"); - } -} - ?> @@ -1,6 +1,6 @@ <? -include "includes/theme.inc"; +include "includes/common.inc"; ### Security check: if (strstr($number, " ") || strstr($date, " ")) { diff --git a/module.php b/module.php index f2246aae6..f1cae971d 100644 --- a/module.php +++ b/module.php @@ -1,6 +1,6 @@ <? -include_once "includes/theme.inc"; +include_once "includes/common.inc"; module_execute($mod, "page"); ?> diff --git a/modules/backend.module b/modules/backend.module index 217762ac7..ab8c6ab9e 100644 --- a/modules/backend.module +++ b/modules/backend.module @@ -5,7 +5,7 @@ $module = array("page" => "backend_page", "block" => "backend_block", "admin" => "backend_admin"); -include "includes/theme.inc"; +include "includes/common.inc"; include "modules/backend.class"; function backend_page() { diff --git a/modules/diary.module b/modules/diary.module index 7e49e03e6..29d8af1f2 100644 --- a/modules/diary.module +++ b/modules/diary.module @@ -4,8 +4,7 @@ $module = array("page" => "diary_page", "block" => "diary_block", "admin" => "diary_admin"); - -include "includes/theme.inc"; +include "includes/common.inc"; function diary_page_overview($num = 20) { global $theme, $user; diff --git a/modules/faq.module b/modules/faq.module index 31ea797cf..e50231c67 100644 --- a/modules/faq.module +++ b/modules/faq.module @@ -2,7 +2,7 @@ $module = array("page" => "faq_page"); -include "includes/theme.inc"; +include "includes/common.inc"; function faq_page() { global $theme; diff --git a/modules/wishlist.module b/modules/wishlist.module index 661e98973..c11bf51de 100644 --- a/modules/wishlist.module +++ b/modules/wishlist.module @@ -4,7 +4,6 @@ $module = array("page" => "wishlist_page"); function wishlist_page() { ?> - <H1>Whislist</H1> <SMALL><I>$Id$</I></SMALL> @@ -74,5 +73,4 @@ function wishlist_page() { <? } -?> - +?>
\ No newline at end of file diff --git a/search.php b/search.php index da3b70d2a..83ac91511 100644 --- a/search.php +++ b/search.php @@ -1,5 +1,5 @@ <? - include "includes/theme.inc"; + include "includes/common.inc"; $theme->header(); diff --git a/submission.php b/submission.php index ad1767ed0..a34ef6a7d 100644 --- a/submission.php +++ b/submission.php @@ -1,7 +1,7 @@ <? include "includes/submission.inc"; -include "includes/theme.inc"; +include "includes/common.inc"; function submission_displayMain() { global $PHP_SELF, $theme, $user; diff --git a/submit.php b/submit.php index 579f010fa..59e055627 100644 --- a/submit.php +++ b/submit.php @@ -139,7 +139,7 @@ function submit_submit($subject, $abstract, $article, $category) { $theme->footer(); } -include "includes/theme.inc"; +include "includes/common.inc"; switch($op) { case "Preview submission": diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme index b8e671083..929fcc494 100644 --- a/themes/marvin/marvin.theme +++ b/themes/marvin/marvin.theme @@ -1,24 +1,21 @@ <? class Theme { - ### color set #1: + // color set #1: var $bgcolor1 = "#EAEAEA"; // background color var $fgcolor1 = "#404040"; // table body color var $hlcolor1 = "#666699"; // high-light color - ### color set #2: + // color set #2: var $bgcolor2 = "#666699"; var $fgcolor2 = "#666699"; var $hlcolor2 = "#666699"; - ### color set #3: + // color set #3: var $bgcolor3 = "#EFEFEF"; var $fgcolor3 = "yellow"; var $hlcolor3 = "yellow"; - ###### - # Syntax.......: header($title); - # Description..: a function to draw the page header. function header($title) { global $site_name; ?> @@ -53,10 +50,6 @@ <? } - ###### - # Syntax.......: abstract(...); - # Description..: a function to draw an abstract story box, that is the - # boxes displayed on the main page. function abstract($story) { print "\n<!-- story: \"$story->subject\" -->\n"; print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n"; @@ -75,16 +68,11 @@ print " </TD>\n"; print " </TR>\n"; print " <TR><TD COLSPAN=\"2\"> </TD></TR>\n"; - print " <TR><TD COLSPAN=\"2\">". display_morelink($this, $story) ."</TD></TR>\n"; + print " <TR><TD COLSPAN=\"2\">". theme_morelink($this, $story) ."</TD></TR>\n"; print "</TABLE>\n"; print "<BR><BR>\n\n"; } - ###### - # Syntax.......: article(...); - # Description..: a function to dispay a complete article (without user - # comments). It's what you get when you followed for - # instance one of read-more links on the main page. function article($story, $reply) { print "\n<!-- story: \"$story->subject\" -->\n"; print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n"; @@ -109,9 +97,6 @@ print "<BR><BR>\n\n"; } - ###### - # Syntax.......: commentControl(...); - # Description..: this function is used to theme the comment control box. function commentControl($sid, $title, $threshold, $mode, $order) { global $user; @@ -167,13 +152,10 @@ <? } - ###### - # Syntax.......: comment(...); - # Description..: this function is used to theme user comments. function comment($comment, $link, $thread = "") { print "<A NAME=\"$comment->cid\">\n"; - ### Create comment header: + // Create comment header: print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\"#000000\" WIDTH=\"100%\">\n"; print " <TR BGCOLOR=\"#000000\">\n"; print " <TD>\n"; @@ -183,22 +165,22 @@ print " <TABLE BORDER=\"0\" CELLPADDING=\"2\" CELLSPACING=\"1\" WIDTH=\"100%\">\n"; print " <TR>\n"; - ### Subject: + // Subject: print " <TD ALIGN=\"right\" WIDTH=\"5%\"><B>Subject:</FONT></TD>\n"; print " <TD WIDTH=\"80%\"><B><FONT COLOR=\"$this->hlcolor1\">". check_output($comment->subject) ."</FONT></B></TD>\n"; - ### Moderation: + // Moderation: print " <TD ALIGN=\"right\" ROWSPAN=\"3\" VALIGN=\"middle\" WIDTH=\"15%\">\n"; - display_comment_moderation($comment->cid, $comment->userid, $comment->score, $comment->votes); + theme_comment_moderation($comment->cid, $comment->userid, $comment->score, $comment->votes); print " </TD>\n"; print " </TR>\n"; - ### Author: + // Author: print " <TR>\n"; print " <TD ALIGN=\"right\" VALIGN=\"top\">Author:</TD><TD>". format_username($comment->userid) ."</TD>\n"; print " </TR>\n"; - ### Date + // Date print " <TR>\n"; print " <TD ALIGN=\"right\">Date:</TD><TD>". format_date($comment->timestamp) ."</TD>\n"; print " </TR>\n"; @@ -207,13 +189,13 @@ print " </TD>\n"; print " </TR>\n"; - ### Print body of comment: + // Print body of comment: if ($comment->comment) print " <TR><TD BGCOLOR=\"#FFFFFF\">". check_output($comment->comment, 1) ."</TD></TR>\n"; - ### Print thread (if any): + // Print thread (if any): if ($thread) print " <TR><TD BGCOLOR=\"$this->bgcolor1\">$thread</TD></TR>\n"; - ### Print bottom link(s): + // Print bottom link(s): print " <TR><TD ALIGN=\"right\" BGCOLOR=\"$this->bgcolor1\">[ $link ]</TD></TR>\n"; print " </TABLE>\n"; print " </TD>\n"; @@ -222,17 +204,14 @@ print "<BR>\n\n"; } - ###### - # Syntax.......: box($subject, $body, $options = ""); - # Description..: a function to draw a box/block. function box($subject, $content, $options = "") { print "\n<!-- box: \"$subject\" -->\n"; print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"0\" BGCOLOR=\"#000000\" WIDTH=\"100%\">\n"; print " <TR>\n"; - print " <TD $wrap>\n"; + print " <TD>\n"; print " <TABLE BORDER=\"0\" CELLPADDING=\"5\" CELLSPACING=\"1\" WIDTH=\"100%\">\n"; - print " <TR><TD ALIGN=\"center\" BGCOLOR=\"$this->bgcolor1\" WIDTH=\"100%\"><FONT COLOR=\"$this->fgcolor1\"><B>$subject</B></FONT></TD></TR>\n"; - print " <TR><TD BGCOLOR=\"#FFFFFF\" $options>$content</TD></TR>\n"; + print " <TR><TD ALIGN=\"center\" BGCOLOR=\"$this->bgcolor1\" NOWRAP><FONT COLOR=\"$this->fgcolor1\"><B>$subject</B></FONT></TD></TR>\n"; + print " <TR><TD BGCOLOR=\"#FFFFFF\">$content</TD></TR>\n"; print " </TABLE>\n"; print " </TD>\n"; print " </TR>\n"; @@ -240,73 +219,17 @@ print "<BR>\n\n"; } - ###### - # Syntax.......: footer(); - # Description..: a function to draw the page footer. function footer() { ?> </TD> <TD VALIGN="top"> <? - global $PHP_SELF; - - if (strstr($PHP_SELF, "index.php")) { - global $user, $date; - - ### Display account: - display_account($this); - - ### Display old headlines: - display_old_headlines($this); - - ### Display module blocks: - display_module_blocks(); - } - elseif (strstr($PHP_SELF, "account.php")) { - ### Display account: - display_account($this); - } - elseif (strstr($PHP_SELF, "module.php")) { - ### Display account: - display_account($this); - } - elseif (strstr($PHP_SELF, "submission.php")) { - ### Display account: - display_account($this); - } - elseif (strstr($PHP_SELF, "submit.php")) { - ### Display new headlines: - display_new_headlines($this); - } - elseif (strstr($PHP_SELF, "discussion.php")) { - global $id; - - if ($id && $story = id2story($id)) { - if ($story->status == 2) { - ### Display new headlines: - display_new_headlines($this); - } - else { - ### Display results of moderation: - display_moderation_results($this, $story); - } - } - else { - ### Display account: - display_account($this); - - ### Display new headlines: - display_new_headlines($this); - } - } - else { - ### Display account: - display_account($this); + // Display main blocks: + theme_main_blocks($this); - ### Display new headlines: - display_new_headlines($this); - } - ?> + // Display user-defined blocks: + theme_user_blocks($this); + ?> </TD> </TR> <TR> @@ -321,4 +244,4 @@ } } -?> +?>
\ No newline at end of file diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme index 50c316619..6727b32ef 100644 --- a/themes/unconed/unconed.theme +++ b/themes/unconed/unconed.theme @@ -7,26 +7,23 @@ var $clc0 = "#c8c8d0"; var $cl00 = "#000000"; - ### color set #1: + // color set #1: var $brcolor1 = "#000000"; // border color var $bgcolor1 = "#B5BECE"; var $fgcolor1 = "#000000"; // table body color var $hlcolor1 = "#000000"; // high-light color var $categorycolor = "#202020"; - ### color set #2: + // color set #2: var $bgcolor2 = "#EEEEEE"; var $fgcolor2 = "#000000"; var $hlcolor2 = "#000000"; - ### color set #3: + // color set #3: var $bgcolor3 = "#D7D7D7"; var $fgcolor3 = "#000000"; var $hlcolor3 = "yellow"; - ###### - # Syntax.......: header($title); - # Description..: a function to draw the page header. function header($title) { global $site_name; srand((double)microtime()*1000000); @@ -73,10 +70,6 @@ <? } - ###### - # Syntax.......: abstract(...); - # Description..: a function to draw an abstract story box, that is the - # boxes displayed on the main page. function abstract($story) { $timestamp = format_date($story->timestamp); @@ -108,16 +101,11 @@ ?> </TD> </TR> - <TR BGCOLOR="<? echo $this->bgcolor3; ?>"><TD BGCOLOR="<? echo $this->bgcolor3 ?>" ALIGN="right" COLSPAN="2"><? echo display_morelink($this, $story) ?></TD></TR> + <TR BGCOLOR="<? echo $this->bgcolor3; ?>"><TD BGCOLOR="<? echo $this->bgcolor3 ?>" ALIGN="right" COLSPAN="2"><? echo theme_morelink($this, $story) ?></TD></TR> </TABLE></TD></TR></TABLE><BR> <? } - ###### - # Syntax.......: article(...); - # Description..: a function to dispay a complete article (without user - # comments). It's what you get when you followed for - # instance one of read-more links on the main page. function article($story, $reply) { $timestamp = format_date($story->timestamp); @@ -152,9 +140,6 @@ <? } - ###### - # Syntax.......: commentControl(...); - # Description..: this function is used to theme the comment control box. function commentControl($sid, $title, $threshold, $mode, $order) { global $user; $query = mysql_query("SELECT sid FROM comments WHERE sid = $sid"); @@ -215,9 +200,6 @@ <? } - ###### - # Syntax.......: comment(...); - # Description..: this function is used to theme user comments. function comment($comment, $link, $thread = "") { print "<A NAME=\"$comment->cid\"></A>\n"; @@ -228,29 +210,29 @@ <TR><TD> <? - ### Create comment header: + // Create comment header: echo "<TABLE BORDER=\"0\" CELLPADDING=\"4\" CELLSPACING=\"1\" WIDTH=\"100%\">"; echo " <TR BGCOLOR=\"$this->bgcolor1\">"; echo " <TD BGCOLOR=\"$this->bgcolor1\">"; echo " <TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"1\"WIDTH=\"100%\">"; - ### Subject: + // Subject: echo " <TR>"; echo " <TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"5%\"><FONT COLOR=\"$this->hlcolor1\"><B>Subject:</B></FONT></TD><TD WIDTH=\"80%\">"; echo " <B><FONT COLOR=\"$this->fgcolor1\">" . check_output($comment->subject) . "</FONT></B>"; echo " </TD>"; - ### Moderation: + // Moderation: echo " <TD ALIGN=\"right\" ROWSPAN=\"3\" VALIGN=\"middle\" WIDTH=\"15%\">"; - display_comment_moderation($comment->cid, $comment->userid, $comment->score, $comment->votes); + theme_comment_moderation($comment->cid, $comment->userid, $comment->score, $comment->votes); echo " </TD>"; echo " </TR>"; - ### Author: + // Author: echo " <TR>"; echo " <TD ALIGN=\"right\" VALIGN=\"top\">Author:</TD><TD><B>" . format_username($comment->userid) . "</B> "; if ($comment->userid != $anonymous) { - ### Display extra information line: + // Display extra information line: if ($comment->fake_email) $info .= format_email($comment->fake_email); if (eregi("http://",$comment->url)) $info .= " | " . format_url($comment->url); if ($info) echo "<BR>[ $info ]"; @@ -258,38 +240,34 @@ echo " </TD>"; echo " </TR>"; - ### Date + // Date echo " <TR><TD ALIGN=\"right\">Date:</TD><TD>". format_date($comment->timestamp) ."</TD></TR>"; echo " </TABLE>"; echo " </TD>"; echo " </TR>"; - ### Print body of comment: + // Print body of comment: if ($comment) echo " <TR><TD BGCOLOR=\"$this->bgcolor2\">". check_output($comment->comment, 1) ."</TD></TR>"; - ### Print thread (if any): + // Print thread (if any): if ($thread) echo " <TR><TD BGCOLOR=\"$this->bgcolor3\">$thread</TD></TR>"; - ### Print bottom link(s): + // Print bottom link(s): echo " <TR><TD ALIGN=\"right\" BGCOLOR=\"$this->bgcolor3\">[ $link ]</TD></TR>"; echo " </TABLE>"; ?></TD></TR></TABLE><BR><? } - - ###### - # Syntax.......: box($title, $body); - # Description..: a function to draw a box/block. - function box($subject, $content, $options = "") { + function box($subject, $content) { ?> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" BGCOLOR="<? echo $this->brcolor1; ?>" WIDTH="100%"> <TR><TD> <? print "<TABLE BORDER=\"0\" CELLPADDING=\"3\" CELLSPACING=\"1\" WIDTH=\"100%\">"; - print " <TR><TD ALIGN=\"center\" BGCOLOR=\"$this->bgcolor1\"><FONT COLOR=\"$this->fgcolor1\"><B>$subject</B></FONT></TD></TR>"; - print " <TR><TD BGCOLOR=\"$this->bgcolor2\" $options>$content</TD></TR>"; + print " <TR><TD ALIGN=\"center\" BGCOLOR=\"$this->bgcolor1\" NOWRAP><FONT COLOR=\"$this->fgcolor1\"><B>$subject</B></FONT></TD></TR>"; + print " <TR><TD BGCOLOR=\"$this->bgcolor2\">$content</TD></TR>"; print "</TABLE>"; ?> @@ -299,77 +277,16 @@ } - ###### - # Syntax.......: footer(); - # Description..: a function to draw the page footer. function footer() { ?> </TD> <TD VALIGN="top" WIDTH="185"> - <? - global $PHP_SELF, $user; - - if (strstr($PHP_SELF, "index.php")) { - global $user, $date; - - ### Display account: - display_account($this); - - ### Display calendar: - $this->box("Browse archives", droplet_get("calendar")); - - ### Display calendar: - display_old_headlines($this); - } - elseif (strstr($PHP_SELF, "account.php")) { - ### Display account: - display_account($this); - } - elseif (strstr($PHP_SELF, "submission.php")) { - ### Display account: - display_account($this); - } - elseif (strstr($PHP_SELF, "submit.php")) { - ### Display account: - display_account($this); - - ### Display new headlines: - display_new_headlines($this); - } - elseif (strstr($PHP_SELF, "discussion.php")) { - global $id; - - if ($id && $story = id2story($id)) { - if ($story->status == 2) { - ### Display account: - display_account($this); - - ### Display related links: - display_related_links($this, $story); - - ### Display new headlines: - display_new_headlines($this); - } - else { - ### Display results of moderation: - display_moderation_results($this, $story); - } - } - else { - ### Display account: - display_account($this); - - ### Display new headlines: - display_new_headlines($this); - } - } - else { - ### Display account: - display_account($this); - - ### Display new headlines: - display_new_headlines($this); - } + <? + // Display main blocks: + theme_main_blocks($this); + + // Display user-defined blocks: + theme_user_blocks($this); ?> </TD> </TR> |