<?php
$c=&$this->config;
$c['manager_theme'] = "MODxLight";
$c['settings_version'] = "0.9.6.1p2";
$c['server_offset_time'] = "0";
$c['server_protocol'] = "http";
$c['manager_language'] = "english";
$c['modx_charset'] = "UTF-8";
$c['site_name'] = "Mercure Pontianak";
$c['site_start'] = "1";
$c['error_page'] = "1";
$c['unauthorized_page'] = "1";
$c['site_status'] = "1";
$c['site_unavailable_message'] = "The site is currently unavailable";
$c['track_visitors'] = "0";
$c['resolve_hostnames'] = "0";
$c['top_howmany'] = "10";
$c['default_template'] = "4";
$c['old_template'] = "4";
$c['publish_default'] = "0";
$c['cache_default'] = "1";
$c['search_default'] = "1";
$c['friendly_urls'] = "1";
$c['friendly_url_prefix'] = "";
$c['friendly_url_suffix'] = ".html";
$c['friendly_alias_urls'] = "1";
$c['use_alias_path'] = "1";
$c['use_udperms'] = "1";
$c['udperms_allowroot'] = "0";
$c['failed_login_attempts'] = "3";
$c['blocked_minutes'] = "60";
$c['use_captcha'] = "0";
$c['captcha_words'] = "MODx,Access,Better,BitCode,Cache,Desc,Design,Excell,Enjoy,URLs,TechView,Gerald,Griff,Humphrey,Holiday,Intel,Integration,Joystick,Join(),Tattoo,Genetic,Light,Likeness,Marit,Maaike,Niche,Netherlands,Ordinance,Oscillo,Parser,Phusion,Query,Question,Regalia,Righteous,Snippet,Sentinel,Template,Thespian,Unity,Enterprise,Verily,Veri,Website,WideWeb,Yap,Yellow,Zebra,Zygote";
$c['emailsender'] = "sitorush@gmail.com";
$c['emailsubject'] = "Your login details";
$c['signupemail_message'] = "Hello [+uid+] \r\n\r\nHere are your login details for [+sname+] Content Manager:\r\n\r\nUsername: [+uid+]\r\nPassword: [+pwd+]\r\n\r\n\r\n\r\nOnce you log into the Content Manager at [+surl+], you can change your password.\r\n\r\nRegards,\r\nSite Administrator";
$c['websignupemail_message'] = "Hello [+uid+] \r\n\r\nHere are your login details for [+sname+]:\r\n\r\nUsername: [+uid+]\r\nPassword: [+pwd+]\r\n\r\nOnce you log into [+sname+] at [+surl+], you can change your password.\r\n\r\nRegards,\r\nSite Administrator";
$c['webpwdreminder_message'] = "Hello [+uid+]\r\n\r\nTo active you new password click the following link:\r\n\r\n[+surl+]\r\n\r\nIf successful you can use the following password to login:\r\n\r\nKey Activation : [+pwd+]\r\n\r\nIf you did not request this email then please ignore it.\r\n\r\nRegards,\r\nSite Administrator";
$c['number_of_logs'] = "100";
$c['number_of_messages'] = "30";
$c['number_of_results'] = "20";
$c['use_editor'] = "1";
$c['use_browser'] = "1";
$c['rb_base_dir'] = "/home/mercurep/public_html/assets/";
$c['rb_base_url'] = "/assets/";
$c['which_editor'] = "TinyMCE";
$c['fe_editor_lang'] = "english";
$c['fck_editor_toolbar'] = "standard";
$c['fck_editor_autolang'] = "0";
$c['editor_css_path'] = "";
$c['editor_css_selectors'] = "";
$c['strip_image_paths'] = "1";
$c['upload_images'] = "jpg,jpeg,png,gif,psd,ico,bmp";
$c['upload_media'] = "mp3,wav,au,wmv,avi,mpg,mpeg";
$c['upload_flash'] = "swf,fla";
$c['upload_files'] = "txt,php,html,htm,xml,js,css,cache,zip,gz,rar,z,tgz,tar,htaccess,mp3,mp4,aac,wav,au,wmv,avi,mpg,mpeg,pdf,doc,xls,txt,jpg,jpeg,png,gif,psd";
$c['upload_maxsize'] = "1048576";
$c['new_file_permissions'] = "0644";
$c['new_folder_permissions'] = "0777";
$c['show_preview'] = "0";
$c['filemanager_path'] = "/home/mercurep/public_html/";
$c['theme_refresher'] = "";
$c['manager_layout'] = "4";
$c['custom_contenttype'] = "text/css,text/html,text/javascript,text/plain,text/xml";
$c['auto_menuindex'] = "1";
$c['session.cookie.lifetime'] = "604800";
$c['mail_check_timeperiod'] = "60";
$c['manager_lang_attribute'] = "en";
$c['manager_direction'] = "ltr";
$c['tinymce_editor_theme'] = "editor";
$c['tinymce_custom_plugins'] = "style,advimage,advlink,searchreplace,print,contextmenu,paste,fullscreen,nonbreaking,xhtmlxtras,visualchars,media";
$c['tinymce_custom_buttons1'] = "undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,link,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help";
$c['tinymce_custom_buttons2'] = "bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops";
$c['tree_show_protected'] = "0";
$c['site_id'] = "4809c9f48f84d";
$c['xhtml_urls'] = "0";
$c['site_unavailable_page'] = "";
$c['allow_duplicate_alias'] = "1";
$c['automatic_alias'] = "1";
$c['tinymce_custom_buttons3'] = "";
$c['tinymce_custom_buttons4'] = "";
$c['tinymce_css_selectors'] = "";
$this->aliasListing = array();
$a = &$this->aliasListing;
$d = &$this->documentListing;
$m = &$this->documentMap;
$d['welcome'] = 1;
$a[1] = array('id' => 1, 'alias' => 'welcome', 'path' => '');
$m[] = array('0' => '1');
$d['privacy'] = 48;
$a[48] = array('id' => 48, 'alias' => 'privacy', 'path' => '');
$m[] = array('0' => '48');
$d['contactus'] = 46;
$a[46] = array('id' => 46, 'alias' => 'contactus', 'path' => '');
$m[] = array('0' => '46');
$d['promotion'] = 54;
$a[54] = array('id' => 54, 'alias' => 'promotion', 'path' => '');
$m[] = array('0' => '54');
$d['fr'] = 57;
$a[57] = array('id' => 57, 'alias' => 'fr', 'path' => '');
$m[] = array('0' => '57');
$d['sitemap'] = 44;
$a[44] = array('id' => 44, 'alias' => 'sitemap', 'path' => '');
$m[] = array('0' => '44');
$d['reservation'] = 42;
$a[42] = array('id' => 42, 'alias' => 'reservation', 'path' => '');
$m[] = array('0' => '42');
$d['rooms'] = 18;
$a[18] = array('id' => 18, 'alias' => 'rooms', 'path' => '');
$m[] = array('0' => '18');
$d['news'] = 50;
$a[50] = array('id' => 50, 'alias' => 'news', 'path' => '');
$m[] = array('0' => '50');
$d['restaurants'] = 19;
$a[19] = array('id' => 19, 'alias' => 'restaurants', 'path' => '');
$m[] = array('0' => '19');
$d['facilities-services'] = 20;
$a[20] = array('id' => 20, 'alias' => 'facilities-services', 'path' => '');
$m[] = array('0' => '20');
$d['weddings'] = 72;
$a[72] = array('id' => 72, 'alias' => 'weddings', 'path' => '');
$m[] = array('0' => '72');
$d['meetings-evetns'] = 21;
$a[21] = array('id' => 21, 'alias' => 'meetings-evetns', 'path' => '');
$m[] = array('0' => '21');
$d['spa'] = 66;
$a[66] = array('id' => 66, 'alias' => 'spa', 'path' => '');
$m[] = array('0' => '66');
$d['find-us'] = 86;
$a[86] = array('id' => 86, 'alias' => 'find-us', 'path' => '');
$m[] = array('0' => '86');
$d['information'] = 22;
$a[22] = array('id' => 22, 'alias' => 'information', 'path' => '');
$m[] = array('0' => '22');
$d['photos'] = 23;
$a[23] = array('id' => 23, 'alias' => 'photos', 'path' => '');
$m[] = array('0' => '23');
$d['property-feature-section'] = 59;
$a[59] = array('id' => 59, 'alias' => 'property-feature-section', 'path' => '');
$m[] = array('0' => '59');
$d['video'] = 94;
$a[94] = array('id' => 94, 'alias' => 'video', 'path' => '');
$m[] = array('0' => '94');
$d['article'] = 96;
$a[96] = array('id' => 96, 'alias' => 'article', 'path' => '');
$m[] = array('0' => '96');
$d['login'] = 100;
$a[100] = array('id' => 100, 'alias' => 'login', 'path' => '');
$m[] = array('0' => '100');
$d['download'] = 99;
$a[99] = array('id' => 99, 'alias' => 'download', 'path' => '');
$m[] = array('0' => '99');
$d['rooms/overview'] = 61;
$a[61] = array('id' => 61, 'alias' => 'overview', 'path' => 'rooms');
$m[] = array('18' => '61');
$d['rooms/superior-room'] = 26;
$a[26] = array('id' => 26, 'alias' => 'superior-room', 'path' => 'rooms');
$m[] = array('18' => '26');
$d['rooms/deluxe-room'] = 25;
$a[25] = array('id' => 25, 'alias' => 'deluxe-room', 'path' => 'rooms');
$m[] = array('18' => '25');
$d['rooms/Suite'] = 27;
$a[27] = array('id' => 27, 'alias' => 'Suite', 'path' => 'rooms');
$m[] = array('18' => '27');
$d['rooms/beach-front-suites'] = 71;
$a[71] = array('id' => 71, 'alias' => 'beach-front-suites', 'path' => 'rooms');
$m[] = array('18' => '71');
$d['restaurants/index'] = 41;
$a[41] = array('id' => 41, 'alias' => 'index', 'path' => 'restaurants');
$m[] = array('19' => '41');
$d['restaurants/Ebony-Restaurant'] = 29;
$a[29] = array('id' => 29, 'alias' => 'Ebony-Restaurant', 'path' => 'restaurants');
$m[] = array('19' => '29');
$d['restaurants/Ebony-bar-Lounge'] = 75;
$a[75] = array('id' => 75, 'alias' => 'Ebony-bar-Lounge', 'path' => 'restaurants');
$m[] = array('19' => '75');
$d['restaurants/sahadewa-bar'] = 83;
$a[83] = array('id' => 83, 'alias' => 'sahadewa-bar', 'path' => 'restaurants');
$m[] = array('19' => '83');
$d['restaurants/departure-lounge'] = 30;
$a[30] = array('id' => 30, 'alias' => 'departure-lounge', 'path' => 'restaurants');
$m[] = array('19' => '30');
$d['facilities-services/overview'] = 62;
$a[62] = array('id' => 62, 'alias' => 'overview', 'path' => 'facilities-services');
$m[] = array('20' => '62');
$d['facilities-services/swimming-pools'] = 85;
$a[85] = array('id' => 85, 'alias' => 'swimming-pools', 'path' => 'facilities-services');
$m[] = array('20' => '85');
$d['facilities-services/kids-club'] = 84;
$a[84] = array('id' => 84, 'alias' => 'kids-club', 'path' => 'facilities-services');
$m[] = array('20' => '84');
$d['facilities-services/Services'] = 34;
$a[34] = array('id' => 34, 'alias' => 'Services', 'path' => 'facilities-services');
$m[] = array('20' => '34');
$d['facilities-services/Activities'] = 33;
$a[33] = array('id' => 33, 'alias' => 'Activities', 'path' => 'facilities-services');
$m[] = array('20' => '33');
$d['facilities-services/Business-Services'] = 35;
$a[35] = array('id' => 35, 'alias' => 'Business-Services', 'path' => 'facilities-services');
$m[] = array('20' => '35');
$d['meetings-evetns/meetings-overview'] = 36;
$a[36] = array('id' => 36, 'alias' => 'meetings-overview', 'path' => 'meetings-evetns');
$m[] = array('21' => '36');
$d['meetings-evetns/events1'] = 95;
$a[95] = array('id' => 95, 'alias' => 'events1', 'path' => 'meetings-evetns');
$m[] = array('21' => '95');
$d['information/sanur-destination'] = 63;
$a[63] = array('id' => 63, 'alias' => 'sanur-destination', 'path' => 'information');
$m[] = array('22' => '63');
$d['information/history-of-bali'] = 93;
$a[93] = array('id' => 93, 'alias' => 'history-of-bali', 'path' => 'information');
$m[] = array('22' => '93');
$d['information/nice-places-to-visit-in-Bali'] = 39;
$a[39] = array('id' => 39, 'alias' => 'nice-places-to-visit-in-Bali', 'path' => 'information');
$m[] = array('22' => '39');
$d['information/Bali'] = 37;
$a[37] = array('id' => 37, 'alias' => 'Bali', 'path' => 'information');
$m[] = array('22' => '37');
$d['information/Sanur'] = 38;
$a[38] = array('id' => 38, 'alias' => 'Sanur', 'path' => 'information');
$m[] = array('22' => '38');
$d['photos/photos'] = 40;
$a[40] = array('id' => 40, 'alias' => 'photos', 'path' => 'photos');
$m[] = array('23' => '40');
$d['reservation/index'] = 43;
$a[43] = array('id' => 43, 'alias' => 'index', 'path' => 'reservation');
$m[] = array('42' => '43');
$d['sitemap/index'] = 45;
$a[45] = array('id' => 45, 'alias' => 'index', 'path' => 'sitemap');
$m[] = array('44' => '45');
$d['contactus/index'] = 47;
$a[47] = array('id' => 47, 'alias' => 'index', 'path' => 'contactus');
$m[] = array('46' => '47');
$d['privacy/index'] = 49;
$a[49] = array('id' => 49, 'alias' => 'index', 'path' => 'privacy');
$m[] = array('48' => '49');
$d['news/weeding-package'] = 81;
$a[81] = array('id' => 81, 'alias' => 'weeding-package', 'path' => 'news');
$m[] = array('50' => '81');
$d['promotion/promotion1'] = 55;
$a[55] = array('id' => 55, 'alias' => 'promotion1', 'path' => 'promotion');
$m[] = array('54' => '55');
$d['promotion/room-package'] = 56;
$a[56] = array('id' => 56, 'alias' => 'room-package', 'path' => 'promotion');
$m[] = array('54' => '56');
$d['fr/welcome'] = 58;
$a[58] = array('id' => 58, 'alias' => 'welcome', 'path' => 'fr');
$m[] = array('57' => '58');
$d['property-feature-section/Deluxe-King-Room'] = 64;
$a[64] = array('id' => 64, 'alias' => 'Deluxe-King-Room', 'path' => 'property-feature-section');
$m[] = array('59' => '64');
$d['property-feature-section/Lobby'] = 80;
$a[80] = array('id' => 80, 'alias' => 'Lobby', 'path' => 'property-feature-section');
$m[] = array('59' => '80');
$d['property-feature-section/meranti-ballroom'] = 65;
$a[65] = array('id' => 65, 'alias' => 'meranti-ballroom', 'path' => 'property-feature-section');
$m[] = array('59' => '65');
$d['property-feature-section/swimming-pool'] = 79;
$a[79] = array('id' => 79, 'alias' => 'swimming-pool', 'path' => 'property-feature-section');
$m[] = array('59' => '79');
$d['property-feature-section/ebony-restaurant1'] = 60;
$a[60] = array('id' => 60, 'alias' => 'ebony-restaurant1', 'path' => 'property-feature-section');
$m[] = array('59' => '60');
$d['spa/overview'] = 70;
$a[70] = array('id' => 70, 'alias' => 'overview', 'path' => 'spa');
$m[] = array('66' => '70');
$d['spa/spa-packages'] = 67;
$a[67] = array('id' => 67, 'alias' => 'spa-packages', 'path' => 'spa');
$m[] = array('66' => '67');
$d['weddings/overview'] = 74;
$a[74] = array('id' => 74, 'alias' => 'overview', 'path' => 'weddings');
$m[] = array('72' => '74');
$d['weddings/meetings'] = 73;
$a[73] = array('id' => 73, 'alias' => 'meetings', 'path' => 'weddings');
$m[] = array('72' => '73');
$d['weddings/honeymoon-package1'] = 82;
$a[82] = array('id' => 82, 'alias' => 'honeymoon-package1', 'path' => 'weddings');
$m[] = array('72' => '82');
$d['weddings/wedding-packages'] = 76;
$a[76] = array('id' => 76, 'alias' => 'wedding-packages', 'path' => 'weddings');
$m[] = array('72' => '76');
$d['find-us/index'] = 90;
$a[90] = array('id' => 90, 'alias' => 'index', 'path' => 'find-us');
$m[] = array('86' => '90');
$d['article/MRA-Bali-International-Triathlon'] = 97;
$a[97] = array('id' => 97, 'alias' => 'MRA-Bali-International-Triathlon', 'path' => 'article');
$m[] = array('96' => '97');
$d['article/Bali-Arts-Festival'] = 98;
$a[98] = array('id' => 98, 'alias' => 'Bali-Arts-Festival', 'path' => 'article');
$m[] = array('96' => '98');
$c = &$this->contentTypes;
$c[1] = 'text/html';
$c[61] = 'text/html';
$c[38] = 'text/html';
$c[37] = 'text/html';
$c[100] = 'text/html';
$c[63] = 'text/html';
$c[64] = 'text/html';
$c[65] = 'text/html';
$c[36] = 'text/html';
$c[35] = 'text/html';
$c[26] = 'text/html';
$c[27] = 'text/html';
$c[29] = 'text/html';
$c[30] = 'text/html';
$c[60] = 'text/html';
$c[62] = 'text/html';
$c[96] = 'text/html';
$c[33] = 'text/html';
$c[34] = 'text/html';
$c[41] = 'text/html';
$c[25] = 'text/html';
$c[23] = 'text/html';
$c[22] = 'text/html';
$c[21] = 'text/html';
$c[20] = 'text/html';
$c[19] = 'text/html';
$c[18] = 'text/html';
$c[59] = 'text/html';
$c[39] = 'text/html';
$c[98] = 'text/html';
$c[40] = 'text/html';
$c[71] = 'text/html';
$c[83] = 'text/html';
$c[86] = 'text/html';
$c[84] = 'text/html';
$c[72] = 'text/html';
$c[73] = 'text/html';
$c[42] = 'text/html';
$c[43] = 'text/html';
$c[44] = 'text/html';
$c[45] = 'text/html';
$c[46] = 'text/html';
$c[47] = 'text/html';
$c[66] = 'text/html';
$c[70] = 'text/html';
$c[67] = 'text/html';
$c[74] = 'text/html';
$c[48] = 'text/html';
$c[49] = 'text/html';
$c[81] = 'text/html';
$c[82] = 'text/html';
$c[50] = 'text/html';
$c[54] = 'text/html';
$c[55] = 'text/html';
$c[56] = 'text/html';
$c[57] = 'text/html';
$c[58] = 'text/html';
$c[93] = 'text/html';
$c[94] = 'text/html';
$c[79] = 'text/html';
$c[80] = 'text/html';
$c[75] = 'text/html';
$c[76] = 'text/html';
$c[99] = 'text/html';
$c[97] = 'text/html';
$c[90] = 'text/html';
$c[85] = 'text/html';
$c[95] = 'text/html';
$c = &$this->chunkCache;
$c['WebLoginSideBar'] = '<!-- #declare:separator <hr> --> 
<!-- login form section-->
<form method="post" name="loginfrm" action="[+action+]" style="margin: 0px; padding: 0px;"> 
<input type="hidden" value="[+rememberme+]" name="rememberme"> 
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td><b>User:</b></td>
	<td><input type="text" name="username" tabindex="1" onkeypress="return webLoginEnter(document.loginfrm.password);" size="5" style="width: 100px;" value="[+username+]" /></td>
  </tr>
  <tr>
	<td><b>Password:</b></td>
	<td><input type="password" name="password" tabindex="2" onkeypress="return webLoginEnter(document.loginfrm.cmdweblogin);" size="5" style="width: 100px;" value="" /></td>
  </tr>
  <tr>
	<td><label for="chkbox" style="cursor:pointer">Remember me:&nbsp; </label></td>
	<td>
	<table width="100%"  border="0" cellspacing="0" cellpadding="0">
	  <tr>
		<td valign="top"><input type="checkbox" id="chkbox" name="chkbox" tabindex="4" size="1" value="" [+checkbox+] onClick="webLoginCheckRemember()" /></td>
		<td align="right">									
		<input type="submit" value="[+logintext+]" name="cmdweblogin" /></td>
	  </tr>
	</table>
	</td>
  </tr>
  <tr>
	<td colspan="2"><a href="#" onclick="webLoginShowForm(2);return false;">Forget Password?</a></td>
  </tr>
</table>
</td>
</tr>
</table>
</form>
<hr>
<!-- log out hyperlink section -->
<a href=\'[+action+]\'>[+logouttext+]</a>
<hr>
<!-- Password reminder form section -->
<form name="loginreminder" method="post" action="[+action+]" style="margin: 0px; padding: 0px;">
<input type="hidden" name="txtpwdrem" value="0" />
<table border="0">
	<tr>
	  <td>Enter the email address of your account <br />below to receive your password:</td>
	</tr>
	<tr>
	  <td><input type="text" name="txtwebemail" size="24" /></td>
	</tr>
	<tr>
	  <td align="right"><input type="submit" value="Submit" name="cmdweblogin" />
	  <input type="reset" value="Cancel" name="cmdcancel" onclick="webLoginShowForm(1);" /></td>
	</tr>
  </table>
</form>

';
$c['footer'] = '        <ul>

          <li>Copyright Mercure Pontianak 2009</li>

          <li>||</li>
        <li>
          <a href="http://www.accorhotels-asia.com/advplus?utm_source=HW-{{hotel-id}}&utm_medium=HotelWeb" target="_blank">Advantage Plus</a>
        </li>
        <li>|</li>

          <li>

<a href="http://www.accorhotels.com/accorhotels/lien_externe.svlt?goto=liste_hotel&nom_ville={{hotel-id}}&code_langue=gb&sourceid=hotelwebsite{{hotel-id}}&merchantid=par-accorAS" target="_blank">Reservations & Rates</a>
            <!-- <a href="http://www.accorhotels-asia.com/{{hotel-id}}?utm_source=HW-{{hotel-id}}&utm_medium=HotelWeb">Reservations & Rates</a> -->

          </li>

          <li>:</li>

          <li>

            <a href="/[~45~]">Sitemap</a>

          </li>

          <li>:</li>

          <li>

            <a href="/[~47~]">Contact us</a>

          </li>

          <li>:</li>

          <li>

            <a href="/[~49~]">Privacy Policy</a>

          </li>
          <li>:</li>

          <li>

            <a href="/[~96~]">Article</a>

          </li>

        </ul>
<br>';
$c['news-tpl'] = '                [+tvthumbNews+]
                <div class="text">
                  <h2>
                    <a href="/[~[+id+]~]">[+title+]</a>
                  </h2>
                    <a href="/[~[+id+]~]">[+introtext+]</a>
                  <a href="/[~[+id+]~]" class="more">more</a>
                </div>
';
$c['span'] = '<li[+wf.classes+]>
	<span>[+wf.linktext+]</span>
	[+wf.wrapper+]
</li>';
$c['promotion-tpl'] = '             [+tvthumbNews+]
              <div class="text">
                <h2>
                  <a href="/[~[+id+]~]">[+title+]</a>
                </h2>
                <a href="/[~[+id+]~]">[+introtext+]</a>
                  <a href="/[~[+id+]~]" class="more">more</a>
              </div>
                ';
$c['mercure-asia-link'] = '<a href="http://www.mercure.com/asia" target="_blank">www.mercure.com/asia</a>';
$c['photo-js'] = ' <script type="text/javascript"><!--

          var arrImageInfo = new Array(0);

    arrImageInfo[0] = new Array("title");

    arrImageInfo[0]["title"] = \'\';

  

    arrImageInfo[1] = new Array("title");

    arrImageInfo[1]["title"] = \'\';

  

    arrImageInfo[2] = new Array("title");

    arrImageInfo[2]["title"] = \'\';

  

    arrImageInfo[3] = new Array("title");

    arrImageInfo[3]["title"] = \'\';

  

    arrImageInfo[4] = new Array("title");

    arrImageInfo[4]["title"] = \'\';

  

    arrImageInfo[5] = new Array("title");

    arrImageInfo[5]["title"] = \'\';

  

    arrImageInfo[6] = new Array("title");

    arrImageInfo[6]["title"] = \'\';

  

    arrImageInfo[7] = new Array("title");

    arrImageInfo[7]["title"] = \'\';

  

    arrImageInfo[8] = new Array("title");

    arrImageInfo[8]["title"] = \'\';

  

    arrImageInfo[9] = new Array("title");

    arrImageInfo[9]["title"] = \'\';

  

    arrImageInfo[10] = new Array("title");

    arrImageInfo[10]["title"] = \'\';

  

    arrImageInfo[11] = new Array("title");

    arrImageInfo[11]["title"] = \'\';

  

    arrImageInfo[12] = new Array("title");

    arrImageInfo[12]["title"] = \'\';

  

    arrImageInfo[13] = new Array("title");

    arrImageInfo[13]["title"] = \'\';

  

    arrImageInfo[14] = new Array("title");

    arrImageInfo[14]["title"] = \'\';

  

    arrImageInfo[15] = new Array("title");

    arrImageInfo[15]["title"] = \'\';

  

    arrImageInfo[16] = new Array("title");

    arrImageInfo[16]["title"] = \'\';

  

    arrImageInfo[17] = new Array("title");

    arrImageInfo[17]["title"] = \'\';

  

    arrImageInfo[18] = new Array("title");

    arrImageInfo[18]["title"] = \'\';

  

    arrImageInfo[19] = new Array("title");

    arrImageInfo[19]["title"] = \'\';

  --></script>';
$c['hotelname'] = 'Mercure Pontianak';
$c['hotel-id'] = '6925';
$c['property-ditto-template'] = '<div id="bg-imagebox">
<img src="[+property-image+]" />
</div>
<div class="text">
<h2>[+pagetitle+]</h2>
<p>[+introtext+]</p>
</div>';
$c['JavaSlide'] = '<script language="javascript" type="text/javascript">

