:App-Ebuild_page method. Since it is a reference, it can be modified by the callback. The C<$param> parameter is a hash reference to the parameter data that was given to build the page. The C<$tmpl> parameter is the L object used to generate the page. =back =head1 METHODS Following are the list of methods specific to L: =head2 MT::App->new Constructs and returns a new L object. =head2 $app->init_request Invoked at the start of each request. This method is a good place to initialize any settings that are request-specific. When overriding this method, B call the superclass C method. One such setting is the C member element that controls whether the active application mode requires the user to login first. Example: sub init_request { my $app = shift; $app->SUPER::init_request(@_); $app->{requires_login} = 1 unless $app->mode eq 'unprotected'; } =head2 $app->run Runs the application. This gathers the input, chooses the method to execute, executes it, and prints the output to the client. If an error occurs during the execution of the application, L handles all of the errors thrown either through the L or through C. =head2 $app->login Checks the user's credentials, first by looking for a login cookie, then by looking for the C and C CGI parameters. In both cases, the username and password are verified for validity. This method does not set the user's login cookie, however--that should be done by the caller (in most cases, the caller is the L method). On success, returns the L object representing the author who logged in, and a boolean flag; if the boolean flag is true, it indicates the the login credentials were obtained from the CGI parameters, and thus that a cookie should be set by the caller. If the flag is false, the credentials came from an existing cookie. On an authentication error, L removes any authentication cookies that the user might have on his or her browser, then returns C, and the error message can be obtained from C<$app-Eerrstr>. =head2 $app->logout A handler method for logging the user out of the application. =head2 $app->send_http_header([ $content_type ]) Sends the HTTP header to the client; if C<$content_type> is specified, the I header is set to C<$content_type>. Otherwise, C is used as the default. In a L context, this calls the L method; in a CGI context, the L method is called. =head2 $app->print(@data) Sends data C<@data> to the client. In a L context, this calls the L method; in a CGI context, data is printed directly to STDOUT. =head2 $app->bake_cookie(%arg) Bakes a cookie to be sent to the client. C<%arg> can contain any valid parameters to the C methods of L (or L--both take the same parameters). These include C<-name>, C<-value>, C<-path>, C<-secure>, and C<-expires>. If you do not include the C<-path> parameter in C<%arg>, it will be set automatically to C<$app-Epath> (below). In a L context, this method uses L; in a CGI context, it uses L. This method will automatically assign a "secure" flag for the cookie if it the current HTTP request is using the https protocol. To forcibly disable the secure flag, provide a C<-secure> argument with a value of 0. =head2 $app->cookies Returns a reference to a hash containing cookie objects, where the objects are either of class L (in a L context) or L (in a CGI context). =head2 $app->user_cookie Returns the string of the cookie name used for the user login cookie. =head2 $app->user Returns the object of the logged in user. Typically a L object. =head2 $app->clear_login_cookie Sends a cookie back to the user's browser which clears their existing authenication cookie. =head2 $app->current_magic Returns the active user's "magic token" which is used to validate posted data with the C method. =head2 $app->make_magic_token Creates a new "magic token" string which is a random set of characters. The =head2 $app->load_tmpl($file[, @params]) Loads a L template using the filename specified. See the documentation for the C method to learn about how templates are located. The optional C<@params> are passed to the L constructor. =head2 $app->charset Gets or sets the application's character set based on the "PublishCharset" configuration setting or the encoding of the active language (C<$app-Ecurrent_language>). =head2 $app->add_return_arg(%param) Adds one or more arguments to the list of 'return' arguments that are use to construct a return URL. Example: $app->add_return_arg(finished_task => 1) $app->call_return; This will redirect the user back to the URL they came from, adding a new 'finished_task' query parameter to the URL. =head2 $app->call_return Invokes C<$app-Eredirect> using the C<$app-Ereturn_uri> method as the address. =head2 $app->make_return_args Constructs the list of return arguments using the data available from C<$app-Estate_params> and C<$app->Emode>. =head2 $app->mode([$mode]) Gets or sets the active application run mode. =head2 $app->state_params Returns a list of the parameter names that preserve the given state of the application. These are declared during the application's C method, using the C member element. Example: $app->{state_params} = ['filter','page','blog_id']; =head2 $app->return_args([$args]) Gets or sets a string containing query parameters which is used by C in constructing a 'return' address for the current request. =head2 $app->return_uri Returns a string composed of the C<$app-Euri> and the C<$app-Ereturn_args>. =head2 $app->uri_params(%param) A utility method that assembles the query portion of a URI, taking a mode and set of parameters. The string returned does include the '?' character if query parameters exist. Example: my $query_str = $app->uri_params(mode => 'go', args => { 'this' => 'that' }); # $query_str == '?__mode=go&this=that' =head2 $app->session([$element[,$value]]) Returns the active user's session object. This also acts as a get/set method for assigning arbitrary data into the user's session record. At the end of the active request, any unsaved session data is written to the L record. Example: # saves the value of a 'color' parameter into the user's session # this value will persist from one request to the next, but will # be cleared when the user logs out or has to reauthenicate. $app->session('color', $app->param('color')) =head2 $app->start_session Initializes a new user session by both calling C and setting the user's login cookie. =head2 $app->make_session Creates a new user session MT::Session record for the active user. =head2 $app->show_error($error) Handles the display of an application error. =head2 $app->static_path Returns the application's static web path. =head2 $app->takedown Called at the end of the web request for cleanup purposes. =head2 $app->add_breadcrumb($name, $uri) Adds to the navigation history path that is displayed to the end user when using the application. The last breadcrumb should always be a reference to the active mode of the application. Example: $app->add_breadcrumb('Edit Foo', $app->uri_params(mode => 'edit', args => { '_type' => 'foo' })); =head2 $app->add_methods(%arg) Used to supply the application class with a list of available run modes and the code references for each of them. C<%arg> should be a hash list of methods and the code reference for it. Example: $app->add_methods( 'one' => \&one, 'two' => \&two, 'three' => \&three, ); =head2 $app->add_plugin_action($where, $action_link, $link_text) Adds a link to the given plugin action from the location specified by $where. This allows plugins to create actions that apply to, for example, the entry which the user is editing. The type of object the user was editing, and its ID, are passed as parameters. Values that are used from the $where parameter are as follows: =over 4 =item * list_entries =item * list_commenters =item * list_comments =item * (Where is any object that the user can already edit, such as 'entry,' 'comment,' 'commenter,' 'blog,' etc.) =back The C<$where> value will be passed to the given action_link as a CGI parameter called C. For example, on the list_entries page, a link will appear to: &from=list_entries If the $where is a single-item page, such as an entry-editing page, then the action_link will also receive a CGI parameter C whose value is the ID of the object under consideration: &from=entry&id= Note that the link is always formed by appending an ampersand. Thus, if your $action_link is simply the name of a CGI script, such as my-plugin.cgi, you'll want to append a '?' to the argument you pass: MT->add_plugin_action('entry', 'my-plugin.cgi?', \ 'Touch this entry with MyPlugin') Finally, the $link_text parameter specifies the text of the link; this value will be wrapped in Ea> tags that point to the $action_link. =head2 $app->app_path Returns the path portion of the active URI. =head2 $app->app_uri Returns the current application's URI. =head2 $app->mt_path Returns the path portion of the URI that is used for accessing the MT CGI scripts. =head2 $app->mt_uri Returns the full URI of the MT "admin" script (typically a reference to mt.cgi). =head2 $app->blog Returns the active weblog, if available. The I query parameter identifies this weblog. =head2 $app->build_page($tmpl_name, \%param) Builds an application page to be sent to the client; the page name is specified in C<$tmpl_name>, which should be the name of a template containing valid L markup. C<\%param> is a hash ref whose keys and values will be passed to L for use in the template. On success, returns a scalar containing the page to be sent to the client. On failure, returns C, and the error message can be obtained from C<$app-Eerrstr>. =head2 How does build_page find a template? The C function looks in several places for an app template. Two configuration directives can modify these search paths, and application and plugin code can also affect them. The I config directive is an absolute path to the directory where MT's core application templates live. It defaults to the I plus an additional path segment of 'tmpl'. The optional I config directive is a path (absolute or relative) to a directory where some 'override templates' may live. An override template takes the place of one of MT's core application templates, and is used interchangeably with the core template. This allows power users to customize the look and feel of the MT application. If I is relative, its base path is the value of the Movable Type configuration file. Next, any application built on the C foundation can define its own I parameter, which identifies a subdirectory of TemplatePath (or AltTemplatePath) where that application's templates can be found. I defaults to C. Most templates will be found in this directory, but sometimes the template search will fall through to the parent directory, where a default error template is found, for example. I should rightly have been named I, since it is application-specific. Finally, a plugin can specify its I, which locates a directory where the templates for that plugin's own interface are found. If the I is relative, it may be relative to either the I, or the I; the former takes precedence if it exists. (for a definition of I and I, see L) Given these values, the order of search is as follows: =over 4 =item * I =item * I =item * IFI =item * I/I =item * I =back If a template with the given name is not found in any of these locations, an ugly error is thrown to the user. =head2 $app->cookie_val($name) Returns the value of a given cookie. =head2 $app->delete_param($param) Clears the value of a given CGI parameter. =head2 $app->errtrans($msg[, @param]) Translates the C<$msg> text, passing through C<@param> for any parameters within the message. This also sets the error state of the application, assinging the translated text as the error message. =head2 $app->get_header($header) Returns the value of the specified HTTP header. =head2 MT::App->handler The mod_perl handler used when the application is run as a native mod_perl handler. =head2 $app->init(@param) Initializes the application object, setting default values and establishing the parameters necessary to run. The @param values are passed through to the parent class, the C package. This method needs to be invoked by any subclass when the object is initialized. =head2 $app->is_authorized Returns a true value if the active user is authorized to access the application. By default, this always returns true; subclasses may override it to check app-specific authorization. A login attempt will be rejected with a generic error message at the MT::App level, if is_authorized returns false, but MT::App subclasses may wish to perform additional checks which produce more specific error messages. Subclass authors can assume that $app->{author} is populated with the authenticated user when this routine is invoked, and that CGI query object is available through $app->{query} and $app->param(). =head2 $app->is_secure Returns a boolean result based on whether the application request is happening over a secure (HTTPS) connection. =head2 $app->l10n_filter Alias for Ctranslate_templatized>. =head2 $app->param($name[, $value]) Interface for getting and setting CGI query parameters. Example: my $title = $app->param('entry_title'); Versions of MT before 3.16 did not support the MT::App::param() method. In that environment, $app->{query} is a CGI object whose C method works identically with this one. =head2 $app->param_hash Returns a hash reference containing all of the query parameter names and their values. Example: my $data = $app->param_hash; my $title = $data->{entry_title}; =head2 $app->post_run This method is invoked, with no parameters, immediately following the execution of the requested C<__mode> handler. Its return value is ignored. C will be invoked whether or not the C<__mode> handler returns an error state through the MT::ErrorHandler mechanism, but it will not be invoked if the handler Cs. App subclasses can override this method with tasks to be executed after any C<__mode> handler but before the page is delivered to the client. Such a method should invoke C to ensure that MT's core post-run tasks are executed. =head2 $app->pre_run This method is invoked, with no parameters, before dispatching to the requested C<__mode> handler. Its return value is ignored. C is not invoked if the request could not be authenticated. If C is invoked and does not C, the C<__mode> handler B be invoked. App subclasses can override this method with tasks to be executed before, and regardless of, the C<__mode> specified in the request. Such an overriding method should invoke C to ensure that MT's core pre-run tasks are executed. =head2 $app->query_string Returns the CGI query string of the active request. =head2 $app->request_content Returns a scalar containing the POSTed data of the active HTTP request. This will force the request body to be read, even if $app->{no_read_body} is true. TBD: document no_read_body. =head2 $app->request_method Returns the method of the active HTTP request, typically either "GET" or "POST". =head2 $app->response_content_type([$type]) Gets or sets the HTTP response Content-Type header. =head2 $app->response_code([$code]) Gets or sets the HTTP response code: the numerical value that begins the "status line." Defaults to 200. =head2 $app->response_message([$message]) Gets or sets the HTTP response message, better known as the "reason phrase" of the "status line." E.g., if these calls were executed: $app->response_code("404"); $app->response_message("Thingy Not Found"); This status line might be returned to the client: 404 Thingy Not Found By default, the reason phrase is an empty string, but an appropriate reason phrase may be assigned by the webserver based on the response code. =head2 $app->set_header($name, $value) Adds an HTTP header to the response with the given name and value. =head2 $app->validate_magic Checks for a I HTTP parameter and validates it for the current author. If it is invalid, an error message is assigned to the application and a false result is returned. If it is valid, it returns 1. Example: return unless $app->validate_magic; To populate a form with a valid magic token, place the token value in a hidden form field: If you're protecting a hyperlink, add the token to the query parameters for that link. =head2 $app->redirect($url, [option1 => option1_val, ...]) Redirects the client to the URL C<$url>. If C<$url> is not an absolute URL, it is prepended with the value of C<$app-Ebase>. By default, the redirection is accomplished by means of a Location header and a 302 Redirect response. If the option C 1> is given, the request will be redirected by issuing a text/html entity body that contains a "meta redirect" tag. This option can be used to work around clients that won't accept cookies as part of a 302 Redirect response. =head2 $app->base The protocol and domain of the application. For example, with the full URI F, this method will return F. =head2 $app->path The path component of the URL of the application directory. For example, with the full URL F, this method will return F. =head2 $app->script In CGI mode, the filename of the active CGI script. For example, with the full URL F, this method will return F. In mod_perl mode, the Request-URI without any query string. =head2 $app->uri([%params]) The concatenation of C<$app-Epath> and C<$app-Escript>. For example, with the full URI F, this method will return F. If C<%params> exist, they are passed to the C<$app-Euri_params> method for processing. Example: return $app->redirect($app->uri(mode => 'go', args => {'this'=>'that'})); =head2 $app->path_info The path_info for the request (that is, whatever is left in the URI after removing the path to the script itself). =head2 $app->log($msg) Adds the message C<$msg> to the activity log. The log entry will be tagged with the IP address of the client running the application (that is, of the browser that made the HTTP request), using C<$app-Eremote_ip>. =head2 $app->trace(@msg) Adds a trace message by concatenating all the members of C<@msg> to the internal tracing mechanism; trace messages are then displayed at the top of the output page sent to the client. These messages are displayed when the I configuration parameter is enabled. This is useful for debugging. =head2 $app->remote_ip The IP address of the client. In a L context, this calls L; in a CGI context, this uses C<$ENV{REMOTE_ADDR}>. =head1 STANDARD APPLICATION TEMPLATE PARAMETERS When loading an application template, a number of parameters are preset for you. The following are some parameters that are assigned by C itself: =over 4 =item * AUTHOR_ID =item * AUTHOR_NAME The MT::Author ID and username of the currently logged-in user. =item * MT_VERSION The value returned by MT->version_id. Typically just the release version number, but for special releases such as betas, this may also include an identifying suffix (ie "3.2b"). =item * MT_PRODUCT_CODE A product code defined by Six Apart to identify the edition of Movable Type. Currently, the valid values include: MT - Movable Type Personal or Movable Type Commercial editions MTE - Movable Type Enterprise =item * MT_PRODUCT_NAME The name of the product in use. =item * LANGUAGE_TAG The active language identifier of the currently logged-in user (or default language for the MT installation if there is no logged in user). =item * LANGUAGE_xx A parameter dynamically named for testing for particular languages. Sample usage: Parlez-vous Francias? Note that this is not a recommended way to localize your application. This is intended for including or excluding portions of a template based on the active language. =item * LANGUAGE_ENCODING Provides the character encoding that is configured for the application. This maps to the "PublishCharset" MT configuration setting. =item * STATIC_URI This provides the mt-config.cgi setting for "StaticWebPath" or "AdminCGIPath", depending on whether the active CGI is an admin CGI script or not (most likely it is, if it's meant to be used by an administrator (mt.cgi) and not an end user such as mt-comments.cgi). Sample usage: images/logo.gif With a StaticWebPath of '/mt/', this produces: /mt/mt-static/images/logo.gif or, if StaticWebPath is 'http://example.com/mt-static/': http://example.com/mt-static/images/logo.gif =item * SCRIPT_URL Returns the relative URL to the active CGI script. Sample usage: ?__mode=blah which may output: /mt/plugins/myplugin/myplugin.cgi?__mode=blah =item * MT_URI Yields the relative URL to the primary Movable Type application script (mt.cgi or the configured 'AdminScript'). Sample usage: ?__mode=view&_type=entry&id=1&blog_id=1 producing: /mt/mt.cgi?__mode=view&_type=entry&id=1&blog_id=1 =item * SCRIPT_PATH The path portion of URL for script Sample usage: mt-check.cgi producing: /mt/mt-check.cgi =item * SCRIPT_FULL_URL The complete URL to the active script. This is useful when needing to output the full script URL, including the protocol and domain. Sample usage: ?__mode=blah Which produces something like this: http://example.com/mt/plugins/myplugin/myplugin.cgi =back =head1 AUTHOR & COPYRIGHTS Please see the L manpage for author, copyright, and license information. =cut S_eVgr-4K|]Jt.sKk 'EwOխ#?{?Naqcy'#-Z<}z}R_և:w򋱻w'v%N5Gpҥ73WiM" V$9Q{yCZ؇۞#4_i1.u4Zo:A~cΟ-G>kz{{3~tĻOj_koJrde1[{[QNZԊ*zu > .nYrx @$q>T|uWwmUgkn*ϐ=/c+S0KGRI((7I"TW㡪cqjdͥHQF4w);lm.·"`*=sN#5E:[/{gGln0bsUu['&+SWSuUGkLh!Z'Ǥ)Ko#>F( L pEUs$0;jy(N@Q4?~%wI|}Ӛ}gm,[)Ȕ;gv`KYtǒz* RC[P)m/}(B8AR94:Ѯql54ht 9>l<~Ћjz{oHRsy5P욭L3nLl4::J<visitors><v p="66.249.65.209" b="NS6 - 5" l=""><p t="0025" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207312&amp;" f=""/><p t="0127" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199403&amp;" f=""/><p t="0218" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195701&amp;" f=""/><p t="0338" n="" u="id=0&amp;ACT=9&amp;" f=""/><p t="0339" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199711&amp;" f=""/><p t="0434" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207401&amp;" f=""/><p t="0438" n="" u="id=16&amp;mnu=16&amp;" f=""/><p t="0504" n="" u="" f=""/><p t="0510" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199402&amp;" f=""/><p t="0538" n="" u="id=11&amp;mnu=11&amp;" f=""/><p t="0612" n="" u="id=0&amp;ACT=20&amp;" f=""/><p t="0626" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195612&amp;" f=""/><p t="0646" n="" u="id=0&amp;ACT=91&amp;" f=""/><p t="0655" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199401&amp;" f=""/><p t="0710" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207402&amp;" f=""/><p t="0720" n="" u="" f=""/><p t="0727" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195611&amp;" f=""/><p t="0746" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=196010&amp;" f=""/><p t="0746" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207005&amp;" f=""/><p t="0746" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=200411&amp;" f=""/><p t="0754" n="" u="id=0&amp;ACT=14&amp;" f=""/><p t="0802" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199312&amp;" f=""/><p t="0828" n="" u="id=0&amp;ACT=18&amp;" f=""/><p t="0829" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207403&amp;" f=""/><p t="0844" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195610&amp;" f=""/><p t="0902" n="" u="id=10&amp;mnu=10&amp;" f=""/><p t="0926" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199311&amp;" f=""/><p t="0926" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207404&amp;" f=""/><p t="0936" n="" u="id=13&amp;mnu=13&amp;" f=""/><p t="0956" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195609&amp;" f=""/><p t="1010" n="" u="id=4&amp;mnu=4&amp;" f=""/><p t="1026" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199310&amp;" f=""/><p t="1026" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207405&amp;" f=""/><p t="1044" n="" u="ACT=81&amp;member=410&amp;id=0&amp;" f=""/><p t="1056" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195608&amp;" f=""/><p t="1152" n="" u="id=17&amp;mnu=17&amp;" f=""/><p t="1156" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207406&amp;" f=""/><p t="1156" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199309&amp;" f=""/><p t="1156" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195607&amp;" f=""/><p t="1226" n="" u="id=15&amp;mnu=15&amp;" f=""/><p t="1232" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199710&amp;" f=""/><p t="1251" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=195606&amp;" f=""/><p t="1251" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=207407&amp;" f=""/><p t="1259" n="" u="id=20&amp;mnu=20&amp;" f=""/><p t="1306" n="" u="id=0&amp;ACT=91&amp;calendar=1&amp;eventdate=199308&amp;" f=""/><p t="1331" n="" u="id=6&amp;content=13&amp;mnu=6&amp;ACT=5&amp;" f=""/><p t="1350" n="" u="id=0&amp;ACT=91&