Changeset 333
- Timestamp:
- 05/11/06 12:49:48 (3 years ago)
- Files:
-
- devel/.htaccess (modified) (2 diffs)
- devel/lib/elgglib.php (modified) (1 diff)
- devel/profile/edit.php (modified) (2 diffs)
- devel/units/files/files_actions.php (modified) (5 diffs)
- devel/units/magpie/function_update.php (modified) (1 diff)
- devel/units/profile/function_actions.php (modified) (3 diffs)
- devel/units/weblogs/weblogs_actions.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/.htaccess
r276 r333 1 1 RewriteEngine on 2 RewriteBase /elgg/ 2 3 Options +FollowSymLinks 3 4 … … 7 8 #php_flag short_open_tag off 8 9 # Forgot that anyone might still have this turned on 9 #php_flag register_globals off10 php_flag register_globals off 10 11 11 12 RewriteRule ^([0-9\-]+)\.css$ _templates/css.php?template=$1 devel/lib/elgglib.php
r307 r333 4084 4084 } 4085 4085 4086 4087 4088 // Take a comma-separated string of keywords and create the relevant tag entries 4089 // in the database. Returns a cleaned comma-separated keyword string. 4090 function insert_tags_from_string ($string, $tagtype, $ref, $access, $owner) { 4091 4092 $ref = (int) $ref; 4093 $owner = (int) $owner; 4094 $tagtype = trim($tagtype); 4095 $access = trim($access); 4096 $string = trim($string); 4097 $keywords = ""; 4098 4099 $string = str_replace("\n", "", $string); 4100 $string = str_replace("\r", "", $string); 4101 if ($string) { 4102 $keyword_list = explode(",", $string); 4103 //$keyword_list = array_unique($keyword_list); // maybe? 4104 sort($keyword_list); 4105 if (sizeof($keyword_list) > 0) { 4106 foreach($keyword_list as $key => $list_item) { 4107 $list_item = trim($list_item); 4108 if ($list_item) { 4109 if ($key > 0) { 4110 $keywords .= ", "; 4111 } 4112 $keywords .= $list_item; 4113 $t = new StdClass; 4114 $t->tagtype = $tagtype; 4115 $t->access = $access; 4116 $t->tag = $list_item; 4117 $t->ref = $ref; 4118 $t->owner = $owner; 4119 insert_record('tags', $t); 4120 } 4121 } 4122 } 4123 } 4124 4125 return($keywords); 4126 } 4127 4128 4086 4129 ?> devel/profile/edit.php
r330 r333 63 63 foreach($profiledetails as $field => $value) { 64 64 $field = addslashes($field); 65 foreach($data['profile:details'] as $datatype) { 66 if ($datatype[1] == $field && $datatype[2] == "keywords") { 67 delete_records('tags','tagtype',$field,'owner',$owner); 68 } 69 } 70 65 $value = trim($value); 66 71 67 if ($value != "") { 72 73 68 //TODO get rid of variable duplication here. (Penny) 74 $owner = (int) $page_owner; 75 $access = $_POST['profileaccess'][$field]; 69 $access = $_POST['profileaccess'][$field]; 76 70 77 71 $pd = new StdClass; … … 79 73 $pd->value = $value; 80 74 $pd->access = $access; 81 $pd->owner = $ owner;75 $pd->owner = $page_owner; 82 76 83 77 $insert_id = insert_record('profile_data',$pd); 84 85 foreach($data['profile:details'] as $datatype) { 86 if ($datatype[1] == $field && $datatype[2] == "keywords") { 87 $keywords = ""; 88 $value = str_replace("\n","",$value); 89 $value = str_replace("\r","",$value); 90 $keyword_list = explode(",",$value); 91 sort($keyword_list); 92 if (sizeof($keyword_list) > 0) { 93 foreach($keyword_list as $key => $list_item) { 94 $list_item = trim($list_item); 95 if ($list_item) { 96 if ($key > 0) { 97 $keywords .= ", "; 98 } 99 $keywords .= $list_item; 100 $t = new StdClass; 101 $t->tagtype = $field; 102 $t->access = $access; 103 $t->tag = $list_item; 104 $t->ref = $insert_id; 105 $t->owner = $owner; 106 insert_record('tags',$t); 107 } 108 } 109 } 110 $value = $keywords; 111 } 78 } 112 79 80 81 foreach($data['profile:details'] as $datatype) { 82 if ($datatype[1] == $field && $datatype[2] == "keywords") { 83 delete_records('tags', 'tagtype', $field, 'owner', $page_owner); 84 $value = insert_tags_from_string ($value, $field, $insert_id, $access, $page_owner); 113 85 } 114 115 86 } 116 87 } devel/units/files/files_actions.php
r271 r333 23 23 $insert_id = insert_record('file_folders',$f); 24 24 $value = trim(optional_param('new_folder_keywords')); 25 if (!empty($value)) { 26 $value = str_replace("\n","",$value); 27 $value = str_replace("\r","",$value); 28 $keyword_list = explode(",",$value); 29 sort($keyword_list); 30 if (sizeof($keyword_list) > 0) { 31 foreach($keyword_list as $key => $list_item) { 32 $t = new StdClass; 33 $t->tagtype = 'folder'; 34 $t->access = $f->access; 35 $t->tag = trim($list_item); 36 $t->ref = $insert_id; 37 $t->owner = $USER->ident; 38 insert_record('tags',$t); 39 } 40 } 41 } 25 insert_tags_from_string ($value, 'folder', $insert_id, $f->access, $f->owner); 42 26 $messages[] = gettext("Your folder was created."); 43 27 } else { … … 87 71 $file_id = insert_record('files',$f); 88 72 $value = trim(optional_param('new_file_keywords')); 89 if (!empty($value)) { 90 $value = str_replace("\n","",$value); 91 $value = str_replace("\r","",$value); 92 $keyword_list = explode(",",$value); 93 sort($keyword_list); 94 if (sizeof($keyword_list) > 0) { 95 foreach($keyword_list as $key => $list_item) { 96 $t = new StdClass; 97 $t->tagtype = 'file'; 98 $t->access = $access; 99 $t->tag = trim($list_item); 100 $t->ref = $file_id; 101 $t->owner = $page_owner; 102 insert_record('tags',$t); 103 } 104 } 105 } 73 insert_tags_from_string ($value, 'file', $file_id, $access, $page_owner); 106 74 $metadata = optional_param('metadata'); 107 75 if (is_array($metadata)) { … … 144 112 delete_records('tags','tagtype','file','ref',$f->ident); 145 113 $file_keywords = trim(optional_param('edit_file_keywords')); 146 if (!empty($file_keywords)) { 147 $value = $file_keywords; 148 $value = str_replace("\n","",$value); 149 $value = str_replace("\r","",$value); 150 $keyword_list = explode(",",$value); 151 sort($keyword_list); 152 if (sizeof($keyword_list) > 0) { 153 foreach($keyword_list as $key => $list_item) { 154 $t = new StdClass; 155 $t->tagtype = 'file'; 156 $t->access = $f->access; 157 $t->tag = trim($list_item); 158 $t->ref = $f->ident; 159 $t->owner = $USER->ident; 160 insert_record('tags',$t); 161 } 162 } 163 } 114 insert_tags_from_string ($file_keywords, 'file', $f->ident, $f->access, $USER->ident); 164 115 $redirect_url = url . $files_username . "/files/"; 165 116 if ($file_folder != -1) { … … 179 130 $f->ident = optional_param('edit_folder_id',0,PARAM_INT); 180 131 $f->name = trim(optional_param('edit_folder_name')); 181 $f->access = trim(optional_param('edit_folder_ group'));132 $f->access = trim(optional_param('edit_folder_access')); 182 133 $f->parent = optional_param('edit_folder_parent',0,PARAM_INT); 183 134 if (!empty($f->ident) && !empty($f->name) && !empty($f->access) && !empty($f->parent)) { 184 $edit_owner = get_field('file_folders','owner','ident',$ edit_folder_id);135 $edit_owner = get_field('file_folders','owner','ident',$f->ident); 185 136 if (run("permissions:check", array("files:edit",$edit_owner))) { 186 137 if ($f->ident != $f->parent) { … … 188 139 delete_records('tags','tagtype','folder','ref',$f->ident); 189 140 $edit_value = trim(optional_param('edit_folder_keywords')); 190 if (!empty($edit_value)) { 191 $edit_value = str_replace("\n","",$edit_value); 192 $edit_value = str_replace("\r","",$edit_value); 193 $edit_keyword_list = explode(",",$edit_value); 194 sort($edit_keyword_list); 195 if (sizeof($edit_keyword_list) > 0) { 196 foreach($edit_keyword_list as $key => $list_item) { 197 $t = new StdClass; 198 $t->tagtype = 'folder'; 199 $t->access = $f->access; 200 $t->tag = trim($list_item); 201 $t->ref = $f->ident; 202 $f->owner = $USER->ident; 203 insert_record('tags',$t); 204 } 205 } 206 } 141 insert_tags_from_string ($edit_value, 'folder', $f->ident, $f->access, $USER->ident); 207 142 $messages[] = gettext("The folder was edited."); 208 143 } else { devel/units/magpie/function_update.php
r269 r333 112 112 $id = insert_record('weblog_posts',$wp); 113 113 $tags = trim($weblog->autopost_tag); 114 if ($tags != "") { 115 $tags = explode(",",$tags); 116 foreach($tags as $tag) { 117 $tag = trim($tag); 118 if ($tag != "") { 119 $tag = $tag; 120 $t = new StdClass; 121 $t->tag = $tag; 122 $t->tagtype = 'weblog'; 123 $t->ref = $id; 124 $t->access = 'PUBLIC'; 125 $t->owner = $weblog_user_id; 126 insert_record('tags',$t); 127 } 128 } 129 } 114 insert_tags_from_string ($tags, 'weblog', $id, 'PUBLIC', $weblog_user_id); 130 115 $rssresult = run("weblogs:rss:publish", array($weblog->user_id, false)); 131 116 $rssresult = run("profile:rss:publish", array($weblog->user_id, false)); devel/units/profile/function_actions.php
r330 r333 3 3 4 4 global $page_owner; 5 $page_owner = (int) $page_owner; 5 6 6 7 if (isset($_POST['action']) && $_POST['action'] == "profile:edit" && logged_on && run("permissions:check", "profile")) { … … 12 13 13 14 $field = addslashes($field); 14 foreach($data['profile:details'] as $datatype) { 15 if ($datatype[1] == $field && $datatype[2] == "keywords") { 16 delete_records('tags',"tagtype='$field'",'owner',$owner); 17 } 18 } 19 15 $value = trim($value); 16 20 17 if ($value != "") { 21 18 //TODO get rid of variable duplication here. (Penny) 22 19 $value = addslashes($value); 23 $field = addslashes($field);20 //$field = addslashes($field); 24 21 $access = trim($_POST['profileaccess'][$field]); 25 22 $owner = (int) $page_owner; … … 29 26 $pd->value = $value; 30 27 $pd->access = $access; 31 $pd->owner = $ owner;28 $pd->owner = $page_owner; 32 29 $insert_id = insert_record('profile_data',$pd); 33 30 34 31 foreach($data['profile:details'] as $datatype) { 35 32 if ($datatype[1] == $field && $datatype[2] == "keywords") { 36 $keywords = ""; 37 $value = str_replace("\n","",$value); 38 $value = str_replace("\r","",$value); 39 $keyword_list = explode(",",$value); 40 sort($keyword_list); 41 if (sizeof($keyword_list) > 0) { 42 foreach($keyword_list as $key => $list_item) { 43 $list_item = trim($list_item); 44 if ($list_item) { 45 if ($key > 0) { 46 $keywords .= ", "; 47 } 48 $keywords .= $list_item; 49 $t = new StdClass; 50 $t->tagtype = $field; 51 $t->access = $access; 52 $t->tag = $list_item; 53 $t->ref = $insert_id; 54 $t->owner = $owner; 55 insert_record('tags',$t); 56 } 57 } 58 } 59 $value = $keywords; 33 delete_records('tags', 'tagtype', $field, 'owner', $page_owner); 34 $value = insert_tags_from_string ($value, $field, $insert_id, $access, $page_owner); 60 35 } 61 36 } devel/units/weblogs/weblogs_actions.php
r305 r333 18 18 $insert_id = insert_record('weblog_posts',$post); 19 19 $value = trim(optional_param('new_weblog_keywords')); 20 if (!empty($value)) { 21 $value = str_replace("\n","",$value); 22 $value = str_replace("\r","",$value); 23 $keyword_list = explode(",",$value); 24 sort($keyword_list); 25 if (sizeof($keyword_list) > 0) { 26 foreach($keyword_list as $key => $list_item) { 27 $t = new StdClass; 28 $t->tagtype = 'weblog'; 29 $t->access = $post->access; 30 $t->tag = $list_item; 31 $t->ref = $insert_id; 32 $t->owner = $USER->ident; 33 insert_record('tags',$t); 34 } 35 } 36 } 20 insert_tags_from_string ($value, 'weblog', $insert_id, $post->access, $post->owner); 21 37 22 $rssresult = run("weblogs:rss:publish", array($page_owner, false)); 38 23 $rssresult = run("profile:rss:publish", array($page_owner, false)); … … 65 50 delete_records('tags','tagtype','weblog','ref',$post->ident); 66 51 $value = trim(optional_param('edit_weblog_keywords')); 67 if (!empty($value)) { 68 $value = str_replace("\n","",$value); 69 $value = str_replace("\r","",$value); 70 $keyword_list = explode(",",$value); 71 sort($keyword_list); 72 if (sizeof($keyword_list) > 0) { 73 foreach($keyword_list as $key => $list_item) { 74 $t = new StdClass; 75 $t->tagtype = 'weblog'; 76 $t->access = $post->access; 77 $t->tag = trim($list_item); 78 $t->ref = $post->ident; 79 $t->owner = $oldpost->owner; 80 insert_record('tags',$t); 81 } 82 } 83 } 84 52 insert_tags_from_string ($value, 'weblog', $post->ident, $post->access, $oldpost->owner); 53 85 54 $rssresult = run("weblogs:rss:publish", array($page_owner, false)); 86 55 $rssresult = run("profile:rss:publish", array($page_owner, false));
