Changeset 453
- Timestamp:
- 07/15/06 05:53:51 (2 years ago)
- Files:
-
- devel/_files/download.php (modified) (3 diffs)
- devel/_files/rss2.php (modified) (1 diff)
- devel/_invite/forgotten_password.php (modified) (1 diff)
- devel/_rss/blog.php (modified) (1 diff)
- devel/_rss/popular.php (modified) (1 diff)
- devel/_rss/static.php (modified) (1 diff)
- devel/_rss/subscriptions.php (modified) (1 diff)
- devel/_weblog/archive_month.php (modified) (1 diff)
- devel/_weblog/rss2.php (modified) (1 diff)
- devel/lib/datalib.php (modified) (2 diffs)
- devel/lib/elgglib.php (modified) (2 diffs)
- devel/profile/index.php (modified) (1 diff)
- devel/units/communities/communities_actions.php (modified) (1 diff)
- devel/units/communities/communities_create.php (modified) (1 diff)
- devel/units/communities/communities_moderator_of.php (modified) (1 diff)
- devel/units/files/folder_view.php (modified) (2 diffs)
- devel/units/files/function_rss_getitems.php (modified) (1 diff)
- devel/units/files/function_rss_publish.php (modified) (1 diff)
- devel/units/files/weblogs_posts_add_fields.php (modified) (1 diff)
- devel/units/friends/friends_edit.php (modified) (1 diff)
- devel/units/magpie/function_subscriptions.php (modified) (1 diff)
- devel/units/magpie/function_subscriptions_popular.php (modified) (1 diff)
- devel/units/magpie/function_subscriptions_publish_to_blog.php (modified) (1 diff)
- devel/units/magpie/function_update.php (modified) (2 diffs)
- devel/units/magpie/function_view_individual.php (modified) (1 diff)
- devel/units/magpie/function_view_post.php (modified) (1 diff)
- devel/units/profile/function_init.php (modified) (1 diff)
- devel/units/search/search_suggest_tags.php (modified) (1 diff)
- devel/units/tinymce/tinymce_js.php (modified) (1 diff)
- devel/units/tinymce/tinymce_userdetails_edit.php (modified) (1 diff)
- devel/units/weblogs/archives_view.php (modified) (1 diff)
- devel/units/weblogs/archives_view_month.php (modified) (1 diff)
- devel/units/weblogs/function_rss_getitems.php (modified) (1 diff)
- devel/units/weblogs/function_search.php (modified) (2 diffs)
- devel/units/weblogs/function_search_rss.php (modified) (1 diff)
- devel/units/weblogs/weblogs_posts_view.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/_files/download.php
r438 r453 28 28 // ... and the file exists on disk ... 29 29 30 // Send 304s where possible, rather than spitting out the file each time31 $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);32 33 $tstamp = filemtime($CFG->dataroot . $file->location);34 $lm = gmdate("D, d M Y H:i:s", $tstamp) . " GMT";35 36 if ($if_modified_since == $lm) {37 header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified");38 exit;39 }40 41 // Send last-modified header to enable if-modified-since requests42 if ($tstamp < time()) {43 header("Last-Modified: " . $lm);44 }45 46 30 // Then output some appropriate headers and send the file data! 47 31 require_once($CFG->dirroot . 'lib/filelib.php'); … … 52 36 header("Cache-Control: private"); 53 37 54 header("Content-type: $mimetype");55 38 if ($mimetype == "application/octet-stream") { 56 39 header('Content-Disposition: attachment'); … … 63 46 @apache_setenv('no-gzip', '1'); 64 47 } 65 readfile($CFG->dataroot . $file->location);48 spitfile_with_mtime_check($CFG->dataroot . $file->location, $mimetype); 66 49 } 67 50 } devel/_files/rss2.php
r447 r453 51 51 header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT"); 52 52 53 $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']);53 $if_none_match = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']) : false; 54 54 55 55 $etag = md5($output); 56 56 header('ETag: "' . $etag . '"'); 57 57 58 if ($if_none_match == $etag) {58 if ($if_none_match && $if_none_match == $etag) { 59 59 header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 60 60 exit; devel/_invite/forgotten_password.php
r339 r453 13 13 $title = gettext("Generate a New Password"); 14 14 15 $body .= run("invite:password:request");15 $body = run("invite:password:request"); 16 16 17 17 $body = templates_draw(array( devel/_rss/blog.php
r430 r453 15 15 $title = run("profile:display:name") ." :: " . gettext("Publish feeds to blog"); 16 16 17 $body = run("rss:subscriptions:publish:blog" ,$feed);17 $body = run("rss:subscriptions:publish:blog"); 18 18 19 19 $body = templates_draw(array( devel/_rss/popular.php
r386 r453 12 12 $title = gettext("Popular feeds"); 13 13 14 $body = run("rss:subscriptions:popular" ,$feed);14 $body = run("rss:subscriptions:popular"); 15 15 16 16 $body = templates_draw( array( devel/_rss/static.php
r269 r453 15 15 header("Pragma: public"); 16 16 header("Cache-Control: public"); 17 header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT");18 17 19 20 $if_modified_since = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']); 21 22 $tstamp = filemtime($file); 23 $lm = gmdate("D, d M Y H:i:s", $tstamp) . " GMT"; 24 25 if ($if_modified_since == $lm) { 26 header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 27 exit; 28 } 29 30 // Send last-modified header to enable if-modified-since requests 31 if ($tstamp < time()) { 32 header("Last-Modified: " . $lm); 33 } 34 35 header("Content-type: text/xml; charset=utf-8"); 36 readfile($file); 18 require_once($CFG->dirroot . 'lib/filelib.php'); 19 spitfile_with_mtime_check($file, "text/xml; charset=utf-8"); 37 20 38 21 ?> devel/_rss/subscriptions.php
r296 r453 15 15 $title = run("profile:display:name") ." :: " . gettext("Feeds"); 16 16 17 $body = run("rss:subscriptions" ,$feed);17 $body = run("rss:subscriptions"); 18 18 19 19 $body = templates_draw(array( devel/_weblog/archive_month.php
r296 r453 15 15 $title = run("profile:display:name") . " :: " . gettext("Blog Archives"); 16 16 17 $body .= run("weblogs:archives:month:view");17 $body = run("weblogs:archives:month:view"); 18 18 19 19 $body = templates_draw(array( devel/_weblog/rss2.php
r429 r453 109 109 header('Expires: ' . gmdate("D, d M Y H:i:s", (time()+3600)) . " GMT"); 110 110 111 $if_none_match = preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']);111 $if_none_match = (isset($_SERVER['HTTP_IF_NONE_MATCH'])) ? preg_replace('/[^0-9a-f]/', '', $_SERVER['HTTP_IF_NONE_MATCH']) : false; 112 112 113 113 $etag = md5($output); 114 header('ETag: "' . $etag . '"');114 header('ETag: "' . $etag . '"'); 115 115 116 if ($if_none_match == $etag) {116 if ($if_none_match && $if_none_match == $etag) { 117 117 header("{$_SERVER['SERVER_PROTOCOL']} 304 Not Modified"); 118 118 exit; devel/lib/datalib.php
r446 r453 1268 1268 1269 1269 $data = (array)$dataobject; 1270 $ddd = array(); 1270 1271 1271 1272 // Pull out data matching these fields … … 1400 1401 1401 1402 $data = (array)$dataobject; 1403 $ddd = array(); 1402 1404 1403 1405 if (defined('ELGG_PERFDB')) { global $PERF ; $PERF->dbqueries++; }; devel/lib/elgglib.php
r451 r453 3406 3406 function cookied_login() { 3407 3407 global $USER; 3408 if( $ticket = md5($_COOKIE[AUTH_COOKIE])) {3408 if((!empty($_COOKIE[AUTH_COOKIE])) && $ticket = md5($_COOKIE[AUTH_COOKIE])) { 3409 3409 if ($user = get_record('users','code',$ticket)) { 3410 3410 $USER = $user; … … 4163 4163 4164 4164 4165 // return the "this is restricted" text for a given access value 4166 // functionised to reduce code duplication 4167 function get_access_description ($accessvalue) { 4168 4169 if ($accessvalue != "PUBLIC") { 4170 if ($accessvalue == "LOGGED_IN") { 4171 $title = "[" . gettext("Logged in users") . "] "; 4172 } else if (substr_count($accessvalue, "user") > 0) { 4173 $title = "[" . gettext("Private") . "] "; 4174 } else { 4175 $title = "[" . gettext("Restricted") . "] "; 4176 } 4177 } else { 4178 $title = ""; 4179 } 4180 4181 return $title; 4182 } 4183 4184 4165 4185 ?> devel/profile/index.php
r420 r453 25 25 26 26 $title = $profile->display_name(); 27 $body .= $profile->view(); 27 $body = $profile->view(); 28 28 29 $body = templates_draw( array( 29 30 'context' => 'contentholder', devel/units/communities/communities_actions.php
r433 r453 24 24 $username = strtolower(trim($comm_username)); 25 25 if (record_exists('users','username',$username)) { 26 $messages[] = sprintf(gettext("The username $s is already taken by another user. You will need to pick a different one."), stripslashes($username));26 $messages[] = sprintf(gettext("The username %s is already taken by another user. You will need to pick a different one."), stripslashes($username)); 27 27 } else { 28 28 $name = trim($comm_name); devel/units/communities/communities_create.php
r269 r453 1 1 <?php 2 2 3 $comm_name = ''; 3 4 if (isset($_SESSION['comm_name'])) { 4 5 $comm_name = $_SESSION['comm_name']; 5 6 } 7 $comm_username = ''; 6 8 if (isset($_SESSION['comm_username'])) { 7 $comm_ name = $_SESSION['comm_username'];9 $comm_username = $_SESSION['comm_username']; 8 10 } 9 11 devel/units/communities/communities_moderator_of.php
r447 r453 20 20 foreach($result as $key => $info) { 21 21 $w = 100; 22 if (sizeof($parameter[1]) > 4) {23 $w = 100;24 }22 //if (count($result) > 4) { 23 // $w = 100; 24 //} 25 25 $friends_username = stripslashes($info->username); 26 26 // $friends_name = htmlspecialchars(stripslashes($info->name), ENT_COMPAT, 'utf-8'); devel/units/files/folder_view.php
r447 r453 69 69 $username = $owner_username; 70 70 $ident = (int) $folder_details->ident; 71 $name = stripslashes($folder_details->name); 71 $name = get_access_description($folder_details->access); 72 $name .= stripslashes($folder_details->name); 72 73 if (run("permissions:check", array("files:edit", $folder_details->owner)) || run("permissions:check", array("files:edit", $folder_details->files_owner))) { 73 74 $areyouSure = gettext("Are you sure you want to permanently delete this folder?"); // gettext variable … … 108 109 $ident = (int) $file->ident; 109 110 $folder = $file->folder; 110 $title = stripslashes($file->title); 111 $title = get_access_description($file->access); 112 $title .= stripslashes($file->title); 111 113 $description = nl2br(stripslashes($file->description)); 112 114 $filetitle = urlencode($title); devel/units/files/function_rss_getitems.php
r420 r453 41 41 require_once($CFG->dirroot . 'lib/filelib.php'); 42 42 foreach($files as $file) { 43 $title = (stripslashes($file->title));43 $title = stripslashes($file->title); 44 44 $link = url . $username . "/files/" . $file->folder . "/" . $file->ident . "/" . (urlencode(stripslashes($file->originalname))); 45 $description = (stripslashes($file->description));45 $description = stripslashes($file->description); 46 46 $pubdate = gmdate("D, d M Y H:i:s T", $file->time_uploaded); 47 $trackmaxtime = max($trackmaxtime, $file->time_uploaded);47 // $trackmaxtime = max($trackmaxtime, $file->time_uploaded); 48 48 $length = (int) $file->size; 49 49 $mimetype = mimeinfo('type',$file->location); devel/units/files/function_rss_publish.php
r447 r453 41 41 $rssurl = $mainurl . "rss/"; 42 42 $rssdescription = sprintf(gettext("Files for %s, hosted on %s."),$name,$sitename); 43 $output .= <<< END43 $output = <<< END 44 44 <?xml-stylesheet type="text/xsl" href="{$rssurl}rssstyles.xsl"?> 45 45 <rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'> devel/units/files/weblogs_posts_add_fields.php
r434 r453 25 25 if ($files = get_records_select('files',"owner = ? AND folder = ?",array($userid,$folderid))) { 26 26 foreach($files as $file) { 27 $name = stripslashes($file->name);28 27 $filetitle = stripslashes($file->title); 29 28 $body .= <<< END devel/units/friends/friends_edit.php
r447 r453 20 20 foreach($result as $key => $info) { 21 21 $w = 100; 22 if ( sizeof($parameter[1]) > 4) {22 if (count($result) > 4) { 23 23 $w = 50; 24 24 } devel/units/magpie/function_subscriptions.php
r442 r453 1 1 <?php 2 2 global $USER,$CFG,$page_owner; 3 $body = ''; 3 4 4 5 if (logged_on) { devel/units/magpie/function_subscriptions_popular.php
r442 r453 1 1 <?php 2 2 global $CFG; 3 $body = ''; 3 4 if (logged_on) { 4 5 devel/units/magpie/function_subscriptions_publish_to_blog.php
r442 r453 2 2 3 3 global $USER,$CFG,$page_owner; 4 $body = ''; 4 5 5 6 if (logged_on) { devel/units/magpie/function_update.php
r402 r453 84 84 $url = substr($url, 0, 255); // trim urls down to the max length in the db, just in case. CURSE YOU, GUARDIAN BLOGGERS! 85 85 86 if ( $item['date_timestamp']) {86 if (!empty($item['date_timestamp'])) { 87 87 $added = (int) $item['date_timestamp']; 88 88 } … … 99 99 if (in_array($url,$feeditems)) { 100 100 // update_record is not going to work here, we don't have a primary key that I can see (Penny) 101 $f = new StdClass;102 $f ->ident = array_search($url,$feeditems);103 $f ->title = $title;104 $f ->body = $description;105 $f ->posted = $posted;106 $f ->url = $url;107 $f ->feed = $parameter;101 $fp = new StdClass; 102 $fp->ident = array_search($url,$feeditems); 103 $fp->title = $title; 104 $fp->body = $description; 105 $fp->posted = $posted; 106 $fp->url = $url; 107 $fp->feed = $parameter; 108 108 update_record('feed_posts',$fp); 109 109 } else { devel/units/magpie/function_view_individual.php
r447 r453 9 9 $feed_offset = optional_param('feed_offset',0,PARAM_INT); 10 10 11 $numposts = count_records_sql('SELECT COUNT (fp.ident) FROM '.$CFG->prefix.'feed_posts fp11 $numposts = count_records_sql('SELECT COUNT(fp.ident) FROM '.$CFG->prefix.'feed_posts fp 12 12 JOIN '.$CFG->prefix.'feeds f ON f.ident = fp.feed 13 13 WHERE f.ident = ?',array($parameter)); devel/units/magpie/function_view_post.php
r442 r453 13 13 $author = ""; 14 14 $usericon = "default.png"; 15 $post_authors[$post->owner] = $author; 15 //if (!empty($post->owner)) { 16 // $post_authors[$post->owner] = $author; 17 //} 16 18 17 19 // $date = stripslashes($post->posted); devel/units/profile/function_init.php
r287 r453 23 23 $page_owner = $profile_id; 24 24 25 define('profileinit',true); 25 if (!defined('profileinit')) { 26 define('profileinit', true); 27 } 26 28 27 29 ?> devel/units/search/search_suggest_tags.php
r269 r453 18 18 } 19 19 20 if ( $results = get_records_sql($searchline) && count($results) > 1) {20 if (($results = get_records_sql($searchline)) && count($results) > 1) { 21 21 $run_result .= "<h2>" . gettext("Automatic tag suggestion:") . "</h2><p>"; 22 22 foreach($results as $returned_tag) { devel/units/tinymce/tinymce_js.php
r355 r453 7 7 if (run('userdetails:editor', $page_owner) == "yes") { 8 8 9 if ( !$CFG->userlocale) {9 if (empty($CFG->userlocale)) { 10 10 $lang = substr($CFG->defaultlocale, 0, 2); 11 11 } else { devel/units/tinymce/tinymce_userdetails_edit.php
r269 r453 4 4 $visualEditorRules = gettext("Set this to 'yes' if you would like to use a visual (WYSIWYG) text editor for your posts and comments."); 5 5 6 $body .= <<< END6 $body = <<< END 7 7 8 8 <h2>$visualEditor</h2> devel/units/weblogs/archives_view.php
r269 r453 18 18 // If there are any archives ... 19 19 $archive = gettext("Weblog Archive"); // gettext variable 20 $run_result .= "<h1 class=\"weblogdateheader\">$archive</h1>";20 $run_result .= "<h1 class=\"weblogdateheader\">$archive</h1>"; 21 21 22 // Get the name of the weblog user23 24 $weblog_name = htmlspecialchars(stripslashes(optional_param('weblog_name')), ENT_COMPAT, 'utf-8');25 26 // Run through them27 28 $lastyear = 0;29 30 foreach($archives as $archive) {31 32 // Extract the year and the month33 34 $year = substr($archive->archivestamp, 0, 4);35 $month = substr($archive->archivestamp, 4, 2);36 37 if ($year != $lastyear) {38 if ($lastyear .= 0) {39 $run_result .= "</ul>";40 }41 $lastyear = $year;42 $run_result .= "<h2 class=\"weblogdateheader\">$year</h2>";43 $run_result .= "<ul>";44 }45 46 // Print a link47 48 $run_result .= "<li>";49 $run_result .= "<a href=\"" . url . $weblog_name . "/weblog/archive/$year/$month/\">";50 $run_result .= strftime("%B %Y", gmmktime(0,0,0,$month,1,$year));51 $run_result .= "</a>";52 $run_result .= "</li>";53 54 }55 56 $run_result .= "</ul>";57 58 // If there are no posts to archive, say so!22 // Get the name of the weblog user 23 24 $weblog_name = htmlspecialchars(stripslashes(optional_param('weblog_name')), ENT_COMPAT, 'utf-8'); 25 26 // Run through them 27 28 $lastyear = 0; 29 30 foreach($archives as $archive) { 31 32 // Extract the year and the month 33 34 $year = substr($archive->archivestamp, 0, 4); 35 $month = substr($archive->archivestamp, 4, 2); 36 37 if ($year != $lastyear) { 38 if ($lastyear .= 0) { 39 $run_result .= "</ul>"; 40 } 41 $lastyear = $year; 42 $run_result .= "<h2 class=\"weblogdateheader\">$year</h2>"; 43 $run_result .= "<ul>"; 44 } 45 46 // Print a link 47 48 $run_result .= "<li>"; 49 $run_result .= "<a href=\"" . url . $weblog_name . "/weblog/archive/$year/$month/\">"; 50 $run_result .= strftime("%B %Y", gmmktime(0,0,0,$month,1,$year)); 51 $run_result .= "</a>"; 52 $run_result .= "</li>"; 53 54 } 55 56 $run_result .= "</ul>"; 57 58 // If there are no posts to archive, say so! 59 59 60 60 } else { 61 $noBlogs = gettext("There are no weblog posts to archive as yet."); // gettext variable - NOT SURE ABOUT THIS POSITION62 $run_result .= "<p> There are no weblog posts to archive as yet.</p>";61 62 $run_result .= "<p>" . gettext("There are no weblog posts to archive as yet.") . "</p>"; 63 63 64 64 } devel/units/weblogs/archives_view_month.php
r269 r453 14 14 // Get the name of the weblog user 15 15 16 $weblog_name = htmlspecialchars(stripslashes(optional_param('weblog_name')), ENT_COMPAT, 'utf-8');16 $weblog_name = optional_param('weblog_name', '', PARAM_ALPHANUM); 17 17 18 18 // Run through them devel/units/weblogs/function_rss_getitems.php
r405 r453 57 57 if ($keywords = get_records_select('tags','tagtype = ? AND ref = ?',array('weblog',$entry->ident))) { 58 58 foreach($keywords as $keyword) { 59 $keywordtags .= "\n\t\t<dc:subject><![CDATA[" .(stripslashes($keyword->tag)) . "]]></dc:subject>";59 $keywordtags .= "\n\t\t<dc:subject><![CDATA[" . (stripslashes($keyword->tag)) . "]]></dc:subject>"; 60 60 } 61 61 } devel/units/weblogs/function_search.php
r447 r453 26 26 } 27 27 $searchline = " wp.ident in (" . $searchline . ")"; 28 if (!$posts = get_records_sql('SELECT wp.ident,u.name,u.username,u.ident as u esrid,wp.title,wp.ident,wp.weblog,wp.owner,wp.posted28 if (!$posts = get_records_sql('SELECT wp.ident,u.name,u.username,u.ident as userid, wp.title, wp.ident, wp.weblog, wp.owner, wp.posted 29 29 FROM '.$CFG->prefix.'weblog_posts wp JOIN '.$CFG->prefix.'users u ON u.ident = wp.owner 30 30 WHERE ('.$searchline.') ORDER BY posted DESC')) { … … 85 85 $friends_menu = run("users:infobox:menu",array($info->ident)); 86 86 $link_keyword = urlencode($parameter[1]); 87 $width = round($width / 2);88 $height = round($height / 2);89 87 $body .= <<< END 90 88 <td align="center"> devel/units/weblogs/function_search_rss.php
r269 r453 23 23 $weblogusername = run("users:id_to_name",$post->weblog); 24 24 $run_result .= "]]></title>\n"; 25 $run_result .= "\t\t<link>" . url . (stripslashes($weblogusername)). "/weblog/" . $post->ident . ".html</link>\n";25 $run_result .= "\t\t<link>" . url . $weblogusername . "/weblog/" . $post->ident . ".html</link>\n"; 26 26 $run_result .= "\t</item>\n"; 27 27 } devel/units/weblogs/weblogs_posts_view.php
r447 r453 69 69 $fullname = $specialname; 70 70 } 71 if ($post->access != "PUBLIC") { 72 if ($post->access == "LOGGED_IN") { 73 $title = "[" . gettext("Logged in users") . "]"; 74 } else if (substr_count($post->access, "user") > 0) { 75 $title = "[" . gettext("Private") . "]"; 76 } else { 77 $title = "[" . gettext("Restricted") . "]"; 78 } 79 } else { 80 $title = ""; 81 } 82 83 $title .= " " . stripslashes($post->title); 71 72 $title = get_access_description($post->access); 73 $title .= stripslashes($post->title); 84 74 85 75 if ($post->owner != $post->weblog) {
