diff --git a/b2-include/b2template.functions.php b/b2-include/b2template.functions.php index 43c498dc3..f99a96747 100644 --- a/b2-include/b2template.functions.php +++ b/b2-include/b2template.functions.php @@ -1405,6 +1405,29 @@ function trackback_rdf($timezone = 0) { /***** Permalink tags *****/ +function get_permalink($id=false) { + global $post; + if (!$id) { + if (get_settings('permalink_structure')) { + $unixtime = strtotime($post->post_date); + $rewritecode = array( + '%year%', + '%monthnum%', + '%day%', + '%postname%' + ); + $rewritereplace = array( + date('Y', $unixtime), + date('n', $unixtime), + date('j', $unixtime), + $post->post_name + ); + return str_replace($rewritecode, $rewritereplace, get_settings('permalink_structure')); + } else { // if they're not using the fancy permalink option + return $file.$querystring_start.'p'.$querystring_equal.$post->ID; + } + } +} function permalink_anchor($mode = 'id') { global $id, $post; @@ -1434,25 +1457,7 @@ function permalink_link($file='', $mode = 'id') { $anchor = $id; break; } - $archive_mode = get_settings('archive_mode'); - switch($archive_mode) { - case 'daily': - echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).substr($post->post_date,5,2).substr($postdata['Date'],8,2).'#post-'.$anchor; - break; - case 'monthly': - echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).substr($post->post_date,5,2).'#post-'.$anchor; - break; - case 'weekly': - if((!isset($cacheweekly)) || (empty($cacheweekly[$postdata['Date']]))) { - $cacheweekly[$post->post_date] = $wpdb->get_var("SELECT WEEK('$post->post_date')"); - ++$querycount; - } - echo $file.$querystring_start.'m'.$querystring_equal.substr($post->post_date,0,4).$querystring_separator.'w'.$querystring_equal.$cacheweekly[$post->post_date].'#post-'.$anchor; - break; - case 'postbypost': - echo $file.$querystring_start.'p'.$querystring_equal.$id; - break; - } + echo get_permalink(); } function permalink_single($file='') { diff --git a/blog.header.php b/blog.header.php index ce033331f..e6f5744f5 100644 --- a/blog.header.php +++ b/blog.header.php @@ -13,7 +13,7 @@ require_once ($curpath.$b2inc.'/b2functions.php'); require_once ($curpath.$b2inc.'/xmlrpc.inc'); require_once ($curpath.$b2inc.'/xmlrpcs.inc'); -$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby'); +$b2varstoreset = array('m','p','posts','w','c', 'cat','withcomments','s','search','exact', 'sentence','poststart','postend','preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'monthnum'); for ($i=0; $i $poststart) && (!$m) &&(!$w) && (!$whichcat) && (!$s) && (!$p)) { +if ( !empty($postend) && ($postend > $poststart) && (!$m) && !$month && !$year && !$day &&(!$w) && (!$whichcat) && (!$s) && (!$p)) { if ($what_to_show == 'posts' || ($what_to_show == 'paged' && (!$paged))) { $poststart = intval($poststart); $postend = intval($postend); @@ -243,7 +263,7 @@ if ( !empty($postend) && ($postend > $poststart) && (!$m) &&(!$w) && (!$whichcat } } } - elseif (($m) || ($p) || ($w) || ($s) || ($whichcat) || ($author)) { + elseif (($m) || ($p) || ($w) || ($s) || ($whichcat) || ($author) || $month || $year || $day) { $limits = ''; } } @@ -281,7 +301,11 @@ if ($preview) { } } -//error_log("$request"); -//echo $request; +// error_log("$request"); +// echo $request; $posts = $wpdb->get_results($request); + +if (1 == count($posts)) { + $more = 1; $c = 1; $single = 1; +} ?> \ No newline at end of file diff --git a/index.php b/index.php index 0b47f8379..73f0817a9 100644 --- a/index.php +++ b/index.php @@ -55,8 +55,9 @@ require_once($abspath.'wp-links/links.php'); - - + +

Sorry, no posts matched your criteria.

+ diff --git a/wp-admin/upgrade-072-to-073.php b/wp-admin/upgrade-072-to-073.php index 37b0d8f3a..1e5808ced 100644 --- a/wp-admin/upgrade-072-to-073.php +++ b/wp-admin/upgrade-072-to-073.php @@ -5,6 +5,7 @@ require('wp-install-helper.php'); $step = $HTTP_GET_VARS['step']; if (!$step) $step = 0; if (!step) $step = 0; +update_option('blogdescription', 'hahahah'); ?> @@ -76,6 +77,7 @@ foreach($posts as $post) { flush(); } +$wpdb->query("INSERT INTO `$tableoptions` (`option_id`, `blog_id`, `option_name`, `option_can_override`, `option_type`, `option_value`, `option_width`, `option_height`, `option_description`, `option_admin_level`) VALUES ('', '0', 'permalink_structure', 'Y', '3', '', '20', '8', 'How the permalinks for your site are constructed.', '8');"); ?> Done.

See, that didn’t hurt a bit. All done!

diff --git a/wp-admin/wp-options-permalink.php b/wp-admin/wp-options-permalink.php new file mode 100644 index 000000000..dd1c87257 --- /dev/null +++ b/wp-admin/wp-options-permalink.php @@ -0,0 +1,143 @@ + $v) { + if (is_array($v)) { + $array[$k] = add_magic_quotes($v); + } else { + $array[$k] = addslashes($v); + } + } + return $array; +} + +if (!get_magic_quotes_gpc()) { + $HTTP_GET_VARS = add_magic_quotes($HTTP_GET_VARS); + $HTTP_POST_VARS = add_magic_quotes($HTTP_POST_VARS); + $HTTP_COOKIE_VARS = add_magic_quotes($HTTP_COOKIE_VARS); +} + +$b2varstoreset = array('action','standalone', 'option_group_id'); +for ($i=0; $iAsk for a promotion to your blog admin :)"); + } +?> + +
+
+

Edit Permalink Structure

+

WordPress offers you the ability to create a custom URI structure for your permalinks and archives. The following “tags” are available:

+
    +
  • %year% --- The year of the post, 4 digits, for example 2003
  • +
  • %monthnum% --- Two digit month, for example 05
  • +
  • %day% --- Day of the month, for example 28
  • +
  • %postname% --- A sanitized version of the title of the post. So "This Is A Great Post!" becomes "this-is-a-great-post"
  • +
  • %category% --- Category name of the post. For example "general". Not done yet.
  • +
+

So for example a value like /%year%/%monthnum%/%day%/%postname% could give you a permalink like /2003/05/23/my-cheese-sandwich . For this to work you'll need mod_rewrite installed on your server for the rule generation rule to work below. In the future there may be other options.

+
+

Use the template tags above to create a virtual site structure:

+

+ +

+

+ +

+
+

Using the permalink structure value you currently have, , these are the mod_rewrite rules you should have in your .htaccess file.

+ +

RewriteEngine On
+ RewriteBase
+ RewriteRule ^ [QSA]

+
+ diff --git a/wp-admin/wp-options.php b/wp-admin/wp-options.php index d286cc971..88333da80 100644 --- a/wp-admin/wp-options.php +++ b/wp-admin/wp-options.php @@ -119,6 +119,7 @@ default: } } // end for each group ?> +
  • Permalinks