Source for file module_display_functions.php

Documentation is available at module_display_functions.php

  1. <?php
  2.  
  3. function system_beta_1_process_post() {
  4. //handle any data passed via POST or GET methods
  5. session_start();
  6.  
  7. if( isset($_SESSION['new_object']['object']) && $_SESSION['new_object']['object'] == $_GET['object'] ) {
  8. //if the user is returning to an object they've just related a new object to
  9. //update session values
  10. if( isset( $_SESSION['new_object']['previousReferrers'] ) ) {
  11. $previous = unserialize( $_SESSION['new_object']['previousReferrers'] );
  12. unset( $_SESSION['new_object'] );
  13. $_SESSION['new_object']['referrer'] = array_pop( $previous );
  14. strtok( $_SESSION['new_object']['referrer'], "&" );
  15. while( $variable = strtok( "&" ) ) {
  16. if( strpos( $variable, "object=" ) ) {
  17. $_SESSION['new_object']['object'] = substr( strpos( $variable, '=')+1 );
  18. break;
  19. }
  20. }
  21. if( !count($previous) ) {
  22. unset( $_SESSION['new_object']['previousReferrers'] );
  23. }
  24. } else {
  25. unset( $_SESSION['new_object'] );
  26. }
  27. } else if((isset($_POST['related']) && strstr( $_POST['related'], "*new*" ) ) ) {
  28. //if a new object should be created for relating to an existing object redirect to the appropriate page for creating that object
  29. strtok( $_POST['related'], "?" );
  30. $constraints = unserialize( strtok( "?" ) );
  31. relate_new_object( $constraints );
  32. } else if( isset($_POST['embed_type']) ) {
  33. //if an embed is beind added
  34. //relate_new_object();
  35. }
  36.  
  37. if( $_POST || $_REQUEST['action'] ) {
  38. //if data has been posted from a form
  39.  
  40. if( $_REQUEST['action'] == 'logout' ) {
  41. //if the user is logging out
  42. people_log_out();
  43. } else if( $_REQUEST['action'] == "delete" ) {
  44. //if the object should be deleted
  45. if( $object =& get_object( $_GET['object'] ) ) {
  46. $object->delete();
  47. }
  48. } else if( $_REQUEST['action'] == 'delete_relationship' ) {
  49. //if a relationship should be deleted
  50. if( $object =& get_relationship( $_POST['relationship'], $_POST['relationship_type'] ) ) {
  51. $object->delete();
  52. }
  53. } else {
  54. if( $_POST['action'] == 'new_relationship' ) {
  55. //if the data is for making a new relationship
  56. if( $_POST['target'] == 'secondary' ) {
  57. $primary = $_POST['object'];
  58. $secondary = $_POST['related'];
  59. } else {
  60. $secondary = $_POST['object'];
  61. $primary = $_POST['related'];
  62. }
  63. $relationship =& new relationship( NULL, $_POST['relationship_type'], $primary, $secondary );
  64. } else if( $object =& get_object( $_GET['object'], $_GET['object_type'] ) ) {
  65. //if an object is being modified
  66. $object->verify_set( $_POST );
  67. //NOTE: this is where we're having problems i think
  68. if( $_SESSION['new_object'] && !count($GLOBALS['errorArray']) ) {
  69. //if the object being edited is to be related to another object and the object was set OK
  70. //determine the primary and secondary objects
  71. if( $_SESSION['new_object']['target'] == 'secondary' ) {
  72. $primary = $_SESSION['new_object']['object'];
  73. $secondary = $object->id;
  74. } else {
  75. $secondary = $_SESSION['new_object']['object'];
  76. $primary = $object->id;
  77. }
  78.  
  79. //create the new relationship
  80. $relationship =& new relationship( NULL, $_SESSION['new_object']['typeID'], $primary, $secondary );
  81. }
  82. }
  83. //if a new object is being set with data, redirect to the object's page
  84. if( $_GET['object'] == '*new*' && $object->id != '*new*' ) {
  85. $redirectString = "Location: ".echo_url(true);
  86. $redirectString = str_replace( '*new*', $object->id, $redirectString );
  87. header( $redirectString );
  88. }
  89. }
  90. }
  91. }
  92.  
  93. function system_beta_1_get_module_tab_html() {
  94. //system implementatioin of get_module_tabs
  95. return '<a href="system_management.php?module=system" onmouseout="this.style.color=\'#999999\'"onmouseover="this.style.color=\'#000000\'">system</a>';
  96. }
  97.  
  98. ?>

Documentation generated on Tue, 24 May 2005 03:58:41 -0400 by phpDocumentor 1.3.0RC3