Update of /cvsroot/phpwebapp/top10/templates/edit_project
In directory sc8-pr-cvs1:/tmp/cvs-serv22571/templates/edit_project
Modified Files:
edit_project.php edit_project.html edit_project.db
Log Message:
A user authorized by site admin can edit the details of a project.
Index: edit_project.php
===================================================================
RCS file: /cvsroot/phpwebapp/top10/templates/edit_project/edit_project.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** edit_project.php 2 Oct 2003 07:09:40 -0000 1.3
--- edit_project.php 25 Dec 2003 15:35:46 -0000 1.4
***************
*** 108,118 ****
$username = $event_args["username"];
$to = "dasho";
//$to = $username."@users.sourceforge.net";
! $subject = "";
! $message = " ";
mail($to, $subject, $message);
! WebApp::message("Project sent to '$to' for editing.");
}
--- 108,169 ----
$username = $event_args["username"];
+ $proj_id = $this->getSVar("proj_id");
+
+ //get a unique id
+ $request_id = md5(uniqid(rand()));
+
+ //insert in DB a request with the same id as above
+ $time = time();
+ $ip = $_SERVER["REMOTE_ADDR"];
+ $params = compact("request_id", "time", "ip", "username", "proj_id");
+ WebApp::execDBCmd("insert_request", $params);
+
+ //send a notification e-mail to the user
$to = "dasho";
//$to = $username."@users.sourceforge.net";
! $subject = "Top10: Modify Project '$proj_id'";
! $admin_mail = ADMIN_EMAIL;
! $top10_site = "http://" . $_SERVER["HTTP_HOST"] . APP_URL;
! $confirmation_uri = $top10_site."confirm.php?".$request_id;
! $message = "
! The admin ($admin_mail) of the site
! $top10_site
! has given you permission to modify the details of the
! project '$proj_id'. You can modify them by opening
! the following URL in 24 hours:
! $confirmation_uri
+ ";
+ //mail the message
mail($to, $subject, $message);
!
! //display a confirmation message
! $msg = "Project '$proj_id' has been sent for editing\n"
! . " to $use...@us... .\n";
! WebApp::message($msg);
! }
!
! /**
! * Constructs and returns the body of the message
! * that is sent to the user for changing the details of a project.
! */
! function get_message_body($token)
! {
! $admin_mail = ADMIN_MAIL;
! $username = WebApp::getSVar("username");
! $remote_addr = $_SERVER["REMOTE_ADDR"];
! $top10_site = "http://" . $_SERVER["HTTP_HOST"] . APP_URL;
! $confirmation_uri = $top10_site."confirm.php?".$token;
!
! $message = "
! The admin ($admin_mail) of the site
! $top10_site
! has given you permission to modify the details of the
! project '$proj_id'. You can modify them by opening
! the following URL in 24 hours:
! $confirmation_uri
!
! ";
! return $message;
}
Index: edit_project.html
===================================================================
RCS file: /cvsroot/phpwebapp/top10/templates/edit_project/edit_project.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** edit_project.html 2 Oct 2003 07:09:40 -0000 1.3
--- edit_project.html 25 Dec 2003 15:35:46 -0000 1.4
***************
*** 90,94 ****
<a class="button" href="javascript:done_editing()">Done</a>
</If>
! <If condition="'{{mode}}'=='done'">
<a class="button" href="javascript:add_new_project()">
Add Another Project
--- 90,94 ----
<a class="button" href="javascript:done_editing()">Done</a>
</If>
! <If condition="('{{mode}}'=='done' and '{{ADMIN}}'=='true')">
<a class="button" href="javascript:add_new_project()">
Add Another Project
Index: edit_project.db
===================================================================
RCS file: /cvsroot/phpwebapp/top10/templates/edit_project/edit_project.db,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** edit_project.db 30 Sep 2003 09:41:07 -0000 1.2
--- edit_project.db 25 Dec 2003 15:35:46 -0000 1.3
***************
*** 68,69 ****
--- 68,83 ----
</Query>
</dbCommand>
+
+ <dbCommand ID="insert_request">
+ <Query>
+ INSERT INTO requests
+ SET
+ request_id = '{{request_id}}',
+ time = '{{time}}',
+ username = '{{username}}',
+ ip = '{{ip}}',
+ type = 'edit_proj_details',
+ data = '{{proj_id}}',
+ status = 'pending'
+ </Query>
+ </dbCommand>
|