root/releases/0.1.2a/units/profile/function_actions.php

Revision 2, 1.6 kB (checked in by sven, 3 years ago)

importing elgg-0.1.1a

Line 
1 <?php
2
3     // Action parser for profiles
4
5         if (isset($_POST['action']) && $_POST['action'] == "profile:edit" && logged_on) {
6         
7
8             if (isset($_POST))           
9             if (isset($_POST['profiledetails'])) {
10                 db_query("delete from profile_data where owner = '".$_SESSION['userid']."'");
11                 foreach($_POST['profiledetails'] as $field => $value) {
12
13                     if ($value != "") {
14                 
15                         $value = addslashes($value);
16                         $field = addslashes($field);
17                         $access = addslashes($_POST['profileaccess'][$field]);
18                         $owner = (int) $_SESSION['userid'];
19                         
20                         db_query("insert into profile_data set name = '$field', value = '$value', access = '$access', owner = '$owner'");
21                         $insert_id = (int) db_id();
22                         
23                         foreach($data['profile:details'] as $datatype) {
24                             if ($datatype[1] == $field && $datatype[2] == "keywords") {
25                                 db_query("delete from tags where tagtype = '$field' and owner = '$owner'");
26                                 $keywords = "";
27                                 $value = str_replace("\n","",$value);
28                                 $value = str_replace("\r","",$value);
29                                 $keyword_list = explode(",",$value);
30                                 sort($keyword_list);
31                                 if (sizeof($keyword_list) > 0) {
32                                     foreach($keyword_list as $key => $list_item) {
33                                         if ($key > 0) {
34                                             $keywords .= ", ";
35                                         }
36                                         $keywords .= ($list_item);
37                                         $list_item = (trim($list_item));
38                                         db_query("insert into tags set tagtype = '$field', access = '$access', tag = '$list_item', ref = $insert_id, owner = $owner");
39                                     }
40                                 }
41                                 $value = $keywords;
42                             }
43                         }
44
45                     }
46             
47                 }
48                 $messages[] = "Your profile was updated.";
49             }
50         
51         }
52
53 ?>
Note: See TracBrowser for help on using the browser.