function dashboard_personal() { $member = member_get(); // Additional fields for user $personal_more = array('site' => array('name' => 'Personal site', 'type' => 'text'), 'about' => array('name' => 'About me', 'type' => 'textarea')); if (request_type('POST')) { cn_dsi_check(); $clause = ''; $any_changes = FALSE; list($editpassword, $confirmpassword, $editnickname, $edithidemail, $more) = GET('editpassword, confirmpassword, editnickname, edithidemail, more', 'POST'); $avatar_file = isset($_FILES['avatar_file']) ? $_FILES['avatar_file'] : null; if (!isset($member['nick']) && !empty($editnickname) || isset($member['nick']) && $member['nick'] !== $editnickname) { $any_changes = TRUE; } if (!isset($member['e-hide']) && !empty($edithidemail) || isset($member['e-hide']) && $member['e-hide'] !== $edithidemail) { $any_changes = TRUE; } if ($editpassword) { if ($editpassword === $confirmpassword) { $any_changes = TRUE; db_user_update($member['name'], "pass="******"Check your email."; cn_send_mail($member['email'], i18n("Password was changed"), $notification); } else { cn_throw_message('Password and confirm do not match', 'e'); } } // Update additional fields for personal data $o_more = base64_encode(serialize($member['more'])); $n_more = base64_encode(serialize($more)); if ($o_more !== $n_more) { $any_changes = TRUE; db_user_update($member['name'], "more=" . $n_more); } // Set an avatar if (!empty($avatar_file) && $avatar_file['error'] == 0) { $uploads_dir = getoption('uploads_dir'); if ($uploads_dir) { $file_name = 'avatar_' . $member['name'] . '_' . $avatar_file['name']; if (isset($member['avatar']) && $member['avatar'] != $file_name) { // remove old avatar unlink($uploads_dir . $member['avatar']); } move_uploaded_file($avatar_file['tmp_name'], $uploads_dir . $file_name); db_user_update($member['name'], "avatar=" . $file_name); $any_changes = TRUE; } } // Has changes? if ($any_changes) { db_user_update($member['name'], "nick={$editnickname}", "e-hide={$edithidemail}"); // Update & Get member from DB mcache_set('#member', NULL); $member = member_get(); cn_throw_message("User info updated! {$clause}"); } else { cn_throw_message("No changes", 'w'); } } $grp = getoption('#grp'); $acl_desc = $grp[$member['acl']]['N']; // Get info from personal data foreach ($personal_more as $name => $pdata) { if (isset($member['more'][$name])) { $personal_more[$name]['value'] = $member['more'][$name]; } } cn_assign('member, acl_write_news, acl_desc, personal_more', $member, test('Can'), $acl_desc, $personal_more); echoheader('-@dashboard/style.css', "Personal options"); echo exec_tpl('dashboard/personal'); echofooter(); }
function cn_extrn_init() { global $template; if ($template == 'rss') { return; } $i18n = getoption('i18n'); if (!$i18n) { $i18n = 'en_US'; } // Facebook initialzie if ((getoption('use_fbcomments') || getoption('use_fblike')) && !mcache_get('fb_js_on') && $template != 'rss') { echo str_replace(array('{appID}', '{fbi18n}'), array(getoption('fb_appid'), str_replace('-', '_', $i18n)), read_tpl('fb_comments')); mcache_set('fb_js_on', true); } // Definition G+ code uses if (getoption('use_gplus') && !mcache_get('gplus_js_on') && $template != 'rss') { echo str_replace('{lang}', $i18n, read_tpl('google_plus')); mcache_set('gplus_js_on', true); } // First init CN script if (!mcache_get('cn:extr_init')) { echo preg_replace('/\\s{2,}/s', ' ', read_tpl('cnscript')); mcache_set('cn:extr_init', true); } }