| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <!-- headlinks removed -->
- <link rel="shortcut icon" href="../../../../misc/favicon.ico"/>
- <title>SloodleLSLHandler - SLIS Second Life Wiki</title>
- <style type="text/css">/*<![CDATA[*/ @import "../../../../skins/offline/main.css"; /*]]>*/</style>
- <link rel="stylesheet" type="text/css" media="print" href="../../../../skins/common/commonPrint.css" />
- <!--[if lt IE 5.5000]><style type="text/css">@import "../../../../skins/monobook/IE50Fixes.css";</style><![endif]-->
- <!--[if IE 5.5000]><style type="text/css">@import "../../../../skins/monobook/IE55Fixes.css";</style><![endif]-->
- <!--[if IE 6]><style type="text/css">@import "../../../../skins/monobook/IE60Fixes.css";</style><![endif]-->
- <!--[if IE]><script type="text/javascript" src="../../../../skins/common/IEFixes.js"></script>
- <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
- <script type="text/javascript" src="../../../../skins/common/wikibits.js"></script>
- <script type="text/javascript" src="../../../../skins/offline/md5.js"></script>
- <script type="text/javascript" src="../../../../skins/offline/utf8.js"></script>
- <script type="text/javascript" src="../../../../skins/offline/lookup.js"></script>
- </head>
- <body
- class="ns-0 ns-subject page-SloodleLSLHandler">
- <div id="globalWrapper">
- <div id="column-content">
- <div id="content">
- <a name="top" id="contentTop"></a>
- <h1 class="firstHeading">SloodleLSLHandler</h1>
- <div id="bodyContent">
- <h3 id="siteSub">From SLIS Second Life Wiki</h3>
- <div id="contentSub"></div>
- <!-- start content -->
- <div id="mw-content-text" lang="en" dir="ltr" class="mw-content-ltr"><table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
- <ul>
- <li class="toclevel-1 tocsection-1"><a href="#Declaration"><span class="tocnumber">1</span> <span class="toctext">Declaration</span></a></li>
- <li class="toclevel-1 tocsection-2"><a href="#Summary"><span class="tocnumber">2</span> <span class="toctext">Summary</span></a></li>
- <li class="toclevel-1 tocsection-3"><a href="#Compatibility"><span class="tocnumber">3</span> <span class="toctext">Compatibility</span></a></li>
- <li class="toclevel-1 tocsection-4"><a href="#Data"><span class="tocnumber">4</span> <span class="toctext">Data</span></a>
- <ul>
- <li class="toclevel-2 tocsection-5"><a href="#var_.24user"><span class="tocnumber">4.1</span> <span class="toctext">var $user</span></a></li>
- <li class="toclevel-2 tocsection-6"><a href="#var_.24response"><span class="tocnumber">4.2</span> <span class="toctext">var $response</span></a></li>
- <li class="toclevel-2 tocsection-7"><a href="#var_.24request"><span class="tocnumber">4.3</span> <span class="toctext">var $request</span></a></li>
- </ul>
- </li>
- <li class="toclevel-1 tocsection-8"><a href="#Functions"><span class="tocnumber">5</span> <span class="toctext">Functions</span></a>
- <ul>
- <li class="toclevel-2 tocsection-9"><a href="#SloodleLSLHandler.28.29"><span class="tocnumber">5.1</span> <span class="toctext">SloodleLSLHandler()</span></a></li>
- <li class="toclevel-2 tocsection-10"><a href="#login_by_request.28.24require_.3D_TRUE.2C_.24suppress_autoreg_.3D_FALSE.29"><span class="tocnumber">5.2</span> <span class="toctext">login_by_request($require = TRUE, $suppress_autoreg = FALSE)</span></a></li>
- <li class="toclevel-2 tocsection-11"><a href="#confirm_by_login_security_token.28.24use_cache_.3D_FALSE.29"><span class="tocnumber">5.3</span> <span class="toctext">confirm_by_login_security_token($use_cache = FALSE)</span></a></li>
- <li class="toclevel-2 tocsection-12"><a href="#is_user_enrolled_by_request.28.24require_.3D_TRUE.2C_.24use_cache_.3D_FALSE.29"><span class="tocnumber">5.4</span> <span class="toctext">is_user_enrolled_by_request($require = TRUE, $use_cache = FALSE)</span></a></li>
- </ul>
- </li>
- </ul>
- </td></tr></table>
- <h2> <span class="mw-headline" id="Declaration"> Declaration </span></h2>
- <p><font size="5"><code>class SloodleLSLHandler</code></font><br />
- Defined in: <a href="../../../../articles/f/i/l/File:File.gif.html" class="image"><img alt="File.gif" src="../../../../images/a/2F/a/a/af/File.gif" width="16" height="16" /></a> <a href="../../../../articles/l/i/b/Fileref:lib/sl_lsllib.php.html" title="Fileref:lib/sl lsllib.php">lib/sl_lsllib.php</a> <br />
- </p><p><br />
- </p>
- <h2> <span class="mw-headline" id="Summary"> Summary </span></h2>
- <p>This PHP class is the central part of the <a href="../../../../articles/s/l/o/Sloodle_PHP_API.html" title="Sloodle PHP API">Sloodle PHP API</a>, as it automatically brings together all of the other main classes in the API upon construction. This prevents the need for programmers to continually 'reinvent the wheel' while developing Sloodle scripts. It is typically used by <a href="../../../../articles/l/i/n/Linker_Script.html" title="Linker Script">Linker Scripts</a> to:
- </p>
- <ol><li> Handle and process the incoming request
- </li><li> Find and manage the avatar and Moodle user data
- </li><li> Construct and render appropriately formatted responses
- </li></ol>
- <p>The main class in each of these steps are <a href="../../../../articles/s/l/o/SloodleLSLRequest.html" title="SloodleLSLRequest">SloodleLSLRequest</a>, <a href="../../../../articles/s/l/o/SloodleUser.html" title="SloodleUser">SloodleUser</a>, and <a href="http:http://localhost/sl/index.php?title=SloodleResponse&action=edit&redlink=1" class="new" title="SloodleResponse (page does not exist)">SloodleResponse</a> respectively. It is important to remember that <i>most</i> (but not all) of the underlying functionality takes places within these classes, but that the SloodleLSLHandler provides the means for those other classes to communicate. This can be seen in the following UML diagram, which shows that the <a href="../../../../articles/s/l/o/SloodleLSLRequest.html" title="SloodleLSLRequest">SloodleLSLRequest</a> object also takes on references to the <a href="../../../../articles/s/l/o/SloodleUser.html" title="SloodleUser">SloodleUser</a> and <a href="http:http://localhost/sl/index.php?title=SloodleResponse&action=edit&redlink=1" class="new" title="SloodleResponse (page does not exist)">SloodleResponse</a> objects (if these references are not provided, then the <a href="../../../../articles/s/l/o/SloodleLSLRequest.html" title="SloodleLSLRequest">SloodleLSLRequest</a> class creates its own). Additionally, there are certain functions in the SloodleLSLHandler class which use the underlying objects together.
- </p>
- <div class="center"><div class="floatnone"><a href="../../../../articles/s/l/o/File:Sloodle_api_uml_highlight_handler.jpg.html" class="image"><img alt="Sloodle api uml highlight handler.jpg" src="../../../../images/5/2F/5/5/5f/Sloodle_api_uml_highlight_handler.jpg" width="798" height="276" /></a></div></div>
- <p><br />
- </p>
- <h2> <span class="mw-headline" id="Compatibility"> Compatibility </span></h2>
- <p>This class conforms to PHP4 syntax, and so scope visibility qualifiers (public, private, protected) are not available. However, unlike in the other API classes, all member data should be considered <b>public</b>.
- </p><p><br />
- </p>
- <h2> <span class="mw-headline" id="Data"> Data </span></h2>
- <p>This class contains the following member values (all of which should be considered <b>public</b>):
- </p>
- <h5> <span class="mw-headline" id="var_.24user">var $user</span></h5>
- <p>Assigned NULL by default. At construction time it is set to a new instance of the <a href="../../../../articles/s/l/o/SloodleUser.html" title="SloodleUser">SloodleUser</a> class.
- </p>
- <h5> <span class="mw-headline" id="var_.24response">var $response</span></h5>
- <p>Assigned NULL by default. At construction time it is set to a new instance of the <a href="../../../../articles/s/l/o/SloodleLSLResponse.html" title="SloodleLSLResponse">SloodleLSLResponse</a> class.
- </p>
- <h5> <span class="mw-headline" id="var_.24request">var $request</span></h5>
- <p>Assigned NULL by default. At construction time it is set to a new instance of the <a href="../../../../articles/s/l/o/SloodleLSLRequest.html" title="SloodleLSLRequest">SloodleLSLRequest</a> class. The <i>$user</i> and <i>$response</i> members are constructed first, and passed into the constructor of this object.
- </p><p><br />
- </p>
- <h2> <span class="mw-headline" id="Functions"> Functions </span></h2>
- <h5> <span class="mw-headline" id="SloodleLSLHandler.28.29">SloodleLSLHandler()</span></h5>
- <p>Constructor -- constructs objects for each of the members: <i>$user</i>, <i>$response</i>, and <i>$request</i>.
- </p><p><br />
- </p>
- <h5> <span class="mw-headline" id="login_by_request.28.24require_.3D_TRUE.2C_.24suppress_autoreg_.3D_FALSE.29">login_by_request($require = TRUE, $suppress_autoreg = FALSE)</span></h5>
- <p>Checks to see if sufficient data was passed into the <i>$request</i> member such that an avatar can be recognised. If so, it checks to see if that avatar has been <a href="../../../../articles/r/e/g/Registration_and_Enrolment.html" title="Registration and Enrolment">registered</a> to a specific Moodle account. If so, then that user's details are fetched from the database, and the user is 'logged-in' for purposes of this single request. (i.e. their data is set into Moodle's global $USER variable).
- </p><p>If parameter <i>$require</i> is boolean TRUE (default), then the script will terminate if login fails, e.g. not enough data was provided, or there was no linked Moodle account. The <i>$response</i> member is used to output an error message prior to terminate.
- </p><p>If parameter <i>$suppress_autoreg</i> is TRUE, then the script will <i>not</i> auto-register the user under any circumstances, even if auto-registration is enabled in the <a href="../../../../articles/s/l/o/Sloodle_Module_Configuration.html" title="Sloodle Module Configuration" class="mw-redirect">Sloodle Module Configuration</a> page (see <a href="../../../../articles/u/s/e/User_Authentication_Method.html" title="User Authentication Method">User Authentication Method</a> for more information).
- </p><p>If login was successful, then the function returns TRUE. If <i>$require</i> is FALSE, then the function will return FALSE if login fails.
- </p><p><br />
- </p>
- <h5> <span class="mw-headline" id="confirm_by_login_security_token.28.24use_cache_.3D_FALSE.29">confirm_by_login_security_token($use_cache = FALSE)</span></h5>
- <p>This function is used to check the <i>$request</i> data to compare avatar and <a href="../../../../articles/l/o/g/Login_Security_Token.html" title="Login Security Token">Login Security Token</a> details against the database. This acts like an internal 'username and password' combination, to ensure that the login request is genuine. It is used in the <a href="../../../../articles/r/e/g/Registration_and_Enrolment.html" title="Registration and Enrolment">registration</a> process when using <a href="../../../../articles/u/s/e/User_Authentication_Method.html" title="User Authentication Method">web registration</a>.
- </p><p>If the details all match correctly, then the function returns TRUE. If there is a mismatch, or if any of the data is unrecognised or missing, then the function returns FALSE.
- </p><p>The <i>$use_cache</i> parameter can be used to prevent an additional database query if you <b>know</b> that the Sloodle user data cache in the <i>$user</i> member is fully up-to-date. In such cases, set this parameter to TRUE. However, most of the time, you can probably ignore this parameter and let it refresh the user cache for you. It will default to FALSE if unspecified.
- </p><p><br />
- </p>
- <h5> <span class="mw-headline" id="is_user_enrolled_by_request.28.24require_.3D_TRUE.2C_.24use_cache_.3D_FALSE.29">is_user_enrolled_by_request($require = TRUE, $use_cache = FALSE)</span></h5>
- <p>This function will check whether or not the avatar identified in the <i>$request</i> data is <a href="../../../../articles/r/e/g/Registration_and_Enrolment.html" title="Registration and Enrolment">registered</a> to a particular Moodle account. If so, it checks if that Moodle user in enrolled in the course identified in the <i>$request</i> data.
- </p><p>If the user is confirmed as enrolled, then the function returns TRUE. Under all other circumstances, the function will either return FALSE, or terminate the script with an error message. (The latter behaviour is the default, but can be changed by setting the <i>$require</i> parameter to FALSE).
- </p><p>The <i>$use_cache</i> parameter can be used to prevent an additional database query if you <b>know</b> that the Sloodle user data cache in the <i>$user</i> member is fully up-to-date. In such cases, set this parameter to TRUE. However, most of the time, you can probably ignore this parameter and let it refresh the user cache for you. It will default to FALSE if unspecified.
- </p><p><br />
- </p>
- <table style="background-color:white; border:1px solid #0099cc; text-align:center; width:100%;">
- <tr>
- <th style="background-color:#99d9ea;" colspan="4"> This page is part of the SLOODLE documentation
- </th></tr>
- <tr>
- <td style="border-bottom:solid 1px #dddddd;"> Docs: <a href="../../../../articles/s/l/o/SloodleUserDocs.html" title="SloodleUserDocs" class="mw-redirect">Users</a> | <a href="../../../../articles/s/l/o/SloodleAdminDocs.html" title="SloodleAdminDocs" class="mw-redirect">Administrators</a> | <a href="../../../../articles/s/l/o/SloodleDevDocs.html" title="SloodleDevDocs" class="mw-redirect">Developers</a>
- </td></tr>
- <tr>
- <td style=""> <span style="float:left"><a href="../../../../articles/s/l/o/Sloodle.html" title="Sloodle" class="mw-redirect">Wiki Frontpage</a></span> <span style="float:right"><a rel="nofollow" class="external text" href="http://www.sloodle.org">Sloodle.org</a></span>
- </td></tr></table>
- <!--
- NewPP limit report
- Preprocessor node count: 57/1000000
- Post‐expand include size: 559/2097152 bytes
- Template argument size: 49/2097152 bytes
- Expensive parser function count: 0/100
- -->
- </div><div class="printfooter">
- </div>
- <div id="catlinks"><div id='catlinks' class='catlinks'><div id="mw-normal-catlinks" class="mw-normal-catlinks"><a href="http://localhost/sl/index.php/Special:Categories" title="Special:Categories">Category</a>: <ul><li><a href="../../../../articles/s/l/o/Category:Sloodle_PHP_API.html" title="Category:Sloodle PHP API">Sloodle PHP API</a></li></ul></div></div></div> <!-- end content -->
- <div class="visualClear"></div>
- </div>
- </div>
- </div>
- <div id="column-one">
- <div id="p-cactions" class="portlet">
- <h5>Views</h5>
- <ul>
- <li id="ca-nstab-main"
- class="selected" ><a href="../../../../articles/s/l/o/SloodleLSLHandler.html">Page</a></li><li id="ca-talk"
- class="new" ><a href="http:http://localhost/sl/index.php?title=Talk:SloodleLSLHandler&action=edit&redlink=1">Discussion</a></li><li id="ca-current"
- ><a href="http://localhost/sl/index.php/SloodleLSLHandler">Latest revision</a></li> </ul>
- </div>
- <div class="portlet" id="p-logo">
- <a style="background-image: url(../../../../misc/wiki.png);"
- href="../../../../index.html"
- title="Main Page"></a>
- </div>
- <script type="text/javascript"> if (window.isMSIE55) fixalpha(); </script>
- <div class='portlet' id='p-navigation'>
- <h5>Navigation</h5>
- <div class='pBody'>
- <ul>
- <li id="n-mainpage-description"><a href="../../../../index.html">Main page</a></li>
- <li id="n-SLOODLE"><a href="../../../../articles/s/l/o/Sloodle.html">SLOODLE</a></li>
- <li id="n-currentevents"><a href="../../../../articles/c/u/r/SLIS_Second_Life_Wiki:Current_events.html">Current events</a></li>
- <li id="n-help"><a href="../../../../articles/c/o/n/Help:Contents.html">Help</a></li>
- </ul>
- </div>
- </div>
- <div class='portlet' id='p-SEARCH'>
- <h5>Search</h5>
- <div class='pBody'>
- <ul>
- </ul>
- </div>
- </div>
- <div class='portlet' id='p-TOOLBOX'>
- <h5>Toolbox</h5>
- <div class='pBody'>
- <ul>
- </ul>
- </div>
- </div>
- <div class='portlet' id='p-LANGUAGES'>
- <h5>LANGUAGES</h5>
- <div class='pBody'>
- <ul>
- </ul>
- </div>
- </div>
- <div id="p-search" class="portlet">
- <h5><label for="searchInput">Search</label></h5>
- <div id="searchBody" class="pBody">
- <form action="javascript:goToStatic(3)" id="searchform"><div>
- <input id="searchInput" name="search" type="text"
- accesskey="f" value="" />
- <input type='submit' name="go" class="searchButton" id="searchGoButton"
- value="Go" />
- </div></form>
- </div>
- </div>
- </div><!-- end of the left (by default at least) column -->
- <div class="visualClear"></div>
- <div id="footer">
- <div id="f-poweredbyico"><a href="//www.mediawiki.org/"><img src="../../../../skins/common/images/poweredby_mediawiki_88x31.png" height="31" width="88" alt="Powered by MediaWiki" /></a></div> <ul id="f-list">
- <li id="f-credits">This page was last modified 09:40, 5 February 2008 by SLIS Second Life Wiki user <a href="http:http://localhost/sl/index.php?title=User:Peter_Bloomfield&action=edit&redlink=1" class="new" title="User:Peter Bloomfield (page does not exist)">Peter Bloomfield</a>. </li> <li id="f-about"><a href="../../../../articles/a/b/o/SLIS_Second_Life_Wiki:About.html" title="SLIS Second Life Wiki:About">About SLIS Second Life Wiki</a></li> <li id="f-disclaimer"><a href="../../../../articles/g/e/n/SLIS_Second_Life_Wiki:General_disclaimer.html" title="SLIS Second Life Wiki:General disclaimer">Disclaimers</a></li> </ul>
- </div>
- </div>
- </body>
- </html>
|