Umfragen
profile.php
Go to the documentation of this file.
1 <?php
2 /*
3  * backend/edit.php
4  *
5  * Copyright 2012 Johannes <jojo@jojo-42>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  * MA 02110-1301, USA.
21  *
22  *
23  */
24 
25 require_once("../config.php");
26 require_once("../inc/user.class.php");
27 require_once("../inc/tools.php");
28 require_once("../inc/check_login.php");
29 
30 require_once("../inc/db.class.php");
31 require_once("../inc/config.class.php");
32 require_once("../inc/auth.class.php");
33 
34 require_once("../inc/poll.class.php");
35 require_once("../inc/messages.class.php");
36 require_once("../inc/html.class.php");
37 $db= new db( DB_USER, DB_PASS, DB_DATABASE, DB_HOST );
39 $config->load();
40 
42 make_session();
43 check_login();
44 
45 $user = $_SESSION["user"];
46 
47 /*// edit needs ownership or admin rights
48 if( (intval($_SESSION["userID"]) !== intval($poll->owner) ) AND
49  ( !in_array("{$_SESSION["userID"]}",explode(",",SUPER_ADMIN) )) ){
50  die("Umfrage Bearbeiten nicht erlaubt.");
51 }*/
52 
53 if( (isset($_POST["save_profile"])) AND ($_POST["save_profile"] != "") ){
54 
55  if( $user->check_config("email",$_POST["profile_email_address"]) ){
56  $user->set_config("email",$_POST["profile_email_address"]);
57  $user->save_config($db);
58  }else{
59  $messages->add_message(new errorMessage("Die angegebene Emailadresse ist keine Emailadresse!") );
60  }
61  header("Location: profile.php");
62  exit();
63 }
64 
65 
66 //$navbar = array( 0 => array("name"=>"Backend","href"=>"index.php","onclick"=>"") );
67 //$navbar[] = array( "name"=>"Profileinstellungen" , "href"=>"profile.php" , "onclick"=>"");
68 
69 
71 HTML::head("",1); // extra header section , level of deepness for relative paths
72 //HTML::menu($navbar); // navbar array
73 HTML::menu();
74 
75 echo "<h2>Profileinstellungen</h2>";
76 
77 $messages->display_messages();
78 $messages->del_all_messages();
79 
80 
81 echo "<form action='' method='POST'>";
82 
83 echo "<table>";
84  $email = $user->get_config("email");
85  echo "<tr>";
86  echo "<td>E-mail Adresse:</td>";
87  echo "<td><input type='text' name='profile_email_address' value='{$email}'></td>";
88  echo "</tr>";
89 echo "</table>";
90 
91 echo "<input type='submit' name='save_profile' value='Speichern'/>";
92 echo "</form>";
93 
94 
95 
96 HTML::foot();
97 
98 
99 ?>