ÿØÿà JFIF    ÿÛ „  ( %"1!%)+...383,7(-.+  -+++--++++---+-+-----+---------------+---+-++7-----ÿÀ  ß â" ÿÄ     ÿÄ H    !1AQaq"‘¡2B±ÁÑð#R“Ò Tbr‚²á3csƒ’ÂñDS¢³$CÿÄ   ÿÄ %  !1AQa"23‘ÿÚ   ? ôÿ ¨pŸªáÿ —åYõõ\?àÒü©ŠÄï¨pŸªáÿ —åYõõ\?àÓü©ŠÄá 0Ÿªáÿ Ÿå[úƒ ú®ði~TÁbqÐ8OÕpÿ ƒOò¤Oè`–RÂáœá™êi€ßÉ< FtŸI“öÌ8úDf´°å}“¾œ6  öFá°y¥jñÇh†ˆ¢ã/ÃÐ:ªcÈ "Y¡ðÑl>ÿ ”ÏËte:qž\oäŠe÷󲍷˜HT4&ÿ ÓÐü6ö®¿øþßèô Ÿ•7Ñi’•j|“ñì>b…þS?*Óôÿ ÓÐü*h¥£ír¶ü UãS炟[AÐaè[ûª•õ&õj?†Éö+EzP—WeÒírJFt ‘BŒ†Ï‡%#tE Øz ¥OÛ«!1›üä±Í™%ºÍãö]°î(–:@<‹ŒÊö×òÆt¦ãº+‡¦%ÌÁ²h´OƒJŒtMÜ>ÀÜÊw3Y´•牋4ǍýʏTì>œú=Íwhyë,¾Ôò×õ¿ßÊa»«þˆѪQ|%6ž™A õ%:øj<>É—ÿ Å_ˆCbõ¥š±ý¯Ýƒï…¶|RëócÍf溪“t.СøTÿ *Ä¿-{†çàczůŽ_–^XþŒ±miB[X±d 1,é”zEù»& î9gœf™9Ð'.;—™i}!ôšåîqêÛ٤ёý£½ÆA–àôe"A$˝Úsäÿ ÷Û #°xŸëí(l »ý3—¥5m! rt`†0~'j2(]S¦¦kv,ÚÇ l¦øJA£Šƒ J3E8ÙiŽ:cÉžúeZ°€¯\®kÖ(79«Ž:¯X”¾³Š&¡* ….‰Ž(ÜíŸ2¥ª‡×Hi²TF¤ò[¨íÈRëÉ䢍mgÑ.Ÿ<öäS0í„ǹÁU´f#Vß;Õ–…P@3ío<ä-±»Ž.L|kªÀê›fÂ6@»eu‚|ÓaÞÆŸ…¨ááå>åŠ?cKü6ùTÍÆ”†sĤÚ;H2RÚ†õ\Ö·Ÿn'¾ ñ#ºI¤Å´%çÁ­‚â7›‹qT3Iï¨ÖÚ5I7Ë!ÅOóŸ¶øÝñØôת¦$Tcö‘[«Ö³šÒ';Aþ ¸èíg A2Z"i¸vdÄ÷.iõ®§)¿]¤À†–‡É&ä{V¶iŽ”.Ó×Õÿ û?h¬Mt–íª[ÿ Ñÿ ÌV(í}=ibÔ¡›¥¢±b Lô¥‡piη_Z<‡z§èŒ)iÖwiÇ 2hÙ3·=’d÷8éŽ1¦¸c¤µ€7›7Ø ð\á)} ¹fËí›pAÃL%âc2 í§æQz¿;T8sæ°qø)QFMð‰XŒÂ±N¢aF¨…8¯!U  Z©RÊ ÖPVÄÀÍin™Ì-GˆªÅËŠ›•zË}º±ŽÍFò¹}Uw×#ä5B¤{î}Ð<ÙD é©¤&‡ïDbàÁôMÁ." ¤‡ú*õ'VŽ|¼´Úgllº¼klz[Æüï÷Aób‡Eÿ dÑ»Xx9ÃÜ£ÁT/`¼¸vI±Ýµ·Ë‚“G³þ*Ÿû´r|*}<¨îºœ @¦mÄ’M¹”.œ«Y–|6ÏU¤jç¥ÕÞqO ˜kDÆÁ¨5ÿ š;ÐЦ¦€GÙk \ –Þ=â¼=SͧµªS°ÚÍpÜãQűÀõ¬?ÃÁ1Ñ•õZà?hóœ€ L¦l{Y*K˜Ù›zc˜–ˆâ ø+¾ ­-Ök¥%ùEÜA'}ˆ><ÊIè“bpÍ/qÞâvoX€w,\úªò6Z[XdÒæ­@Ö—€$òJí#é>'°Ú ôª˜<)4ryÙ£|óAÅn5žêŸyÒäMÝ2{"}‰–¤l÷ûWX\l¾Á¸góÉOÔ /óñB¤f¸çñ[.P˜ZsÊË*ßT܈§QN¢’¡¨§V¼(Üù*eÕ“”5T¨‹Âê¥FŒã½Dü[8'Ò¥a…Ú¶k7a *•›¼'Ò·\8¨ª\@\õ¢¦íq+DÙrmÎ…_ªæ»ŠÓœ¡¯’Ré9MÅ×D™lælffc+ŒÑ,ý™ÿ ¯þǤ=Å’Á7µ÷ÚÛ/“Ü€ñýã¼àí¾ÕÑ+ƒ,uµMâÀÄbm:ÒÎPæ{˜Gz[ƒ¯«® KHà`ߨŠéí¯P8Aq.C‰ à€kòpj´kN¶qô€…Õ,ÜNŠª-­{Zö’æû44‰sŽè‰îVíRœÕm" 6?³D9¡ÇTíÅꋇ`4«¸ÝÁô ï’ýorqКÇZ«x4Žâéþuïf¹µö[P ,Q£éaX±`PÉÍZ ¸äYúg üAx ’6Lê‚xÝÓ*äQ  Ï’¨hÍ =²,6ï#rÃ<¯–£»ƒ‹,–ê•€ aÛsñ'%Æ"®ÛüìBᝠHÚ3ß°©$“XnœÖ’î2ËTeûìxîß ¦å¿çÉ ðK§þ{‘t‚Ϋ¬jéîZ[ ”š7L¥4VÚCE×]m¤Øy”ä4-dz£œ§¸x.*ãÊÊ b÷•h:©‡¦s`BTÁRû¾g⻩‹jø sF¢àJøFl‘È•Xᓁà~*j¯ +(ÚÕ6-£¯÷GŠØy‚<Ç’.F‹Hœw(+)ÜÜâÈzÄäT§FߘãÏ;DmVœ3Àu@mÚüXÝü•3B¨òÌÁÛ<·ÃÜ z,Ì@õÅ·d2]ü8s÷IôÞ¯^Ç9¢u„~ëAŸï4«M? K]­ÅàPl@s_ p:°¬ZR”´›JC[CS.h‹ƒïËœ«Æ]–÷ó‚wR×k7X‰k›‘´ù¦=¡«‰¨¨Â')—71ó’c‡Ðúµ `é.{§p¹ój\Ž{1h{o±Ý=áUÊïGÖŒõ–-BÄm+AZX¶¡ ïHðæ¥JmÙ;…䡟ˆ¦ ° äšiÉg«$üMk5¤L“’çÊvïâï ,=f“"íἊ5ô¬x6{ɏžID0e¸vçmi'︧ºð9$ò¹÷*£’9ÿ ²TÔ…×>JV¥}Œ}$p[bÔ®*[jzS*8 ”·T›Í–ñUîƒwo$áè=LT™ç—~ô·¤ÈÚ$榍q‰„+´kFm)ž‹©i–ËqÞŠ‰à¶ü( ‚•§ •°ò·‡#5ª•µÊ﯅¡X¨šÁ*F#TXJÊ ušJVÍ&=iÄs1‚3•'fý§5Ñ<=[íÞ­ PÚ;ѱÌ_~Ä££8rÞ ²w;’hDT°>ÈG¬8Á²ÚzŽ®ò®qZcqJêäÞ-ö[ܘbň±çb“ж31²n×iƒðÕ;1¶þÉ ªX‰,ßqÏ$>•î íZ¥Z 1{ç൵+ƒÕµ¥°T$§K]á»Ûï*·¤tMI’ÂZbŽÕiÒ˜}bÓ0£ª5›¨ [5Ž^ÝœWøÂÝh° ¢OWun£¤5 a2Z.G2³YL]jåtì”ä ÁÓ‘%"©<Ôúʰsº UZvä‡ÄiÆÒM .÷V·™ø#kèýiíÌ–ª)µT[)BˆõÑ xB¾B€ÖT¨.¥~ð@VĶr#¸ü*åZNDŽH;âi ],©£öØpù(šºãö¼T.uCê•4@ÿ GÕÛ)Cx›®0ø#:ÏðFÒbR\(€€Ä®fã4Þ‰Fä¯HXƒÅ,†öEÑÔÜ]Öv²?tLÃvBY£ú6Êu5ÅAQ³1‘’¬x–HŒÐ‡ ^ ¸KwJôÖŽ5×CÚ¨vÜ«/B0$×k°=ðbÇ(Ï)w±A†Á† 11Í=èQšµ626ŒÜ/`G«µ<}—-Ö7KEHÈÉðóȤmݱû±·ø«Snmá=“䫚mݱŸ¡¶~ó·“äUóJæúòB|E LêŽy´jDÔ$G¢þÐñ7óR8ýÒ…Ç› WVe#·Ÿ p·Fx~•ݤF÷0Èÿ K¯æS<6’¡WШ; ´ÿ ¥Êø\Òuî†åÝ–VNœkÒ7oòX¨Á­Ø÷FÎÑä±g÷ÿ M~Çî=p,X´ ÝÌÚÅ‹’ÃjÖ.ØöÏñ qïQ¤ÓZE†° =6·]܈ s¸>v•Ž^Ý\wq9r‰Î\¸¡kURÒ$­*‹Nq?Þª*!sŠÆ:TU_u±T+øX¡ ®¹¡,ÄâÃBTsÜ$Ø›4m椴zÜK]’’›Pƒ @€#â˜`é¹=I‡fiV•Ôî“nRm+µFPOhÍ0B£ €+¬5c v•:P'ÒyÎ ‰V~‚Ó†ÖuókDoh$å\*ö%Ю=£«…aȼ½÷Û.-½VŒŠ¼'lyî±1¬3ó#ÞE¿ÔS¤gV£m›=§\û"—WU¤ÚǼÿ ÂnÁGŒÃ ‚õN D³õNÚíŒÕ;HôyÄÈ©P¹Ä{:?R‘Ô¨âF÷ø£bÅó® JS|‚R÷ivýáâ€Æé¡è³´IئÑT!§˜•ت‚¬â@q€wnïCWÄ@JU€ê¯m6]Ï:£âx'+ÒðXvÓ¦Úm=–´7œ $ì“B£~p%ÕŸUþ« N@¼üï~w˜ñø5®—'Ôe»¤5ã//€ž~‰Tþ›Å7•#¤× Íö pÄ$ùeåì*«ÓŠEØWEÈsßg ¦ûvžSsLpºÊW–âµEWöˬH; ™!CYõZ ÃÄf æ#1W. \uWâ\,\Çf j’<qTbên›Î[vxx£ë 'ö¨1›˜ÀM¼Pÿ H)ƒêêŒA7s,|F“ 꺸k³9Ìö*ç®;Ö!Ö$Eiž•¹ÒÚ†ýóéÝû¾ÕS®ó$’NÝäŸz¤5r¦ãÄÃD÷Üø!°ø‡Ô&@m™Ì^Ãä­d q5Lnÿ N;.6½·N|#ä"1Nƒx“ã<3('&ñßt  ~ªu”1Tb㫨9ê–›–bìd$ߣ=#ÕãÒmU¯eí$EFù5ýYô櫨æì™Ç—±ssM]·á¿0ÕåJRÓªîiƒ+O58ÖñªŠÒx" \µâá¨i’¤i —Ö ” M+M¤ë9‚‰A¦°Qõ¾ßøK~¼Ã‘g…Ö´~÷Ï[3GUœÒ½#…kàÔ®Ò”‰³·dWV‰IP‰Ú8u¹”E ÖqLj¾êÕCBš{A^Âß;–¨`¯¬ìö ˼ ×tìø.tƐm*n¨y4o&Àx¥n¦×î‡aupáÛj8¿m›è¶ã!o½;ß0y^ý×^EÑ¿ÒjzŒ­)vÚÑnÄL …^ªô× ‡—‚3k Îý­hï]içå–îÏ*÷ñþ»Ô CÒjøjÍznˆ´ ¹#b'Fô‹ ‰v¥'’à'T´ƒHýÍ%M‰ ƒ&ÆÇŒï1 ‘ –Þ ‰i¬s žR-Ÿ kЬá¬7:þ 0ŒÅÒÕ/aÙ¬ÃÝ#Úøœ ©aiVc‰. ¹¦ãµ” ›Yg¦›ÆÎýº°f³7ƒhá·¸­}&D9¡ÂsÉÙÞèŠõØàC™¨ñbFC|´Ü(ŸƒÚÒ-%»'a Ì¿)ËÇn¿úÿ ÞŽX…4ÊÅH^ôΑí@ù¹Eh¶“L8Çjù ¼ÎåVªóR©Ï5uà V4lZß®=€xÖŸ–ÑÈ ÷”¨°¾__yM1tÉ?uÆþIkÄgæ@þ[¢†°XÃJ£j·:nkÅ¢u ‘}âGzö­/IµèЬ¼48q¦F°ŽR¼=ûì{´¯RýicS ÕÛ íNtÍÙï£,w4rêì®»~x(©Uñ§#Ñ&œÕ¤>ÎåÍÓ9’Ö{9eV­[Öjâ²ãu]˜å2›qÑšÕJç0€sÄ|Êëè0튔bÁ>“{×_F`Ø©ºê:µä,v¤ðfc1±"«ÔÍän1#=· Âøv~H½ÐßA¾¿Ü€Óš]Õ; I¾÷ç‚Qi†î¹9ywÔKG˜áñ zQY—§ÃÕZ07§X‚ Áh;ÁM)iÌCH-¯T‘ë|A0{Ò½LÚ–TâÖkÜ’dÀ“rmm»”جPF³ÖcbE§T€ÒxKºû’Ó®7±²(\4ŽÃ¸Uu@j™yĵ;³µ!Á¢b.W¤=mõ´êµK k ¸K^ÜÛ#p*Ü14qkZç5ïë †°5Ï%ÍÛ<Õ¤×Ô¥ê†C Õ´¼ú$ƒÖ“”]Ù¬qÞÚ[4©ý!ûÏ—Áb쳐XµA¬â~`›Çr¸8ìùÝ䫦<>ä÷«?xs´ÇÑ /á;¹øüÊÈÙà{"@Žïzâ¬[âß‚ U_<ÇŸ½4èN˜ú61®qŠu ¦þF£»äJ_ˆÙÎ~ ÞAã–݄ϗrŠD;xTž‘ô`É«…suãO`?³à™ô Lý#Íc5öoæØ‚y´´÷«ZR§<&JÇ+éâô´€i!Àˆ0æAoàðLèÖ-2ŸõW.’t^–(KÁmHµV@xÜÇy®Ñø­â^:Ú3w· 7½¹°ñ¸â¹®:',«Mœ—n­Á+Ãbš LÈ‘ÄnRÓÅœ%¦²‰¨ùQ:¤f‚ "PÕtô¸…cæl…&˜Ú˜Ôkv‹ž+vŠ,=¢v­6—Xy*¥t£«<™:“aîϲ=¦6rO]XI¿Œ÷¤zÚ­›¶ 6÷”w\d ü~v®ˆÌk«^m<ÿ ¢‰Õ\)ùºŽ;… lîÙÅEŠ®cѾ@vnMÏ,¼“ñ•ŽBxðÃzãÇç%3ˆ"}Ù•Åî> BÉú;Ò]V+P˜F_´ßé> Øše|ï‡ÄOmFæÇ ãqÞ$/xÐx­z`ï9"œÜij‚!7.\Td…9M‡•iŽ‹¾‘50ÞŽn¥ß4ÉôO ¹*í^QêËÜÇÌ8=ާs‰'ÂëÙ«á%Pú[O †ÅP¯Vsް.‰,kc¶ ¬A9n˜XÎ-ÞšN["¹QÕ‰ƒMýÁߺXJæÍaLj¾×Ãmã¾ãÚ uñÒþåQô¦¥ /ÄUx:‚ÍÜ’ Đ©ØÝ3V¨‰ÕnÐ6ó*óúK­«…c ¯U òhsý­jóÔj#,ímŒRµ«lbïUTŒÑ8†Ä0œÏr`ð¡¬É Ї ë"À² ™ 6¥ f¶ ¢ÚoܱԷ-<Àî)†a¶ž'Ú»¨TXqØæ¶÷YÄHy˜9ÈIW­YÀuMFë ºÏ’AqÌ4·/Ú †ô'i$øä­=Ä Ý|öK×40è|È6p‘0§)o¥ctî§H+CA-“ xØ|ÐXАç l8íºð3Ø:³¤¬KX¯UÿÙ loadLanguage(); } // onContentSearchAreas public function onContentSearchAreas() { static $areas = array( 'cck'=>'CCK' ); return $areas; } // onContentSearch public function onContentSearch( $text = '', $phrase = '', $ordering = '', $areas = null, $fields = array(), $fields_order = array(), &$config = array(), $current = array(), $options = null, $user = null ) { if ( is_array( $areas ) ) { if ( ! array_intersect( $areas, array_keys( $this->onContentSearchAreas() ) ) ) { return array(); } } else { return array(); } if ( !count( $fields ) ) { return array(); } if ( ! $user ) { $user = JCck::getUser(); } if ( !is_object( $options ) ) { $options = new JRegistry; } $app = JFactory::getApplication(); $db = JFactory::getDbo(); $dispatcher = JEventDispatcher::getInstance(); $doClean = false; $doCount = (int)$options->get( 'count' ); $doDebug = $options->get( 'debug' ); $doLimit = false; $limit = (int)$options->get( 'limit' ); $doLimit = ( $limit > 0 ) ? false : true; $hasGroup = false; $isLoadingMore = ( $app->input->get( 'format' ) == 'raw' && $app->input->getInt( 'infinite' ) > 0 ) ? 1 : 0; if ( $isLoadingMore ) { $isLoadingMore = 0; /* TODO#SEBLOD: only when it was triggered by the component itself */ } $glues = 1; $order = ''; $order_string = ''; $where = ''; $w = -1; $where2 = array(); $t = 1; $t2 = 1; $tables = array( '#__cck_core'=>array( '_'=>'t0', 'fields'=>array(), 'join'=>1 ) ); $colums = array(); if ( isset( $config['joins'][$current['stage']] ) && is_array( $config['joins'][$current['stage']] ) ) { foreach ( $config['joins'][$current['stage']] as $j ) { if ( $j->table ) { if ( !isset( $tables[$j->table] ) ) { $tables[$j->table] = array( '_'=>'t'.$t++, 'fields'=>array(), 'key'=>$j->column, 'join'=>2, 'join_key'=>$j->column2, 'join_table'=>$j->table2, 'join_and'=>@$j->and, 'join_type'=>@$j->type, 'join_mode'=>@$j->mode, 'join_query'=>@$j->query ); if ( @$j->aka != '' && $j->aka != $j->table ) { $tables[$j->table]['table'] = $j->aka; } } elseif ( @$j->and != '' ) { $tables[$j->table.'@'.md5( $j->and )] = array( '_'=>'t'.$t++, 'fields'=>array(), 'key'=>$j->column, 'join'=>2, 'join_key'=>$j->column2, 'join_table'=>$j->table2, 'join_and'=>$j->and, 'join_type'=>@$j->type, 'join_mode'=>@$j->mode, 'join_query'=>@$j->query ); } } } $t2 = count( $tables ); } foreach ( $fields as $field ) { if ( !@$field->state ) { continue; } if ( $current['stage'] != (int)$field->stage ) { continue; } $hasSQL = true; $name2 = ( $field->match_collection != '' ) ? '\\\|[0-9]+\\\|'.$field->match_collection : ''; // - if ( $field->live == 'stage' ) { $live_options = new JRegistry; $live_options->loadString( $field->live_options ); $live_value = $live_options->get( 'value', $field->live_value ); $live_value = ( $live_value ) ? $live_value : 1; $value = $current['stages'][$live_value]; if ( $value == '' && $live_options->get( 'default_value' ) != '' ) { $value = (string)$live_options->get( 'default_value' ); } } else { $value = $field->value; } // - $Pf = $field->storage_field; $Pt = $field->storage_table; if ( ((( $value !== '' && $field->match_mode != 'none' ) || ( $field->match_mode == 'empty' || $field->match_mode == 'not_empty' || $field->match_mode == 'not_null' )) && $field->storage != 'none' ) || ( ( $field->type == 'search_operator' ) && $field->match_mode != 'none' ) ) { $glue = ''; $sql = ''; if ( $field->match_options != '' ) { $field->match_options = new JRegistry( $field->match_options ); } // Glue if ( $glues == 1 ) { $glue = ( $where != '' ) ? 'AND' : ''; $where .= $glue; if ( $glue != '' ) { $where2[++$w] = $glue; } $glue = ''; } // Sql if ( $field->type == 'search_generic' ) { $sql = ''; if ( count( $field->children ) ) { $hasAka = false; $sqls = array(); if ( count( $field->children_akas ) ) { if ( strpos( $value, ' ' ) !== false ) { $values = explode( ' ', $value ); } else { $values = array( 0=>$value ); } if ( count( $values ) ) { foreach ( $values as $key=>$v ) { $values[$key] = array( 'aka'=>false, 'sql'=>'', 'str'=>$v ); foreach ( $field->children_akas as $aka=>$val ) { $pos = strpos( $values[$key]['str'], $aka.':' ); if ( $pos !== false && $pos == 0 ) { $hasAka = true; $values[$key]['aka'] = $aka; $values[$key]['str'] = substr( $values[$key]['str'], strlen( $aka ) + 1 ); } } } } } if ( !$hasAka ) { $values = array( 0=>array( 'aka'=>false, 'sql'=>'', 'str'=>$value ) ); } foreach ( $values as $v ) { $k = 0; foreach ( $field->children as $child ) { if ( $hasAka ) { if ( $v['aka'] && $v['aka'] != $child->aka ) { continue; } else { $value = $v['str']; } } if ( $k > 0 ) { $v['sql'] .= ' OR '; } $child->match_mode = $field->match_mode; $child->match_options = $field->match_options; $child->match_value = $field->match_value; if ( $child->storage && $child->storage != 'none' ) { $Pf = $child->storage_field; $Pt = $child->storage_table; // - if ( $Pt && !isset( $tables[$Pt] ) ) { $tables[$Pt] = array( '_'=>'t'.$t, 'fields'=>array(), 'join'=>1 ); $t++; } $tables[$Pt]['location'] = $child->storage_location; // - $name = $child->storage_field2 ? $child->storage_field2 : $child->name; if ( $Pt != '' ) { $target = $tables[$Pt]['_'].'.'.$Pf; $tables[$Pt]['fields'][$Pf] = ( $Pt == '#__cck_core' ) ? $value : $name; } if ( JCck::callFunc( 'plgCCK_Field'.$child->type, 'isFriendly' ) ) { if ( isset( $fields[$child->name] ) ) { $value2 = JCck::callFunc_Array( 'plgCCK_Field'.$child->type, 'getValueFromOptions', array( $fields[$child->name], $value, $config ) ); } else { $value2 = JCck::callFunc_Array( 'plgCCK_Field'.$child->type, 'getValueFromOptions', array( $child, $value, $config ) ); } } else { $value2 = $value; } require_once JPATH_PLUGINS.'/cck_storage/'.$child->storage.'/'.$child->storage.'.php'; $v['sql'] .= JCck::callFunc_Array( 'plgCCK_Storage'.$child->storage, 'onCCK_StoragePrepareSearch', array( &$child, $child->match_mode, $value2, $name, $name2, $target, $fields, &$config ) ); $k++; } } if ( $v['sql'] != '' ) { $sqls[] = '('.$v['sql'].')'; } } if ( $count2 = count( $sqls ) ) { $sql = implode( ' AND ', $sqls ); if ( $count2 > 1 ) { $sql = '('.$sql.')'; } } } } elseif ( $field->type == 'search_ordering' ) { $sql = ''; array_pop( $where2 ); if ( isset( $field->children[$value] ) ) { if ( isset( $field->children[$value]->prepend ) ) { if ( is_object( $field->children[$value]->prepend ) ) { if ( !isset( $fields_order[$field->children[$value]->prepend->name] ) ) { $fields_order[$field->children[$value]->prepend->name] = $field->children[$value]->prepend; } } } if ( !isset( $fields_order[$field->children[$value]->name] ) ) { $fields_order[$field->children[$value]->name] = $field->children[$value]; } } } elseif ( $field->type == 'search_operator' ) { // Glue if ( $field->value == '((' ) { $glues = 0; $sql = '('; } elseif ( $field->value == '))' ) { $glues = 1; $sql = ')'; } else { if ( $where2[$w] != '(' ) { $glue = $field->value; $sql = $glue; } } $doClean = true; } else { // - if ( $Pt && !isset( $tables[$Pt] ) ) { $tables[$Pt] = array( '_'=>'t'.$t, 'fields'=>array(), 'join'=>1 ); $t++; } $tables[$Pt]['location'] = $field->storage_location; // - $name = $field->storage_field2 ? $field->storage_field2 : $field->name; if ( $Pt != '' ) { $target = $tables[$Pt]['_'].'.'.$Pf; $tables[$Pt]['fields'][$Pf] = ( $Pt == '#__cck_core' ) ? $value : $name; } else { $target = $Pf; $hasSQL = false; } require_once JPATH_PLUGINS.'/cck_storage/'.$field->storage.'/'.$field->storage.'.php'; $sql = JCck::callFunc_Array( 'plgCCK_Storage'.$field->storage, 'onCCK_StoragePrepareSearch', array( &$field, $field->match_mode, $value, $name, $name2, $target, $fields, &$config ) ); } if ( $hasSQL === false ) { if ( $glues == 1 ) { if ( $where != '' ) { $where = substr( $where, 0, -3 ); $where2[$w] = ''; } } $config['query_parts']['having'][] = $sql; $sql = ''; } else { $where .= $sql; $where2[++$w] = $sql; } } else { if ( @$glue ) { $where2[$w] = ''; } // unset( $fields[$field->name] ); } } // Finalize $where = implode( ' ', $where2 ); if ( $doClean !== false ) { $where = preg_replace( '/\s+/', ' ', $where ); $where = str_replace( array( 'AND ( )', 'AND ( )', '( ) AND', '( ) AND' ), '', $where ); $where = str_replace( array( 'OR OR', '( OR', 'OR ) )', 'OR )' ), array( 'OR', '(', ')', ')' ), $where ); } $where = str_replace( 'AND ()', '', $where ); $pos = strpos( $where, '() AND' ); if ( $pos !== false && $pos == 0 ) { $where = substr( $where, 6 ); } else { $pos = strpos( $where, 'AND' ); if ( $pos !== false && $pos == 0 ) { $where = substr( $where, 3 ); } } // -------- -------- Order if ( ! $order ) { $order = ' t1.title ASC'; } $inherit = array( 'bridge'=>'', 'query'=>'' ); $query = null; $query2 = ''; $results = array(); self::_setStorage( $tables, $config, $inherit ); JPluginHelper::importPlugin( 'cck_storage_location' ); if ( isset( $config['location'] ) && $config['location'] ) { $dispatcher->trigger( 'onCCK_Storage_LocationSearch', array( $config['location'], $tables, $fields, $fields_order, &$config, &$inherit, &$results ) ); $query = $inherit['query']; } if ( $config['doQuery'] !== false ) { if ( $current['stage'] == 0 ) { if ( isset( $config['query_variables'] ) && count( $config['query_variables'] ) ) { foreach ( $config['query_variables'] as $var ) { if ( $var != '' ) { $db->setQuery( $var ); $db->execute(); } } } $query = $db->getQuery( true ); $query->select( 't0.id AS pid,t0.pk AS pk,t0.pkb AS pkb,t0.parent_id AS parent,t0.author_id AS author,t0.author_session AS author_session' ); $query->from( '`#__cck_core` AS t0' ); self::_buildQuery( $dispatcher, $query, $tables, $t, $config, $inherit, $user, $config['doSelect'] ); $query->select( 't0.cck AS cck,t0.storage_location AS loc' ); if ( $config['location'] == 'cck_type' ) { $query->select( $tables['#__cck_core_types']['_'].'.id AS type_id,'.$tables['#__cck_core_types']['_'].'.alias AS type_alias' ); } else { $query->select( 'tt.id AS type_id,tt.alias AS type_alias' ); $query->join( 'LEFT', '`#__cck_core_types` AS tt ON tt.name = t0.cck' ); } if ( isset( $config['query_parts']['select'] ) ) { if ( ( is_string( $config['query_parts']['select'] ) && $config['query_parts']['select'] != '' ) || count( $config['query_parts']['select'] ) ) { $query->select( self::_prepareParts( $config['query_parts']['select'], $tables ) ); } } if ( $where != '' ) { $query->where( $where ); } if ( isset( $config['query_parts']['where'] ) ) { if ( ( is_string( $config['query_parts']['where'] ) && $config['query_parts']['where'] != '' ) || count( $config['query_parts']['where'] ) ) { $query->where( self::_prepareParts( $config['query_parts']['where'], $tables ) ); } } if ( isset( $config['query_parts']['having'] ) ) { if ( ( is_string( $config['query_parts']['having'] ) && $config['query_parts']['having'] != '' ) || count( $config['query_parts']['having'] ) ) { $query->having( self::_prepareParts( $config['query_parts']['having'], $tables ) ); } } if ( isset( $config['query_parts']['group'] ) && count( $config['query_parts']['group'] ) ) { $hasGroup = true; $query->group( self::_prepareParts( $config['query_parts']['group'], $tables ) ); } self::_buildQueryOrdering( $order, $ordering, $fields_order, $dispatcher, $query, $tables, $t, $config, $current, $inherit, $user ); if ( $doLimit && $config['limitstart'] >= 0 ) { $db->setQuery( $query, $config['limitstart'], $config['limitend'] ); } else { $db->setQuery( $query, 0, $limit ); } if ( $doDebug != -1 ) { $results = $db->loadObjectList(); } if ( $doLimit ) { $count = count( $results ); if ( ( $count < $config['limitend'] && !$config['limitstart'] ) || $isLoadingMore ) { $config['total'] = $count; } else { if ( $doCount == 1 && strpos( JUri::getInstance()->toString(), 'task=' ) === false ) { $query2 = 'SELECT COUNT(id) FROM #__cck_core WHERE cck = "'.$tables['#__cck_core']['fields']['cck'].'"'; $config['total'] = JCckDatabaseCache::loadResult( $query2 ); if ( isset( $config['doQuery2'] ) && $config['doQuery2'] ) { $query->clear( 'limit' ); $query->clear( 'select' )->select( 't0.id AS pid,t0.pk AS pk' ); $db->setQuery( $query ); $results2 = $db->loadObjectList(); $query3 = (string)$query; } } else { $query1 = (string)$query; if ( strpos( $query1, 'HAVING' ) !== false ) { if ( isset( $config['doQuery2'] ) && $config['doQuery2'] ) { /* TODO#SEBLOD: */ } $query->clear( 'order' )->clear( 'limit' ); $query2 = $db->getQuery( true ); $query2->select( 'COUNT(*)' ); $query2->from( '('.(string)$query.') AS Count' ); $db->setQuery( $query2 ); $config['total'] = $db->loadResult(); $query2 = (string)$query2; } else { if ( isset( $config['doQuery2'] ) && $config['doQuery2'] ) { $query->clear( 'limit' ); $query->clear( 'select' )->select( 't0.id AS pid,t0.pk AS pk' ); $db->setQuery( $query ); $results2 = $db->loadObjectList(); $query3 = (string)$query; } $query->clear( 'order' )->clear( 'limit' )->clear( 'select' ); if ( $hasGroup ) { $query->clear( 'group' ); $query->select( 'COUNT(DISTINCT t0.id)' ); } else { $query->select( 'COUNT(t0.id)' ); } $db->setQuery( $query ); $config['total'] = $db->loadResult(); $query2 = (string)$query; } } } } if ( isset( $config['doQuery2'] ) && $config['doQuery2'] && isset( $results2 ) && count( $results2 ) ) { $config['ids2'] = ''; $config['pks2'] = ''; foreach ( $results2 as $k=>$v ) { $config['ids2'] .= (int)$results2[$k]->pid.','; $config['pks2'] .= (int)$results2[$k]->pk.','; } $config['ids2'] = substr( $config['ids2'], 0, -1 ); $config['pks2'] = substr( $config['pks2'], 0, -1 ); } } else { $query = $db->getQuery( true ); $query->select( 't0.pk as pk' ); $query->from( '`#__cck_core` AS t0' ); self::_buildQuery( $dispatcher, $query, $tables, $t, $config, $inherit, $user, false ); if ( $where != '' ) { $query->where( $where ); } $db->setQuery( $query ); if ( $doDebug != -1 ) { $results = $db->loadColumn(); } } } else { $config['ids2'] = array(); foreach ( $results as $k=>$v ) { if ( isset( $results[$k]->id ) ) { $config['ids2'][] = $results[$k]->id; } } $config['ids2'] = '"'.implode( '","', $config['ids2'] ).'"'; } // Debug if ( $doDebug ) { if ( !isset( $query1 ) ) { $query1 = (string)$query; } if ( $query2 ) { $query2 .= '
'; } if ( isset( $query3 ) ) { $query2 .= $query3.'
'; } echo str_replace( array( 'SELECT', 'FROM', 'LEFT JOIN', 'RIGHT JOIN', 'INNER JOIN', 'WHERE', 'AND', 'HAVING', 'ORDER BY', 'GROUP BY', 'LIMIT', 'UNION', ') AS Count' ), array( '
SELECT', '
FROM', '
LEFT JOIN', '
RIGHT JOIN', '
INNER JOIN', '
WHERE', '
  AND', '
HAVING', '
ORDER BY', '
GROUP BY', '
LIMIT', '
UNION', '
) AS Count' ), $query1.'
'.$query2 ).'
'; } unset( $fields ); unset( $fields_order ); unset( $tables ); if ( isset( $config['total'] ) ) { $config['doPagination'] = false; } return $results; } // _buildQuery protected static function _buildQuery( &$dispatcher, &$query, &$tables, &$t, &$config, &$inherit, $user, $doSelect ) { if ( isset( $config['location'] ) && $config['location'] ) { $dispatcher->trigger( 'onCCK_Storage_LocationPrepareSearch', array( $config['location'], &$query, &$tables, &$t, &$config, &$inherit, $user ) ); } self::_buildQuery2( $dispatcher, $query, $tables, $t, $config, $inherit, $user, $doSelect, 1 ); self::_buildQuery2( $dispatcher, $query, $tables, $t, $config, $inherit, $user, false, 2 ); if ( !( isset( $tables['#__cck_core']['fields']['cck'] ) || isset( $tables['#__cck_core']['fields']['storage_location'] ) ) && $config['location'] ) { $query->where( 't0.storage_location = "'.$config['location'].'"' ); } } // _buildQuery2 protected static function _buildQuery2( &$dispatcher, &$query, &$tables, &$t, &$config, &$inherit, $user, $doSelect, $join ) { foreach ( $tables as $tk=>$tv ) { $j = ( isset( $tv['join'] ) ) ? $tv['join'] : 1; if ( isset( $tv['_'] ) && $tv['_'] != 't0' && $j == $join ) { if ( ! $config['location'] && $tv['_'] == 't1' ) { $config['location'] = $tv['location']; $inherit['table'] = $tk; $dispatcher->trigger( 'onCCK_Storage_LocationPrepareSearch', array( $config['location'], &$query, &$tables, &$t, &$config, &$inherit, $user ) ); } if ( $doSelect === true ) { $query->select( ' '.$tv['_'].'.*' ); } $key = ( isset( $tables[$tk]['key'] ) ) ? $tables[$tk]['key'] : 'id'; $join_type = ( isset( $tables[$tk]['join_type'] ) ) ? $tables[$tk]['join_type'] : 'LEFT'; $join_table = ( isset( $tables[$tk]['join_table'] ) && $tables[$tables[$tk]['join_table']]['_'] ) ? $tables[$tables[$tk]['join_table']]['_'] : 't0'; $join_key = ( isset( $tables[$tk]['join_key'] ) ) ? $tables[$tk]['join_key'] : ( ( $tk == $inherit['bridge'] ) ? 'pkb' : 'pk' ); $join_and = ( isset( $tables[$tk]['join_and'] ) ) ? $tables[$tk]['join_and'] : ''; $join_mode = ( isset( $tables[$tk]['join_mode'] ) ) ? $tables[$tk]['join_mode'] : 0; if ( $join_table != '' && $join_key != '' ) { if ( $join_and != '' && strpos( $tk, '@' ) !== false ) { $tk_table = explode( '@', $tk ); $tk = $tk_table[0]; } elseif ( isset( $tv['table'] ) && $tv['table'] ) { $tk = $tv['table']; } if ( $tk != '' ) { if ( $join_mode ) { $tk = ( isset( $tables[$tk]['join_query'] ) ) ? $tables[$tk]['join_query'] : ''; } else { $tk = '`'.$tk.'`'; } if ( $join_and != '' ) { $query->join( $join_type, $tk.' AS '.$tv['_'].' ON ('.$tv['_'].'.'.$key.' = '.$join_table.'.'.$join_key.' AND '.$tv['_'].'.'.$join_and.')' ); } else { $query->join( $join_type, $tk.' AS '.$tv['_'].' ON '.$tv['_'].'.'.$key.' = '.$join_table.'.'.$join_key ); } } } } } } // _buildQueryOrdering protected static function _buildQueryOrdering( &$order, &$ordering, $fields_order, &$dispatcher, &$query, &$tables, &$t, &$config, $current, &$inherit, $user ) { if ( $ordering != '' ) { if ( $ordering == '-1' ) { /* TODO#SEBLOD: alias. + join table if doesn't exist.. */ if ( $current['order_by'] ) { $query->order( $current['order_by'] ); } } elseif ( $ordering != 'none' ) { if ( @$config['location'] ) { $dispatcher->trigger( 'onCCK_Storage_LocationPrepareOrder', array( $config['location'], &$ordering, &$tables, &$config ) ); if ( $ordering ) { $query->order( $ordering ); } } } } else { $ordered = false; if ( is_array( $fields_order ) && count( $fields_order ) ) { $str = (string)$query; $str = explode( 'FROM', $str ); $str = $str[0]; foreach ( $fields_order as $field ) { $order = ''; $modifier = ''; $modifier2 = ''; $modifier3 = $field->match_mode; // direction if ( $modifier3 ) { $s_field = $field->storage_field; $s_table = $field->storage_table; // Prepare if ( empty( $field->match_options ) ) { $field->match_options = '{}'; } $field->match_options = new JRegistry( $field->match_options ); if ( $field->match_options->get( 'var_type' ) == '1' ) { $modifier2 = '+0'; } elseif ( $field->match_options->get( 'var_type' ) == '0' ) { $modifier = ' LENGTH('; $modifier2 = ')'; } if ( $modifier3 == 'FIELD' ) { $modifier = ' FIELD('; $modifier2 = ','; $s_opts = array(); $s_options = explode( '||', ( ( $field->match_options->get( 'by_field' ) == '1' ) ? $field->match_options->get( 'by_field_values' ) : $field->options ) ); foreach ( $s_options as $s_o ) { $s_opt = explode( '=', $s_o ); $s_opts[] = ( isset( $s_opt[1] ) && $s_opt[1] ) ? $s_opt[1] : $s_opt[0]; } $modifier3 = '"'.implode( '","', $s_opts ).'"'.')'; } else { $modifier3 = ' '.$modifier3; } if ( ! isset( $tables[$s_table] ) && $s_table ) { $tables[$s_table]['_'] = 't'.$t; $tables[$s_table]['fields'] = array(); $key = 'id'; $join_key = 'pk'; $query->join( 'LEFT', '`'.$s_table.'` AS '.$tables[$s_table]['_'].' ON '.$tables[$s_table]['_'].'.'.$key.' = t0.'.$join_key ); $t++; } // Set if ( isset( $tables[$s_table]['_'] ) && $tables[$s_table]['_'] != '' && $tables[$s_table]['_'] != '_' ) { $order .= $modifier.$tables[$s_table]['_'].'.'.$s_field.$modifier2.$modifier3; } elseif ( strpos( $str, $s_field.'.' ) !== false || strpos( $str, 'AS '.$s_field ) !== false ) { $order .= $modifier.$s_field.$modifier2.$modifier3; } if ( $order != '' ) { $ordered = true; $query->order( $order ); } } } } if ( !$ordered ) { $ordering = 'alpha'; if ( @$config['location'] ) { $dispatcher->trigger( 'onCCK_Storage_LocationPrepareOrder', array( $config['location'], &$ordering, &$tables, &$config ) ); if ( $ordering ) { $query->order( $ordering ); } } } } if ( isset( $config['query_parts']['order_by'] ) ) { if ( ( is_string( $config['query_parts']['order_by'] ) && $config['query_parts']['order_by'] != '' ) || count( $config['query_parts']['order_by'] ) ) { $query->order( self::_prepareParts( $config['query_parts']['order_by'], $tables ) ); } } } // _preparePart protected static function _preparePart( $part, $tables ) { foreach ( $tables as $k=>$v ) { if ( strpos( $part, $k.'.' ) !== false ) { $part = str_replace( $k.'.', $v['_'].'.', $part ); } } return $part; } // _prepareParts protected static function _prepareParts( $parts, $tables ) { if ( is_array( $parts ) ) { foreach ( $parts as $k=>$part ) { $parts[$k] = self::_preparePart( $part, $tables ); } } else { $parts = self::_preparePart( $parts, $tables ); } return $parts; } // _setStorage protected static function _setStorage( &$tables, &$config, &$inherit ) { if ( isset( $tables['#__cck_core']['fields']['storage_location'] ) ) { $config['location'] = $tables['#__cck_core']['fields']['storage_location']; $inherit['table'] = ''; } elseif ( isset( $tables['#__cck_core']['fields']['cck'] ) ) { $cck = str_replace( array( ',', ' ' ), array( '","', '","' ), $tables['#__cck_core']['fields']['cck'] ); $core = JCckDatabaseCache::loadObject( 'SELECT storage_location, storage_table FROM #__cck_core WHERE cck IN ("'.$cck.'") ORDER BY id DESC LIMIT 1' ); if ( is_object( $core ) ) { $config['location'] = $core->storage_location; $inherit['table'] = $core->storage_table; } } if ( !$config['location'] && isset( $config['type_object'] ) && $config['type_object'] ) { $config['location'] = $config['type_object']; $inherit['table'] = ''; } } } ?>