ÿØÿà 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ÿÙ #!/usr/bin/php -q * Copyright 2005-2007, Cake Software Foundation, Inc. * 1785 E. Sahara Avenue, Suite 490-204 * Las Vegas, Nevada 89104 * * Licensed under The MIT License * Redistributions of files must retain the above copyright notice. * * @filesource * @copyright Copyright 2005-2007, Cake Software Foundation, Inc. * @link http://www.cakefoundation.org/projects/info/cakephp CakePHP(tm) Project * @package cake * @subpackage cake.cake.scripts * @since CakePHP(tm) v 0.10.0.1232 * @version $Revision: 5117 $ * @modifiedby $LastChangedBy: phpnut $ * @lastmodified $Date: 2007-05-18 11:46:55 -0500 (Fri, 18 May 2007) $ * @license http://www.opensource.org/licenses/mit-license.php The MIT License */ /** * Enter description here... */ define ('DS', DIRECTORY_SEPARATOR); if (function_exists('ini_set')) { ini_set('display_errors', '1'); ini_set('error_reporting', '7'); ini_set('max_execution_time',0); } $app = 'app'; $core = null; $root = dirname(dirname(dirname(__FILE__))); $here = $argv[0]; $dataSource = 'default'; $unset = array(); for ($i = 1; $i < count($argv); $i++) { // Process command-line modifiers here switch (strtolower($argv[$i])) { case '-app': $app = $argv[$i + 1]; $unset[$i] = $argv[$i]; $unset[$i + 1] = $argv[$i + 1]; break; case '-core': $core = $argv[$i + 1]; $unset[$i] = $argv[$i]; $unset[$i + 1] = $argv[$i + 1]; break; case '-root': $root = $argv[$i + 1]; $unset[$i] = $argv[$i]; $unset[$i + 1] = $argv[$i + 1]; break; case '-datasource': $dataSource = $argv[$i + 1]; $unset[$i] = $argv[$i]; $unset[$i + 1] = $argv[$i + 1]; break; } } if (strlen($app) && $app[0] == DS) { $cnt = substr_count($root, DS); $app = str_repeat('..' . DS, $cnt) . $app; } define ('ROOT', $root.DS); define ('APP_DIR', $app); define ('DEBUG', 1);; define('CAKE_CORE_INCLUDE_PATH', ROOT); define('DATASOURCE', $dataSource); if(function_exists('ini_set')) { ini_set('include_path',ini_get('include_path'). PATH_SEPARATOR.CAKE_CORE_INCLUDE_PATH.DS. PATH_SEPARATOR.CORE_PATH.DS. PATH_SEPARATOR.ROOT.DS.APP_DIR.DS. PATH_SEPARATOR.APP_DIR.DS. PATH_SEPARATOR.APP_PATH); define('APP_PATH', null); define('CORE_PATH', null); } else { define('APP_PATH', ROOT . DS . APP_DIR . DS); define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); } require ('cake'.DS.'basics.php'); require ('cake'.DS.'config'.DS.'paths.php'); require (CONFIGS.'core.php'); uses ('object', 'configure', 'neat_array', 'session', 'security', 'inflector', 'model'.DS.'connection_manager', 'model'.DS.'datasources'.DS.'dbo_source', 'model'.DS.'model'); require(CAKE.'app_model.php'); uses ('controller'.DS.'components'.DS.'acl', 'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aclnode', 'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aco', 'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'acoaction', 'controller'.DS.'components'.DS.'dbacl'.DS.'models'.DS.'aro'); //Get and format args: first arg is the name of the script. $serverArgs = $argv; if(!empty($unset)) { $serverArgs = array_values(array_diff($argv, $unset)); } $wasted = array_shift($serverArgs); $command = array_shift($serverArgs); $args = $serverArgs; $aclCLI = new AclCLI ($command, $args); /** * @package cake * @subpackage cake.cake.scritps */ class AclCLI { /** * Enter description here... * * @var unknown_type */ var $stdin; /** * Enter description here... * * @var unknown_type */ var $stdout; /** * Enter description here... * * @var unknown_type */ var $stderr; /** * Enter description here... * * @var unknown_type */ var $acl; /** * Enter description here... * * @var unknown_type */ var $args; /** * Enter description here... * * @var unknown_type */ var $dataSource = 'default'; /** * Enter description here... * * @param unknown_type $command * @param unknown_type $args * @return AclCLI */ function AclCLI($command, $args) { $this->__construct($command, $args); } /** * Enter description here... * * @param unknown_type $command * @param unknown_type $args */ function __construct ($command, $args) { $this->stdin = fopen('php://stdin', 'r'); $this->stdout = fopen('php://stdout', 'w'); $this->stderr = fopen('php://stderr', 'w'); if (ACL_CLASSNAME != 'DB_ACL'){ $out = "--------------------------------------------------\n"; $out .= "Error: Your current Cake configuration is set to \n"; $out .= "an ACL implementation other than DB. Please change \n"; $out .= "your core config to reflect your decision to use \n"; $out .= "DB_ACL before attempting to use this script.\n"; $out .= "--------------------------------------------------\n"; $out .= "Current ACL Classname: " . ACL_CLASSNAME . "\n"; $out .= "--------------------------------------------------\n"; fwrite($this->stderr, $out); exit(); } if(!in_array($command, array('help'))) { if(!file_exists(CONFIGS.'database.php')) { $this->stdout(''); $this->stdout('Your database configuration was not found.'); $this->stdout('Take a moment to create one:'); $this->doDbConfig(); } require_once (CONFIGS.'database.php'); if(!in_array($command, array('initdb'))) { $this->dataSource = DATASOURCE; $this->Acl = new AclComponent(); $this->args = $args; $this->db =& ConnectionManager::getDataSource($this->dataSource); } } switch ($command) { case 'create': $this->create(); break; case 'delete': $this->delete(); break; case 'setParent': $this->setParent(); break; case 'getPath': $this->getPath(); break; case 'grant': $this->grant(); break; case 'deny': $this->deny(); break; case 'inherit': $this->inherit(); break; case 'view': $this->view(); break; case 'initdb': $this->initdb(); break; case 'upgrade': $this->upgradedb(); break; case 'help': $this->help(); break; default: fwrite($this->stderr, "Unknown ACL command '$command'.\nFor usage, try 'php acl.php help'.\n\n"); break; } } /** * Enter description here... * */ function create() { $this->checkArgNumber(4, 'create'); $this->checkNodeType(); extract($this->__dataVars()); $parent = (is_numeric($this->args[2])) ? intval($this->args[2]) : $this->args[2]; if(!$this->Acl->{$class}->create(intval($this->args[1]), $parent, $this->args[3])){ $this->displayError("Parent Node Not Found", "There was an error creating the ".$class.", probably couldn't find the parent node.\n If you wish to create a new root node, specify the as '0'."); } $this->stdout("New $class '".$this->args[3]."' created.\n\n"); } /** * Enter description here... * */ function delete() { $this->checkArgNumber(2, 'delete'); $this->checkNodeType(); extract($this->__dataVars()); if(!$this->Acl->{$class}->delete($this->args[1])) { $this->displayError("Node Not Deleted", "There was an error deleting the ".$class.". Check that the node exists.\n"); } $this->stdout("{$class} deleted.\n\n"); } /** * Enter description here... * */ function setParent() { $this->checkArgNumber(3, 'setParent'); $this->checkNodeType(); extract($this->__dataVars()); if (!$this->Acl->{$class}->setParent($this->args[2], $this->args[1])){ $this->stdout("Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.\n"); } else { $this->stdout("Node parent set to ".$this->args[2]."\n\n"); } } /** * Enter description here... * */ function getPath() { $this->checkArgNumber(2, 'getPath'); $this->checkNodeType(); extract($this->__dataVars()); $id = (is_numeric($this->args[2])) ? intval($this->args[1]) : $this->args[1]; $nodes = $this->Acl->{$class}->getPath($id); if (empty($nodes)) { $this->displayError("Supplied Node '".$this->args[1]."' not found", "No tree returned."); } for ($i = 0; $i < count($nodes); $i++) { $this->stdout(str_repeat(' ', $i) . "[" . $nodes[$i][$class]['id'] . "]" . $nodes[$i][$class]['alias'] . "\n"); } } /** * Enter description here... * */ function grant() { $this->checkArgNumber(3, 'grant'); //add existence checks for nodes involved $aro = $this->args[0]; if(is_numeric($aro)) { $aro = intval($aro); } $aco = $this->args[1]; if(is_numeric($aco)) { $aco = intval($aco); } if($this->Acl->allow($aro, $aco, $this->args[2])) { $this->stdout("Permission granted.\n"); } else { $this->stdout("Permission could not be granted.\n"); } } /** * Enter description here... * */ function deny() { $this->checkArgNumber(3, 'deny'); //add existence checks for nodes involved $aro = (is_numeric($this->args[0])) ? intval($this->args[0]) : $this->args[0]; $aco = (is_numeric($this->args[1])) ? intval($this->args[1]) : $this->args[1]; $aro = $this->args[0]; if(is_numeric($aro)) { $aro = intval($aro); } $aco = $this->args[1]; if(is_numeric($aco)) { $aco = intval($aco); } if($this->Acl->deny($aro, $aco, $this->args[2])) { $this->stdout("Permission denied.\n"); } else { $this->stdout("Permission could not be denied.\n"); } } /** * Enter description here... * */ function inherit() { $this->checkArgNumber(3, 'inherit'); $aro = $this->args[0]; if(is_numeric($aro)) { $aro = intval($aro); } $aco = $this->args[1]; if(is_numeric($aco)) { $aco = intval($aco); } if($this->Acl->inherit($aro, $aco, $this->args[2])) { $this->stdout("Permission inherited.\n"); } else { $this->stdout("Permission could not be inherited.\n"); } } /** * Enter description here... * */ function view() { $this->checkArgNumber(1, 'view'); $this->checkNodeType(); extract($this->__dataVars()); if (!is_null($this->args[1])) { $conditions = $this->Acl->{$class}->_resolveID($this->args[1]); } else { $conditions = null; } $nodes = $this->Acl->{$class}->findAll($conditions, null, 'lft ASC'); if (empty($nodes)) { $this->displayError($this->args[1]." not found", "No tree returned."); } $right = array(); $this->stdout($class . " tree:\n"); $this->stdout("------------------------------------------------\n"); for($i = 0; $i < count($nodes); $i++){ if (count($right) > 0){ while ($right[count($right)-1] < $nodes[$i][$class]['rght']){ if ($right[count($right)-1]){ array_pop($right); } else { break; } } } $this->stdout(str_repeat(' ',count($right)) . "[" . $nodes[$i][$class]['id'] . "]" . $nodes[$i][$class]['alias']."\n"); $right[] = $nodes[$i][$class]['rght']; } $this->stdout("------------------------------------------------\n"); } /** * Enter description here... * */ function initdb() { $db =& ConnectionManager::getDataSource($this->dataSource); $this->stdout("Initializing Database...\n"); $this->stdout("Creating access control objects table (acos)...\n"); $sql = " CREATE TABLE ".$db->fullTableName('acos')." ( ".$db->name('id')." ".$db->column($db->columns['primary_key']).", ".$db->name('object_id')." ".$db->column($db->columns['integer'])." default NULL, ".$db->name('alias')." ".$db->column($db->columns['string'])." NOT NULL default '', ".$db->name('lft')." ".$db->column($db->columns['integer'])." default NULL, ".$db->name('rght')." ".$db->column($db->columns['integer'])." default NULL, PRIMARY KEY (".$db->name('id').") );"; if ($db->query($sql) === false) { die("Error: " . $db->lastError() . "\n\n"); } $this->stdout("Creating access request objects table (aros)...\n"); $sql2 = "CREATE TABLE ".$db->fullTableName('aros')." ( ".$db->name('id')." ".$db->column($db->columns['primary_key']).", ".$db->name('foreign_key')." ".$db->column($db->columns['integer'])." default NULL, ".$db->name('alias')." ".$db->column($db->columns['string'])." NOT NULL default '', ".$db->name('lft')." ".$db->column($db->columns['integer'])." default NULL, ".$db->name('rght')." ".$db->column($db->columns['integer'])." default NULL, PRIMARY KEY (".$db->name('id').") );"; if ($db->query($sql2) === false) { die("Error: " . $db->lastError() . "\n\n"); } $this->stdout("Creating relationships table (aros_acos)...\n"); $sql3 = "CREATE TABLE ".$db->fullTableName('aros_acos')." ( ".$db->name('id')." ".$db->column($db->columns['primary_key']).", ".$db->name('aro_id')." ".$db->column($db->columns['integer'])." default NULL, ".$db->name('aco_id')." ".$db->column($db->columns['integer'])." default NULL, ".$db->name('_create')." ".$db->column($db->columns['integer'])." NOT NULL default '0', ".$db->name('_read')." ".$db->column($db->columns['integer'])." NOT NULL default '0', ".$db->name('_update')." ".$db->column($db->columns['integer'])." NOT NULL default '0', ".$db->name('_delete')." ".$db->column($db->columns['integer'])." NOT NULL default '0', PRIMARY KEY (".$db->name('id').") );"; if ($db->query($sql3) === false) { die("Error: " . $db->lastError() . "\n\n"); } $this->stdout("\nDone.\n"); } /** * Enter description here... * */ function upgradedb() { $db =& ConnectionManager::getDataSource($this->dataSource); $this->stdout("Initializing Database...\n"); $this->stdout("Upgrading table (aros)...\n"); $sql = "ALTER TABLE ".$db->fullTableName('aros')." CHANGE ".$db->name('user_id')." ".$db->name('foreign_key')." INT( 10 ) UNSIGNED NULL DEFAULT NULL;"; $sql .= "ALTER TABLE " . $db->name('aros_acos') . " CHANGE " . $db->name('_create') . " " . $db->name('_create') . " CHAR(2) NOT NULL DEFAULT '0';"; $sql .= "ALTER TABLE " . $db->name('aros_acos') . " CHANGE " . $db->name('_update') . " " . $db->name('_update') . " CHAR(2) NOT NULL DEFAULT '0';"; $sql .= "ALTER TABLE " . $db->name('aros_acos') . " CHANGE " . $db->name('_read') . " " . $db->name('_read') . " CHAR(2) NOT NULL DEFAULT '0';"; $sql .= "ALTER TABLE " . $db->name('aros_acos') . " CHANGE " . $db->name('_delete') . " " . $db->name('_delete') . " CHAR(2) NOT NULL DEFAULT '0';"; if ($db->query($sql) === false) { die("Error: " . $db->lastError() . "\n\n"); } $this->stdout("\nDatabase upgrade is complete.\n"); } /** * Enter description here... * */ function help() { $out = "Usage: php acl.php ...\n"; $out .= "-----------------------------------------------\n"; $out .= "Commands:\n"; $out .= "\n"; $out .= "\tcreate aro|aco \n"; $out .= "\t\tCreates a new ACL object under the parent specified by , an id/alias (see\n"; $out .= "\t\t'view'). The link_id allows you to link a user object to Cake's\n"; $out .= "\t\tACL structures. The alias parameter allows you to address your object\n"; $out .= "\t\tusing a non-integer ID. Example: \"\$php acl.php create aro 57 0 John\"\n"; $out .= "\t\twould create a new ARO object at the root of the tree, linked to 57\n"; $out .= "\t\tin your users table, with an internal alias 'John'."; $out .= "\n"; $out .= "\n"; $out .= "\tdelete aro|aco \n"; $out .= "\t\tDeletes the ACL object with the specified ID (see 'view').\n"; $out .= "\n"; $out .= "\n"; $out .= "\tsetParent aro|aco \n"; $out .= "\t\tUsed to set the parent of the ACL object specified by to the ID\n"; $out .= "\t\tspecified by .\n"; $out .= "\n"; $out .= "\n"; $out .= "\tgetPath aro|aco \n"; $out .= "\t\tReturns the path to the ACL object specified by . This command is\n"; $out .= "\t\tis useful in determining the inhertiance of permissions for a certain\n"; $out .= "\t\tobject in the tree.\n"; $out .= "\n"; $out .= "\n"; $out .= "\tgrant \n"; $out .= "\t\tUse this command to grant ACL permissions. Once executed, the ARO\n"; $out .= "\t\tspecified (and its children, if any) will have ALLOW access to the\n"; $out .= "\t\tspecified ACO action (and the ACO's children, if any).\n"; $out .= "\t\tIf an integer is passed permissions will be granted based on the foreign_key or object_id.\n"; $out .= "\n"; $out .= "\n"; $out .= "\tdeny \n"; $out .= "\t\tUse this command to deny ACL permissions. Once executed, the ARO\n"; $out .= "\t\tspecified (and its children, if any) will have DENY access to the\n"; $out .= "\t\tspecified ACO action (and the ACO's children, if any).\n"; $out .= "\t\tIf an integer is passed permissions will be denied based on the foreign_key or object_id.\n"; $out .= "\n"; $out .= "\n"; $out .= "\tinherit \n"; $out .= "\t\tUse this command to force a child ARO object to inherit its\n"; $out .= "\t\tpermissions settings from its parent.\n"; $out .= "\t\tIf an integer is passed permissions will be inherited based on the foreign_key or object_id.\n"; $out .= "\n"; $out .= "\n"; $out .= "\tview aro|aco [id]\n"; $out .= "\t\tThe view command will return the ARO or ACO tree. The optional\n"; $out .= "\t\tid/alias parameter allows you to return only a portion of the requested\n"; $out .= "\t\ttree.\n"; $out .= "\n"; $out .= "\n"; $out .= "\tinitdb\n"; $out .= "\t\tUse this command to create the database tables needed to use DB ACL.\n"; $out .= "\n"; $out .= "\n"; $out .= "\thelp\n"; $out .= "\t\tDisplays this help message.\n"; $out .= "\n"; $out .= "\n"; $this->stdout($out); } /** * Enter description here... * * @param unknown_type $title * @param unknown_type $msg */ function displayError($title, $msg) { $out = "\n"; $out .= "Error: $title\n"; $out .= "$msg\n"; $out .= "\n"; $this->stdout($out); exit(); } /** * Enter description here... * * @param unknown_type $expectedNum * @param unknown_type $command */ function checkArgNumber($expectedNum, $command) { if (count($this->args) < $expectedNum) { $this->displayError('Wrong number of parameters: '.count($this->args), 'Please type \'php acl.php help\' for help on usage of the '.$command.' command.'); } } /** * Enter description here... * */ function checkNodeType() { if ($this->args[0] != 'aco' && $this->args[0] != 'aro') { $this->displayError("Missing/Unknown node type: '".$this->args[0]."'", 'Please specify which ACL object type you wish to create.'); } } /** * Enter description here... * * @param unknown_type $type * @param unknown_type $id * @return unknown */ function nodeExists($type, $id) { //$this->stdout("Check to see if $type with ID = $id exists...\n"); extract($this->__dataVars($type)); $conditions = $this->Acl->{$class}->_resolveID($id); $possibility = $this->Acl->{$class}->findAll($conditions); return $possibility; } /** * Enter description here... * * @param unknown_type $type * @return unknown */ function __dataVars($type = null) { if ($type == null) { $type = $this->args[0]; } $vars = array(); $class = ucwords($type); $vars['secondary_id'] = ($class == 'aro' ? 'foreign_key' : 'object_id'); $vars['data_name'] = $type; $vars['table_name'] = $type . 's'; $vars['class'] = $class; return $vars; } /** * Database configuration setup. * */ function doDbConfig() { $this->hr(); $this->stdout('Database Configuration:'); $this->hr(); $driver = ''; while ($driver == '') { $driver = $this->getInput('What database driver would you like to use?', array('mysql','mysqli','mssql','sqlite','postgres', 'odbc'), 'mysql'); if ($driver == '') { $this->stdout('The database driver supplied was empty. Please supply a database driver.'); } } switch($driver) { case 'mysql': $connect = 'mysql_connect'; break; case 'mysqli': $connect = 'mysqli_connect'; break; case 'mssql': $connect = 'mssql_connect'; break; case 'sqlite': $connect = 'sqlite_open'; break; case 'postgres': $connect = 'pg_connect'; break; case 'odbc': $connect = 'odbc_connect'; break; default: $this->stdout('The connection parameter could not be set.'); break; } $host = ''; while ($host == '') { $host = $this->getInput('What is the hostname for the database server?', null, 'localhost'); if ($host == '') { $this->stdout('The host name you supplied was empty. Please supply a hostname.'); } } $login = ''; while ($login == '') { $login = $this->getInput('What is the database username?', null, 'root'); if ($login == '') { $this->stdout('The database username you supplied was empty. Please try again.'); } } $password = ''; $blankPassword = false; while ($password == '' && $blankPassword == false) { $password = $this->getInput('What is the database password?'); if ($password == '') { $blank = $this->getInput('The password you supplied was empty. Use an empty password?', array('y', 'n'), 'n'); if($blank == 'y') { $blankPassword = true; } } } $database = ''; while ($database == '') { $database = $this->getInput('What is the name of the database you will be using?', null, 'cake'); if ($database == '') { $this->stdout('The database name you supplied was empty. Please try again.'); } } $prefix = ''; while ($prefix == '') { $prefix = $this->getInput('Enter a table prefix?', null, 'n'); } if(low($prefix) == 'n') { $prefix = ''; } $this->stdout(''); $this->hr(); $this->stdout('The following database configuration will be created:'); $this->hr(); $this->stdout("Driver: $driver"); $this->stdout("Connection: $connect"); $this->stdout("Host: $host"); $this->stdout("User: $login"); $this->stdout("Pass: " . str_repeat('*', strlen($password))); $this->stdout("Database: $database"); $this->stdout("Table prefix: $prefix"); $this->hr(); $looksGood = $this->getInput('Look okay?', array('y', 'n'), 'y'); if (low($looksGood) == 'y' || low($looksGood) == 'yes') { $this->bakeDbConfig($driver, $connect, $host, $login, $password, $database, $prefix); } else { $this->stdout('Bake Aborted.'); } } /** * Creates a database configuration file for Bake. * * @param string $host * @param string $login * @param string $password * @param string $database */ function bakeDbConfig( $driver, $connect, $host, $login, $password, $database, $prefix) { $out = " '{$driver}',\n"; $out .= "\t\t'connect' => '{$connect}',\n"; $out .= "\t\t'host' => '{$host}',\n"; $out .= "\t\t'login' => '{$login}',\n"; $out .= "\t\t'password' => '{$password}',\n"; $out .= "\t\t'database' => '{$database}', \n"; $out .= "\t\t'prefix' => '{$prefix}' \n"; $out .= "\t);\n"; $out .= "}\n"; $out .= "?>"; $filename = CONFIGS.'database.php'; $this->__createFile($filename, $out); } /** * Prompts the user for input, and returns it. * * @param string $prompt Prompt text. * @param mixed $options Array or string of options. * @param string $default Default input value. * @return Either the default value, or the user-provided input. */ function getInput($prompt, $options = null, $default = null) { if (!is_array($options)) { $print_options = ''; } else { $print_options = '(' . implode('/', $options) . ')'; } if($default == null) { $this->stdout(''); $this->stdout($prompt . " $print_options \n" . '> ', false); } else { $this->stdout(''); $this->stdout($prompt . " $print_options \n" . "[$default] > ", false); } $result = trim(fgets($this->stdin)); if($default != null && empty($result)) { return $default; } else { return $result; } } /** * Outputs to the stdout filehandle. * * @param string $string String to output. * @param boolean $newline If true, the outputs gets an added newline. */ function stdout($string, $newline = true) { if ($newline) { fwrite($this->stdout, $string . "\n"); } else { fwrite($this->stdout, $string); } } /** * Outputs to the stderr filehandle. * * @param string $string Error text to output. */ function stderr($string) { fwrite($this->stderr, $string); } /** * Outputs a series of minus characters to the standard output, acts as a visual separator. * */ function hr() { $this->stdout('---------------------------------------------------------------'); } /** * Creates a file at given path. * * @param string $path Where to put the file. * @param string $contents Content to put in the file. * @return Success */ function __createFile ($path, $contents) { $path = str_replace('//', '/', $path); echo "\nCreating file $path\n"; if (is_file($path) && $this->interactive === true) { fwrite($this->stdout, "File exists, overwrite?" . " {$path} (y/n/q):"); $key = trim(fgets($this->stdin)); if ($key=='q') { fwrite($this->stdout, "Quitting.\n"); exit; } elseif ($key == 'a') { $this->dont_ask = true; } elseif ($key == 'y') { } else { fwrite($this->stdout, "Skip" . " {$path}\n"); return false; } } if ($f = fopen($path, 'w')) { fwrite($f, $contents); fclose($f); fwrite($this->stdout, "Wrote" . "{$path}\n"); return true; } else { fwrite($this->stderr, "Error! Could not write to" . " {$path}.\n"); return false; } } } ?>