/***********************************************
* Ultimate Fade-In Slideshow (v1.5): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
 



var fadeimages3=new Array() //2nd array set example. Remove or add more sets as needed.
//SET IMAGE PATHS. Extend or contract array as needed
//fadeimages3[0]=["1.jpg", "", ""] //plain image syntax
//fadeimages3[1]=["2.jpg", "", ""] 
//fadeimages3[2]=["3.jpg", "", ""]//image with link syntax

[!JavaSlideSnipet!]
 
 var jumlah = 3
var fadebgcolor="white"
 
////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*jumlah
var fadeheight=fadeheight+this.imageborder*jumlah
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write(\'<div id="master\'+this.slideshowid+\'" style="position:relative;width:\'+fadewidth+\'px;height:\'+fadeheight+\'px;overflow:hidden;"><div id="\'+this.canvasbase+\'_0" style="position:absolute;width:\'+fadewidth+\'px;height:\'+fadeheight+\'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;-khtml-opacity:10;background-color:\'+fadebgcolor+\'"></div><div id="\'+this.canvasbase+\'_1" style="position:absolute;width:\'+fadewidth+\'px;height:\'+fadeheight+\'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);-moz-opacity:10;background-color:\'+fadebgcolor+\'"></div></div>\')
else
document.write(\'<div><img name="defaultslide\'+this.slideshowid+\'" src="\'+this.postimages[0].src+\'"></div>\')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=10
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML=\'<a href="\'+this.theimages[picindex][1]+\'" target="\'+this.theimages[picindex][2]+\'">\'
slideHTML+=\'<img src="\'+this.postimages[picindex].src+\'" border="\'+this.imageborder+\'px">\'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+=\'</a>\'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images[\'defaultslide\'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=obj.degree/100
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}
 


</script>';
$c['reservation'] = '
                  <select id="cmbDay" name="cmbDay">
                    <option value="1">1</option>
                    <option value="2">2</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                    <option value="5">5</option>
                    <option value="6">6</option>
                    <option value="7">7</option>
                    <option value="8">8</option>
                    <option value="9">9</option>
                    <option value="10">10</option>
                    <option value="11">11</option>
                    <option value="12">12</option>
                    <option value="13">13</option>
                    <option value="14">14</option>
                    <option value="15">15</option>
                    <option value="16">16</option>
                    <option value="17">17</option>
                    <option value="18">18</option>
                    <option value="19">19</option>
                    <option value="20">20</option>
                    <option value="21">21</option>
                    <option value="22">22</option>
                    <option value="23">23</option>
                    <option value="24">24</option>
                    <option value="25">25</option>
                    <option value="26">26</option>
                    <option value="27">27</option>
                    <option value="28">28</option>
                    <option value="29">29</option>
                    <option value="30">30</option>
                    <option value="31">31</option>
                  </select>
                  <select id="cmbMonthYear" name="cmbMonthYear" class="month"></select>';
$c['ArtikelInContent'] = '<div class="newslist">[!Ditto?startID=`96` &tpl=`artikelInContentDittoTpl` &summarize=`5` &multiLevel=`1` &paginate=`1` &paginateAlwaysShowLinks=`1`!]</div>
<p>&nbsp;</p>
<div id="ditto_wrapper">
<div id="ditto_total">Page <strong>[+currentPage+]</strong> of <strong>[+total+]</strong> Articles</div>
<div id="ditto_pages">[+previous+] [+pages+] [+next+]</div>
</div>';
$c['artikelInContentDittoTpl'] = '<div class="NewsInContent">
<!-- <div class="News_images">[[checkTVarImage?doc_id=`[+id+]` &Tv_Var=`ImageContent`]]</div> -->
<div  align="left"><a href="/[~[+id+]~]" align="left">[+pagetitle+]</a></div>
[+introtext+]
<a href="/[~[+id+]~]">more... </a><br /><br />
<div class="clr"></div>
</div>';
$c['linkdownload'] = '[!downloadinsert!]';
$c['defaultLoginFormTpl'] = '<div id="wlpeLogin" align="center">
	<form id="wlpeLoginForm" action="/[~[*id*]~]" method="POST">
    <div class="box_formlogin">
  
    <div id="FormLogin">
		<!--<fieldset id="wlpeLoginFieldset">--><!--<legend id="wlpeLegend">Web User Login Form</legend>-->
	    <table cellpadding="3" cellspacing="2" border="0" width="100%">
        <tr>
            <td colspan="2" class="header_form"><strong>Form Login</strong></td>
          </tr>
          <tr>
            <td colspan="2">[+wlpe.message+]</td>
          </tr>
          <tr>
            <label id="wlpeUsernameLabel" for="wlpeUsername"> </label>
            <td width="80">Email Address</td>
            <td><input id="wlpeUsername" type="text" name="username" />
            </td>
          </tr>
          <tr>
            <label id="wlpePasswordLabel" for="wlpePassword"> </label>
            <td>Password</td>
            <td><input id="wlpePassword" type="password" name="password" /></td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td><!--<fieldset id="wlpeLoginButtons">-->
                <button type="submit" id="wlpeLoginButton" name="service" value="login">Login</button> 
            </td>
          </tr>
          <tr>
            <td>&nbsp;</td>
            <td>
                <button type="submit" id="wlpeReminderButton" name="service" value="forgot">Forgot Password</button> &nbsp;
				<button type="submit" id="wlpeRegisterButton" name="service" value="registernew">Register</button>

              <!--</fieldset>--></td>
          </tr>
        </table>
        </div>
  
        </div>
	</form>
</div>';
$c['resetTplForm'] = '<div id="wlpeReset" align="center">
	<form id="wlpeResetForm" name="wlpeResetForm" action="/[~[*id*]~]" method="POST">
    <div class="box_formlogin">

		<div id="FormReset">
		
	    <table cellpadding="3" cellspacing="2" border="0" width="100%">
        <tr>
            <td colspan="2" class="header_form"><strong>Password Reset Form</strong></td>
          </tr>
          <tr>
            <td colspan="2">[+wlpe.message+]</td>
          </tr>
          <tr>
            <td colspan="2" >
            <h3 id="wlpeResetInfo">Don\'t Worry, it happens to everyone.</h3>
			<p>Enter your email address in the field below and we will set a temporary password for your account.</p>
			<p>This temporary password will be emailed to you with instructions on how to activate it.</p>
            </td>
          </tr>
			<tr>
            <label  for="wlpeResetEmail"> </label>
            <td >Email Address</td>
            <td><input type="text" id="wlpeResetEmail" name="email" class="inputregister" />
            </td>
    		</tr>
         <!--   <tr>
            <td>&nbsp;</td>
            <td>OR</td>
            </tr>
          <tr>
			<label for="wlpeRegisterUserName"></label>
            
            <td>Username</td>
            <td>
			<input type="text" id="wlpeRegisterUserName" name="username" class="inputregister"  /></td>
            </tr> -->
			<tr>
            <td>&nbsp;</td>
            <td>		
			<button type="submit" id="wlpeResetButton" name="service" value="resetpassword">Send Password</button> &nbsp;
			<button type="submit" id="wlpeResetCancelButton" name="service" value="cancel">Cancel</button>
            </td>
            </tr>            
            </table>
        </div>
    
            </div>
	</form>
</div>';
$c['defaultActivationFormTpl'] = '<div id="wlpeActivate" align="center">
	<form id="wlpeActivateForm" name="wlpeActivateForm" action="/[~[*id*]~]" method="POST">
       <div class="box_formlogin">
    
    <div id="FormRegister" >
	<table cellpadding="3" cellspacing="2" border="0" width="100%">
        <tr>
            <td colspan="2" class="header_form"><strong>Form Activation</strong></td>
          </tr>
          <tr>
            <td colspan="2" >
            [+wlpe.message+]
            <input type="hidden" name="userid" value="[+request.userid+]" />
			<input type="hidden" name="activationkey" value="[+request.activationkey+]" />
            </td>
          </tr>
			
            <tr>
            <label for="wlpeActivationPassword"></label>
            <td width="120" >Activation password</td>
            <td>
			<input type="text" id="wlpeActivationPassword" name="activationpassword" />
			</td>
            </tr>
            <tr>
            
			<label for="wlpeNewPassword"></label>
            <td>New password</td>
            <td>
			<input type="password" id="wlpeNewPassword" name="newpassword" /></td>
            </tr>
            <tr>
            
			<label for="wlpeNewPasswordConfirm"></label>
            <td>New password (Confirm)</td>
			<td><input type="password" id="wlpeNewPasswordConfirm" name="newpassword.confirm" /></td>
			</tr>
			<tr>
            <td >&nbsp;</td>
            <td>            
			<button type="submit" id="wlpeActivateButton" name="service" value="activated">Activate</button>
            </td></tr>
            </table>
        </div>
       
        </div>
	</form>
</div>';
$c['registerSuccessTpl'] = '<div id="wlpeRegister" align="center">
	<form id="wlpeRegisterForm" name="wlpeRegisterForm" action="/[~[*id*]~]" method="POST">
   <div class="box_formlogin">
   
    <div id="FormRegister">
		
	    <table cellpadding="3" cellspacing="2" border="0" width="100%">
        <tr>
            <td colspan="2" class="header_form"><strong>Form Register</strong></td>
          </tr>
          <tr>
            <td colspan="2" >
            Your registration has been completed,<br />
            [+wlpe.message+]
            </td>
          </tr>
          <tr>
            <td colspan="2" >
           <a href="/[~[*id*]~]">Click Here to Login</a>
            </td>
          </tr>
		
			
		
        </table>
        </div>
        
        </div>

	</form>
</div>
';
$c['RegisterTpl'] = '<div id="wlpeRegister" align="center">
	<form id="wlpeRegisterForm" name="wlpeRegisterForm" action="/[~[*id*]~]" method="POST">
    <div class="box_formlogin">
    
    <div id="FormRegister">
		
	    <table cellpadding="3" cellspacing="2" border="0" width="100%">
        <tr>
            <td colspan="2" class="header_form"><strong>Form Register</strong></td>
          </tr>
          <tr>
            <td colspan="2" >[+wlpe.message+]</td>
          </tr>
          <tr>
            <td colspan="2" >
            <p class="wlpeRegisterInfo">Please fill in registration form below, password will be emailed to you</p>
            </td>
          </tr>
          <tr>
            <label  for="wlpeRegisterFullName"> </label>
            <td width="120" >Full Name</td>
            <td><input type="text" id="wlpeRegisterFullName" name="fullname" class="inputregister" value="[+post.fullname+]"/>
            </td>
          </tr>	
          <tr>
            <label  for="wlpeRegisterAddress"> </label>
            <td >Address</td>
            <td><input type="text" id="wlpeRegisterAddress" name="address"style="width:250px;" value="[+post.address+]" />
            </td>
          </tr>	
          <tr>
            <label  for="wlpeUserRegisterPhone"> </label>
            <td >Phone number</td>
            <td><input type="text" id="wlpeUserRegisterPhone" name="phone" style="width:250px;" value="[+post.phone+]" />
            </td>
          </tr>	
          <tr>
            <label  for="wlpeRegisterEmail"> </label>
            <td >Email Address</td>
            <td><input type="text" id="wlpeRegisterEmail" name="email" style="width:250px;" value="[+post.email+]" />
            </td>
          </tr>	
<tr>
            <label for="wlpeUserRegisterComment"> </label>
            <td valign="top">Purpose </td>
            <td><textarea id="wlpeUserRegisterComment" name="comment" style="width:250px; height:60px;">[+post.comment+]</textarea>
            </td>
          </tr>
					
          
        <!--   <tr>
			<label for="wlpeRegisterUserName"></label>
            
            <td>desired username</td>
            <td>
			<input type="text" id="wlpeRegisterUserName" name="username" class="inputregister" value="[+post.username+]" /></td>
            </tr> -->
         <!--    <tr>
			<label for="wlpeRegisterPassword"></label>
            
            <td>Password</td>
            <td>
            <input type="password" name="password" id="wlpeRegisterPassword" class="inputregister" />
			</td>
            </tr>
             <tr>
			<label for="wlpeRegisterPasswordconfirm"></label>
            
            <td>confirm Password</td>
            <td>
			<input type="password" name="password.confirm" id="wlpeRegisterPasswordconfirm" class="inputregister" /></td>
            </tr> -->
			<tr>
            <td>&nbsp;</td>
            <td><!--<fieldset id="wlpeLoginButtons">-->
            <button type="submit" id="wlpeRegisterButton" name="service" value="register">Register</button> &nbsp;
			<button type="submit" id="wlpeRegisterCancelButton" name="service" value="cancel">Cancel</button>
            </td>
          </tr>
			
		
        </table>
        </div>
        
        </div>
	</form>
</div>';
$s = &$this->snippetCache;
$s['AjaxSearch'] = '/* -------------------------------------------------------------
:: Snippet: Ajax Search
----------------------------------------------------------------
    Short Description: 
        Ajax-driven search form

    Version:
        1.6

    Created by:
	    Jason Coward (opengeek - jason@opengeek.com)
	    Kyle Jaebker (kylej - kjaebker@muddydogpaws.com)
	    Ryan Thrash (rthrash - ryan@vertexworks.com)
	    
	    Live Search by Thomas (Shadock)
	    Fixes & Additions by identity/Perrine/mikkelwe

    Date:
        02/18/2007

    Required Usage:
        [!AjaxSearch!]

    Changelog:
	22-Jan-07 
		-- Added templating support (includes/templates.inc.php)
		-- Added language support
		-- Switched from prototype/scriptaculous to Mootools
	03-Jan-07 -- Added many bugfixes/additions from AjaxSearch forum
	18-Sep-06 -- Added code to only show results for allowed pages
	05-May-06 -- Added liveSearch functionality and new parameter
	21-Apr-06 -- Added code to make it compatible with tagcloud snippet
	20-Apr-06 -- Added code from eastbind & japanese community for other language searching
	4-Apr-06 -- Added search term highlighting
	1-Apr-06 -- initial commit into SVN
	30-Mar-06 -- initial work based on FSF_ajax from KyleJ

----------------------------------------------------------------
:: Description
----------------------------------------------------------------
    Ajax search form that degrades (works without JS enabled), and that provides for either live search or click-to-submit. Results returned to the current page without reloading.

----------------------------------------------------------------
:: Parameters
----------------------------------------------------------------

    &AS_showForm [1 | 0] (optional)
        Show the search form with the results. Default is 1 (true)
        
    &AS_landing [int] (optional)
        Document id you would like the search to show on. (For non-ajax search)
        
    &AS_showResults [1 | 0] (optional)
        Show the results with the snippet. (For non-ajax search)
        
    &extract [1 | 0] (optional)
        Show the search words highlighting.
        
    &ajaxSearch [1 | 0] (optional)
        Use the ajaxSearch. Default is 1 (true)

    &ajaxSearchType [1 | 0] (optional)
        There are two forms of the ajaxSearch.
        0 - The form button is displayed and searching does not start until the button is pressed by the user.
        1 - There is no form button, the search is started automatically as the user types

    &ajaxMax [int] (optional)
        The number of results you would like returned from the ajax search.
        
    &grabMax [int] (optional)
        The number of results per page returned for non-ajax search and for the more results page.
        
    &showMoreResults [1 | 0] (optional)
        If you want a link to show all of the results from the ajax search.
        
    &moreResultsPage [int] (optional)
        Page you want the more results link to point to. This page should contain another call to this snippet for displaying results.
        
    &addJscript [1 | 0] (Default: 1)
        If you want the prototype and the scriptaculous libraries added to the header of your pages automatically set this to 1.  Set to
        0 if you do not want them inculded automatically.


----------------------------------------------------------------
:: CSS                         
----------------------------------------------------------------
    The following items are used to style the starting form and
    ajax result container.

    #ajaxSearch_form - id of the search form
    #ajaxSearch_input - id of the input box on the form
    #ajaxSearch_submit - id of the submit button
    #ajaxSearch_output - id of the div that the ajax results are returned in
    
    The following items are used to style the reults when the user does not have javascript or they have clicked the more results link
    
    #ajaxSearch_resultListContainer - id of the results container
    .ajaxSearch_paging - class for span of result pages listing
    .ajaxSearch_pagination - class for pagination paragraph
    .ajaxSearch_result - class for result container div
    .ajaxSearch_resultLink - class for result link
    .ajaxSearch_resultDescription - class for result description span
    .ajaxSearch_extract - class for content extract div (for highlighting)
    .ajaxSearch_highlight1,2,3 - classes for result highlighting.  You need to
        create as many classes as terms you think a user will search for.
    .ajaxSearch_resultsIntroFailure - class for no results paragraph
    .ajaxSearch_intro - class for intro paragraph

    The following items are used to style the results returned by the ajax request.

    .AS_ajax_result - class for the result container div
    .AS_ajax_resultLink - class for the result link
    .AS_ajax_resultDescription - class for the result description span
    .AS_ajax_extract - class for the content extract div (for highlighting)
    .AS_ajax_hightlight1,2,3 - classes for result highlighting.  You need to create as many classes as terms you think a user will search for.
    .AS_ajax_more - class for more search results div
    .AS_ajax_resultsIntroFailure - class for no results paragraph


----------------------------------------------------------------
:: Example Calls              
----------------------------------------------------------------
[!AjaxSearch!]
    A basic default call that renders a search form with the default images and parametes

[!AjaxSearch? &showMoreResults=`1` &moreResultsPage=`25`!]
    Allows a link to a full-page search to go to another page.
    
[!AjaxSearch? &ajaxMax=`10` &extract=`0`!]
    Overrides the number of maximum results returned and removes search term highlighting.
    

----------------------------------------------------------------
:: Credits
----------------------------------------------------------------
   Based on Flex Search Form (FSF) by jardc@honeydewdsign.com 
   as modified by KyleJ (kjaebker@muddydogpaws.com).
   
   Also based on degradible live search demos at:
     http://orderedlist.com/articles/howto-animated-live-search/
     http://www.gizax.it/experiments/AHAH/degradabile/test/liveSearch.html
     
   The search highlighting was based off of the original FSF
     modification by Marc (MadeMyDay).
------------------------------------------------------------- */

// CONFIGURE

  // MAIN SNIPPET SETUP OPTIONS
  // --------------------------

   // $searchStyle [ \'relevance\' | \'partial\' ]
   // This option allows you to decide to use a faster, relevance sorted search (\'relevance\') which WILL NOT inlclude partial matches. Or use a slower, but more inclusive search (\'partial\') that will include partial matches. Results will NOT be sorted based on relevance.
   // This option contributed by Rich from Snappy Graffix Media to allow partial matching and LIKE matching of the search term. sam@snappygraffix.com
   $searchStyle = \'partial\';

   // $useAllWords [ true | false ]
   // If you want only documents which contain ALL words in the search string, set to true. Otherwise, the search will return all pages with ONE or more of the search words (which can be a LOT more pages).
   $useAllWords = false;

   // $showSearchWithResults [1 | 0]
   // If you would like to turn off the search form when showing results you can set this to false. Can also be set in template by using the snippet variable: AS_showForm like this (1=true, 0=false):
   // [[AjaxSearch? AS_showForm=0]]
   $showSearchWithResults = 1;

   // $resultsPage [int]
   // The default behavior is to show the results on the current page, but you may define the results page any way you like. The priority is:
   // 1- snippet variable - set in page template like this:
   //    [[AjaxSearch? AS_landing=int]]
   //    where int is the page id number of the page you want your results on
   // 2- querystring variable AS_form
   // 3- variable set here
   // 4- use current page
   // This is VERY handy when you want to put the search form in a discrete and/or small place on your page- like a side column, but don\'t want all your results to show up there!
   // Set to results page or leave 0 as default
   $resultsPage = 0;

   // $grabMax [ int ]
   // Set to the max number of records you would like on each page. Set to 0 if unlimited.
   $grabMax = (isset($grabMax))? $grabMax : 10;

   // $pageLinkSeparator [ string ]
   // What you want, if anything, between your page link numbers
   $pageLinkSeparator = " | ";

   // $stripHTML [ true | false ]
   // Allow HTML characters in the search? Probably not.
   $stripHTML = true;

   // $stripSnip [ true | false ]
   // Strip out snippet calls etc from the search string?
   $stripSnip = true;

   // $stripSnippets [ true | false ]
   // Strip out snippet names so users will not be able to "search" to see what snippets are used in your content. This is a security benefit, as users will not be able to search for what pages use specific snippets.
   $stripSnippets = true;

   // $minChars [ int ]
   // Minimum number of characters to require for a word to be valid for searching. MySQL will typically NOT search for words with less than 4 characters (relevance mode). If you have $useAllWords = true and a three or fewer word appears in the search string, the results will always be 0. Setting this drops those words from the search in THAT CIRCUMSTANCE ONLY (relevance mode, useAllWords=true).
   $minChars = 4;

   // $extract [1 | 0]
   // show the search terms highlighted in a little extract (like Google)
   $extract = (isset($extract))? $extract : 1;
   
   // $highlightResult [1 | 0]
   // create links so that search terms will be highlighted when linked page clicked
   $highlightResult = (isset($highlightResult)) ? $highlightResult : 1;

   // $ajaxSearch [1 | 0] (as passed in snippet variable ONLY)
   // Use this to display the search results using ajax You must include the Mootools library in your template
   $ajaxSearch = (isset($ajaxSearch))? $ajaxSearch : 1;

   // $ajaxSearchType [1 | 0] (as passed in snippet variable ONLY)
   // Use this to display the search results using ajax
   $ajaxSearchType = (isset($ajaxSearchType))? $ajaxSearchType : 0;

   // $ajaxMax [int] - The maximum number of results to show for the ajaxsearch
   $ajaxMax = (isset($ajaxMax))? $ajaxMax : 6;

   // $showMoreResults [1 | 0]
   // Set this to 1 if you would like a link to show all of the search results
   $showMoreResults = (isset($showMoreResults))? $showMoreResults : 0;
   
   // $moreResultsPage [int]
   // The document id of the page you want the more results link to point to
   $moreResultsPage = (isset($moreResultsPage ))? $moreResultsPage : 0;

   // $addJscript [1 | 0]
   // Set this to 1 if you would like to include the javascript libraries in the
   // header of your pages automatically.
   $addJscript = (isset($addJscript ))? $addJscript : 1;
   
   //Location of the ajaxsearch, prototype, and scriptaculous libraries
   //These will be set in the page head if they are not included in the template
   $jsInclude = \'assets/snippets/AjaxSearch/AjaxSearch.js\';
   $jsMooTools = \'manager/media/script/mootools/mootools.js\';

   // establish whether to show the form or not
   $showSearchWithResults = (isset($AS_showForm))? $AS_showForm : $showSearchWithResults;

   // establish whether to show the results or not
   $showResults = (isset($AS_showResults))? $AS_showResults : true;

/* -------------
  End configure
 -------------- */

