Advertisement
Guest User

Tim Black

a guest
Dec 28th, 2009
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 135.18 KB | None | 0 0
  1. === modified file 'administrator/components/com_cb_search/admin.cb_search.html.php'
  2. --- administrator/components/com_cb_search/admin.cb_search.html.php 2008-07-04 21:14:01 +0000
  3. +++ administrator/components/com_cb_search/admin.cb_search.html.php 2009-03-11 20:50:16 +0000
  4. @@ -27,7 +27,7 @@
  5. $update_msg = "";
  6.  
  7. } else {
  8.  
  9. $update_msg = _CB_AS_MENU_MESSAGE;
  10.  
  11. - }
  12.  
  13. + }
  14.  
  15.  
  16.  
  17. $tmpl = & cb_as :: createTemplate();
  18.  
  19. $tmpl->setAttribute('body', 'src', 'cb_search.showmenu.tmpl.html');
  20.  
  21. @@ -40,37 +40,15 @@
  22. $tmpl->addVar('body', 'cb_as_sql2', _CB_AS_SQL2 );
  23.  
  24. $tmpl->addVar('body', 'cb_as_fields', _CB_AS_FIELDS );
  25.  
  26. $tmpl->addVar('body', 'cb_as_update', _CB_AS_UPDATE );
  27.  
  28. - $tmpl->addVar('body', 'cb_as_adv_user', _CB_AS_ADV_USER );
  29.  
  30. -
  31.  
  32. + $tmpl->addVar('body', 'cb_as_adv_user', _CB_AS_ADV_USER );
  33.  
  34. +
  35.  
  36. $tmpl->addVar('body', 'mosConfig_live_site', $mosConfig_live_site);
  37.  
  38. -
  39.  
  40. - $trunkpath = "http://www.emptorum.com/update/cbas_version.xml";
  41.  
  42. - $localpath = $mosConfig_absolute_path."/administrator/components/com_cb_search/cbas_version.xml";
  43.  
  44. -
  45.  
  46. - $trunkversion = cb_as :: getXMLElementData("version", $trunkpath);
  47.  
  48. - $trunkinfo = cb_as :: getXMLElementData("information", $trunkpath);
  49.  
  50. - $trunkdate = cb_as :: getXMLElementData("date", $trunkpath);
  51.  
  52. - $localversion = cb_as :: getXMLElementData("version", $localpath);
  53.  
  54. -
  55.  
  56. - $tmpl->addVar('body', 'localversion', $localversion );
  57.  
  58. - $tmpl->addVar('body', 'trunkversion', $trunkversion );
  59.  
  60. -
  61.  
  62. - if ($trunkversion <> $localversion){
  63.  
  64. - $tmpl->addVar('body', 'trunkinfo', $trunkinfo );
  65.  
  66. - $tmpl->addVar('body', 'trunkdate', $trunkdate." - " );
  67.  
  68. - $updatelink = "<br><a href=\"http://www.emptorum.com/index.php?option=com_docman&task=cat_view&gid=17&Itemid=28\">"._CB_AS_NEWVERSION."</a>";
  69.  
  70. - $tmpl->addVar('body', 'update', $updatelink );
  71.  
  72. - } else {
  73.  
  74. - $tmpl->addVar('body', 'trunkinfo', '' );
  75.  
  76. - $tmpl->addVar('body', 'trunkdate', '' );
  77.  
  78. - $tmpl->addVar('body', 'update', '' );
  79.  
  80. - }
  81.  
  82. -
  83.  
  84. +
  85.  
  86. $tmpl->displayParsedTemplate('form');
  87.  
  88. }
  89.  
  90.  
  91.  
  92. function showconfig($option){
  93.  
  94. - global $mosConfig_absolute_path, $mosConfig_live_site, $acl, $database;
  95.  
  96. + global $mosConfig_absolute_path, $mosConfig_live_site;
  97.  
  98. require ($mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php");
  99.  
  100. //Generate the List for cbsa_hack
  101.  
  102.  
  103.  
  104. @@ -89,9 +67,15 @@
  105. $cbsa_list12 = mosHTML :: yesnoRadioList('cbsa_show_title', $cbsa_class, $cbsa_show_title );
  106.  
  107. $cbsa_list14 = mosHTML :: yesnoRadioList('cbsa_show_sql_error', $cbsa_class, $cbsa_show_sql_error );
  108.  
  109. $cbsa_list15 = mosHTML :: yesnoRadioList('cbsa_deactivate_allowaccess', $cbsa_class, $cbsa_deactivate_allowaccess );
  110.  
  111. - $cbsa_list17 = mosHTML :: yesnoRadioList('cbsa_userlist', $cbsa_class, $cbsa_userlist );
  112.  
  113. - $cbsa_list19 = mosHTML :: yesnoRadioList('cbsa_ajax_on', $cbsa_class, $cbsa_ajax_on );
  114.  
  115. -
  116.  
  117. + //Age search -- BEGIN
  118.  
  119. + $cbsa_list16 = mosHTML::yesnoRadioList('cbsa_enable_age_search',$cbsa_class,$cbsa_enable_age_search);
  120.  
  121. + $cbsa_list17 = mosGetParam($_REQUEST,'cbsa_birthday_fieldname',$cbsa_birthday_fieldname);
  122.  
  123. + $cbsa_list18 = mosGetParam($_REQUEST,'cbsa_lower_age_limit',$cbsa_lower_age_limit);
  124.  
  125. + $cbsa_list19 = mosGetParam($_REQUEST,'cbsa_upper_age_limit',$cbsa_upper_age_limit);
  126.  
  127. + //Age search -- END
  128.  
  129. + //Photo only -- BEGIN
  130.  
  131. + $cbsa_list20 = mosHTML::yesnoRadioList('cbsa_enable_photo_only_search',$cbsa_class,$cbsa_enable_photo_only_search);
  132.  
  133. +
  134.  
  135. $searchoperator = mosGetParam( $_REQUEST, 'cbsa_page_nav', $cbsa_page_nav );
  136.  
  137. $searchoperators = array();
  138.  
  139.  
  140.  
  141. @@ -139,75 +123,22 @@
  142.  
  143.  
  144. $log_result = mosGetParam( $_REQUEST, 'cbsa_show_result', $cbsa_show_result );
  145.  
  146. $logesult = array();
  147.  
  148. -
  149.  
  150. +
  151.  
  152. $logesult = new stdClass();
  153.  
  154. $logesult->value = '0';
  155.  
  156. $logesult->text = _CB_AS_SHOW_RESULT_ALL;
  157.  
  158. $logesults[] = $logesult;
  159.  
  160. -
  161.  
  162. +
  163.  
  164. $logesult = new stdClass();
  165.  
  166. $logesult->value = '1';
  167.  
  168. $logesult->text = _CB_AS_SHOW_RESULT_NONE;
  169.  
  170. $logesults[] = $logesult;
  171.  
  172.  
  173.  
  174. - $cbsa_list13= mosHTML::radioList( $logesults, 'cbsa_show_result', '', $cbsa_show_result );
  175.  
  176. -
  177.  
  178. - $searchphrases = array();
  179.  
  180. -
  181.  
  182. - $phrase = new stdClass();
  183.  
  184. - $phrase->value = 'any';
  185.  
  186. - $phrase->text = _SEARCH_ANYWORDS;
  187.  
  188. - $searchphrases[] = $phrase;
  189.  
  190. -
  191.  
  192. - $phrase = new stdClass();
  193.  
  194. - $phrase->value = 'all';
  195.  
  196. - $phrase->text = _SEARCH_ALLWORDS;
  197.  
  198. - $searchphrases[] = $phrase;
  199.  
  200. -
  201.  
  202. - $phrase = new stdClass();
  203.  
  204. - $phrase->value = 'exact';
  205.  
  206. - $phrase->text = _SEARCH_PHRASE;
  207.  
  208. - $searchphrases[] = $phrase;
  209.  
  210. -
  211.  
  212. - $cbsa_list18= mosHTML::radioList( $searchphrases, 'cbsa_simple_default', '', $cbsa_simple_default );
  213.  
  214. -
  215.  
  216. - $ajaximages = array();
  217.  
  218. -
  219.  
  220. - $ajaximage = new stdClass();
  221.  
  222. - $ajaximage->value = 'spinner';
  223.  
  224. - $ajaximage->text = _CB_AS_AJAX_IMAGE_SPINNER;
  225.  
  226. - $ajaximages[] = $ajaximage;
  227.  
  228. -
  229.  
  230. - $ajaximage = new stdClass();
  231.  
  232. - $ajaximage->value = 'toolbar';
  233.  
  234. - $ajaximage->text = _CB_AS_AJAX_IMAGE_Toolbar;
  235.  
  236. - $ajaximages[] = $ajaximage;
  237.  
  238. -
  239.  
  240. - $cbsa_list20= mosHTML::radioList( $ajaximages, 'cbsa_ajax_image', '', $cbsa_ajax_image );
  241.  
  242. -
  243.  
  244. + $cbsa_list13= mosHTML::radioList( $logesults, 'cbsa_show_result', '', $cbsa_show_result );
  245.  
  246. +
  247.  
  248. $cbsa_path = $mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php";
  249.  
  250. $cbsa_file_writeable_text = cb_as::green(cb_as::filedir_writeable($cbsa_path)) ? _CB_AS_WRITEABLE : _CB_AS_NOTWRITEABLE;
  251.  
  252. -
  253.  
  254. - //User types
  255.  
  256. - $query = "SELECT group_id AS value, name AS text FROM #__core_acl_aro_groups WHERE name <> 'ROOT' AND name <> 'USERS'";
  257.  
  258. - $database->setQuery($query);
  259.  
  260. - $usertype = $database->loadObjectList();
  261.  
  262. -
  263.  
  264. - //Generate the List for cbsa_list16
  265.  
  266. - $lookup = preg_split('/,/', $cbsa_usergid);
  267.  
  268. - $cbsa_list16 = "<select class=\"inputbox\" size=\"5\" name=\"cbsa_usergid[]\" multiple=\"multiple\">\n";
  269.  
  270. - foreach ($usertype as $value) {
  271.  
  272. - $menutype = $value->value;
  273.  
  274. - $selected = "";
  275.  
  276. - foreach ($lookup as $value2) {
  277.  
  278. - if ($menutype == $value2) {
  279.  
  280. - $selected = "selected";
  281.  
  282. - }
  283.  
  284. - }
  285.  
  286. - $cbsa_list16 .= " <option $selected value=\"".$menutype."\">".$value->text."</option>\n";
  287.  
  288. - }
  289.  
  290. - $cbsa_list16 .= " </select>\n";
  291.  
  292. -
  293.  
  294. +
  295.  
  296. //we build the template mow
  297.  
  298. $tmpl = & cb_as :: createTemplate();
  299.  
  300. $tmpl->readTemplatesFromInput('cb_search.config.tmpl.html');
  301.  
  302. @@ -221,13 +152,10 @@
  303. $tmpl->addVar('main', 'cb_as_comparision_help', _CB_AS_COMPARISION_HELP );
  304.  
  305. $tmpl->addVar('main', 'cb_as_allow', _CB_AS_ALLOW );
  306.  
  307. $tmpl->addVar('main', 'cb_as_allow_help', _CB_AS_ALLOW_HELP );
  308.  
  309. - $tmpl->addVar('main', 'cb_as_allow_menu_1', _CB_AS_ALLOW_MENU_1 );
  310.  
  311. + $tmpl->addVar('main', 'cb_as_allow_menu_1', _CB_AS_ALLOW_MENU_1 );
  312.  
  313. $tmpl->addVar('main', 'cb_as_allow_menu_1_help', _CB_AS_ALLOW_MENU_1_HELP );
  314.  
  315. $tmpl->addVar('main', 'cbsa_list4', $cbsa_list4 );
  316.  
  317. - $tmpl->addVar('main', 'cb_as_simple_default', _CB_AS_SIMPLE_DEFAULT );
  318.  
  319. - $tmpl->addVar('main', 'cb_as_simple_default_help', _CB_AS_SIMPLE_DEFAULT_HELP );
  320.  
  321. - $tmpl->addVar('main', 'cbsa_list18', $cbsa_list18 );
  322.  
  323. - $tmpl->addVar('main', 'cb_as_allow_menu_2', _CB_AS_ALLOW_MENU_2 );
  324.  
  325. + $tmpl->addVar('main', 'cb_as_allow_menu_2', _CB_AS_ALLOW_MENU_2 );
  326.  
  327. $tmpl->addVar('main', 'cb_as_allow_menu_2_help', _CB_AS_ALLOW_MENU_2_HELP );
  328.  
  329. $tmpl->addVar('main', 'cbsa_list5', $cbsa_list5 );
  330.  
  331. $tmpl->addVar('main', 'cb_as_allow_pagnav', _CB_AS_ALLOW_PAGNAV );
  332.  
  333. @@ -260,18 +188,26 @@
  334. $tmpl->addVar('main', 'cb_as_deactivate_allowaccess', _CB_AS_DEACTIVATE_ALLOWACCESS );
  335.  
  336. $tmpl->addVar('main', 'cb_as_deactivate_allowaccess_help', _CB_AS_DEACTIVATE_ALLOWACCESS_HELP );
  337.  
  338. $tmpl->addVar('main', 'cbsa_list15', $cbsa_list15 );
  339.  
  340. - $tmpl->addVar('main', 'cb_as_usertype', _CB_AS_USERTYPE );
  341.  
  342. - $tmpl->addVar('main', 'cb_as_usertype_help', _CB_AS_USERTYPE_HELP );
  343.  
  344. + //Age Search -- BEGIN
  345.  
  346. $tmpl->addVar('main', 'cbsa_list16', $cbsa_list16 );
  347.  
  348. - $tmpl->addVar('main', 'cb_as_showlist', _CB_AS_SHOWLIST );
  349.  
  350. - $tmpl->addVar('main', 'cb_as_showlist_help', _CB_AS_SHOWLIST_HELP );
  351.  
  352. + $tmpl->addVar('main', 'cb_as_enable_age_search',_CB_AS_ENABLE_AGE_SEARCH);
  353.  
  354. + $tmpl->addVar('main', 'cb_as_enable_age_search_help',_CB_AS_ENABLE_AGE_SEARCH_HELP);
  355.  
  356. $tmpl->addVar('main', 'cbsa_list17', $cbsa_list17 );
  357.  
  358. - $tmpl->addVar('main', 'cb_as_ajax_on', _CB_AS_AJAX_ON );
  359.  
  360. - $tmpl->addVar('main', 'cb_as_ajax_on_help', _CB_AS_AJAX_ON_HELP );
  361.  
  362. + $tmpl->addVar('main', 'cb_as_birthday_fieldname',_CB_AS_BIRTHDAY_FIELDNAME);
  363.  
  364. + $tmpl->addVar('main', 'cb_as_birthday_fieldname_help',_CB_AS_BIRTHDAY_FIELDNAME_HELP);
  365.  
  366. + $tmpl->addVar('main', 'cbsa_list18', $cbsa_list18 );
  367.  
  368. + $tmpl->addVar('main', 'cb_as_lower_age_limit',_CB_AS_LOWER_AGE_LIMIT);
  369.  
  370. + $tmpl->addVar('main', 'cb_as_lower_age_limit_help',_CB_AS_LOWER_AGE_LIMIT_HELP);
  371.  
  372. $tmpl->addVar('main', 'cbsa_list19', $cbsa_list19 );
  373.  
  374. - $tmpl->addVar('main', 'cb_as_ajax_image', _CB_AS_AJAX_IMAGE );
  375.  
  376. - $tmpl->addVar('main', 'cb_as_ajax_image_help', _CB_AS_AJAX_IMAGE_HELP );
  377.  
  378. + $tmpl->addVar('main', 'cb_as_upper_age_limit',_CB_AS_UPPER_AGE_LIMIT);
  379.  
  380. + $tmpl->addVar('main', 'cb_as_upper_age_limit_help',_CB_AS_UPPER_AGE_LIMIT_HELP);
  381.  
  382. + //Age Search -- END
  383.  
  384. + //Photo only -- BEGIN
  385.  
  386. $tmpl->addVar('main', 'cbsa_list20', $cbsa_list20 );
  387.  
  388. + $tmpl->addVar('main', 'cb_as_enable_photo_only_search',_CB_AS_ENABLE_PHOTO_ONLY_SEARCH);
  389.  
  390. + $tmpl->addVar('main', 'cb_as_enable_photo_only_search_help',_CB_AS_ENABLE_PHOTO_ONLY_SEARCH_HELP);
  391.  
  392. + //Photo only -- END
  393.  
  394. +
  395.  
  396. $tmpl->addVar('main', 'cbsa_list3', $cbsa_list3 );
  397.  
  398.  
  399.  
  400. $tmpl->addVar('main', 'cb_as_writeable', $cbsa_file_writeable_text );
  401.  
  402.  
  403. === modified file 'administrator/components/com_cb_search/admin.cb_search.php'
  404. --- administrator/components/com_cb_search/admin.cb_search.php 2008-07-04 21:14:01 +0000
  405. +++ administrator/components/com_cb_search/admin.cb_search.php 2009-03-11 20:50:16 +0000
  406. @@ -18,7 +18,7 @@
  407.  
  408.  
  409. $cid = mosGetParam( $_POST, 'cid', array(0) );
  410.  
  411. if (!is_array( $cid )) {
  412.  
  413. - $cid = array(0);
  414.  
  415. + $cid = array(0);
  416.  
  417. }
  418.  
  419.  
  420.  
  421. require_once ($mainframe->getPath('admin_html'));
  422.  
  423. @@ -26,9 +26,9 @@
  424.  
  425.  
  426. // Get the right language if it exists
  427.  
  428. if (file_exists($mosConfig_absolute_path.'/administrator/components/com_cb_search/languages/'.$mosConfig_lang.'.php')) {
  429.  
  430. - include ($mosConfig_absolute_path.'/administrator/components/com_cb_search/languages/'.$mosConfig_lang.'.php');
  431.  
  432. + include ($mosConfig_absolute_path.'/administrator/components/com_cb_search/languages/'.$mosConfig_lang.'.php');
  433.  
  434. } else {
  435.  
  436. - include ($mosConfig_absolute_path.'/administrator/components/com_cb_search/languages/english.php');
  437.  
  438. + include ($mosConfig_absolute_path.'/administrator/components/com_cb_search/languages/english.php');
  439.  
  440. }
  441.  
  442.  
  443.  
  444. //Get the CB language file
  445.  
  446. @@ -40,95 +40,95 @@
  447.  
  448.  
  449.  
  450.  
  451. switch ($task) {
  452.  
  453. - case "config" :
  454.  
  455. - showconfig($option);
  456.  
  457. - break;
  458.  
  459. -
  460.  
  461. - case "saveconfig" :
  462.  
  463. - saveconfig($option, 1);
  464.  
  465. - break;
  466.  
  467. -
  468.  
  469. - case "update" :
  470.  
  471. - update($option);
  472.  
  473. - break;
  474.  
  475. -
  476.  
  477. - case "sql" :
  478.  
  479. - sql_list($option, 1);
  480.  
  481. - break;
  482.  
  483. -
  484.  
  485. - case "sql2" :
  486.  
  487. - sql_list($option, 2);
  488.  
  489. - break;
  490.  
  491. -
  492.  
  493. - case "published" :
  494.  
  495. - published($cid, 1, $option);
  496.  
  497. - break;
  498.  
  499. - case "unpublished" :
  500.  
  501. - published($cid, 0, $option);
  502.  
  503. - break;
  504.  
  505. -
  506.  
  507. - case "fields":
  508.  
  509. - fields($option);
  510.  
  511. - break;
  512.  
  513. -
  514.  
  515. - case "save":
  516.  
  517. - save($option, $category);
  518.  
  519. - break;
  520.  
  521. -
  522.  
  523. - case "sql_default":
  524.  
  525. - sql_default($cid, 1, $option, $category);
  526.  
  527. -
  528.  
  529. - case "sql_edit1" :
  530.  
  531. - edit($id, $option, 1);
  532.  
  533. - break;
  534.  
  535. -
  536.  
  537. - case "sql_edit2" :
  538.  
  539. - edit($id, $option, 2);
  540.  
  541. - break;
  542.  
  543. -
  544.  
  545. - case "sql_del" :
  546.  
  547. - remove( $cid, $option, $category);
  548.  
  549. - break;
  550.  
  551. -
  552.  
  553. - case "sql_new":
  554.  
  555. - edit('0', $option, 1);
  556.  
  557. - break;
  558.  
  559. -
  560.  
  561. - case "sql_new2":
  562.  
  563. - edit('0', $option, 2);
  564.  
  565. - break;
  566.  
  567. -
  568.  
  569. - case "sql_cancel":
  570.  
  571. - sql_cancel($option, $category);
  572.  
  573. - break;
  574.  
  575. -
  576.  
  577. - case "sql_cancel2":
  578.  
  579. - sql_cancel2($option, $category);
  580.  
  581. - break;
  582.  
  583. -
  584.  
  585. - case "searchable":
  586.  
  587. - searchable($cid, 1, $option);
  588.  
  589. - break;
  590.  
  591. -
  592.  
  593. - case "unsearchable":
  594.  
  595. - searchable($cid, 0, $option);
  596.  
  597. - break;
  598.  
  599. -
  600.  
  601. - case "orderup":
  602.  
  603. - order($cid[0],-1,$option);
  604.  
  605. - break;
  606.  
  607. -
  608.  
  609. - case "orderdown":
  610.  
  611. - order($cid[0],1,$option);
  612.  
  613. - break;
  614.  
  615. -
  616.  
  617. - case 'saveorder':
  618.  
  619. - saveOrder( $cid, $option );
  620.  
  621. - break;
  622.  
  623. -
  624.  
  625. - default :
  626.  
  627. - showmenu($option);
  628.  
  629. - break;
  630.  
  631. + case "config" :
  632.  
  633. + showconfig($option);
  634.  
  635. + break;
  636.  
  637. +
  638.  
  639. + case "saveconfig" :
  640.  
  641. + saveconfig($option, 1);
  642.  
  643. + break;
  644.  
  645. +
  646.  
  647. + case "update" :
  648.  
  649. + update($option);
  650.  
  651. + break;
  652.  
  653. +
  654.  
  655. + case "sql" :
  656.  
  657. + sql_list($option, 1);
  658.  
  659. + break;
  660.  
  661. +
  662.  
  663. + case "sql2" :
  664.  
  665. + sql_list($option, 2);
  666.  
  667. + break;
  668.  
  669. +
  670.  
  671. + case "published" :
  672.  
  673. + published($cid, 1, $option);
  674.  
  675. + break;
  676.  
  677. + case "unpublished" :
  678.  
  679. + published($cid, 0, $option);
  680.  
  681. + break;
  682.  
  683. +
  684.  
  685. + case "fields":
  686.  
  687. + fields($option);
  688.  
  689. + break;
  690.  
  691. +
  692.  
  693. + case "save":
  694.  
  695. + save($option, $category);
  696.  
  697. + break;
  698.  
  699. +
  700.  
  701. + case "sql_default":
  702.  
  703. + sql_default($cid, 1, $option, $category);
  704.  
  705. +
  706.  
  707. + case "sql_edit1" :
  708.  
  709. + edit($id, $option, 1);
  710.  
  711. + break;
  712.  
  713. +
  714.  
  715. + case "sql_edit2" :
  716.  
  717. + edit($id, $option, 2);
  718.  
  719. + break;
  720.  
  721. +
  722.  
  723. + case "sql_del" :
  724.  
  725. + remove( $cid, $option, $category);
  726.  
  727. + break;
  728.  
  729. +
  730.  
  731. + case "sql_new":
  732.  
  733. + edit('0', $option, 1);
  734.  
  735. + break;
  736.  
  737. +
  738.  
  739. + case "sql_new2":
  740.  
  741. + edit('0', $option, 2);
  742.  
  743. + break;
  744.  
  745. +
  746.  
  747. + case "sql_cancel":
  748.  
  749. + sql_cancel($option, $category);
  750.  
  751. + break;
  752.  
  753. +
  754.  
  755. + case "sql_cancel2":
  756.  
  757. + sql_cancel2($option, $category);
  758.  
  759. + break;
  760.  
  761. +
  762.  
  763. + case "searchable":
  764.  
  765. + searchable($cid, 1, $option);
  766.  
  767. + break;
  768.  
  769. +
  770.  
  771. + case "unsearchable":
  772.  
  773. + searchable($cid, 0, $option);
  774.  
  775. + break;
  776.  
  777. +
  778.  
  779. + case "orderup":
  780.  
  781. + order($cid[0],-1,$option);
  782.  
  783. + break;
  784.  
  785. +
  786.  
  787. + case "orderdown":
  788.  
  789. + order($cid[0],1,$option);
  790.  
  791. + break;
  792.  
  793. +
  794.  
  795. + case 'saveorder':
  796.  
  797. + saveOrder( $cid, $option );
  798.  
  799. + break;
  800.  
  801. +
  802.  
  803. + default :
  804.  
  805. + showmenu($option);
  806.  
  807. + break;
  808.  
  809. }
  810.  
  811.  
  812.  
  813. /**
  814.  
  815. @@ -136,154 +136,164 @@
  816. *
  817.  
  818. */
  819.  
  820. function showmenu($option) {
  821.  
  822. - HTML_cbas :: showmenu($option);
  823.  
  824. + HTML_cbas :: showmenu($option);
  825.  
  826. }
  827.  
  828.  
  829.  
  830. function showconfig($option){
  831.  
  832. - HTML_cbas :: showconfig($option);
  833.  
  834. + HTML_cbas :: showconfig($option);
  835.  
  836. }
  837.  
  838.  
  839.  
  840. function saveconfig($option, $saveexit) {
  841.  
  842. - global $database, $mosConfig_absolute_path;
  843.  
  844. -
  845.  
  846. - //We check if the default section has been correctly set
  847.  
  848. - $check_default = intval(mosGetParam( $_POST, 'cbsa_logical_default', 0));
  849.  
  850. - $check_equal = intval(mosGetParam( $_POST, 'cbsa_logical_equal', 0));
  851.  
  852. - $check_and = intval(mosGetParam( $_POST, 'cbsa_logical_and', 0));
  853.  
  854. - $check_or = intval(mosGetParam( $_POST, 'cbsa_logical_or', 0));
  855.  
  856. - $check_not = intval(mosGetParam( $_POST, 'cbsa_logical_not', 0));
  857.  
  858. -
  859.  
  860. - if ( $check_equal + $check_and + $check_or + $check_not > 0){
  861.  
  862. - switch ($check_default){
  863.  
  864. - case "0":
  865.  
  866. - if ($check_equal==0){
  867.  
  868. - $default_error = 1;
  869.  
  870. - $default_msg = _CB_AS_DEFAULT_ERROR;
  871.  
  872. - }
  873.  
  874. - break;
  875.  
  876. - case "1":
  877.  
  878. - if ($check_and==0){
  879.  
  880. - $default_error = 1;
  881.  
  882. - $default_msg = _CB_AS_DEFAULT_ERROR;
  883.  
  884. - }
  885.  
  886. - break;
  887.  
  888. - case "2":
  889.  
  890. - if ($check_or==0){
  891.  
  892. - $default_error = 1;
  893.  
  894. - $default_msg = _CB_AS_DEFAULT_ERROR;
  895.  
  896. - }
  897.  
  898. - break;
  899.  
  900. - case "3":
  901.  
  902. - if ($check_not==0){
  903.  
  904. - $default_error = 1;
  905.  
  906. - $default_msg = _CB_AS_DEFAULT_ERROR;
  907.  
  908. - }
  909.  
  910. - break;
  911.  
  912. - }
  913.  
  914. -
  915.  
  916. - //We check the query worked
  917.  
  918. - if ($default_error==1) {
  919.  
  920. - echo "<script>alert('".$default_msg."'); window.history.go(-1);</script>\n";
  921.  
  922. - exit;
  923.  
  924. - }
  925.  
  926. - }
  927.  
  928. -
  929.  
  930. - $row = new cbsaConfig();
  931.  
  932. -
  933.  
  934. - if (!$row->bind($_POST)) {
  935.  
  936. - mosRedirect('index2.php', $row->getError());
  937.  
  938. - }
  939.  
  940. -
  941.  
  942. - $row->cbsa_usergid = implode(',', $row->cbsa_usergid);
  943.  
  944. -
  945.  
  946. - $config = "<?php \n";
  947.  
  948. - $config .= $row->getVarText();
  949.  
  950. - $config .= '?>';
  951.  
  952. -
  953.  
  954. - $fname = $mosConfig_absolute_path.'/administrator/components/com_cb_search/cb_search.config.php';
  955.  
  956. -
  957.  
  958. - $enable_write = mosGetParam($_POST, 'enable_write', 0);
  959.  
  960. - $oldperms = fileperms($fname);
  961.  
  962. - if ($enable_write) {
  963.  
  964. - @ chmod($fname, $oldperms | 0222);
  965.  
  966. - }
  967.  
  968. -
  969.  
  970. - $msg = $gsg_msg;
  971.  
  972. -
  973.  
  974. - if (!$gsg_error){
  975.  
  976. - if ($fp = fopen($fname, 'w')) {
  977.  
  978. - fputs($fp, $config, strlen($config));
  979.  
  980. - fclose($fp);
  981.  
  982. - if ($enable_write) {
  983.  
  984. - @ chmod($fname, $oldperms);
  985.  
  986. - } else {
  987.  
  988. - if (mosGetParam($_POST, 'disable_write', 0))
  989.  
  990. - @ chmod($fname, $oldperms & 0777555);
  991.  
  992. - } // if
  993.  
  994. + global $database, $mosConfig_absolute_path;
  995.  
  996. +
  997.  
  998. + //We check if the default section has been correctly set
  999.  
  1000. + $check_default = intval(mosGetParam( $_POST, 'cbsa_logical_default', 0));
  1001.  
  1002. + $check_equal = intval(mosGetParam( $_POST, 'cbsa_logical_equal', 0));
  1003.  
  1004. + $check_and = intval(mosGetParam( $_POST, 'cbsa_logical_and', 0));
  1005.  
  1006. + $check_or = intval(mosGetParam( $_POST, 'cbsa_logical_or', 0));
  1007.  
  1008. + $check_not = intval(mosGetParam( $_POST, 'cbsa_logical_not', 0));
  1009.  
  1010. + //Age Search -- BEGIN
  1011.  
  1012. + $check_lower_age = intval(mosGetParam( $_POST, 'cbsa_lower_age_limit',0));
  1013.  
  1014. + $check_upper_age = intval(mosGetParam( $_POST, 'cbsa_upper_age_limit',0));
  1015.  
  1016. + //Age Search -- END
  1017.  
  1018. +
  1019.  
  1020. +
  1021.  
  1022. + if ( $check_equal + $check_and + $check_or + $check_not > 0){
  1023.  
  1024. + switch ($check_default){
  1025.  
  1026. + case "0":
  1027.  
  1028. + if ($check_equal==0){
  1029.  
  1030. + $default_error = 1;
  1031.  
  1032. + $default_msg = _CB_AS_DEFAULT_ERROR;
  1033.  
  1034. + }
  1035.  
  1036. + break;
  1037.  
  1038. + case "1":
  1039.  
  1040. + if ($check_and==0){
  1041.  
  1042. + $default_error = 1;
  1043.  
  1044. + $default_msg = _CB_AS_DEFAULT_ERROR;
  1045.  
  1046. + }
  1047.  
  1048. + break;
  1049.  
  1050. + case "2":
  1051.  
  1052. + if ($check_or==0){
  1053.  
  1054. + $default_error = 1;
  1055.  
  1056. + $default_msg = _CB_AS_DEFAULT_ERROR;
  1057.  
  1058. + }
  1059.  
  1060. + break;
  1061.  
  1062. + case "3":
  1063.  
  1064. + if ($check_not==0){
  1065.  
  1066. + $default_error = 1;
  1067.  
  1068. + $default_msg = _CB_AS_DEFAULT_ERROR;
  1069.  
  1070. + }
  1071.  
  1072. + break;
  1073.  
  1074. + }
  1075.  
  1076. +
  1077.  
  1078. + //Age Search -- BEGIN
  1079.  
  1080. + if($check_lower_age >= $check_upper_age) {
  1081.  
  1082. + echo "<script>alert('"._CB_AS_ERR_BAD_INTERVAL."'); window.history.go(-1);</script>\n";
  1083.  
  1084. + exit;
  1085.  
  1086. + }
  1087.  
  1088. + //Age Search -- END
  1089.  
  1090. +
  1091.  
  1092. +
  1093.  
  1094. + //We check the query worked
  1095.  
  1096. + if ($default_error==1) {
  1097.  
  1098. + echo "<script>alert('".$default_msg."'); window.history.go(-1);</script>\n";
  1099.  
  1100. + exit;
  1101.  
  1102. + }
  1103.  
  1104. + }
  1105.  
  1106. +
  1107.  
  1108. + $row = new cbsaConfig();
  1109.  
  1110. + if (!$row->bind($_POST)) {
  1111.  
  1112. + mosRedirect('index2.php', $row->getError());
  1113.  
  1114. + }
  1115.  
  1116. +
  1117.  
  1118. + $config = "<?php \n";
  1119.  
  1120. + $config .= $row->getVarText();
  1121.  
  1122. + $config .= '?>';
  1123.  
  1124. +
  1125.  
  1126. + $fname = $mosConfig_absolute_path.'/administrator/components/com_cb_search/cb_search.config.php';
  1127.  
  1128. +
  1129.  
  1130. + $enable_write = mosGetParam($_POST, 'enable_write', 0);
  1131.  
  1132. + $oldperms = fileperms($fname);
  1133.  
  1134. + if ($enable_write) {
  1135.  
  1136. + @ chmod($fname, $oldperms | 0222);
  1137.  
  1138. + }
  1139.  
  1140. +
  1141.  
  1142. + $msg = $gsg_msg;
  1143.  
  1144. +
  1145.  
  1146. + if (!$gsg_error){
  1147.  
  1148. + if ($fp = fopen($fname, 'w')) {
  1149.  
  1150. + fputs($fp, $config, strlen($config));
  1151.  
  1152. + fclose($fp);
  1153.  
  1154. + if ($enable_write) {
  1155.  
  1156. + @ chmod($fname, $oldperms);
  1157.  
  1158. + } else {
  1159.  
  1160. + if (mosGetParam($_POST, 'disable_write', 0))
  1161.  
  1162. + @ chmod($fname, $oldperms & 0777555);
  1163.  
  1164. + } // if
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170. - if($saveexit){
  1171.  
  1172. - mosRedirect("index2.php?option=$option&task=config",_CB_AS_CONFIGSAVED);
  1173.  
  1174. - } else {
  1175.  
  1176. - mosRedirect("index2.php?option=$option");
  1177.  
  1178. - }
  1179.  
  1180. -
  1181.  
  1182. - } else {
  1183.  
  1184. - if ($enable_write) {
  1185.  
  1186. - @ chmod($fname, $oldperms);
  1187.  
  1188. - }
  1189.  
  1190. - mosRedirect("index2.php?option=$option&task=config",_CB_AS_CONFIGSAVED);
  1191.  
  1192. - }
  1193.  
  1194. - } else {
  1195.  
  1196. - mosRedirect("index2.php?option=$option&task=config");
  1197.  
  1198. - }
  1199.  
  1200. + if($saveexit){
  1201.  
  1202. + mosRedirect("index2.php?option=$option&task=config",_CB_AS_CONFIGSAVED);
  1203.  
  1204. + } else {
  1205.  
  1206. + mosRedirect("index2.php?option=$option");
  1207.  
  1208. + }
  1209.  
  1210. +
  1211.  
  1212. + } else {
  1213.  
  1214. + if ($enable_write) {
  1215.  
  1216. + @ chmod($fname, $oldperms);
  1217.  
  1218. + }
  1219.  
  1220. + mosRedirect("index2.php?option=$option&task=config",_CB_AS_CONFIGSAVED);
  1221.  
  1222. + }
  1223.  
  1224. + } else {
  1225.  
  1226. + mosRedirect("index2.php?option=$option&task=config");
  1227.  
  1228. + }
  1229.  
  1230.  
  1231.  
  1232. }
  1233.  
  1234.  
  1235.  
  1236. function sql_list($option, $cat){
  1237.  
  1238. - global $database;
  1239.  
  1240. - $query = "SELECT *"."\n FROM #__cb_search WHERE category=$cat";
  1241.  
  1242. -
  1243.  
  1244. - $database->setQuery($query);
  1245.  
  1246. - $rows = $database->loadObjectList();
  1247.  
  1248. -
  1249.  
  1250. - HTML_cbas :: sql_list($option, $rows, $cat);
  1251.  
  1252. + global $database;
  1253.  
  1254. + $query = "SELECT *"."\n FROM #__cb_search WHERE category=$cat";
  1255.  
  1256. +
  1257.  
  1258. + $database->setQuery($query);
  1259.  
  1260. + $rows = $database->loadObjectList();
  1261.  
  1262. +
  1263.  
  1264. + HTML_cbas :: sql_list($option, $rows, $cat);
  1265.  
  1266. }
  1267.  
  1268.  
  1269.  
  1270. function published($cid = null, $published = 1, $option) {
  1271.  
  1272. - global $database, $mosConfig_absolute_path;
  1273.  
  1274. -
  1275.  
  1276. - if (count($cid) < 1) {
  1277.  
  1278. - $action = $published ? _gsg_active_make : _gsg_active_notmake;
  1279.  
  1280. - echo "<script>alert('"._gsg_active_select.$action."'); window.history.go(-1);</script>\n";
  1281.  
  1282. - exit;
  1283.  
  1284. - }
  1285.  
  1286. -
  1287.  
  1288. - mosCache :: cleanCache('com_cb_search');
  1289.  
  1290. -
  1291.  
  1292. - $cids = implode(',', $cid);
  1293.  
  1294. - $query = "UPDATE #__cb_search SET published=$published"."\n WHERE id IN ($cids)";
  1295.  
  1296. -
  1297.  
  1298. - $database->setQuery($query);
  1299.  
  1300. - if (!$database->query()) {
  1301.  
  1302. - echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1303.  
  1304. - exit;
  1305.  
  1306. - }
  1307.  
  1308. -
  1309.  
  1310. - if (count($cid) == 1) {
  1311.  
  1312. - $row = new cbs_table($database);
  1313.  
  1314. - $row->checkin($cid[0]);
  1315.  
  1316. - }
  1317.  
  1318. -
  1319.  
  1320. - mosRedirect('index2.php?task=sql&option='.$option);
  1321.  
  1322. + global $database, $mosConfig_absolute_path;
  1323.  
  1324. +
  1325.  
  1326. + if (count($cid) < 1) {
  1327.  
  1328. + $action = $published ? _gsg_active_make : _gsg_active_notmake;
  1329.  
  1330. + echo "<script>alert('"._gsg_active_select.$action."'); window.history.go(-1);</script>\n";
  1331.  
  1332. + exit;
  1333.  
  1334. + }
  1335.  
  1336. +
  1337.  
  1338. + mosCache :: cleanCache('com_cb_search');
  1339.  
  1340. +
  1341.  
  1342. + $cids = implode(',', $cid);
  1343.  
  1344. + $query = "UPDATE #__cb_search SET published=$published"."\n WHERE id IN ($cids)";
  1345.  
  1346. +
  1347.  
  1348. + $database->setQuery($query);
  1349.  
  1350. + if (!$database->query()) {
  1351.  
  1352. + echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1353.  
  1354. + exit;
  1355.  
  1356. + }
  1357.  
  1358. +
  1359.  
  1360. + if (count($cid) == 1) {
  1361.  
  1362. + $row = new cbs_table($database);
  1363.  
  1364. + $row->checkin($cid[0]);
  1365.  
  1366. + }
  1367.  
  1368. +
  1369.  
  1370. + mosRedirect('index2.php?task=sql&option='.$option);
  1371.  
  1372. }
  1373.  
  1374.  
  1375.  
  1376. function edit($id, $option, $category){
  1377.  
  1378. - global $database;
  1379.  
  1380. - $row = new cbs_table($database);
  1381.  
  1382. - $row->load($id);
  1383.  
  1384. -
  1385.  
  1386. - HTML_cbas :: edit($option, $row, $category);
  1387.  
  1388. + global $database;
  1389.  
  1390. + $row = new cbs_table($database);
  1391.  
  1392. + $row->load($id);
  1393.  
  1394. +
  1395.  
  1396. + HTML_cbas :: edit($option, $row, $category);
  1397.  
  1398. }
  1399.  
  1400.  
  1401.  
  1402. function save($option){
  1403.  
  1404. @@ -301,9 +311,9 @@
  1405.  
  1406.  
  1407. if($default_save==1){
  1408.  
  1409. //We set all entries to Zero
  1410.  
  1411. - $query = "UPDATE #__cb_search as j SET j.default = 0;";
  1412.  
  1413. - $database->setQuery( $query );
  1414.  
  1415. - $database->query();
  1416.  
  1417. + $query = "UPDATE #__cb_search as j SET j.default = 0;";
  1418.  
  1419. + $database->setQuery( $query );
  1420.  
  1421. + $database->query();
  1422.  
  1423. }
  1424.  
  1425.  
  1426.  
  1427. if(!$row->store()){
  1428.  
  1429. @@ -312,9 +322,9 @@
  1430. }
  1431.  
  1432.  
  1433.  
  1434. if ($category==1){
  1435.  
  1436. - $task = "sql";
  1437.  
  1438. - } else {
  1439.  
  1440. - $task = "sql2";
  1441.  
  1442. + $task = "sql";
  1443.  
  1444. + } else {
  1445.  
  1446. + $task = "sql2";
  1447.  
  1448. }
  1449.  
  1450.  
  1451.  
  1452. mosRedirect("index2.php?option=$option&task=$task&category=$category", "Saved");
  1453.  
  1454. @@ -323,113 +333,113 @@
  1455. function fields($option){
  1456.  
  1457. global $database, $mainframe, $mosConfig_list_limit;
  1458.  
  1459.  
  1460.  
  1461. - $query = "SELECT jf.ordering AS ordering, j.fieldid AS jid, jf.id AS id, jf.search AS search, j.name AS name, j.published AS published, j.profile AS profile"
  1462.  
  1463. - . "\n FROM #__comprofiler_fields AS j LEFT JOIN #__cb_search_fields AS jf"
  1464.  
  1465. - . "\n ON j.fieldid = jf.fieldid"
  1466.  
  1467. - . "\n WHERE ((( j.name)<>'NA') AND (( j.published)=1) AND (( j.profile)=1))"
  1468.  
  1469. - . "\n ORDER BY jf.search DESC, jf.ordering;";
  1470.  
  1471. + $query = "SELECT jf.ordering AS ordering, j.fieldid AS jid, jf.id AS id, jf.search AS search, j.name AS name, j.published AS published, j.profile AS profile"
  1472.  
  1473. + . "\n FROM #__comprofiler_fields AS j LEFT JOIN #__cb_search_fields AS jf"
  1474.  
  1475. + . "\n ON j.fieldid = jf.fieldid"
  1476.  
  1477. + . "\n WHERE ((( j.name)<>'NA') AND (( j.published)=1) AND (( j.profile)=1))"
  1478.  
  1479. + . "\n ORDER BY jf.ordering;";
  1480.  
  1481.  
  1482.  
  1483. - $database->setQuery( $query );
  1484.  
  1485. + $database->setQuery( $query );
  1486.  
  1487. $rows = $database->loadObjectList();
  1488.  
  1489. -
  1490.  
  1491. - require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
  1492.  
  1493. -
  1494.  
  1495. - $total = count($rows);
  1496.  
  1497. - $limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit );
  1498.  
  1499. - $limitstart = $mainframe->getUserStateFromRequest( "viewlimitstart", 'limitstart', 0 );
  1500.  
  1501. - $pageNav = new mosPageNav( $total, $limitstart, $limit );
  1502.  
  1503. +
  1504.  
  1505. + require_once( $GLOBALS['mosConfig_absolute_path'] . '/administrator/includes/pageNavigation.php' );
  1506.  
  1507. +
  1508.  
  1509. + $total = count($rows);
  1510.  
  1511. + $limit = $mainframe->getUserStateFromRequest( "viewlistlimit", 'limit', $mosConfig_list_limit );
  1512.  
  1513. + $limitstart = $mainframe->getUserStateFromRequest( "viewlimitstart", 'limitstart', 0 );
  1514.  
  1515. + $pageNav = new mosPageNav( $total, $limitstart, $limit );
  1516.  
  1517.  
  1518.  
  1519. -
  1520.  
  1521. - HTML_cbas :: fields($option, $rows, $pageNav);
  1522.  
  1523. -
  1524.  
  1525. +
  1526.  
  1527. + HTML_cbas :: fields($option, $rows, $pageNav);
  1528.  
  1529. +
  1530.  
  1531. }
  1532.  
  1533.  
  1534.  
  1535. function sql_cancel($option, $category){
  1536.  
  1537. - mosRedirect('index2.php?task=sql&option='.$option.'&category=$category');
  1538.  
  1539. + mosRedirect('index2.php?task=sql&option='.$option.'&category=$category');
  1540.  
  1541. }
  1542.  
  1543.  
  1544.  
  1545. function sql_cancel2($option, $category){
  1546.  
  1547. - mosRedirect('index2.php?task=sql2&option='.$option.'&category=$category');
  1548.  
  1549. + mosRedirect('index2.php?task=sql2&option='.$option.'&category=$category');
  1550.  
  1551. }
  1552.  
  1553.  
  1554.  
  1555. function sql_default($cid, $default=1, $option, $category){
  1556.  
  1557. - global $database;
  1558.  
  1559. -
  1560.  
  1561. - //we clear all previous values
  1562.  
  1563. - $query = "UPDATE #__cb_search as j SET j.default = 0 WHERE category=$category;";
  1564.  
  1565. - $database->setQuery( $query );
  1566.  
  1567. - $database->query();
  1568.  
  1569. -
  1570.  
  1571. - mosCache :: cleanCache('com_cb_search');
  1572.  
  1573. -
  1574.  
  1575. - $cids = implode(',', $cid);
  1576.  
  1577. - $query = "UPDATE #__cb_search as j SET j.default=$default"."\n WHERE id IN ($cids)";
  1578.  
  1579. -
  1580.  
  1581. - $database->setQuery($query);
  1582.  
  1583. - if (!$database->query()) {
  1584.  
  1585. - echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1586.  
  1587. - exit;
  1588.  
  1589. - }
  1590.  
  1591. -
  1592.  
  1593. - if (count($cid) == 1) {
  1594.  
  1595. - $row = new cbs_table($database);
  1596.  
  1597. - $row->checkin($cid[0]);
  1598.  
  1599. - }
  1600.  
  1601. -
  1602.  
  1603. - mosRedirect('index2.php?task=sql&option='.$option);
  1604.  
  1605. + global $database;
  1606.  
  1607. +
  1608.  
  1609. + //we clear all previous values
  1610.  
  1611. + $query = "UPDATE #__cb_search as j SET j.default = 0 WHERE category=$category;";
  1612.  
  1613. + $database->setQuery( $query );
  1614.  
  1615. + $database->query();
  1616.  
  1617. +
  1618.  
  1619. + mosCache :: cleanCache('com_cb_search');
  1620.  
  1621. +
  1622.  
  1623. + $cids = implode(',', $cid);
  1624.  
  1625. + $query = "UPDATE #__cb_search as j SET j.default=$default"."\n WHERE id IN ($cids)";
  1626.  
  1627. +
  1628.  
  1629. + $database->setQuery($query);
  1630.  
  1631. + if (!$database->query()) {
  1632.  
  1633. + echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1634.  
  1635. + exit;
  1636.  
  1637. + }
  1638.  
  1639. +
  1640.  
  1641. + if (count($cid) == 1) {
  1642.  
  1643. + $row = new cbs_table($database);
  1644.  
  1645. + $row->checkin($cid[0]);
  1646.  
  1647. + }
  1648.  
  1649. +
  1650.  
  1651. + mosRedirect('index2.php?task=sql&option='.$option);
  1652.  
  1653. }
  1654.  
  1655.  
  1656.  
  1657. function remove( $cid, $option, $category){
  1658.  
  1659. - global $database;
  1660.  
  1661. - $cids = implode(',', $cid);
  1662.  
  1663. + global $database;
  1664.  
  1665. + $cids = implode(',', $cid);
  1666.  
  1667.  
  1668.  
  1669. - $query = "SELECT *"
  1670.  
  1671. - . "\n FROM #__cb_search"
  1672.  
  1673. - . "\n WHERE id IN ($cids)"
  1674.  
  1675. - ;
  1676.  
  1677. - $database->setQuery( $query );
  1678.  
  1679. - $cur_defaults = $database->loadObjectList();
  1680.  
  1681. -
  1682.  
  1683. - for ($i = 0, $n = count($cur_defaults); $i < $n; $i ++) {
  1684.  
  1685. - $cur_default = & $cur_defaults[$i];
  1686.  
  1687. - if ($cur_default->default == 1) {
  1688.  
  1689. - echo "<script>alert(\"You can not delete a default Search Criteria.\"); window.history.go(-1); </script>\n";
  1690.  
  1691. - exit();
  1692.  
  1693. - }
  1694.  
  1695. - }
  1696.  
  1697. -
  1698.  
  1699. - $query = "DELETE FROM #__cb_search WHERE id IN ($cids)";
  1700.  
  1701. - $database->setQuery( $query );
  1702.  
  1703. - $database->query();
  1704.  
  1705. -
  1706.  
  1707. - mosRedirect('index2.php?task=sql&option='.$option.'category=$category');
  1708.  
  1709. + $query = "SELECT *"
  1710.  
  1711. + . "\n FROM #__cb_search"
  1712.  
  1713. + . "\n WHERE id IN ($cids)"
  1714.  
  1715. + ;
  1716.  
  1717. + $database->setQuery( $query );
  1718.  
  1719. + $cur_defaults = $database->loadObjectList();
  1720.  
  1721. +
  1722.  
  1723. + for ($i = 0, $n = count($cur_defaults); $i < $n; $i ++) {
  1724.  
  1725. + $cur_default = & $cur_defaults[$i];
  1726.  
  1727. + if ($cur_default->default == 1) {
  1728.  
  1729. + echo "<script>alert(\"You can not delete a default Search Criteria.\"); window.history.go(-1); </script>\n";
  1730.  
  1731. + exit();
  1732.  
  1733. + }
  1734.  
  1735. + }
  1736.  
  1737. +
  1738.  
  1739. + $query = "DELETE FROM #__cb_search WHERE id IN ($cids)";
  1740.  
  1741. + $database->setQuery( $query );
  1742.  
  1743. + $database->query();
  1744.  
  1745. +
  1746.  
  1747. + mosRedirect('index2.php?task=sql&option='.$option.'category=$category');
  1748.  
  1749. }
  1750.  
  1751.  
  1752.  
  1753. function searchable($cid, $searchable=1, $option){
  1754.  
  1755. - global $database, $mosConfig_absolute_path;
  1756.  
  1757. -
  1758.  
  1759. - if (count($cid) < 1) {
  1760.  
  1761. - $action = $published ? _gsg_active_make : _gsg_active_notmake;
  1762.  
  1763. - echo "<script>alert('"._gsg_active_select.$action."'); window.history.go(-1);</script>\n";
  1764.  
  1765. - exit;
  1766.  
  1767. - }
  1768.  
  1769. -
  1770.  
  1771. - mosCache :: cleanCache('com_cb_search');
  1772.  
  1773. -
  1774.  
  1775. - $cids = implode(',', $cid);
  1776.  
  1777. - $query = "UPDATE #__cb_search_fields SET search=$searchable"
  1778.  
  1779. - ."\n WHERE id IN ($cids)";
  1780.  
  1781. + global $database, $mosConfig_absolute_path;
  1782.  
  1783. +
  1784.  
  1785. + if (count($cid) < 1) {
  1786.  
  1787. + $action = $published ? _gsg_active_make : _gsg_active_notmake;
  1788.  
  1789. + echo "<script>alert('"._gsg_active_select.$action."'); window.history.go(-1);</script>\n";
  1790.  
  1791. + exit;
  1792.  
  1793. + }
  1794.  
  1795. +
  1796.  
  1797. + mosCache :: cleanCache('com_cb_search');
  1798.  
  1799. +
  1800.  
  1801. + $cids = implode(',', $cid);
  1802.  
  1803. + $query = "UPDATE #__cb_search_fields SET search=$searchable"
  1804.  
  1805. + ."\n WHERE id IN ($cids)";
  1806.  
  1807. //echo $query;
  1808.  
  1809. - $database->setQuery($query);
  1810.  
  1811. - if (!$database->query()) {
  1812.  
  1813. - echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1814.  
  1815. - exit;
  1816.  
  1817. - }
  1818.  
  1819. + $database->setQuery($query);
  1820.  
  1821. + if (!$database->query()) {
  1822.  
  1823. + echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1824.  
  1825. + exit;
  1826.  
  1827. + }
  1828.  
  1829.  
  1830.  
  1831. - if (count($cid) == 1) {
  1832.  
  1833. - $row = new cbs_fields($database);
  1834.  
  1835. - $row->checkin($cid[0]);
  1836.  
  1837. - }
  1838.  
  1839. + if (count($cid) == 1) {
  1840.  
  1841. + $row = new cbs_fields($database);
  1842.  
  1843. + $row->checkin($cid[0]);
  1844.  
  1845. + }
  1846.  
  1847.  
  1848.  
  1849. mosRedirect("index2.php?option=$option&task=fields", "Changed Searchable Property");
  1850.  
  1851. }
  1852.  
  1853. @@ -441,112 +451,112 @@
  1854. // if fields does not exist in table #__cb_search it will be added - QUERY 1
  1855.  
  1856. // fields exist in table #__cb_search but not any more in the #_comprofiler_fields we will delete the field in #_cb_search - QUERY 2
  1857.  
  1858.  
  1859.  
  1860. - $query_search = "SELECT * FROM `#__comprofiler_fields`AS j"
  1861.  
  1862. - . "\n WHERE ((( j.name)<>'NA') AND (( j.published)=1) AND (( j.profile)=1));";
  1863.  
  1864. - $database->setQuery( $query_search );
  1865.  
  1866. - $searchfields = $database->loadObjectList();
  1867.  
  1868. - $query_search2 = "SELECT * FROM `#__cb_search_fields`";
  1869.  
  1870. - $database->setQuery( $query_search2 );
  1871.  
  1872. - $searchfields2 = $database->loadObjectList();
  1873.  
  1874. - $fieldnameexist=0;
  1875.  
  1876. -
  1877.  
  1878. - //QUERY 1
  1879.  
  1880. - for ($s=0, $n=count( $searchfields ); $s < $n; $s++) {
  1881.  
  1882. - $searchfield =& $searchfields[$s];
  1883.  
  1884. - $fieldnameexist=0;
  1885.  
  1886. - for ($s2=0, $n2=count( $searchfields2 ); $s2 < $n2; $s2++) {
  1887.  
  1888. - $searchfield2 =& $searchfields2[$s2];
  1889.  
  1890. - if ( $searchfield->fieldid == $searchfield2->fieldid){
  1891.  
  1892. - $fieldnameexist=1;
  1893.  
  1894. - }
  1895.  
  1896. - }
  1897.  
  1898. - if ($fieldnameexist==0){
  1899.  
  1900. - $query = "INSERT IGNORE INTO #__cb_search_fields VALUES ('',$searchfield->fieldid, 0,999)";
  1901.  
  1902. - $database->setQuery($query);
  1903.  
  1904. - $fieldnameexist=0;
  1905.  
  1906. - if (!$database->query()) {
  1907.  
  1908. - echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1909.  
  1910. - exit;
  1911.  
  1912. - }
  1913.  
  1914. - }
  1915.  
  1916. - }
  1917.  
  1918. + $query_search = "SELECT * FROM `#__comprofiler_fields`AS j"
  1919.  
  1920. + . "\n WHERE ((( j.name)<>'NA') AND (( j.published)=1) AND (( j.profile)=1));";
  1921.  
  1922. + $database->setQuery( $query_search );
  1923.  
  1924. + $searchfields = $database->loadObjectList();
  1925.  
  1926. + $query_search2 = "SELECT * FROM `#__cb_search_fields`";
  1927.  
  1928. + $database->setQuery( $query_search2 );
  1929.  
  1930. + $searchfields2 = $database->loadObjectList();
  1931.  
  1932. + $fieldnameexist=0;
  1933.  
  1934. +
  1935.  
  1936. + //QUERY 1
  1937.  
  1938. + for ($s=0, $n=count( $searchfields ); $s < $n; $s++) {
  1939.  
  1940. + $searchfield =& $searchfields[$s];
  1941.  
  1942. + $fieldnameexist=0;
  1943.  
  1944. + for ($s2=0, $n2=count( $searchfields2 ); $s2 < $n2; $s2++) {
  1945.  
  1946. + $searchfield2 =& $searchfields2[$s2];
  1947.  
  1948. + if ( $searchfield->fieldid == $searchfield2->fieldid){
  1949.  
  1950. + $fieldnameexist=1;
  1951.  
  1952. + }
  1953.  
  1954. + }
  1955.  
  1956. + if ($fieldnameexist==0){
  1957.  
  1958. + $query = "INSERT IGNORE INTO #__cb_search_fields VALUES ('',$searchfield->fieldid, 0,999)";
  1959.  
  1960. + $database->setQuery($query);
  1961.  
  1962. + $fieldnameexist=0;
  1963.  
  1964. + if (!$database->query()) {
  1965.  
  1966. + echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  1967.  
  1968. + exit;
  1969.  
  1970. + }
  1971.  
  1972. + }
  1973.  
  1974. + }
  1975.  
  1976.  
  1977.  
  1978. - $fieldnameexist2=0;
  1979.  
  1980. - //QUERY 2
  1981.  
  1982. - for ($s=0, $n=count( $searchfields2 ); $s < $n; $s++) {
  1983.  
  1984. - $searchfield2 =& $searchfield2s[$s];
  1985.  
  1986. - for ($s2=0, $n2=count( $searchfields ); $s2 < $n2; $s2++) {
  1987.  
  1988. - $searchfield =& $searchfields[$s2];
  1989.  
  1990. - if ( $searchfield2->fieldid == $searchfield->fieldid){
  1991.  
  1992. - $fieldnameexist2=1;
  1993.  
  1994. - }
  1995.  
  1996. - }
  1997.  
  1998. - if ($fieldnameexist2==0){
  1999.  
  2000. - $query = "DELETE FROM #__cb_search_fields WHERE id='$searchfields2->id'";
  2001.  
  2002. - $database->setQuery($query);
  2003.  
  2004. - $fieldnameexist2=0;
  2005.  
  2006. - if (!$database->query()) {
  2007.  
  2008. - echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  2009.  
  2010. - exit;
  2011.  
  2012. - }
  2013.  
  2014. - }
  2015.  
  2016. - }
  2017.  
  2018. -
  2019.  
  2020. - //We will now order the fields
  2021.  
  2022. - $row = new cbs_fields( $database );
  2023.  
  2024. - $row->updateOrder();
  2025.  
  2026. -
  2027.  
  2028. - mosRedirect('index2.php?task=fields&option='.$option,_CB_AS_UPDATELIST );
  2029.  
  2030. + $fieldnameexist2=0;
  2031.  
  2032. + //QUERY 2
  2033.  
  2034. + for ($s=0, $n=count( $searchfields2 ); $s < $n; $s++) {
  2035.  
  2036. + $searchfield2 =& $searchfield2s[$s];
  2037.  
  2038. + for ($s2=0, $n2=count( $searchfields ); $s2 < $n2; $s2++) {
  2039.  
  2040. + $searchfield =& $searchfields[$s2];
  2041.  
  2042. + if ( $searchfield2->fieldid == $searchfield->fieldid){
  2043.  
  2044. + $fieldnameexist2=1;
  2045.  
  2046. + }
  2047.  
  2048. + }
  2049.  
  2050. + if ($fieldnameexist2==0){
  2051.  
  2052. + $query = "DELETE FROM #__cb_search_fields WHERE id='$searchfields2->id'";
  2053.  
  2054. + $database->setQuery($query);
  2055.  
  2056. + $fieldnameexist2=0;
  2057.  
  2058. + if (!$database->query()) {
  2059.  
  2060. + echo "<script>alert('".$database->getErrorMsg()."'); window.history.go(-1);</script>\n";
  2061.  
  2062. + exit;
  2063.  
  2064. + }
  2065.  
  2066. + }
  2067.  
  2068. + }
  2069.  
  2070. +
  2071.  
  2072. + //We will now order the fields
  2073.  
  2074. + $row = new cbs_fields( $database );
  2075.  
  2076. + $row->updateOrder();
  2077.  
  2078. +
  2079.  
  2080. + mosRedirect('index2.php?task=fields&option='.$option,_CB_AS_UPDATELIST );
  2081.  
  2082. }
  2083.  
  2084.  
  2085.  
  2086. function order($uid, $inc, $option){
  2087.  
  2088. - global $database;
  2089.  
  2090. + global $database;
  2091.  
  2092.  
  2093.  
  2094. - $row = new cbs_fields( $database );
  2095.  
  2096. - $row->load($uid);
  2097.  
  2098. -
  2099.  
  2100. - if($inc>0){
  2101.  
  2102. - $order_adj = $inc;
  2103.  
  2104. - } else {
  2105.  
  2106. - $order_adj = $inc * 2;
  2107.  
  2108. - }
  2109.  
  2110. -
  2111.  
  2112. - $neworder = $row->ordering + $order_adj;
  2113.  
  2114. -
  2115.  
  2116. - $row->ordering = $neworder;
  2117.  
  2118. - if (!$row->store()) {
  2119.  
  2120. - echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
  2121.  
  2122. - exit();
  2123.  
  2124. - } // if
  2125.  
  2126. - //$row->move($inc, "id=$row->id");
  2127.  
  2128. - $row->updateOrder('search=1');
  2129.  
  2130. - mosRedirect('index2.php?task=fields&option='.$option);
  2131.  
  2132. + $row = new cbs_fields( $database );
  2133.  
  2134. + $row->load($uid);
  2135.  
  2136. +
  2137.  
  2138. + if($inc>0){
  2139.  
  2140. + $order_adj = $inc;
  2141.  
  2142. + } else {
  2143.  
  2144. + $order_adj = $inc * 2;
  2145.  
  2146. + }
  2147.  
  2148. +
  2149.  
  2150. + $neworder = $row->ordering + $order_adj;
  2151.  
  2152. +
  2153.  
  2154. + $row->ordering = $neworder;
  2155.  
  2156. + if (!$row->store()) {
  2157.  
  2158. + echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
  2159.  
  2160. + exit();
  2161.  
  2162. + } // if
  2163.  
  2164. + //$row->move($inc, "id=$row->id");
  2165.  
  2166. + $row->updateOrder();
  2167.  
  2168. + mosRedirect('index2.php?task=fields&option='.$option);
  2169.  
  2170. }
  2171.  
  2172.  
  2173.  
  2174. function saveOrder( &$cid, $option ) {
  2175.  
  2176. - global $database;
  2177.  
  2178. -
  2179.  
  2180. - $total = count( $cid );
  2181.  
  2182. - $order = mosGetParam( $_POST, 'order', array(0) );
  2183.  
  2184. - $row = new cbs_fields( $database );
  2185.  
  2186. -
  2187.  
  2188. - // update ordering values
  2189.  
  2190. - for( $i=0; $i < $total; $i++ ) {
  2191.  
  2192. - $row->load( $cid[$i] );
  2193.  
  2194. - if ($row->ordering != $order[$i]) {
  2195.  
  2196. - echo $row->id."-".$row->fieldid."-".$row->ordering."-".$order[$i]."<br>";
  2197.  
  2198. - $row->ordering = $order[$i];
  2199.  
  2200. - if (!$row->store()) {
  2201.  
  2202. - echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
  2203.  
  2204. - exit();
  2205.  
  2206. - } // if
  2207.  
  2208. - } // if
  2209.  
  2210. - } // for
  2211.  
  2212. -
  2213.  
  2214. - $row->updateOrder();
  2215.  
  2216. -
  2217.  
  2218. - $msg = 'New ordering saved';
  2219.  
  2220. + global $database;
  2221.  
  2222. +
  2223.  
  2224. + $total = count( $cid );
  2225.  
  2226. + $order = mosGetParam( $_POST, 'order', array(0) );
  2227.  
  2228. + $row = new cbs_fields( $database );
  2229.  
  2230. +
  2231.  
  2232. + // update ordering values
  2233.  
  2234. + for( $i=0; $i < $total; $i++ ) {
  2235.  
  2236. + $row->load( $cid[$i] );
  2237.  
  2238. + if ($row->ordering != $order[$i]) {
  2239.  
  2240. + echo $row->id."-".$row->fieldid."-".$row->ordering."-".$order[$i]."<br>";
  2241.  
  2242. + $row->ordering = $order[$i];
  2243.  
  2244. + if (!$row->store()) {
  2245.  
  2246. + echo "<script> alert('".$database->getErrorMsg()."'); window.history.go(-1); </script>\n";
  2247.  
  2248. + exit();
  2249.  
  2250. + } // if
  2251.  
  2252. + } // if
  2253.  
  2254. + } // for
  2255.  
  2256. +
  2257.  
  2258. + $row->updateOrder();
  2259.  
  2260. +
  2261.  
  2262. + $msg = 'New ordering saved';
  2263.  
  2264.  
  2265.  
  2266. - mosRedirect('index2.php?task=fields&option='.$option,$msg);
  2267.  
  2268. -
  2269.  
  2270. -} // saveOrder
  2271.  
  2272. + mosRedirect('index2.php?task=fields&option='.$option,$msg);
  2273.  
  2274. +
  2275.  
  2276. +} // saveOrder
  2277. \ No newline at end of file
  2278.  
  2279. === modified file 'administrator/components/com_cb_search/cb_search.class.php'
  2280. --- administrator/components/com_cb_search/cb_search.class.php 2008-07-04 21:14:01 +0000
  2281. +++ administrator/components/com_cb_search/cb_search.class.php 2009-03-24 02:13:14 +0000
  2282. @@ -49,19 +49,19 @@
  2283. var $cbsa_show_sql_error = 0;
  2284.  
  2285. /** @var int */
  2286.  
  2287. var $cbsa_deactivate_allowaccess = 0;
  2288.  
  2289. - /** @var varchar(100) */
  2290.  
  2291. - var $cbsa_usergid = '';
  2292.  
  2293. - /** @var int */
  2294.  
  2295. - var $cbsa_userlist = 0;
  2296.  
  2297. - /** @var varchar(100) */
  2298.  
  2299. - var $cbsa_simple_default = 'any';
  2300.  
  2301. - /** @var varchar(100) */
  2302.  
  2303. - var $cbsa_ajax_image = 'spinner';
  2304.  
  2305. - /** @var int */
  2306.  
  2307. - var $cbsa_ajax_on = 0;
  2308.  
  2309. -
  2310.  
  2311. -
  2312.  
  2313. -
  2314.  
  2315. + //Age Search -- BEGIN
  2316.  
  2317. + /** @var int*/
  2318.  
  2319. + var $cbsa_enable_age_search = 0;
  2320.  
  2321. + /** @var int*/
  2322.  
  2323. + var $cbsa_lower_age_limit = 0;
  2324.  
  2325. + /** @var int*/
  2326.  
  2327. + var $cbsa_upper_age_limit = 0;
  2328.  
  2329. + /** @var string*/
  2330.  
  2331. + var $cbsa_birthday_fieldname = '';
  2332.  
  2333. + //Age Search -- END
  2334.  
  2335. + //Photo Only Search -- BEGIN
  2336.  
  2337. + /** @var int*/
  2338.  
  2339. + var $cbsa_enable_photo_only_search = 0;
  2340.  
  2341.  
  2342.  
  2343. /**
  2344.  
  2345. * @return array An array of the public vars in the class
  2346.  
  2347. @@ -266,34 +266,33 @@
  2348. return $oReturn;
  2349.  
  2350. }
  2351.  
  2352.  
  2353.  
  2354. - function getChildGIDS($gid) {
  2355. - // TODO: The problem is that $gid = 0
  2356. - // echo $gid;
  2357. + function getChildGIDS($gid) {
  2358.  
  2359. global $database;
  2360.  
  2361. - $query="SELECT g1.group_id, g1.name"
  2362.  
  2363. + $query="SELECT g1.id, g1.name"
  2364.  
  2365. ."\n FROM #__core_acl_aro_groups g1"
  2366.  
  2367. ."\n LEFT JOIN #__core_acl_aro_groups g2 ON g2.lft >= g1.lft"
  2368.  
  2369. - ."\n WHERE g2.group_id =".$gid
  2370.  
  2371. + ."\n WHERE g2.id =".$gid
  2372.  
  2373. ."\n ORDER BY g1.name";
  2374.  
  2375. $standardlist=array(-2,);
  2376.  
  2377. if( $gid > 0) $standardlist[]=-1;
  2378.  
  2379. $array=array();
  2380.  
  2381. $database->setQuery( $query );
  2382.  
  2383. $array=$database->loadResultArray();
  2384.  
  2385. + if (count($array)==0) $array = array();
  2386.  
  2387. $array=array_merge($array,$standardlist);
  2388.  
  2389. return $array;
  2390.  
  2391. }
  2392.  
  2393.  
  2394.  
  2395. function getParentGIDS($gid) {
  2396.  
  2397. global $database;
  2398.  
  2399. - $query="SELECT g1.group_id, g1.name"
  2400.  
  2401. + $query="SELECT g1.id, g1.name"
  2402.  
  2403. ."\n FROM #__core_acl_aro_groups g1"
  2404.  
  2405. ."\n LEFT JOIN #__core_acl_aro_groups g2 ON g2.lft <= g1.lft"
  2406.  
  2407. - ."\n WHERE g2.group_id =".$gid
  2408.  
  2409. + ."\n WHERE g2.id =".$gid
  2410.  
  2411. ."\n ORDER BY g1.name";
  2412.  
  2413. $array=array();
  2414.  
  2415. $database->setQuery( $query );
  2416.  
  2417. - $array=$database->loadResultArray();
  2418.  
  2419. + $array=$database->loadResultArray();
  2420. return $array;
  2421.  
  2422. }
  2423.  
  2424.  
  2425.  
  2426. @@ -457,7 +456,7 @@
  2427. for ($s=0, $n=count( $customfield ); $s < $n; $s++) {
  2428.  
  2429. $customfields = &$customfield[$s];
  2430.  
  2431. $whattable2 = $customfields->table;
  2432.  
  2433. - }
  2434.  
  2435. + }
  2436.  
  2437.  
  2438.  
  2439. if ( $whattable == "lastvisitDate" && $whattable2 == "#__comprofiler") {
  2440.  
  2441. $whattable2 = "#__users";
  2442.  
  2443. @@ -473,7 +472,7 @@
  2444. case '#__user':
  2445.  
  2446. $table_syn = "u.";
  2447.  
  2448. break;
  2449.  
  2450. - case '#__comprofiler':
  2451.  
  2452. + case '#__comprofiler':
  2453.  
  2454. $table_syn = "ue.";
  2455.  
  2456. break;
  2457.  
  2458. default:
  2459.  
  2460. @@ -525,7 +524,7 @@
  2461. return;
  2462.  
  2463. }
  2464.  
  2465.  
  2466.  
  2467. -
  2468.  
  2469. +
  2470.  
  2471. $col=$row[0]->col1fields;
  2472.  
  2473. $col=explode('|*|',$col);
  2474.  
  2475. $lfields="";
  2476.  
  2477. @@ -750,48 +749,11 @@
  2478. * @param mixed string/array : string: search parameter added as &$prefix.search=... if NOT NULL ; array: each added as $prefix.&key=$val
  2479.  
  2480. * @param string prefix on the &limitstart and &search URL items
  2481.  
  2482. */
  2483.  
  2484. +
  2485.  
  2486. function writePagesLinks($limitstart, $limit, $total,$ue_base_url,$search=null,$prefix="") {
  2487.  
  2488. global $mosConfig_sef;
  2489.  
  2490. $ret="";
  2491.  
  2492.  
  2493.  
  2494. - $searchword = mosGetParam( $_REQUEST, 'searchword', '' );
  2495.  
  2496. - $phrase = mosGetParam( $_REQUEST, 'searchphrase', '' );
  2497.  
  2498. - $task = mosGetParam( $_REQUEST, 'task', '' );
  2499.  
  2500. - $limitstart = mosGetParam( $_REQUEST, 'limitstart', '' );
  2501.  
  2502. -
  2503.  
  2504. - $pattern[0] = "+";
  2505.  
  2506. - $pattern[1] = "%28";
  2507.  
  2508. - $pattern[2] = "%27";
  2509.  
  2510. - $pattern[3] = "%25";
  2511.  
  2512. - $pattern[4] = "%29";
  2513.  
  2514. - $pattern[5] = "%F6";
  2515.  
  2516. - $pattern[6] = "%FC";
  2517.  
  2518. - $pattern[7] = "%E4";
  2519.  
  2520. - $pattern[8] = "%D6";
  2521.  
  2522. - $pattern[9] = "%DC";
  2523.  
  2524. - $pattern[10] = "%C4";
  2525.  
  2526. - $pattern[11] = "%20";
  2527.  
  2528. - $replacement[0] = " ";
  2529.  
  2530. - $replacement[1] = "(";
  2531.  
  2532. - $replacement[2] = "'";
  2533.  
  2534. - $replacement[3] = "%";
  2535.  
  2536. - $replacement[4] = ")";
  2537.  
  2538. - $replacement[5] = "�";
  2539.  
  2540. - $replacement[6] = "�";
  2541.  
  2542. - $replacement[7] = "�";
  2543.  
  2544. - $replacement[8] = "�";
  2545.  
  2546. - $replacement[9] = "�";
  2547.  
  2548. - $replacement[10] = "�";
  2549.  
  2550. - $replacement[11] = " ";
  2551.  
  2552. - $searchword = str_replace($pattern, $replacement, $searchword );
  2553.  
  2554. -
  2555.  
  2556. -/** echo "searcharray: " . $search . "<br>";
  2557.  
  2558. - echo "searchstring: " . $searchword . "<br>";
  2559.  
  2560. - echo "phrase: " . $phrase . "<br>";
  2561.  
  2562. - echo "task: " . $task . "<br>";
  2563.  
  2564. - echo "limitstart: " . $limitstart . "<br>";
  2565.  
  2566. - */
  2567.  
  2568. -
  2569.  
  2570. if ($mosConfig_sef){
  2571.  
  2572. $sefchar = ",";
  2573.  
  2574. $sefchar2 = "";
  2575.  
  2576. @@ -813,7 +775,8 @@
  2577.  
  2578.  
  2579. $limstart_str = "".urlencode($prefix).$sefchar2."limitstart".$sefchar;
  2580.  
  2581. $pages_in_list = 9; // set how many pages you want displayed in the menu (not including first&last, and ev. ... repl by single page number.
  2582.  
  2583. - $displayed_pages = $pages_in_list;
  2584.  
  2585. + $displayed_pages = $pages_in_list;
  2586. + if ($limit =='') $limit = 10; // fix by Tim Black 2-9-2009
  2587.  
  2588. $total_pages = ceil( $total / $limit );
  2589.  
  2590. $this_page = ceil( ($limitstart+1) / $limit );
  2591.  
  2592. // $start_loop = (floor(($this_page-1)/$displayed_pages))*$displayed_pages+1;
  2593.  
  2594. @@ -824,17 +787,15 @@
  2595. $stop_loop = $total_pages;
  2596.  
  2597. }
  2598.  
  2599.  
  2600.  
  2601. - $searchword = urlencode($searchword);
  2602.  
  2603. -
  2604.  
  2605. if ($this_page > 1) {
  2606.  
  2607. $page = ($this_page - 2) * $limit;
  2608.  
  2609. - $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=0&searchword=".$searchword."&searchphrase=".$phrase."&task=".$task)."\" title=\"" . _UE_FIRST_PAGE . "\"><< " . _UE_FIRST_PAGE . "</a>";
  2610.  
  2611. - $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=".$page."&searchword=".$searchword."&searchphrase=".$phrase."&task=".$task)."\" title=\"" . _UE_PREV_PAGE . "\">< " . _UE_PREV_PAGE . "</a>";
  2612.  
  2613. - if ($start_loop > 1) $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=0&searchword=".$searchword."&searchphrase=".$phrase."&task=".$task)."\" title=\"" . _UE_FIRST_PAGE . "\"><strong>1</strong></a>";
  2614.  
  2615. + $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str."0".$search_str)."\" title=\"" . _UE_FIRST_PAGE . "\">&lt;&lt; " . _UE_FIRST_PAGE . "</a>";
  2616.  
  2617. + $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str.$page.$search_str)."\" title=\"" . _UE_PREV_PAGE . "\">&lt; " . _UE_PREV_PAGE . "</a>";
  2618.  
  2619. + if ($start_loop > 1) $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str."0".$search_str)."\" title=\"" . _UE_FIRST_PAGE . "\"><strong>1</strong></a>";
  2620.  
  2621. if ($start_loop > 2) $ret .= "\n<span class=\"pagenav\"> <strong>...</strong> </span>";
  2622.  
  2623. } else {
  2624.  
  2625. - $ret .= '<span class="pagenav"><< '. _UE_FIRST_PAGE .'</span> ';
  2626.  
  2627. - $ret .= '<span class="pagenav">< '. _UE_PREV_PAGE .'</span> ';
  2628.  
  2629. + $ret .= '<span class="pagenav">&lt;&lt; '. _UE_FIRST_PAGE .'</span> ';
  2630.  
  2631. + $ret .= '<span class="pagenav">&lt; '. _UE_PREV_PAGE .'</span> ';
  2632.  
  2633. }
  2634.  
  2635.  
  2636.  
  2637. for ($i=$start_loop; $i <= $stop_loop; $i++) {
  2638.  
  2639. @@ -842,7 +803,7 @@
  2640. if ($i == $this_page) {
  2641.  
  2642. $ret .= "\n <span class=\"pagenav\">[".$i."]</span> ";
  2643.  
  2644. } else {
  2645.  
  2646. - $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=".$page."&searchword=".$searchword."&searchphrase=".$phrase."&task=".$task)."\"><strong>$i</strong></a>";
  2647.  
  2648. + $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str.$page.$search_str)."\"><strong>$i</strong></a>";
  2649.  
  2650. }
  2651.  
  2652. }
  2653.  
  2654.  
  2655.  
  2656. @@ -850,75 +811,38 @@
  2657. $page = $this_page * $limit;
  2658.  
  2659. $end_page = ($total_pages-1) * $limit;
  2660.  
  2661. if ($stop_loop < $total_pages-1) $ret .= "\n<span class=\"pagenav\"> <strong>...</strong> </span>";
  2662.  
  2663. - if ($stop_loop < $total_pages) $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=".$end_page."&searchphrase=".$phrase."&task=".$task)."\" title=\"" . _UE_END_PAGE . "\"><strong>".$total_pages."</strong></a>";
  2664.  
  2665. - $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=".$page."&searchword=".$searchword."&searchphrase=".$phrase."&task=".$task)."\" title=\"" . _UE_NEXT_PAGE . "\">" . _UE_NEXT_PAGE . " ></a>";
  2666.  
  2667. - $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs("index.php?option=com_cb_search&limitstart=".$end_page."&searchword=".$searchword."&searchphrase=".$phrase."&task=".$task)."\" title=\"" . _UE_END_PAGE . "\">" . _UE_END_PAGE . " >></a>";
  2668.  
  2669. + if ($stop_loop < $total_pages) $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str.$end_page.$search_str)."\" title=\"" . _UE_END_PAGE . "\"><strong>".$total_pages."</strong></a>";
  2670.  
  2671. + $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str.$page.$search_str)."\" title=\"" . _UE_NEXT_PAGE . "\">" . _UE_NEXT_PAGE . " &gt;</a>";
  2672.  
  2673. + $ret .= "\n<a class=\"pagenav\" href=\"".sefRelToAbs($ue_base_url.$limstart_str.$end_page.$search_str)."\" title=\"" . _UE_END_PAGE . "\">" . _UE_END_PAGE . " &gt;&gt;</a>";
  2674.  
  2675. } else {
  2676.  
  2677. - $ret .= '<span class="pagenav">'. _UE_NEXT_PAGE .' ></span> ';
  2678.  
  2679. - $ret .= '<span class="pagenav">'. _UE_END_PAGE .' >></span>';
  2680.  
  2681. + $ret .= '<span class="pagenav">'. _UE_NEXT_PAGE .' &gt;</span> ';
  2682.  
  2683. + $ret .= '<span class="pagenav">'. _UE_END_PAGE .' &gt;&gt;</span>';
  2684.  
  2685. }
  2686.  
  2687. return $ret;
  2688.  
  2689. }
  2690.  
  2691.  
  2692.  
  2693.  
  2694.  
  2695. -
  2696.  
  2697. function correct_search($search_sql){
  2698.  
  2699. $pattern[0] = "+";
  2700.  
  2701. $pattern[1] = "%28";
  2702.  
  2703. $pattern[2] = "%27";
  2704.  
  2705. $pattern[3] = "%25";
  2706.  
  2707. $pattern[4] = "%29";
  2708.  
  2709. - $pattern[5] = "%20";
  2710.  
  2711. + $pattern[5] = "%3C";
  2712.  
  2713. + $pattern[6] = "%3D";
  2714.  
  2715. + $pattern[7] = "%3E";
  2716.  
  2717. +
  2718.  
  2719. $replacement[0] = " ";
  2720.  
  2721. $replacement[1] = "(";
  2722.  
  2723. $replacement[2] = "'";
  2724.  
  2725. $replacement[3] = "%";
  2726.  
  2727. $replacement[4] = ")";
  2728.  
  2729. - $replacement[5] = " ";
  2730.  
  2731. + $replacement[5] = "<";
  2732.  
  2733. + $replacement[6] = "=";
  2734.  
  2735. + $replacement[7] = ">";
  2736.  
  2737. $fieldvalue = str_replace($pattern, $replacement, $search_sql );
  2738.  
  2739. return $fieldvalue;
  2740.  
  2741. }
  2742.  
  2743.  
  2744.  
  2745. -
  2746.  
  2747. -function getfieldtype($name){
  2748.  
  2749. - global $database;
  2750.  
  2751. - $query = "SELECT type FROM #__comprofiler_fields WHERE name='".$name."'";
  2752.  
  2753. - $database->setQuery($query);
  2754.  
  2755. - $type = $database->loadResult();
  2756.  
  2757. - return $type;
  2758.  
  2759. -}
  2760.  
  2761. -
  2762.  
  2763. - /**
  2764.  
  2765. - * Opens up a xml file and looks for the element
  2766.  
  2767. - * @param $ElementName Define what element you want to retrieve from the xml file
  2768.  
  2769. - * @param $Document Define the document, can be http as well!
  2770.  
  2771. - * @return Element Value
  2772.  
  2773. - */
  2774.  
  2775. - function getXMLElementData($ElementName, $Document) {
  2776.  
  2777. - global $mosConfig_absolute_path;
  2778.  
  2779. - require_once ($mosConfig_absolute_path."/includes/domit/xml_domit_include.php");
  2780.  
  2781. -
  2782.  
  2783. - $gsgCollection = & new DOMIT_Document();
  2784.  
  2785. - $gsgCollection->resolveErrors(true);
  2786.  
  2787. - //$gsgCollection->useHTTPClient(true);
  2788.  
  2789. - $success = $gsgCollection->loadXML($Document);
  2790.  
  2791. -
  2792.  
  2793. - if ($success) {
  2794.  
  2795. - if ($gsgCollection->documentElement->hasChildNodes()) {
  2796.  
  2797. - $myChildNodes = & $gsgCollection->documentElement->childNodes;
  2798.  
  2799. - $numChildren = & $gsgCollection->documentElement->childCount;
  2800.  
  2801. -
  2802.  
  2803. - for ($i = 0; $i < $numChildren; $i ++) {
  2804.  
  2805. - $currentNode = & $myChildNodes[$i]->firstChild;
  2806.  
  2807. - $currentNodeName = & $myChildNodes[$i];
  2808.  
  2809. - if ($currentNodeName->nodeName == $ElementName) {
  2810.  
  2811. - return $currentNode->toString(false);
  2812.  
  2813. - }
  2814.  
  2815. -
  2816.  
  2817. - }
  2818.  
  2819. - }
  2820.  
  2821. - }
  2822.  
  2823. - }
  2824.  
  2825. -
  2826.  
  2827. //End of class
  2828.  
  2829. }
  2830.  
  2831.  
  2832. === modified file 'administrator/components/com_cb_search/cb_search.config.php'
  2833. --- administrator/components/com_cb_search/cb_search.config.php 2008-07-04 21:14:01 +0000
  2834. +++ administrator/components/com_cb_search/cb_search.config.php 2009-03-18 02:58:56 +0000
  2835. @@ -1,22 +1,22 @@
  2836. <?php
  2837. -$cbsa_ajax_image = 'toolbar';
  2838. -$cbsa_ajax_on = '1';
  2839. $cbsa_allow_adv_search = '1';
  2840. $cbsa_allow_search_1 = '1';
  2841. $cbsa_allow_search_2 = '1';
  2842. +$cbsa_birthday_fieldname = 'cb_birthday';
  2843. $cbsa_comparision = '0';
  2844. $cbsa_deactivate_allowaccess = '0';
  2845. +$cbsa_enable_age_search = '1';
  2846. +$cbsa_enable_photo_only_search = '1';
  2847. $cbsa_logical = '0';
  2848. $cbsa_logical_and = '1';
  2849. $cbsa_logical_default = '1';
  2850. $cbsa_logical_equal = '0';
  2851. $cbsa_logical_not = '0';
  2852. $cbsa_logical_or = '0';
  2853. +$cbsa_lower_age_limit = '18';
  2854. $cbsa_page_nav = '2';
  2855. -$cbsa_show_result = '0';
  2856. +$cbsa_show_result = '1';
  2857. $cbsa_show_sql_error = '1';
  2858. -$cbsa_show_title = '0';
  2859. -$cbsa_simple_default = 'any';
  2860. -$cbsa_usergid = '';
  2861. -$cbsa_userlist = '0';
  2862. -?>
  2863. \ No newline at end of file
  2864. +$cbsa_show_title = '1';
  2865. +$cbsa_upper_age_limit = '100';
  2866. +?>
  2867.  
  2868. === modified file 'administrator/components/com_cb_search/cb_search.xml'
  2869. --- administrator/components/com_cb_search/cb_search.xml 2008-07-04 21:14:01 +0000
  2870. +++ administrator/components/com_cb_search/cb_search.xml 2009-03-11 20:50:16 +0000
  2871. @@ -1,12 +1,12 @@
  2872. <?xml version="1.0" ?>
  2873.  
  2874. <mosinstall type="component">
  2875.  
  2876. <name>cb_search</name>
  2877.  
  2878. - <creationDate>04.10.2006</creationDate>
  2879.  
  2880. + <creationDate>25.08.2006</creationDate>
  2881.  
  2882. <author>Robert Grund</author>
  2883.  
  2884. <copyright>This frontend component is released under the GNU/GPL License</copyright>
  2885.  
  2886. <authorEmail>robertgrund@yahoo.com</authorEmail>
  2887.  
  2888. <authorUrl>www.emptorum.com</authorUrl>
  2889.  
  2890. - <version>2.0.5</version>
  2891.  
  2892. + <version>2.0.4</version>
  2893.  
  2894. <description>Community Builder Advanced Search Component</description>
  2895.  
  2896. <files>
  2897.  
  2898. <filename>index.html</filename>
  2899.  
  2900. @@ -14,15 +14,15 @@
  2901. <filename>cb_search.html.php</filename>
  2902.  
  2903. <filename>images/form-find-animated.gif</filename>
  2904.  
  2905. <filename>images/search.gif</filename>
  2906.  
  2907. - <filename>images/spinner.gif</filename>
  2908.  
  2909. - <filename>images/progressbar.gif</filename>
  2910.  
  2911. - <filename>js/AjaxRequest.js</filename>
  2912.  
  2913. <filename>js/sorttable.js</filename>
  2914.  
  2915. </files>
  2916.  
  2917. <install>
  2918.  
  2919. <queries>
  2920.  
  2921. <query>
  2922.  
  2923. - CREATE TABLE IF NOT EXISTS `#__cb_search` (
  2924.  
  2925. + DROP TABLE IF EXISTS `#__cb_search`;
  2926.  
  2927. + </query>
  2928.  
  2929. + <query>
  2930.  
  2931. + CREATE TABLE `#__cb_search` (
  2932.  
  2933. `id` INT( 11 ) NOT NULL AUTO_INCREMENT ,
  2934.  
  2935. `name` VARCHAR( 255 ) NOT NULL ,
  2936.  
  2937. `default` TINYINT( 1 ) NOT NULL ,
  2938.  
  2939. @@ -33,8 +33,11 @@
  2940. PRIMARY KEY ( `id` )
  2941.  
  2942. );
  2943.  
  2944. </query>
  2945.  
  2946. + <query>
  2947.  
  2948. + DROP TABLE IF EXISTS `#__cb_search_fields`;
  2949.  
  2950. + </query>
  2951.  
  2952. <query>
  2953.  
  2954. - CREATE TABLE IF NOT EXISTS `#__cb_search_fields` (
  2955.  
  2956. + CREATE TABLE `#__cb_search_fields` (
  2957.  
  2958. `id` int(11) NOT NULL auto_increment,
  2959.  
  2960. `fieldid` int(11) NOT NULL default '0',
  2961.  
  2962. `search` tinyint(1) NOT NULL default '0',
  2963.  
  2964. @@ -44,18 +47,23 @@
  2965. </query>
  2966.  
  2967. </queries>
  2968.  
  2969. </install>
  2970.  
  2971. + <uninstall>
  2972.  
  2973. + <queries>
  2974.  
  2975. + <query>DROP TABLE IF EXISTS `#__cb_search`;</query>
  2976.  
  2977. + <query>DROP TABLE IF EXISTS `#__cb_search_fields`;</query>
  2978.  
  2979. + </queries>
  2980.  
  2981. + </uninstall>
  2982.  
  2983. <installfile>install.cb_search.php</installfile>
  2984.  
  2985. <uninstallfile>uninstall.cb_search.php</uninstallfile>
  2986.  
  2987. <administration>
  2988.  
  2989. <menu>Community Builder Advanced Search</menu>
  2990.  
  2991. <files>
  2992.  
  2993. <!-- base files -->
  2994.  
  2995. + <filename>index.html</filename>
  2996.  
  2997. <filename>admin.cb_search.php</filename>
  2998.  
  2999. <filename>admin.cb_search.html.php</filename>
  3000.  
  3001. <filename>cb_search.config.php</filename>
  3002.  
  3003. <filename>cb_search.class.php</filename>
  3004.  
  3005. - <filename>cbas_version.xml</filename>
  3006.  
  3007. - <filename>index.html</filename>
  3008.  
  3009. <filename>toolbar.cb_search.html.php</filename>
  3010.  
  3011. <filename>toolbar.cb_search.php</filename>
  3012.  
  3013. <filename>help/cb_search.showmenu.help.html</filename>
  3014.  
  3015.  
  3016. === removed file 'administrator/components/com_cb_search/cbas_version.xml'
  3017. --- administrator/components/com_cb_search/cbas_version.xml 2008-07-04 21:14:01 +0000
  3018. +++ administrator/components/com_cb_search/cbas_version.xml 1970-01-01 00:00:00 +0000
  3019. @@ -1,5 +0,0 @@
  3020. -<cbasupdate type="versioninfo">
  3021.  
  3022. - <version>2.0.5</version>
  3023.  
  3024. - <information>A new version is available! Please download and reinstall!</information>
  3025.  
  3026. - <date>5.Oct 2006</date>
  3027.  
  3028. -</cbasupdate>
  3029.  
  3030.  
  3031. === modified file 'administrator/components/com_cb_search/install.cb_search.php'
  3032. --- administrator/components/com_cb_search/install.cb_search.php 2008-07-04 21:14:01 +0000
  3033. +++ administrator/components/com_cb_search/install.cb_search.php 2009-03-11 20:50:16 +0000
  3034. @@ -21,11 +21,11 @@
  3035. </td>
  3036.  
  3037. </tr>
  3038.  
  3039. <tr>
  3040.  
  3041. - <td></td>
  3042.  
  3043. - <td>
  3044.  
  3045. + <td></td>
  3046.  
  3047. + <td>
  3048.  
  3049. <ul>
  3050.  
  3051. <li>
  3052.  
  3053. - This component is a stand alone but needs the Community Builder Component to
  3054.  
  3055. + This component is a stand alone but needs the Community Builder Component to
  3056.  
  3057. run.</li>
  3058.  
  3059. <li>The cb_search.config.php file needs to be writeable. This file is located in
  3060.  
  3061. adminstrator/components/com_cb_search</li>
  3062.  
  3063. @@ -34,110 +34,80 @@
  3064. <p>To add a menu Item, you have to</p>
  3065.  
  3066. <ul>
  3067.  
  3068. <li>
  3069.  
  3070. - You will need to add another sub menu section into your menu. Just add the menu item through the Backend Administration
  3071.  
  3072. + You will need to add another sub menu section into your menu. Just add the menu item through the Backend Administration
  3073.  
  3074. Section.</li>
  3075.  
  3076. <li>You can also use the Community Builder Advances Search Component to display the user
  3077.  
  3078. profile. Just add a menu item as a link and use the following url
  3079.  
  3080. &quot;<b>index.php?option=com_cb_search&amp;task=usersList</b>&quot;</li>
  3081.  
  3082. - <li>NEW - If you have already installed the Advanced Search component, your Itemid in your Main menu has been corrected</li>
  3083.  
  3084. - <li>NEW - An Ajax Search Engine has been implemented - You will need to set up the configuration for the feature</li>
  3085.  
  3086. - <li>NEW - Currently all settings have been deleted and you will need to set the configuration again but at the next upgrade your configuration settings have stayed and you will not need to reset everything!</li>
  3087.  
  3088. </ul>
  3089.  
  3090. - </td>
  3091.  
  3092. + </td>
  3093.  
  3094. </tr>
  3095.  
  3096. <tr>
  3097.  
  3098. <td background="E0E0E0" style="border:1px solid #999;" colspan="2">
  3099.  
  3100. <code>Installation Process:<br />
  3101.  
  3102. <?php
  3103.  
  3104. - //Need to find out if the table #_cb_search is empty
  3105.  
  3106. -
  3107.  
  3108. - $database->setQuery("SELECT COUNT(*) FROM #__cb_search");
  3109.  
  3110. - $components = $database->loadresult();
  3111.  
  3112. - IF($components == 0) {
  3113.  
  3114. - # Add items in the table
  3115.  
  3116. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (2, 'Is Null', 0, 1, 'IS NULL', 0, 1);");
  3117.  
  3118. - $iconresult[0] = $database->query();
  3119.  
  3120. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (6, 'Like', 1, 1, 'Like \'%SEARCHWORD%\'', 0, 1);");
  3121.  
  3122. - $iconresult[1] = $database->query();
  3123.  
  3124. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (7, 'Is not Null', 0, 1, 'IS NOT NULL', 0, 1);");
  3125.  
  3126. - $iconresult[2] = $database->query();
  3127.  
  3128. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (8, 'Beginning with', 0, 1, '\'SEARCHWORD%\'', 0, 1);");
  3129.  
  3130. - $iconresult[3] = $database->query();
  3131.  
  3132. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (9, 'Ending with', 0, 1, '\'%SEARCHWORD\'', 0, 1);");
  3133.  
  3134. - $iconresult[4] = $database->query();
  3135.  
  3136. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (10, 'Begins with first Letter', 0, 1, '^SEARCHWORD', 0, 1);");
  3137.  
  3138. - $iconresult[5] = $database->query();
  3139.  
  3140. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (11, 'Equal', 0, 1, '= \'SEARCHWORD\'', 0, 1);");
  3141.  
  3142. - $iconresult[6] = $database->query();
  3143.  
  3144. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (12, 'Not Equal', 0, 1, '<> \'SEARCHWORD\'', 0, 1);");
  3145.  
  3146. - $iconresult[7] = $database->query();
  3147.  
  3148. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (13, 'Less than or equal', 0, 1, '<= \'SEARCHWORD\'', 0, 1);");
  3149.  
  3150. - $iconresult[8] = $database->query();
  3151.  
  3152. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (14, 'Less', 0, 1, '< \'SEARCHWORD\'', 0, 1);");
  3153.  
  3154. - $iconresult[9] = $database->query();
  3155.  
  3156. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (15, 'Greater than or equal', 0, 1, '>= \'SEARCHWORD\'', 0, 1);");
  3157.  
  3158. - $iconresult[10] = $database->query();
  3159.  
  3160. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (17, 'AND', 1, 1, 'AND', 0, 2);");
  3161.  
  3162. - $iconresult[11] = $database->query();
  3163.  
  3164. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (18, 'OR', 0, 1, 'OR', 0, 2);");
  3165.  
  3166. - $iconresult[12] = $database->query();
  3167.  
  3168. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (19, 'AND (', 0, 1, 'AND (', 0, 2);");
  3169.  
  3170. - $iconresult[13] = $database->query();
  3171.  
  3172. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (20, 'OR (', 0, 1, 'OR (', 0, 2);");
  3173.  
  3174. - $iconresult[14] = $database->query();
  3175.  
  3176. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (21, ') AND (', 0, 1, ') AND (', 0, 2);");
  3177.  
  3178. - $iconresult[15] = $database->query();
  3179.  
  3180. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (22, ') OR (', 0, 1, ') OR (', 0, 2);");
  3181.  
  3182. - $iconresult[16] = $database->query();
  3183.  
  3184. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (23, ') AND', 0, 1, ') AND', 0, 2);");
  3185.  
  3186. - $iconresult[17] = $database->query();
  3187.  
  3188. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (24, ') OR', 0, 1, ') OR', 0, 2);");
  3189.  
  3190. - $iconresult[18] = $database->query();
  3191.  
  3192. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (25, ')', 0, 1, ')', 0, 2);");
  3193.  
  3194. - $iconresult[19] = $database->query();
  3195.  
  3196. - $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (26, '(', 0, 1, '(', 0, 2);");
  3197.  
  3198. - $iconresult[20] = $database->query();
  3199.  
  3200. - foreach ($iconresult as $i=>$icresult) {
  3201.  
  3202. - if ($icresult) {
  3203.  
  3204. - echo "<font color='green'>FINISHED:</font> Loaded record $i .<br />";
  3205.  
  3206. - } else {
  3207.  
  3208. - echo "<font color='red'>ERROR:</font> Could not load the record.<br />";
  3209.  
  3210. - }
  3211.  
  3212. - }
  3213.  
  3214. - }
  3215.  
  3216. -
  3217.  
  3218. - $thefinallink = $mosConfig_live_site."/administrator/index2.php?option=$com_sb_search&task=$update";
  3219.  
  3220. -
  3221.  
  3222. -
  3223.  
  3224. -//If the component is reinstalled, we correct the Itemid in the menusection
  3225.  
  3226. -
  3227.  
  3228. - $query = "SELECT id FROM #__components AS A WHERE A.option = 'com_cb_search'";
  3229.  
  3230. - $database->setQuery($query);
  3231.  
  3232. - $optionid = $database->loadResult();
  3233.  
  3234. -
  3235.  
  3236. -//alter the menu section now with the correct id
  3237.  
  3238. -
  3239.  
  3240. - $query = "UPDATE #__menu SET componentid = '".$optionid."' WHERE link = 'index.php?option=com_cb_search' AND published='1'" ;
  3241.  
  3242. - $database->setQuery($query);
  3243.  
  3244. - if (!$database->query()) {
  3245.  
  3246. - $msgerror = "<font color='red'>ERROR:The component was not preinstalled and the menu item was not altered</font> ";
  3247.  
  3248. - } else {
  3249.  
  3250. - $msgerror = "<font color='green'>The menu link for the Advanced Search Component was updated with the correct Itemid number. No need to re-add the link!!</font> ";
  3251.  
  3252. - }
  3253.  
  3254. - echo $msgerror."<br />";
  3255.  
  3256. + # Add items in the table
  3257.  
  3258. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (2, 'Is Null', 0, 1, 'IS NULL', 0, 1);");
  3259.  
  3260. + $iconresult[0] = $database->query();
  3261.  
  3262. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (6, 'Like', 1, 1, 'Like \'%SEARCHWORD%\'', 0, 1);");
  3263.  
  3264. + $iconresult[1] = $database->query();
  3265.  
  3266. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (7, 'Is not Null', 0, 1, 'IS NOT NULL', 0, 1);");
  3267.  
  3268. + $iconresult[2] = $database->query();
  3269.  
  3270. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (8, 'Beginning with', 0, 1, '\'SEARCHWORD%\'', 0, 1);");
  3271.  
  3272. + $iconresult[3] = $database->query();
  3273.  
  3274. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (9, 'Ending with', 0, 1, '\'%SEARCHWORD\'', 0, 1);");
  3275.  
  3276. + $iconresult[4] = $database->query();
  3277.  
  3278. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (10, 'Begins with first Letter', 0, 1, '^SEARCHWORD', 0, 1);");
  3279.  
  3280. + $iconresult[5] = $database->query();
  3281.  
  3282. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (11, 'Equal', 0, 1, '= \'SEARCHWORD\'', 0, 1);");
  3283.  
  3284. + $iconresult[6] = $database->query();
  3285.  
  3286. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (12, 'Not Equal', 0, 1, '<> \'SEARCHWORD\'', 0, 1);");
  3287.  
  3288. + $iconresult[7] = $database->query();
  3289.  
  3290. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (13, 'Less than or equal', 0, 1, '<= \'SEARCHWORD\'', 0, 1);");
  3291.  
  3292. + $iconresult[8] = $database->query();
  3293.  
  3294. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (14, 'Less', 0, 1, '< \'SEARCHWORD\'', 0, 1);");
  3295.  
  3296. + $iconresult[9] = $database->query();
  3297.  
  3298. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (15, 'Greater than or equal', 0, 1, '>= \'SEARCHWORD\'', 0, 1);");
  3299.  
  3300. + $iconresult[10] = $database->query();
  3301.  
  3302. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (17, 'AND', 1, 1, 'AND', 0, 2);");
  3303.  
  3304. + $iconresult[11] = $database->query();
  3305.  
  3306. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (18, 'OR', 0, 1, 'OR', 0, 2);");
  3307.  
  3308. + $iconresult[12] = $database->query();
  3309.  
  3310. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (19, 'AND (', 0, 1, 'AND (', 0, 2);");
  3311.  
  3312. + $iconresult[13] = $database->query();
  3313.  
  3314. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (20, 'OR (', 0, 1, 'OR (', 0, 2);");
  3315.  
  3316. + $iconresult[14] = $database->query();
  3317.  
  3318. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (21, ') AND (', 0, 1, ') AND (', 0, 2);");
  3319.  
  3320. + $iconresult[15] = $database->query();
  3321.  
  3322. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (22, ') OR (', 0, 1, ') OR (', 0, 2);");
  3323.  
  3324. + $iconresult[16] = $database->query();
  3325.  
  3326. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (23, ') AND', 0, 1, ') AND', 0, 2);");
  3327.  
  3328. + $iconresult[17] = $database->query();
  3329.  
  3330. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (24, ') OR', 0, 1, ') OR', 0, 2);");
  3331.  
  3332. + $iconresult[18] = $database->query();
  3333.  
  3334. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (25, ')', 0, 1, ')', 0, 2);");
  3335.  
  3336. + $iconresult[19] = $database->query();
  3337.  
  3338. + $database->setQuery("INSERT INTO `#__cb_search` (`id`, `name`, `default`, `published`, `sql_code`, `ordering`, `category`) VALUES (26, '(', 0, 1, '(', 0, 2);");
  3339.  
  3340. + $iconresult[20] = $database->query();
  3341.  
  3342. + foreach ($iconresult as $i=>$icresult) {
  3343.  
  3344. + if ($icresult) {
  3345.  
  3346. + echo "<font color='green'>FINISHED:</font> Loaded record $i .<br />";
  3347.  
  3348. + } else {
  3349.  
  3350. + echo "<font color='red'>ERROR:</font> Could not load the record.<br />";
  3351.  
  3352. + }
  3353.  
  3354. + }
  3355.  
  3356. +
  3357.  
  3358. + $thefinallink = $mosConfig_live_site."/administrator/index2.php?option=$com_sb_search&task=$update";
  3359.  
  3360. +
  3361.  
  3362. ?>
  3363.  
  3364. - <font color="green"><b>
  3365.  
  3366. - <?php IF($components == 0) {?>
  3367.  
  3368. - First
  3369.  
  3370. - <?php } ?>
  3371.  
  3372. - Installation finished.</b></font></code>
  3373.  
  3374. + <font color="green"><b>First Installation finished.</b></font></code>
  3375.  
  3376.  
  3377.  
  3378. </td>
  3379.  
  3380. </tr>
  3381.  
  3382. <tr>
  3383.  
  3384. <td width="36"></td>
  3385.  
  3386. <td>
  3387.  
  3388. - To finish the installation you will need to press the Update Icon in the Advanced Search Menu!!!
  3389.  
  3390. + To finish the installation you will need to press the Update Icon in the Advanced Search Menu!!!
  3391.  
  3392. </td>
  3393.  
  3394. </tr>
  3395.  
  3396.  
  3397.  
  3398.  
  3399. === modified file 'administrator/components/com_cb_search/languages/english.php'
  3400. --- administrator/components/com_cb_search/languages/english.php 2008-07-04 21:14:01 +0000
  3401. +++ administrator/components/com_cb_search/languages/english.php 2009-03-12 01:50:42 +0000
  3402. @@ -10,6 +10,9 @@
  3403. */
  3404.  
  3405.  
  3406.  
  3407. // Header language definitions
  3408.  
  3409. +DEFINE("_SEARCH_ANYWORDS","Search for any words");
  3410.  
  3411. +DEFINE("_SEARCH_ALLWORDS","Search for all words");
  3412.  
  3413. +DEFINE("_SEARCH_PHRASE","Search for phrase");
  3414.  
  3415. DEFINE("_CB_AS_TITLE","Advanced Search");
  3416.  
  3417. DEFINE("_CB_AS_BUTTON","Search");
  3418.  
  3419. DEFINE("_CB_AS_COMP_TITLE","COMMUNITY BUILDER - Advanced Search Component");
  3420.  
  3421. @@ -109,24 +112,24 @@
  3422. DEFINE("_CB_AS_SHOW_ADVANCED","Advanced");
  3423.  
  3424. DEFINE("_CB_AS_SHOW_ADVANCED2","Expert");
  3425.  
  3426.  
  3427.  
  3428. -//Version 2.0.5
  3429.  
  3430. -DEFINE("_CB_AS_USERTYPE","User Type");
  3431.  
  3432. -DEFINE("_CB_AS_USERTYPE_HELP","Define what Users types will be included within the search");
  3433.  
  3434. -DEFINE("_CB_AS_SHOWLIST","Show all User Lists");
  3435.  
  3436. -DEFINE("_CB_AS_SHOWLIST_HELP","Define if you want to show all your Userlist or just the default one");
  3437.  
  3438. -DEFINE("_CB_AS_NEWVERSION","Download new Version!");
  3439.  
  3440. -DEFINE("_CB_AS_SIMPLE_DEFAULT","Simple Menu Default");
  3441.  
  3442. -DEFINE("_CB_AS_SIMPLE_DEFAULT_HELP","Choose which one should be shown as the selected Option");
  3443.  
  3444. -DEFINE("_CB_AS_AJAX_ON","Enable Ajax");
  3445.  
  3446. -DEFINE("_CB_AS_AJAX_ON_HELP","You can turn the Ajax Search Engine On=Yes or Off=No");
  3447.  
  3448. -DEFINE("_CB_AS_AJAX_IMAGE","Ajax Search Image");
  3449.  
  3450. -DEFINE("_CB_AS_AJAX_IMAGE_HELP","Choose which Image you want to show when you have turned the Ajax Search Engine On");
  3451.  
  3452. -DEFINE("_CB_AS_AJAX_IMAGE_SPINNER","Spinner");
  3453.  
  3454. -DEFINE("_CB_AS_AJAX_IMAGE_Toolbar","Toolbar");
  3455.  
  3456. +//Age Search -- BEGIN
  3457.  
  3458. +DEFINE("_CB_AS_AGE","Age");
  3459.  
  3460. +DEFINE("_CB_AS_TOAGE","to");
  3461.  
  3462. +DEFINE("_CB_AS_ENABLE_AGE_SEARCH","Enable age interval search hack");
  3463.  
  3464. +DEFINE("_CB_AS_ENABLE_AGE_SEARCH_HELP","A hack which is made to search age based on certain interval specified");
  3465.  
  3466. +DEFINE("_CB_AS_BIRTHDAY_FIELDNAME","Birthday field name");
  3467.  
  3468. +DEFINE("_CB_AS_BIRTHDAY_FIELDNAME_HELP","The field name of user\\'s birthday used for age interval search");
  3469.  
  3470. +DEFINE("_CB_AS_LOWER_AGE_LIMIT","Lower Age Limit");
  3471.  
  3472. +DEFINE("_CB_AS_LOWER_AGE_LIMIT_HELP","Lower age limit to be displayed in a select list while conducting search");
  3473.  
  3474. +DEFINE("_CB_AS_UPPER_AGE_LIMIT","Upper Age Limit");
  3475.  
  3476. +DEFINE("_CB_AS_UPPER_AGE_LIMIT_HELP","Upper age limit to displayed in a select list while conducting search");
  3477.  
  3478. +DEFINE("_CB_AS_ERR_BAD_INTERVAL","Bad interval for lower and upper age limit");
  3479.  
  3480. +//Age Search -- END
  3481.  
  3482.  
  3483.  
  3484. -// added by Tim Black 6-23-2008
  3485. -DEFINE("_SEARCH_ANYWORDS","Search any words");
  3486.  
  3487. -DEFINE("_SEARCH_ALLWORDS","Search all words");
  3488.  
  3489. -DEFINE("_SEARCH_PHRASE","Search for whole phrase");
  3490.  
  3491. +//Photo only search
  3492.  
  3493. +DEFINE("_CB_AS_EXTRA_FILTER","Extra Filter");
  3494.  
  3495. +DEFINE("_CB_AS_PHOTO_ONLY","Only member with photo");
  3496.  
  3497. +DEFINE("_CB_AS_ENABLE_PHOTO_ONLY_SEARCH","Enable member search with photo only");
  3498.  
  3499. +DEFINE("_CB_AS_ENABLE_PHOTO_ONLY_SEARCH_HELP","If enabled, this will add search capability to return only user with photo");
  3500.  
  3501.  
  3502.  
  3503. ?>
  3504.  
  3505.  
  3506. === modified file 'administrator/components/com_cb_search/tmpl/cb_search.config.tmpl.html'
  3507. --- administrator/components/com_cb_search/tmpl/cb_search.config.tmpl.html 2008-07-04 21:14:01 +0000
  3508. +++ administrator/components/com_cb_search/tmpl/cb_search.config.tmpl.html 2009-03-11 20:50:16 +0000
  3509. @@ -80,7 +80,16 @@
  3510. <td valign="top" align="left" colspan="3">
  3511.  
  3512. <b><HR></b>
  3513.  
  3514. </td>
  3515.  
  3516. - </tr>
  3517.  
  3518. + </tr>
  3519.  
  3520. + <tr align="center" valign="middle">
  3521.  
  3522. + <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW}:</strong></td>
  3523.  
  3524. + <td align="left" valign="top">
  3525.  
  3526. + {CBSA_LIST3}
  3527.  
  3528. + </td>
  3529.  
  3530. + <td align="left" valign="top">
  3531.  
  3532. + <a href="#" onMouseOver="return overlib('{CB_AS_ALLOW_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3533.  
  3534. + </td>
  3535.  
  3536. + </tr>
  3537.  
  3538. <tr align="center" valign="middle">
  3539.  
  3540. <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW_MENU_1}:</strong></td>
  3541.  
  3542. <td align="left" valign="top">
  3543.  
  3544. @@ -91,20 +100,6 @@
  3545. </td>
  3546.  
  3547. </tr>
  3548.  
  3549. <tr align="center" valign="middle">
  3550.  
  3551. - <td width="20%" align="left" valign="top"><strong>{CB_AS_SIMPLE_DEFAULT}:</strong></td>
  3552.  
  3553. - <td align="left" valign="top">
  3554.  
  3555. - {CBSA_LIST18}
  3556.  
  3557. - </td>
  3558.  
  3559. - <td align="left" valign="top">
  3560.  
  3561. - <a href="#" onMouseOver="return overlib('{CB_AS_SIMPLE_DEFAULT_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3562.  
  3563. - </td>
  3564.  
  3565. - </tr>
  3566.  
  3567. - <tr>
  3568.  
  3569. - <td valign="top" align="left" colspan="3">
  3570.  
  3571. - <b><HR></b>
  3572.  
  3573. - </td>
  3574.  
  3575. - </tr>
  3576.  
  3577. - <tr align="center" valign="middle">
  3578.  
  3579. <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW_MENU_2}:</strong></td>
  3580.  
  3581. <td align="left" valign="top">
  3582.  
  3583. {CBSA_LIST5}
  3584.  
  3585. @@ -114,20 +109,6 @@
  3586. </td>
  3587.  
  3588. </tr>
  3589.  
  3590. <tr align="center" valign="middle">
  3591.  
  3592. - <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW}:</strong></td>
  3593.  
  3594. - <td align="left" valign="top">
  3595.  
  3596. - {CBSA_LIST3}
  3597.  
  3598. - </td>
  3599.  
  3600. - <td align="left" valign="top">
  3601.  
  3602. - <a href="#" onMouseOver="return overlib('{CB_AS_ALLOW_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3603.  
  3604. - </td>
  3605.  
  3606. - </tr>
  3607.  
  3608. - <tr>
  3609.  
  3610. - <td valign="top" align="left" colspan="3">
  3611.  
  3612. - <b><HR></b>
  3613.  
  3614. - </td>
  3615.  
  3616. - </tr>
  3617.  
  3618. - <tr align="center" valign="middle">
  3619.  
  3620. <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW_PAGNAV}:</strong></td>
  3621.  
  3622. <td align="left" valign="top">
  3623.  
  3624. {CBSA_LIST6}
  3625.  
  3626. @@ -149,7 +130,7 @@
  3627. <td valign="top" align="left" colspan="3">
  3628.  
  3629. <b><HR></b>
  3630.  
  3631. </td>
  3632.  
  3633. - </tr>
  3634.  
  3635. + </tr>
  3636.  
  3637. <tr align="center" valign="middle">
  3638.  
  3639. <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW_DEF_EQUAL}:</strong></td>
  3640.  
  3641. <td align="left" valign="top">
  3642.  
  3643. @@ -158,7 +139,7 @@
  3644. <td align="left" valign="top">
  3645.  
  3646. <a href="#" onMouseOver="return overlib('{CB_AS_ALLOW_DEF_EQUAL_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3647.  
  3648. </td>
  3649.  
  3650. - </tr>
  3651.  
  3652. + </tr>
  3653.  
  3654. <tr align="center" valign="middle">
  3655.  
  3656. <td width="20%" align="left" valign="top"><strong>{CB_AS_ALLOW_DEF_AND}:</strong></td>
  3657.  
  3658. <td align="left" valign="top">
  3659.  
  3660. @@ -185,59 +166,63 @@
  3661. <td align="left" valign="top">
  3662.  
  3663. <a href="#" onMouseOver="return overlib('{CB_AS_ALLOW_DEF_NOT_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3664.  
  3665. </td>
  3666.  
  3667. - </tr>
  3668.  
  3669. - <tr>
  3670.  
  3671. - <td valign="top" align="left" colspan="3">
  3672.  
  3673. - <b><HR></b>
  3674.  
  3675. - </td>
  3676.  
  3677. - </tr>
  3678.  
  3679. - <tr align="center" valign="middle">
  3680.  
  3681. - <td width="20%" align="left" valign="top"><strong>{CB_AS_USERTYPE}:</strong></td>
  3682.  
  3683. - <td align="left" valign="top">
  3684.  
  3685. - {CBSA_LIST16}
  3686.  
  3687. - </td>
  3688.  
  3689. - <td align="left" valign="top">
  3690.  
  3691. - <a href="#" onMouseOver="return overlib('{CB_AS_USERTYPE_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3692.  
  3693. - </td>
  3694.  
  3695. - </tr>
  3696.  
  3697. - <tr>
  3698.  
  3699. - <td valign="top" align="left" colspan="3">
  3700.  
  3701. - <b><HR></b>
  3702.  
  3703. - </td>
  3704.  
  3705. - </tr>
  3706.  
  3707. - <tr align="center" valign="middle">
  3708.  
  3709. - <td width="20%" align="left" valign="top"><strong>{CB_AS_SHOWLIST}:</strong></td>
  3710.  
  3711. - <td align="left" valign="top">
  3712.  
  3713. - {CBSA_LIST17}
  3714.  
  3715. - </td>
  3716.  
  3717. - <td align="left" valign="top">
  3718.  
  3719. - <a href="#" onMouseOver="return overlib('{CB_AS_SHOWLIST_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3720.  
  3721. - </td>
  3722.  
  3723. - </tr>
  3724.  
  3725. - <tr>
  3726.  
  3727. - <td valign="top" align="left" colspan="3">
  3728.  
  3729. - <b><HR></b>
  3730.  
  3731. - </td>
  3732.  
  3733. - </tr>
  3734.  
  3735. - <tr align="center" valign="middle">
  3736.  
  3737. - <td width="20%" align="left" valign="top"><strong>{CB_AS_AJAX_ON}:</strong></td>
  3738.  
  3739. - <td align="left" valign="top">
  3740.  
  3741. - {CBSA_LIST19}
  3742.  
  3743. - </td>
  3744.  
  3745. - <td align="left" valign="top">
  3746.  
  3747. - <a href="#" onMouseOver="return overlib('{CB_AS_AJAX_ON_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3748.  
  3749. - </td>
  3750.  
  3751. - </tr>
  3752.  
  3753. - <tr align="center" valign="middle">
  3754.  
  3755. - <td width="20%" align="left" valign="top"><strong>{CB_AS_AJAX_IMAGE}:</strong></td>
  3756.  
  3757. - <td align="left" valign="top">
  3758.  
  3759. - {CBSA_LIST20}
  3760.  
  3761. - </td>
  3762.  
  3763. - <td align="left" valign="top">
  3764.  
  3765. - <a href="#" onMouseOver="return overlib('{CB_AS_AJAX_IMAGE_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3766.  
  3767. - </td>
  3768.  
  3769. - </tr>
  3770.  
  3771. -<!--
  3772.  
  3773. + </tr>
  3774.  
  3775. + <tr>
  3776.  
  3777. + <td valign="top" align="left" colspan="3">
  3778.  
  3779. + <b><hr></b>
  3780.  
  3781. + </td>
  3782.  
  3783. + </tr>
  3784.  
  3785. + <tr align="center" valign="middle">
  3786.  
  3787. + <td width="20%" align="left" valign="top"><strong>{CB_AS_ENABLE_AGE_SEARCH}:</strong></td>
  3788.  
  3789. + <td align="left" valign="top">
  3790.  
  3791. + {CBSA_LIST16}
  3792.  
  3793. + </td>
  3794.  
  3795. + <td align="left" valign="top">
  3796.  
  3797. + <a href="#" onMouseOver="return overlib('{CB_AS_ENABLE_AGE_SEARCH_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3798.  
  3799. + </td>
  3800.  
  3801. + </tr>
  3802.  
  3803. + <tr align="center" valign="middle">
  3804.  
  3805. + <td width="20%" align="left" valign="top"><strong>{CB_AS_BIRTHDAY_FIELDNAME}:</strong></td>
  3806.  
  3807. + <td align="left" valign="top">
  3808.  
  3809. + <input type="text" name="cbsa_birthday_fieldname" value="{CBSA_LIST17}" maxlength="255">
  3810.  
  3811. + </td>
  3812.  
  3813. + <td align="left" valign="top">
  3814.  
  3815. + <a href="#" onMouseOver="return overlib('{CB_AS_BIRTHDAY_FIELDNAME_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3816.  
  3817. + </td>
  3818.  
  3819. + </tr>
  3820.  
  3821. + <tr align="center" valign="middle">
  3822.  
  3823. + <td width="20%" align="left" valign="top"><strong>{CB_AS_LOWER_AGE_LIMIT}:</strong></td>
  3824.  
  3825. + <td align="left" valign="top">
  3826.  
  3827. + <input type="text" name="cbsa_lower_age_limit" value="{CBSA_LIST18}" size="4" maxlength="3">
  3828.  
  3829. + </td>
  3830.  
  3831. + <td align="left" valign="top">
  3832.  
  3833. + <a href="#" onMouseOver="return overlib('{CB_AS_LOWER_AGE_LIMIT_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3834.  
  3835. + </td>
  3836.  
  3837. + </tr>
  3838.  
  3839. + <tr align="center" valign="middle">
  3840.  
  3841. + <td width="20%" align="left" valign="top"><strong>{CB_AS_UPPER_AGE_LIMIT}:</strong></td>
  3842.  
  3843. + <td align="left" valign="top">
  3844.  
  3845. + <input type="text" name="cbsa_upper_age_limit" value="{CBSA_LIST19}" size="4" maxlength="3">
  3846.  
  3847. + </td>
  3848.  
  3849. + <td align="left" valign="top">
  3850.  
  3851. + <a href="#" onMouseOver="return overlib('{CB_AS_UPPER_AGE_LIMIT_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3852.  
  3853. + </td>
  3854.  
  3855. + </tr>
  3856.  
  3857. + <tr>
  3858.  
  3859. + <td valign="top" align="left" colspan="3">
  3860.  
  3861. + <b><hr></b>
  3862.  
  3863. + </td>
  3864.  
  3865. + </tr>
  3866.  
  3867. + <tr align="center" valign="middle">
  3868.  
  3869. + <td width="20%" align="left" valign="top"><strong>{CB_AS_ENABLE_PHOTO_ONLY_SEARCH}:</strong></td>
  3870.  
  3871. + <td align="left" valign="top">
  3872.  
  3873. + {CBSA_LIST20}
  3874.  
  3875. + </td>
  3876.  
  3877. + <td align="left" valign="top">
  3878.  
  3879. + <a href="#" onMouseOver="return overlib('{CB_AS_ENABLE_PHOTO_ONLY_SEARCH_HELP}', CAPTION, 'Help', ABOVE, RIGHT);" onmouseout="return nd();"><img src="../includes/js/ThemeOffice/tooltip.png" border="0" /></a></td>
  3880.  
  3881. + </td>
  3882.  
  3883. + </tr>
  3884.  
  3885. +<!--
  3886.  
  3887. <tr>
  3888.  
  3889. <td width="100%" valign="top" align="left" colspan="3">
  3890.  
  3891. <b><h1 class="blink">{CB_SA_NA}</b>
  3892.  
  3893.  
  3894. === modified file 'administrator/components/com_cb_search/tmpl/cb_search.showmenu.tmpl.html'
  3895. --- administrator/components/com_cb_search/tmpl/cb_search.showmenu.tmpl.html 2008-07-04 21:14:01 +0000
  3896. +++ administrator/components/com_cb_search/tmpl/cb_search.showmenu.tmpl.html 2009-03-11 20:50:16 +0000
  3897. @@ -196,15 +196,7 @@
  3898. </td></tr>
  3899.  
  3900. <tr class="thisform">
  3901.  
  3902. <td width="120" bgcolor="#FFFFFF">Installed version:</td>
  3903.  
  3904. - <td bgcolor="#FFFFFF">{LOCALVERSION}</td>
  3905.  
  3906. - </tr>
  3907.  
  3908. - <tr class="thisform">
  3909.  
  3910. - <td width="120" bgcolor="#FFFFFF">Current version:</td>
  3911.  
  3912. - <td bgcolor="#FFFFFF">{TRUNKVERSION}</td>
  3913.  
  3914. - </tr>
  3915.  
  3916. - <tr class="thisform">
  3917.  
  3918. - <td width="120" bgcolor="#FFFFFF">Information:</td>
  3919.  
  3920. - <td bgcolor="#FFFFFF"><font color="#FF0000">{TRUNKDATE}{TRUNKINFO}{UPDATE}</font></td>
  3921.  
  3922. + <td bgcolor="#FFFFFF">2.0.4</td>
  3923.  
  3924. </tr>
  3925.  
  3926. <tr class="thisform">
  3927.  
  3928. <td width="120" bgcolor="#FFFFFF">Team:</td>
  3929.  
  3930. @@ -322,7 +314,7 @@
  3931. <a href="http://www.joomlapolic.com/" target="_blank">Community Builder API</a><br />
  3932.  
  3933. <a href="http://www.dynarch.com/projects/calendar" target="_blank">Calendar</a><br />
  3934.  
  3935. <a href="http://www.bosrup.com/web/overlib/" target="_blank">overLib</a><br />
  3936.  
  3937. - <a href="http://www.ajaxtoolbox.com" target="_blank">AjaxToolbox</a><br />
  3938.  
  3939. +
  3940.  
  3941. </td>
  3942.  
  3943. </tr>
  3944.  
  3945. <tr class="thisform">
  3946.  
  3947.  
  3948. === modified file 'administrator/components/com_cb_search/tmpl/cb_search.simple.tmpl.html'
  3949. --- administrator/components/com_cb_search/tmpl/cb_search.simple.tmpl.html 2008-07-04 21:14:01 +0000
  3950. +++ administrator/components/com_cb_search/tmpl/cb_search.simple.tmpl.html 2009-03-11 20:50:16 +0000
  3951. @@ -4,71 +4,9 @@
  3952. @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
  3953.  
  3954. Joomla is Free Software
  3955.  
  3956. </mos:comment>
  3957.  
  3958. -<mos:tmpl name="header">
  3959.  
  3960. +<mos:tmpl name="header">
  3961.  
  3962. {CALENDAR}
  3963.  
  3964. </mos:tmpl>
  3965.  
  3966. -<mos:tmpl name="ajax">
  3967.  
  3968. -<script type="text/javascript">
  3969.  
  3970. -function SendQuery(key) {
  3971.  
  3972. - if (key.length==0){
  3973.  
  3974. - document.getElementById("autocomplete").innerHTML = '';
  3975.  
  3976. - HideDiv('autocomplete');
  3977.  
  3978. - } else {
  3979.  
  3980. - document.getElementById("autocomplete").innerHTML = ''
  3981.  
  3982. -
  3983.  
  3984. - //need to get the value of the radio button
  3985.  
  3986. - var radios = document.getElementById ('radios');
  3987.  
  3988. - if (radios) {
  3989.  
  3990. - var inputs = radios.getElementsByTagName ('input');
  3991.  
  3992. - if (inputs) {
  3993.  
  3994. - for (var i = 0; i < inputs.length; ++i) {
  3995.  
  3996. - if (inputs[i].type == 'radio' && inputs[i].name == 'searchphrase' && inputs[i].checked)
  3997.  
  3998. - sp=inputs[i].value;
  3999.  
  4000. - }
  4001.  
  4002. - }
  4003.  
  4004. - }
  4005.  
  4006. -
  4007.  
  4008. - //alert('{MOSCONFIG_LIVE_SITE}/index2.php?option=com_cb_search&task=simplesearch&searchword='+key+'&phrase='+sp);
  4009.  
  4010. - ShowDiv("autocomplete");
  4011.  
  4012. - AjaxRequest.get(
  4013.  
  4014. - {
  4015.  
  4016. - 'url':'{MOSCONFIG_LIVE_SITE}/index2.php?option=com_cb_search&task=simplesearch&searchword='+key+'&phrase='+sp
  4017.  
  4018. - ,'onLoading':RequestBegin
  4019.  
  4020. - ,'onComplete':function(req){ document.getElementById("autocomplete").innerHTML = req.responseText; }
  4021.  
  4022. - ,'onError':function(req){ alert('Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);}
  4023.  
  4024. - ,'onSuccess':RequestEnd
  4025.  
  4026. - ,'responseReceived':function(req) { RequestEnd }
  4027.  
  4028. - }
  4029.  
  4030. - );
  4031.  
  4032. - }
  4033.  
  4034. -}
  4035.  
  4036. -
  4037.  
  4038. -function showSpinner(id) {id.style.display = "block";}
  4039.  
  4040. -function hideSpinner(id) {id.style.display = "none";}
  4041.  
  4042. -
  4043.  
  4044. -function RequestBegin() {showSpinner(document.getElementById('spinner'));}
  4045.  
  4046. -function RequestEnd() {hideSpinner(document.getElementById('spinner'));}
  4047.  
  4048. -
  4049.  
  4050. -
  4051.  
  4052. -function ShowDiv(divid)
  4053.  
  4054. -{
  4055.  
  4056. - if (document.layers){
  4057.  
  4058. - document.layers[divid].visibility="show";
  4059.  
  4060. - } else {
  4061.  
  4062. - document.getElementById(divid).style.visibility="visible";
  4063.  
  4064. - }
  4065.  
  4066. -}
  4067.  
  4068. -
  4069.  
  4070. -function HideDiv(divid)
  4071.  
  4072. -{
  4073.  
  4074. - if (document.layers) document.layers[divid].visibility="hide";
  4075.  
  4076. - else document.getElementById(divid).style.visibility="hidden";
  4077.  
  4078. -}
  4079.  
  4080. -</script>
  4081.  
  4082. -<script type="text/javascript" src="{MOSCONFIG_LIVE_SITE}/components/com_cb_search/js/AjaxRequest.js"></script>
  4083.  
  4084. -<script type="text/javascript" src="{MOSCONFIG_LIVE_SITE}/components/com_cb_search/js/sorttable.js"></script>
  4085.  
  4086. -</mos:tmpl>
  4087.  
  4088. -
  4089.  
  4090. <mos:tmpl name="header_1">
  4091.  
  4092. <table>
  4093.  
  4094. <tr>
  4095.  
  4096. @@ -77,45 +15,33 @@
  4097. </table>
  4098.  
  4099. </mos:tmpl>
  4100.  
  4101. <mos:tmpl name="search_1">
  4102.  
  4103. - <table width="100%">
  4104.  
  4105. + <table>
  4106.  
  4107. <tr>
  4108.  
  4109. <td colspan="3" width="100%" class="componentheading">{CB_AS_SEARCH_TITLE_1}</td>
  4110.  
  4111. - </tr>
  4112.  
  4113. + </tr>
  4114.  
  4115. <tr>
  4116.  
  4117. <td valign="top">
  4118.  
  4119. - <form action="{URL}" method="post" id="adminForm2" name="adminForm2">
  4120.  
  4121. + <form action="{URL}" method="post">
  4122.  
  4123. <b>{PROMPT_KEYWORD}:</b>
  4124.  
  4125. </td>
  4126.  
  4127. <td valign="top">
  4128.  
  4129. - <input type="text" name="searchword" id="search_searchword" size="35" value="" class="inputbox" onfocus="this.value = '';" {CALLAJAX} style="WIDTH:200px" autocomplete="off"/>
  4130.  
  4131. - </td>
  4132.  
  4133. - <td valign="middle" align="center">
  4134.  
  4135. + <input type="text" name="searchword" id="search_searchword" size="35" value="" class="inputbox" />
  4136.  
  4137. <input type="image" src="{CB_AS_SEARCH_GIF}" alt="{CB_AS_BUTTON}" align="top" style="border: 0px;" />
  4138.  
  4139. </td>
  4140.  
  4141. + <td>
  4142.  
  4143. + </td>
  4144.  
  4145. </tr>
  4146.  
  4147. <tr>
  4148.  
  4149. - <td colspan="3"><p id="radios">
  4150.  
  4151. + <td colspan="3">
  4152.  
  4153. {LIST}
  4154.  
  4155. - </td></p>
  4156.  
  4157. - </tr>
  4158.  
  4159. - <td colspan="3" valign="middle" align="center">
  4160.  
  4161. -</mos:tmpl>
  4162.  
  4163. -<mos:tmpl name="image_1">
  4164.  
  4165. - <img alt="Spinner" id="spinner" src="{MOSCONFIG_LIVE_SITE}/components/com_cb_search/images/spinner.gif" height="15" width="17" style="display:none;" />
  4166.  
  4167. -</mos:tmpl>
  4168.  
  4169. -<mos:tmpl name="image_2">
  4170.  
  4171. - <img border="0" id="spinner" src="{MOSCONFIG_LIVE_SITE}/components/com_cb_search/images/progressbar.gif" width="280" height="13" style="display:none;" />
  4172.  
  4173. -</mos:tmpl>
  4174.  
  4175. -<mos:tmpl name="search_1b">
  4176.  
  4177. </td>
  4178.  
  4179. </tr>
  4180.  
  4181. <tr>
  4182.  
  4183. <td colspan="3">
  4184.  
  4185. - <input type="hidden" name="id" value="0" />
  4186.  
  4187. - <input type="hidden" name="gid" value="0" />
  4188.  
  4189. - <input type="hidden" name="option" value="{OPTION}" />
  4190.  
  4191. - <input type="hidden" name="task" value="simplesearch" />
  4192.  
  4193. - <div id="autocomplete"></div>
  4194.  
  4195. + <input type="hidden" name="id" value="0" />
  4196.  
  4197. + <input type="hidden" name="gid" value="0" />
  4198.  
  4199. + <input type="hidden" name="option" value="{OPTION}" />
  4200.  
  4201. + <input type="hidden" name="task" value="simplesearch" />
  4202.  
  4203. </form>
  4204.  
  4205. </td>
  4206.  
  4207. </tr>
  4208.  
  4209. @@ -126,7 +52,7 @@
  4210. <table cellpadding="5" cellspacing="0" border="0" width="98%" class="contentpane" id="registrationTable">
  4211.  
  4212. </mos:tmpl>
  4213.  
  4214. <mos:tmpl name="search_2">
  4215.  
  4216. - <table width="100%">
  4217.  
  4218. + <table>
  4219.  
  4220. <form action="{URL}" method="post" id="adminForm" name="adminForm">
  4221.  
  4222. <tr>
  4223.  
  4224. <td colspan="3" width="100%" class="componentheading">{CB_AS_SEARCH_TITLE_2}</td>
  4225.  
  4226. @@ -144,6 +70,22 @@
  4227. <td colspan="{COLSPAN}" class="fieldCell">{FIELD}</td>
  4228.  
  4229. </tr>
  4230.  
  4231. </mos:tmpl>
  4232.  
  4233. +<mos:tmpl name="search_2_ageint">
  4234.  
  4235. + <tr>
  4236.  
  4237. + <td align="right"><b>{TITLE}:</b></td>
  4238.  
  4239. + <td>
  4240.  
  4241. + </td>
  4242.  
  4243. + <td colspan="1" class="fieldCell">{FIELD1} {TO} {FIELD2}</td>
  4244.  
  4245. + </tr>
  4246.  
  4247. +</mos:tmpl>
  4248.  
  4249. +<mos:tmpl name="search_2_photoonly">
  4250.  
  4251. + <tr>
  4252.  
  4253. + <td align="right"><b>{TITLE}:</b></td>
  4254.  
  4255. + <td>
  4256.  
  4257. + </td>
  4258.  
  4259. + <td colspan="1" class="fieldCell"><input type="checkbox" id="photoonly" name="photoonly" value="1"{CHECKED} /><label for="photoonly">{CB_AS_PHOTO_ONLY}</label></td>
  4260.  
  4261. + </tr>
  4262.  
  4263. +</mos:tmpl>
  4264.  
  4265. <mos:tmpl name="search_2_list_footer">
  4266.  
  4267. <tr>
  4268.  
  4269. <td colspan="2">
  4270.  
  4271. @@ -170,6 +112,6 @@
  4272. </td>
  4273.  
  4274. </tr>
  4275.  
  4276. </table>
  4277.  
  4278. -</mos:tmpl>
  4279.  
  4280. +</mos:tmpl>
  4281.  
  4282. <mos:tmpl name="footer">
  4283.  
  4284. </mos:tmpl>
  4285.  
  4286.  
  4287. === modified file 'components/com_cb_search/cb_search.html.php'
  4288. --- components/com_cb_search/cb_search.html.php 2008-07-04 21:14:01 +0000
  4289. +++ components/com_cb_search/cb_search.html.php 2009-03-18 02:58:56 +0000
  4290. @@ -16,27 +16,21 @@
  4291.  
  4292.  
  4293. function simple($option, $rowFields, $rowFieldValues, $regErrorMSG){
  4294.  
  4295. global $mosConfig_absolute_path, $mosConfig_live_site, $Itemid;
  4296.  
  4297. -require ($mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php");
  4298.  
  4299. +require ($mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php");
  4300.  
  4301. $Itemid = mosGetParam( $_REQUEST, 'Itemid', '' );
  4302.  
  4303. $option_itemid = "&amp;Itemid=".$Itemid;
  4304.  
  4305.  
  4306.  
  4307. $tmpl = & cb_as :: createTemplate();
  4308.  
  4309. $tmpl->readTemplatesFromInput('cb_search.simple.tmpl.html');
  4310.  
  4311. - $tmpl->addVar('header', 'mosconfig_live_site', $mosConfig_live_site );
  4312.  
  4313. $tmpl->addVar('header', 'calendar', cb_as::cbCalendars(2) );
  4314.  
  4315. //$tmpl->addVar('header', 'index', sefRelToAbs("index.php") );
  4316.  
  4317. $tmpl->displayParsedTemplate('header');
  4318.  
  4319. - //if Ajax is turned on
  4320.  
  4321. - if ($cbsa_ajax_on){
  4322.  
  4323. - $tmpl->addVar('ajax', 'mosconfig_live_site', $mosConfig_live_site );
  4324.  
  4325. - $tmpl->displayParsedTemplate('ajax');
  4326.  
  4327. - }
  4328.  
  4329. -
  4330.  
  4331. if ( $cbsa_show_title ) {
  4332.  
  4333. $tmpl->addVar('header_1', 'cb_as_title', _CB_AS_TITLE );
  4334.  
  4335. $tmpl->displayParsedTemplate('header_1');
  4336.  
  4337. }
  4338.  
  4339.  
  4340.  
  4341. + $searchphrase = mosGetParam( $_REQUEST, 'searchphrase', 'any' );
  4342.  
  4343. $searchphrases = array();
  4344.  
  4345.  
  4346.  
  4347. $phrase = new stdClass();
  4348.  
  4349. @@ -54,8 +48,7 @@
  4350. $phrase->text = _SEARCH_PHRASE;
  4351.  
  4352. $searchphrases[] = $phrase;
  4353.  
  4354.  
  4355.  
  4356. - $lists['searchphrase']= mosHTML::radioList( $searchphrases, 'searchphrase', '', $cbsa_simple_default );
  4357.  
  4358. -
  4359.  
  4360. + $lists['searchphrase']= mosHTML::radioList( $searchphrases, 'searchphrase', '', $searchphrase );
  4361.  
  4362. $image_url = $mosConfig_live_site."/components/com_cb_search/images/search.gif";
  4363.  
  4364.  
  4365.  
  4366. $tabs = new mosTabs(0);
  4367.  
  4368. @@ -64,33 +57,17 @@
  4369. if ( $cbsa_allow_search_1 ){
  4370.  
  4371. $tabs->startTab(_CB_AS_SHOW_SIMPLE,"simple-page");
  4372.  
  4373. $tmpl->addVar('search_1', 'cb_as_search_title_1', _CB_AS_SEARCH_TITLE_1 );
  4374.  
  4375. + $tmpl->addVar('search_1', 'option', $option );
  4376.  
  4377. $tmpl->addVar('search_1', 'url', ampReplace(sefRelToAbs("index.php?option=".$option.$option_itemid)) );
  4378.  
  4379. $tmpl->addVar('search_1', 'cb_as_search_gif', $image_url );
  4380.  
  4381. $tmpl->addVar('search_1', 'cb_as_button', _CB_AS_BUTTON );
  4382.  
  4383. $tmpl->addVar('search_1', 'prompt_keyword', _CB_AS_ALL_FIELDS );
  4384.  
  4385. $tmpl->addVar('search_1', 'list', $lists['searchphrase'] );
  4386.  
  4387. - $tmpl->addVar('search_1', 'mosconfig_live_site', $mosConfig_live_site );
  4388.  
  4389. - if ($cbsa_ajax_on){
  4390.  
  4391. - $tmpl->addVar('search_1', 'callajax', "onKeyUp='SendQuery(this.value)'" );
  4392.  
  4393. - }
  4394.  
  4395. $tmpl->displayParsedTemplate('search_1');
  4396.  
  4397. -
  4398.  
  4399. - if ($cbsa_ajax_on){
  4400.  
  4401. - if ($cbsa_ajax_image=="spinner"){
  4402.  
  4403. - $tmpl->addVar('image_1', 'mosconfig_live_site', $mosConfig_live_site );
  4404.  
  4405. - $tmpl->displayParsedTemplate('image_1');
  4406.  
  4407. - } else {
  4408.  
  4409. - $tmpl->addVar('image_2', 'mosconfig_live_site', $mosConfig_live_site );
  4410.  
  4411. - $tmpl->displayParsedTemplate('image_2');
  4412.  
  4413. - }
  4414.  
  4415. - }
  4416.  
  4417. -
  4418.  
  4419. - $tmpl->addVar('search_1b', 'option', $option );
  4420.  
  4421. - $tmpl->displayParsedTemplate('search_1b');
  4422.  
  4423. $tabs->endTab();
  4424.  
  4425. }
  4426.  
  4427. //$tmpl->displayParsedTemplate('search_1_footer');
  4428.  
  4429. -
  4430.  
  4431. +
  4432.  
  4433. if ( $cbsa_allow_search_2 ){
  4434.  
  4435. $tabs->startTab(_CB_AS_SHOW_ADVANCED,"advanced-page");
  4436.  
  4437. $tmpl->addVar('search_2', 'url', ampReplace(sefRelToAbs("index.php?option=".$option.$option_itemid)) );
  4438.  
  4439. @@ -120,7 +97,7 @@
  4440. } else $oValue = "";
  4441.  
  4442. if(!ISSET($rowFields[$i]->id)) $rowFields[$i]->id="";
  4443.  
  4444. if(!ISSET($rowFieldValues['lst_'.$rowFields[$i]->name])) $rowFieldValues['lst_'.$rowFields[$i]->name]="";
  4445.  
  4446. - if ($rowFields[$i]->type=='multicheckbox' || $rowFields[$i]->type=='multiselect' || $rowFields[$i]->type=='radio' || $rowFields[$i]->type=='checkbox'){
  4447.  
  4448. + if ($rowFields[$i]->type=='multicheckbox' || $rowFields[$i]->type=='multiselect' || $rowFields[$i]->type=='radio'){
  4449.  
  4450. $pfields = "<input readonly type=\"hidden\" name=\"".$rowFields[$i]->name."[]\" value=\"no_check\" checked />";
  4451.  
  4452. }
  4453.  
  4454. $pfields .= cb_as::getFieldEntry(1,$calendars,$rowFields[$i]->type,$rowFields[$i]->name,$rowFields[$i]->description,$rowFields[$i]->title,$oValue,$rowFields[$i]->required,$rowFields[$i]->title,$rowFields[$i]->id,$rowFields[$i]->size, $rowFields[$i]->maxlength, $rowFields[$i]->cols, $rowFields[$i]->rows,$rowFields[$i]->profile,$rowFieldValues['lst_'.$rowFields[$i]->name],$rowFields[$i]->readonly);
  4455.  
  4456. @@ -207,17 +184,51 @@
  4457. $tmpl->displayParsedTemplate('search_2_list');
  4458.  
  4459. $tmpl->clearTemplate('search_2_list');
  4460.  
  4461. }
  4462.  
  4463. +
  4464.  
  4465. + //Age Search -- START
  4466.  
  4467. + if($cbsa_enable_age_search) {
  4468.  
  4469. + $tmpl->addVar('search_2_ageint','title',_CB_AS_AGE);
  4470.  
  4471. + $tmpl->addVar('search_2_ageint','to',_CB_AS_TOAGE);
  4472.  
  4473. + //create the select list
  4474.  
  4475. + $ages = array();
  4476.  
  4477. + $j = $cbsa_lower_age_limit;
  4478.  
  4479. + for($i=0; $j < ($cbsa_upper_age_limit+1); $i++) {
  4480.  
  4481. + $age = new StdClass();
  4482.  
  4483. + $age->value = $j;
  4484.  
  4485. + $age->text = $j;
  4486.  
  4487. + $j++;
  4488.  
  4489. + $ages[] = $age;
  4490.  
  4491. + }
  4492.  
  4493. + $startAge = mosGetParam($_REQUEST,'startage',$cbsa_lower_age_limit);
  4494.  
  4495. + $endAge = mosGetParam($_REQUEST,'endage',$cbsa_upper_age_limit);
  4496.  
  4497. + $selStartAge = mosHTML::selectList($ages,'startage','','value','text',$startAge);
  4498.  
  4499. + $selEndAge = mosHTML::selectList($ages,'endage','','value','text',$endAge);
  4500.  
  4501. + $tmpl->addVar('search_2_ageint','field1',$selStartAge);
  4502.  
  4503. + $tmpl->addVar('search_2_ageint','field2',$selEndAge);
  4504.  
  4505. + $tmpl->displayParsedTemplate('search_2_ageint');
  4506.  
  4507. + }
  4508.  
  4509. + //Age Search -- END
  4510.  
  4511. +
  4512.  
  4513. + //Photo only --START
  4514.  
  4515. + if($cbsa_enable_photo_only_search) {
  4516.  
  4517. + $photoonly = intval(mosGetParam($_REQUEST,'photoonly',0));
  4518.  
  4519. + $cb_sa_photo_only = mosHTML::yesnoRadioList('photoonly','',$photoonly);
  4520.  
  4521. + $tmpl->addVar('search_2_photoonly','title',_CB_AS_EXTRA_FILTER);
  4522.  
  4523. + $tmpl->addVar('search_2_photoonly','cb_as_photo_only',_CB_AS_PHOTO_ONLY);
  4524.  
  4525. + $tmpl->addVar('search_2_photoonly','checked',($photoonly ? ' checked' : ''));
  4526.  
  4527. + $tmpl->displayParsedTemplate('search_2_photoonly');
  4528.  
  4529. + }
  4530.  
  4531. +
  4532.  
  4533. $tmpl->addVar('search_2_list_footer', 'cb_as_search_gif', $image_url );
  4534.  
  4535. $tmpl->addVar('search_2_list_footer', 'option', $option );
  4536.  
  4537. $tmpl->addVar('search_2_list_footer', 'cb_as_button', _CB_AS_BUTTON );
  4538.  
  4539. $tmpl->displayParsedTemplate('search_2_list_footer');
  4540.  
  4541. - $tmpl->displayParsedTemplate('footer');
  4542.  
  4543. $tabs->endTab();
  4544.  
  4545. }
  4546.  
  4547.  
  4548.  
  4549. if($cbsa_allow_adv_search){
  4550.  
  4551. $tabs->startTab(_CB_AS_SHOW_ADVANCED2,"advanced2-page");
  4552.  
  4553. - $cb_sa_adv_url = sefRelToAbs( "index.php?option=com_cb_search&task=advanced&Itemid=$Itemid");
  4554.  
  4555. + $cb_sa_adv_url = sefRelToAbs( "index.php?option=com_cb_search&amp;task=advanced&amp;Itemid=$Itemid");
  4556.  
  4557. $cb_sa_adv_url = ampReplace($cb_sa_adv_url);
  4558.  
  4559.  
  4560.  
  4561. $tmpl->addVar('allow', 'allow_url', $cb_sa_adv_url );
  4562.  
  4563. @@ -339,21 +350,15 @@
  4564.  
  4565.  
  4566. $allusergids=array();
  4567.  
  4568. $usergids=explode(",",$row->usergroupids);
  4569.  
  4570. -$usergids = array_unique($usergids);
  4571.  
  4572. -$cbas_usergids=explode(",",$cbsa_usergid);
  4573.  
  4574. foreach($usergids AS $usergid) {
  4575.  
  4576. - //$allusergids[]=$usergid;
  4577.  
  4578. - foreach($cbas_usergids AS $cbas_usergid){
  4579.  
  4580. - if($usergid=$cbas_usergid){
  4581.  
  4582. - //if ($usergid==29 || $usergid==30) {
  4583.  
  4584. - $groupchildren = array();
  4585.  
  4586. - $groupchildren = $usergid;
  4587.  
  4588. - //$groupchildren = $acl->get_group_children( $usergid, 'ARO','RECURSE' );
  4589.  
  4590. - $allusergids = array_merge($allusergids,$groupchildren);
  4591.  
  4592. - }
  4593.  
  4594. + $allusergids[]=$usergid;
  4595.  
  4596. + if ($usergid==29 || $usergid==30) {
  4597.  
  4598. + $groupchildren = array();
  4599.  
  4600. + $groupchildren = $acl->get_group_children( $usergid, 'ARO','RECURSE' );
  4601.  
  4602. + $allusergids = array_merge($allusergids,$groupchildren);
  4603.  
  4604. }
  4605.  
  4606. }
  4607.  
  4608. -$usergids=implode(",",array_unique($allusergids));
  4609.  
  4610. +$usergids=implode(",",$allusergids);
  4611.  
  4612.  
  4613.  
  4614. // Total
  4615.  
  4616. $database->setQuery("SELECT count(u.id) FROM #__users u, #__comprofiler ue WHERE u.id=ue.id AND u.block !=1 AND ue.approved=1 AND ue.banned=0 AND ue.confirmed=1 AND u.gid IN (".$usergids.")");
  4617.  
  4618. @@ -385,11 +390,11 @@
  4619. $query .= $where;
  4620.  
  4621. $query .= " ".$filterby;
  4622.  
  4623. $query .= " ".$orderby;
  4624.  
  4625. -$query .= " LIMIT $limitstart, $limit";
  4626.  
  4627. +if ($limit) $query .= " LIMIT $limitstart, $limit";
  4628.  
  4629.  
  4630.  
  4631. //echo $query;
  4632.  
  4633.  
  4634.  
  4635. -$cb_sa_base_url = sefRelToAbs("index.php?option=com_cb_search&task=advancedsearch&listid=".$listid.$option_itemid);
  4636.  
  4637. +$cb_sa_base_url = sefRelToAbs("index.php?option=com_cb_search&amp;task=advancedsearch&amp;listid=".$listid.$option_itemid);
  4638.  
  4639. $cb_sa_base_url = ampReplace($cb_sa_base_url);
  4640.  
  4641.  
  4642.  
  4643. $database->setQuery($query);
  4644.  
  4645. @@ -433,38 +438,35 @@
  4646. <td valign="top" class="contentdescription">
  4647.  
  4648. <?php echo _CB_AS_RESULTS_FOUND . ": <b>" . $results_found . "</b> "; ?>
  4649.  
  4650. </td>
  4651.  
  4652. - <?php if ($cbsa_userlist==1){ ?>
  4653.  
  4654. - <form name="adminForm" method="post" action="<?php echo ampReplace(sefRelToAbs($ue_base_url)."&search=".$where);?>" >
  4655.  
  4656. + <form name="adminForm" method="post" action="<?php echo ampReplace(sefRelToAbs($ue_base_url));?>" >
  4657.  
  4658. <td valign = "right"><?php echo $lists['plists']; ?>
  4659.  
  4660. </td>
  4661.  
  4662. </form>
  4663.  
  4664. - <?php } ?>
  4665.  
  4666. - </tr>
  4667.  
  4668. + </tr>
  4669.  
  4670. <?php } else { ?>
  4671.  
  4672. - <tr>
  4673.  
  4674. - <?php if ($cbsa_userlist==1){ ?>
  4675.  
  4676. - <form name="adminForm" method="post" action="<?php echo ampReplace(sefRelToAbs($ue_base_url."&search=".$where));?>" >
  4677.  
  4678. + <tr>
  4679.  
  4680. + <form name="adminForm" method="post" action="<?php echo ampReplace(sefRelToAbs($ue_base_url));?>" >
  4681.  
  4682. <td style="width:100%;text-align:right;"><?php echo $lists['plists']; ?>
  4683.  
  4684. </td>
  4685.  
  4686. </form>
  4687.  
  4688. - <?php } ?>
  4689.  
  4690. - </tr>
  4691.  
  4692. + </tr>
  4693.  
  4694. <?php } ?>
  4695.  
  4696. <tr>
  4697.  
  4698. <td colspan="2">
  4699.  
  4700. - <a href="<?php echo ampReplace(sefRelToAbs("index.php?option=com_cb_search&task=simple&Itemid=$Itemid")); ?>"><?php echo _CB_AS_TITLE; ?></a>
  4701.  
  4702. - </td>
  4703.  
  4704. + <a href="<?php echo ampReplace(sefRelToAbs("index.php?option=com_cb_search&amp;task=simple&amp;Itemid=$Itemid")); ?>"><?php echo _CB_AS_TITLE; ?></a>
  4705.  
  4706. + </td>
  4707.  
  4708. </tr>
  4709.  
  4710. <tr>
  4711.  
  4712. <td colspan="2">
  4713.  
  4714. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  4715.  
  4716. <tr>
  4717.  
  4718. <td><a href="<?php echo ampReplace(sefRelToAbs($ue_base_url)); ?>" onclick="javascript:adminForm.search.value=''"><?php echo _UE_LIST_ALL; ?></a></td>
  4719.  
  4720. +
  4721.  
  4722. <td align="right"></td>
  4723.  
  4724. </tr>
  4725.  
  4726. </table>
  4727.  
  4728. - <?php
  4729.  
  4730. - if ($cbsa_page_nav == 0 || $cbsa_page_nav == 2){
  4731.  
  4732. + <?php
  4733.  
  4734. + if ($cbsa_page_nav == 0 || $cbsa_page_nav == 2){
  4735.  
  4736. if ($results_found > $limit){ ?>
  4737.  
  4738. <div style="width:100%;text-align:center;"><?php echo cb_as::writePagesLinks($limitstart, $limit, $total, $cb_sa_base_url,$where); ?></div>
  4739.  
  4740. <hr noshade="noshade" size="1" />
  4741.  
  4742. @@ -491,9 +493,9 @@
  4743. } else {
  4744.  
  4745. $class = "sectiontableentry2";
  4746.  
  4747. }
  4748.  
  4749. - //print $user->name;
  4750.  
  4751. + $ueConfig['allow_profilelink']=1; // fix by Tim Black 2-9-2009. This is a hack; the root of the problem is that for some reason $ueConfig isn't in scope. I think the scope issue can't easily be corrected by adding $GLOBALS['ueConfig'] = $ueConfig; to ue_config.php, because that file is re-generated everytime we change CB config settings.
  4752. if($ueConfig['allow_profilelink']==1) {
  4753.  
  4754. - $onclick = "onclick=\"javascript:window.location='".ampReplace(sefRelToAbs("index.php?option=com_comprofiler&task=userProfile&user=".$user->id))."'\"";
  4755.  
  4756. + $onclick = "onclick=\"javascript:window.location='".ampReplace(sefRelToAbs("index.php?option=com_comprofiler&amp;task=userProfile&amp;user=".$user->id))."'\"";
  4757.  
  4758. $style="style=\"cursor:hand;cursor:pointer;\"";
  4759.  
  4760. }
  4761.  
  4762. print "\t<tr class=\"$class\" ".$style." ".$onclick.">\n";
  4763.  
  4764.  
  4765. === modified file 'components/com_cb_search/cb_search.php'
  4766. --- components/com_cb_search/cb_search.php 2008-07-04 21:14:01 +0000
  4767. +++ components/com_cb_search/cb_search.php 2009-04-09 03:24:52 +0000
  4768. @@ -62,7 +62,7 @@
  4769. break;
  4770.  
  4771.  
  4772.  
  4773. case "simplesearch2":
  4774.  
  4775. - simplesearch2($option, $uid, $search_sql);
  4776.  
  4777. + simplesearch2($option, $uid, $search_sql);
  4778. break;
  4779.  
  4780.  
  4781.  
  4782. case "usersList":
  4783.  
  4784. @@ -145,32 +145,7 @@
  4785. $searchword = mosGetParam( $_REQUEST, 'searchword', '' );
  4786.  
  4787. $searchword = $database->getEscaped( trim( $searchword ) );
  4788.  
  4789. $phrase = mosGetParam( $_REQUEST, 'searchphrase', '' );
  4790.  
  4791. - $pattern[0] = "+";
  4792.  
  4793. - $pattern[1] = "%28";
  4794.  
  4795. - $pattern[2] = "%27";
  4796.  
  4797. - $pattern[3] = "%25";
  4798.  
  4799. - $pattern[4] = "%29";
  4800.  
  4801. - $pattern[5] = "%F6";
  4802.  
  4803. - $pattern[6] = "%FC";
  4804.  
  4805. - $pattern[7] = "%E4";
  4806.  
  4807. - $pattern[8] = "%D6";
  4808.  
  4809. - $pattern[9] = "%DC";
  4810.  
  4811. - $pattern[10] = "%C4";
  4812.  
  4813. - $pattern[11] = "%20";
  4814.  
  4815. - $replacement[0] = " ";
  4816.  
  4817. - $replacement[1] = "(";
  4818.  
  4819. - $replacement[2] = "'";
  4820.  
  4821. - $replacement[3] = "%";
  4822.  
  4823. - $replacement[4] = ")";
  4824.  
  4825. - $replacement[5] = "�";
  4826.  
  4827. - $replacement[6] = "�";
  4828.  
  4829. - $replacement[7] = "�";
  4830.  
  4831. - $replacement[8] = "�";
  4832.  
  4833. - $replacement[9] = "�";
  4834.  
  4835. - $replacement[10] = "�";
  4836.  
  4837. - $replacement[11] = " ";
  4838.  
  4839. - $searchword = str_replace($pattern, $replacement, $searchword );
  4840.  
  4841. -
  4842.  
  4843. +
  4844.  
  4845. $check_count = strlen($searchword);
  4846.  
  4847.  
  4848.  
  4849. $where = " AND (";
  4850.  
  4851. @@ -179,23 +154,16 @@
  4852. case 'exact':
  4853.  
  4854. $wheres2 = array();
  4855.  
  4856. //We get the custom fields
  4857.  
  4858. - $query_custom = "SELECT f.* FROM #__comprofiler_fields AS f INNER JOIN #__cb_search_fields AS s ON f.fieldid = s.fieldid"
  4859.  
  4860. - . "\n WHERE (((f.published)=1) AND ((f.profile)=1) AND ((f.name)<>'NA') AND ((s.search)=1))"
  4861.  
  4862. - . "\n ORDER BY f.ordering";
  4863.  
  4864. + $query_custom = "SELECT f.* FROM #__comprofiler_fields f"
  4865.  
  4866. + . "\n WHERE f.published=1 AND f.profile = 1 AND f.name<>'NA'"
  4867.  
  4868. + . "\n ORDER BY f.ordering";
  4869.  
  4870.  
  4871.  
  4872. $database->setQuery( $query_custom );
  4873.  
  4874. $customfield = $database->loadObjectList();
  4875.  
  4876. for ($s=0, $n=count( $customfield ); $s < $n; $s++) {
  4877.  
  4878. $customfields = &$customfield[$s];
  4879.  
  4880. - if (cb_as::getfieldtype($customfields->name)==="multicheckbox" || cb_as::getfieldtype($customfields->name)==="multiselect"){
  4881.  
  4882. - $jocker = "";
  4883.  
  4884. - $jockerend = "%";
  4885.  
  4886. - } else {
  4887.  
  4888. - $jocker = "%";
  4889.  
  4890. - $jockerend = "%";
  4891.  
  4892. - }
  4893.  
  4894. - $wheres2[] = " LOWER(".cb_as::gettable($customfields->name).$customfields->name.") LIKE '".$jocker.$searchword.$jockerend."'";
  4895.  
  4896. -
  4897.  
  4898. + $wheres2[] = " LOWER(".cb_as::gettable($customfields->name).$customfields->name.") LIKE '%$searchword%'";
  4899.  
  4900. +
  4901.  
  4902. }
  4903.  
  4904.  
  4905.  
  4906. $where .= '(' . implode( ') OR (', $wheres2 ) . '))';
  4907.  
  4908. @@ -209,22 +177,14 @@
  4909. foreach ($words as $word) {
  4910.  
  4911. $wheres2 = array();
  4912.  
  4913. //We get the custom fields
  4914.  
  4915. - $query_custom = "SELECT f.* FROM #__comprofiler_fields AS f INNER JOIN #__cb_search_fields AS s ON f.fieldid = s.fieldid"
  4916.  
  4917. - . "\n WHERE (((f.published)=1) AND ((f.profile)=1) AND ((f.name)<>'NA') AND ((s.search)=1))"
  4918.  
  4919. - . "\n ORDER BY f.ordering";
  4920.  
  4921. -
  4922.  
  4923. + $query_custom = "SELECT f.* FROM #__comprofiler_fields f"
  4924.  
  4925. + . "\n WHERE f.published=1 AND f.profile = 1 AND f.name<>'NA'"
  4926.  
  4927. + . "\n ORDER BY f.ordering";
  4928.  
  4929. $database->setQuery( $query_custom );
  4930.  
  4931. $customfield = $database->loadObjectList();
  4932.  
  4933. for ($s=0, $n=count( $customfield ); $s < $n; $s++) {
  4934.  
  4935. $customfields = &$customfield[$s];
  4936.  
  4937. - if (cb_as::getfieldtype($customfields->name)==="multicheckbox" || cb_as::getfieldtype($customfields->name)==="multiselect"){
  4938.  
  4939. - $jocker = "";
  4940.  
  4941. - $jockerend = "%";
  4942.  
  4943. - } else {
  4944.  
  4945. - $jocker = "%";
  4946.  
  4947. - $jockerend = "%";
  4948.  
  4949. - }
  4950.  
  4951. - $wheres2[] = "LOWER(".cb_as::gettable($customfields->name).$customfields->name.") LIKE '".$jocker.$word.$jockerend."'";
  4952.  
  4953. + $wheres2[] = "LOWER(".cb_as::gettable($customfields->name).$customfields->name.") LIKE '%$word%'";
  4954.  
  4955.  
  4956.  
  4957. }
  4958.  
  4959.  
  4960.  
  4961. @@ -309,7 +269,7 @@
  4962. $lfields .= "</td>\n";
  4963.  
  4964. if($row[0]->col2enabled) {
  4965.  
  4966. $col=$row[0]->col2fields;
  4967.  
  4968. - $col=explode('|*|',$col);
  4969.  
  4970. + $col=explode('|*|',$col);
  4971.  
  4972. for ($i=0, $n=count( $col ); $i < $n; $i++) {
  4973.  
  4974. if($i==0) $lfields .= "<td valign='top'>\n";
  4975.  
  4976. else $lfields .= "<br/>\n";
  4977.  
  4978. @@ -504,15 +464,15 @@
  4979.  
  4980.  
  4981.  
  4982.  
  4983. function simplesearch2($option, $uid, $search_sql){
  4984.  
  4985. - global $database,$my,$ueConfig,$_POST,$_REQUEST, $mosConfig_absolute_path;
  4986.  
  4987. + global $database,$my,$ueConfig,$_POST,$_REQUEST, $mosConfig_absolute_path;
  4988.  
  4989.  
  4990. - //We load the CB Saech Config variables
  4991.  
  4992. + //We load the CB Search Config variables
  4993.  
  4994. require_once ($mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php");
  4995.  
  4996.  
  4997.  
  4998. $where = " AND (";
  4999.  
  5000.  
  5001.  
  5002. //Generate the advanced search criteria
  5003.  
  5004. -
  5005.  
  5006. +
  5007. if(strlen($search_sql)>0) {
  5008.  
  5009. $query2 = " ".$search_sql;
  5010.  
  5011. $pattern[0] = "\'%";
  5012.  
  5013. @@ -536,7 +496,22 @@
  5014. $logical_operator = "";
  5015.  
  5016. $comparision_operator = "";
  5017.  
  5018. $jocker = "";
  5019.  
  5020. -
  5021.  
  5022. +
  5023.  
  5024. +//Age Seach -- BEGIN
  5025.  
  5026. +if($sbsa_enable_age_search) {
  5027.  
  5028. + $custom_where = array('startdate' => '','enddate' => '');
  5029.  
  5030. + $now = time();
  5031.  
  5032. +
  5033.  
  5034. + //modify the reversed startage and endage
  5035.  
  5036. + if($_POST['startage'] > $_POST['endage']) {
  5037.  
  5038. + $temp = $_POST['startage'];
  5039.  
  5040. + $_POST['startage'] = $_POST['endage'];
  5041.  
  5042. + $_POST['endage'] = $temp;
  5043.  
  5044. + }
  5045.  
  5046. +}
  5047.  
  5048. +//Age Search -- END
  5049.  
  5050. +
  5051.  
  5052. +
  5053.  
  5054. $form_fields = array_keys($_POST);
  5055.  
  5056.  
  5057.  
  5058. //echo sizeof($form_fields)."<br>";
  5059.  
  5060. @@ -547,10 +522,38 @@
  5061.  
  5062.  
  5063. $thisField = $form_fields[$i];
  5064.  
  5065. $thisValue = mosGetParam( $_REQUEST, $thisField, '' );
  5066.  
  5067. + //Age Search -- BEGIN
  5068.  
  5069. + if($thisField == 'startage' && $cbsa_enable_age_search) {
  5070.  
  5071. + $start_time = strtotime("-$thisValue year");
  5072.  
  5073. + //$start_date = date('Y-m-d',$now - $start_time);
  5074.  
  5075. + $start_date = date('Y-m-d',$start_time);
  5076.  
  5077. + $custom_where['enddate'] = $start_date;
  5078.  
  5079. + $fieldcount = 0;
  5080.  
  5081. + }
  5082.  
  5083. + elseif ($thisField == 'endage' && $cbsa_enable_age_search) {
  5084.  
  5085. + $addValue = $thisValue + 1;
  5086.  
  5087. + $end_time = strtotime("-$addValue year");
  5088.  
  5089. + //$end_date = date('Y-m-d',$now - $end_time);
  5090.  
  5091. + $end_date = date('Y-m-d',$end_time);
  5092.  
  5093. + $custom_where['startdate'] = $end_date;
  5094.  
  5095. + $fieldcount = 0;
  5096.  
  5097. + }
  5098.  
  5099. + //Age Search -- END
  5100.  
  5101. + //Photo only --BEGIN
  5102.  
  5103. + elseif ($thisField == 'photoonly' && $cbsa_enable_photo_only_search) {
  5104.  
  5105. + if($thisValue) {
  5106.  
  5107. + $custom_where['avatar'] = true;
  5108.  
  5109. + $fieldcount = 0;
  5110.  
  5111. + }
  5112.  
  5113. + }
  5114.  
  5115. + //Photo only -- END
  5116.  
  5117. + else {
  5118.  
  5119. +
  5120.  
  5121. +
  5122.  
  5123. //echo "thisField:".$thisField." - thisValue:".$thisValue."<br>";
  5124.  
  5125.  
  5126.  
  5127. //Define Logical Operator
  5128.  
  5129. -
  5130.  
  5131. +
  5132.  
  5133. $pos = strpos($thisField, "searchoperator");
  5134.  
  5135.  
  5136.  
  5137. if ($pos === 0 ){
  5138.  
  5139. @@ -570,13 +573,9 @@
  5140. }
  5141.  
  5142.  
  5143.  
  5144. if ($fieldcount ==2){
  5145.  
  5146. - //We first check if there is a value to search logical operator
  5147.  
  5148. + //We first check the if there is a value to search logical operator
  5149.  
  5150. if (is_array($thisValue)){
  5151.  
  5152. for ($j = 0; $j < sizeof($thisValue); $j++) {
  5153.  
  5154. - if (cb_as::getfieldtype($thisField)==="multicheckbox" || cb_as::getfieldtype($thisField)==="multiselect"){
  5155.  
  5156. - $jocker = "";
  5157.  
  5158. - }
  5159.  
  5160. -
  5161.  
  5162. if ( strlen($thisValue[$j])>0 && $thisValue[$j] != "no_check" ){
  5163.  
  5164. $fieldvalue = "'".$jocker.$thisValue[$j].$jocker."'";
  5165.  
  5166. $pattern[0] = "\'%";
  5167.  
  5168. @@ -597,13 +596,10 @@
  5169. }
  5170.  
  5171. } else {
  5172.  
  5173. if (strlen($thisValue)>0 ){
  5174.  
  5175. - if (cb_as::getfieldtype($thisField)==="multicheckbox" || cb_as::getfieldtype($thisField)==="multiselect"){
  5176.  
  5177. - $jocker = "";
  5178.  
  5179. - }
  5180.  
  5181. - $fieldvalue = "'".$jocker.$thisValue.$jocker."'";
  5182.  
  5183. - $pattern[0] = "\'%";
  5184.  
  5185. + $fieldvalue = "'".$jocker.$thisValue.$jocker."'";
  5186.  
  5187. + $pattern[0] = "\'%";
  5188.  
  5189. $pattern[1] = "%\'";
  5190.  
  5191. - $pattern[2] = "\'";
  5192.  
  5193. + $pattern[2] = "\'";
  5194.  
  5195. $replacement[0] = "'%";
  5196.  
  5197. $replacement[1] = "%'";
  5198.  
  5199. $replacement[2] = "'";
  5200.  
  5201. @@ -618,13 +614,29 @@
  5202.  
  5203.  
  5204. }
  5205.  
  5206. }
  5207.  
  5208. - $fieldcount=0;
  5209.  
  5210. - }
  5211.  
  5212. + $fieldcount=0;
  5213.  
  5214. + }
  5215.  
  5216. + //Age Search -- BEGIN
  5217.  
  5218. + }
  5219.  
  5220. + //Age Search -- END
  5221.  
  5222. //echo $i.":".$fieldcount.". FieldName: ".$thisField." - FieldValue: ".$fieldvalue."<br>";
  5223.  
  5224. }
  5225.  
  5226. }
  5227.  
  5228.  
  5229.  
  5230. //echo $query2;
  5231.  
  5232. +
  5233.  
  5234. + //Age Search -- BEGIN
  5235.  
  5236. + if($cbsa_enable_age_search) {
  5237.  
  5238. + //now add custom date to query2
  5239.  
  5240. + $query_extra = " AND $cbsa_birthday_fieldname >= '".$custom_where['startdate']."' AND $cbsa_birthday_fieldname < '".$custom_where['enddate']."' ";
  5241.  
  5242. + }
  5243.  
  5244. + //Age Search -- END
  5245.  
  5246. +
  5247.  
  5248. + //Photo Search -- BEGIN
  5249.  
  5250. + if($cbsa_enable_photo_only_search && $custom_where['avatar']) {
  5251.  
  5252. + $query_extra .= " AND avatar IS NOT null AND avatar NOT LIKE '%nophoto.jpg'";
  5253.  
  5254. + }
  5255.  
  5256. +
  5257.  
  5258.  
  5259.  
  5260. //we check to see if $query2 is empty
  5261.  
  5262.  
  5263.  
  5264. @@ -642,14 +654,19 @@
  5265. $add_beg = $where;
  5266.  
  5267. $add_end = " )";
  5268.  
  5269. }
  5270.  
  5271. -
  5272.  
  5273. +
  5274.  
  5275. $query2 = $add_beg.$query2.$add_end;
  5276.  
  5277. + //Age Search & Avatar Only -- BEGIN
  5278.  
  5279. + if($cbsa_enable_age_search || $cbsa_enable_photo_only_search) {
  5280.  
  5281. + $query2 .= $query_extra;
  5282.  
  5283. + }
  5284.  
  5285. + //Age Search -- END
  5286.  
  5287.  
  5288.  
  5289. $CB_Access = "";
  5290.  
  5291. if (!$cbsa_deactivate_allowaccess){
  5292.  
  5293. $CB_Access = " AND useraccessgroupid IN (".implode(',',cb_as::getChildGIDS(cb_as::userGID($uid)))." )";
  5294.  
  5295. }
  5296.  
  5297. -
  5298.  
  5299. +
  5300. $database->setQuery("SELECT listid, title FROM #__comprofiler_lists WHERE published=1 ".$CB_Access." ORDER BY ordering");
  5301.  
  5302. $plists = $database->loadObjectList();
  5303.  
  5304. //print $database->getQuery();
  5305.  
  5306. @@ -765,10 +782,14 @@
  5307. }
  5308.  
  5309. $lfields .= "</td>\n";
  5310.  
  5311. }
  5312.  
  5313. - $row=$row[0];
  5314.  
  5315. -
  5316.  
  5317. - HTML_advancedsearch::usersList($row,$lfields,$lists,$listid, $search_sql, $query2, 0 );
  5318.  
  5319. -
  5320.  
  5321. + $row=$row[0];
  5322. + // Fix by Tim Black 4-8-2009
  5323. + // This is only a quick hack because I couldn't find the right location above to make a more correct change.
  5324. + if ($_POST['cb_gender']=="Male"){
  5325. + $query2 = str_replace("cb_gender LIKE '%Male%'","cb_gender='Male'",$query2);
  5326. + }
  5327. + // end fix
  5328.  
  5329. + HTML_advancedsearch::usersList($row,$lfields,$lists,$listid, $search_sql, $query2, 0 );
  5330. }
  5331.  
  5332.  
  5333.  
  5334. function advanced($option, $regErrorMSG=null){
  5335.  
  5336. @@ -833,7 +854,7 @@
  5337. function advancedsearch($option,$uid, $search_sql){
  5338.  
  5339. global $database,$my,$ueConfig,$_POST,$_REQUEST, $mosConfig_absolute_path;
  5340.  
  5341.  
  5342.  
  5343. - //We load the CB Saech Config variables
  5344.  
  5345. + //We load the CB Search Config variables
  5346.  
  5347. require_once ($mosConfig_absolute_path."/administrator/components/com_cb_search/cb_search.config.php");
  5348.  
  5349.  
  5350.  
  5351. //Generate the advanced search criteria
  5352.  
  5353.  
  5354. === removed file 'components/com_cb_search/images/progressbar.gif'
  5355. Binary files components/com_cb_search/images/progressbar.gif 2008-07-04 21:14:01 +0000 and components/com_cb_search/images/progressbar.gif 1970-01-01 00:00:00 +0000 differ
  5356. === removed file 'components/com_cb_search/images/spinner.gif'
  5357. Binary files components/com_cb_search/images/spinner.gif 2008-07-04 21:14:01 +0000 and components/com_cb_search/images/spinner.gif 1970-01-01 00:00:00 +0000 differ
  5358. === removed file 'components/com_cb_search/js/AjaxRequest.js'
  5359. --- components/com_cb_search/js/AjaxRequest.js 2008-07-04 21:14:01 +0000
  5360. +++ components/com_cb_search/js/AjaxRequest.js 1970-01-01 00:00:00 +0000
  5361. @@ -1,559 +0,0 @@
  5362. -// ===================================================================
  5363. -// Author: Matt Kruse <matt@ajaxtoolbox.com>
  5364. -// WWW: http://www.AjaxToolbox.com/
  5365. -//
  5366. -// NOTICE: You may use this code for any purpose, commercial or
  5367. -// private, without any further permission from the author. You may
  5368. -// remove this notice from your final code if you wish, however it is
  5369. -// appreciated by the author if at least my web site address is kept.
  5370. -//
  5371. -// You may *NOT* re-distribute this code in any way except through its
  5372. -// use. That means, you can include it in your product, or your web
  5373. -// site, or any other form where the code is actually being used. You
  5374. -// may not put the plain javascript up on your site for download or
  5375. -// include it in your javascript libraries for download.
  5376. -// If you wish to share this code with others, please just point them
  5377. -// to the URL instead.
  5378. -// Please DO NOT link directly to my .js files from your site. Copy
  5379. -// the files to your server and use them there. Thank you.
  5380. -// ===================================================================
  5381. -
  5382. -/**
  5383. - * The AjaxRequest class is a wrapper for the XMLHttpRequest objects which
  5384. - * are available in most modern browsers. It simplifies the interfaces for
  5385. - * making Ajax requests, adds commonly-used convenience methods, and makes
  5386. - * the process of handling state changes more intuitive.
  5387. - * An object may be instantiated and used, or the Class methods may be used
  5388. - * which internally create an AjaxRequest object.
  5389. - */
  5390. -function AjaxRequest() {
  5391. - var req = new Object();
  5392. -
  5393. - // -------------------
  5394. - // Instance properties
  5395. - // -------------------
  5396. -
  5397. - /**
  5398. - * Timeout period (in ms) until an async request will be aborted, and
  5399. - * the onTimeout function will be called
  5400. - */
  5401. - req.timeout = null;
  5402. -
  5403. - /**
  5404. - * Since some browsers cache GET requests via XMLHttpRequest, an
  5405. - * additional parameter called AjaxRequestUniqueId will be added to
  5406. - * the request URI with a unique numeric value appended so that the requested
  5407. - * URL will not be cached.
  5408. - */
  5409. - req.generateUniqueUrl = true;
  5410. -
  5411. - /**
  5412. - * The url that the request will be made to, which defaults to the current
  5413. - * url of the window
  5414. - */
  5415. - req.url = window.location.href;
  5416. -
  5417. - /**
  5418. - * The method of the request, either GET (default), POST, or HEAD
  5419. - */
  5420. - req.method = "GET";
  5421. -
  5422. - /**
  5423. - * Whether or not the request will be asynchronous. In general, synchronous
  5424. - * requests should not be used so this should rarely be changed from true
  5425. - */
  5426. - req.async = true;
  5427. -
  5428. - /**
  5429. - * The username used to access the URL
  5430. - */
  5431. - req.username = null;
  5432. -
  5433. - /**
  5434. - * The password used to access the URL
  5435. - */
  5436. - req.password = null;
  5437. -
  5438. - /**
  5439. - * The parameters is an object holding name/value pairs which will be
  5440. - * added to the url for a GET request or the request content for a POST request
  5441. - */
  5442. - req.parameters = new Object();
  5443. -
  5444. - /**
  5445. - * The sequential index number of this request, updated internally
  5446. - */
  5447. - req.requestIndex = AjaxRequest.numAjaxRequests++;
  5448. -
  5449. - /**
  5450. - * Indicates whether a response has been received yet from the server
  5451. - */
  5452. - req.responseReceived = false;
  5453. -
  5454. - /**
  5455. - * The name of the group that this request belongs to, for activity
  5456. - * monitoring purposes
  5457. - */
  5458. - req.groupName = null;
  5459. -
  5460. - /**
  5461. - * The query string to be added to the end of a GET request, in proper
  5462. - * URIEncoded format
  5463. - */
  5464. - req.queryString = "";
  5465. -
  5466. - /**
  5467. - * After a response has been received, this will hold the text contents of
  5468. - * the response - even in case of error
  5469. - */
  5470. - req.responseText = null;
  5471. -
  5472. - /**
  5473. - * After a response has been received, this will hold the XML content
  5474. - */
  5475. - req.responseXML = null;
  5476. -
  5477. - /**
  5478. - * After a response has been received, this will hold the status code of
  5479. - * the response as returned by the server.
  5480. - */
  5481. - req.status = null;
  5482. -
  5483. - /**
  5484. - * After a response has been received, this will hold the text description
  5485. - * of the response code
  5486. - */
  5487. - req.statusText = null;
  5488. -
  5489. - /**
  5490. - * An internal flag to indicate whether the request has been aborted
  5491. - */
  5492. - req.aborted = false;
  5493. -
  5494. - /**
  5495. - * The XMLHttpRequest object used internally
  5496. - */
  5497. - req.xmlHttpRequest = null;
  5498. -
  5499. - // --------------
  5500. - // Event handlers
  5501. - // --------------
  5502. -
  5503. - /**
  5504. - * If a timeout period is set, and it is reached before a response is
  5505. - * received, a function reference assigned to onTimeout will be called
  5506. - */
  5507. - req.onTimeout = null;
  5508. -
  5509. - /**
  5510. - * A function reference assigned will be called when readyState=1
  5511. - */
  5512. - req.onLoading = null;
  5513. -
  5514. - /**
  5515. - * A function reference assigned will be called when readyState=2
  5516. - */
  5517. - req.onLoaded = null;
  5518. -
  5519. - /**
  5520. - * A function reference assigned will be called when readyState=3
  5521. - */
  5522. - req.onInteractive = null;
  5523. -
  5524. - /**
  5525. - * A function reference assigned will be called when readyState=4
  5526. - */
  5527. - req.onComplete = null;
  5528. -
  5529. - /**
  5530. - * A function reference assigned will be called after onComplete, if
  5531. - * the statusCode=200
  5532. - */
  5533. - req.onSuccess = null;
  5534. -
  5535. - /**
  5536. - * A function reference assigned will be called after onComplete, if
  5537. - * the statusCode != 200
  5538. - */
  5539. - req.onError = null;
  5540. -
  5541. - /**
  5542. - * If this request has a group name, this function reference will be called
  5543. - * and passed the group name if this is the first request in the group to
  5544. - * become active
  5545. - */
  5546. - req.onGroupBegin = null;
  5547. -
  5548. - /**
  5549. - * If this request has a group name, and this request is the last request
  5550. - * in the group to complete, this function reference will be called
  5551. - */
  5552. - req.onGroupEnd = null;
  5553. -
  5554. - // Get the XMLHttpRequest object itself
  5555. - req.xmlHttpRequest = AjaxRequest.getXmlHttpRequest();
  5556. - if (req.xmlHttpRequest==null) { return null; }
  5557. -
  5558. - // -------------------------------------------------------
  5559. - // Attach the event handlers for the XMLHttpRequest object
  5560. - // -------------------------------------------------------
  5561. - req.xmlHttpRequest.onreadystatechange =
  5562. - function() {
  5563. - if (req==null || req.xmlHttpRequest==null) { return; }
  5564. - if (req.xmlHttpRequest.readyState==1) { req.onLoadingInternal(req); }
  5565. - if (req.xmlHttpRequest.readyState==2) { req.onLoadedInternal(req); }
  5566. - if (req.xmlHttpRequest.readyState==3) { req.onInteractiveInternal(req); }
  5567. - if (req.xmlHttpRequest.readyState==4) { req.onCompleteInternal(req); }
  5568. - };
  5569. -
  5570. - // ---------------------------------------------------------------------------
  5571. - // Internal event handlers that fire, and in turn fire the user event handlers
  5572. - // ---------------------------------------------------------------------------
  5573. - // Flags to keep track if each event has been handled, in case of
  5574. - // multiple calls (some browsers may call the onreadystatechange
  5575. - // multiple times for the same state)
  5576. - req.onLoadingInternalHandled = false;
  5577. - req.onLoadedInternalHandled = false;
  5578. - req.onInteractiveInternalHandled = false;
  5579. - req.onCompleteInternalHandled = false;
  5580. - req.onLoadingInternal =
  5581. - function() {
  5582. - if (req.onLoadingInternalHandled) { return; }
  5583. - AjaxRequest.numActiveAjaxRequests++;
  5584. - if (AjaxRequest.numActiveAjaxRequests==1 && typeof(window['AjaxRequestBegin'])=="function") {
  5585. - AjaxRequestBegin();
  5586. - }
  5587. - if (req.groupName!=null) {
  5588. - if (typeof(AjaxRequest.numActiveAjaxGroupRequests[req.groupName])=="undefined") {
  5589. - AjaxRequest.numActiveAjaxGroupRequests[req.groupName] = 0;
  5590. - }
  5591. - AjaxRequest.numActiveAjaxGroupRequests[req.groupName]++;
  5592. - if (AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==1 && typeof(req.onGroupBegin)=="function") {
  5593. - req.onGroupBegin(req.groupName);
  5594. - }
  5595. - }
  5596. - if (typeof(req.onLoading)=="function") {
  5597. - req.onLoading(req);
  5598. - }
  5599. - req.onLoadingInternalHandled = true;
  5600. - };
  5601. - req.onLoadedInternal =
  5602. - function() {
  5603. - if (req.onLoadedInternalHandled) { return; }
  5604. - if (typeof(req.onLoaded)=="function") {
  5605. - req.onLoaded(req);
  5606. - }
  5607. - req.onLoadedInternalHandled = true;
  5608. - };
  5609. - req.onInteractiveInternal =
  5610. - function() {
  5611. - if (req.onInteractiveInternalHandled) { return; }
  5612. - if (typeof(req.onInteractive)=="function") {
  5613. - req.onInteractive(req);
  5614. - }
  5615. - req.onInteractiveInternalHandled = true;
  5616. - };
  5617. - req.onCompleteInternal =
  5618. - function() {
  5619. - if (req.onCompleteInternalHandled || req.aborted) { return; }
  5620. - req.onCompleteInternalHandled = true;
  5621. - AjaxRequest.numActiveAjaxRequests--;
  5622. - if (AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function") {
  5623. - AjaxRequestEnd(req.groupName);
  5624. - }
  5625. - if (req.groupName!=null) {
  5626. - AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
  5627. - if (AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function") {
  5628. - req.onGroupEnd(req.groupName);
  5629. - }
  5630. - }
  5631. - req.responseReceived = true;
  5632. - req.status = req.xmlHttpRequest.status;
  5633. - req.statusText = req.xmlHttpRequest.statusText;
  5634. - req.responseText = req.xmlHttpRequest.responseText;
  5635. - req.responseXML = req.xmlHttpRequest.responseXML;
  5636. - if (typeof(req.onComplete)=="function") {
  5637. - req.onComplete(req);
  5638. - }
  5639. - if (req.xmlHttpRequest.status==200 && typeof(req.onSuccess)=="function") {
  5640. - req.onSuccess(req);
  5641. - }
  5642. - else if (typeof(req.onError)=="function") {
  5643. - req.onError(req);
  5644. - }
  5645. -
  5646. - // Clean up so IE doesn't leak memory
  5647. - delete req.xmlHttpRequest['onreadystatechange'];
  5648. - req.xmlHttpRequest = null;
  5649. - };
  5650. - req.onTimeoutInternal =
  5651. - function() {
  5652. - if (req!=null && req.xmlHttpRequest!=null && !req.onCompleteInternalHandled) {
  5653. - req.aborted = true;
  5654. - req.xmlHttpRequest.abort();
  5655. - AjaxRequest.numActiveAjaxRequests--;
  5656. - if (AjaxRequest.numActiveAjaxRequests==0 && typeof(window['AjaxRequestEnd'])=="function") {
  5657. - AjaxRequestEnd(req.groupName);
  5658. - }
  5659. - if (req.groupName!=null) {
  5660. - AjaxRequest.numActiveAjaxGroupRequests[req.groupName]--;
  5661. - if (AjaxRequest.numActiveAjaxGroupRequests[req.groupName]==0 && typeof(req.onGroupEnd)=="function") {
  5662. - req.onGroupEnd(req.groupName);
  5663. - }
  5664. - }
  5665. - if (typeof(req.onTimeout)=="function") {
  5666. - req.onTimeout(req);
  5667. - }
  5668. - // Opera won't fire onreadystatechange after abort, but other browsers do.
  5669. - // So we can't rely on the onreadystate function getting called. Clean up here!
  5670. - delete req.xmlHttpRequest['onreadystatechange'];
  5671. - req.xmlHttpRequest = null;
  5672. - }
  5673. - };
  5674. -
  5675. - // ----------------
  5676. - // Instance methods
  5677. - // ----------------
  5678. - /**
  5679. - * The process method is called to actually make the request. It builds the
  5680. - * querystring for GET requests (the content for POST requests), sets the
  5681. - * appropriate headers if necessary, and calls the
  5682. - * XMLHttpRequest.send() method
  5683. - */
  5684. - req.process =
  5685. - function() {
  5686. - if (req.xmlHttpRequest!=null) {
  5687. - // Some logic to get the real request URL
  5688. - if (req.generateUniqueUrl && req.method=="GET") {
  5689. - req.parameters["AjaxRequestUniqueId"] = new Date().getTime() + "" + req.requestIndex;
  5690. - }
  5691. - var content = null; // For POST requests, to hold query string
  5692. - for (var i in req.parameters) {
  5693. - if (req.queryString.length>0) { req.queryString += "&"; }
  5694. - req.queryString += encodeURIComponent(i) + "=" + encodeURIComponent(req.parameters[i]);
  5695. - }
  5696. - if (req.method=="GET") {
  5697. - if (req.queryString.length>0) {
  5698. - req.url += ((req.url.indexOf("?")>-1)?"&":"?") + req.queryString;
  5699. - }
  5700. - }
  5701. - req.xmlHttpRequest.open(req.method,req.url,req.async,req.username,req.password);
  5702. - if (req.method=="POST") {
  5703. - if (typeof(req.xmlHttpRequest.setRequestHeader)!="undefined") {
  5704. - req.xmlHttpRequest.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  5705. - }
  5706. - content = req.queryString;
  5707. - }
  5708. - if (req.timeout>0) {
  5709. - setTimeout(req.onTimeoutInternal,req.timeout);
  5710. - }
  5711. - req.xmlHttpRequest.send(content);
  5712. - }
  5713. - };
  5714. -
  5715. - /**
  5716. - * An internal function to handle an Object argument, which may contain
  5717. - * either AjaxRequest field values or parameter name/values
  5718. - */
  5719. - req.handleArguments =
  5720. - function(args) {
  5721. - for (var i in args) {
  5722. - // If the AjaxRequest object doesn't have a property which was passed, treat it as a url parameter
  5723. - if (typeof(req[i])=="undefined") {
  5724. - req.parameters[i] = args[i];
  5725. - }
  5726. - else {
  5727. - req[i] = args[i];
  5728. - }
  5729. - }
  5730. - };
  5731. -
  5732. - /**
  5733. - * Returns the results of XMLHttpRequest.getAllResponseHeaders().
  5734. - * Only available after a response has been returned
  5735. - */
  5736. - req.getAllResponseHeaders =
  5737. - function() {
  5738. - if (req.xmlHttpRequest!=null) {
  5739. - if (req.responseReceived) {
  5740. - return req.xmlHttpRequest.getAllResponseHeaders();
  5741. - }
  5742. - alert("Cannot getAllResponseHeaders because a response has not yet been received");
  5743. - }
  5744. - };
  5745. -
  5746. - /**
  5747. - * Returns the the value of a response header as returned by
  5748. - * XMLHttpRequest,getResponseHeader().
  5749. - * Only available after a response has been returned
  5750. - */
  5751. - req.getResponseHeader =
  5752. - function(headerName) {
  5753. - if (req.xmlHttpRequest!=null) {
  5754. - if (req.responseReceived) {
  5755. - return req.xmlHttpRequest.getResponseHeader(headerName);
  5756. - }
  5757. - alert("Cannot getResponseHeader because a response has not yet been received");
  5758. - }
  5759. - };
  5760. -
  5761. - return req;
  5762. -}
  5763. -
  5764. -// ---------------------------------------
  5765. -// Static methods of the AjaxRequest class
  5766. -// ---------------------------------------
  5767. -
  5768. -/**
  5769. - * Returns an XMLHttpRequest object, either as a core object or an ActiveX
  5770. - * implementation. If an object cannot be instantiated, it will return null;
  5771. - */
  5772. -AjaxRequest.getXmlHttpRequest = function() {
  5773. - if (window.XMLHttpRequest) {
  5774. - return new XMLHttpRequest();
  5775. - }
  5776. - else if (window.ActiveXObject) {
  5777. - // Based on http://jibbering.com/2002/4/httprequest.html
  5778. - /*@cc_on @*/
  5779. - /*@if (@_jscript_version >= 5)
  5780. - try {
  5781. - return new ActiveXObject("Msxml2.XMLHTTP");
  5782. - } catch (e) {
  5783. - try {
  5784. - return new ActiveXObject("Microsoft.XMLHTTP");
  5785. - } catch (E) {
  5786. - return null;
  5787. - }
  5788. - }
  5789. - @end @*/
  5790. - }
  5791. - else {
  5792. - return null;
  5793. - }
  5794. -};
  5795. -
  5796. -/**
  5797. - * See if any request is active in the background
  5798. - */
  5799. -AjaxRequest.isActive = function() {
  5800. - return (AjaxRequest.numActiveAjaxRequests>0);
  5801. -};
  5802. -
  5803. -/**
  5804. - * Make a GET request. Pass an object containing parameters and arguments as
  5805. - * the second argument.
  5806. - * These areguments may be either AjaxRequest properties to set on the request
  5807. - * object or name/values to set in the request querystring.
  5808. - */
  5809. -AjaxRequest.get = function(args) {
  5810. - AjaxRequest.doRequest("GET",args);
  5811. -};
  5812. -
  5813. -/**
  5814. - * Make a POST request. Pass an object containing parameters and arguments as
  5815. - * the second argument.
  5816. - * These areguments may be either AjaxRequest properties to set on the request
  5817. - * object or name/values to set in the request querystring.
  5818. - */
  5819. -AjaxRequest.post = function(args) {
  5820. - AjaxRequest.doRequest("POST",args);
  5821. -};
  5822. -
  5823. -/**
  5824. - * The internal method used by the .get() and .post() methods
  5825. - */
  5826. -AjaxRequest.doRequest = function(method,args) {
  5827. - if (typeof(args)!="undefined" && args!=null) {
  5828. - var myRequest = new AjaxRequest();
  5829. - myRequest.method = method;
  5830. - myRequest.handleArguments(args);
  5831. - myRequest.process();
  5832. - }
  5833. -} ;
  5834. -
  5835. -/**
  5836. - * Submit a form. The requested URL will be the form's ACTION, and the request
  5837. - * method will be the form's METHOD.
  5838. - * Returns true if the submittal was handled successfully, else false so it
  5839. - * can easily be used with an onSubmit event for a form, and fallback to
  5840. - * submitting the form normally.
  5841. - */
  5842. -AjaxRequest.submit = function(theform, args) {
  5843. - var myRequest = new AjaxRequest();
  5844. - if (myRequest==null) { return false; }
  5845. - var serializedForm = AjaxRequest.serializeForm(theform);
  5846. - myRequest.method = theform.method.toUpperCase();
  5847. - myRequest.url = theform.action;
  5848. - myRequest.handleArguments(args);
  5849. - myRequest.queryString = serializedForm;
  5850. - myRequest.process();
  5851. - return true;
  5852. -};
  5853. -
  5854. -/**
  5855. - * Serialize a form into a format which can be sent as a GET string or a POST
  5856. - * content.It correctly ignores disabled fields, maintains order of the fields
  5857. - * as in the elements[] array. The 'file' input type is not supported, as
  5858. - * its content is not available to javascript. This method is used internally
  5859. - * by the submit class method.
  5860. - */
  5861. -AjaxRequest.serializeForm = function(theform) {
  5862. - var els = theform.elements;
  5863. - var len = els.length;
  5864. - var queryString = "";
  5865. - this.addField =
  5866. - function(name,value) {
  5867. - if (queryString.length>0) {
  5868. - queryString += "&";
  5869. - }
  5870. - queryString += encodeURIComponent(name) + "=" + encodeURIComponent(value);
  5871. - };
  5872. - for (var i=0; i<len; i++) {
  5873. - var el = els[i];
  5874. - if (!el.disabled) {
  5875. - switch(el.type) {
  5876. - case 'text': case 'password': case 'hidden': case 'textarea':
  5877. - this.addField(el.name,el.value);
  5878. - break;
  5879. - case 'select-one':
  5880. - if (el.selectedIndex>=0) {
  5881. - this.addField(el.name,el.options[el.selectedIndex].value);
  5882. - }
  5883. - break;
  5884. - case 'select-multiple':
  5885. - for (var j=0; j<el.options.length; j++) {
  5886. - if (el.options[j].selected) {
  5887. - this.addField(el.name,el.options[j].value);
  5888. - }
  5889. - }
  5890. - break;
  5891. - case 'checkbox': case 'radio':
  5892. - if (el.checked) {
  5893. - this.addField(el.name,el.value);
  5894. - }
  5895. - break;
  5896. - }
  5897. - }
  5898. - }
  5899. - return queryString;
  5900. -};
  5901. -
  5902. -// -----------------------
  5903. -// Static Class variables
  5904. -// -----------------------
  5905. -
  5906. -/**
  5907. - * The number of total AjaxRequest objects currently active and running
  5908. - */
  5909. -AjaxRequest.numActiveAjaxRequests = 0;
  5910. -
  5911. -/**
  5912. - * An object holding the number of active requests for each group
  5913. - */
  5914. -AjaxRequest.numActiveAjaxGroupRequests = new Object();
  5915. -
  5916. -/**
  5917. - * The total number of AjaxRequest objects instantiated
  5918. - */
  5919. -AjaxRequest.numAjaxRequests = 0;
  5920. -
  5921.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement