Changeset 318
- Timestamp:
- 06/03/08 20:30:20 (6 months ago)
- Files:
-
- avatars/languages (deleted)
- avatars/releases (added)
- avatars/releases/0.1 (added)
- avatars/releases/0.1/CHANGELOG (added)
- avatars/releases/0.1/README (added)
- avatars/releases/0.1/TODO (added)
- avatars/releases/0.1/img (added)
- avatars/releases/0.1/img/1.gif (added)
- avatars/releases/0.1/img/2.gif (added)
- avatars/releases/0.1/img/3.gif (added)
- avatars/releases/0.1/img/4.gif (added)
- avatars/releases/0.1/img/5.gif (added)
- avatars/releases/0.1/img/6.gif (added)
- avatars/releases/0.1/index.php (added)
- avatars/releases/0.1/lib (added)
- avatars/releases/0.1/lib.php (added)
- avatars/releases/0.1/lib/avatars_config.php (added)
- avatars/releases/0.1/lib/avatars_functions.php (added)
- avatars/releases/0.1/plugin.info (added)
- avatars/releases/0.1/templates (added)
- avatars/releases/0.1/templates/form_avatar (added)
- avatars/trunk (added)
- avatars/trunk/CHANGELOG (moved) (moved from avatars/CHANGELOG)
- avatars/trunk/README (moved) (moved from avatars/README)
- avatars/trunk/TODO (moved) (moved from avatars/TODO)
- avatars/trunk/img (moved) (moved from avatars/img)
- avatars/trunk/index.php (moved) (moved from avatars/index.php) (2 diffs)
- avatars/trunk/lib (moved) (moved from avatars/lib)
- avatars/trunk/lib.php (moved) (moved from avatars/lib.php) (2 diffs)
- avatars/trunk/lib/avatars_functions.php (modified) (5 diffs)
- avatars/trunk/plugin.info (moved) (moved from avatars/plugin.info)
- avatars/trunk/templates (moved) (moved from avatars/templates)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
avatars/trunk/index.php
r315 r318 13 13 require_once (dirname(dirname(__FILE__)) . "/../includes.php"); 14 14 15 //global $profile_id, $CFG, $PAGE, $messages, $USER;16 15 include (dirname(__FILE__) . "/lib/avatars_functions.php"); 17 16 include (dirname(__FILE__) . "/lib/avatars_config.php"); … … 34 33 $title = __gettext("Choose your avatar"); 35 34 35 //switching the action to do (Save, or nothing) 36 36 if (isset($_POST["save_avatar"])) 37 37 { avatars/trunk/lib.php
r315 r318 15 15 16 16 17 require_once (dirname(dirname(__FILE__)) . "/../includes.php");18 19 run("profile:init");20 17 global $CFG, $PAGE, $profile_id; 21 18 require_once (dirname(__FILE__) . "/lib/avatars_config.php"); … … 28 25 if (defined("context") && context == "avatars" && $page_owner == $_SESSION['userid']) { 29 26 $PAGE->menu[] = array( 'name' => 'avatars', 30 'html' => '< a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a>');27 'html' => '<l1><a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a></li>'); 31 28 32 29 33 30 } else { 34 31 $PAGE->menu[] = array( 'name' => 'avatars', 35 'html' => '< a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a>');32 'html' => '<li><a href="' . $CFG->wwwroot . 'mod/avatars/index.php?profile_name='.$user.'">' . __gettext("Your Avatars") . '</a></li>'); 36 33 } 37 34 } avatars/trunk/lib/avatars_functions.php
r315 r318 14 14 function avatars_get_loggeduser_data() 15 15 { 16 $user["name"] = $_SESSION["username"]; 16 17 // In this function we built the array $user, usefull in the update/insert process 18 19 $user["name"] = $_SESSION["username"]; 17 20 $user["ident"] = $_SESSION["userid"]; 18 21 $user["initial"] = substr($user["name"], 0, 1); // returns the first letter of the username logged in … … 24 27 function avatars_create_usericon_folder($user) 25 28 { 29 // This function creates the folder where the avatar will be saved 30 // the avatar replaces the profile icon available for the chosen avatar 26 31 global $CFG; 27 32 require_once (dirname(__FILE__) . "/avatars_config.php"); … … 30 35 31 36 37 //Creating the folders if not exists any 32 38 mkdir($CFG->dirroot.$icons_path.$user["initial"], 0777); 33 39 mkdir($CFG->dirroot.$icons_path.$user["initial"]."/".$user["name"], 0777); … … 37 43 function avatars_update_icon_user($user, $profile_id) 38 44 { 45 46 // here is, the function that updates the profile icon 39 47 global $CFG; 40 48 require_once (dirname(__FILE__) . "/avatars_config.php"); … … 42 50 $icons_path = AVATARS_USERICONS_PATH; 43 51 52 // preparing the data to be inserted in the elgg db 44 53 $avatar_icon = new StdClass; 45 54 $avatar_icon->owner = $user["ident"]; 46 55 $avatar_icon->filename = $_POST["avatar"].".gif"; 47 56 57 // Inserting the icon in their respective elgg's DB table 48 58 $icon_id = insert_record('icons', $avatar_icon); 49 59 60 //Removing the old data of the profileicon changed 50 61 unlink($CFG->dirroot.$icons_path.$user["initial"]."/".$user["name"]."/*"); 51 62 copy($CFG->dirroot."mod/avatars/img/".$_POST["avatar"].".gif", $CFG->dirroot.$icons_path.$user["initial"]."/".$user["name"]."/".$_POST["avatar"].".gif"); 52 63 64 // Preparing the data to be updated for the user 53 65 $avatar_icon_user = new StdClass; 54 66 $avatar_icon_user->ident = $profile_id; 55 67 $avatar_icon_user->icon = $icon_id; 56 68 69 //Updating the user data in the elgg's DB 57 70 update_record('users', $avatar_icon_user); 58 71 }