// Set Snippet Paths
$snipPath = $modx->config[\'base_path\'] . "assets/snippets/";

include_once $snipPath."AjaxSearch/includes/AjaxSearch.inc.php";
include $snipPath."AjaxSearch/includes/templates.inc.php";

#include default language file
include($snipPath."AjaxSearch/lang/english.inc.php");

#include other language file if set.
$as_language = isset($language) ? $language : $modx->config[\'manager_language\'];
if($as_language!="english" && $as_language != \'\') {
	if(file_exists($snipPath ."AjaxSearch/lang/".$as_language.".inc.php"))
		include $snipPath ."AjaxSearch/lang/".$as_language.".inc.php";
}

$liveSearch = $ajaxSearchType;

// establish results page
if (isset($AS_landing)) { // set in snippet
	$searchAction = "[~".$AS_landing."~]";
} elseif ($resultsPage > 0) { // locally set
	$searchAction = "[~".$resultsPage."~]";
} else { //otherwise
	$searchAction = "[~".$modx->documentIdentifier."~]";
}

// Set newline variable
$newline = "\\n";

// Initialize search string
$searchString = \'\';

// CLEAN SEARCH STRING
if ( isset($_POST[\'search\']) || isset($_GET[\'AS_search\']) || isset($_GET[\'FSF_search\'])) {
	// Prefer post to get
	if (isset($_POST[\'search\'])) {
		$searchString = $_POST[\'search\'];
	} elseif (isset($_GET[\'AS_search\'])) {
		$searchString = urldecode($_GET[\'AS_search\']);
	} else {
		// Code to make tag cloud snippet work with this search
		$searchString = urldecode($_GET[\'FSF_search\']);
	}

	//**********************************************************************************************************************
	$searchString = initSearchString($searchString,$stripHTML,$stripSnip,$stripSnippets,$useAllWords,$searchStyle,$minChars,$ajaxSearch);
	//**********************************************************************************************************************
} // End cleansing search string

// check querystring
$validSearch = ($searchString != \'\')? true : false ;

//check for offset
$offset = (isset($_GET[\'AS_offset\']))? $_GET[\'AS_offset\'] : 0;

// initialize output
$SearchForm = \'\';
$introMessage = \'\';
$useAllWords = ($useAllWords) ? 1 : 0;

if ($docgrp = $modx->getUserDocGroups()) {
	$docgrp = implode(",", $docgrp);
}

if ($ajaxSearch) {
	$searchFormId = \'id="ajaxSearch_form" \';
	//Adding the javascript libraries to the header
	if ($addJscript) {
		$modx->regClientStartupScript($jsMooTools);
	}
  
	$modx->regClientStartupScript($jsInclude);
	
	$jsVars = <<<EOD
	<script type="text/javascript">
		<!--
		stripHtml = $stripHTML;
		stripSnip = $stripSnip;
		stripSnippets = $stripSnippets;
		useAllWords = $useAllWords;
		searchStyle = \'$searchStyle\';
		minChars = $minChars;
		maxResults = $ajaxMax;
		showMoreResults = $showMoreResults;
		moreResultsPage = $moreResultsPage;
		as_language = \'$as_language\'
		extract = $extract;
		liveSearch = $liveSearch;
		docgrp = \'$docgrp\';
		highlightResult = $highlightResult;
		-->
	</script>
EOD;

	$modx->regClientStartupScript($jsVars);
} else {
	$searchFormId = \'\';
}

// establish form
if (($validSearch && ($showSearchWithResults)) || $showSearchWithResults){
	$formPlaceholders = array(
		\'[+as.formId+]\' => $searchFormId,
		\'[+as.formAction+]\' => $searchAction,
		\'[+as.inputValue+]\' => ($searchString == \'\' && $_lang[\'as_boxText\'] != \'\') ? $_lang[\'as_boxText\'] : $searchString,
		\'[+as.inputOptions+]\' => ($_lang[\'as_boxText\']) ? \' onfocus="this.value=(this.value==\\\'\'.$_lang[\'as_boxText\'].\'\\\')? \\\'\\\' : this.value ;"\' : \'\',
		\'[+as.submitText+]\' => $_lang[\'as_searchButtonText\'],
	);
	
	$finalSearchForm = str_replace( array_keys( $formPlaceholders ), array_values( $formPlaceholders ), $asTemplates[\'form\'] );
} else {
	$finalSearchForm = \'\';
}

$finalResults = \'\';
if ($showResults) {
	if($validSearch) {
	//**********************************************************************************************************************
	$rs = doSearch($searchString,$searchStyle,$useAllWords,$ajaxSearch,$docgrp);
	//**********************************************************************************************************************
	$limit = $modx->recordCount($rs);
	$search = explode(" ", $searchString);
		if($limit>0) {
			// pagination
			if ($grabMax > 0){
				$numResultPages = ceil($limit/$grabMax);
				$resultPagingText = ($limit>$grabMax) ? $_lang[\'as_paginationTextMultiplePages\'] : $_lang[\'as_paginationTextSinglePage\'] ;
				$resultPageLinkNumber = 1;
				$resultPageLinks = \'\';
				for ( $nrp = 0; $nrp < $limit && $limit > $grabMax; $nrp += $grabMax ){
					if($offset == ($resultPageLinkNumber-1)*$grabMax){
						$resultPageUrl = $resultPageLinkNumber;
						$usePageTemplate = \'pagingLinksCurrent\';
					} else {
						$resultPageUrl = $modx->makeUrl($modx->documentIdentifier, \'\', \'AS_offset=\' . $nrp . \'&AS_search=\' . urlencode($searchString));
						$usePageTemplate = \'pagingLinks\';
					}
					
					$useSeperator = ($nrp + $grabMax < $limit) ? $pageLinkSeparator : \'\' ;
					
					$pageLinkPlaceholders = array(
						\'[+as.pagingLink+]\' => $resultPageUrl,
						\'[+as.pagingText+]\' => $resultPageLinkNumber,
						\'[+as.pagingSeperator+]\' => $useSeperator,
					);
					
					$resultPageLinks .= str_replace(array_keys($pageLinkPlaceholders),array_values($pageLinkPlaceholders),$asTemplates[$usePageTemplate]);
					$resultPageLinkNumber++;
				}
				
				$pageLinkPlaceholders = array(
					\'[+as.pagingText+]\' => $resultPagingText,
					\'[+as.pagingLinks+]\' => $resultPageLinks,
				);
				
				$resultPageLinksFinal = str_replace(array_keys($pageLinkPlaceholders),array_values($pageLinkPlaceholders),$asTemplates[\'pagingLinksOuter\']);
				
				$resultsFoundText = ($limit > 1)? $_lang[\'as_resultsFoundTextMultiple\'] : $_lang[\'as_resultsFoundTextSingle\'] ;
				if ($extract) {
					$hits=1;
					$searchwords=\'\';
					foreach ($search as $words) {
						$searchwords .= \'<span class="ajaxSearch_highlight ajaxSearch_highlight\'.$hits.\'">\'.$words.\'</span>&nbsp;\';
						$hits++;
					}
					// Remove trailing \'&nbsp;\'
					$searchwords = substr($searchwords, 0, strlen($searchwords) -6);
					$resultsFoundText = sprintf($resultsFoundText,$limit,$searchwords);
				} else {
					$resultsFoundText = sprintf($resultsFoundText,$limit,$searchString);
				}
				
				$resultInfoPlaceholders = array(
					\'[+as.resultInfoText+]\' => $resultsFoundText,
				);
				
				$resultInfo = str_replace(array_keys($resultInfoPlaceholders),array_values($resultInfoPlaceholders),$asTemplates[\'resultsInfo\']);		
			} // end if grabMax

			// search results
			$useLimit = ($grabMax > 0)? $offset+$grabMax : $limit;
			$allResults = \'\';
			for ($y = $offset; ($y < $useLimit) && ($y<$limit); $y++) {
				$moveToRow = mysql_data_seek($rs,$y);
				$SearchFormsrc=$modx->fetchRow($rs);
				if ($extract) {
					$highlightClass = \'ajaxSearch_highlight\';
					$text=$SearchFormsrc[\'content\'];
					$count=1;
					$summary=\'\';
					$toAdd = PrepareSearchContent( $text, $length=200, $search[0] );
					strip_tags( $text );
					foreach ($search as $searchTerm) {
						if (preg_match(\'/\' . preg_quote($searchTerm) . \'/i\', $text)) {
							if ($count > 1) { // The first summary was already extracted above
								$toAdd = SmartSubstr( $text , $length=200, $searchTerm );
							}
							$summary .= preg_replace( \'/\' . preg_quote( $searchTerm, \'/\' ) . \'/i\', \'<span class="ajaxSearch_highlight ajaxSearch_highlight\'.$count.\'">\\0</span>\', $toAdd ) . \' \';
						}
						$highlightClass .= \' ajaxSearch_highlight\'.$count;
						$count++;
					}
					$text=$summary;
				}
				
				if ($highlightResult) {
					if (!$extract) {
						$highlightClass = \'ajaxSearch_highlight\';
						$count=1;
						foreach ($search as $searchTerm) {
							$highlightClass .= \' ajaxSearch_highlight\'.$count;
							$count++;
						}
					}
				
					$searchFormLink = $modx->makeUrl($SearchFormsrc[\'id\'],\'\',\'searched=\'.urlencode($searchString).\'&amp;highlight=\'.urlencode($highlightClass));
				} else {
					$searchFormLink = $modx->makeUrl($SearchFormsrc[\'id\']);
				}
			
				if ($extract) {
					$extractPlaceholders = array(
						\'[+as.extractClass+]\' => \'ajaxSearch_extract\',
						\'[+as.extract+]\' => $text,
					);
					$resultExtract = str_replace(array_keys($extractPlaceholders),array_values($extractPlaceholders),$asTemplates[\'extractWrapper\']);
				} else {
					$resultExtract = \'\';
				}
				
				if ($SearchFormsrc[\'description\'] != \'\') {
					$descPlaceholders = array(
						\'[+as.descriptionClass+]\' => \'ajaxSearch_resultDescription\',
						\'[+as.description+]\' => $SearchFormsrc[\'description\'],
					);
					$resultDesc = str_replace(array_keys($descPlaceholders),array_values($descPlaceholders),$asTemplates[\'descriptionWrapper\']);
				} else {
					$resultDesc = \'\';
				}
				
				$resultPlaceholders = array(
					\'[+as.resultClass+]\' => \'ajaxSearch_result\',
					\'[+as.resultLinkClass+]\' => \'ajaxSearch_resultLink\',
					\'[+as.resultLink+]\' => $searchFormLink,
					\'[+as.longtitle+]\' => $SearchFormsrc[\'longtitle\'],
					\'[+as.pagetitle+]\' => $SearchFormsrc[\'pagetitle\'],
					\'[+as.description+]\' => $resultDesc,
					\'[+as.extract+]\' => $resultExtract,
				);
				
				$allResults .= str_replace(array_keys($resultPlaceholders),array_values($resultPlaceholders),$asTemplates[\'result\']);
			}
			
			$finalPlaceholders = array(
				\'[+as.results+]\' => $allResults,
				\'[+as.paging+]\' => $resultPageLinksFinal,
				\'[+as.resultInfo+]\' => $resultInfo,
			);
			
			$finalResults .= str_replace(array_keys($finalPlaceholders),array_values($finalPlaceholders),$asTemplates[\'no_ajax_outer\']);
		} else {
			$noResultsPlaceholder = array(
				\'[+as.noResultClass+]\' => \'ajaxSearch_resultsIntroFailure\',
				\'[+as.noResultText+]\' => $_lang[\'as_resultsIntroFailure\'],
			);
			$finalResults .= str_replace(array_keys($noResultsPlaceholder),array_values($noResultsPlaceholder),$asTemplates[\'noResults\']);
		} // end if records found
	} else if (!$validSearch && isset($_POST[\'sub\'])) {
		// message to show if search was performed but for something invalid
		$noResultsPlaceholder = array(
			\'[+as.noResultClass+]\' => \'ajaxSearch_resultsIntroFailure\',
			\'[+as.noResultText+]\' => $_lang[\'as_resultsIntroFailure\'],
		);
		$finalResults .= str_replace(array_keys($noResultsPlaceholder),array_values($noResultsPlaceholder),$asTemplates[\'noResults\']);
	} else { // end if validSearch
		$introMessage = str_replace(\'[+as.introMessage+]\',$_lang[\'as_introMessage\'],$asTemplates[\'introMessage\']);
	} // end if not validSearch
} // end if showResults

if ($ajaxSearch) {
    $finalResults = \'<div id="ajaxSearch_output" style="opacity:0;"> </div>\';
	$introMessage = \'\';
}

$finalPlaceholders = array(
	\'[+as.form+]\' => $finalSearchForm,
	\'[+as.intro+]\' => $introMessage,
	\'[+as.results+]\' => $finalResults,
);

$SearchForm .= str_replace(array_keys($finalPlaceholders),array_values($finalPlaceholders),$asTemplates[\'layout\']);

return $SearchForm;';
$s['Breadcrumbs'] = '// --------------------
// Snippet: Breadcrumbs
// --------------------
// Version: 0.9d
// Date: 2006.06.12
// jaredc@honeydewdesign.com
// Honorable mentions:
// - Bill Wilson
// - wendy@djamoer.net
// - grad
//
// This snippet was designed to show the path through the various
// levels of site structure back to the root. It is NOT necessarily
// the path the user took to arrive at a given page.

// Configuration Settings

    // $maxCrumbs [number]
    // Max number of elements to have in a path.
    // 100 is an arbitrary high number.
    // If you make it smaller, like say 2, but you
    // you are 5 levels deep, it will appear as:
    // Home > ... > Level 4 > Level 5
    // It should be noted that "Home" and the current
    // page do not count. Each of these are configured
    // separately.
    (isset($maxCrumbs)) ? $maxCrumbs : $maxCrumbs = 100;

    // $pathThruUnPub [ 1 | 0 ]
    // When your path includes an unpublished folder, setting this to 
    // 1 will show all documents in path EXCEPT the unpublished.
    // Example path (unpublished in caps)
    // home > news > CURRENT > SPORTS > skiiing > article
    // $pathThruUnPub = true would give you this:
    // home > news > skiiing > article
    // $pathThruUnPub = false  would give you this:
    // home > skiiing > article (assuming you have home crumb turned on)
    (isset($pathThruUnPub)) ? $pathThruUnPub : $pathThruUnPub = 1;
   
    // $respectHidemenu [ 1 | 0 ]
    // Setting this to 1 will hide items in the breadcrumb list that
    // are set to be hidden in menus.
    (isset($respectHidemenu)) ? $respectHidemenu : $respectHidemenu = 1;

    // $showHomeCrumb [ 1 | 0 ]
    // Would you like your crumb string to start
    // with a link to home? Some would not because
    // a home link is usually found in the site logo
    // or elsewhere in the navigation scheme.
    (isset($showHomeCrumb)) ? $showHomeCrumb : $showHomeCrumb = 1;

    // $showCrumbsAtHome [ 1 | 0 ]
    // You can use this to turn off the breadcrumbs on the
    // home page with 1.
    // grad: actually \'1\' shows and \'0\' hides crumbs at homepage
    (isset($showCrumbsAtHome)) ? $showCrumbsAtHome : $showCrumbsAtHome = 0;

    // $showCurrentCrumb [ 1 | 0 ]
    // Show the current page in path with 1 or not with 0.
    (isset($showCurrentCrumb)) ? $showCurrentCrumb : $showCurrentCrumb = 1;

    // $currentAsLink [ 1 | 0]
    // If you want the current page crumb to be a
    // link (to itself) then set to 1.
    (isset($currentAsLink)) ? $currentAsLink : $currentAsLink = 0;

    // $crumbSeparator [string]
    // Define what you want between the crumbs
    (isset($crumbSeparator)) ? $crumbSeparator : $crumbSeparator = "&raquo;";

    // $homeCrumbTitle [string]
    // Just in case you want to have a home link,
    // but want to call it something else
    (isset($homeCrumbTitle)) ? $homeCrumbTitle : $homeCrumbTitle = \'Home\';

    // $homeCrumbDescription [string]
    // In case you want to have a custom description of the home link
    // Defaults to title of home link
    (isset($homeCrumbDescription)) ? $homeCrumbDescription : $homeCrumbDescription = $homeCrumbTitle; 

    // $titleField [string]
    // To change default page field to be used as
    // a breadcrumb title, default is pagetitle
    (isset($titleField)) ? $titleField : $titleField = \'pagetitle\';

    // $descField [string]
    // To change default page field to be used as
    // a breadcrumb description, default is description (GA: falls back to pagetitle if description is empty)
    (isset($descField)) ? $descField : $descField = \'description\';

    // Included classes
    // .B_crumbBox        Span that surrounds all crumb output
    // .B_hideCrumb       Span surrounding the "..." if there are more crumbs than will be shown
    // .B_currentCrumb    Span or A tag surrounding the current crumb
    // .B_firstCrumb      Span that always surrounds the first crumb, whether it is "home" or not
    // .B_lastCrumb       Span surrounding last crumb, whether it is the current page or not
    // .B_crumb           Class given to each A tag surrounding the intermediate crumbs (not home, or hide)
    // .B_homeCrumb       Class given to the home crumb
    

// ***********************************
// END CONFIG SETTINGS
// THE REST SHOULD TAKE CARE OF ITSELF
// ***********************************

// Check for home page
if ($showCrumbsAtHome || (!$showCrumbsAtHome && ($modx->documentIdentifier != $modx->config[\'site_start\'])) ){

    //initialize crumb array
    $ptarr = array();
    // get current page parent info
    $docInfo = $modx->getDocument($modx->documentIdentifier,\'id,pagetitle,menutitle,published,deleted,parent,hidemenu,description,longtitle,introtext\');
    $pid = $docInfo[\'parent\'];
    // show current page, as link or not
    if ($showCurrentCrumb){
        $titleToShow = ($docInfo[$titleField])? $docInfo[$titleField] : $docInfo[\'pagetitle\'] ;
        if ($currentAsLink && (!$respectHidemenu || ($respectHidemenu && $docInfo[\'hidemenu\'] != 1 ))){
            $descriptionToUse = ($docInfo[$descField]) ? $docInfo[$descField] : $docInfo[\'pagetitle\'] ;
            $ptarr[] = \'<a class="B_currentCrumb" href="[~\'.$modx->documentIdentifier.\'~]" title="\'.$descriptionToUse.\'">\'.$titleToShow.\'</a>\';
        } else {
            $ptarr[] = \'<span class="B_currentCrumb">\'.$docInfo[\'pagetitle\'].\'</span>\';
        }
    }
    // assemble intermediate crumbs
    $crumbCount = 0;
    //$activeOnly = ($pathThruUnPub)? 0 : 1;
    //while (($parent=$modx->getPageInfo($pid,$activeOnly,"id,pagetitle,menutitle,published,deleted,parent,hidemenu,description,longtitle,introtext")) && ($crumbCount < $maxCrumbs)) {
    while (($parent=$modx->getPageInfo($pid,!$pathThruUnPub,"id,pagetitle,menutitle,published,deleted,parent,hidemenu,description,longtitle,introtext")) && ($crumbCount < $maxCrumbs)) {
        if ($parent[\'published\'] && !$parent[\'deleted\'] && $parent[\'id\'] != $modx->config[\'site_start\']){
            if (!$respectHidemenu || ($respectHidemenu && $parent[\'hidemenu\'] != 1 )){
                $titleToShow = ($parent[$titleField])? $parent[$titleField] : $parent[\'pagetitle\'] ;
                $descriptionToUse = ($parent[$descField]) ? $parent[$descField] : $parent[\'pagetitle\'] ;
                $ptarr[] = \'<a class="B_crumb" href="[~\'.$parent[\'id\'].\'~]" title="\'.$descriptionToUse.\'">\'.$titleToShow.\'</a>\';
            }
        } // end if   
        $pid = $parent[\'parent\'];
        $crumbCount++;
    } // end while

    // insert \'...\' if maximum number of crumbs exceded
    if ($parent != 0){
        $ptarr[] = \'<span class="B_hideCrumb">...</span>\';
    }

    // add home link if desired
    if ($showHomeCrumb && ($modx->documentIdentifier != $modx->config[\'site_start\'])){
        $ptarr[] = \'<a class="B_homeCrumb" href="[~\'.$modx->config[\'site_start\'].\'~]" title="\'.$homeCrumbDescription.\'">\'.$homeCrumbTitle.\'</a>\';
    }

    $ptarr = array_reverse($ptarr);
    $ptarr[0] = \'<span class="B_firstCrumb">\'.$ptarr[0].\'</span>\';
    $ptarr[count($ptarr)-1] = \'<span class="B_lastCrumb">\'.$ptarr[count($ptarr)-1].\'</span>\';
    return \'<span class="B_crumbBox">\'. join($ptarr, " $crumbSeparator ").\'</span>\';

}';
$s['Ditto'] = '
/*
 * Title: Ditto Snippet
 * 
 * Description:
 *  	Aggregates documents to create blogs, article/news
 *  	collections, and more,with full support for templating.
 * 
 * Author: 
 * 		Mark Kaplan for MODx CMF
 * 
 * Version: 
 * 		2.1.1.SVN
*/

//---Core Settings---------------------------------------------------- //

$ditto_version = "2.1.1.SVN";
	// Ditto version being executed

$ditto_base = isset($ditto_base) ? $modx->config[\'base_path\'].$ditto_base : $modx->config[\'base_path\']."assets/snippets/ditto/";
/*
	Param: ditto_base
	
	Purpose:
	Location of Ditto files

	Options:
	Any valid folder location containing the Ditto source code with a trailing slash

	Default:
	[(base_path)]assets/snippets/ditto/
*/
$dittoID = (!isset($id)) ? "" : $id."_";
$GLOBALS["dittoID"] = $dittoID;
/*
	Param: id

	Purpose:
	Unique ID for this Ditto instance for connection with other scripts (like Reflect) and unique URL parameters

	Options:
	Any combination of characters a-z, underscores, and numbers 0-9
	
	Note:
	This is case sensitive

	Default:
	"" - blank
*/		
$language = (isset($language))? $language : "english";
/*
	Param: language

	Purpose:
	language for defaults, debug, and error messages

	Options:
	Any language name with a corresponding file in the &ditto_base/lang folder

	Default:
	"english"
*/
$format = (isset($format)) ? strtolower($format) : "html" ;
/*
	Param: format

	Purpose:
 	Output format to use

	Options:
	- "html"
	- "json"
	- "xml"
	- "atom"
	- "rss"

	Default:
	"html"
*/
$config = (isset($config)) ? $config : "default";
/*
	Param: config

	Purpose:
 	Load a custom configuration

	Options:
	"default" - default blank config file
	CONFIG_NAME - Other configs installed in the configs folder or in any folder within the MODx base path via @FILE

	Default:
	"default"
	
	Related:
	- <extenders>
*/
$debug = isset($debug)? $debug : 0;
/*
	Param: debug

	Purpose:
 	Output debugging information

	Options:
	0 - off
	1 - on
	
	Default:
	0 - off
	
	Related:
	- <debug>
*/
$phx = (isset($phx))? $phx : 1;
/*
	Param: phx

	Purpose:
 	Use PHx formatting

	Options:
	0 - off
	1 - on
	
	Default:
	1 - on
*/		
$extenders = isset($extenders) ? explode(",",$extenders) : array();
/*
	Param: extenders

	Purpose:
 	Load an extender which adds functionality to Ditto

	Options:
	Any extender in the extenders folder or in any folder within the MODx base path via @FILE

	Default:
	[NULL]

	Related:
	- <config>
*/
	// Variable: extenders
	// Array that can be added to by configs or formats to load that extender
	
$placeholders = array();
	// Variable: placeholders
	// Initialize custom placeholders array for configs or extenders to add to

$filters = array("custom"=>array(),"parsed"=>array());
	// Variable: filters
	// Holds both the custom filters array for configs or extenders to add to 
	// and the parsed filters array. To add to this array, use the following format
	// (code)
	// $filters["parsed"][] = array("name" => array("source"=>$source,"value"=>$value,"mode"=>$mode));
	// $filters["custom"][] = array("source","callback_function");

$orderBy = array(\'parsed\'=>array(),\'custom\'=>array(),\'unparsed\'=>$orderBy);
	// Variable: orderBy
	// An array that holds all criteria to sort the result set by. 
	// Note that using a custom sort will disable all other sorting.
	// (code)
	// $orderBy["parsed"][] = array("sortBy","sortDir");
	// $orderBy["custom"][] = array("sortBy","callback_function");
		
//---Includes-------------------------------------------------------- //

$files = array (
	"base_language" => $ditto_base."lang/english.inc.php",
	"language" => $ditto_base."lang/$language.inc.php",
	"main_class" => $ditto_base."classes/ditto.class.inc.php",
	"template_class" => $ditto_base."classes/template.class.inc.php",
	"filter_class" => $ditto_base."classes/filter.class.inc.php",
	"format" => $ditto_base."formats/$format.format.inc.php",
	"config" => $ditto_base."configs/default.config.php",
	"user_config" => (substr($config, 0, 5) != "@FILE") ? $ditto_base."configs/$config.config.php" : $modx->config[\'base_path\'].trim(substr($config, 5))
);

if ($phx == 1) {
	$files["prePHx_class"] = $ditto_base."classes/phx.pre.class.inc.php";
}
if (isset($randomize)) {
	$files["randomize_class"] = $ditto_base."classes/random.class.inc.php";
}
if ($debug == 1) {
	$files["modx_debug_class"] = $ditto_base."debug/modxDebugConsole.class.php";
	$files["debug_class"] = $ditto_base."classes/debug.class.inc.php";
	$files["debug_templates"] = $ditto_base."debug/debug.templates.php";
}

$files = array_unique($files);
foreach ($files as $filename => $filevalue) {
	if (file_exists($filevalue) && strpos($filename,"class")) {
		include_once($filevalue);
	} else if (file_exists($filevalue)) {
		include($filevalue);
	} else if ($filename == "language") {
		$modx->logEvent(1, 3, "Language file does not exist Please check: " . $filevalue, "Ditto " . $ditto_version);
		return "Language file does not exist Please check: " . $filevalue;
	} else {
		$modx->logEvent(1, 3, $filevalue . " " . $_lang[\'file_does_not_exist\'], "Ditto " . $ditto_version);
		return $filevalue . " " . $_lang[\'file_does_not_exist\'];
	}
}

//---Initiate Class-------------------------------------------------- //
if (class_exists(\'ditto\')) {
	$ditto = new ditto($dittoID,$format,$_lang,$dbg_templates);
		// create a new Ditto instance in the specified format and language with the requested debug level
} else {
	$modx->logEvent(1,3,$_lang[\'invalid_class\'],"Ditto ".$ditto_version);
	return $_lang[\'invalid_class\'];
}

//---Initiate Extenders---------------------------------------------- //
if (isset($tagData)) {
	$extenders[] = "tagging";
}
if(count($extenders) > 0) {
	$extenders = array_unique($extenders);
	foreach ($extenders as $extender) {
			if(substr($extender, 0, 5) != "@FILE") {
				$extender_path = $ditto_base."extenders/".$extender.".extender.inc.php";				
			} else {
				$extender_path = $modx->config[\'base_path\'].trim(substr($extender, 5));
			}
			
			if (file_exists($extender_path)){
				include($extender_path);
			} else {
				$modx->logEvent(1, 3, $extender . " " . $_lang[\'extender_does_not_exist\'], "Ditto ".$ditto_version);
				return $extender . " " . $_lang[\'extender_does_not_exist\'];
			}		
	}	
}

//---Parameters------------------------------------------------------- /*
if (isset($startID)) {$parents = $startID;}
if (isset($summarize)) {$display = $summarize;}
if (isset($limit)) {$queryLimit = $limit;}
if (isset($sortBy) || isset($sortDir) || is_null($orderBy[\'unparsed\'])) {
	$sortDir = isset($sortDir) ? strtoupper($sortDir) : \'DESC\';
	$sortBy = isset($sortBy) ? $sortBy : "createdon";
	$orderBy[\'parsed\'][]=array($sortBy,$sortDir);
}
	// Allow backwards compatibility

$idType = isset($documents) ? "documents" : "parents";
	// Variable: idType
	// type of IDs provided; can be either parents or documents

$parents = isset($parents) ? $ditto->cleanIDs($parents) : $modx->documentIdentifier;

/*
	Param: parents

	Purpose:
	IDs of containers for Ditto to retrieve their children to &depth depth

	Options:
	Any valid MODx document marked as a container

	Default:
	Current MODx Document

	Related:
	- <documents>
	- <depth>
*/
$documents = isset($documents) ? $ditto->cleanIDs($documents) : false;
/*
	Param: documents

	Purpose:
	IDs of documents for Ditto to retrieve

	Options:
	Any valid MODx document marked as a container

	Default:
	None

	Related:
	- <parents>
*/

$IDs = ($idType == "parents") ? $parents : $documents;
	// Variable: IDs
	// Internal variable which holds the set of IDs for Ditto to fetch

$depth = isset($depth) ? $depth : 1;
/*
	Param: depth

	Purpose:
	Number of levels deep to retrieve documents

	Options:
	Any number greater than or equal to 1
	0 - infinite depth

	Default:
	1

	Related:
	- <seeThruUnpub>
*/
$paginate = isset($paginate)? $paginate : 0;
/*
	Param: paginate

	Purpose:
	Paginate the results set into pages of &display length.
	Use &total to limit the number of documents retreived.

	Options:
	0 - off
	1 - on
	
	Default:
	0 - off
	
	Related:
	- <paginateAlwaysShowLinks>
	- <paginateSplitterCharacter>
	- <display>
*/
$dateSource = isset($dateSource) ? $dateSource : "createdon";
/*
	Param: dateSource

	Purpose:
	Source of the [+date+] placeholder

	Options:
	# - Any UNIX timestamp from MODx fields or TVs such as createdon, pub_date, or editedon
	
	Default:
	"createdon"
	
	Related:
	- <dateFormat>
*/
$dateFormat = isset($dateFormat)? $dateFormat : $_lang["dateFormat"];
/*
	Param: dateFormat

	Purpose:
	Format the [+date+] placeholder in human readable form

	Options:
	Any PHP valid strftime option

	Default:
	[LANG]
	
	Related:
	- <dateSource>
*/
$display = isset($display) ? $display : "all";
/*
	Param: display

	Purpose:
	Number of documents to display in the results

	Options:
	# - Any number
	"all" - All documents found

	Default:
	"all"
	
	Related:
	- <queryLimit>
	- <total>
*/
$total = isset($total) ? $total : "all";
/*
	Param: total

	Purpose:
	Number of documents to retrieve
	
	Options:
	# - Any number
	"all" - All documents found

	Default:
	"all" - All documents found
	
	Related:
	- <display>
	- <queryLimit>
*/
$showPublishedOnly = isset($showPublishedOnly) ? $showPublishedOnly : 1;
/*
	Param: showPublishedOnly

	Purpose:
	Show only published documents

	Options:
	0 - show only unpublished documents
	1 - show both published and unpublished documents
	
	Default:
	1 - show both published and unpublished documents
	
	Related:
	- <seeThruUnpub>
	- <hideFolders>
	- <showPublishedOnly>
	- <where>
*/
$showInMenuOnly = isset($showInMenuOnly) ? $showInMenuOnly : 0;
/*
	Param: showInMenuOnly

	Purpose:
	Show only documents visible in the menu

	Options:
	0 - show all documents
	1 - show only documents with the show in menu flag checked
	
	Default:
	0 - show all documents
	
	Related:
	- <seeThruUnpub>
	- <hideFolders>
	- <where>
*/
$hideFolders = isset($hideFolders)? $hideFolders : 0;
/*
	Param: hideFolders

	Purpose:
	Don\'t show folders in the returned results

	Options:
	0 - keep folders
	1 - remove folders
	
	Default:
	0 - keep folders
	
	Related:
	- <seeThruUnpub>
	- <showInMenuOnly>
	- <where>
*/
$hidePrivate = isset($hidePrivate)? $hidePrivate : 1;
/*
	Param: hidePrivate

	Purpose:
	Don\'t show documents the guest or user does not have permission to see

	Options:
	0 - show private documents
	1 - hide private documents
	
	Default:
	1 - hide private documents
	
	Related:
	- <seeThruUnpub>
	- <showInMenuOnly>
	- <where>
*/
$seeThruUnpub = (isset($seeThruUnpub))? $seeThruUnpub : 1 ;
/*
	Param: seeThruUnpub

	Purpose:
	See through unpublished folders to retrive their children
	Used when depth is greater than 1

	Options:
	0 - off
	1 - on
	
	Default:
	0 - off
	
	Related:
	- <hideFolders>
	- <showInMenuOnly>
	- <where>
*/
$queryLimit = (isset($queryLimit))? $queryLimit : 0;
/*
	Param: queryLimit

	Purpose:
	Number of documents to retrieve from the database, same as MySQL LIMIT

	Options:
	# - Any number
	0 - automatic

	Default:
	0 - automatic
	
	Related:
	- <where>
*/
$where = (isset($where))? $where : "";
/*
	Param: where

	Purpose:
	Custom MySQL WHERE statement

	Options:
	A valid MySQL WHERE statement using only document object items (no TVs)

	Default:
	[NULL]
	
	Related:
	- <queryLimit>
*/
$noResults = isset($noResults)? $ditto->getParam($noResults,"no_documents") : $_lang[\'no_documents\'];
/*
	Param: noResults

	Purpose:
	Text or chunk to display when there are no results

	Options:
	Any valid chunk name or text

	Default:
	[LANG]
*/
$removeChunk = isset($removeChunk) ? explode(",",$removeChunk) : false;
/*
	Param: removeChunk

	Purpose:
 	Name of chunks to be stripped from content separated by commas
	- Commonly used to remove comments

	Options:
	Any valid chunkname that appears in the output

	Default:
	[NULL]
*/
$hiddenFields = isset($hiddenFields) ? explode(",",$hiddenFields) : false;
/*
	Param: hiddenFields

	Purpose:
	Allow Ditto to retrieve fields its template parser cannot handle such as nested placeholders and [*fields*]

	Options:
	Any valid MODx fieldnames or TVs comma separated

	Default:
	[NULL]
*/
$offset = isset($start) ? $start : 0;
$start = (isset($_GET[$dittoID.\'start\'])) ? intval($_GET[$dittoID.\'start\']) : 0;
/*
	Param: start

	Purpose:
 	Number of documents to skip in the results
	
	Options:
	Any number

	Default:
	0
*/
$globalFilterDelimiter = isset($globalFilterDelimiter) ? $globalFilterDelimiter : "|";
/*
	Param: globalFilterDelimiter

	Purpose:
 	Filter delimiter used to separate filters in the filter string
	
	Options:
	Any character not used in the filters

	Default:
	"|"
	
	Related:
	- <localFilterDelimiter>
	- <filter>
	- <parseFilters>
*/
	
$localFilterDelimiter = isset($localFilterDelimiter) ? $localFilterDelimiter : ",";
/*
	Param: localFilterDelimiter

	Purpose:
	Delimiter used to separate individual parameters within each filter string
	
	Options:
	Any character not used in the filter itself

	Default:
	","
	
	Related:
	- <globalFilterDelimiter>
	- <filter>
	- <parseFilters>
*/
$filters["custom"] = isset($cFilters) ? array_merge($filters["custom"],$cFilters) : $filters["custom"];
$filters["parsed"] = isset($parsedFilters) ? array_merge($filters["parsed"],$parsedFilters) : $filters["parsed"];
	// handle 2.0.0 compatibility
$filter = (isset($filter) || ($filters["custom"] != false) || ($filters["parsed"] != false)) ? $ditto->parseFilters($filter,$filters["custom"],$filters["parsed"],$globalFilterDelimiter,$localFilterDelimiter) : false;
/*
	Param: filter

	Purpose:
	Removes items not meeting a critera. Thus, if pagetitle == joe then it will be removed.
	Use in the format field,criteria,mode with the comma being the local delimiter

	*Mode* *Meaning*
	
	1 - !=
	2 - ==
	3 - <
	4 - >
	5 - <=
	6 - >=
	7 - Text not in field value
	8 - Text in field value
	9 - case insenstive version of #7
	10 - case insenstive version of #8
	11 - checks leading character of the field
	
	@EVAL:
		@EVAL in filters works the same as it does in MODx exect it can only be used 
		with basic filtering, not custom filtering (tagging, etc). Make sure that
		you return the value you wish Ditto to filter by and that the code is valid PHP.

	Default:
	[NULL]
	
	Related:
	- <localFilterDelimiter>
	- <globalFilterDelimiter>
	- <parseFilters>
*/
$keywords = (isset($keywords))? $keywords : 0;
/*	
	Param: keywords
	
	Purpose: 
	Enable fetching of associated keywords for each document
	Can be used as [+keywords+] or as a tagData source
	
	Options:
	0 - off
	1 - on
	
	Default:
	0 - off
*/

$randomize = (isset($randomize))? $randomize : 0;
/*	
	Param: randomize
	
	Purpose: 
	Randomize the order of the output
	
	Options:
	0 - off
	1 - on
	Any MODx field or TV for weighted random
	
	Default:
	0 - off
*/
$save = (isset($save))? $save : 0;
/*
	Param: save

	Purpose:
	Saves the ditto object and results set to placeholders
	for use by other snippets

	Options:
	0 - off; returns output
	1 - remaining; returns output
	2 - all;
	3 - all; returns ph only

	Default:
		0 - off; returns output
*/
$templates = array(
	"default" => "@CODE".$_lang[\'default_template\'],
	"base" => $tpl,
	"alt" => $tplAlt,
	"first" => $tplFirst,
	"last" => $tplLast,
	"current" => $tplCurrentDocument
);
/*
	Param: tpl

	Purpose:
	User defined chunk to format the documents 

	Options:
	- Any valid chunk name
	- Code via @CODE
	- File via @FILE

	Default:
	[LANG]
*/
/*
	Param: tplAlt

	Purpose:
	User defined chunk to format every other document

	Options:
	- Any valid chunk name
	- Code via @CODE
	- File via @FILE

	Default:
	&tpl
*/
/*
	Param: tplFirst

	Purpose:
	User defined chunk to format the first document 

	Options:
	- Any valid chunk name
	- Code via @CODE
	- File via @FILE

	Default:
	&tpl
*/
/*
	Param: tplLast

	Purpose:
	User defined chunk to format the last document 

	Options:
	- Any valid chunk name
	- Code via @CODE
	- File via @FILE

	Default:
	&tpl
*/
/*
	Param: tplCurrentDocument

	Purpose:
	User defined chunk to format the current document

	Options:
	- Any valid chunk name
	- Code via @CODE
	- File via @FILE

	Default:
	&tpl
*/
$orderBy = $ditto->parseOrderBy($orderBy,$randomize);
/*
	Param: orderBy

	Purpose:
	Sort the result set

	Options:
	Any valid MySQL style orderBy statement

	Default:
	createdon DESC
*/
//-------------------------------------------------------------------- */
$templates = $ditto->template->process($templates);
	// parse the templates for TV\'s and store them for later use

$ditto->setDisplayFields($ditto->template->fields,$hiddenFields);
	// parse hidden fields
	
$ditto->parseFields($placeholders,$seeThruUnpub,$dateSource,$randomize);
	// parse the fields into the field array
	
$documentIDs = $ditto->determineIDs($IDs, $idType, $ditto->fields["backend"]["tv"], $orderBy, $depth, $showPublishedOnly, $seeThruUnpub, $hideFolders, $hidePrivate, $showInMenuOnly, $where, $keywords, $dateSource, $queryLimit, $display, $filter,$paginate, $randomize);
	// retrieves a list of document IDs that meet the criteria and populates the $resources array with them
$count = count($documentIDs);
	// count the number of documents to be retrieved
$count = $count-$offset;
	// handle the offset

if ($count > 0) {
	// if documents are returned continue with execution
	
	$total = ($total == "all") ? $count : min($total,$count);
		// set total equal to count if all documents are to be included
	
	$display = ($display == "all") ? min($count,$total) : min($display,$total);
		// allow show to use all option

	$stop = ($save != "1") ? min($total-$start,$display) : min($count,$total);
		// set initial stop count

	if($paginate == 1) {
		$paginateAlwaysShowLinks = isset($paginateAlwaysShowLinks)? $paginateAlwaysShowLinks : 0;
		/*
			Param: paginateAlwaysShowLinks

			Purpose:
			Determine whether or not to always show previous next links

			Options:
			0 - off
			1 - on

			Default:
			0 - off
		
			Related:
			- <paginate>
			- <paginateSplitterCharacter>
		*/
		$paginateSplitterCharacter = isset($paginateSplitterCharacter)? $paginateSplitterCharacter : $_lang[\'button_splitter\'];
		/*
			Param: paginateSplitterCharacter

			Purpose:
			Splitter to use if always show is disabled

			Options:
			Any valid character

			Default:
			[LANG]
		
			Related:
			- <paginate>
			- <paginateSplitterCharacter>
		*/
		$tplPaginatePrevious = isset($tplPaginatePrevious)? $ditto->template->fetch($tplPaginatePrevious) : "<a href=\'[+url+]\' class=\'ditto_previous_link\'>[+lang:previous+]</a>";
		/*
			Param: tplPaginatePrevious

			Purpose:
			Template for the previous link

			Options:
			- Any valid chunk name
			- Code via @CODE
			- File via @FILE

			Placeholders:
			url - URL for the previous link
			lang:previous - value of \'prev\' from the language file
		
			Related:
			- <tplPaginateNext>
			- <paginateSplitterCharacter>
		*/
		$tplPaginateNext = isset($tplPaginateNext)? $ditto->template->fetch($tplPaginateNext) : "<a href=\'[+url+]\' class=\'ditto_next_link\'>[+lang:next+]</a>";
		/*
			Param: tplPaginateNext

			Purpose:
			Template for the next link

			Options:
			- Any valid chunk name
			- Code via @CODE
			- File via @FILE

			Placeholders:
			url - URL for the next link
			lang:next - value of \'next\' from the language file
		
			Related:
			- <tplPaginatePrevious>
			- <paginateSplitterCharacter>
		*/
		$tplPaginateNextOff = isset($tplPaginateNextOff)? $ditto->template->fetch($tplPaginateNextOff) : "<span class=\'ditto_next_off ditto_off\'>[+lang:next+]</span>";
		/*
			Param: tplPaginateNextOff

			Purpose:
			Template for the inside of the next link

			Options:
			- Any valid chunk name
			- Code via @CODE
			- File via @FILE

			Placeholders:
			lang:next - value of \'next\' from the language file
		
			Related:
			- <tplPaginatePrevious>
			- <paginateSplitterCharacter>
		*/
		$tplPaginatePreviousOff = isset($tplPaginatePreviousOff)? $ditto->template->fetch($tplPaginatePreviousOff) : "<span class=\'ditto_previous_off ditto_off\'>[+lang:previous+]</span>";
		/*
			Param: tplPaginatePreviousOff

			Purpose:
			Template for the previous link when it is off

			Options:
			- Any valid chunk name
			- Code via @CODE
			- File via @FILE

			Placeholders:
			lang:previous - value of \'prev\' from the language file
	
			Related:
			- <tplPaginatePrevious>
			- <paginateSplitterCharacter>
		*/
		$tplPaginatePage = isset($tplPaginatePage)? $ditto->template->fetch($tplPaginatePage) : "<a class=\'ditto_page\' href=\'[+url+]\'>[+page+]</a>";
		/*
			Param: tplPaginatePage

			Purpose:
			Template for the page link

			Options:
			- Any valid chunk name
			- Code via @CODE
			- File via @FILE

			Placeholders:
			url - url for the page
			page - number of the page
	
			Related:
			- <tplPaginatePrevious>
			- <paginateSplitterCharacter>
		*/
		$tplPaginateCurrentPage = isset($tplPaginateCurrentPage)? $ditto->template->fetch($tplPaginateCurrentPage) : "<span class=\'ditto_currentpage\'>[+page+]</span>";
		/*
			Param: tplPaginateCurrentPage

			Purpose:
			Template for the current page link

			Options:
			- Any valid chunk name
			- Code via @CODE
			- File via @FILE

			Placeholders:
			page - number of the page
	
			Related:
			- <tplPaginatePrevious>
			- <paginateSplitterCharacter>
		*/
		
		$ditto->paginate($start, $stop, $total, $display, $tplPaginateNext, $tplPaginatePrevious, $tplPaginateNextOff, $tplPaginatePreviousOff, $tplPaginatePage, $tplPaginateCurrentPage, $paginateAlwaysShowLinks, $paginateSplitterCharacter);
			// generate the pagination placeholders
	}

	$dbFields = $ditto->fields["display"]["db"];
		// get the database fields
	$TVs = $ditto->fields["display"]["tv"];
		// get the TVs
	
	switch($orderBy[\'parsed\'][0][1]) {
		case "DESC":
			$stop = ($ditto->prefetch === false) ? $stop + $start + $offset : $stop + $offset; 
			$start += $offset;
		break;
		case "ASC":
			$start += $offset;
			$stop += $start;
		break;
	}

	if ($ditto->prefetch !== false) {
		$documentIDs = array_slice($documentIDs,$start,$stop);
			// set the document IDs equal to the trimmed array
		$dbFields = array_diff($dbFields,$ditto->prefetch["fields"]["db"]);
			// calculate the difference between the database fields and those already prefetched
		$dbFields[] = "id";
			// append id to the db fields array
		$TVs = array_diff($TVs,$ditto->prefetch["fields"]["tv"]);
			// calculate the difference between the tv fields and those already prefetched
		$start = 0;
		$stop = min($display,($queryLimit != 0) ? $queryLimit : $display,count($documentIDs));
	} else {
		$queryLimit = ($queryLimit == 0) ? "" : $queryLimit;
	}
	
	$resource = $ditto->getDocuments($documentIDs, $dbFields, $TVs, $orderBy, $showPublishedOnly, 0, $hidePrivate, $where, $queryLimit, $keywords, $randomize, $dateSource);
		// retrieves documents
	$output = $header;
		// initialize the output variable and send the header

	if ($resource) {
		if ($randomize != "0" && $randomize != "1") {
			$resource = $ditto->weightedRandom($resource,$randomize,$stop);
				// randomize the documents
		}
		
		$resource = array_values($resource);

		for ($x=$start;$x<$stop;$x++) {
			$template = $ditto->template->determine($templates,$x,0,$stop,$resource[$x]["id"]);
				// choose the template to use and set the code of that template to the template variable
			$renderedOutput = $ditto->render($resource[$x], $template, $removeChunk, $dateSource, $dateFormat, $placeholders,$phx,abs($start-$x));
				// render the output using the correct template, in the correct format and language
			$modx->setPlaceholder($dittoID."item[".abs($start-$x)."]",$renderedOutput);
			/*
				Placeholder: item[x]

				Content:
				Individual items rendered output
			*/
			$output .= $renderedOutput;
				// send the rendered output to the buffer
		}
	} else {
		$output .= $ditto->noResults($noResults,$paginate);
			// if no documents are found return a no documents found string
	}
	$output .= $footer;
		// send the footer

	// ---------------------------------------------------
	// Save Object
	// ---------------------------------------------------

	if($save) {
		$modx->setPlaceholder($dittoID."ditto_object", $ditto);
		$modx->setPlaceholder($dittoID."ditto_resource", ($save == "1") ? array_slice($resource,$display) : $resource);
	}
} else {
	$output = $header.$ditto->noResults($noResults,$paginate).$footer;
}
// ---------------------------------------------------
// Handle Debugging
// ---------------------------------------------------

if ($debug == 1) {
	$ditto_params = func_get_args();
	if (!isset($_GET["ditto_".$dittoID."debug"])) {
	$_SESSION["ditto_debug_$dittoID"] = $ditto->debug->render_popup($ditto, $ditto_base, $ditto_version, $ditto_params[1], $documentIDs, array("db"=>$dbFields,"tv"=>$TVs), $display, $templates, $orderBy, $start, $stop, $total,$filter,$resource);
	}
	if (isset($_GET["ditto_".$dittoID."debug"])) {
		switch ($_GET["ditto_".$dittoID."debug"]) {
			case "open" :
				exit($_SESSION["ditto_debug_$dittoID"]);
			break;
			case "save" :
				$ditto->debug->save($_SESSION["ditto_debug_$dittoID"],"ditto".strtolower($ditto_version)."_debug_doc".$modx->documentIdentifier.".html");
			break;
		}
	} else {
		$output = $ditto->debug->render_link($dittoID,$ditto_base).$output;
	}
}

return ($save != 3) ? $output : "";
';
$s['eForm'] = '# eForm 1.4.4 - Electronic Form Snippet
# Original created by Raymond Irving 15-Dec-2004.
# Version 1.3+ extended by Jelle Jager (TobyL) September 2006
# -----------------------------------------------------
# local version: $Id: eform.snippet.tpl,v 1.2 2006/11/22 14:53:38 jelle Exp $
# Captcha image support - thanks to Djamoer
# Multi checkbox, radio, select support - thanks to Djamoer
# Form Parser and extened validation - by Jelle Jager
#
# see eform/docs/eform.htm for history, usage and examples
#

# Set Snippet Paths
#new in 1.4.4 - sub-folder set by parameter
$snipFolder = isset($snipFolder)?$snipFolder:\'eform\';
$snipPath = $modx->config["base_path"].\'assets/snippets/\'.$snipFolder.\'/\';


# check if inside manager
if ($modx->isBackend()) {
return \'\'; # don\'t go any further when inside manager
}

//tidying up some casing errors in parameters
if(isset($eformOnValidate)) $eFormOnValidate = $eformOnValidate;
if(isset($eformOnBeforeMailSent)) $eFormOnBeforeMailSent = $eformOnBeforeMailSent;
if(isset($eformOnMailSent)) $eFormOnMailSent = $eformOnMailSent;
if(isset($eformOnValidate)) $eFormOnValidate = $eformOnValidate;
if(isset($eformOnBeforeFormMerge)) $eFormOnBeforeFormMerge = $eformOnBeforeFormMerge;
if(isset($eformOnBeforeFormParse)) $eFormOnBeforeFormParse = $eformOnBeforeFormParse;
//for sottwell :)
if(isset($eFormCSS)) $cssStyle = $eFormCSS;

# Snippet customize settings
$params = array (
   // Snippet Path
   \'snipPath\' => $snipPath, //includes $snipFolder
	 \'snipFolder\' => $snipFolder,

// eForm Params
   \'vericode\' => isset($vericode)? $vericode:"",
   \'formid\' => isset($formid)? $formid:"",
   \'from\' => isset($from)? $from:$modx->config[\'emailsender\'],
   \'fromname\' => isset($fromname)? $fromname:$modx->config[\'site_name\'],
   \'to\' => isset($to)? $to:$modx->config[\'emailsender\'],
   \'cc\' => isset($cc)? $cc:"",
   \'bcc\' => isset($bcc)? $bcc:"",
   \'subject\' => isset($subject)? $subject:"",
   \'ccsender\' => isset($ccsender)? 1:0,
   \'sendirect\' => isset($sendirect)? 1:0,
   \'mselector\' => isset($mailselector)? $mailselector:0,
   \'mobile\' => isset($mobile)? $mobile:\'\',
   \'mobiletext\' => isset($mobiletext)? $mobiletext:\'\',
   \'autosender\' => isset($autosender)? $autosender:$from,
   \'autotext\' => isset($automessage)? $automessage:"",
   \'category\' => isset($category)? $category:0,
   \'keywords\' => isset($keywords)? $keywords:"",
   \'gid\' => isset($gotoid)? $gotoid:$modx->documentIdentifier,
   \'noemail\' => isset($noemail)? ($noemail):false,
   \'saveform\' => isset($saveform)? ($saveform? true:false):true,
   \'tpl\' => isset($tpl)? $tpl:"",
   \'report\' => isset($report)? $report:"",
   \'allowhtml\' => isset($allowhtml)? 1:0,
   //Added by JJ
   \'replyto\' => isset($replyto)? $replyto:"",
   \'language\' => isset($language)? $language:$modx->config[\'manager_language\'],
   \'thankyou\' => isset($thankyou)? $thankyou:"",
   \'isDebug\' => isset($debug)? $debug:0,
   \'reportAbuse\' => isset($reportAbuse)? $reportAbuse:false,
   \'disclaimer\' => isset($disclaimer)?$disclaimer:\'\',
   \'sendAsHtml\' => isset($sendAsHtml)?$sendAsHtml:false,
   \'sendAsText\' => isset($sendAsText)?$sendAsText:false,
   \'sessionVars\' => isset($sessionVars)?$sessionVars:false,
   \'postOverides\' => isset($postOverides)?$postOverides:0,
   \'eFormOnBeforeMailSent\' => isset($eFormOnBeforeMailSent)?$eFormOnBeforeMailSent:\'\',
   \'eFormOnMailSent\' => isset($eFormOnMailSent)?$eFormOnMailSent:\'\',
   \'eFormOnValidate\' => isset($eFormOnValidate)?$eFormOnValidate:\'\',
   \'eFormOnBeforeFormMerge\' => isset($eFormOnBeforeFormMerge)?$eFormOnBeforeFormMerge:\'\',
   \'eFormOnBeforeFormParse\' => isset($eFormOnBeforeFormParse)?$eFormOnBeforeFormParse:\'\',
   \'cssStyle\' => isset($cssStyle)?$cssStyle:\'\',
   \'jScript\' => isset($jScript)?$jScript:\'\',
   \'submitLimit\' => (isset($submitLimit) &&  is_numeric($submitLimit))?$submitLimit*60:0,
   \'protectSubmit\' => isset($protectSubmit)?$protectSubmit:1,
   \'requiredClass\' => isset($requiredClass)?$requiredClass:"required",
   \'invalidClass\' => isset($invalidClass)?$invalidClass:"invalid",
   \'runSnippet\' => ( isset($runSnippet) && !is_numeric($runSnippet) )?$runSnippet:\'\',
   \'autoSenderName\' => isset($autoSenderName)?$autoSenderName:\'\',
   \'version\' => \'1.4.4\'
);

# Start processing

include_once ($snipPath."eform.inc.php");

$output = eForm($modx,$params);

# Return
return $output;';
$s['FirstChildRedirect'] = '/**
 * @name FirstChildRedirect
 * @author Jason Coward <jason@opengeek.com>
 * @modified-by Ryan Thrash <ryan@vertexworks.com>
 * @license Public Domain
 * @version 1.0
 * 
 * This snippet redirects to the first child document of a folder in which this
 * snippet is included within the content (e.g. [!FirstChildRedirect!]).  This
 * allows MODx folders to emulate the behavior of real folders since MODx
 * usually treats folders as actual documents with their own content.
 * 
 * Modified to make Doc ID a required parameter... now defaults to the current 
 * Page/Folder you call the snippet from.
 * 
 * &docid=`12` 
 * Use the docid parameter to have this snippet redirect to the
 * first child document of the specified document.
 */

$docid = (isset($docid))? $docid: $modx->documentIdentifier;

$children= $modx->getActiveChildren($docid, \'menuindex\', \'ASC\');
if (!$children === false) {
    $firstChild= $children[0];
    $firstChildUrl= $modx->makeUrl($firstChild[\'id\']);
} else {
    $firstChildUrl= $modx->makeUrl($modx->config[\'site_start\']);
}
return $modx->sendRedirect($firstChildUrl);
';
$s['Jot'] = '/*####
#
#	Name: Jot
#	Version: 1.1.2
#	Author: Armand "bS" Pondman (apondman@zerobarrier.nl)
#	Date: Feb 19, 2006 15:26 CET
#
# Latest Version: http://modxcms.com/Jot-998.html
# Jot Demo Site: http://projects.zerobarrier.nl/modx/
# Documentation: http://wiki.modxcms.com/index.php/Jot (wiki)
#
####*/

$jotPath = $modx->config[\'base_path\']. \'assets/snippets/jot/\';
include_once($jotPath.\'jot.class.inc.php\');

$Jot = new CJot;
$Jot->VersionCheck("1.1.2");
$Jot->Set("path",$jotPath);
$Jot->Set("action", $action);
$Jot->Set("postdelay", $postdelay);
$Jot->Set("docid", $docid);
$Jot->Set("tagid", $tagid);
$Jot->Set("subscribe", $subscribe);
$Jot->Set("moderated", $moderated);
$Jot->Set("captcha", $captcha);
$Jot->Set("badwords", $badwords);
$Jot->Set("bw", $bw);
$Jot->Set("sortby", $sortby);
$Jot->Set("numdir", $numdir);
$Jot->Set("customfields", $customfields);
$Jot->Set("guestname", $guestname);
$Jot->Set("canpost", $canpost);
$Jot->Set("canview", $canview);
$Jot->Set("canedit", $canedit);
$Jot->Set("canmoderate", $canmoderate);
$Jot->Set("trusted", $trusted);
$Jot->Set("pagination", $pagination);
$Jot->Set("placeholders", $placeholders);
$Jot->Set("subjectSubscribe", $subjectSubscribe);
$Jot->Set("subjectModerate", $subjectModerate);
$Jot->Set("notify", $notify);
$Jot->Set("validate", $validate);
$Jot->Set("title", $title);
$Jot->Set("authorid", $authorid);
$Jot->Set("css", $css);
$Jot->Set("cssFile", $cssFile);
$Jot->Set("cssRowAlt", $cssRowAlt);
$Jot->Set("cssRowMe", $cssRowMe);
$Jot->Set("cssRowAuthor", $cssRowAuthor);
$Jot->Set("tplForm", $tplForm);
$Jot->Set("tplComments", $tplComments);
$Jot->Set("tplModerate", $tplModerate);
$Jot->Set("tplNav", $tplNav);
$Jot->Set("tplNotify", $tplNotify);
$Jot->Set("tplNotifyModerator", $tplNotifyModerator);
$Jot->Set("tplSubscribe", $tplSubscribe);
$Jot->Set("debug", $debug);
$Jot->Set("output", $output);
return $Jot->Run();';
$s['ListIndexer'] = '// --------------------
// Snippet: ListIndexer
// --------------------
// Version: 1.0
// Date: 10 Oct 2005
//
// Derived from ListIndex 0.6j by jaredc@honeydewdesign.com
// Now supports Show In Menu
//
// This snippet was designed to be a VERY flexible way
// of showing what has been recently added. You can use
// this snippet to show news from one folder, or what has
// been recently added site wide. You can even show what\'s
// new in a \'section\' (everything under a defined folder)!
//

// Configuration Settings

   // Set the following snippet defaults the way you would normally
   // use this snippet, then use snippet variables in other situations
   // to override the default behaviors.

   // GENERAL OPTIONS

   // $rootFolder [ NULL | string (comma separated page id\'s) ]
   // Decide which folder to pull recent documents from.
   // If you want to specify a few folders, comma separate them.
   // The default NULL will set current page as root. Using 0
   // would search site wide. Can be set with snippet parameter
   // $LIn_root like:
   // [[ListIndexer?LIn_root=3,6,88]] 
   $rootFolder = NULL;

   // $descendentDepth [ int ]
   // How many levels below the root folder(s) do you want to
   // include? Can be overridden in snippet call with LIn_depth:
   // [[ListIndexer?LIn_depth=2]]
   // Uncomment one of these common two or create your own:
   // $descendentDepth = 1; // just children of root folder(s)
   $descendentDepth = 0; // all decendents of root folder(s)

   // $seeThruUnpub [ true | false ]
   // When using descendents, do you want to consider files below
   // an unpublished (hidden) folder? Usually no. But you decide.
   // Snippet parameter: LIn_seeThru
   // [[ListIndexer?LIn_seeThru=1]]
   $seeThruUnpub = false;

   // $seeShowInMenu [ true | false ]
   // When using descendents, do you want to consider files flagged
   // to be hidden from the menus? Usually no. But you decide.
   // Snippet parameter: LIn_seeShowInMenu
   // [[ListIndexer?LIn_seeShowInMenu=1]]
   $seeShowInMenu = false;

   // $mode [ \'short\' | \'full\' ]
   // Defines whether this list should be a full, paged
   // list of all documents, or a short list of the most
   // recent few (how many will be defined next). Can be
   // overridden in snippet call with $LIn_mode:
   // [[ListIndexer?LIn_mode=full]]
   $mode = \'short\';
   
   // $sortBy [ \'alpha\' | \'date\' | \'menuindex\' ]
   // The default date will sort by most recent items first, but
   // by using the \'alpha\' option, and using full mode, you could
   // use this to create an index, or directory.
   // Settable with snippet call $LIn_sort:
   // [[ListIndexer?LIn_sort=alpha]]
   $sortBy = \'date\';
   
   // $sortDir [ \'ASC\' | \'DESC\' ]
   // Sort direction ascending or descending. Is applied to whatever $sortBy
   // field you have chosen above. If left blank, menuindex and alpha will sort
   // ASC and date DESC.
   // $LIn_dir in snippet call:
   // [[ListIndexer?LIn_dir=ASC&LIn_sortBy=menuindex]]
   $sortDir = \'\';

   // WHAT TO DISPLAY

   // $defaultTitle [ string ]
   // If you want a default title for your list
   // you can declare it here. Or use an empty
   // string to leave this off. This can be overridden
   // in the snippet call with the variable $LIn_title:
   // [[ListIndexer?LIn_title=Some new title]]
   $defaultTitle = \'\';

   // $shortDesc [ true | false ]
   // Show the description on the short list, or not. Snippet
   // parameter $LIn_sDesc:
   // [[ListIndexer?LIn_sDesc=0]]
   $shortDesc = true;

   // $fullDesc [ true | false ]
   // Show the description on the full list, or not. Snippet
   // parameter $LIn_fDesc:
   // [[ListIndexer?LIn_fDesc=0]]
   $fullDesc = true;

   // $linkToIndex [ int ]
   // If you have a page set up as an \'index\' for all the 
   // documents in this list, you can link to it by specifying 
   // its id- can also be set in snippet call with LIn_link:
   // [[ListIndexer?LIn_link=8]]
   // The default 0 will eliminate this link
   $linkToIndex = 0;

   // $indexText [ string ]
   // If you want a link to an index (probably a page running this
   // snippet in "full" mode), you can declare what you want that
   // link to say here. Or in the snippet call with LIn_indexText:
   // [[ListIndexer?LIn_indexText=Financial News Index]]
   $indexText = \'Index\';

   // $showCreationDate [ true | false ]
   // Decide to include date of creation in output or not. From
   // snippet call $LIn_showDate use 1 (true) or 0 (false)
   // [[ListIndexer?LIn_showDate=1]]
   $showCreationDate = true;

   // $dateFormat [ string ]
   // Used to define how date will be displayed (if using date)
   // Y = 4 digit year     y = 2 digit year
   // M = Jan - Dec        m = 01 - 12
   // D = Sun - Sat        d = 01 -31
   // Other standard PHP characters may be used
   $dateFormat = \'Y.m.d\';

   // $shortQty [ int ]
   // Number of entries to list in the short list. Can be
   // overridden in snippet call with $LIn_sQty:
   //[[ListIndexer?LIn_sQty=3]]
   $shortQty = 3;

   // PAGING

   // $fullQty [ int ]
   // Number of entries PER PAGE to list in the full list
   // Can be overridden in snippet call with $LIn_fQty:
   // [[ListIndexer?LIn_fQty=20]]
   // To show all set to 0 here or in snippet call
   $fullQty = 10;
   
   // $pageSeparator [ string ]
   // What you want your page number links to be separated by.
   // You NEED to include spaces if you want them. They are NOT
   // created automatically to facilitate styling ability.
   // For instance, " | " will render links like:
   // 1 | 2 | 3 | 4
   $pageSeparator = " | ";
   
   // $pgPosition [ \'top\' | \'bottom\' | \'both\']
   // Pick where you want your pagination links to appear.
   $pgPosition = \'both\';

   // PERFORMANCE

   // $useFastUrls [ true | false ]
   // IMPORTANT- using fast urls will reduce database queries
   // and improve performance WHEN IN FULL MODE ONLY and 
   // should NOT be used when multiple instances of this snippet
   // appear on the same page. With snippet call LIn_fast use 1
   // (true) or 0 (false)
   // [[ListIndexer?LIn_fast=0]]
   $useFastUrls = false;

   // $newLinesForLists [ true | false ]
   // Depending on how you want to style your list, you may
   // or may not want your <li>s on new lines. Generally, if you
   // are displaying then inline (horizontal, you do not want new
   // lines, but standard vertical block styling you do. This is
   // for IE, real browsers don\'t care.
   $newLinesForLists = true;

// Styles
//
// The following are the styles included in this snippet. It is up
// to you to include these styles in your stylesheet to get them to
// look the way you want.

   // div.LIn_title {}          List title div
   // ul.LIn_fullMode {}        UL class
   // ul.LIn_shortMode {}       UL class
   // span.LIn_date {}          Span surrounding pub/created date
   // span.LIn_desc {}          Span surrounding description
   // div.LIn_pagination        Div surrounding pagination links
   // span.LIn_currentPage {}   Span surrounding current page of
   //                           pagination (which wouldn\'t be css-able
   //                           by virtue of its <a> tag)


// **********************************************************************
// END CONFIG SETTINGS
// THE REST SHOULD TAKE CARE OF ITSELF
// **********************************************************************

// Take care of IE list issue
$ie = ($newLinesForLists)? "\\n" : \'\' ;

// Use snippet call defined variables if set
$activeTitle = (isset($LIn_title))? $LIn_title : $defaultTitle ;
$mode = (isset($LIn_mode))? $LIn_mode : $mode ;
$descendentDepth = (isset($LIn_depth))? $LIn_depth : $descendentDepth ;
$seeThruUnpub = (isset($LIn_seeThru))? $LIn_seeThru : $seeThruUnpub ;
$seeShowInMenu = (isset($LIn_seeShowInMenu))? $LIn_seeShowInMenu : $seeShowInMenu ;
$linkToIndex = (isset($LIn_link))? $LIn_link : $linkToIndex ;
$rootFolder = (isset($LIn_root))? $LIn_root : $rootFolder ;
$shortQty = (isset($LIn_sQty))? $LIn_sQty : $shortQty ;
$fullQty = (isset($LIn_fQty))? $LIn_fQty : $fullQty ;
$showCreationDate = (isset($LIn_showDate))? $LIn_showDate : $showCreationDate ;
$indexText = (isset($LIn_indexText))? $LIn_indexText : $indexText ;
$useFastUrls = (isset($LIn_fast))? $LIn_fast : $useFastUrls ;
$sortBy = (isset($LIn_sort))? $LIn_sort : $sortBy;
$shortDesc = (isset($LIn_sDesc))? $LIn_sDesc : $shortDesc ;
$fullDesc = (isset($LIn_fDesc))? $LIn_fDesc : $fullDesc ;
$sortDir = (isset($LIn_dir))? $LIn_dir : $sortDir ;
if ($sortDir == \'\') $sortDir = ($sortBy == \'date\')? \'DESC\' : \'ASC\' ;


// Make useful variable shortcut for the content table
$tbl = $modx->dbConfig[\'dbase\'] . ".`" . $modx->dbConfig[\'table_prefix\'] . "site_content`";

// Initialize output
$output = \'\';

// ---------------------------------------------------
// ---------------------------------------------------
// Query db for parent folders, or not. First check to
// see if a querystring cheat has been provided- this
// should speed things up considerably when using this
// in full mode. (a.k.a. fastUrls)
// ---------------------------------------------------
// ---------------------------------------------------
$inFolder= isset($_GET[\'LIn_f\'])? $_GET[\'LIn_f\']: 0;
if ((!$inFolder && $useFastUrls) || !$useFastUrls ){
  // Only run all the database queries if we don\'t already
  // know the folders AND fastUrls are desired.

  // ---------------------------------------------------
  // Seed list of viable parents
  // ---------------------------------------------------

  if ($rootFolder == NULL){
    $rootFolder = $modx->documentIdentifier;
  }
  // Set root level parent array
  $seedArray = explode(\',\',$rootFolder);
  $parentsArray = array();
  foreach($seedArray AS $seed){
    $parentsArray[\'level_0\'][] = $seed;
  }

  // ---------------------------------------------------
  // Make array of all allowed parents
  // ---------------------------------------------------

  // Process valid parents
  $levelCounter = 1;

  while (((count($parentsArray) < $descendentDepth) || ($descendentDepth == 0)) && ($levelCounter <= count($parentsArray)) && ($levelCounter < 10)){

    // Find all decendant parents for this level
    $pLevel = \'level_\'.($levelCounter - 1);
    $tempLevelArray = $parentsArray[$pLevel];

    foreach($tempLevelArray AS $p){

      // Get children who are parents (isfolder = 1)
      $validParentSql = "";
      $validParentSql .= "SELECT id FROM $tbl WHERE ";
      $validParentSql .= "isfolder = 1 AND parent = $p ";
      $validParentSql .= "AND $tbl.deleted=0 ";
      $validParentSql .= ($seeThruUnpub)? ";" : "AND $tbl.published = 1;";

      // Run statement
      $rsTempParents = $modx->dbQuery($validParentSql);
      // Get number of results
      $countTempParents = $modx->recordCount($rsTempParents);

      // If there are results, put them in an array
      $tempValidArray = false;
      if ($countTempParents){
        for ($i=0;$i<$countTempParents;$i++){
          $tempId = $modx->fetchRow($rsTempParents);
          $tempValidArray[] = $tempId[\'id\'];
        } // end while
      } // end if

	  // populate next level of array 
	  if ($tempValidArray){
	    foreach($tempValidArray AS $kid){
	      $kidLevel = \'level_\'.$levelCounter;
	      $parentsArray[$kidLevel][] = $kid;
	    } // end foreach

	  } // end if
    } // end foreach

    // Do next level
    $levelCounter++;

  } // end while

  // Finalize list of parents
  $validParents = \'\';
  foreach ($parentsArray AS $level){
    foreach ($level AS $validP){
      $validParents .= $validP . \',\';
    }
  }

  // Remove trailing comma
  $validParents = substr($validParents,0,strlen($validParents)-1);

} else {
  $validParents = $_GET[\'LIn_f\'];
}

// ---------------------------------------------------
// Make appropriate SQL statement to pull recent items
// ---------------------------------------------------

// Initialize
$recentSql = "";
$recentSql .= "SELECT id, pagetitle, description";
// Include pub_date or createdon date if date is desired
$recentSql .= ($showCreationDate)? ", IF(pub_date > 0, pub_date, createdon) AS pubDate ": " " ;
$recentSql .= "FROM $tbl ";
$recentSql .= "WHERE ";
// Look everywhere, or just under valid parents
$recentSql .= (($rootFolder == 0) && $seeThruUnpub && ($descendentDepth == 0))? "" : "parent IN ($validParents) AND " ;
// Published
$recentSql .= "$tbl.published = 1 ";
// Show In Menu
$recentSql .= ($seeShowInMenu)? " " : " AND $tbl.hidemenu=0 " ;
// Not deleted
$recentSql .= "AND $tbl.deleted=0 ";
// Choose sort method
switch ($sortBy){
  case \'alpha\':
    $recentSql .= "ORDER BY pagetitle ";
    break;
  case \'menuindex\':
    $recentSql .= "ORDER BY menuindex ";
    break;
  default:
    $recentSql .= "ORDER BY IF(pub_date>0, pub_date, createdon) ";
    break;
}
// Provide a sort direction
$recentSql .= $sortDir;

// If this is a short list, just pull a limited number
$recentSql .= ($mode == \'short\')? " LIMIT $shortQty;" : ";" ;

// Run statement
$rsRecent = $modx->dbQuery($recentSql);
// Count records
$recentLimit = $modx->recordCount($rsRecent);

// ---------------------------------------------------
// Generate pagination string if needed
// ---------------------------------------------------
$offsetParam = isset($_GET[\'LIn_o\'])? $_GET[\'LIn_o\']: 0;
$offset = ($offsetParam && ($mode == \'full\'))? $offsetParam : 0 ;
$pagination = \'\';

// Don\'t bother unless there are enough records to justify it
if ( ($mode == \'full\') && ($recentLimit > $fullQty) && ($fullQty) ){
  $fullUrl = $_SERVER[\'REQUEST_URI\'];
  $urlPieces = parse_url($fullUrl);
  $urlPath = $urlPieces[\'path\'];
  $otherQs = \'\';

  if ($urlPieces[\'query\']){
    foreach($_GET AS $qsKey=>$qsValue){
	  if (($qsKey != \'LIn_o\') && ($qsKey != \'LIn_f\')){
	    $otherQs .= \'&\'.$qsKey.\'=\'.$qsValue;
	  }
	}
  } 
  
  $fastUrl = $urlPath.\'?LIn_f=\'.$validParents.$otherQs;

  // Determine number of pages needed to show results
  $totalPages = ceil($recentLimit/$fullQty);
  
  // Make links
  for ($j = 0 ; $j < $totalPages; $j++){
    // only include links to OTHER pages, not current page
    if($offset == $j*$fullQty){
	  $pagination .= \'<span class="LIn_currentPage">\'.($j+1) .\'</span>\';
	} else {
      $pagination .= \'<a href="\'.$fastUrl.\'&LIn_o=\'.($j*$fullQty).\'" title="\'.($j+1).\'">\'.($j+1) .\'</a>\';
	}
	if ($j < $totalPages-1){
	  $pagination .= $pageSeparator;
	}
  }
  
  // Make final pagination link set in it\'s own div
  $pagination = \'<div class="LIn_pagination">\'."\\n".$pagination."\\n</div>\\n";
  
}


// ---------------------------------------------------
// Create title if wanted
// ---------------------------------------------------

if ($activeTitle){
  $output .= \'<div class="LIn_title">\'.$activeTitle.\'</div>\'."\\n";
}

// ---------------------------------------------------
// Create list of recent items
// ---------------------------------------------------

// Include pagination
$output .= ($pgPosition == \'top\' || $pgPosition == \'both\')? $pagination : \'\' ;

$output .= \'<ul class="LIn_\'.$mode.\'Mode">\' . $ie;

$recentCounter = $offset;
if ($mode == \'short\') {
  $recentCounterLimit = min($shortQty,$recentLimit);
} else {
  $recentCounterLimit = ($fullQty)? min(($fullQty+$offset),$recentLimit) : $recentLimit ;
}

while (($recentCounter < $recentCounterLimit) && $rsRecent && ($recentLimit > 0)){
  mysql_data_seek($rsRecent,$recentCounter);
  $recentRecord = $modx->fetchRow($rsRecent);
  $output .= \'<li>\';
  // Link to page
  $output .= \'<a href="[~\'.$recentRecord[\'id\'].\'~]" title="\'.strip_tags($recentRecord[\'pagetitle\']).\'">\'.$recentRecord[\'pagetitle\'].\'</a> \';
  // Date if desired
  if ($showCreationDate){
    $output .= \'<span class="LIn_date">\'.date($dateFormat,$recentRecord[\'pubDate\']).\'</span> \';
  }
  // Description if desired
  if ((($mode == \'short\') && ($shortDesc)) || (($mode == \'full\') && ($fullDesc))){
   $output .= \'<span class="LIn_desc">\'.$recentRecord[\'description\'].\'</span>\';
  }
  // wrap it up
  $output .= \'</li>\' . $ie;
  $recentCounter ++;
}

$output .= \'</ul>\' . $ie;

$output .= ($pgPosition == \'bottom\' || $pgPosition == \'both\')? $pagination : \'\' ;

// ---------------------------------------------------
// Link to index
// ---------------------------------------------------

if ($linkToIndex) {

  $output .= \'<div class="LIn_index">\';
  $output .= \'<a href="[~\'.$linkToIndex.\'~]" title="\'.$indexText.\'">\'.$indexText.\'</a>\';
  $output .= \'</div>\';

}

// ---------------------------------------------------
// Send to browser
// ---------------------------------------------------

return $output;';
$s['MemberCheck'] = '#::::::::::::::::::::::::::::::::::::::::
# Snippet name: MemberCheck 
# Short Desc: checks logged in groups and displays a chunk
# Version: 1.0
# Created By Ryan Thrash (vertexworks.com)
# Sanitized By Jason Coward (opengeek.com)
#
# Date: November 29, 2005
#
# Changelog: 
# Nov 29, 05 -- initial release
# Jul 13, 06 -- adjusted Singleton to work under PHP4, added placeholder code (by: garryn)
#
#::::::::::::::::::::::::::::::::::::::::
# Description: 	
#	Checks to see if users belong to a certain group and 
#	displays the specified chunk if they do. Performs several
#	sanity checks and allows to be used multiple times on a page.
#
# Params:
#	&groups [array] (REQUIRED)
#		array of webuser group-names to check against
#
#	&chunk [string] (REQUIRED)
#		name of the chunk to use if passes the check
#
#	&ph [string] (optional)
#		name of the placeholder to set instead of directly retuning chunk
#
#	&debug [boolean] (optional | false) 
#		turn on debug mode for extra troubleshooting
#
# Example Usage:
#
#	[[MemberCheck? &groups=`siteadmin, registered users` &chunk=`privateSiteNav` &ph=`MemberMenu` &debug=`true`]]
#
#	This would place the \'members-only\' navigation store in the chunk \'privateSiteNav\'
#	into a placeholder (called \'MemberMenu\'). It will only do this as long as the user 
#	is logged in as a webuser and is a member of the \'siteadmin\' or the \'registered users\'
#	groups. The optional debug parameter can be used to display informative error messages 
#	when configuring this snippet for your site. For example, if the developer had 
#	mistakenly typed \'siteowners\' for the first group, and none existed with debug mode on, 
#	it would have returned the error message: The group siteowners could not be found....
#
#::::::::::::::::::::::::::::::::::::::::

# debug parameter
$debug = isset ($debug) ? $debug : false;

# check if inside manager
if ($m = $modx->insideManager()) {
	return \'\'; # don\'t go any further when inside manager
}

if (!isset ($groups)) {
	return $debug ? \'<p>Error: No Group Specified</p>\' : \'\';
}

if (!isset ($chunk)) {
	return $debug ? \'<p>Error: No Chunk Specified</p>\' : \'\';
}

# turn comma-delimited list of groups into an array
$groups = explode(\',\', $groups);

if (!class_exists(\'MemberCheck\')) {
	class MemberCheck {
		var $allGroups = NULL;
		var $debug;

		function getInstance($debug) {
			static $instance;
			if (!isset ($instance)) {
				$instance = new MemberCheck($debug);
			}
			return $instance;
		}

		function MemberCheck($debug = false) {
			global $modx;

			$this->debug = $debug;
			if ($debug) {
				$this->allGroups = array ();
				$tableName = $modx->getFullTableName(\'webgroup_names\');
				$sql = "SELECT name FROM $tableName";
				if ($rs = $modx->db->query($sql)) {
					while ($row = $modx->db->getRow($rs)) {
						array_push($this->allGroups, stripslashes($row[\'name\']));
					}
				}
			}
		}

		function isValidGroup($groupName) {
			$isValid = !(array_search($groupName, $this->allGroups) === false);
			return $isValid;
		}

		function getMemberChunk(& $groups, $chunk) {
			global $modx;
			$o = \'\';
			if (is_array($groups)) {
				for ($i = 0; $i < count($groups); $i++) {
					$groups[$i] = trim($groups[$i]);
					if ($this->debug) {
						if (!$this->isValidGroup($groups[$i])) {
							return "<p>The group <strong>" . $groups[$i] . "</strong> could not be found...</p>";
						}
					}
				}

				$check = $modx->isMemberOfWebGroup($groups);

				$chunkcheck = $modx->getChunk($chunk);

				$o .= ($check && $chunkcheck) ? $chunkcheck : \'\';
				if (!$chunkcheck)
					$o .= $this->debug ? "<p>The chunk <strong>$chunk</strong> not found...</p>" : \'\';
			} else {
				$o .= "<p>No valid group names were specified!</p>";
			}

			return $o;
		}
	}
}

$memberCheck = MemberCheck :: getInstance($debug);

if (!isset ($ph)) {
	return $memberCheck->getMemberChunk($groups, $chunk);
} else {
	$modx->setPlaceholder($ph, $memberCheck->getMemberChunk($groups, $chunk));
	return \'\';
}';
$s['NewsPublisher'] = '#::::::::::::::::::::::::::::::::::::::::
#
#  Snippet Name: NewsPublisher 
#  Short Desc: Create articles directly from front end (news, blogs, PR, etc.)
#  Created By: Raymond Irving (xwisdom@yahoo.com), August 2005
#
#  Version: 1.4
#  Modified: December 13, 2005
#
#  Changelog: 
#	 Mar 05, 06 -- modx_ prefix removed [Mark]
#    Dec 13, 05 -- Now inherrits web/manager docgroups thanks to Jared Carlow
#
#::::::::::::::::::::::::::::::::::::::::
#  Description: 	
#    Checks to see if users belong to a certain group and 
#    displays the specified chunk if they do. Performs several
#    sanity checks and allows to be used multiple times on a page.
#    Only meant to be used once per page.
#::::::::::::::::::::::::::::::::::::::::
#  
#  Parameters:
#    &folder      - folder id where comments are stored
#    &makefolder  - set to 1 to automatically convert the parent document to a folder. Defaults to 0
#    &postid      - document id to load after posting news item. Defaults to the page created
#    &canpost     - comma delimitted web groups that can post comments. leave blank for public posting
#    &badwords    - comma delimited list of words not allowed in post
#    &template    - name of template to use for news post
#    &headertpl   - header template (chunk name) to be inserted at the begining of the news content
#    &footertpl   - footer template (chunk name) to be inserted at the end of the news content
#    &formtpl     - form template (chunk name)
#    &rtcontent   - name of a richtext content form field 
#    &rtsummary   - name of a richtext summary form field 
#    &showinmenu  - sets the flag to true or false (1|0) as to whether or not it shows in the menu. defaults to false (0)
#    &aliastitle  - set to 1 to use page title as alias suffix. Defaults to 0 - date created.
#    &clearcache  - when set to 1 the system will automatically clear the site cache after publishing an article.
#  
#::::::::::::::::::::::::::::::::::::::::

// get user groups that can post articles
$postgrp = isset($canpost) ? explode(",",$canpost):array();
$allowAnyPost = count($postgrp)==0 ? true : false;

// get clear cache
$clearcache	 = isset($clearcache) ? 1:0;

// get alias title
$aliastitle	 = isset($aliastitle) ? 1:0;

// get folder id where we should store articles
// else store in current document
$folder = isset($folder) ? intval($folder):$modx->documentIdentifier;

// set rich text content field
$rtcontent = isset($rtcontent) ? $rtcontent:\'content\';

// set rich text summary field
$rtsummary = isset($rtsummary) ? $rtsummary:\'introtext\';

// get header
$header = isset($headertpl) ? "{{".$headertpl."}}":\'\';

// get footer
$footer = isset($footertpl) ? "{{".$footertpl."}}":\'\';

// get postback status
$isPostBack = isset($_POST[\'NewsPublisherForm\']) ? true:false;

// get badwords
if(isset($badwords)) {
    $badwords = str_replace(\' \',\'\', $badwords);
    $badwords = "/".str_replace(\',\',\'|\', $badwords)."/i";
}

// get menu status
$hidemenu = isset($showinmenu) && $showinmenu==1 ? 0 : 1;

// get template
$template = isset($template) ? $modx->db->getValue(\'SELECT id FROM \'.$modx->getFullTableName(\'site_templates\').\' WHERE templatename=\\\'\'.mysql_escape_string($template).\'\\\'\'):$modx->config[\'default_template\'];

$message = \'\';

// get form template
if(isset($formtpl)) $formTpl = $modx->getChunk($formtpl);
if(empty($formTpl)) $formTpl = \'
    <form name="NewsPublisher" method="post">
        <input name="NewsPublisherForm" type="hidden" value="on" />
        Page title:<br /><input name="pagetitle" type="text" size="40" value="[+pagetitle+]" /><br />
        Long title:<br /><input name="longtitle" type="text" size="40" value="[+longtitle+]" /><br />
        Description:<br /><input name="description" type="text" size="40" value="[+description+]" /><br />
        Published date:<br /><input name="pub_date" type="text" value="[+pub_date+]" size="40" readonly="readonly" />
        <a onClick="nwpub_cal1.popup();" onMouseover="window.status=\\\'Select date\\\'; return true;" onMouseout="window.status=\\\'\\\'; return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle" src="manager/media/images/icons/cal.gif" width="16" height="16" border="0" alt="Select date" /></a>
        <a onClick="document.NewsPublisher.pub_date.value=\\\'\\\'; return true;" onMouseover="window.status=\\\'Remove date\\\'; return true;" onMouseout="window.status=\\\'\\\'; return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle" src="manager/media/images/icons/cal_nodate.gif" width="16" height="16" border="0" alt="Remove date"></a><br />
        Unpublished date:<br /><input name="unpub_date" type="text" value="[+unpub_date+]" size="40" readonly="readonly" />
        <a onClick="nwpub_cal2.popup();" onMouseover="window.status=\\\'Select date\\\'; return true;" onMouseout="window.status=\\\'\\\'; return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle" src="manager/media/images/icons/cal.gif" width="16" height="16" border="0" alt="Select date" /></a>
        <a onClick="document.NewsPublisher.unpub_date.value=\\\'\\\'; return true;" onMouseover="window.status=\\\'Remove date\\\'; return true;" onMouseout="window.status=\\\'\\\'; return true;" style="cursor:pointer; cursor:hand"><img align="absmiddle" src="manager/media/images/icons/cal_nodate.gif" width="16" height="16" border="0" alt="Remove date"></a><br />
        Summary:<br /><textarea name="introtext" cols="50" rows="5">[+introtext+]</textarea><br />
        Content:<br /><textarea name="content" cols="50" rows="8">[+content+]</textarea><br />
        <input name="send" type="submit" value="Submit" />
    </form>
    <script language="JavaScript" src="manager/media/script/datefunctions.js"></script>
    <script type="text/javascript">
        var elm_txt = {}; // dummy
        var pub = document.forms["NewsPublisher"].elements["pub_date"];
        var nwpub_cal1 = new calendar1(pub,elm_txt);
        nwpub_cal1.path="[(base_url)]manager/media/";
        nwpub_cal1.year_scroll = true;
        nwpub_cal1.time_comp = true;	

        var unpub = document.forms["NewsPublisher"].elements["unpub_date"];
        var nwpub_cal2 = new calendar1(unpub,elm_txt);
        nwpub_cal2.path="[(base_url)]manager/media/";
        nwpub_cal2.year_scroll = true;
        nwpub_cal2.time_comp = true;	
    </script>\';


// switch block
switch ($isPostBack) {
    case true:
        // process post back
        // remove magic quotes from POST
        if(get_magic_quotes_gpc()){
            $_POST = array_map("stripslashes", $_POST);
        }	
        if(trim($_POST[\'pagetitle\'])==\'\') $modx->webAlert(\'Missing page title.\');
        elseif($_POST[$rtcontent]==\'\') $modx->webAlert(\'Missing news content.\');
        else {
            // get created date
            $createdon = time();

            // set alias name of document used to store articles
            if(!$aliastitle) $alias = \'article-\'.$createdon;
            else {
                $alias = $modx->stripTags($_POST[\'pagetitle\']);
                $alias = strtolower($alias);
                $alias = preg_replace(\'/&.+?;/\', \'\', $alias); // kill entities
                $alias = preg_replace(\'/[^\\.%a-z0-9 _-]/\', \'\', $alias);
                $alias = preg_replace(\'/\\s+/\', \'-\', $alias);
                $alias = preg_replace(\'|-+|\', \'-\', $alias);
                $alias = trim($alias, \'-\');			
                $alias = \'article-\'.$modx->db->escape($alias);
            }

            $user = $modx->getLoginUserName();
            $userid = $modx->getLoginUserID();
            if(!$user && $allowAnyPost) $user = \'anonymous\';

            // check if user has rights
            if(!$allowAnyPost && !$modx->isMemberOfWebGroup($postgrp)) {
                return \'You are not allowed to publish articles\';
            }

            $allowedTags = \'<p><br><a><i><em><b><strong><pre><table><th><td><tr><img><span><div><h1><h2><h3><h4><h5><font><ul><ol><li><dl><dt><dd>\';

            // format content
            $content = $modx->stripTags($_POST[$rtcontent],$allowedTags);
            $content = str_replace(\'[+user+]\',$user,$content);
            $content = str_replace(\'[+createdon+]\',strftime(\'%d-%b-%Y %H:%M\',$createdon),$content);
            foreach($_POST as $n=>$v) {
                if(!empty($badwords)) $v = preg_replace($badwords,\'[Filtered]\',$v); // remove badwords
                $v = $modx->stripTags(htmlspecialchars($v));
                $v = str_replace("\\n",\'<br />\',$v);
                $content = str_replace(\'[+\'.$n.\'+]\',$v,$content);
            }

            $title = mysql_escape_string($modx->stripTags($_POST[\'pagetitle\']));
            $longtitle = mysql_escape_string($modx->stripTags($_POST[\'longtitle\']));
            $description = mysql_escape_string($modx->stripTags($_POST[\'description\']));
            $introtext = mysql_escape_string($modx->stripTags($_POST[$rtsummary],$allowedTags));
            $pub_date = $_POST[\'pub_date\'];
            $unpub_date = $_POST[\'unpub_date\'];
            $published = 1;

            // check published date
            if($pub_date=="") {
                $pub_date="0";
            } else {
                list($d, $m, $Y, $H, $M, $S) = sscanf($pub_date, "%2d-%2d-%4d %2d:%2d:%2d");
                $pub_date = strtotime("$m/$d/$Y $H:$M:$S");

                if($pub_date < $createdon) {
                    $published = 1;
                }    elseif($pub_date > $createdon) {
                    $published = 0;	
                }
            }

            // check unpublished date
            if($unpub_date=="") {
                $unpub_date="0";
            } else {
                list($d, $m, $Y, $H, $M, $S) = sscanf($unpub_date, "%2d-%2d-%4d %2d:%2d:%2d");
                $unpub_date = strtotime("$m/$d/$Y $H:$M:$S");
                if($unpub_date < $createdon) {
                    $published = 0;
                }
            }

            // set menu index
            $mnuidx = $modx->db->getValue(\'SELECT MAX(menuindex)+1 as \\\'mnuidx\\\' FROM \'.$modx->getFullTableName(\'site_content\').\' WHERE parent=\\\'\'.$folder.\'\\\'\');
            if($mnuidx<1) $mnuidx = 0;

            // post news content
            $flds = array(
                \'pagetitle\'     => $title,
                \'longtitle\'     => $longtitle,
                \'description\' => $description,
                \'introtext\'     => $introtext,
                \'alias\'             => $alias,
                \'parent\'            => $folder, 
                \'createdon\'     => $createdon,
                \'createdby\'     => ($userid>0 ? $userid * -1:0),
                \'editedon\'        => \'0\',
                \'editedby\'        => \'0\',
                \'published\'     => $published,
                \'pub_date\'        => $pub_date,
                \'unpub_date\'    => $unpub_date,
                \'deleted\'         => \'0\',
                \'hidemenu\'        => $hidemenu,
                \'menuindex\'     => $mnuidx,
                \'template\'        => $template,
                \'content\'         => mysql_escape_string($header.$content.$footer)
            );
            $redirectid = $modx->db->insert($flds,$modx->getFullTableName(\'site_content\'));

            // Doc group thing
            // look in save_content.processor.php for tips (or below)
            $lastInsertId = $modx->db->getInsertId();

            // Get doc groups based on $folder (parent id)
            $parentDocGroupsSql = "SELECT * FROM " . $modx->getFullTableName(\'document_groups\'). " where document=".$folder;
            $parentDocGroupsRs = $modx->db->query($parentDocGroupsSql);
            $parentDocGroupsLimit = $modx->db->getRecordCount($parentDocGroupsRs);
            for ($pdgi = 0; $pdgi < $parentDocGroupsLimit; $pdgi++) { 
                $currentDocGroup = $modx->db->getRow($parentDocGroupsRs);
                $parentDocGroupsArray[$pdgi] = $currentDocGroup[\'document_group\'];
            }

            // put the document in the document_groups it should be in
            // check that up_perms are switched on!
            if($modx->config[\'use_udperms\']==1) {
                if(is_array($parentDocGroupsArray)) {
                    foreach ($parentDocGroupsArray as $dgKey=>$dgValue) {
                        $insertDocSql = "INSERT INTO ".$modx->getFullTableName(\'document_groups\')."(document_group, document) values(".stripslashes($dgValue).", $lastInsertId)";
                        $insertDocRs = $modx->db->query($insertDocSql);
                        if(!$insertDocRs){
                            exit;
                        }
                    } // end foreach
                } // end if doc group array exists
            } // end if perms are used

            // Handle privateweb
            $modx->db->query("UPDATE ".$modx->getFullTableName("site_content")." SET privateweb = 0 WHERE id=\'$lastInsertId\';");
            $privatewebSql =    "
                SELECT DISTINCT ".$modx->getFullTableName(\'document_groups\').".document_group 
                FROM ".$modx->getFullTableName(\'document_groups\').", ".$modx->getFullTableName(\'webgroup_access\')." 
                WHERE 
                ".$modx->getFullTableName(\'document_groups\').".document_group = ".$modx->getFullTableName(\'webgroup_access\').".documentgroup 
                AND 
                ".$modx->getFullTableName(\'document_groups\').".document = $lastInsertId;";
                $privatewebIds = $modx->db->getColumn("document_group",$privatewebSql);
                if(count($privatewebIds)>0) {
                    $modx->db->query("UPDATE ".$modx->getFullTableName("site_content")." SET privateweb = 1 WHERE id = $lastInsertId;");	
                }

                // And privatemgr
                $modx->db->query("UPDATE ".$modx->getFullTableName("site_content")." SET privatemgr = 0 WHERE id=\'$lastInsertId\';");
                $privatemgrSql =    "
                    SELECT DISTINCT ".$modx->getFullTableName(\'document_groups\').".document_group 
                    FROM ".$modx->getFullTableName(\'document_groups\').", ".$modx->getFullTableName(\'membergroup_access\')." 
                    WHERE 
                    ".$modx->getFullTableName(\'document_groups\').".document_group = ".$modx->getFullTableName(\'membergroup_access\')." .documentgroup 
                    AND 
                    ".$modx->getFullTableName(\'document_groups\').".document = $lastInsertId;";
                    $privatemgrIds = $modx->db->getColumn("document_group",$privatemgrSql);
                    if(count($privatemgrIds)>0) {
                        $modx->db->query("UPDATE ".$modx->getFullTableName("site_content")." SET privatemgr = 1 WHERE id = $lastInsertId;");	
                    }
            // end of document_groups stuff!

            if(!empty($makefolder)) {
                // convert parent into folder
                $modx->db->update(array(\'isfolder\'=>\'1\'),$modx->getFullTableName(\'site_content\'),\'id=\\\'\'.$folder.\'\\\'\');
            }

            // empty cache
            if($clearcache==1){
                include_once $modx->config[\'base_path\']."manager/processors/cache_sync.class.processor.php";
                $sync = new synccache();
                $sync->setCachepath("assets/cache/");
                $sync->setReport(false);
                $sync->emptyCache(); // first empty the cache		
            }

            // get redirect/post id
            $redirectid = $modx->db->getValue(\'SELECT id as \\\'redirectid\\\' FROM \'.$modx->getFullTableName(\'site_content\').\' WHERE createdon=\\\'\'.$createdon.\'\\\'\');
            $postid = isset($postid) ? $postid:$redirectid;

            // redirect to post id
            $modx->sendRedirect($modx->makeUrl($postid));
        }

    default: 
        // display news form
        // check if user has rights to post comments
        if(!$allowAnyPost && !$modx->isMemberOfWebGroup($postgrp)) {
            $formTpl = \'\';
        } else {
            foreach($_POST as $n=>$v) {
                $formTpl = str_replace(\'[+\'.$n.\'+]\',$v,$formTpl);
            }
        }
        // return form
        return $message.$formTpl;
        break;
}';
$s['Personalize'] = '#::::::::::::::::::::::::::::::::::::::::
# Snippet Name: Personalize 
# Short Desc: calls a chunk if the user is logged in, otherwise calls another
# Version: 2.0
# Created By: 	Ryan Thrash (modx@vertexworks.com), and then
#		powered up by kudo (kudo@kudolink.com)
#
# Date: Aug 03, 2006
#
# Changelog: 
# Dec 01, 05 -- initial release
# Jun 19, 06 -- updated description
# Jul 19, 06 -- hacked by kudo to output chunks
# Aug 03, 06 -- added placeholder for username
#
#::::::::::::::::::::::::::::::::::::::::
# Description: 	
#	Checks to see if webusers are logged in and displays yesChunk if the user
#	is logged or noChunk if user is not logged. Insert only the chunk name as
#	param, without {{}}. Can use a placeholder to output the username.
#	TESTED: can be used more than once per page.
#	TESTED: chunks can contain snippets.
#	
#	
# Params:
#	&yesChunk [string] [REQUIRED]
#		Output for LOGGED users
#
#	&noChunk [string] [REQUIRED] 
#		Output for NOT logged users
#
#	&ph [string] (optional) 
#		Placeholder for placing the username
#		ATTENTION!: place this ph only in yesChunk!
#	
#
# Example Usage:
#
#	[[LoggedOrNot? &yesChunk=`Link` &noChunk=`Register` &ph=`name`]]
#
#	Having Chunks named {{Link}} and another {{Register}}, the first will be
#	published to registered user, the second to non-registered users.
#
#::::::::::::::::::::::::::::::::::::::::

# prepare params and variables
$o = \'\';
$yesChunk = (isset($yesChunk))? $yesChunk : \'\';
$noChunk = (isset($noChunk))? $noChunk : \'\';

# do the work
$test = $modx->getLoginUserName();
if ($test) {
    $o = $modx->getChunk($yesChunk);
  } else {
    $o = $modx->getChunk($noChunk);
}

if (isset($ph)) {
	$modx->setPlaceholder($ph,$test);
	return $o;
} else {
	return $o;
}
';
$s['Reflect'] = ' 

/*
 * Title: Reflect Snippet
 * 
 * Description: 
 * 		Generates date based archives using Ditto
 * 
 * Author: 
 * 		Mark Kaplan for MODx CMF
 * 
 * Version: 
 * 		2.1.1.SVN
 * 
 * Note: 
 * 		If Reflect is not retrieving its own documents, make sure that the
 *			Ditto call feeding it has all of the fields in it that you plan on
 *       calling in your Reflect template. Furthermore, Reflect will ONLY
 *			show what is currently in the Ditto result set.
 *       Thus, if pagination is on it will ONLY show that page\'s items.
*/
 

// ---------------------------------------------------
//  Includes
// ---------------------------------------------------

$reflect_base = isset($reflect_base) ? $modx->config[\'base_path\'].$reflect_base : $modx->config[\'base_path\']."assets/snippets/reflect/";
/*
	Param: ditto_base
	
	Purpose:
	Location of Ditto files

	Options:
	Any valid folder location containing the Ditto source code with a trailing slash

	Default:
	[(base_path)]assets/snippets/ditto/
*/

$config = (isset($config)) ? $config : "default";
/*
	Param: config

	Purpose:
 	Load a custom configuration

	Options:
	"default" - default blank config file
	CONFIG_NAME - Other configs installed in the configs folder or in any folder within the MODx base path via @FILE

	Default:
	"default"
	
	Related:
	- <extenders>
*/

require($reflect_base."configs/default.config.php");
require($reflect_base."default.templates.php");
if ($config != "default") {
	require((substr($config, 0, 5) != "@FILE") ? $reflect_base."configs/$config.config.php" : $modx->config[\'base_path\'].trim(substr($config, 5)));
}

// ---------------------------------------------------
//  Parameters
// ---------------------------------------------------

$id = isset($id) ? $id."_" : false;
/*
	Param: id

	Purpose:
	Unique ID for this Ditto instance for connection with other scripts (like Reflect) and unique URL parameters

	Options:
	Any valid folder location containing the Ditto source code with a trailing slash

	Default:
	"" - blank
*/
$getDocuments = isset($getDocuments) ? $getDocuments : 0;
/*
	Param: getDocuments

	Purpose:
 	Force Reflect to get documents

	Options:
	0 - off
	1 - on
	
	Default:
	0 - off
*/
$showItems = isset($showItems) ? $showItems : 1;
/*
	Param: showItems

	Purpose:
 	Show individual items in the archive

	Options:
	0 - off
	1 - on
	
	Default:
	1 - on
*/
$groupByYears = isset($groupByYears)? $groupByYears : 1;
/*
	Param: groupByYears

	Purpose:
 	Group the archive by years

	Options:
	0 - off
	1 - on
	
	Default:
	1 - on
*/
$targetID = isset($targetID) ? $targetID : $modx->documentObject[\'id\'];
/*
	Param: targetID

	Purpose:
 	ID for archive links to point to

	Options:
	Any MODx document with a Ditto call setup with extenders=`dateFilter`
	
	Default:
	Current MODx Document
*/
$dateSource = isset($dateSource) ? $dateSource : "createdon";
/*
	Param: dateSource

	Purpose:
	Date source to display for archive items

	Options:
	# - Any UNIX timestamp from MODx fields or TVs such as createdon, pub_date, or editedon
	
	Default:
	"createdon"
	
	Related:
	- <dateFormat>
*/
$dateFormat = isset($dateFormat) ? $dateFormat : "%d-%b-%y %H:%M";	
/*
	Param: dateFormat

	Purpose:
	Format the [+date+] placeholder in human readable form

	Options:
	Any PHP valid strftime option

	Default:
	"%d-%b-%y %H:%M"
	
	Related:
	- <dateSource>
*/
$yearSortDir = isset($yearSortDir) ? $yearSortDir : "DESC";
/*
	Param: yearSortDir

	Purpose:
 	Direction to sort documents

	Options:
	ASC - ascending
	DESC - descending

	Default:
	"DESC"
	
	Related:
	- <monthSortDir>
*/
$monthSortDir = isset($monthSortDir) ? $monthSortDir : "ASC";
/*
	Param: monthSortDir

	Purpose:
 	Direction to sort the months

	Options:
	ASC - ascending
	DESC - descending

	Default:
	"ASC"
	
	Related:
	- <yearSortDir>
*/
$start = isset($start)? intval($start) : 0;
/*
	Param: start

	Purpose:
 	Number of documents to skip in the results
	
	Options:
	Any number

	Default:
	0
*/	
$phx = (isset($phx))? $phx : 1;
/*
	Param: phx

	Purpose:
 	Use PHx formatting

	Options:
	0 - off
	1 - on
	
	Default:
	1 - on
*/

// ---------------------------------------------------
//  Initialize Ditto
// ---------------------------------------------------
$placeholder = ($id != false && $getDocuments == 0) ? true : false;
if ($placeholder === false) {
	$rID = "reflect_".rand(1,1000);
	$itemTemplate = isset($tplItem) ? $tplItem: "@CODE:".$defaultTemplates[\'item\'];
	$dParams = array(
		"id" => "$rID",
		"save" => "3",	
		"summarize" => "all",
		"tpl" => $itemTemplate,
	);
	
	$source = $dittoSnippetName;
	$params = $dittoSnippetParameters;
		// TODO: Remove after 3.0
		
	if (isset($params)) {
		$givenParams = explode("|",$params);
		foreach ($givenParams as $parameter) {
			$p = explode(":",$parameter);
			$dParams[$p[0]] = $p[1];
		}
	}
	/*
		Param: params

		Purpose:
	 	Pass parameters to the Ditto instance used to retreive the documents

		Options:
		Any valid ditto parameters in the format name:value 
		with multiple parameters separated by a pipe (|)
		
		Note:
		This parameter is only needed for config, start, and phx as you can
		now simply use the parameter as if Reflect was Ditto

		Default:
		[NULL]
	*/
	
	$allParameters = func_get_args();
	$reflectParameters = array(\'reflect_base\',\'config\',\'id\',\'getDocuments\',\'showItems\',\'groupByYears\',\'targetID\',\'yearSortDir\',\'monthSortDir\',\'start\',\'phx\',\'tplContainer\',\'tplYear\',\'tplMonth\',\'tplMonthInner\',\'tplItem\',\'save\');
	foreach ($allParameters[1] as $param=>$value) {
		if (!in_array($param,$reflectParameters) && substr($param,-3) != \'tpl\') {
			$dParams[$param] = $value;
		}
	}

	$source = isset($source) ? $source : "Ditto";
	/*
		Param: source

		Purpose:
		Name of the Ditto snippet to use

		Options:
		Any valid snippet name

		Default:
		"Ditto"
	*/
	$snippetOutput = $modx->runSnippet($source,$dParams);
	$ditto = $modx->getPlaceholder($rID."_ditto_object");
	$resource = $modx->getPlaceholder($rID."_ditto_resource");
} else {
	$ditto = $modx->getPlaceholder($id."ditto_object");
	$resource = $modx->getPlaceholder($id."ditto_resource");
}
if (!is_object($ditto) || !isset($ditto) || !isset($resource)) {
	return !empty($snippetOutput) ? $snippetOutput : "The Ditto object is invalid. Please check it.";
}

// ---------------------------------------------------
//  Templates
// ---------------------------------------------------

$templates[\'tpl\'] = isset($tplContainer) ? $ditto->template->fetch($tplContainer): $defaultTemplates[\'tpl\'];
/*
	Param: tplContainer

	Purpose:
	Container template for the archive

	Options:
	- Any valid chunk name
	- Code via @CODE:
	- File via @FILE:

	Default:
	See default.tempates.php
*/
$templates[\'year\'] = isset($tplYear) ? $ditto->template->fetch($tplYear): $defaultTemplates[\'year\'];
/*
	Param: tplYear

	Purpose:
	Template for the year item

	Options:
	- Any valid chunk name
	- Code via @CODE:
	- File via @FILE:

	Default:
	See default.tempates.php
*/
$templates[\'year_inner\'] = isset($tplYearInner) ? $ditto->template->fetch($tplYearInner): $defaultTemplates[\'year_inner\'];
/*
	Param: tplYearInner

	Purpose:
	Template for the year item (the ul to hold the year template)

	Options:
	- Any valid chunk name
	- Code via @CODE:
	- File via @FILE:

	Default:
	See default.tempates.php
*/
$templates[\'month\'] = isset($tplMonth) ? $ditto->template->fetch($tplMonth): $defaultTemplates[\'month\'];
/*
	Param: tplMonth

	Purpose:
	Template for the month item

	Options:
	- Any valid chunk name
	- Code via @CODE:
	- File via @FILE:

	Default:
	See default.tempates.php
*/
$templates[\'month_inner\'] = isset($tplMonthInner) ? $ditto->template->fetch($tplMonthInner): $defaultTemplates[\'month_inner\'];
/*
	Param: tplMonthInner

	Purpose:
	Template for the month item  (the ul to hold the month template)

	Options:
	- Any valid chunk name
	- Code via @CODE:
	- File via @FILE:

	Default:
	See default.tempates.php
*/
$templates[\'item\'] = isset($tplItem) ? $ditto->template->fetch($tplItem): $defaultTemplates[\'item\'];
/*
	Param: tplItem

	Purpose:
	Template for the individual item

	Options:
	- Any valid chunk name
	- Code via @CODE:
	- File via @FILE:

	Default:
	See default.tempates.php
*/

$ditto->addField("date","display","custom");
	// force add the date field if receiving data from a Ditto instance

// ---------------------------------------------------
//  Reflect
// ---------------------------------------------------

if (function_exists("reflect") === FALSE) {
function reflect($templatesDocumentID, $showItems, $groupByYears, $resource, $templatesDateSource, $dateFormat, $ditto, $templates,$id,$start,$yearSortDir,$monthSortDir) {
	global $modx;
	$cal = array();
	$output = \'\';
	$ph = array(\'year\'=>\'\',\'month\'=>\'\',\'item\'=>\'\',\'out\'=>\'\');
	$build = array();
	$stop = count($resource);

	// loop and fetch all the results
	for ($i = $start; $i < $stop; $i++) {
		$date = getdate($resource[$i][$templatesDateSource]);
		$year = $date["year"];
		$month = $date["mon"];
		$cal[$year][$month][] = $resource[$i];
	}
	if ($yearSortDir == "DESC") {
		krsort($cal);
	} else {
		ksort($cal);
	}
	foreach ($cal as $year=>$months) {
		if ($monthSortDir == "ASC") {
			ksort($months);
		} else {
			krsort($months);
		}
		$build[$year] = $months;
	}
	
	foreach ($build as $year=>$months) {
		$r_year = \'\';
		$r_month = \'\';
		$r_month_2 = \'\';
		$year_count = 0;
		$items = array();
		
		foreach ($months as $mon=>$month) {
			$month_text = strftime("%B", mktime(10, 10, 10, $mon, 10, $year));
			$month_url = $ditto->buildURL("month=".$mon."&year=".$year."&day=false&start=0",$templatesDocumentID,$id);
			$month_count = count($month);
			$year_count += $month_count;
			$r_month = $ditto->template->replace(array("year"=>$year,"month"=>$month_text,"url"=>$month_url,"count"=>$month_count),$templates[\'month\']);
			if ($showItems) {
				foreach ($month as $item) {
					$items[$year][$mon][\'items\'][] = $ditto->render($item, $templates[\'item\'], false, $templatesDateSource, $dateFormat, array(),$phx);
				}
				$r_month_2 = $ditto->template->replace(array(\'wrapper\' => implode(\'\',$items[$year][$mon][\'items\'])),$templates[\'month_inner\']);
				$items[$year][$mon] = $ditto->template->replace(array(\'wrapper\' => $r_month_2),$r_month);
			} else {
				$items[$year][$mon] = $r_month;
			}
		}
		if ($groupByYears) {
			$year_url = $ditto->buildURL("year=".$year."&month=false&day=false&start=0",$templatesDocumentID,$id);
			$r_year =  $ditto->template->replace(array("year"=>$year,"url"=>$year_url,"count"=>$year_count),$templates[\'year\']);
			$var = $ditto->template->replace(array(\'wrapper\'=>implode(\'\',$items[$year])),$templates[\'year_inner\']);
			$output .= $ditto->template->replace(array(\'wrapper\'=>$var),$r_year);
		} else {
			$output .= implode(\'\',$items[$year]);
		}
	}

	$output = $ditto->template->replace(array(\'wrapper\'=>$output),$templates[\'tpl\']);
	$modx->setPlaceholder($id.\'reset\',$ditto->buildURL(\'year=false&month=false&day=false\',$templatesDocumentID,$id));

return $output;
	
}
}

return reflect($targetID, $showItems, $groupByYears, $resource, $dateSource, $dateFormat, $ditto, $templates,$id,$start,$yearSortDir,$monthSortDir);

';
$s['UltimateParent'] = '/**
 * @name UltimateParent
 * @version 2.0 beta (requires MODx 0.9.5+)
 * @author Jason Coward <modx@opengeek.com>
 * 
 * @param &id The id of the document whose parent you want to find.
 * @param &top The top node for the search.
 * @param &topLevel The top level node for the search (root = level 1)
 * 
 * @license Public Domain, use as you like.
 * 
 * @example [[UltimateParent? &id=`45` &top=`6`]] 
 * Will find the ultimate parent of document 45 if it is a child of document 6;
 * otherwise it will return 45.
 * 
 * @example [[UltimateParent? &topLevel=`2`]]
 * Will find the ultimate parent of the current document at a depth of 2 levels
 * in the document hierarchy, with the root level being level 1.
 * 
 * This snippet travels up the document tree from a specified document and
 * returns the "ultimate" parent.  Version 2.0 was rewritten to use the new
 * getParentIds function features available only in MODx 0.9.5 or later.
 * 
 * Based on the original UltimateParent 1.x snippet by Susan Ottwell
 * <sottwell@sottwell.com>.  The topLevel parameter was introduced by staed and
 * adopted here.
 */
$top= isset ($top) && intval($top) ? $top : 0;
$id= isset ($id) && intval($id) ? intval($id) : $modx->documentIdentifier;
$topLevel= isset ($topLevel) && intval($topLevel) ? intval($topLevel) : 0;
if ($id && $id != $top) {
    $pid= $id;
    if (!$topLevel || count($modx->getParentIds($id)) >= $topLevel) {
        while ($parentIds= $modx->getParentIds($id, 1)) {
            $pid= array_pop($parentIds);
            if ($pid == $top) {
                break;
            }
            $id= $pid;
            if ($topLevel && count($modx->getParentIds($id)) < $topLevel) {
                break;
            }
        }
    }
}
return $id;';
$s['Wayfinder'] = '
/*
::::::::::::::::::::::::::::::::::::::::
 Snippet name: Wayfinder
 Short Desc: builds site navigation
 Version: 2.0
 Authors: 
	Kyle Jaebker (muddydogpaws.com)
	Ryan Thrash (vertexworks.com)
 Date: February 27, 2006
::::::::::::::::::::::::::::::::::::::::
Description:
    Totally refactored from original DropMenu nav builder to make it easier to
    create custom navigation by using chunks as output templates. By using templates,
    many of the paramaters are no longer needed for flexible output including tables,
    unordered- or ordered-lists (ULs or OLs), definition lists (DLs) or in any other
    format you desire.
::::::::::::::::::::::::::::::::::::::::
Example Usage:
    [[Wayfinder? &startId=`0`]]
::::::::::::::::::::::::::::::::::::::::
*/

$wayfinder_base = $modx->config[\'base_path\']."assets/snippets/wayfinder/";

//Include a custom config file if specified
$config = (isset($config)) ? "{$wayfinder_base}configs/{$config}.config.php" : "{$wayfinder_base}configs/default.config.php";
if (file_exists($config)) {
	include_once("$config");
}

include_once("{$wayfinder_base}wayfinder.inc.php");

if (class_exists(\'Wayfinder\')) {
   $wf = new Wayfinder();
} else {
    return \'error: Wayfinder class not found\';
}

$wf->_config = array(
	\'id\' => isset($startId) ? $startId : $modx->documentIdentifier,
	\'level\' => isset($level) ? $level : 0,
	\'includeDocs\' => isset($includeDocs) ? $includeDocs : 0,
	\'excludeDocs\' => isset($excludeDocs) ? $excludeDocs : 0,
	\'ph\' => isset($ph) ? $ph : FALSE,
	\'debug\' => isset($debug) ? TRUE : FALSE,
	\'ignoreHidden\' => isset($ignoreHidden) ? $ignoreHidden : FALSE,
	\'hideSubMenus\' => isset($hideSubMenus) ? $hideSubMenus : FALSE,
	\'useWeblinkUrl\' => isset($useWeblinkUrl) ? $useWeblinkUrl : TRUE,
	\'fullLink\' => isset($fullLink) ? $fullLink : FALSE,
	\'nl\' => isset($removeNewLines) ? \'\' : "\\n",
	\'sortOrder\' => isset($sortOrder) ? strtoupper($sortOrder) : \'ASC\',
	\'sortBy\' => isset($sortBy) ? $sortBy : \'menuindex\',
	\'limit\' => isset($limit) ? $limit : 0,
	\'cssTpl\' => isset($cssTpl) ? $cssTpl : FALSE,
	\'jsTpl\' => isset($jsTpl) ? $jsTpl : FALSE,
	\'rowIdPrefix\' => isset($rowIdPrefix) ? $rowIdPrefix : FALSE,
	\'textOfLinks\' => isset($textOfLinks) ? $textOfLinks : \'menutitle\',
	\'titleOfLinks\' => isset($titleOfLinks) ? $titleOfLinks : \'pagetitle\',
	\'displayStart\' => isset($displayStart) ? $displayStart : FALSE,
);

//get user class definitions
$wf->_css = array(
	\'first\' => isset($firstClass) ? $firstClass : \'\',
	\'last\' => isset($lastClass) ? $lastClass : \'last\',
	\'here\' => isset($hereClass) ? $hereClass : \'active\',
	\'parent\' => isset($parentClass) ? $parentClass : \'\',
	\'row\' => isset($rowClass) ? $rowClass : \'\',
	\'outer\' => isset($outerClass) ? $outerClass : \'\',
	\'inner\' => isset($innerClass) ? $innerClass : \'\',
	\'level\' => isset($levelClass) ? $levelClass: \'\',
	\'self\' => isset($selfClass) ? $selfClass : \'\',
	\'weblink\' => isset($webLinkClass) ? $webLinkClass : \'\',
);

//get user templates
$wf->_templates = array(
	\'outerTpl\' => isset($outerTpl) ? $outerTpl : \'\',
	\'rowTpl\' => isset($rowTpl) ? $rowTpl : \'\',
	\'parentRowTpl\' => isset($parentRowTpl) ? $parentRowTpl : \'\',
	\'parentRowHereTpl\' => isset($parentRowHereTpl) ? $parentRowHereTpl : \'\',
	\'hereTpl\' => isset($hereTpl) ? $hereTpl : \'\',
	\'innerTpl\' => isset($innerTpl) ? $innerTpl : \'\',
	\'innerRowTpl\' => isset($innerRowTpl) ? $innerRowTpl : \'\',
	\'innerHereTpl\' => isset($innerHereTpl) ? $innerHereTpl : \'\',
	\'activeParentRowTpl\' => isset($activeParentRowTpl) ? $activeParentRowTpl : \'\',
	\'categoryFoldersTpl\' => isset($categoryFoldersTpl) ? $categoryFoldersTpl : \'\',
	\'startItemTpl\' => isset($startItemTpl) ? $startItemTpl : \'\',
);

//Process Wayfinder
$output = $wf->run();

if ($wf->_config[\'debug\']) {
	$output .= $wf->renderDebugOutput();
}

//Ouput Results
if ($wf->_config[\'ph\']) {
    $modx->setPlaceholder($wf->_config[\'ph\'],$output);
} else {
    return $output;
}
';
$s['WebChangePwd'] = '# WebChangePwd 1.0
# Created By Raymond Irving April, 2005
#::::::::::::::::::::::::::::::::::::::::
# Usage: 	
#	Allows a web user to change his/her password from the website
#
# Params:	
#
#	&tpl			- (Optional)
#		Chunk name or document id to use as a template
#				  
#	Note: Templats design:
#			section 1: change pwd template
#			section 2: notification template 
#
# Examples:
#
#	[[WebChangePwd? &tpl=`ChangePwd`]] 

# Set Snippet Paths 
$snipPath  = (($modx->insideManager())? "../":"");
$snipPath .= "assets/snippets/";

# check if inside manager
if ($m = $modx->insideManager()) {
	return \'\'; # don\'t go any further when inside manager
}


# Snippet customize settings
$tpl		= isset($tpl)? $tpl:"";

# System settings
$isPostBack		= count($_POST) && isset($_POST[\'cmdwebchngpwd\']);

# Start processing
include_once $snipPath."weblogin/weblogin.common.inc.php";
include_once $snipPath."weblogin/webchangepwd.inc.php";

# Return
return $output;



';
$s['WebChangePwdProps'] = '&tpl=Template;string; ';
$s['WebLogin'] = '# WebLogin 1.0
# Created By Raymond Irving 2004
#::::::::::::::::::::::::::::::::::::::::
# Usage: 	
#	Allows a web user to login to the website
#
# Params:	
#	&loginhomeid 	- (Optional)
#		redirects the user to first authorized page in the list.
#		If no id was specified then the login home page id or 
#		the current document id will be used
#
#	&logouthomeid 	- (Optional)
#		document id to load when user logs out	
#
#	&pwdreqid 	- (Optional)
#		document id to load after the user has submited
#		a request for a new password
#
#	&pwdactid 	- (Optional)
#		document id to load when the after the user has activated
#		their new password
#
#	&logintext		- (Optional) 
#		Text to be displayed inside login button (for built-in form)
#
#	&logouttext 	- (Optional)
#		Text to be displayed inside logout link (for built-in form)
#	
#	&tpl			- (Optional)
#		Chunk name or document id to as a template
#				  
#	Note: Templats design:
#			section 1: login template
#			section 2: logout template 
#			section 3: password reminder template 
#
#			See weblogin.tpl for more information
#
# Examples:
#
#	[[WebLogin? &loginhomeid=`8` &logouthomeid=`1`]] 
#
#	[[WebLogin? &loginhomeid=`8,18,7,5` &tpl=`Login`]] 

# Set Snippet Paths 
$snipPath = $modx->config[\'base_path\'] . "assets/snippets/";

# check if inside manager
if ($m = $modx->insideManager()) {
	return \'\'; # don\'t go any further when inside manager
}

# deprecated params - only for backward compatibility
if(isset($loginid)) $loginhomeid=$loginid;
if(isset($logoutid)) $logouthomeid = $logoutid;
if(isset($template)) $tpl = $template;

# Snippet customize settings
$liHomeId	= isset($loginhomeid)? explode(",",$loginhomeid):array($modx->config[\'login_home\'],$modx->documentIdentifier);
$loHomeId	= isset($logouthomeid)? $logouthomeid:$modx->documentIdentifier;
$pwdReqId	= isset($pwdreqid)? $pwdreqid:0;
$pwdActId	= isset($pwdactid)? $pwdactid:0;
$loginText	= isset($logintext)? $logintext:\'Login\';
$logoutText	= isset($logouttext)? $logouttext:\'Logout\';
$tpl		= isset($tpl)? $tpl:"";

# System settings
$webLoginMode = isset($_REQUEST[\'webloginmode\'])? $_REQUEST[\'webloginmode\']: \'\';
$isLogOut		= $webLoginMode==\'lo\' ? 1:0;
$isPWDActivate	= $webLoginMode==\'actp\' ? 1:0;
$isPostBack		= count($_POST) && (isset($_POST[\'cmdweblogin\']) || isset($_POST[\'cmdweblogin_x\']));
$txtPwdRem 		= isset($_REQUEST[\'txtpwdrem\'])? $_REQUEST[\'txtpwdrem\']: 0;
$isPWDReminder	= $isPostBack && $txtPwdRem==\'1\' ? 1:0;

$site_id = isset($site_id)? $site_id: \'\';
$cookieKey = substr(md5($site_id."Web-User"),0,15);

# Start processing
include_once $snipPath."weblogin/weblogin.common.inc.php";
include_once ($modx->config[\'base_path\'] . "manager/includes/crypt.class.inc.php");

if ($isPWDActivate || $isPWDReminder || $isLogOut || $isPostBack) {
	# include the logger class
	include_once $modx->config[\'base_path\'] . "manager/includes/log.class.inc.php";
	include_once $snipPath."weblogin/weblogin.processor.inc.php";
}

include_once $snipPath."weblogin/weblogin.inc.php";

# Return
return $output;
';
$s['WebLoginProps'] = '&loginhomeid=Login Home Id;string; &logouthomeid=Logout Home Id;string; &logintext=Login Button Text;string; &logouttext=Logout Button Text;string; &tpl=Template;string; ';
$s['WebSignup'] = '# WebSignup 1.1
# Created By Raymond Irving April, 2005
#::::::::::::::::::::::::::::::::::::::::
# Usage:     
#    Allows a web user to signup for a new web account from the website
#    This snippet provides a basic set of form fields for the signup form
#    You can customize this snippet to create your own signup form
#
# Params:    
#
#    &tpl        - (Optional) Chunk name or document id to use as a template
#    &groups     - Web users groups to be assigned to users
#    &useCaptcha - (Optional) Determine to use (1) or not to use (0) captcha
#                  on signup form - if not defined, will default to system
#                  setting. GD is required for this feature. If GD is not 
#                  available, useCaptcha will automatically be set to false;
#                  
#    Note: Templats design:
#        section 1: signup template
#        section 2: notification template 
#
# Examples:
#
#    [[WebSignup? &tpl=`SignupForm` &groups=`NewsReaders,WebUsers`]] 

# Set Snippet Paths 
$snipPath = $modx->config[\'base_path\'] . "assets/snippets/";

# check if inside manager
if ($m = $modx->insideManager()) {
    return \'\'; # don\'t go any further when inside manager
}


# Snippet customize settings
$tpl = isset($tpl)? $tpl:"";
$useCaptcha = isset($useCaptcha)? $useCaptcha : $modx->config[\'use_captcha\'] ;
// Override captcha if no GD
if ($useCaptcha && !gd_info()) $useCaptcha = 0;

# setup web groups
$groups = isset($groups) ? explode(\',\',$groups):array();
for($i=0;$i<count($groups);$i++) $groups[$i] = trim($groups[$i]);

# System settings
$isPostBack        = count($_POST) && isset($_POST[\'cmdwebsignup\']);

$output = \'\';

# Start processing
include_once $snipPath."weblogin/weblogin.common.inc.php";
include_once $snipPath."weblogin/websignup.inc.php";

# Return
return $output;';
$s['WebSignupProps'] = '&tpl=Template;string; ';
$s['date'] = '
#### date
$i = 1;
print "<select name=\\"cmbDay\\">\\n";
while ($i <= date("t")) {
	($i == date(\'j\')) ? print "<option value=\\"$i\\" selected=\\"selected\\">".$i."</option>\\n":print "<option value=\\"$i\\">".$i."</option>\\n";
	$i++;
}
print "</select>\\n";
#### month / year
$y = 0;
print "<select name=\\"cmbMonthYear\\" class=\\"month\\">\\n";
while ($y < 12) {
echo "<option value=\'".date("n/Y",strtotime("+$y month"))."\'>".date("M Y",strtotime("+$y month"))."</option>\\n";
$y++;
}
print "</select>";
';
$s['submenu'] = '
if ( $modx->documentObject[\'id\']!= 1 &&  $modx->documentObject[\'id\']!= 50 && $modx->documentObject[\'id\']!= 54 && $modx->documentObject[\'id\']!= 90 && $modx->documentObject[\'id\']!= 94 && $modx->documentObject[\'id\']!= 96  && $modx->documentObject[\'id\']!= 99  && $modx->documentObject[\'id\']!= 100) {
    return "[!Wayfinder?&startId=`[*parent*]` &sortOrder=`ASC`  &level=`1` &hereTpl=`span`   !]"; 
}
';
$s['photo-jscript'] = '
if  ( $modx->documentObject[\'id\'] == 40 ) {
     return \'<script type="text/javascript" src="[(base_url)]assets/templates/mercure/javascripts/imagefade.js"></script>\';
}
';
$s['homepage-css'] = '
if  ( $modx->documentObject[\'id\'] == 1 ) {
     return \'<link rel="stylesheet" type="text/css" href="[(base_url)]assets/templates/mercure/styles/homepage.css"/>\';
} else if ($modx->documentObject[\'id\'] == 40 ) {
     return \'<link rel="stylesheet" type="text/css" href="[(base_url)]assets/templates/mercure/styles/gallery.css"/>\';
}
';
$s['multi-lingo'] = '
echo \'<a href="fr/\'.$modx->documentObject[\'alias\'].\'">French</a>$modx->documentObject[\'type\']\';
';
$s['JavaSlideSnipet'] = '
for($i=1; $i<=8; $i++)
{
	$image = $modx->getTemplateVar($idname= "image-slide_".$i, $fields= "*", $docid= $modx->documentObject[\'id\'], $published= 1);
	if($image[value] != "")
	{
	   print \'fadeimages3[\'.($i - 1).\']=["\'.$image[value].\'", "", ""]; \';
	}
}
';
$s['fotogallery'] = '
print "<div align=\'center\'>";

$x = 0;
$pathImage = (isset($pathImage)) ? $pathImage : \'assets/images/photos/\';
$handle=opendir($pathImage);
while (false!==($file = readdir($handle))) 
{
	if (substr($file, strlen($file)-4, 4) == ".jpg" and substr($file, 0, 1) != ".") 
	{
		$filesbig[$x] = $file;
		$x++;
	}
}
closedir($handle);
print \'<script type="text/javascript">
<!--
var arrImageInfo = new Array(0); 
\';

for($i=0; $i<$x; $i++) 
{
	print \'arrImageInfo[\'.$i.\'] = new Array("title"); 
	\';
	print \'arrImageInfo[\'.$i.\']["title"] = \\\'\\\'; 
	\';
}
echo \'--></script>

<div id="thumbnail">
<ul>\';

$x = 0;
$handle=opendir($pathImage.\'\');
while (false!==($file = readdir($handle))) 
{
	if (substr($file, strlen($file)-4, 4) == ".jpg" and substr($file, 0, 1) == ".") 
	{
		$files[$x] = $file;
		$x++;
	}
}
sort($files);
$x = 0;
while($x <= (count($files)-1))
{
	print \'	<li>
		<a href="#" onclick="return clickImage(\'.$x.\');">
		<! -- <img height="37" src="\'.$pathImage.\'tn/\'.$files[$x].\'" width="37" /> -->
<img height="37" src="\'.$pathImage.\'\'.$files[$x].\'" width="37" />
		</a>
		</li>\';

	$x++;
}
closedir($handle);
print \'</ul>
</div>
<div class="clear">
</div>
<div id="displayImage">\';

$x = 0;
sort($filesbig);
while($x <= (count($filesbig)-1))
{
	print \'<img height="400" src="\'.$pathImage.$filesbig[$x].\'" width="400" />
	\';
	$x++;
}
print \'</div>
<div id="gallerydevice">
<div class="text">
<p id="imgTitle">
&nbsp;
</p>
</div>
<div class="button">
<a href="#" onclick="return playImage();">
<img height="13" src="/mersanur/assets/images/btn-play.gif" width="13" />
</a>
<a href="#" onclick="return stopDisplay();">
<img height="13" src="/mersanur/assets/images/btn-stop.gif" width="13" />
</a>
</div>
</div>
</div>\';
';
$s['FhotoGallery'] = '
print \'<link href="/assets/templates/ombak/css/gallery.css" rel="stylesheet" type="text/css" />
		\';
print \'<script src="/assets/templates/ombak/js/imagefade.js" type="text/javascript"></script>
		\';
print "<div align=\'center\'>";

$x = 0;

$pathImage = (isset($pathImage)) ? $pathImage : \'assets/images/gallery/\';
$handle=opendir($pathImage);
while (false!==($file = readdir($handle))) 
{
	if (substr($file, strlen($file)-4, 4) == ".jpg" and substr($file, 0, 1) != ".") 
	{
		$filesbig[$x] = $file;
		$x++;
	}
}
closedir($handle);
print \'<script type="text/javascript">
<!--
var arrImageInfo = new Array(0); 
\';

for($i=0; $i<$x; $i++) 
{
	print \'arrImageInfo[\'.$i.\'] = new Array("title"); 
	\';
	print \'arrImageInfo[\'.$i.\']["title"] = \\\'\\\'; 
	\';
}
echo \'--></script>\';

echo \'<br /><div id="thumbnail">\';
//echo \'<ul>\';

$x = 0;
//sort($filesbig);
while($x <= (count($filesbig)-1))
{
	//print \'	<li>\';
	print \'<a href="#" onclick="return clickImage(\'.$x.\');">
		<img  src="/assets/snippets/phpthumb/phpThumb.php?zc=1&w=40&h=40&far=0&src=/\'.$pathImage.$filesbig[$x].\'"/>
		</a>\';
	//print \'	</li>\';
	$x++;
}
//closedir($handle);
//print \'</ul>\';
print \'</div>\';


print \'<div id="displayImage">\';

$x = 0;
//sort($filesbig);
while($x <= (count($filesbig)-1))
{
	print \'<img src="/\'.$pathImage.$filesbig[$x].\'" />
	\';
	$x++;
}
print \'</div>
<div id="gallerydevice">
<div class="text">
<p id="imgTitle">
&nbsp;
</p>
</div>
<div class="button">
<a href="#" onclick="return playImage();">
<img height="13" src="/assets/images/btn-play.gif" width="13" />
</a>
<a href="#" onclick="return stopDisplay();">
<img height="13" src="/assets/images/btn-stop.gif" width="13" />
</a>
</div>
</div>\';

print \'<div class="clr"></div>\';


echo \'</div>\';
';
$s['Lengthofstay'] = '
print \'Length of stay <br>\';
print \'<fieldset class="length"><select id="nb_nuit" name="nb_nuit">\';
for ($i=1;$i<=30;$i++)
{
	print \'<option value="\'.$i.\'">\'.$i.\'</option>\';
}
print \'</select><label for="nb_nuit">night(s)</label></fieldset>\';
//print \'</select><label for="nb_nuit">night(s)</label></fieldset>\';
';
$s['WebLoginPE'] = '
//print \'====\'.$_GET[direct];
/**
	 * WebLoginPE Snippet 1.3.1
	 * v1.3.1 Bugfix by Soshite @ MODx CMS Forums & Various Other Forum Members
	 *
	 * @package WebLoginPE
	 * @author Scotty Delicious
	 * @version 1.3.1
	 *
	 * See the "docs" folder for detailed usage and parameter instructions.
	 */

	$type = isset($type) ? $type : \'simple\';
	$regType = isset($regType) ? $regType : \'instant\';
	$notify = isset($notify) ? $notify : \'\';
	$groups = isset($groups) ? $groups : \'\';
	$regRequired = isset($regRequired) ? $regRequired : \'\';
	$customTable = isset($customTable) ? $customTable : \'web_user_attributes_extended\';
	$customFields = isset($customFields) ? $customFields : \'\';
	$prefixTable = isset($prefixTable) ? $prefixTable : 1;
	$lang = isset($lang) ? $lang : \'en\';
	$userImageSettings = isset($userImage) ? $userImage : \'105000,100,100\';
	$dateFormat = isset($dateFormat) ? $dateFormat : \'%A %B %d, %Y at %I:%M %p\';
	$disableServices = isset($disableServices) ? explode(\',\', str_replace(\', \',\',\',$disableServices)) : array();
	$tableCheck = isset($tableCheck) ? $tableCheck : 1;
	
	include_once MODX_BASE_PATH.\'assets/snippets/webloginpe/webloginpe.class.php\';
	include MODX_BASE_PATH.\'assets/snippets/webloginpe/webloginpe.templates.php\';
	if (file_exists(MODX_BASE_PATH.\'assets/snippets/webloginpe/lang/\'.$lang.\'.php\'))
	{
		include_once MODX_BASE_PATH.\'assets/snippets/webloginpe/lang/\'.$lang.\'.php\';
	}
	else
	{
		include_once MODX_BASE_PATH.\'assets/snippets/webloginpe/lang/en.php\';
		$modx->setPlaceholder(\'wlpe.message\', $wlpe_lang[105]);
		print \'[+wlpe.message+]\';
	}
	
	$wlpe = new WebLoginPE($wlpe_lang, $dateFormat, $userImageSettings, $type);
	$wlpe->CustomTable($customTable, $customFields, $prefixTable, $tableCheck);

	$liHomeId = isset($liHomeId) ? explode(\',\', $liHomeId) : \'\';
	$loHomeId = isset($loHomeId) ? $loHomeId : \'\';
	$regHomeId = isset($regHomeId) ? $regHomeId : \'\';
	$regSuccessId = isset($regSuccessId) ? $regSuccessId : \'\';
	$regSuccessPause = isset($regSuccessPause) ? $regSuccessPause : 5;
	$profileHomeId = isset($profileHomeId) ? $profileHomeId : \'\';
	$inputHandler = isset($inputHandler) ? explode(\'||\', $inputHandler) : array();
	$usersList = isset($usersList) ? $usersList : \'\';
	
	if ($regType == \'verify\'){$wlpeRegisterTpl = $wlpeRegisterVerifyTpl;}else{$wlpeRegisterTpl = $wlpeRegisterInstantTpl;}
	
	$displayLoginFormTpl = isset($loginFormTpl) ? $wlpe->Template($loginFormTpl) : $wlpeDefaultFormTpl;
	$displaySuccessTpl = isset($successTpl) ? $wlpe->Template($successTpl) : $wlpeDefaultSuccessTpl;
	$displayRegisterTpl = isset($registerTpl) ? $wlpe->Template($registerTpl) : $wlpeRegisterTpl;
	$displayRegSuccessTpl = isset($registerSuccessTpl) ? $wlpe->Template($registerSuccessTpl) : $wlpeDefaultFormTpl;
	$displayProfileTpl = isset($profileTpl) ? $wlpe->Template($profileTpl) : $wlpeProfileTpl;
	$displayViewProfileTpl = isset($viewProfileTpl) ? $wlpe->Template($viewProfileTpl) : $wlpeViewProfileTpl;
	$displayUsersOuterTpl = isset($usersOuterTpl) ? $wlpe->Template($usersOuterTpl) : $wlpeUsersOuterTpl;
	$displayUsersTpl = isset($usersTpl) ? $wlpe->Template($usersTpl) : $wlpeUsersTpl;
	$displayManageOuterTpl = isset($manageOuterTpl) ? $wlpe->Template($manageOuterTpl) : $wlpeUsersOuterTpl;
	$displayManageTpl = isset($manageTpl) ? $wlpe->Template($manageTpl) : $wlpeManageTpl;
	$displayManageProfileTpl = isset($manageProfileTpl) ? $wlpe->Template($manageProfileTpl) : $wlpeManageProfileTpl;
	$displayManageDeleteTpl = isset($manageDeleteTpl) ? $wlpe->Template($manageDeleteTpl) : $wlpeManageDeleteTpl;
	$displayProfileDeleteTpl = isset($profileDeleteTpl) ? $wlpe->Template($profileDeleteTpl) : $wlpeProfileDeleteTpl;
	$displayActivateTpl = isset($activateTpl) ? $wlpe->Template($activateTpl) : $wlpeActivateTpl;
	$displayResetTpl = isset($resetTpl) ? $wlpe->Template($resetTpl) : $wlpeResetTpl;
	$notifyTpl = isset($notifyTpl) ? $wlpe->Template($notifyTpl) : $wlpeNotifyTpl;
	$notifySubject = isset($notifySubject) ? $notifySubject : \'New Web User for \'.$modx->config[\'site_name\'].\'.\';
	$messageTpl = isset($messageTpl) ? $wlpe->Template($messageTpl) : $wlpeMessageTpl;
	$tosChunk = isset($tosChunk) ? $wlpe->Template($tosChunk) : $wlpeTos;
	$modx->setPlaceholder(\'tos\', $tosChunk);
	
	$loadJquery = isset($loadJquery) ? $loadJquery : false;
	$customJs = isset($customJs) ? $customJs : \'\';
	
	if (isset($pruneDays))
	{
		$wlpe->PruneUsers($pruneDays);
	}
		
	if ($loadJquery == \'true\' || $loadJquery == true || $loadJquery == 1 || $loadJquery == \'1\') 
	{
		$wlpe->RegisterScripts($customJs);
	}
	else if (!empty($customJs))
	{
		$modx->regClientStartupScript($customJs);
	}
	
	$wlpe->ActiveUsers();
	$wlpe->PlaceHolders($inputHandler, $messageTpl);
	
	$modx->regClientStartupScript(\'assets/snippets/webloginpe/js/ieButtonFix.js\');

	$service = $_REQUEST[\'service\'];
	if (empty($service) || $service == \'\')
	{
		$service = $_REQUEST[\'serviceButtonValue\'];
	}
	
	if ($type == \'register\')
	{
		if (in_array(\'register\', $disableServices)){return;}
		switch ($service) 
		{
			case \'register\' :
				if (in_array(\'register\', $disableServices)){return;}
				$registration = $wlpe->Register($regType, $groups, $regRequired, $notify, $notifyTpl, $notifySubject);
				
				if (isset($regSuccessId) && $regSuccessId !== \'\')
				{
					if ($registration == \'success\')
					{
						$url = rtrim($modx->config[\'site_url\'], \'/\').$modx->makeURL($regSuccessId);
						header(\'Refresh: \'.$regSuccessPause.\';URL=\'.$url);
						return $displayRegSuccessTpl;
					}
					return $displayRegisterTpl;
					
				}
				if ($registration == \'success\')
				{
					return $displayRegSuccessTpl;
				}
				return $displayRegisterTpl;
				break;
				
			case \'cancel\':
				if ($loHomeId == \'\') $loHomeId = $modx->config[\'site_start\'];
				$url = $modx->makeURL($loHomeId);
		        $modx->sendRedirect($url,0,\'REDIRECT_REFRESH\');
				break;
			
			case \'login\' :
				$wlpe->Login($type, $liHomeId);

				if ($modx->getLoginUserID())
				{
					return $displaySuccessTpl;
				}
				return $displayLoginFormTpl;
				break;

			case \'logout\' :
				$wlpe->Logout($type, $loHomeId);
				return $displayLoginFormTpl;
				break;
			
			default :
				return $displayRegisterTpl;
		}
		return;
	}
	
	else if ($type == \'profile\')
	{
		if (in_array(\'profile\', $disableServices)){return;}
		switch ($service) 
		{
			case \'saveprofile\' :
				if (in_array(\'saveprofile\', $disableServices)){return;}
				$wlpe->SaveUserProfile();
				$wlpe->PlaceHolders($inputHandler, $messageTpl);
				return $displayProfileTpl;
				break;
				
			case \'cancel\':
				if ($loHomeId == \'\') $loHomeId = $modx->config[\'site_start\'];
				$url = $modx->makeURL($loHomeId);
		        $modx->sendRedirect($url,0,\'REDIRECT_REFRESH\');
				break;
				
			case \'logout\':
				if ($loHomeId == \'\') $loHomeId = $modx->config[\'site_start\'];
				$wlpe->Logout($type, $loHomeId);
				break;
				
			case \'deleteprofile\':
				if (in_array(\'deleteprofile\', $disableServices)){return;}
				return $displayProfileDeleteTpl;
				break;
			
			case \'confirmdeleteprofile\':
				if (in_array(\'confirmdeleteprofile\', $disableServices)){return;}
				$wlpe->RemoveUserProfile();
				return \'[+wlpe.message+]\';
				break;
				
			default :
				return $displayProfileTpl;
				break;
		}
		return;
	}
	
	else if ($type == \'users\')
	{
		if (in_array(\'users\', $disableServices)){return;}
		switch ($service)
		{
			case \'viewprofile\':
				if (in_array(\'viewprofile\', $disableServices)){return;}
				$wlpe->ViewUserProfile($_REQUEST[\'username\'],$inputHandler);
				return $displayViewProfileTpl;
				break;
				
			case \'messageuser\':
				if (in_array(\'messageuser\', $disableServices)){return;}
				$wlpe->SendMessageToUser();
				return $displayViewProfileTpl;
				break;
			
			default :
				$userpage = $wlpe->ViewAllUsers($displayUsersTpl, $displayUsersOuterTpl, $usersList);
				return $userpage;
		}
		return;
	}
	
	else if ($type == \'manager\')
	{
		if (in_array(\'manager\', $disableServices)){return;}
		switch ($service)
		{
			case \'editprofile\':
				if (in_array(\'editprofile\', $disableServices)){return;}
				$wlpe->ViewUserProfile($_REQUEST[\'username\'],$inputHandler);
				return $displayManageProfileTpl;
				break;
				
			case \'saveuserprofile\' :
				if (in_array(\'saveuserprofile\', $disableServices)){return;}
				$wlpe->SaveUserProfile($_POST[\'internalKey\']);
				$manageUsersPage = $wlpe->ViewAllUsers($displayManageTpl, $displayManageOuterTpl, $usersList);
				return $manageUsersPage;
				break;
				
			case \'messageuser\':
				if (in_array(\'messageuser\', $disableServices)){return;}
				$wlpe->SendMessageToUser();
				return $displayViewProfileTpl;
				break;
				
			case \'deleteuser\':
				if (in_array(\'deleteuser\', $disableServices)){return;}
				$_SESSION[\'editInternalKey\'] = $_POST[\'internalKey\'];
				return $displayManageDeleteTpl;
				break;

			case \'confirmdeleteuser\':
				if (in_array(\'confirmdeleteuser\', $disableServices)){return;}
				$wlpe->RemoveUserProfileManager($_SESSION[\'editInternalKey\']);
				$manageUsersPage = $wlpe->ViewAllUsers($displayManageTpl, $displayManageOuterTpl, $usersList);
				unset($_SESSION[\'editInternalKey\']);
				return $manageUsersPage;
				break;
			
			default :
				$manageUsersPage = $wlpe->ViewAllUsers($displayManageTpl, $displayManageOuterTpl, $usersList);
				return $manageUsersPage;
		}
		return;
	}
	
	else if ($type == \'simple\')
	{
		switch ($service) 
		{

			case \'login\' :
				$wlpe->Login($type, $liHomeId);

				if ($modx->getLoginUserID())
				{
					return $displaySuccessTpl;
				}
				return $displayLoginFormTpl;
				break;

			case \'logout\' :
				$wlpe->Logout($type, $loHomeId);
				return $displayLoginFormTpl;
				break;

			case \'profile\' :
				if (in_array(\'profile\', $disableServices)){return;}
				if (empty($profileHomeId))
				{
					return $displayProfileTpl;
				}
				$url = $modx->makeURL($profileHomeId);
		        $modx->sendRedirect($url,0,\'REDIRECT_REFRESH\');
		        return;
				break;
				
			case \'saveprofilesimple\' :
				if (in_array(\'saveprofile\', $disableServices)){return;}
				$wlpe->SaveUserProfile();
				$wlpe->PlaceHolders($inputHandler, $messageTpl);
				return $displayProfileTpl;
				break;
			
			case \'deleteprofilesimple\':
				if (in_array(\'deleteprofile\', $disableServices)){return;}
				return $displayProfileDeleteTpl;
				break;

			case \'confirmdeleteprofilesimple\':
				if (in_array(\'confirmdeleteprofile\', $disableServices)){return;}
				$wlpe->RemoveUserProfile();
				return \'[+wlpe.message+]\';
				break;

			case \'registernew\' :
				if (in_array(\'register\', $disableServices)){return;}
				if (empty($regHomeId))
				{
					return $displayRegisterTpl;
				}
				$url = $modx->makeURL($regHomeId);
		        $modx->sendRedirect($url,0,\'REDIRECT_REFRESH\');
		        return;
				break;
				
			case \'register\':
				if (in_array(\'register\', $disableServices)){return;}
				$registration = $wlpe->Register($regType, $groups, $regRequired, $notify, $notifyTpl, $notifySubject);
				
				if (isset($regSuccessId) && $regSuccessId !== \'\')
				{
					if ($registration == \'success\')
					{
						$url = rtrim($modx->config[\'site_url\'], \'/\').$modx->makeURL($regSuccessId);
						header(\'Refresh: \'.$regSuccessPause.\';URL=\'.$url);
						return $displayRegSuccessTpl;
					}
					return $displayRegisterTpl;
					
				}
				if ($registration == \'success\')
				{
					return $displayRegSuccessTpl;
				}
				return $displayRegisterTpl;
				break;

			case \'forgot\' :
				if (in_array(\'forgot\', $disableServices)){return;}
				return $displayResetTpl;
				break;
			
			case \'resetpassword\' :
				if (in_array(\'resetpassword\', $disableServices)){return;}
				$wlpe->ResetPassword();
				if (isset($wlpe->Report)) 
				{
					if (isset($_POST[\'email\']))
					{
						return $displayResetTpl;
					}
					else
					{
						return $displayActivateTpl;
					}
				}
				return;
				break;
			
			case \'activate\' :
				if (in_array(\'activate\', $disableServices)){return;}
				return $displayActivateTpl;
				break;
			
			case \'activated\':
                if (in_array(\'activated\', $disableServices)){return;}
                $wlpe->ActivateUser();
                // pixelchutes 1:57 AM 9/19/2007
                // Here we check for an error, then reload the activation template if necessary
                // Do NOT reload if wlpe->Report indicates success
                 // Added strip_tags() around string which means an error is not thrown regarding a modifier from closing
                // html tag e.g. if $wlpe_lang[104] contains "</div>" this will fail as "/d" treated as modifier
                if ( isset( $wlpe->Report ) && !preg_match( "/".strip_tags($wlpe_lang[104])."/i", $wlpe->Report ) )
                {
                    return $displayActivateTpl;
                }                
                return $displayLoginFormTpl;
                break;
			
			default :
				
				if ($modx->getLoginUserID())
				{
					return $displaySuccessTpl;
				}
				else
				{
					$wlpe->AutoLogin();
					return $displayLoginFormTpl;
				}

		}// [END] Switch : $service for simple.
	}
	
	else if ($type == \'taconite\')
	{
		switch ($service) 
		{

			case \'login\' :
				$wlpe->Login($type, $liHomeId);

				if (isset($wlpe->Report)) 
				{
					return $wlpe->Report;
				}
				return;
				break;

			case \'logout\' :
				$wlpe->Logout($type, $loHomeId);				
				return;
				break;

			case \'register\' :
				if (in_array(\'register\', $disableServices)){return;}
				$wlpe->Register($regType, $groups, $regRequired, $notify, $notifyTpl, $notifySubject);
				return $wlpe->Report;
				break;
			
			case \'resetpassword\' :
				if (in_array(\'resetpassword\', $disableServices)){return;}
				$wlpe->ResetPassword();
				return $wlpe->Report;
				break;
				
			case \'activated\':
				if (in_array(\'activated\', $disableServices)){return;}
				$wlpe->ActivateUser();
				return $wlpe->Report;
				break;
					
			default :
				if ($modx->getLoginUserID())
				{
					return;
				}
				else
				{
					$wlpe->AutoLogin();
				}
		}// [END] Switch : $service for taconite.
	}
	
	else
	{
		return;
	}
';
$s['downloadinsert'] = '
$userweb = base64_decode($_SESSION[webUser]);
//$headerlogin  = isset($headerlogin )? $headerlogin :\'69\';
$headersuccess  = isset($headersuccess  )? $headersuccess  :\'99\';
$headerlogin  = isset($headerlogin )? $headerlogin :\'99\';
if($userweb!="")
{
$link_direct = "$headersuccess";
/*$log_direct = \'<a href="/[~\'.$link_direct.\'~]"><img class="downloadimg" src="/assets/templates/novbalibenoa/images/download-images.gif" width="105" height="30" alt="Novotel Benoa Bali" /></a>
\';*/
}else{
$link_direct = "$headerlogin";
}
    print \'<div class="btndownload"><a href="/[~\'.$link_direct.\'~]"><img src="/assets/templates/mercure/images/btn_download.jpg"  border="0"/></a></div>
\';

print \'<!--<div style="text-align:center;"><a href="http://www.tripadvisor.com/Hotel_Review-g297700-d299600-Reviews-Mercure_Resort_Sanur-Sanur_Bali.html" target="_blank" ><img src="/assets/images/tripadvisor_mer.jpg" border="0"></a> </div>-->\';
';
$s['FileDownload'] = '
$userweb = base64_decode($_SESSION[webUser]);
$headerlogin  = isset($headerlogin )? $headerlogin :\'100\';
$x = 0;
$pathFile = (isset($pathFile)) ? $pathFile : \'assets/images/gallery\';
$pathFile = "assets/files/".$pathFile;
	$handle=opendir($pathFile);
	while (($file = readdir($handle)) !== false ) 
	{
		$path_info = pathinfo($file);
		if (($file != ".") && ($file != "..") || $path_info[\'extension\'] =="EPS" || $path_info[\'extension\'] =="jpg" || $path_info[\'extension\'] =="JPG"  || $path_info[\'extension\'] =="PNG" || $path_info[\'extension\'] =="png" || $path_info[\'extension\'] =="gif" || $path_info[\'extension\'] =="jpeg" || $path_info[\'extension\'] =="psd" || $path_info[\'extension\'] =="PSD" )		
		{
			$filesbig[$x] = $file;
			$x++;
		}

	}

	closedir($handle);
	$jumlah = count($filesbig);
	if($filesbig > 1 )
	{
	print \'<div class="file_download">\';
	}
	
	for($j=0; $j < $jumlah; $j++ )
	{
		if($userweb == "")
		{
			//$base_64 = base64_encode(base64_encode($pathFile.$filesbig[$j]));
			//print \'<li style="list-style:none; padding:0; margin:0;"> <a href="/[~\'.$headerlogin.\'~]?direct=/\'.$base_64.\'" >\'.$filesbig[$j].\'</a></li>\';
			print \'<a href="/[~\'.$headerlogin.\'~]" ><img src="/assets/snippets/phpthumb/phpThumb.php?zc=1&w=80&far=0&src=/\'.$pathFile.$filesbig[$j].\'" style="padding:2px;  border:1px solid #FFF; margin:2px;" /></a>\';
			//print \'<li>\'.$base_64.\'</li>\';
			//print \'<li>\'.base64_decode(base64_decode($base_64)).\'</li>\';
		}else
		{
			print \'<a href="/\'.$pathFile.$filesbig[$j].\'" target="_blank" ><img src="/assets/snippets/phpthumb/phpThumb.php?zc=1&w=80&far=0&src=/\'.$pathFile.$filesbig[$j].\'" style="padding:2px;  border:1px solid #FFF; margin:2px;" /></a>\';
		}
		
	}
	
	if($filesbig > 1 )
	{	
	print \'</div>\';
	}
';
$s['PDFDownload'] = '
$userweb = base64_decode($_SESSION[webUser]);
$headerlogin  = isset($headerlogin )? $headerlogin :\'100\';
$x = 0;
$pathFile = (isset($pathFile)) ? $pathFile : \'assets/images/gallery\';
$pathFile = "assets/files/".$pathFile;
	$handle=opendir($pathFile);
	while (($file = readdir($handle)) !== false ) 
	{
		$path_info = pathinfo($file);
		if (($file != ".") && ($file != "..") || $path_info[\'extension\'] =="PDF"  )		
		{
			$filesbig[$x] = $file;
			$x++;
		}

	}

	closedir($handle);
	$jumlah = count($filesbig);
	if($filesbig > 1 )
	{
	print \'<ul>\';
	}
	
	for($j=0; $j < $jumlah; $j++ )
	{
		if($userweb == "")
		{
			//$base_64 = base64_encode(base64_encode($pathFile.$filesbig[$j]));
			//print \'<li style="list-style:none; padding:0; margin:0;"> <a href="/[~\'.$headerlogin.\'~]?direct=/\'.$base_64.\'" >\'.$filesbig[$j].\'</a></li>\';
			print \'<li><a href="/[~\'.$headerlogin.\'~]" >\'.$filesbig[$j].\'</a></li>\';
			//print \'<li>\'.$base_64.\'</li>\';
			//print \'<li>\'.base64_decode(base64_decode($base_64)).\'</li>\';
		}else
		{
			print \'<li><a href="/\'.$pathFile.$filesbig[$j].\'" target="_blank" >\'.$filesbig[$j].\'</a></li>\';
		}
		
	}
	
	if($filesbig > 1 )
	{	
	print \'</ul>\';
	}
';
$p = &$this->pluginCache;
$p['Bottom Button Bar'] = '/* BottomButtonBar v1.0 (by Mitch)
 *
 * I just got tired of scrolling up after editing a document/snippet/etc... 
 * to save it. The GoUp plugin improved it a bit, but I was not completely 
 * satisfied. So I wrote this plugin that will add the complete buttonbar 
 * at the bottom of the edit screen. Also there is a GoUp link in the bottombar.
 *
 * To use the plugin you have to enable the following events:
 *
 *   OnChunkFormRender
 *   OnDocFormRender
 *   OnModFormRender
 *   OnPluginFormRender
 *   OnSnipFormRender
 *   OnTVFormRender
 *   OnTempFormRender
 *   OnUserFormRender
 *   OnWUsrFormRender
 *
 * Hope you like it as much as I do.
 * 
 */


// I know the code looks messy, but that is mainly because of the copy/pasting.

// Load the language file
include $modx->config[\'base_path\'].\'manager/includes/lang/\'.$modx->config[\'manager_language\'].\'.inc.php\';

//Get Manager Theme - added by garryn
$manager_theme = $modx->config[\'manager_theme\'] ? $modx->config[\'manager_theme\'] : \'\';

// Get a reference to the event
$e = & $modx->Event;

// For every form basicially the code is just copied from the appropriate
// mutate_XXXXXX.dynamic.action.php file. Then the CSS id\'s are updated so they
// are unique. I just added __ after it.

switch ($e->name) {

//-------------------------------------------------------------------
   case "OnDocFormRender":

// From mutate_content.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<tr>
			<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
			<td id="Button2__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></span></a></td>
				<?php if($_REQUEST[\'a\']==\'4\' || $_REQUEST[\'a\']==72) { ?><script>document.getElementById("Button2__").className=\'disabled\';</script><?php } ?>
			<td id="Button5__"><a href="<?php echo $id==0 ? "index.php?a=2" : "index.php?a=3&id=$id"; ?>"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
		</tr>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;


//-------------------------------------------------------------------
   case "OnSnipFormRender":

// From mutate_snippet.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click(); saveWait(\'mutate\');"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
<?php if($_GET[\'a\']==\'22\') { ?>
		<td id="Button2__"><a href="#" onclick="duplicaterecord();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/copy.gif" align="absmiddle" /> <?php echo $_lang["duplicate"]; ?></a></td>
		<td id="Button3__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
<?php } ?>
		<td id="Button4__"><a href="index.php?a=76"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnChunkFormRender":

// From mutate_htmlsnippet.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click(); saveWait(\'mutate\');"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
<?php if($_REQUEST[\'a\']==\'78\') { ?>
		<td id="Button2__"><a href="#" onclick="duplicaterecord();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/copy.gif" align="absmiddle" /> <?php echo $_lang["duplicate"]; ?></a></td>
		<td id="Button3__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
<?php } ?>
		<td id="Button4__"><a href="index.php?a=76"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnModFormRender":

// From mutate_module.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5"><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<tr>
		<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click(); saveWait(\'mutate\');"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle"> <?php echo $_lang[\'save\']; ?></a></td>
<?php if($_GET[\'a\']==\'108\') { ?>
		<td id="Button2__"><a href="#" onclick="duplicaterecord();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/copy.gif" align="absmiddle"> <?php echo $_lang["duplicate"]; ?></a></td>
		<td id="Button3__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle"> <?php echo $_lang[\'delete\']; ?></a></td>
<?php } ?>
		<td id="Button4__"><a href="#" onclick="documentDirty=false;document.location.href=\'index.php?a=106\';"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle"> <?php echo $_lang[\'cancel\']; ?></a></td>
		</tr>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnPluginFormRender":

// From mutate_plugin.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click(); saveWait(\'mutate\');"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
<?php if($_GET[\'a\']==\'102\') { ?>
		<td id="Button2__"><a href="#" onclick="duplicaterecord();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/copy.gif" align="absmiddle" /> <?php echo $_lang["duplicate"]; ?></a></td>
		<td id="Button3__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
<?php } ?>
		<td id="Button4__"><a href="index.php?a=76"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle"> <?php echo $_lang[\'cancel\']; ?></a></td>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnTVFormRender":

// From mutate_tmplvars.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click(); saveWait(\'mutate\');"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
<?php if($_GET[\'a\']==\'301\') { ?>
		<td id="Button2__"><a href="#" onclick="duplicaterecord();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/copy.gif" align="absmiddle" /> <?php echo $_lang["duplicate"]; ?></a></td>
		<td id="Button3__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
<?php } ?>
		<td id="Button4__"><a href="index.php?a=76"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnTempFormRender":

// From mutate_templates.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<td id="Button1__"><a href="#" onclick="documentDirty=false; document.mutate.save.click(); saveWait(\'mutate\');"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
<?php if($_REQUEST[\'a\']==\'16\') { ?>
		<td id="Button2__"><a href="#" onclick="duplicaterecord();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/copy.gif" align="absmiddle" /> <?php echo $_lang["duplicate"]; ?></a></td>
		<td id="Button3__"><a href="#" onclick="deletedocument();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
<?php } ?>
		<td id="Button4__"><a href="index.php?a=76"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnWUsrFormRender":

// From mutate_web_user.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<tr>
			<td id="Button1__"><a href="#" onclick="documentDirty=false; document.userform.save.click();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
			<td id="Button2__"><a href="#" onclick="deleteuser();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
				<?php if($_GET[\'a\']!=\'88\') { ?>
					<script>document.getElementById("Button2__").className=\'disabled\';</script>
				<?php } ?>
			<td id="Button3__"><a href="index.php?a=99"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
		</tr>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

//-------------------------------------------------------------------
   case "OnUserFormRender":

// From mutate_user.dynamic.action.php
ob_start();
?>
<div class="subTitle" style="width:100%">
	<span class="right"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/_tx_.gif" width="1" height="5" /><br />"<a href=\'javascript:scroll(0,0);\'><?php echo $_lang[\'scroll_up\']; ?></a>"</span>

	<table cellpadding="0" cellspacing="0" class="actionButtons">
		<tr>
			<td id="Button1__"><a href="#" onclick="documentDirty=false; document.userform.save.click();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/save.gif" align="absmiddle" /> <?php echo $_lang[\'save\']; ?></a></td>
			<td id="Button2__"><a href="#" onclick="deleteuser();"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/delete.gif" align="absmiddle" /> <?php echo $_lang[\'delete\']; ?></a></td>
				<?php if($_GET[\'a\']!=\'12\') { ?>	
					<script>document.getElementById("Button2__").className=\'disabled\';</script>
				<?php } ?>
			<td id="Button3__"><a href="index.php?a=75"><img src="media/style/<?php echo $manager_theme ? "$manager_theme/":""; ?>images/icons/cancel.gif" align="absmiddle" /> <?php echo $_lang[\'cancel\']; ?></a></td>
		</tr>
	</table>
</div>
<?php
$output = ob_get_clean();
    break;

}

// Add the new bar to the output
$e->output($output);
';
$p['Forgot Manager Login'] = '
if(!class_exists(\'ForgotManagerPassword\')) {
class ForgotManagerPassword{

 function ForgotManagerPassword(){
 
  $this->errors = array();
 
  $this->checkLang();

 }

 function getLink() {
 
  global $_lang;
 
$link = <<<EOD
<a id="ForgotManagerPassword-show_form" href="index.php?action=show_form">{$_lang[\'forgot_your_password\']}</a>
EOD;

  return $link;

 }

 function getForm() {

  global $_lang;

$form = <<<EOD
<label id="FMP-email_label" for="FMP_email">{$_lang[\'account_email\']}:</label>
<input id="FMP-email" type="text" />
<button id="FMP-email_button" type="button" onclick="window.location = \'index.php?action=send_email&email=\'+document.getElementById(\'FMP-email\').value;">{$_lang[\'send\']}</button>
EOD;

  return $form;

 }

 // Get user info including a hash unique to this user, password, and day
 function getUser($user_id=0, $username=\'\', $email=\'\', $hash=\'\') {

  global $modx, $_lang;
 
  $user_id = $modx->db->escape($user_id);
  $username = $modx->db->escape($username);
  $email = $modx->db->escape($email);
  $emaail = $modx->db->escape($hash);
  
  $pre = $modx->db->config[\'table_prefix\'];
  $site_id = $modx->config[\'site_id\'];
  $today = date(\'Yz\'); // Year and day of the year
  $wheres = array();
  $where = \'\';
  $user = array(\'id\'=>0, \'username\'=>\'\', \'email\'=>\'\', \'hash\'=>\'\');
 
  if(!empty($user_id)) { $wheres[] = "id = \'{$user_id}\'"; }
  if(!empty($username)) { $wheres[] = "username = \'{$username}\'"; }
  if(!empty($email)) { $wheres[] = "email = \'{$email}\'"; }
  if(!empty($hash)) { $wheres[] = "MD5(CONCAT(usr.username,usr.password,\'{$site_id}\',\'{$today}\')) = \'{$hash}\'"; }
 
  if($wheres) {
  
   $where = \' WHERE \'.implode(\' AND \',$wheres);
   $sql = "SELECT usr.id, usr.username, attr.email, MD5(CONCAT(usr.username,usr.password,\'{$site_id}\',\'{$today}\')) AS hash
           FROM `{$pre}manager_users` usr
           INNER JOIN `{$pre}user_attributes` attr ON usr.id = attr.internalKey
           {$where};";
   
   if($result = $modx->db->query($sql)){
    if($modx->db->getRecordCount($result)==1) {
     $user = $modx->db->getRow($result);
    }
   }
   
  }
  
  if(!$user[\'id\']) { $this->errors[] = $_lang[\'could_not_find_user\']; }

  return $user;

 }

 // Send an email with a link to login
 function sendEmail($to) {

  global $modx, $_lang;

  $subject = $_lang[\'password_change_request\'];
  $headers  = "MIME-Version: 1.0\\n".
              "Content-type: text/html; charset=iso-8859-1\\n".
              "From: MODx\\n".
              "Reply-To: no-reply@{$_SERVER[\'HTTP_HOST\']}\\n".
              "X-Mailer: PHP/".phpversion();
  
  $user = $this->getUser(0, \'\', $to);

  if($user[\'username\']) {

$body = <<<EOD
<p>{$_lang[\'forgot_password_email_intro\']} <a href="{$modx->config[\'site_url\']}manager/processors/login.processor.php?username={$user[\'username\']}&hash={$user[\'hash\']}">{$_lang[\'forgot_password_email_link\']}</a></p>

<p>{$_lang[\'forgot_password_email_instructions\']}</p>

<p><small>{$_lang[\'forgot_password_email_fine_print\']}</small></p>
EOD;

   $mail = mail($to, $subject, $body, $headers);
 
   if(!$mail) { $this->errors[] = $_lang[\'error_sending_email\']; }
 
   return $mail;
   
  }

 }
 
 function unblockUser($user_id) {
  
  global $modx, $_lang;
  $pre = $modx->db->config[\'table_prefix\'];
  
  $modx->db->update(array(\'blocked\'=>\'\', \'blockeduntil\'=>\'\'), "`{$pre}user_attributes`", "internalKey = \'{$user_id}\'");
  
  if(!$modx->db->getAffectedRows()) { $this->errors[] = $_lang[\'user_doesnt_exist\']; return; }
  
  return true;
  
 }
 
 function checkLang() {
  
  global $_lang;
  $eng = array();
  
  $eng[\'forgot_your_password\'] = \'Forgot your password?\';
  $eng[\'account_email\'] = \'Account email\';
  $eng[\'send\'] = \'Send\';
  $eng[\'password_change_request\'] = \'Password change request\';
  $eng[\'forgot_password_email_intro\'] = \'A request has been made to change the password on your account.\';
  $eng[\'forgot_password_email_link\'] = \'Click here to complete the process.\';
  $eng[\'forgot_password_email_instructions\'] = \'From there you will be able to change your password from the My Account menu.\';
  $eng[\'forgot_password_email_fine_print\'] = \'* The URL above will expire once you change your password or after today.\';
  $eng[\'error_sending_email\'] = \'Error sending email\';
  $eng[\'could_not_find_user\'] = \'Could not find user\';
  $eng[\'user_doesnt_exist\'] = \'User does not exist\';
  $eng[\'email_sent\'] = \'Email sent\';
  
  foreach($eng as $key=>$value) {
   if(empty($_lang[$key])) { $_lang[$key] = $value; }
  }
  
 }
 
 function getErrorOutput() {
 
  $outptut = \'\';
 
  if($this->errors) {
   $output = \'<span class="error">\'.implode(\'</span><span class="errors">\', $this->errors).\'</span>\';
  }
 
  return $output;
 
 }
 
}
}

global $_lang;

$output = \'\';
$event_name = $modx->Event->name;
$action = (empty($_GET[\'action\']) ? \'\' : $_GET[\'action\']);
$username = (empty($_GET[\'username\']) ? \'\' : $_GET[\'username\']);
$to = (empty($_GET[\'email\']) ? \'\' : $_GET[\'email\']);
$hash = (empty($_GET[\'hash\']) ? \'\' : $_GET[\'hash\']);
$forgot = new ForgotManagerPassword();

if($event_name == \'OnManagerLoginFormRender\') {

 switch($action) {

  case \'show_form\':
   $output = $forgot->getForm();
   break;
  
  case \'send_email\':
   if($forgot->sendEmail($to)) { $output = $_lang[\'email_sent\']; }
   break;
  
  default:
   $output = $forgot->getLink();

 }
 
 if($forgot->errors) { $output = $forgot->getErrorOutput() . $forgot->getLink(); }
 
}

if($event_name == \'OnBeforeManagerLogin\') {
 $user = $forgot->getUser(0, $username, \'\', $hash);
 if($user[\'id\'] && !$forgot->errors) {
  $forgot->unblockUser($user[\'id\']);
 }
}

if($event_name == \'OnManagerAuthentication\' && $hash) {
 $user = $forgot->getUser(0, \'\', \'\', $hash);
 $output = ($user[\'id\'] > 0 && !$forgot->errors);
}

$modx->Event->output($output);
';
$p['Inherit Parent Template'] = '/*
 * Inherit Template from Parent
 * Written By Raymond Irving - 12 Oct 2006
 *
 * Simply results in new documents inherriting the template 
 * of their parent folder upon creating a new document
 *
 * Configuration:
 * check the OnDocFormPrerender event
 *
 * Version 1.0
 *
 */

global $content;
$e = &$modx->Event;

switch($e->name) {
  case \'OnDocFormPrerender\':
    if(($_REQUEST[\'pid\'] > 0) && ($id == 0)) {
      if($parent = $modx->getPageInfo($_REQUEST[\'pid\'],0,\'template\')) {
        $content[\'template\'] = $parent[\'template\'];
      }
    }
    break;

  default:
    return;
    break;
}
';
$p['TinyMCE'] = '/*
 * TinyMCE RichText Editor Plugin 
 * Written By Jeff Whitfield - September 9, 2005
 * Modified On - September 1, 2007
 *
 * Version 2.1.2
 *
 * Events: OnRichTextEditorInit, OnRichTextEditorRegister, OnInterfaceSettingsRender
 *
 */

include_once $modx->config[\'base_path\'].\'assets/plugins/tinymce212/tinymce.lang.php\';
include_once $modx->config[\'base_path\'].\'assets/plugins/tinymce212/tinymce.functions.php\';

// Set path and base setting variables
if(!isset($tinyPath)) { 
	global $tinyPath, $tinyURL;
	$tinyPath = $modx->config[\'base_path\'].\'assets/plugins/tinymce212\'; 
	$tinyURL = $modx->config[\'base_url\'].\'assets/plugins/tinymce212\'; 
}
$base_url = $modx->config[\'base_url\'];
$displayStyle = ( ($_SESSION[\'browser\']==\'mz\') || ($_SESSION[\'browser\']==\'op\') ) ? "table-row" : "block" ;

// Handle event
$e = &$modx->Event; 
switch ($e->name) { 
	case "OnRichTextEditorRegister": // register only for backend
		$e->output("TinyMCE");
		break;

	case "OnRichTextEditorInit": 
		if($editor=="TinyMCE") {
			$elementList = implode(",", $elements);
			if(isset($forfrontend)||$modx->isFrontend()){
				$frontend = \'true\';
				$frontend_language = isset($modx->config[\'fe_editor_lang\']) ? $modx->config[\'fe_editor_lang\']:"";
				$tinymce_language = getTinyMCELang($frontend_language);
				$html = getTinyMCEScript($elementList,$webtheme,$width,$height,$tinymce_language,$frontend,$base_url, $webPlugins, $webButtons1, $webButtons2, $webButtons3, $webButtons4, $disabledButtons, $tinyFormats, $entity_encoding, $entities, $tinyPathOptions, $tinyCleanup, $tinyResizing, $modx->config[\'editor_css_path\'], $modx->config[\'tinymce_css_selectors\'], $modx->config[\'use_browser\'], $webAlign, null, null, $tinyLinkList, $customparams, $tinyURL);
			} else {
				$frontend = \'false\';
				$manager_language = $modx->config[\'manager_language\'];
				$tinymce_language = getTinyMCELang($manager_language);
				$html = getTinyMCEScript($elementList, $modx->config[\'tinymce_editor_theme\'], $width=\'100%\', $height=\'400px\', $tinymce_language, $frontend, $modx->config[\'base_url\'], $modx->config[\'tinymce_custom_plugins\'], $modx->config[\'tinymce_custom_buttons1\'], $modx->config[\'tinymce_custom_buttons2\'], $modx->config[\'tinymce_custom_buttons3\'], $modx->config[\'tinymce_custom_buttons4\'], $disabledButtons, $tinyFormats, $entity_encoding, $entities, $tinyPathOptions, $tinyCleanup, $tinyResizing, $modx->config[\'editor_css_path\'], $modx->config[\'tinymce_css_selectors\'], $modx->config[\'use_browser\'], $modx->config[\'manager_direction\'], $advimage_styles, $advlink_styles, $tinyLinkList, $customparams, $tinyURL);
			}
			$e->output($html);
		}		
		break;

	case "OnInterfaceSettingsRender":
		global $usersettings,$settings;
		$action = $modx->manager->action;
		switch ($action) {
    		case 11:
        		$tinysettings = "";
        		break;
    		case 12:
        		$tinysettings = $usersettings;
        		break;
    		default:
        		$tinysettings = $settings;
        		break;
    	}
		$tinymce_editor_theme = $tinysettings[\'tinymce_editor_theme\'];
		$tinymce_css_selectors = $tinysettings[\'tinymce_css_selectors\'];
		$tinymce_custom_plugins = $tinysettings[\'tinymce_custom_plugins\'];
		$tinymce_custom_buttons1 = $tinysettings[\'tinymce_custom_buttons1\'];
		$tinymce_custom_buttons2 = $tinysettings[\'tinymce_custom_buttons2\'];
		$tinymce_custom_buttons3 = $tinysettings[\'tinymce_custom_buttons3\'];
		$tinymce_custom_buttons4 = $tinysettings[\'tinymce_custom_buttons4\'];
		$manager_language = $modx->config[\'manager_language\'];
		$html = getTinyMCESettings($_lang, $tinyPath, $modx->config[\'manager_language\'], $modx->config[\'use_editor\'], $tinymce_editor_theme, $tinymce_css_selectors, $tinymce_custom_plugins, $tinymce_custom_buttons1, $tinymce_custom_buttons2, $tinymce_custom_buttons3, $tinymce_custom_buttons4, $displayStyle, $action);
		$e->output($html);
		break;

   default :    
      return; // stop here - this is very important. 
      break; 
}
';
$p['TinyMCEProps'] = '&tinyFormats=Block Formats;text;p,h1,h2,h3,h4,h5,h6,div,blockquote,code,pre,address &entity_encoding=Entity Encoding;list;named,numeric,raw;named &entities=Entities;text; &tinyPathOptions=Path Options;list;rootrelative,docrelative,fullpathurl;rootrelative &tinyCleanup=Cleanup;list;enabled,disabled;enabled &tinyResizing=Advanced Resizing;list;true,false;false &advimage_styles=Advanced Image Styles;text; &advlink_styles=Advanced Link Styles;text; &disabledButtons=Disabled Buttons;text; &tinyLinkList=Link List;list;enabled,disabled;enabled &webtheme=Web Theme;list;simple,advanced,editor,custom;simple &webPlugins=Web Plugins;text;style,advimage,advlink,searchreplace,print,contextmenu,paste,fullscreen,nonbreaking,xhtmlxtras,visualchars,media &webButtons1=Web Buttons 1;text;undo,redo,selectall,separator,pastetext,pasteword,separator,search,replace,separator,nonbreaking,hr,charmap,separator,image,link,unlink,anchor,media,separator,cleanup,removeformat,separator,fullscreen,print,code,help &webButtons2=Web Buttons 2;text;bold,italic,underline,strikethrough,sub,sup,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,separator,styleprops &webButtons3=Web Buttons 3;text; &webButtons4=Web Buttons 4;text; &webAlign=Web Toolbar Alignment;list;ltr,rtl;ltr ';
$p['Search Highlighting'] = '/*
  ------------------------------------------------------------------------
  Plugin: Search_Highlight v1.2.1
  ------------------------------------------------------------------------
  Changes:
  01/03/07 - Added fies/updates from forum from users mikkelwe/identity
  (better highlight replacement, additional div around term/removal message)
  ------------------------------------------------------------------------
  Description: When a user clicks on the link from the AjaxSearch results
    the target page will have the terms highlighted.
  ------------------------------------------------------------------------
  Created By:  Susan Ottwell (sottwell@sottwell.com)
               Kyle Jaebker (kjaebker@muddydogpaws.com)
  ------------------------------------------------------------------------
  Based off the the code by Susan Ottwell (www.sottwell.com)
    http://modxcms.com/forums/index.php/topic,1237.0.html
  ------------------------------------------------------------------------
  CSS:
    The classes used for the highlighting are the same as the AjaxSearch
  ------------------------------------------------------------------------
  Notes:
    To add a link to remove the highlighting and to show the searchterms
    put the following on your page where you would like this to appear:
    
      <!--search_terms-->
    
    Example output for this:
    
      Search Terms: the, template
      Remove Highlighting
      
    Set the following variables to change the text:
    
      $termText - the text before the search terms
      $removeText - the text for the remove link
  ------------------------------------------------------------------------
*/

if(isset($_GET[\'searched\']) && isset($_GET[\'highlight\'])) {

  // Set these to customize the text for the highlighting key
  // --------------------------------------------------------
     $termText = \'<div class="searchTerms">Search Terms: \';
     $removeText = \'Remove Highlighting\';
  // --------------------------------------------------------

  $highlightText = $termText;

  $searched = strip_tags(urldecode($_REQUEST[\'searched\'])); 
  $highlight = strip_tags(urldecode($_REQUEST[\'highlight\'])); 
  $output = $modx->documentOutput; // get the parsed document

  $body = explode("<body>", $output); // break out the head

  $searchArray = explode(\' \', $searched); // break apart the search terms

  $highlightClass = explode(\' \',$highlight); // break out the highlight classes

  $i = 0; // for individual class names

  foreach($searchArray as $word) {
    $i++;
    $class = $highlightClass[0].\' \'.$highlightClass[$i];

    $highlightText .= ($i > 1) ? \', \' : \'\';
    $highlightText .= \'<span class="\'.$class.\'">\'.$word.\'</span>\';

    $pattern = \'/\' . preg_quote($word) . \'(?=[^>]*<)/i\';
    $replacement = \'<span class="\' . $class . \'">${0}</span>\';
    $body[1] = preg_replace($pattern, $replacement, $body[1]);
  }

  $output = implode("<body>", $body);

  $removeUrl = $modx->makeUrl($modx->documentIdentifier);
  $highlightText .= \'<br /><a href="\'.$removeUrl.\'" class="ajaxSearch_removeHighlight">\'.$removeText.\'</a></div>\';

  $output = str_replace(\'<!--search_terms-->\',$highlightText,$output);

  $modx->documentOutput = $output;
}';
$e = &$this->pluginEvent;
$e['OnBeforeManagerLogin'] = array('Forgot Manager Login');
$e['OnChunkFormRender'] = array('Bottom Button Bar');
$e['OnDocFormPrerender'] = array('Inherit Parent Template');
$e['OnDocFormRender'] = array('Bottom Button Bar');
$e['OnInterfaceSettingsRender'] = array('TinyMCE');
$e['OnManagerAuthentication'] = array('Forgot Manager Login');
$e['OnManagerLoginFormRender'] = array('Forgot Manager Login');
$e['OnModFormRender'] = array('Bottom Button Bar');
$e['OnPluginFormRender'] = array('Bottom Button Bar');
$e['OnRichTextEditorInit'] = array('TinyMCE');
$e['OnRichTextEditorRegister'] = array('TinyMCE');
$e['OnSnipFormRender'] = array('Bottom Button Bar');
$e['OnTempFormRender'] = array('Bottom Button Bar');
$e['OnTVFormRender'] = array('Bottom Button Bar');
$e['OnUserFormRender'] = array('Bottom Button Bar');
$e['OnWebPagePrerender'] = array('Search Highlighting');
$e['OnWUsrFormRender'] = array('Bottom Button Bar');
?>