Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

directory_view.php 214KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858
  1. <?php
  2. /*
  3. Author : David Wan
  4. Contact : inventordavid AT yahoo.com
  5. david AT simpledirectorylisting.net
  6. Application Name : Simple Directory Listing
  7. Version : 2.1 beta
  8. Last Modified : 2008-08-02
  9. License : GNU GENERAL PUBLIC LICENSE Version 3
  10. Web Site : http://simpledirectorylisting.net/
  11. http://sourceforge.net/projects/simpledirectory/
  12. Copyright. All rights reserved.
  13. */
  14. ?>
  15. <?php
  16. //------------------------------------------------------------------------------
  17. // CONFIG
  18. //------------------------------------------------------------------------------
  19. // added in 2.1;
  20. // Service can be shuted down by setting it to false.(true or false)
  21. define("SYSTEM_ON" , true);
  22. // added in 2.0;
  23. // Admin mode can be shuted down by setting it to false.(true or false)
  24. define("ADMIN_MODE_ON" , true);
  25. // added in 2.0;
  26. // To allow access to public, set it to false.(true or false)
  27. define("ADMIN_MODE_NEEDS_LOGIN" , true);
  28. // added in 2.0;
  29. // Login Name(a string)
  30. define("ADMIN_MODE_LOGIN_NAME" , "admin");
  31. // added in 2.0;
  32. // Password encoded in sha1 format(a string) or raw password
  33. define("ADMIN_MODE_PASSWORD" , "password");
  34. // added in 2.0; removed in 2.1, see PASSWORD_FORMAT;
  35. // "RAW", "SHA1"
  36. //define("ADMIN_MODE_PASSWORD_FORMAT" , "RAW");
  37. // added in 2.0;
  38. // "CUSTOM_ROOT", "CURRENT_WORKING_DIR", "DOCUMENT_ROOT" or "SERVER_ROOT"
  39. define("ADMIN_MODE_VIRTUAL_ROOT" , "DOCUMENT_ROOT");
  40. // added in 2.0;
  41. // An absolute path or null(a string or null)
  42. define("ADMIN_MODE_CUSTOM_VIRTUAL_ROOT" , null);
  43. // added in 2.0;
  44. // A relative path or null(a string or null)
  45. define("ADMIN_MODE_PERMITTED_DIR" , null);
  46. // added in 2.1;
  47. // User mode can be shuted down by setting it to false.(true or false)
  48. define("USER_MODE_ON" , true);
  49. // added in 2.1;
  50. // To allow access to public, set it to false.(true or false)
  51. define("USER_MODE_NEEDS_LOGIN" , false);
  52. // added in 2.1;
  53. // Login Name(a string)
  54. define("USER_MODE_LOGIN_NAME" , "user");
  55. // added in 2.1;
  56. // Password encoded in sha1 format(a string) or raw password
  57. define("USER_MODE_PASSWORD" , "password");
  58. // added in 2.1;
  59. // "CUSTOM_ROOT", "CURRENT_WORKING_DIR", "DOCUMENT_ROOT" or "SERVER_ROOT"
  60. define("USER_MODE_VIRTUAL_ROOT" , "DOCUMENT_ROOT");
  61. // added in 2.1;
  62. // An absolute path or null(a string or null)
  63. define("USER_MODE_CUSTOM_VIRTUAL_ROOT" , null);
  64. // added in 2.1;
  65. // A relative path or null(a string or null)
  66. define("USER_MODE_PERMITTED_DIR" , null);
  67. // added in 2.0;
  68. // Font size in pixel(a number)
  69. define("FONT_SIZE" , 15);
  70. // added in 2.0;
  71. // Enable/Disable Icon(true or false)
  72. define("ICON_ON" , true);
  73. // added in 2.0;
  74. // Enable/Disable Image(true or false)
  75. define("IMAGE_PASSTHRU_ON" , true);
  76. // added in 2.0;
  77. // "AUTO", "PASSTHRU_ONLY", "URL_ONLY"
  78. define("IMAGE_LOAD_TYPE" , "AUTO");
  79. // added in 2.0;
  80. // Language class(the name of a locale class)
  81. define("LOCALE_CLASS" , "LocaleEnglishUS");
  82. // added in 2.0;
  83. // For OS that doesn't use utf-8 as internal encoding method(a string)
  84. define("OS_ENCODING" , null);
  85. // added in 2.1;
  86. // "RAW", "SHA1"
  87. define("PASSWORD_FORMAT" , "RAW");
  88. // added in 2.0;
  89. // Enable/Disable RSS(true or false)
  90. define("RSS_ON" , true);
  91. // added in 2.0;
  92. // Enable/Disable SFS(true or false)
  93. define("SFS_ON" , true);
  94. // added in 2.0;
  95. // Theme class(the name of a theme class)
  96. define("THEME_CLASS" , "ThemeApache");
  97. // added in 2.0;
  98. // Enable/Disable thumbnail view(true or false)
  99. define("THUMBNAIL_ON" , true);
  100. // added in 2.0;
  101. // Pixel width in pixel(a number)
  102. define("THUMBNAIL_SIZE" , 120);
  103. // added in 2.0;
  104. // Name of your web site(a string)
  105. define("META_WEB_SITE_NAME" , "My Web Site");
  106. //------------------------------------------------------------------------------
  107. // ADVANCED CONFIG
  108. //------------------------------------------------------------------------------
  109. // added in 2.0;
  110. // Enable/Disable 'remember me'(true or false)
  111. define("SAVE_LOGIN_ON" , false);
  112. // added in 2.0;
  113. // Dependent on SAVE_LOGIN_ON(in minute)
  114. define("SESSION_CACHE_EXPIRE" , 1440);
  115. // added in 2.0;
  116. // php ini(string)
  117. define("SESSION_SAVE_PATH" , null);
  118. // added in 2.0;
  119. // php ini(in secons)
  120. define("SESSION_GC_MAXLIFETIME" , null);
  121. // added in 2.1;
  122. // The size(no. of chars) of an incorrect XML response.(an integer)
  123. define("DEBUG_XML_RESPONSE_LENGTH" , 200);
  124. // added in 2.1;
  125. // Sets which PHP errors are reported. (null for using the value in php.ini)
  126. define("DEBUG_ERROR_REPORTING_LEVEL" , E_ALL ^ E_NOTICE);
  127. // added in 2.1;
  128. // Enable/disable FTP Layer for admin/readonly mode
  129. define("FTP_LAYER_ON" , false);
  130. // added in 2.1;
  131. // The FTP server address
  132. define("FTP_LAYER_HOST" , "localhost");
  133. // added in 2.1;
  134. // The FTP PORT
  135. define("FTP_LAYER_PORT" , 21);
  136. // added in 2.1;
  137. // The username of the FTP account
  138. // SECURITY WARNING: Do no use the FTP account of "root" on your server
  139. // SECURITY WARNING: Do not use FTP layer for production use
  140. define("FTP_LAYER_USERNAME" , "username");
  141. // added in 2.1;
  142. // The password of the FTP account
  143. // SECURITY WARNING: Do no use the FTP account of "root" on your server
  144. // SECURITY WARNING: Do not use FTP layer for production use
  145. define("FTP_LAYER_PASSWORD" , "password");
  146. // added in 2.1;
  147. // Enable/diable secure SSL-FTP connection
  148. define("FTP_LAYER_SSL_ON" , false);
  149. // added in 2.1;
  150. // The absolute path of the home of the FTP account.
  151. define("FTP_LAYER_PATH_ON_SERVER" , "/home/username/");
  152. ?>
  153. <?php
  154. //------------------------------------------------------------------------------
  155. // Class name : Browser
  156. //------------------------------------------------------------------------------
  157. class Browser {
  158. var $cwd;
  159. var $cwdRelPath; // for non-js
  160. var $fileManager;
  161. var $moduleManager;
  162. var $view;
  163. function getFilesViewList($files, $isJavascript) {
  164. $html = null;
  165. if (count($files) === 0) {
  166. $html .= "<center>" . text("NO FILES") . "</center>";
  167. } else {
  168. $html .= "<table class='browserFilesViewList' id='browserFiles'><tbody>";
  169. foreach ($files as $fileIndex => $file) {
  170. if ($file->absPath !== $_SERVER['SCRIPT_FILENAME']) {
  171. $html .= "<tr class='fileViewList' id='$fileIndex'>";
  172. $html .= "<td class='systemAttribute'><div id='systemFilename_$fileIndex'>{$file->basename}</div></td>";
  173. $html .= "<td class='systemAttribute'><div id='systemRelPath_$fileIndex'>{$file->relPath}</div></td>";
  174. $html .= "<td class='systemAttribute'><div id='systemUrl_$fileIndex'>{$file->url}</div></td>";
  175. $html .= "<td class='systemAttribute'><div id='systemIsDir_$fileIndex'>{$file->isDir}</div></td>";
  176. foreach ($this->moduleManager->attributes as $attribute) {
  177. $html .= "<td>" . $attribute->getHtml($file, $fileIndex, $this->view, $isJavascript) . "</td>";
  178. }
  179. $html .= "<td class='browserCellFiller'></td>";
  180. $html .= "</tr>";
  181. }
  182. }
  183. $html .= "</tbody></table>";
  184. }
  185. return $html;
  186. }
  187. function getFilesViewThumbnail($files, $isJavascript) {
  188. $html = null;
  189. if (count($files) === 0) {
  190. $html .= "<center>" . text("NO FILES") . "</center>";
  191. } else {
  192. $html .= "<div class='browserFilesViewThumbnail' id='browserFiles'>";
  193. foreach ($files as $fileIndex=>$file) {
  194. if ($file->absPath !== $_SERVER['SCRIPT_FILENAME']) {
  195. $html .= "<div class='fileViewThumbnail' id='$fileIndex'>";
  196. $html .= "<div class='thumbnailItemContainer'>";
  197. $html .= "<div class='systemAttribute' id='systemFilename_$fileIndex'>{$file->basename}</div>";
  198. $html .= "<div class='systemAttribute' id='systemRelPath_$fileIndex'>{$file->relPath}</div>";
  199. $html .= "<div class='systemAttribute' id='systemUrl_$fileIndex'>{$file->url}</div>";
  200. $html .= "<div class='systemAttribute' id='systemIsDir_$fileIndex'>{$file->isDir}</div>";
  201. if ($file->isDir) {
  202. $html .= "<div class='thumbnailItemImageContainer' title='$file->basename'>" .
  203. "<a href='?cwdRelPath={$file->relPath}&view=$this->view' onclick='Sdl.browser.onClickThumbnailRedirect(event, \"$file->relPath\"); return false;'>" .
  204. "<img alt='<" . text("DIR") . ">' class='thumbnailItemImageDir' onload='Sdl.Image.position(this);' src='?print=icon&icon=dir'> </a></div>";
  205. } else {
  206. $ext = strtolower($file->extension);
  207. if ($ext === "gif" || $ext === "jpg" || $ext === "jpeg" || $ext === "png" || $ext === "wbmp") {
  208. If (IMAGE_LOAD_TYPE === "AUTO") {
  209. if ($file->url) {$href = "url";}
  210. else {$href = "passthru";}
  211. } else if (IMAGE_LOAD_TYPE === "PASSTHRU_ONLY") {
  212. $href = "passthru";
  213. } else { // URL_ONLY
  214. if ($file->url) {$href = "url";}
  215. else {$href = "";}
  216. }
  217. $img = "<img alt='<" . text("IMG") . ">' onload='Sdl.Image.position(this);' src='?print=thumbnail&relPath=$file->relPath'>";
  218. } else {
  219. If (IMAGE_LOAD_TYPE === "AUTO") {
  220. if ($file->url) {$href = "url";}
  221. else {$href = "passthru";}
  222. } else if (IMAGE_LOAD_TYPE === "PASSTHRU_ONLY") {
  223. $href = "passthru";
  224. } else { // URL_ONLY
  225. if ($file->url) {$href = "url";}
  226. else {$href .= "";}
  227. }
  228. $img = "<img alt='<" . text("UNKNOWN") . ">' class='thumbnailItemImageUnknown' onload='Sdl.Image.position(this);' src='?print=icon&icon=unknown'>";
  229. }
  230. if ($href === "passthru") {
  231. if (IMAGE_PASSTHRU_ON) {$href = "href='?print=image&relPath=$file->relPath' onclick='Sdl.image.onClickShowByRelPath(event, \"$file->relPath\"); return false;'";}
  232. else {$href = "";}
  233. } else if ($href === "url") {
  234. $href = "href='$file->url' onclick='Sdl.image.onClickShowByUrl(event, \"$file->url\"); return false;'";
  235. }
  236. $html .= "<div class='thumbnailItemImageContainer' title='$file->basename'><a $href>$img </a></div>";
  237. }
  238. foreach ($this->moduleManager->attributes as $attribute) {
  239. $html .= "<div>" . $attribute->getHtml($file, $fileIndex, $this->view, $isJavascript) . "</div>";
  240. }
  241. $html .= "</div>";
  242. $html .= "</div>";
  243. }
  244. }
  245. $html .= "</div>";
  246. // For IE6
  247. // For Opera 9.21. Functions would flow through thumbnail view otherwise.
  248. $html .= "<div style='clear:both'></div>";
  249. }
  250. return $html;
  251. }
  252. function getFunctions() {
  253. $html = null;
  254. if (count($this->moduleManager->functions) > 0) {
  255. foreach ($this->moduleManager->functions as $function) {
  256. //$function->fileManager = $this->fileManager;
  257. //$function->moduleManager = $this->moduleManager;
  258. $html .= "<div class='function'>" . $function->getHtml($this->cwdRelPath, $this->view) . "</div>";
  259. }
  260. }
  261. // For IE6
  262. // For Opera 9.21 though this part hasn't shown any problem yet.
  263. $html .= "<div style='clear:both'></div>";
  264. return $html;
  265. }
  266. function getHeader() {
  267. $html = null;
  268. $html .= "<table id='browserHeaders'><tbody><tr>";
  269. $html .= "<td class='systemAttribute'><div>systemFilename</div></td>";
  270. $html .= "<td class='systemAttribute'><div>systemRelPath</div></td>";
  271. $html .= "<td class='systemAttribute'><div>systemUrl</div></td>";
  272. $html .= "<td class='systemAttribute'><div>systemIsDir</div></td>";
  273. foreach ($this->moduleManager->attributes as $attribute) {
  274. $html .= "<td>" . $attribute->getHeader() . "</td>";
  275. }
  276. $html .= "<td class='browserCellFiller'><div class='browserScrollBarFiller'></div></td>";
  277. $html .= "</tr></tbody></table>";
  278. return $html;
  279. }
  280. function getHtml() {
  281. if (isset($_GET["cwdRelPath"])) {$this->cwdRelPath = $_GET["cwdRelPath"];}
  282. else {$this->cwdRelPath = $this->user->permittedDirRelPath;}
  283. if ($_GET["view"] === "list" || $_GET["view"] === "thumbnail") {$this->view = $_GET["view"];}
  284. else {$this->view = "list";}
  285. $functions = $this->getFunctions();
  286. $header = $this->getHeader();
  287. $systemFiles = $this->getSystemFiles();
  288. $files = $this->getDirListing();
  289. if (!$functions) {$separator2Display = "display:none;";}
  290. $html = null;
  291. $html .=
  292. "
  293. <div id='browserContainer'>
  294. <div id='browser'>
  295. <div id='browserDirListingContainer'>
  296. <div id='browserDirListing'>
  297. <div id='browserHeadersContainer'>
  298. $header
  299. <div id='browserHeadersMovableBar'></div>
  300. </div>
  301. <div id='broswerSeparator1Container'>
  302. <div id='broswerSeparator1'><hr/></div>
  303. <div id='broswerSeparator1MovableBar'></div>
  304. </div>
  305. <div id='browserSystemFilesContainer'>
  306. $systemFiles
  307. <div id='browserSystemFilesMovableBar'></div>
  308. </div>
  309. <div id='browserFilesContainer'>
  310. <div id='browserFilesDiv'><noscript>$files</noscript></div>
  311. <div id='browserFilesMovableBar'></div>
  312. </div>
  313. </div>
  314. <div id='browserDirListingMovableBar'></div>
  315. </div>
  316. <div id='broswerSeparator2Container'>
  317. <div id='broswerSeparator2' style='$separator2Display'><hr/></div>
  318. <div id='broswerSeparator2MovableBar'></div>
  319. </div>
  320. <div id='browserFunctionsContainer'>
  321. <div id='browserFunctions'>$functions</div>
  322. <div id='browserFunctionsMovableBar'></div>
  323. </div>
  324. <div id='broswerSeparator3Container'>
  325. <div id='broswerSeparator3'><hr/></div>
  326. <div id='broswerSeparator3MovableBar'></div>
  327. </div>
  328. </div>
  329. <div id='browserMovableBar'></div>
  330. </div>
  331. ";
  332. return $html;
  333. }
  334. function getSystemFiles() {
  335. $parentCwdRelPath = dirname($this->cwdRelPath);
  336. if ($parentCwdRelPath === ".") $parentCwdRelPath = "";
  337. $html = null;
  338. $html .= "<table id='browserSystemFiles'><tbody>";
  339. $html .= "<tr id='..' file >";
  340. $html .= "<td class='systemAttribute'><div id='systemFilename_..'></div></td>";
  341. $html .= "<td class='systemAttribute'><div id='systemRelPath_..'></div></td>";
  342. $html .= "<td class='systemAttribute'><div id='systemUrl_..'></div></td>";
  343. $html .= "<td class='systemAttribute'><div id='systemIsDir_..'></div></td>";
  344. foreach ($this->moduleManager->attributes as $attribute) {
  345. $html .= "<td>" . $attribute->getHtmlParentDirectory($parentCwdRelPath, $this->view) . "</td>";
  346. }
  347. $html .= "<td class='browserCellFiller'></td>";
  348. $html .= "</tr></tbody></table>";
  349. return $html;
  350. }
  351. // for noscript
  352. // set cwdRelPath to permittedDir if it is not set
  353. function getDirListing() {
  354. $this->cwd = $this->fileManager->getFileByRelPath($this->cwdRelPath);
  355. if ($this->cwd) {
  356. if ($this->cwd->isDir) {
  357. if ($this->cwd->isPermitted) {
  358. $files = $this->fileManager->getFilesByDir($this->cwd->absPath);
  359. $html = null;
  360. if ($this->view === "list") {
  361. $html .= $this->getFilesViewList($files, false);
  362. } else if ($this->view === "thumbnail") {
  363. if (THUMBNAIL_ON) {$html .= $this->getFilesViewThumbnail($files, false);}
  364. else {$html .= "<center>" . text("THUMBNAIL VIEW IS DISABLED.") . "</center>";}
  365. }
  366. } else {
  367. $html .= "<center>" . text("ACCESS DENIED") . "</center>";
  368. }
  369. } else {
  370. $html .= "<center>" . text("ACCESS DENIED") . "</center>";
  371. }
  372. } else {
  373. $html .= "<center>" . text("ACCESS DENIED") . "</center>";
  374. }
  375. return $html;
  376. }
  377. // show error if $_GET["cwdRelPath"] is not set
  378. function printDirListing($cwdRelPath) {
  379. $xml = new Xml();
  380. if (isset($cwdRelPath)) {
  381. $this->cwd = $this->fileManager->getFileByRelPath($cwdRelPath);
  382. if ($this->cwd) {
  383. if ($this->cwd->isDir) {
  384. if ($this->cwd->isPermitted) {
  385. $files = $this->fileManager->getFilesByDir($this->cwd->absPath);
  386. if ($_GET["view"] === "list" || $_GET["view"] === "thumbnail") {$this->view = $_GET["view"];}
  387. else {$this->view = "list";}
  388. $html = null;
  389. if ($this->view === "list") {
  390. $html .= $this->getFilesViewList($files, true);
  391. $xml->setStatusSuccess();
  392. $xml->setContent($html);
  393. } else if ($this->view === "thumbnail") {
  394. //if (THUMBNAIL_ON) {
  395. if (true) {
  396. $html .= $this->getFilesViewThumbnail($files, true);
  397. $xml->setStatusSuccess();
  398. $xml->setContent($html);
  399. } else {
  400. $xml->setError(text("THUMBNAIL VIEW IS DISABLED."));
  401. }
  402. }
  403. } else {
  404. $xml->setError(text("ACCESS DENIED"));
  405. }
  406. } else {
  407. $xml->setError(text("ACCESS DENIED")); //Do not output relevant information.
  408. }
  409. } else {
  410. $xml->setError(text("ACCESS DENIED")); //Do not output relevant information.
  411. }
  412. } else {
  413. $xml->setError(text("ACCESS DENIED"));
  414. }
  415. $xml->dump();
  416. }
  417. function printFiles() {
  418. echo $this->getFiles();
  419. }
  420. }
  421. ?>
  422. <?php
  423. //------------------------------------------------------------------------------
  424. // Class name : File
  425. //------------------------------------------------------------------------------
  426. class File {
  427. //
  428. var $absPath;
  429. var $basename;
  430. var $dirAbsPath; // Only for regular files
  431. var $dirRelPath; // Only for regular files
  432. var $extension; // Only for regular files
  433. var $filename; // Only for regular files
  434. var $isDir;
  435. var $isPermitted;
  436. var $isWithinDocumentRoot;
  437. var $relPath;
  438. var $uri;
  439. var $url;
  440. // Encoded in OS encoding method
  441. var $absPathEn;
  442. var $basenameEn;
  443. var $dirAbsPathEn; // Only for regular files
  444. var $dirRelPathEn; // Only for regular files
  445. var $extensionEn; // Only for regular files
  446. var $filenameEn; // Only for regular files
  447. var $relPathEn;
  448. var $uriEn;
  449. var $urlEn;
  450. }
  451. ?>
  452. <?php
  453. //------------------------------------------------------------------------------
  454. // Class name : FileManager
  455. //------------------------------------------------------------------------------
  456. // added in 2.0
  457. class FileManager {
  458. var $user;
  459. function absPathToRelPath($absPath) {
  460. $len = strlen($this->user->virtualRootAbsPath);
  461. if ($len === strlen($absPath)) return "";
  462. else return substr($absPath, $len);
  463. }
  464. function addEndingSlash($absDir) {
  465. if (strlen($absDir) === 0) return "";
  466. else {
  467. $lastchar = substr($absDir, -1);
  468. if ($lastchar !== "/" && $lastchar !== "\\") $absDir .= "/";
  469. return $absDir;
  470. }
  471. }
  472. function changeSlashes($absPath) {
  473. return str_replace("\\", "/", $absPath);
  474. }
  475. function getDir($absPath) {
  476. $dirAbsPath = dirname($absPath);
  477. $dirAbsPath = FileManager::changeSlashes($dirAbsPath);
  478. return FileManager::addEndingSlash($dirAbsPath);
  479. }
  480. // A file at $absPath must exist.
  481. function getFile($absPath) {
  482. $absPath = realpath($absPath); // to strip ending / if it exists
  483. $absPath = $this->changeSlashes($absPath);
  484. $file = new File;
  485. $file->isDir = is_dir($absPath);
  486. $path_parts = pathinfo($absPath);
  487. $file->basename = $path_parts["basename"];
  488. if (is_dir($absPath)) {
  489. $file->absPath = $this->addEndingSlash($absPath);
  490. $file->relPath = $this->absPathToRelPath($file->absPath);
  491. } else {
  492. $file->absPath = $absPath;
  493. $file->relPath = $this->absPathToRelPath($absPath);
  494. $file->filename = $path_parts["filename"];
  495. $file->extension = $path_parts["extension"];
  496. }
  497. $file->dirAbsPath = $this->getDir($file->absPath);
  498. $file->dirRelPath = $this->absPathToRelPath($file->dirAbsPath);
  499. $file->uri = $this->getUri($file->absPath);
  500. $file->url = $this->getUrl($file->absPath);
  501. $file->isWithinDocumentRoot = $this->isWithinDocumentRoot($file->absPath);
  502. $file->isPermitted = $this->isPermitted($file->absPath);
  503. $file->absPathEn = Text::convertEncodingToUtf8($file->absPath);
  504. $file->basenameEn = Text::convertEncodingToUtf8($file->basename);
  505. $file->dirAbsPathEn = Text::convertEncodingToUtf8($file->dirAbsPath);
  506. $file->dirRelPathEn = Text::convertEncodingToUtf8($file->dirRelPath);
  507. $file->extensionEn = Text::convertEncodingToUtf8($file->extension);
  508. $file->filenameEn = Text::convertEncodingToUtf8($file->filename);
  509. $file->relPathEn = Text::convertEncodingToUtf8($file->relPath);
  510. $file->uriEn = Text::convertEncodingToUtf8($file->uri);
  511. $file->urlEn = Text::convertEncodingToUtf8($file->url);
  512. return $file;
  513. }
  514. function getFileByRelPath($relPath) {
  515. $absPath = $this->relPathToAbsPath($relPath);
  516. if ($absPath) return $this->getFile($absPath);
  517. else return false;
  518. }
  519. function getFilesByDir($cwdAbsPath) {
  520. $files = array();
  521. $dirHandle = opendir($cwdAbsPath);
  522. # When there is no permission to browse the directory
  523. if ($dirHandle === false) {
  524. return false;
  525. # When there is permission to browse the directory
  526. } else {
  527. while($basename = readdir($dirHandle)) {
  528. if (!($basename === "." || $basename === "..")) $files[] = $this->getFile($cwdAbsPath . $basename);
  529. }
  530. }
  531. closedir($dirHandle);
  532. usort($files, array("FileManager", "sortFilesCmp"));
  533. return $files;
  534. }
  535. function getParentDir($dirAbsPath) {
  536. $parentDirAbsPath = dirname($dirAbsPath);
  537. $parentDirAbsPath = FileManager::changeSlashes($parentDirAbsPath);
  538. return FileManager::addEndingSlash($parentDirAbsPath);
  539. }
  540. function getUri($absPath) {
  541. if (FileManager::isWithinDocumentRoot($absPath)) {
  542. // Some OS's add an ending slash to paths of directories
  543. $docRoot = FileManager::addEndingSlash(FileManager::changeSlashes($_SERVER['DOCUMENT_ROOT']));
  544. if (strlen($absPath) === strlen($docRoot)) return "";
  545. else return substr($absPath, strlen($docRoot));
  546. }
  547. return false;
  548. }
  549. // edited in 2.1
  550. function getUrl($absPath) {
  551. $uri = FileManager::getUri($absPath);
  552. if ($_SERVER["SERVER_PORT"] !== "80") $port = ":" . $_SERVER["SERVER_PORT"];
  553. else $port = null;
  554. if ($_SERVER["HTTPS"]) $protocal = "https";
  555. else $protocal = "http";
  556. if ($uri !== false) return $protocal . "://" . $_SERVER["SERVER_NAME"] . $port . "/" . $uri;
  557. return false;
  558. }
  559. function isPermitted($absPath) {
  560. if (strpos($absPath, $this->user->permittedDirAbsPath) === 0) return true;
  561. return false;
  562. }
  563. function isRelPathExist($relPath) {
  564. $absPath = realpath($this->user->virtualRootAbsPath . $relPath);
  565. str_replace("\\", "/", $absPath);
  566. return (file_exists($absPath));
  567. }
  568. function isWithinDocumentRoot($absPath) {
  569. // Some OS's add an ending slash to paths of directories
  570. $docRoot = FileManager::addEndingSlash(FileManager::changeSlashes($_SERVER['DOCUMENT_ROOT']));
  571. if (strpos($absPath, $docRoot) === 0) return true;
  572. else return false;
  573. }
  574. function relPathToAbsPath($relPath) {
  575. $absPath = realpath($this->user->virtualRootAbsPath . $relPath);
  576. $absPath = FileManager::changeSlashes($absPath);
  577. if ($absPath) {
  578. if (is_dir($absPath)) return FileManager::addEndingSlash($absPath);
  579. else return $absPath;
  580. } else {
  581. return false;
  582. }
  583. }
  584. function relPathsToAbsPaths($relPaths) {
  585. $absPaths = array();
  586. foreach ($relPaths as $relPath) {
  587. $absPath = $this->relPathToAbsPath($relPath);
  588. $absPaths[$relPath] = $absPath;
  589. }
  590. return $absPaths;
  591. }
  592. // 2007-12-26
  593. function removeBeginningSlash($relPath) {
  594. return ltrim($relPath, "/\\");
  595. }
  596. function removeDoubleDots($absPath) {
  597. return str_replace("..", "", $absPath);
  598. }
  599. function sortFiles($files) {
  600. usort($files, array("FileManager", "sortFilesCmp"));
  601. }
  602. function sortFilesCmp($file1, $file2) {
  603. $basename1 = strtolower($file1->basename);
  604. $basename2 = strtolower($file2->basename);
  605. //$basename1 = $file1->basename;
  606. //$basename2 = $file2->basename;
  607. if ($basename1 == $basename2) return 0;
  608. return ($basename1 < $basename2) ? -1 : 1;
  609. }
  610. }
  611. ?>
  612. <?php
  613. //------------------------------------------------------------------------------
  614. // Class name : Ftp
  615. //------------------------------------------------------------------------------
  616. // added in 2.1
  617. class Ftp {
  618. var $connId = null;
  619. var $password = FTP_LAYER_PASSWORD;
  620. var $path = FTP_LAYER_PATH_ON_SERVER;
  621. var $port = FTP_LAYER_PORT;
  622. var $server = FTP_LAYER_HOST;
  623. var $ssl = FTP_LAYER_SSL_ON;
  624. var $timeout = 60;
  625. var $username = FTP_LAYER_USERNAME;
  626. function Ftp() {
  627. $this->path = FileManager::changeSlashes($this->path);
  628. $this->path = FileManager::addEndingSlash($this->path);
  629. }
  630. function absPathToFtpAbsPath($absPath) {
  631. if ($this->isWithinFtpRoot($absPath)) {
  632. $len = strlen($this->path);
  633. if ($len === strlen($absPath)) return "/";
  634. else return "/" . substr($absPath, $len);
  635. } else {
  636. return false;
  637. }
  638. }
  639. function chdir($absPath) {
  640. $this->connect();
  641. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  642. if ($ftpAbsPath !== false) {
  643. return ftp_chdir($this->getConnId(), $ftpAbsPath);
  644. }
  645. }
  646. // PHP 5 or above only
  647. function chmod($absPath, $mode) {
  648. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  649. if ($ftpAbsPath !== false) {
  650. if (!function_exists("ftp_chmod")) {
  651. return -1;
  652. }
  653. // ftp_chmod may not work on Windows. PHP 5 shows warning on Windows.
  654. return ftp_chmod($this->getConnId(), $mode, $ftpAbsPath);
  655. }
  656. return false;
  657. }
  658. function connect() {
  659. if (!$this->connId) {
  660. // set up basic connection
  661. if ($this->ssl) {
  662. $this->connId = @ftp_ssl_connect($this->server, $this->port, $this->timeout);
  663. } else {
  664. $this->connId = @ftp_connect($this->server, $this->port, $this->timeout);
  665. }
  666. if (!$this->connId) die("Cannot connect to FTP server");
  667. // login with username and password
  668. $loginResult = @ftp_login($this->connId, $this->username, $this->password);
  669. if (!$loginResult) die("Cannot login to FTP server");
  670. }
  671. return true;
  672. }
  673. function copy($srcAbsPath, $desAbsPath) {
  674. $ftpSrcAbsPath = $this->absPathToFtpAbsPath($srcAbsPath);
  675. $ftpDesAbsPath = $this->absPathToFtpAbsPath($desAbsPath);
  676. if ($ftpSrcAbsPath !== false && $ftpDesAbsPath !== false) {
  677. $result = false;
  678. $temp = tmpfile();
  679. if (ftp_fget($this->getConnId(), $temp, $ftpSrcAbsPath, FTP_BINARY, 0)) {
  680. //fseek($temp, 0); // Content to be uploaded will be content after the pointer
  681. $result = ftp_fput($this->getConnId(), $ftpDesAbsPath, $temp, FTP_BINARY);
  682. }
  683. fclose($temp);
  684. return $result;
  685. }
  686. return false;
  687. }
  688. function delete($absPath) {
  689. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  690. if ($ftpAbsPath !== false) {
  691. return ftp_delete($this->getConnId(), $ftpAbsPath);
  692. }
  693. return false;
  694. }
  695. function getConnId() {
  696. $this->connect();
  697. return $this->connId;
  698. }
  699. function isWithinFtpRoot($absPath) {
  700. if (strpos($absPath, $this->path) === 0) return true;
  701. else return false;
  702. }
  703. function mkdir($absPath) {
  704. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  705. if ($ftpAbsPath !== false) {
  706. return ftp_mkdir($this->getConnId(), $ftpAbsPath);
  707. }
  708. return false;
  709. }
  710. function moveUploadedFile($tmpAbsPath, $desAbsPath) {
  711. $ftpDesAbsPath = $this->absPathToFtpAbsPath($desAbsPath);
  712. if ($ftpDesAbsPath !== false) {
  713. if (is_uploaded_file($tmpAbsPath)) { // to prevent file upload attack
  714. return ftp_put($this->getConnId(), $ftpDesAbsPath, $tmpAbsPath, FTP_BINARY);
  715. }
  716. }
  717. return false;
  718. }
  719. function putWithContent($absPath, $content) {
  720. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  721. if ($ftpAbsPath !== false) {
  722. $temp = tmpfile();
  723. if (fwrite($temp, $content) === false) return false;
  724. fseek($temp, 0); // Content to be uploaded will be content after the pointer
  725. $result = ftp_fput($this->getConnId(), $ftpAbsPath, $temp, FTP_BINARY);
  726. fclose($temp);
  727. return $result;
  728. }
  729. return false;
  730. }
  731. function rename($oldAbsPath, $newAbsPath) {
  732. $this->connect();
  733. $oldFtpAbsPath = $this->absPathToFtpAbsPath($oldAbsPath);
  734. $newFtpAbsPath = $this->absPathToFtpAbsPath($newAbsPath);
  735. if (($oldFtpAbsPath !== false) && ($newFtpAbsPath !== false)) {
  736. return ftp_rename($this->getConnId(), $oldFtpAbsPath, $newFtpAbsPath);
  737. }
  738. return false;
  739. }
  740. function rmdir($absPath) {
  741. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  742. if ($ftpAbsPath !== false) {
  743. return ftp_rmdir($this->getConnId(), $ftpAbsPath);
  744. }
  745. return false;
  746. }
  747. function touch($absPath) {
  748. $ftpAbsPath = $this->absPathToFtpAbsPath($absPath);
  749. if ($ftpAbsPath !== false) {
  750. $temp = tmpfile();
  751. $result = ftp_fput($this->getConnId(), $ftpAbsPath, $temp, FTP_BINARY);
  752. fclose($temp);
  753. return $result;
  754. }
  755. return false;
  756. }
  757. }
  758. ?>
  759. <?php
  760. //------------------------------------------------------------------------------
  761. // Class name : Image
  762. //------------------------------------------------------------------------------
  763. class Image {
  764. var $file;
  765. var $height;
  766. var $image;
  767. var $type;
  768. var $width;
  769. function printImage($file) {
  770. if ($this->setImageByFile($file)) {
  771. $this->dump();
  772. } else {
  773. return false;
  774. }
  775. }
  776. function printThumbnail($file) {
  777. if ($this->setImageByFile($file)) {
  778. $this->resize(THUMBNAIL_SIZE);
  779. $this->dump();
  780. } else {
  781. return false;
  782. }
  783. }
  784. function setImageByFile($file) {
  785. $this->file = $file;
  786. $size = getimagesize($this->file->absPath);
  787. $this->width = $size[0];
  788. $this->height = $size[1];
  789. $this->type = $size[2];
  790. if ($this->type === IMAGETYPE_JPEG) {
  791. $this->image = imagecreatefromjpeg($this->file->absPath);
  792. } else if ($this->type === IMAGETYPE_GIF) {
  793. $this->image = imagecreatefromgif($this->file->absPath);
  794. } else if ($this->type === IMAGETYPE_PNG) {
  795. $this->image = imagecreatefrompng($this->file->absPath);
  796. } else if ($this->type === IMAGETYPE_WBMP) {
  797. $this->image = imagecreatefromwbmp($this->file->absPath);
  798. } else {
  799. return false;
  800. }
  801. return true;
  802. }
  803. function resize($newSize) {
  804. $containerRatio = 1; // square
  805. if ($this->height > $newSize || $this->width > $newSize) {
  806. $ratio = $this->height / $this->width;
  807. if ($ratio > $containerRatio) {
  808. $newWidth = $newSize / $ratio;
  809. $newHeight = $newSize;
  810. } else {
  811. $newWidth = $newSize;
  812. $newHeight = $newSize * $ratio;
  813. }
  814. $newImage = imagecreatetruecolor($newWidth, $newHeight);
  815. imagecopyresampled($newImage, $this->image, 0, 0, 0, 0, $newWidth, $newHeight, $this->width, $this->height);
  816. $this->image = $newImage;
  817. }
  818. }
  819. function dump() {
  820. header("Cache-Control: public");
  821. header("Content-type: " . image_type_to_mime_type($this->type));
  822. header('Content-Disposition: attachment; filename="'.$this->file->basename.'"');
  823. header("Content-Transfer-Encoding: binary\n");
  824. if ($this->type === IMAGETYPE_JPEG) {
  825. imagejpeg($this->image);
  826. } else if ($this->type === IMAGETYPE_GIF) {
  827. imagegif($this->image);
  828. } else if ($this->type === IMAGETYPE_PNG) {
  829. imagepng($this->image);
  830. } else if ($this->type === IMAGETYPE_WBMP) {
  831. imagewbmp($this->image);
  832. }
  833. exit(0);
  834. }
  835. }
  836. ?>
  837. <?php
  838. //------------------------------------------------------------------------------
  839. // Class name : Javascript
  840. //------------------------------------------------------------------------------
  841. class Javascript {
  842. function getJavascrtipt() {
  843. $javascript = null;
  844. $javascript .=
  845. "
  846. var Sdl = {};
  847. //------------------------------------------------------------------------------
  848. Sdl.Ajax = function() {}
  849. Sdl.Ajax.ajaxGet = function(fn, targetLink) {
  850. var xhr;
  851. xhr = Sdl.Ajax.initializeAjax();
  852. if (xhr) {
  853. //xhr.onerror = Sdl.Ajax.onError; //IE6 doesn't support it.
  854. xhr.onreadystatechange = function() {
  855. if(xhr.readyState == 4) {fn(xhr)};
  856. }
  857. xhr.open('GET', targetLink, true);
  858. xhr.send(null);
  859. return xhr;
  860. } else {
  861. return false;
  862. }
  863. }
  864. Sdl.Ajax.ajaxPost = function(fn, targetLink, param) {
  865. var xhr
  866. xhr = Sdl.Ajax.initializeAjax();
  867. if (xhr) {
  868. //xhr.onerror = Sdl.Ajax.onError; //IE6 doesn't support it.
  869. xhr.onreadystatechange = function() {
  870. if(xhr.readyState == 4) {fn(xhr)};
  871. }
  872. xhr.open('POST', targetLink, true);
  873. xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  874. xhr.setRequestHeader('Content-length', param.length);
  875. xhr.setRequestHeader('Connection', 'close');
  876. xhr.send(param);
  877. return xhr;
  878. } else {
  879. return false;
  880. }
  881. }
  882. Sdl.Ajax.initializeAjax = function() {
  883. var xhr;
  884. try {
  885. xhr = new XMLHttpRequest(); // FF & IE7
  886. } catch (e) {
  887. try {
  888. xhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  889. } catch(e) {
  890. try {
  891. xhr = new ActiveXObject('Microsoft.XMLHTTP');
  892. } catch(e) {
  893. alert('" . text("JAVASCRIPT ERROR") . "');
  894. return false;
  895. }
  896. }
  897. }
  898. return xhr;
  899. }
  900. Sdl.Ajax.onError = function() {
  901. alert('" . text("JAVASCRIPT ERROR") . "');
  902. }
  903. //------------------------------------------------------------------------------
  904. Sdl.Browser = function() {
  905. var this_clone = this;
  906. this.cacheLocation = null;
  907. this.caches = [];
  908. this.cwd = new Sdl.File();
  909. this.cwdLoading = new Sdl.File();
  910. this.onLoadListeners = [];
  911. this.permittedDir = new Sdl.File(); //For reference only. It's not used for permission checking.
  912. this.status = {};
  913. this.status.success = false;
  914. this.view = null;
  915. this.ajaxActionLoadDirListingPass = function(xhr) {
  916. this_clone.ajaxActionLoadDirListing(xhr);
  917. }
  918. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  919. }
  920. Sdl.Browser.prototype = {
  921. addOnLoadListener : function(fn) {
  922. this.onLoadListeners.push(fn);
  923. },
  924. ajaxActionLoadDirListing : function(xhr) {
  925. var div, container, dirListing, response;
  926. response = Sdl.Xml.digestResponseXml(xhr);
  927. if (Sdl.Xml.validateResponseAndWarn(response)) {
  928. this.cwd = new Sdl.Object.cloneObject(this.cwdLoading);
  929. div = document.getElementById('browserFilesDiv');
  930. if(response.status.success) {
  931. div.innerHTML = response.content;
  932. this.status.success = true;
  933. } else {
  934. this.status.success = false;
  935. div.innerHTML = '<center>' + response.error + '</center>';
  936. }
  937. var cache = {};
  938. cache.cwd = new Sdl.Object.cloneObject(this.cwd);
  939. cache.innerHTML = div.innerHTML;
  940. cache.view = this.view;
  941. cache.status = new Sdl.Object.cloneObject(this.status);
  942. this.cacheAdd(cache);
  943. this.onLoad();
  944. }
  945. },
  946. cacheAdd : function(cache) {
  947. if (this.cacheLocation != null) {
  948. if (this.caches[this.cacheLocation].cwd.relPath == cache.cwd.relPath) {
  949. this.caches.splice(this.cacheLocation, 1, cache);
  950. } else {
  951. this.caches.splice(this.cacheLocation + 1);
  952. this.cacheLocation++;
  953. this.caches.push(cache);
  954. }
  955. } else {
  956. this.cacheLocation = 0;
  957. this.caches.push(cache);
  958. }
  959. },
  960. cacheBackward : function() {
  961. if (this.cacheLocation != null) {
  962. if (this.caches[this.cacheLocation - 1]) {
  963. this.cacheLoad(this.caches[this.cacheLocation - 1]);
  964. this.cacheLocation--;
  965. }
  966. }
  967. },
  968. cacheForward : function() {
  969. if (this.cacheLocation != null) {
  970. if (this.caches[this.cacheLocation + 1]) {
  971. this.cacheLoad(this.caches[this.cacheLocation + 1]);
  972. this.cacheLocation++;
  973. }
  974. }
  975. },
  976. cacheLoad : function(cache) {
  977. var div;
  978. this.cwd = new Sdl.Object.cloneObject(cache.cwd);
  979. div = document.getElementById('browserFilesDiv');
  980. div.innerHTML = cache.innerHTML;
  981. this.view = cache.view;
  982. this.status = new Sdl.Object.cloneObject(cache.status);
  983. this.onLoad();
  984. },
  985. getAllFiles : function() {
  986. var files = [];
  987. this.traverseAllFiles(function(row) {
  988. var file = {};
  989. file.id = row.id;
  990. file.relPath = document.getElementById('systemRelPath_' + row.id).innerHTML.
  991. file.filename = document.getElementById('systeFilename_' + row.id).innerHTML.
  992. files.push(file);
  993. });
  994. return files;
  995. },
  996. getParentDir : function(path) {
  997. var i, parentDir;
  998. i = path.lastIndexOf('/', path.length - 2);
  999. if (i>=0) {parentDir = path.substring(0, i+1);}
  1000. else {parentDir = '';}
  1001. return parentDir;
  1002. },
  1003. loadDirListing : function(cwdRelPath, view) {
  1004. if (view == 'list') {this.view = 'list';}
  1005. else if (view == 'thumbnail') {this.view = 'thumbnail';}
  1006. this.cwdLoading.relPath = cwdRelPath;
  1007. this.cwdLoading.parentDir = this.getParentDir(cwdRelPath);
  1008. Sdl.Ajax.ajaxGet(this.ajaxActionLoadDirListingPass, '?print=dirListing&cwdRelPath=' + encodeURIComponent(this.cwdLoading.relPath) + '&view=' + this.view);
  1009. },
  1010. loadDirListingParentDir : function() {
  1011. this.loadDirListing(this.cwd.parentDir);
  1012. },
  1013. onClickThumbnailRedirect : function(e, cwdRelPath) {
  1014. Sdl.Event.stopPropagation(e);
  1015. this.loadDirListing(cwdRelPath);
  1016. },
  1017. onLoad : function() {
  1018. var headers, len;
  1019. document.title = '/' + this.cwd.relPath + ' - Simple Directory Listing';
  1020. headers = document.getElementById('browserHeaders');
  1021. for (var i = 0 ; i < headers.rows[0].cells.length ; i++) {
  1022. if (this.view == 'thumbnail') {
  1023. headers.rows[0].cells[i].childNodes[0].style.display = 'inline';
  1024. } else if (this.view == 'list') {
  1025. headers.rows[0].cells[i].childNodes[0].style.display = 'block';
  1026. }
  1027. }
  1028. // It is replaced by Sdl.Image.position as an onload listener for thumbnails
  1029. /*
  1030. // For IE6. I don't know how to vertically align img with CSS only in IE6.
  1031. if (Sdl.System.isIe6() && this.view == 'thumbnail') {
  1032. this.traverseAllFiles(function(file) {
  1033. var imgs, marginTop;
  1034. imgs = file.getElementsByTagName('img');
  1035. marginTop = ((" . THUMBNAIL_SIZE . " - imgs[0].offsetHeight ) / 2);
  1036. imgs[0].style.marginTop = marginTop >= 0 ? marginTop + 'px' : '0px';
  1037. });
  1038. }
  1039. */
  1040. len = this.onLoadListeners.length;
  1041. for (var i = 0 ; i < len ; i++) {
  1042. this.onLoadListeners[i]();
  1043. }
  1044. },
  1045. redirectPermittedDir : function() {
  1046. this.loadDirListing(this.permittedDir.relPath);
  1047. },
  1048. reloadDirListing : function() {
  1049. this.loadDirListing(this.cwd.relPath);
  1050. },
  1051. removeOnLoadListener : function(fn) {
  1052. var len;
  1053. len = this.onLoadListeners.length;
  1054. for (var i = 0 ; i < len ; i++) {
  1055. if (this.onLoadListeners[i] == fn) {
  1056. this.onLoadListeners.splice(i,1);
  1057. return;
  1058. }
  1059. }
  1060. },
  1061. setView : function(view) {
  1062. if (view == 'list' && this.view != 'list') {this.loadDirListing(this.cwd.relPath, 'list');}
  1063. else if (view == 'thumbnail' && this.view != 'thumbnail') {this.loadDirListing(this.cwd.relPath, 'thumbnail');}
  1064. },
  1065. traverseAllFiles : function(fn) {
  1066. var b, elts, len;
  1067. b = document.getElementById('browserFiles');
  1068. if (b) {
  1069. if (b.tagName == 'TABLE') {
  1070. elts = b.rows;
  1071. } else {
  1072. elts = [];
  1073. for (var i=0 ; i<b.childNodes.length ; i++) {
  1074. if (b.childNodes[i].nodeType == 1 && b.childNodes[i].tagName == 'DIV') {elts.push(b.childNodes[i]);}
  1075. }
  1076. }
  1077. len = elts.length;
  1078. for (var i = 0 ; i < len ; i++) {
  1079. fn(elts[i]);
  1080. }
  1081. }
  1082. },
  1083. traverseAllFilesOnAttribute : function(fn, idTag) {
  1084. this.traverseAllFiles(function(elt) {
  1085. var a;
  1086. a = document.getElementById(idTag + '_' + elt.id);
  1087. fn(a, elt);
  1088. });
  1089. },
  1090. windowOnLoadListener : function() {
  1091. document.getElementById('browserFilesDiv').innerHTML = '<center>" . text("LOADING") . "</center>';
  1092. this.cwd.relPath = Sdl.Text.decodeHtmlEntity(this.cwd.relPath);
  1093. this.permittedDir.relPath = Sdl.Text.decodeHtmlEntity(this.permittedDir.relPath);
  1094. this.view = Sdl.Text.decodeHtmlEntity(this.view);
  1095. this.loadDirListing(this.cwd.relPath, this.view);
  1096. }
  1097. }
  1098. //------------------------------------------------------------------------------
  1099. Sdl.Button = function() {}
  1100. Sdl.Button.decorateById = function(id) {
  1101. Sdl.Button.decorateByRef(document.getElementById(id));
  1102. }
  1103. Sdl.Button.decorateByRef = function(elt) {
  1104. Sdl.Object.modifyClassName(elt, 'functionButton', null);
  1105. elt.onmouseout = function() {Sdl.Object.modifyClassName(this, null, 'functionButtonMouseOver');}
  1106. elt.onmouseover = function() {Sdl.Object.modifyClassName(this, 'functionButtonMouseOver', null);}
  1107. }
  1108. //------------------------------------------------------------------------------
  1109. Sdl.CoverBody = function() {
  1110. Sdl.CoverBody.cover = null;
  1111. Sdl.CoverBody.isCovered = false;
  1112. Sdl.CoverBody.isTextShown = false;
  1113. Sdl.CoverBody.text = null;
  1114. }
  1115. Sdl.CoverBody.hideCoverBody = function() {
  1116. if (Sdl.CoverBody.isCovered) {
  1117. document.body.removeChild(Sdl.CoverBody.cover);
  1118. Sdl.CoverBody.isCovered = false;
  1119. }
  1120. }
  1121. Sdl.CoverBody.hideText = function() {
  1122. if (Sdl.CoverBody.isTextShown) {
  1123. document.body.removeChild(Sdl.CoverBody.text);
  1124. Sdl.CoverBody.isTextShown = false;
  1125. }
  1126. }
  1127. Sdl.CoverBody.modifyText = function(text) {
  1128. if (Sdl.CoverBody.isTextShown) {
  1129. var clientWidth;
  1130. clientWidth = document.documentElement.clientWidth;
  1131. Sdl.CoverBody.text.style.visibility = 'hidden';
  1132. Sdl.CoverBody.text.innerHTML = text;
  1133. Sdl.CoverBody.text.style.left = ((clientWidth - Sdl.CoverBody.text.offsetWidth) / 2) + 'px';
  1134. Sdl.CoverBody.text.style.visibility = 'visible';
  1135. }
  1136. }
  1137. Sdl.CoverBody.resizeCoverBody = function() {
  1138. if (Sdl.CoverBody.isCovered) {
  1139. var clientHeight, clientWidth, newHeight, newWidth, pageHeight, pageWidth;
  1140. clientWidth = document.documentElement.clientWidth;
  1141. clientHeight = document.documentElement.clientHeight;
  1142. pageWidth = document.body.clientWidth;
  1143. pageHeight = document.body.clientHeight;
  1144. newHeight = clientHeight > pageHeight ? clientHeight : pageHeight;
  1145. newWidth = clientWidth > pageWidth ? clientWidth : pageWidth;
  1146. Sdl.CoverBody.cover.style.height = newHeight + 'px';
  1147. Sdl.CoverBody.cover.style.width = newWidth + 'px';
  1148. }
  1149. }
  1150. Sdl.CoverBody.resizeText = function() {
  1151. if (Sdl.CoverBody.isTextShown) {
  1152. var clientWidth;
  1153. clientWidth = document.documentElement.clientWidth;
  1154. Sdl.CoverBody.text.style.left = ((clientWidth - Sdl.CoverBody.text.offsetWidth) / 2) + 'px';
  1155. }
  1156. }
  1157. // For IE. IE6 doesn't support position:fixed.
  1158. Sdl.CoverBody.positionText = function() {
  1159. if (Sdl.CoverBody.isTextShown) {
  1160. Sdl.CoverBody.text.style.position = 'absolute';
  1161. Sdl.CoverBody.text.style.top = (document.documentElement.scrollTop + (document.documentElement.clientHeight - Sdl.CoverBody.text.clientHeight) / 2) + 'px';
  1162. }
  1163. }
  1164. Sdl.CoverBody.showCoverBody = function() {
  1165. if (!Sdl.CoverBody.isCovered) {
  1166. var newHeight, newWidth, clientHeight, clientWidth, pageHeight, pageWidth;
  1167. clientWidth = document.documentElement.clientWidth;
  1168. clientHeight = document.documentElement.clientHeight;
  1169. pageWidth = document.body.clientWidth;
  1170. pageHeight = document.body.clientHeight;
  1171. newHeight = clientHeight > pageHeight ? clientHeight : pageHeight;
  1172. newWidth = clientWidth > pageWidth ? clientWidth : pageWidth;
  1173. Sdl.CoverBody.cover = document.createElement('div');
  1174. Sdl.CoverBody.cover.className = 'coverBody';
  1175. Sdl.CoverBody.cover.style.height = newHeight + 'px';
  1176. Sdl.CoverBody.cover.style.width = newWidth + 'px';
  1177. document.body.appendChild(Sdl.CoverBody.cover);
  1178. Sdl.CoverBody.isCovered = true;
  1179. }
  1180. }
  1181. Sdl.CoverBody.showText = function(text) {
  1182. if (!Sdl.CoverBody.isTextShown) {
  1183. var clientWidth;
  1184. clientWidth = document.documentElement.clientWidth;
  1185. Sdl.CoverBody.text = document.createElement('div');
  1186. Sdl.CoverBody.text.className = 'coverBodyText';
  1187. Sdl.CoverBody.text.innerHTML = text;
  1188. document.body.appendChild(Sdl.CoverBody.text);
  1189. Sdl.CoverBody.text.style.left = ((clientWidth - Sdl.CoverBody.text.offsetWidth) / 2) + 'px';
  1190. Sdl.CoverBody.isTextShown = true;
  1191. }
  1192. }
  1193. //------------------------------------------------------------------------------
  1194. Sdl.Css = function() {}
  1195. Sdl.Css.changeAttribute = function(className, attribute, value) {
  1196. for (var i = 0; i < document.styleSheets.length; i++){
  1197. for (var j = 0; j < document.styleSheets[i]['cssRules'].length; j++) {
  1198. if (document.styleSheets[i]['cssRules'][j].selectorText == className) {
  1199. document.styleSheets[i]['cssRules'][j].style[attribute] = value;
  1200. }
  1201. }
  1202. }
  1203. }
  1204. //------------------------------------------------------------------------------
  1205. Sdl.Event = function() {}
  1206. Sdl.Event.addEventListener = function(target, event, fn) {
  1207. if (target.addEventListener) {target.addEventListener(event, fn, false);}
  1208. else if (target.attachEvent) {target.attachEvent('on' + event, fn);}
  1209. }
  1210. Sdl.Event.addWindowOnLoadListener = function(fn) {
  1211. Sdl.Event.addEventListener(window,'load',fn);
  1212. }
  1213. Sdl.Event.disableSelection = function(elt) {
  1214. elt.onselectstart = function() {return false;};
  1215. elt.style.MozUserSelect = 'none';
  1216. }
  1217. Sdl.Event.removeEventListener = function(target, event, fn) {
  1218. if (target.removeEventListener) {target.removeEventListener(event, fn, false);}
  1219. else if (target.detachEvent) {target.detachEvent('on' + event, fn);}
  1220. }
  1221. Sdl.Event.stopPropagation = function(e) {
  1222. if (e.stopPropagation) {e.stopPropagation();}
  1223. else {e.cancelBubble = true;}
  1224. }
  1225. //------------------------------------------------------------------------------
  1226. Sdl.File = function() {
  1227. this.filename = null;
  1228. this.id = null;
  1229. this.isDir = null;
  1230. this.relPath = null;
  1231. }
  1232. //------------------------------------------------------------------------------
  1233. Sdl.FileContainer = function() {
  1234. var this_clone = this;
  1235. this.fileContainer = null;
  1236. this.files = [];
  1237. this.select = null;
  1238. this.acceptedFileType = 1; //1=files/dirs, 2=files only, 3=dirs only
  1239. this.onClickAddPass = function() {
  1240. this_clone.onClickAdd();
  1241. }
  1242. this.onClickRemovePass = function() {
  1243. this_clone.onClickRemove();
  1244. }
  1245. this.onClickResetPass = function() {
  1246. this_clone.onClickReset();
  1247. }
  1248. }
  1249. Sdl.FileContainer.prototype = {
  1250. addFile : function(file) {
  1251. if(!this.isFileExist(file)) {
  1252. if(this.acceptedFileType == 2 && file.isDir) {
  1253. alert('Cannot add directory. ' + file.relPath + ' is a directory.');
  1254. return;
  1255. }
  1256. if(this.acceptedFileType == 3 && !file.isDir) {
  1257. alert('Directory only. ' + file.relPath + ' is not a directory.');
  1258. return;
  1259. }
  1260. this.files.push(file);
  1261. this.addOption(this.select, file.relPath);
  1262. this.updateNumber();
  1263. }
  1264. },
  1265. addFiles : function(files) {
  1266. var len;
  1267. len = files.length;
  1268. for(var i = 0 ; i < len ; i++) {
  1269. this.addFile(files[i]);
  1270. }
  1271. },
  1272. addOption : function(select, text) {
  1273. var o;
  1274. o = document.createElement('option');
  1275. o.text = text;
  1276. try {select.add(o, null);}
  1277. catch (ex) {select.add(o);}
  1278. return o;
  1279. },
  1280. isFileExist : function(file) {
  1281. var exist, len;
  1282. len = this.files.length;
  1283. exist = false;
  1284. for(var i = 0 ; i < len ; i++) {
  1285. if(file.relPath == this.files[i].relPath) {
  1286. exist = true;
  1287. break;
  1288. }
  1289. }
  1290. return exist;
  1291. },
  1292. onClickAdd : function() {
  1293. var selectedFiles;
  1294. selectedFiles = Sdl.ModuleSelector.main.getSelectedFilesAndWarn();
  1295. if (selectedFiles && selectedFiles.length > 0) {this.addFiles(selectedFiles);}
  1296. },
  1297. onClickRemove : function() {
  1298. var index;
  1299. index = this.select.selectedIndex;
  1300. if(index>0) {this.removeFile(index);}
  1301. },
  1302. onClickReset : function() {
  1303. var len;
  1304. len = this.select.length;
  1305. for (var i = len - 1 ; i > 0 ; i--) {
  1306. this.removeFile(i);
  1307. }
  1308. },
  1309. removeFile : function(index) {
  1310. this.select.remove(index);
  1311. this.files.splice(index-1, 1);
  1312. if (index < this.select.length) {this.select.selectedIndex = index;}
  1313. else {this.select.selectedIndex = index - 1;}
  1314. this.updateNumber();
  1315. },
  1316. setFileContainer : function(fc) {
  1317. this.fileContainer = fc;
  1318. this.add = document.createElement('input');
  1319. //this.add.value = '" . text("ADD") . "';
  1320. this.add.type = 'button';
  1321. this.add.onclick = this.onClickAddPass;
  1322. this.remove = document.createElement('input');
  1323. //this.remove.value = '" . text("REMOVE") . "';
  1324. this.remove.type = 'button';
  1325. this.remove.onclick = this.onClickRemovePass;
  1326. this.reset = document.createElement('input');
  1327. //this.reset.value = '" . text("RESET") . "';
  1328. this.reset.type = 'button';
  1329. this.reset.onclick = this.onClickResetPass;
  1330. this.select = document.createElement('select');
  1331. this.select.style.width = '6em'; // Safari 3 beta occupies a longer select box.
  1332. // IE6 doesn't expand items when a select box is clicked.
  1333. if (Sdl.System.isIe6()) {
  1334. this.select.style.width = '30em';
  1335. }
  1336. this.addOption(this.select, '0 " . text("FILES") . "');
  1337. this.fileContainer.appendChild(this.select);
  1338. this.fileContainer.appendChild(this.add);
  1339. this.fileContainer.appendChild(this.remove);
  1340. this.fileContainer.appendChild(this.reset);
  1341. // For Opera 9.21. It can't set values to input buttons before they are added to DOM.
  1342. this.add.value = '" . text("ADD") . "';
  1343. this.remove.value = '" . text("REMOVE") . "';
  1344. this.reset.value = '" . text("RESET") . "';
  1345. },
  1346. updateNumber : function() {
  1347. this.select.options[0].text = this.files.length + ' " . text("FILES") . "';
  1348. }
  1349. }
  1350. //------------------------------------------------------------------------------
  1351. Sdl.Image = function() {
  1352. var this_clone = this;
  1353. this.img = null;
  1354. this.intervalId = null;
  1355. this.originalHeight = null;
  1356. this.originalWidth = null;
  1357. this.success = false;
  1358. this.checkCompletePass = function() {
  1359. this_clone.checkComplete();
  1360. }
  1361. this.onClickShowPass = function(e, relPath) {
  1362. this_clone.onClickShow(e, relPath);
  1363. }
  1364. this.onErrorPass = function() {
  1365. this_clone.onError();
  1366. }
  1367. this.onLoadPass = function() {
  1368. this_clone.onLoad();
  1369. }
  1370. }
  1371. Sdl.Image.prototype = {
  1372. // For Opera 9.21. zero byte image does not go to onerror
  1373. // It isn't used.
  1374. checkComplete : function() {
  1375. if (this.img.complete) {
  1376. if (!this.success) {Sdl.CoverBody.modifyText('". text("INVALID IMAGE FORMAT") ."');}
  1377. window.clearInterval(this.intervalId);
  1378. }
  1379. },
  1380. onClickShowByRelPath : function(e, relPath) {
  1381. this.showByRelPath(relPath);
  1382. Sdl.Event.stopPropagation(e);
  1383. },
  1384. onClickShowByUrl : function(e, url) {
  1385. this.showByUrl(url);
  1386. Sdl.Event.stopPropagation(e);
  1387. },
  1388. onError : function() {
  1389. Sdl.CoverBody.modifyText('Invalid image format.');
  1390. //window.clearInterval(this.intervalId);
  1391. },
  1392. onLoad : function() {
  1393. this.success = true;
  1394. this.originalHeight = this.img.offsetHeight;
  1395. this.originalWidth = this.img.offsetWidth;
  1396. this.resize();
  1397. Sdl.CoverBody.hideText();
  1398. this.img.style.visibility = 'visible';
  1399. },
  1400. // For IE. IE6 doesn't support position:fixed.
  1401. position : function() {
  1402. this.img.style.position = 'absolute';
  1403. this.img.style.top = document.documentElement.scrollTop + 'px';
  1404. },
  1405. resize : function() {
  1406. if (this.success) {
  1407. var imgHeight, imgWidth, newHeight, newWidth, screenHeight, screenWidth;
  1408. screenHeight = document.documentElement.clientHeight < document.body.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
  1409. screenWidth = document.documentElement.clientWidth < document.body.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
  1410. imgHeight = this.originalHeight;
  1411. imgWidth = this.originalWidth;
  1412. if (imgHeight > screenHeight || imgWidth > screenWidth) {
  1413. var imgRatio, screenRatio;
  1414. imgRatio = imgHeight / imgWidth;
  1415. screenRatio = screenHeight / screenWidth;
  1416. if (imgRatio > screenRatio) {
  1417. newHeight = screenHeight;
  1418. newWidth = newHeight / imgRatio;
  1419. } else {
  1420. newWidth = screenWidth;
  1421. newHeight = newWidth * imgRatio;
  1422. }
  1423. } else {
  1424. newHeight = imgHeight;
  1425. newWidth = imgWidth;
  1426. }
  1427. this.img.style.height = newHeight + 'px';
  1428. this.img.style.width = newWidth + 'px';
  1429. }
  1430. },
  1431. show : function(url) {
  1432. var width1, height1;
  1433. width1 = document.documentElement.clientWidth;
  1434. height1 = document.documentElement.clientHeight;
  1435. this.success = false;
  1436. this.img = document.createElement('img');
  1437. this.img.style.visibility = 'hidden';
  1438. this.img.className = 'image';
  1439. this.img.onload = this.onLoadPass;
  1440. this.img.onerror = this.onErrorPass;
  1441. document.body.appendChild(this.img);
  1442. Sdl.CoverBody.showCoverBody();
  1443. Sdl.CoverBody.showText('Loading');
  1444. if (Sdl.System.isIe6()) {
  1445. this.position(); // For IE. IE6 doesn't support position:fixed.
  1446. Sdl.CoverBody.positionText(); // For IE. IE6 doesn't support position:fixed.
  1447. Sdl.CoverBody.resizeText(); // For IE. IE6 doesn't support position:fixed.
  1448. }
  1449. this.img.src = url;
  1450. //this.intervalId = window.setInterval(this.checkCompletePass, 500);
  1451. var this_clone_tmp = this;
  1452. window.onresize = function() {
  1453. this_clone_tmp.resize();
  1454. if (Sdl.System.isIe6()) {
  1455. this_clone_tmp.position(); // For IE. IE6 doesn't support position:fixed.
  1456. Sdl.CoverBody.positionText(); // For IE. IE6 doesn't support position:fixed.
  1457. }
  1458. Sdl.CoverBody.resizeCoverBody();
  1459. Sdl.CoverBody.resizeText();
  1460. }
  1461. if (Sdl.System.isIe6()) {
  1462. window.onscroll = function() {
  1463. this_clone_tmp.position(); // For IE. IE6 doesn't support position:fixed.
  1464. Sdl.CoverBody.positionText(); // For IE. IE6 doesn't support position:fixed.
  1465. }
  1466. }
  1467. document.onmousedown = function() {
  1468. //window.clearInterval(this_clone_tmp.intervalId);
  1469. document.body.removeChild(this_clone_tmp.img);
  1470. document.onmousedown = null;
  1471. window.onresize = null;
  1472. if (Sdl.System.isIe6()) {
  1473. window.onscroll = null; // For IE. IE6 doesn't support position:fixed.
  1474. }
  1475. Sdl.CoverBody.hideCoverBody();
  1476. Sdl.CoverBody.hideText();
  1477. this_clone_tmp.img = null;
  1478. return false;
  1479. }
  1480. },
  1481. showByRelPath : function(relPath) {
  1482. this.show('?print=image&relPath=' + relPath);
  1483. },
  1484. showByUrl : function(url) {
  1485. this.show(url);
  1486. }
  1487. }
  1488. // For IE6. I don't know how to vertically align img with CSS only in IE6.
  1489. Sdl.Image.position = function(img) {
  1490. if (Sdl.System.isIe6()) {
  1491. var marginTop;
  1492. marginTop = ((" . THUMBNAIL_SIZE . " - img.offsetHeight ) / 2);
  1493. img.style.marginTop = marginTop >= 0 ? marginTop + 'px' : '0px';
  1494. }
  1495. }
  1496. //------------------------------------------------------------------------------
  1497. Sdl.Layout = function() {
  1498. var this_clone = this;
  1499. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  1500. }
  1501. Sdl.Layout.prototype = {
  1502. windowOnLoadListener : function() {
  1503. document.getElementById('font').style.display = 'inline';
  1504. }
  1505. }
  1506. Sdl.Layout.changeFontSize = function(num) {
  1507. var fontSize;
  1508. fontSize = document.body.style.fontSize;
  1509. if (fontSize) {document.body.style.fontSize = parseInt(fontSize.substring(0, fontSize.length - 2)) + num + 'px';}
  1510. else {document.body.style.fontSize = " . FONT_SIZE . " + num + 'px';}
  1511. }
  1512. Sdl.Layout.increaseFontSize = function() {
  1513. Sdl.Layout.changeFontSize(1);
  1514. }
  1515. Sdl.Layout.decreaseFontSize = function() {
  1516. Sdl.Layout.changeFontSize(-1);
  1517. }
  1518. //------------------------------------------------------------------------------
  1519. Sdl.MovableBar = function() {
  1520. var this_clone = this;
  1521. this.div = null;
  1522. this.isCovered = false;
  1523. this.isDefaultLocked = null;
  1524. this.lock = null;
  1525. this.unlockType = 'auto';
  1526. this.movableBar = null;
  1527. this.moveTarget = null;
  1528. this.onClickLock = function(e) {
  1529. e = e || event;
  1530. if (this_clone.lock.checked) {
  1531. this_clone.moveTarget.style.height = this_clone.moveTarget.offsetHeight + 'px';
  1532. } else {
  1533. if (this_clone.unlockType == 'scrollHeight') {this_clone.moveTarget.style.height = this_clone.moveTarget.scrollHeight + 'px';}
  1534. else {this_clone.moveTarget.style.height = 'auto';}
  1535. }
  1536. Sdl.Event.stopPropagation(e);
  1537. }
  1538. this.onMouseDown = function(e) {
  1539. var oldY, oldHeight;
  1540. e = e || event;
  1541. oldY = e.pageY ? e.pageY : e.clientY + document.documentElement.scrollTop + document.body.scrollTop;
  1542. oldHeight = this_clone.moveTarget.offsetHeight;
  1543. this_clone.movableBar.onmouseout = null;
  1544. this_clone.movableBar.onmouseover = null;
  1545. document.onselectstart = function(e) {return false;}
  1546. document.onmousedown = function(e) {return false;}
  1547. //document.body.style.MozUserSelect = 'none';
  1548. document.onmousemove = function(e) {
  1549. var lock, newY, newHeight, diff;
  1550. this_clone.lock.checked = true;
  1551. e = e || event;
  1552. newY = e.pageY ? e.pageY : e.clientY + document.documentElement.scrollTop + document.body.scrollTop;
  1553. diff = newY - oldY;
  1554. newHeight = oldHeight + diff;
  1555. if (newHeight >= 0 ) {
  1556. this_clone.moveTargetHeight = newHeight;
  1557. this_clone.moveTarget.style.height = newHeight + 'px';
  1558. }
  1559. };
  1560. document.onmouseup = function(e) {
  1561. document.body.onselectstart = null;
  1562. document.onmousemove = null;
  1563. document.onmousedown = null;
  1564. this_clone.movableBar.onmouseout = this_clone.onMouseOut;
  1565. this_clone.movableBar.onmouseover = this_clone.onMouseOver;
  1566. this_clone.onMouseOut(e);
  1567. };
  1568. }
  1569. this.onMouseOut = function() {
  1570. Sdl.Object.modifyClassName(this_clone.movableBar, null, 'movableBarMouseOver')
  1571. }
  1572. this.onMouseOver = function() {
  1573. Sdl.Object.modifyClassName(this_clone.movableBar, 'movableBarMouseOver', null)
  1574. }
  1575. }
  1576. Sdl.MovableBar.prototype = {
  1577. setMoveTarget : function(t) {
  1578. //It would make body have no x-scroll
  1579. //t.style.overflowY = 'auto';
  1580. this.moveTarget = t;
  1581. // IE6 retrieved incorrect .offsetHeight if there is no border in this case.
  1582. if (Sdl.System.isIe6()) {
  1583. Sdl.Object.modifyClassName(this.moveTarget, 'moveTargetIe6', null);
  1584. }
  1585. },
  1586. setup : function() {
  1587. var content, locked, sign;
  1588. this.movableBar = document.createElement('div');
  1589. Sdl.Object.modifyClassName(this.movableBar, 'movableBar', null)
  1590. this.movableBar.onmouseover = this.onMouseOver;
  1591. this.movableBar.onmouseout = this.onMouseOut;
  1592. this.movableBar.onmousedown = this.onMouseDown;
  1593. sign = document.createElement('div');
  1594. sign.innerHTML = '------';
  1595. sign.className = 'movableBarSign';
  1596. content = document.createElement('div');
  1597. content.className = 'movableBarContent';
  1598. this.lock = document.createElement('input');
  1599. this.lock.style.cursor = 'default';
  1600. this.lock.type = 'checkbox';
  1601. this.lock.onclick = this.onClickLock;
  1602. this.lock.tabIndex = -1;
  1603. locked = document.createTextNode('Locked');
  1604. content.appendChild(this.lock);
  1605. content.appendChild(locked);
  1606. this.movableBar.appendChild(sign);
  1607. this.movableBar.appendChild(content);
  1608. // Properties/status change must be done after elements are added to DOM
  1609. this.lock.checked = this.isDefaultLocked;
  1610. }
  1611. }
  1612. //------------------------------------------------------------------------------
  1613. Sdl.Object = function() {}
  1614. Sdl.Object.cloneObject = function(obj) {
  1615. for (i in obj) {
  1616. if (typeof obj[i] == 'object') {this[i] = new Sdl.Object.cloneObject(obj[i]);}
  1617. else {this[i] = obj[i];}
  1618. }
  1619. }
  1620. Sdl.Object.modifyClassName = function(elt, add, remove) {
  1621. var classNames, len, newClassName = '';
  1622. classNames = elt.className.split(' ');
  1623. len = classNames.length;
  1624. for (var i = 0 ; i < len ; i++) {
  1625. if (classNames[i] != remove && classNames[i] != add) {
  1626. newClassName += classNames[i] + ' ';
  1627. }
  1628. }
  1629. if (add) {
  1630. newClassName += add;
  1631. }
  1632. elt.className = newClassName;
  1633. //alert(elt.className);
  1634. }
  1635. //------------------------------------------------------------------------------
  1636. Sdl.Page = function() {
  1637. var this_clone = this;
  1638. this.content = null;
  1639. this.contentContainer = null;
  1640. this.movableBar = new Sdl.MovableBar();
  1641. this.resizableElement = null;
  1642. this.tabContent = null;
  1643. this.tab = null;
  1644. this.onClickTab = function() {
  1645. Sdl.pageManager.switchPage(this_clone);
  1646. }
  1647. this.onClickTabRemove = function(e) {
  1648. /* e.stopPropagation is for Safari 3 beta, after this page is removed, this clicking bubbles to
  1649. switching tab again. This doesn't happer in FF and IE since this page
  1650. should have been deleted from DOM. */
  1651. Sdl.Event.stopPropagation(e || event);
  1652. Sdl.pageManager.removePage(this_clone);
  1653. }
  1654. }
  1655. Sdl.Page.prototype = {
  1656. hideContent : function() {
  1657. this.contentContainer.style.display = 'none';
  1658. },
  1659. showContent : function() {
  1660. this.contentContainer.style.display = 'block';
  1661. },
  1662. focusTab : function() {
  1663. Sdl.Object.modifyClassName(this.tab, 'tabFocus', null);
  1664. },
  1665. blurTab : function() {
  1666. Sdl.Object.modifyClassName(this.tab, null, 'tabFocus');
  1667. }
  1668. }
  1669. //------------------------------------------------------------------------------
  1670. Sdl.PageManager = function() {
  1671. var this_clone = this;
  1672. this.currentPage = null;
  1673. this.pages = [];
  1674. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  1675. }
  1676. Sdl.PageManager.prototype = {
  1677. addContent : function(page) {
  1678. var pages;
  1679. pages = document.getElementById('pages');
  1680. page.contentContainer = document.createElement('div');
  1681. page.contentContainer.style.display = 'none';
  1682. page.contentContainer.appendChild(page.content);
  1683. pages.appendChild(page.contentContainer);
  1684. },
  1685. addMovableBar : function(page) {
  1686. page.movableBar.setup();
  1687. page.contentContainer.appendChild(page.movableBar.movableBar);
  1688. },
  1689. addPage : function(page) {
  1690. this.pages.push(page);
  1691. this.addContent(page);
  1692. this.addTab(page);
  1693. this.addMovableBar(page);
  1694. this.switchPage(page);
  1695. this.showHideTabs();
  1696. },
  1697. addTab : function(page, removable) {
  1698. var tabContentContainer, tabs;
  1699. tabs = document.getElementById('tabs');
  1700. tabContentContainer = document.createElement('div');
  1701. page.tab = document.createElement('div');
  1702. Sdl.Object.modifyClassName(page.tab, 'tab', null);
  1703. page.tab.onclick = page.onClickTab;
  1704. tabContentContainer.style.cssFloat = 'left';
  1705. tabContentContainer.style.styleFloat = 'left';
  1706. tabContentContainer.appendChild(page.tabContent);
  1707. page.tab.appendChild(tabContentContainer);
  1708. if (removable != false) {
  1709. var remove, removeDiv;
  1710. removeDiv = document.createElement('div');
  1711. remove = document.createElement('img');
  1712. remove.src = '?print=icon&icon=cross';
  1713. remove.alt = '[x]';
  1714. remove.align = 'middle';
  1715. remove.style.verticalAlign = 'middle';
  1716. removeDiv.style.cssFloat = 'left';
  1717. removeDiv.style.styleFloat = 'left';
  1718. remove.onclick = page.onClickTabRemove;
  1719. removeDiv.appendChild(remove);
  1720. page.tab.appendChild(removeDiv);
  1721. }
  1722. tabs.appendChild(page.tab);
  1723. },
  1724. removePage : function(page) {
  1725. var pages, tabs;
  1726. tabs = document.getElementById('tabs');
  1727. pages = document.getElementById('pages');
  1728. tabs.removeChild(page.tab);
  1729. pages.removeChild(page.contentContainer);
  1730. var i = 0, len = this.pages.length;
  1731. for (i ; i < len ; i++) {
  1732. if (this.pages[i] == page) {
  1733. if (this.currentPage == page) {
  1734. if (this.pages[parseInt(i)+1]) {this.switchPage(this.pages[parseInt(i)+1]);}
  1735. else {this.switchPage(this.pages[parseInt(i)-1]);}
  1736. }
  1737. this.pages.splice(i, 1);
  1738. break;
  1739. }
  1740. }
  1741. this.showHideTabs();
  1742. },
  1743. removeTab : function(id) {
  1744. var tabs = document.getElementById('tabs');
  1745. for (var i in tabs.childNodes) {
  1746. if (tabs.childNodes[i].id == id) {
  1747. tabs.removeChild(tabs.childNodes[i]);
  1748. break;
  1749. }
  1750. }
  1751. for (var i in this.pages) {
  1752. if (this.tabs[i] == id) {
  1753. this.tabs.splice(i, 1);
  1754. break;
  1755. }
  1756. }
  1757. },
  1758. showHideTabs : function() {
  1759. if (this.pages.length > 1) {
  1760. document.getElementById('tabs').style.display = 'block';
  1761. document.getElementById('pages').className = 'pagesSideBoxTopExist';
  1762. } else {
  1763. var sideBoxTopHeight;
  1764. document.getElementById('tabs').style.display = 'none';
  1765. sideBoxTopHeight = document.getElementById('containerSideBoxTopContainerCell').offsetHeight;
  1766. if (sideBoxTopHeight > 0) {document.getElementById('pages').className = 'pagesSideBoxTopExist';}
  1767. else {document.getElementById('pages').className = 'pagesSideBoxTopNotExist';}
  1768. }
  1769. },
  1770. switchPage : function(page) {
  1771. if (this.currentPage) {
  1772. this.currentPage.hideContent();
  1773. this.currentPage.blurTab();
  1774. /*
  1775. for (var i in this.pages) {
  1776. this.pages[i].hideContent();
  1777. }
  1778. */
  1779. }
  1780. page.showContent();
  1781. page.focusTab();
  1782. this.currentPage = page;
  1783. },
  1784. windowOnLoadListener : function() {
  1785. var page, tabContent;
  1786. this.showHideTabs();
  1787. page = new Sdl.Page();
  1788. page.contentContainer = document.getElementById('browserContainer');
  1789. tabContent = document.createElement('div');
  1790. tabContent.innerHTML = 'Browser';
  1791. page.tabContent = tabContent;
  1792. page.movableBar.moveTarget = document.getElementById('browserFilesContainer');
  1793. // IE6 retrieved incorrect .offsetHeight if there is no border in this case.
  1794. if (Sdl.System.isIe6()) {
  1795. Sdl.Object.modifyClassName(page.movableBar.moveTarget, 'moveTargetIe6', null);
  1796. }
  1797. this.addTab(page, false);
  1798. this.pages.push(page);
  1799. this.addMovableBar(page);
  1800. this.switchPage(page);
  1801. Sdl.browser.page = page;
  1802. this.showHideTabs();
  1803. }
  1804. }
  1805. //------------------------------------------------------------------------------
  1806. Sdl.Rss = function() {
  1807. var this_clone = this;
  1808. Sdl.browser.addOnLoadListener(function() {this_clone.browserOnLoadListener();});
  1809. }
  1810. Sdl.Rss.prototype = {
  1811. browserOnLoadListener : function() {
  1812. var rss;
  1813. rss = document.getElementById('rss');
  1814. if (Sdl.browser.status.success && Sdl.browser.cwd) {rss.href = '?print=rss&cwdRelPath=' + Sdl.browser.cwd.relPath;}
  1815. else {rss.removeAttribute('href');}
  1816. }
  1817. }
  1818. //------------------------------------------------------------------------------
  1819. Sdl.Main = function() {
  1820. Sdl.browser = new Sdl.Browser(); // Must be on top
  1821. Sdl.image = new Sdl.Image();
  1822. Sdl.layout = new Sdl.Layout();
  1823. Sdl.movableBar = new Sdl.MovableBar();
  1824. Sdl.pageManager = new Sdl.PageManager();
  1825. Sdl.rss = new Sdl.Rss();
  1826. Sdl.sfs = new Sdl.Sfs();
  1827. Sdl.sort = new Sdl.Sort();
  1828. Sdl.sortManager = new Sdl.SortManager();
  1829. }
  1830. //------------------------------------------------------------------------------
  1831. Sdl.Sfs = function() {
  1832. var this_clone = this;
  1833. Sdl.browser.addOnLoadListener(function() {this_clone.browserOnLoadListener();});
  1834. }
  1835. Sdl.Sfs.prototype = {
  1836. browserOnLoadListener : function() {
  1837. var sfs;
  1838. sfs = document.getElementById('sfs');
  1839. if (Sdl.browser.status.success && Sdl.browser.cwd) {sfs.href = '?print=sfs&cwdRelPath=' + Sdl.browser.cwd.relPath;}
  1840. else {sfs.removeAttribute('href');}
  1841. }
  1842. }
  1843. //------------------------------------------------------------------------------
  1844. Sdl.Sort = function() {
  1845. var this_clone = this;
  1846. this.pos = null;
  1847. this.sortSign = null;
  1848. this.sortOnClick = function() {
  1849. this_clone.order = -this_clone.order;
  1850. this_clone.sort();
  1851. Sdl.sortManager.sort = this_clone;
  1852. }
  1853. this.sortLiteral = function(a, b) {
  1854. if (a.sortValue.toLowerCase() > b.sortValue.toLowerCase()) {return this_clone.order;}
  1855. //if (a.sortValue > b.sortValue) {return this_clone.order;}
  1856. else {return -this_clone.order;}
  1857. }
  1858. this.sortNumeric = function(a, b) {
  1859. if (parseInt(a.sortValue, 10) > parseInt(b.sortValue, 10)) {return this_clone.order;}
  1860. else {return -this_clone.order;}
  1861. }
  1862. }
  1863. Sdl.Sort.prototype = {
  1864. setDefaultOrder : function(order) {
  1865. this.order = order;
  1866. },
  1867. setSortButton : function(button) {
  1868. Sdl.Object.modifyClassName(button, 'sortHeader', null);
  1869. button.onclick = this.sortOnClick;
  1870. button.onmouseover = function() {Sdl.Object.modifyClassName(this, 'sortHeaderMouseOver', null);}
  1871. button.onmouseout = function() {Sdl.Object.modifyClassName(this, null, 'sortHeaderMouseOver');}
  1872. },
  1873. sort : function() {
  1874. var files = [], refs = [];
  1875. Sdl.browser.traverseAllFilesOnAttribute(function(a, file) {
  1876. var arr = {};
  1877. arr.sortValue = a.innerHTML;
  1878. arr.clone = file.cloneNode(true);
  1879. arr.file = file;
  1880. files.push(arr);
  1881. refs.push(file);
  1882. }, this.attribute);
  1883. if (files.length > 0) {
  1884. var len, parentNode;
  1885. if (this.type == 'literal') {files.sort(this.sortLiteral);}
  1886. else if (this.type == 'numeric'){files.sort(this.sortNumeric);}
  1887. parentNode = refs[0].parentNode;
  1888. len = refs.length;
  1889. for (var i = 0 ; i < len ; i++) {
  1890. parentNode.appendChild(files[i].file);
  1891. }
  1892. }
  1893. }
  1894. }
  1895. Sdl.SortManager = function() {
  1896. var this_clone = this;
  1897. this.defaultSort = null;
  1898. Sdl.browser.addOnLoadListener(function() {this_clone.browserOnLoadListener();});
  1899. }
  1900. Sdl.SortManager.prototype = {
  1901. browserOnLoadListener : function() {
  1902. if (Sdl.browser.status.success) {
  1903. if (this.defaultSort != null) {
  1904. this.defaultSort.sort();
  1905. }
  1906. }
  1907. }
  1908. }
  1909. //------------------------------------------------------------------------------
  1910. Sdl.System = {};
  1911. Sdl.System.isIe6 = function() {
  1912. if (navigator.userAgent.toLowerCase().indexOf('msie 6') != -1) {return true;}
  1913. }
  1914. Sdl.System.isOpera = function() {
  1915. if (navigator.userAgent.toLowerCase().indexOf('opera') != -1) {return true;}
  1916. }
  1917. Sdl.System.isFf1 = function() {
  1918. if (navigator.userAgent.toLowerCase().indexOf('gecko') != -1 && navigator.userAgent.toLowerCase().indexOf('rv:1.7') != -1) {return true;}
  1919. }
  1920. //------------------------------------------------------------------------------
  1921. Sdl.Text = function() {}
  1922. Sdl.Text.decodeHtmlEntity = function(text) {
  1923. text = text.replace('&amp;', '&');
  1924. text = text.replace('&lt;', '<');
  1925. text = text.replace('&gt;', '>');
  1926. return text;
  1927. }
  1928. Sdl.Text.encodeHtmlEntity = function(text) {
  1929. text = text.replace('&', '&amp;');
  1930. text = text.replace('<', '&lt;');
  1931. text = text.replace('>', '&gt;');
  1932. return text;
  1933. }
  1934. //------------------------------------------------------------------------------
  1935. Sdl.Xml = function() {}
  1936. Sdl.Xml.digestResponseXml = function(xhr) {
  1937. var container, nodes, response = {};
  1938. if (!xhr) {
  1939. response.valid = false;
  1940. response.debug = '" . text("ERROR") . " : Sdl.Ajax';
  1941. return response;
  1942. }
  1943. if (xhr.responseXML == null) {
  1944. response.valid = false;
  1945. response.debug = xhr.responseText.substr(0, " . DEBUG_XML_RESPONSE_LENGTH . ");
  1946. return response;
  1947. }
  1948. container = xhr.responseXML.documentElement;
  1949. if (!container || container.tagName != 'container') {
  1950. response.valid = false;
  1951. response.debug = xhr.responseText.substr(0, " . DEBUG_XML_RESPONSE_LENGTH . ");
  1952. return response;
  1953. }
  1954. response.valid = true;
  1955. response.status = {};
  1956. nodes = container.getElementsByTagName('error')[0].childNodes;
  1957. response.error = nodes[0] ? nodes[0].nodeValue : null;
  1958. nodes = container.getElementsByTagName('status')[0].childNodes;
  1959. response.status.text = nodes[0] ? nodes[0].nodeValue : null;
  1960. nodes = container.getElementsByTagName('content')[0].childNodes;
  1961. if (nodes[0]) {
  1962. response.contentNodes = nodes;
  1963. response.content = '';
  1964. for (var i = 0 ; i < nodes.length ; i++) {
  1965. response.content += nodes[i].nodeValue;
  1966. }
  1967. } else {
  1968. response.content = null;
  1969. }
  1970. nodes = container.getElementsByTagName('debug')[0].childNodes;
  1971. response.debug = nodes[0] ? nodes[0].nodeValue : null;
  1972. nodes = container.getElementsByTagName('message')[0].childNodes;
  1973. response.message = nodes[0] ? nodes[0].nodeValue : null;
  1974. nodes = container.getElementsByTagName('warning')[0].childNodes;
  1975. response.warning = nodes[0] ? nodes[0].nodeValue : null;
  1976. if (response.status.text != null) {
  1977. if (response.status.text == 'success') {
  1978. response.status.success = true;
  1979. } else if (response.status.text == 'error') {
  1980. response.status.success = false;
  1981. } else {
  1982. response.status.success = null;
  1983. }
  1984. } else {
  1985. response.status.success = null;
  1986. }
  1987. return response;
  1988. }
  1989. Sdl.Xml.validateResponseAndWarn = function(response) {
  1990. if (response.valid) {
  1991. return true;
  1992. } else {
  1993. alert('" . text("ERROR") . " : " . text("INCORRECT XML RESPONSE") . ".\\n" . text("DEBUG") . " : \\n' + response.debug);
  1994. return false;
  1995. }
  1996. }
  1997. Sdl.Xml.alertResponse = function(response) {
  1998. if (response.status.success != null) {
  1999. if (response.status.success == true) {
  2000. if(response.message) {alert(response.message);}
  2001. if(response.warning) {alert('" . text("WARNING") . " : ' + response.warning);}
  2002. } else if (response.status.success == false){
  2003. alert('" . text("ERROR") . " : ' + response.error);
  2004. }
  2005. } else {
  2006. alert('" . text("ERROR") . " : " . text("UNKNOWN RESPONSE STATUS") . "');
  2007. }
  2008. }
  2009. //------------------------------------------------------------------------------
  2010. Sdl.main = new Sdl.Main();
  2011. ";
  2012. return $javascript;
  2013. }
  2014. }
  2015. ?>
  2016. <?php
  2017. //------------------------------------------------------------------------------
  2018. // Class name : Layout
  2019. //------------------------------------------------------------------------------
  2020. class Layout {
  2021. var $cwdRelPath;
  2022. var $footer;
  2023. var $logout;
  2024. var $pageBrowser;
  2025. var $permittedDirRelPath;
  2026. var $sideBoxBottom;
  2027. var $sideBoxLeft;
  2028. var $sideBoxRight;
  2029. var $sideBoxTop;
  2030. var $view;
  2031. function getHtml() {
  2032. $this->cwdRelPath = addslashes($this->cwdRelPath);
  2033. if (!$this->sideBoxBottom) {$sideBoxBottomDisplay = "display:none;";}
  2034. if (!$this->sideBoxLeft) {$sideBoxLeftDisplay = "display:none;";}
  2035. if (!$this->sideBoxRight) {$sideBoxRightDisplay = "display:none;";}
  2036. if (!$this->sideBoxTop) {
  2037. $sideBoxTopDisplay = "display:none;";
  2038. $pagesClass = "pagesSideBoxTopNotExist";
  2039. } else {
  2040. $pagesClass = "pagesSideBoxTopExist";
  2041. }
  2042. $html = null;
  2043. $html .=
  2044. "
  2045. <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
  2046. <html>
  2047. <head>
  2048. <link rel='stylesheet' type='text/css' href='?print=css' />
  2049. <meta name='keywords' content='simple, directory, listing, $this->title'></meta>
  2050. <script type='text/javascript' src='?print=javascript'></script>
  2051. <script type='text/javascript'>
  2052. Sdl.browser.cwd.relPath = '$this->cwdRelPath';
  2053. Sdl.browser.view = '$this->view';
  2054. Sdl.browser.permittedDir.relPath = '$this->permittedDirRelPath';
  2055. </script>
  2056. <title>$this->title</title>
  2057. </head>
  2058. <body>
  2059. <div id='body'>
  2060. <div id='containerContainer'>
  2061. <table id='container'>
  2062. <tbody>
  2063. <tr>
  2064. <td class='containerCell' id='containerSideBoxLeftContainerCell' rowspan='3' style='{$sideBoxLeftDisplay}'>
  2065. <div id='containerSideBoxLeftContainer'>
  2066. <div id='containerSideBoxLeft'>$this->sideBoxLeft</div>
  2067. <div id='containerSideBoxLeftMovableBar'></div>
  2068. </div>
  2069. </td>
  2070. <td height='1px' class='containerCell' id='containerSideBoxTopContainerCell' colspan='2' style='{$sideBoxTopDisplay}'>
  2071. <div id='containerSideBoxTopContainer'>
  2072. <div id='containerSideBoxTop'>$this->sideBoxTop</div>
  2073. <div id='containerSideBoxTopMovableBar'></div>
  2074. </div>
  2075. </td>
  2076. </tr>
  2077. <tr>
  2078. <td class='containerCell' id='containerCentralContainerCell'>
  2079. <div id='containerCentralContainer'>
  2080. <div id='containerCentral'>
  2081. <div id='tabsContainer'>
  2082. <div id='tabs'></div>
  2083. <div id='tabsMovableBar'></div>
  2084. </div>
  2085. <div id='pagesContainer'>
  2086. <div id='pages' class='$pagesClass'>$this->pageBrowser</div>
  2087. <div id='pagesMovableBar'></div>
  2088. </div>
  2089. </div>
  2090. <div id='containerCentralMovableBar'></div>
  2091. </div>
  2092. </td>
  2093. <td class='containerCell' id='containerSideBoxRightContainerCell' style='{$sideBoxRightDisplay}'>
  2094. <div id='containerSideBoxRightContainer'>
  2095. <div id='containerSideBoxRight'>$this->sideBoxRight</div>
  2096. <div id='containerSideBoxRightMovableBar'></div>
  2097. </div>
  2098. </td>
  2099. <tr>
  2100. <td height='1px' class='containerCell' id='containerSideBoxBottomContainerCell' colspan='2' style='{$sideBoxBottomDisplay}'>
  2101. <div id='containerSideBoxBottomContainer'>
  2102. <div id='containerSideBoxBottom'>$this->sideBoxBottom</div>
  2103. <div id='containerSideBoxBottomMovableBar'></div>
  2104. </div>
  2105. </td>
  2106. </tr>
  2107. </tbody>
  2108. </table>
  2109. <div id='containerMovableBar'></div>
  2110. </div>
  2111. $this->footer
  2112. </div>
  2113. </body>
  2114. </html>
  2115. ";
  2116. return $html;
  2117. }
  2118. }
  2119. ?>
  2120. <?php
  2121. //------------------------------------------------------------------------------
  2122. // Class name : Locale
  2123. //------------------------------------------------------------------------------
  2124. class Locale {
  2125. var $text;
  2126. function text($str, $replace=null, $firstCap=false) {
  2127. $str = $this->text[$str];
  2128. if (isset($replace)) {
  2129. foreach ($replace as $key => $value) {
  2130. $str = str_replace($key, $value, $str);
  2131. }
  2132. }
  2133. if ($firstCap) {
  2134. $str = strtoupper(substr($str, 0, 1)) . substr($str, 1);
  2135. }
  2136. return $str;
  2137. }
  2138. function setLocale() {
  2139. $localeClass = LOCALE_CLASS;
  2140. $locale = new $localeClass;
  2141. $this->text = $locale->text;
  2142. }
  2143. }
  2144. ?>
  2145. <?php
  2146. //------------------------------------------------------------------------------
  2147. // Class name : System
  2148. //------------------------------------------------------------------------------
  2149. // added in 2.1
  2150. class System {
  2151. var $fileManager = null;
  2152. var $ftpLayerOn = false;
  2153. // added in 2.1
  2154. function sysChmod($absPath, $mode) {
  2155. $ftp = $this->fileManager->user->ftp;
  2156. if ($this->ftpLayerOn && $ftp) {
  2157. return $ftp->chmod($absPath, $mode);
  2158. } else {
  2159. return chmod($absPath, $mode);
  2160. }
  2161. }
  2162. // added in 2.1
  2163. function sysCopy($srcAbsPath, $desAbsPath) {
  2164. $ftp = $this->fileManager->user->ftp;
  2165. if ($this->ftpLayerOn && $ftp) {
  2166. return $ftp->copy($srcAbsPath, $desAbsPath);
  2167. } else {
  2168. return copy($srcAbsPath, $desAbsPath);
  2169. }
  2170. }
  2171. // added in 2.1
  2172. function sysMkdir($absPath) {
  2173. $ftp = $this->fileManager->user->ftp;
  2174. if ($this->ftpLayerOn && $ftp) {
  2175. return $ftp->mkdir($absPath);
  2176. } else {
  2177. return mkdir($absPath);
  2178. }
  2179. }
  2180. // added in 2.1
  2181. function sysMoveUploadedFile($tmpAbsPath, $desAbsPath) {
  2182. $ftp = $this->fileManager->user->ftp;
  2183. if ($this->ftpLayerOn && $ftp) {
  2184. return $ftp->moveUploadedFile($tmpAbsPath, $desAbsPath);
  2185. } else {
  2186. return move_uploaded_file($tmpAbsPath, $desAbsPath);
  2187. }
  2188. }
  2189. // added in 2.1
  2190. function sysRename($oldAbsPath, $newAbsPath) {
  2191. $ftp = $this->fileManager->user->ftp;
  2192. if ($this->ftpLayerOn && $ftp) {
  2193. return $ftp->rename($oldAbsPath, $newAbsPath);
  2194. } else {
  2195. return rename($oldAbsPath, $newAbsPath);
  2196. }
  2197. }
  2198. // added in 2.1
  2199. function sysRmdir($absPath) {
  2200. $ftp = $this->fileManager->user->ftp;
  2201. if ($this->ftpLayerOn && $ftp) {
  2202. return $ftp->rmdir($absPath);
  2203. } else {
  2204. return rmdir($absPath);
  2205. }
  2206. }
  2207. // added in 2.1
  2208. function sysTouch($absPath) {
  2209. $ftp = $this->fileManager->user->ftp;
  2210. if ($this->ftpLayerOn && $ftp) {
  2211. return $ftp->touch($absPath);
  2212. } else {
  2213. return touch($absPath);
  2214. }
  2215. }
  2216. // added in 2.1
  2217. function sysUnlink($absPath) {
  2218. $ftp = $this->fileManager->user->ftp;
  2219. if ($this->ftpLayerOn && $ftp) {
  2220. return $ftp->delete($absPath);
  2221. } else {
  2222. return unlink($absPath);
  2223. }
  2224. }
  2225. function sysWrite($absPath, $content) {
  2226. $ftp = $this->fileManager->user->ftp;
  2227. if ($this->ftpLayerOn && $ftp) {
  2228. return $ftp->putWithContent($absPath, $content);
  2229. } else {
  2230. return $this->write($absPath, $content);
  2231. }
  2232. }
  2233. }
  2234. ?>
  2235. <?php
  2236. //------------------------------------------------------------------------------
  2237. // Class name : Module
  2238. //------------------------------------------------------------------------------
  2239. class Module extends System{
  2240. var $enabled = true;
  2241. var $disabledIfNotRequired = false;
  2242. // removed in 2.1
  2243. //var $fileManager;
  2244. var $locale;
  2245. var $localeClass;
  2246. var $moduleManager;
  2247. var $requiredModules = array();
  2248. var $text;
  2249. // added in 2.1
  2250. var $enabledAdminMode = true;
  2251. var $enabledUserMode = true;
  2252. function Module() {
  2253. if ($this->localeClass) {$this->locale = new $this->localeClass;}
  2254. }
  2255. function getCss() {}
  2256. function getHtml($fileIndex) {}
  2257. function getHtmlParentDirectory($file, $view) {}
  2258. function getIcon() {
  2259. return $this->icons[$_GET["moduleParams"]["icon"]];
  2260. }
  2261. function getJavascript() {}
  2262. function getRss($file) {}
  2263. function text($str, $replace = null, $firstCap = false) {
  2264. return $this->locale->text($str, $replace, $firstCap);
  2265. }
  2266. }
  2267. ?>
  2268. <?php
  2269. //------------------------------------------------------------------------------
  2270. // Class name : ModuleManager
  2271. //------------------------------------------------------------------------------
  2272. class ModuleManager {
  2273. var $modules = array();
  2274. var $attributes = array();
  2275. var $functions = array();
  2276. //var $sideBoxes = array();
  2277. var $sideBoxesBottom = array();
  2278. var $sideBoxesLeft = array();
  2279. var $sideBoxesRight = array();
  2280. var $sideBoxesTop = array();
  2281. var $services = array();
  2282. // edited in 2.1;
  2283. function ModuleManager($user) {
  2284. $classes = get_declared_classes();
  2285. foreach ($classes as $class) {
  2286. $class = strtolower($class);
  2287. if (strpos($class, "module") === 0 && strlen($class) > 6) {
  2288. // PHP 4 returns lowercase while PHP 5 returns the original one
  2289. //if (get_parent_class($class) === "module") {
  2290. if (strtolower(get_parent_class($class)) === "module") {
  2291. $module = new $class;
  2292. if ($module->requiredModules) {
  2293. foreach ($module->requiredModules as $requiredModule) {
  2294. $requiredModule = strtolower($requiredModule);
  2295. if (!class_exists($requiredModule)) {
  2296. die(text("MODULE ERROR") . " : $class " . text("REQUIRES") . " $requiredModule");
  2297. }
  2298. }
  2299. }
  2300. if ($module->enabled) {
  2301. // "b8ff02892916ff59f7fbd4e617fccd01f6bca576" === sha1("Module")
  2302. if (($user->mode == "admin" && $module->enabledAdminMode) || ($user->mode == "user" && $module->enabledUserMode)) {
  2303. $this->modules[] = $module;
  2304. }
  2305. /*
  2306. if ($module->isAttribute === true) {
  2307. $this->attributes[] = $module;
  2308. } else if($module->isFunction === true) {
  2309. $this->functions[] = $module;
  2310. } else if($module->isSideBox === true) {
  2311. //$this->sideBoxes[] = $module;
  2312. if ($module->isSideBoxPositionBottom) $this->sideBoxesBottom[] = $module;
  2313. if ($module->isSideBoxPositionLeft) $this->sideBoxesLeft[] = $module;
  2314. if ($module->isSideBoxPositionRight) $this->sideBoxesRight[] = $module;
  2315. if ($module->isSideBoxPositionTop) $this->sideBoxesTop[] = $module;
  2316. } else {
  2317. $this->services[] = $module;
  2318. }
  2319. */
  2320. }
  2321. }
  2322. }
  2323. }
  2324. $requiredModules = array();
  2325. foreach ($this->modules as $module) {
  2326. foreach ($module->requiredModules as $requiredModule) {
  2327. $requiredModule = strtolower($requiredModule);
  2328. if(!$this->isModuleExist($requiredModule)) {
  2329. die(text("MODULE ERROR") . " : " . get_class($module) . " " . text("REQUIRES") . " $requiredModule");
  2330. }
  2331. $requiredModules[] = $requiredModule; // Store the list of required modules for next part
  2332. }
  2333. }
  2334. // Remove modules which are necessary only when required by others
  2335. foreach ($this->modules as $key => $module) {
  2336. if ($module->disabledIfNotRequired) {
  2337. if (!in_array(strtolower($module->moduleName), $requiredModules)) {
  2338. array_splice($this->modules, $key, 1);
  2339. }
  2340. }
  2341. }
  2342. foreach ($this->modules as $module) {
  2343. if ($module->isAttribute === true) {
  2344. $this->attributes[] = $module;
  2345. } else if($module->isFunction === true) {
  2346. $this->functions[] = $module;
  2347. } else if($module->isSideBox === true) {
  2348. //$this->sideBoxes[] = $module;
  2349. if ($module->isSideBoxPositionBottom) $this->sideBoxesBottom[] = $module;
  2350. if ($module->isSideBoxPositionLeft) $this->sideBoxesLeft[] = $module;
  2351. if ($module->isSideBoxPositionRight) $this->sideBoxesRight[] = $module;
  2352. if ($module->isSideBoxPositionTop) $this->sideBoxesTop[] = $module;
  2353. } else {
  2354. $this->services[] = $module;
  2355. }
  2356. }
  2357. $this->sortModules();
  2358. }
  2359. function getSideBoxes($pos, $cwdRelPath, $view) {
  2360. $html = null;
  2361. foreach ($this->{sideBoxes . $pos} as $sideBox) {
  2362. $html .= $sideBox->getHtml($cwdRelPath, $view);
  2363. }
  2364. return $html;
  2365. }
  2366. function isModuleExist($moduleName) {
  2367. foreach ($this->modules as $module) {
  2368. if (strcasecmp(get_class($module), $moduleName) == 0) {
  2369. return $module;
  2370. }
  2371. }
  2372. return false;
  2373. }
  2374. function setManagersToModules($fileManager, $user) {
  2375. foreach ($this->modules as $key=>$module) {
  2376. $this->modules[$key]->fileManager = $fileManager;
  2377. $this->modules[$key]->moduleManager = $this;
  2378. $this->modules[$key]->user = $user;
  2379. }
  2380. foreach ($this->functions as $key=>$function) {
  2381. $this->functions[$key]->fileManager = $fileManager;
  2382. $this->functions[$key]->moduleManager = $this;
  2383. $this->functions[$key]->user = $user;
  2384. }
  2385. foreach ($this->attributes as $key=>$attribute) {
  2386. $this->attributes[$key]->fileManager = $fileManager;
  2387. $this->attributes[$key]->moduleManager = $this;
  2388. $this->attributes[$key]->user = $user;
  2389. }
  2390. foreach ($this->sideBoxesBottom as $key=>$sideBox) {
  2391. $this->sideBoxesBottom[$key]->fileManager = $fileManager;
  2392. $this->sideBoxesBottom[$key]->moduleManager = $this;
  2393. $this->sideBoxesBottom[$key]->user = $user;
  2394. }
  2395. foreach ($this->sideBoxesLeft as $key=>$sideBox) {
  2396. $this->sideBoxesLeft[$key]->fileManager = $fileManager;
  2397. $this->sideBoxesLeft[$key]->moduleManager = $this;
  2398. $this->sideBoxesLeft[$key]->user = $user;
  2399. }
  2400. foreach ($this->sideBoxesRight as $key=>$sideBox) {
  2401. $this->sideBoxesRight[$key]->fileManager = $fileManager;
  2402. $this->sideBoxesRight[$key]->moduleManager = $this;
  2403. $this->sideBoxesRight[$key]->user = $user;
  2404. }
  2405. foreach ($this->sideBoxesTop as $key=>$sideBox) {
  2406. $this->sideBoxesTop[$key]->fileManager = $fileManager;
  2407. $this->sideBoxesTop[$key]->moduleManager = $this;
  2408. $this->sideBoxesTop[$key]->user = $user;
  2409. }
  2410. }
  2411. function sortModules() {
  2412. usort($this->attributes, array("ModuleManager", "sortModulesCmp"));
  2413. usort($this->functions, array("ModuleManager", "sortModulesCmp"));
  2414. //usort($this->sideBoxes, array("ModuleManager", "sortModulesCmp"));
  2415. usort($this->sideBoxesBottom, array("ModuleManager", "sortModulesCmp"));
  2416. usort($this->sideBoxesLeft, array("ModuleManager", "sortModulesCmp"));
  2417. usort($this->sideBoxesRight, array("ModuleManager", "sortModulesCmp"));
  2418. usort($this->sideBoxesTop, array("ModuleManager", "sortModulesCmp"));
  2419. }
  2420. function sortModulesCmp($module1, $module2) {
  2421. if ($module1->position == $module2->position) {return 0;}
  2422. return ($module1->position < $module2->position) ? -1 : 1;
  2423. }
  2424. }
  2425. ?>
  2426. <?php
  2427. //------------------------------------------------------------------------------
  2428. // Class name : Param
  2429. //------------------------------------------------------------------------------
  2430. class Param {
  2431. function filter(&$param) {
  2432. if (is_array($param)) {
  2433. array_map(array("Param", "filter"), &$param);
  2434. } else {
  2435. if (get_magic_quotes_gpc()) {$param = stripslashes($param);}
  2436. $param = Text::convertEncodingFromUtf8($param);
  2437. }
  2438. }
  2439. }
  2440. ?>
  2441. <?php
  2442. class Rss {
  2443. var $fileManager;
  2444. var $moduleManager;
  2445. function printRss($cwdRelPath) {
  2446. $content = array();
  2447. $content["description"] = "(RSS generated by Simple Directory Listing - http://simpledirectorylisting.net)";
  2448. if (RSS_ON) {
  2449. if (isset($cwdRelPath)) {
  2450. $cwd = $this->fileManager->getFileByRelPath($cwdRelPath);
  2451. if ($cwd) {
  2452. if ($cwd->isDir) {
  2453. if ($cwd->isPermitted) {
  2454. $files = $this->fileManager->getFilesByDir($cwd->absPath);
  2455. $content["title"] = text("INDEX OF") . " /$cwd->relPath";
  2456. $content["link"] = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}?cwdRelPath=$cwd->relPath";
  2457. $content["items"] = array();
  2458. if (count($files) > 0) {
  2459. foreach ($files as $fileIndex=>$file) {
  2460. $description = null;
  2461. foreach ($this->moduleManager->attributes as $attribute) {
  2462. $description .= $attribute->getRss($file, $fileIndex);
  2463. }
  2464. $item = array();
  2465. $item["description"] = $description;
  2466. $item["link"] = $file->url;
  2467. $item["title"] = $file->basename;
  2468. $content["items"][] = $item;
  2469. }
  2470. }
  2471. } else {
  2472. $content["title"] = text("ACCESS DENIED");
  2473. $content["link"] = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}";
  2474. }
  2475. } else {
  2476. $content["title"] = text("ACCESS DENIED");
  2477. $content["link"] = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}";
  2478. }
  2479. } else {
  2480. $content["title"] = text("ACCESS DENIED");
  2481. $content["link"] = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}";
  2482. }
  2483. } else {
  2484. $content["title"] = text("ACCESS DENIED");
  2485. $content["link"] = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}";
  2486. }
  2487. } else {
  2488. $content["title"] = text("RSS IS DISABLED.");
  2489. $content["link"] = "http://{$_SERVER['SERVER_NAME']}{$_SERVER['SCRIPT_NAME']}";
  2490. }
  2491. $this->dumb($content);
  2492. }
  2493. function dumb($content) {
  2494. $xml = null;
  2495. $content["title"] = Text::convertEncodingToUtf8($content["title"]);
  2496. $content["link"] = Text::convertEncodingToUtf8($content["link"]);
  2497. $content["description"] = Text::convertEncodingToUtf8($content["description"]);
  2498. $xml .=
  2499. "<?xml version='1.0' encoding='utf-8'?>" .
  2500. "<rss version='2.0'>" .
  2501. "<channel>" .
  2502. "<title>" . htmlentities($content["title"], null, "utf-8") . "</title>" .
  2503. "<link>" . htmlentities($content["link"], null, "utf-8") . "</link>" .
  2504. "<description>" . htmlentities($content["description"], null, "utf-8") . "</description>" .
  2505. "<generator>Simple Directory Listing</generator>";
  2506. if ($content["items"]) {
  2507. foreach ($content["items"] as $item) {
  2508. $item["title"] = Text::convertEncodingToUtf8($item["title"]);
  2509. $item["link"] = Text::convertEncodingToUtf8($item["link"]);
  2510. $item["description"] = Text::convertEncodingToUtf8($item["description"]);
  2511. $xml .=
  2512. "<item>" .
  2513. "<title>" . htmlentities($item["title"], null, "utf-8") . "</title>" .
  2514. "<link>" . htmlentities($item["link"], null, "utf-8") . "</link>" .
  2515. "<description>" . htmlentities($item["description"], null, "utf-8") . "</description>" .
  2516. "</item>";
  2517. }
  2518. }
  2519. $xml .=
  2520. "</channel>" .
  2521. "</rss>";
  2522. header("content-type: text/xml");
  2523. echo $xml;
  2524. }
  2525. }
  2526. ?>
  2527. <?php
  2528. class Sfs {
  2529. var $fileManager;
  2530. function printSfs($cwdRelPath) {
  2531. $content = array();
  2532. if (SFS_ON) {
  2533. if (isset($cwdRelPath)) {
  2534. $cwd = $this->fileManager->getFileByRelPath($cwdRelPath);
  2535. if ($cwd) {
  2536. if ($cwd->isDir) {
  2537. if($cwd->url != false) {
  2538. if ($cwd->isPermitted) {
  2539. $files = $this->fileManager->getFilesByDir($cwd->absPath);
  2540. $content["description"] = "(SFS generated by Simple Directory Listing - http://simpledirectorylisting.net)";
  2541. $content["cwd"] = array();
  2542. $content["cwd"]["path"] = $cwd->relPath;
  2543. $content["cwd"]["link"] = $cwd->url;
  2544. $content["cwd"]["mtime"] = filemtime($cwd->absPath);
  2545. $content["files"] = array();
  2546. if (count($files) > 0) {
  2547. foreach ($files as $fileIndex=>$file) {
  2548. $item = array();
  2549. $item["name"] = $file->basename;
  2550. $item["mtime"] = filemtime($file->absPath);
  2551. if ($file->isDir) {
  2552. $item["type"] = "dir";
  2553. $item["size"] = "";
  2554. } else {
  2555. $item["type"] = "file";
  2556. $item["size"] = filesize($file->absPath);
  2557. }
  2558. $content["files"][] = $item;
  2559. }
  2560. }
  2561. } else {
  2562. $content["description"] = text("ACCESS DENIED");
  2563. }
  2564. } else {
  2565. $content["description"] = text("ACCESS DENIED");
  2566. }
  2567. } else {
  2568. $content["description"] = text("ACCESS DENIED");
  2569. }
  2570. } else {
  2571. $content["description"] = text("ACCESS DENIED");
  2572. }
  2573. } else {
  2574. $content["description"] = text("ACCESS DENIED");
  2575. }
  2576. } else {
  2577. $content["description"] = text("ACCESS DENIED");
  2578. }
  2579. $this->dumb($content);
  2580. }
  2581. function dumb($content) {
  2582. $xml = null;
  2583. $content["description"] = Text::convertEncodingToUtf8($content["description"]);
  2584. $xml .=
  2585. "<?xml version='1.0' encoding='utf-8'?>" .
  2586. "<sfs version='1.0'>" .
  2587. "<description>{$content["description"]}</description>";
  2588. if ($content["cwd"]) {
  2589. $content["cwd"]["path"] = Text::convertEncodingToUtf8($content["cwd"]["path"]);
  2590. $content["cwd"]["link"] = Text::convertEncodingToUtf8($content["cwd"]["link"]);
  2591. $xml .=
  2592. "<cwd>" .
  2593. "<path>" . htmlentities($content["cwd"]["path"], null, "utf-8") . "</path>" .
  2594. "<link>" . htmlentities($content["cwd"]["link"], null, "utf-8") . "</link>" .
  2595. "<mtime>{$content["cwd"]["mtime"]}</mtime>" .
  2596. "</cwd>";
  2597. }
  2598. if ($content["files"]) {
  2599. foreach ($content["files"] as $file) {
  2600. $file["name"] = Text::convertEncodingToUtf8($file["name"]);
  2601. $file["link"] = Text::convertEncodingToUtf8($file["link"]);
  2602. $xml .=
  2603. "<file>" .
  2604. "<name>" . htmlentities($file["name"], null, "utf-8") . "</name>" .
  2605. "<mtime>{$file["mtime"]}</mtime>" .
  2606. "<size>{$file["size"]}</size>" .
  2607. "<type>{$file["type"]}</type>" .
  2608. "</file>";
  2609. }
  2610. }
  2611. $xml .=
  2612. "</sfs>";
  2613. header("content-type: text/xml");
  2614. echo $xml;
  2615. }
  2616. }
  2617. ?>
  2618. <?php
  2619. //------------------------------------------------------------------------------
  2620. // Class name : SimpleDirectoryListing
  2621. //------------------------------------------------------------------------------
  2622. class SimpleDirectoryListing {
  2623. var $fileManager;
  2624. var $moduleManager;
  2625. var $user;
  2626. // edited in 2.1;
  2627. function SimpleDirectoryListing() {
  2628. $this->validateConfig();
  2629. // edited in 2.1;
  2630. if (!SYSTEM_ON || (!ADMIN_MODE_ON && !USER_MODE_ON)){
  2631. if (!(isset($_GET["print"]) || isset($_GET["action"]))) {
  2632. echo text("SYSTEM HAS BEEN SHUTTED DOWN");
  2633. }
  2634. exit(0);
  2635. }
  2636. #-----------------------------------------------------------------------
  2637. # Service is available
  2638. #-----------------------------------------------------------------------
  2639. #-----------------------------------------------------------------------
  2640. # Anonymous visitor
  2641. #-----------------------------------------------------------------------
  2642. Param::filter($_GET);
  2643. Param::filter($_POST);
  2644. UserManager::proceedLoginLogout();
  2645. $this->user = UserManager::checkPermissionAndGetUser();
  2646. if (!$this->user) {
  2647. if (!(isset($_GET["print"]) || isset($_GET["action"]))) {UserManager::printLogin();}
  2648. if (isset($_GET["action"]) || $_GET["print"] === "dirListing") {echo text("PLEASE LOGIN");};
  2649. exit(0);
  2650. }
  2651. #-----------------------------------------------------------------------
  2652. # Have rights to access
  2653. #-----------------------------------------------------------------------
  2654. // added in 2.1;
  2655. if (($_GET["system"] === "loginPage") && !$_SESSION["loggedIn"]) {
  2656. UserManager::printLogin();
  2657. exit(0);
  2658. }
  2659. $this->moduleManager = new moduleManager($this->user);
  2660. // The output is static data
  2661. if (($_GET["print"] === "css")) {
  2662. $this->printCss();
  2663. exit(0);
  2664. }
  2665. // The output is static data
  2666. if (($_GET["print"] === "icon")) {
  2667. $this->printIcon();
  2668. exit(0);
  2669. }
  2670. // The output is static data
  2671. if (($_GET["print"] === "javascript")) {
  2672. $this->printJavascript();
  2673. exit(0);
  2674. }
  2675. #-----------------------------------------------------------------------
  2676. # Needs to have the $_GET['relCwd']
  2677. #-----------------------------------------------------------------------
  2678. #-----------------------------------------------------------------------
  2679. # Printing of sections and modules
  2680. # Execution of actions
  2681. #-----------------------------------------------------------------------
  2682. $this->fileManager = New fileManager();
  2683. $this->fileManager->user = $this->user;
  2684. $this->moduleManager->setManagersToModules($this->fileManager, $this->user);
  2685. // The output is static data
  2686. if (($_GET["print"] === "image")) {
  2687. $this->printImage();
  2688. exit(0);
  2689. }
  2690. // The output is static data
  2691. if (($_GET["print"] === "thumbnail")) {
  2692. $this->printThumbnail();
  2693. exit(0);
  2694. }
  2695. // The output is dynamic
  2696. if ($_GET["print"] === "dirListing") {
  2697. $this->printDirListing();
  2698. exit(0);
  2699. }
  2700. // The output is dynamic
  2701. if ($_GET["print"] === "rss") {
  2702. $this->printRss();
  2703. exit(0);
  2704. }
  2705. // The output is dynamic
  2706. if ($_GET["print"] === "sfs") {
  2707. $this->printSfs();
  2708. exit(0);
  2709. }
  2710. // The output is dynamic
  2711. if ($_GET["action"] === "module") {
  2712. $this->actionModule();
  2713. exit(0);
  2714. }
  2715. $this->printHtml();
  2716. exit(0);
  2717. }
  2718. function actionModule() {
  2719. $module = $this->moduleManager->isModuleExist($_GET["module"]);
  2720. if ($module) {
  2721. //$module->fileManager = $this->fileManager;
  2722. //$module->moduleManager = $this->moduleManager;
  2723. //$module->user = $this->user;
  2724. $module->action();
  2725. }
  2726. exit(0);
  2727. }
  2728. // edited in 2.1;
  2729. function getFooter() {
  2730. if (isset($_GET["cwdRelPath"])) {$rss = $sfs = $_GET["cwdRelPath"];}
  2731. else {$rss = $sfs = $this->user->permittedDirRelPath;}
  2732. if ($_SESSION["loggedIn"] === true) {
  2733. $logout = " <a href='?system=logout'>" . text("LOGOUT") . "</a>";
  2734. } else {
  2735. // shows login only if one of the modes needs login
  2736. if ((ADMIN_MODE_ON && ADMIN_MODE_NEEDS_LOGIN) || (USER_MODE_ON && USER_MODE_NEEDS_LOGIN)) {
  2737. $login = " <a href='?system=loginPage'>" . text("LOGIN") . "</a>";
  2738. }
  2739. }
  2740. $footer = null;
  2741. $footer .= "<div id='footer'>";
  2742. $footer .= "<div style='float:left'>";
  2743. $footer .= "<span id='poweredBy'><i><b>powered by <a href='http://simpledirectorylisting.net'>SimpleDirectoryListing</a></b></i></span>";
  2744. $footer .= " <a href='?print=rss&cwdRelPath=$rss' id='rss' target='_blank'>RSS</a>";
  2745. $footer .= " <a href='?print=sfs&cwdRelPath=$sfs' id='sfs' target='_blank'>SFS</a>";
  2746. $footer .= $login . $logout;
  2747. $footer .= " Mode:" . $this->user->mode;
  2748. $footer .= " <span id='font' style='cursor:pointer; display:none'>Font size: <span onclick='Sdl.Layout.increaseFontSize();'>[+]</span> <span onclick='Sdl.Layout.decreaseFontSize();'>[-]</span></span>";
  2749. $footer .= "</div>";
  2750. $footer .= "<div style='float:right'>" . META_WEB_SITE_NAME . "</div>";
  2751. $footer .= "</div>";
  2752. return $footer;
  2753. }
  2754. function getTheme() {
  2755. if (get_parent_class($_GET["theme"]) === "theme") {
  2756. $_SESSION["theme"] = $_GET["theme"];
  2757. $theme = new $_GET["theme"];
  2758. } else if (get_parent_class($_SESSION["theme"]) === "theme") {
  2759. $theme = new $_SESSION["theme"];
  2760. } else {
  2761. $themeName = THEME_CLASS;
  2762. $theme = new $themeName;
  2763. }
  2764. return $theme;
  2765. }
  2766. function printCss() {
  2767. header("Cache-Control: public");
  2768. header("content-type: text/css");
  2769. $theme = $this->getTheme();
  2770. $css = null;
  2771. $css .= $theme->getCss();
  2772. foreach ($this->moduleManager->modules as $module) {
  2773. $css .= $module->getCss();
  2774. }
  2775. echo $css;
  2776. exit(0);
  2777. }
  2778. // Output in XML format
  2779. function printDirListing() {
  2780. $browser = new Browser;
  2781. $browser->fileManager = $this->fileManager;
  2782. $browser->moduleManager = $this->moduleManager;
  2783. $browser->printDirListing($_GET["cwdRelPath"]);
  2784. exit(0);
  2785. }
  2786. function printHtml() {
  2787. $layout = new Layout;
  2788. $browser = new Browser;
  2789. if (isset($_GET["cwdRelPath"])) {$cwdRelPath = $_GET["cwdRelPath"];}
  2790. else {$cwdRelPath = $this->user->permittedDirRelPath;}
  2791. if ($_GET["view"] === "list" || $_GET["view"] === "thumbnail") {$view = $_GET["view"];}
  2792. else { $view = "list";}
  2793. $browser->fileManager = $this->fileManager;
  2794. $browser->moduleManager = $this->moduleManager;
  2795. $layout->pageBrowser = $browser->getHtml();
  2796. $layout->sideBoxBottom = $browser->moduleManager->getSideBoxes("Bottom", $cwdRelPath, $view);
  2797. $layout->sideBoxLeft = $browser->moduleManager->getSideBoxes("Left", $cwdRelPath, $view);
  2798. $layout->sideBoxRight = $browser->moduleManager->getSideBoxes("Right", $cwdRelPath, $view);
  2799. $layout->sideBoxTop = $browser->moduleManager->getSideBoxes("Top", $cwdRelPath, $view);
  2800. $layout->permittedDirRelPath = Text::htmlentitiesUtf8($this->user->permittedDirRelPath);
  2801. $layout->cwdRelPath = Text::htmlentitiesUtf8($cwdRelPath);
  2802. $layout->view = $view;
  2803. $layout->title = Text::htmlentitiesUtf8("/$cwdRelPath") . " - Simple Directory Listing";
  2804. $layout->footer = $this->getFooter();
  2805. header("Cache-Control: no-cache, must-revalidate");
  2806. header("Content-Type: text/html; charset=utf-8");
  2807. $html = null;
  2808. $html .= $layout->getHtml();
  2809. echo Text::convertEncodingToUtf8($html);
  2810. }
  2811. function printIcon() {
  2812. if (ICON_ON) {
  2813. if (isset($_GET["module"])) {
  2814. if ($this->moduleManager->isModuleExist($_GET["module"])) {
  2815. header("Cache-Control: public");
  2816. $module = new $_GET["module"];
  2817. $icon = base64_decode($module->getIcon());
  2818. }
  2819. } else {
  2820. $theme = $this->getTheme();
  2821. $icon = base64_decode($theme->icons[$_GET["icon"]]);
  2822. }
  2823. //header('Content-type: image/gif');
  2824. header('Content-length: '.strlen($icon));
  2825. echo $icon;
  2826. }
  2827. exit(0);
  2828. }
  2829. function printImage() {
  2830. if (IMAGE_PASSTHRU_ON) {
  2831. $file = $this->fileManager->getFileByRelPath($_GET["relPath"]);
  2832. if ($file) {
  2833. if ($file->isPermitted) {
  2834. $image = new Image();
  2835. $image->printImage($file);
  2836. }
  2837. }
  2838. }
  2839. exit(0);
  2840. }
  2841. function printJavascript() {
  2842. $javascriptObj = new Javascript;
  2843. $javascript = $javascriptObj->getJavascrtipt();
  2844. foreach ($this->moduleManager->modules as $module) {
  2845. $javascript .= $module->getJavascript();
  2846. }
  2847. header("Cache-Control: public");
  2848. header("content-type: text/javascript");
  2849. echo $javascript;
  2850. }
  2851. function printRss() {
  2852. $rss = new Rss;
  2853. $rss->fileManager = $this->fileManager;
  2854. $rss->moduleManager = $this->moduleManager;
  2855. $rss->printRss($_GET["cwdRelPath"]);
  2856. exit(0);
  2857. }
  2858. function printSfs() {
  2859. $sfs = new Sfs;
  2860. $sfs->fileManager = $this->fileManager;
  2861. //$rss->moduleManager = $this->moduleManager;
  2862. $sfs->printSfs($_GET["cwdRelPath"]);
  2863. exit(0);
  2864. }
  2865. function printThumbnail() {
  2866. if (THUMBNAIL_ON) {
  2867. $file = $this->fileManager->getFileByRelPath($_GET["relPath"]);
  2868. if ($file) {
  2869. if ($file->isPermitted) {
  2870. $image = new Image();
  2871. $image->printThumbnail($file);
  2872. }
  2873. }
  2874. }
  2875. exit(0);
  2876. }
  2877. function validateConfig() {}
  2878. }
  2879. ?>
  2880. <?php
  2881. //------------------------------------------------------------------------------
  2882. // Class name : Text
  2883. //------------------------------------------------------------------------------
  2884. class Text {
  2885. var $text;
  2886. function convertEncodingToUtf8($str) {
  2887. if(OS_ENCODING != null) {
  2888. if (mb_detect_encoding($str, OS_ENCODING . ",utf-8")) {
  2889. return mb_convert_encoding($str, "utf-8", OS_ENCODING . ",utf-8");
  2890. }
  2891. }
  2892. return $str;
  2893. }
  2894. function convertEncodingFromUtf8($str) {
  2895. if(OS_ENCODING != null) {
  2896. if (mb_detect_encoding($str, OS_ENCODING . ",utf-8")) {
  2897. return mb_convert_encoding($str, OS_ENCODING, OS_ENCODING . ",utf-8");
  2898. }
  2899. }
  2900. return $str;
  2901. }
  2902. function htmlentitiesUtf8($str) {
  2903. return htmlentities(Text::convertEncodingToUtf8($str), null, "utf-8");
  2904. }
  2905. }
  2906. ?>
  2907. <?php
  2908. //------------------------------------------------------------------------------
  2909. // Class name : Theme
  2910. //------------------------------------------------------------------------------
  2911. class Theme {
  2912. var $icons = array();
  2913. function getCss() {}
  2914. }
  2915. ?>
  2916. <?php
  2917. //------------------------------------------------------------------------------
  2918. // Class name : User
  2919. //------------------------------------------------------------------------------
  2920. class User {
  2921. var $ftp = null;
  2922. var $mode = false;
  2923. var $virtualRootAbsPath = null;
  2924. var $permittedDirAbsPath = null;
  2925. var $permittedDirRelPath = null;
  2926. }
  2927. ?>
  2928. <?php
  2929. //------------------------------------------------------------------------------
  2930. // Class name : UserManager
  2931. //------------------------------------------------------------------------------
  2932. class UserManager {
  2933. var $user;
  2934. // edited in 2.1;
  2935. // It checks session and config
  2936. function getMode() {
  2937. if (ADMIN_MODE_ON) {
  2938. if (ADMIN_MODE_NEEDS_LOGIN) {
  2939. if ($_SESSION["mode"] === "admin") {return "admin";}
  2940. } else {
  2941. return "admin";
  2942. }
  2943. }
  2944. if (USER_MODE_ON) {
  2945. if (USER_MODE_NEEDS_LOGIN) {
  2946. if ($_SESSION["mode"] === "user") {return "user";}
  2947. } else {
  2948. return "user";
  2949. }
  2950. }
  2951. return false;
  2952. }
  2953. // edited in 2.1;
  2954. // It returns a user
  2955. function checkPermissionAndGetUser() {
  2956. $user = new User;
  2957. $user->mode = UserManager::getMode();
  2958. if ($user->mode === "admin") {
  2959. //$user->virtualRootAbsPath = ADMIN_MODE_VIRTUAL_ROOT;
  2960. $configVirtualRoot = ADMIN_MODE_VIRTUAL_ROOT;
  2961. $configCustomVirtualRoot = ADMIN_MODE_CUSTOM_VIRTUAL_ROOT;
  2962. $configPermittedDir = ADMIN_MODE_PERMITTED_DIR;
  2963. } elseif ($user->mode === "user") {
  2964. $configVirtualRoot = USER_MODE_VIRTUAL_ROOT;
  2965. $configCustomVirtualRoot = USER_MODE_CUSTOM_VIRTUAL_ROOT;
  2966. $configPermittedDir = USER_MODE_PERMITTED_DIR;
  2967. }
  2968. else {return false;}
  2969. $user->virtualRootAbsPath = $configVirtualRoot;
  2970. // Some OS's add an ending slash to paths of directories
  2971. if ($user->virtualRootAbsPath === "CURRENT_WORKING_DIR") {$user->virtualRootAbsPath = dirname($_SERVER['SCRIPT_FILENAME']);}
  2972. elseif ($user->virtualRootAbsPath === "DOCUMENT_ROOT") {$user->virtualRootAbsPath = $_SERVER['DOCUMENT_ROOT'];}
  2973. elseif ($user->virtualRootAbsPath === "SERVER_ROOT") {$user->virtualRootAbsPath = substr($_SERVER['DOCUMENT_ROOT'], 0, strpos($_SERVER['DOCUMENT_ROOT'], "/")+ 1);}
  2974. elseif ($user->virtualRootAbsPath === "CUSTOM_ROOT") {$user->virtualRootAbsPath = $configCustomVirtualRoot;}
  2975. // virtual root does not need to have relPath because it is null.
  2976. $user->virtualRootAbsPath = FileManager::changeSlashes($user->virtualRootAbsPath);
  2977. $user->virtualRootAbsPath = FileManager::addEndingSlash($user->virtualRootAbsPath);
  2978. if (!realpath($user->virtualRootAbsPath)) {
  2979. if ($user->mode === "admin") die(text("CONFIG ERROR") . " : ADMIN_MODE_VIRTUAL_ROOT, ADMIN_MODE_CUSTOM_VIRTUAL_ROOT");
  2980. if ($user->mode === "user") die(text("CONFIG ERROR") . " : USER_MODE_VIRTUAL_ROOT, USER_MODE_CUSTOM_VIRTUAL_ROOT");
  2981. }
  2982. $user->permittedDirRelPath = $configPermittedDir;
  2983. $user->permittedDirRelPath = FileManager::changeSlashes($user->permittedDirRelPath);
  2984. $user->permittedDirRelPath = FileManager::addEndingSlash($user->permittedDirRelPath);
  2985. $user->permittedDirRelPath = FileManager::removeBeginningSlash($user->permittedDirRelPath); // 2007-12-26
  2986. $user->permittedDirAbsPath = $user->virtualRootAbsPath . $user->permittedDirRelPath;
  2987. if (!realpath($user->permittedDirAbsPath)) {
  2988. if ($user->mode === "admin") die(text("CONFIG ERROR") . " : ADMIN_MODE_PERMITTED_DIR");
  2989. if ($user->mode === "user") die(text("CONFIG ERROR") . " : USER_MODE_PERMITTED_DIR");
  2990. }
  2991. if (FTP_LAYER_ON) {
  2992. $ftp = new Ftp;
  2993. //$ftp->connect(); // It checks the ftp account but would decrease performance.
  2994. $user->ftp = $ftp;
  2995. }
  2996. return $user;
  2997. }
  2998. // edited in 2.1;
  2999. function proceedLoginLogout() {
  3000. if (SESSION_SAVE_PATH) session_save_path(SESSION_SAVE_PATH);
  3001. if (SESSION_GC_MAXLIFETIME) ini_set("session.gc_maxlifetime", (string)SESSION_GC_MAXLIFETIME);
  3002. if ($_GET["system"] === "login") {
  3003. // Submit from a non-javscript browser
  3004. if (isset($_POST["njs"])) {
  3005. $password = null;
  3006. if (PASSWORD_FORMAT === "SHA1") {
  3007. $password = sha1($_POST["password"]);
  3008. } else {
  3009. $password = $_POST["password"];
  3010. }
  3011. // Correct
  3012. if ((ADMIN_MODE_ON && $_POST["loginName"] === ADMIN_MODE_LOGIN_NAME && $password === ADMIN_MODE_PASSWORD) ||
  3013. (USER_MODE_ON && $_POST["loginName"] === USER_MODE_LOGIN_NAME && $password === USER_MODE_PASSWORD)) {
  3014. // Save login
  3015. if (SAVE_LOGIN_ON && $_POST["saveLogin"] === "on") {
  3016. session_cache_expire(SESSION_CACHE_EXPIRE);
  3017. session_start();
  3018. setcookie(session_name(), session_id(), time() + 60 * SESSION_CACHE_EXPIRE);
  3019. // Ordinary session
  3020. } else {
  3021. session_start();
  3022. }
  3023. if (ADMIN_MODE_ON && $_POST["loginName"] === ADMIN_MODE_LOGIN_NAME && $password === ADMIN_MODE_PASSWORD) {
  3024. $_SESSION["mode"] = "admin";
  3025. } else {
  3026. $_SESSION["mode"] = "user";
  3027. }
  3028. $_SESSION["loggedIn"] = true;
  3029. // Incorrect
  3030. } else {
  3031. session_start();
  3032. // Saved for filling values of input and showing login message
  3033. $_SESSION["njs"] = array();
  3034. $_SESSION["njs"]["isLoginCorrect"] = false;
  3035. $_SESSION["njs"]["loginName"] = $_POST["loginName"];
  3036. }
  3037. sleep(1);
  3038. header("location:?{$_POST["query"]}");
  3039. exit(0);
  3040. // Ordinary flow
  3041. } else {
  3042. $xml = new Xml();
  3043. $password = null;
  3044. if (PASSWORD_FORMAT === "SHA1") {
  3045. $password = sha1($_POST["password"]);
  3046. } else {
  3047. $password = $_POST["password"];
  3048. }
  3049. // Correct
  3050. if ((ADMIN_MODE_ON && $_POST["loginName"] === ADMIN_MODE_LOGIN_NAME && $password === ADMIN_MODE_PASSWORD) ||
  3051. (USER_MODE_ON && $_POST["loginName"] === USER_MODE_LOGIN_NAME && $password === USER_MODE_PASSWORD)) {
  3052. // Save login
  3053. if (SAVE_LOGIN_ON && $_POST["saveLogin"] === "true") {
  3054. session_cache_expire(SESSION_CACHE_EXPIRE);
  3055. session_start();
  3056. setcookie(session_name(), session_id(), time() + 60 * SESSION_CACHE_EXPIRE);
  3057. // Ordinary session
  3058. } else {
  3059. session_start();
  3060. }
  3061. if (ADMIN_MODE_ON && $_POST["loginName"] === ADMIN_MODE_LOGIN_NAME && $password === ADMIN_MODE_PASSWORD) {
  3062. $_SESSION["mode"] = "admin";
  3063. } else {
  3064. $_SESSION["mode"] = "user";
  3065. }
  3066. $_SESSION["loggedIn"] = true;
  3067. $xml->setStatusSuccess();
  3068. $xml->setContent("1");
  3069. // Incorrect
  3070. } else {
  3071. $xml->setStatusSuccess();
  3072. $xml->setMessage(text("INCORRECT LOGIN NAME OR PASSWORD"));
  3073. }
  3074. sleep(1);
  3075. $xml->dump();
  3076. exit(0);
  3077. }
  3078. exit(0);
  3079. } else {
  3080. if ($_GET["system"] === "logout") {
  3081. session_start();
  3082. session_unset();
  3083. session_destroy();
  3084. setcookie(session_name(), "");
  3085. echo "<html><body style='font-family:arial'>" . text("YOU HAVE SUCCESSFULLY LOGGED OUT") . " <a href='?'>" . text("BACK") . "</a></body></html>";
  3086. exit(0);
  3087. }
  3088. }
  3089. session_start();
  3090. }
  3091. // edited in 2.1;
  3092. function getLogin() {
  3093. // Safari 3 beta submits form when pressing Enter no matter there is Submit input or not.
  3094. // Safari doesn't align inline table to center
  3095. if (isset($_SESSION["njs"])) {
  3096. if ($_SESSION["njs"]["isLoginCorrect"] === false) {$msg = text("INCORRECT LOGIN NAME OR PASSWORD");}
  3097. $loginName = $_SESSION["njs"]["loginName"];
  3098. unset($_SESSION["njs"]);
  3099. }
  3100. if (SAVE_LOGIN_ON) {$saveLogin = "<input name='saveLogin' id='saveLogin' style='vertical-align:middle' type='checkbox' value='on'><span style='font-size:0.7em;'>" . text("REMEMBER ME") . "</span>";}
  3101. if ((ADMIN_MODE_ON && !ADMIN_MODE_NEEDS_LOGIN) || (USER_MODE_ON && !USER_MODE_NEEDS_LOGIN)) {
  3102. $accessWithoutLogin = " <a href='?'>(" . text("ACCESS WITHOUT LOGIN") . ")</a>";
  3103. }
  3104. $html = null;
  3105. $html .=
  3106. "
  3107. <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
  3108. <html>
  3109. <head>
  3110. <title>" . text("LOGIN") . " - Simple Directory Listing</title>
  3111. <meta name='keywords' content='simple, directory, listing'></meta>
  3112. <script type='text/javascript'>
  3113. //------------------------------------------------------------------------------
  3114. var Sdl = {};
  3115. //------------------------------------------------------------------------------
  3116. Sdl.Ajax = function() {}
  3117. Sdl.Ajax.ajaxGet = function(fn, targetLink) {
  3118. var xhr;
  3119. xhr = Sdl.Ajax.initializeAjax();
  3120. if (xhr) {
  3121. //xhr.onerror = Sdl.Ajax.onError; //IE6 doesn't support it.
  3122. xhr.onreadystatechange = function() {
  3123. if(xhr.readyState == 4) {fn(xhr)};
  3124. }
  3125. xhr.open('GET', targetLink, true);
  3126. xhr.send(null);
  3127. return xhr;
  3128. } else {
  3129. return false;
  3130. }
  3131. }
  3132. Sdl.Ajax.ajaxPost = function(fn, targetLink, param) {
  3133. var xhr
  3134. xhr = Sdl.Ajax.initializeAjax();
  3135. if (xhr) {
  3136. //xhr.onerror = Sdl.Ajax.onError; //IE6 doesn't support it.
  3137. xhr.onreadystatechange = function() {
  3138. if(xhr.readyState == 4) {fn(xhr)};
  3139. }
  3140. xhr.open('POST', targetLink, true);
  3141. xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
  3142. xhr.setRequestHeader('Content-length', param.length);
  3143. xhr.setRequestHeader('Connection', 'close');
  3144. xhr.send(param);
  3145. return xhr;
  3146. } else {
  3147. return false;
  3148. }
  3149. }
  3150. Sdl.Ajax.initializeAjax = function() {
  3151. var xhr;
  3152. try {
  3153. xhr = new XMLHttpRequest(); // FF & IE7
  3154. } catch (e) {
  3155. try {
  3156. xhr = new ActiveXObject('MSXML2.XMLHTTP.3.0');
  3157. } catch(e) {
  3158. try {
  3159. xhr = new ActiveXObject('Microsoft.XMLHTTP');
  3160. } catch(e) {
  3161. alert('" . text("JAVASCRIPT ERROR") . "');
  3162. return false;
  3163. }
  3164. }
  3165. }
  3166. return xhr;
  3167. }
  3168. Sdl.Ajax.onError = function() {
  3169. alert('" . text("JAVASCRIPT ERROR") . "');
  3170. }
  3171. //------------------------------------------------------------------------------
  3172. Sdl.Login = {};
  3173. Sdl.Login = function() {}
  3174. Sdl.Login.prototype = {
  3175. ajaxActionSubmit : function(xhr) {
  3176. var response;
  3177. response = Sdl.Xml.digestResponseXml(xhr);
  3178. if (Sdl.Xml.validateResponseAndWarn(response)) {
  3179. Sdl.Xml.alertResponse(response);
  3180. if (response.valid) {
  3181. if (response.content == '1') {
  3182. window.location.reload();
  3183. return;
  3184. }
  3185. }
  3186. }
  3187. document.getElementById('submit').disabled = false;
  3188. },
  3189. onClickSubmit : function() {
  3190. this.submit();
  3191. },
  3192. onKeyPressEnter : function(e) {
  3193. if (e.keyCode == 13) {
  3194. this.submit();
  3195. }
  3196. },
  3197. submit : function() {
  3198. var loginName, param, password, saveLogin;
  3199. document.getElementById('submit').disabled = true;
  3200. loginName = document.getElementById('loginName').value;
  3201. password = document.getElementById('password').value;
  3202. saveLogin = document.getElementById('saveLogin') ? document.getElementById('saveLogin').checked : null;
  3203. param = 'loginName=' + loginName + '&' +
  3204. 'password=' + password + '&' +
  3205. 'saveLogin=' + saveLogin;
  3206. Sdl.Ajax.ajaxPost(this.ajaxActionSubmit, '?system=login', param);
  3207. }
  3208. }
  3209. Sdl.login = new Sdl.Login();
  3210. //------------------------------------------------------------------------------
  3211. Sdl.Xml = function() {}
  3212. Sdl.Xml.digestResponseXml = function(xhr) {
  3213. var container, nodes, response = {};
  3214. if (!xhr) {
  3215. response.valid = false;
  3216. response.debug = '" . text("ERROR") . " : Sdl.Ajax';
  3217. return response;
  3218. }
  3219. if (xhr.responseXML == null) {
  3220. response.valid = false;
  3221. response.debug = xhr.responseText.substr(0, " . DEBUG_XML_RESPONSE_LENGTH . ");
  3222. return response;
  3223. }
  3224. container = xhr.responseXML.documentElement;
  3225. if (!container || container.tagName != 'container') {
  3226. response.valid = false;
  3227. response.debug = xhr.responseText.substr(0, " . DEBUG_XML_RESPONSE_LENGTH . ");
  3228. return response;
  3229. }
  3230. response.valid = true;
  3231. response.status = {};
  3232. nodes = container.getElementsByTagName('error')[0].childNodes;
  3233. response.error = nodes[0] ? nodes[0].nodeValue : null;
  3234. nodes = container.getElementsByTagName('status')[0].childNodes;
  3235. response.status.text = nodes[0] ? nodes[0].nodeValue : null;
  3236. nodes = container.getElementsByTagName('content')[0].childNodes;
  3237. if (nodes[0]) {
  3238. response.contentNodes = nodes;
  3239. response.content = '';
  3240. for (var i = 0 ; i < nodes.length ; i++) {
  3241. response.content += nodes[i].nodeValue;
  3242. }
  3243. } else {
  3244. response.content = null;
  3245. }
  3246. nodes = container.getElementsByTagName('debug')[0].childNodes;
  3247. response.debug = nodes[0] ? nodes[0].nodeValue : null;
  3248. nodes = container.getElementsByTagName('message')[0].childNodes;
  3249. response.message = nodes[0] ? nodes[0].nodeValue : null;
  3250. nodes = container.getElementsByTagName('warning')[0].childNodes;
  3251. response.warning = nodes[0] ? nodes[0].nodeValue : null;
  3252. if (response.status.text != null) {
  3253. if (response.status.text == 'success') {
  3254. response.status.success = true;
  3255. } else if (response.status.text == 'error') {
  3256. response.status.success = false;
  3257. } else {
  3258. response.status.success = null;
  3259. }
  3260. } else {
  3261. response.status.success = null;
  3262. }
  3263. return response;
  3264. }
  3265. Sdl.Xml.validateResponseAndWarn = function(response) {
  3266. if (response.valid) {
  3267. return true;
  3268. } else {
  3269. alert('" . text("ERROR") . " : " . text("INCORRECT XML RESPONSE") . ".\\n" . text("DEBUG") . " : \\n' + response.debug);
  3270. return false;
  3271. }
  3272. }
  3273. Sdl.Xml.alertResponse = function(response) {
  3274. if (response.status.success != null) {
  3275. if (response.status.success == true) {
  3276. if(response.message) {alert(response.message);}
  3277. if(response.warning) {alert('" . text("WARNING") . " : ' + response.warning);}
  3278. } else if (response.status.success == false){
  3279. alert('" . text("ERROR") . " : ' + response.error);
  3280. }
  3281. } else {
  3282. alert('" . text("ERROR") . " : " . text("UNKNOWN RESPONSE STATUS") . "');
  3283. }
  3284. }
  3285. //------------------------------------------------------------------------------
  3286. </script>
  3287. <style type='text/css'>
  3288. body {font-family:arial; font-size:" . FONT_SIZE . "; margin:0px;}
  3289. .textfield {width:11em} /* For IE6 */
  3290. #accessWithoutLogin {font-size:0.9em;}
  3291. #container {left:50%; margin:0em 0em 0em -8.5em; position:absolute; text-align:center; top:35%;}
  3292. #footer {font-size:10px}
  3293. #form {margin:0px}
  3294. #formTable {border-collapse:collapse;}
  3295. #msg {font-size:0.7em}
  3296. </style>
  3297. </head>
  3298. <body>
  3299. <div id='container'>
  3300. <strong>" . META_WEB_SITE_NAME . "</strong>
  3301. <form action='?system=login' method='post' onsubmit='Sdl.login.submit(); return false;'>
  3302. <noscript><div id='msg'>$msg</div></noscript>
  3303. <table id='formTable'>
  3304. <tr><td style='text-align:right'>" . text("LOGIN NAME") . " :</td><td><input class='textfield' type='textfield' name='loginName' id='loginName' value='$loginName'></td></tr>
  3305. <tr><td style='text-align:right'>" . text("PASSWORD") . " :</td><td><input class='textfield' type='password' name='password' id='password'></td></tr>
  3306. <tr>
  3307. <td></td>
  3308. <td style='text-align:left'>
  3309. <noscript>
  3310. <input name='query' type='hidden' value='{$_SERVER['QUERY_STRING']}'>
  3311. <input name='njs' type='hidden' value='true'>
  3312. </noscript>
  3313. <input id='submit' type='submit' value='" . text("SUBMIT") . "'>
  3314. <span style='vertical-align:top'>$saveLogin</span>
  3315. </td>
  3316. </tr>
  3317. </table>
  3318. </form>
  3319. <span id='accessWithoutLogin'>$accessWithoutLogin</span>
  3320. <div id='footer'><i><b>powered by <a href='http://simpledirectorylisting.net'>SimpleDirectoryListing</a></b></i></div>
  3321. </div>
  3322. </body>
  3323. </html>
  3324. ";
  3325. return $html;
  3326. }
  3327. function printLogin() {
  3328. echo UserManager::getLogin();
  3329. }
  3330. }
  3331. ?>
  3332. <?php
  3333. //------------------------------------------------------------------------------
  3334. // Class name : Xml
  3335. //------------------------------------------------------------------------------
  3336. class Xml {
  3337. var $content;
  3338. var $debug;
  3339. var $doc;
  3340. var $error;
  3341. var $status;
  3342. var $warning;
  3343. function dump() {
  3344. $this->status = Text::convertEncodingToUtf8($this->status);
  3345. $this->content = Text::convertEncodingToUtf8($this->content);
  3346. $this->message = Text::convertEncodingToUtf8($this->message);
  3347. $this->error = Text::convertEncodingToUtf8($this->error);
  3348. $this->warning = Text::convertEncodingToUtf8($this->warning);
  3349. $this->debug = Text::convertEncodingToUtf8($this->debug);
  3350. header("content-type: text/xml");
  3351. $xml =
  3352. "<?xml version='1.0' encoding='utf-8'?>" .
  3353. "<container>" .
  3354. /*
  3355. "<status>" . htmlentities($this->status, null, "utf-8") . "</status>" .
  3356. "<content>" . htmlentities($this->content, null, "utf-8") . "</content>" .
  3357. "<message>" . htmlentities($this->message, null, "utf-8") . "</message>" .
  3358. "<error>" . htmlentities($this->error, null, "utf-8") . "</error>" .
  3359. "<warning>" . htmlentities($this->warning, null, "utf-8") . "</warning>" .
  3360. "<debug>" . htmlentities($this->debug, null, "utf-8") . "</debug>" .
  3361. */
  3362. "<status><![CDATA[" . $this->status . "]]></status>" .
  3363. "<content><![CDATA[" . $this->content . "]]></content>" .
  3364. "<message><![CDATA[" . $this->message . "]]></message>" .
  3365. "<error><![CDATA[" . $this->error . "]]></error>" .
  3366. "<warning><![CDATA[" . $this->warning . "]]></warning>" .
  3367. "<debug><![CDATA[" . $this->debug . "]]></debug>" .
  3368. "</container>";
  3369. echo $xml;
  3370. }
  3371. function setContent($text) {
  3372. $this->content = $text;
  3373. $this->setStatusSuccess();
  3374. }
  3375. function setError($text) {
  3376. $this->error = $text;
  3377. $this->setStatusError();
  3378. }
  3379. function setMessage($text) {
  3380. $this->message = $text;
  3381. }
  3382. function setStatus($text) {
  3383. $this->status = $text;
  3384. }
  3385. function setStatusError() {
  3386. $this->setStatus("error");
  3387. }
  3388. function setStatusSuccess() {
  3389. $this->setStatus("success");
  3390. }
  3391. function setWarning($text) {
  3392. $this->warning = $text;
  3393. }
  3394. }
  3395. ?>
  3396. <?php
  3397. //------------------------------------------------------------------------------
  3398. // Class name : LocaleEnglishUS
  3399. //------------------------------------------------------------------------------
  3400. class LocaleEnglishUS extends Locale {
  3401. var $localeGroup = "en";
  3402. var $localeName = "en-us";
  3403. var $text = array(
  3404. // Class : Browser
  3405. "DIR"
  3406. => "dir",
  3407. "IMG"
  3408. => "img",
  3409. "UNKNOWN"
  3410. => "unknown",
  3411. "INDEX OF"
  3412. => "Index of",
  3413. "NO FILES"
  3414. => "No files",
  3415. "RSS IS DISABLED."
  3416. => "RSS is disabled.",
  3417. // Errors
  3418. "ACCESS DENIED"
  3419. => "Access denied",
  3420. "DIRECTORY IS NOT ACCEPTED"
  3421. => "Directory is not accepted.",
  3422. "INTERNAL SERVER ERROR"
  3423. => "Internal server error",
  3424. "THUMBNAIL VIEW IS DISABLED."
  3425. => "Thumbnail View is disabled.",
  3426. "INVALID LOCATION"
  3427. => "Invalid location",
  3428. // Class : Javascript
  3429. "ADD"
  3430. => "Add",
  3431. "REMOVE"
  3432. => "Remove",
  3433. "RESET"
  3434. => "Reset",
  3435. "FILES"
  3436. => "files",
  3437. "DEBUG"
  3438. => "Debug",
  3439. "ERROR"
  3440. => "Error",
  3441. "INCORRECT XML RESPONSE"
  3442. => "Incorrect XML response.",
  3443. "INVALID IMAGE FORMAT"
  3444. => "Invalid image format",
  3445. "JAVASCRIPT ERROR"
  3446. => "Javascript error",
  3447. "LOADING"
  3448. => "Loading...",
  3449. "UNKNOWN RESPONSE ERROR"
  3450. => "Unknown response error.",
  3451. "WARNING"
  3452. => "Warning",
  3453. // Class : ModuleManager
  3454. "MODULE ERROR"
  3455. => "MODULE ERROR",
  3456. "REQUIRES"
  3457. => "requires",
  3458. // Class : SimpleDirectoryListing
  3459. "LOGIN"
  3460. => "Login",
  3461. "LOGOUT"
  3462. => "Logout",
  3463. "SYSTEM HAS BEEN SHUTTED DOWN"
  3464. => "System has been shutted down.",
  3465. // Class : UserManager
  3466. "ACCESS WITHOUT LOGIN"
  3467. => "Access without login",
  3468. "BACK"
  3469. => "Back",
  3470. "CONFIG ERROR"
  3471. => "CONFIG ERROR",
  3472. "INCORRECT LOGIN NAME OR PASSWORD"
  3473. => "Incorrect login name or password.",
  3474. "LOGIN"
  3475. => "Login",
  3476. "LOGIN NAME"
  3477. => "Login name",
  3478. "PASSWORD"
  3479. => "Password",
  3480. "PLEASE LOGIN"
  3481. => "Please login.",
  3482. "REMEMBER ME"
  3483. => "Remember me",
  3484. "SUBMIT"
  3485. => "Submit",
  3486. "YOU HAVE SUCCESSFULLY LOGGED OUT"
  3487. => "You have successfully logged out.",
  3488. // Module : ModuleBrowserView
  3489. "BACKWARD"
  3490. => "Backward",
  3491. "FORWARD"
  3492. => "Forward",
  3493. "HOME"
  3494. => "Home",
  3495. "LIST VIEW"
  3496. => "List View",
  3497. "RELOAD"
  3498. => "Reload",
  3499. "THUMBNAIL VIEW"
  3500. => "Thumbnail View",
  3501. // Module : ModuleChangeMode
  3502. "CHANGE MODE"
  3503. => "Change Mode",
  3504. "HAS BEEN SUCCESSFULLY CHANGED TO A NEW MODE"
  3505. => "has been successfully changed to a new mode",
  3506. // Module : ModuleCopyMove
  3507. "ARE YOU SURE YOU WANT TO COPY ALL THESE"
  3508. => "Are you sure you want to copy all these",
  3509. "ARE YOU SURE YOU WANT TO MOVE ALL THESE"
  3510. => "Are you sure you want to move all these",
  3511. "COPY/MOVE"
  3512. => "Copy/Move",
  3513. "COPY TO HERE"
  3514. => "Copy to here",
  3515. "FAILED TO COPY"
  3516. => "Failed to copy",
  3517. "FAILED TO MOVE"
  3518. => "Failed to move",
  3519. "MOVE TO HERE"
  3520. => "Move to here",
  3521. "SUCCESSFULLY COPIED"
  3522. => "Successfully copied",
  3523. "SUCCESSFULLY MOVED"
  3524. => "Successfully moved",
  3525. // Module : ModuleCreateFile
  3526. "CREATE DIRECTORY"
  3527. => "Create Directory",
  3528. "CREATE FILE"
  3529. => "Create File",
  3530. "FILE WITH SAME NAME EXISTS"
  3531. => "File with same name exist.",
  3532. "HAS BEEN SUCCESSFULLY CREATED IN"
  3533. => "has been successfully created in",
  3534. "INVALID CURRENT WORKING DIRECTORY"
  3535. => "Invalid current working directory.",
  3536. "NEWDIR"
  3537. => "newdir",
  3538. "NEWFILE.EXT"
  3539. => "newfile.ext",
  3540. "PLEASE ENTER A FILENAME"
  3541. => "Please enter a filename.",
  3542. "PLEASE ENTER A DIRECTORY NAME"
  3543. => "Please enter a directory name.",
  3544. // Module : ModuleDelete
  3545. "ARE YOU SURE YOU WANT TO DELETE ALL THESE"
  3546. => "Are you sure you want to delete all these",
  3547. "DELETE"
  3548. => "Delete",
  3549. "FAILED TO DELETE"
  3550. => "Failed to delete",
  3551. "FILES/DIRECTORIES"
  3552. => "files/directories",
  3553. "SUCCESSFULLY DELETED"
  3554. => "Successfully deleted",
  3555. // Module : ModuleDownload
  3556. "DOWNLOAD"
  3557. => "Download",
  3558. // Module : ModuleEdit
  3559. "FILE HAS BEEN SUCCESSFULLY SAVED"
  3560. => "File has been successfully saved.",
  3561. // Modile : ModuleFileMode
  3562. "FILE MODE"
  3563. => "File mode",
  3564. "MODE"
  3565. => "Mode",
  3566. "PLEASE ENTER A NEW FILE MODE"
  3567. => "Please enter a new file mode.",
  3568. // Module : ModuleFileMTime
  3569. "LAST MODIFIED"
  3570. => "Last modified",
  3571. // Module : ModuleFilename
  3572. "NAME"
  3573. => "Name",
  3574. // Module : ModuleFileSize
  3575. "FILE SIZE"
  3576. => "File size",
  3577. "SIZE"
  3578. => "Size",
  3579. // Module : ModuleFileType
  3580. "FILE TYPE"
  3581. => "File type",
  3582. "TYPE"
  3583. => "Type",
  3584. // Module : ModuleMusicPlayer
  3585. "NO FILE"
  3586. => "No file",
  3587. "PLAY"
  3588. => "Play",
  3589. "PLAY MUSIC"
  3590. => "Play Music",
  3591. // Module : ModuleOpen
  3592. "FILE IS NOT WITHIN DOCUMENT ROOT"
  3593. => "File is not witin document root",
  3594. "OPEN"
  3595. => "Open",
  3596. // Module : ModuleRead
  3597. "FILE"
  3598. => "File",
  3599. "READ"
  3600. => "Read",
  3601. // Module : ModuleRename
  3602. "HAS BEEN SUCCESSFULLY RENAMED TO"
  3603. => "has been successfully renamed to",
  3604. "PLEASE ENTER A NEW FILENAME"
  3605. => "Please enter a new filename.",
  3606. "RENAME"
  3607. => "Rename",
  3608. // Module : ModuleSelector
  3609. "PLEASE SELECT A FILE"
  3610. => "Please select a file.",
  3611. "PLEASE SELECT FILES"
  3612. => "Please select files.",
  3613. "PLEASE SELECT ONE FILE ONLY"
  3614. => "Please select one file only.",
  3615. // Module : ModuleUpload
  3616. "FILE SIZE EXCEEDS LIMIT"
  3617. => "File size exceeds limit.",
  3618. "SUCCESSFULLY UPLOADED TO"
  3619. => "Successfully uploaded to",
  3620. "UPLOAD"
  3621. => "Upload",
  3622. "UPLOAD TO DIRECTORY"
  3623. => "Upload to directory",
  3624. );
  3625. }
  3626. ?>
  3627. <?php
  3628. //------------------------------------------------------------------------------
  3629. // Class name : ThemeApache
  3630. //------------------------------------------------------------------------------
  3631. class ThemeApache extends Theme{
  3632. var $icons = array(
  3633. "cross" => "R0lGODlhEAAQAMQfAOt0dP94eOFjY/a0tP/JyfFfX/yVlf6mppNtbf5qanknJ9dVVeZqat5eXpiMjGo4OIUvL3pGRthWVuhvb1kaGv39/f1lZdg7O/7Y2F8/P+13d4tcXNRTU2dCQv///////yH5BAEAAB8ALAAAAAAQABAAAAV/4Cd+Xml6Y0pGTosgEap6G0YQh6FDskhjGg0AMJkwAjxfBygkGhmCAAXl6QyGnuLFI4g+qNbixLMNdBNfkpXBLncbial6AC17Gvg4eND1BPB3cHJVBguGhwsSHHo+GRqKHJGRCQo9JI4WBZoFFpUVMw8QCqMQU58qJCclqKytIQA7",
  3634. "file" => "R0lGODlhEAAQAMQfAMfj/uzx9rvc/eXt9YivyHaXtFdwkZXK/KvU+0lVa/L2+rba/KTR+4m77FJhe67T5UNLXNXn8MDf/bHX/JrA1qjL3t7n7ykxQz5FVeLp8LDR48vM0Z7O+9Xb5P///////yH5BAEAAB8ALAAAAAAQABAAAAWPoCeO5PidXvRoFUURRCEXHvpEQ5DrQ98YNY9mACgWJUhF4yeqKIwApECgqDpElOdRulhMFFdPdisRdCcIsIjwlJon6HRireB6EQgGYzD3FAJccXocAxAif1N3eQwcHBmGfgFmd4MHBxYYhwpveIwclgGZHgYdCjwZqBkWARsXhwawDg4JCRAQGBgXYSW8JCEAOw==",
  3635. "dir" => "R0lGODlhEAAQAMQfAOvGUf7ztuvPMf/78/fkl/Pbg+u8Rvjqteu2Pf3zxPz36Pz0z+vTmPzurPvuw/npofbjquvNefHVduuyN+uuMu3Oafbgjfnqvf/3zv/3xevPi+vRjP/20/bmsP///////yH5BAEAAB8ALAAAAAAQABAAAAV24CeOZGmepqeqqOgxjBZFa+19r4ftWQUAgqDgltthMshMIJAZ4jYDHsBARSAmFOJvq+g6HIdEFgcYmBWNxoNAsDjGHgBnmV5bCoUDHLBIq9sFEhIdcAYJdYASFRUQhQkLCwkOFwcdEBAXhVabE52ecDahKy0oIQA7",
  3636. "unknown" => "R0lGODlhEAAQAMQfAHSUstdxbU1Zbvz9/4CwzVZtjeTs9Njq9+rx9o7B8d7LzbjTsISyhUiCRvb5/K7S5NXd36LQ+7TZ/PP2+sPh/ajL3ikxQz9HV+Hp8Jq/1czkt5PGeDhzKs9XUv///////yH5BAEAAB8ALAAAAAAQABAAAAWSoCeO5Pid3vE8VZYRBCADHvocBuKIgzcZiULN89D1Ap1AwDNAEISeyqDjQXau1M4AiriKlh7vFSK6DhrkMnWa1VIajLB3EWGb3wS5Z9GIOMRaDRsaIg8cDWwiGGYNcgoMbGkAUwMSenUdDhciAA4DlQciB3VNmx4FEBMIBqwYrhgIChacBbUFArgXuhcWAiW/vyEAOw=="
  3637. );
  3638. // edited in 2.1;
  3639. function getCss() {
  3640. $css =
  3641. "
  3642. body {
  3643. margin:0px 0px 0px 0px;
  3644. font-family:arial;
  3645. font-size:".FONT_SIZE."px;
  3646. }
  3647. img {
  3648. border:0px;
  3649. }
  3650. .browserCellFiller { /* Php class : Browser */
  3651. width:100%;
  3652. }
  3653. .browserScrollBarFiller { /* Php class : Browser */
  3654. width:20px;
  3655. }
  3656. .browserFilesViewList { /* Php class : Browser */
  3657. border-collapse:collapse;
  3658. line-height:1.2em;
  3659. }
  3660. .browserFilesViewThumbnail { /* Php class : Browser */
  3661. line-height:1.2em;
  3662. }
  3663. .containerCell { /* Php class : Browser */
  3664. padding:0px;
  3665. vertical-align:top;
  3666. }
  3667. .coverBody { /* Js class : Sdl.CoverBody */
  3668. background-color:black; /*#00ff00*/
  3669. filter:alpha(opacity=90);
  3670. height:0px;
  3671. left:0px;
  3672. opacity:0.9;
  3673. position:absolute;
  3674. top:0px;
  3675. width:0px;
  3676. z-index:0;
  3677. }
  3678. .coverBodyText { /* Js class : Sdl.CoverBody */
  3679. color:white;
  3680. font-size:2em;
  3681. position:fixed;
  3682. top:45%;
  3683. /* For IE6. IE6 doesn't support position:fixed */
  3684. /* position:absolute; */ /* Js apprroach */
  3685. z-index:1;
  3686. }
  3687. .fileViewList { /* Php class : Browser */ /* Sdl.Selector overrides it */
  3688. }
  3689. .fileViewThumbnail { /* Php class : Browser */ /* Sdl.Selector overrides it */
  3690. float:left;
  3691. }
  3692. .function { /* Php class : Browser */
  3693. float:left;
  3694. }
  3695. .functionButton { /* Js class : Sdl.Button */
  3696. border:1px solid;
  3697. /* border-color:transparent;*/ /* IE6 doesn't support transparent */
  3698. border-color:white;
  3699. cursor:pointer;
  3700. padding:3px;
  3701. }
  3702. .functionButtonMouseOver { /* Js class : Sdl.Button */
  3703. background-color:green;
  3704. border:1px solid black;
  3705. filter:alpha(opacity=50);
  3706. opacity:0.5;
  3707. }
  3708. .image { /* Js class : Sdl.Image */
  3709. color:white;
  3710. font-size:2em;
  3711. left:0px;
  3712. position:fixed;
  3713. top:0px;
  3714. /* For IE6. IE6 doesn't support position:fixed */
  3715. /*position:absolute;*/ /* Js approach */
  3716. z-index:2;
  3717. }
  3718. .movableBar{ /* Js class : Sdl.MovableBar */
  3719. cursor:move;
  3720. height:0.5em;
  3721. left:45%;
  3722. overflow:hidden;
  3723. position:relative;
  3724. width:6em;
  3725. }
  3726. .movableBarMouseOver { /* Js class : Sdl.MovableBar */
  3727. background-color:gray;
  3728. height:2.0em;
  3729. }
  3730. .movableBarSign { /* Js class : Sdl.MovableBar */
  3731. line-height:0.5em;
  3732. text-align:center;
  3733. }
  3734. .movableBarContent { /* Js class : Sdl.MovableBar */
  3735. text-align:center;
  3736. line-height:1.0em;
  3737. }
  3738. /* For IE6. contentContainer gets incorrect height when setting .style.height = .offsetHeigh */
  3739. .moveTargetIe6 {
  3740. border:1px solid white;
  3741. }
  3742. .pagesSideBoxTopExist { /* Php class : Layout */
  3743. border-top:1px solid #AAAAAA;
  3744. }
  3745. .pagesSideBoxTopNotExist { /* Php class : Layout */
  3746. border-top:0px;
  3747. }
  3748. .sortHeader { /* Js class : Sdl.Sort */
  3749. cursor:pointer;
  3750. }
  3751. .sortHeaderMouseOver { /* Js class : Sdl.Sort */
  3752. background-color:orange;
  3753. filter:alpha(opacity=70);
  3754. opacity:0.7;
  3755. }
  3756. .systemAttribute { /* Php class : Browser */
  3757. display:none;
  3758. }
  3759. .tab { /* Js class : Sdl.Page */
  3760. border-top:1px solid;
  3761. border-left:1px solid;
  3762. border-right:1px solid;
  3763. cursor:pointer;
  3764. float:left;
  3765. margin-right:0.1em;
  3766. padding:0px 0.2em;
  3767. line-height:1.2em;
  3768. vertical-align:bottom;
  3769. }
  3770. .tabFocus { /* Js class : Sdl.Page */
  3771. background-color : yellow;
  3772. }
  3773. .thumbnailItemContainer { /* Php class : Browser*/
  3774. padding: 0.33em;
  3775. width: " . THUMBNAIL_SIZE / FONT_SIZE . "em;
  3776. overflow:hidden;
  3777. }
  3778. .thumbnailItemImageContainer { /* Php class : Browser*/
  3779. border: 1px solid #DDDDDD;
  3780. width: " . THUMBNAIL_SIZE/FONT_SIZE . "em;
  3781. height: " . THUMBNAIL_SIZE/FONT_SIZE . "em;
  3782. line-height: " . THUMBNAIL_SIZE/FONT_SIZE . "em;
  3783. overflow:hidden; /*For IE6. Size of cached images are used as estimated size.*/
  3784. text-align:center;
  3785. }
  3786. .thumbnailItemImageContainer a { /* Php class : Browser*/
  3787. display:block;
  3788. height:100%; /* For IE6 */
  3789. width:100%; /* For IE6 */
  3790. }
  3791. .thumbnailItemImageContainer img { /* Php class : Browser*/
  3792. vertical-align:middle;
  3793. }
  3794. .thumbnailItemImageDir { /* Php class : Browser */
  3795. height:2em;
  3796. }
  3797. .thumbnailItemImageUnknown { /* Php class : Browser */
  3798. height:2em;
  3799. }
  3800. #browserFiles { /* Php class : Browser */
  3801. /*width:100%;*/ /* Cancelled for IE6. Vertical scrollbar problem. */
  3802. }
  3803. #browserFilesContainer { /* Php class : Browser */
  3804. min-height:10em;
  3805. height:auto;
  3806. /*
  3807. overflow-x:hidden;
  3808. overflow-y:auto;
  3809. */
  3810. overflow:auto;
  3811. overflow-x:hidden; /* Opera 9.21 doesn't support overflow-x or overflow-y */
  3812. }
  3813. #browserFunctions { /* Php class : Browser */
  3814. overflow:hidden;
  3815. }
  3816. #browserHeaders { /* Php class : Browser */
  3817. border-collapse:collapse;
  3818. border-bottom:1px solid gray;
  3819. line-height:1.2em;
  3820. }
  3821. #broswerSeparator1 { /* Php class : Browser */
  3822. display:none;
  3823. height:0px;
  3824. overflow:hidden;
  3825. }
  3826. #browserSystemFiles { /* Php class : Browser */
  3827. border-collapse:collapse;
  3828. line-height:1.2em;
  3829. }
  3830. #container { /* Php class : Layout */
  3831. border:0px solid;
  3832. border-collapse:collapse;
  3833. padding:0px;
  3834. width:100%;
  3835. }
  3836. #footer { /* Php class : Layout */
  3837. font-size:0.67em;
  3838. }
  3839. #pagesContainer { /* Php class : Layout */
  3840. clear:both; /* For IE6 */
  3841. }
  3842. #tabs { /* Php class : Layout */
  3843. overflow:hidden;
  3844. }
  3845. ";
  3846. return $css;
  3847. }
  3848. }
  3849. ?>
  3850. <?php
  3851. //------------------------------------------------------------------------------
  3852. // Class name : ModuleBrowserView
  3853. //------------------------------------------------------------------------------
  3854. define("MODULEBROWSERVIEW_ON" , true);
  3855. define("MODULEBROWSERVIEW_ADMIN_MODE_ON" , true);
  3856. define("MODULEBROWSERVIEW_USER_MODE_ON" , true);
  3857. class ModuleBrowserView extends Module {
  3858. var $enabled = MODULEBROWSERVIEW_ON;
  3859. var $enabledAdminMode = MODULEBROWSERVIEW_ADMIN_MODE_ON;
  3860. var $enabledUserMode = MODULEBROWSERVIEW_USER_MODE_ON;
  3861. var $icons = array(
  3862. "backward" => "R0lGODlhEAAQAMQfACROFdzy00yoLbDhnUSVKFe+OV3CPMXpuLPioitfGordWnfRTXTLXLzmqX3UUYTaVjyDJGTEQaPdjI/gXXDLSc7sw2rKRdjwz9PuyVG6NTRzH4zUc9/z2H3OZf///////yH5BAEAAB8ALAAAAAAQABAAAAWH4CeOXumNKOkJLFGm4ipwXHARbrrSzaQMmArkFJtVJj7Fw4E4aIg75MSzXFCcp1WgoVCUHFbLppEoES6Ph8kUMZDNGIdjXTIUEGUPpCKxlixtBQwIAFkQBxaAHgZ2GYRQGgcSbXYFGRsDhSQaDQ0dGRkMA5lEJAkJCAijAJowJaysLzAqsighADs=",
  3863. "forward" => "R0lGODlhEAAQAMQfACROFd7z10yoLbDhnUSVKHTLXIrdWVe+OcXpuLPiol3CPCtfGrzmqYTZVmvJRnjRTjyDJKPdjI/gXc7sw2PEQHLPS9nw0NPuyX7WUlG6NTRzH4zUc23LR33OZf///////yH5BAEAAB8ALAAAAAAQABAAAAWG4CeOXumNKOkJLFGm4ioEtEW46UozkjFcE8gpNptIeobGI4HQDHXHnufx4DRPKwvDwG2UHI4NY1EiWBpeU4miGJcvGIy6pDgkyB7IJFLpc+gHBQkAWBAIHGAUHnUZg08aCBFsdQcZGwOEJBoMDB0ZGQUDmEMkCwsJCaIAmTAlq6svMCqxKCEAOw==",
  3864. "home" => "R0lGODlhEAAQALMPAI50QJ6IVNro74WxxfDmyNnGknZXI5zA0JS7zPPr08awddW5bNvCf6fJ2f///////yH5BAEAAA8ALAAAAAAQABAAAARg8Mn5nKOYOoRu1oggDN63CU0zliCaqiR2vu86OYNLp3Y1NIcDBzEoFkuOQEHBbBYCrGSiwKhWE4BoIFENBBgLQlaz7QIW4fGtzACcwwZtYk6o1+PkgNtt6ONvFoGCFhIRADs=",
  3865. "reload" => "R0lGODlhEAAQAMQfAJXG2JXa+ZLO5ChrlkCy4TZ1kiVvpCN0trvo9SN5xTd4lrfh7iR9zo3S+EGz7JDJ4TaCromrvC9ymyV+0Dd3mTl1koe72YvN7LTj+9ne6N3g6v7+/0Cw2Stoh////////yH5BAEAAB8ALAAAAAAQABAAAAV94CeOXumJ5ah6VVFQpXSqX6YgC4JAljGTnYVAwCFcMIffx9OJdDqDB8HRSCiZCpMh0GgwroWTZ2A4JBiTn2nNVk8YiYNhIA6vGJhAwFdSdK4JAQ4EDwMDTX8rBwEXBBxDAIkrBhYQDw8AAAoaGzQeMh4ULhVKJDNrNKmqNCEAOw==",
  3866. "viewList" => "R0lGODlhEAAQAMQAALvd/3aVsoWsx5XL/9vp9OTr81dvj7ba/0eo/0lVa4fE/+vy96rU/jya/2fG/6TR/1Fhe7LY/q/S5ENLXPL1+Orv+ufu9ZrA1qjL3tHW3SkxQz5FVeDo757P/6/X/////yH5BAAAAAAALAAAAAAQABAAAAWP4CeOZCkSkoRdl+AGsBGIErEQeI5bGUQvDoSwQSQiFgYRZgFoNg/QQ8Ti+1wszqc04ilULxUnlOthMLwiQRgwLjMej0IijWVz353OQE5vRiJ4A4IFEyIBWAdlD3oDCgochR+HUIqCjo8bhhRSgZcKC5kfBhkUFhYFqByqCxkahgawEBAJCRMTGxsaVSa8IiEAOw==",
  3867. "viewThumbnail" => "R0lGODlhEAAQAMQAANvn8klVa+bt9Onx9lRpiUWHuXaYtT13uVJgea/S5OPr8ENLXPL1+HiOqerv+m+NrYOqxYyzzFp5npa805/E2KjL3ikxQz5FVUHUD+fv93uhvercjYXaaer0/7jT7P///yH5BAAAAAAALAAAAAAQABAAAAWJ4CeOZCkCSVJRUwRphvFIjZgAGaDvevYRtk5heCgaDz9RZeDpNJ/OTvJDyXg8m+x1+0GIJo5mdhNtdkWRMFbLaXs+ARFEAG1yMBxp/KNRtDlbf28LIhoCd3l1UoQfBoduW1wXIg8MilAfkx8SAAwCnwqhCgADHxYiDQSqCAgBAQsLFxcWXia2IyEAOw=="
  3868. );
  3869. var $isFunction = true;
  3870. var $moduleName = "ModuleBrowserView";
  3871. var $position = -10;
  3872. function getCss() {
  3873. $css =
  3874. "
  3875. .$this->moduleName a, .$this->moduleName div{
  3876. display:block;
  3877. float:left;
  3878. }
  3879. ";
  3880. return $css;
  3881. }
  3882. function getHtml($cwdRelPath, $view) {
  3883. $html =
  3884. "
  3885. <div class='$this->moduleName' id='$this->moduleName' style='line-height:0.9;'>
  3886. <div id='{$this->moduleName}BrowserCacheBackward' onclick='Sdl.$this->moduleName.main.onClickCacheBackward();' style='display:none;' title='" . text("BACKWARD") . "'>
  3887. <img alt='[" . text("BACKWARD") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=backward'>
  3888. </div>
  3889. <div id='{$this->moduleName}BrowserCacheForward' onclick='Sdl.$this->moduleName.main.onClickCacheForward();' style='display:none;' title='" . text("FORWARD") . "'>
  3890. <img alt='[" . text("FORWARD") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=forward'>
  3891. </div>
  3892. <a class='functionButton' href='?cwdRelPath=$cwdRelPath&view=$view' id='{$this->moduleName}BrowserReload' onclick='Sdl.$this->moduleName.main.onClickReload(); return false;' title='" . text("RELOAD") . "'>
  3893. <img alt='[" . text("RELOAD") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=reload'>
  3894. </a>
  3895. <a class='functionButton' href='?view=$view' id='{$this->moduleName}BrowserRedirectHome' onclick='Sdl.$this->moduleName.main.onClickRedirectPermittedDir(); return false;' title='" . text("HOME") . "'>
  3896. <img alt='[" . text("HOME") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=home'>
  3897. </a>
  3898. <a class='functionButton' href='?cwdRelPath=$cwdRelPath&view=list' id='{$this->moduleName}BrowserViewList' onclick='Sdl.$this->moduleName.main.onClickViewList(); return false;' title='" . text("LIST VIEW") . "'>
  3899. <img alt='[" . text("LIST VIEW") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=viewList'>
  3900. </a>
  3901. <a class='functionButton' href='?cwdRelPath=$cwdRelPath&view=thumbnail' id='{$this->moduleName}BrowserViewThumbnail' onclick='Sdl.$this->moduleName.main.onClickViewThumbnail(); return false;' title='" . text("THUMBNAIL VIEW") . "'>
  3902. <img alt='[" . text("THUMBNAIL VIEW") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=viewThumbnail'>
  3903. </a>
  3904. </div>
  3905. ";
  3906. return $html;
  3907. }
  3908. function getJavascript() {
  3909. $javascript =
  3910. "
  3911. Sdl.$this->moduleName = {};
  3912. Sdl.$this->moduleName.Main = function() {
  3913. var this_clone = this;
  3914. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  3915. }
  3916. Sdl.$this->moduleName.Main.prototype = {
  3917. onClickCacheBackward : function() {
  3918. Sdl.browser.cacheBackward();
  3919. },
  3920. onClickCacheForward : function() {
  3921. Sdl.browser.cacheForward();
  3922. },
  3923. onClickRedirectPermittedDir : function() {
  3924. Sdl.browser.redirectPermittedDir();
  3925. },
  3926. onClickReload : function() {
  3927. Sdl.browser.reloadDirListing();
  3928. },
  3929. onClickViewList : function() {
  3930. Sdl.browser.setView('list');
  3931. },
  3932. onClickViewThumbnail : function() {
  3933. Sdl.browser.setView('thumbnail');
  3934. },
  3935. windowOnLoadListener : function() {
  3936. document.getElementById('{$this->moduleName}BrowserCacheBackward').style.display = 'block';
  3937. document.getElementById('{$this->moduleName}BrowserCacheForward').style.display = 'block';
  3938. document.getElementById('{$this->moduleName}BrowserReload').removeAttribute('href');
  3939. document.getElementById('{$this->moduleName}BrowserRedirectHome').removeAttribute('href');
  3940. document.getElementById('{$this->moduleName}BrowserViewList').removeAttribute('href');
  3941. document.getElementById('{$this->moduleName}BrowserViewThumbnail').removeAttribute('href');
  3942. Sdl.Button.decorateById('{$this->moduleName}BrowserViewList');
  3943. Sdl.Button.decorateById('{$this->moduleName}BrowserViewThumbnail');
  3944. Sdl.Button.decorateById('{$this->moduleName}BrowserReload');
  3945. Sdl.Button.decorateById('{$this->moduleName}BrowserRedirectHome');
  3946. Sdl.Button.decorateById('{$this->moduleName}BrowserCacheBackward');
  3947. Sdl.Button.decorateById('{$this->moduleName}BrowserCacheForward');
  3948. }
  3949. }
  3950. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  3951. ";
  3952. return $javascript;
  3953. }
  3954. }
  3955. ?>
  3956. <?php
  3957. //------------------------------------------------------------------------------
  3958. // Class name : ModuleChangeMode
  3959. //------------------------------------------------------------------------------
  3960. define("MODULECHANGEMODE_ON" , true);
  3961. define("MODULECHANGEMODE_ADMIN_MODE_ON" , true);
  3962. define("MODULECHANGEMODE_USER_MODE_ON" , false);
  3963. define("MODULECHANGEMODE_FTP_LAYER_ON" , true);
  3964. class ModuleChangeMode extends Module {
  3965. var $enabled = MODULECHANGEMODE_ON;
  3966. var $enabledAdminMode = MODULECHANGEMODE_ADMIN_MODE_ON;
  3967. var $enabledUserMode = MODULECHANGEMODE_USER_MODE_ON;
  3968. var $icons = array(
  3969. "changeMode" => "R0lGODlhEAAQAMQfAO/v79GdFee+Su/TbvPdgMXFxevJXeO0OPrhkfz10v354v3328SCDti0If377dSlF+vr68mMEcfHx/rwucySEvvzx9XV1ditGvnsqNy2HMN/Dffnkvnadq2trf///////yH5BAEAAB8ALAAAAAAQABAAAAV24CeKXmmOKNmtrJeqniVLReeing2wq2TjnZ0pV7uphKZOceTJdCCdRibTUHYut6bHoVgkEpUJBhHIZhSYzYYwMAgOiIgZrWa74QzzIr1uvzkaZgl8dn+BJBmDdX4HgFkXCBySk5OHHx4PARQRDBqen5ZDoqIfIQA7"
  3970. );
  3971. var $isFunction = true;
  3972. var $moduleName = "ModuleChangeMode";
  3973. var $position = 40;
  3974. var $requiredModules = array("ModuleSelector");
  3975. // added in 2.1;
  3976. var $ftpLayerOn = MODULECHANGEMODE_FTP_LAYER_ON;
  3977. // edited in 2.1;
  3978. function action() {
  3979. $relPath = $_POST["moduleParams"]["relPath"];
  3980. $newFileMode = $_POST["moduleParams"]["newFileMode"];
  3981. $file = $this->fileManager->getFileByRelPath($relPath);
  3982. $xml = new Xml();
  3983. if ($file) {
  3984. if($file->isPermitted) {
  3985. $result = $this->sysChmod($file->absPath, octdec($newFileMode));
  3986. if ($result !== false) {
  3987. $xml->setStatusSuccess();
  3988. $xml->setMessage("/$file->relPath " . text("HAS BEEN SUCCESSFULLY CHANGED TO A NEW MODE") . " $newFileMode .");
  3989. } else if ($result === -1) {
  3990. $xml->setError("Change mode by FTP(ftp_chmod) is not supported in your PHP version. Please use PHP 5 or above.");
  3991. } else {
  3992. $xml->setError(text("ACCESS DENIED"));
  3993. }
  3994. } else {
  3995. $xml->setError(text("ACCESS DENIED"));
  3996. }
  3997. } else {
  3998. $xml->setError(text("ACCESS DENIED"));
  3999. }
  4000. $xml->dump();
  4001. }
  4002. function getHtml() {
  4003. $html =
  4004. "
  4005. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  4006. <div id='{$this->moduleName}ChangeMode' onclick='Sdl.$this->moduleName.main.onClickChangeMode();' style='float:left' title='" . text("CHANGE MODE") . "'>
  4007. <img alt='[" . text("CHANGE MODE") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=changeMode'>
  4008. </div>
  4009. </div>
  4010. ";
  4011. return $html;
  4012. }
  4013. function getJavascript() {
  4014. $javascript =
  4015. "
  4016. Sdl.$this->moduleName = {};
  4017. Sdl.$this->moduleName.Main = function() {
  4018. var this_clone = this;
  4019. this.ajaxActionChangeMode = function(xhr) {
  4020. var response;
  4021. response = Sdl.Xml.digestResponseXml(xhr);
  4022. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4023. Sdl.Xml.alertResponse(response);
  4024. }
  4025. }
  4026. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  4027. };
  4028. Sdl.$this->moduleName.Main.prototype = {
  4029. changeMode : function(relPath, newFileMode) {
  4030. var param;
  4031. param = 'moduleParams[relPath]=' + relPath + '&' +
  4032. 'moduleParams[newFileMode]=' + newFileMode;
  4033. Sdl.Ajax.ajaxPost(this.ajaxActionChangeMode, '?action=module&module=$this->moduleName', param);
  4034. },
  4035. onClickChangeMode : function() {
  4036. if (Sdl.browser.status.success) {
  4037. var newFileMode, oldFileMode, selectedFile;
  4038. selectedFile = Sdl.ModuleSelector.main.getSingleSelectedFileAndWarn();
  4039. if (selectedFile) {
  4040. oldFileMode = document.getElementById('ModuleFileMode_' + selectedFile.id).innerHTML;
  4041. newFileMode = prompt('" . text("PLEASE ENTER A NEW FILE MODE") . "', oldFileMode);
  4042. if (newFileMode && newFileMode != '') {
  4043. this.changeMode(selectedFile.relPath, newFileMode);
  4044. }
  4045. }
  4046. }
  4047. },
  4048. windowOnLoadListener : function() {
  4049. document.getElementById('{$this->moduleName}').style.display = 'block';
  4050. Sdl.Button.decorateById('{$this->moduleName}ChangeMode');
  4051. }
  4052. }
  4053. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4054. ";
  4055. return $javascript;
  4056. }
  4057. }
  4058. ?>
  4059. <?php
  4060. //------------------------------------------------------------------------------
  4061. // Class name : ModuleCopyMove
  4062. //------------------------------------------------------------------------------
  4063. define("MODULECOPYMOVE_ON" , true);
  4064. define("MODULECOPYMOVE_ADMIN_MODE_ON" , true);
  4065. define("MODULECOPYMOVE_USER_MODE_ON" , false);
  4066. define("MODULECOPYMOVE_FTP_LAYER_ON" , true);
  4067. class ModuleCopyMove extends Module {
  4068. var $enabled = MODULECOPYMOVE_ON;
  4069. var $enabledAdminMode = MODULECOPYMOVE_ADMIN_MODE_ON;
  4070. var $enabledUserMode = MODULECOPYMOVE_USER_MODE_ON;
  4071. var $icons = array(
  4072. "cut" => "R0lGODlhEAAQAMQfALm7y/n5+3aQrZTI+hsjTu/0+abS+0tVcllqiuXs9dHT22h6m7vc/Yi237PZ/FRheeTl69Tq/o2Rqq7S5JqetMHg/Z6ht6irvlheg9/o70BIWDI5Z5/D177Z6P///////yH5BAEAAB8ALAAAAAAQABAAAAWM4CeOZFl6aJqan9dNE9cItGeqXpEkw2KTHgDAE6lUCo0G4tcKHCABQIRRqC5bqMtBcbB4GA5H4YEKKCCbDYHydRgMhQNKIkEQCJf225CQe3wUBBgBFWB7CRpzEhgQAF5uBgMDGYkeZgIAFHmQkgWJWAkSFwEoCRkZBQoETCkICA8HGrIEZCc4OCy5HyEAOw=="
  4073. );
  4074. var $isFunction = true;
  4075. var $moduleName = "ModuleCopyMove";
  4076. var $position = 35;
  4077. var $requiredModules = array("ModuleSelector");
  4078. var $ftpLayerOn = MODULECOPYMOVE_FTP_LAYER_ON;
  4079. function action() {
  4080. error_reporting(0);
  4081. $relPaths = $_POST["moduleParams"]["relPaths"];
  4082. $cwdRelPath = $_POST["moduleParams"]["cwdRelPath"];
  4083. $action = $_POST["moduleParams"]["action"];
  4084. $cwd = $this->fileManager->getFileByRelPath($cwdRelPath);
  4085. $xml = new Xml();
  4086. if($cwd) {
  4087. if ($cwd->isPermitted) {
  4088. $success = array();
  4089. $failure = array();
  4090. foreach ($relPaths as $relPath) {
  4091. $file = $this->fileManager->getFileByRelPath($relPath);
  4092. if ($file) {
  4093. if ($file->isPermitted) {
  4094. if ($action === "copy") {$this->copy($file->absPath, $cwd->absPath, $success, $failure);}
  4095. else if ($action === "move") {$this->move($file->absPath, $cwd->absPath, $success, $failure);}
  4096. } else {
  4097. $failure[] = array("src" => $this->user->virtualRootAbsPath . $relPath, "des" => $cwd->absPath . basename($relPath));
  4098. }
  4099. } else {
  4100. $failure[] = array("src" => $this->user->virtualRootAbsPath . $relPath, "des" => $cwd->absPath . basename($relPath));
  4101. }
  4102. }
  4103. sort($success);
  4104. sort($failure);
  4105. $xml->setStatusSuccess();
  4106. $content = null;
  4107. if ($action === "copy") {$content .= text("SUCCESSFULLY COPIED") . " :<br>";}
  4108. else if ($action === "move") {$content .= text("SUCCESSFULLY MOVED") . " :<br>";}
  4109. foreach ($success as $absPath) {
  4110. $content .= "/" . $this->fileManager->absPathToRelPath($absPath["src"]) . " -> " . "/" . $this->fileManager->absPathToRelPath($absPath["des"]) . "<br>";
  4111. }
  4112. if ($action === "copy") {$content .= "<br>" . text("FAILED TO COPY") . " :<br>";}
  4113. else if ($action === "move") {$content .= "<br>" . text("FAILED TO MOVE") . " :<br>";}
  4114. foreach ($failure as $absPath) {
  4115. $content .= "/" . $this->fileManager->absPathToRelPath($absPath["src"]) . " -> " . "/" . $this->fileManager->absPathToRelPath($absPath["des"]) . "<br>";
  4116. }
  4117. $xml -> setContent($content);
  4118. } else {
  4119. $xml->setError(text("ACCESS DENIED"));
  4120. }
  4121. } else {
  4122. $xml->setError(text("ACCESS DENIED"));
  4123. }
  4124. $xml->dump();
  4125. }
  4126. // edited in 2.1;
  4127. function copy($srcAbsPath, $desDirAbsPath, &$success, &$failure){
  4128. if (is_dir($srcAbsPath)) {
  4129. $nextDesDirAbsPath = $desDirAbsPath . basename($srcAbsPath) . "/";
  4130. if (strpos($nextDesDirAbsPath, $srcAbsPath) === 0) {
  4131. $failure[] = array("src" => $srcAbsPath, "des" => $nextDesDirAbsPath);
  4132. } else {
  4133. if ($this->sysMkdir($nextDesDirAbsPath)) {
  4134. $success[] = array("src" => $srcAbsPath, "des" => $nextDesDirAbsPath);
  4135. $dirHandle = opendir($srcAbsPath);
  4136. while ($basename = readdir($dirHandle)) {
  4137. $nextSrcAbsPath = $srcAbsPath . $basename;
  4138. switch (true) {
  4139. case ($basename=="."):
  4140. break;
  4141. case ($basename==".."):
  4142. break;
  4143. case (is_dir($nextSrcAbsPath)):
  4144. $nextSrcAbsPath .= "/";
  4145. ModuleCopyMove::copy($nextSrcAbsPath, $nextDesDirAbsPath, $success, $failure);
  4146. break;
  4147. default:
  4148. if ($this->sysCopy($nextSrcAbsPath, $nextDesDirAbsPath . $basename)) {
  4149. $success[] = array("src" => $nextSrcAbsPath, "des" => $nextDesDirAbsPath . $basename);
  4150. } else {
  4151. $failure[] = array("src" => $nextSrcAbsPath, "des" => $nextDesDirAbsPath . $basename);
  4152. }
  4153. break;
  4154. }
  4155. }
  4156. closedir($dirHandle);
  4157. } else {
  4158. $failure[] = array("src" => $srcAbsPath, "des" => $nextDesDirAbsPath);
  4159. }
  4160. }
  4161. } else {
  4162. if ($this->sysCopy($srcAbsPath, $desDirAbsPath . basename($srcAbsPath))) {
  4163. $success[] = array("src" => $srcAbsPath, "des" => $desDirAbsPath . basename($srcAbsPath));
  4164. } else {
  4165. $failure[] = array("src" => $srcAbsPath, "des" => $desDirAbsPath . basename($srcAbsPath));
  4166. }
  4167. }
  4168. }
  4169. function getCss() {
  4170. $css =
  4171. "
  4172. .$this->moduleName input, .$this->moduleName select{
  4173. font-size:0.8em;
  4174. }
  4175. ";
  4176. return $css;
  4177. }
  4178. function getHtml() {
  4179. /* Button is set overflow:hidden for Safari 3 beta. Otherwise button
  4180. would disappear after onClick show/hide the panel and onmouseout. */
  4181. $html =
  4182. "
  4183. <div class='$this->moduleName' id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  4184. <div id='{$this->moduleName}CopyMove' onclick='Sdl.$this->moduleName.main.onClickShowHide();' style='float:left; overflow:hidden;' title='" . text("COPY/MOVE") . "'>
  4185. <img alt='[" . text("COPY/MOVE") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=cut'>
  4186. </div>
  4187. <div style='display:none; float:left; white-space:nowrap;' id='{$this->moduleName}Panel'>
  4188. <span id='{$this->moduleName}FileContainer'></span><input onclick='Sdl.$this->moduleName.main.onClickMove();' type='button' value='" . text("MOVE TO HERE") . "'><input onclick='Sdl.$this->moduleName.main.onClickCopy();' type='button' value='" . text("COPY TO HERE") . "'>
  4189. </div>
  4190. </div>
  4191. ";
  4192. return $html;
  4193. }
  4194. function getJavascript() {
  4195. $javascript =
  4196. "
  4197. Sdl.$this->moduleName = {};
  4198. Sdl.$this->moduleName.Main = function() {
  4199. var this_clone = this;
  4200. this.fileContainer = new Sdl.FileContainer();
  4201. this.ajaxActionCopy = function(xhr) {
  4202. var response;
  4203. response = Sdl.Xml.digestResponseXml(xhr);
  4204. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4205. Sdl.Xml.alertResponse(response);
  4206. this_clone.showResult('copy', response.content);
  4207. }
  4208. }
  4209. this.ajaxActionMove = function(xhr) {
  4210. var response;
  4211. response = Sdl.Xml.digestResponseXml(xhr);
  4212. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4213. Sdl.Xml.alertResponse(response);
  4214. this_clone.showResult('move', response.content);
  4215. }
  4216. }
  4217. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  4218. };
  4219. Sdl.$this->moduleName.Main.prototype = {
  4220. copy : function(cwdRelPath, relPaths) {
  4221. var param = '';
  4222. param += 'moduleParams[action]=copy' + '&';
  4223. param += 'moduleParams[cwdRelPath]=' + cwdRelPath + '&';
  4224. for (var i = 0 ; i < relPaths.length ; i++) {
  4225. param += 'moduleParams[relPaths][' + i + ']=' + relPaths[i] + '&';
  4226. }
  4227. Sdl.Ajax.ajaxPost(this.ajaxActionCopy, '?action=module&module=$this->moduleName', param);
  4228. },
  4229. copyMove : function(action) {
  4230. if (this.fileContainer.files.length > 0) {
  4231. if (Sdl.browser.status.success && Sdl.browser.cwd) {
  4232. var confirm, text;
  4233. if (action == 'copy') {text = '" . text("ARE YOU SURE YOU WANT TO COPY ALL THESE") . " ';}
  4234. else if (action == 'move') {text = '" . text("ARE YOU SURE YOU WANT TO MOVE ALL THESE") . " ';}
  4235. confirm = window.confirm(text + this.fileContainer.files.length + ' files/directories?');
  4236. if (confirm) {
  4237. var relPaths = [];
  4238. for (var i = 0 ; i < this.fileContainer.files.length ; i++) {
  4239. relPaths.push(this.fileContainer.files[i].relPath);
  4240. }
  4241. if (action == 'copy') {this.copy(Sdl.browser.cwd.relPath, relPaths);}
  4242. else if (action == 'move') {this.move(Sdl.browser.cwd.relPath, relPaths);}
  4243. }
  4244. } else {
  4245. alert('Invalid current working directory.');
  4246. }
  4247. } else {
  4248. alert('Please select files.');
  4249. }
  4250. },
  4251. move : function(cwdRelPath, relPaths) {
  4252. var param = '';
  4253. param += 'moduleParams[action]=move' + '&';
  4254. param += 'moduleParams[cwdRelPath]=' + cwdRelPath + '&';
  4255. for (var i = 0 ; i < relPaths.length ; i++) {
  4256. param += 'moduleParams[relPaths][' + i + ']=' + relPaths[i] + '&';
  4257. }
  4258. Sdl.Ajax.ajaxPost(this.ajaxActionMove, '?action=module&module=$this->moduleName', param);
  4259. },
  4260. onClickCopy : function() {
  4261. this.copyMove('copy');
  4262. },
  4263. onClickMove : function() {
  4264. this.copyMove('move');
  4265. },
  4266. onClickShowHide : function() {
  4267. var panel = document.getElementById('{$this->moduleName}Panel');
  4268. if (panel.style.display == 'block') {
  4269. panel.style.display = 'none';
  4270. } else {
  4271. panel.style.display = 'block';
  4272. // For Opera 9.21. When it's clicked, the panel floats down until mouse moves or until onmouseout.
  4273. if (Sdl.System.isOpera()) {
  4274. document.getElementById('{$this->moduleName}CopyMove').onmouseout();
  4275. document.getElementById('{$this->moduleName}CopyMove').onmouseover();
  4276. }
  4277. }
  4278. },
  4279. showResult : function(action, result) {
  4280. var content, page, tabContent, text;
  4281. page = new Sdl.Page();
  4282. content = document.createElement('div');
  4283. content.innerHTML = result;
  4284. content.style.overflow = 'hidden';
  4285. page.content = content;
  4286. tabContent = document.createElement('div');
  4287. if (action == 'copy') {text = 'Result:copy';}
  4288. else {text = 'Result:move';}
  4289. tabContent.innerHTML = text;
  4290. page.tabContent = tabContent;
  4291. page.movableBar.setMoveTarget(page.content);
  4292. Sdl.pageManager.addPage(page);
  4293. },
  4294. windowOnLoadListener : function() {
  4295. document.getElementById('$this->moduleName').style.display = 'inline';
  4296. Sdl.Button.decorateById('{$this->moduleName}CopyMove');
  4297. this.fileContainer.setFileContainer(document.getElementById('{$this->moduleName}FileContainer'));
  4298. }
  4299. }
  4300. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4301. ";
  4302. return $javascript;
  4303. }
  4304. // edited in 2.1;
  4305. function move($absPath, $dirAbsPath, &$success, &$failure) {
  4306. if ($this->sysRename($absPath, $dirAbsPath . basename($absPath))) {$success[] = array("src" => $absPath, "des" => $dirAbsPath . basename($absPath));}
  4307. else {$failure[] = array("src" => $absPath, "des" => $dirAbsPath . basename($absPath));}
  4308. }
  4309. }
  4310. ?>
  4311. <?php
  4312. //------------------------------------------------------------------------------
  4313. // Class name : ModuleCreateFile
  4314. //------------------------------------------------------------------------------
  4315. define("MODULECREATEFILE_ON" , true);
  4316. define("MODULECREATEFILE_ADMIN_MODE_ON" , true);
  4317. define("MODULECREATEFILE_USER_MODE_ON" , false);
  4318. define("MODULECREATEFILE_FTP_LAYER_ON" , true);
  4319. class ModuleCreateFile extends Module {
  4320. var $enabled = MODULECREATEFILE_ON;
  4321. var $enabledAdminMode = MODULECREATEFILE_ADMIN_MODE_ON;
  4322. var $enabledUserMode = MODULECREATEFILE_USER_MODE_ON;
  4323. var $icons = array(
  4324. "createFile" => "R0lGODlhEAAQANUoAOLp8ElVa0NLXIivyJXK/D5FVYm77N7n7ykxQ5rA1svM0YS8O4C4OJXJSInAP5fLS362N4/ERJLHR5DFRdXb5JbKStXn8HqzM4vAQJ7O+1Jhe1dwkezx9nKsLeXt9XaXtKTR+7HX/PL2+sDf/bvc/avU+7ba/P///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACgALAAAAAAQABAAAAaXwJNwSByijifLqdM5JQaDj/RzQgofjaFn6zFsqsuKJOJojs4ig1fYmWAWEDOJJKpriIzLcEQymUIid05LZnx+ISWBQgNEc3+IiQGLImd9fyUlICAekicfHJWXmSAZHgJCn46QmhkZAKeeHJaIrAQEBwWoIn2rrbYcuScbFCIcWwDIAAccCgioG9AaGgEBAgIFBQiCRdxEQQA7",
  4325. "createDir" => "R0lGODlhEAAQANUnAP/3xffkl+vPMfbgjf3zxP7ztvnpofz36PPbg/vuw+3Oaf/78/HVdvbjqvjqtfz0z/bmsPnqvYvAQI/ERJfLS//204nAP5XJSHqzM5bKSoS8O5LHR362N4C4OJDFReu8Ruu2PeuyN+vGUXKsLeuuMvzurP///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACcALAAAAAAQABAAAAaFwNPJRDQJj8ijaTQyJpFFyqX4FC4zm4mlWewSRx6JhtNUiESCtKDbwRQB8EIBsB4umwDRZw8ChUhGXiIHhAkJDgSAQyILjQclJQYBAQMJiiYiFXKQkgMICA6XIg+QkZQIDAwQlx8EnKcMCgoNrAQPDwQJEQ4QDQ0RrH3CIcTFl17IVFXLQQA7",
  4326. );
  4327. var $isFunction = true;
  4328. var $moduleName = "ModuleCreateFile";
  4329. var $position = 20;
  4330. var $ftpLayerOn = MODULECREATEFILE_FTP_LAYER_ON;
  4331. // edited in 2.1;
  4332. function action() {
  4333. $cwdRelPath = $_POST["moduleParams"]["cwdRelPath"];
  4334. $filename = $_POST["moduleParams"]["filename"];
  4335. $type = $_POST["moduleParams"]["type"];
  4336. $cwd = $this->fileManager->getFileByRelPath($cwdRelPath);
  4337. $xml = new Xml();
  4338. if ($cwd) {
  4339. if ($cwd->isPermitted) {
  4340. $absPath = $cwd->absPath . $filename;
  4341. if (file_exists($absPath)) {
  4342. $xml->setError(text("FILE WITH SAME NAME EXISTS"));
  4343. } else {
  4344. if ($type === "file") {
  4345. if ($this->sysTouch($absPath)) {
  4346. $xml->setStatusSuccess();
  4347. $xml->setMessage("$filename " . text("HAS BEEN SUCCESSFULLY CREATED IN") . " /$cwd->relPath .");
  4348. } else {
  4349. $xml->setError(text("ACCESS DENIED"));
  4350. }
  4351. } elseif ($type === "dir") {
  4352. if ($this->sysMkdir($absPath)) {
  4353. $xml->setStatusSuccess();
  4354. $xml->setMessage("$filename " . text("HAS BEEN SUCCESSFULLY CREATED IN") . " /$cwd->relPath .");
  4355. } else {
  4356. $xml->setError(text("ACCESS DENIED"));
  4357. }
  4358. } else {
  4359. $xml->setError(text("ACCESS DENIED"));
  4360. }
  4361. }
  4362. } else {
  4363. $xml->setError(text("ACCESS DENIED"));
  4364. }
  4365. } else {
  4366. $xml->setError(text("ACCESS DENIED"));
  4367. }
  4368. $xml->dump();
  4369. }
  4370. function getHtml() {
  4371. $html =
  4372. "
  4373. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9'>
  4374. <div id='{$this->moduleName}CreateFile' onclick='Sdl.$this->moduleName.main.onClickCreateFile();' style='float:left;' title='" . text("CREATE FILE") . "'>
  4375. <img alt='[" . text("CREATE FILE") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=createFile'>
  4376. </div>
  4377. <div id='{$this->moduleName}CreateDir' onclick='Sdl.$this->moduleName.main.onClickCreateDir();' style='float:left' title='" . text("CREATE DIRECTORY") . "'>
  4378. <img alt='[" . text("CREATE DIRECTORY") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=createDir'>
  4379. </div>
  4380. </div>
  4381. ";
  4382. return $html;
  4383. }
  4384. function getJavascript() {
  4385. $javascript =
  4386. "
  4387. Sdl.$this->moduleName = {};
  4388. Sdl.$this->moduleName.Main = function() {
  4389. var this_clone = this;
  4390. this.ajaxActionCreate = function(xhr) {
  4391. var response;
  4392. response = Sdl.Xml.digestResponseXml(xhr);
  4393. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4394. Sdl.Xml.alertResponse(response);
  4395. }
  4396. }
  4397. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  4398. }
  4399. Sdl.$this->moduleName.Main.prototype = {
  4400. createDir : function(cwdRelPath, filename) {
  4401. var param;
  4402. param = 'moduleParams[cwdRelPath]=' + cwdRelPath + '&' +
  4403. 'moduleParams[filename]=' + filename + '&' +
  4404. 'moduleParams[type]=dir';
  4405. Sdl.Ajax.ajaxPost(this.ajaxActionCreate, '?action=module&module=$this->moduleName', param);
  4406. },
  4407. createFile : function(cwdRelPath, filename) {
  4408. var param;
  4409. param = 'moduleParams[cwdRelPath]=' + cwdRelPath + '&' +
  4410. 'moduleParams[filename]=' + filename + '&' +
  4411. 'moduleParams[type]=file';
  4412. Sdl.Ajax.ajaxPost(this.ajaxActionCreate, '?action=module&module=$this->moduleName', param);
  4413. },
  4414. onClickCreateDir : function() {
  4415. if (Sdl.browser.status.success && Sdl.browser.cwd) {
  4416. var filename;
  4417. filename = prompt('" . text("PLEASE ENTER A DIRECTORY NAME") . "', '" . text("NEWDIR") . "');
  4418. if (filename != '' && filename != null) {
  4419. this.createDir(Sdl.browser.cwd.relPath, filename);
  4420. }
  4421. } else {
  4422. alert('" . text("INVALID CURRENT WORKING DIRECTORY") . "');
  4423. }
  4424. },
  4425. onClickCreateFile : function() {
  4426. if (Sdl.browser.status.success && Sdl.browser.cwd) {
  4427. var filename;
  4428. filename = prompt('" . text("PLEASE ENTER A FILENAME") . "', '" . text("NEWFILE.EXT") . "');
  4429. if (filename != '' && filename != null) {
  4430. this.createFile(Sdl.browser.cwd.relPath, filename);
  4431. }
  4432. } else {
  4433. alert('" . text("INVALID CURRENT WORKING DIRECTORY") . "');
  4434. }
  4435. },
  4436. windowOnLoadListener : function() {
  4437. document.getElementById('$this->moduleName').style.display = 'inline';
  4438. Sdl.Button.decorateById('{$this->moduleName}CreateFile');
  4439. Sdl.Button.decorateById('{$this->moduleName}CreateDir');
  4440. }
  4441. }
  4442. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4443. ";
  4444. return $javascript;
  4445. }
  4446. }
  4447. ?>
  4448. <?php
  4449. //------------------------------------------------------------------------------
  4450. // Class name : ModuleDelete
  4451. //------------------------------------------------------------------------------
  4452. define("MODULEDELETE_ON" , true);
  4453. define("MODULEDELETE_ADMIN_MODE_ON" , true);
  4454. define("MODULEDELETE_USER_MODE_ON" , false);
  4455. define("MODULEDELETE_FTP_LAYER_ON" , true);
  4456. class ModuleDelete extends Module {
  4457. var $enabled = MODULEDELETE_ON;
  4458. var $enabledAdminMode = MODULEDELETE_ADMIN_MODE_ON;
  4459. var $enabledUserMode = MODULEDELETE_USER_MODE_ON;
  4460. var $icons = array(
  4461. "delete" => "R0lGODlhEAAQANUiALba/OLp8ElVa0NLXIivyJXK/MDf/T5FVbvc/Ym77MvM0ZrA1t7n7ykxQ67T5dXn8LDR46jL3tXb5J7O+1Jhe1dwkbHX/KvU+6TR++zx9naXtMfj/u0xMeXt9fL2+u3x9s8dHf///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACIALAAAAAAQABAAAAaewJBwSByKjqGHAxJZLAgEjVQTQjoenUxW2+kmKtUQpLMplw1oT+IrjHg+5o8BgfDYKcLFBwTffxAAABYeeCEKIBx8iHyCF4RCBB6LiR8WFheOApBvi5WYGBgdmiEaGZN8F6ATHQNCh5SdGBMTAa2kfgB+sgUFDAdCGm+NH7ITvBm/IRUSHlwBzwEMGQoNwBXXFBQCAgMDBwcNhUXjREEAOw==",
  4462. );
  4463. var $isFunction = true;
  4464. var $moduleName = "ModuleDelete";
  4465. var $position = 50;
  4466. var $requiredModules = array("ModuleSelector");
  4467. var $ftpLayerOn = MODULEDELETE_FTP_LAYER_ON;
  4468. // edited in 2.1;
  4469. function action() {
  4470. $relPaths = $_POST["moduleParams"]["relPaths"];
  4471. $xml = new Xml();
  4472. $success = array();
  4473. $failure = array();
  4474. foreach ($relPaths as $relPath) {
  4475. $file = $this->fileManager->getFileByRelPath($relPath);
  4476. if ($file) {
  4477. if ($file->isPermitted) {
  4478. $this->deleteFile($file->absPath, $success, $failure);
  4479. } else {
  4480. $failure[] = $file->absPath;
  4481. }
  4482. } else {
  4483. $failure[] = $file->absPath;
  4484. }
  4485. }
  4486. sort($success);
  4487. sort($failure);
  4488. $xml->setStatusSuccess();
  4489. $content = null;
  4490. $content = text("SUCCESSFULLY DELETED") . " :<br>";
  4491. foreach ($success as $absPath) {
  4492. $content .= "/" . $this->fileManager->absPathToRelPath($absPath) . "<br>";
  4493. }
  4494. $content .= "<br>" . text("FAILED TO DELETE") . " :<br>";
  4495. foreach ($failure as $absPath) {
  4496. $content .= "/" . $this->fileManager->absPathToRelPath($absPath) . "<br>";
  4497. }
  4498. $xml -> setContent($content);
  4499. $xml->dump();
  4500. }
  4501. function deleteFile($absPath, &$success, &$failure) {
  4502. if(is_dir($absPath)){
  4503. $dirHandle = opendir($absPath);
  4504. while ($basename = readdir($dirHandle)){
  4505. $nextAbsPath = $absPath . $basename;
  4506. switch (true) {
  4507. case ($basename=="."):
  4508. break;
  4509. case ($basename==".."):
  4510. break;
  4511. case (is_dir($nextAbsPath)):
  4512. $nextAbsPath .= "/";
  4513. ModuleDelete::deleteFile($nextAbsPath, $success, $failure);
  4514. break;
  4515. default:
  4516. $this->sysUnlink($nextAbsPath) ? $success[] = $nextAbsPath : $failure[] = $nextAbsPath;
  4517. break;
  4518. }
  4519. }
  4520. closedir($dirHandle);
  4521. if ($this->sysRmdir($absPath)) {$success[] = $absPath;}
  4522. else {$failure[] = $absPath;}
  4523. }else{
  4524. if ($this->sysUnlink($absPath)) {$success[] = $absPath;}
  4525. else {$failure[] = $absPath;}
  4526. }
  4527. }
  4528. function getHtml() {
  4529. $html =
  4530. "
  4531. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  4532. <div id='{$this->moduleName}Delete' onclick='Sdl.$this->moduleName.main.onClickDelete();' style='float:left' title='" . text("DELETE") . "'>
  4533. <img alt='[" . text("DELETE") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=delete'>
  4534. </div>
  4535. </div>
  4536. ";
  4537. return $html;
  4538. }
  4539. function getJavascript() {
  4540. $javascript =
  4541. "
  4542. Sdl.$this->moduleName = {};
  4543. Sdl.$this->moduleName.Main = function() {
  4544. var this_clone = this;
  4545. this.ajaxActionDelete = function(xhr) {
  4546. var response;
  4547. response = Sdl.Xml.digestResponseXml(xhr);
  4548. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4549. var content, page, tabContent;
  4550. Sdl.Xml.alertResponse(response);
  4551. page = new Sdl.Page();
  4552. content = document.createElement('div');
  4553. content.style.overflow = 'hidden';
  4554. content.innerHTML = response.content;
  4555. page.content = content;
  4556. tabContent = document.createElement('div');
  4557. tabContent.innerHTML = '<nobr>Deletion result</nobr>';
  4558. page.tabContent = tabContent;
  4559. page.movableBar.setMoveTarget(page.content);
  4560. Sdl.pageManager.addPage(page);
  4561. }
  4562. }
  4563. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  4564. };
  4565. Sdl.$this->moduleName.Main.prototype = {
  4566. deleteFiles : function(relPaths) {
  4567. var param = '';
  4568. for (var i = 0 ; i < relPaths.length ; i++) {
  4569. param += 'moduleParams[relPaths][' + i + ']=' + relPaths[i] + '&';
  4570. }
  4571. Sdl.Ajax.ajaxPost(this.ajaxActionDelete, '?action=module&module=$this->moduleName', param);
  4572. },
  4573. onClickDelete : function() {
  4574. var selectedFiles, confirm;
  4575. selectedFiles = Sdl.ModuleSelector.main.getSelectedFilesAndWarn();
  4576. if (selectedFiles.length > 0) {
  4577. confirm = window.confirm('" . text("ARE YOU SURE YOU WANT TO DELETE ALL THESE") . " ' + selectedFiles.length + ' " . text("FILES/DIRECTORIES") . "?');
  4578. if (confirm) {
  4579. var relPaths = [];
  4580. for (var i = 0 ; i < selectedFiles.length ; i++) {
  4581. relPaths.push(selectedFiles[i].relPath);
  4582. }
  4583. this.deleteFiles(relPaths);
  4584. }
  4585. }
  4586. },
  4587. windowOnLoadListener : function() {
  4588. document.getElementById('$this->moduleName').style.display = 'block';
  4589. Sdl.Button.decorateById('{$this->moduleName}Delete');
  4590. }
  4591. }
  4592. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4593. ";
  4594. return $javascript;
  4595. }
  4596. }
  4597. ?>
  4598. <?php
  4599. //------------------------------------------------------------------------------
  4600. // Class name : ModuleDownload
  4601. //------------------------------------------------------------------------------
  4602. define("MODULEDOWNLOAD_ON" , true);
  4603. define("MODULEDOWNLOAD_ADMIN_MODE_ON" , true);
  4604. define("MODULEDOWNLOAD_USER_MODE_ON" , false);
  4605. class ModuleDownload extends Module {
  4606. var $enabled = MODULEDOWNLOAD_ON;
  4607. var $enabledAdminMode = MODULEDOWNLOAD_ADMIN_MODE_ON;
  4608. var $enabledUserMode = MODULEDOWNLOAD_USER_MODE_ON;
  4609. var $icons = array(
  4610. "download" => "R0lGODlhEAAQAMQAAIWOl8rKyoibetPT02hoarm6usPDw/Pz89ra2uTk5Hl6e6mrpmGNRH2vWunp6e3t7ZPNX47LVbW1tZPIa5nXWvv7+1hZXfT2+HFxcfNXV2FhYZ6ens7OzvDw8GOPRf///yH5BAAAAAAALAAAAAAQABAAAAWf4CeOX9SQJGIYi+CZniBsQCEa5Nt44nUBIlvCQ6RMiB7ORRH8JCoeCAUSYVQ4H+ZH8kEgDp5Gg9HhYDGiRRcRODDIBvMH/VEPBgVJpyORyOl2d2aDcgQiGwd7D4sPDo6Ohh8bHSoFlpYSBRwOkZN3AxwBHxMGGQYJGocXn6EBKwYFHakfAAgXHY2PDgkdARYiAArCGBgExhrIFpEozCQhADs=",
  4611. );
  4612. var $isFunction = true;
  4613. var $moduleName = "ModuleDownload";
  4614. var $position = 70;
  4615. var $requiredModules = array("ModuleSelector");
  4616. function action() {
  4617. if ($_GET["moduleParams"]["action"] === "download") {
  4618. $relPath = $_GET["moduleParams"]["relPath"];
  4619. $absPath = $this->fileManager->relPathToAbsPath($relPath);
  4620. $handle = fopen($absPath, "rb");
  4621. $name = basename($absPath);
  4622. header("Content-Type: application/octet-stream");
  4623. header("Content-Length: " . filesize($absPath));
  4624. header('Content-Disposition: attachment; filename="'.$name.'"');
  4625. header("Content-Transfer-Encoding: binary\n");
  4626. fpassthru($handle);
  4627. exit(0);
  4628. } else if ($_GET["moduleParams"]["action"] === "check") {
  4629. $xml = new Xml();
  4630. $relPath = $_POST["moduleParams"]["relPath"];
  4631. $absPath = $this->fileManager->relPathToAbsPath($relPath);
  4632. if ($absPath) {
  4633. if (is_dir($absPath)) {
  4634. $xml->setError(text("DIRECTORY IS NOT ACCEPTED"));
  4635. } else {
  4636. if (is_readable($absPath)) {
  4637. $xml->setStatusSuccess();
  4638. $link = "?action=module&module=$this->moduleName&moduleParams[action]=download&moduleParams[relPath]=$relPath";
  4639. $xml->setContent($link);
  4640. } else {
  4641. $xml->setError(text("ACCESS DENIED"));
  4642. }
  4643. }
  4644. } else {
  4645. $xml->setError(text("ACCESS DENIED"));
  4646. }
  4647. $xml->dump();
  4648. }
  4649. }
  4650. function getPageHtml($content, $relPath) {
  4651. $content = htmlentities($content);
  4652. $html = null;
  4653. $html =
  4654. "
  4655. <div>
  4656. <span>$relPath</span>
  4657. <pre>$content</pre>
  4658. </div>
  4659. ";
  4660. return $html;
  4661. }
  4662. function getHtml() {
  4663. $html =
  4664. "
  4665. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  4666. <div id='{$this->moduleName}Download' onclick='Sdl.$this->moduleName.main.onClickDownload();' style='float:left' title='" . text("DOWNLOAD") . "'>
  4667. <img alt='[" . text("DOWNLOAD") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=download'>
  4668. </div>
  4669. </div>";
  4670. return $html;
  4671. }
  4672. function getJavascript() {
  4673. $javascript =
  4674. "
  4675. Sdl.$this->moduleName = {};
  4676. Sdl.$this->moduleName.Main = function() {
  4677. var this_clone = this;
  4678. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  4679. }
  4680. Sdl.$this->moduleName.Main.prototype = {
  4681. ajaxActionDownload : function(xhr) {
  4682. var response;
  4683. response = Sdl.Xml.digestResponseXml(xhr);
  4684. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4685. Sdl.Xml.alertResponse(response);
  4686. if (response.status.success) {
  4687. window.open(response.content);
  4688. }
  4689. }
  4690. },
  4691. download : function(relPath) {
  4692. var param;
  4693. param = 'moduleParams[relPath]=' + relPath;
  4694. Sdl.Ajax.ajaxPost(this.ajaxActionDownload, '?action=module&module=$this->moduleName&moduleParams[action]=check', param);
  4695. },
  4696. onClickDownload : function() {
  4697. var selectedFile;
  4698. selectedFile = Sdl.ModuleSelector.main.getSingleSelectedFileAndWarn();
  4699. if (selectedFile) {
  4700. this.download(selectedFile.relPath);
  4701. }
  4702. },
  4703. windowOnLoadListener : function() {
  4704. document.getElementById('$this->moduleName').style.display = 'inline';
  4705. Sdl.Button.decorateById('{$this->moduleName}Download');
  4706. }
  4707. }
  4708. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4709. ";
  4710. return $javascript;
  4711. }
  4712. }
  4713. ?>
  4714. <?php
  4715. //------------------------------------------------------------------------------
  4716. // Class name : ModuleEdit
  4717. //------------------------------------------------------------------------------
  4718. define("MODULEEDIT_ON" , true);
  4719. define("MODULEEDIT_ADMIN_MODE_ON" , true);
  4720. define("MODULEEDIT_USER_MODE_ON" , false);
  4721. define("MODULEEDIT_FTP_LAYER_ON" , true);
  4722. class ModuleEdit extends Module {
  4723. var $enabled = MODULEEDIT_ON;
  4724. var $enabledAdminMode = MODULEEDIT_ADMIN_MODE_ON;
  4725. var $enabledUserMode = MODULEEDIT_USER_MODE_ON;
  4726. var $icons = array(
  4727. "edit" => "R0lGODlhEAAQAMQAAGB3lYivyMDf/XiZt+Ts9ajT/Mbh/UlVa/P2+bLY/FRlfu3x9ZzN++Xy/rTR4ENLXN7v/tTk8Jm/1enx96jL3uDo7ykxQz5FVb2JAP+8Bv/RV6HQ/FSr9qfR+jhllf///yH5BAAAAAAALAAAAAAQABAAAAWV4CeOZClGjkNJUhAMsOdJohMRUz4RvNdxntrEQCQKGj6gQkRBFAXHpAex/EicBijy54FQRddslAspfD8BhBZDLpgPovQRo8l0C50NAf4ZLBp0GRhleXoPIn4RdYN4GxsMFYd9CwkKlgoAAwybFReICAkJeAUDAKYAC54fABEIOzwEFbILDhaImJcHBw8PFxcWVSbCIiEAOw==",
  4728. );
  4729. var $isFunction = true;
  4730. var $moduleName = "ModuleEdit";
  4731. var $position = 95;
  4732. var $requiredModules = array("ModuleFilename", "ModuleSelector");
  4733. var $ftpLayerOn = MODULEEDIT_FTP_LAYER_ON;
  4734. function action() {
  4735. $action = $relPath = $_POST["moduleParams"]["action"];
  4736. if ($action === "edit") {
  4737. $relPath = $_POST["moduleParams"]["relPath"];
  4738. $file = $this->fileManager->getFileByRelPath($relPath);
  4739. $xml = new Xml();
  4740. if ($file) {
  4741. if ($file->isPermitted) {
  4742. if ($file->isDir) {
  4743. $content = text("DIRECTORY IS NOT ACCEPTED");
  4744. } else {
  4745. $content = file_get_contents($file->absPath);
  4746. if ($content === false) {$response = text("ACCESS DENIED");}
  4747. else {$content = $this->getPageHtml($content, $relPath, $_POST["moduleParams"]["pageId"]);}
  4748. }
  4749. } else {
  4750. $content = text("ACCESS DENIED");
  4751. }
  4752. } else {
  4753. $content = text("ACCESS DENIED");
  4754. }
  4755. echo $content;
  4756. } else if ($action === "save") {
  4757. $relPath = $_POST["moduleParams"]["relPath"];
  4758. $text = $_POST["moduleParams"]["text"];
  4759. $file = $this->fileManager->getFileByRelPath($relPath);
  4760. $xml = new Xml();
  4761. if ($file) {
  4762. if ($file->isPermitted) {
  4763. if ($file->isDir) {
  4764. $xml->setErrorFileWithSameNameExist();
  4765. } else {
  4766. if ($this->sysWrite($file->absPath, $text)) {
  4767. $xml->setStatusSuccess();
  4768. $xml->setMessage(text("FILE HAS BEEN SUCCESSFULLY SAVED"));
  4769. } else {
  4770. $xml->setError("ACCESS DENIED");
  4771. }
  4772. /*
  4773. $handle = fopen($file->absPath, 'w');
  4774. if ($handle) {
  4775. if (fwrite($handle, $text) === false) {
  4776. $xml->setError("ACCESS DENIED");
  4777. } else {
  4778. $xml->setStatusSuccess();
  4779. $xml->setMessage(text("FILE HAS BEEN SUCCESSFULLY SAVED"));
  4780. }
  4781. } else {
  4782. $xml->setError("ACCESS DENIED");
  4783. }
  4784. fclose($handle);
  4785. */
  4786. }
  4787. } else {
  4788. $xml->setError(text("ACCESS DENIED"));
  4789. }
  4790. } else {
  4791. $xml->setError(text("ACCESS DENIED"));
  4792. }
  4793. $xml->dump();
  4794. }
  4795. }
  4796. function write($absPath, $content) {
  4797. $handle = fopen($absPath, 'w');
  4798. if ($handle) {
  4799. if (fwrite($handle, $content) === false) {
  4800. fclose($handle);
  4801. return false;
  4802. } else {
  4803. fclose($handle);
  4804. return true;
  4805. }
  4806. }
  4807. return false;
  4808. }
  4809. function getHtml() {
  4810. $html =
  4811. "
  4812. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  4813. <div id='{$this->moduleName}Edit' onclick='Sdl.$this->moduleName.main.onClickEdit();' style='float:left' title='Edit'>
  4814. <img alt='[Edit]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=edit'>
  4815. </div>
  4816. </div>
  4817. ";
  4818. return $html;
  4819. }
  4820. function getPageHtml($content, $relPath, $pageId) {
  4821. $content = Text::htmlentitiesUtf8($content);
  4822. $html = null;
  4823. $html =
  4824. "
  4825. <div>
  4826. <div>File : /$relPath</div>
  4827. <div><input id='{$this->moduleName}Save_$pageId' type='button' value='Save'></div>
  4828. <div><textarea id='{$this->moduleName}Textarea_$pageId' wrap='off' style='height:300px;min-height:100px;width:100%;'>$content</textarea></div>
  4829. </div>
  4830. ";
  4831. return $html;
  4832. }
  4833. function getJavascript() {
  4834. $javascript =
  4835. "
  4836. Sdl.$this->moduleName = {};
  4837. Sdl.$this->moduleName.Edit = function(){
  4838. var this_clone = this;
  4839. this.file = null;
  4840. this.page = null;
  4841. this.pageId = null;
  4842. this.ajaxActionEditPass = function(xhr) {
  4843. this_clone.ajaxActionEdit(xhr);
  4844. }
  4845. this.ajaxActionSavePass = function(xhr) {
  4846. this_clone.ajaxActionSave(xhr);
  4847. }
  4848. this.onClickSave = function() {
  4849. this_clone.save();
  4850. }
  4851. };
  4852. Sdl.$this->moduleName.Edit.prototype = {
  4853. addPage : function() {
  4854. var content, tabContent;
  4855. this.page = new Sdl.Page();
  4856. content = document.createElement('div');
  4857. content.innerHTML = 'Loading...';
  4858. content.style.padding = '0px 5px';
  4859. this.page.content = content;
  4860. tabContent = document.createElement('div');
  4861. tabContent.innerHTML = 'Edit:Loading';
  4862. this.page.tabContent = tabContent;
  4863. this.page.movableBar.isDefaultLocked = true;
  4864. this.page.movableBar.unlockType = 'scrollHeight';
  4865. Sdl.pageManager.addPage(this.page);
  4866. },
  4867. ajaxActionEdit : function(xhr) {
  4868. var div
  4869. this.page.content.innerHTML = xhr.responseText;
  4870. this.page.tabContent.innerHTML = '<nobr>Edit:' + this.file.filename + '</nobr>';
  4871. div = document.getElementById('{$this->moduleName}Textarea_' + this.pageId);
  4872. if (div){
  4873. this.page.movableBar.setMoveTarget(document.getElementById('{$this->moduleName}Textarea_' + this.pageId));
  4874. document.getElementById('{$this->moduleName}Save_' + this.pageId).onclick = this.onClickSave;
  4875. }
  4876. },
  4877. ajaxActionSave : function(xhr) {
  4878. var response;
  4879. response = Sdl.Xml.digestResponseXml(xhr);
  4880. if (Sdl.Xml.validateResponseAndWarn(response)) {
  4881. Sdl.Xml.alertResponse(response);
  4882. }
  4883. },
  4884. edit : function() {
  4885. var param;
  4886. param = 'moduleParams[relPath]=' + this.file.relPath + '&' +
  4887. 'moduleParams[pageId]=' + this.pageId + '&' +
  4888. 'moduleParams[action]=edit';
  4889. Sdl.Ajax.ajaxPost(this.ajaxActionEditPass, '?action=module&module=$this->moduleName', param);
  4890. },
  4891. save : function() {
  4892. var text;
  4893. text = document.getElementById('{$this->moduleName}Textarea_' + this.pageId).value;
  4894. var param;
  4895. param = 'moduleParams[relPath]=' + this.file.relPath + '&' +
  4896. 'moduleParams[text]=' + encodeURIComponent(text) + '&' +
  4897. 'moduleParams[action]=save';
  4898. Sdl.Ajax.ajaxPost(this.ajaxActionSavePass, '?action=module&module=$this->moduleName', param);
  4899. }
  4900. }
  4901. Sdl.$this->moduleName.Main = function() {
  4902. var this_clone = this;
  4903. this.pages = [];
  4904. this.pageIdIndex = 0;
  4905. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  4906. }
  4907. Sdl.$this->moduleName.Main.prototype = {
  4908. onClickEdit : function() {
  4909. var newFilename, oldFilename, selectedFile;
  4910. selectedFile = Sdl.ModuleSelector.main.getSingleSelectedFileAndWarn();
  4911. if (selectedFile) {
  4912. var edit = new Sdl.$this->moduleName.Edit;
  4913. edit.file = selectedFile;
  4914. edit.pageId = this.pageIdIndex++;
  4915. edit.addPage();
  4916. edit.edit();
  4917. }
  4918. },
  4919. windowOnLoadListener : function() {
  4920. document.getElementById('$this->moduleName').style.display = 'block';
  4921. Sdl.Button.decorateById('{$this->moduleName}Edit');
  4922. }
  4923. }
  4924. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4925. ";
  4926. return $javascript;
  4927. }
  4928. }
  4929. ?>
  4930. <?php
  4931. //------------------------------------------------------------------------------
  4932. // Class name : ModuleFileMode
  4933. //------------------------------------------------------------------------------
  4934. define("MODULEFILEMODE_ON" , true);
  4935. define("MODULEFILEMODE_ADMIN_MODE_ON" , true);
  4936. define("MODULEFILEMODE_USER_MODE_ON" , true);
  4937. class ModuleFileMode extends Module {
  4938. var $enabled = MODULEFILEMODE_ON;
  4939. var $enabledAdminMode = MODULEFILEMODE_ADMIN_MODE_ON;
  4940. var $enabledUserMode = MODULEFILEMODE_USER_MODE_ON;
  4941. var $isAttribute = true;
  4942. var $moduleName = "ModuleFileMode";
  4943. var $position = 30;
  4944. function getCss() {
  4945. $css =
  4946. "
  4947. .{$this->moduleName}HeaderViewList {
  4948. margin:0em 0.5em;
  4949. text-align:center;
  4950. white-space:nowrap;
  4951. width:3em;
  4952. }
  4953. .{$this->moduleName}ViewList {
  4954. margin:0em 0.5em;
  4955. text-align:center;
  4956. white-space:nowrap;
  4957. width:3em;
  4958. }
  4959. .{$this->moduleName}ViewThumbnail {
  4960. font-size:0.9em;
  4961. white-space:nowrap;
  4962. }
  4963. ";
  4964. return $css;
  4965. }
  4966. function getHeader() {
  4967. return "<div class='{$this->moduleName}HeaderViewList'><span id='{$this->moduleName}Header'>" . text("MODE") . "</span></div>";
  4968. }
  4969. function getHtml($file, $id, $view) {
  4970. if ($view == "list") {$className = "{$this->moduleName}ViewList";}
  4971. else if ($view == "thumbnail") {$className = "{$this->moduleName}ViewThumbnail";}
  4972. $mode = substr(sprintf('%o', fileperms($file->absPath)), -3);
  4973. $html = "<div class='$className' id='{$this->moduleName}_$id'>$mode</div><div id='{$this->moduleName}SortValue_$id' style='display:none'>$mode</div>";
  4974. return $html;
  4975. }
  4976. function getHtmlParentDirectory($relPath, $view) {
  4977. $html = "<div class='{$this->moduleName}ViewList'></div>";
  4978. return $html;
  4979. }
  4980. function getJavascript() {
  4981. $javascript =
  4982. "
  4983. Sdl.$this->moduleName = {};
  4984. Sdl.$this->moduleName.Main = function() {
  4985. var this_clone = this;
  4986. this.sort = new Sdl.Sort();
  4987. this.sort.setDefaultOrder(1);
  4988. this.sort.attribute = '$this->moduleName';
  4989. this.sort.type = 'numeric';
  4990. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener()});
  4991. }
  4992. Sdl.$this->moduleName.Main.prototype = {
  4993. windowOnLoadListener : function() {
  4994. var div = document.getElementById('{$this->moduleName}Header');
  4995. this.sort.setSortButton(div);
  4996. }
  4997. }
  4998. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  4999. ";
  5000. return $javascript;
  5001. }
  5002. function getRss($file, $fileId) {
  5003. return "[" . text("FILE MODE") . ": " . substr(sprintf('%o', fileperms($file->absPath)), -3) . "] ";
  5004. }
  5005. }
  5006. ?>
  5007. <?php
  5008. //------------------------------------------------------------------------------
  5009. // Class name : ModuleFileMTime
  5010. //------------------------------------------------------------------------------
  5011. define("MODULEFILEMTIME_ON" , true);
  5012. define("MODULEFILEMTIME_ADMIN_MODE_ON" , true);
  5013. define("MODULEFILEMTIME_USER_MODE_ON" , true);
  5014. define("MODULEFILEMTIME_TIME_OFFSET" , 0);
  5015. class ModuleFileMTime extends Module {
  5016. var $enabled = MODULEFILEMTIME_ON;
  5017. var $enabledAdminMode = MODULEFILEMTIME_ADMIN_MODE_ON;
  5018. var $enabledUserMode = MODULEFILEMTIME_USER_MODE_ON;
  5019. var $header = "Last Modified";
  5020. var $isAttribute = true;
  5021. var $moduleName = "ModuleFileMTime";
  5022. var $position = 40;
  5023. function getCss() {
  5024. $css =
  5025. "
  5026. .{$this->moduleName}HeaderViewList {
  5027. margin:0em 0.5em;
  5028. text-align:center;
  5029. width:9em;
  5030. white-space:nowrap;
  5031. }
  5032. .{$this->moduleName}ViewList {
  5033. margin:0em 0.5em;
  5034. text-align:right;
  5035. width:9em;
  5036. white-space:nowrap;
  5037. white-space:nowrap;
  5038. }
  5039. .{$this->moduleName}ViewThumbnail {
  5040. white-space:nowrap;
  5041. font-size:0.9em;
  5042. }
  5043. ";
  5044. return $css;
  5045. }
  5046. function getHeader() {
  5047. return "<div class='{$this->moduleName}HeaderViewList'><span id='{$this->moduleName}Header'>" . text("LAST MODIFIED") . "</span></div>";
  5048. }
  5049. function getHtml($file, $id, $view) {
  5050. $timestamp = filemtime($file->absPath) + MODULEFILEMTIME_TIME_OFFSET * 3600;
  5051. if ($view == "list") {
  5052. $className = "{$this->moduleName}ViewList";
  5053. $mtime = date('d-M-Y H:i', $timestamp);
  5054. } else if ($view == "thumbnail") {
  5055. $className = "{$this->moduleName}ViewThumbnail";
  5056. $mtime = date('d-M-y H:i', $timestamp);
  5057. }
  5058. $html =
  5059. "
  5060. <div class='$className' id='{$this->moduleName}_$id'>$mtime</div>
  5061. <div id='{$this->moduleName}SortValue_$id' style='display:none'>" . $timestamp . "</div>
  5062. ";
  5063. return $html;
  5064. }
  5065. function getHtmlParentDirectory($file, $view) {
  5066. $html = "<div class='{$this->moduleName}ViewList'></div>";
  5067. return $html;
  5068. }
  5069. function getJavascript() {
  5070. $javascript =
  5071. "
  5072. Sdl.$this->moduleName = {};
  5073. Sdl.$this->moduleName.Main = function() {
  5074. var this_clone = this;
  5075. this.sort = new Sdl.Sort();
  5076. this.sort.setDefaultOrder(1);
  5077. this.sort.attribute = '{$this->moduleName}SortValue';
  5078. this.sort.type = 'numeric';
  5079. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener()});
  5080. }
  5081. Sdl.$this->moduleName.Main.prototype = {
  5082. windowOnLoadListener : function() {
  5083. var div = document.getElementById('{$this->moduleName}Header');
  5084. this.sort.setSortButton(div);
  5085. }
  5086. }
  5087. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5088. ";
  5089. return $javascript;
  5090. }
  5091. function getRss($file, $fileId) {
  5092. $timestamp = filemtime($file->absPath) + MODULEFILEMTIME_TIME_OFFSET * 3600;
  5093. return "[" . text("LAST MODIFIED") . ": " . date('d-M-Y H:i', $timestamp) . "] ";
  5094. }
  5095. }
  5096. ?>
  5097. <?php
  5098. //------------------------------------------------------------------------------
  5099. // Class name : ModuleFilename
  5100. //------------------------------------------------------------------------------
  5101. define("MODULEFILENAME_ON" , true);
  5102. define("MODULEFILENAME_ADMIN_MODE_ON" , true);
  5103. define("MODULEFILENAME_USER_MODE_ON" , true);
  5104. define("MODULEFILENAME_LOCALE_CLASS" , "ModuleFilenameLocaleEnglishUS");
  5105. class ModuleFilename extends Module {
  5106. var $enabled = MODULEFILENAME_ON;
  5107. var $enabledAdminMode = MODULEFILENAME_ADMIN_MODE_ON;
  5108. var $enabledUserMode = MODULEFILENAME_USER_MODE_ON;
  5109. var $isAttribute = true;
  5110. var $localeClass = MODULEFILENAME_LOCALE_CLASS;
  5111. var $moduleName = "ModuleFilename";
  5112. var $position = 10;
  5113. function getCss() {
  5114. $css =
  5115. "
  5116. .{$this->moduleName}ViewList {
  5117. overflow:hidden;
  5118. margin:0em 0.5em;
  5119. /*width:13.3em;*/
  5120. width:20em;
  5121. white-space:nowrap;
  5122. }
  5123. .{$this->moduleName}ViewThumbnail {
  5124. white-space:nowrap;
  5125. font-size:0.9em;
  5126. }
  5127. ";
  5128. return $css;
  5129. }
  5130. function getHeader() {
  5131. return "<div class='{$this->moduleName}ViewList'><span id='{$this->moduleName}Header'>" . text("NAME") . "</span></div>";
  5132. }
  5133. function getHtml($file, $id, $view) {
  5134. if ($view == "list") {
  5135. $className = "{$this->moduleName}ViewList";
  5136. } else if ($view == "thumbnail") {
  5137. $className = "{$this->moduleName}ViewThumbnail";
  5138. }
  5139. if ($file->isDir) {
  5140. $attribute = "<a href='?cwdRelPath={$file->relPath}&view=$view' onclick='Sdl.$this->moduleName.main.onClickRedirect(event, \"$file->relPath\"); return false;' style='text-decoration:underline'>$file->basename</a>";
  5141. } else {
  5142. if($file->url) {
  5143. $attribute = "<a href='$file->url' onclick='Sdl.Event.stopPropagation(event);' style='text-decoration:none' target='_blank'>$file->basename</a>";
  5144. } else {
  5145. $attribute = "<span style='text-decoration:none'>$file->basename</span>";
  5146. }
  5147. }
  5148. $html =
  5149. "
  5150. <div class='$className' id='{$this->moduleName}_$id' title='$file->basename'>$attribute</div>
  5151. <div id='{$this->moduleName}SortValue_$id' style='display:none'>$file->basename</div>
  5152. ";
  5153. return $html;
  5154. }
  5155. function getHtmlParentDirectory($relPath, $view) {
  5156. $basename = "Parent Directory";
  5157. $html =
  5158. "<div class='{$this->moduleName}ViewList' id='{$this->moduleName}_..'>
  5159. <a href='?cwdRelPath={$relPath}&view=$view' onclick='Sdl.$this->moduleName.main.onClickRedirectParentDir(); return false;'>$basename</a>
  5160. </div>
  5161. ";
  5162. return $html;
  5163. }
  5164. function getJavascript() {
  5165. $javascript =
  5166. "
  5167. Sdl.$this->moduleName = {};
  5168. Sdl.$this->moduleName.Main = function() {
  5169. var this_clone = this;
  5170. this.sort = new Sdl.Sort();
  5171. this.sort.setDefaultOrder(1);
  5172. this.sort.attribute = '{$this->moduleName}SortValue';
  5173. this.sort.type = 'literal';
  5174. Sdl.browser.addOnLoadListener(function() {this_clone.browserOnLoadListener()});
  5175. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener()});
  5176. }
  5177. Sdl.$this->moduleName.Main.prototype = {
  5178. browserOnLoadListener : function() {
  5179. var a, div;
  5180. div = document.getElementById('{$this->moduleName}_..');
  5181. a = div.getElementsByTagName('a')[0];
  5182. a.href = '?cwdRelPath=' + Sdl.browser.cwd.parentDir + '&view=' + Sdl.browser.view;
  5183. },
  5184. onClickRedirect : function(e, cwdRelPath) {
  5185. Sdl.Event.stopPropagation(e);
  5186. Sdl.browser.loadDirListing(cwdRelPath);
  5187. },
  5188. onClickRedirectParentDir : function() {
  5189. Sdl.browser.loadDirListingParentDir();
  5190. },
  5191. windowOnLoadListener : function() {
  5192. var div = document.getElementById('{$this->moduleName}Header');
  5193. this.sort.setSortButton(div);
  5194. Sdl.sortManager.defaultSort = this.sort;
  5195. }
  5196. }
  5197. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5198. ";
  5199. return $javascript;
  5200. }
  5201. }
  5202. class ModuleFilenameLocaleEnglishUS extends Locale {
  5203. var $localeGroup = "en";
  5204. var $localeName = "en-us";
  5205. var $text = array(
  5206. "NAME"
  5207. => "Name",
  5208. );
  5209. }
  5210. ?>
  5211. <?php
  5212. //------------------------------------------------------------------------------
  5213. // Class name : ModuleFileSize
  5214. //------------------------------------------------------------------------------
  5215. define("MODULEFILESIZE_ON" , true);
  5216. define("MODULEFILESIZE_ADMIN_MODE_ON" , true);
  5217. define("MODULEFILESIZE_USER_MODE_ON" , true);
  5218. class ModuleFileSize extends Module {
  5219. var $enabled = MODULEFILESIZE_ON;
  5220. var $enabledAdminMode = MODULEFILESIZE_ADMIN_MODE_ON;
  5221. var $enabledUserMode = MODULEFILESIZE_USER_MODE_ON;
  5222. var $isAttribute = true;
  5223. var $moduleName = "ModuleFileSize";
  5224. var $position = 20;
  5225. function getCss() {
  5226. $css =
  5227. "
  5228. .{$this->moduleName}HeaderViewList {
  5229. overflow:hidden;
  5230. margin:0em 0.5em;
  5231. text-align:right;
  5232. white-space:nowrap;
  5233. width:5em;
  5234. }
  5235. .{$this->moduleName}ViewList {
  5236. overflow:hidden;
  5237. margin:0em 0.5em;
  5238. text-align:right;
  5239. white-space:nowrap;
  5240. width:5em;
  5241. }
  5242. .{$this->moduleName}ViewThumbnail {
  5243. font-size:0.9em;
  5244. white-space:nowrap;
  5245. }
  5246. ";
  5247. return $css;
  5248. }
  5249. function getHeader() {
  5250. return "<div class='{$this->moduleName}HeaderViewList'><span id='{$this->moduleName}Header'>" . text("SIZE") . "</span></div>";
  5251. }
  5252. function getHtml($file, $id, $view) {
  5253. if ($view == "list") {$className = "{$this->moduleName}ViewList";}
  5254. else if ($view == "thumbnail") {$className = "{$this->moduleName}ViewThumbnail";}
  5255. if ($file->isDir) {
  5256. $filesize = "-";
  5257. $sortValue = -1;
  5258. } else {
  5259. $filesize = $this->getSizeString(filesize($file->absPath));
  5260. $sortValue = filesize($file->absPath);
  5261. }
  5262. $html =
  5263. "
  5264. <div class='$className' id='{$this->moduleName}_$id'>$filesize</div>
  5265. <div id='{$this->moduleName}SortValue_$id' style='display:none'>" . $sortValue . "</div>
  5266. ";
  5267. return $html;
  5268. }
  5269. function getHtmlParentDirectory($relPath, $view) {
  5270. $html = "<div class='{$this->moduleName}ViewList'></div>";
  5271. return $html;
  5272. }
  5273. function getJavascript() {
  5274. $javascript =
  5275. "
  5276. Sdl.$this->moduleName = {};
  5277. Sdl.$this->moduleName.Main = function() {
  5278. var this_clone = this;
  5279. this.sort = new Sdl.Sort();
  5280. this.sort.setDefaultOrder(1);
  5281. this.sort.attribute = '{$this->moduleName}SortValue';
  5282. this.sort.type = 'numeric';
  5283. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener()});
  5284. }
  5285. Sdl.$this->moduleName.Main.prototype = {
  5286. windowOnLoadListener : function() {
  5287. var div;
  5288. div = document.getElementById('{$this->moduleName}Header');
  5289. this.sort.setSortButton(div);
  5290. }
  5291. }
  5292. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5293. ";
  5294. return $javascript;
  5295. }
  5296. function getRss($file, $fileId) {
  5297. if ($file->isDir) {$filesize = "-";}
  5298. else {$filesize = $this->getSizeString(filesize($file->absPath));}
  5299. return "[" . text("FILE SIZE") . ": " . $filesize . "] ";
  5300. }
  5301. function getSizeString($filesize) {
  5302. $precision = 2;
  5303. if($filesize > 1024 * 1024 * 1024) {$filesize = round($filesize / (1024 * 1024 * 1024), $precision) . "G";}
  5304. else if($filesize > 1024 * 1024) {$filesize = round($filesize / (1024 * 1024), $precision) . "M";}
  5305. else if($filesize > 1024) {$filesize = round($filesize / (1024), $precision) . "K";}
  5306. else {$filesize = $filesize . "B";}
  5307. return $filesize;
  5308. }
  5309. }
  5310. ?>
  5311. <?php
  5312. //------------------------------------------------------------------------------
  5313. // Class name : ModuleFileType
  5314. //------------------------------------------------------------------------------
  5315. define("MODULEFILETYPE_ON" , true);
  5316. define("MODULEFILETYPE_ADMIN_MODE_ON" , true);
  5317. define("MODULEFILETYPE_USER_MODE_ON" , true);
  5318. class ModuleFileType extends Module {
  5319. var $enabled = MODULEFILETYPE_ON;
  5320. var $enabledAdminMode = MODULEFILETYPE_ADMIN_MODE_ON;
  5321. var $enabledUserMode = MODULEFILETYPE_USER_MODE_ON;
  5322. var $isAttribute = true;
  5323. var $moduleName = "ModuleFileType";
  5324. var $position = 15;
  5325. function getCss() {
  5326. $css =
  5327. "
  5328. .{$this->moduleName}HeaderViewList {
  5329. margin:0em 0.5em;
  5330. text-align:center;
  5331. white-space:nowrap;
  5332. width:3em;
  5333. }
  5334. .{$this->moduleName}ViewList {
  5335. height:1em;
  5336. line-height:1em;
  5337. margin:0em 0.5em;
  5338. text-align:center;
  5339. white-space:nowrap;
  5340. width:3em;
  5341. }
  5342. .{$this->moduleName}ViewThumbnail {
  5343. height:1em;
  5344. line-height:1em;
  5345. }
  5346. .{$this->moduleName}Icon {
  5347. height:1em;
  5348. }
  5349. ";
  5350. return $css;
  5351. }
  5352. function getHeader() {
  5353. return "<div class='{$this->moduleName}HeaderViewList'><span id='{$this->moduleName}Header'>" . text("TYPE") . "</span></div>";
  5354. }
  5355. function getHtml($file, $id, $view) {
  5356. if ($view == "list") {$className = "{$this->moduleName}ViewList";}
  5357. else if ($view == "thumbnail") {$className = "{$this->moduleName}ViewThumbnail";}
  5358. if ($file->isDir) {
  5359. $type = "<img alt='<" . text("DIR") . ">' class='{$this->moduleName}Icon' src='?print=icon&icon=dir'>";
  5360. //$type = htmlentities("<" . text("DIR") . ">");
  5361. $sortValue = htmlentities("<dir>") . $file->basename;
  5362. } else {
  5363. $type = "";
  5364. $sortValue = htmlentities("<file>") . $file->basename;
  5365. }
  5366. $html =
  5367. "
  5368. <div class='$className' id='{$this->moduleName}_$id'>$type</div>
  5369. <div id='{$this->moduleName}SortValue_$id' style='display:none'>" . $sortValue . "</div>
  5370. ";
  5371. return $html;
  5372. }
  5373. function getHtmlParentDirectory($relPath, $view) {
  5374. $html = "<div class='{$this->moduleName}ViewList'></div>";
  5375. return $html;
  5376. }
  5377. function getJavascript() {
  5378. $javascript =
  5379. "
  5380. Sdl.$this->moduleName = {};
  5381. Sdl.$this->moduleName.Main = function() {
  5382. var this_clone = this;
  5383. this.sort = new Sdl.Sort();
  5384. this.sort.setDefaultOrder(1);
  5385. this.sort.attribute = '{$this->moduleName}SortValue';
  5386. this.sort.type = 'literal';
  5387. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener()});
  5388. }
  5389. Sdl.$this->moduleName.Main.prototype = {
  5390. windowOnLoadListener : function() {
  5391. var div = document.getElementById('{$this->moduleName}Header');
  5392. this.sort.setSortButton(div);
  5393. }
  5394. }
  5395. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5396. ";
  5397. return $javascript;
  5398. }
  5399. function getRss($file, $fileId) {
  5400. if ($file->isDir) {$type = text("DIR");}
  5401. else {$type = "-";}
  5402. return "[" . text("FILE TYPE") . ": $type] ";
  5403. }
  5404. }
  5405. ?>
  5406. <?php
  5407. //------------------------------------------------------------------------------
  5408. // Class name : ModuleNavigator
  5409. //------------------------------------------------------------------------------
  5410. define("MODULENAVIGATOR_ON" , true);
  5411. define("MODULENAVIGATOR_ADMIN_MODE_ON" , true);
  5412. define("MODULENAVIGATOR_USER_MODE_ON" , true);
  5413. class ModuleNavigator extends Module {
  5414. var $enabled = MODULENAVIGATOR_ON;
  5415. var $enabledAdminMode = MODULENAVIGATOR_ADMIN_MODE_ON;
  5416. var $enabledUserMode = MODULENAVIGATOR_USER_MODE_ON;
  5417. var $isSideBox = true;
  5418. var $isSideBoxPositionTop = true;
  5419. var $moduleName = "ModuleNavigator";
  5420. var $position = 10;
  5421. function getHtml($cwdRelPath, $view) {
  5422. $cwdRelPath = Text::htmlentitiesUtf8($cwdRelPath);
  5423. $html =
  5424. "
  5425. <div style='margin:1.4em 0em;'><span id='$this->moduleName' style='font-size:2em; font-weight:bold; white-space:nowrap;'>/$cwdRelPath</span></div>
  5426. ";
  5427. return $html;
  5428. }
  5429. function getJavascript() {
  5430. $javascript =
  5431. "
  5432. Sdl.$this->moduleName = {};
  5433. Sdl.$this->moduleName.Main = function() {
  5434. var this_clone = this;
  5435. Sdl.browser.addOnLoadListener(function() {this_clone.browserOnLoadListener()});
  5436. };
  5437. Sdl.$this->moduleName.Main.prototype = {
  5438. browserOnLoadListener : function() {
  5439. var title;
  5440. title = document.getElementById('$this->moduleName');
  5441. title.textContent ? title.textContent = '/' + Sdl.browser.cwd.relPath : title.innerText = '/' + Sdl.browser.cwd.relPath;
  5442. }
  5443. }
  5444. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5445. ";
  5446. return $javascript;
  5447. }
  5448. }
  5449. ?>
  5450. <?php
  5451. //------------------------------------------------------------------------------
  5452. // Class name : ModuleOpen
  5453. //------------------------------------------------------------------------------
  5454. define("MODULEOPEN_ON" , true);
  5455. define("MODULEOPEN_ADMIN_MODE_ON" , true);
  5456. define("MODULEOPEN_USER_MODE_ON" , false);
  5457. class ModuleOpen extends Module {
  5458. var $enabled = MODULEOPEN_ON;
  5459. var $enabledAdminMode = MODULEOPEN_ADMIN_MODE_ON;
  5460. var $enabledUserMode = MODULEOPEN_USER_MODE_ON;
  5461. var $icons = array(
  5462. "open" => "R0lGODlhEAAQANUkAHBwcMXFxaioqJqamtHR0XNzc6SkpJeXl6CgoNXV1ZiYmHd3d8fHx6Kioo2NjZubm6GhoX9/f4qKipSUlKenp5CQkJOTk6Ojo3t7e6WlpZ2dnX19fZ+fn4SEhHJycn5+foWFhZ6entra2v///////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAACQALAAAAAAQABAAAAZmQJJwSCwaj0jSaMlMjgSUjAGCGB2fI1GCwAg8rEKmYGRAcAYKRWDCHIXe78vyAH8vRXg8SBjJ45cggYEDSwUAh4dtDSMHFRIdHxgBC01hGllbXR5gRSMWDiAbCwWcRm1LSamqq6pBADs=",
  5463. );
  5464. var $isFunction = true;
  5465. var $moduleName = "ModuleOpen";
  5466. var $position = 60;
  5467. var $requiredModules = array("ModuleSelector");
  5468. function getHtml() {
  5469. $html =
  5470. "
  5471. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  5472. <div id='{$this->moduleName}Open' onclick='Sdl.$this->moduleName.main.onClickOpen();' style='float:left' title='" . text("OPEN") . "'>
  5473. <img alt='[" . text("OPEN") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=open'>
  5474. </div>
  5475. </div>
  5476. ";
  5477. return $html;
  5478. }
  5479. function getJavascript() {
  5480. $javascript =
  5481. "
  5482. Sdl.$this->moduleName = {};
  5483. Sdl.$this->moduleName.Main = function() {
  5484. var this_clone = this;
  5485. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  5486. };
  5487. Sdl.$this->moduleName.Main.prototype = {
  5488. onClickOpen : function() {
  5489. var selectedFile;
  5490. selectedFile = Sdl.ModuleSelector.main.getSingleSelectedFileAndWarn();
  5491. if (selectedFile) {
  5492. this.open(selectedFile.id);
  5493. }
  5494. },
  5495. open : function(id) {
  5496. var url;
  5497. url = document.getElementById('systemUrl_' + id).innerHTML;
  5498. if (url == '') {alert('" . text("FILE IS NOT WITHIN DOCUMENT ROOT") . "');}
  5499. else {window.open(url);}
  5500. },
  5501. windowOnLoadListener : function() {
  5502. document.getElementById('$this->moduleName').style.display = 'block';
  5503. Sdl.Button.decorateById('{$this->moduleName}Open');
  5504. }
  5505. }
  5506. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5507. ";
  5508. return $javascript;
  5509. }
  5510. }
  5511. ?>
  5512. <?php
  5513. //------------------------------------------------------------------------------
  5514. // Class name : ModuleRead
  5515. //------------------------------------------------------------------------------
  5516. define("MODULEREAD_ON" , true);
  5517. define("MODULEREAD_ADMIN_MODE_ON" , true);
  5518. define("MODULEREAD_USER_MODE_ON" , false);
  5519. class ModuleRead extends Module {
  5520. var $enabled = MODULEREAD_ON;
  5521. var $enabledAdminMode = MODULEREAD_ADMIN_MODE_ON;
  5522. var $enabledUserMode = MODULEREAD_USER_MODE_ON;
  5523. var $icons = array(
  5524. "read" => "R0lGODlhEAAQAMQfAJrM+3OSsKfS++zx9uXt9Yis1FdwkZW51ElVa8fj/bba/NXb5PL2+o276b3d/VJhe7TR4ENLXNXn8KLD536kwIyzzJ/E2KjL3t7n7ykxQz5FVa/W/OLp8I+w1P///////yH5BAEAAB8ALAAAAAAQABAAAAWRoCeO5PidngRBl3VUVBwEHgpJxJDrRN8YNQ+EkCgWHUhG4ye6MBKdqLTDqD5ElifSoeh2N4yr5/CcTAtoQVhUeXoVm7hAjRBRylE0uiEg1D0UA1xwcnMABBF2gmZ6ewAciR4BgoRzAgCYGBoiAQxchZiYA5seBgsMPByqHBgDEBmcBrIPDwgIEREaGhliJb4kIQA7",
  5525. );
  5526. var $isFunction = true;
  5527. var $moduleName = "ModuleRead";
  5528. var $position = 90;
  5529. var $requiredModules = array("ModuleFilename");
  5530. function action() {
  5531. $relPath = $_POST["moduleParams"]["relPath"];
  5532. $file = $this->fileManager->getFileByRelPath($relPath);
  5533. $xml = new Xml();
  5534. if ($file) {
  5535. if ($file->isPermitted) {
  5536. if ($file->isDir) {
  5537. $content = text("DIRECTORY IS NOT ACCEPTED");
  5538. } else {
  5539. $content = file_get_contents($file->absPath);
  5540. if ($content === false) {$response = text("ACCESS DENIED");}
  5541. else {$content = $this->getPageHtml($content, $relPath);}
  5542. }
  5543. } else {
  5544. $content = text("ACCESS DENIED");
  5545. }
  5546. } else {
  5547. $content = text("ACCESS DENIED");
  5548. }
  5549. echo $content;
  5550. }
  5551. function getHtml() {
  5552. $html =
  5553. "
  5554. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9;'>
  5555. <div id='{$this->moduleName}Read' onclick='Sdl.$this->moduleName.main.onClickRead();' style='float:left' title='" . text("READ") . "'>
  5556. <img alt='[" . text("READ") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=read'>
  5557. </div>
  5558. </div>
  5559. ";
  5560. return $html;
  5561. }
  5562. function getPageHtml($content, $relPath) {
  5563. $content = Text::htmlentitiesUtf8($content);
  5564. $html = null;
  5565. $html =
  5566. "
  5567. <div>
  5568. <div>" . text("FILE") . " : /$relPath</div>
  5569. <div style='border:1px dotted #CCCCCC; padding:2px'><pre style='margin:0px'>$content</pre></div>
  5570. </div>
  5571. ";
  5572. return $html;
  5573. }
  5574. function getJavascript() {
  5575. $javascript =
  5576. "
  5577. Sdl.$this->moduleName = {};
  5578. Sdl.$this->moduleName.Read = function(){
  5579. var this_clone = this;
  5580. this.file = null;
  5581. this.page = null;
  5582. this.ajaxActionReadPass = function(xhr) {
  5583. this_clone.ajaxActionRead(xhr);
  5584. }
  5585. };
  5586. Sdl.$this->moduleName.Read.prototype = {
  5587. addPage : function() {
  5588. var content, tabContent;
  5589. this.page = new Sdl.Page();
  5590. content = document.createElement('div');
  5591. content.innerHTML = 'Loading...';
  5592. content.style.padding = '0px 5px';
  5593. //content.style.overflow = 'hidden';
  5594. this.page.content = content;
  5595. tabContent = document.createElement('div');
  5596. tabContent.innerHTML = 'Read:Loading';
  5597. this.page.tabContent = tabContent;
  5598. this.page.movableBar.setMoveTarget(this.page.content);
  5599. Sdl.pageManager.addPage(this.page);
  5600. },
  5601. ajaxActionRead : function(xhr) {
  5602. this.page.content.innerHTML = xhr.responseText;
  5603. this.page.tabContent.innerHTML = '<nobr>Read:' + this.file.filename + '</nobr>';
  5604. // Must set overflow:hidden after putting innerHTML because text cannot expand after setting overflow:hidden
  5605. this.page.content.style.overflow = 'hidden';
  5606. //this.page.content.style.top = this.page.content.clientHeight + 'px';
  5607. },
  5608. read : function() {
  5609. var param;
  5610. param = 'moduleParams[relPath]=' + this.file.relPath;
  5611. Sdl.Ajax.ajaxPost(this.ajaxActionReadPass, '?action=module&module=$this->moduleName', param);
  5612. }
  5613. }
  5614. Sdl.$this->moduleName.Main = function() {
  5615. var this_clone = this;
  5616. this.pages = [];
  5617. this.pageIdIndex = 0;
  5618. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  5619. }
  5620. Sdl.$this->moduleName.Main.prototype = {
  5621. onClickRead : function() {
  5622. var newFilename, oldFilename, selectedFile;
  5623. selectedFile = Sdl.ModuleSelector.main.getSingleSelectedFileAndWarn();
  5624. if (selectedFile) {
  5625. var read = new Sdl.$this->moduleName.Read;
  5626. read.file = selectedFile;
  5627. read.addPage();
  5628. read.read();
  5629. }
  5630. },
  5631. windowOnLoadListener : function() {
  5632. document.getElementById('$this->moduleName').style.display = 'block';
  5633. Sdl.Button.decorateById('{$this->moduleName}Read');
  5634. }
  5635. }
  5636. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5637. ";
  5638. return $javascript;
  5639. }
  5640. }
  5641. ?>
  5642. <?php
  5643. //------------------------------------------------------------------------------
  5644. // Class name : ModuleRename
  5645. //------------------------------------------------------------------------------
  5646. define("MODULERENAME" , true);
  5647. define("MODULERENAME_ADMIN_MODE_ON" , true);
  5648. define("MODULERENAME_USER_MODE_ON" , false);
  5649. define("MODULERENAME_FTP_LAYER_ON" , true);
  5650. class ModuleRename extends Module {
  5651. var $enabled = MODULERENAME;
  5652. var $enabledAdminMode = MODULERENAME_ADMIN_MODE_ON;
  5653. var $enabledUserMode = MODULERENAME_USER_MODE_ON;
  5654. var $icons = array(
  5655. "rename" => "R0lGODlhEAAQAOZ/ALHW+a7V+rXa/VJjgHSWs95hZPb5+oOqxdJud3mdubrc/YyzzO32/uzx98bj/pa8077e/Z/E2Ovy+ajL3vH0+erx9+Xt9uXs88nk/sjj/sDf/Vt6np/P++JLSPT3+/P2+fL1+FlujN7n773d/a7T5SkxQ0xZcUlUaeZCPeVNS05eeT1EVUJLXanT++o5Mv7+/qvU+8rl/sLg/aTR+8Th/cbi/XqPq+Pq8eTv9dOKl6bQ+tt4fo7B8avQ9ejv9Z3F75TB71Fhfn2hvEFIV+Hp8OPs9+Tr9aDK87zB3UVPYbTR8bja/cy2yrzZ+L6Po8xrdsXW8XyjwJe951BpjLDS4+Tq+LDX/NxdYMvN5Iq971VohdXb5LLY/O7w8q3C47y81qzH6IOz48vM0fH0+8qPn6LQ+5LI+5bK+5fM/82fsLjJ5+fv99KWpFlgbmeHp2+Or9Fyfe/x9OJXV6/Q4tfn8MyqvafS+5vN+6nK7K3I6UBHV8KfskVQY9Pn8P///////yH5BAEAAH8ALAAAAAAQABAAAAfqgC9+g4SFg3+Ifn0kcxMRDwsHQgkEbn6JJHQ4FWsSDRagRTwbl35UPhkxGDU0GhoQDFlhIYMTHqoZWEwaIwoMDB9agxEGGA4OOwVNCksCXCBBgw8eNTVQKS5fAgJWASAqgwtjNDJsaR0IAFYwLSAmgwcUMhpyamQoXi12M0Yng1ENNNRJcaUACic6ynCokmRQggYjCiDJgwdBhyMc7hBhMYhAgxwu9gSAAcfFEzRnROgZ9MaAAiVgerSY8UMKEDNxVgzasOVDhQtAbxAhIqKLmBKDbEwJoWWAChMn+LAYsqJEGz+CDGkd9CIQADs=",
  5656. );
  5657. var $isFunction = true;
  5658. var $moduleName = "ModuleRename";
  5659. var $position = 10;
  5660. var $requiredModules = array("ModuleSelector");
  5661. var $ftpLayerOn = MODULERENAME_FTP_LAYER_ON;
  5662. function action() {
  5663. $oldRelPath = $_POST["moduleParams"]["oldRelPath"];
  5664. $newFilename = $_POST["moduleParams"]["newFilename"];
  5665. $oldFile = $this->fileManager->getFileByRelPath($oldRelPath);
  5666. $xml = new Xml();
  5667. if ($oldFile) {
  5668. if ($oldFile->isPermitted) {
  5669. $newAbsPath = $oldFile->dirAbsPath . $newFilename;
  5670. if (file_exists($newAbsPath)) {
  5671. $xml->setError(text("FILE WITH SAME NAME EXIST"));
  5672. } else {
  5673. if ($this->sysRename($oldFile->absPath, $newAbsPath)) {
  5674. $xml->setStatusSuccess();
  5675. $xml->setMessage("$oldFile->basename " . text("HAS BEEN SUCCESSFULLY RENAMED TO") . " $newFilename .");
  5676. } else {
  5677. $xml->setError(text("ACCESS DENIED"));
  5678. }
  5679. }
  5680. } else {
  5681. $xml->setError(text("ACCESS DENIED"));
  5682. }
  5683. } else {
  5684. $xml->setError(text("ACCESS DENIED"));
  5685. }
  5686. $xml->dump();
  5687. }
  5688. function getHtml() {
  5689. $html =
  5690. "
  5691. <div id='$this->moduleName' style='display:none; float:left; line-height:0.9' title='" . text("RENAME") . "'>
  5692. <div id='{$this->moduleName}Rename' onclick='Sdl.$this->moduleName.main.onClickRename();' style='float:left'>
  5693. <img alt='[" . text("RENAME") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=rename'>
  5694. </div>
  5695. </div>";
  5696. return $html;
  5697. }
  5698. function getJavascript() {
  5699. $javascript =
  5700. "
  5701. Sdl.$this->moduleName = {};
  5702. Sdl.$this->moduleName.Main = function() {
  5703. var this_clone = this;
  5704. this.ajaxActionRename = function(xhr) {
  5705. var response;
  5706. response = Sdl.Xml.digestResponseXml(xhr);
  5707. if (Sdl.Xml.validateResponseAndWarn(response)) {Sdl.Xml.alertResponse(response);}
  5708. },
  5709. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  5710. }
  5711. Sdl.$this->moduleName.Main.prototype = {
  5712. onClickRename : function() {
  5713. var selectedFile, oldRelPath, newFilename;
  5714. selectedFile = Sdl.ModuleSelector.main.getSingleSelectedFileAndWarn();
  5715. if (selectedFile) {
  5716. oldRelPath = selectedFile.relPath;
  5717. newFilename = prompt('" . text("PLEASE ENTER A NEW FILENAME") . "', selectedFile.filename);
  5718. if (newFilename != '' && newFilename != null) {this.renameFile(oldRelPath, newFilename);}
  5719. }
  5720. },
  5721. renameFile : function(oldRelPath, newFilename) {
  5722. var param;
  5723. param = 'moduleParams[oldRelPath]=' + oldRelPath + '&' +
  5724. 'moduleParams[newFilename]=' + newFilename;
  5725. Sdl.Ajax.ajaxPost(this.ajaxActionRename, '?action=module&module=$this->moduleName', param);
  5726. },
  5727. windowOnLoadListener : function() {
  5728. document.getElementById('$this->moduleName').style.display = 'block';
  5729. Sdl.Button.decorateById('{$this->moduleName}Rename');
  5730. }
  5731. }
  5732. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5733. ";
  5734. return $javascript;
  5735. }
  5736. }
  5737. ?>
  5738. <?php
  5739. //------------------------------------------------------------------------------
  5740. // Class name : ModuleSelector
  5741. //------------------------------------------------------------------------------
  5742. define("MODULESELECTOR_ON" , true);
  5743. define("MODULESELECTOR_ADMIN_MODE_ON" , true);
  5744. define("MODULESELECTOR_USER_MODE_ON" , true);
  5745. define("MODULESELECTOR_DISABLED_IF_NOT_REQUIRED" , true);
  5746. define("MODULESELECTOR_FILE_TYPE" , 1); //1=files/dirs, 2=regular files only, 3=dirs only
  5747. class ModuleSelector extends Module {
  5748. var $disabledIfNotRequired = MODULESELECTOR_DISABLED_IF_NOT_REQUIRED;
  5749. var $enabled = MODULESELECTOR_ON;
  5750. var $enabledAdminMode = MODULESELECTOR_ADMIN_MODE_ON;
  5751. var $enabledUserMode = MODULESELECTOR_USER_MODE_ON;
  5752. var $isAttribute = true;
  5753. var $moduleName = "ModuleSelector";
  5754. var $position = 0;
  5755. function getCss() {
  5756. // Checkbox is about the same in FF2 and IE7.
  5757. // In Safari 3 beta, checkbox is aligned a bit bottom
  5758. // In Opera 9.21, checkbox is large. It's about 16px minimum.
  5759. $css =
  5760. "
  5761. .{$this->moduleName}FileFocus {
  5762. background-color:#E2ECED;
  5763. }
  5764. .{$this->moduleName}HeaderViewList {
  5765. margin:0em 0.1em;
  5766. overflow:hidden;
  5767. text-align:center;
  5768. width:1.6em;
  5769. }
  5770. .{$this->moduleName}ViewList {
  5771. margin:0em 0.1em;
  5772. overflow:hidden;
  5773. text-align:center;
  5774. width:1.6em;
  5775. }
  5776. .{$this->moduleName}ViewThumbnail {
  5777. }
  5778. .{$this->moduleName}CheckBox {
  5779. height:1.05em;
  5780. margin:0px;
  5781. vertical-align:middle;
  5782. }
  5783. .{$this->moduleName}browserFilesDiv {
  5784. cursor:pointer;
  5785. }
  5786. ";
  5787. return $css;
  5788. }
  5789. function getHeader() {
  5790. return "<div id='{$this->moduleName}Header' class='{$this->moduleName}HeaderViewList' style='display:none'><input class='{$this->moduleName}CheckBox' id='{$this->moduleName}SelectorAll' onclick='Sdl.$this->moduleName.main.onClickAllSelectors(event);' type='checkbox'/></div>";
  5791. }
  5792. function getHtml($file, $id, $view, $isJavascript) {
  5793. if ($isJavascript) {
  5794. if ($view == "list") {$className = "{$this->moduleName}ViewList";}
  5795. else if ($view == "thumbnail") {$className = "{$this->moduleName}ViewThumbnail";}
  5796. $html = "<div class='$className' id='{$this->moduleName}_$id'><input class='{$this->moduleName}CheckBox' onclick='Sdl.$this->moduleName.main.onClickSelector(event, \"$id\");' type='checkbox'/></div>";
  5797. return $html;
  5798. } else {
  5799. return "";
  5800. }
  5801. }
  5802. function getHtmlParentDirectory() {
  5803. $html = "<div class='{$this->moduleName}ViewList' id='{$this->moduleName}_..'>&nbsp;</div>";
  5804. return $html;
  5805. }
  5806. function getJavascript() {
  5807. $javascript =
  5808. "
  5809. Sdl.$this->moduleName = {};
  5810. Sdl.$this->moduleName.Main = function() {
  5811. var this_clone = this;
  5812. this.fileType = " . MODULESELECTOR_FILE_TYPE . "; //1=files/dirs, 2=files only, 3=dirs only
  5813. this.selectedFileIds = [];
  5814. this.modifyFilesPass = function(file) {
  5815. this_clone.modifyFiles(file);
  5816. }
  5817. Sdl.browser.addOnLoadListener(function() {this_clone.browserOnLoadListener()});
  5818. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener()});
  5819. }
  5820. Sdl.$this->moduleName.Main.prototype = {
  5821. browserOnLoadListener : function() {
  5822. Sdl.browser.traverseAllFiles(this.modifyFilesPass);
  5823. var sa = document.getElementById('{$this->moduleName}SelectorAll');
  5824. sa.checked = false;
  5825. this.selectedFileIds = [];
  5826. },
  5827. countSelectedFiles : function() {
  5828. var num = 0, this_clone_tmp = this;
  5829. Sdl.browser.traverseAllFiles(function(file) {
  5830. if (this_clone_tmp.isFileSelected(file.id)) {num++;}
  5831. });
  5832. return num;
  5833. },
  5834. deselectAllFiles : function() {
  5835. var this_clone_tmp = this;
  5836. Sdl.browser.traverseAllFiles(function(file) {
  5837. if (this_clone_tmp.isFileSelected(file.id)) {this_clone_tmp.deselectFile(file.id);}
  5838. });
  5839. },
  5840. deselectSelectedFiles : function() {
  5841. var len;
  5842. len = this.selectedFileIds.length;
  5843. for(var i = len-1 ; i >=0 ; i--) {
  5844. var a, t;
  5845. t = document.getElementById(this.selectedFileIds[i]);
  5846. Sdl.Object.modifyClassName(t, null, '{$this->moduleName}FileFocus');
  5847. a = document.getElementById('browserFiles');
  5848. t.getElementsByTagName('input').item(0).checked = false;
  5849. }
  5850. this.selectedFileIds = [];
  5851. },
  5852. deselectFile : function(fileId) {
  5853. var a, len, t;
  5854. t = document.getElementById(fileId);
  5855. Sdl.Object.modifyClassName(t, null, '{$this->moduleName}FileFocus');
  5856. a = document.getElementById('browserFiles');
  5857. t.getElementsByTagName('input').item(0).checked = false;
  5858. len = this.selectedFileIds.length;
  5859. for(var i = 0 ; i < len ; i++) {
  5860. if(fileId == this.selectedFileIds[i]) {
  5861. this.selectedFileIds.splice(i, 1);
  5862. break;
  5863. }
  5864. }
  5865. },
  5866. getSelectedFiles : function() {
  5867. var selectedFiles = [], this_clone_tmp = this;
  5868. Sdl.browser.traverseAllFiles(function(file) {
  5869. if (this_clone_tmp.isFileSelected(file.id)) {
  5870. var detail = {};
  5871. detail.id = file.id;
  5872. detail.relPath = document.getElementById('systemRelPath_' + file.id).innerHTML;
  5873. detail.filename = document.getElementById('systemFilename_' + file.id).innerHTML;
  5874. detail.isDir = document.getElementById('systemIsDir_' + file.id).innerHTML;
  5875. selectedFiles.push(detail);
  5876. }
  5877. });
  5878. return selectedFiles;
  5879. },
  5880. getSelectedFilesAndWarn : function() {
  5881. var selectedFiles;
  5882. selectedFiles = this.getSelectedFiles();
  5883. if (selectedFiles.length < 1) {
  5884. alert('" . text("PLEASE SELECT FILES") . "');
  5885. return false;
  5886. } else {
  5887. return selectedFiles;
  5888. }
  5889. },
  5890. getSingleSelectedFileAndWarn : function() {
  5891. var selectedFiles;
  5892. selectedFiles = this.getSelectedFiles();
  5893. if (selectedFiles.length > 1) {alert('" . text("PLEASE SELECT ONE FILE ONLY") . "');}
  5894. else if (selectedFiles.length == 1) {return selectedFiles[0];}
  5895. else {alert('" . text("PLEASE SELECT A FILE") . "');}
  5896. return false;
  5897. },
  5898. isFileSelected : function(fileId) {
  5899. return document.getElementById(fileId).getElementsByTagName('input').item(0).checked;
  5900. },
  5901. modifyFiles : function(file) {
  5902. if (Sdl.browser.status.success) {
  5903. var this_clone_tmp = this;
  5904. var isDir = document.getElementById('systemIsDir_' + file.id).innerHTML; // For additional file/dir type function
  5905. if ((this.fileType == 1) || (this.fileType == 2 && !isDir) || (this.fileType == 3 && isDir)) { // For additional file/dir type function
  5906. var File = function() {
  5907. var fileId;
  5908. this.setFileId = function(id) {
  5909. fileId = id;
  5910. }
  5911. this.fileOnClick = function(e) {
  5912. e = e || event;
  5913. if (e.ctrlKey) {
  5914. if (this_clone_tmp.isFileSelected(fileId)) {this_clone_tmp.deselectFile(fileId);}
  5915. else {this_clone_tmp.selectFile(fileId);}
  5916. } else {
  5917. if (this_clone_tmp.isFileSelected(fileId)) {
  5918. if (this_clone_tmp.countSelectedFiles() > 1) {
  5919. this_clone_tmp.deselectSelectedFiles();
  5920. this_clone_tmp.selectFile(fileId);
  5921. } else {
  5922. this_clone_tmp.deselectSelectedFiles();
  5923. }
  5924. } else {
  5925. this_clone_tmp.deselectSelectedFiles();
  5926. this_clone_tmp.selectFile(fileId);
  5927. }
  5928. }
  5929. }
  5930. }
  5931. var fileObj = new File();
  5932. fileObj.setFileId(file.id);
  5933. file.onclick = fileObj.fileOnClick;
  5934. } else {
  5935. var checkbox = document.getElementById('{$this->moduleName}_' + file.id); // For additional file/dir type function
  5936. checkbox.style.visibility = 'hidden'; // For additional file/dir type function
  5937. }
  5938. }
  5939. },
  5940. onClickAllSelectors : function(e) {
  5941. var checkbox;
  5942. e = e || event;
  5943. checkbox = e.target || e.srcElement;
  5944. if (checkbox.checked) {this.selectAllFiles();}
  5945. else {this.deselectAllFiles();}
  5946. Sdl.Event.stopPropagation(e);
  5947. },
  5948. onClickSelector : function(e, fileId) {
  5949. var checkbox;
  5950. e = e || event;
  5951. checkbox = e.target || e.srcElement;
  5952. if (checkbox.checked) {this.selectFile(fileId);}
  5953. else {this.deselectFile(fileId);}
  5954. Sdl.Event.stopPropagation(e);
  5955. },
  5956. selectAllFiles : function() {
  5957. var this_clone_tmp = this;
  5958. Sdl.browser.traverseAllFiles(function(file) {
  5959. this_clone_tmp.selectFile(file.id);
  5960. });
  5961. },
  5962. selectFile : function(fileId) {
  5963. var i, s, t;
  5964. t = document.getElementById(fileId);
  5965. Sdl.Object.modifyClassName(t, '{$this->moduleName}FileFocus', null);
  5966. s = document.getElementById('{$this->moduleName}_' + t.id);
  5967. i = s.getElementsByTagName('input');
  5968. i[0].checked = true;
  5969. this.selectedFileIds.push(fileId);
  5970. },
  5971. windowOnLoadListener : function() {
  5972. Sdl.Object.modifyClassName(document.getElementById('browserFilesDiv'), '{$this->moduleName}browserFilesDiv', null);
  5973. document.getElementById('{$this->moduleName}Header').style.display = 'block';
  5974. document.getElementById('{$this->moduleName}_..').style.display = 'block';
  5975. Sdl.Event.disableSelection(document.getElementById('browserDirListing'));
  5976. // For additional file/dir type function
  5977. var sa = document.getElementById('{$this->moduleName}SelectorAll');
  5978. if (this.fileType == 2 || this.fileType == 3) {
  5979. sa.style.visibility = 'hidden';
  5980. }
  5981. }
  5982. }
  5983. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  5984. ";
  5985. return $javascript;
  5986. }
  5987. }
  5988. ?>
  5989. <?php
  5990. //------------------------------------------------------------------------------
  5991. // Class name : ModuleServerSignature
  5992. //------------------------------------------------------------------------------
  5993. define("MODULESERVERSIGNATURE_ON" , true);
  5994. define("MODULESERVERSIGNATURE_ADMIN_MODE_ON" , true);
  5995. define("MODULESERVERSIGNATURE_USER_MODE_ON" , true);
  5996. class ModuleServerSignature extends Module {
  5997. var $enabled = MODULESERVERSIGNATURE_ON;
  5998. var $enabledAdminMode = MODULESERVERSIGNATURE_ADMIN_MODE_ON;
  5999. var $enabledUserMode = MODULESERVERSIGNATURE_USER_MODE_ON;
  6000. var $isSideBox = true;
  6001. var $isSideBoxPositionBottom = true;
  6002. var $moduleName = "ModuleServerSignature";
  6003. var $position = 10;
  6004. function getHtml($cwdRelPath, $view) {
  6005. $html =
  6006. "
  6007. <div id='$this->moduleName'><address><span style='font-size:0.8em'>" . $_SERVER["SERVER_SIGNATURE"] . "</span></address></div>
  6008. ";
  6009. return $html;
  6010. }
  6011. }
  6012. ?>
  6013. <?php
  6014. //------------------------------------------------------------------------------
  6015. // Class name : ModuleUpload
  6016. //------------------------------------------------------------------------------
  6017. define("MODULEUPLOAD_ON" , true);
  6018. define("MODULEUPLOAD_ADMIN_MODE_ON" , true);
  6019. define("MODULEUPLOAD_USER_MODE_ON" , false);
  6020. define("MODULEUPLOAD_FTP_LAYER_ON" , true);
  6021. define("MODULEUPLOAD_FILE_SIZE_LIMIT" , 100 * 1024 * 1024); // in byte; for HTML form only
  6022. class ModuleUpload extends Module {
  6023. var $enablde = MODULEUPLOAD_ON;
  6024. var $enabledAdminMode = MODULEUPLOAD_ADMIN_MODE_ON;
  6025. var $enabledUserMode = MODULEUPLOAD_USER_MODE_ON;
  6026. var $icons = array(
  6027. "upload" => "R0lGODlhEAAQAMQfAJLNW3aXtJnM/OTs9YivyMfj/ldwkabS+73d/UpXbdXb5PP2+dHn+uv1/uvx9mGNRIm77LXZ/H6xW1Jhe6/S5ERNX5rA1qjL3uLw/t7o8CkxQz9GVsvM0WOPRf///////yH5BAEAAB8ALAAAAAAQABAAAAWYoCeO5PidHkNRl2URRCAHHkplg6M7Qz9AhpqH4igYjYhkAwIUXRbHwuOhbCwmIgvU2JFIHpHwNbvtAM4A8GHsIUA78DO8s06I3IhGwyzpYDAHA3YeAQ1JCHwPBwcCAxUiAQ5JEXN0AgIZj4SSYQyeBZeYG5ALCGGLi6EOox4GCgs8PhmzDhwakAa5ExMJCRUVGxsaWCXFJSEAOw==",
  6028. );
  6029. var $isFunction = true;
  6030. var $moduleName = "ModuleUpload";
  6031. var $position = 100;
  6032. var $ftpLayerOn = MODULEUPLOAD_FTP_LAYER_ON;
  6033. // edited in 2.1;
  6034. function action() {
  6035. $xml = new Xml();
  6036. if ($_GET["moduleParams"]["action"] === "upload") {
  6037. $cwdRelPath = $_GET["moduleParams"]["cwdRelPath"];
  6038. $cwd = $this->fileManager->getFileByRelPath($cwdRelPath);
  6039. if ($cwd) {
  6040. if ($cwd->isPermitted) {
  6041. if ($_FILES["file"]["size"] == 0) {
  6042. $content = text("ERROR");
  6043. } else {
  6044. if ( $_FILES["file"]["size"] > MODULEUPLOAD_FILE_SIZE_LIMIT) {
  6045. $content = text("FILE SIZE EXCEEDS LIMIT");
  6046. } else {
  6047. $absPath = $cwd->absPath . $_FILES["file"]["name"];
  6048. if (file_exists($absPath)) {
  6049. $content = text("FILE WITH SAME NAME EXISTS");
  6050. } else {
  6051. if ($this->sysMoveUploadedFile($_FILES["file"]["tmp_name"], $absPath)) {$content = text("SUCCESSFULLY UPLOADED TO") . " /" . $cwdRelPath;}
  6052. else {$content = text("ACCESS DENIED");}
  6053. }
  6054. }
  6055. }
  6056. } else {
  6057. $content = text("ACCESS DENIED");
  6058. }
  6059. } else {
  6060. $content = text("ACCESS DENIED");
  6061. }
  6062. echo "<html><body style='border:0px; margin:0.1em'><span style='white-space:nowrap'>$content</span></body></html>";
  6063. exit(0);
  6064. } else if ($_GET["moduleParams"]["action"] === "printPage") {
  6065. $cwdRelPath = $_POST["moduleParams"]["cwdRelPath"];
  6066. $cwdAbsPath = $this->fileManager->relPathToAbsPath($cwdRelPath);
  6067. if ($cwdAbsPath) {
  6068. if (is_dir($cwdAbsPath)) {
  6069. // writable for others or using ftp layer
  6070. if (is_writable($cwdAbsPath) || $this->fileManager->user->ftp) {
  6071. $xml->setStatusSuccess();
  6072. $xml->setContent($this->getPageHtml($cwdRelPath, $_POST["moduleParams"]["pageId"]));
  6073. } else {
  6074. $xml->setError(text("ACCESS DENIED"));
  6075. }
  6076. } else {
  6077. $xml->setError(text("ACCESS DENIED"));
  6078. }
  6079. } else {
  6080. $xml->setError(text("ACCESS DENIED"));
  6081. }
  6082. echo $response;
  6083. } else if ($_GET["moduleParams"]["action"] === "printUploadFrame") {
  6084. $cwdRelPath = $_GET["moduleParams"]["cwdRelPath"];
  6085. echo $this->getUploadFrame($cwdRelPath);
  6086. return;
  6087. } else {
  6088. $xml->setError(text("ACCESS DENIED"));
  6089. }
  6090. $xml->dump();
  6091. }
  6092. function getCss() {
  6093. //overflow:hidden is for Safari 3 beta as its html page inside a frame is long
  6094. $css =
  6095. "
  6096. .{$this->moduleName}UploadFrame {
  6097. border:0px dotted black;
  6098. height:3em;
  6099. overflow:auto;
  6100. padding:0.2em;
  6101. width:35em;
  6102. }
  6103. ";
  6104. return $css;
  6105. }
  6106. function getUploadFrame($cwdRelPath) {
  6107. $html = null;
  6108. $html =
  6109. "
  6110. <html>
  6111. <body style='border:0px; margin:0em; overflow:hidden'>
  6112. <form action='?action=module&module=$this->moduleName&moduleParams[action]=upload&moduleParams[cwdRelPath]=$cwdRelPath' method='post' name='form' enctype='multipart/form-data'>
  6113. <input type='hidden' name='MAX_FILE_SIZE' value='" . MODULEUPLOAD_FILE_SIZE_LIMIT . "'>
  6114. <nobr><input name='file' type='file' size='50'><input name='upload' value='" . text("UPLOAD") . "' type='submit'></nobr>
  6115. </form>
  6116. </body>
  6117. </html>
  6118. ";
  6119. return $html;
  6120. }
  6121. function getPageHtml($cwdRelPath, $pageId) {
  6122. $content = htmlentities($content);
  6123. $iniMaxUpload = ini_get(upload_max_filesize);
  6124. $iniMaxPost = ini_get(post_max_size);
  6125. $maxUploadSize = $iniMaxUpload < $iniMaxPost ? $iniMaxUpload : $iniMaxPost;
  6126. $html = null;
  6127. $html =
  6128. "
  6129. <div>
  6130. <div>" . text("UPLOAD TO DIRECTORY") . " : /$cwdRelPath<br>Max file size : $maxUploadSize</div>
  6131. <div><input id='{$this->moduleName}AddUploadFrame_{$pageId}' type='button' value='Add'></div>
  6132. <div style='min-height:10em; overflow:auto' id='{$this->moduleName}UploadFrameContainer_{$pageId}'></div>
  6133. </div>
  6134. ";
  6135. return $html;
  6136. }
  6137. function getHtml() {
  6138. $html =
  6139. "
  6140. <div id='{$this->moduleName}' style='display:none; float:left; line-height:0.9;'>
  6141. <div id='{$this->moduleName}Upload' onclick='Sdl.$this->moduleName.main.onClick();' style='float:left' title='" . text("UPLOAD") . "'>
  6142. <img alt='[" . text("UPLOAD") . "]' src='?print=icon&module=$this->moduleName&moduleParams[icon]=upload'>
  6143. </div>
  6144. </div>";
  6145. return $html;
  6146. }
  6147. function getJavascript() {
  6148. $javascript =
  6149. "
  6150. Sdl.$this->moduleName = {};
  6151. Sdl.$this->moduleName.Upload = function() {
  6152. var this_clone = this;
  6153. this.file = null;
  6154. this.pageId = null;
  6155. this.cwd = null;
  6156. this.ajaxActionPrintPage = function(xhr) {
  6157. var response;
  6158. response = Sdl.Xml.digestResponseXml(xhr);
  6159. if (Sdl.Xml.validateResponseAndWarn(response)) {
  6160. Sdl.Xml.alertResponse(response);
  6161. if (response.status.success) {this_clone.addPage(response.content);}
  6162. }
  6163. }
  6164. this.onClickAddUploadFrame = function() {
  6165. this_clone.addUploadFrame();
  6166. }
  6167. }
  6168. Sdl.$this->moduleName.Upload.prototype = {
  6169. addUploadFrame : function() {
  6170. var container, div;
  6171. div = document.createElement('div');
  6172. div.innerHTML = '<iframe class=\'{$this->moduleName}UploadFrame\' src=\'?action=module&module=$this->moduleName&moduleParams[action]=printUploadFrame&moduleParams[cwdRelPath]=' + this.cwd.relPath + '\'></iframe>';
  6173. container = document.getElementById('{$this->moduleName}UploadFrameContainer_' + this.pageId);
  6174. container.insertBefore(div, container.childNodes[0] ? container.childNodes[0] : null);
  6175. },
  6176. addPage : function(innerHTML) {
  6177. var add, content, tabContent;
  6178. this.page = new Sdl.Page();
  6179. content = document.createElement('div');
  6180. content.innerHTML = innerHTML;
  6181. this.page.content = content;
  6182. tabContent = document.createElement('div');
  6183. tabContent.innerHTML = 'Upload';
  6184. this.page.tabContent = tabContent;
  6185. this.page.movableBar.isDefaultLocked = false;
  6186. Sdl.pageManager.addPage(this.page);
  6187. // Must add movable bar after add page because the moveTarget has not been rendered before adding page to DOM
  6188. this.page.movableBar.setMoveTarget(document.getElementById('{$this->moduleName}UploadFrameContainer_' + this.pageId));
  6189. add = document.getElementById('{$this->moduleName}AddUploadFrame_' + this.pageId);
  6190. add.onclick = this.onClickAddUploadFrame;
  6191. this.addUploadFrame();
  6192. },
  6193. printPage : function() {
  6194. var param;
  6195. param = 'moduleParams[cwdRelPath]=' + this.cwd.relPath + '&' +
  6196. 'moduleParams[pageId]=' + this.pageId;
  6197. Sdl.Ajax.ajaxPost(this.ajaxActionPrintPage, '?action=module&module=$this->moduleName&moduleParams[action]=printPage', param);
  6198. }
  6199. }
  6200. Sdl.$this->moduleName.Main = function() {
  6201. var this_clone = this;
  6202. this.pages = [];
  6203. this.pageIdIndex = 0;
  6204. Sdl.Event.addWindowOnLoadListener(function() {this_clone.windowOnLoadListener();});
  6205. };
  6206. Sdl.$this->moduleName.Main.prototype = {
  6207. onClick : function() {
  6208. var upload;
  6209. upload = new Sdl.$this->moduleName.Upload;
  6210. upload.cwd = Sdl.browser.cwd;
  6211. upload.pageId = this.pageIdIndex++;
  6212. upload.printPage();
  6213. },
  6214. windowOnLoadListener : function() {
  6215. document.getElementById('$this->moduleName').style.display = 'block';
  6216. Sdl.Button.decorateById('{$this->moduleName}Upload');
  6217. }
  6218. }
  6219. Sdl.$this->moduleName.main = new Sdl.$this->moduleName.Main();
  6220. ";
  6221. return $javascript;
  6222. }
  6223. }
  6224. ?>
  6225. <?php
  6226. if (DEBUG_ERROR_REPORTING_LEVEL !== null)
  6227. error_reporting(DEBUG_ERROR_REPORTING_LEVEL);
  6228. $locale = new Locale();
  6229. $locale->setLocale();
  6230. function text($str, $replace = null, $firstCap = false) {
  6231. global $locale;
  6232. return $locale->text($str, $replace, $firstCap);
  6233. }
  6234. $instance = new SimpleDirectoryListing();
  6235. ?>