log)) $io->log->addMessage ($class_name . ' not found', 'autoload'); eval ('class ' . $class_name . '{ public $is_phantom = true; }'); } // not found else { // not found if (isset ($io->log)) $io->log->addMessage ($class_name . ' not found', 'autoload'); eval ('class ' . $class_name . ' extends eclClass_' . strtolower( substr ($prefix, 3)) . '{ public $is_phantom = true; }'); } // not found return; } // do not include external scripts $ob_length = ob_get_length(); if (is_file (FOLDER_ENGINE . $prefix . '/' . $class_name . '.php')) include FOLDER_ENGINE . $prefix . '/' . $class_name . '.php'; elseif (count ($parts) >= 3 and is_file (FOLDER_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php')) include FOLDER_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php'; elseif (is_file (FOLDER_LIBRARY . $component . '/' . $class_name . '.php')) include FOLDER_LIBRARY . $component . '/' . $class_name . '.php'; elseif (count ($parts) == 4 and is_file (FOLDER_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php')) include FOLDER_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php'; elseif ($prefix == $class_name or $prefix == 'eclClass') { // not found if (isset ($io->log)) $io->log->addMessage ($class_name . ' not found', 'autoload'); eval ('class ' . $class_name . '{ public $is_phantom = true; }'); } // not found else { // not found if (isset ($io->log)) $io->log->addMessage ($class_name . ' not found', 'autoload'); eval ('class ' . $class_name . ' extends eclClass_' . strtolower( substr ($prefix, 3)) . '{ public $is_phantom = true; }'); } // not found if (ob_get_length() > $ob_length) print 'vazamento de caracteres em ' . $class_name . '
'; } // magic autoload function print_a ($array) { print nl2br (str_replace (array ('&', '"', '<'), array ('&', '"', '<'), eclIo_file::array2string ($array))); } $systemMap = array(); $groupsMap = array(); /* The packager will look for the lines starting with "!". Do not change these lines! */ //!packager:start_of_files //!start_of_packager_settings define('SYSTEM_IS_PACKED', true); //!end_of_packager_settings //!packager:start_of_map $systemMap = array ( 'admin' => array('admin_index', 'adminAlert', 'adminUser', 'adminDomain', 'adminSystem', 'adminDatabase', 'adminMail', 'adminTools', 'domainStylesheet', 'system_embeded', 'dialog', 'admin_default'), 'adminAlert' => array('adminAlert_log', 'adminAlert_userSurvey', 'adminReport'), 'dialog' => array('dialog_media', 'dialog_mediaUpload', 'dialog_simple', 'dialogDetails', 'dialogFields', 'dialogLink', 'dialogList', 'dialogModule', 'dialogTemplate', 'modBanner', 'modLayout', 'modList', 'modTable', 'modTable_new'), 'domain' => array('domainIndex', 'section', 'section_create', 'dialog', 'tool', 'domainSubscription', 'domain_files', 'domainStylesheet', 'domainGlossary', 'domainRecents', 'domainSearch', 'domainAbout', 'userJoin', 'domainDefault'), 'section_create' => array('sectionFolder_create', 'sectionBlog_create', 'sectionCategories_create', 'sectionSearch_create', 'sectionAbout_create', 'sectionHistoric_create', 'sectionBranch_create', 'sectionMission_create', 'sectionStatute_create', 'sectionTeam_create', 'sectionCourse_create', 'sectionAVA_create', 'sectionQuestionsBank_create', 'sectionAdministration_create', 'sectionChart_create', 'sectionDoc_create', 'sectionAudit_create', 'sectionFinancial_create', 'sectionFormulary_create', 'sectionGlossary_create', 'sectionLogin_create', 'sectionSubdomains_create', 'sectionTerms_create', 'sectionRedirect_create', 'sectionRemoteGraphic_create', 'sectionCarte_create'), 'system' => array('system_shared', 'user', 'systemInstallation', 'admin', 'system_maintenance', 'domain', 'domainCreate', 'system_accessDenied', 'system_preload', 'system_overload', 'system_sessionRestore', 'system_error'), 'system_preload' => array('adminReport_form', 'modChatterbot', 'modEditor', 'modInstructor_preload', 'user_systemAlerts'), 'tool' => array('toolGroups'), 'user' => array('user_index', 'user_anonimous', 'userHome', 'user_admin', 'userJoin', 'userRecoverPassword', 'domainStylesheet', 'user_default'), 'userAlert' => array('userAlert_message'), 'userHome' => array('userHome_index', 'userAlert', 'userHome_password', 'userHome_personal', 'userHome_default') ); //!packager:end_of_map //!packager:start_of_data_index $dataMap = array ( 'c' => array ( 'admin' => array ( 'content' => '0:663' ), 'admin_default' => array ( 'content' => '663:547' ), 'admin_index' => array ( 'content' => '1210:1163', 'helpAbout' => '2373:722' ), 'adminAlert' => array ( 'helpAbout' => '3095:521', 'logDatabase' => '3616:352', 'logDatabasedisabled' => '3968:313', 'logPhp' => '4281:305', 'main' => '4586:241', 'mainEmpty' => '4827:162', 'userSurvey' => '4989:200' ), 'adminDatabase' => array ( 'content' => '5189:243', 'edit' => '5432:141', 'editMsg' => '5573:535', 'editSubmit' => '6108:221' ), 'adminDatabase_config' => array ( 'content' => '6329:299', 'edit' => '6628:392', 'editMessage' => '7020:300' ), 'adminDatabase_log' => array ( 'content' => '7320:269', 'edit' => '7589:242', 'editLogClear' => '7831:251', 'editLogView' => '8082:222' ), 'adminDatabase_query' => array ( 'content' => '8304:241', 'edit' => '8545:122', 'editInput' => '8667:236', 'editResult' => '8903:294' ), 'adminDatabase_tables' => array ( 'content' => '9197:223', 'edit' => '9420:157', 'editAction' => '9577:374', 'editActionCreate' => '9951:166', 'editActionDrop' => '10117:164', 'editActionRepair' => '10281:168', 'editList' => '10449:58', 'editLog' => '10507:209', 'editOk' => '10716:173' ), 'adminDomain' => array ( 'content' => '10889:227', 'contentDisabled' => '11116:443', 'contentEmpty' => '11559:180', 'edit' => '11739:140', 'editMsg' => '11879:527', 'editSubmit' => '12406:221' ), 'adminDomain_add' => array ( 'content' => '12627:255', 'edit' => '12882:214', 'editAdmin' => '13096:391', 'editAdminRequired' => '13487:380', 'editDatabase' => '13867:381', 'editDatabaseClient' => '14248:178', 'editDatabaseFile' => '14426:164', 'editDescription' => '14590:268', 'editMail' => '14858:244', 'editName' => '15102:312', 'editNameAlreadyExists' => '15414:394', 'editNameInvalidChars' => '15808:541', 'editNameSoLong' => '16349:424', 'editTitle' => '16773:328' ), 'adminDomain_details' => array ( 'content' => '17101:267', 'contextRemove' => '17368:141', 'contextRemoveConfirm' => '17509:1062', 'contextRemoveConfirmError' => '18571:450', 'contextRemoveConfirmOk' => '19021:276', 'edit' => '19297:351', 'editAdminAddName' => '19648:332', 'editAdminAddSubmit' => '19980:188', 'editAdminRemoveList' => '20168:362', 'editAdminRemoveSubmit' => '20530:195', 'editAVAEnable' => '20725:330', 'editDescription' => '21055:268', 'editMail' => '21323:244', 'editName' => '21567:219', 'editStatus' => '21786:410', 'editStatusAlert' => '22196:169', 'editStatusDefault' => '22365:169', 'editStatusDisabled' => '22534:174', 'editStatusFree' => '22708:167', 'editStatusWaiting' => '22875:197', 'editTitle' => '23072:328', 'editUpdate' => '23400:186', 'msgAdminAlreadyExists' => '23586:406', 'msgAdminPleaseSelect' => '23992:428', 'msgAdminRemoveError' => '24420:347', 'msgAdminRemoveLast' => '24767:483', 'msgAdminRequired' => '25250:380' ), 'adminMail' => array ( 'content' => '25630:215' ), 'adminMail_message' => array ( 'content' => '25845:255', 'edit' => '26100:196', 'editBcc' => '26296:302', 'editCc' => '26598:302', 'editHtml' => '26900:314', 'editSubject' => '27214:300', 'editText' => '27514:321', 'editTo' => '27835:282', 'view' => '28117:94', 'viewLog' => '28211:293' ), 'adminMail_smtp' => array ( 'alertDisabled' => '28504:626', 'alertLoginError' => '29130:573', 'alertSendingError' => '29703:371', 'alertSocketError' => '30074:548', 'alertToError' => '30622:384', 'content' => '31006:263', 'edit' => '31269:335' ), 'adminSystem' => array ( 'content' => '31604:223' ), 'adminSystem_admin' => array ( 'content' => '31827:253', 'edit' => '32080:360' ), 'adminSystem_eval' => array ( 'content' => '32440:271', 'edit' => '32711:103', 'editEvalInput' => '32814:216' ), 'adminSystem_extract' => array ( 'content' => '33030:970', 'edit' => '34000:571', 'editBackupFilename' => '34571:458', 'editCreateBackup' => '35029:343', 'editDataExtension' => '35372:463', 'editDataExtensionEcl' => '35835:206', 'editDataExtensionJson' => '36041:163', 'editIndentStart' => '36204:446', 'editIndentStart1' => '36650:170', 'editIndentStart2' => '36820:170', 'editIndentStart3' => '36990:196', 'editIndentString' => '37186:441', 'editIndentString2spaces' => '37627:171', 'editIndentString4spaces' => '37798:178', 'editIndentStringTab' => '37976:156', 'editNlMode' => '38132:376', 'editNlModeLinux' => '38508:136', 'editNlModeWindows' => '38644:142', 'editScriptAccessibility' => '38786:364', 'editSubmit' => '39150:231' ), 'adminSystem_hosting' => array ( 'content' => '39381:233', 'edit' => '39614:501' ), 'adminSystem_log' => array ( 'content' => '40115:250', 'edit' => '40365:281', 'editLogClear' => '40646:251', 'editLogView' => '40897:212' ), 'adminSystem_pack' => array ( 'alertFinished' => '41109:326', 'content' => '41435:634', 'edit' => '42069:227', 'editClearServer' => '42296:322', 'editExportFilename' => '42618:440', 'editModeExport' => '43058:381', 'editModeReplace' => '43439:407', 'editPackMediaFiles' => '43846:358', 'editSubmit' => '44204:223' ), 'adminSystem_server' => array ( 'content' => '44427:225', 'edit' => '44652:205' ), 'adminSystem_setup' => array ( 'content' => '44857:286', 'edit' => '45143:270' ), 'adminSystem_tracking' => array ( 'alertCacheCleared' => '45413:409', 'alertPagesRemoved' => '45822:415', 'content' => '46237:239', 'edit' => '46476:430', 'editClearGeoipCache' => '46906:265', 'editClearRemovedPages' => '47171:287' ), 'adminSystem_update' => array ( 'content' => '47458:237', 'edit' => '47695:102', 'editSendFile' => '47797:218' ), 'adminTools' => array ( 'content' => '48015:245' ), 'adminTools_ecl2php' => array ( 'content' => '48260:255', 'edit' => '48515:102', 'editCompiler' => '48617:248' ), 'adminUser' => array ( 'content' => '48865:223', 'contentDisabled' => '49088:443', 'contentEmpty' => '49531:178', 'createFolder' => '49709:158', 'createFolderButtom' => '49867:221', 'createFolderMsg' => '50088:523', 'updateRequest' => '50611:188', 'updateRequestConfirm' => '50799:985', 'updateRequestError' => '51784:451' ), 'adminUser_add' => array ( 'content' => '52235:249', 'edit' => '52484:296', 'editCaption' => '52780:287', 'editGender' => '53067:338', 'editGenderFemale' => '53405:118', 'editGenderMale' => '53523:119', 'editGenderUndefined' => '53642:120', 'editMail' => '53762:244', 'editName' => '54006:268', 'editPassword' => '54274:281', 'editPassword2' => '54555:192', 'editTitle' => '54747:281', 'msgPasswordInvalidCharacter' => '55028:689', 'msgPasswordRepeatError' => '55717:393', 'msgPasswordRequired' => '56110:373', 'msgUserAlreadyExists' => '56483:438', 'msgUserInvalidName' => '56921:666', 'msgUserNameRequired' => '57587:667' ), 'adminUser_details' => array ( 'content' => '58254:263', 'edit' => '58517:382', 'editCaption' => '58899:287', 'editComents' => '59186:243', 'editGender' => '59429:338', 'editGenderFemale' => '59767:118', 'editGenderMale' => '59885:119', 'editGenderUndefined' => '60004:120', 'editMail' => '60124:244', 'editName' => '60368:223', 'editPassword' => '60591:253', 'editPassword2' => '60844:173', 'editPasswordDescription' => '61017:323', 'editStatus' => '61340:279', 'editTitle' => '61619:281', 'removeConfirmErrorF' => '61900:448', 'removeConfirmErrorM' => '62348:448', 'removeConfirmF' => '62796:1047', 'removeConfirmM' => '63843:1042', 'removeConfirmOkF' => '64885:270', 'removeConfirmOkM' => '65155:270', 'removeF' => '65425:139', 'removeM' => '65564:139', 'statusAlert' => '65703:185', 'statusEmpty' => '65888:164', 'statusRemoved' => '66052:172', 'statusSurvey' => '66224:225', 'statusUpdate' => '66449:215' ), 'adminUser_survey' => array ( 'survey' => '66664:841', 'surveyList' => '67505:70', 'surveySubmit' => '67575:141', 'surveySubmitAccept' => '67716:207', 'surveySubmitBlock' => '67923:205' ), 'dialog' => array ( 'cancel' => '68128:197', 'close' => '68325:357', 'popUpClose' => '68682:298', 'popUpLoad' => '68980:608', 'tabs' => '69588:3394', 'tabsObjects' => '72982:3383' ), 'dialog_simple' => array ( 'color' => '76365:46482', 'font' => '122847:9082', 'font_old' => '131929:9104', 'paragraph' => '141033:9910' ), 'dialogDetails' => array ( 'main' => '150943:1408' ), 'dialogDetails_configure' => array ( 'content' => '152351:311' ), 'dialogFields' => array ( 'add' => '152662:98', 'close' => '152760:612', 'editCaption' => '153372:297', 'editRequired' => '153669:285', 'load' => '153954:711', 'main' => '154665:516', 'module' => '155181:254' ), 'dialogFields_checkbox' => array ( 'content' => '155435:239', 'edit' => '155674:140', 'preset' => '155814:34', 'valueNo' => '155848:108', 'valueYes' => '155956:109' ), 'dialogFields_description' => array ( 'content' => '156065:249', 'edit' => '156314:203', 'editContent' => '156517:378', 'editDisplayWhenEditingOnly' => '156895:349', 'preset' => '157244:38' ), 'dialogFields_mail' => array ( 'alertInvalidMail' => '157282:597', 'alertMultipleNotAllowed' => '157879:485', 'content' => '158364:245', 'edit' => '158609:177', 'preset' => '158786:112' ), 'dialogFields_radio' => array ( 'content' => '158898:241', 'edit' => '159139:247', 'preset' => '159386:54' ), 'dialogFields_select' => array ( 'content' => '159440:237', 'edit' => '159677:209', 'editExplain' => '159886:207', 'editFields' => '160093:112', 'preset' => '160205:56' ), 'dialogFields_separator' => array ( 'content' => '160261:217', 'edit' => '160478:140', 'preset' => '160618:109' ), 'dialogFields_text' => array ( 'content' => '160727:227', 'edit' => '160954:197', 'editType' => '161151:351', 'editTypeText' => '161502:176', 'editTypeTextSmall' => '161678:197', 'editTypeTextTiny' => '161875:196', 'preset' => '162071:30' ), 'dialogFields_textarea' => array ( 'content' => '162101:273', 'edit' => '162374:197', 'editType' => '162571:362', 'editTypeTextarea' => '162933:180', 'editTypeTextareaBig' => '163113:197', 'editTypeTextareaSmall' => '163310:202', 'preset' => '163512:83' ), 'dialogLink' => array ( 'main' => '163595:2042' ), 'dialogList' => array ( 'close' => '165637:609', 'edit' => '166246:134', 'html' => '166380:300', 'load' => '166680:791', 'notEditable' => '167471:544', 'tabHtml' => '168015:218', 'tabs' => '168233:3549' ), 'dialogModule' => array ( '000auto' => '171782:169', '000noPadding' => '171951:183', '012rem' => '172134:168', '025rem' => '172302:179', '050rem' => '172481:175', '075rem' => '172656:179', '083rem' => '172835:179', '091rem' => '173014:179', '100rem' => '173193:166', '110rem' => '173359:172', '125rem' => '173531:176', '150rem' => '173707:172', '200rem' => '173879:168', '250rem' => '174047:175', '300rem' => '174222:168', 'alignBottom' => '174390:169', 'alignCenter' => '174559:174', 'alignLeft' => '174733:164', 'alignRight' => '174897:168', 'alignTop' => '175065:160', 'boxDisplay' => '175225:399', 'boxPadding' => '175624:588', 'boxRounded' => '176212:595', 'boxRoundedElipse' => '176807:164', 'boxRoundedOff' => '176971:193', 'boxScheme' => '177164:580', 'boxSchemeAuto' => '177744:174', 'boxSchemeCard' => '177918:163', 'boxSchemeFormulary' => '178081:178', 'boxSchemeNav' => '178259:186', 'boxSchemePanel' => '178445:165', 'boxSchemeSpotlight' => '178610:175', 'boxSchemeSystem' => '178785:168', 'boxShadow' => '178953:485', 'boxShadowAuto' => '179438:174', 'boxShadowOff' => '179612:190', 'boxShadowOn' => '179802:192', 'boxShadowSmoke' => '179994:185', 'boxSize' => '180179:579', 'caption' => '180758:281', 'captionDisplay' => '181039:349', 'captionLegend' => '181388:362', 'contentNotConfigurable' => '181750:466', 'details' => '182216:255', 'detailsHorizontalAlign' => '182471:501', 'detailsHorizontalSpacing' => '182972:675', 'detailsSpacing000' => '183647:180', 'detailsSpacing006' => '183827:133', 'detailsSpacing012' => '183960:134', 'detailsSpacing025' => '184094:133', 'detailsSpacing037' => '184227:134', 'detailsSpacing050' => '184361:132', 'detailsSpacing075' => '184493:134', 'detailsSpacing100' => '184627:131', 'detailsVerticalAlign' => '184758:492', 'detailsVerticalSpacing' => '185250:667', 'edit' => '185917:503', 'imgFilterGrayscale' => '186420:469', 'imgFilterSepia' => '186889:443', 'imgFormat' => '187332:515', 'imgFormatAuto' => '187847:200', 'imgFormatCircle' => '188047:168', 'imgFormatElipse' => '188215:167', 'imgFormatSquare' => '188382:169', 'imgFormatThumbnail' => '188551:168', 'imgSmoke' => '188719:374', 'listAlign' => '189093:455', 'listColumns' => '189548:587', 'listColumns1' => '190135:117', 'listColumns2' => '190252:117', 'listColumns3' => '190369:117', 'listColumns4' => '190486:117', 'listColumns5' => '190603:117', 'listColumns6' => '190720:117', 'listColumnsAuto' => '190837:174', 'listColumnsWide' => '191011:598', 'listType' => '191609:472', 'listTypeColumns' => '192081:170', 'listTypeGrid' => '192251:162', 'listTypeInline' => '192413:164', 'margin025' => '192577:175', 'margin050' => '192752:172', 'margin075' => '192924:175', 'margin100' => '193099:165', 'margin150' => '193264:169', 'margin200' => '193433:167', 'marginAuto' => '193600:182', 'marginBottom' => '193782:575', 'marginLeft' => '194357:569', 'marginNone' => '194926:169', 'marginRight' => '195095:571', 'marginTop' => '195666:566', 'modPosition' => '196232:567', 'modPositionCenter' => '196799:174', 'modPositionFloatLeft' => '196973:190', 'modPositionFloatRight' => '197163:191', 'modPositionInline' => '197354:173', 'modPositionLeft' => '197527:168', 'modPositionRight' => '197695:168', 'modSemantic' => '197863:601', 'modSemanticAddress' => '198464:190', 'modSemanticArticle' => '198654:188', 'modSemanticAside' => '198842:188', 'modSemanticFooter' => '199030:167', 'modSemanticHeader' => '199197:170', 'modSemanticNav' => '199367:172', 'modSemanticNone' => '199539:156', 'modSize' => '199695:425', 'modWidth' => '200120:697', 'modWidth1' => '200817:128', 'modWidth10' => '200945:130', 'modWidth11' => '201075:130', 'modWidth12' => '201205:138', 'modWidth2' => '201343:128', 'modWidth3' => '201471:135', 'modWidth4' => '201606:128', 'modWidth5' => '201734:128', 'modWidth6' => '201862:135', 'modWidth7' => '201997:128', 'modWidth8' => '202125:128', 'modWidth9' => '202253:128', 'modWidthAuto' => '202381:174', 'modWidthWidescreen' => '202555:705', 'tabCaption' => '203260:287', 'tabDetails' => '203547:214', 'tabEffects' => '203761:294', 'tabList' => '204055:423', 'tabPosition' => '204478:391', 'tabStyle' => '204869:300' ), 'dialogTemplate' => array ( 'content' => '205169:298', 'css' => '205467:286', 'cssVars' => '205753:311', 'customGeneral' => '206064:296', 'edit' => '206360:234', 'html' => '206594:261', 'panelFooter' => '206855:281', 'panelHeader' => '207136:284', 'tabCSS' => '207420:230', 'tabCSSVars' => '207650:246', 'tabDisabledTheme' => '207896:276', 'tabDocument' => '208172:377', 'tabHTML' => '208549:233', 'tabPanelFooter' => '208782:291', 'tabPanelHeader' => '209073:294', 'themeColors' => '209367:228', 'themeFonts' => '209595:209', 'themeThemes' => '209804:211' ), 'dialogTemplate_advanced' => array ( 'content' => '210015:313', 'css' => '210328:254', 'cssVars' => '210582:279', 'edit' => '210861:119', 'html' => '210980:261', 'panelFooter' => '211241:281', 'panelHeader' => '211522:284', 'tabCSS' => '211806:230', 'tabCSSVars' => '212036:246', 'tabHTML' => '212282:233', 'tabPanelFooter' => '212515:291', 'tabPanelHeader' => '212806:294' ), 'dialogTemplate_color' => array ( 'color' => '213100:1748' ), 'domain_disabled' => array ( 'content' => '214848:883' ), 'domain_empty' => array ( 'content' => '215731:1149', 'edit' => '216880:647', 'editCaption' => '217527:400', 'editContent' => '217927:477', 'editDescription' => '218404:382', 'editKeywords' => '218786:283', 'editKeywordsPack' => '219069:129', 'editTitle' => '219198:863', 'help01empty' => '220061:463', 'help01login' => '220524:411', 'help02accessDenied' => '220935:363', 'help02loginError' => '221298:251', 'help02welcomeAdmin_f' => '221549:322', 'help02welcomeAdmin_m' => '221871:321', 'help04index01edit' => '222192:832', 'help04index01editError' => '223024:345', 'help04index02editDone' => '223369:344', 'help04index02return' => '223713:527', 'templateForNewDomain' => '224240:265' ), 'domainAbout' => array ( 'content' => '224505:1010' ), 'domainCategories' => array ( 'content' => '225515:522', 'helpAbout' => '226037:691', 'link' => '226728:276' ), 'domainCategories_category' => array ( 'create' => '227004:562', 'edit' => '227566:591', 'editCaption' => '228157:455', 'editCaptionHidden' => '228612:330', 'editCaptionRequired' => '228942:461', 'editContent' => '229403:391', 'editDescription' => '229794:251', 'editImg' => '230045:284', 'editKeywords' => '230329:230', 'editKeywordsPack' => '230559:61', 'editName' => '230620:257', 'editNameHidden' => '230877:176', 'editTitle' => '231053:249', 'editUpdated' => '231302:210', 'helpAbout' => '231512:565', 'new' => '232077:257', 'remove' => '232334:145', 'removeConfirm' => '232479:715' ), 'domainCreate' => array ( 'content' => '233194:1222', 'contentCreate' => '234416:330', 'edit' => '234746:217', 'editAddress' => '234963:451', 'editCaption' => '235414:599', 'editDescription' => '236013:564', 'editPhone' => '236577:268', 'editTitle' => '236845:517' ), 'domainDefault' => array ( 'content' => '237362:628', 'custom' => '237990:291', 'edit' => '238281:664', 'editCaption' => '238945:378', 'editContent' => '239323:422', 'editRecognizeEcolabore' => '239745:343', 'editRecognizeHTML' => '240088:296', 'editRecognizeParagraphs' => '240384:335', 'editTitle' => '240719:310', 'editUpdated' => '241029:210', 'helpAbout' => '241239:503', 'helpTip' => '241742:624', 'restore' => '242366:303' ), 'domainGlossary' => array ( 'content' => '242669:532', 'helpAbout' => '243201:559' ), 'domainGlossary_keyword' => array ( 'content' => '243760:707', 'edit' => '244467:419', 'editCaption' => '244886:188', 'editContent' => '245074:419', 'editTitle' => '245493:310', 'editUpdated' => '245803:210', 'helpAbout' => '246013:904', 'remove' => '246917:140', 'removeConfirm' => '247057:578' ), 'domainIndex' => array ( 'contentEdit' => '247635:197', 'edit' => '247832:616', 'editCaption' => '248448:400', 'editContent' => '248848:477', 'editDescription' => '249325:382', 'editKeywords' => '249707:283', 'editKeywordsPack' => '249990:129', 'editList' => '250119:266', 'editListRecents' => '250385:319', 'editListSections' => '250704:330', 'editTitle' => '251034:863', 'editUpdated' => '251897:210', 'helpAbout' => '252107:637', 'helpNavigate' => '252744:391', 'helpTip' => '253135:662', 'mainSections' => '253797:638' ), 'domainRecents' => array ( 'content' => '254435:145', 'helpAbout' => '254580:371', 'helpTip' => '254951:442', 'link' => '255393:315' ), 'domainSearch' => array ( 'content' => '255708:227', 'helpAbout' => '255935:776', 'search' => '256711:134', 'searchInput' => '256845:295', 'searchSubmit' => '257140:207', 'searchTagOnly' => '257347:286' ), 'domainStylesheet' => array ( 'preset' => '257633:7189', 'style' => '264822:21944' ), 'domainStylesheet_colors' => array ( 'default' => '286766:1317', 'white' => '288083:1010' ), 'domainStylesheet_theme' => array ( 'default' => '289093:2496' ), 'modAudio' => array ( 'content' => '291589:337', 'edit' => '291926:343', 'editAudio' => '292269:224', 'editDescription' => '292493:308', 'module' => '292801:197', 'moduleCreate' => '292998:735', 'tabAudio' => '293733:240', 'tabCaption' => '293973:303', 'tabStyle' => '294276:329', 'upload' => '294605:443', 'uploadAudio' => '295048:269' ), 'modAudio_upload' => array ( 'content' => '295317:403', 'edit' => '295720:99', 'editAudio' => '295819:263' ), 'modBanner' => array ( 'content' => '296082:306', 'edit' => '296388:401', 'module' => '296789:334', 'moduleCreate' => '297123:769' ), 'modBox' => array ( 'content' => '297892:279', 'edit' => '298171:307', 'editContent' => '298478:385', 'module' => '298863:318', 'moduleCreate' => '299181:720', 'tabCaption' => '299901:269', 'tabContent' => '300170:253' ), 'modContent' => array ( 'edit' => '300423:355', 'module' => '300778:498' ), 'modContext' => array ( 'help' => '301276:129', 'module' => '301405:421' ), 'modDinamic' => array ( 'content' => '301826:469', 'edit' => '302295:432', 'listDirection' => '302727:350', 'listDirectionAsc' => '303077:172', 'listDirectionDesc' => '303249:176', 'listFilter' => '303425:395', 'listFilterNextEvents' => '303820:190', 'listFilterNone' => '304010:175', 'listFilterSpotlight' => '304185:191', 'listMax' => '304376:317', 'listOffset' => '304693:570', 'listUpdate' => '305263:451', 'listUpdateAuto' => '305714:173', 'listUpdateDay' => '305887:175', 'listUpdateHits' => '306062:181', 'listUpdateHour' => '306243:178', 'listUpdateMonth' => '306421:179', 'listUpdateWeek' => '306600:181', 'module' => '306781:302', 'moduleCreate' => '307083:746', 'sort' => '307829:513', 'sortByCreated' => '308342:186', 'sortByEventStart' => '308528:193', 'sortByHits' => '308721:191', 'sortByIndex' => '308912:181', 'sortByLastComment' => '309093:200', 'sortByName' => '309293:161', 'sortByUpdated' => '309454:190', 'sortByValue' => '309644:166', 'sortShuffled' => '309810:173', 'tabSort' => '309983:327' ), 'modEditor' => array ( 'contextWisiwygDisable' => '310310:152', 'contextWisiwygEnable' => '310462:148', 'module' => '310610:1153' ), 'modEditor_document' => array ( 'module' => '311763:423', 'save' => '312186:142' ), 'modEditor_insert' => array ( 'editor' => '312328:1125', 'editorA' => '313453:194', 'editorAudio' => '313647:181', 'editorBox' => '313828:201', 'editorFile' => '314029:184', 'editorH1' => '314213:238', 'editorH2' => '314451:238', 'editorH3' => '314689:238', 'editorH4' => '314927:238', 'editorH5' => '315165:238', 'editorH6' => '315403:238', 'editorHR' => '315641:233', 'editorHtml' => '315874:190', 'editorImg' => '316064:211', 'editorLA' => '316275:249', 'editorLO' => '316524:246', 'editorLU' => '316770:251', 'editorP' => '317021:238', 'editorTable' => '317259:225', 'editorVideo' => '317484:181', 'module' => '317665:787' ), 'modEditor_objects' => array ( 'audio' => '318452:121', 'box' => '318573:134', 'file' => '318707:122', 'html' => '318829:140', 'img' => '318969:122', 'module' => '319091:441', 'ofBanner' => '319532:144', 'ofPage' => '319676:127', 'ofPost' => '319803:125', 'ofSection' => '319928:130', 'table' => '320058:122', 'video' => '320180:121' ), 'modFile' => array ( 'content' => '320301:338', 'edit' => '320639:343', 'editDescription' => '320982:308', 'editFile' => '321290:219', 'module' => '321509:180', 'moduleCreate' => '321689:736', 'tabCaption' => '322425:303', 'tabFile' => '322728:239', 'tabStyle' => '322967:329', 'upload' => '323296:416', 'uploadFile' => '323712:220' ), 'modFormulary' => array ( 'module' => '323932:244' ), 'modHits' => array ( 'edit' => '324176:383', 'module' => '324559:493' ), 'modHtml' => array ( 'content' => '325052:316', 'edit' => '325368:296', 'editHtml' => '325664:274', 'module' => '325938:46', 'moduleCreate' => '325984:737', 'tabCaption' => '326721:303', 'tabHtml' => '327024:208' ), 'modHumperstilshen' => array ( 'iconAlert' => '327232:193', 'iconCrash' => '327425:179', 'iconDefault' => '327604:154', 'iconError' => '327758:203', 'iconHappy' => '327961:183', 'iconQuestion' => '328144:189', 'iconTip' => '328333:178', 'iconWelcome' => '328511:189', 'iconWhait' => '328700:182', 'showAlert' => '328882:164', 'showTip' => '329046:156', 'submitCancel' => '329202:220', 'submitConfirm' => '329422:154', 'submitConfirmCancel' => '329576:131' ), 'modImg' => array ( 'content' => '329707:312', 'edit' => '330019:374', 'editDescription' => '330393:308', 'editImg' => '330701:294', 'imgFilterBrightness' => '330995:476', 'imgFilterContrast' => '331471:472', 'imgFilterHueRotate' => '331943:473', 'imgFilterSaturate' => '332416:472', 'module' => '332888:298', 'moduleCreate' => '333186:780', 'tabCaption' => '333966:303', 'tabFilters' => '334269:317', 'tabImg' => '334586:238', 'tabStyle' => '334824:329' ), 'modInstructor' => array ( 'module' => '335153:2141' ), 'modInstructor_quality' => array ( 'helpNavigate' => '337294:308', 'helpRedirect' => '337602:409', 'index' => '338011:391' ), 'modInterface' => array ( 'module' => '338402:424' ), 'modKeywords' => array ( 'edit' => '338826:385', 'module' => '339211:521' ), 'modLanguages' => array ( 'edit' => '339732:413', 'module' => '340145:644' ), 'modLayout' => array ( 'alternativeLayoutOff' => '340789:166', 'applyChanges' => '340955:175', 'content' => '341130:298', 'edit' => '341428:280', 'htmlEdit' => '341708:292', 'personaliteLayout' => '342000:145', 'personaliteOff' => '342145:140', 'personaliteOn' => '342285:152', 'print' => '342437:150', 'tabColors' => '342587:188', 'tabFonts' => '342775:188', 'tabHtml' => '342963:221', 'tabLayout' => '343184:189', 'tabStyle' => '343373:188', 'tabTheme' => '343561:168' ), 'modLayout_scheme' => array ( 'cardActiveColor' => '343729:420', 'cardBackgroundColor' => '344149:433', 'cardBorderColor' => '344582:414', 'cardCaptionColor' => '344996:413', 'cardHeaderColor' => '345409:408', 'cardLinkColor' => '345817:398', 'cardMarkColor' => '346215:414', 'cardTextColor' => '346629:397', 'content' => '347026:509', 'documentActiveColor' => '347535:409', 'documentBackgroundColor' => '347944:445', 'documentBorderColor' => '348389:426', 'documentCaptionColor' => '348815:425', 'documentHeaderColor' => '349240:420', 'documentLinkColor' => '349660:410', 'documentMarkColor' => '350070:426', 'documentTextColor' => '350496:409', 'edit' => '350905:212', 'formularyActiveColor' => '351117:435', 'formularyBackgroundColor' => '351552:448', 'formularyBorderColor' => '352000:429', 'formularyCaptionColor' => '352429:428', 'formularyHeaderColor' => '352857:423', 'formularyLinkColor' => '353280:413', 'formularyMarkColor' => '353693:429', 'formularyTextColor' => '354122:412', 'layout' => '354534:3414', 'navActiveColor' => '357948:417', 'navBackgroundColor' => '358365:430', 'navBorderColor' => '358795:411', 'navCaptionColor' => '359206:410', 'navHeaderColor' => '359616:405', 'navLinkColor' => '360021:395', 'navMarkColor' => '360416:411', 'navTextColor' => '360827:394', 'panelActiveColor' => '361221:423', 'panelBackgroundColor' => '361644:436', 'panelBorderColor' => '362080:417', 'panelCaptionColor' => '362497:416', 'panelHeaderColor' => '362913:411', 'panelLinkColor' => '363324:401', 'panelMarkColor' => '363725:417', 'panelTextColor' => '364142:400', 'spotlightActiveColor' => '364542:435', 'spotlightBackgroundColor' => '364977:448', 'spotlightBorderColor' => '365425:429', 'spotlightCaptionColor' => '365854:428', 'spotlightHeaderColor' => '366282:423', 'spotlightLinkColor' => '366705:413', 'spotlightMarkColor' => '367118:429', 'spotlightTextColor' => '367547:412', 'systemActiveColor' => '367959:426', 'systemBackgroundColor' => '368385:439', 'systemBorderColor' => '368824:420', 'systemCaptionColor' => '369244:419', 'systemHeaderColor' => '369663:414', 'systemLinkColor' => '370077:404', 'systemMarkColor' => '370481:420', 'systemTextColor' => '370901:403', 'tabButtons' => '371304:1062', 'tabCard' => '372366:913', 'tabDocument' => '373279:974', 'tabFormulary' => '374253:988', 'tabNav' => '375241:901', 'tabPanel' => '376142:916', 'tabSpotlight' => '377058:1021', 'tabSystem' => '378079:1062' ), 'modList' => array ( 'content' => '379141:160', 'edit' => '379301:440', 'listDirection' => '379741:350', 'listDirectionAsc' => '380091:172', 'listDirectionDesc' => '380263:176', 'listMax' => '380439:329', 'module' => '380768:632', 'postEdit' => '381400:241', 'sort' => '381641:488', 'sortByCreated' => '382129:186', 'sortByEventStart' => '382315:193', 'sortByHits' => '382508:191', 'sortByIndex' => '382699:181', 'sortByLastComment' => '382880:200', 'sortByName' => '383080:161', 'sortByUpdated' => '383241:190', 'sortByValue' => '383431:166', 'tabSort' => '383597:257' ), 'modList_preset' => array ( 'blog' => '383854:766', 'blogContent' => '384620:90', 'blogDinamic' => '384710:892', 'events' => '385602:817', 'eventsContent' => '386419:103', 'eventsDinamic' => '386522:916', 'folder' => '387438:729', 'galery' => '388167:810', 'galeryContent' => '388977:60', 'galeryDinamic' => '389037:845', 'navigate' => '389882:523', 'news' => '390405:803', 'newsContent' => '391208:97', 'newsDinamic' => '391305:851', 'pages' => '392156:510', 'podcast' => '392666:830', 'podcastContent' => '393496:112', 'podcastDinamic' => '393608:900', 'related' => '394508:747', 'videocast' => '395255:824', 'videocastContent' => '396079:105', 'videocastDinamic' => '396184:892' ), 'modLogin' => array ( 'alertCookiesRequired' => '397076:375', 'alertInvalidLogin' => '397451:417', 'anonimous' => '397868:119', 'login' => '397987:187', 'loginName' => '398174:159', 'loginPassword' => '398333:164', 'loginSubmit' => '398497:255', 'module' => '398752:229' ), 'modNavbar' => array ( 'edit' => '398981:416', 'module' => '399397:449' ), 'modPages' => array ( 'edit' => '399846:416', 'module' => '400262:510' ), 'modTable' => array ( 'content' => '400772:5016', 'edit' => '405788:321', 'list' => '406109:342', 'module' => '406451:55', 'moduleCreate' => '406506:779', 'tabApearance' => '407285:214', 'tabCaption' => '407499:309', 'tabContent' => '407808:245' ), 'modTable_new' => array ( 'content' => '408053:351', 'edit' => '408404:142', 'editCols' => '408546:307', 'editList' => '408853:342', 'editRows' => '409195:306' ), 'modTitle' => array ( 'edit' => '409501:316', 'module' => '409817:379' ), 'modToolbox' => array ( 'module' => '410196:425' ), 'modUser' => array ( 'goAdmin' => '410621:205', 'goLogout' => '410826:134', 'goMain' => '410960:190', 'module' => '411150:453' ), 'modUser_alerts' => array ( 'module' => '411603:418' ), 'modUser_quoteoftheday' => array ( 'module' => '412021:427', 'quotes' => '412448:45066' ), 'modUser_tools' => array ( 'goPassword' => '457514:135', 'goPersonal' => '457649:132', 'module' => '457781:420' ), 'modUser_welcome' => array ( 'goAbout' => '458201:151', 'goEcolabore' => '458352:187', 'goHome' => '458539:161', 'goOrganization' => '458700:193', 'goPassword' => '458893:161', 'goProfiles' => '459054:132', 'goReport' => '459186:147', 'goServiceTerms' => '459333:151', 'goSubscribe' => '459484:140', 'module' => '459624:426' ), 'renderBase_mail' => array ( 'block' => '460050:452' ), 'renderBase_print' => array ( 'block' => '460502:580' ), 'renderBase_responsive' => array ( 'block' => '461082:4008' ), 'renderBase_simple' => array ( 'block' => '465090:658' ), 'renderBase_system_message' => array ( 'block' => '465748:1296' ), 'renderBorders_none' => array ( 'block' => '467044:1056', 'description' => '468100:89' ), 'renderLabels_action' => array ( 'add' => '468189:115', 'answer' => '468304:118', 'back' => '468422:121', 'cancel' => '468543:125', 'choose' => '468668:125', 'close' => '468793:114', 'config' => '468907:142', 'configure' => '469049:131', 'confirm' => '469180:127', 'connect' => '469307:126', 'continue' => '469433:128', 'create' => '469561:114', 'custom' => '469675:130', 'download' => '469805:125', 'edit' => '469930:113', 'finish' => '470043:125', 'go' => '470168:115', 'move_down' => '470283:129', 'move_up' => '470412:126', 'next' => '470538:114', 'ok' => '470652:107', 'open' => '470759:112', 'pause' => '470871:114', 'play' => '470985:118', 'previous' => '471103:122', 'refresh' => '471225:119', 'reload' => '471344:133', 'remove' => '471477:116', 'remove_object' => '471593:132', 'repeat' => '471725:116', 'restore' => '471841:166', 'save' => '472007:113', 'select' => '472120:120', 'stop' => '472240:112', 'submit' => '472352:115', 'update' => '472467:118' ), 'renderLabels_date' => array ( 'day' => '472585:109', 'days_ago' => '472694:122', 'formated' => '472816:197', 'hour' => '473013:113', 'hours' => '473126:113', 'hours_ago' => '473239:124', 'minutes' => '473363:117', 'minutes_ago' => '473480:129', 'month' => '473609:111', 'month_short1' => '473720:109', 'month_short10' => '473829:109', 'month_short11' => '473938:109', 'month_short12' => '474047:109', 'month_short2' => '474156:109', 'month_short3' => '474265:109', 'month_short4' => '474374:109', 'month_short5' => '474483:109', 'month_short6' => '474592:109', 'month_short7' => '474701:109', 'month_short8' => '474810:109', 'month_short9' => '474919:109', 'month1' => '475028:117', 'month10' => '475145:117', 'month11' => '475262:119', 'month12' => '475381:119', 'month2' => '475500:120', 'month3' => '475620:113', 'month4' => '475733:113', 'month5' => '475846:110', 'month6' => '475956:112', 'month7' => '476068:112', 'month8' => '476180:115', 'month9' => '476295:120', 'seconds' => '476415:118', 'weekShort1' => '476533:109', 'weekShort2' => '476642:109', 'weekShort3' => '476751:109', 'weekShort4' => '476860:109', 'weekShort5' => '476969:109', 'weekShort6' => '477078:109', 'weekShort7' => '477187:109', 'year' => '477296:110', 'yesterday' => '477406:117' ), 'renderLabels_detail' => array ( 'by' => '477523:108', 'created' => '477631:123', 'downloads' => '477754:121', 'elapsed_1day' => '477875:135', 'elapsed_1hour' => '478010:140', 'elapsed_1minute' => '478150:144', 'elapsed_1month' => '478294:140', 'elapsed_1year' => '478434:139', 'elapsed_days' => '478573:162', 'elapsed_hours' => '478735:164', 'elapsed_minutes' => '478899:168', 'elapsed_months' => '479067:165', 'elapsed_now' => '479232:129', 'elapsed_years' => '479361:163', 'plays' => '479524:120', 'posted' => '479644:123', 'updated' => '479767:140' ), 'renderLabels_editor' => array ( 'link_anchor' => '479907:135' ), 'renderLabels_field' => array ( 'address_city' => '480042:113', 'address_complement' => '480155:126', 'address_country' => '480281:114', 'address_district' => '480395:117', 'address_number' => '480512:115', 'address_postalcode' => '480627:118', 'address_state' => '480745:114', 'address_street' => '480859:112', 'admin' => '480971:131', 'answer' => '481102:117', 'audio_add' => '481219:128', 'background' => '481347:119', 'border' => '481466:114', 'captcha_donotfill' => '481580:149', 'caption' => '481729:117', 'color' => '481846:111', 'comment' => '481957:121', 'confirm_witch_ok' => '482078:180', 'content' => '482258:118', 'description' => '482376:124', 'disabled' => '482500:122', 'domain' => '482622:116', 'enabled' => '482738:117', 'end' => '482855:124', 'evaluation' => '482979:131', 'file_add' => '483110:129', 'filename' => '483239:128', 'filter' => '483367:116', 'folder' => '483483:114', 'font' => '483597:112', 'full_name' => '483709:126', 'gender' => '483835:167', 'gender_mis' => '484002:121', 'gender_mister' => '484123:123', 'group' => '484246:121', 'hits' => '484367:122', 'identifier' => '484489:136', 'img' => '484625:122', 'img_description' => '484747:149', 'keywords' => '484896:134', 'mail' => '485030:123', 'nick' => '485153:145', 'observations' => '485298:136', 'paragraph' => '485434:121', 'password' => '485555:124', 'password2' => '485679:141', 'phone_area' => '485820:124', 'phone_country' => '485944:122', 'phone_number' => '486066:123', 'please_select' => '486189:123', 'recognize_ecolabore' => '486312:156', 'recognize_html' => '486468:146', 'recognize_paragraphs' => '486614:158', 'secondcontent' => '486772:158', 'start' => '486930:125', 'status' => '487055:123', 'tabs' => '487178:119', 'title' => '487297:122', 'undefined' => '487419:138', 'user' => '487557:122', 'video_add' => '487679:128', 'word_import' => '487807:164' ), 'renderLabels_glificons' => array ( 'adjust' => '487971:116', 'alert' => '488087:113', 'align-center' => '488200:124', 'align-justify' => '488324:121', 'align-left' => '488445:133', 'align-right' => '488578:133', 'apple' => '488711:112', 'arrow-down' => '488823:126', 'arrow-left' => '488949:130', 'arrow-right' => '489079:130', 'arrow-up' => '489209:122', 'asterisk' => '489331:120', 'baby-formula' => '489451:131', 'backward' => '489582:122', 'ban-circle' => '489704:113', 'barcode' => '489817:127', 'bed' => '489944:110', 'bell' => '490054:111', 'bishop' => '490165:114', 'bitcoin' => '490279:119', 'blackboard' => '490398:127', 'bold' => '490525:114', 'book' => '490639:112', 'bookmark' => '490751:119', 'briefcase' => '490870:118', 'btc' => '490988:111', 'bullhorn' => '491099:119', 'calendar' => '491218:122', 'camera' => '491340:112', 'cd' => '491452:109', 'certificate' => '491561:127', 'check' => '491688:115', 'chevron-down' => '491803:113', 'chevron-left' => '491916:118', 'chevron-right' => '492034:135', 'chevron-up' => '492169:110', 'circle-arrow-down' => '492279:127', 'circle-arrow-left' => '492406:132', 'circle-arrow-right' => '492538:161', 'circle-arrow-up' => '492699:124', 'cloud-download' => '492823:134', 'cloud-upload' => '492957:136', 'cloud' => '493093:113', 'cog' => '493206:111', 'collapse-down' => '493317:133', 'collapse-up' => '493450:130', 'comment' => '493580:121', 'compressed' => '493701:125', 'console' => '493826:119', 'copy' => '493945:113', 'copyright-mark' => '494058:125', 'credit-card' => '494183:133', 'cutlery' => '494316:118', 'dashboard' => '494434:131', 'download-alt' => '494565:117', 'download' => '494682:117', 'duplicate' => '494799:120', 'earphone' => '494919:127', 'edit' => '495046:113', 'education' => '495159:120', 'eject' => '495279:114', 'envelope' => '495393:118', 'equalizer' => '495511:124', 'erase' => '495635:116', 'euro' => '495751:113', 'exclamation-sign' => '495864:126', 'expand' => '495990:117', 'export' => '496107:117', 'eye-close' => '496224:115', 'eye-open' => '496339:117', 'facetime-video' => '496456:135', 'fast-backward' => '496591:137', 'fast-forward' => '496728:130', 'file' => '496858:114', 'film' => '496972:113', 'filter' => '497085:115', 'fire' => '497200:111', 'flag' => '497311:115', 'flash' => '497426:113', 'floppy-disk' => '497539:130', 'floppy-open' => '497669:135', 'floppy-remove' => '497804:134', 'floppy-save' => '497938:131', 'floppy-saved' => '498069:131', 'folder-close' => '498200:131', 'folder-open' => '498331:130', 'font' => '498461:112', 'forward' => '498573:117', 'fullscreen' => '498690:125', 'gbp' => '498815:111', 'gift' => '498926:115', 'glass' => '499041:112', 'globe' => '499153:113', 'grain' => '499266:112', 'hand-down' => '499378:133', 'hand-left' => '499511:138', 'hand-right' => '499649:139', 'hand-up' => '499788:130', 'hd-video' => '499918:135', 'hdd' => '500053:111', 'header' => '500164:118', 'headphones' => '500282:130', 'heart-empty' => '500412:134', 'heart' => '500546:115', 'home' => '500661:113', 'hourglass' => '500774:121', 'ice-lolly-tasted' => '500895:136', 'ice-lolly' => '501031:119', 'import' => '501150:117', 'inbox' => '501267:125', 'indent-left' => '501392:129', 'indent-right' => '501521:129', 'info-sign' => '501650:118', 'italic' => '501768:116', 'jpy' => '501884:111', 'king' => '501995:110', 'knight' => '502105:118', 'lamp' => '502223:114', 'leaf' => '502337:112', 'level-up' => '502449:126', 'link' => '502575:111', 'list-alt' => '502686:112', 'list' => '502798:112', 'lock' => '502910:121', 'log-in' => '503031:117', 'log-out' => '503148:122', 'magnet' => '503270:115', 'map-marker' => '503385:131', 'menu-down' => '503516:124', 'menu-hamburger' => '503640:133', 'menu-left' => '503773:126', 'menu-right' => '503899:127', 'menu-up' => '504026:121', 'minus-sign' => '504147:114', 'minus' => '504261:113', 'modal-window' => '504374:133', 'move' => '504507:112', 'music' => '504619:127', 'new-window' => '504746:149', 'object-align-bottom' => '504895:141', 'object-align-horizontal' => '505036:147', 'object-align-left' => '505183:139', 'object-align-right' => '505322:139', 'object-align-top' => '505461:138', 'object-align-vertical' => '505599:143', 'off' => '505742:115', 'oil' => '505857:119', 'ok-circle' => '505976:107', 'ok-sign' => '506083:107', 'ok' => '506190:109', 'open-file' => '506299:126', 'open' => '506425:112', 'option-horizontal' => '506537:138', 'option-vertical' => '506675:134', 'paperclip' => '506809:114', 'paste' => '506923:113', 'pause' => '507036:114', 'pawn' => '507150:111', 'pencil' => '507261:116', 'phone-alt' => '507377:125', 'phone' => '507502:116', 'picture' => '507618:116', 'piggy-bank' => '507734:133', 'plane' => '507867:113', 'play-circle' => '507980:118', 'play' => '508098:118', 'plus-sign' => '508216:111', 'plus' => '508327:111', 'print' => '508438:116', 'pushpin' => '508554:115', 'qrcode' => '508669:109', 'queen' => '508778:114', 'question-sign' => '508892:124', 'random' => '509016:118', 'record' => '509134:115', 'refresh' => '509249:119', 'registration-mark' => '509368:138', 'remove-circle' => '509506:116', 'remove-sign' => '509622:116', 'remove' => '509738:116', 'repeat' => '509854:116', 'resize-full' => '509970:126', 'resize-horizontal' => '510096:153', 'resize-small' => '510249:123', 'resize-vertical' => '510372:149', 'retweet' => '510521:121', 'road' => '510642:110', 'rub' => '510752:111', 'ruble' => '510863:113', 'save-file' => '510976:127', 'save' => '511103:113', 'saved' => '511216:113', 'scale' => '511329:114', 'scissors' => '511443:118', 'screenshot' => '511561:130', 'sd-video' => '511691:136', 'search' => '511827:118', 'send' => '511945:113', 'share-alt' => '512058:121', 'share' => '512179:121', 'shopping-cart' => '512300:137', 'signal' => '512437:114', 'sort-by-alphabet-alt' => '512551:147', 'sort-by-alphabet' => '512698:144', 'sort-by-attributes-alt' => '512842:151', 'sort-by-attributes' => '512993:144', 'sort-by-order-alt' => '513137:141', 'sort-by-order' => '513278:133', 'sort' => '513411:114', 'sound-5-1' => '513525:121', 'sound-6-1' => '513646:121', 'sound-7-1' => '513767:125', 'sound-dolby' => '513892:127', 'sound-stereo' => '514019:116', 'star-empty' => '514135:134', 'star' => '514269:114', 'stats' => '514383:121', 'step-backward' => '514504:137', 'step-forward' => '514641:133', 'stop' => '514774:112', 'subscript' => '514886:121', 'subtitles' => '515007:119', 'sunglasses' => '515126:153', 'superscript' => '515279:128', 'tag' => '515407:111', 'tags' => '515518:113', 'tasks' => '515631:115', 'tent' => '515746:114', 'text-background' => '515860:133', 'text-color' => '515993:127', 'text-height' => '516120:131', 'text-size' => '516251:129', 'text-width' => '516380:131', 'th-large' => '516511:121', 'th-list' => '516632:119', 'th' => '516751:109', 'thumbs-down' => '516860:133', 'thumbs-up' => '516993:129', 'time' => '517122:112', 'tint' => '517234:112', 'tower' => '517346:113', 'transfer' => '517459:122', 'trash' => '517581:115', 'tree-conifer' => '517696:124', 'tree-deciduous' => '517820:134', 'triangle-bottom' => '517954:137', 'triangle-left' => '518091:133', 'triangle-right' => '518224:135', 'triangle-top' => '518359:131', 'unchecked' => '518490:124', 'upload' => '518614:117', 'usd' => '518731:111', 'user' => '518842:114', 'volume-down' => '518956:134', 'volume-off' => '519090:120', 'volume-up' => '519210:135', 'warning-sign' => '519345:116', 'wrench' => '519461:123', 'xbt' => '519584:111', 'yen' => '519695:111', 'zoom-in' => '519806:124', 'zoom-out' => '519930:125' ), 'renderLabels_lang' => array ( 'aa' => '520055:133', 'ab' => '520188:150', 'ae' => '520338:143', 'af' => '520481:150', 'ak' => '520631:134', 'am' => '520765:149', 'an' => '520914:148', 'ar' => '521062:148', 'as' => '521210:159', 'av' => '521369:143', 'ay' => '521512:139', 'az' => '521651:157', 'ba' => '521808:150', 'be' => '521958:165', 'bg' => '522123:157', 'bh' => '522280:156', 'bi' => '522436:144', 'bm' => '522580:147', 'bn' => '522727:151', 'bo' => '522878:158', 'br' => '523036:143', 'bs' => '523179:143', 'ca' => '523322:143', 'ce' => '523465:151', 'ch' => '523616:144', 'co' => '523760:139', 'cr' => '523899:145', 'cs' => '524044:138', 'cu' => '524182:181', 'cv' => '524363:148', 'cy' => '524511:139', 'da' => '524650:145', 'de' => '524795:141', 'dv' => '524936:158', 'dz' => '525094:151', 'ee' => '525245:135', 'el' => '525380:149', 'en' => '525529:116', 'eo' => '525645:148', 'es' => '525793:144', 'et' => '525937:143', 'eu' => '526080:139', 'fa' => '526219:144', 'ff' => '526363:138', 'fi' => '526501:144', 'fj' => '526645:152', 'fo' => '526797:144', 'fr' => '526941:144', 'fy' => '527085:140', 'ga' => '527225:142', 'gd' => '527367:154', 'gl' => '527521:141', 'gn' => '527662:146', 'gu' => '527808:159', 'gv' => '527967:136', 'ha' => '528103:148', 'he' => '528251:152', 'hi' => '528403:151', 'ho' => '528554:148', 'hr' => '528702:143', 'ht' => '528845:169', 'hu' => '529014:144', 'hy' => '529158:152', 'hz' => '529310:145', 'ia' => '529455:158', 'id' => '529613:160', 'ie' => '529773:158', 'ig' => '529931:132', 'ii' => '530063:149', 'ik' => '530212:143', 'in' => '530355:123', 'io' => '530478:130', 'is' => '530608:148', 'it' => '530756:144', 'iu' => '530900:158', 'iw' => '531058:117', 'ja' => '531175:146', 'ji' => '531321:76', 'jv' => '531397:146', 'ka' => '531543:160', 'kg' => '531703:138', 'ki' => '531841:142', 'kj' => '531983:150', 'kk' => '532133:149', 'kl' => '532282:158', 'km' => '532440:159', 'kn' => '532599:151', 'ko' => '532750:143', 'kr' => '532893:139', 'ks' => '533032:176', 'ku' => '533208:151', 'kv' => '533359:137', 'kw' => '533496:143', 'ky' => '533639:153', 'la' => '533792:137', 'lb' => '533929:165', 'lg' => '534094:140', 'li' => '534234:153', 'ln' => '534387:142', 'lo' => '534529:141', 'lt' => '534670:148', 'lu' => '534818:160', 'lv' => '534978:143', 'mg' => '535121:152', 'mh' => '535273:162', 'mi' => '535435:145', 'mk' => '535580:164', 'ml' => '535744:158', 'mn' => '535902:149', 'mo' => '536051:162', 'mr' => '536213:150', 'ms' => '536363:175', 'mt' => '536538:144', 'my' => '536682:159', 'na' => '536841:151', 'nb' => '536992:165', 'nd' => '537157:159', 'ne' => '537316:154', 'ng' => '537470:145', 'nl' => '537615:146', 'nn' => '537761:169', 'no' => '537930:146', 'nr' => '538076:161', 'nv' => '538237:146', 'ny' => '538383:146', 'oc' => '538529:143', 'oj' => '538672:151', 'om' => '538823:137', 'or' => '538960:147', 'os' => '539107:147', 'pa' => '539254:154', 'pi' => '539408:143', 'pl' => '539551:141', 'ps' => '539692:141', 'pt' => '539833:123', 'qu' => '539956:145', 'rm' => '540101:156', 'rn' => '540257:138', 'ro' => '540395:143', 'ru' => '540538:148', 'rw' => '540686:158', 'sa' => '540844:162', 'sc' => '541006:140', 'sd' => '541146:148', 'se' => '541294:161', 'sg' => '541455:138', 'si' => '541593:155', 'sk' => '541748:147', 'sl' => '541895:152', 'sm' => '542047:147', 'sn' => '542194:139', 'so' => '542333:144', 'sq' => '542477:142', 'sr' => '542619:148', 'ss' => '542767:139', 'st' => '542906:155', 'su' => '543061:150', 'sv' => '543211:140', 'sw' => '543351:144', 'ta' => '543495:148', 'te' => '543643:152', 'tg' => '543795:146', 'th' => '543941:158', 'ti' => '544099:151', 'tk' => '544250:152', 'tl' => '544402:141', 'tn' => '544543:141', 'to' => '544684:146', 'tr' => '544830:141', 'ts' => '544971:139', 'tt' => '545110:142', 'tw' => '545252:130', 'ty' => '545382:148', 'ug' => '545530:147', 'uk' => '545677:160', 'ur' => '545837:137', 'uz' => '545974:144', 've' => '546118:138', 'vi' => '546256:158', 'vo' => '546414:146', 'wa' => '546560:139', 'wo' => '546699:136', 'xh' => '546835:136', 'yi' => '546971:149', 'yo' => '547120:142', 'za' => '547262:146', 'zh' => '547408:158', 'zu' => '547566:133' ), 'renderLabels_mime' => array ( 'audio' => '547699:113', 'compressed' => '547812:138', 'document' => '547950:120', 'image' => '548070:114', 'msexcel' => '548184:159', 'mspp' => '548343:180', 'msword' => '548523:155', 'pdf' => '548678:155', 'script' => '548833:148', 'text' => '548981:126', 'unknown' => '549107:155', 'video' => '549262:113' ), 'renderLabels_msg' => array ( 'operation_canceled' => '549375:149', 'operation_choose' => '549524:147', 'operation_confirm' => '549671:148', 'required_field' => '549819:161' ), 'renderLabels_navigation' => array ( 'downloads' => '549980:173', 'first' => '550153:124', 'last' => '550277:121', 'next' => '550398:122', 'plays' => '550520:161', 'previous' => '550681:127', 'up' => '550808:118' ), 'renderLabels_personalite' => array ( 'align' => '550926:128', 'align_center' => '551054:132', 'align_float_left' => '551186:141', 'align_float_right' => '551327:141', 'align_inline' => '551468:142', 'align_left' => '551610:123', 'align_right' => '551733:123', 'apply_to' => '551856:107', 'apply_to_default' => '551963:126', 'apply_to_module' => '552089:145', 'caption' => '552234:109', 'color' => '552343:119', 'font' => '552462:120', 'img' => '552582:122', 'img_display' => '552704:127', 'img_display_big' => '552831:126', 'img_display_big_click' => '552957:152', 'img_display_mini' => '553109:121', 'img_display_mini_click' => '553230:141', 'list' => '553371:104', 'margin_bottom' => '553475:141', 'margin_left' => '553616:139', 'margin_right' => '553755:139', 'margin_top' => '553894:138', 'menu_active' => '554032:131', 'menu_focus' => '554163:135', 'menu_item' => '554298:117', 'menu_virtual' => '554415:135', 'paragraph' => '554550:129', 'tab_img' => '554679:122', 'tab_position' => '554801:130', 'undefined' => '554931:129' ), 'renderLabels_system' => array ( 'assistant_close' => '555060:279', 'assistant_open' => '555339:199', 'editor_flag_green' => '555538:184', 'editor_flag_red' => '555722:191', 'instructor_icon' => '555913:148', 'instructor_image' => '556061:148', 'instructor_next_icon' => '556209:160', 'instructor_pause_icon' => '556369:158', 'instructor_play_icon' => '556527:168', 'panel_left_close' => '556695:151', 'panel_left_open' => '556846:153', 'panel_right_close' => '556999:151', 'panel_right_open' => '557150:153', 'panel_top_close' => '557303:150', 'panel_top_open' => '557453:152' ), 'section' => array ( 'contentEdit' => '557605:180', 'edit' => '557785:698', 'editAccess' => '558483:500', 'editAccessAdmin' => '558983:202', 'editAccessAll' => '559185:166', 'editAccessMember' => '559351:213', 'editAccessSubscribed' => '559564:196', 'editCaption' => '559760:455', 'editCaptionRequired' => '560215:461', 'editContent' => '560676:391', 'editDescription' => '561067:251', 'editGroup' => '561318:226', 'editGroupNone' => '561544:125', 'editImg' => '561669:284', 'editKeywords' => '561953:230', 'editKeywordsPack' => '562183:61', 'editName' => '562244:257', 'editTitle' => '562501:249', 'editUpdated' => '562750:210', 'imgRemove' => '562960:156', 'imgRemoveConfirm' => '563116:454', 'moveDown' => '563570:84', 'moveUp' => '563654:82', 'remove' => '563736:140', 'removeConfirm' => '563876:644', 'specialFieldsOnEdit' => '564520:124' ), 'section_create' => array ( 'content' => '564644:256', 'contextNew' => '564900:132', 'contextNewMain' => '565032:141', 'edit' => '565173:552', 'editCaptionHidden' => '565725:330', 'editContent' => '566055:391', 'editDescription' => '566446:251', 'editKeywordsPack' => '566697:61', 'editNameHidden' => '566758:176', 'editTitle' => '566934:249', 'helpNavigate' => '567183:852', 'specialFieldsAfterCreate' => '568035:166', 'specialFieldsOnCreate' => '568201:133' ), 'sectionBlog' => array ( 'editComment' => '568334:579', 'editCommentDisabled' => '568913:179', 'helpAbout' => '569092:844', 'helpCreate' => '569936:699', 'helpDone' => '570635:160', 'helpNavigate' => '570795:699', 'reindex' => '571494:390', 'reindexList' => '571884:240', 'specialFieldsOnEdit' => '572124:51' ), 'sectionBlog_create' => array ( 'blog' => '572175:377', 'blogPreset' => '572552:55', 'events' => '572607:412', 'eventsPreset' => '573019:90', 'galery' => '573109:421', 'galeryPreset' => '573530:90', 'news' => '573620:384', 'newsPreset' => '574004:88', 'podcast' => '574092:371', 'podcastPreset' => '574463:91', 'specialFieldsOnCreate' => '574554:62', 'videocast' => '574616:408', 'videocastPreset' => '575024:93' ), 'sectionBlog_post' => array ( 'contextNew' => '575117:128', 'edit' => '575245:636', 'editCaption' => '575881:367', 'editCaptionHidden' => '576248:408', 'editContent' => '576656:394', 'editDescription' => '577050:316', 'editImg' => '577366:284', 'editKeywords' => '577650:300', 'editKeywordsPack' => '577950:67', 'editName' => '578017:196', 'editNameHidden' => '578213:237', 'editTitle' => '578450:361', 'editTitleRequired' => '578811:445', 'editUpdated' => '579256:210', 'imgRemove' => '579466:152', 'msgImgRemoveConfirm' => '579618:450', 'msgRemoveConfirm' => '580068:462', 'new' => '580530:552', 'remove' => '581082:136' ), 'sectionCarte' => array ( 'helpAbout' => '581218:595', 'helpDone' => '581813:253', 'listAdmin' => '582066:643', 'week' => '582709:506' ), 'sectionCarte_all' => array ( 'content' => '583215:235', 'list' => '583450:760' ), 'sectionCarte_create' => array ( 'content' => '584210:445', 'contentPreset' => '584655:56' ), 'sectionCarte_division' => array ( 'content' => '584711:241', 'contextMoveDown' => '584952:137', 'contextMoveUp' => '585089:134', 'contextNew' => '585223:137', 'edit' => '585360:522', 'editCaptionHidden' => '585882:408', 'editNameHidden' => '586290:237', 'editTitle' => '586527:361', 'editTitleRequired' => '586888:445', 'new' => '587333:532', 'remove' => '587865:143', 'removeConfirm' => '588008:553' ), 'sectionCarte_post' => array ( 'contextNew' => '588561:130', 'edit' => '588691:586', 'editCaptionHidden' => '589277:408', 'editContent' => '589685:394', 'editDescription' => '590079:360', 'editDivision' => '590439:242', 'editImg' => '590681:284', 'editKeywordsPack' => '590965:67', 'editNameHidden' => '591032:237', 'editTitle' => '591269:361', 'editTitleRequired' => '591630:445', 'editUpdated' => '592075:210', 'new' => '592285:517', 'remove' => '592802:136', 'removeConfirm' => '592938:462' ), 'sectionCarte_select' => array ( 'content' => '593400:245', 'select' => '593645:1586' ), 'sectionCarte_store' => array ( 'content' => '595231:215', 'edit' => '595446:97', 'editDays' => '595543:83', 'list' => '595626:479', 'listDish' => '596105:120', 'listIngredient' => '596225:134', 'listQuantity' => '596359:130' ), 'sectionCategories' => array ( 'helpAbout' => '596489:414', 'helpInstructor' => '596903:181' ), 'sectionCategories_create' => array ( 'content' => '597084:404', 'contentPreset' => '597488:700' ), 'sectionFolder' => array ( 'helpAbout' => '598188:890' ), 'sectionFolder_create' => array ( 'content' => '599078:408', 'contentPreset' => '599486:248' ), 'sectionFormulary' => array ( 'editMail' => '599734:233', 'fields' => '599967:410', 'fieldsList' => '600377:240', 'helpAbout' => '600617:566', 'helpInstructor' => '601183:177', 'review' => '601360:335', 'security' => '601695:591', 'securityAccess' => '602286:597', 'securityBasics' => '602883:556', 'securityBasicsEnable' => '603439:313', 'securityContent' => '603752:468', 'securityContentUrlBlock' => '604220:304', 'securityReview' => '604524:408', 'securityReviewEnable' => '604932:272', 'specialFieldsOnEdit' => '605204:47' ), 'sectionFormulary_create' => array ( 'contact' => '605251:434', 'contactPreset' => '605685:987', 'formulary' => '606672:534', 'formularyPreset' => '607206:60', 'specialFieldsOnCreate' => '607266:64' ), 'sectionFormulary_done' => array ( 'content' => '607330:544', 'custom' => '607874:291', 'edit' => '608165:664', 'editCaption' => '608829:378', 'editContent' => '609207:422', 'editRecognizeEcolabore' => '609629:343', 'editRecognizeHTML' => '609972:296', 'editRecognizeParagraphs' => '610268:335', 'editTitle' => '610603:310', 'editUpdated' => '610913:210', 'restore' => '611123:303' ), 'sectionFormulary_received' => array ( 'content' => '611426:467', 'list' => '611893:246', 'listNew' => '612139:127' ), 'sectionFormulary_record' => array ( 'content' => '612266:219', 'remove' => '612485:139' ), 'sectionFormulary_removed' => array ( 'content' => '612624:251' ), 'sectionFormulary_statistics' => array ( 'content' => '612875:245', 'list' => '613120:1133' ), 'sectionGlossary' => array ( 'helpAbout' => '614253:613', 'helpInstructor' => '614866:178' ), 'sectionGlossary_create' => array ( 'content' => '615044:399', 'contentPreset' => '615443:731' ), 'sectionRedirect' => array ( 'content' => '616174:588', 'editURL' => '616762:325', 'helpAbout' => '617087:518', 'specialFieldsOnEdit' => '617605:46' ), 'sectionRedirect_create' => array ( 'content' => '617651:472', 'contentPreset' => '618123:59', 'specialFieldsOnCreate' => '618182:62' ), 'sectionSearch' => array ( 'helpAbout' => '618244:255', 'helpInstructor' => '618499:176' ), 'sectionSearch_create' => array ( 'content' => '618675:410', 'contentPreset' => '619085:390' ), 'sectionSubdomains' => array ( 'helpAbout' => '619475:451', 'helpInstructor' => '619926:139', 'list' => '620065:172' ), 'sectionSubdomains_create' => array ( 'content' => '620237:419', 'contentPreset' => '620656:447' ), 'sectionTerms' => array ( 'helpAbout' => '621103:685', 'helpInstructor' => '621788:133' ), 'sectionTerms_create' => array ( 'content' => '621921:501', 'contentPreset' => '622422:455' ), 'system' => array ( 'accessDenied' => '622877:1074', 'error' => '623951:618', 'maintenance' => '624569:795', 'overload' => '625364:643', 'resourceDenied' => '626007:755', 'sessionRestore' => '626762:796' ), 'systemConstants' => array ( 'adminCaption' => '627558:562', 'adminGender' => '628120:780', 'adminGenderFemale' => '628900:173', 'adminGenderMale' => '629073:173', 'adminHelpers' => '629246:928', 'adminIdentifier' => '630174:824', 'adminMail' => '630998:992', 'adminPassword' => '631990:893', 'adminPassword2' => '632883:133', 'chrFns' => '633016:664', 'databaseClient' => '633680:883', 'databaseClientMysql' => '634563:172', 'databaseClientSqlite' => '634735:175', 'databaseDb' => '634910:357', 'databaseDisplayErrors' => '635267:986', 'databaseEnabled' => '636253:1021', 'databaseEnabledDisabled' => '637274:424', 'databaseEnabledFailed' => '637698:379', 'databaseEnabledSuccess' => '638077:313', 'databaseHost' => '638390:346', 'databaseLogErrors' => '638736:671', 'databasePassword' => '639407:359', 'databasePrefix' => '639766:979', 'databaseUser' => '640745:349', 'filterFlagError' => '641094:448', 'filterFolderError' => '641542:402', 'filterFolderExists' => '641944:425', 'pathDatabase' => '642369:862', 'pathDomains' => '643231:735', 'pathEngine' => '643966:774', 'pathLibrary' => '644740:823', 'pathProfiles' => '645563:784', 'pathShared' => '646347:926', 'smtpEnable' => '647273:923', 'smtpFrom' => '648196:341', 'smtpHost' => '648537:340', 'smtpPassword' => '648877:351', 'smtpPort' => '649228:337', 'smtpTTL' => '649565:369', 'smtpUser' => '649934:339', 'systemAdminUri' => '650273:1372', 'systemDefaultCharset' => '651645:1214', 'systemDefaultCharsetIso88591' => '652859:225', 'systemDefaultCharsetUtf8' => '653084:142', 'systemDefaultDomainName' => '653226:1079', 'systemDefaultLanguage' => '654305:753', 'systemDisplayErrors' => '655058:971', 'systemEnableUserDomains' => '656029:810', 'systemEnableUserSubscriptions' => '656839:832', 'systemHost' => '657671:712', 'systemHostingMode' => '658383:1923', 'systemHostingModePortal' => '660306:178', 'systemHostingModeSingle' => '660484:181', 'systemHostingModeSubfolders' => '660665:189', 'systemHttpsRedirect' => '660854:1270', 'systemLogErrors' => '662124:791', 'systemMaintenance' => '662915:432', 'systemPackedMapFirst' => '663347:1316', 'systemPackedSharedFirst' => '664663:1238', 'systemProfilesUri' => '665901:1296', 'systemProjectCaption' => '667197:773', 'systemProjectRef' => '667970:801', 'systemSessionCacheExpire' => '668771:1064', 'systemSessionTTL' => '669835:790', 'systemTimeLimit' => '670625:905', 'systemTimezone' => '671530:13393', 'trackingEnable' => '684923:1574', 'trackingGeoipCache' => '686497:907', 'trackingGeoipCache1month' => '687404:166', 'trackingGeoipCache3months' => '687570:169', 'trackingGeoipCache6months' => '687739:169', 'trackingGeoipCacheNoExpire' => '687908:174', 'trackingGeoipEnable' => '688082:871', 'trackingGeoipService' => '688953:1038', 'trackingRemovedPages' => '689991:725', 'trackingStoreFullBacktrace' => '690716:1097' ), 'systemFormulary' => array ( 'alertConfigurationRestored' => '691813:182', 'alertConfigurationSaved' => '691995:156', 'alertDataUpdated' => '692151:347', 'alertFilenameInvalid' => '692498:858', 'alertFlagInvalid' => '693356:702', 'alertImgNotUploaded' => '694058:759', 'alertInternalError' => '694817:385', 'alertRequiredField' => '695202:556', 'alertRobotsPrevent' => '695758:535', 'alertUnexpectedError' => '696293:870', 'clearLanguage' => '697163:222', 'clearLanguageConfirm' => '697385:584', 'filterAlphanumericError' => '697969:1473', 'filterAlphanumericHelp' => '699442:575', 'filterArrayError' => '700017:795', 'filterArrayHelp' => '700812:856', 'filterAudioHelp' => '701668:961', 'filterAudioNotUploaded' => '702629:733', 'filterBlockError' => '703362:623', 'filterBlockHelp' => '703985:486', 'filterColorError' => '704471:841', 'filterColorHelp' => '705312:600', 'filterConfirmWithOkError' => '705912:527', 'filterCssHelp' => '706439:889', 'filterFlagError' => '707328:498', 'filterFreeHelp' => '707826:403', 'filterJsHelp' => '708229:871', 'filterMailError' => '709100:597', 'filterMailSingle' => '709697:485', 'filterPasswordInvalidCharacter' => '710182:689', 'filterPasswordRepeatError' => '710871:393', 'filterPasswordRequired' => '711264:373', 'filterPhoneError' => '711637:790', 'filterTimestampEventAfter' => '712427:755', 'filterTimestampEventInvalid' => '713182:614', 'filterWordHelp' => '713796:889' ), 'systemFormulary_form' => array ( 'add' => '714685:149', 'back' => '714834:153', 'cancel' => '714987:155', 'close' => '715142:154', 'continue' => '715296:155', 'create' => '715451:153', 'end' => '715604:86', 'finish' => '715690:153', 'formularyIdCrash' => '715843:431', 'go' => '716274:149', 'next' => '716423:151', 'previous' => '716574:159', 'previousFinish' => '716733:118', 'previousNext' => '716851:116', 'previousSubmit' => '716967:118', 'refresh' => '717085:154', 'refreshNext' => '717239:148', 'remove' => '717387:155', 'restore' => '717542:157', 'save' => '717699:151', 'saveCancel' => '717850:147', 'saveCancelRemove' => '717997:165', 'saveClose' => '718162:146', 'separator' => '718308:60', 'start' => '718368:90', 'submit' => '718458:153', 'submitCancel' => '718611:149' ), 'systemInstallation' => array ( 0 => '718760:248', '0description' => '719008:189', 1 => '719197:247', '1description' => '719444:184', 2 => '719628:133', '2description' => '719761:665', 'accessDenied' => '720426:1009', 'adminCaption' => '721435:508', 'adminGender' => '721943:793', 'adminIdentifier' => '722736:807', 'adminMail' => '723543:975', 'adminPassword' => '724518:928', 'adminPassword2' => '725446:247', 'index' => '725693:281', 'systemHostingMode' => '725974:1877', 'systemHostingModeMultiple' => '727851:352', 'systemHostingModeSingle' => '728203:238', 'systemHttpsRedirect' => '728441:1649', 'systemRewriteEngine' => '730090:2470', 'templateForConfig' => '732560:146' ), 'tool' => array ( 'main' => '732706:574', 'template' => '733280:1606' ), 'user' => array ( 'content' => '734886:489' ), 'user_admin' => array ( 'content' => '735375:695' ), 'user_anonimous' => array ( 'content' => '736070:127' ), 'user_default' => array ( 'content' => '736197:612' ), 'user_index' => array ( 'content' => '736809:489' ), 'userAlert' => array ( 'alertNewMessage' => '737298:289', 'alertSurvey' => '737587:675', 'disabledF' => '738262:675', 'disabledM' => '738937:679', 'editCaption' => '739616:293', 'editGender' => '739909:344', 'editGenderFemale' => '740253:118', 'editGenderMale' => '740371:119', 'editGenderUndefined' => '740490:199', 'editMail' => '740689:252', 'editTitle' => '740941:287', 'main' => '741228:125', 'module' => '741353:289', 'update' => '741642:773', 'updateDone' => '742415:601', 'updateError' => '743016:864', 'updateForm' => '743880:284', 'welcome' => '744164:884', 'welcomeToProfile' => '745048:852' ), 'userHome_default' => array ( 'content' => '745900:410' ), 'userHome_index' => array ( 'content' => '746310:444', 'recents' => '746754:768' ), 'userHome_password' => array ( 'alertPasswordChanged' => '747522:384', 'content' => '747906:421', 'edit' => '748327:211', 'editRecoverPassword' => '748538:207', 'msgInvalidToken' => '748745:487', 'msgPasswordRecovered' => '749232:452' ), 'userHome_personal' => array ( 'alertDataUpdated' => '749684:393', 'content' => '750077:419', 'edit' => '750496:236', 'editCaption' => '750732:293', 'editDescription' => '751025:327', 'editMail' => '751352:272', 'editSecurity' => '751624:304', 'editSecurityDescription' => '751928:326', 'editTitle' => '752254:290' ), 'userJoin' => array ( 'alertWelcome' => '752544:686', 'content' => '753230:541', 'editDescription' => '753771:321', 'editMail' => '754092:272', 'editTermsAgree' => '754364:340', 'editTermsView' => '754704:72', 'editTitle' => '754776:290', 'helpDescription' => '755066:82', 'page0' => '755148:534', 'page1' => '755682:429', 'page1previous' => '756111:312', 'page2' => '756423:363' ), 'userRecoverPassword' => array ( 'content' => '756786:535', 'edit' => '757321:104', 'editAdminMailNotFound' => '757425:605', 'editAdminNotFound' => '758030:388', 'editIdentifier' => '758418:250', 'messageTemplate' => '758668:1539', 'msgMailSent' => '760207:842' ) ), 's' => array ( 'blocks/help' => array ( '_block' => '761049:279' ), 'blocks/personalite' => array ( '_block' => '761328:245', '_block.old' => '761573:256' ), 'details/button_caption' => array ( '_block' => '761829:390', '_description' => '762219:141' ), 'details/button_icon_caption' => array ( '_block' => '762360:491', '_description' => '762851:158' ), 'details/button_title' => array ( '_block' => '763009:359', '_description' => '763368:138' ), 'details/caption' => array ( '_block' => '763506:151', '_description' => '763657:117' ), 'details/caption_icon' => array ( '_block' => '763774:469', '_description' => '764243:136' ), 'details/content' => array ( '_block' => '764379:336', '_description' => '764715:118' ), 'details/description' => array ( '_block' => '764833:314', '_description' => '765147:124' ), 'details/img' => array ( '_block' => '765271:687', '_description' => '765958:114' ), 'details/img_mini' => array ( '_block' => '766072:809', '_description' => '766881:121' ), 'details/img_mini_title_description' => array ( '_block' => '767002:1347', '_description' => '768349:182' ), 'details/info_hits' => array ( '_block' => '768531:87', '_description' => '768618:122' ), 'details/info_owner' => array ( '_block' => '768740:172', '_description' => '768912:140' ), 'details/info_posted' => array ( '_block' => '769052:122', '_description' => '769174:138' ), 'details/info_posted_datetime' => array ( '_block' => '769312:134', '_description' => '769446:154' ), 'details/info_posted_elapsed' => array ( '_block' => '769600:104', '_description' => '769704:154' ), 'details/info_updated' => array ( '_block' => '769858:134', '_description' => '769992:142' ), 'details/media_audio' => array ( '_block' => '770134:471', '_description' => '770605:157' ), 'details/media_file' => array ( '_block' => '770762:306', '_description' => '771068:136' ), 'details/media_video' => array ( '_block' => '771204:248', '_description' => '771452:135' ), 'details/subitems' => array ( '_block' => '771587:96' ), 'details/title_1' => array ( '_block' => '771683:429', '_description' => '772112:126' ), 'details/title_2' => array ( '_block' => '772238:150', '_description' => '772388:126' ), 'details/title_3' => array ( '_block' => '772514:150', '_description' => '772664:126' ), 'details/title_4' => array ( '_block' => '772790:434', '_description' => '773224:126' ), 'details/title_5' => array ( '_block' => '773350:434', '_description' => '773784:126' ), 'details/title_6' => array ( '_block' => '773910:434', '_description' => '774344:126' ), 'fields/interactive' => array ( 'checkbox_create' => '774470:300', 'description' => '774770:82', 'end_create' => '774852:318', 'end_view' => '775170:37', 'radio_create' => '775207:381', 'select_create' => '775588:368', 'separator' => '775956:71', 'start_create' => '776027:633', 'start_view' => '776660:47', 'text' => '776707:304', 'text_small' => '777011:295', 'text_tiny' => '777306:294', 'textarea' => '777600:310', 'textarea_big' => '777910:356', 'textarea_small' => '778266:310', 'view' => '778576:201', 'view_pre' => '778777:220' ), 'fields/table' => array ( 'address' => '778997:1881', 'address_view' => '780878:391', 'apearance' => '781269:2594', 'audit' => '783863:2496', 'audit_view' => '786359:1536', 'checkbox' => '787895:361', 'checkbox_group' => '788256:377', 'color' => '788633:1748', 'color_testable' => '790381:2742', 'content' => '793123:170', 'content_box' => '793293:260', 'date' => '793553:639', 'date_daily_event' => '794192:2107', 'date_daily_event_view' => '796299:758', 'date_event' => '797057:2926', 'date_event_view' => '799983:830', 'date_select' => '800813:909', 'datetime' => '801722:1427', 'end' => '803149:144', 'fields' => '803293:47', 'fieldset' => '803340:213', 'file' => '803553:292', 'file_big' => '803845:1565', 'font' => '805410:1355', 'install_getstatus' => '806765:341', 'links_list' => '807106:271', 'list' => '807377:1856', 'paragraph' => '809233:1363', 'phone' => '810596:684', 'popup' => '811280:1164', 'radio' => '812444:282', 'range' => '812726:308', 'select' => '813034:368', 'select_dinamic' => '813402:6606', 'select_dinamic_multiple' => '820008:1258', 'select_fields' => '821266:6914', 'select_fields_manager' => '828180:6627', 'select_list' => '834807:402', 'select_radio' => '835209:357', 'select_submit' => '835566:491', 'separator' => '836057:71', 'start' => '836128:190', 'submit' => '836318:449', 'text' => '836767:304', 'text_password' => '837071:291', 'text_small' => '837362:295', 'text_tiny' => '837657:294', 'text_tiny_leftfield' => '837951:282', 'textarea' => '838233:310', 'textarea_big' => '838543:337', 'textarea_full' => '838880:337', 'textarea_small' => '839217:310', 'time_select' => '839527:680', 'topic' => '840207:264', 'view' => '840471:311' ), 'layouts/clean' => array ( '_block' => '840782:236' ), 'layouts/default' => array ( '_block' => '841018:326' ), 'layouts/dialog' => array ( '_block' => '841344:93' ), 'lists/box' => array ( '_block' => '841437:156' ), 'lists/comments' => array ( '_block' => '841593:96' ), 'lists/default' => array ( '_block' => '841689:610' ), 'lists/details' => array ( '_block' => '842299:42' ), 'lists/dinamic_slideshow' => array ( '_block' => '842341:3158', '_description' => '845499:286', 'slideHeight' => '845785:259', 'slideSleep' => '846044:278', 'slideSpeed' => '846322:298', 'slideWidth' => '846620:257', 'tabSlide' => '846877:307' ), 'lists/formulary' => array ( '_block' => '847184:38' ), 'lists/html' => array ( '_block' => '847222:31' ), 'lists/interactive' => array ( '_block' => '847253:44' ), 'lists/list_big_buttons' => array ( '_block' => '847297:330', '_description' => '847627:334' ), 'lists/list_columns_1' => array ( '_block' => '847961:90', '_description' => '848051:304' ), 'lists/list_columns_2' => array ( '_block' => '848355:262', '_description' => '848617:307' ), 'lists/list_formulary' => array ( '_block' => '848924:89' ), 'lists/list_thumbnails' => array ( '_block' => '849013:301', '_description' => '849314:307' ), 'lists/menu_box_horizontal' => array ( '_block' => '849621:293', '_description' => '849914:307', 'align' => '850221:376', 'alignCenter' => '850597:176', 'alignLeft' => '850773:165', 'alignRight' => '850938:166', 'colorBackground' => '851104:215', 'colorItem' => '851319:191', 'display' => '851510:358', 'fontMenuItem' => '851868:190', 'lengthBorderRadius' => '852058:253', 'lengthMargin' => '852311:332', 'lengthPadding' => '852643:356', 'lengthWidth' => '852999:316', 'tabColors' => '853315:262', 'tabLength' => '853577:336' ), 'lists/menu_box_rows' => array ( '_block' => '853913:972', '_description' => '854885:283' ), 'lists/menu_box_vertical' => array ( '_block' => '855168:324', '_description' => '855492:303' ), 'lists/menu_list_vertical' => array ( '_block' => '855795:174', '_description' => '855969:300' ), 'lists/menu_simple_horizontal' => array ( '_block' => '856269:152', '_description' => '856421:304' ), 'lists/menu_simple_vertical' => array ( '_block' => '856725:91', '_description' => '856816:300' ), 'lists/table' => array ( '_block' => '857116:383', '_description' => '857499:293' ), 'lists/table_printed_boxes' => array ( '_block' => '857792:826', '_description' => '858618:351', 'colorCellBackground' => '858969:312', 'colorCellBorder' => '859281:306', 'colorCellText' => '859587:294', 'colorTableBackground' => '859881:301', 'colorTableBorder' => '860182:295', 'measureCellBorder' => '860477:321', 'measureCellMinHeight' => '860798:319', 'measureCellPadding' => '861117:323', 'measureTableBorder' => '861440:310', 'measureTablePadding' => '861750:292', 'tabColors' => '862042:339', 'tabMeasures' => '862381:352', 'tabText' => '862733:265', 'textFont' => '862998:269', 'textParagraph' => '863267:294', 'textVerticalAlign' => '863561:445', 'textVerticalAlignBottom' => '864006:165', 'textVerticalAlignMiddle' => '864171:167', 'textVerticalAlignTop' => '864338:159' ), 'lists/table_simple' => array ( '_block' => '864497:55', '_description' => '864552:287' ) ), 'f' => array ( 'icons/editor' => array ( 'flag_green.svg' => '864839:909', 'flag_red.svg' => '865748:640', 'insert_a.svg' => '866388:1022', 'insert_h1.svg' => '867410:1707', 'insert_h2.svg' => '869117:2906', 'insert_h3.svg' => '872023:4076', 'insert_hr.svg' => '876099:796', 'insert_img.svg' => '876895:2773', 'insert_la.svg' => '879668:12550', 'insert_lo.svg' => '892218:2156', 'insert_lu.svg' => '894374:682', 'insert_p.svg' => '895056:553', 'insert_table.svg' => '895609:1635', 'next.svg' => '897244:396', 'pause.svg' => '897640:394', 'pen.png' => '898034:3556', 'pen.svg' => '901590:1931', 'personalite.svg' => '903521:1554', 'play.svg' => '905075:353' ), 'icons/humperstilshen' => array ( 'alert.png' => '905428:18219', 'crash.png' => '923647:11061', 'default.png' => '934708:10383', 'error.png' => '945091:9283', 'happy.png' => '954374:9594', 'next.svg' => '963968:530', 'question.png' => '964498:10254', 'tip.png' => '974752:8695', 'welcome.png' => '983447:10383', 'whait.png' => '993830:12007' ), 'icons/tools' => array ( 'add.svg' => '1005837:249', 'blank.gif' => '1006086:68', 'book16.gif' => '1006154:1327', 'book32.gif' => '1007481:1761', 'book64.gif' => '1009242:2134', 'configure.svg' => '1011376:222', 'down16.gif' => '1011598:1293', 'down32.gif' => '1012891:1842', 'download16.gif' => '1014733:1284', 'download32.gif' => '1016017:1859', 'download64.gif' => '1017876:2837', 'ecolabore-flower.svg' => '1020713:1270', 'ecolabore-glifs.svg' => '1021983:1247', 'file16.gif' => '1023230:1344', 'file32.gif' => '1024574:1739', 'file64.gif' => '1026313:2533', 'folder16.gif' => '1028846:1365', 'folder32.gif' => '1030211:1819', 'folder64.gif' => '1032030:1819', 'help.gif' => '1033849:1885', 'help16.gif' => '1035734:1307', 'help32.gif' => '1037041:1885', 'help64.gif' => '1038926:2540', 'home16.gif' => '1041466:1271', 'home32.gif' => '1042737:1964', 'home64.gif' => '1044701:3100', 'index16.gif' => '1047801:1325', 'index32.gif' => '1049126:1814', 'index64.gif' => '1050940:2162', 'info16.gif' => '1053102:1331', 'info32.gif' => '1054433:1927', 'info64.gif' => '1056360:3013', 'mail16.gif' => '1059373:1391', 'mail32.gif' => '1060764:1876', 'mail64.gif' => '1062640:2380', 'next16.gif' => '1065020:1303', 'next32.gif' => '1066323:1842', 'previous16.gif' => '1068165:1305', 'previous32.gif' => '1069470:1836', 'print16.gif' => '1071306:1292', 'print32.gif' => '1072598:1871', 'print64.gif' => '1074469:2497', 'remove.svg' => '1076966:205', 'top16.gif' => '1077171:1288', 'top32.gif' => '1078459:1842', 'up16.gif' => '1080301:1270', 'up32.gif' => '1081571:1891' ), 'lists/dinamic_slideshow' => array ( 'blue.txt' => '1083462:853', 'colors.txt' => '1084315:619' ), 'scripts' => array ( 'ecolabore-editor.js' => '1084934:28860', 'ecolabore-humperstilshen.js' => '1113794:3977', 'ecolabore-instructor.js' => '1117771:4334' ), 'styles' => array ( 'ecolabore-basics.css' => '1122105:20901', 'ecolabore-print.css' => '1143006:909' ) ) ); //!packager:end_of_data_index //!file:engine/eclClass/eclClass_app.php; class eclClass_app { // class eclClass_app static function is_child ($me, $name) { // function is_child return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclClass_app //!eof:engine/eclClass/eclClass_app.php; //!file:engine/eclClass/eclClass_filter.php; class eclClass_filter { // class eclClass_filter static function create ($fieldName, $control, $formulary) { // function create } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclClass_filter //!eof:engine/eclClass/eclClass_filter.php; //!file:engine/eclClass/eclClass_interactive.php; class eclClass_interactive { // class eclClass_interactive static function create ($fieldName, $control, $formulary) { // function create } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function interact () { // function interact } // function interact static function view () { // function view } // function view } // class eclClass_interactive //!eof:engine/eclClass/eclClass_interactive.php; //!file:engine/eclClass/eclClass_mod.php; class eclClass_mod { // class eclClass_mod public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule } // function setModule } // class eclClass_mod //!eof:engine/eclClass/eclClass_mod.php; //!file:engine/eclClass/eclClass_scope.php; class eclClass_scope { // class eclClass_scope static function get ($render) { // function get } // function get } // class eclClass_scope //!eof:engine/eclClass/eclClass_scope.php; //!file:engine/eclClass/eclClass_tag.php; class eclClass_tag { // class eclClass_tag static function render ($render, $arguments) { // function render return array (); } // function render } // class eclClass_tag //!eof:engine/eclClass/eclClass_tag.php; //!file:engine/eclEngine/eclEngine_application.php; class eclEngine_application { // class eclEngine_application public $applicationName; // O nome da aplicação que auxilia o objeto public $menuType; // A forma de listar este objeto no menu public $access = 0; // Quem pode ter acesso a este objeto public $isDomain = false; public $name; // O nome do objeto public $id = 0; // O ID deste objeto no banco de dados public $domainId = 0; // O ID do domínio ao qual este objeto pertence public $userId = 0; // O id do usuário caso o objeto se refira a um usuário public $parent; // O pai deste objeto public $map = array (); // O mapa de aplicações que podem gerar filhos deste objeto public $data = array (); // Os dados - o conteúdo do objeto public $ignoreSubfolders = false; // Ignora as subpastas informadas no endereço public $pathway = array (); // O caminho para este objeto public $groups = array (); // a hierarquia de grupos à qual este objeto pertence protected $magic = array (); // guardará os membros criados dinamicamente protected $childrenByName = array (); // Guardará os filhos chamados por nome public function __construct ($applicationName='system', $name='system', $parent=false) { // function __construct $this->applicationName = $applicationName; $this->name = $name; $this->parent = $parent; // Vamos anotar o caminho para este objeto if ($parent) { // parent present $this->pathway = $this->parent->pathway; $this->pathway[] = $this->name; // Vamos propagar propriedades herdadas $this->groups = $parent->groups; $this->access = $parent->access; $this->domainId = $parent->domainId; $this->userId = $parent->userId; } // parent present // Chama a classe de aplicação para auxiliar na construção $class = 'eclApp_' . $applicationName; $class::constructor_helper ($this); // menu $this->menuType = $class::get_menu_type ($this); } // function __construct public function getMap ($applicationName=false) { // function getMap global $systemMap; if ($applicationName == false) $applicationName = $this->applicationName; // com SYSTEM_PACKED_MAP_FIRST o mapa interno tem preferência if (SYSTEM_PACKED_MAP_FIRST and isset ($systemMap[$applicationName])) { // packed map first $this->map = $systemMap[$applicationName]; return; } // packed map first if (!isset ($systemMap[$applicationName])) { // open map $result = array (); $systemMap[$applicationName] = array (); list ($prefix) = explode ('_', $applicationName, 2); // O arquivo do mapa terá o mesmo nome da aplicação, seguido por ".txt" $file = FOLDER_LIBRARY . $prefix . '/app_' . $applicationName . '.txt'; if (is_file ($file)) { // open file $string = file_get_contents ($file); $array = explode (LF, $string); foreach ($array as $line) { // each line $line = trim ($line); if (preg_match ('%^[a-zA-Z0-9_]+$%', $line)) $result[] = $line; } // each line } // open file $systemMap[$applicationName] = $result; } // open map $this->map = $systemMap[$applicationName]; } // function getMap public function child ($name) { // function child if (isset ($this->childrenByName[$name])) return $this->childrenByName[$name]; // Será que os filhos já foram todos abertos? if (isset ($this->magic['children'])) return false; // Vamos percorrer o mapa, testando cada aplicação foreach ($this->map as $applicationName) { // each application $class = 'eclApp_' . $applicationName; if ($class::is_child ($this, $name)) { // child found $this->childrenByName[$name] = new eclEngine_application ($applicationName, $name, $this); return $this->childrenByName[$name]; } // child found } // each application // Não existe um filho com este nome return false; } // function child public function children () { // function children if (!isset ($this->magic['children'])) { // open children $this->magic['children'] = array (); foreach ($this->map as $applicationName) { // each application $class = 'eclApp_' . $applicationName; $names = $class::get_children_names ($this); foreach ($names as $name) { // each name // Se este filho não foi chamado pelo nome, crie-o if (!isset ($this->childrenByName[$name])) $this->childrenByName[$name] = new eclEngine_application ($applicationName, $name, $this); // Vamos copiá-lo para a lista em ordem de índice $this->magic['children'][] = $this->childrenByName[$name]; } // each name } // each application } // open children return $this->magic['children']; } // function children public function length () { // function length return count ($this->children ()); } // function length public function menuChildren ($document, $name=false) { // function menuChildren $menu = array (); if (!isset ($this->magic['children'])) { // open children foreach ($this->map as $applicationName) { // each application $class = 'eclApp_' . $applicationName; $menuType = $class::get_menu_type ($this); switch ($menuType) { // switch menu type case 'post': if (!$name or !$class::is_child ($this, $name)) break; if (!isset ($this->childrenByName[$name])) $this->childrenByName[$name] = new eclEngine_application ($applicationName, $name, $this); // Vamos copiá-lo para a lista em ordem de índice if ($document->access ($this->childrenByName[$name]->access, $this->childrenByName[$name]->groups)) $menu[] = $this->childrenByName[$name]; break; case 'hidden': case 'domain': break; case 'section': default: $names = (array)$class::get_children_names ($this); foreach ($names as $childName) { // each name // Se este filho não foi chamado pelo nome, crie-o if (!isset ($this->childrenByName[$childName])) $this->childrenByName[$childName] = new eclEngine_application ($applicationName, $childName, $this); // Vamos copiá-lo para a lista em ordem de índice if ($document->access ($this->childrenByName[$childName]->access, $this->childrenByName[$childName]->groups)) $menu[] = $this->childrenByName[$childName]; } // each name } // switch type } // each application return $menu; } // open children foreach ($this->children () as $child) { // each child if ($child->menuType == 'hidden') continue; if ($child->menuType == 'post' and $child->name != $name) continue; if (!$document->access ($child->access, $child->groups)) continue; $menu[] = $child; } // each child return $menu; } // function menuChildren public function reset () { // function reset $this->magic = array (); $this->childrenByName = array (); } // function reset public function __set ($name, $value) { // function __set $this->magic[$name] = $value; } // function __set public function __get ($name) { // function __get if (isset ($this->magic[$name])) { // existing value $return = $this->magic[$name]; return $return; } // existing value $value = $this->$name (); return $value; } // function __get public function ignoreSession ($set=123) { // function ignoreSession static $ignore = false; if ($set != 123) $ignore = $set; return $ignore; } // function ignoreSession public function flags () { // function flags if (!isset ($this->magic['flags'])) { // set flags // Esta classe tem um pai? if (is_object ($this->parent)) $this->magic['flags'] = $this->parent->flags (); else $this->magic['flags'] = array (); // Agora vamos fundir com as flags deste objeto - se houverem if (isset ($this->data['flags'])) { // merge flags if ($this->magic['flags']) $this->magic['flags'] = array_replace ($this->magic['flags'], $this->data['flags']); else $this->magic['flags'] = $this->data['flags']; } // merge flags } // set flags return $this->magic['flags']; } // function flags public function mod ($name) { // function mod $class = 'eclApp_' . $this->applicationName; if (is_callable ($class . '::get_module')) return $class::get_module ($this, $name); return $this->parent->mod ($name); } // function mod public function dispatch ($document) { // function dispatch $document->data = array_replace_recursive (array ('flags' => $this->flags ()), $this->data); $class = 'eclApp_' . $this->applicationName; $class::dispatch ($document); } // function dispatch public function remove () { // function remove foreach ($this->children () as $child) { // each child $child->remove (); } // each child $this->reset (); $class = 'eclApp_' . $this->applicationName; if (is_callable ($class . '::remove')) $class::remove ($this); } // function remove public function __call ($name, $args=array ()) { // function __call $class = 'eclApp_' . $this->applicationName; $name = 'object_' . $name; return $class::$name ($this, $args); } // function __call public function getVar ($name) { // function getVar if ($name[0] == '$') $name = substr ($name, 1); if (isset ($this->data[$name])) return $this->data[$name]; if (isset ($this->data['text'][$name])) return $this->data['text'][$name]; if (isset ($this->data['local'][$name])) return $this->data['local'][$name]; return false; } // function getVar public function findChild ($name) { // function findChild global $store, $system; if ($this->domainId) { // from domain $pathway = $store->domainContent->pathway ($this->domainId, $name); } // from domain elseif ($this->userId) { // from profile $pathway = $store->userContent->pathway ($this->userId, $name); } // from profile if ($pathway === false) return false; $me = $system; foreach ($pathway as $folder) { // loop folders $me = $me->child ($folder); if (!$me) return false; } // loop folders if (!$me) return false; return $me; } // function findChild } // class eclEngine_application //!eof:engine/eclEngine/eclEngine_application.php; //!file:engine/eclEngine/eclEngine_document.php; class eclEngine_document { // class eclEngine_document // O preenchimento destas propriedades determinará a geração do documento: public $mode = SYSTEM_HOSTING_MODE; public $protocol = 'http'; // string => the protocol used in the comunication public $host = 'localhost/'; // string => the main host public $pathway = array ('-blank'); // array => the pathway to route the application public $lang = false; // string | false => the language or auto define public $actions = array (); // array => the actions from url public $received = array (); // array => the posted data from formularies public $session = array (); // array => the session data $io->session->cache private $sid = 0; // o id da sessão private $cookie = true; // bool => If user agent accepts cookies public $rewriteEngine = false; // bool => if the Apache Rewrite Engine is enabled // Após o início da seção e do roteamento, estas propriedades estarão definidas: public $user; // object eclEngine_application => the user connected public $domain; // object eclEngine_application => the domain of this application public $subscription; // object eclEngine_application => the relationcheep between the user and the domain public $application; // object eclEngine_application => the application to be dispatched // Estas propriedades são preenchidas em __construct() com objetos auxiliares: public $render; // object eclEngine_render => the renderizer engine public $mod; // object eclEngine_mod => a loader for modules // Estas propriedades auxiliam no processamento da renderização: public $defaultLang; // string => the preferred language if $lang is not available public $charset; // string => the charset public $data = array (); // array is the main content of the document public $buffer = ''; // string => the output document to be sent public $ids = array (); // array ids used in HTML id property to prevent duplicated identifiers public $templateEditable = false; public $contentEditable = false; public $printableLayout = false; public $reload = false; public $preload = array (); // array eclEngine_application => an array with the applications to be dispatched before the main application public function __construct () { // function __construct $this->render = new eclEngine_render ($this); $this->mod = new eclEngine_mod ($this); } // function __construct public function __clone () { // function __clone $this->actions = array (); // array => the actions from url $this->received = array (); // array => the posted data from formularies $this->session = array (); // array => the session data $io->session->cache $this->mod = new eclEngine_mod ($this); $this->render = new eclEngine_render ($this); $this->data = array (); // array is the main content of the document $this->buffer = ''; // string => the output document to be sent $this->ids = array (); // array ids used in HTML id property to prevent duplicated identifiers $this->templateEditable = false; $this->contentEditable = false; $this->printableLayout = false; $this->reload = false; $this->preload = array (); // array eclEngine_application => an array with the applications to be dispatched before the main application } // function __clone public function route ($request=false) { // function route global $system; if (is_object ($request)) { // get request params $this->protocol = $request->protocol; $this->host = $request->host; $this->pathway = $request->pathway; $this->lang = $request->lang; $this->actions = $request->actions; $this->received = $request->received; $this->rewriteEngine = $request->rewriteEngine; } // get request params // Vamos procurar pelo nome do domínio $pathway = $this->pathway; $domainName = array_shift ($pathway); $this->domain = $system->child ($domainName); // Se o domínio não existir, vamos forçar a aplicação app_system_error if (!is_object ($this->domain)) $this->domain = $system->child ('-default'); if (!count ($pathway)) $pathway = array (''); // Vamos rotear as subpastas chamando outra função if ($this->domain->ignoreSubfolders == false) $this->application = $this->routeSubfolders ($this->domain, $pathway); else $this->application = $this->domain; // Se neste ponto não tivermos encontrado uma aplicação, novamente procuramos por uma aplicação padrão if (!is_object ($this->application)) { // force app_system_error $this->domain = $system->child ('-default'); $this->application = $this->domain; } // force app_system_error } // function route private function routeSubfolders ($me, $pathway) { // function routeSubfolders $application = false; $folder = array_shift ($pathway); $application = $me->child ($folder); // a aplicação foi encontrada if (is_object ($application)) { // route children // Se a aplicação ignorar subpastas, retornamos esta aplicação if ($application->ignoreSubfolders) return $application; // Se não houverem mais subpastas, retornamos esta aplicação if (!count ($pathway)) return $application; // Se ainda não retornamos, rotearemos a próxima subpasta $application = $this->routeSubfolders ($application, $pathway); // Se o roteamento encontrou uma aplicação, retornaremos daqui if (is_object ($application)) return $application; } // route children // Se o filho não existir, procuramos uma aplicação que responda por padrão $application = $me->child ('-default'); // Se não existir uma aplicação padrão, retornamos daqui if ($application === false) return false; // Se a aplicação ignorar subpastas, retornamos esta aplicação if ($application->ignoreSubfolders) return $application; // Se não houverem mais subpastas, retornamos esta aplicação if (!count ($pathway)) return $application; // Se ainda não retornamos, rotearemos a próxima subpasta return $this->routeSubfolders ($application, $pathway); } // function routeSubfolders public function sessionStart ($session=false) { // function sessionStart global $io, $store, $system; $this->user = $system->child (SYSTEM_PROFILES_URI)->child ('-anonimous'); $this->subscription = $system->child (SYSTEM_PROFILES_URI)->child ('-anonimous'); if ($this->application->ignoreSession ()) return; $this->session = &$session->cache; if (!defined ('ADMIN_IDENTIFIER') or !defined ('ADMIN_PASSWORD')) return; if (isset ($this->actions['logout'])) { // logout $this->session = array (); unset ($this->actions['logout']); } // logout elseif (isset ($this->actions['login'])) { // login // cookies disabled if (false) // (TRACKING_ENABLE and !isset ($this->session['requests'])) { // cookies disabled // set_time_limit (15 + SYSTEM_TIME_LIMIT); // sleep (15); $this->mod->humperstilshen->alert ('modLogin_alertCookiesRequired'); return; } // cookies disabled isset ($this->actions['login'][1]) ? $instance = $this->actions['login'][1] : $instance = '1'; isset ($this->received['login' . $instance . 'fields_name']) ? $name = strtolower ($this->received['login' . $instance . 'fields_name']) : $name = ''; isset ($this->received['login' . $instance . 'fields_password']) ? $password = strtolower ($this->received['login' . $instance . 'fields_password']) : $password = ''; if ($name == ADMIN_IDENTIFIER and md5 ($password) == ADMIN_PASSWORD) { // admin $user['name'] = ADMIN_IDENTIFIER; $user['id'] = true; $user['password'] = ADMIN_PASSWORD; } // admin elseif (defined ('DATABASE_ENABLED') and preg_match ('/^[a-z0-9_-]+$/', $name)) $user = $store->user->open ($name); else $user = array (); if (isset ($user['password']) and $user['password'] == md5 ($password)) { // login pass true $this->session['user_id'] = $user['id']; $this->session['user_name'] = $name; } // login pass true else { // invalid login $this->mod->humperstilshen->loginError = true; } // invalid login } // login elseif (isset ($this->session['time']) and $this->session['time'] + SYSTEM_SESSION_TTL < TIME) { // session expired $this->session = array (); } // session expired if (isset ($this->session['user_name']) and strlen ($this->session['user_name'])) { // connected $this->user = $system->child (SYSTEM_PROFILES_URI)->child ($this->session['user_name']); if ($subscription = $store->domainGroup->getUserSubscription ($this)) $this->subscription = $subscription; if (!isset ($this->session['time'])) { // first load $this->session['time'] = TIME; $this->preload[] = $this->user->child ('-login-alerts'); } // first load else { // else load $this->session['time'] = TIME; if (isset ($this->actions['loginform'])) $this->preload[] = $this->user->child ('-login-alerts'); } // else load } // connected } // function sessionStart public function dispatch () { // function dispatch global $system; // Antes de despachar a aplicação, definiremos o idioma if (isset ($this->domain->data['flags']['default_lang'])) $this->defaultLang = $this->domain->data['flags']['default_lang']; elseif (defined ('SYSTEM_DEFAULT_LANGUAGE')) $this->defaultLang = SYSTEM_DEFAULT_LANGUAGE; else $this->defaultLang = 'en'; if ($this->lang == false) $this->lang = $this->defaultLang; // Definiremos o conjunto de caractéres if (isset ($this->application->flags['default_charset'])) $this->charset = $this->application->flags['default_charset']; else $this->charset = SYSTEM_DEFAULT_CHARSET; // Layout para impressão if ($this->actions ('layout', 'print')) $this->printableLayout = true; // Caso o acesso seja restrito, desviaremos o controle para outra aplicação if (!$this->access ($this->application->access)) { // access denied $application = $system->child ('-access-denied'); $application->pathway = $this->application->pathway; $application->groups = $this->application->groups; $application->access = $this->application->access; $application->parent = $this->application->parent; $this->application = $application; } // access denied else { // normal access // busca por aplicações de alerta if (isset ($this->actions['alert']) and count ($this->actions['alert']) > 1) { // alert application array_shift ($this->actions['alert']); $alert = $system->child ('-alert'); foreach ($this->actions['alert'] as $name) { // loop names $alert = $alert->child ($name); if ($alert === false) break; if ($alert->ignoreSubfolders) break; } // loop names if ($alert !== false) $this->preload[] = $alert; } // alert application // busca por aplicações de alerta if (isset ($this->actions['preload']) and count ($this->actions['preload']) > 1) { // alert application array_shift ($this->actions['preload']); $preload = $system->child ('-preload'); foreach ($this->actions['preload'] as $name) { // loop names $preload = $preload->child ($name); if ($preload === false) break; if ($preload->ignoreSubfolders) break; } // loop names if ($preload !== false) $this->preload[] = $preload; } // alert application // rodaremos aplicações preliminares foreach ($this->preload as $application) { // each preload application $application->dispatch ($this); } // each preload application } // normal access // Finalmente, despacharemos a aplicação $this->application->dispatch ($this); } // function dispatch public function render () { // function render global $io, $store, $system; if (SYSTEM_HTTPS_REDIRECT and $this->protocol != 'https') $this->reload = $this->ref (true, true, true, 'https'); if ($this->reload) { // reload header ('Location: ' . $this->reload); $this->buffer = ''; } // reload if ($this->buffer != '') return; // Idioma e codificação $this->data['lang'] = $this->lang; $this->data['charset'] = $this->charset; // Data da geração do documento if (isset ($this->application->data['updated'])) $this->data['date'] = date ('c', $this->application->data['updated']); else $this->data['date'] = date ('c'); // Folha de estilo $template = $store->domainContent->open ($this->domain->domainId, '-layouts-default'); if (isset ($template['updated'])) $this->data['ref_stylesheet'] = $this->ref (array ($this->domain->name, '--style', 'ecolabore-generated-template-' . $template['updated'] . '.css'), false); else $this->data['ref_stylesheet'] = $this->ref (array ($this->domain->name, '--style', 'ecolabore-generated-template.css'), false); // Flags de acesso if ($this->access (1)) { // user is connected $this->data['user_is_connected'] = 1; if ($this->access (2)) { // user is subscribed $this->data['user_is_subscribed'] = 1; if ($this->access (3)) { // user is member $this->data['user_is_member'] = 1; if ($this->access (4)) $this->data['user_is_admin'] = 1; } // user is member } // user is subscribed } // user is connected // IP tracking if (TRACKING_ENABLE and ($this->application->id or (TRACKING_FULL_BACKTRACE and $this->received))) $store->tracking->register ($this); if ($this->contentEditable) $this->data['editor_is_enabled'] = 1; // Renderiza o documento if ($this->printableLayout) { // printable layout eclRender_renderBase_print::render ($this->render); } // printable layout // elseif ($this->data['flags']['modLayout_base'] == 'responsive') // { // responsive layout // eclRender_renderBase_responsive::render ($this->render); // } // responsive layout else { // custom layout $documentBase = $store->control->read ('renderBase_' . $this->data['flags']['modLayout_base'] . '_block'); if (!isset ($documentBase['html'])) exit ('Template not found or not valid'); if (isset ($documentBase['parsed'])) $this->render->render_tags_level ($documentBase['parsed']); else $this->render->render_tags ($documentBase['html']); } // custom layout // Cola os recortes $this->render_cuts ($this->render); // Recolhe o documento pronto $this->buffer = $this->render->buffer; } // function render private function renderStyle ($style) { // function renderStyle $styleBuffer = ''; foreach ($style as $name => $selectorArray) { // each name foreach ($selectorArray as $selector => $properties) { // each selector $propertiesBuffer = ''; foreach ($properties as $property => $value) { // each property if (!strlen ($value)) continue; if (strpos ($value, ':')) $propertiesBuffer .= $value; else $propertiesBuffer .= $property . ':' . $value . '; '; } // each property if (strlen ($propertiesBuffer)) { // creates a selector line $selector = str_replace ('%%', $name, $selector); $styleBuffer .= $selector . ' { ' . $propertiesBuffer . '}' . CRLF; } // creates a selector line } // each selector } // each name return $styleBuffer; } // function renderStyle private function render_cuts ($render) { // function render_cuts $header = ''; if ($render->css) { // css foreach ($render->css as $file => $true) { // each css file if ($file) $header .= '' . CRLF; } // each css file } // css if ($render->js) { // js foreach ($render->js as $file => $true) { // each js file if ($file) $header .= '' . CRLF; } // each js file } // js $styleBuffer = ''; if ($render->style) $styleBuffer = $this->renderStyle ($render->style); if ($render->styleWidescreen) $styleBuffer .= '@media screen and (min-width: 480px) {' . CRLF . $this->renderStyle ($render->styleWidescreen) . '}' . CRLF; if (strlen ($styleBuffer)) { // style cut if (isset ($render->cuts['style'])) $render->cuts['style'] .= $styleBuffer; else $render->cuts['style'] = $styleBuffer; } // style cut if (isset ($render->cuts['style'])) { // paste style $header .= $render->tags['style_open'] . CRLF . $render->cuts['style']; if (isset ($render->cuts['style-widescreen'])) $header .= '@media screen and (max-width:480px) {' . CRLF . $render->cuts['style-bigscreen'] . '}' . CRLF; $header .= $render->tags['style_close'] . CRLF; } // paste style if ($header) $render->cuts['style'] = $header; if (isset ($render->cuts['script'])) $render->cuts['script'] = $render->tags['script_open'] . CRLF . $render->cuts['script'] . $render->tags['script_close'] . CRLF; if (isset ($render->cuts['footerscript'])) $render->cuts['footerscript'] = $render->tags['script_open'] . CRLF . $render->cuts['footerscript'] . $render->tags['script_close'] . CRLF; for ($index = $render->pasteIndex; $index; $index--) { // loop cuts if (isset ($render->cuts[$render->pasteNames[$index]])) $render->buffer = substr_replace ($render->buffer, $render->cuts[$render->pasteNames[$index]], $render->pastePointer[$index], 0); } // loop cuts } // function render_cuts public function ref ($pathway=true, $lang=true, $actions=true, $protocol=true) { // function ref if ($protocol === true) $protocol = $this->protocol . '://'; elseif ($protocol === false) $protocol = 'http://'; else $protocol .= '://'; // Pathway if ($pathway === true) $pathway = $this->application->pathway; elseif (!is_array ($pathway) or !$pathway) $pathway = array ($this->domain->name); // Lang if ($lang === true) $lang = $this->lang; if ($lang !== false and $lang != $this->defaultLang) $pathway[] = $lang; // Actions if ($actions !== false) { // actions if (isset ($this->session['sid'])) { // add sid if (is_string ($actions)) $actions .= '_sid-' . $this->session['sid']; else $actions = '_sid-' . $this->session['sid']; } // add sid if (is_string ($actions)) $pathway[] = $actions; } // actions if ($this->mode == 0) { // hide default domain name if ($pathway[0] == SYSTEM_DEFAULT_DOMAIN_NAME) array_shift ($pathway); else $pathway[0] = '-' . $pathway[0]; } // hide default domain name elseif ($this->mode == 2) { // virtual hosts enabled $domain = array_shift ($pathway); if ($domain == SYSTEM_DEFAULT_DOMAIN_NAME) $ref = $protocol . SYSTEM_SERVER . SYSTEM_HOST . '/'; else $ref = $protocol . SYSTEM_SERVER . $domain . '.' . SYSTEM_HOST . '/'; if (!$this->rewriteEngine) { // add script name if (!$pathway) { // empty if (SYSTEM_SCRIPT_NAME == 'index.php') return $ref; else return $ref . SYSTEM_SCRIPT_NAME; } // empty $ref .= SYSTEM_SCRIPT_NAME . '?uri='; } // add script name if ($pathway) $ref .= implode ('/', $pathway); return $ref; } // virtual hosts enabled $ref = $protocol . $this->host; if (!$this->rewriteEngine) { // add script name if (!$pathway) { // empty if (SYSTEM_SCRIPT_NAME == 'index.php') return $ref; else return $ref . SYSTEM_SCRIPT_NAME; } // empty $ref .= SYSTEM_SCRIPT_NAME . '?uri='; } // add script name $ref .= implode ('/', $pathway); return $ref; } // function ref public function refFiles ($file, $domain=true, $special='-files') { // function refFiles if ($domain === true) $domain = $this->domain->name; if (SYSTEM_HOSTING_MODE == 2) { // virtual hosts enabled if ($domain == SYSTEM_DEFAULT_DOMAIN_NAME) $ref = $this->protocol . '://' . SYSTEM_SERVER . SYSTEM_HOST . '/'; else $ref = $this->protocol . '://' . SYSTEM_SERVER . $domain . '.' . SYSTEM_HOST . '/'; if (!$this->rewriteEngine) $ref .= SYSTEM_SCRIPT_NAME . '?uri='; $ref .= $special . '/' . $file; return $ref; } // virtual hosts enabled $ref = $this->protocol . '://' . $this->host; if (!$this->rewriteEngine) $ref .= SYSTEM_SCRIPT_NAME . '?uri='; if (SYSTEM_HOSTING_MODE == 0) return $ref . $special . '/' . $file; return $ref . $domain . '/' . $special . '/' . $file; } // function refFiles public function selectLanguage ($field) { // function selectLanguage static $cs = array (0 => 'UTF-8', 1 => 'ISO-8859-1'); // Se não houver conteúdo if (!is_array ($field) or !$field) return array (1 => '', 3 => $this->lang); // Vamos procurar o conteúdo no idioma do documento if (isset ($field[$this->lang])) { // found lang $content = $field[$this->lang]; $content[TEXT_LANG] = $this->lang; } // found lang elseif (isset ($field[$this->defaultLang])) { // default lang $content = $field[$this->defaultLang]; $content[TEXT_LANG] = $this->defaultLang; } // default lang else { // next language list ($lang, $content) = each ($field); $content[TEXT_LANG] = $lang; } // next language // Se não for especificada uma codificação if (!isset ($content[TEXT_CHARSET])) $content[TEXT_CHARSET] = 0; // UTF-8 // Se o conteúdo estiver em uma codificação diferente da do documento if (isset ($cs[$content[TEXT_CHARSET]]) and $cs[$content[TEXT_CHARSET]] != $this->charset) $content[TEXT_CONTENT] = mb_convert_encoding ($content[TEXT_CONTENT], $this->charset, $cs[$content[TEXT_CHARSET]]); return $content; } // function selectLanguage public function textMerge () { // function textMerge $result[$this->lang][TEXT_CONTENT] = ''; if ($this->charset == 'ISO-8859-1') $result[$this->lang][TEXT_CHARSET] = 1; $result[$this->lang][TEXT_HTML] = 2; foreach (func_get_args () as $field) { // each field if (is_string ($field)) $result[$this->lang][TEXT_CONTENT] .= $field; elseif (is_array ($field)) { // select language $content = $this->selectLanguage ($field); $result[$this->lang][TEXT_CONTENT] .= $content[TEXT_CONTENT]; } // select language elseif (is_int ($field)) $result[$this->lang][TEXT_CONTENT] .= strval ($field); } // each field return $result; } // function textMerge public function dataMerge ($data) { // function dataMerge global $store; if (is_string ($data)) $data = $store->control->read ($data); foreach ($data as $key => $value) { // each value switch ($key) { // switch key case 'text': case 'flags': case 'local': if (!is_array ($value)) break; foreach ($value as $field => $content) { // each field $this->data[$key][$field] = $content; } // each field break; default: $this->data[$key] = $value; } // switch key } // each value } // function dataMerge public function dataReplace ($data) { // function dataReplace global $store; if (is_string ($data)) $data = $store->control->read ($data); $this->data = array_replace_recursive (array ('flags' => $this->application->flags ()), $data); } // function dataReplace public function actions () { // function actions $args = func_get_args (); if (!isset ($this->actions[$args[0]])) return false; $actions = $this->actions[$args[0]]; foreach ($args as $arg) { // each argument if ($arg != array_shift ($actions)) return false; } // each argument return true; } // function actions public function access ($level, $groups=false) { // function access if (!$level) return true; if ($level == 1 and $this->user->userId) return true; if ($level == 2 and $this->subscription->domainId) return true; if ($groups === false) $groups = $this->application->groups; foreach ($groups as $group) { // walk groups list $status = $group->check ($this); if ($status >= $level) return true; } // walk groups list return false; } // function access public function createModule ($name, $arguments=array()) { // function createModule if (!preg_match ('/^[a-z][a-z0-9_]*$/', $name)) $name = 'default'; $mod = new eclEngine_module ($this); $this->mod->$name->setModule ($mod, $arguments); if (isset ($mod->data['local']['name'])) $name = $mod->data['local']['name']; if (isset ($this->ids[$name])) { // more instances $this->ids[$name]++; $mod->data['local']['name'] = $name . '_' . $this->ids[$name]; } // more instances else { // first instance $this->ids[$name] = 1; $mod->data['local']['name'] = $name; } // first instance return $mod; } // function createModule public function createListItem ($data=false, $local=array ()) { // function createListItem return new eclEngine_listItem ($this, $data, $local); } // function createListItem public function createFormulary ($controlName=false, $data=false, $prefix='edit') { // function createFormulary return new eclEngine_formulary ($this, $controlName, $data, $prefix); } // function createFormulary public function createInteractive ($template=array (), $data=array (), $prefix='form') { // function createInteractive return new eclEngine_interactive ($this, $template, $data, $prefix); } // function createInteractive public function createMail () { // function createMail return new eclIo_smtp(); } // function createMail } // class eclEngine_document //!eof:engine/eclEngine/eclEngine_document.php; //!file:engine/eclEngine/eclEngine_formulary.php; class eclEngine_formulary extends eclEngine_listItem { // class eclEngine_formulary public $document; public $protocol = true; public $pathway = true; public $lang = true; public $action = true; public $multipart = false; public $data; public $flags = array (); public $received; public $prefix; public $errorMsg = false; public $required = false; public $hidden = array (); public $posteriori = 0; // 0=all 1=normal_only 2=posteriori_only public $submited = false; private $receivedCommands; private $baseTarget = ''; private $baseName = ''; public $control = array (); public $children = array (); private $level = 0; private $tower = array (); private $index = 0; public function __construct ($document, $controlName=false, $data=array (), $prefix='edit') { // function __construct global $store; $this->document = $document; $this->received = $document->received; if (isset ($document->data['flags'])) $this->flags = $document->data['flags']; $this->data = $data; $this->prefix = $prefix; if ($controlName !== false) { // open control $this->control = $store->control->read ($controlName); if (isset ($this->control['flags'])) $this->flags = array_replace ($this->flags, $this->control['flags']); if (isset ($this->flags['control_prefix'])) $this->prefix = $this->flags['control_prefix']; if (isset ($this->flags['control_action'])) $this->action = $this->flags['control_action']; } // open control // check formulary id if (!$this->prefix or isset ($document->ids[$this->prefix])) $this->control['children'] = array ('_start', '_formularyIdCrash', '_end'); else { // correct insertion $document->ids[$this->prefix] = 1; $this->hidden[$this->prefix] = 'yes'; if (isset ($this->received[$this->prefix])) $this->submited = true; $this->prefix .= '_'; } // correct insertion if (isset ($this->control['children'])) $this->control['children'] = array_values ($this->control['children']); } // function __construct public function command ($command) { // function command if (!isset ($this->receivedCommands)) { // load commands if (!$this->submited) $this->receivedCommands = array (); else { // received $start = strlen ($this->prefix); foreach (array_keys ($this->received) as $key) { // each key if (substr ($key, 0, $start) != $this->prefix) continue; if (substr ($key, $start, 8) == 'command_') $this->receivedCommands[substr ($key, $start + 8)] = true; } // each key } // received } // load commands if (isset ($this->receivedCommands[$command])) return true; return false; } // function command public function levelUp ($control) { // function levelUp if (!isset ($control['children'])) return; $control['children'] = array_values ($control['children']); $this->level++; $this->tower[$this->level] = array ( 'children' => $this->children, 'control' => $this->control, 'index' => $this->index ); $this->children = array (); $this->control = $control; $this->index = 0; } // function levelUp public function insertControlChildren ($control) { // function insertControlChildren if (!isset ($control['children'])) return; $control['children'] = array_values ($control['children']); $this->level++; $this->tower[$this->level] = array ( 'control' => $this->control, 'index' => $this->index ); $this->control = $control; $this->index = 0; } // function insertControlChildren private function nextControl () { // function nextControl do { // loop levels if (isset ($this->control['flags']['control_base_target'])) $this->baseTarget = $this->control['flags']['control_base_target']; else $this->baseTarget = ''; if (isset ($this->control['flags']['control_base_name'])) $this->baseName = $this->control['flags']['control_base_name'] . '_'; else $this->baseName = ''; if (isset ($this->control['children'][$this->index])) { // child found $this->index++; return $this->control['children'][$this->index - 1]; } // found if (!$this->level) return false; $floor = $this->tower[$this->level]; if (isset ($floor['children'])) { // children level down end ($floor['children'])->children = $this->children; $this->children = $floor['children']; } // children level down $this->control = $floor['control']; $this->index = $floor['index']; unset ($this->tower[$this->level]); $this->level--; } // loop levels while (true); } // function nextControl public function create () { // function create global $store; $this->children = array (); $this->index = 0; if (!isset ($this->control['children'])) return $this; while ($name = $this->nextControl ()) { // each child if (is_string ($name)) { // open control if ($name[0] == '_') $name = 'systemFormulary_form' . $name; $control = $store->control->read ($name); } // open control elseif (is_array ($name) and isset ($name['flags']['control_field_name'])) { // embed control $control = $name; $name = $control['flags']['control_field_name']; } // embed control else continue; // condition if (isset ($control['flags']['control_condition']) and !$this->condition ($control['flags']['control_condition'])) continue; // display field if (isset ($control['flags']['control_field_display']) and !$this->condition ($control['flags']['control_field_display'])) continue; // field name if (isset ($control['flags']['control_field_name'])) $fieldName = $this->prefix . $this->baseName . $control['flags']['control_field_name']; else $fieldName = $this->prefix . $this->baseName . $name; // required if (isset ($control['flags']['control_required'])) { // required $this->required = true; $control['required'] = 1; } // required // help if (isset ($control['flags']['control_help'])) $control['help'] = 1; // filter if (isset ($control['flags']['control_filter'])) { // use filter if (preg_match ('%^[a-z][a-zA-Z0-9_]*$%', $control['flags']['control_filter'])) { // valid filter name $filter = 'eclFilter_' . $control['flags']['control_filter']; $item = $filter::create ($fieldName, $control, $this); if (is_object ($item)) $this->appendChild ($item); } // valid filter name } // use filter else { // no filter if (isset ($control['flags']['control_type'])) $type = $control['flags']['control_type']; else $type = 'unknown'; $this->appendChild ($name, array ( 'name' => $fieldName, 'type' => $type )); } // no filter } // each child return $this; } // function create public function save ($posteriori=0) { // function save global $store; $this->index = 0; if (!$this->submited) return false; if (!isset ($this->control['children'])) return false; while ($name = $this->nextControl ()) { // each child if (is_string ($name)) { // open control if ($name[0] == '_') continue; $control = $store->control->read ($name); } // open control elseif (is_array ($name) and isset ($name['flags']['control_field_name'])) { // embed control $control = $name; $name = $control['flags']['control_field_name']; } // embed control else continue; if (!isset ($control['flags']['control_filter'])) continue; if (!preg_match ('%^[a-z][a-zA-Z0-9_]*$%', $control['flags']['control_filter'])) continue; if (isset ($control['flags']['control_condition']) and !$this->condition ($control['flags']['control_condition'])) continue; if (isset ($control['flags']['control_posteriori']) and $posteriori == 1) continue; if (!isset ($control['flags']['control_posteriori']) and $posteriori == 2) continue; if (isset ($control['flags']['control_view'])) continue; if (isset ($control['flags']['control_field_name'])) $fieldName = $this->prefix . $this->baseName . $control['flags']['control_field_name']; else $fieldName = $this->prefix . $this->baseName . $name; $filter = 'eclFilter_' . $control['flags']['control_filter']; $filter::save ($fieldName, $control, $this); } // each child if ($this->errorMsg) return false; return true; } // function save public function restore ($data=array ()) { // function restore global $store; if ($this->controlName === false) return false; $control = $store->control->read ($this->controlName); if (isset ($control['flags'])) $this->flags = array_replace ($this->flags, $control['flags']); if (isset ($control['children'])) { // children exists foreach ($control['children'] as $name) { // each child if ($name[0] == '_') $name = 'formulary' . $name; $control = $store->control->read ($name); if ( (!isset ($control['flags']['control_condition']) or $this->condition ($control['flags']['control_condition'])) and isset ($control['flags']['control_target'])) { // valid condition $target = $control['flags']['control_target']; $field = $this->getField ($target, $data); $this->setField ($target, $field); } // valid condition } // each child } // children exists } // function restore public function removeLanguage ($lang) { // function removeLanguage if (!isset ($this->data['text'])) return; foreach (array_keys ($this->data['text']) as $key) { // each field if (isset ($this->data['text'][$key][$lang])) unset ($this->data['text'][$key][$lang]); } // each field } // function removeLanguage public function getField ($path, $data=false) { // function getField $path = $this->baseTarget . $path; if (!strlen ($path)) return false; if ($data === false) $data = $this->data; $pathway = explode ('/', $path); $level = count ($pathway); $found[0] = $data; for ($i = 0; $i < $level; ) { // loop levels if (!isset ($found[$i][$pathway[$i]])) return false; $return = $found[$i][$pathway[$i]]; $i++; if ($level == $i) return $return; $found[$i] = $return; } // loop levels } // function getField public function setField ($path, $value=false) { // function setField $path = $this->baseTarget . $path; if (!strlen ($path)) return; $pathway = explode ('/', $path); $level = count ($pathway); $data = $this->data; do { // its not a loop if ($level == 1) { // level 1 $data[$pathway[0]] = $value; break; } // level 1 if (!isset ($data[$pathway[0]])) $data[$pathway[0]] = array (); if ($level == 2) { // level 2 $data[$pathway[0]][$pathway[1]] = $value; break; } // level 2 if (!isset ($data[$pathway[0]][$pathway[1]])) $data[$pathway[0]][$pathway[1]] = array (); if ($level == 3) { // level 3 $data[$pathway[0]][$pathway[1]][$pathway[2]] = $value; break; } // level 3 if (!isset ($data[$pathway[0]][$pathway[1]][$pathway[2]])) $data[$pathway[0]][$pathway[1]][$pathway[2]] = array (); if ($level == 4) { // level 4 $data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]] = $value; break; } // level 4 if (!isset ($data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]])) $data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]] = array (); if ($level == 5) { // level 5 $data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]] = $value; break; } // level 5 if (!isset ($data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]])) $data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]] = array (); if ($level == 6) { // level 6 $data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]][$pathway[5]] = $value; break; } // level 6 break; } // its not a loop while ('Ill never be evaluated'); if ($value === false) { // empty value switch ($level) { // clear fields case 6: if (!$data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]][$pathway[5]]) unset ($data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]][$pathway[5]]); case 5: if (!$data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]]) unset ($data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]][$pathway[4]]); case 4: if (!$data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]]) unset ($data[$pathway[0]][$pathway[1]][$pathway[2]][$pathway[3]]); case 3: if (!$data[$pathway[0]][$pathway[1]][$pathway[2]]) unset ($data[$pathway[0]][$pathway[1]][$pathway[2]]); case 2: if (!$data[$pathway[0]][$pathway[1]]) unset ($data[$pathway[0]][$pathway[1]]); case 1: if (!$data[$pathway[0]]) unset ($data[$pathway[0]]); } // clear fields } // empty value $this->data = $data; } // function setField public function setErrorMsg ($control, $fieldName, $msg=false, $value=false) { // function setErrorMsg if ($this->errorMsg) return; $local = $control['flags']; unset ($local['control_icon']); if (isset ($local['control_error_msg'])) $local['msg'] = $local['control_error_msg']; elseif ($msg !== false) $local['msg'] = $msg; else $local['msg'] = 'systemFormulary_alertErrorField'; $local['name'] = $fieldName; $local['return_id'] = $fieldName; if (isset ($control['text']['caption'])) $local['field_caption'] = $control['text']['caption']; if ($value !== false) $local['value'] = $this->htmlSpecialChars ($value); $this->errorMsg = $local; } // function setErrorMsg public function setRequiredMsg ($control, $fieldName, $msg=false) { // function setRequiredMsg if ($this->errorMsg) return; $local = $control['flags']; unset ($local['control_icon']); if (isset ($local['control_required_msg'])) $local['msg'] = $local['control_required_msg']; elseif ($msg !== false) $local['msg'] = $msg; else $local['msg'] = 'systemFormulary_alertRequiredField'; $local['name'] = $fieldName; $local['return_id'] = $fieldName; if (isset ($control['text']['caption'])) $local['field_caption'] = $control['text']['caption']; $this->errorMsg = $local; } // function setRequiredMsg public function condition ($condition) { // function condition if (!$condition) return true; $not = false; // Vamos separar os membros OR $or_list = explode ('||', $condition); foreach ($or_list as $or_condition) { // each or condition $result = true; $or_condition = trim ($or_condition); // Para cada membro OR, vamos criar uma lista AND $and_list = explode ('&&', $or_condition); foreach ($and_list as $and_condition) { // each and condition $c = trim ($and_condition); if ($c[0] == '!') { // negative operator on $not = true; $c = trim (substr ($c, 1)); } // negative operator on if (!$not and (!isset ($this->flags[$c]) or !$this->flags[$c]))$result = false; elseif ($not and isset ($this->flags[$c]) and $this->flags[$c])$result = false; $not = false; } // each and condition if ($result) return true; } // each or condition return false; } // function condition public function htmlSpecialChars ($string) { // function htmlSpecialChars return str_replace (array ('&', '<', '"'), array ('&', '<', '"'), $string ); } // function htmlSpecialChars public function setModule ($mod, $arguments) { // function setModule global $store; $mod->childrenMerge ($this->create ()); if (!$mod->children) return; $mod->data = $store->control->read ('modFormulary_module'); if (isset ($this->control['local'])) { // set local scope if (isset ($mod->data['local'])) $mod->data['local'] = array_replace ($mod->data['local'], $this->control['local']); else $mod->data['local'] = $this->control['local']; } // set local scope if (isset ($this->control['text']['caption'])) $mod->data['local']['caption'] = $this->control['text']['caption']; $mod->enabled = true; } // function setModule } // class eclEngine_formulary //!eof:engine/eclEngine/eclEngine_formulary.php; //!file:engine/eclEngine/eclEngine_interactive.php; class eclEngine_interactive { // class eclEngine_interactive public $document; public $interactive; public $template; public $data; public $pointer = 0; public $prefix; public $errorMsg = false; public $children = array (); public $action = true; public function __construct ($document, $template, $data, $prefix) { // function __construct $this->document = $document; $this->received = $document->received; $this->template = $template; $this->data = $data; $this->prefix = $prefix; } // function __construct public function command ($command) { // function command static $receivedCommands; if (!isset ($receivedCommands)) { // load commands $start = strlen ($this->prefix); foreach (array_keys ($this->document->received) as $key) { // each key if (substr ($key, 0, $start) != $this->prefix) continue; if (substr ($key, $start, 9) == '_command_') $receivedCommands[substr ($key, $start + 9)] = true; } // each key } // load commands if (isset ($receivedCommands[$command])) return true; return false; } // function command public function interact ($mode, $createFullFormulary=true) { // function interact $this->errorMsg = false; $this->children = array (); $template = $this->template; if ($createFullFormulary) { // create a full formulary $start = array ('filter' => 'start'); $end = array ('filter' => 'end'); array_unshift ($template, $start); array_push ($template, $end); } // create full formulary foreach ($template as $name => $control) { // each control if (!isset ($control['filter'])) continue; if (!is_string ($name)) { // special control $filter = 'eclInteractive_dialogFields_' . $control['filter']; $filter::$mode ($this->prefix, $control, array (), $this); continue; } // special control if (!isset ($this->data[$name])) $this->data[$name] = array ('filter' => $control['filter']); $filter = 'eclInteractive_dialogFields_' . $control['filter']; $fieldName = $this->prefix . '_' . $name; $filter::$mode ($fieldName, $control, $name, $this); } // each control if ($this->errorMsg === false) return true; return false; } // function interact public function appendChild ($from=false, $local=array ()) { // function appendChild if (is_object ($from) and isset ($from->document)) { // from list item if ($local) $from->data = array_replace_recursive ($from->data, $local); $this->children[] = $from; return $from; } // from list item else $this->children[] = new eclEngine_listItem ($this->document, $from, $local); return end ($this->children); } // function appendChild public function setErrorMsg ($local, $fieldName, $msg=false, $value=false) { // function setErrorMsg if ($this->errorMsg) return; unset ($local['icon']); if (isset ($local['error_msg'])) $local['msg'] = $local['error_msg']; elseif ($msg !== false) $local['msg'] = $msg; else $local['msg'] = 'systemFormulary_alertErrorField'; if ($fieldName) { // return id $local['name'] = $fieldName; $local['return_id'] = $fieldName; } // return id if (isset ($local['caption'])) $local['field_caption'] = $local['caption']; if ($value !== false) $local['value'] = eclEngine_formulary::htmlSpecialChars ($value); $this->errorMsg = $local; } // function setErrorMsg public function setRequiredMsg ($control, $fieldName, $msg=false) { // function setRequiredMsg if ($this->errorMsg) return; $local = array (); if ($msg !== false) $local['msg'] = $msg; else $local['msg'] = 'systemFormulary_alertRequiredField'; $local['name'] = $fieldName; $local['return_id'] = $fieldName; if (isset ($control['caption'])) $local['field_caption'] = $control['caption']; $this->errorMsg = $local; } // function setRequiredMsg public function setModule ($mod, $arguments) { // function setModule global $store; $mod->children = $this->children; if (!$mod->children) return; $mod->data = $store->control->read ('dialogFields_module'); $mod->enabled = true; } // function setModule } // class eclEngine_interactive //!eof:engine/eclEngine/eclEngine_interactive.php; //!file:engine/eclEngine/eclEngine_io.php; class eclEngine_io { // class eclEngine_io public $buffer = ''; public function __construct () { // function __construct $this->log = new eclIo_log (); } // function __construct public function __get ($name) { // function __get $class = 'eclIo_' . $name; $this->$name = new $class ($this); return $this->$name; } // function __get public function close () { // function close if (isset ($this->session)) $this->session->close (); foreach ($this as $name => $driver) { // close each driver if ($name == 'buffer' or $name == 'session' or $name == 'log') continue; if (!isset ($driver->isPhantom)) $driver->close (); } // close each driver // log é o último a ser fechado $this->log->close (); $this->buffer = $this->log->buffer; } // function close } // class eclEngine_io //!eof:engine/eclEngine/eclEngine_io.php; //!file:engine/eclEngine/eclEngine_listItem.php; class eclEngine_listItem { // class eclEngine_listItem public $document; public $data; public $children = array (); public function __construct ($document, $from=false, $local=array ()) { // function __construct global $store; $this->document = $document; if (is_string ($from)) $this->data = $store->control->read ($from); elseif (is_object ($from)) $this->data = $from->data; elseif (is_array ($from)) $this->data = $from; if ($local) { // local if (!$this->data) $this->data = $local; else $this->data = array_replace_recursive ($this->data, $local); } // local } // function __construct public function appendChild ($from=false, $local=array ()) { // function appendChild if (is_object ($from) and isset ($from->document)) { // from list item if ($local) $from->data = array_replace_recursive ($from->data, $local); $this->children[] = $from; return $from; } // from list item else $this->children[] = new eclEngine_listItem ($this->document, $from, $local); return end ($this->children); } // function appendChild public function childrenMerge ($from) { // function childrenMerge if (is_object ($from)) { // is object foreach ($from->children as $child) { // each child if (isset ($child->document)) $this->children[] = $child; else $this->children[] = new eclEngine_listItem ($this->document, $child); } // each child } // is object } // function childrenMerge public function ref ($pathway=true, $lang=true, $action=true, $protocol=true) { // function ref if ($pathway === true) $pathway = $this->document->application->pathway; $this->data['pathway'] = $pathway; $this->data['ref'] = $this->document->ref ($pathway, $lang, $action, $protocol); return $this; } // function ref public function confirm ($name, $formulary=false) { // function confirm if (!isset ($this->data['ref'])) $this->data['ref'] = $this->document->mod->humperstilshen->dialog ($name, array ('ref' => $this->document->ref ()), $formulary); else $this->data['ref'] = $this->document->mod->humperstilshen->dialog ($name, array ('ref' => $this->data['ref']), $formulary); return $this; } // function confirm public function popUpOpen ($width=410, $height=600) { // function popUpOpen if (!isset ($this->data['ref'])) $this->data['ref'] = $this->document->ref (); $this->data['ref'] = "javaScript:humperstilshen.popUpOpen('" . $this->data['ref'] . "', " . $width . ", " . $height . ")"; return $this; } // function popUpOpen public function dialog ($data) { // function dialog $this->data['ref'] = $this->document->mod->humperstilshen->dialog ($data); return $this; } // function dialog public function active ($active=true) { // function active if ($active) $this->data['active'] = 1; return $this; } // function active public function virtual ($virtual=true) { // function virtual if ($virtual) $this->data['virtual'] = 1; return $this; } // function virtual public function set ($name, $value=1) { // function set if (!$value) unset ($this->data[$name]); elseif ($value === true) $this->data[$name] = 1; else $this->data[$name] = $value; return $this; } // function set public function swapTitle ($title=array ()) { // function swapTitle if (is_array ($this->data) and isset ($this->data['text']['title'])) $this->data['caption'] = $this->data['text']['title']; return $this; } // function swapTitle public function getVar ($name) { // function getVar if ($name[0] == '$') $name = substr ($name, 1); if (!is_array ($this->data)) return false; if (isset ($this->data[$name])) return $this->data[$name]; if (isset ($this->data['text'][$name])) return $this->data['text'][$name]; if (isset ($this->data['local'][$name])) return $this->data['local'][$name]; return false; } // function getVar public function editable ($access) { // function editable if (!$this->document->contentEditable) return $this; if ($access) $this->data['editable'] = 1; return $this; } // function editable } // class eclEngine_listItem //!eof:engine/eclEngine/eclEngine_listItem.php; //!file:engine/eclEngine/eclEngine_mail.php; class eclEngine_mail { // class eclEngine_mail public $host; public $port; public $user; public $password; public $from; public $to = ''; public $cc = array (); public $bcc = array (); public $subject = ''; public $text_plain = ''; public $text_html = ''; public $ttl; public $log = ''; public $document; protected $smtp; public function __construct ($parentDocument, $control, $local) { // function __construct global $io, $store, $system; $this->smtp = $io->smtp; $document = new eclEngine_document (); $document->domain = $parentDocument->domain; $document->user = $system->child (SYSTEM_PROFILES_URI)->child ('-anonimous'); $document->application = $system->child ('-blank'); if (is_string ($control)) $document->application->data = $store->control->read ($control); elseif (is_array ($control)) $document->application->data = $control; $document->render->global = $local; // Idioma $document->lang = $parentDocument->lang; $document->defaultLang = $parentDocument->defaultLang; // Definiremos também o conjunto de caracteres $document->charset = $parentDocument->charset; $document->base = 'mail'; $this->document = $document; } // function __construct public function subject ($subject) { // function subject if (is_string ($subject)) $this->subject = $subject; else { // select language $text = $this->document->selectLanguage ($subject); $this->subject = $text[TEXT_CONTENT]; } // select language $this->subject = '=?' . $this->document->charset . '?Q?' . quoted_printable_encode ($this->subject) . '?='; return $this; } // function subject public function to ($to) { // function to $this->to = $to; return $this; } // function to public function cc ($cc) { // function cc $this->cc[] = $cc; return $this; } // function cc public function bcc ($bcc) { // function bcc $this->bcc[] = $bcc; return $this; } // function bcc public function send () { // function send $document = $this->document; $document->application->dispatch ($document); $document->render (); $this->text_html = $document->buffer; $render = new eclEngine_render ($document); $text = $document->selectLanguage ($document->application->data['text']['secondcontent']); $text[TEXT_HTML] = 0; $text[TEXT_FORMAT] = 0; $text[TEXT_ECOLABORE] = 1; $render->global = $document->render->global; $render->render ($text); $this->text_plain = $render->buffer; if (!$this->subject) { // creates a subject $render = new eclEngine_render ($document); $text = $document->selectLanguage ($document->application->data['text']['caption']); $text[TEXT_HTML] = 0; $text[TEXT_FORMAT] = 0; $text[TEXT_ECOLABORE] = 1; $render->global = $document->render->global; $render->render ($text); $this->subject ($render->buffer); } // creates a subject return $this->smtp->send ($this); } // function send } // class eclEngine_mail //!eof:engine/eclEngine/eclEngine_mail.php; //!file:engine/eclEngine/eclEngine_mod.php; class eclEngine_mod { // class eclEngine_mod private $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function __get ($name) { // function __get $class = 'eclMod_mod' . ucfirst ($name); $this->$name = new $class ($this->document); return $this->$name; } // function __get public function __set ($name, $value) { // function __set if (is_object ($value)) $this->$name = $value; elseif (is_string ($value)) { // new module $class = 'eclMod_' . $value; $this->$name = new $class ($this->document); } // new module } // function __set } // class eclEngine_mod //!eof:engine/eclEngine/eclEngine_mod.php; //!file:engine/eclEngine/eclEngine_module.php; class eclEngine_module extends eclEngine_listItem { // class eclEngine_module public $document; public $data = array (); public $children = array (); public $enabled = false; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function tr() { // function tr return $this->appendChild (); } // function tr public function td ($data) { // function td if (!$this->children) $this->appendChild (); $child = $this->document->createListItem ($data); $this->children[count ($this->children) - 1]->children[] = $child; return $child; } // function td } // class eclEngine_module //!eof:engine/eclEngine/eclEngine_module.php; //!file:engine/eclEngine/eclEngine_render.php; class eclEngine_render { // class eclEngine_render public $document; public $buffer = ''; public $data = false; public $mod = array (); public $children = array (); public $index = 0; public $blocks = array (); public $tags = array ( 'p_open' => '

', 'p_close' => '

', 'h1_open' => '

', 'h1_close' => '

', 'h2_open' => '

', 'h2_close' => '

', 'h3_open' => '

', 'h3_close' => '

', 'h4_open' => '

', 'h4_close' => '

', 'h5_open' => '
', 'h5_close' => '
', 'h6_open' => '
', 'h6_close' => '
', 'ul_open' => '', 'ol_open' => '
    ', 'ol_close' => '
', 'ol_open_first' => '
    ', 'al_open' => '
      ', 'al_close' => '
    ', 'li_open' => '
  1. ', 'li_close' => '
  2. ', 'pre_open' => '
    ', 
    'pre_close' => '
    ', 'code_open' => '
    ', 
    'code_close' => '
    ', 'inline_code_open' => '', 'inline_code_close' => '', 'style_open' => '', 'script_open' => '', 'hr' => '
    ' ); public $editableTags = array ( 'editable_open' => '', 'editable_open_empty' => '', 'editable_close' => '', 'p_open' => '

    ', 'p_close' => '

    ', 'h1_open' => '

    ', 'h1_close' => '

    ', 'h2_open' => '

    ', 'h2_close' => '

    ', 'h3_open' => '

    ', 'h3_close' => '

    ', 'h4_open' => '

    ', 'h4_close' => '

    ', 'h5_open' => '
    ', 'h5_close' => '
    ', 'h6_open' => '
    ', 'h6_close' => '
    ', 'ul_open' => '', 'ol_open' => '
      ', 'ol_close' => '
    ', 'ol_open_first' => '
      ', 'al_open' => '
        ', 'al_close' => '
      ', 'li_open' => '
    1. ', 'li_close' => '
    2. ', 'pre_open' => '
      ', 
      'pre_close' => '
      ', 'code_open' => '
      ', 
      'code_close' => '
      ', 'inline_code_open' => '', 'inline_code_close' => '', 'style_open' => '', 'script_open' => '', 'hr' => '
      ' ); public $css = array (); public $js = array (); public $style = array (); public $styleWidescreen = array (); public $cuts = array (); public $cutOnce = array (); public $cutLastId = false; public $cutLastPosition = false; public $cutOnceLastId = false; public $pasteIndex = 0; public $pastePointer = array (); public $pasteNames = array (); private $levelIndex = 0; private $levelArray = array (); public function __construct ($document=false) { // function __construct $this->document = $document; } // function __construct public function levelUp ($data) { // function levelUp $this->levelIndex++; $this->levelArray[$this->levelIndex] = array (); $a = &$this->levelArray[$this->levelIndex]; if (isset ($data['data']) or isset ($data['local']) or isset ($data['text'])) { // data $a['data'] = $this->data; $this->data = array (); if (isset ($data['data'])) $this->data = $data['data']; if (isset ($data['local'])) $this->data = array_replace ($this->data, $data['local']); if (isset ($data['text'])) $this->data = array_replace ($this->data, $data['text']); } // data if (isset ($data['mod'])) { // mod $a['mod'] = $this->mod; $this->mod = $data['mod']; } // mod if (isset ($data['blocks'])) { // blocks $a['blocks'] = $this->blocks; $this->blocks = array_replace ($this->blocks, $data['blocks']); } // blocks if (isset ($data['tags'])) { // tags $a['tags'] = $this->tags; $this->tags = array_replace ($this->tags, $data['tags']); } // tags if (isset ($data['css_src'])) { // css foreach ($data['css_src'] as $css) { // each css $this->css[$css] = true; } // each css } // css if (isset ($data['js_src'])) { // js foreach ($data['js_src'] as $js) { // each js $this->js[$js] = true; } // each js } // js if (isset ($data['style']) and $name = $this->getVar ('mod.name')) { // style if (isset ($this->style[$name])) $this->style[$name] = array_replace_recursive ($this->style[$name], $data['style']); else $this->style[$name] = $data['style']; if (isset ($data['style_widescreen'])) { // style widescreen if (isset ($this->styleWidescreen[$name])) $this->styleWidescreen[$name] = array_replace_recursive ($this->styleWidescreen[$name], $data['style_widescreen']); else $this->styleWidescreen[$name] = $data['style_widescreen']; } // style widescreen } // style if (isset ($data['style_global'])) { // style global if (isset ($this->style['global'])) $this->style['global'] = array_replace_recursive ($this->style['global'], $data['style_global']); else $this->style['global'] = $data['style_global']; if (isset ($data['style_global_widescreen'])) { // style global widescreen if (isset ($this->styleWidescreen['global'])) $this->styleWidescreen['global'] = array_replace_recursive ($this->styleWidescreen['global'], $data['style_global_widescreen']); else $this->styleWidescreen['global'] = $data['style_global_widescreen']; } // style global widescreen } // style global if (isset ($data['children'])) { // children $a['children'] = $this->children; $a['index'] = $this->index; $this->children = $data['children']; if (isset ($data['index'])) $this->index = $data['index']; else $this->index = 0; } // children } // function levelUp public function levelDown () { // function levelDown foreach ($this->levelArray[$this->levelIndex] as $property => $value) { // each item $this->$property = $value; } // each item unset ($this->levelArray[$this->levelIndex]); $this->levelIndex--; } // function levelDown public function render ($content) { // function render static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); if (is_string ($content)) $content = array ( TEXT_CONTENT => $content, TEXT_HTML => 2, TEXT_ECOLABORE => 1 ); if (!isset ($content[TEXT_CONTENT])) return; if (!strlen ($content[TEXT_CONTENT]) and !isset ($content[TEXT_EDITABLE])) return; if (isset ($content[TEXT_FORMAT]) and $content[TEXT_FORMAT]) $this->text2html ($content); if (isset ($content[TEXT_ECOLABORE]) and $content[TEXT_ECOLABORE]) $this->render_tags ($content); elseif ( (!isset ($content[TEXT_FORMAT]) or !$content[TEXT_FORMAT]) and (!isset ($content[TEXT_HTML]) or !$content[TEXT_HTML])) $this->buffer .= str_replace ($s, $r, $content[TEXT_CONTENT]); else $this->buffer .= $content[TEXT_CONTENT]; } // function render private function filter_html ($string, $text_html=1, $editable=false) { // function filter_html static $valid_tags = array ( 'b' => true, // Texto em negrito 'br' => true, // Quebra de linha forçada 'caption' => true, // Legenda de tabela 'col' => true, // Coluna de tabela 'colgroup' => true, // Grupo de colunas de tabela 'div' => true, // Contentor genérico 'em' => true, // ênfase 'hr' => true, // Barra horizontal 'i' => true, // Texto em itálico 'mark' => true, // Destaque 's' => true, // Texto em negrito 'small' => true, // Texto pequeno 'span' => true, // Contentor genérico 'strong' => true, // Texto grande 'sub' => true, // Texto Subescrito 'sup' => true, // Texto superescrito 'table' => true, // Tabela 'tbody' => true, // Corpo de tabela 'td' => true, // Célula de tabela 'tfoot' => true, // Rodapé de tabela 'th' => true, // Cabeçalho de tabela 'thead' => true, // Cabeçalho de tabela 'tr' => true, // Linha de tabela 'u' => true, // Texto sublinhado 'wbr' => true // Local propício para quebra de linha ); // As tags que não trabalham em pares. static $single_tags = array ( 'br' => true, 'hr' => true, 'wbr' => true ); // A lista de argumentos permitidos por padrão static $valid_arguments = array ( '/' => true, // Argumento padrão para marcações singulares 'abbr' => true, // Cabeçalho - legenda 'alt' => true, // Descrição 'axis' => true, // Lista de cabeçalhos relacionados 'cellpadding' => true, // Preenchimento da célula 'cellspacing' => true, // Espaçamento entre células 'cite' => true, // Endereço da citação 'colspan' => true, // Número de colunas ocupadas pela célula 'frame' => true, // Parte do quadro a ser renderizado 'header' => true, // Cabeçalho 'height' => true, // Altura 'href' => true, // Endereço 'lang' => true, // Idioma 'name' => true, // Nome 'rowspan' => true, // Número de linhas ocupadas pela célula 'rules' => true, 'title' => true, // Título - legenda 'local' => true, // Campo coberto pelas células do cabeçalho 'span' => true, 'src' => true, // Endereço do recurso 'style' => true, // Regras de folha de estilo 'summary' => true, // Descrição de estrutura para saída em fala 'width' => true // Largura ); if ($editable) { // editable content if (!$text_html) $string = str_replace ('<', '<', $string); $buffer = ''; $length = strlen ($string); $pointer = 0; do { // loop string $offset = strcspn ($string, '[', $pointer); if (!$offset) { // empty offset if (substr ($string, $pointer, 13) != '[placeholder:') $buffer .= $this->editableTags['editable_open_empty'] . $this->editableTags['editable_close']; } // empty offset else $buffer .= $this->editableTags['editable_open'] . substr ($string, $pointer, $offset) . $this->editableTags['editable_close']; $pointer += $offset; if ($pointer >= $length) return $buffer; $offset = strcspn ($string, ']', $pointer); $offset += strspn ($string, ']', $pointer + $offset); $markup = substr ($string, $pointer, $offset); if (substr ($markup, 0, 13) == '[placeholder:') { // placeholder $buffer .= ''; if ($pointer + $offset >= $length) return $buffer; } // placeholder else $buffer .= $markup; $pointer += $offset; } // loop string while (true); } // editable content // Se todo o HTML for permitido if ($text_html == 2) return $string; // Se nenhum HTML for permitido if (!$text_html) return str_replace ('<', '<', $string); // O resultado $result = ''; // O ponteiro que utilizaremos para percorrer a string $pointer = 0; // Vamos iniciar um loop infinito para percorrer a string while (true) { // infinity loop // Vamos procurar o início de uma tag ("<") $start = strpos ($string, '<', $pointer); // Se não for encontrado, a tarefa terminou e sairemos do loop if ($start === false) { // tag not found $result .= substr ($string, $pointer); return $result; } // tag not found // Vamos procurar o fim da tag (">") $start++; $end = strpos ($string, '>', $start); /// Se não for encontrado, a tarefa terminou e sairemos do loop if ($end === false) { // tag end not found $result .= str_replace ('<', '<', substr ($string, $pointer)); return $result; } // tag end not found // Vamos recortar o conteúdo da tag e fazer uma análize $tag = substr ($string, $start, $end - $start); $end++; // Vamos recortar cada elemento da tag preg_match_all ('/([a-zA-Z]+)([=]["][^"]*["])?\ ?\/?/', $tag, $preg); $array = $preg[1]; // O primeiro elemento corresponde à própria tag $original = array_shift ($array); $type = strtolower ($original); // Vamos comparar o primeiro elemento com a lista de tags válidas $accept = false; if (isset ($valid_tags[$type])) { // accept tag $accept = true; // Vamos comparar os demais elementos com a lista de argumentos válidos foreach ($array as $argument) { // each argument $argument = strtolower ($argument); if (!isset ($valid_arguments[$argument])) { // invalid argument $accept = false; break; } // invalid argument } // each argument } // accept tag // Se toda a tag foi aceita if ($accept) { // allow tag // Se a tag trabalha sozinha if (isset ($single_tags[$type])) { // allow single tag $result .= substr ($string, $pointer, $end - $pointer); } // allow single tag // Outro caso, iremos procurar uma tag de fechamento correspondente else { // allow double tag $close_tag = ''; $close_start = strpos ($string, $close_tag, $end); // Se a tag de fechamento não foi encontrada if ($close_start === false) { // deny no closed tag $result .= str_replace ('<', '<', substr ($string, $pointer, $end - $pointer)); } // deny no closed tag // Se encontramos a tag de fechamento else { // close tag found $result .= substr ($string, $pointer, $end - $pointer); // IMPORTANTE: O conteúdo encontrado entre as tags // será analizado em busca de outras tags $result .= $this->filter_html (substr ($string, $end, $close_start - $end)); $result .= $close_tag; $end = $close_start + strlen ($close_tag); } // close tag found } // allow double tag } // allow tag // Caso a tag ou algum argumento não foi permitido else { // deny - escape html special chars $result .= str_replace ('<', '<', substr ($string, $pointer, $end - $pointer)); } // deny - escape html special chars // Avançaremos o ponteiro para continuar a análize $pointer = $end; } // infinity loop } // function filter_html private function text2html (&$content) { // function text2html $string = trim ($content[TEXT_CONTENT]); isset ($content[TEXT_HTML]) ? $text_html = $content[TEXT_HTML] : $text_html = 0; isset ($content[TEXT_ECOLABORE]) ? $text_ecolabore = $content[TEXT_ECOLABORE] : $text_ecolabore = 0; isset ($content[TEXT_EDITABLE]) ? $editable = $content[TEXT_EDITABLE] : $editable = false; if ($editable) $marks = $this->editableTags; else $marks = $this->tags; // Converte quebras de linhas Windows para Linux $string = str_replace (CRLF, LF, $string); // o cumprimento total da string $strlen = strlen ($string); // Os ponteiros indicando o início e o fim de um parágrafo $paragraph_start = 0; $paragraph_end = 0; // O resultado final $result = ''; // Anota se é necessário um parágrafo intermediário $previousIsParagraph = false; // enquanto o ponteiro não alcançar o final da string while ($paragraph_start < $strlen) { // move pointer // um parágrafo é delimitado por duas quebras de linha consecutivas: $paragraph_end = strpos ($string, LF . LF, $paragraph_start); if ($paragraph_end === false) $paragraph_end = $strlen; else $paragraph_end += 2; // pega o primeiro caractére do parágrafo $char = $string[$paragraph_start]; switch ($char) { // switch char // Ignora os caractéres case CR: case LF: case "\t": $paragraph_end = $paragraph_start + 1; break; // Listas case '*': case '#': case '@': if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $paragraph = substr ($string, $paragraph_start, $paragraph_end - $paragraph_start); // Separa as linhas do parágrafo $lines = explode (LF, $paragraph); $last = ''; $last_level = 0; // Percorre as linhas deste parágrafo foreach ($lines as $line) { // each line if (!strlen (trim ($line))) continue; // Quantos símbolos existem no início desta linha $current_level = strspn ($line, '*#@'); // Recorta os símbolos encontrados para análize posterior $current = substr ($line, 0, $current_level); $line = $this->filter_html (trim (substr ($line, $current_level)), $text_html, $editable); // Uma versão mais descomplicada da linha acima: // Retira os símbolos do início da linha // $line = substr ($line, $current_level); // $line = trim ($line); // $line = $this->filter_html ($line, $text_html, $editable); // Se não houverem símbolos no início desta linha, trata-se de uma // quebra acidental, o que nos leva a emendar esta linha com a linha anterior if (!$current_level and strlen ($line)) $result .= ' ' . $line; else { // valid line // Vamos comparar os símbolos da linha atual com a linha anterior // para determinar até que ponto são iguais for ($equal = 0; $equal < $last_level and $equal < $current_level and $current[$equal] == $last[$equal]; $equal++) { } // compare levels // Se o resultado indica que precisamos descer algum nível da lista for ($level = $last_level; $level > $equal; $level--) { // loop level down $char = $last[$level - 1]; if ($char == '*') $result .= $marks['li_close'] . LF . $marks['ul_close'] . LF; elseif ($char == '#') $result .= $marks['li_close'] . LF . $marks['ol_close'] . LF; else $result .= $marks['li_close'] . LF . $marks['al_close'] . LF; } // loop level down // Se fechamos uma lista, a linha atual deverá ser criada como um novo item if ($last_level > $equal and $equal) { // new item after close a list $result .= $marks['li_close'] . LF . $marks['li_open']; } // new item after close a list // Se o prefixo da lista anterior for idêntico ao desta, // simplesmente criamos um novo item if ($last_level == $equal and $current_level == $equal and $equal) { // item in same level $result .= $marks['li_close'] . LF . $marks['li_open']; } // item in same level // Se for preciso criar sublistas for ($level = $equal; $level < $current_level; $level++) { // level up if ($level) $result .= LF; $char = $current[$level]; if ($char == '*') $result .= $marks['ul_open'] . LF . $marks['li_open']; elseif ($char == '#' and $level == 0) $result .= $marks['ol_open_first'] . LF . $marks['li_open']; elseif ($char == '#') $result .= $marks['ol_open'] . LF . $marks['li_open']; else $result .= $marks['al_open'] . LF . $marks['li_open']; } // level up // Finalmente, colocamos o conteúdo desta linha $result .= $line; // Preparamos a próxima iteração anotando os itens desta linha como // sendo os símbolos da linha anterior $last = $current; $last_level = $current_level; } // valid line } // each line // Acrescenta o fechamento do último item da lista for ($level = $last_level; $level > 0; $level--) { // loop level down $char = $last[$level - 1]; if ($char == '*') $result .= $marks['li_close'] . LF . $marks['ul_close'] . LF; elseif ($char == '#') $result .= $marks['li_close'] . LF . $marks['ol_close'] . LF; else $result .= $marks['li_close'] . LF . $marks['al_close'] . LF; } // loop level down break; // Cabeçálhos - ou Títulos case '=': $previousIsParagraph = true; $paragraph = substr ($string, $paragraph_start, $paragraph_end - $paragraph_start); // Vamos ver quantos símbolos = tem no início do parágrafo $level = strspn ($paragraph, '='); // Se forem de 1 a 6 if ($level <= 6) { // valid header level // Vamos filtrar o parágrafo, removendo os sinais de = no início e no final $paragraph = trim ($paragraph, "= \r\n\t"); $paragraph = $this->filter_html ($paragraph, $text_html, $editable); $result .= $marks['h' . $level . '_open'] . $paragraph . $marks['h' . $level . '_close'] . LF; } // valid header level // Se tiverem mais de 6 sinais de =, será tratado como um parágrafo normal else $result .= $marks['p_open'] . $this->filter_html (trim ($paragraph), $text_html, $editable) . $marks['p_close'] . LF; break; // Um separador horizontal case '-': $paragraph = substr ($string, $paragraph_start, $paragraph_end - $paragraph_start); // Quantos hifens ("-") tem no parágrafo $level = strspn ($paragraph, '-'); // Vamos limpar o parágrafo $clean = trim ($paragraph, "- \r\n\t"); // Somente se houverem mais de 4 hifens e se não houver restado nada após a limpeza if ($level > 4 and !strlen ($clean)) { // insert separator if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $result .= $marks['hr'] . LF; } // insert separator // Caso contrário, este será mais um parágrafo comum else { // insert paragraph $previousIsParagraph = true; $result .= $marks['p_open'] . $this->filter_html (trim ($paragraph), $text_html, $editable) . $marks['p_close'] . LF; } // insert paragraph break; // procura por marcações que alteram o método de formatação case '[': $start = $paragraph_start + 1; // Procura por ] $end = strpos ($string, ']', $start); // Se for encontrado if (is_int ($end)) { // end of tag found // Recortamos a tag $tag = substr ($string, $start, $end - $start); list ($type) = explode (':', $tag); $original = $type; // Vamos analizar seu conteúdo switch ($type) { // switch tag case 'style': case 'script': // Se não for permitido script ou style, as marcas serão convertidas if ($text_html != 2) $type = 'pre'; case 'code': case 'pre': // Vamos procurar pela marca de fechamento $close_tag = '[/' . $original . ']'; $close_length = strlen ($close_tag); $close_pos = strpos ($string, $close_tag, $end); // Se a encontrarmos if ($close_pos) { // close tag found if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $paragraph_end = $close_pos + $close_length; $end++; $paragraph = substr ($string, $end, $close_pos - $end); // Se o conteudo for do tipo code ou pre, escapamos o HTML if ($type == 'code' or $type == 'pre') $paragraph = str_replace ('<', '<', $paragraph); // Se o conteúdo for do tipo code e for preciso pular as marcações if ($type == 'code' and $text_ecolabore) $paragraph = '[jump]' . str_replace ('[/jump]', '[[/jump]/jump][jump]', $paragraph) . '[/jump]'; $result .= $marks[$type . '_open'] . $paragraph . $marks[$type . '_close'] . LF; break 2; } // close tag found // outras marcações serão consideradas como um parágrafo normal // simplesmente deixando o fluxo do programa prosseguir } // switch tag } // end of tag found // Um parágrafo normal default: $paragraph = trim (substr ($string, $paragraph_start, $paragraph_end - $paragraph_start)); if ($editable and substr ($paragraph, 0, 13) == '[placeholder:') { // placeholder $result .= $marks['p_open'] . $this->filter_html ($paragraph, 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = true; } // placeholder elseif ($text_ecolabore and strlen ($paragraph) > 1 and $paragraph[0] == '[' and $paragraph[strlen ($paragraph) - 1] == ']') { // markup alone if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $result .= $paragraph; } // markup alone else { // insert paragraph $previousIsParagraph = true; $result .= $marks['p_open'] . $this->filter_html ($paragraph, $text_html, $editable) . $marks['p_close'] . LF; } // insert paragraph } // switch char // Movemos o ponteiro adiante $paragraph_start = $paragraph_end; } // move pointer if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; // converte quebras de linhas Linux para Windows $result = str_replace (LF, CRLF, $result); $content[TEXT_CONTENT] = $result; } // function text2html /* * 0 type * 1 value * 2 arguments * 3 sublevel * 4 silent * 5 parse error * * Type values * 0 string buffer * 1 function * 2 variable * 3 number * 4 operator * 5 precedent operator */ public function render_tags ($content, $parseOnly=false) { // function render_tags if (is_string ($content)) $_string = $content; elseif (is_array ($content) and isset ($content[1])) $_string = $content[TEXT_CONTENT]; else return; $_length = strlen ($_string); $_pointer = 0; $_array = array (); $_level = 1; $_index = array (1 => 0); PARSE_TAG_SEEK: $_pos = strpos ($_string, '[', $_pointer); if ($_pos === false) { // open tag not found $_array[$_level][$_index[$_level]] = array (0, substr ($_string, $_pointer)); goto PARSE_END_OF_STRING; } // open tag not found if ($_pos > $_pointer) { // buffer $_array[$_level][$_index[$_level]] = array (0, substr ($_string, $_pointer, $_pos - $_pointer)); $_index[$_level]++; } // buffer $_pointer = $_pos + 1; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); if ($_char == 91) { // [[ $_pos = strpos ($_string, ']]', $_pointer); if ($_pos === false) { // end tag not found $_array[$_level][$_index[$_level]] = array (0, '[['); $_index[$_level]++; $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_TAG_SEEK; } // end tag not found $_pointer++; $_array[$_level][$_index[$_level]] = array ( 0 => 1, 1 => 'key', 2 => array ( 0 => array ( 0 => 0, 1 => substr ($_string, $_pointer, $_pos - $_pointer) ) ) ); $_index[$_level]++; $_pointer = $_pos + 2; if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_TAG_SEEK; } // [[ if ($_char == 93) { // [] $_array[$_level][$_index[$_level]] = array (0, '['); $_index[$_level]++; $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_TAG_SEEK; } // [] PARSE_NEXT_INSTRUCTION: while ($_char == 9 or $_char == 10 or $_char == 13 or $_char == 32) // tab 9 lf 10 cr 13 espace 32 { // empty space $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); } // empty space if ($_char == 47 and $_pointer + 1 < $_length and ($_string[$_pointer + 1] == '/' or $_string[$_pointer + 1] == '*')) { // comment $_pointer++; $_char = ord ($_string[$_pointer]); if ($_char == 47) { // inline comment $_offset = strcspn ($_string, "\r\n;]", $_pointer); $_pointer += $_offset; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); } // inline comment elseif ($_char == 42) { // block comment $_pos = strpos ($_string, '*/', $_pointer); if ($_pos === false) goto PARSE_END_OF_STRING; $_pointer = $_pos + 2; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); } // block comment goto PARSE_NEXT_INSTRUCTION; } // comment if ($_char == 125) { // } level down $_level--; if (!$_level) goto PARSE_END_OF_STRING; $_array[$_level][$_index[$_level]][3] = $_array[$_level + 1]; $_index[$_level]++; unset ($_array[$_level + 1]); $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // } level down if ($_char == 96) { // ` string $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $pos = strpos ($_string, '`', $_pointer); if ($pos === false) goto PARSE_END_OF_STRING; $_array[$_level][$_index[$_level]] = array ( 0 => 0, 1 => substr ($_string, $_pointer, $pos - $_pointer) ); $_index[$_level]++; $_pointer = $pos + 1; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // ` string $_offset = strcspn ($_string, '{};]', $_pointer); if (!$_offset) goto PARSE_END_OF_INSTRUCTION; $length = $_pointer + $_offset; $pointer = $_pointer; $char = ord ($_string[$pointer]); $silent = false; $name = ''; $level = 1; $index[1] = 0; $array = array (1 => array ()); if ($char == 64) { // @ silent $silent = true; while ($char == 9 or $char == 10 or $char == 13 or $char == 32 or $char == 64) // tab 9 lf 10 cr 13 espace 32 @ 64 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space } // @ silent if ($char == 47) { // / end function $name .= 'end'; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // / end function if ( ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122)) { // a-z _ A-Z do { // . a-z _ A-Z 0-9 $name .= $_string[$pointer]; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // . a-z _ A-Z 0-9 while ($char == 46 or ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122) or ($char >= 48 and $char <= 57)); } // a-z _ A-Z // Elimina parênteses e espaços desnecessários while ($char == 9 or $char == 10 or $char == 13 or $char == 32) // tab 9 lf 10 cr 13 espace 32 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space if ($char == 40) { // () $char = ord ($_string[$length - 1]); while ($char == 9 or $char == 10 or $char == 13 or $char == 32 or $char == 64) // tab 9 lf 10 cr 13 espace 32 @ 64 { // rtrim $length--; $char = ord ($_string[$length - 1]); } // rtrim if ($char == 41) $length--; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // () if ($char == 58) { // : string $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $offset = strcspn ($_string, '{]', $pointer); $array[1][0] = array ( 0 => 0, 1 => substr ($_string, $pointer, $offset) ); $_offset = ($pointer + $offset) - $_pointer; goto PARSE_END_OF_ARGUMENTS; } // string goto PARSE_NEXT_ARGUMENT_NO_DOWN; PARSE_NEXT_ARGUMENT: while (isset ($down[$level])) { // operator level down unset ($down[$level]); $level--; if (!$level) goto PARSE_END_OF_ARGUMENTS; $array[$level][$index[$level]][2] = $array[$level + 1]; unset ($array[$level + 1]); $index[$level]++; } // operator level down PARSE_NEXT_ARGUMENT_NO_DOWN: while ($char == 9 or $char == 10 or $char == 13 or $char == 32) // tab 9 lf 10 cr 13 espace 32 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space if ($char == 45 or $char == 46 or ($char >= 48 and $char <= 57)) { // number $buffer = ''; do { // loop numbers $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) break; $char = ord ($_string[$pointer]); } // loop numbers while ($char == 46 or ($char >= 48 and $char <= 57)); $array[$level][$index[$level]] = array ( 0 => 3, 1 => $buffer ); $index[$level]++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // number if ($char == 36) { // $ variable $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $buffer = ''; do { // . a-z _ A-Z 0-9 $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) break; $char = ord ($_string[$pointer]); } // . a-z _ A-Z 0-9 while ($char == 45 or $char == 46 or ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122) or ($char >= 48 and $char <= 57)); $array[$level][$index[$level]] = array ( 0 => 2, 1 => $buffer ); $index[$level]++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // $ variable if ( ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122)) { // function $buffer = ''; do { // . a-z _ A-Z 0-9 $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) break; $char = ord ($_string[$pointer]); } // . a-z _ A-Z 0-9 while ($char == 46 or ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122) or ($char >= 48 and $char <= 57)); if ($buffer == 'and' or $buffer == 'or') { // operator if (!$index[$level]) goto PARSE_END_OF_ARGUMENTS; $index[$level]--; $operand = $array[$level][$index[$level]]; $array[$level][$index[$level]] = array (0 => 4, 1 => $buffer); // puts the operand into argument list $level++; $array[$level] = array (0 => $operand); $index[$level] = 1; // Alert to down a level after next operand $down[$level] = true; goto PARSE_NEXT_ARGUMENT_NO_DOWN; } // operator else $array[$level][$index[$level]] = array (0 => 1, 1 => $buffer); if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; while ($char == 9 or $char == 10 or $char == 13 or $char == 32 or $char == 44) // tab 9 lf 10 cr 13 espace 32 , 44 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space if ($char == 40) { // ( level up $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $level++; $index[$level] = 0; $array[$level] = array (); $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ( level up $index[$level]++; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // function if ($char == 40) { // ( level up $array[$level][$index[$level]] = array ( 0 => 1, 1 => '' ); $level++; $index[$level] = 0; $array[$level] = array (); $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ( level up if ($char == 41) { // ) level down $level--; if (!$level) goto PARSE_END_OF_ARGUMENTS; $array[$level][$index[$level]][2] = $array[$level + 1]; $index[$level]++; while (isset ($down[$level])) { // operator level down unset ($down[$level]); $level--; if (!$level) goto PARSE_END_OF_ARGUMENTS; $array[$level][$index[$level]][2] = $array[$level + 1]; $index[$level]++; } // operator level down $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ) level down if ($char == 96) { // ` string $pointer++; if ($pointer == $_length) goto PARSE_END_OF_STRING; $pos = strpos ($_string, '`', $pointer); if ($pos === false) goto PARSE_END_OF_STRING; $array[$level][$index[$level]] = array ( 0 => 0, 1 => substr ($_string, $pointer, $pos - $pointer) ); $index[$level]++; if ($pos > $length) { // new ending $pointer = $pos + 1; $_pointer = $pointer; $_offset = strcspn ($_string, ';{]', $pointer); if (!$_offset) goto PARSE_END_OF_ARGUMENTS; $length = $pointer + $_offset; } // new ending else $pointer = $pos + 1; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ` string if ($char == 33) { // ! operator $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); $array[$level][$index[$level]] = array (0 => 5, 1 => '!'); $level++; $array[$level] = array (); $index[$level] = 0; // Alert to down a level after next operand $down[$level] = true; goto PARSE_NEXT_ARGUMENT_NO_DOWN; } // ! operator if ($char == 38 or $char == 42 or $char == 43 or $char == 45 or $char == 47 or $char == 60 or $char == 61 or $char == 62) { // = + - / * += -= /= *= == & | operadores $buffer = $_string[$pointer]; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); if ($char == 38 or $char == 42 or $char == 43 or $char == 45 or $char == 47 or $char == 60 or $char == 61 or $char == 62) { // second operator $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // second operator if (!$index[$level]) goto PARSE_END_OF_ARGUMENTS; $index[$level]--; $operand = $array[$level][$index[$level]]; $array[$level][$index[$level]] = array (0 => 4, 1 => $buffer); // puts the operand into argument list $level++; $array[$level] = array (0 => $operand); $index[$level] = 1; // Alert to down a level after next operand $down[$level] = true; goto PARSE_NEXT_ARGUMENT_NO_DOWN; } // = + - / * += -= /= *= == & | operadores // salta caractéres não reconhecidos até aqui $pointer++; if ($pointer < $length) { // unrecognized char $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // unrecognized char PARSE_END_OF_ARGUMENTS: while (isset ($down[$level])) { // operator level down unset ($down[$level]); $level--; if (!$level) break; $array[$level][$index[$level]][2] = $array[$level + 1]; unset ($array[$level + 1]); } // operator level down if (strlen ($name) or $array[1]) { // creates a new function $_array[$_level][$_index[$_level]] = array ( 0 => 1, 1 => $name, 2 => $array[1], 4 => $silent ); $_pointer += $_offset; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); if ($_char == 123) { // { level up $_level++; $_array[$_level] = array (); $_index[$_level] = 0; $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // { level up else $_index[$_level]++; goto PARSE_END_OF_INSTRUCTION; } // creates a new function $_pointer += $_offset; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); PARSE_END_OF_INSTRUCTION: if ($_char == 59) { // ; end of instruction $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // ; end of instruction if ($_char == 93) { // ] $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; if (ord ($_string[$_pointer]) == 13) { // cr $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; } // cr if (ord ($_string[$_pointer]) == 10) { // lf $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; } // lf goto PARSE_TAG_SEEK; } // ] // unrecognized char $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; PARSE_END_OF_STRING: if ($parseOnly) return $_array[1]; $this->render_tags_level ($_array[1]); } // function render_tags public function render_tags_level ($array) { // function render_tags_level $length = count ($array); if (!$length) return; $index = 0; goto LEVEL_NEXT_INSTRUCTION_1; LEVEL_NEXT_INSTRUCTION: $index++; if ($index == $length) return; LEVEL_NEXT_INSTRUCTION_1: $current = $array[$index]; if (!isset ($current[1])) goto LEVEL_NEXT_INSTRUCTION; if ($current[0] == 0) { // buffer $this->buffer .= $current[1]; goto LEVEL_NEXT_INSTRUCTION; } // buffer if (isset ($current[2]) and $current[2]) $arguments = $this->render_tags_arguments ($current[2]); else $arguments = array (); switch ($current[1]) { // switch function name case 'if': if ($arguments and ( (is_string ($arguments[0]) and strlen ($arguments[0]) and $arguments[0] != '0') or (!is_string ($arguments[0]) and $arguments[0]) )) { // if condition evaluates true if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); goto LEVEL_NEXT_INSTRUCTION; } // if condition evaluates true while ($index + 1 != $length and isset ($array[$index + 1][1]) and $array[$index + 1][1] == 'elseif') { // loop elseif $current = $array[$index + 1]; if (isset ($current[2])) { // conditions exists $arguments = $this->render_tags_arguments ($current[2]); if ($arguments and $arguments[0]) { // elseif condition evaluates true if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); $index++; goto LEVEL_NEXT_INSTRUCTION; } // elseif condition evaluates true } // conditions exists $index++; } // loop elseif if ($index + 1 != $length and isset ($array[$index + 1][1]) and $array[$index + 1][1] == 'else') { // else $current = $array[$index + 1]; if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); $index++; } // else goto LEVEL_NEXT_INSTRUCTION; case 'elseif': case 'else': goto LEVEL_NEXT_INSTRUCTION; case 'loop': do { // loop if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); } // loop while (eclTag_loop::render ($this)); goto LEVEL_NEXT_INSTRUCTION; case '': if (isset ($arguments[0]) and (!isset ($current[4]) or !$current[4])) $this->buffer .= strval ($arguments[0]); goto LEVEL_NEXT_INSTRUCTION; default: $class = 'eclTag_' . $current[1]; if (preg_match ('/^[a-z][a-zA-Z0-9_]*$/', $class)) $local = $class::render ($this, $arguments); else goto LEVEL_NEXT_INSTRUCTION; if (!is_array ($local) or !$local or (isset ($current[4]) and $current[4])) goto LEVEL_NEXT_INSTRUCTION; if (isset ($current[3]) and $current[3]) { // not empty $this->levelUp ($local); $this->render_tags_level ($current[3]); $this->levelDown (); goto LEVEL_NEXT_INSTRUCTION; } // not empty if (isset ($local['parsed'])) { // parsed content $this->levelUp ($local); $this->render_tags_level ($local['parsed']); $this->levelDown (); goto LEVEL_NEXT_INSTRUCTION; } // parsed content if (isset ($local['html'])) { // render html $this->levelUp ($local); $this->render_tags ($local['html']); $this->levelDown (); goto LEVEL_NEXT_INSTRUCTION; } // render html switch ($current[1]) { // switch tag case 'audio': case 'box': case 'dinamic': case 'file': case 'html': case 'img': case 'mod': case 'table': case 'video': $this->levelUp ($local); eclRender_renderBorders_none::render ($this); $this->levelDown (); goto LEVEL_NEXT_INSTRUCTION; } // switch tag } // switch function name goto LEVEL_NEXT_INSTRUCTION; } // function render_tags_level public function condition ($condition) { // function condition if (!$condition) return true; $not = false; // Vamos separar os membros OR foreach (explode ('||', $condition) as $orGroup) { // each or condition $result = true; // Para cada membro OR, vamos criar uma lista AND $and_list = explode ('&&', $orGroup); foreach ($and_list as $and_condition) { // each and condition $c = trim ($and_condition); if ($c[0] == '!') { // negative operator on $not = true; $c = trim (substr ($c, 1)); } // negative operator on else $not = false; if (!$not and !$this->getVar ($c)) $result = false; elseif ($not and $this->getVar ($c)) $result = false; } // each and condition if ($result) return true; } // each or condition return false; } // function condition public function getVar ($name) { // function getVar global $system; if ($name[0] == '$') $name = substr ($name, 1); $parts = explode ('.', $name); if (count ($parts) == 1) { // local scope if (isset ($this->data[$name])) return $this->data[$name]; if (isset ($this->data['text'][$name])) return $this->data['text'][$name]; if (isset ($this->data['local'][$name])) return $this->data['local'][$name]; if (is_array ($this->data)) { // control mode if (isset ($this->data[$name])) return $this->data[$name]; if (isset ($this->data['text'][$name])) return $this->data['text'][$name]; if (isset ($this->data['local'][$name])) return $this->data['local'][$name]; } // control mode if (is_object ($this->data)) { // application mode } // application mode return ''; } // local scope list ($prefix, $name) = $parts; switch ($prefix) { // switch scope name case 'system': $me = $system; break; case 'domain': case 'home': case 'user': case 'subscription': $me = $this->document->$prefix; break; case 'document': $me = $this->document; break; case 'mod': if (isset ($this->mod[$name])) return $this->mod[$name]; if (isset ($this->mod['text'][$name])) return $this->mod['text'][$name]; if (isset ($this->mod['local'][$name])) return $this->mod['local'][$name]; default: return ''; } // switch scope name if (isset ($me->data[$name])) return $me->data[$name]; if (isset ($me->data['text'][$name])) return $me->data['text'][$name]; if (isset ($me->data['local'][$name])) return $me->data['local'][$name]; return ''; } // function getVar private function render_tags_arguments ($array) { // function render_tags_arguments $arguments = array (); foreach ($array as $current) { // each argument switch ($current[0]) { // switch argument type case 0: case 3: $arguments[] = $current[1]; break; case 1: if (isset ($current[2]) and $current[2]) $sub = $this->render_tags_arguments ($current[2]); else $sub = array (); if ($current[1] == '') { // anonimous function if (isset ($sub[0])) $arguments[] = $sub[0]; } // anonimous function else { // sub function $func = 'eclTag_' . $current[1]; $arguments[] = $func::render ($this, $sub); } // sub function break; case 2: $arguments[] = $this->getVar ($current[1]); break; case 4: if (!isset ($current[2]) or !$current[2]) break; $sub = $this->render_tags_arguments ($current[2]); if (count ($sub) < 2) break; switch ($current[1]) { // switch operator case 'and': if ($sub[0] and $sub[1]) $arguments[] = 1; else $arguments[] = 0; break; case 'or': if ($sub[0]) $arguments[] = $sub[0]; elseif ($sub[1]) $arguments[] = $sub[1]; else $arguments[] = ''; break; } // switch operator break; case 5: if (!isset ($current[2]) or !$current[2]) break; $sub = $this->render_tags_arguments ($current[2]); if (!count ($sub)) break; switch ($current[1]) { // switch operator case '!': if ($sub[0]) $arguments[] = 0; else $arguments[] = 1; } // switch operator break; } // switch argument type } // each argument return $arguments; } // function render_tags_arguments public function toKeyword ($key) { // function toKeyword static $convert = array ('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'â' => 'a', 'Â' => 'a', 'ã' => 'a', 'Ã' => 'a', 'á' => 'a', 'Á' => 'a', 'à' => 'a', 'À' => 'a', 'ä' => 'a', 'Ä' => 'a', 'Ç' => 'c', 'ç' => 'c', 'ê' => 'e', 'Ê' => 'e', 'é' => 'e', 'É' => 'e', 'ë' => 'e', 'Ë' => 'e', 'î' => 'i', 'Î' => 'i', 'í' => 'i', 'Í' => 'i', 'ï' => 'i', 'Ï' => 'i', 'ô' => 'o', 'Ô' => 'o', 'õ' => 'o', 'Õ' => 'o', 'ó' => 'o', 'Ó' => 'o', 'ö' => 'o', 'Ö' => 'o', 'û' => 'u', 'Û' => 'u', 'ú' => 'u', 'Ú' => 'u', 'ü' => 'u', 'Ü' => 'u', 'Ý' => 'y', 'ý' => 'y', 'ÿ' => 'y', 'Ÿ' => 'y', '-' => '-', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0', '_' => '_', ' ' => '_'); // The $last will remember the last character of the convertion // to prevent duplicated spacing "__" or "--" in the name $result = ''; $last = ' '; foreach (str_split ($key) as $char) { // each char if (!isset ($convert[$char])) continue; $valid = $convert[$char]; if ($valid != $last) { // not repeated separator if ($valid == '-' or $valid == ' ' or $valid == '_') $last = $valid; else $last = ''; $result .= $valid; } // not repeated separator } // each char return trim ($result, '-_'); } // function toKeyword } // class eclEngine_render //!eof:engine/eclEngine/eclEngine_render.php; //!file:engine/eclEngine/eclEngine_store.php; class eclEngine_store { // class eclEngine_store public function __get ($name) { // function __get $class = 'eclStore_' . $name; $this->$name = new $class; return $this->$name; } // function __get public function close () { // function close foreach ($this as $name => $driver) { // close each driver if (!isset ($driver->isPhantom)) $driver->close (); } // close each driver } // function close } // class eclEngine_store //!eof:engine/eclEngine/eclEngine_store.php; //!file:engine/eclFilter/eclFilter_address.php; /* * Valid control flags * control_type = address * control_filter = address * control_target * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_address { // class eclFilter_address static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'address'; // target if (isset ($control['flags']['control_target'])) { // target $target = $control['flags']['control_target']; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postalcode', 'country'); foreach ($list as $item) { // each item $value = $formulary->getField ($target . '/' . $item); if ($value === false) continue; if ($formulary->document->charset != 'UTF-8') $value = mb_convert_encoding ($value, $formulary->document->charset, 'UTF-8'); $local[$item] = $formulary->htmlSpecialChars ($value); } // each item } // target $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postalcode', 'country'); foreach ($list as $item) { // each item if (!isset ($formulary->received[$fieldName . '_' . $item])) { // empty $formulary->setField ($target . '/' . $item, false); continue; } // empty $value = $formulary->received[$fieldName . '_' . $item]; if ($formulary->document->charset != 'UTF-8') $value = mb_convert_encoding ($value, 'UTF-8', $formulary->document->charset); $formulary->setField ($target . '/' . $item, $value); } // each item } // function save } // class eclFilter_address //!eof:engine/eclFilter/eclFilter_address.php; //!file:engine/eclFilter/eclFilter_address_view.php; /* * Valid control flags * control_type = address_view * control_filter = address_view * control_target * control_field_name * control_help * control_help_msg * control_clear */ class eclFilter_address_view { // class eclFilter_address_view static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'address_view'; // target if (isset ($control['flags']['control_target'])) { // target $target = $control['flags']['control_target']; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postalcode', 'country'); foreach ($list as $item) { // each item $value = $formulary->getField ($target . '/' . $item); if ($value === false) continue; if ($formulary->document->charset != 'UTF-8') $value = mb_convert_encoding ($value, $formulary->document->charset, 'UTF-8'); $local[$item] = $formulary->htmlSpecialChars ($value); } // each item } // target $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_address_view //!eof:engine/eclFilter/eclFilter_address_view.php; //!file:engine/eclFilter/eclFilter_alphanumeric.php; /* * Valid control flags * control_type text | text_small * control_filter * = alphanumeric * control_target * control_field_name * control_default_value * control_upercase => convert all characters to upercase * control_allow_space => allows word separation with blank space * control_allow_hifen => allows word separation with hifen * control_allow_underscore => allows word separation with underscore * control_clear * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_alphanumeric { // class eclFilter_alphanumeric static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterAlphanumericHelp'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['control_target'])); // default value if ( (!isset ($local['value']) or $local['value'] === '' or $local['value'] === false) and isset ($control['flags']['control_default_value'])) $local['value'] = $control['flags']['control_default_value']; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received value $value = $formulary->received[$fieldName]; $charset = $formulary->document->charset; if ($charset != 'ISO-8859-1') $value = mb_convert_encoding ($value, 'ISO-8859-1', $charset); // Here is a table for character convertion: // the key represents the input character, // and the value is the valid character to use instead // Other characters will be ignored $convert = array ('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'â' => 'a', 'Â' => 'a', 'ã' => 'a', 'Ã' => 'a', 'á' => 'a', 'Á' => 'a', 'à' => 'a', 'À' => 'a', 'ä' => 'a', 'Ä' => 'a', 'Ç' => 'c', 'ç' => 'c', 'ê' => 'e', 'Ê' => 'e', 'é' => 'e', 'É' => 'e', 'ë' => 'e', 'Ë' => 'e', 'î' => 'i', 'Î' => 'i', 'í' => 'i', 'Í' => 'i', 'ï' => 'i', 'Ï' => 'i', 'ô' => 'o', 'Ô' => 'o', 'õ' => 'o', 'Õ' => 'o', 'ó' => 'o', 'Ó' => 'o', 'ö' => 'o', 'Ö' => 'o', 'û' => 'u', 'Û' => 'u', 'ú' => 'u', 'Ú' => 'u', 'ü' => 'u', 'Ü' => 'u', 'Ý' => 'y', 'ý' => 'y', 'ÿ' => 'y', 'Ÿ' => 'y', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0'); if (isset ($control['flags']['control_allow_space'])) $convert[' '] = ' '; if (isset ($control['flags']['control_allow_hifen'])) $convert['-'] = '-'; if (isset ($control['flags']['control_allow_underscore'])) $convert['_'] = '_'; // The $last will remember the last character of the convertion // to prevent duplicated spacing "__" or "--" in the name $result = ''; $last = '_'; foreach (str_split ($value) as $char) { // each char if (!isset ($convert[$char])) continue; $valid = $convert[$char]; if ($valid != $last) { // not repeated separator if ($valid == '-' or $valid == '_' or $valid == ' ') $last = $valid; else $last = ''; $result .= $valid; } // not repeated separator } // each char $value = trim ($result, ' _-'); if (!strlen ($value)) { // invalid characters if (isset ($control['flags']['control_error'])) { // alert invalid $value = $formulary->received[$fieldName]; $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterAlphanumericError', $value); } // alert invalid else $value = false; } // invalid characters // upercase if (isset ($control['flags']['control_upercase'])) $value = strtoupper ($value); } // received value else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = ''; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_alphanumeric //!eof:engine/eclFilter/eclFilter_alphanumeric.php; //!file:engine/eclFilter/eclFilter_apearance.php; /* * control_type = apearance * control_filter = apearance * control_field_name * control_target * background_enabled * border_enabled * font_enabled * paragraph_enabled * * This filter aways clears empty fields */ class eclFilter_apearance { // class eclFilter_apearance static function create ($fieldName, $control, $formulary) { // function create static $base; $document = $formulary->document; // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; // References if (!isset ($base)) { // set base $base['background_ref'] = $document->ref (array ($document->domain->name, '-dialog', 'background')); $base['border_ref'] = $document->ref (array ($document->domain->name, '-dialog', 'border')); $base['font_ref'] = $document->ref (array ($document->domain->name, '-dialog', 'font')); $base['paragraph_ref'] = $document->ref (array ($document->domain->name, '-dialog', 'paragraph')); } // set base $local = $base; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'apearance'; // name $local['name'] = $fieldName; $value = $formulary->getField ($target); if (isset ($control['flags']['background_enabled'])) { // background $local['background_enabled'] = 1; if (isset ($value['background'])) $local['background'] = $value['background']; if (isset ($value['background-color'])) $local['background_color'] = $value['background-color']; } // background if (isset ($control['flags']['border_enabled'])) { // border $local['border_enabled'] = 1; if (isset ($value['border'])) $local['border'] = $value['border']; if (isset ($value['border-color'])) $local['border_color'] = $value['border-color']; } // border if (isset ($control['flags']['font_enabled'])) { // font $local['font_enabled'] = 1; if (isset ($value['font'])) $local['font'] = $value['font']; if (isset ($value['color'])) $local['font_color'] = $value['color']; if (isset ($value['decoration'])) $local['font_decoration'] = $value['decoration']; } // font if (isset ($control['flags']['paragraph_enabled'])) { // paragraph $local['paragraph_enabled'] = 1; if (isset ($value['paragraph'])) $local['paragraph'] = $value['paragraph']; } // paragraph $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; $received = $formulary->received; $value = $formulary->getField ($target); if ($value === false) $value = array (); if (isset ($control['flags']['background_enabled'])) { // background if (isset ($received[$fieldName . '_background']) and strlen ($received[$fieldName . '_background'])) $value['background'] = $received[$fieldName . '_background']; elseif (isset ($value['background'])) unset ($value['background']); if (isset ($received[$fieldName . '_background_color']) and strlen ($received[$fieldName . '_background_color'])) $value['background-color'] = $received[$fieldName . '_background_color']; elseif (isset ($value['background-color'])) unset ($value['background-color']); } // background if (isset ($control['flags']['border_enabled'])) { // border if (isset ($received[$fieldName . '_border']) and strlen ($received[$fieldName . '_border'])) $value['border'] = $received[$fieldName . '_border']; elseif (isset ($value['border'])) unset ($value['border']); if (isset ($received[$fieldName . '_border_color']) and strlen ($received[$fieldName . '_border_color'])) $value['border-color'] = $received[$fieldName . '_border_color']; elseif (isset ($value['border-color'])) unset ($value['border-color']); } // border if (isset ($control['flags']['font_enabled'])) { // font if (isset ($received[$fieldName . '_font']) and strlen ($received[$fieldName . '_font'])) $value['font'] = $received[$fieldName . '_font']; elseif (isset ($value['font'])) unset ($value['font']); if (isset ($received[$fieldName . '_font_color']) and strlen ($received[$fieldName . '_font_color'])) $value['color'] = $received[$fieldName . '_font_color']; elseif (isset ($value['color'])) unset ($value['color']); if (isset ($received[$fieldName . '_font_decoration']) and strlen ($received[$fieldName . '_font_decoration'])) $value['decoration'] = $received[$fieldName . '_font_decoration']; elseif (isset ($value['decoration'])) unset ($value['decoration']); } // font if (isset ($control['flags']['paragraph_enabled'])) { // paragraph if (isset ($received[$fieldName . '_paragraph']) and strlen ($received[$fieldName . '_paragraph'])) $value['paragraph'] = $received[$fieldName . '_paragraph']; elseif (isset ($value['paragraph'])) unset ($value['paragraph']); } // paragraph if (!$value) $value = false; $formulary->setField ($target, $value); } // function save } // class eclFilter_apearance //!eof:engine/eclFilter/eclFilter_apearance.php; //!file:engine/eclFilter/eclFilter_array.php; /* * Valid control flags * control_type textarea | textarea_big | textarea_full * control_filter * = array * control_target * control_field_name * control_clear * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_array { // class eclFilter_array static function create ($fieldName, $control, $formulary) { // function create global $io; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'textarea'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterArrayHelp'; // target if (isset ($control['flags']['control_target'])) { // target $value = $formulary->getField ($control['flags']['control_target']); if (is_array ($value)) $local['value'] = $formulary->htmlSpecialChars ($io->file->array2string ($value, '#')); else $local['value'] = $formulary->htmlSpecialChars ($value); } // target $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received $value = $io->file->string2array ($formulary->received[$fieldName]); if (!$value) { // error // invalid if (isset ($control['flags']['control_error'])) { // invalid $value = $formulary->received[$fieldName]; $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterAlphanumericError', $value); } // invalid else $value = false; } // error } // received else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if (!$value and !isset ($control['flags']['control_clear'])) $value = array (); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_array //!eof:engine/eclFilter/eclFilter_array.php; //!file:engine/eclFilter/eclFilter_bitmask.php; /* * Valid control flags * control_filter = select * control_target * control_field_name * control_help * control_help_msg * control_clear */ class eclFilter_bitmask { // class eclFilter_bitmask static function create ($fieldName, $control, $formulary) { // function create global $store; if (!isset ($control['flags']['control_target'])) return; if (!isset ($control['children'])) return; $value = intval ($formulary->getField ($control['flags']['control_target'])); foreach ($control['children'] as $child_name) { // each child $data = $store->control->read ($child_name); if (!isset ($data['flags']['control_value'])) continue; $mask = intval ($data['flags']['control_value']); if ($mask&$value) $data['value'] = 1; $data['name'] = $fieldName . '_' . $mask; $data['type'] = 'checkbox'; $formulary->appendChild (false, $data); } // each child } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($control['flags']['control_target'])) return; if (!isset ($control['children'])) return; $target = $control['flags']['control_target']; $value = 0; foreach ($control['children'] as $child_name) { // each child $data = $store->control->read ($child_name); if (!isset ($data['flags']['control_value'])) continue; $mask = intval ($data['flags']['control_value']); if (isset ($formulary->received[$fieldName . '_' . $mask])) $value += $mask; } // each child $formulary->setField ($target, $value); } // function save } // class eclFilter_bitmask //!eof:engine/eclFilter/eclFilter_bitmask.php; //!file:engine/eclFilter/eclFilter_block.php; /* * valid control flags * control_type = textarea_small | textarea | textarea_big | textarea_full * control_filter = block * control_target * control_field_name * control_clear * control_help * control_help_msg * control_required * control_required_msg * control_error * control_error_msg */ class eclFilter_block { // class eclFilter_block static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'textarea'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterBlockHelp'; // target if (isset ($control['flags']['control_target'])) { // get value $value = $formulary->getField ($control['flags']['control_target']); if ($value !== false) $local['value'] = $formulary->htmlSpecialChars ($value); } // get value $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // filter input $line = 1; $buffer = ''; if (isset ($control['flags']['control_error'])) $invalid = true; foreach (str_split ($formulary->received[$fieldName]) as $pointer => $char) { // loop chars if ($char == LF) $line++; if (ord ($char) > 9 and ord ($char) < 128) $buffer .= $char; elseif (isset ($invalid)) { // invalid character $control['flags']['char'] = $formulary->htmlSpecialChars (substr ($formulary->received[$fieldName], $pointer, 10)) . '...'; $control['flags']['line'] = $line; $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterBlockError'); break; } // invalid character else $buffer .= '?'; } // loop chars if (isset ($invalid)) $value = $formulary->received[$fieldName]; else $value = $buffer; } // filter input else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = ''; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_block //!eof:engine/eclFilter/eclFilter_block.php; //!file:engine/eclFilter/eclFilter_checkbox.php; /* * Valid control flags * control_type = checkbox * control_filter = checkbox * control_target * control_field_name * control_invert => invert selection before showing and before saving * control_clear => if value == 0, clears the target flag * control_true_value => specifies a value to save when checked, like 'yes' - note that its depends of control_invert * control_false_value => specifies a value to save when not checked, like 'no' - note that its depends of control_invert * control_help * control_help_msg */ class eclFilter_checkbox { // class eclFilter_checkbox static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'checkbox'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterCheckboxHelp'; // value $value = 0; if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (isset ($control['flags']['control_true_value'])) { // predefined value if ($value == $control['flags']['control_true_value']) $value = 1; else $value = 0; } // predefined value elseif (isset ($control['flags']['control_false_value'])) { // predefined false value if ($value == $control['flags']['control_false_value']) $value = 0; else $value = 1; } // predefined false value elseif ($value) $value = 1; else $value = 0; // invert if (isset ($control['flags']['control_invert'])) $value ? $value = 0 : $value = 1; if ($value) $local['value'] = 1; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and $formulary->received[$fieldName]) $value = 1; else $value = 0; // invert if (isset ($control['flags']['control_invert'])) $value ? $value = 0 : $value = 1; // clear if (isset ($control['flags']['control_clear']) and !$value) $value = false; // true value if ($value and isset ($control['flags']['control_true_value'])) $value = $control['flags']['control_true_value']; // false value elseif (!$value and isset ($control['flags']['control_false_value'])) $value = $control['flags']['control_false_value']; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_checkbox //!eof:engine/eclFilter/eclFilter_checkbox.php; //!file:engine/eclFilter/eclFilter_color.php; /* * control_type = color * control_filter = color * control_field_name * control_target * control_default * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg * * This filter aways clears empty fields */ class eclFilter_color { // class eclFilter_color static function create ($fieldName, $control, $formulary) { // function create $local['ref'] = $formulary->document->ref (array ($formulary->document->domain->name, '-dialog', 'color')); // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'color'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterColorHelp'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->getField ($control['flags']['control_target']); // default if (isset ($control['flags']['control_default'])) { // default $default = $formulary->getField ($control['flags']['control_default']); if ($default[0] == '$') $local['from'] = str_replace ('-', '_', substr ($default, 1)); else $local['default'] = $default; } // default // Current if (isset ($local['value'])) $local['current'] = $local['value']; elseif (isset ($local['default'])) $local['current'] = $local['default']; // property if (isset ($control['flags']['control_property'])) $local['property'] = $control['flags']['control_property']; // class if (isset ($control['flags']['control_field_name'])) { // class $local['class'] = $control['flags']['control_field_name']; $local['target'] = str_replace ('-', '_', $control['flags']['control_field_name']); } // class $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received value $value = $formulary->received[$fieldName]; if (!preg_match ('/^[a-zA-Z0-9\ #(),.]+$/', $value)) { // error // error if (isset ($control['flags']['control_error'])) $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterColorError', $value); else $value = false; } // error } // received value else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_color //!eof:engine/eclFilter/eclFilter_color.php; //!file:engine/eclFilter/eclFilter_content.php; /* * Control flags * control_type = content * control_filter = content */ class eclFilter_content { // class eclFilter_content static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'content'; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_content //!eof:engine/eclFilter/eclFilter_content.php; //!file:engine/eclFilter/eclFilter_css.php; /* * Valid control flags * control_type = select_dinamic * control_filter = css * control_target * control_field_name * control_help * control_help_msg * * This filter aways clear empty or invalid fields */ class eclFilter_css { // class eclFilter_css static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select_dinamic'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterCssHelp'; // references for dialog popups $item->data['add'] = $document->ref (array ($document->domain->name, '-dialog', 'css')); $item->data['configure'] = $document->ref (array ($document->domain->name, '-dialog', 'css'), false, false); $item->data['poplang'] = $document->lang . '/'; $item->data['mode'] = 'css'; if (!isset ($control['flags']['control_target'])) return; $value = (array)$formulary->getField ($control['flags']['control_target']); $buffer = ''; foreach ($value as $line) { // each line $line = trim ($line); if (!strlen ($line)) continue; $buffer .= $line . CRLF; $item->appendChild (false, array ('value' => $line, 'caption' => $document->textMerge ($line))); } // each line $item->data['value'] = $buffer; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $received = $formulary->received; $buffer = array (); if (isset ($received[$fieldName . '_serialized'])) { // received foreach (explode (LF, $received[$fieldName . '_serialized']) as $line) { // each line $line = trim ($line); if (preg_match ('%^[a-z0-9][a-z0-9/_-]*\.css$%', $line)) $buffer[] = $line; } // each line } // received if (!$buffer) $buffer = false; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $buffer); } // function save } // class eclFilter_css //!eof:engine/eclFilter/eclFilter_css.php; //!file:engine/eclFilter/eclFilter_date.php; /* * Valid control flags * control_type = date * control_filter = date * control_target * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg * * This filter aways clear empty values */ class eclFilter_date { // class eclFilter_date static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'date'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterPhoneHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (is_string ($value) and strlen ($value)) { // value not empty $list = explode ('/', $value); if (count ($list) == 3) $local['year'] = $list[0]; $local['month'] = $list[1]; $local['day'] = $list[2]; } // value not empty $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName . '_year'])) $year = intval ($formulary->received[$fieldName . '_year']); else $year = ''; if (isset ($formulary->received[$fieldName . '_month'])) $month = intval ($formulary->received[$fieldName . '_month']); else $month = ''; if (isset ($formulary->received[$fieldName . '_day'])) $day = intval ($formulary->received[$fieldName . '_day']); else $day = ''; // required if ($day === '' and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName . '_year'); // Error if ($year < 1900 and $year > 2500) $year = ''; if ($month < 1 and $month > 12) $month = ''; if ($day < 1 and $day > 31) $day = ''; $value = $year . '/' . $month . '/' . $day; // clear if (!$year and !$month and !$day) $value = false; elseif (!$year or !$month or !$day) $formulary->setErrorMsg ($control, $fieldName . '_year', 'systemFormulary_filterDateError'); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_date //!eof:engine/eclFilter/eclFilter_date.php; //!file:engine/eclFilter/eclFilter_datetime.php; /* * Valid control flags: * control_type = date * control_filter = date * control_target * control_field_name * control_help * control_help_msg * * The default value for this field is aways "now" */ class eclFilter_datetime { // class eclFilter_datetime static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // control_type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'datetime'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterDateHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (!$value) $value = TIME; $valueY = date ('Y', $value); $valueM = date ('m', $value); $valueD = date ('j', $value); $valueH = date ('H', $value); $valueI = date ('i', $value); $local = array ('name' => $fieldName); $year = $item->appendChild (false, $local); $month = $item->appendChild (false, $local); $day = $item->appendChild (false, $local); $hour = $item->appendChild (false, $local); for ($y = 2030; $y > 1969; $y--) { // each year $year->appendChild (false, array ('value' => $y)) ->active ($y == $valueY); } // each year for ($m = 12; $m > 0; $m--) { // each month $local = array ('value' => $m); $month->appendChild ($store->control->read ('labels/date/month' . $m), $local) ->active ($m == $valueM); } // each month for ($d = 31; $d > 0; $d--) { // each day $day->appendChild (false, array ('value' => $d)) ->active ($d == $valueD); } // each day for ($h = 24; $h >= 0; $h--) { // each hour $local = array ('value' => $h . ':30'); $hour->appendChild (false, $local) ->active ($valueH == $h and $valueI); $local = array ('value' => $h . ':00'); $hour->appendChild (false, $local) ->active ($valueH == $h and !$valueI); } // each hour return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; if ( isset ($received[$fieldName . '_year']) and isset ($received[$fieldName . '_month']) and isset ($received[$fieldName . '_day']) and isset ($received[$fieldName . '_hour']) ) { // received value $y = intval ($received[$fieldName . '_year']); $m = intval ($received[$fieldName . '_month']); $d = intval ($received[$fieldName . '_day']); preg_match ('/^([0-2]?[0-9]):?([0-5][0-9])?$/', $received[$fieldName . '_hour'], $preg_match); isset ($preg_match[1]) ? $h = $preg_match[1] : $h = 0; isset ($preg_match[2]) ? $i = $preg_match[2] : $i = 0; $value = mktime ($h, $i, 0, $m, $d, $y); } // received value else $value = TIME; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_datetime //!eof:engine/eclFilter/eclFilter_datetime.php; //!file:engine/eclFilter/eclFilter_decoration.php; /* * Valid control flags * control_type = select * control_filter = decoration * control_field_name * control_help * control_help_msg */ class eclFilter_decoration { // class eclFilter_decoration static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterDecorationHelp'; // value if (!isset ($formulary->data['style'])) $value = 'default'; else { // style exists $style = $formulary->data['style']; if (!isset ($style['a']['text_decoration'])) $value = 'default'; elseif ($style['a']['text_decoration'] == 'underline') $value = 'aways'; elseif (isset ($style['a_hover']['text_decoration']) and $style['a_hover']['text_decoration'] == 'underline') $value = 'hover'; else $value = 'none'; } // style exists if (isset ($control['children'])) { // children exists foreach ($control['children'] as $child_name) { // each child $child = $item->appendChild ($child_name); if (isset ($child->data['control_value'])) { // value exists $child->data['value'] = $child->data['control_value']; if ($child->data['control_value'] == $value) $child->data['active'] = 1; } // value exists } // each child } // children exists return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($received[$fieldName])) $value = trim ($received[$fieldName], ' -_'); else $value = 'default'; switch ($value) { // switch value case 'none': $formulary->setField ('style.a.text_decoration', 'none'); $formulary->setField ('style.a_hover.text_decoration', false); break; case 'underline': $formulary->setField ('style.a.text_decoration', 'underline'); $formulary->setField ('style.a_hover.text_decoration', false); break; case 'hover': $formulary->setField ('style.a.text_decoration', 'none'); $formulary->setField ('style.a_hover.text_decoration', 'underline'); break; default: $formulary->setField ('style.a.text_decoration', false); $formulary->setField ('style.a_hover.text_decoration', false); } // switch value } // function save } // class eclFilter_decoration //!eof:engine/eclFilter/eclFilter_decoration.php; //!file:engine/eclFilter/eclFilter_details.php; /* * Valid control flags * control_type = select_dinamic * control_filter = details * control_field_name * control_target = local/details * control_help * control_help_msg */ class eclFilter_details { // class eclFilter_details static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select_dinamic'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterDetailsHelp'; // references $item->data['add'] = $document->ref (array ($document->domain->name, '-dialog', 'details')); $item->data['configure'] = $document->ref (array ($document->domain->name, '-dialog', 'details'), false, false); $item->data['poplang'] = $document->lang . '/'; $item->data['mode'] = 'module'; // target if (!isset ($control['flags']['control_target'])) return; $value = trim (strval ($formulary->getField ($control['flags']['control_target']))); $buffer = ''; foreach (explode (CRLF, $value) as $line) { // each line $line = trim ($line); if (!strlen ($line)) continue; $data = $store->control->read ('details/' . $line . '/_description'); if (isset ($data['text']['caption'])) $caption = $data['text']['caption']; else $caption = $document->textMerge ($line); $buffer .= $line . CRLF; $item->appendChild (false, array ('value' => $line, 'caption' => $caption)); } // each line $item->data['value'] = $buffer; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $buffer = array (); if (isset ($formulary->received[$fieldName . '_serialized'])) { // received foreach (explode (LF, $formulary->received[$fieldName . '_serialized']) as $line) { // each line $line = trim ($line); if (preg_match ('/^[a-z][a-z0-9_]*$/', $line)) $buffer[] = $line; } // each line } // received if ($buffer) $buffer = implode (CRLF, $buffer); else $buffer = false; // target if ($buffer and isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $buffer); } // function save } // class eclFilter_details //!eof:engine/eclFilter/eclFilter_details.php; //!file:engine/eclFilter/eclFilter_end.php; class eclFilter_end { // class eclFilter_end static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->appendChild (); $item->data['type'] = 'end'; foreach ($formulary->hidden as $name => $value) { // each hidden field $item->appendChild (false, array ( 'name' => $name, 'value' => $value )); } // each hidden field } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_end //!eof:engine/eclFilter/eclFilter_end.php; //!file:engine/eclFilter/eclFilter_fields.php; /* * Valid control flags * control_type = select_fields * control_filter = fields * control_field_name * control_target * control_help * control_help_msg */ class eclFilter_fields { // class eclFilter_fields static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type $item->data['type'] = 'select_fields'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterModulesHelp'; // references $item->data['add'] = $document->ref (array ($document->domain->name, '-dialog', 'fields')); $item->data['configure'] = $document->ref (array ($document->domain->name, '-dialog', 'fields'), false, false); $item->data['poplang'] = $document->lang . '/'; // value $value = $formulary->getField ($target); if (is_array ($value)) { // each array item foreach ($value as $name => $content) { // each field if (!isset ($content['caption']) or !isset ($content['filter'])) continue; $data = array ( 'name' => $name, 'filter' => $content['filter'], 'caption' => $content['caption'], 'content' => str_replace (array ('#', "\r", "\n", '"'), array ('#c', '#r', '#n', '#q'), eclIo_file::array2string ($content)) ); $item->appendChild ($data); } // each field } // each array item } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; if (!isset ($formulary->received[$fieldName . '_serialized'])) return; $value = $formulary->received[$fieldName . '_serialized']; $value = str_replace (array ('#r', '#n', '#q', '#c'), array ("\r", "\n", '"', '#'), $value); $value = eclIo_file::string2array ($value); $formulary->setField ($target, $value); } // function save } // class eclFilter_fields //!eof:engine/eclFilter/eclFilter_fields.php; //!file:engine/eclFilter/eclFilter_file_big.php; /* * Control flags * control_type = file_big * control_filter = _file_big */ class eclFilter_file_big { // class eclFilter_file_big static function create ($fieldName, $control, $formulary) { // function create $control['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $control['type'] = $control['flags']['control_type']; else $control['type'] = 'file_big'; $control['ref'] = $formulary->document->ref ($formulary->pathway, $formulary->lang, $formulary->action, $formulary->protocol); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_file_big //!eof:engine/eclFilter/eclFilter_file_big.php; //!file:engine/eclFilter/eclFilter_filename.php; /* * Control flags * control_type = text_small | text * control_filter = filename * control_target * control_field_name * control_file_extension * control_default_value * control_clear * control_help * control_help_msg * control_required * control_required_msg * control_error * control_error_msg */ class eclFilter_filename { // class eclFilter_filename static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterFilenameHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); else $value = false; // default value if ( ($value === false or $value === '') and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; $local['value'] = $formulary->htmlSpecialChars ($value); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received list ($value) = explode ('.', $formulary->received[$fieldName]); if (!preg_match ('/^[a-z][a-z0-9_-]*$/', $value)) { // invalid if (isset ($control['flags']['control_error'])) { // alert invalid $value = $formulary->received[$fieldName]; $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterFilenameError', $value); } // alert invalid else $value = false; } // invalid if (isset ($control['flags']['control_file_extension'])) $value .= '.' . $control['flags']['control_file_extension']; } // received else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = ''; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_filename //!eof:engine/eclFilter/eclFilter_filename.php; //!file:engine/eclFilter/eclFilter_flag.php; /* * Valid control flags * control_type = text_small | text * control_filter = flag * control_target * control_field_name * control_preg = * control_default_value * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_flag { // class eclFilter_flag static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterFlagHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['control_target'])); else $value = false; // default value if ( ($value === false or $value === '') and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; $local['value'] = $value; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received $value = $formulary->received[$fieldName]; if ( (isset ($control['flags']['control_preg']) and !@preg_match ($control['flags']['control_preg'], $value)) or !preg_match ('/^[a-z][a-z0-9_-]*$/', $value) ) { // invalid // error if (isset ($control['flags']['control_error'])) $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterFlagError', $value); else $value = false; } // invalid } // received else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = ''; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_flag //!eof:engine/eclFilter/eclFilter_flag.php; //!file:engine/eclFilter/eclFilter_flag_view.php; /* * Valid control flags * control_type = view * control_filter = flag_view * control_target * control_field_name * control_default_value */ class eclFilter_flag_view { // class eclFilter_flag_view static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'view'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); else $value = false; if ($value !== false and $value !== '') $local['content'] = $formulary->document->textMerge ($value); elseif (isset ($control['flags']['control_default_value'])) $local['content'] = $document->textMerge ($control['flags']['control_default_value']); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_flag_view //!eof:engine/eclFilter/eclFilter_flag_view.php; //!file:engine/eclFilter/eclFilter_font.php; /* * Valid control flags * control_type = font * control_filter = font * control_target * control_field_name * control_help * control_help_msg * * This filter aways clears wrong or empty fields */ class eclFilter_font { // class eclFilter_font static function create ($fieldName, $control, $formulary) { // function create $local['ref'] = $formulary->document->ref (array ($formulary->document->domain->name, '-dialog', 'font')); // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'font'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterFontHelp'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['control_target'])); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) $value = $formulary->received[$fieldName]; else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_font //!eof:engine/eclFilter/eclFilter_font.php; //!file:engine/eclFilter/eclFilter_formulary.php; /* * Valid control flags * control_filter = formulary * control_base_target = A prefix for each control_target, like 'path/' * control_base_name = a prefix for each field name, like 'path' * * Note that the control needs children */ class eclFilter_formulary { // class eclFilter_formulary static function create ($fieldName, $control, $formulary) { // function create if (!isset ($control['children'])) return; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'fields'; $formulary->appendChild ($control, $local); $formulary->levelUp ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save $formulary->insertControlChildren ($control); } // function save } // class eclFilter_formulary //!eof:engine/eclFilter/eclFilter_formulary.php; //!file:engine/eclFilter/eclFilter_free.php; /* * Valid control flags * control_type = text_small | text | text_tiny | textarea_small | textarea | textarea_big | textarea_full * control_filter = free * control_target * control_field_name * control_default_value * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_free { // class eclFilter_free static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'textarea'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterFreeHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['control_target'])); else $value = false; // default value if ( ($value === false or $value === '') and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; $local['value'] = $value; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) $value = $formulary->received[$fieldName]; else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = ''; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_free //!eof:engine/eclFilter/eclFilter_free.php; //!file:engine/eclFilter/eclFilter_img.php; /* * Valid control flags * control_type = file * control_filter = img * control_target * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_img { // class eclFilter_img static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'file'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterImgHelp'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $flags = $formulary->flags; $received = $formulary->received; if ($formulary->errorMsg !== false) return; if (!isset ($control['flags']['control_target'])) return; if (!isset ($_FILES[$fieldName]['type'])) { // error if (isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'systemFormulary_filterImgNotUploaded'); return false; } // error isset ($flags['img_size']) or $flags['img_size'] = 3840; isset ($flags['img_mini_size']) or $flags['img_mini_size'] = 256; isset ($flags['img_interlace']) or $flags['img_interlace'] = false; isset ($flags['target_name']) or $flags['target_name'] = $formulary->document->application->name; isset ($flags['target_index']) or $flags['target_index'] = 0; $uploaded = $_FILES[$fieldName]['tmp_name']; if (@getimagesize ($uploaded) === false) { // error if (isset ($control['flags']['control_error'])) return $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterImgNotUploaded'); return false; } // error list ($width_orig, $height_orig, $type) = getimagesize ($uploaded); $ratio_orig = $width_orig / $height_orig; // Calculate big image size if ($width_orig > $flags['img_size'] or $height_orig > $flags['img_size']) { // resize big image $img_width = $flags['img_size']; $img_height = $flags['img_size']; if ($img_width / $img_height > $ratio_orig) $img_width = $img_height * $ratio_orig; else $img_height = $img_width / $ratio_orig; } // resize big image else { // keep image size $img_width = $width_orig; $img_height = $height_orig; } // keep image size settype ($img_width, 'int'); settype ($img_height, 'int'); // Calculate miniature size if ($width_orig > $flags['img_mini_size'] or $height_orig > $flags['img_mini_size']) { // resize miniature $mini_width = $flags['img_mini_size']; $mini_height = $flags['img_mini_size']; if ($mini_width / $mini_height > $ratio_orig) $mini_width = $mini_height * $ratio_orig; else $mini_height = $mini_width / $ratio_orig; } // resize miniature else { // keep image size $mini_width = $width_orig; $mini_height = $height_orig; } // keep image size settype ($mini_width, 'int'); settype ($mini_height, 'int'); // Suported formats are if ($type == 1) $ext = '.gif'; elseif ($type == 2) $ext = '.jpg'; elseif ($type == 3) $ext = '.png'; else return 'systemFormulary_alertImgWrongFormat'; // Opens received file if ($type == 1) $image_orig = @imagecreatefromgif ($uploaded); elseif ($type == 2) $image_orig = @imagecreatefromjpeg ($uploaded); elseif ($type == 3) $image_orig = @imagecreatefrompng ($uploaded); if (!$image_orig) return 'systemFormulary_alertImageError'; $name = $flags['target_name']; if ($flags['target_index']) $name .= CHR_FNS . $flags['target_index']; $filename = FOLDER_DOMAINS . $formulary->document->domain->name . '/' . $name; // Resample big image $image_big = imagecreatetruecolor ($img_width, $img_height); imagecopyresampled ($image_big, $image_orig, 0, 0, 0, 0, $img_width, $img_height, $width_orig, $height_orig); // save big image if ($type == 1) $saved = imagegif ($image_big, $filename . $ext); elseif ($type == 2) $saved = imagejpeg ($image_big, $filename . $ext, 100); elseif ($type == 3) $saved = imagepng ($image_big, $filename . $ext); if (!$saved) return 'systemFormulary_alertImgError'; // Resample miniature $image_mini = imagecreatetruecolor ($mini_width, $mini_height); imagecopyresampled ($image_mini, $image_orig, 0, 0, 0, 0, $mini_width, $mini_height, $width_orig, $height_orig); // save miniature if ($type == 1) $saved = imagegif ($image_mini, $filename . 'mini.gif'); elseif ($type == 2) $saved = imagejpeg ($image_mini, $filename . 'mini.jpg', 100); elseif ($type == 3) $saved = imagepng ($image_mini, $filename . 'mini.png'); if (!$saved) return 'systemFormulary_alertImgError'; // save image data $data['img_width'] = $img_width; $data['img_height'] = $img_height; $data['img_mini_width'] = $mini_width; $data['img_mini_height'] = $mini_height; $data['img'] = $name . $ext; $data['img_mini'] = $name . 'mini' . $ext; $formulary->setField ($control['flags']['control_target'], $data); } // function save } // class eclFilter_img //!eof:engine/eclFilter/eclFilter_img.php; //!file:engine/eclFilter/eclFilter_integer.php; /* * Valid control flags: * control_type text_tiny_leftfield | text_tiny | text_small | range * control_filter = integer * control_target * control_field_name * control_clear * control_default_value * control_clear_default_value => clear the field when the value is the default value * control_min_input => adjust the value if received is smaller * control_max_input => adjust the value if received is bigger * control_step => for use with range inputs * control_help * control_help_msg */ class eclFilter_integer { // class eclFilter_integer static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_small'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterIntegerHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); else $value = false; // default_value if ($value === false and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; $local['value'] = $value; if (isset ($control['flags']['control_min_input'])) $local['min'] = $control['flags']['control_min_input']; if (isset ($control['flags']['control_max_input'])) $local['max'] = $control['flags']['control_max_input']; if (isset ($control['flags']['control_step'])) $local['step'] = $control['flags']['control_step']; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName])) { // received value $value = $formulary->received[$fieldName]; if (!preg_match ('/^[-]?[0-9]+$/', $value)) $value = false; } // received value else $value = false; // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = 0; if (isset ($control['flags']['control_default_value']) and isset ($control['flags']['control_clear_default_value']) and $value == $control['flags']['control_default_value']) $value = false; if ($value !== false) { // valid value settype ($value, 'int'); // min_input if (isset ($control['flags']['control_min_input']) and $value < $control['flags']['control_min_input']) $value = $control['flags']['control_min_input']; // max_input if (isset ($control['flags']['control_max_input']) and $value > $control['flags']['control_max_input']) $value = $control['flags']['control_max_input']; } // received value // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_integer //!eof:engine/eclFilter/eclFilter_integer.php; //!file:engine/eclFilter/eclFilter_js.php; /* * Valid control flags * control_type = select_dinamic * control_filter = js * control_target * control_field_name * control_help * control_help_msg * * This filter aways clear empty or invalid fields */ class eclFilter_js { // class eclFilter_js static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select_dinamic'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterJsHelp'; // references for dialog popups $item->data['add'] = $document->ref (array ($document->domain->name, '-dialog', 'js')); $item->data['configure'] = $document->ref (array ($document->domain->name, '-dialog', 'js'), false, false); $item->data['poplang'] = $document->lang . '/'; $item->data['mode'] = 'javascript'; if (!isset ($control['flags']['control_target'])) return; $value = (array)$formulary->getField ($control['flags']['control_target']); $buffer = ''; foreach ($value as $line) { // each line $line = trim ($line); if (!strlen ($line)) continue; $buffer .= $line . CRLF; $item->appendChild (false, array ('value' => $line, 'caption' => $document->textMerge ($line))); } // each line $item->data['value'] = $buffer; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $received = $formulary->received; $buffer = array (); if (isset ($received[$fieldName . '_serialized'])) { // received foreach (explode (LF, $received[$fieldName . '_serialized']) as $line) { // each line $line = trim ($line); if (preg_match ('%^[a-z0-9][a-z0-9/_-]*\.js$%', $line)) $buffer[] = $line; } // each line } // received if (!$buffer) $buffer = false; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $buffer); } // function save } // class eclFilter_js //!eof:engine/eclFilter/eclFilter_js.php; //!file:engine/eclFilter/eclFilter_keywords_pack.php; /* * Valid control flags * control_filter = keywords_pack */ class eclFilter_keywords_pack { // class eclFilter_keywords_pack static function create ($fieldName, $control, $formulary) { // function create } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; // If a previous problem was ocurred saving the formulary, we need to abort if ($formulary->errorMsg !== false) return false; $data = &$formulary->data; if (isset ($data['name'])) $keywords = $data['name']; else $keywords = ''; foreach (array ('caption', 'title', 'author') as $field) { // each text field if (isset ($data['text'][$field])) { // field exists foreach ($data['text'][$field] as $language) { // each language if (!isset ($language[TEXT_CHARSET]) or $language[TEXT_CHARSET] == 0) $keywords .= ' ' . mb_convert_encoding ($language[TEXT_CONTENT], 'ISO-8859-1', 'UTF-8'); elseif ($language[TEXT_CHARSET] == 1) $keywords .= ' ' . $language[TEXT_CONTENT]; } // each language } // field exists } // each text field $keywords = str_replace (array ('#', ';'), '', $keywords); if (isset ($data['text']['keywords'])) { // set hash tags $buffer = ''; foreach ($data['text']['keywords'] as $language) { // each language if (!isset ($language[TEXT_CHARSET]) or $language[TEXT_CHARSET] == 0) $buffer .= ' ' . mb_convert_encoding ($language[TEXT_CONTENT], 'ISO-8859-1', 'UTF-8'); elseif ($language[TEXT_CHARSET] == 1) $buffer .= ' ' . $language[TEXT_CONTENT]; } // each language foreach (explode (' ', $buffer) as $key) { // filter each keyword $key = str_replace (array ('#', ';'), '', $key); if (!strlen ($key)) continue; $keywords .= ' :' . $key . ':'; } // filter each keyword } // set hash tags $formulary->data['keywords'] = implode (' ', eclIo_database::filterKeywords ($keywords)); } // function save } // class eclFilter_keywords_pack //!eof:engine/eclFilter/eclFilter_keywords_pack.php; //!file:engine/eclFilter/eclFilter_length.php; /* * Valid control flags * control_type = text_tiny | text_small * control_filter = length * control_target * control_field_name * control_help * control_help_msg * * This filter aways clears invalid or blank fields */ class eclFilter_length { // class eclFilter_length static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_small'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterLengthHelp'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->getField ($control['flags']['control_target']); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received $value = $formulary->received[$fieldName]; if (!preg_match ('/^([0]?)|([-]?[0-9.]+(ch|cm|em|ex|in|mm|pc|pt|px|rem|vh|vmin|vmax|vw|\%))$/', $value)) { // error if (isset ($control['flags']['control_error'])) $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterLengthError', $value); else $value = false; } // error } // received else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_length //!eof:engine/eclFilter/eclFilter_length.php; //!file:engine/eclFilter/eclFilter_list.php; /* * Valid control flags * control_type = list * control_filter = list * control_target * control_field_name * list_type = table list menu * control_help * control_help_msg */ class eclFilter_list { // class eclFilter_list static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'list'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterListHelp'; $path = array ($document->domain->name, '-dialog', 'list'); $item->data['ref'] = $document->ref ($path); // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; // Reference $item->data['ref'] = $document->ref (array ($document->domain->name, '-dialog', 'list'), true, true); // list name $listName = $formulary->getField ($target); if (!$listName and isset ($control['flags']['control_default_value'])) $listName = $control['flags']['control_default_value']; elseif (!$listName) $listName = 'menu_simple_vertical'; $item->data['list_name'] = $listName; // list type if (isset ($control['flags']['list_type'])) $listType = $control['flags']['list_type']; foreach ($store->control->scandir ('s', 'lists') as $name) { // each list $data = $store->control->read ('lists/' . $name . '/_description'); if (!$data) continue; if (isset ($listType)) { // filter type of list if (!isset ($data['flags']['list_for_' . $listType])) continue; } // filter type of list $data['value'] = $name; $item->appendChild ($data) ->active ($name == $listName); } // each list return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; $data = &$formulary->data; if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; if (!isset ($received[$fieldName . '_name'])) { // value not received if (!$formulary->getField ($target) and isset ($control['flags']['control_default_value'])) $name = $control['flags']['control_default_value']; else return false; } // value not received else $name = $received[$fieldName . '_name']; $formulary->setField ($target, $name); if (!isset ($received[$fieldName . '_content']) or !strlen ($received[$fieldName . '_content'])) { // empty content unset ($formulary->data['blocks']['lists/' . $name]); return false; } // empty content $out = array ('#Q', '#L', '#A', '#B', '#C'); $in = array ('"', '<', '&', '\\', '#'); $string = str_replace ($out, $in, $received[$fieldName . '_content']); $formulary->data['blocks']['lists/' . $name] = $io->file->string2array ($string); return false; } // function save } // class eclFilter_list //!eof:engine/eclFilter/eclFilter_list.php; //!file:engine/eclFilter/eclFilter_mail.php; /* * Valid control flags * control_type = text_small | text * control_filter = mail * control_target * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_mail { // class eclFilter_mail static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterMailHelp'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['control_target'])); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received $value = $formulary->received[$fieldName]; if (!preg_match ('/^[a-z0-9._-]+[@][a-z0-9_-]+\.[a-z0-9._-]+$/', $value)) { // error if (isset ($control['flags']['control_error'])) $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterMailError', $value); else $value = false; } // error } // received else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['control_clear'])) $value = ''; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_mail //!eof:engine/eclFilter/eclFilter_mail.php; //!file:engine/eclFilter/eclFilter_me.php; class eclFilter_me { // class eclFilter_me static function create ($fieldName, $control, $formulary) { // function create } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($control['flags']['control_target'])) return; if (!$formulary->document->user->domainId) return; if (isset ($control['flags']['control_no_overwrite']) and $formulary->getField ($control['flags']['control_target'])) return; $formulary->setField ($control['flags']['control_target'], $formulary->document->user->userId); } // function save } // class eclFilter_me //!eof:engine/eclFilter/eclFilter_me.php; //!file:engine/eclFilter/eclFilter_modules.php; /* * Valid control flags * control_type = select_dinamic * control_filter = modules * control_field_name * control_target * control_help * control_help_msg */ class eclFilter_modules { // class eclFilter_modules static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select_dinamic'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterModulesHelp'; // references $item->data['add'] = $document->ref (array ($document->domain->name, '-dialog', 'add')); $item->data['configure'] = $document->ref (array ($document->domain->name, '-dialog', 'mod'), false, false); $item->data['poplang'] = $document->lang . '/'; $item->data['mode'] = 'module'; // target if (!isset ($control['flags']['control_target'])) return; $value = trim (strval ($formulary->getField ($control['flags']['control_target']))); $buffer = ''; foreach (explode (CRLF, $value) as $line) { // each line $line = trim ($line); if (!strlen ($line)) continue; @list ($prefix, $sufix) = explode ('_', $line, 2); switch ($prefix) { // prefix case 'img': $data = $store->domainContent->open ($document->domain->domainId, $sufix); $caption = false; if (isset ($data['text']['img_description'])) $caption = $data['text']['img_description']; elseif (isset ($data['text']['title'])) $caption = $data['text']['title']; elseif (isset ($data['text']['caption'])) $caption = $data['text']['caption']; if ($caption !== false) { // caption found $label = $store->control->read ('personalite_img'); $caption = $document->textMerge ($label['text']['caption'], ' (', $caption, ')'); } // caption found else $caption = $document->textMerge ($line); break; default: $file = $io->file->read (FOLDER_SHARED . 'modules/' . $line . '/_description.ecl.php'); if (isset ($file['text']['caption'])) $caption = $file['text']['caption']; else $caption = $document->textMerge ($line); } // prefix $buffer .= $line . CRLF; $item->appendChild (false, array ('value' => $line, 'caption' => $caption)); } // each line $item->data['value'] = $buffer; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $buffer = array (); if (isset ($formulary->received[$fieldName . '_serialized'])) { // received foreach (explode (LF, $formulary->received[$fieldName . '_serialized']) as $line) { // each line $line = trim ($line); if (preg_match ('/^[a-z][a-z0-9_]*$/', $line)) $buffer[] = $line; } // each line } // received if ($buffer) $buffer = implode (CRLF, $buffer); else $buffer = false; // target if ($buffer and isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $buffer); } // function save } // class eclFilter_modules //!eof:engine/eclFilter/eclFilter_modules.php; //!file:engine/eclFilter/eclFilter_ok.php; class eclFilter_ok { // class eclFilter_ok static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_tiny'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->received[$fieldName]) or !preg_match ('/^["]?[oO][kK]["]?$/', $formulary->received[$fieldName])) $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterConfirmWithOkError'); } // function save } // class eclFilter_ok //!eof:engine/eclFilter/eclFilter_ok.php; //!file:engine/eclFilter/eclFilter_paragraph.php; /* * Valid control flags * control_type = paragraph * control_filter = paragraph * control_target * control_field_name * control_help * control_help_msg */ class eclFilter_paragraph { // class eclFilter_paragraph static function create ($fieldName, $control, $formulary) { // function create $local['ref'] = $formulary->document->ref (array ($formulary->document->domain->name, '-dialog', 'paragraph')); // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'paragraph'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterParagraphHelp'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->getField ($control['flags']['control_target']); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName])) { // received value $value = trim ($formulary->received[$fieldName], ' '); if (!strlen ($value)) $value = false; } // received value else $value = false; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_paragraph //!eof:engine/eclFilter/eclFilter_paragraph.php; //!file:engine/eclFilter/eclFilter_password.php; /* * Control flags * control_type * control_filter = password * control_target * control_field_name * control_required * control_error_msg */ class eclFilter_password { // class eclFilter_password static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_password'; $formulary->appendChild ($control, $local); $local['name'] .= '_repeat'; $formulary->appendChild ('labels/field/password2', $local); } // function create static function save ($fieldName, $control, $formulary) { // function save isset ($formulary->received[$fieldName]) ? $password = $formulary->received[$fieldName] : $password = false; isset ($formulary->received[$fieldName . '_repeat']) ? $password2 = $formulary->received[$fieldName . '_repeat'] : $password2 = false; if (!$password and $password !== '0') $password = false; // required if ($password === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminUser_add_msgPasswordRequired'); // no password, no required if (!$password) return; if ($password != $password2) return $formulary->setErrorMsg ($control, $fieldName, 'adminUser_add_msgPasswordRepeatError'); foreach (str_split ($password) as $char) { // each char if (ord ($char) < 32 or ord ($char) > 127) return $formulary->setErrorMsg ($control, $fieldName, 'adminUser_add_msgPasswordInvalidCharacter'); } // each char // md5 if (isset ($control['flags']['password_md5'])) $password = md5 ($password); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $password); } // function save } // class eclFilter_password //!eof:engine/eclFilter/eclFilter_password.php; //!file:engine/eclFilter/eclFilter_phone.php; /* * Valid control flags * control_type = phone * control_filter = phone * control_target * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg * * This filter aways clear empty values */ class eclFilter_phone { // class eclFilter_phone static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'phone'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterPhoneHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (is_string ($value) and strlen ($value)) { // value not empty $list = explode ('/', $value); if (count ($list) == 3) $local['country'] = $list[0]; $local['area'] = $list[1]; $local['number'] = $list[2]; } // value not empty $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName . '_country'])) $country = $formulary->received[$fieldName . '_country']; else $country = ''; if (isset ($formulary->received[$fieldName . '_area'])) $area = $formulary->received[$fieldName . '_area']; else $area = ''; if (isset ($formulary->received[$fieldName . '_number'])) $number = $formulary->received[$fieldName . '_number']; else $number = ''; // required if ($number === '' and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName . '_country', 'systemFormulary_filterPhoneError'); // Error if (!preg_match ('/^[+][0-9\ ]+$/', $country)) $country = ''; if (!preg_match ('/^[0-9\ ]+$/', $area)) $area = ''; if (!preg_match ('/^[0-9\ -]+$/', $number)) $number = ''; $value = $country . '/' . $area . '/' . $number; // clear if (!$country and !$area and !$number) $value = false; elseif (!$country or !$area or !$number) $formulary->setErrorMsg ($control, $fieldName . '_country', 'systemFormulary_filterPhoneError'); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_phone //!eof:engine/eclFilter/eclFilter_phone.php; //!file:engine/eclFilter/eclFilter_radio.php; /* * Control flags * control_type = radio * control_filter = radio * control_target * control_field_name * control_clear * control_help * control_help_msg */ class eclFilter_radio { // class eclFilter_radio static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'radio'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterRadioHelp'; // value if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if ($value === false and isset ($control['flags']['control_clear'])) $item->data['active'] = 1; elseif (isset ($control['flags']['control_value']) and $value == $control['flags']['control_value']) $item->data['active'] = 1; if (isset ($control['flags']['control_value'])) $item->data['value'] = $control['flags']['control_value']; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($control['flags']['control_target'])) return; if (!isset ($control['flags']['control_value'])) return; if (!isset ($formulary->received[$fieldName])) { // field empty if (isset ($control['flags']['control_clear'])) $formulary->setField ($control['flags']['control_target'], false); return; } // field empty if ($formulary->received[$fieldName] == $control['flags']['control_value']) { // received value if (isset ($control['flags']['control_clear'])) $formulary->setField ($control['flags']['control_target'], false); else $formulary->setField ($control['flags']['control_target'], $formulary->received[$fieldName]); } // received value } // function save } // class eclFilter_radio //!eof:engine/eclFilter/eclFilter_radio.php; //!file:engine/eclFilter/eclFilter_select.php; /* * Valid control flags * control_type = select | select_list | radio_group * control_filter = select * control_target * control_field_name * control_help * control_help_msg * control_value_cast string | int * control_default_value * control_mask_values * control_clear */ class eclFilter_select { // class eclFilter_select static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterSelectHelp'; // target if (!isset ($control['flags']['control_target'])) return; $value = $formulary->getField ($control['flags']['control_target']); // Default value if ($value === false and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; // children if (isset ($control['children'])) { // children exists $counter = 0; foreach ($control['children'] as $child_name) { // each child $counter++; $child = $item->appendChild ($child_name); if (isset ($child->data['flags']['control_value'])) { // value exists if (isset ($control['flags']['control_mask_values'])) $child->data['value'] = $counter; else $child->data['value'] = $child->data['flags']['control_value']; if ($child->data['value'] == $value) $child->data['active'] = 1; } // value exists $child->data['name'] = $fieldName; } // each child } // children exists } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (isset ($formulary->received[$fieldName])) $value = trim ($formulary->received[$fieldName], ' '); else $value = false; $found = false; if (isset ($control['children'])) { // children exists $counter = 0; foreach ($control['children'] as $child_name) { // each child $child = $store->control->read ($child_name); $counter++; if (!isset ($child['flags']['control_value'])) continue; if (isset ($control['flags']['control_mask_values'])) { // mask value if ($value == $counter) { // value found $found = $child['flags']['control_value']; break; } // value found continue; } // mask value if ($child['flags']['control_value'] == $value) { // value found $found = $value; break; } // value found } // each child } // children exists $value = $found; if ($value === false and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; // Clear default value if (isset ($control['flags']['control_default_value']) and isset ($control['flags']['control_clear']) and $value == $control['flags']['control_default_value']) $value = false; // cast if (isset ($control['flags']['control_cast']) and $control['flags']['control_cast'] == 'int') settype ($value, 'int'); // clear if (isset ($control['flags']['control_clear']) and !$value) $value = false; if ($value === false and isset ($control['flags']['control_required'])) { // required field if (isset ($control['flags']['control_error_msg'])) return $control['flags']['control_error_msg']; return 'systemFormulary_alertRequiredField'; } // required field // value cast if ($value !== false and isset ($control['flags']['control_value_cast']) and $control['flags']['control_value_cast'] == 'int') $value = intval ($value); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_select //!eof:engine/eclFilter/eclFilter_select.php; //!file:engine/eclFilter/eclFilter_select_view.php; /* * Valid control flags * control_type = select | select_list | select_radio * control_filter = select * control_target * control_field_name * control_help * control_help_msg */ class eclFilter_select_view { // class eclFilter_select_view static function create ($fieldName, $control, $formulary) { // function create global $store; $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'view'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); else $value = false; // Default value if ($value === false and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; // children if (isset ($control['children'])) { // children exists foreach ($control['children'] as $childName) { // each child $data = $store->control->read ($childName); if (!isset ($data['text']['caption'])) continue; if (!isset ($data['flags']['control_value'])) continue; if ($data['flags']['control_value'] != $value) continue; $item->data['content'] = $data['text']['caption']; break; } // each child } // children exists return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_select_view //!eof:engine/eclFilter/eclFilter_select_view.php; //!file:engine/eclFilter/eclFilter_start.php; class eclFilter_start { // class eclFilter_start static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->appendChild (); $item->data['type'] = 'start'; if (isset ($formulary->flags['control_field_name'])) $item->data['name'] = $formulary->flags['control_field_name']; if (isset ($formulary->flags['control_action'])) $formulary->action = $formulary->flags['control_action']; $item->data['ref'] = $formulary->document->ref ($formulary->pathway, $formulary->lang, $formulary->action, $formulary->protocol); if ($formulary->multipart or isset ($formulary->flags['multipart'])) $item->data['multipart'] = 1; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_start //!eof:engine/eclFilter/eclFilter_start.php; //!file:engine/eclFilter/eclFilter_submit.php; class eclFilter_submit { // class eclFilter_submit static function create ($fieldName, $control, $formulary) { // function create global $store; $item = $formulary->document->createListItem (); if (isset ($control['children'])) { // children exists foreach ($control['children'] as $name) { // each submit item if ($name[0] == '_') $name = 'systemFormulary_form' . $name; $data = $store->control->read ($name); if (!isset ($data['flags']['control_field_name'])) continue; if (!isset ($data['text']['caption'])) continue; if ($data['flags']['control_field_name'] == 'clear_language' and (!isset ($formulary->data['text']['caption']) or count ($formulary->data['text']['caption']) == 1)) continue; $local['name'] = $formulary->prefix . 'command_' . $data['flags']['control_field_name']; $item->appendChild ($data, $local); } // each submit item } // children exists else { // self submit if (isset ($control['flags']['control_field_name'])) $item->appendChild ($control, array ('name' => $formulary->prefix . 'command_' . $control['flags']['control_field_name'])); else $item->appendChild ($control); } // self submit $item->data['type'] = 'submit'; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_submit //!eof:engine/eclFilter/eclFilter_submit.php; //!file:engine/eclFilter/eclFilter_text.php; /* * control_type = text_small | text | textarea_small | textarea | textarea_big | textarea_full * control_filter = text * control_target * control_field_name * control_monolang = forces a unique language * * control_format_enable * control_format_force * control_html_enable * control_html_force * control_ecolabore_enable * control_ecolabore_force * * control_help * control_help_msg * control_required * control_required_msg */ class eclFilter_text { // class eclFilter_text static function create ($fieldName, $control, $formulary) { // function create static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); static $cs = array ('UTF-8', 'ISO-8859-1'); $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'text'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterTextHelp'; // target if (isset ($control['flags']['control_target']) and $text = $formulary->getField ($control['flags']['control_target'])) { // get field $text = $formulary->getField ($control['flags']['control_target']); $lang = $document->lang; $charset = $document->charset; if (isset ($text[$lang])) $found = $text[$lang]; elseif (isset ($control['flags']['control_monolang']) or isset ($formulary->flags['text_translation_copy'])) $found = current ($text); if (isset ($found[TEXT_CONTENT])) { // contents exists if (!isset ($found[TEXT_CHARSET])) $found[TEXT_CHARSET] = 0; if ($charset != $cs[$found[TEXT_CHARSET]]) $value = mb_convert_encoding ($found[TEXT_CONTENT], $charset, $cs[$found[TEXT_CHARSET]]); else $value = $found[TEXT_CONTENT]; $item->data['value'] = str_replace ($s, $r, $value); } // contents exists } // get field return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save $flags = $formulary->flags; if (isset ($control['flags']['control_target'])) { // set field $current = $formulary->getField ($control['flags']['control_target']); $current === false ? $current = array () : null; if (isset ($control['flags']['control_monolang'])) $current = array (); $lang = $formulary->document->lang; if (isset ($current[$lang])) unset ($current[$lang]); if (!isset ($formulary->received[$fieldName]) or $formulary->received[$fieldName] == '') { // empty field if (isset ($control['flags']['control_required']) and !$current) return $formulary->setRequiredMsg ($control, $fieldName); $formulary->received[$fieldName] = false; } // empty field if ($formulary->received[$fieldName] !== false) { // received data $current[$lang][TEXT_CONTENT] = $formulary->received[$fieldName]; if ($formulary->document->charset == 'ISO-8859-1') $current[$lang][TEXT_CHARSET] = 1; if (isset ($control['flags']['control_format_enable'])) { // format enable if (isset ($flags['text_format_choose']) and isset ($formulary->received['text_format'])) $current[$lang][TEXT_FORMAT] = 2; elseif (isset ($flags['text_format_force'])) { // format force if ($flags['text_format_force']) $current[$lang][TEXT_FORMAT] = 1; } // format force elseif (!isset ($flags['text_format_choose'])) $current[$lang][TEXT_FORMAT] = 1; } // format enable elseif (isset ($control['flags']['control_format_force'])) $current[$lang][TEXT_FORMAT] = $control['flags']['control_format_force']; if (isset ($control['flags']['control_html_enable'])) { // html enable if (isset ($flags['text_html_choose']) and isset ($formulary->received['text_html'])) $current[$lang][TEXT_HTML] = 2; elseif (isset ($flags['text_html_force'])) { // html force if ($flags['text_html_force']) $current[$lang][TEXT_HTML] = $flags['text_html_force']; } // html force elseif (!isset ($flags['text_html_choose'])) $current[$lang][TEXT_HTML] = 1; } // html enable elseif (isset ($control['flags']['control_html_force'])) $current[$lang][TEXT_HTML] = $control['flags']['control_html_force']; if (isset ($control['flags']['control_ecolabore_enable'])) { // ecolabore enable if (isset ($flags['text_ecolabore_choose']) and isset ($formulary->received['text_ecolabore'])) $current[$lang][TEXT_ECOLABORE] = 1; elseif (isset ($flags['text_ecolabore_force'])) { // force ecolabore if ($flags['text_ecolabore_force']) $current[$lang][TEXT_ECOLABORE] = 1; } // force ecolabore elseif (!isset ($flags['text_ecolabore_choose']) and !isset ($flags['text_ecolabore_disabled'])) $current[$lang][TEXT_ECOLABORE] = 1; } // ecolabore enable elseif (isset ($control['flags']['control_ecolabore_force'])) $current[$lang][TEXT_ECOLABORE] = $control['flags']['control_ecolabore_force']; } // received data if (!$current)$current = false; $formulary->setField ($control['flags']['control_target'], $current); } // set field } // function save } // class eclFilter_text //!eof:engine/eclFilter/eclFilter_text.php; //!file:engine/eclFilter/eclFilter_text_caption.php; class eclFilter_text_caption { // class eclFilter_text_caption static function create ($fieldName, $control, $formulary) { // function create static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); static $cs = array ('UTF-8', 'ISO-8859-1'); $document = $formulary->document; $item = $document->createListItem ($control); $item->data['name'] = $fieldName; if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'text'; if (isset ($control['flags']['control_target']) and $text = $formulary->getField ($control['flags']['control_target'])) { // get field $lang = $document->lang; $charset = $document->charset; if (isset ($text[$lang])) $found = $text[$lang]; elseif (isset ($control['flags']['control_monolang'])) $found = current ($text); if (isset ($found[TEXT_CONTENT])) { // contents exists if (!isset ($found[TEXT_CHARSET])) $found[TEXT_CHARSET] = 0; if ($charset != $cs[$found[TEXT_CHARSET]]) $value = mb_convert_encoding ($found[TEXT_CONTENT], $charset, $cs[$found[TEXT_CHARSET]]); else $value = $found[TEXT_CONTENT]; $item->data['value'] = str_replace ($s, $r, $value); } // contents exists } // get field return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->received[$fieldName]) or $formulary->received[$fieldName] == '') { // empty field if (isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); if (isset ($formulary->data['text']['title'][$formulary->document->lang][1])) $caption = $formulary->data['text']['title'][$formulary->document->lang][1]; if (!isset ($caption) or !$caption) return $formulary->setRequiredMsg ($control, $fieldName); } // empty field else $caption = $formulary->received[$fieldName]; $charset = $formulary->document->charset; $lenght = mb_strlen ($caption, $charset); if ($lenght > 36) { // cut caption $caption = mb_substr ($caption, 0, 36, $charset); $lenght = mb_strrpos ($caption, ' ', 30, $charset); if ($lenght) $caption = mb_substr ($caption, 0, $lenght, $charset); $caption .= '...'; } // cut caption if (isset ($control['flags']['control_target'])) { // set field $current = $formulary->getField ($control['flags']['control_target']); $current === false ? $current = array () : null; $lang = $formulary->document->lang; if (isset ($current[$lang])) unset ($current[$lang]); if ($caption !== false) { // received data $caption = str_replace (array (CR, LF), array ('', ' '), $caption); $current[$lang][TEXT_CONTENT] = $caption; if ($charset == 'ISO-8859-1') $current[$lang][TEXT_CHARSET] = 1; } // received data if (!$current)$current = false; $formulary->setField ($control['flags']['control_target'], $current); } // set field } // function save } // class eclFilter_text_caption //!eof:engine/eclFilter/eclFilter_text_caption.php; //!file:engine/eclFilter/eclFilter_text_view.php; /* * Control flags * control_type = view * control_filter = text_view * control_target * control_default_value * control_clear // hide field if value is empty */ class eclFilter_text_view { // class eclFilter_text_view static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'view'; // target if (isset ($control['flags']['control_target'])) $item->data['content'] = $formulary->getField ($control['flags']['control_target']); // default value if ( (!is_array ($item->data['content']) or !count ($item->data['content'])) and isset ($control['flags']['control_clear'])) return false; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_text_view //!eof:engine/eclFilter/eclFilter_text_view.php; //!file:engine/eclFilter/eclFilter_time.php; /* * Valid control flags: * control_type = time_select * control_filter = time * control_target * control_field_name * control_help * control_help_msg * * The default value for this field is aways "now" */ class eclFilter_time { // class eclFilter_time static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // control_type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'time_select'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterDateHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (!$value) $value = date ('h:i', TIME); $local['value'] = $value; list ($valueH, $valueI) = explode (':', $value); $valueI = floor ($valueI / 5) * 5; $local = array ('name' => $fieldName); $hour = $item->appendChild (false, $local); $minutes = $item->appendChild (false, $local); for ($h = 23; $h >= 0; $h--) { // each hour $value = str_pad ($h, '0', STR_PAD_LEFT); $local = array ('value' => $value); $hour->appendChild (false, $local) ->active ($h == $valueH); } // each hour for ($i = 55; $i >= 0; $i -= 5) { // each minute $value = str_pad ($i, '0', STR_PAD_LEFT); $local = array ('value' => $value); if ($i == $valueI) $local['active'] = 1; $minutes->appendChild (false, $local); } // each minute } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; if (isset ($received[$fieldName]) and preg_match ('/^[0-2]?[0-9][:][0-5][0-9]$/', $received[$fieldName])) $value = $received[$fieldName]; elseif (isset ($received[$fieldName . '_hours']) and isset ($received[$fieldName . '_minutes'])) $value = strval (intval ($received[$fieldName . '_hours'])) . ':' . strval (intval ($received[$fieldName . '_minutes'])); else $value = false; if ($value === false and $control['flags']['control_required']) $formulary->setRequiredMsg ($control, $fieldName); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_time //!eof:engine/eclFilter/eclFilter_time.php; //!file:engine/eclFilter/eclFilter_timestamp.php; /* * Valid control flags: * control_type = date * control_filter = timestamp * control_target * control_field_name * control_help * control_help_msg * * The default value for this field is aways "now" */ class eclFilter_timestamp { // class eclFilter_timestamp static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // control_type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'date_select'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterDateHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (!$value) $value = TIME; $valueY = date ('Y', $value); $valueM = date ('m', $value); $valueD = date ('j', $value); $valueH = date ('H', $value); $valueI = date ('i', $value); $valueI = intval ($valueI / 5) * 5; $local = array ('name' => $fieldName); $year = $item->appendChild (false, $local); $month = $item->appendChild (false, $local); $day = $item->appendChild (false, $local); $hour = $item->appendChild (false, $local); $minutes = $item->appendChild (false, $local); for ($y = 2030; $y > 1969; $y--) { // each year $local = array ('value' => $y); if ($y == $valueY) $local['active'] = 1; $year->appendChild (false, $local); } // each year for ($m = 12; $m > 0; $m--) { // each month $local = array ('value' => $m); if ($m == $valueM) $local['active'] = 1; $month->appendChild ($store->control->read ('labels/date/month' . $m), $local); } // each month for ($d = 31; $d > 0; $d--) { // each day $local = array ('value' => $d); if ($d == $valueD) $local['active'] = 1; $day->appendChild (false, $local); } // each day for ($h = 23; $h >= 0; $h--) { // each hour $value = str_pad ($h, '0', STR_PAD_LEFT); $local = array ('value' => $value); $hour->appendChild (false, $local) ->active ($h == $valueH); } // each hour for ($i = 55; $i >= 0; $i -= 5) { // each minute $value = str_pad ($i, '0', STR_PAD_LEFT); $local = array ('value' => $value); if ($i == $valueI) $local['active'] = 1; $minutes->appendChild (false, $local); } // each minute } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; if ( isset ($received[$fieldName . '_year']) and isset ($received[$fieldName . '_month']) and isset ($received[$fieldName . '_day']) ) { // received value $y = intval ($received[$fieldName . '_year']); $m = intval ($received[$fieldName . '_month']); $d = intval ($received[$fieldName . '_day']); isset ($received[$fieldName . '_hours']) ? $hours = intval ($received[$fieldName . '_hours']) : $hours = 0; isset ($received[$fieldName . '_minutes']) ? $minutes = intval ($received[$fieldName . '_minutes']) : $minutes = 0; $value = mktime ($hours, $minutes, 0, $m, $d, $y); } // received value else $value = TIME; // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_timestamp //!eof:engine/eclFilter/eclFilter_timestamp.php; //!file:engine/eclFilter/eclFilter_timestamp_event.php; /* * Valid control flags: * control_type = date | date_event * control_filter = eclFilter_timestamp_event * control_target=event_start event_end flags/event_start flags/event_end * control_field_name * control_help * control_help_msg * * The default value for this field is aways "now" */ class eclFilter_timestamp_event { // class eclFilter_timestamp_event static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // control_type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'date_daily_event'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterDateHelp'; $eventStart = isset ($formulary->data['event_start']) ? $formulary->data['event_start'] : TIME; $eventEnd = isset ($formulary->data['event_end']) ? $formulary->data['event_end'] : TIME; $startY = date ('Y', $eventStart); $startM = date ('m', $eventStart); $startD = date ('j', $eventStart); $startH = date ('H', $eventStart); $startI = date ('i', $eventStart); $startI = intval ($startI / 5) * 5; $endY = date ('Y', $eventEnd); $endM = date ('m', $eventEnd); $endD = date ('j', $eventEnd); $endH = date ('H', $eventEnd); $endI = date ('i', $eventEnd); $endI = intval ($endI / 5) * 5; $local = array ('name' => $fieldName); $startDSelect = $item->appendChild (false, $local); $startMSelect = $item->appendChild (false, $local); $startYSelect = $item->appendChild (false, $local); $startHSelect = $item->appendChild (false, $local); $startISelect = $item->appendChild (false, $local); $endDSelect = $item->appendChild (false, $local); $endMSelect = $item->appendChild (false, $local); $endYSelect = $item->appendChild (false, $local); $endHSelect = $item->appendChild (false, $local); $endISelect = $item->appendChild (false, $local); for ($y = 2030; $y > 1969; $y--) { // each year $local = array ('value' => $y); $startYSelect->appendChild (false, $local) ->active ($y == $startY); $endYSelect->appendChild (false, $local) ->active ($y == $endY); } // each year for ($m = 12; $m > 0; $m--) { // each month $local = array ('value' => $m); $startMSelect->appendChild ($store->control->read ('labels/date/month' . $m), $local) ->active ($m == $startM); $endMSelect->appendChild ($store->control->read ('labels/date/month' . $m), $local) ->active ($m == $endM); } // each month for ($d = 31; $d > 0; $d--) { // each day $local = array ('value' => $d); $startDSelect->appendChild (false, $local) ->active ($d == $startD); $endDSelect->appendChild (false, $local) ->active ($d == $endD); } // each day for ($h = 23; $h >= 0; $h--) { // each hour $value = str_pad ($h, '0', STR_PAD_LEFT); $local = array ('value' => $value); $startHSelect->appendChild (false, $local) ->active ($h == $startH); $endHSelect->appendChild (false, $local) ->active ($h == $endH); } // each hour for ($i = 55; $i >= 0; $i -= 5) { // each minute $value = str_pad ($i, 2, '0', STR_PAD_LEFT); $local = array ('value' => $value); $startISelect->appendChild (false, $local) ->active ($i == $startI); $endISelect->appendChild (false, $local) ->active ($i == $endI); } // each minute } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; if (isset ($received[$fieldName . '_year']) and isset ($received[$fieldName . '_month']) and isset ($received[$fieldName . '_day'])) { // received value $y = intval ($received[$fieldName . '_year']); $m = intval ($received[$fieldName . '_month']); $d = intval ($received[$fieldName . '_day']); isset ($received[$fieldName . '_hours']) ? $hours = intval ($received[$fieldName . '_hours']) : $hours = 0; isset ($received[$fieldName . '_minutes']) ? $minutes = intval ($received[$fieldName . '_minutes']) : $minutes = 0; if (isset ($received[$fieldName . '_year_end']) and isset ($received[$fieldName . '_month_end']) and isset ($received[$fieldName . '_day_end'])) { // end date $yEnd = intval ($received[$fieldName . '_year']); $mEnd = intval ($received[$fieldName . '_month']); $dEnd = intval ($received[$fieldName . '_day']); } // end date else { // same of start $yEnd = $y; $mEnd = $m; $dEnd = $d; } // same of start isset ($received[$fieldName . '_hours_end']) ? $hoursEnd = intval ($received[$fieldName . '_hours_end']) : $hoursEnd = $hours; isset ($received[$fieldName . '_minutes_end']) ? $minutesEnd = intval ($received[$fieldName . '_minutes_end']) : $minutesEnd = $minutes; $eventStart = mktime ($hours, $minutes, 30, $m, $d, $y); $eventEnd = mktime ($hoursEnd, $minutesEnd, 30, $mEnd, $dEnd, $yEnd); } // received value else { // not received $eventStart = TIME; $eventEnd = TIME; } // not received if ($eventEnd < $eventStart) $formulary->setErrorMsg ($control, $fieldName . '_year', 'systemFormulary_filterTimestampEventInvalid'); $formulary->data['event_start'] = $eventStart; $formulary->data['event_end'] = $eventEnd; } // function save } // class eclFilter_timestamp_event //!eof:engine/eclFilter/eclFilter_timestamp_event.php; //!file:engine/eclFilter/eclFilter_timestamp_view.php; class eclFilter_timestamp_view { // class eclFilter_timestamp_view static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // control_type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'view'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $item->data['control_help_msg'] = 'systemFormulary_filterDateHelp'; // target if (isset ($control['flags']['control_target'])) $value = $formulary->getField ($control['flags']['control_target']); if (!$value) $value = TIME; $valueY = date ('Y', $value); $valueM = date ('m', $value); $valueD = date ('j', $value); $item->data['content'] = $formulary->document->textMerge ($valueY . '-' . $valueM . '-' . $valueD); return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_timestamp_view //!eof:engine/eclFilter/eclFilter_timestamp_view.php; //!file:engine/eclIo/eclIo_cachedControls.php; class eclIo_cachedControls { // class eclIo_cachedControls private $enabled = false; private $file; private $externalString2; private $databaseString2; public function __construct () { // function __construct global $dataMap; if (!isset ($dataMap) or !$dataMap or !defined ('SYSTEM_COMPILER_HALT_OFFSET')) return; $this->file = fopen (SYSTEM_SCRIPT_PATH, 'rb'); $this->enabled = true; } // function __construct public function read ($mode, $path, $name) { // function read global $dataMap; if (!$this->enabled) return array (); if (!isset ($dataMap[$mode][$path][$name])) return array (); list ($offset, $length) = explode (':', $dataMap[$mode][$path][$name]); fseek ($this->file, SYSTEM_COMPILER_HALT_OFFSET + $offset); return unserialize ($this->stringFromDatabase (fread ($this->file, $length))); } // function read public function file ($path, $name, $mode='f') { // function file global $dataMap; if (!isset ($dataMap[$mode][$path][$name])) return ''; list ($offset, $length) = explode (':', $dataMap[$mode][$path][$name]); fseek ($this->file, SYSTEM_COMPILER_HALT_OFFSET + $offset); return $this->stringFromDatabase (fread ($this->file, $length)); } // function file public function stringFromDatabase ($string) { // function stringFromDatabase if (!isset ($this->externalString2)) { // set replaces $this->externalString2 = array ( chr (0), chr (10), chr (13), chr (26), chr (39), chr (92) ); $this->databaseString2 = array ( '#0', '#n', '#r', '#z', '#s', '#e' ); } // set replacements return str_replace ('#c', '#', str_replace ($this->databaseString2, $this->externalString2, $string)); } // function stringFromDatabase public function close () { // function close if ($this->enabled) fclose ($this->file); } // function close } // class eclIo_cachedControls //!eof:engine/eclIo/eclIo_cachedControls.php; //!file:engine/eclIo/eclIo_database.php; /* * Fields types * primary_key * tinyint * mediumint * int * time * name * password * array * keywords */ class eclIo_database { // class eclIo_database private $tables; private $batchQuery = array (); private $databasePrefix = ''; private $client; private $database; private $databaseString, $externalString, $databaseString2, $externalString2; public $status = false; private $pdo; public $verbose = true; public $performed_queries = ''; private $last_query; public function __construct ($io, $database=false) { // function __construct if (!$database and (!defined ('DATABASE_ENABLED') or !DATABASE_ENABLED)) return; try { // try if ($database) { // from file $this->client = 'sqlite'; $this->database = $database; $this->pdo = new PDO ('sqlite:' . $database); } // from file else { // from server $this->client = DATABASE_CLIENT; $this->database = DATABASE_DB; if (DATABASE_CLIENT == 'sqlite') { // sqlite if (!is_dir (FOLDER_DATABASE)) mkdir (FOLDER_DATABASE); $this->pdo = new PDO ('sqlite:' . FOLDER_DATABASE . '.system.db'); } // sqlite else { // shared database $this->pdo = new PDO (DATABASE_CLIENT . ':host=' . DATABASE_HOST . ';dbname=' . DATABASE_DB, DATABASE_USER, DATABASE_PASSWORD); $this->databasePrefix = DATABASE_PREFIX; } // shared database } // from server $this->status = true; } // try catch (PDOException$e) { // catch if (defined ('DATABASE_DISPLAY_ERRORS') and DATABASE_DISPLAY_ERRORS) print 'Database connection error: ' . $e->getMessage () . '
      '; if (defined ('DATABASE_LOG_ERRORS') and DATABASE_LOG_ERRORS) { // log errors if (!is_dir (FOLDER_DATABASE)) mkdir (FOLDER_DATABASE); $string = '#On: ' . date ('c s u') . CRLF . '#client: ' . $this->client . ' database:' . $this->database . CRLF . '#Database connection error: ' . $e->getMessage () . CRLF . CRLF; file_put_contents (FOLDER_DATABASE . '.database.log', $string, FILE_APPEND); } // log errors $this->status = false; } // catch } // function __construct public function reconnect () { // function reconnect global $io; if (!$io->systemConstants->check ('DATABASE_ENABLED') or !$io->systemConstants->constants['DATABASE_ENABLED']) return; try { // try $c = $io->systemConstants->constants; if ($c['DATABASE_CLIENT'] == 'sqlite') { // sqlite if (!is_dir (FOLDER_DATABASE)) mkdir (FOLDER_DATABASE); $this->pdo = new PDO ('sqlite:' . FOLDER_DATABASE . '.system.db'); } // sqlite else $this->pdo = new PDO ($c['DATABASE_CLIENT'] . ':host=' . $c['DATABASE_HOST'] . ';dbname=' . $c['DATABASE_DB'], $c['DATABASE_USER'], $c['DATABASE_PASSWORD']); $this->status = true; } // try catch (PDOException$e) { // catch $io->log->addMessage ('Database connection error: ' . $e->getMessage (), __CLASS__); $this->status = false; } // catch } // function reconnect public function query ($query) { // function query global $io; if (!$this->status or !is_string ($query) or !isset ($query[0])) return array (); $this->performed_queries .= $query . CRLF; $result = $this->pdo->query ($query); if ($this->pdo->errorCode () != '00000' and $this->verbose) { // error $error = $this->pdo->errorCode (); $info = $this->pdo->errorInfo (); $string = '#Date: ' . date ('c s u') . CRLF . '#client: ' . $this->client . ' database:' . $this->database . CRLF . $query . CRLF . '#The error: ' . $error . CRLF; if (isset ($info[2])) $string .= '# ' . $info[2] . CRLF; $string .= CRLF; $this->performed_queries .= '# Error' . CRLF; $this->performed_queries .= '# ' . $error . CRLF; if (isset ($info[2])) $this->performed_queries .= '# ' . $info[2] . CRLF; if (defined ('DATABASE_DISPLAY_ERRORS') and DATABASE_DISPLAY_ERRORS) print nl2br (eclEngine_formulary::htmlSpecialChars ($string)); if (defined ('DATABASE_LOG_ERRORS') and DATABASE_LOG_ERRORS) { // log errors if (!is_dir (FOLDER_DATABASE)) mkdir (FOLDER_DATABASE); file_put_contents (FOLDER_DATABASE . '.database.log', $string, FILE_APPEND); } // log errors return array (); } // error if (!is_object ($result)) return array (); $return = array (); foreach ($result as $row) { // each row $return[] = $row; } // each row return $return; } // function query public function batchQuery ($query) { // function batchQuery if (!is_array ($query) or !count ($query)) return; $this->last_query = implode (";" . CRLF, $query); $this->performed_queries .= $this->last_query; foreach ($query as $call) { // each query $this->pdo->query ($call); } // each query } // function batchQuery public function insertId () { // function insertId return intval ($this->pdo->lastInsertId ()); } // function insertId public function affectedRows () { // function affectedRows if ($this->client == 'mysql') { // mysql if (is_array ($this->pdo->query ('mysql_affected_rows()'))) { // is array foreach ($this->pdo->query ('mysql_affected_rows()') as $row) { // each row return current ($row); } // each row } // is array } // mysql return 0; } // function affectedRows public function error () { // function error $error = $this->pdo->errorInfo (); if ($error) return $error[2]; return ''; } // function error public function commit () { // function commit } // function commit public function tableEnabled ($table) { // function tableEnabled if (!$this->status) return false; if (!isset ($this->tables)) { // list tables if ($this->client == 'mysql') $rows = $this->query ('SHOW TABLES'); else $rows = $this->query ("SELECT `name` FROM sqlite_master WHERE `type`='table'"); foreach ($rows as $row) { // each table $this->tables[current ($row)] = true; } // each table } // list tables $table_name = $this->databasePrefix . $table->name; if (isset ($this->tables[$table_name])) return true; $this->create ($table); $this->tables = array (); if ($this->client == 'mysql') $rows = $this->query ('SHOW TABLES'); else $rows = $this->query ("SELECT `name` FROM sqlite_master WHERE `type`='table'"); foreach ($rows as $row) { // each table $this->tables[current ($row)] = true; } // each table $table_name = $this->databasePrefix . $table->name; if (isset ($this->tables[$table_name])) return true; return false; } // function tableEnabled public function create ($table) { // function create if (!count ($table->fields)) return false; // Create table description $lines = array (); foreach ($table->fields as $fieldName => $fieldType) { // each field switch ($fieldType) { // switch field type case 'primary_key': if ($this->client == 'mysql') $lines[] = '`' . $fieldName . '` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY'; else $lines[] = '`' . $fieldName . '` INTEGER PRIMARY KEY'; break; case 'tinyint': $lines[] = '`' . $fieldName . '` TINYINT UNSIGNED NOT NULL'; break; case 'mediumint': $lines[] = '`' . $fieldName . '` MEDIUMINT UNSIGNED NOT NULL'; break; case 'int': case 'time': $lines[] = '`' . $fieldName . '` INTEGER UNSIGNED NOT NULL'; break; case 'name': case 'password': if ($this->client == 'mysql') $lines[] = '`' . $fieldName . '` CHAR(32) BINARY NOT NULL'; else $lines[] = '`' . $fieldName . '` BLOB NOT NULL'; break; case 'array': case 'keywords': if ($this->client == 'mysql') $lines[] = '`' . $fieldName . '` MEDIUMBLOB NOT NULL'; else $lines[] = '`' . $fieldName . '` BLOB NOT NULL'; break; } // switch type } // each field // The query $this->query ('CREATE TABLE `' . $this->databasePrefix . $table->name . "` (" . CRLF . implode ("," . CRLF, $lines) . CRLF . ")" . CRLF); // Index if (isset ($table->index)) { // index exists foreach ($table->index as $index_name => $index_fields) { // each index $this->query ('CREATE INDEX `' . $index_name . '` ON `' . $this->databasePrefix . $table->name . '` (`' . implode ('`, `', $index_fields) . '`)'); } // each index } // index exists } // function create public function insert ($table, &$data) { // function insert global $io; $fields = array (); $values = array (); foreach ($table->fields as $fieldName => $fieldType) { // each field switch ($fieldType) { // switch filter case 'primary_key': break; case 'tinyint': case 'mediumint': case 'int': if (!isset ($data[$fieldName])) $data[$fieldName] = 0; $fields[] = $fieldName; $values[] = strval (intval ($data[$fieldName])); break; case 'name': if (!isset ($data[$fieldName]) or !preg_match ('%^[a-zA-Z0-9@:./_-]*$%', $data[$fieldName])) $data[$fieldName] = ''; $fields[] = $fieldName; $values[] = "'" . $data[$fieldName] . "'"; break; case 'time': if (!isset ($data[$fieldName]) or !is_int ($data[$fieldName])) $data[$fieldName] = TIME; $fields[] = $fieldName; $values[] = strval (intval ($data[$fieldName])); break; case 'array': if (!isset ($data[$fieldName]) or !is_array ($data[$fieldName]) and count ($data[$fieldName])) $data[$fieldName] = array (); $fields[] = $fieldName; $values[] = "'" . $this->stringToDatabase (serialize ($data[$fieldName])) . "'"; break; case 'keywords': if (!isset ($data[$fieldName]) or !is_string ($data[$fieldName])) $data[$fieldName] = ''; $temp = implode (' ', $this->filterKeywords ($data[$fieldName])); $fields[] = $fieldName; $values[] = "'" . $temp . "'"; break; case 'password': if (!isset ($data[$fieldName]) or !is_string ($data[$fieldName])) $data[$fieldName] = ""; $fields[] = $fieldName; $values[] = "'" . strval (md5 ($data[$fieldName])) . "'"; break; default: break; } // switch filter } // each field // The query $this->query ('INSERT INTO `' . $this->databasePrefix . $table->name . '` (`' . implode ('`, `', $fields) . '`) VALUES (' . implode (', ', $values) . ')'); $data['id'] = $this->insertId (); return $data['id']; } // function insert public function select ($table, $where, $limit='', $returnRows=false) { // function select $results = array (); $conditions = array (); foreach ($where as $fieldName => $field_value) { // each where condition if (isset ($table->fields[$fieldName])) { // valid field switch ($table->fields[$fieldName]) { // switch filter case 'primary_key': case 'tinyint': case 'mediumint': case 'int': case 'time': if (is_int ($field_value)) $conditions[] = '`' . $fieldName . '`=' . strval ($field_value); elseif (is_string ($field_value) and preg_match ('%^[<=>\ ]*[0-9]+$%', $field_value)) $conditions[] = '`' . $fieldName . '` ' . $field_value; elseif (is_array ($field_value)) { // set $field_value = implode (', ', $field_value); if (preg_match ('%[0-9, ]+%', $field_value)) $conditions[] = '`' . $fieldName . '` IN(' . $field_value . ')'; } // set break; case 'name': if (preg_match ('%^[a-zA-Z0-9@:/_-]*$%', $field_value)) $conditions[] = '`' . $fieldName . "`='" . $field_value . "'"; break; case 'password': $conditions[] = '`' . $fieldName . "`='" . strval (md5 ($field_value)) . "'"; break; case 'keywords': foreach ($this->filterKeywords ($field_value) as $keyword) { // each keyword $conditions[] = '`' . $fieldName . "` LIKE('%" . $keyword . "%')"; } // each keyword break; } // switch filter } // valid field } // each where condition if ($conditions) { // conditions exists // The query if ($returnRows) { // select return columns foreach ($returnRows as $fieldName) { // each column if (!isset ($table->fields[$fieldName])) continue; $columns[] = '`' . $fieldName . '`'; $returnColumns[$fieldName] = $table->fields[$fieldName]; } // each column } // select return columns if (isset ($columns)) $columns = implode (', ', $columns); else $columns = '*'; $rows = $this->query ('SELECT ' . $columns . ' FROM `' . $this->databasePrefix . $table->name . '` WHERE ' . implode (' AND ', $conditions) . $limit); if (!isset ($returnColumns)) $returnColumns = $table->fields; // Extract rows foreach ($rows as $row) { // each row $data = array (); foreach ($returnColumns as $fieldName => $fieldType) { // each field switch ($fieldType) { // switch filter case 'primary_key': case 'tinyint': case 'mediumint': case 'int': case 'time': $data[$fieldName] = intval ($row[$fieldName]); break; case 'array': if (strlen ($row[$fieldName])) $data[$fieldName] = unserialize ($this->stringFromDatabase ($row[$fieldName])); else $data[$fieldName] = array (); break; default: $data[$fieldName] = $this->stringFromDatabase ($row[$fieldName]); } // switch filter } // each field $results[] = $data; } // each row return $results; } // conditions exists return array (); } // function select public function update ($table, $data, $originalData) { // function update $id = intval ($data['id']); if (!$id) return; $set = array (); foreach ($table->fields as $fieldName => $fieldType) { // each field if (isset ($data[$fieldName]) and (!isset ($originalData[$fieldName]) or $data[$fieldName] != $originalData[$fieldName])) { // field changed switch ($fieldType) { // switch filter case 'tinyint': case 'mediumint': case 'int': case 'time': $set[] = '`' . $fieldName . '`=' . strval (intval ($data[$fieldName])); break; case 'name': if (preg_match ('%^[a-zA-Z0-9@:/_-]*$%', $data[$fieldName])) $set[] = '`' . $fieldName . "`='" . $data[$fieldName] . "'"; break; case 'array': $set[] = '`' . $fieldName . "`='" . $this->stringToDatabase (serialize ($data[$fieldName])) . "'"; break; case 'password': if (md5 ($data[$fieldName]) != $originalData[$fieldName]) $set[] = '`' . $fieldName . "`='" . md5 ($data[$fieldName]) . "'"; break; case 'keywords': $keywords = implode (' ', $this->filterKeywords ($data[$fieldName])); if ( (strlen ($keywords) and !isset ($originalData[$fieldName])) or $keywords != $originalData[$fieldName]) $set[] = '`' . $fieldName . "`='" . $keywords . "'"; break; } // switch filter } // field changed } // each field if (count ($set)) { // valid fields changed $this->batchQuery[] = 'UPDATE `' . $this->databasePrefix . $table->name . '` SET ' . implode (', ', $set) . ' WHERE `id`=' . $id; } // valid fields changed } // function update public function delete ($table, $where) { // function delete $conditions = array (); foreach ($where as $fieldName => $field_value) { // each where condition if (isset ($table->fields[$fieldName])) { // valid field switch ($table->fields[$fieldName]) { // switch filter case 'primary_key': case 'tinyint': case 'mediumint': case 'int': case 'time': if (is_int ($field_value)) $conditions[] = '`' . $fieldName . '`=' . strval ($field_value); break; case 'name': if (preg_match ('%^[a-zA-Z0-9@:/_-]*$%', $field_value)) $conditions[] = '`' . $fieldName . "`='" . $field_value . "'"; break; } // switch filter } // valid field } // each where condition // The query $this->query ('DELETE FROM `' . $this->databasePrefix . $table->name . '` WHERE ' . implode (' AND ', $conditions)); } // function delete public function drop ($table) { // function drop $this->query ('DROP TABLE `' . $this->databasePrefix . $table->name . '`'); } // function drop public function close () { // function close global $io; $this->batchQuery ($this->batchQuery); $this->batchQuery = array (); // $io->log->addMessage ($this->performed_queries, 'database'); } // function close public function stringToDatabase ($string) { // function stringToDatabase if (!isset ($this->externalString)) { // set replace sequence $this->externalString = array ( '#', chr (0), chr (26), // chr (34), chr (39), chr (92) ); $this->databaseString = array ( '#c', '#0', '#z', // '#q', '#s', '#e' ); } // set replace sequence return str_replace ($this->externalString, $this->databaseString, $string); } // function stringToDatabase public function stringFromDatabase ($string) { // function stringFromDatabase if (!isset ($this->externalString2)) { // set replace sequence $this->externalString2 = array ( chr (0), chr (26), chr (34), chr (39), chr (92) ); $this->databaseString2 = array ( '#0', '#z', '#q', '#s', '#e' ); } // set replace sequence if (strpos ($string, '\\') === false) return str_replace ('#c', '#', str_replace ($this->databaseString2, $this->externalString2, $string)); return stripslashes ($string); } // function stringFromDatabase public static function filterKeywords ($string) { // function filterKeywords static $convert = array ('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'â' => 'a', 'Â' => 'a', 'ã' => 'a', 'Ã' => 'a', 'á' => 'a', 'Á' => 'a', 'à' => 'a', 'À' => 'a', 'ä' => 'a', 'Ä' => 'a', 'Ç' => 'c', 'ç' => 'c', 'ê' => 'e', 'Ê' => 'e', 'é' => 'e', 'É' => 'e', 'ë' => 'e', 'Ë' => 'e', 'î' => 'i', 'Î' => 'i', 'í' => 'i', 'Í' => 'i', 'ï' => 'i', 'Ï' => 'i', 'ô' => 'o', 'Ô' => 'o', 'õ' => 'o', 'Õ' => 'o', 'ó' => 'o', 'Ó' => 'o', 'ö' => 'o', 'Ö' => 'o', 'û' => 'u', 'Û' => 'u', 'ú' => 'u', 'Ú' => 'u', 'ü' => 'u', 'Ü' => 'u', 'Ý' => 'y', 'ý' => 'y', 'ÿ' => 'y', 'Ÿ' => 'y', ' ' => ' ', '-' => '-', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0', '_' => ' ', ':' => ':', ';' => ';'); // The $last will remember the last character of the convertion // to prevent duplicated spacing "__" or "--" in the name $result = ''; $last = ' '; foreach (str_split ($string) as $char) { // each char if (!isset ($convert[$char])) continue; $valid = $convert[$char]; if ($valid != $last) { // not repeated separator if ($valid == '-' or $valid == ' ') $last = $valid; else $last = ''; $result .= $valid; } // not repeated separator } // each char $words = explode (' ', $result); $keywords = array (); $validWords = array (); foreach ($words as $word) { // each word $validWords[strlen ($word)][] = $word; } // each word krsort ($validWords); foreach ($validWords as $index => $group) { // each group if ($index < 3) break; foreach ($group as $word) { // each word $valid = true; foreach ($keywords as $value) { // each keyword if (is_int (strpos ($value, $word))) { // existing word $valid = false; } // existing word } // each keyword if ($valid) $keywords[] = $word; } // each word } // each group sort ($keywords); return $keywords; } // function filterKeywords } // class eclIo_database //!eof:engine/eclIo/eclIo_database.php; //!file:engine/eclIo/eclIo_file.php; class eclIo_file { // class eclIo_file private $openedFiles = array (); public function &open ($name) { // function & if (!isset ($this->openedFiles[$name])) { // open file if (is_file ($name)) $this->openedFiles[$name][0] = $this->string2array (file_get_contents ($name, FILE_BINARY)); else $this->openedFiles[$name][0] = array (); $this->openedFiles[$name][1] = $this->openedFiles[$name][0]; } // open file $data = &$this->openedFiles[$name][0]; return $data; } // function & public function read ($name) { // function read if (is_file ($name)) return $this->string2array (file_get_contents ($name, FILE_BINARY)); return array (); } // function read public function close () { // function close foreach ($this->openedFiles as $name => $contents) { // each opened file // protection mode // 'array2string ($contents[0])); if (!$contents[0] and is_file ($name)) unlink ($name); } // each opened files } // function close public static function array2string ($array, $use_counter=false) { // function array2string if (!is_array ($array)) return ''; // a string resultante $string = ''; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; // iniciaremos copiando o array para o primeiro andar do edifício reset ($array); $building[$floor] = $array; // nosso processo se dará em um loop "infinito" while (1) { // loop // capturaremos o item corrente do array no andar em que nos encontramos // com each, após a captura, o ponteiro interno do array deverá avançar para o próximo item $item = each ($building[$floor]); // se o array tiver terminado, desceremos um andar if ($item === false) { // end of array unset ($building[$floor]); $floor--; // Se chegarmos ao "térreo", o processo terminou if (!$floor) break; // Se não terminou, imprime "}" $string .= "}" . CRLF; } // end of array else { // array item // capturamos a chave e o valor do item corrente $key = $item[0]; $value = $item[1]; // imprimimos a chave do array if (is_int ($key)) { // int key if ($floor < 3 and $use_counter) $string .= '#'; else $string .= strval ($key); } // int key else { // string key $string .= "'" . str_replace ("'", "''", $key) . "'"; } // string key // Se o valor for um "subarray", if (is_array ($value)) { // value is array // subimos um andar $floor++; // copiamos o array deste valor para o andar em que nos encontramos reset ($value); $building[$floor] = $value; // Imprimimos "={" $string .= "={" . CRLF; } // value is array // Caso o valor seja numérico elseif (is_int ($value)) { // numeric value // imprimimos "=" e o valor sem os apóstrofos $string .= '=' . strval ($value) . CRLF; } // numeric value elseif (is_object ($value)) { // is object } // is object // Ou consideraremos o valor como string else { // string value // imprimimos a string englobada por "'", e duplicamos os apóstrofos encontrados dentro dela $string .= "='" . str_replace ("'", "''", $value) . "'" . CRLF; } // string value } // array item } // loop return $string; } // function array2string public static function string2array ($string, $counter1=0) { // function string2array if (!is_string ($string)) return array (); // acrescentamos à string recebida uma quebra de linha $string .= LF; // o cumprimento total da string $strlen = strlen ($string); // o ponteiro que percorrerá a string $pointer = 0; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; $building[$floor] = array (); // O contador que substituirá os coringas encontrados $counter[$floor] = $counter1; // Sinalizadores $buffer = ''; $buffer_enabled = false; $buffer_string = false; $key_enabled = false; // iremos varrer a string até que o ponteiro alcance seu cumprimento total while ($pointer < $strlen) { // get char // capturamos o caractére da string que se encontra sob o ponteiro $char = $string[$pointer]; // Verificamos que caractére é este switch ($char) { // char // ao encontrar uma quebra de linha, criamos um novo item de array case "\n": if (!$buffer_string)settype ($buffer, 'int'); if ($key_enabled) { // creates a value $building[$floor][$key] = $buffer; } // creates a value $buffer = ''; $key_enabled = false; $buffer_enabled = false; $buffer_string = false; break; // ao encontrar "=", o que estiver no $buffer representa a chave de um item case '=': if ($buffer_enabled) { // creates key if ($buffer == '#') { // counter $buffer = $counter[$floor]; $counter[$floor]++; } // counter elseif (!$buffer_string) { // numeric settype ($buffer, 'int'); } // numeric $key = $buffer; $buffer = ''; $buffer_enabled = false; $buffer_string = false; $key_enabled = true; } // creates key break; // ao encontrar "{", subiremos um andar case '{': if ($key_enabled) { // sublevel $array_key[$floor] = $key; $floor++; $building[$floor] = array (); $counter[$floor] = 0; } // sublevel $key = ''; $key_enabled = false; $buffer = ''; $buffer_enabled = false; $buffer_string = false; break; // ao encontrar "}", copiamos o array do andar corrente para o item atual do andar inferior e descemos um andar case '}': if ($floor <= 1) break 2; $building[$floor - 1][$array_key[$floor - 1]] = $building[$floor]; $counter[$floor] = 0; $floor--; $buffer = ''; $buffer_enabled = false; $buffer_string = false; $key = ''; $key_enabled = false; break; // Ao encontrar "'", procuramos uma string com apóstrofos duplicados ("''") case "'": case '"': loop_escape_char: $n_close_string = strpos ($string, $char, $pointer + 1); if ($n_close_string === false) break; $buffer .= substr ($string, $pointer + 1, $n_close_string - ($pointer + 1)); $buffer_enabled = true; $buffer_string = true; $pointer = $n_close_string; if ($string[$pointer + 1] != $char) break; $buffer .= $char; $pointer++; goto loop_escape_char; // Caractéres ignorados case "\r": case "\t": case ' ': break; // Ao encontrar "/" ou "<", seguiremos ignorando uma linha de comentário case '<': case '/': $n_close_string = strpos ($string, LF, $pointer + 1); if ($n_close_string === false) break; else { // coment $pointer = $n_close_string - 1; } // coment break; // outros caractéres são guardados em $buffer default: $buffer .= $char; $buffer_enabled = true; break; } // char // avança o ponteiro para o próximo caractére $pointer++; } // get char return $building[1]; } // function string2array public static function array2xml ($array, $use_counter=false) { // function array2xml if (!is_array ($array)) return ''; // a string resultante $string = ''; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; // iniciaremos copiando o array para o primeiro andar do edifício $building[$floor] = $array; // nosso processo se dará em um loop "infinito" while (1) { // loop // capturaremos o item corrente do array no andar em que nos encontramos // com each, após a captura, o ponteiro interno do array deverá avançar para o próximo item $item = each ($building[$floor]); // se o array tiver terminado, desceremos um andar if ($item === false) { // end of array unset ($building[$floor]); $floor--; // Se chegarmos ao "térreo", o processo terminou if (!$floor) break; // Se não terminou, imprime a marcação de fechamento $string .= '<' . current ($building[$floor]) . ">" . CRLF; } // end of array else { // array item // capturamos a chave e o valor do item corrente $key = $item[0]; $value = $item[1]; // imprimimos a chave do array $string .= '<' . $key . '>'; // Se o valor for um "subarray", if (is_array ($value)) { // value is array // subimos um andar $floor++; // copiamos o array deste valor para o andar em que nos encontramos $building[$floor] = $value; // Imprimimos uma quebra de linha $string .= CRLF; } // value is array elseif (is_object ($value)) { // is object } // is object else { // numeric value // imprimimos "=" e o valor sem os apóstrofos $string .= strval ($value) . '" . CRLF; } // numeric value } // array item } // loop return $string; } // function array2xml } // class eclIo_file //!eof:engine/eclIo/eclIo_file.php; //!file:engine/eclIo/eclIo_fileBinary.php; class eclIo_fileBinary { // class eclIo_fileBinary private $openedFiles = array (); public function &open ($name) { // function & if (!isset ($this->openedFiles[$name])) { // open file if (is_file ($name)) $this->openedFiles[$name][0] = file_get_contents ($name); else $this->openedFiles[$name][0] = ''; $this->openedFiles[$name][1] = $this->openedFiles[$name][0]; } // open file $data = &$this->openedFiles[$name][0]; return $data; } // function & public function close () { // function close foreach ($this->openedFiles as $name => $contents) { // each opened file if (strlen ($contents[0]) and $contents[0] != $contents[1]) file_put_contents ($name, $contents[0]); if (!strlen ($contents[0]) and is_file ($name)) unlink ($name); } // each opened files } // function close } // class eclIo_fileBinary //!eof:engine/eclIo/eclIo_fileBinary.php; //!file:engine/eclIo/eclIo_functions.php; class eclIo_functions { // class eclIo_functions public function cssFormat ($string) { // function cssFormat $replaces = array ( CR => '', LF => '', ': ' => ':', '; ' => ';', CHR_HT => '', '}' => ' }' . CRLF, '{' => ' { ', ';' => '; ', ' ' => ' ', ' ' => ' ', ); foreach ($replaces as $a => $b) { // each replacement $string = str_replace ($a, $b, $string); } // each replacement return $string; } // function cssFormat public function close () { // function close } // function close } // class eclIo_functions //!eof:engine/eclIo/eclIo_functions.php; //!file:engine/eclIo/eclIo_htaccess.php; class eclIo_htaccess { // class eclIo_htaccess public function regenerate () { // function regenerate $string = '#!Ecolabore Engine (c)2017 - Copyleft by Angelo Beck' . CRLF . '# Do not change these lines. Changes will be made from system.' . CRLF . CRLF . '' . CRLF . 'RewriteEngine On' . CRLF . CRLF . '# Forbiden invalid requests' . CRLF . 'RewriteRule [@%<>&] - [F]' . CRLF . CRLF . '# redirect all requests for the index' . CRLF . 'RewriteRule - ' . SYSTEM_SCRIPT_NAME . '?RewriteEngine=On [L]' . CRLF . CRLF . '' . CRLF . '#!End of Ecolabore Engine settings' . CRLF; file_put_contents ('.htaccess', $string); } // function regenerate public function close () { // function close } // function close } // class eclIo_htaccess //!eof:engine/eclIo/eclIo_htaccess.php; //!file:engine/eclIo/eclIo_log.php; class eclIo_log { // class eclIo_log public $cache = ''; public $silent = false; public $buffer = ''; private $messages = array (); private $startTime; public function __construct () { // function __construct $this->startTime = microtime (true); } // function __construct public function addMessage ($message, $group='') { // function addMessage $this->messages[$group][] = $message; } // function addMessage public function close () { // function close if ($this->silent) return; $this->buffer = "'; } // function close } // class eclIo_log //!eof:engine/eclIo/eclIo_log.php; //!file:engine/eclIo/eclIo_packager.php; class eclIo_packager { // class eclIo_packager private $databaseString; private $externalString; private $dataBuffer; private $dataIndex; private $clearFiles; private $index_contents; private $path_engine, $path_library, $path_shared; private $packMediaFiles; public $nlMode = CRLF; public $indentLevel = 100; public $indent = "\t"; public $outputFileExtension = '.ecl.php'; public function __construct () { // function __construct global $io; defined ('SYSTEM_IS_PACKED') or define ('SYSTEM_IS_PACKED', false); $this->externalString = array ( '#', chr (0), chr (10), chr (13), chr (26), chr (39), chr (92) ); $this->databaseString = array ( '#c', '#0', '#n', '#r', '#z', '#s', '#e' ); if ($io->systemConstants->check ('PATH_ENGINE')) $this->path_engine = $io->systemConstants->constants['PATH_ENGINE']; else $this->path_engine = PATH_ENGINE; if ($io->systemConstants->check ('PATH_LIBRARY')) $this->path_library = $io->systemConstants->constants['PATH_LIBRARY']; else $this->path_library = PATH_LIBRARY; if ($io->systemConstants->check ('PATH_SHARED')) $this->path_shared = $io->systemConstants->constants['PATH_SHARED']; else $this->path_shared = PATH_SHARED; } // function __construct public function pack ($params=array ()) { // function pack if (defined ('SYSTEM_IS_PACKED') and SYSTEM_IS_PACKED) return false; set_time_limit (300); ignore_user_abort (true); isset ($params['pack_mode']) or $params['pack_mode'] = 'export'; isset ($params['filename']) or $params['filename'] = 'install.php'; isset ($params['clear_source_files']) or $params['clear_source_files'] = false; isset ($params['pack_media_files']) or $params['pack_media_files'] = false; $this->packMediaFiles = $params['pack_media_files']; $this->dataBuffer = ''; $this->dataIndex = array (); $this->index_contents = file_get_contents (FOLDER_ROOT . SYSTEM_SCRIPT_NAME); $this->clearFiles = array (); $this->pack_controls (); $this->pack_shared (); $this->pack_embeded (); $settings = array ('SYSTEM_IS_PACKED' => true); if ($params['pack_mode'] == 'export') $fileName = FOLDER_ROOT . $params['filename']; else $fileName = FOLDER_ROOT . SYSTEM_SCRIPT_NAME; $package = fopen ($fileName, 'a+b'); ftruncate ($package, 0); fwrite ($package, $this->get_index_header ()); fwrite ($package, $this->set_packager_settings ($settings)); fwrite ($package, $this->pack_map ()); fwrite ($package, $this->pack_data_map ()); fwrite ($package, $this->pack_scripts ()); fwrite ($package, $this->get_index_footer ()); fwrite ($package, $this->dataBuffer); fclose ($package); if (!$params['clear_source_files'] or $params['pack_mode'] == 'export') return; // delete source files foreach ($this->clearFiles as $file) { // clear each source file unlink ($file); } // clear each source file // clear empty folders $folders = array (FOLDER_ENGINE, FOLDER_LIBRARY, FOLDER_SHARED); $list = array (); foreach ($folders as $level1) { // each level 1 if ($level1[0] == '.') continue; if (!is_dir ($level1)) continue; $list[] = $level1; foreach (scandir ($level1) as $level2) { // each level 2 if ($level2[0] == '.') continue; $level2 = $level1 . $level2 . '/'; if (!is_dir ($level2)) continue; $list[] = $level2; foreach (scandir ($level2) as $level3) { // each level 3 if ($level3[0] == '.') continue; $level3 = $level2 . $level3 . '/'; if (!is_dir ($level3)) continue; $list[] = $level3; foreach (scandir ($level3) as $level4) { // each level 4 if ($level4[0] == '.') continue; $level4 = $level3 . $level4 . '/'; if (!is_dir ($level4)) continue; $list[] = $level4; } // each level 4 } // each level 3 } // each level 2 } // each level 1 $list = array_reverse ($list); foreach ($list as $dir) { // each dir if (count (scandir ($dir)) == 2) rmdir ($dir); } // each dir } // function pack private function get_index_header () { // function get_index_header $indexFile = &$this->index_contents; $start = strpos ($indexFile, '//!' . 'packager:start_of_files'); if (!$start) exit ('markup "//!' . 'packager:start_of_files" not found in index.php'); $start += strlen ('//!' . 'packager:start_of_files'); $indexHeader = substr ($indexFile, 0, $start) . CRLF; return $indexHeader; } // function get_index_header private function get_index_footer () { // function get_index_footer $indexFile = $this->index_contents; $start = strpos ($indexFile, '//!' . 'packager:end_of_files'); if (!$start) exit ('markup "//!' . 'packager:end_of_files" not found in index.php'); if (defined ('SYSTEM_COMPILER_HALT_OFFSET')) $indexFooter = substr ($indexFile, $start, SYSTEM_COMPILER_HALT_OFFSET - $start); else $indexFooter = substr ($indexFile, $start) . CRLF . '__halt_' . 'compiler();'; return $indexFooter; } // function get_index_footer private function set_packager_settings ($settings) { // function set_packager_settings $buffer = '//!' . 'start_of_packager_settings' . CRLF . CRLF; foreach ($settings as $key => $value) { // each setting $buffer .= 'define(' . "'" . $key . "'" . ', '; if (is_string ($value)) $buffer .= "'" . str_replace ("'", "\'", $value) . "'"; elseif (is_int ($value)) $buffer .= strval ($value); elseif ($value === false) $buffer .= 'false'; else $buffer .= 'true'; $buffer .= ');' . CRLF; } // each setting $buffer .= CRLF . '//!' . 'end_of_packager_settings' . CRLF; return $buffer; } // function set_packager_settings private function pack_map () { // function pack_map $map = '//!' . 'packager:start_of_map' . CRLF; $map .= '$systemMap = array (' . CRLF; $first = true; foreach (scandir (FOLDER_LIBRARY) as $module) { // scan library if ($module[0] == '.') continue; foreach (scandir (FOLDER_LIBRARY . $module) as $name) { // each file if (!is_file (FOLDER_LIBRARY . $module . '/' . $name)) continue; if (substr ($name, 0, 4) != 'app_' or substr ($name, - 4) != '.txt') continue; $this->clearFiles[] = FOLDER_LIBRARY . $module . '/' . $name; $content = file_get_contents (FOLDER_LIBRARY . $module . '/' . $name); $lines = array (); foreach (explode ("\n", $content) as $line) { // each line $line = trim ($line); if (strlen ($line) and preg_match ('/^[a-zA-Z0-9_]+$/', $line)) $lines[] = $line; } // each line if ($lines) { // lines exists if ($first) $first = false; else $map .= ',' . CRLF; $map .= "'" . substr ($name, 4, - 4) . "' => array('" . implode ("', '", $lines) . "')"; } // lines exists } // each file } // scan library $map .= CRLF; $map .= ');' . CRLF; $map .= '//!' . 'packager:end_of_map' . CRLF; return $map; } // function pack_map private function add ($mode, $path, $name, $content) { // function add $content = str_replace ($this->externalString, $this->databaseString, $content); $offset = strlen ($this->dataBuffer); $length = strlen ($content); $this->dataBuffer .= $content; $this->dataIndex[$mode][$path][$name] = strval ($offset) . ':' . strval ($length); } // function add private function pack_controls () { // function pack_controls foreach ($this->getAllFilesNames (FOLDER_LIBRARY) as $file) { // each file $parts = explode ('/', $file); $name = array_pop ($parts); $last = array_pop ($parts); if ($last == '_controls') $mode = 'c'; elseif ($last == '_help') $mode = 'h'; else continue; if (substr ($file, - 8) == '.ecl.php') { // control $name = substr ($name, 0, - 8); $this->clearFiles[] = FOLDER_LIBRARY . $file; $content = serialize (eclIo_file::string2array (file_get_contents (FOLDER_LIBRARY . $file))); } // control elseif (!$this->packMediaFiles) continue; else { // media $this->clearFiles[] = FOLDER_LIBRARY . $file; $content = file_get_contents (FOLDER_LIBRARY . $file); } // media $path = implode ('_', $parts); $this->add ($mode, $path, $name, $content); } // each file } // function pack_controls private function pack_shared () { // function pack_shared foreach ($this->getAllFilesNames (FOLDER_SHARED) as $file) { // each file if (substr ($file, - 8) != '.ecl.php') continue; $this->clearFiles[] = FOLDER_SHARED . $file; $content = serialize (eclIo_file::string2array (file_get_contents (FOLDER_SHARED . $file))); $parts = explode ('/', $file); $name = array_pop ($parts); $path = implode ('/', $parts); $this->add ('s', $path, substr ($name, 0, - 8), $content); } // each file } // function pack_shared private function pack_embeded () { // function pack_embeded foreach ($this->getAllFilesNames (FOLDER_SHARED) as $file) { // each file if (substr ($file, - 8) == '.ecl.php') continue; if (!$this->packMediaFiles and substr ($file, - 4) == '.mp3') continue; $this->clearFiles[] = FOLDER_SHARED . $file; $content = file_get_contents (FOLDER_SHARED . $file); $parts = explode ('/', $file); $name = array_pop ($parts); $path = implode ('/', $parts); $this->add ('f', $path, $name, $content); } // each file } // function pack_embeded private function pack_data_map () { // function pack_data_map $dataIndex = '//!' . 'packager:start_of_data_index' . CRLF; $dataIndex .= '$dataMap = array (' . CRLF; $dataIndex .= $this->array2php ($this->dataIndex) . CRLF; $dataIndex .= ');' . CRLF; $dataIndex .= '//!' . 'packager:end_of_data_index' . CRLF; return $dataIndex; } // function pack_data_map private function pack_scripts () { // function pack_scripts $buffer = ''; $allFiles = array (); foreach ($this->getAllFilesNames (FOLDER_ENGINE) as $file) { // loop engine files if (substr ($file, - 8) == '.ecl.php') continue; if (substr ($file, - 4) != '.php') continue; $allFiles[FOLDER_ENGINE . $file] = 'engine/' . $file; } // loop engine files foreach ($this->getAllFilesNames (FOLDER_LIBRARY) as $file) { // loop library files if (substr ($file, - 8) == '.ecl.php') continue; if (substr ($file, - 4) != '.php') continue; $allFiles[FOLDER_LIBRARY . $file] = 'library/' . $file; } // loop library files foreach ($allFiles as $fromFileName => $toFileName) { // get all scripts $this->clearFiles[] = $fromFileName; $string = file_get_contents ($fromFileName); if (substr ($string, 0, 5) == '') $string = substr ($string, 0, - 2); $buffer .= '//!' . 'file:' . $toFileName . ';' . CRLF . $string . '//' . '!eof:' . $toFileName . ';' . CRLF; } // get all files return $buffer; } // function pack_scripts public static function array2php ($array) { // function array2php if (!is_array ($array)) return ''; // a string resultante $string = ''; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; // iniciaremos copiando o array para o primeiro andar do edifício $building[$floor] = $array; $started[$floor] = false; // nosso processo se dará em um loop "infinito" while (1) { // loop // capturaremos o item corrente do array no andar em que nos encontramos // com each, após a captura, o ponteiro interno do array deverá avançar para o próximo item $item = each ($building[$floor]); // se o array tiver terminado, desceremos um andar if ($item === false) { // end of array unset ($building[$floor]); $floor--; // Se chegarmos ao "térreo", o processo terminou if (!$floor) break; // Se não terminou, imprime ")" $string .= CRLF . ')'; } // end of array else { // array item // capturamos a chave e o valor do item corrente $key = $item[0]; $value = $item[1]; // Se não for o primeiro item, acrescentaremos uma vírgula após o item anterior if ($started[$floor]) $string .= ',' . CRLF; else { // start $string .= CRLF; $started[$floor] = true; } // start // imprimimos a chave do array if (is_int ($key)) { // int key $string .= $key . ' => '; } // int key else { // string key $string .= "'" . str_replace ("'", "''", $key) . "'" . ' => '; } // string key // Se o valor for um "subarray", if (is_array ($value)) { // value is array // subimos um andar $floor++; // copiamos o array deste valor para o andar em que nos encontramos $building[$floor] = $value; $started[$floor] = false; // Imprimimos "array (" $string .= "array ("; } // value is array // Caso o valor seja numérico elseif (is_int ($value)) { // numeric value // imprimimos o valor sem os apóstrofos $string .= strval ($value); } // numeric value elseif (is_object ($value)) { // is object $string .= "''"; } // is object // Ou consideraremos o valor como string else { // string value // imprimimos a string englobada por "'", e duplicamos os apóstrofos encontrados dentro dela $string .= "'" . str_replace ("'", "''", $value) . "'"; } // string value } // array item } // loop return $string; } // function array2php public function extract ($params=array ()) { // function extract if (!defined ('SYSTEM_IS_PACKED') or !SYSTEM_IS_PACKED) return; set_time_limit (3600); ignore_user_abort (true); $this->index_contents = file_get_contents (FOLDER_ROOT . SYSTEM_SCRIPT_NAME); $this->extract_scripts ($params); $this->extract_controls ($params); $this->extract_map (); $this->extract_shared ($params); $this->extract_embeded (); $settings = array ('SYSTEM_IS_PACKED' => false); if (isset ($params['output_data_file_extension'])) $settings['SYSTEM_DATA_FILE_EXTENSION'] = $params['output_data_file_extension']; $buffer = $this->get_index_header (); $buffer .= $this->set_packager_settings ($settings); $buffer .= $this->get_index_footer (); if (isset ($params['create_backup'])) { // create beckup if (isset ($params['filename'])) $fileName = $params['filename']; else $fileName = 'install.php'; $package = fopen (FOLDER_ROOT . $fileName, 'a+b'); ftruncate ($package, 0); fwrite ($package, $this->index_contents); fclose ($package); } // create backup $index = fopen (FOLDER_ROOT . SYSTEM_SCRIPT_NAME, 'a+b'); ftruncate ($index, 0); fwrite ($index, $buffer); fclose ($index); } // function extract private function extract_scripts ($params) { // function extract_scripts global $io; $string = $this->index_contents; $pointer = 0; $numFiles = 0; for ($watchDog = 0; $watchDog < 2000; $watchDog++) { // loop $pointer = strpos ($string, '//!' . 'file:', $pointer); if ($pointer === false) break; $pointer += 8; $end = strpos ($string, ";", $pointer); $length = $end - $pointer; $pathway = substr ($string, $pointer, $length); $numFiles++; $pointer = $end + 1; $end = strpos ($string, '//!' . 'eof:' . $pathway, $pointer); if ($end === false) break; $length = $end - $pointer; $file = ''; $file = $io->scriptFormat->format ($file, $params); $folders = explode ('/', $pathway); if ($folders[0] == 'engine') $folders[0] = $this->path_engine; elseif ($folders[0] == 'library') $folders[0] = $this->path_library; if (substr ($folders[0], - 1) == '/') $folders[0] = substr ($folders[0], 0, - 1); $fileName = implode ('/', $folders); $this->filePutContents (FOLDER_ROOT, $fileName, $file); } // loop } // function extract_scripts private function extract_map () { // function extract_map global $systemMap; // extract maps foreach ($systemMap as $application => $names) { // each map list ($module) = explode ('_', $application); $content = implode (CRLF, $names); $this->filePutContents (FOLDER_ROOT, $this->path_library . $module . '/app_' . $application . '.txt', $content); } // each map } // function extract_map private function extract_controls () { // function extract_controls global $io, $dataMap; // extract controls foreach ($dataMap['c'] as $module => $names) { // each module controls $path = str_replace ('_', '/', $module); foreach ($names as $name => $pos) { // each name $content = $io->file->array2string ($io->cachedControls->read ('c', $module, $name), '#'); $this->filePutContents (FOLDER_ROOT, $this->path_library . $path . '/_controls/' . $name . '.ecl.php', $content); } // each name } // each module controls foreach ($dataMap['h'] as $module => $names) { // each module help $path = str_replace ('_', '/', $module); foreach ($names as $name => $pos) { // each name if (strpos ($name, '.') === false) { // control $content = $io->file->array2string ($io->cachedControls->read ('h', $module, $name), '#'); $this->filePutContents (FOLDER_ROOT, $this->path_library . $path . '/_help/' . $name . '.ecl.php', $content); } // control else { // media $content = $io->cachedControls->file ($module, $name, 'h'); $this->filePutContents (FOLDER_ROOT, $this->path_library . $path . '/_help/' . $name, $content); } // media } // each name } // each module help } // function extract_controls private function extract_shared () { // function extract_shared global $io, $dataMap; foreach ($dataMap['s'] as $path => $names) { // each module foreach ($names as $name => $pos) { // each name $content = $io->file->array2string ($io->cachedControls->read ('s', $path, $name)); $this->filePutContents (FOLDER_ROOT, $this->path_shared . $path . '/' . $name . '.ecl.php', $content); } // each name } // each module } // function extract_shared private function extract_embeded () { // function extract_embeded global $io, $dataMap; foreach ($dataMap['f'] as $path => $names) { // each module foreach ($names as $name => $pos) { // each name $content = $io->cachedControls->file ($path, $name); $this->filePutContents (FOLDER_ROOT, $this->path_shared . $path . '/' . $name, $content); } // each name } // each module } // function extract_embeded public function getAllFilesNames ($basedir, $path='', $files=array ()) { // function getAllFilesNames foreach (scandir ($basedir . $path) as $name) { // loop scandir if ($name[0] == '.') continue; if (is_dir ($basedir . $path . $name)) $files = $this->getAllFilesNames ($basedir, $path . $name . '/', $files); elseif (is_file ($basedir . $path . $name)) $files[] = $path . $name; } // loop scandir return $files; } // function getAllFilesNames public function filePutContents ($basedir, $file, $string) { // function filePutContents $parts = explode ('/', $file); $name = array_pop ($parts); $dir = $basedir; foreach ($parts as $folder) { // each folder $dir .= $folder . '/'; if (!is_dir ($dir)) mkdir ($dir); } // each folder file_put_contents ($basedir . $file, $string); } // function filePutContents public function close () { // function close } // function close } // class eclIo_packager //!eof:engine/eclIo/eclIo_packager.php; //!file:engine/eclIo/eclIo_request.php; class eclIo_request { // class eclIo_request public $protocol; public $host; public $pathway; public $lang = false; public $actions = array (); public $received = array (); public $rewriteEngine = false; public function __construct () { // function __construct global $io; if (isset ($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') $this->protocol = 'https'; else $this->protocol = 'http'; // Rewrite Engine if (isset ($_GET['RewriteEngine'])) $this->rewriteEngine = true; elseif (SYSTEM_REWRITE_ENGINE and strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache') and !is_file (FOLDER_ROOT . '.htaccess')) $io->htaccess->regenerate (); // Root dir $root = substr ($_SERVER['SCRIPT_NAME'], 1, - strlen (SYSTEM_SCRIPT_NAME)); // host $host = $_SERVER['SERVER_NAME']; // uri $uri = substr ($_SERVER['REQUEST_URI'], 1 + strlen ($root)); if ($pos = strpos ($uri, '=')) $uri = substr ($uri, $pos + 1); elseif (substr ($uri, 0, strlen (SYSTEM_SCRIPT_NAME)) == SYSTEM_SCRIPT_NAME) $uri = substr ($uri, strlen (SYSTEM_SCRIPT_NAME)); // pathway $pathway = array (); foreach (explode ('/', $uri) as $dir) { // each dir if (preg_match ('%^[a-zA-Z0-9._+-]+$%', $dir)) $pathway[] = $dir; } // each dir // Actions if (substr (end ($pathway), 0, 1) == '_') { // actions $actions_groups = explode ('_', substr (array_pop ($pathway), 1)); foreach ($actions_groups as $action_group) { // each action group // uma ação pode ter argumentos separados por hifem "-" $action_parts = explode ('-', $action_group); $this->actions[$action_parts[0]] = $action_parts; } // each action group } // actions // Reconheceremos por ventura algum idioma if ($this->isLanguage (end ($pathway))) $this->lang = array_pop ($pathway); reset ($pathway); // set reference mode if (SYSTEM_HOSTING_MODE == 2) { // working in Portal mode $main_host_length = strlen (SYSTEM_HOST); $v_host = substr ($host, 0, - $main_host_length); preg_match ('/(www\.)?([a-z0-9][a-z0-9_-]+)?\.?$/', $v_host, $preg_match); if (isset ($preg_match[2])) array_unshift ($pathway, $preg_match[2]); else array_unshift ($pathway, SYSTEM_DEFAULT_DOMAIN_NAME); $this->host = SYSTEM_HOST . '/'; $this->pathway = $pathway; } // working in Portal mode elseif (SYSTEM_HOSTING_MODE == 1) { // subdomains in subfolders // Domínio padrão caso não haja uma pasta if (!$pathway) $pathway[0] = SYSTEM_DEFAULT_DOMAIN_NAME; elseif ($pathway[0] == '-' . SYSTEM_ADMIN_URI or $pathway[0] == '-' . SYSTEM_PROFILES_URI) $pathway[0] = substr ($pathway[0], 1); $this->host = $host . '/' . $root; $this->pathway = $pathway; } // subdomains in subfolders else { // single mode if ($pathway and ($pathway[0] == '-' . SYSTEM_ADMIN_URI or $pathway[0] == '-' . SYSTEM_PROFILES_URI)) $pathway[0] = substr ($pathway[0], 1); else array_unshift ($pathway, SYSTEM_DEFAULT_DOMAIN_NAME); $this->host = $host . '/' . $root; $this->pathway = $pathway; } // single mode if (!get_magic_quotes_gpc ()) $this->received = $_POST; else { // unescape string - magic quotes off $received = array (); foreach ($_POST as $key => $value) { // each field $received[$key] = str_replace (array ('\\\\', '\\\'', '\\"'), array ('\\', '\'', '"'), $value); } // each field $this->received = $received; } // unescape string -- magic quotes off } // function __construct public function isLanguage ($lang) { // function isLanguage if (strlen ($lang) != 2) return false; if ($lang == 'pt' or $lang == 'en' or $lang == 'es' or $lang == 'it' or $lang == 'fr') return true; if (is_file (FOLDER_SHARED . 'labels/lang/' . $lang . '.ecl.php')) return true; return false; } // function isLanguage public function close () { // function close } // function close } // class eclIo_request //!eof:engine/eclIo/eclIo_request.php; //!file:engine/eclIo/eclIo_scriptFormat.php; class eclIo_scriptFormat { // class eclIo_scriptFormat private $indent = CHR_HT; private $indentStart = 3; private $tokens; private $length; private $index = 0; private $level = 0; private $buffer = ''; private $lastFormat = array (); private $addNewLine = 0; public function format ($script, $params=array ()) { // function format $this->indent = CHR_HT; $this->indentStart = 3; $this->tokens = array (); $this->length = 0; $this->index = 0; $this->level = 0; $this->buffer = ''; $this->lastFormat = array (); $this->addNewLine = 0; if (isset ($params['script_indent'])) { // overwrite indentation string $this->indent = ''; foreach (explode (',', $params['script_indent']) as $int) { // loop chars $this->indent .= chr (intval (trim ($int, ', _'))); } // loop chars if (!strlen ($this->indent)) $this->indent = CHR_HT; } // overwrite indentation string if (isset ($params['script_indent_start'])) $this->indentStart = intval ($params['script_indent_start']); if (isset ($params['script_accessibility'])) { // accessibility $accessibility = true; $this->indent = ''; } // accessibility else $accessibility = false; $script = str_replace (CRLF, LF, $script); $this->tokens = token_get_all ($script); $this->length = count ($this->tokens); $names = array (); $nextName = ''; $inParentesis = 0; $inFunctionHeader = false; $afterTernary = false; $allowNextLevel = false; while (true) { // loop tokens list ($code, $string, $line, $newLine) = $this->getToken (); switch ($code) { // switch code case 0: break 2; case 1: switch ($string) { // switch string token case '"': case "'": case '@': case '!': case '&': $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break 2; case ',': $format = array ('spaceBefore' => 0); $this->buffer .= $this->getIndent ($format) . $string . CHR_WSP; break 2; case '.': $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 0); $this->buffer .= $this->getIndent ($format) . CHR_WSP . $string . CHR_WSP; break 2; case '=': if ($inFunctionHeader) $format = array ('spaceBefore' => 0, 'spaceAfter' => 0); else $format = array ('spaceBefore' => 1, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break 2; // Exigem espaços antes e após case '%': case '+': case '-': case '/': case '*': case '~': case '^': case '|': case '<': case '>': $format = array ('spaceBefore' => 1, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break 2; case '?': $afterTernary = true; $format = array ('spaceBefore' => 1, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break 2; case ':': if ($afterTernary) { // after ternary $afterTernary = false; $format = array ('spaceBefore' => 1, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break 2; } // after ternary $format = array ('spaceBefore' => 0, 'newLineAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; if ($allowNextLevel !== false) { // allow next level $allowNextLevel = false; $this->level++; } // allow next level break 2; case '(': $inParentesis++; $this->level++; if ($accessibility) $format = array ('spaceBefore' => 1); else $format = array ('spaceBefore' => 0); $this->buffer .= $this->getIndent ($format) . $string; break 2; case ')': $inParentesis--; $this->level--; $format = array ('newLineBefore' => $newLine); $this->buffer .= $this->getIndent ($format) . $string; if (!$inParentesis) { // next token list ($nextCode, $nextString, $line, $nextNewLine) = $this->getNextToken (); if ($nextString != ':') $allowNextLevel = false; } // next token break 2; case '[': case ']': $format = array ('spaceBefore' => 0); $this->getIndent ($format); $this->buffer .= $string; break 2; case '{': $allowNextLevel = false; list ($nextCode, $nextString, $nextLine, $nextNewLine) = $this->getNextToken (); $inFunctionHeader = false; if (isset ($names[$this->level + 1])) { // comment is set $comment = $names[$this->level + 1]['comment']; $format = array ('newLineBefore' => 1, 'newLineAfter' => $names[$this->level + 1]['openNewLineAfter']); $this->buffer .= $this->getIndent ($format) . $string . ' // ' . $comment; if ($nextCode == T_COMMENT and $nextNewLine == 0) $this->getToken (); $this->level++; break 2; } // comment is set $format = array ('newLineBefore' => 1, 'newLineAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; $this->level++; $allowNextLevel = false; break 2; case '}': $this->level--; list ($nextCode, $nextString, $nextLine, $nextNewLine) = $this->getNextToken (); $format = array ('newLineBefore' => 1, 'newLineAfter' => 1); if (isset ($names[$this->level + 1])) { // comment is set $comment = $names[$this->level + 1]['comment']; $format = array ('newLineBefore' => 1, 'newLineAfter' => $names[$this->level + 1]['closeNewLineAfter']); $this->buffer .= $this->getIndent ($format) . $string . ' // ' . $comment; if ($nextCode == T_COMMENT and $nextNewLine == 0) $this->getToken (); unset ($names[$this->level + 1]); break 2; } // comment is set $format = array ('newLineBefore' => 1, 'newLineAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break 2; case ';': if ($inParentesis) $format = array ('spaceBefore' => 0, 'spaceAfter' => 1); else $format = array ('spaceBefore' => 0, 'newLineAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break 2; } // switch string token break; case T_DOC_COMMENT: case T_COMMENT: // // or #, and /+* *+/ in PHP 5 $string = rtrim ($string, CHR_HT . LF . '* /'); if (substr ($string, 0, 2) == '/' . '*') { // doc comment $string = ltrim ($string, CHR_HT . LF . '* /'); $lines = array (); foreach (explode (LF, $string) as $line) { // each line $lines[] = trim ($line, CHR_HT . LF . '/ *'); } // each line $string = '/' . '*' . LF . '* ' . implode (LF . '* ', $lines) . LF . '*' . '/'; $newLine = 2; } // doc comment $this->addNewLine = 1; if (!$newLine) $format = array ('spaceBefore' => 1, 'newLineAfter' => 1); else $format = array ('newLineBefore' => $newLine, 'newLineAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // a resolver case T_CLASS: // class list ($nextCode, $nextString, $nextLine, $nextNewLine) = $this->getNextToken (); $allowNextLevel = $string; $comment = $string . ' ' . $nextString; $names[$this->level + 1] = array ('comment' => $comment, 'openNewLineAfter' => 2, 'closeNewLineAfter' => 2); $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; case T_FUNCTION: // function or cfunction list ($nextCode, $nextString, $nextLine, $nextNewLine) = $this->getNextToken (); $allowNextLevel = $string; $inFunctionHeader = true; $comment = $string . ' ' . $nextString; $names[$this->level + 1] = array ('comment' => $comment, 'openNewLineAfter' => 1, 'closeNewLineAfter' => 2); $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Regular tokens // Exigem espaço após case T_ABSTRACT: // abstract case T_CONST: // const case T_FINAL: // final case T_INTERFACE: // interface case T_PRIVATE: // private case T_PUBLIC: // public case T_PROTECTED: // protected $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Exigem espaços antes e após case T_AND_EQUAL: // &= case T_AS: // as case T_BOOLEAN_AND: // && case T_BOOLEAN_OR: // || case T_CLONE: // clone case T_CONCAT_EQUAL: // .= case T_DIV_EQUAL: // /= case T_DOUBLE_ARROW: // => case T_EXTENDS: // extends case T_IMPLEMENTS: // implements case T_INSTANCEOF: // instanceof type operators (available since PHP 5.0.0) case T_IS_EQUAL: // == case T_IS_GREATER_OR_EQUAL: // >= case T_IS_IDENTICAL: // === case T_IS_NOT_EQUAL: // != or <> case T_IS_NOT_IDENTICAL: // !== case T_IS_SMALLER_OR_EQUAL: // <= case T_LOGICAL_AND: // and case T_LOGICAL_OR: // or case T_LOGICAL_XOR: // xor case T_MINUS_EQUAL: // -= case T_MOD_EQUAL: // %= case T_MUL_EQUAL: // *= case T_NEW: // new case T_OR_EQUAL: // |= case T_PLUS_EQUAL: // += case T_SL: // << case T_SL_EQUAL: // <<= case T_SR: // >> case T_SR_EQUAL: // >>= case T_XOR_EQUAL: // ^= $format = array ('spaceBefore' => 1, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Não pode estar no início da linha nem admitem espaço após case T_ARRAY: // array() case T_ARRAY_CAST: // (array) case T_BOOL_CAST: // (bool) or (boolean) case T_DOUBLE_CAST: // (real), (double) or (float) case T_INT_CAST: // (int) or (integer) case T_OBJECT_CAST: // (object) case T_STRING_CAST: // (string) $format = array ('newLineBefore' => 0, 'spaceAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; // Não admite espaço ou quebra de linha após case T_ECHO: // echo() case T_EMPTY: // empty() case T_EVAL: // eval() case T_EXIT: // exit or die case T_INCLUDE: // include() case T_INCLUDE_ONCE: // include_once() case T_ISSET: // isset() case T_OBJECT_OPERATOR: // -> case T_REQUIRE: // require() case T_REQUIRE_ONCE: // require_once() case T_UNSET: // unset() case T_UNSET_CAST: // (unset) $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; // Não admitem quebra de linha após case T_DEC: // -- case T_DNUMBER: // decimal number like 0.12, etc case T_INC: // ++ case T_VARIABLE: // $foo $format = array ('newLineBefore' => $newLine, 'newLineAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; case T_CONSTANT_ENCAPSED_STRING: // 'a' or "a" // Não admitem quebra de linha após $format = array ('newLineBefore' => $newLine, 'newLineAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; case T_CLASS_C: // __CLASS__ case T_DIR: // __DIR__ case T_FILE: // __FILE__ case T_FUNC_C: // __FUNCTION__ case T_LINE: // __LINE__ case T_METHOD_C: // __METHOD__ case T_NS_C: // __NAMESPACE__ $format = array ('newLineBefore' => 0, 'newLineAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; // Exige quebra de linha admite espaço após case T_BREAK: // break case T_RETURN: // return if (!$newLine) $newLine = 1; $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Exige quebra de linha não admite espaço após case T_ENDDECLARE: // enddeclare case T_ENDFOR: // endfor case T_ENDFOREACH: // endforeach case T_ENDIF: // endif case T_ENDSWITCH: // endswitch case T_ENDWHILE: // endwhile $this->level--; if (!$newLine) $newLine = 1; $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; case T_CATCH: // catch case T_DECLARE: // declare case T_ELSEIF: // elseif or else if case T_FOR: // for case T_FOREACH: // foreach case T_IF: // if case T_WHILE: // while case T_SWITCH: // switch $allowNextLevel = $string; $nextName = $string; case T_CONTINUE: // continue case T_DEFAULT: // default case T_LIST: // list() if (!$newLine) $newLine = 1; $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 0); $this->buffer .= $this->getIndent ($format) . $string; break; // Exige quebra de linha e espaço após case T_CASE: // case $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 1); $this->level--; $this->buffer .= $this->getIndent ($format) . $string; $this->level++; break; case T_GLOBAL: // global case T_GOTO: // goto case T_NAMESPACE: // namespace case T_PRINT: // print() case T_STATIC: // static case T_THROW: // throw case T_VAR: // var if (!$newLine) $newLine = 1; $format = array ('newLineBefore' => $newLine, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Exige quebra de linha antes e após case T_DO: // do case T_ELSE: // else case T_TRY: // try if (!$newLine) $newLine = 1; $format = array ('newLineBefore' => $newLine, 'newLineAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Exige 2 quebras de linha após case T_OPEN_TAG: // ?php, ? or % $format = array ('spaceBefore' => 0, 'newLineAfter' => 2); $this->buffer .= $this->getIndent ($format) . trim ($string); break; // Exige 2 quebras de linha antes case T_CLOSE_TAG: // ? or % case T_HALT_COMPILER: // magic halt_compiler $format = array ('newLineBefore' => 2, 'spaceAfter' => 0); break; // Exige 2 quebras de linhas antes e espaço após case T_USE: // use $format = array ('newLineBefore' => 2, 'spaceAfter' => 1); $this->buffer .= $this->getIndent ($format) . $string; break; // Tokens não utilizados case T_START_HEREDOC: // <<< case T_END_HEREDOC: // heredoc syntax case T_CURLY_OPEN: // {$lt: case T_DOLLAR_OPEN_CURLY_BRACES: // ${ case T_ENCAPSED_AND_WHITESPACE: // " $a" case T_INLINE_HTML: // text outside PHP case T_NS_SEPARATOR: // \ namespaces (available since PHP 5.3.0) case T_NUM_STRING: // "$a[0]" case T_OPEN_TAG_WITH_ECHO: // $newLine); $this->buffer .= $this->getIndent ($format) . $string; break; } // switch code } // loop tokens $this->buffer .= LF . LF . '?' . '>'; if (isset ($params['script_nl']) and $params['script_nl'] == 'CRLF') $this->buffer = str_replace (LF, CRLF, $this->buffer); return $this->buffer; } // function format private function getToken () { // function getToken if ($this->index == $this->length) return array (0, '', 0, 0); $token = $this->tokens[$this->index]; $this->index++; $nl = $this->addNewLine; $this->addNewLine = 0; if (is_array ($token) and $token[0] == 371) { // spacer for ($i = 0; $i < strlen ($token[1]); $i++) { // loop char if ($token[1][$i] == LF) $nl++; } // loop char $token = $this->tokens[$this->index]; $this->index++; if ($this->index == $this->length) return array (0, '', 0, 0); } // spacer if (is_string ($token)) return array (1, $token, 0, $nl); $token[3] = $nl; return $token; } // function getToken private function getNextToken () { // function getNextToken static $line = 1; $index = $this->index + 1; if ($index >= $this->length) return array (0, '', 0, 0); $token = $this->tokens[$index]; $index++; if (is_array ($token) and $token[0] == 371) { // spacer $nl = 0; for ($i = 0; $i < strlen ($token[1]); $i++) { // loop char if ($token[1][$i] == LF) $nl++; } // loop char $token = $this->tokens[$index]; $index++; if ($index == $this->length) return array (0, '', 0, 0); } // spacer else $nl = 0; if (is_string ($token)) return array (1, $token, $line, $nl); $token[3] = $nl; return $token; } // function getNextToken private function getIndent ($format) { // function getIndent $lastFormat = $this->lastFormat; $this->lastFormat = $format; if (isset ($format['spaceBefore'])) { // space before if ($format['spaceBefore']) return CHR_WSP; return ''; } // space before if (isset ($lastFormat['spaceAfter'])) { // space after last token if ($lastFormat['spaceAfter']) return CHR_WSP; return ''; } // space after last token $nl = 0; if (isset ($format['newLineBefore'])) $nl = $format['newLineBefore']; if (isset ($lastFormat['newLineAfter']) and $lastFormat['newLineAfter'] > $nl) $nl = $lastFormat['newLineAfter']; if (!$nl) return ''; $buffer = LF; if ($nl > 1) $buffer .= LF; for ($i = $this->indentStart; $i <= $this->level; $i++) { // loop levels $buffer .= $this->indent; } // loop levels return $buffer; } // function getIndent public function close () { // function close } // function close } // class eclIo_scriptFormat //!eof:engine/eclIo/eclIo_scriptFormat.php; //!file:engine/eclIo/eclIo_sendFile.php; class eclIo_sendFile { // class eclIo_sendFile static public function send ($path, $params) { // function send error_reporting (0); set_time_limit (0); // header_remove(); while (@ob_end_clean ()); // turn off compression on the server if (is_callable ('apache_setenv')) apache_setenv ('no-gzip', 1); $headers = is_callable ('apache_request_headers') ? apache_request_headers () : array (); ini_set ('zlib.output_compression', 'Off'); $parts = self::get_file_parts ($path); if (!$parts) { // bad request header ('HTTP/1.0 400 Bad Request'); return 400; } // bad request if (!is_file ($path)) { // file not found header ('HTTP/1.0 404 Not Found'); return 404; } // file not found $name = $parts[0]; $mime = $parts[1]; $size = filesize ($path); $start = 0; $end = $size - 1; $updated = filemtime ($path); if (isset ($headers['If-Modified-Since']) and $headers['If-Modified-Since'] == $updated) { // not modified header ('HTTP/1.1 304 Not Modified'); return 304; } // not modified $stream = fopen ($path, 'rb'); if (!$stream and $size > 2000000) { // internal error header ('HTTP/1.0 500 Internal Server Error'); return 500; } // internal error // allow a file to be streamed instead of sent as an attachment if (isset ($_REQUEST['stream'])) header ('Content-Disposition: inline;'); elseif (isset ($params['Content-Disposition']) and $params['Content-Disposition'] == 'inline') header ('Content-Disposition: inline;'); elseif (isset ($params['Filename'])) header ('Content-Disposition: attachment; filename="' . $params['Filename'] . '"'); else header ('Content-Disposition: attachment; filename="' . $name . '"'); if (isset ($params['Cache-Control'])) header ('Cache-Control: ' . $params['Cache-Control']); header ('Content-Type: ' . $mime); header ('Last-Modified: ' . $updated); if ($stream) header ('Accept-Ranges: bytes'); // check if http_range is sent by browser (or download manager) if (false) // (isset ($_SERVER['HTTP_RANGE'])) { // requested range list ($requested_size_unit, $requested_range_orig) = explode ('=', $_SERVER['HTTP_RANGE'], 2); // multiple ranges could be specified at the same time, but for simplicity only serve the first range // http://tools.ietf.org/id/draft-ietf-http-range-retrieval-00.txt list ($range) = explode (',', $requested_range_orig, 2); list ($requested_start, $requested_end) = explode ('-', $range); if ($requested_size_unit != 'bytes' or $requested_start >= $requested_end or $requested_start >= $end or $requested_end > $end) { // out of range header ('HTTP/1.1 416 Requested Range Not Satisfiable'); return 416; } // out of range $start = $requested_start; $end = $requested_end; } // requested range //Only send partial content header if downloading a piece of the file (IE workaround) if ($stream and $start > 0) { // partial content header ('HTTP/1.1 206 Partial Content'); header ('Content-Range: bytes ' . strval ($start) . '-' . $end . '/' . $size); header ('Content-Length: ' . ($end - $start + 1)); fseek ($stream, $start); $sentBytes = 0; while (!feof ($stream)) { // send chunks $readingSize = $size - $sentBytes; if ($readingSize > 524288) // 512 * 1024 $readingSize = 524288; elseif ($readingSize <= 0) break; $data = fread ($stream, $readingSize); if (!$data) break; $sentBytes += strlen ($data); echo$data; flush (); if (connection_status () !== CONNECTION_NORMAL) { // aborted fclose ($stream); return 1; } // aborted } // send chunk fclose ($fp); return 0; } // partial content header ('Content-Length: ' . $size); if (!$stream) { // fopen failed print file_get_contents ($path); return 0; } // fopen failed fseek ($stream, 0); fpassthru ($stream); fclose ($stream); return 0; } // function send static public function get_file_parts ($file) { // function get_file_parts $parts = explode ('/', $file); // cant read from root directory (protection) if (count ($parts) < 2) return false; // allowed folders switch ($parts[0] . '/') { // base dir case PATH_DOMAINS: case PATH_PROFILES: case PATH_LIBRARY: case PATH_SHARED: break; default: return false; } // base dir $name = array_pop ($parts); $n = strrpos ($name, '.'); if (!$n) return array ($name, "application/octet-stream"); $extension = strtolower (substr ($name, $n + 1)); switch ($extension) { // switch extension case 'js': $mime = 'application/javascript'; break; case 'json': $mime = 'application/json'; break; case 'jpg': case 'jpeg': case 'jpe': $mime = 'image/jpg'; break; case 'png': case 'gif': case 'bmp': case 'tiff': $mime = 'image/' . $extension; break; case 'css': $mime = 'text/css'; break; case 'xml': $mime = 'application/xml'; break; case 'doc': case 'docx': $mime = 'application/msword'; break; case 'xls': case 'xlt': case 'xlm': case 'xld': case 'xla': case 'xlc': case 'xlw': case 'xll': $mime = 'application/vnd.ms-excel'; break; case 'ppt': case 'pps': $mime = 'application/vnd.ms-powerpoint'; break; case 'rtf': $mime = 'application/rtf'; break; case 'pdf': $mime = 'application/pdf'; break; case 'html': case 'htm': case 'php': $mime = 'text/html'; break; case 'txt': $mime = 'text/plain'; break; case 'mpeg': case 'mpg': case 'mpe': $mime = 'video/mpeg'; break; case 'mp3': $mime = 'audio/mpeg'; break; case 'wav': $mime = 'audio/wav'; break; case 'aiff': case 'aif': $mime = 'audio/aiff'; break; case 'avi': $mime = 'video/msvideo'; break; case 'wmv': $mime = 'video/x-ms-wmv'; break; case 'mov': $mime = 'video/quicktime'; break; case 'zip': $mime = 'application/zip'; break; case 'tar': $mime = 'application/x-tar'; break; case 'swf': $mime = 'application/x-shockwave-flash'; break; default: if (function_exists ('mime_content_type')) { // discover file type $mime = mime_content_type ($path); } // discover file type else $mime = 'application/octet-stream'; } // switch extension return array ($name, $mime); } // function get_file_parts public function close () { // function close } // function close } // class eclIo_sendFile //!eof:engine/eclIo/eclIo_sendFile.php; //!file:engine/eclIo/eclIo_session.php; class eclIo_session { // class eclIo_session public $cache = array (); public function __construct () { // function __construct if (SYSTEM_HOSTING_MODE == 2) session_set_cookie_params (0, '/', '.' . SYSTEM_HOST); @session_start (); $this->cache = $_SESSION; } // function __construct public function close () { // function close $_SESSION = $this->cache; } // function close } // class eclIo_session //!eof:engine/eclIo/eclIo_session.php; //!file:engine/eclIo/eclIo_smtp.php; class eclIo_smtp { // class eclIo_smtp private $enabled = false; private $host; private $port; private $user; private $password; private $from; private $to = array (); private $cc = array (); private $bcc = array (); private $subject = ''; private $destinations = ''; private $alternativeContents = array (); private $relatedContents = array (); private $attachmentContents = array (); public $rejected = array(); public $log = ''; public function __construct ($host=false, $port=false, $user=false, $password=false, $from=false) { // function __construct if (!defined ('SMTP_ENABLE') or !SMTP_ENABLE) return; $this->host = $host ? $host : SMTP_HOST; $this->port = $port ? $port : SMTP_PORT; $this->user = $user ? $user : SMTP_USER; $this->password = $password ? $password : SMTP_PASSWORD; $this->from = $from ? $from : SMTP_FROM; $this->enabled = true; } // function __construct public function to ($to) { // function to foreach (explode (';', $to) as $copy) { // each copy $this->to[] = trim ($copy); } // each copy return $this; } // function to public function cc ($cc) { // function cc foreach (explode (';', $cc) as $copy) { // each copy $this->cc[] = trim ($copy); } // each copy return $this; } // function cc public function bcc ($bcc) { // function bcc foreach (explode (';', $bcc) as $copy) { // each copy $this->bcc[] = trim ($copy); } // each copy return $this; } // function bcc public function subject ($subject, $charset='UTF-8') { // function subject $this->subject = 'Subject: =?' . $charset . '?Q?' . quoted_printable_encode ($subject) . '?=' . CRLF; return $this; } // function subject public function contentHTML ($html, $charset='UTF-8', $description="Message in HTML format") { // function contentHTML $this->alternativeContents[] = 'Content-type: text/html;charset=' . $charset . CRLF . 'Content-Description: =?' . $charset . '?Q?' . quoted_printable_encode ($description) . '?=' . CRLF . 'Content-Disposition: inline' . CRLF . 'Content-Transfer-Encoding: base64' . CRLF . CRLF . chunk_split (base64_encode ($html)) . CRLF; return $this; } // function contentHTML public function contentTXT ($text, $charset='UTF-8', $description="Message in plain text format") { // function contentTXT $this->alternativeContents[] = 'Content-type: text/plain;charset=' . $charset . CRLF . 'Content-Description: =?' . $charset . '?Q?' . quoted_printable_encode ($description) . '?=' . CRLF . 'Content-Disposition: inline' . CRLF . 'Content-Transfer-Encoding: base64' . CRLF . CRLF . chunk_split (base64_encode ($text)) . CRLF; return $this; } // function contentTXT public function relatedImg ($path, $cid) { // function relatedImg $fileName = array_pop (explode ('/', $path)); $fileExtension = strtolower (array_pop (explode ('.', $fileName))); $mime = array ( 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'gif' => 'image/gif', 'png' => 'image/png' ); $contents = file_get_contents ($path); $this->relatedContents[] = 'Content-Type: ' . $mime[$fileExtension] . '; name="' . $fileName . '"' . CRLF . 'Content-Disposition: inline; filename="' . $fileName . '"' . CRLF . 'Content-Transfer-Encoding: base64' . CRLF . 'Content-ID: <' . $cid . '>' . CRLF . CRLF . chunk_split (base64_encode ($contents)) . CRLF . CRLF; return $this; } // function relatedImg public function attachment ($path) { // function attachment $fileName = array_pop (explode ('/', $path)); if (function_exists ('mime_content_type')) $mime = mime_content_type ($path); else $mime = 'application/octet-stream'; $contents = file_get_contents ($path); $this->attachmentContents[] = 'Content-Type: ' . $mime . '; name="' . $fileName . '"' . CRLF . 'Content-Disposition: attachment; filename="' . $fileName . '"' . CRLF . 'Content-Transfer-Encoding: base64' . CRLF . CRLF . chunk_split (base64_encode ($contents)) . CRLF . CRLF; return $this; } // function attachment public function send () { // function send if (!$this->enabled) return array ('msg' => 'adminMail_smtp_alertDisabled'); if (SYSTEM_TIME_LIMIT) set_time_limit (0); // Opens a socket $this->socket = @fsockopen ($this->host, $this->port, $errNo, $errMsg, SMTP_TTL); if (!$this->socket) return array ('msg' => 'adminMail_smtp_alertSocketError', 'server' => $this->host); // Ehlo $this->putContents ("EHLO " . $this->host . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertSocketError', 'server' => $this->host); // Auth login $this->putContents ("AUTH LOGIN" . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertSocketError', 'server' => $this->host); // Username $this->putContents (base64_encode ($this->user) . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertLoginError', 'server' => $this->host, 'user' => $this->user); // Password $this->putContents (base64_encode ($this->password) . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertLoginError', 'server' => $this->host, 'user' => $this->user); // mail from $this->putContents ("MAIL FROM: <" . $this->from . ">" . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertLoginError', 'server' => $this->host, 'user' => $this->user); // Test the destinations if ($error = $this->rcpt()) return $error; // data command $this->putContents ("DATA" . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertSendingError', 'to' => $this->to); list ($headers, $content) = explode (CRLF . CRLF, $this->getMessageBody (), 2); // The message $out = 'MIME-Version: 1.0' . CRLF . 'From: <' . $this->from . '>' . CRLF . $this->destinations . $this->subject . 'Date: ' . date ('D, d M Y H:i:s O') . CRLF . 'Message-ID: <' . date ('YmdHis') . "." . md5 (microtime ()) . "." . $this->from . '>' . CRLF // . 'User-Agent: ' . SYSTEM_GENERATOR . ' ' . SYSTEM_VERSION . ' ' . SYSTEM_RELEASE . CRLF . 'Importance: normal' . CRLF . $headers . CRLF . CRLF; $this->putContents ($out); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertSendingError', 'to' => implode ('; ', $this->to)); // Content $this->putContents ($content . CRLF . '.' . CRLF); if ($this->discoverError ()) return array ('msg' => 'adminMail_smtp_alertSendingError', 'to' => $this->to); // Close the socket fclose ($this->socket); return false; } // function send private function getContents () { // function getContents $c = $this->socket; $buffer = ''; while ($str = @fgets ($c, 515)) { // loop reading $buffer .= $str; // if the 4th character is a space then we are done reading // so just break the loop if (substr ($str, 3, 1) == " ") break; } // loop reading $this->log .= $buffer; return $buffer; } // function getContents private function putContents ($out) { // function putContents if (!@fwrite ($this->socket, $out)) exit ('connection was broken'); $this->log .= $out; return true; } // function putContents private function discoverError () { // function discoverError $lines = $this->getContents (); $lines = trim ($lines); if (strlen ($lines) < 4) return true; if ($lines[0] == '5') return true; return false; } // function discoverError private function getMessageBody () { // function getMessageBody $alternativeBoundary = md5 (TIME . 'ALTERNATIVE'); $relatedBoundary = md5 (TIME . 'RELATIVE'); $attachmentBoundary = md5 (TIME . 'ATTACHMENT'); if (count ($this->alternativeContents) == 1) $alternativeBody = $this->alternativeContents[0]; elseif (count ($this->alternativeContents) > 1) $alternativeBody = 'Content-Type: multipart/alternative; boundary="' . $alternativeBoundary . '"' . CRLF . CRLF . '--' . $alternativeBoundary . CRLF . implode (CRLF . '--' . $alternativeBoundary . CRLF, $this->alternativeContents) . CRLF . '--' . $alternativeBoundary . '--' . CRLF; array_unshift ($this->relatedContents, $alternativeBody); if (count ($this->relatedContents) == 1) $relatedBody = $this->relatedContents[0]; else $relatedBody = 'Content-Type: multipart/related; boundary="' . $relatedBoundary . '"' . CRLF . CRLF . '--' . $relatedBoundary . CRLF . implode (CRLF . '--' . $relatedBoundary . CRLF, $this->relatedContents) . CRLF . '--' . $relatedBoundary . '--' . CRLF; array_unshift ($this->attachmentContents, $relatedBody); if (count ($this->attachmentContents) == 1) return $this->attachmentContents[0]; return 'Content-Type: multipart/mixed; boundary="' . $attachmentBoundary . '"' . CRLF . CRLF . '--' . $attachmentBoundary . CRLF . implode (CRLF . '--' . $attachmentBoundary . CRLF, $this->attachmentContents) . CRLF . '--' . $attachmentBoundary . '--' . CRLF; } // function getMessageBody private function rcpt () { // function rcpt foreach ($this->to as $recipient) { // each recipient $this->putContents ("RCPT TO: <" . $recipient . ">" . CRLF); if ($this->discoverError ()) $this->rejected[] = $recipient; else $to[] = $recipient; } // each recipient foreach ($this->cc as $recipient) { // each recipient $this->putContents ("RCPT TO: <" . $recipient . ">" . CRLF); if ($this->discoverError ()) $this->rejected[] = $recipient; else $cc[] = $recipient; } // each recipient foreach ($this->bcc as $recipient) { // each recipient $this->putContents ("RCPT TO: <" . $recipient . ">" . CRLF); if ($this->discoverError ()) $this->rejected[] = $recipient; else $bcc[] = $recipient; } // each recipient if (isset ($to) and $to) $this->destinations .= 'To: ' . implode (",\r\n\t", $to) . CRLF; if (isset ($cc) and $cc) $this->destinations .= 'Cc: ' . implode (",\r\n\t", $cc) . CRLF; if (isset ($bcc) and $bcc) $this->destinations .= 'Bcc: ' . implode (",\r\n\t", $bcc) . CRLF; if (!strlen ($this->destinations)) return array ('msg' => 'adminMail_smtp_alertToError', 'to' => implode ('; ', $this->rejected)); return false; } // function rcpt public function close () { // function close } // function close } // class eclIo_smtp //!eof:engine/eclIo/eclIo_smtp.php; //!file:engine/eclIo/eclIo_sqlite.php; class eclIo_sqlite { // class eclIo_sqlite protected $databases = array (); public function connect ($database) { // function connect if (!isset ($this->databases[$database])) { // open file global $io; $this->databases[$database] = new eclIo_database ($io, $database); } // open file return $this->databases[$database]; } // function connect public function close () { // function close foreach ($this->databases as $database) { // each domain $database->close (); } // each domain } // function close } // class eclIo_sqlite //!eof:engine/eclIo/eclIo_sqlite.php; //!file:engine/eclIo/eclIo_systemConstants.php; class eclIo_systemConstants { // class eclIo_systemConstants public $constants; public $originalRows; protected function openConfigFile () { // function openConfigFile $this->constants = array (); if (!is_file (SYSTEM_CONFIG_FILE)) return; $file = file_get_contents (SYSTEM_CONFIG_FILE); foreach (explode (LF, $file) as $line) { // loop each line if (!strlen ($line)) continue; if (preg_match ('%define\ ?[(][\'"]([a-zA-Z0-9_]+)[\'"][,]\ ?([^)]+)%', $line, $results)) { // is a definition line list (, $key, $value) = $results; if ($value == 'true') $value = true; elseif ($value == 'false') $value = false; elseif (is_numeric ($value)) $value = intval ($value); elseif ($value[0] == "'") $value = substr ($value, 1, - 1); $this->constants[$key] = $value; } // is a definition line } // loop each line $this->originalRows = $this->constants; } // function openConfigFile public function set ($name, $value) { // function set if (!isset ($this->constants)) $this->openConfigFile (); $this->constants[$name] = $value; if (!defined ($name)) define ($name, $value); } // function set public function check ($name) { // function check if (!isset ($this->constants)) $this->openConfigFile (); if (isset ($this->constants[$name])) return true; return false; } // function check public function drop ($name) { // function drop if (!isset ($this->constants)) $this->openConfigFile (); if (isset ($this->constants[$name])) unset ($this->constants[$name]); } // function drop public function get ($name) { // function get if (!isset ($this->constants)) $this->openConfigFile (); if (isset ($this->constants[$name])) return $this->constants[$name]; if (defined ($name)) return constant ($name); return false; } // function get public function close () { // function close if ($this->constants != $this->originalRows) { // save changed file $grouped = array (); foreach ($this->constants as $key => $value) { // group constants @list ($prefix) = explode ('_', $key); $grouped[$prefix][$key] = $value; } // group constants $string = ' $value) { // each constant if ($value === false) $string .= "define ('" . $key . "', false);" . CRLF; elseif ($value === true) $string .= "define ('" . $key . "', true);" . CRLF; elseif (is_int ($value)) $string .= "define ('" . $key . "', " . strval ($value) . ");" . CRLF; elseif (is_string ($value)) $string .= "define ('" . $key . "', '" . $value . "');" . CRLF; } // each constant $string .= CRLF; } // each group $string .= '?>'; file_put_contents (SYSTEM_CONFIG_FILE, $string); } // save changed file } // function close } // class eclIo_systemConstants //!eof:engine/eclIo/eclIo_systemConstants.php; //!file:engine/eclScope/eclScope_date.php; class eclScope_date { // class eclScope_date static function get ($render, $args) { // function get global $store; if (!isset ($args[1])) return array (); $from = $args[1]; if ($from[0] == '$') { // variable $from = substr ($from, 1); if (!isset ($render->data[$from])) return array (); $from = $render->data[$from]; } // variable $from = intval ($from); if (!$from) return array (); $monthCaption = $store->control->read ('labels/date/month' . date ('n', $from)); switch (date ('d', $from)) { // switch day case 1: $th = 'st'; break; case 2: $th = 'nd'; break; case 3: $th = 'rd'; break; default: $th = 'th'; break; } // switch day $data['local'] = array ( 'year' => date ('Y', $from), 'month' => date ('m', $from), 'day' => date ('d', $from), 'month_caption' => $monthCaption['text']['caption'], 'th' => $th ); return $data; } // function get } // class eclScope_date //!eof:engine/eclScope/eclScope_date.php; //!file:engine/eclScope/eclScope_img.php; class eclScope_img { // class eclScope_img static function get ($render, $args) { // function get if (!strlen ($args)) $number = 0; elseif ($args[0] == '$') $number = $render->getVar ($args); else $number = $args; $extras = $render->getVar ('extras'); if (!isset ($extras['img_' . $number])) return array (); $scope = array ('data' => array ()); $data = &$scope['data']; $data = $extras['img_' . $number]; if (!isset ($data['img'])) return array (); $data['img_ref'] = $render->document->refFiles ($data['img']); $data['img_mini_ref'] = $render->document->refFiles ($data['img_mini']); if (!isset ($data['local']['description'])) { // provides a description $data['local']['description'] = $render->getVar ('description'); if ($data['local']['description'] === false) $data['local']['description'] = $render->getVar ('title'); if ($data['local']['description'] === false) $data['local']['description'] = $render->getVar ('caption'); } // provides a description return $scope; } // function get } // class eclScope_img //!eof:engine/eclScope/eclScope_img.php; //!file:engine/eclScope/eclScope_profile.php; class eclScope_profile { // class eclScope_profile static function get ($render, $args) { // function get global $store; if (!isset ($args[1])) return array (); $from = $args[1]; if ($from[0] == '$') { // variable $from = substr ($from, 1); if (!isset ($render->data[$from])) return array (); $from = $render->data[$from]; } // variable $from = intval ($from); if (!$from) return array (); $data = $store->userContent->open ($from, '-register'); if (!$data) return array (); $prepare['local'] = array_replace ($data, $data['text'], $data['local']); $pathway = array (SYSTEM_PROFILES_URI, $store->user->getName ($from)); $prepare['local']['ref'] = $render->document->ref ($pathway); return $prepare; } // function get } // class eclScope_profile //!eof:engine/eclScope/eclScope_profile.php; //!file:engine/eclScope/eclScope_subgroup_members.php; class eclScope_subgroup_members { // class eclScope_subgroup_members static function get ($render, $args) { // function get global $store; return array (); $data = $store->userContent->open ($from, '-register'); if (!$data) return array (); $prepare['local'] = array_replace ($data, $data['text'], $data['local']); $pathway = array (SYSTEM_PROFILES_URI, $store->user->getName ($from)); $prepare['local']['ref'] = $render->document->ref ($pathway); return $prepare; } // function get } // class eclScope_subgroup_members //!eof:engine/eclScope/eclScope_subgroup_members.php; //!file:engine/eclStore/eclStore_control.php; class eclStore_control { // class eclStore_control public $name = 'unknown'; public $controls = array (); private $render; public $php = ''; public function __construct () { // function __construct $this->render = new eclEngine_render (); } // function __construct public function read ($controlName) { // function read global $io, $store; if (isset ($this->controls[$controlName])) return $this->controls[$controlName]; $folders = explode ('/', $controlName); $count = count ($folders); switch ($count) { // switch number of folders case 1: $parts = explode ('_', $controlName, 3); $name = array_pop ($parts); $file = FOLDER_LIBRARY . implode ('/', $parts) . '/_controls/' . $name . '.ecl.php'; $path = implode ('_', $parts); $prefix = $path . '_'; $mode = 'c'; break; case 2: $path = $controlName; $prefix = $controlName . '/'; $file = FOLDER_SHARED . $prefix . '_block.ecl.php'; $name = '_block'; $mode = 's'; break; default: $file = FOLDER_SHARED . $controlName . '.ecl.php'; $name = array_pop ($folders); $path = implode ('/', $folders); $prefix = $path . '/'; $mode = 's'; } // switch number of folders if (SYSTEM_PACKED_SHARED_FIRST) { // packed first $control = $io->cachedControls->read ($mode, $path, $name); if (!$control) $control = $io->file->read ($file); } // packed first else { // external first if (!$control) $control = $io->cachedControls->read ($mode, $path, $name); } // external first if (isset ($control['children'])) { // children exists foreach ($control['children'] as &$child) { // each child if ($child[0] == '~') $child = $prefix . substr ($child, 1); } // each child } // children exists if (isset ($control['flags'])) { // flags exists foreach ($control['flags'] as &$value) { // each flag if (is_string ($value) and strlen ($value) and $value[0] == '~') $value = $prefix . substr ($value, 1); } // each flags } // flags exists if (isset ($control['flags']['control_caption'])) { // set caption $caption = $store->control->read ($control['flags']['control_caption']); if (isset ($caption['text']['caption'])) $control['text']['caption'] = $caption['text']['caption']; } // set caption if (isset ($control['html'])) $control['parsed'] = $this->render->render_tags ($control['html'], true); $this->controls[$controlName] = $control; return $control; } // function read public function scandir ($mode, $dir) { // function scandir global $dataMap, $io; if (SYSTEM_IS_PACKED) { // system packed if (isset ($dataMap[$mode][$dir])) { // dir found $names = array (); foreach ($dataMap[$mode][$dir] as $name => $value) { // each name $names[] = $name; } // each name return $names; } // dir found // search subfolders $dir .= '/'; $length = strlen ($dir); $names = array (); foreach ($dataMap[$mode] as $name => $value) { // each dir if (strlen ($name) <= $length) continue; if (substr ($name, 0, $length) == $dir) $names[] = substr ($name, $length); } // each dir return $names; } // system packed if ($mode == 'c') { // control mode } // control mode if ($mode == 's') { // shared mode if (!is_dir (FOLDER_SHARED . $dir)) return array (); $names = array (); foreach (scandir (FOLDER_SHARED . $dir) as $name) { // each name if ($name[0] == '.') continue; $names[] = $name; } // each name return $names; } // shared mode return array (); } // function scandir public function close () { // function close } // function close public function renderToPhp ($array) { // function renderToPhp $length = count ($array); if (!$length) return; $index = 0; goto LEVEL_NEXT_INSTRUCTION_1; LEVEL_NEXT_INSTRUCTION: $index++; if ($index == $length) return; LEVEL_NEXT_INSTRUCTION_1: $current = $array[$index]; if (!isset ($current[1])) goto LEVEL_NEXT_INSTRUCTION; if ($current[0] == 0) { // buffer $this->php .= '$buffer .= ' . "'" . str_replace ("'", CHR_BSLASH . "'", $current[1]) . "';" . CRLF; goto LEVEL_NEXT_INSTRUCTION; } // buffer if (isset ($current[2]) and $current[2]) $arguments = $this->renderArgumentsToPhp ($current[2]); else $arguments = array(); switch ($current[1]) { // switch function name case 'if': $this->php .= 'if (' . $arguments[0] . '){' . CRLF; if (isset ($current[3]) and $current[3]) $this->renderToPhp ($current[3]); $this->php .= '}' . CRLF; while ($index + 1 != $length and isset ($array[$index + 1][1]) and $array[$index + 1][1] == 'elseif') { // loop elseif $current = $array[$index + 1]; if (isset ($current[2]) and isset ($current[3]) and $current[3]) { // conditions and block exists $arguments = $this->renderArgumentsToPhp ($current[2]); $this->php .= 'elseif (' . $arguments[0] . '){' . CRLF; $this->renderToPhp ($current[3]); $this->php .= '}' . CRLF; } // conditions and block exists $index++; } // loop elseif if ($index + 1 != $length and isset ($array[$index + 1][1]) and $array[$index + 1][1] == 'else') { // else $current = $array[$index + 1]; if (isset ($current[3]) and $current[3]) { // block exists $this->php .= 'else {' . CRLF; $this->renderToPhp ($current[3]); $this->php .= '}' . CRLF; } // block exists $index++; } // else goto LEVEL_NEXT_INSTRUCTION; case 'loop': $this->php .= 'do {' . CRLF; if (isset ($current[3]) and $current[3]) $this->renderToPhp ($current[3]); $this->php .= '} while (eclTag_loop::render ($render));' . CRLF; goto LEVEL_NEXT_INSTRUCTION; case '': $this->php .= '$buffer .= ' . implode (' . ', $arguments) . ';' . CRLF; goto LEVEL_NEXT_INSTRUCTION; default: $class = 'eclTag_' . $current[1]; if (!preg_match ('/^[a-z][a-zA-Z0-9_]*$/', $class)) goto LEVEL_NEXT_INSTRUCTION; if (isset ($current[3]) and $current[3]) { // not empty $this->php .= '$local = ' . $class . '::render ($render, array(' . implode (', ', $arguments) . '));' . CRLF; $this->php .= '$render->levelUp ($local);' . CRLF; $this->renderToPhp ($current[3]); $this->php .= '$render->levelDown ();' . CRLF; goto LEVEL_NEXT_INSTRUCTION; } // not empty switch ($current[1]) { // switch return value tags functions case 'nl': $this->php .= '$buffer .= CRLF;' . CRLF; break; case 'details': case 'field': case 'help': case 'interactive': case 'lang': case 'list': case 'modlist': case 'personalite': case 'scope': $this->php .= '$local = ' . $class . '::render ($render, array (' . implode (', ', $arguments) . '));' . CRLF; $this->php .= 'if (isset ($local["parsed"])) { // parsed content $render->levelUp ($local); $render->render_tags_level ($local["parsed"]); $render->levelDown (); } // parsed content elseif (isset ($local["html"])) { // render html $render->levelUp ($local); $render->render_tags ($local["html"]); $render->levelDown (); } // render html '; break; case 'box': case 'img': case 'mod': case 'table': $this->php .= '$local = ' . $class . '::render ($render, array (' . implode (', ', $arguments) . ')); if ($local){ $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); } '; break; default: $this->php .= $class . '::render ($render, array (' . implode (', ', $arguments) . '));' . CRLF; } // switch return tag functions goto LEVEL_NEXT_INSTRUCTION; } // switch function name goto LEVEL_NEXT_INSTRUCTION; } // function renderToPhp private function renderArgumentsToPhp ($array) { // function renderArgumentsToPhp $arguments = array (); foreach ($array as $current) { // each argument switch ($current[0]) { // switch argument type case 0: $arguments[] = "'" . str_replace ("'", CHR_BSLASH . "'", $current[1]) . "'"; break; case 3: $arguments[] = strval ($current[1]); break; case 1: if (isset ($current[2]) and $current[2]) $sub = $this->renderArgumentsToPhp ($current[2]); else $sub = array(); if ($current[1] == '') { // anonimous function if (isset ($sub[0])) $arguments[] = $sub[0]; } // anonimous function else { // sub function $func = 'eclTag_' . $current[1]; $arguments[] = $func . '::render ($render, array (' . implode (', ', $sub) . '));' . CRLF; } // sub function break; case 2: $arguments[] = '$render->getVar (' . "'" . $current[1] . "'" . ')'; break; case 4: if (!isset ($current[2]) or !$current[2]) break; $sub = $this->renderArgumentsToPhp ($current[2]); if (count ($sub) < 2) break; switch ($current[1]) { // switch operator case 'and': $arguments[] = '(' . $sub[0] . ' and ' . $sub[1] . ')'; break; case 'or': $arguments[] = 'eclTag_or::render ($render, array (' . $sub[0] . ', ' . $sub[1] . '))'; break; } // switch operator break; case 5: if (!isset ($current[2]) or !$current[2]) break; $sub = $this->renderArgumentsToPhp ($current[2]); if (!count ($sub)) break; switch ($current[1]) { // switch operator case '!': $arguments[] = '!' . $sub[0]; } // switch operator break; } // switch argument type } // each argument return $arguments; } // function renderArgumentsToPhp } // class eclStore_control //!eof:engine/eclStore/eclStore_control.php; //!file:engine/eclStore/eclStore_domain.php; class eclStore_domain { // class eclStore_domain public $name = 'domain'; // Describe fields structure public $fields = array ( // Indexing 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'aliase' => 'keywords', 'status' => 'tinyint' ); public $insertedData = array (); private $rows = array (); private $originalRows = array (); private $indexByName = array (); private $database = false; public function __construct () { // function __construct global $io; if ($io->database->tableEnabled ($this)) $this->database = $io->database; } // function __construct public function insert ($data) { // function insert if ($this->database) { // insert into database $id = $this->database->insert ($this, $data); $data['id'] = $id; $this->rows[$id] = $data; $this->originalRows[$id] = $data; $this->indexByName[$data['name']] = $id; return $id; } // insert into database return $data['name']; } // function insert public function &open ($name) { // function & global $io; if (isset ($this->indexByName[$name])) { // row found $id = $this->indexByName[$name]; $return = &$this->rows[$id]; return $return; } // row found if ($this->database) { // open from database $rows = $this->database->select ($this, array ('name' => $name)); if ($rows) { // row found $data = $rows[0]; $id = $data['id']; $this->rows[$id] = $data; $this->originalRows[$id] = $data; $this->indexByName[$name] = $id; $return = &$this->rows[$id]; return $return; } // row found } // open from database $file = FOLDER_DOMAINS . $name . '/.domain.db'; if (is_file ($file)) { // file found $row = array ( 'id' => $name, 'status' => 2 ); $this->rows[$name] = &$row; $this->indexByName[$name] = $name; return $row; } // file found $row = array (); return $row; } // function & public function &openById ($id) { // function & if (!isset ($this->rows[$id])) { // open if (is_int ($id) and $this->database) { // open from database $rows = $this->database->select ($this, array ('id' => $id)); if ($rows) { // row found $data = $rows[0]; $this->rows[$id] = $data; $this->originalRows[$id] = $data; $this->indexByName[$data['name']] = $id; $return = &$this->rows[$id]; return $return; } // row found } // open from database $this->rows[$id] = array (); $this->indexByName[$id] = $id; } // open $return = &$this->rows[$id]; return $return; } // function & public function getId ($name) { // function getId if (!isset ($this->indexByName[$name])) $this->open ($name); if (isset ($this->indexByName[$name])) return $this->indexByName[$name]; else return false; } // function getId public function getName ($id) { // function getName if (!isset ($this->rows[$id])) $this->openById ($id); return $this->rows[$id]['name']; } // function getName public function getStatus ($name) { // function getStatus if (!isset ($this->indexByName[$name])) $this->open ($name); if (!isset ($this->indexByName[$name])) return 0; $id = $this->indexByName[$name]; $row = &$this->rows[$id]; return $row['status']; } // function getStatus public function childrenNames () { // function childrenNames $names = array (); foreach (scandir (FOLDER_DOMAINS) as $dirName) { // each directory if ($dirName[0] != '.') $names[] = $dirName; } // each directory return $names; } // function childrenNames public function delete ($id) { // function delete if (isset ($this->originalRows[$id])) { // domain in database $this->database->delete ($this, array ('id' => $id)); $this->rows[$id] = array (); unset ($this->originalRows[$id]); } // domain in database } // function delete public function close () { // function close foreach ($this->originalRows as $id => $originalRow) { // each row if ($this->rows[$id] != $originalRow) $this->database->update ($this, $this->rows[$id], $originalRow); } // each row } // function close } // class eclStore_domain //!eof:engine/eclStore/eclStore_domain.php; //!file:engine/eclStore/eclStore_domainContent.php; class eclStore_domainContent { // class eclStore_domainContent public $name = 'domain_content'; public $fields = array ( // Indexing 'domain_id' => 'mediumint', 'mode' => 'tinyint', 'parent_id' => 'mediumint', 'master_id' => 'mediumint', 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'marker' => 'tinyint', 'access' => 'tinyint', 'owner_id' => 'mediumint', 'place_id' => 'mediumint', // Dates 'created' => 'time', 'updated' => 'time', 'event_start' => 'time', 'event_end' => 'time', 'coments_last_update' => 'time', // More sort options 'index' => 'mediumint', 'hits' => 'int', 'value' => 'mediumint', 'spotlight' => 'tinyint', // Contents 'text' => 'array', 'local' => 'array', 'flags' => 'array', 'extras' => 'array', 'links' => 'array', 'keywords' => 'keywords' ); // Index public $index = array ( 'domain_find_children' => array ('domain_id', 'mode', 'parent_id'), 'domain_find_name' => array ('domain_id', 'name') ); private $indexByName = array (); private $indexByParent = array (); private $chargedParents = array (); private $chargedMode = array (); private $rows = array (); private $originalRows = array (); private $deletedRows = array (); private $notFound = array (); private $database = false; private $openedDatabases = array (); public $lastInsertedData = array (); public function __construct () { // function __construct global $io; if ($io->database->tableEnabled ($this)) $this->database = $io->database; } // function __construct public function getDatabase ($domainName) { // function getDatabase global $io; if (!isset ($this->openedDatabases[$domainName])) { // open database $this->openedDatabases[$domainName] = $io->sqlite->connect (FOLDER_DOMAINS . $domainName . '/.domain.db'); } // open database if ($this->openedDatabases[$domainName]->tableEnabled ($this)) return $this->openedDatabases[$domainName]; return false; } // function getDatabase public function indexFoundRows ($rows, $domainName=0) { // function indexFoundRows $found = array (); foreach ($rows as $data) { // each row if ($data['name'][0] == ':') continue; if (!$data['domain_id']) $data['domain_id'] = $domainName; $domainId = $data['domain_id']; $id = $data['id']; if (!isset ($this->deletedRows[$domainId][$id])) { // row not deleted if (!isset ($this->rows[$domainId][$id])) { // row not indexed $this->rows[$domainId][$id] = $data; $this->originalRows[$domainId][$id] = $data; $this->indexByName[$domainId][$data['name']] = $id; $this->indexByParent[$domainId][$data['mode']][$data['parent_id']][$id] = $id; $found[] = $data; } // row not indexed else $found[] = $this->rows[$domainId][$id]; } // row not deleted } // each row return $found; } // function indexFoundRows public function insert ($domainId, &$data) { // function insert global $io; if (is_int ($domainId) and $this->database) $database = $this->database; elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) null; else return 0; $data['domain_id'] = $domainId; if (!isset ($data['parent_id'])) $data['parent_id'] = 0; $data['index'] = count ($this->children ($domainId, $data['mode'], $data['parent_id'])); if (!isset ($data['name']) or !strlen ($data['name'])) $data['name'] = 't' . strval (TIME); $where = array ('domain_id' => $domainId, 'name' => $data['name']); if ($database->select ($this, $where, ' LIMIT 1', array ('id'))) { // prevent duplicated name $test = 0; do { // loop names $test++; $name = $data['name'] . '-' . str_pad (strval ($test), 3, '0', STR_PAD_LEFT); $where = array ('domain_id' => $domainId, 'name' => $name); } // loop names while ($database->select ($this, $where, ' LIMIT 1', array ('id'))); $data['name'] = $name; } // prevent duplicated names $id = $database->insert ($this, $data); $data['id'] = $id; $this->rows[$domainId][$id] = $data; $this->originalRows[$domainId][$id] = $data; $this->indexByName[$domainId][$data['name']] = $id; $this->indexByParent[$domainId][$data['mode']][$data['parent_id']][$id] = $id; $this->lastInsertedData = $data; return $id; } // function insert public function &open ($domainId, $name, $access=4) { // function & if (!isset ($this->indexByName[$domainId][$name])) { // open if (isset ($this->notFound[$domainId][$name])) { // registered not found $found = array (); return $found; } // registered not found if (is_int ($domainId) and $this->database) $this->indexFoundRows ($this->database->select ($this, array ('domain_id' => $domainId, 'name' => $name), ' LIMIT 1')); elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) $this->indexFoundRows ($database->select ($this, array ('name' => $name), ' LIMIT 1'), $domainId); } // open $found = array (); if (isset ($this->indexByName[$domainId][$name])) { // row found $id = $this->indexByName[$domainId][$name]; $found = &$this->rows[$domainId][$id]; if ($found['access'] <= $access) return $found; } // row found else $this->notFound[$domainId][$name] = true; $empty = array (); return $empty; } // function & public function &openById ($domainId, $id, $access=4) { // function & if (!isset ($this->rows[$domainId][$id])) { // open if (is_int ($domainId) and $this->database) $this->indexFoundRows ($this->database->select ($this, array ('domain_id' => $domainId, 'id' => $id))); elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) $this->indexFoundRows ($database->select ($this, array ('id' => $id)), $domainId); } // open $found = array (); if (isset ($this->rows[$domainId][$id])) { // found $found = &$this->rows[$domainId][$id]; if ($found['access'] <= $access) return $found; } // found $empty = array (); return $empty; } // function & public function &openChild ($domainId, $mode, $parentId, $name, $access=4) { // function & if (!isset ($this->chargedParents[$domainId][$mode][$parentId])) { // open if (is_int ($domainId) and $this->database) { // parents from database $this->chargedParents[$domainId][$mode][$parentId] = true; $this->indexFoundRows ($this->database->select ($this, array ( 'domain_id' => $domainId, 'mode' => $mode, 'parent_id' => $parentId ))); } // parents from database elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) { // parents from file $this->indexFoundRows ($database->select ($this, array ( 'mode' => $mode, 'parent_id' => $parentId )), $domainId); } // parents from file } // open if (isset ($this->indexByParent[$domainId][$mode][$parentId])) { // children exists foreach ($this->indexByParent[$domainId][$mode][$parentId] as $id) { // each child if ($this->rows[$domainId][$id]['name'] == $name) { // found $found = &$this->rows[$domainId][$id]; if ($found['access'] <= $access) return $found; $empty = array (); return $empty; } // found } // each child } // children exists $found = array (); return $found; } // function & public function children ($domainId, $mode, $parentId, $access=4, $max=0, $offset=0, $sort='index', $direction='asc') { // function children if (!isset ($this->chargedParents[$domainId][$mode][$parentId])) { // open if (isset ($this->chargedMode[$domainId][$mode])) return array (); if (is_int ($domainId) and $this->database) { // parents from database $this->chargedParents[$domainId][$mode][$parentId] = true; $this->indexFoundRows ($this->database->select ($this, array ( 'domain_id' => $domainId, 'mode' => $mode, 'parent_id' => $parentId ))); } // parents from database elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) { // parents from file $this->chargedParents[$domainId][$mode][$parentId] = true; $this->indexFoundRows ($database->select ($this, array ( 'mode' => $mode, 'parent_id' => $parentId )), $domainId); } // parents from database } // open if (isset ($this->indexByParent[$domainId][$mode][$parentId])) { // children exists $sorted = array (); $rows = $this->rows[$domainId]; foreach ($this->indexByParent[$domainId][$mode][$parentId] as $id) { // each child if ($rows[$id]['access'] <= $access) $sorted[$rows[$id][$sort]][] = $rows[$id]; } // each child if ($direction == 'desc') krsort ($sorted); else ksort ($sorted); if ($max == 0) $max = count ($this->indexByParent[$domainId][$mode][$parentId]); else $max += $offset; $list = array (); $i = - 1; foreach ($sorted as $doubled) { // each doubled foreach ($doubled as $item) { // each item $i++; if ($i >= $offset and $i < $max) $list[] = $item; elseif ($i > $max) break 2; } // each item } // each doubled return $list; } // children exists return array (); } // function children public function childrenNames ($domainId, $mode, $parentId, $access=4, $max=0, $offset=0, $sort='index', $direction='asc') { // function childrenNames $children = $this->children ($domainId, $mode, $parentId, $access, $max, $offset, $sort, $direction); $names = array (); foreach ($children as $child) { // each child $names[] = $child['name']; } // each child return $names; } // function childrenNames public function mode ($domainId, $mode) { // function mode if (!isset ($this->chargedMode[$domainId][$mode])) { // open if (is_int ($domainId) and is_object ($this->database)) { // mode from database $this->chargedMode[$domainId][$mode] = $this->indexFoundRows ($this->database->select ($this, array ( 'domain_id' => $domainId, 'mode' => $mode ))); } // mode from database elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) { // mode from file $this->chargedMode[$domainId][$mode] = $this->indexFoundRows ($database->select ($this, array ( 'mode' => $mode )), $domainId); } // mode from file else $this->chargedMode[$domainId][$mode] = array (); // index chargedParents if (!isset ($this->chargedParents[$domainId])) $this->chargedParents[$domainId] = array (); if (!isset ($this->chargedParents[$domainId][$mode])) $this->chargedParents[$domainId][$mode] = array (); foreach ($this->chargedMode[$domainId][$mode] as $row) { // each row if (!$row or !isset ($row['id']) or !isset ($row['parent_id'])) continue; if (!isset ($this->chargedParents[$domainId][$mode][$row['parent_id']]) or !is_array ($this->chargedParents[$domainId][$mode][$row['parent_id']])) $this->chargedParents[$domainId][$mode][$row['parent_id']] = array (); $this->chargedParents[$domainId][$mode][$row['parent_id']][$row['id']] = true; $this->indexByParent[$domainId][$mode][$row['parent_id']][$row['id']] = $row['id']; } // each row } // open return $this->chargedMode[$domainId][$mode]; } // function mode public function findMarker ($domainId, $marker, $mode=MODE_SECTION) { // function findMarker static $markers = array (); if (!isset ($markers[$domainId][$mode])) { // charge mode if (!isset ($markers[$domainId])) $markers[$domainId] = array (); if (!isset ($markers[$domainId][$mode])) $markers[$domainId][$mode] = array (); foreach ($this->mode ($domainId, $mode) as $data) { // each row if ($data['access'] > 30) continue; if (!isset ($markers[$domainId][$mode][$data['marker']])) $markers[$domainId][$mode][$data['marker']] = $data['id']; } // each row } // charge mode if (isset ($markers[$domainId][$mode][$marker])) return $markers[$domainId][$mode][$marker]; return false; } // function findMarker public function search ($where, $access=4, $max=0, $offset=0, $sort='created', $direction='desc') { // function search if ( (!isset ($where['domain_id']) or is_int ($where['domain_id'])) and is_object ($this->database)) { // search on database $rows = $this->indexFoundRows ($this->database->select ($this, $where)); } // search on database elseif (isset ($where['domain_id']) and is_string ($where['domain_id']) and $database = $this->getDatabase ($where['domain_id'])) { // search on file unset ($where['domain_id']); $rows = $this->indexFoundRows ($database->select ($this, $where), $where['domain_id']); } // search on file else $rows = array (); if ($rows) { // children exists $sorted = array (); foreach ($rows as $row) { // each child if ($row['access'] <= $access) $sorted[$row[$sort]][] = $row; } // each child if ($direction == 'desc') krsort ($sorted); else ksort ($sorted); if ($max == 0) $max = count ($rows); else $max += $offset; $list = array (); $i = - 1; foreach ($sorted as $doubled) { // each doubled foreach ($doubled as $item) { // each item $i++; if ($i >= $offset and $i < $max) $list[] = $item; elseif ($i > $max) break 2; } // each item } // each doubled return $list; } // children exists return array (); } // function search public function childrenReindex ($domainId, $mode, $parentId) { // function childrenReindex foreach ($this->children ($domainId, $mode, $parentId) as $index => $child) { // each child $this->rows[$domainId][$child['id']]['index'] = $index; } // each child } // function childrenReindex public function pathway ($domainId, $name) { // function pathway global $store; $pathway = array (); if (is_int ($name)) $data = $this->openById ($domainId, $name); else $data = $this->open ($domainId, $name); if (!$data) return false; $id = $data['id']; do { // loop levels if (isset ($this->rows[$domainId][$id])) $data = $this->rows[$domainId][$id]; else $data = $this->openById ($domainId, $id); if (!$data) return false; array_unshift ($pathway, $data['name']); $id = $data['parent_id']; if (!$id and $data['mode'] != MODE_SECTION and $data['marker']) { // find special section $id = $this->findMarker ($domainId, $data['marker']); if (!$id) return false; } // find special section } // loop levels while ($id); array_unshift ($pathway, $store->domain->getName ($domainId)); return $pathway; } // function pathway public function delete ($domainId, $id) { // function delete if (TRACKING_REMOVED_PAGES) { // do not remove page $data = &$this->openById ($domainId, $id); $data['access'] = 255; if (strlen ($data['name']) == 32) $data['name'] = substr ($data['name'], - 2); $data['name'] = ':' . $data['name']; return; } // do not remove page if (isset ($this->rows[$domainId][$id])) { // remove from index $data = $this->rows[$domainId][$id]; $this->deletedRows[$domainId][$id] = $id; $this->rows[$domainId][$id] = array (); unset ($this->originalRows[$domainId][$id]); unset ($this->indexByParent[$domainId][$data['mode']][$data['parent_id']][$id]); unset ($this->indexByName[$domainId][$data['name']][$id]); } // remove from index if (is_int ($domainId) and $this->database) { // delete from database $this->database->delete ($this, array ('id' => $id)); } // delete from database elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) { // delete from file $database->delete ($this, array ('id' => $id)); } // delete from file } // function delete public function export ($domainId, $fileName) { // function export $where = array ('domain_id' => $domainId); $select = array ('id', 'name'); $rows = $this->database->select ($this, $where, '', $select); $index = 0; $names = array (); foreach ($rows as $row) { // each row if ($row['name']) $names[$row['id']] = $row['name']; else { // create name $index++; $names[$row['id']] = '-untitled-' . $index; } // create name } // each row unset ($rows); $file = fopen ($fileName, 'w+b'); $header = true; $rows = $this->database->select ($this, $where); foreach ($rows as $row) { // each row $data = array (); foreach ($row as $key => $value) { // each field if (is_int ($key)) continue; switch ($key) { // switch key case 'id': case 'domain_id': break; case 'parent_id': case 'master_id': case 'owner_id': case 'place_id': if ($value === 0) $data[substr ($key, 0, - 3)] = '""'; else $data[substr ($key, 0, - 3)] = '"' . $names[$value] . '"'; break; default: if (is_int ($value)) $data[$key] = strval ($value); elseif (is_string ($value)) $data[$key] = '"' . $value . '"'; elseif (is_array ($value) and $value) $data[$key] = '"' . $this->database->stringToDatabase (serialize ($value)) . '"'; else $data[$key] = '""'; } // switch key } // each field if ($header) { // create header $buffer = implode ("\t", array_keys ($data)) . CRLF; fwrite ($file, $buffer); } // create header $buffer = implode ("\t", $data) . CRLF; fwrite ($file, $buffer); $header = false; } // each row fclose ($file); } // function export public function import ($domainId, $fileName) { // function import $string = file_get_contents ($fileName); $rows = array (); $names = array (); $header = true; foreach (explode (CRLF, $string) as $line) { // each row if ($header) { // header $headers = explode ("\t", $line); $header = false; continue; } // header foreach (explode ("\t", $line) as $index => $field) { // each field $key = $headers[$index]; switch ($key) { // switch column name case 'parent': case 'master': case 'owner': case 'place': break; } // switch column name } // each field } // each row } // function import public function specialSelect ($domainId, $where, $limit='', $returnRows=false) { // function specialSelect if ( (!isset ($where['domain_id']) or is_int ($where['domain_id'])) and is_object ($this->database)) return $this->database->select ($this, $where, $limit, $returnRows); if (isset ($where['domain_id']) and is_string ($where['domain_id']) and $database = $this->getDatabase ($where['domain_id'])) { // search on file unset ($where['domain_id']); return $database->select ($this, $where, $limit, $returnRows); } // search on file return array (); } // function specialSelect public function close () { // function close foreach ($this->originalRows as $domainId => $domainRows) { // each domain foreach ($domainRows as $id => $originalRow) { // each row if ($this->rows[$domainId][$id] != $originalRow) { // data changed if (is_int ($domainId)) $this->database->update ($this, $this->rows[$domainId][$id], $originalRow); elseif (is_string ($domainId) and $database = $this->getDatabase ($domainId)) $database->update ($this, $this->rows[$domainId][$id], $originalRow); } // data changed } // each row } // each domain $this->indexByName = array (); $this->indexByParent = array (); $this->chargedParents = array (); $this->rows = array (); $this->originalRows = array (); $this->deletedRows = array (); $this->notFound = array (); } // function close } // class eclStore_domainContent //!eof:engine/eclStore/eclStore_domainContent.php; //!file:engine/eclStore/eclStore_domainFile.php; class eclStore_domainFile { // class eclStore_domainFile public function unlink ($domainId, $name) { // function unlink global $store; $domainName = $store->domain->getName ($domainId); if (!is_string ($name) or !strlen ($name)) return; if (is_file (FOLDER_DOMAINS . $domainName . '/' . $name)) unlink (FOLDER_DOMAINS . $domainName . '/' . $name); } // function unlink public function deletePrefixedFiles ($domainId, $prefix, $mode=false) { // function deletePrefixedFiles global $store; $domainName = $store->domain->getName ($domainId); $prefix .= CHR_FNS; $prefixLength = strlen ($prefix); $dir = scandir (FOLDER_DOMAINS . $domainName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) { // valid file if ($mode === false) unlink (FOLDER_DOMAINS . $domainName . '/' . $fileName); else { // select file type $type = substr ($fileName, - 4); switch ($type) { // switch file type case '.jpg': case '.gif': case '.png': if ($mode == MODE_IMG) unlink (FOLDER_DOMAINS . $domainName . '/' . $fileName); break; default: if ($mode == MODE_FILE) unlink (FOLDER_DOMAINS . $domainName . '/' . $fileName); } // switch file type } // select file type } // valid file } // each file } // function deletePrefixedFiles public function clonePrefixedFiles ($domainId, $prefix, $newPrefix) { // function clonePrefixedFiles global $store; $domainName = $store->domain->getName ($domainId); $prefix .= CHR_FNS; $newPrefix .= CHR_FNS; $prefixLength = strlen ($prefix); $dir = scandir (FOLDER_DOMAINS . $domainName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) { // valid file $newFileName = $newPrefix . substr ($fileName, $prefixLength); copy (FOLDER_DOMAINS . $domainName . '/' . $fileName, FOLDER_DOMAINS . $domainName . '/' . $newFileName); } // valid file } // each file } // function clonePrefixedFiles public function renamePrefixedFiles ($domainId, $prefix, $newPrefix) { // function renamePrefixedFiles global $store; $domainName = $store->domain->getName ($domainId); $newPrefix .= CHR_FNS; $prefix .= CHR_FNS; $prefixLength = strlen ($prefix); $dir = scandir (FOLDER_DOMAINS . $domainName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) { // valid file $oldFileName = FOLDER_DOMAINS . $domainName . '/' . $fileName; $newFileName = FOLDER_DOMAINS . $domainName . '/' . $newPrefix . substr ($fileName, $prefixLength); rename ($oldFileName, $newFileName); } // valid file } // each file } // function renamePrefixedFiles public function close () { // function close } // function close } // class eclStore_domainFile //!eof:engine/eclStore/eclStore_domainFile.php; //!file:engine/eclStore/eclStore_domainGroup.php; class eclStore_domainGroup { // class eclStore_domainGroup public $name = 'domain_group'; public $fields = array ( 'domain_id' => 'mediumint', 'group_id' => 'mediumint', 'user_id' => 'mediumint', 'status' => 'tinyint' ); // Index public $index = array ( 'group_find_user' => array ('user_id'), 'domain_find_group' => array ('domain_id', 'group_id') ); private $database = false; private $groups = array (); public function __construct () { // function __construct global $io; if ($io->database->tableEnabled ($this)) $this->database = $io->database; } // function __construct public function getStatus ($domainId, $groupId, $userId) { // function getStatus $this->open ($domainId, $groupId); if (isset ($this->groups[$domainId][$groupId][0][$userId])) return $this->groups[$domainId][$groupId][0][$userId]; return 0; } // function getStatus public function &open ($domainId, $groupId) { // function & if (isset ($this->groups[$domainId][$groupId][0])) return $this->groups[$domainId][$groupId][0]; if (is_int ($domainId) and $this->database) { // from database $this->groups[$domainId][$groupId][0] = array (); $group = &$this->groups[$domainId][$groupId][0]; foreach ($this->database->select ($this, array ('domain_id' => $domainId, 'group_id' => $groupId)) as $row) { // each row $group[$row['user_id']] = $row['status']; } // each row $this->groups[$domainId][$groupId][1] = $this->groups[$domainId][$groupId][0]; } // from database $return = &$this->groups[$domainId][$groupId][0]; return $return; } // function & public function getDomainUsers ($domainId) { // function getDomainUsers $return = array(); if (is_int ($domainId) and $this->database) { // from database foreach ($this->database->select ($this, array ('domain_id' => $domainId)) as $row) { // each row $return[$row['user_id']] = $row['status']; } // each row } // from database return $return; } // function getDomainUsers public function getDomainGroups ($domainId) { // function getDomainGroups $groups = array(); if (is_int ($domainId) and $this->database) { // from database foreach ($this->database->select ($this, array ('domain_id' => $domainId)) as $row) { // each row $groups[$row['group_id']] = $row['group_id']; } // each row } // from database return $groups; } // function getDomainGroups public function getUserLinks ($userId) { // function getUserLinks if ($this->database) return $this->database->select ($this, array ('user_id' => $userId)); return array (); } // function getUserLinks public function getDomainSubscribedUsers ($domainId) { // function getDomainSubscribedUsers $users = array (); if (is_int ($domainId) and $this->database) { // from database foreach ($this->database->select ($this, array ('domain_id' => $domainId)) as $row) { // each row if ($row['status'] == 5) $users[$row['user_id']] = $row['group_id']; } // each row } // from database return $users; } // function getDomainSubscribedUsers public function getUserSubscription ($document) { // function getUserSubscription global $store; if (!$this->database) return false; if (!$document->domain->domainId) return false; if (!$document->user->userId) return false; $where = array ( 'domain_id' => $document->domain->domainId, 'user_id' => $document->user->userId, 'status' => 5 ); $rows = $this->database->select ($this, $where); if (!$rows) return false; $subscriptionId = $rows[0]['group_id']; $data = $store->domainContent->openById ($document->domain->domainId, $subscriptionId); if (!$data) return false; if ($data['marker'] >= 245) return false; $subscriptions = $document->domain->child ('-subscriptions'); if (!$subscriptions) return false; return $subscriptions->child ($data['name']); } // function getUserSubscription public function close () { // function close if (!$this->database) return; foreach ($this->groups as $domainId => $groups) { // each domain foreach ($groups as $groupId => $group) { // each group if (!$group[0] and $group[1]) $this->database->delete ($this, array ('domain_id' => $domainId, 'group_id' => $groupId)); elseif ($group[0] != $group[1]) { // modify group foreach ($group[0] as $userId => $status) { // each user if (!isset ($group[1][$userId])) { // insert $data = array ('domain_id' => $domainId, 'group_id' => $groupId, 'user_id' => $userId, 'status' => $status); $this->database->insert ($this, $data); } // insert elseif ($group[1][$userId] != $status) { // change status $originalData = $this->database->select ($this, array ('domain_id' => $domainId, 'group_id' => $groupId, 'user_id' => $userId)); $data = $originalData; $data['status'] = $status; $this->database->update ($this, $data, $originalData); } // change status else unset ($group[1][$userId]); } // each user foreach ($group[1] as $userId => $status) { // delete remain users in group $this->database->delete ($this, array ('domain_id' => $domainId, 'group_id' => $groupId, 'user_id' => $userId)); } // delete remain users in group } // modify group } // each group } // each domain $this->groups = array (); } // function close } // class eclStore_domainGroup //!eof:engine/eclStore/eclStore_domainGroup.php; //!file:engine/eclStore/eclStore_help.php; class eclStore_help { // class eclStore_help public $name = 'unknown'; public $controls = array (); public function read ($controlName) { // function read global $io, $store; if (isset ($this->controls[$controlName])) return $this->controls[$controlName]; $parts = explode ('_', $controlName); $name = array_pop ($parts); $file = FOLDER_LIBRARY . implode ('/', $parts) . '/_help/' . $name . '.ecl.php'; $path = implode ('_', $parts); $prefix = $path . '_'; $mode = 'h'; if (SYSTEM_PACKED_SHARED_FIRST) { // packed first $control = $io->cachedControls->read ($mode, $path, $name); if (!$control) $control = $io->file->read ($file); } // packed first else { // external first $control = $io->file->read ($file); if (!$control) $control = $io->cachedControls->read ($mode, $path, $name); } // external first if (isset ($control['children'])) { // children exists foreach ($control['children'] as &$child) { // each child if ($child[0] == '~') $child = $prefix . substr ($child, 1); } // each child } // children exists if (isset ($control['flags'])) { // flags exists foreach ($control['flags'] as &$value) { // each flag if (is_string ($value) and strlen ($value) and $value[0] == '~') $value = $prefix . substr ($value, 1); } // each flags } // flags exists $this->controls[$controlName] = $control; return $control; } // function read public function close () { // function close } // function close } // class eclStore_help //!eof:engine/eclStore/eclStore_help.php; //!file:engine/eclStore/eclStore_ipBotList.php; class eclStore_ipBotList { // class eclStore_ipBotList public $name = 'ip_bot_list'; // Describe fields structure public $fields = array ( // Indexing 'id' => 'primary_key', 'ip' => 'name', 'created' => 'time', 'status' => 'tinyint' ); private $database = false; public function __construct () { // function __construct global $io; $this->database = $io->sqlite->connect (FOLDER_DATABASE . '.ipTracking.db'); $this->database->tableEnabled ($this); } // function __construct public function close () { // function close } // function close } // class eclStore_ipBotList //!eof:engine/eclStore/eclStore_ipBotList.php; //!file:engine/eclStore/eclStore_tracking.php; class eclStore_tracking { // class eclStore_tracking public $name = 'tracking'; // Describe fields structure public $fields = array ( // Indexing 'id' => 'primary_key', // Class trackers 'ip' => 'name', 'domain_id' => 'mediumint', 'user_id' => 'mediumint', 'page_id' => 'mediumint', 'request_time' => 'time', 'access' => 'tinyint', // Registered contents 'local' => 'array' ); private $database = false; public function __construct () { // function __construct global $io; $this->database = $io->sqlite->connect (FOLDER_DATABASE . '.tracking.db'); $this->database->tableEnabled ($this); } // function __construct public function insert ($data) { // function insert $this->database->insert ($this, $data); } // function insert public function register ($document) { // function register // login if (isset ($document->actions['login'])) { // login if (!isset ($document->session['login'])) $document->session['login'] = 4; else { // login retry consecutive $document->session['login'] += 4; if ($document->session['login'] > 12) { // time penalty // set_time_limit ($document->session['login'] + SYSTEM_TIME_LIMIT); // sleep ($document->session['login']); } // time penalty } // login retry consecutive } // login if (isset ($document->session['login']) and $document->session['login'] > 1) $document->session['login']--; if (isset ($document->data['user_is_admin'])) $status = 5; elseif (isset ($document->data['user_is_member'])) $status = 4; elseif (isset ($document->data['user_is_subscribed'])) $status = 3; elseif (isset ($document->data['user_is_connected'])) $status = 2; else { // not connected if (!isset ($document->session['requests'])) { // first load $status = 0; $document->session['requests'] = 1; } // first load else { // next visit $document->session['requests']++; $status = 1; } // next visit } // not connected if ($status == 0) { // first loading if (isset ($_SERVER['HTTP_REFERER'])) $from = $_SERVER['HTTP_REFERER']; else $from = ''; $local = array ( 'request' => $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 'from' => $from, 'user_agent' => $_SERVER['HTTP_USER_AGENT'] ); if (TRACKING_FULL_BACKTRACE and $document->received and !isset ($document->actions['login'])) $local['received'] = $document->received; } // first loading else { // consecutive loading $local = array ( 'request' => $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], ); if (TRACKING_FULL_BACKTRACE and $document->received and !isset ($document->actions['login'])) $local['received'] = $document->received; } // consecutive loading $data = array ( 'ip' => $_SERVER['REMOTE_ADDR'], 'domain_id' => $document->domain->domainId, 'user_id' => $document->user->userId, 'page_id' => $document->application->id, 'access' => $status, 'request_time' => $_SERVER['REQUEST_TIME'], 'local' => $local ); $this->database->insert ($this, $data); } // function register public function track () { // function track } // function track public function close () { // function close } // function close } // class eclStore_tracking //!eof:engine/eclStore/eclStore_tracking.php; //!file:engine/eclStore/eclStore_user.php; class eclStore_user { // class eclStore_user public $name = 'user'; // Describe fields structure public $fields = array ( // Indexing 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'password' => 'password', 'status' => 'tinyint' ); public $insertedData = array (); private $rows = array (); private $originalRows = array (); private $indexByName = array (); private $database; public function __construct () { // function __construct global $io; if ($io->database->tableEnabled ($this)) $this->database = $io->database; } // function __construct public function insert ($data) { // function insert global $io; if (!is_dir (FOLDER_PROFILES)) mkdir (FOLDER_PROFILES); if (!is_dir (FOLDER_PROFILES . $data['name'])) mkdir (FOLDER_PROFILES . $data['name']); if ($this->database) { // insert into database $id = $this->database->insert ($this, $data); $data['id'] = $id; $this->rows[$id] = $data; $this->originalRows[$id] = $data; $this->indexByName[$data['name']] = $id; return $id; } // insert into database return 0; } // function insert public function &open ($name) { // function & global $io; if (isset ($this->indexByName[$name])) { // row found $id = $this->indexByName[$name]; $return = &$this->rows[$id]; return $return; } // row found if ($this->database) { // open from database $rows = $this->database->select ($this, array ('name' => $name)); if ($rows) { // row found $data = $rows[0]; $id = $data['id']; $this->rows[$id] = $data; $this->originalRows[$id] = $data; $this->indexByName[$name] = $id; $return = &$this->rows[$id]; return $return; } // row found } // open from database $return = array (); return $return; } // function & public function &openById ($id) { // function & if (isset ($this->rows[$id])) { // row found $row = &$this->rows[$id]; return $row; } // row found if (is_int ($id) and $this->database) { // open from database $rows = $this->database->select ($this, array ('id' => $id)); if ($rows) { // row found $data = $rows[0]; $this->rows[$id] = $data; $this->originalRows[$id] = $data; $this->indexByName[$data['name']] = $id; $return = &$this->rows[$id]; return $return; } // row found } // open from database $row = array (); return $row; } // function & public function getId ($name) { // function getId if (!isset ($this->indexByName[$name])) $this->open ($name); if (isset ($this->indexByName[$name])) return $this->indexByName[$name]; else return false; } // function getId public function getName ($id) { // function getName if (!isset ($this->rows[$id])) $this->openById ($id); if (isset ($this->rows[$id]['name'])) return $this->rows[$id]['name']; else return false; } // function getName public function getStatus ($name) { // function getStatus if (!isset ($this->indexByName[$name])) $this->open ($name); if (!isset ($this->indexByName[$name])) return 0; $id = $this->indexByName[$name]; $row = &$this->rows[$id]; if (!isset ($row['status'])) return 0; return $row['status']; } // function getStatus public function childrenNames () { // function childrenNames $names = array (); if (!is_dir (FOLDER_PROFILES)) return array (); foreach (scandir (FOLDER_PROFILES) as $folder) { // each folder if ($folder[0] == '.') continue; if (!is_dir (FOLDER_PROFILES . $folder)) continue; if ($this->getStatus ($folder)) $names[] = $folder; } // each folder return $names; } // function childrenNames public function delete ($id) { // function delete if (isset ($this->originalRows[$id])) { // user in database $this->database->delete ($this, array ('id' => $id)); $this->rows[$id] = array (); unset ($this->originalRows[$id]); } // user in database } // function delete public function close () { // function close foreach ($this->originalRows as $id => $originalRow) { // each row if ($this->rows[$id] != $originalRow) $this->database->update ($this, $this->rows[$id], $originalRow); } // each row } // function close } // class eclStore_user //!eof:engine/eclStore/eclStore_user.php; //!file:engine/eclStore/eclStore_userContent.php; class eclStore_userContent { // class eclStore_userContent public $name = 'user_content'; public $fields = array ( // Indexing 'user_id' => 'mediumint', 'mode' => 'tinyint', 'parent_id' => 'mediumint', 'master_id' => 'mediumint', 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'marker' => 'tinyint', 'access' => 'tinyint', // Dates 'created' => 'time', 'updated' => 'time', 'event_start' => 'time', 'event_end' => 'time', 'coments_last_update' => 'time', // More sort options 'index' => 'mediumint', 'hits' => 'int', 'value' => 'mediumint', 'spotlight' => 'tinyint', // Contents 'text' => 'array', 'local' => 'array', 'flags' => 'array', 'extras' => 'array', 'links' => 'array', 'keywords' => 'keywords' ); // Index public $index = array ( 'user_find_children' => array ('user_id', 'mode', 'parent_id'), 'user_find_name' => array ('user_id', 'name') ); private $indexByName = array (); private $indexByParent = array (); private $chargedParents = array (); private $chargedMode = array (); private $rows = array (); private $originalRows = array (); private $deletedRows = array (); private $notFound = array (); private $database = false; private $openedDatabases = array (); public function __construct () { // function __construct global $io; if ($io->database->tableEnabled ($this)) $this->database = $io->database; } // function __construct public function getDatabase ($userName) { // function getDatabase global $io; if (!isset ($this->openedDatabases[$userName])) { // open database $this->openedDatabases[$userName] = $io->sqlite->connect (FOLDER_PROFILES . $userName . '/.user.db'); } // open database if ($this->openedDatabases[$userName]->tableEnabled ($this)) return $this->openedDatabases[$userName]; return false; } // function getDatabase public function indexFoundRows ($rows, $userName=0) { // function indexFoundRows $found = array (); foreach ($rows as $data) { // each row if (!$data['user_id']) $data['user_id'] = $userName; $userId = $data['user_id']; $id = $data['id']; if (!isset ($this->deletedRows[$userId][$id])) { // row not deleted if (!isset ($this->rows[$userId][$id])) { // row not indexed $this->rows[$userId][$id] = $data; $this->originalRows[$userId][$id] = $data; $this->indexByName[$userId][$data['name']] = $id; $this->indexByParent[$userId][$data['mode']][$data['parent_id']][$id] = $id; $found[] = $data; } // row not indexed else $found[] = $this->rows[$userId][$id]; } // row not deleted } // each row return $found; } // function indexFoundRows public function insert ($userId, &$data) { // function insert global $io; $data['user_id'] = $userId; if (!isset ($data['parent_id'])) $data['parent_id'] = 0; $data['index'] = count ($this->children ($userId, $data['mode'], $data['parent_id'])); if (!isset ($data['name']) or !strlen ($data['name'])) $data['name'] = 't' . strval (TIME); $where = array ('user_id' => $userId, 'name' => $data['name']); /* * if ($this->database->select ($this, $where, ' LIMIT 1', array ('id'))) * { // prevent duplicated name * $test = 0; * do * { // loop names * $test ++; * $name = $data['name'] . '-' . str_pad (strval ($test), 3, '0', STR_PAD_LEFT); * $where = array ('user_id' => $userId, 'name' => $name); * } // loop names * while ($this->database->select ($this, $where, ' LIMIT 1', array ('id'))); * $data['name'] = $name; * } // prevent duplicated names */ if (is_int ($userId) and $this->database) { // insert into database $id = $this->database->insert ($this, $data); $data['id'] = $id; $this->rows[$userId][$id] = $data; $this->originalRows[$userId][$id] = $data; $this->indexByName[$userId][$data['name']] = $id; $this->indexByParent[$userId][$data['mode']][$data['parent_id']][$id] = $id; return $id; } // insert into database elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) { // from sqlite $id = $database->insert ($this, $data); $data['user_id'] = $userId; $data['id'] = $id; $this->rows[$userId][$id] = $data; $this->originalRows[$userId][$id] = $data; $this->indexByName[$userId][$data['name']] = $id; $this->indexByParent[$userId][$data['mode']][$data['parent_id']][$id] = $id; return $id; } // from sqlite } // function insert public function &open ($userId, $name, $access=4) { // function & if (!isset ($this->indexByName[$userId][$name])) { // open if (isset ($this->notFound[$userId][$name])) { // registered not found $found = array (); return $found; } // registered not found if (is_int ($userId) and $this->database) $this->indexFoundRows ($this->database->select ($this, array ('user_id' => $userId, 'name' => $name), ' LIMIT 1')); elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) $this->indexFoundRows ($database->select ($this, array ('name' => $name), ' LIMIT 1'), $userId); } // open $found = array (); if (isset ($this->indexByName[$userId][$name])) { // row found $id = $this->indexByName[$userId][$name]; $found = &$this->rows[$userId][$id]; if ($found['access'] <= $access) return $found; } // row found else $this->notFound[$userId][$name] = true; $empty = array (); return $empty; } // function & public function &openById ($userId, $id, $access=4) { // function & if (!isset ($this->rows[$userId][$id])) { // open if (is_int ($userId) and $this->database) $this->indexFoundRows ($this->database->select ($this, array ('id' => $id))); elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) $this->indexFoundRows ($database->select ($this, array ('id' => $id)), $userId); } // open $found = array (); if (isset ($this->rows[$userId][$id])) { // found $found = &$this->rows[$userId][$id]; if ($found['access'] <= $access) return $found; } // found $empty = array (); return $empty; } // function & public function &openChild ($userId, $mode, $parentId, $name, $access=4) { // function & if (!isset ($this->chargedParents[$userId][$mode][$parentId])) { // open if (is_int ($userId) and $this->database) { // parents from database $this->chargedParents[$userId][$mode][$parentId] = true; $this->indexFoundRows ($this->database->select ($this, array ( 'user_id' => $userId, 'mode' => $mode, 'parent_id' => $parentId ))); } // parents from database elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) { // parents from file $this->indexFoundRows ($database->select ($this, array ( 'mode' => $mode, 'parent_id' => $parentId )), $userId); } // parents from file } // open if (isset ($this->indexByParent[$userId][$mode][$parentId])) { // children exists foreach ($this->indexByParent[$userId][$mode][$parentId] as $id) { // each child if ($this->rows[$userId][$id]['name'] == $name) { // found $found = &$this->rows[$userId][$id]; if ($found['access'] <= $access) return $found; $empty = array (); return $empty; } // found } // each child } // children exists $found = array (); return $found; } // function & public function children ($userId, $mode, $parentId, $access=4, $max=0, $offset=0, $sort='index', $direction='asc') { // function children if (!isset ($this->chargedParents[$userId][$mode][$parentId])) { // open if (isset ($this->chargedMode[$userId][$mode])) return array (); if (is_int ($userId) and $this->database) { // parents from database $this->chargedParents[$userId][$mode][$parentId] = true; $this->indexFoundRows ($this->database->select ($this, array ( 'user_id' => $userId, 'mode' => $mode, 'parent_id' => $parentId ))); } // parents from database elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) { // parents from file $this->chargedParents[$userId][$mode][$parentId] = true; $this->indexFoundRows ($database->select ($this, array ( 'mode' => $mode, 'parent_id' => $parentId )), $userId); } // parents from database } // open if (isset ($this->indexByParent[$userId][$mode][$parentId])) { // children exists $sorted = array (); $rows = $this->rows[$userId]; foreach ($this->indexByParent[$userId][$mode][$parentId] as $id) { // each child if ($rows[$id]['access'] <= $access) $sorted[$rows[$id][$sort]][] = $rows[$id]; } // each child if ($direction == 'desc') krsort ($sorted); else ksort ($sorted); if ($max == 0) $max = count ($this->indexByParent[$userId][$mode][$parentId]); else $max += $offset; $list = array (); $i = - 1; foreach ($sorted as $doubled) { // each doubled foreach ($doubled as $item) { // each item $i++; if ($i >= $offset and $i < $max) $list[] = $item; elseif ($i > $max) break 2; } // each item } // each doubled return $list; } // children exists return array (); } // function children public function childrenNames ($userId, $mode, $parentId, $access=4, $max=0, $offset=0, $sort='index', $direction='asc') { // function childrenNames $children = $this->children ($userId, $mode, $parentId, $access, $max, $offset, $sort, $direction); $names = array (); foreach ($children as $child) { // each child $names[] = $child['name']; } // each child return $names; } // function childrenNames public function mode ($userId, $mode) { // function mode if (!isset ($this->chargedMode[$userId][$mode])) { // open if (is_int ($userId) and is_object ($this->database)) { // mode from database $this->chargedMode[$userId][$mode] = $this->indexFoundRows ($this->database->select ($this, array ( 'user_id' => $userId, 'mode' => $mode ))); } // mode from database elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) { // mode from file $this->chargedMode[$userId][$mode] = $this->indexFoundRows ($database->select ($this, array ( 'mode' => $mode )), $userId); } // mode from file else $this->chargedMode[$userId][$mode] = array (); // index chargedParents if (!isset ($this->chargedParents[$userId])) $this->chargedParents[$userId] = array (); if (!isset ($this->chargedParents[$userId][$mode])) $this->chargedParents[$userId][$mode] = array (); foreach ($this->chargedMode[$userId][$mode] as $row) { // each row if (!$row or !isset ($row['id']) or !isset ($row['parent_id'])) continue; if (!isset ($this->chargedParents[$userId][$mode][$row['parent_id']]) or !is_array ($this->chargedParents[$userId][$mode][$row['parent_id']])) $this->chargedParents[$userId][$mode][$row['parent_id']] = array (); $this->chargedParents[$userId][$mode][$row['parent_id']][$row['id']] = true; $this->indexByParent[$userId][$mode][$row['parent_id']][$row['id']] = $row['id']; } // each row } // open return $this->chargedMode[$userId][$mode]; } // function mode public function findMarker ($userId, $marker, $mode=MODE_SECTION) { // function findMarker static $markers = array (); if (!isset ($markers[$userId][$mode])) { // charge mode if (!isset ($markers[$userId])) $markers[$userId] = array (); if (!isset ($markers[$userId][$mode])) $markers[$userId][$mode] = array (); foreach ($this->mode ($userId, $mode) as $data) { // each row if (!isset ($markers[$userId][$mode][$data['marker']])) $markers[$userId][$mode][$data['marker']] = $data['id']; } // each row } // charge mode if (isset ($markers[$userId][$mode][$marker])) return $markers[$userId][$mode][$marker]; return false; } // function findMarker public function search ($where, $access=4, $max=0, $offset=0, $sort='created', $direction='desc') { // function search if ( (!isset ($where['user_id']) or is_int ($where['user_id'])) and is_object ($this->database)) { // search on database $rows = $this->indexFoundRows ($this->database->select ($this, $where)); } // search on database elseif (isset ($where['user_id']) and is_string ($where['user_id']) and $database = $this->getDatabase ($where['user_id'])) { // search on file unset ($where['user_id']); $rows = $this->indexFoundRows ($database->select ($this, $where), $where['user_id']); } // search on file else $rows = array (); if ($rows) { // children exists $sorted = array (); foreach ($rows as $row) { // each child if ($row['access'] <= $access) $sorted[$row[$sort]][] = $row; } // each child if ($direction == 'desc') krsort ($sorted); else ksort ($sorted); if ($max == 0) $max = count ($rows); else $max += $offset; $list = array (); $i = - 1; foreach ($sorted as $doubled) { // each doubled foreach ($doubled as $item) { // each item $i++; if ($i >= $offset and $i < $max) $list[] = $item; elseif ($i > $max) break 2; } // each item } // each doubled return $list; } // children exists return array (); } // function search public function childrenReindex ($userId, $mode, $parentId) { // function childrenReindex foreach ($this->children ($userId, $mode, $parentId) as $index => $child) { // each child $this->rows[$userId][$child['id']]['index'] = $index; } // each child } // function childrenReindex public function pathway ($userId, $name) { // function pathway global $store; $pathway = array (); $data = $this->open ($userId, $name); if (!$data) return false; $id = $data['id']; do { // loop levels if (isset ($this->rows[$userId][$id])) $data = $this->rows[$userId][$id]; else $data = $this->openById ($userId, $id); if (!$data) return false; array_unshift ($pathway, $data['name']); $id = $data['parent_id']; if (!$id and $data['mode'] != MODE_SECTION and $data['marker']) { // find special section $id = $this->findMarker ($userId, $data['marker']); if (!$id) return false; } // find special section } // loop levels while ($id); array_unshift ($pathway, $store->user->getName ($userId)); return $pathway; } // function pathway public function delete ($userId, $id) { // function delete if (isset ($this->rows[$userId][$id])) { // remove from index $data = $this->rows[$userId][$id]; $this->deletedRows[$userId][$id] = $id; $this->rows[$userId][$id] = array (); unset ($this->originalRows[$userId][$id]); unset ($this->indexByParent[$userId][$data['mode']][$data['parent_id']][$id]); unset ($this->indexByName[$userId][$data['name']][$id]); } // remove from index if (is_int ($userId) and $this->database) { // delete from database $this->database->delete ($this, array ('id' => $id)); } // delete from database elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) { // delete from file $database->delete ($this, array ('id' => $id)); } // delete from file } // function delete public function export ($userId, $fileName) { // function export $where = array ('user_id' => $userId); $select = array ('id', 'name'); $rows = $this->database->select ($this, $where, '', $select); $index = 0; $names = array (); foreach ($rows as $row) { // each row if ($row['name']) $names[$row['id']] = $row['name']; else { // create name $index++; $names[$row['id']] = '-untitled-' . $index; } // create name } // each row unset ($rows); $file = fopen ($fileName, 'w+b'); $header = true; $rows = $this->database->select ($this, $where); foreach ($rows as $row) { // each row $data = array (); foreach ($row as $key => $value) { // each field if (is_int ($key)) continue; switch ($key) { // switch key case 'id': case 'user_id': break; case 'parent_id': case 'master_id': case 'owner_id': case 'place_id': if ($value === 0) $data[substr ($key, 0, - 3)] = '""'; else $data[substr ($key, 0, - 3)] = '"' . $names[$value] . '"'; break; default: if (is_int ($value)) $data[$key] = strval ($value); elseif (is_string ($value)) $data[$key] = '"' . $value . '"'; elseif (is_array ($value) and $value) $data[$key] = '"' . $this->database->stringToDatabase (serialize ($value)) . '"'; else $data[$key] = '""'; } // switch key } // each field if ($header) { // create header $buffer = implode ("\t", array_keys ($data)) . CRLF; fwrite ($file, $buffer); } // create header $buffer = implode ("\t", $data) . CRLF; fwrite ($file, $buffer); $header = false; } // each row fclose ($file); } // function export public function import ($userId, $fileName) { // function import $string = file_get_contents ($fileName); $rows = array (); $names = array (); $header = true; foreach (explode (CRLF, $string) as $line) { // each row if ($header) { // header $headers = explode ("\t", $line); $header = false; continue; } // header foreach (explode ("\t", $line) as $index => $field) { // each field $key = $headers[$index]; switch ($key) { // switch column name case 'parent': case 'master': case 'owner': case 'place': break; } // switch column name } // each field } // each row } // function import public function close () { // function close foreach ($this->originalRows as $userId => $userRows) { // each user foreach ($userRows as $id => $originalRow) { // each row if ($this->rows[$userId][$id] != $originalRow) { // data changed if (is_int ($userId)) $this->database->update ($this, $this->rows[$userId][$id], $originalRow); elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) $database->update ($this, $this->rows[$userId][$id], $originalRow); } // data changed } // each row } // each user $this->indexByName = array (); $this->indexByParent = array (); $this->chargedParents = array (); $this->rows = array (); $this->originalRows = array (); $this->deletedRows = array (); $this->notFound = array (); } // function close } // class eclStore_userContent //!eof:engine/eclStore/eclStore_userContent.php; //!file:engine/eclStore/eclStore_userFriend.php; class eclStore_userFriend { // class eclStore_userFriend public $name = 'user_friend'; public $fields = array ( 'user_id' => 'mediumint', 'friend_id' => 'mediumint', 'created' => 'time', 'updated' => 'time', 'status' => 'tinyint' ); public $insertedData = array (); private $database = false; private $groups = array (); public function __construct () { // function __construct global $io; if ($io->database->tableEnabled ($this)) $this->database = $io->database; } // function __construct public function close () { // function close } // function close } // class eclStore_userFriend //!eof:engine/eclStore/eclStore_userFriend.php; //!file:engine/eclTag/eclTag_audio.php; class eclTag_audio { // class eclTag_audio static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('audio', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'audio:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_audio //!eof:engine/eclTag/eclTag_audio.php; //!file:engine/eclTag/eclTag_box.php; class eclTag_box { // class eclTag_box static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); // Vamos abrir o módulo $mod = $document->createModule ('box', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'box:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_box //!eof:engine/eclTag/eclTag_box.php; //!file:engine/eclTag/eclTag_code.php; class eclTag_code { // class eclTag_code static function render ($render, $arguments) { // function render $render->buffer .= $render->tags['inline_code_open']; } // function render } // class eclTag_code //!eof:engine/eclTag/eclTag_code.php; //!file:engine/eclTag/eclTag_cut.php; class eclTag_cut { // class eclTag_cut static function render ($render, $arguments) { // function render @list ($name, $once) = explode (' ', $arguments[0]); $render->cutLastId = $name; $render->cutLastPosition = strlen ($render->buffer); $once ? $render->cutOnceId = $once : $render->cutOnceId = false; } // function render } // class eclTag_cut //!eof:engine/eclTag/eclTag_cut.php; //!file:engine/eclTag/eclTag_details.php; class eclTag_details { // class eclTag_details static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; $details = $render->getVar ('mod.details'); if (!strlen ($details)) return; if (is_string ($details)) $details = explode (CRLF, $details); $buffer['html'] = ''; $buffer['parsed'] = array (); foreach ($details as $name) { // each detail $name = 'details/' . trim ($name); if (isset ($render->blocks[$name])) $data = $render->blocks[$name]; else $data = $store->control->read ($name); if (isset ($data['parsed'])) { // ready $buffer['parsed'] = array_merge ($buffer['parsed'], $data['parsed']); continue; } // ready if (!isset ($data['html'])) continue; $buffer['parsed'] = array_merge ($buffer['parsed'], $render->render_tags ($data['html'], true)); // $buffer['html'] .= $data['html']; } // each detail return $buffer; } // function render } // class eclTag_details //!eof:engine/eclTag/eclTag_details.php; //!file:engine/eclTag/eclTag_dinamic.php; class eclTag_dinamic { // class eclTag_dinamic static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('dinamic', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'dinamic:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_dinamic //!eof:engine/eclTag/eclTag_dinamic.php; //!file:engine/eclTag/eclTag_endcode.php; class eclTag_endcode { // class eclTag_endcode static function render ($render, $arguments) { // function render $render->buffer .= $render->tags['inline_code_close']; } // function render } // class eclTag_endcode //!eof:engine/eclTag/eclTag_endcode.php; //!file:engine/eclTag/eclTag_endcut.php; class eclTag_endcut { // class eclTag_endcut static function render ($render, $arguments) { // function render $pos = $render->cutLastPosition; $name = $render->cutLastId; $once = $render->cutOnceId; $render->cutLastPosition = false; $render->cutLastId = false; $render->cutOnceId = false; if ($pos === false) return; $cut = substr ($render->buffer, $pos); $render->buffer = substr ($render->buffer, 0, $pos); if (is_bool ($name) or $name == '') return; if ($once) { // cut once // Se já houvermos recortado este trecho if (isset ($render->cutOnce[$once])) return; $render->cutOnce[$once] = true; } // cut once if (isset ($render->cuts[$name])) $render->cuts[$name] .= $cut; else $render->cuts[$name] = $cut; } // function render } // class eclTag_endcut //!eof:engine/eclTag/eclTag_endcut.php; //!file:engine/eclTag/eclTag_endscript.php; class eclTag_endscript { // class eclTag_endscript static function render ($render) { // function render $pos = $render->cutLastPosition; $name = $render->cutLastId; $render->cutLastPosition = false; $render->cutLastId = false; if ($pos === false) return; $cut = substr ($render->buffer, $pos); $render->buffer = substr ($render->buffer, 0, $pos); if (is_bool ($name) or $name == '') return; if (isset ($render->cuts[$name])) $render->cuts[$name] .= $cut; else $render->cuts[$name] = $cut; } // function render } // class eclTag_endscript //!eof:engine/eclTag/eclTag_endscript.php; //!file:engine/eclTag/eclTag_endstyle.php; class eclTag_endstyle { // class eclTag_endstyle static function render ($render) { // function render $pos = $render->cutLastPosition; $name = $render->cutLastId; $render->cutLastPosition = false; $render->cutLastId = false; if ($pos === false) return; $cut = substr ($render->buffer, $pos); $render->buffer = substr ($render->buffer, 0, $pos); if (is_bool ($name) or $name == '') return; if (isset ($render->cuts[$name])) $render->cuts[$name] .= $cut; else $render->cuts[$name] = $cut; } // function render } // class eclTag_endstyle //!eof:engine/eclTag/eclTag_endstyle.php; //!file:engine/eclTag/eclTag_field.php; class eclTag_field { // class eclTag_field static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; $name = 'fields/table/' . $render->getVar ('type'); $data = $store->control->read ($name); if (!isset ($data['html'])) return; if (isset ($data['local'])) $data['local'] = array_replace ($render->data, $data['local']); else $data['local'] = $render->data; if ($render->data) $data['data'] = $render->data; return $data; } // function render } // class eclTag_field //!eof:engine/eclTag/eclTag_field.php; //!file:engine/eclTag/eclTag_file.php; class eclTag_file { // class eclTag_file static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('file', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'file:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_file //!eof:engine/eclTag/eclTag_file.php; //!file:engine/eclTag/eclTag_gender.php; class eclTag_gender { // class eclTag_gender static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; @list ($male, $female) = explode ('|', $arguments[0], 2); if (!isset ($render->document->user->data['flags']['gender'])) $render->buffer .= $male; elseif ($render->document->user->data['flags']['gender'] == 'female') $render->buffer .= $female; else $render->buffer .= $male; } // function render } // class eclTag_gender //!eof:engine/eclTag/eclTag_gender.php; //!file:engine/eclTag/eclTag_help.php; class eclTag_help { // class eclTag_help static $type = 'scope'; static function render ($render) { // function render global $store; if (!$render->getVar ('name') or !$render->getVar ('help') or !$render->getVar ('caption')) return; $local = array(); $data = array(); if ($render->getVar ('content')) { // from current control if ($render->getVar ('title')) $local['caption'] = $render->getVar ('title'); elseif ($render->getVar ('caption')) $local['caption'] = $render->getVar ('caption'); else return; $local['content'] = $render->getVar ('content'); $render->local['help_caption'] = $local['caption']; $control = array(); if ($render->getVar ('control_icon')) $local['control_icon'] = $render->getVar ('control_icon'); } // from current control elseif ($render->getVar ('control_help_msg')) { // from previous defined message $control = $store->control->read ($render->getVar ('control_help_msg')); if (!isset ($control['text']['caption'])) return; $data['caption'] = $control['text']['caption']; } // from previous message $local['name'] = $render->getVar ('name'); $local['return_id'] = $local['name']; $data['caption'] = $render->getVar ('caption'); $local['field_caption'] = $render->getVar ('caption'); $data['ref'] = $render->document->mod->humperstilshen->dialog ($control, $local); $block = $store->control->read ('blocks/help'); $block['local'] = $data; return $block; } // function render } // class eclTag_help //!eof:engine/eclTag/eclTag_help.php; //!file:engine/eclTag/eclTag_html.php; class eclTag_html { // class eclTag_html static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); // Vamos abrir o módulo $mod = $document->createModule ('html', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'html:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_html //!eof:engine/eclTag/eclTag_html.php; //!file:engine/eclTag/eclTag_http.php; class eclTag_http { // class eclTag_http static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $args = explode (' ', $arguments[0], 2); if (substr ($args[0], 0, 2) != '//') $args[0] = '//' . $args[0]; $buffer = ''; if (isset ($args[1]) and strlen ($args[1])) $buffer .= $args[1]; else $buffer .= substr ($args[0], 2); $buffer .= "" . CRLF; $render->buffer .= $buffer; } // function render } // class eclTag_http //!eof:engine/eclTag/eclTag_http.php; //!file:engine/eclTag/eclTag_https.php; class eclTag_https { // class eclTag_https static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $args = explode (' ', $arguments[0], 2); if (substr ($args[0], 0, 2) != '//') $args[0] = '//' . $args[0]; $buffer = ''; if (isset ($args[1]) and strlen ($args[1])) $buffer .= $args[1]; else $buffer .= substr ($args[0], 2); $buffer .= "" . CRLF; $render->buffer .= $buffer; } // function render } // class eclTag_https //!eof:engine/eclTag/eclTag_https.php; //!file:engine/eclTag/eclTag_img.php; class eclTag_img { // class eclTag_img static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('img', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'img:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_img //!eof:engine/eclTag/eclTag_img.php; //!file:engine/eclTag/eclTag_interactive.php; class eclTag_interactive { // class eclTag_interactive static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; $name = 'fields/interactive/' . $render->getVar ('type'); $data = $store->control->read ($name); if (!isset ($data['html'])) return; if (isset ($data['local'])) $data['local'] = array_replace ($render->data, $data['local']); else $data['local'] = $render->data; if ($render->data) $data['data'] = $render->data; return $data; } // function render } // class eclTag_interactive //!eof:engine/eclTag/eclTag_interactive.php; //!file:engine/eclTag/eclTag_key.php; class eclTag_key { // class eclTag_key static function render ($render, $arguments) { // function render global $store; if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $document = $render->document; $domain = $document->domain; $label = $key = $arguments[0]; if ($document->charset != 'ISO-8859-1') $key = mb_convert_encoding ($key, 'ISO-8859-1', $document->charset); $key = $render->toKeyword ($key); if (!strlen ($key)) return; if ($id = $store->domainContent->findMarker ($document->domain->domainId, 1)) $pathway = $store->domainContent->pathway ($document->domain->domainId, $id); else $pathway = array ($domain->name, '-glossary'); $pathway[] = $key; $ref = $document->ref ($pathway); $buffer = '' . $label . "" . CRLF; $render->buffer .= $buffer; } // function render } // class eclTag_key //!eof:engine/eclTag/eclTag_key.php; //!file:engine/eclTag/eclTag_lang.php; class eclTag_lang { // class eclTag_lang static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; // Vamos encontrar o nome do campo selecionado if (!isset ($arguments[0])) $field = $render->getVar ('caption'); elseif (is_string ($arguments[0])) { // from constant @list ($prefix, $sufix) = explode ('_', $arguments[0], 2); $name = 'labels/' . $prefix . '/' . $sufix; $data = array (); if (isset ($render->blocks[$name])) $data = $render->blocks[$name]; if (!isset ($data['text']['caption'])) $data = $store->control->read ($name); if (!isset ($data['text']['caption'])) return; $field = $data['text']['caption']; } // from constant elseif (is_array ($arguments[0])) $field = $arguments[0]; else return; if (!is_array ($field)) return; $text = $render->document->selectLanguage ($field); if ($text[3] == $render->document->lang) return; $data['lang'] = $text[3]; $data['html'] = ' lang="' . $text[3] . '"'; return $data; } // function render } // class eclTag_lang //!eof:engine/eclTag/eclTag_lang.php; //!file:engine/eclTag/eclTag_list.php; class eclTag_list { // class eclTag_list static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; // Se não existir uma lista if (!count ($render->children)) return; if (isset ($arguments[0]) and is_string ($arguments[0])) $name = 'lists/' . $arguments[0]; else $name = 'lists/menu_list_vertical'; // Procuramos o bloco if (isset ($render->blocks[$name])) $data = $render->blocks[$name]; else $data = $store->control->read ($name); if (isset ($data['local'])) { // merge list local variables if (isset ($render->mod['local'])) $render->mod['local'] = array_replace ($render->mod['local'], $data['local']); else $render->mod['local'] = $data['local']; } // merge list local variables // Vamos procurar a lista if ($render->index) { // subitem if (!isset ($render->children[$render->index - 1]->children)) return; if (!count ($render->children[$render->index - 1]->children)) return; $data['children'] = $render->children[$render->index - 1]->children; $data['index'] = 1; $data['local'] = $render->children[$render->index - 1]->children[0]->data; if (count ($data['children']) == 1) $data['local']['last'] = 1; $data['local']['index'] = 1; } // subitem else { // list from module level 0 $data['data'] = $render->children[0]->data; $render->index = 1; if (count ($render->children) == 1) $data['local']['last'] = 1; $data['local']['index'] = 1; } // list from module level 0 $data['local']['first'] = 1; return $data; } // function render } // class eclTag_list //!eof:engine/eclTag/eclTag_list.php; //!file:engine/eclTag/eclTag_loop.php; class eclTag_loop { // class eclTag_loop static function render ($render) { // function render $render->index++; // Se não houver um próximo item, prosseguiremos if ($render->index > count ($render->children)) return false; $render->data = $render->children[$render->index - 1]->data; $render->data['index'] = $render->index; if ($render->index == count ($render->children)) $render->data['last'] = 1; return true; } // function render } // class eclTag_loop //!eof:engine/eclTag/eclTag_loop.php; //!file:engine/eclTag/eclTag_mailto.php; class eclTag_mailto { // class eclTag_mailto static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $args = explode (' ', $arguments[0], 2); $buffer = ''; if (isset ($args[1]) and strlen ($args[1])) $buffer .= $args[1]; else $buffer .= $args[0]; $buffer .= "" . CRLF; $render->buffer .= $buffer; } // function render } // class eclTag_mailto //!eof:engine/eclTag/eclTag_mailto.php; //!file:engine/eclTag/eclTag_mod.php; class eclTag_mod { // class eclTag_mod static $type = 'module'; static function render ($render, $arguments) { // function render global $store; if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); $name = array_shift ($arguments); // Vamos abrir o módulo $mod = $render->document->createModule ($name, $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; // Vamos criar o escopo para o módulo $data = $mod->data; if (isset ($data['text'])) $data['local']['text'] = $data['text']; $data['local']['tag'] = 'mod:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_mod //!eof:engine/eclTag/eclTag_mod.php; //!file:engine/eclTag/eclTag_modlist.php; class eclTag_modlist { // class eclTag_modlist static $type = 'scope'; static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; // Que bloco deve ser inserido? $buffer = '['; foreach (explode (CRLF, $arguments[0]) as $name) { // each name $buffer .= 'mod`' . $name . '`;'; } // each name $data['html'] = $buffer; return $data; } // function render } // class eclTag_modlist //!eof:engine/eclTag/eclTag_modlist.php; //!file:engine/eclTag/eclTag_next.php; class eclTag_next { // class eclTag_next static function render ($render) { // function render if (!$render->index) return; if ($render->index < count ($render->children)) { // next item $render->index++; $render->data = $render->children[$render->index - 1]->data; $render->data['index'] = $render->index; if ($render->index == count ($render->children)) $render->data['last'] = 1; return; } // next item $render->data = array (); $render->data = array (); return; } // function render } // class eclTag_next //!eof:engine/eclTag/eclTag_next.php; //!file:engine/eclTag/eclTag_nl.php; class eclTag_nl { // class eclTag_nl static function render ($render, $arguments) { // function render $render->buffer .= CRLF; } // function render } // class eclTag_nl //!eof:engine/eclTag/eclTag_nl.php; //!file:engine/eclTag/eclTag_or.php; class eclTag_or { // class eclTag_or static function render ($render, $arguments) { // function render if (!isset ($arguments[0])) return ''; if ($arguments[0]) return $arguments[0]; if (isset ($arguments[1])) return $arguments[1]; return ''; } // function render } // class eclTag_or //!eof:engine/eclTag/eclTag_or.php; //!file:engine/eclTag/eclTag_paste.php; class eclTag_paste { // class eclTag_paste static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; // Vamos anotar a posição e o nome desta colagem $render->pasteIndex++; $render->pastePointer[$render->pasteIndex] = strlen ($render->buffer); $render->pasteNames[$render->pasteIndex] = $arguments[0]; } // function render } // class eclTag_paste //!eof:engine/eclTag/eclTag_paste.php; //!file:engine/eclTag/eclTag_personalite.php; class eclTag_personalite { // class eclTag_personalite static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; if (!$render->getVar ('personalite_ref')) return; $block = $store->control->read ('blocks/personalite'); return $block; } // function render } // class eclTag_personalite //!eof:engine/eclTag/eclTag_personalite.php; //!file:engine/eclTag/eclTag_rendertable.php; class eclTag_rendertable { // class eclTag_rendertable static function render ($render, $arguments) { // function render $buffer = &$render->buffer; $heading = $render->getVar ('table_heading'); $editable = $render->getVar ('mod.editable'); $id = $render->getVar ('mod.id'); $number = $render->getVar ('mod.number'); $buffer .= 'children as $row) { // each row // Row class $buffer .= ''; $cellIndex = 0; foreach ($row->children as $cell) { // each cell if ($rowIndex < $heading) $buffer .= 'data['rowspan'])) $buffer .= ' rowspan="' . $cell->data['rowspan'] . '"'; // Colspan if (isset ($cell->data['colspan'])) $buffer .= ' colspan="' . $cell->data['colspan'] . '"'; // editable if ($editable) $buffer .= ' data-name="' . $id . '_table_' . $number . '_' . $rowIndex . '_' . $cellIndex . '" data-mode="stack"'; // Cell class $class = 'col-' . $cellIndex . ' cell-' . $rowIndex . '-' . $cellIndex; if (!isset ($cell->data['text']['caption']) and !isset ($cell->data['caption'])) $class .= ' empty'; if (isset ($cell->data['class'])) $class .= ' ' . $cell->data['class']; // Cell style if (isset ($cell->data['style'])) { // style $buffer .= ' style="'; foreach ($cell->data['style'] as $selector => $value) { // each selector if (strpos ($value, ':')) $buffer .= $value; else $buffer .= $selector . ':' . $value . '; '; } // each selector $buffer .= '"'; } // style $buffer .= '>'; // Cell link if (isset ($cell->data['ref'])) $buffer .= ''; // Cell content if (isset ($cell->data['caption'])) eclTag_text::render ($render, array ($cell->data['caption'], $editable)); elseif (isset ($cell->data['text']['caption'])) eclTag_text::render ($render, array ($cell->data['text']['caption'], $editable)); elseif ($editable) eclTag_text::render ($render, array ('', $editable)); // End Cell link if (isset ($cell->data['ref'])) $buffer .= ''; if ($rowIndex < $heading) $buffer .= '' . CRLF; else $buffer .= '' . CRLF; $cellIndex ++; } // each cell $buffer .= '' . CRLF; $rowIndex ++; } // each row $buffer .= '' . CRLF; } // function render } // class eclTag_rendertable //!eof:engine/eclTag/eclTag_rendertable.php; //!file:engine/eclTag/eclTag_scope.php; class eclTag_scope { // class eclTag_scope static $type = 'scope'; static function render ($render, $arguments) { // function render global $store, $system; if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $document = $render->document; switch ($arguments[0]) { // switch argument case 'home': $home = $document->application; while (!$home->isDomain) { // loop up $home = $home->parent; } // loop up $data['data'] = $home->data; if ($home !== $document->application and $document->application->name != '') $data['data']['ref'] = $document->ref ($home->pathway); if ($document->contentEditable and $document->application->name == '') $data['data']['editable'] = 1; return $data; case 'img': $extras = $render->getVar ('extras'); if (!isset ($extras['img_0'])) return false; $scope = array ('data' => array ()); $data = &$scope['data']; $data = $extras['img_0']; $data['ref'] = $render->getVar ('ref'); $data['img_ref'] = $render->document->refFiles ($data['img']); $data['img_mini_ref'] = $render->document->refFiles ($data['img_mini']); if (!isset ($data['local']['description'])) { // provides a description $data['local']['description'] = $render->getVar ('description'); if ($data['local']['description'] === false) $data['local']['description'] = $render->getVar ('title'); if ($data['local']['description'] === false) $data['local']['description'] = $render->getVar ('caption'); } // provides a description return $scope; case 'system': $data['data'] = $render->document->system->data; return $data; case 'user': if (!isset ($arguments[1])) return false; $userName = $store->user->getName ($arguments[1]); $user = $store->userContent->open ($arguments[1], '-register'); if (!$user) return; $data['local'] = $user; $data['local']['ref'] = $render->document->ref (array (SYSTEM_PROFILES_URI, $userName)); return $data; case 'date': if (!isset ($arguments[1])) return false; $time = intval ($arguments[1]); if (!$time) return false; if (isset ($arguments[2]) and $time == intval($arguments[2])) return false; $parts = explode ('-', date ('Y-m-d-H-i-n', $time)); $local['y'] = $parts[0]; $local['m'] = $parts[1]; $local['d'] = $parts[2]; $local['h'] = $parts[3]; $local['i'] = $parts[4]; $local['n'] = $parts[5]; if ($parts[2] == 1) $local['th'] = 'st'; elseif ($parts[2] == 2) $local['th'] = 'nd'; elseif ($parts[2] == 3) $local['th'] = 'rd'; else $local['th'] = 'th'; $month = $store->control->read ('renderLabels_date_month' . $parts[5]); if (isset ($month['text']['caption'])) $local['month'] = $month['text']['caption']; $data['local'] = $local; return $data; case 'date_elapsed': if (!isset ($arguments[1])) return false; $time = intval ($arguments[1]); if (!$time) return false; $dif = TIME - $time; if ($dif <= 60) $message = 'now'; elseif ($dif <= 120) $message = '1minute'; elseif ($dif <= 3600){ $message = 'minutes'; $local['i'] = intval($dif / 60); }elseif ($dif <= 7200) $message = '1hour'; elseif ($dif <= 86400){ $message = 'hours'; $local['h'] = intval ($dif / 3600); }elseif ($dif <= 172800) $message = '1day'; elseif ($dif <= 2592000){ $message = 'days'; $local['d'] = intval ($dif / 86400); }elseif ($dif <= 5184000) $message = '1month'; elseif ($dif <= 31104000){ $message = 'months'; $local['m'] = intval ($dif / 2592000); }elseif ($dif <= 62208000) $message = '1year'; else{ $message = 'years'; $local['y'] = intval ($dif / 31104000); } $description = $store->control->read ('renderLabels_detail_elapsed_' . $message); $local['elapsed'] = $description['text']['caption']; $data['local'] = $local; return $data; case 'audio': case 'file': case 'video': $extras = $render->getVar ('extras'); $target = $arguments[0]; $number = $render->getVar ('mod.number'); if (!$number) $number = '0'; if (!isset ($extras[$target . '_' . $number])) { // no media $pathway = $render->getVar ('pathway'); if (!$pathway) return false; $me = $document->domain->parent; foreach ($pathway as $folder) { // each folder $me = $me->child ($folder); if (!$me) return; } // each folder if (!$document->access (4, $me->groups)) return; $data['local']['editable'] = 1; $domain = array_shift ($pathway); if (!$pathway) $pathway[] = '-index'; array_unshift ($pathway, $domain, '-dialog', $target . '_upload'); $name = array_pop ($pathway); $pathway[] = $name . CHR_FNS . $number; $ref = $document->ref ($pathway); $data['local']['ref'] = "javaScript:humperstilshen.popUpOpen('" . $ref . "', 300, 200)"; return $data; } // no media $data['local'] = $extras[$target . '_' . $number]; $data['local']['ref_download'] = $document->refFiles ($extras[$target . '_' . $number][$target], true, '-downloads/' . $target . '_' . $number); $data['local']['ref_play'] = $document->refFiles ($extras[$target . '_' . $number][$target], true, '-play/' . $target . '_' . $number); return $data; } // switch argument } // function render } // class eclTag_scope //!eof:engine/eclTag/eclTag_scope.php; //!file:engine/eclTag/eclTag_script.php; class eclTag_script { // class eclTag_script static function render ($render) { // function render $render->cutLastId = 'script'; $render->cutLastPosition = strlen ($render->buffer); } // function render } // class eclTag_script //!eof:engine/eclTag/eclTag_script.php; //!file:engine/eclTag/eclTag_shared.php; class eclTag_shared { // class eclTag_shared static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $render->buffer .= $render->document->refFiles ($arguments[0], true, '-shared'); } // function render } // class eclTag_shared //!eof:engine/eclTag/eclTag_shared.php; //!file:engine/eclTag/eclTag_style.php; class eclTag_style { // class eclTag_style static function render ($render) { // function render $render->cutLastId = 'style'; $render->cutLastPosition = strlen ($render->buffer); } // function render } // class eclTag_style //!eof:engine/eclTag/eclTag_style.php; //!file:engine/eclTag/eclTag_table.php; class eclTag_table { // class eclTag_table static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('table', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'table:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_table //!eof:engine/eclTag/eclTag_table.php; //!file:engine/eclTag/eclTag_text.php; class eclTag_text { // class eclTag_text static function render ($render, $arguments) { // function render global $store; // Vamos encontrar o nome do campo selecionado if (!isset ($arguments[0])) $field = $render->getVar ('caption'); elseif (is_array ($arguments[0])) $field = $arguments[0]; elseif (is_string ($arguments[0]) and !strlen ($arguments[0])) $field = ''; elseif (is_string ($arguments[0])) { // from constant @list ($prefix, $sufix) = explode ('_', $arguments[0], 2); $name = 'labels/' . $prefix . '/' . $sufix; $data = array (); if (isset ($render->blocks[$name])) $data = $render->blocks[$name]; if (!isset ($data['text']['caption'])) $data = $store->control->read ('renderLabels_' . $arguments[0]); if (!isset ($data['text']['caption'])) return; $field = $data['text']['caption']; } // from constant else return; if (is_array ($field)) $text = $render->document->selectLanguage ($field); else $text = array(); if (isset ($arguments[1]) and $arguments[1]) { // editable if (!isset ($text[TEXT_CONTENT])) $text[TEXT_CONTENT] = CRLF; if (!isset ($text[TEXT_FORMAT])) $text[TEXT_FORMAT] = 1; if (!isset ($text[TEXT_ECOLABORE])) $text[TEXT_ECOLABORE] = 1; $text[TEXT_EDITABLE] = 1; } // editable if (!$text) return; $render->render ($text); } // function render } // class eclTag_text //!eof:engine/eclTag/eclTag_text.php; //!file:engine/eclTag/eclTag_text_language_caption.php; class eclTag_text_language_caption { // class eclTag_text_language_caption static function render ($render, $arguments) { // function render global $store; $data = $store->control->read ('labels/lang/' . $render->document->lang); if (!isset ($data['text']['caption'])) return; $field = $data['text']['caption']; $render->render ($render->document->selectLanguage ($field)); } // function render } // class eclTag_text_language_caption //!eof:engine/eclTag/eclTag_text_language_caption.php; //!file:engine/eclTag/eclTag_video.php; class eclTag_video { // class eclTag_video static $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('video', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'video:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_video //!eof:engine/eclTag/eclTag_video.php; //!file:library/admin/default/eclApp_admin_default.php; class eclApp_admin_default { // class eclApp_admin_default static function is_child ($parent, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; // As subpastas deverão ser ignoradas $me->ignoreSubfolders = true; $me->data = $store->control->read ('admin_default_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_admin_default //!eof:library/admin/default/eclApp_admin_default.php; //!file:library/admin/eclApp_admin.php; class eclApp_admin { // class eclApp_admin static function is_child ($parent, $name) { // function is_child if ($name == SYSTEM_ADMIN_URI or $name == '-' . SYSTEM_ADMIN_URI) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (SYSTEM_ADMIN_URI); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('admin_content'); $me->getMap (); $me->isDomain = true; } // function constructor_helper } // class eclApp_admin //!eof:library/admin/eclApp_admin.php; //!file:library/admin/eclMod_admin_list.php; class eclMod_admin_list { // class eclMod_admin_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('modList_module'); $row = $mod->appendChild (); foreach ($me->menuChildren ($document) as $child) { // each child $row->appendChild ($child) ->swapTitle () ->ref ($child->pathway) ->virtual ($child->access); } // each child if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_admin_list //!eof:library/admin/eclMod_admin_list.php; //!file:library/admin/index/eclApp_admin_index.php; class eclApp_admin_index { // class eclApp_admin_index static function is_child ($parent, $name) { // function is_child if ($name == '') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('admin_index_content'); array_pop ($me->pathway); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_admin_index //!eof:library/admin/index/eclApp_admin_index.php; //!file:library/adminAlert/eclApp_adminAlert.php; class eclApp_adminAlert { // class eclApp_adminAlert static function is_child ($me, $name) { // function is_child if ($name == 'alerts') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('alerts'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminAlert_main'); $me->getMap (); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (!count ($me->children ())) $document->dataMerge ('adminAlert_mainEmpty'); else $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_adminAlert //!eof:library/adminAlert/eclApp_adminAlert.php; //!file:library/adminAlert/eclApp_adminAlert_log.php; class eclApp_adminAlert_log { // class eclApp_adminAlert_log static function is_child ($me, $name) { // function is_child if (substr ($name, 0, 4) == 'log_') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names $names = array (); if (is_file (FOLDER_DATABASE . 'log/.ht_error')) $names[] = 'log_error'; if (is_file (FOLDER_DATABASE . '.database.log')) $names[] = 'log_database'; if (is_file (FOLDER_ROOT . '.error_log')) $names[] = 'log_php'; if (defined ('DATABASE_ENABLED') and !DATABASE_ENABLED) $names[] = 'log_databasedisabled'; return $names; } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminAlert_log' . ucfirst (substr ($me->name, 4))); switch ($me->name) { // switch name case 'log_php': $me->pathway = array (SYSTEM_ADMIN_URI, 'system', 'log'); break; case 'log_database': $me->pathway = array (SYSTEM_ADMIN_URI, 'database', 'log'); break; case 'log_databasedisabled': $me->pathway = array (SYSTEM_ADMIN_URI, 'database', 'install'); break; } // switch name } // function constructor_helper static function dispatch ($document) { // function dispatch global $system; $me = $document->application; switch ($me->name) { // switch name case 'log_php': $document->application = $system->child (SYSTEM_ADMIN_URI)->child ('system')->child ('log'); $document->application->dispatch ($document); break; case 'log_database': $document->application = $system->child (SYSTEM_ADMIN_URI)->child ('database')->child ('log'); $document->application->dispatch ($document); break; case 'log_databasedisabled': $document->application = $system->child (SYSTEM_ADMIN_URI)->child ('database')->child ('config'); $document->application->dispatch ($document); break; case 'log_error': default: } // switch name } // function dispatch } // class eclApp_adminAlert_log //!eof:library/adminAlert/eclApp_adminAlert_log.php; //!file:library/adminAlert/eclApp_adminAlert_userSurvey.php; class eclApp_adminAlert_userSurvey { // class eclApp_adminAlert_userSurvey static function is_child ($me, $name) { // function is_child if ($name == '-survey') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names global $store; foreach ($store->user->childrenNames () as $name) { // each user $status = $store->user->getStatus ($name); if ($status&STATUS_SURVEY) return array ('-survey'); } // each user return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminAlert_userSurvey'); $n = 0; foreach ($store->user->childrenNames () as $name) { // each user $status = $store->user->getStatus ($name); if ($status&STATUS_SURVEY) $n++; } // each user $document->data['number'] = $n; $me->pathway = array (SYSTEM_ADMIN_URI, 'users', '-survey'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_adminAlert_userSurvey //!eof:library/adminAlert/eclApp_adminAlert_userSurvey.php; //!file:library/adminDatabase/config/eclApp_adminDatabase_config.php; class eclApp_adminDatabase_config { // class eclApp_adminDatabase_config static function is_child ($me, $name) { // function is_child if ($name == 'config') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('config'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminDatabase_config_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $formulary = $document->createFormulary ('adminDatabase_config_edit'); if ($formulary->save ()) { // save if ($io->systemConstants->check ('DATABASE_ENABLED') and $io->systemConstants->constants['DATABASE_ENABLED']) { // check database connection $store->close (); $io->close (); $io->database->reconnect (); if ($io->database->status) $document->mod->humperstilshen->alert ('systemConstants_databaseEnabledSuccess'); else $document->mod->humperstilshen->alert ('systemConstants_databaseEnabledFailed'); } // check database connection else $document->mod->humperstilshen->alert ('systemConstants_databaseEnabledDisabled'); } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminDatabase_config //!eof:library/adminDatabase/config/eclApp_adminDatabase_config.php; //!file:library/adminDatabase/eclApp_adminDatabase.php; class eclApp_adminDatabase { // class eclApp_adminDatabase static function is_child ($me, $name) { // function is_child if ($name == 'database') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('database'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminDatabase_content'); $me->access = 4; $me->map = array ('adminDatabase_config', 'adminDatabase_tables', 'adminDatabase_query', 'adminDatabase_log'); } // function constructor_helper static function dispatch ($document) { // function dispatch if (!is_dir (FOLDER_DATABASE)) { // create folder $formulary = $document->createFormulary ('adminDatabase_edit', array (), 'createFolder'); if (!$formulary->command ('create') or !$formulary->save ()) { // view form $document->mod->formulary = $formulary; return; } // view form } // create folder $document->mod->list = 'admin_list'; } // function dispatch } // class eclApp_adminDatabase //!eof:library/adminDatabase/eclApp_adminDatabase.php; //!file:library/adminDatabase/log/eclApp_adminDatabase_log.php; class eclApp_adminDatabase_log { // class eclApp_adminDatabase_log static function is_child ($me, $name) { // function is_child if ($name == 'log') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('log'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminDatabase_log_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminDatabase_log_edit'); if ($formulary->command ('save') and $formulary->save ()) $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminDatabase_log //!eof:library/adminDatabase/log/eclApp_adminDatabase_log.php; //!file:library/adminDatabase/log/eclFilter_adminDatabase_log.php; class eclFilter_adminDatabase_log { // class eclFilter_adminDatabase_log static function create ($fieldName, $control, $formulary) { // function create global $io; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'textarea'; $string = &$io->fileBinary->open (FOLDER_DATABASE . '.database.log'); if ($formulary->command ('clear_log')) $string = ''; $log = $io->fileBinary->open (FOLDER_DATABASE . '.database.log'); $item->data['value'] = $formulary->htmlSpecialChars ($log); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminDatabase_log //!eof:library/adminDatabase/log/eclFilter_adminDatabase_log.php; //!file:library/adminDatabase/query/eclApp_adminDatabase_query.php; class eclApp_adminDatabase_query { // class eclApp_adminDatabase_query static function is_child ($me, $name) { // function is_child if ($name == 'query') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('query'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminDatabase_query_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->formulary = $document->createFormulary ('adminDatabase_query_edit'); } // function dispatch } // class eclApp_adminDatabase_query //!eof:library/adminDatabase/query/eclApp_adminDatabase_query.php; //!file:library/adminDatabase/query/eclFilter_adminDatabase_query_command.php; class eclFilter_adminDatabase_query_command { // class eclFilter_adminDatabase_query_command static function create ($fieldName, $control, $formulary) { // function create global $io; $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (!isset ($item->data['type'])) $item->data['type'] = 'textarea'; if (isset ($formulary->received[$fieldName . '_input']) and $io->database->status) { // perform a query $buffer = ''; $io->database->verbose = false; $result = $io->database->query ($formulary->received[$fieldName . '_input']); $header = true; $headers = array (); foreach ($result as $line) { // each line $values = array (); if ($header) { // creates a header $header = false; foreach ($line as $fieldName => $value) { // each field if (is_int ($fieldName)) continue; $headers[] = $fieldName; $values[] = $value; } // each field $buffer = implode ("\t", $headers) . CRLF; $buffer .= implode ("\t", $values) . CRLF; } // creates a header else { // header ready foreach ($line as $fieldName => $value) { // each field if (is_int ($fieldName)) continue; $values[] = $value; } // each field $buffer .= implode ("\t", $values) . CRLF; } // header ready } // each line if ($io->database->error ()) $buffer .= $formulary->received[$fieldName . '_input'] . CRLF . $io->database->error () . CRLF; if ($io->database->insertId ()) $buffer .= 'Insert id = ' . $io->database->insertId () . CRLF; if ($io->database->affectedRows ()) $buffer .= 'Rows = ' . $io->database->affectedRows () . CRLF; if (count ($result)) $buffer .= count ($result) . " rows in set" . CRLF; $item->data['value'] = $formulary->htmlSpecialChars ($buffer); $io->database->verbose = true; } // perform a query return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminDatabase_query_command //!eof:library/adminDatabase/query/eclFilter_adminDatabase_query_command.php; //!file:library/adminDatabase/tables/eclApp_adminDatabase_tables.php; class eclApp_adminDatabase_tables { // class eclApp_adminDatabase_tables static function is_child ($me, $name) { // function is_child if ($name == 'tables') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names if (!defined ('DATABASE_ENABLED') or !DATABASE_ENABLED) return array (); return array ('tables'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminDatabase_tables_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $data['tables'] = array ( 'domain' => 0, 'domainContent' => 0, 'domainGroup' => 0, 'user' => 0, 'userContent' => 0, 'userFriend' => 0, 'userSubscription' => 0 ); $io->database->performed_queries = ''; $formulary = $document->createFormulary ('adminDatabase_tables_edit', $data, 'dt'); if ($formulary->command ('save') and $formulary->save ()) { // save switch ($formulary->data['action']) { // switch action case 'create': foreach ($formulary->data['tables'] as $table => $enabled) { // loop tables if (!$enabled) continue; $io->database->create ($store->$table); } // loop tables break; case 'drop': foreach ($formulary->data['tables'] as $table => $enabled) { // loop tables if (!$enabled) continue; $io->database->drop ($store->$table); } // loop tables break; case 'repair': break; } // switch action } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminDatabase_tables //!eof:library/adminDatabase/tables/eclApp_adminDatabase_tables.php; //!file:library/adminDatabase/tables/eclFilter_adminDatabase_tables_list.php; class eclFilter_adminDatabase_tables_list { // class eclFilter_adminDatabase_tables_list static function create ($fieldName, $control, $formulary) { // function create foreach ($formulary->data['tables'] as $table => $enabled) { // each table $local['type'] = 'checkbox'; $local['name'] = $fieldName . '_' . $table; $local['caption'] = $formulary->document->textMerge ($table); if ($enabled) $local['value'] = 1; else $local['value'] = 0; $formulary->appendChild (false, $local); } // each table } // function create static function save ($fieldName, $control, $formulary) { // function save foreach ($formulary->data['tables'] as $table => &$enabled) { // each table if (isset ($formulary->received[$fieldName . '_' . $table]) and $formulary->received[$fieldName . '_' . $table]) $enabled = 1; } // each table } // function save } // class eclFilter_adminDatabase_tables_list //!eof:library/adminDatabase/tables/eclFilter_adminDatabase_tables_list.php; //!file:library/adminDatabase/tables/eclFilter_adminDatabase_tables_log.php; class eclFilter_adminDatabase_tables_log { // class eclFilter_adminDatabase_tables_log static function create ($fieldName, $control, $formulary) { // function create global $io; $local['type'] = 'textarea_big'; $local['name'] = $fieldName; $local['value'] = $formulary->htmlSpecialChars ($io->database->performed_queries); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminDatabase_tables_log //!eof:library/adminDatabase/tables/eclFilter_adminDatabase_tables_log.php; //!file:library/adminDomain/add/eclApp_adminDomain_add.php; class eclApp_adminDomain_add { // class eclApp_adminDomain_add static function is_child ($me, $name) { // function is_child if ($name == '-new-domain') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-new-domain'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminDomain_add_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $formulary = $document->createFormulary ('adminDomain_add_edit', array (), 'domainAdd'); if ($formulary->command ('save') and $formulary->save ()) { // formulary saved $domain['name'] = $formulary->data['name']; $domain['status'] = 1; mkdir (FOLDER_DOMAINS . $domain['name']); if (DATABASE_ENABLED and isset ($formulary->data['database']) and $formulary->data['database'] == 'client') { // client $domainId = $store->domain->insert ($domain); $data = $formulary->data; $data['mode'] = MODE_DOMAIN; $data['parent_id'] = 0; $data['name'] = '-register'; $data['text']['caption'] = $data['text']['title']; $store->domainContent->insert ($domainId, $data); $group = &$store->domainGroup->open ($domainId, 1); $group[$data['admin_id']] = 4; } // client else { // file $database = $io->sqlite->connect (FOLDER_DOMAINS . $domain['name'] . '/.domain.db'); $database->create ($store->domainContent); $data = $formulary->data; $data['mode'] = MODE_DOMAIN; $data['parent_id'] = 0; $data['name'] = '-register'; $data['text']['caption'] = $data['text']['title']; $store->domainContent->insert ($domain['name'], $data); $data['name'] = '-index'; $store->domainContent->insert ($domain['name'], $data); $file = FOLDER_DOMAINS . $name . '/_domain.ecl.php'; $row = &$io->file->open ($file); $row['name'] = $domain['name']; $row['id'] = $domain['name']; $row['status'] = 1; } // file $document->received = array (); unset ($document->actions['domain']); $parent = $document->application->parent; $parent->reset (); $document->application = $parent->child ($formulary->data['name']); $document->application->dispatch ($document); $document->reload = $document->ref (); return; } // formulary saved $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminDomain_add //!eof:library/adminDomain/add/eclApp_adminDomain_add.php; //!file:library/adminDomain/add/eclFilter_adminDomain_add_admin.php; class eclFilter_adminDomain_add_admin { // class eclFilter_adminDomain_add_admin static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'text'; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->received[$fieldName]) or !preg_match ('/^[a-z0-9_-]+$/', $formulary->received[$fieldName])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminDomain_add_editAdminRequired'); $userId = $store->user->getId ($formulary->received[$fieldName]); // required if (!$userId) return $formulary->setRequiredMsg ($control, $fieldName, 'adminDomain_add_editAdminRequired'); $formulary->data['admin_id'] = $userId; } // function save } // class eclFilter_adminDomain_add_admin //!eof:library/adminDomain/add/eclFilter_adminDomain_add_admin.php; //!file:library/adminDomain/add/eclFilter_adminDomain_add_name.php; /* * Control flags * control_type * control_target * control_field_name * control_required */ class eclFilter_adminDomain_add_name { // class eclFilter_adminDomain_add_name static function create ($fieldName, $control, $formulary) { // function create $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'text'; // target if (isset ($control['flags']['control_target'])) $item->data['value'] = $formulary->getField ($control['flags']['control_target']); return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->received[$fieldName])) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_add_editNameInvalidChars'); $value = trim ($formulary->received[$fieldName], ' -_'); if (!strlen ($value)) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_add_editNameInvalidChars'); if (strlen ($value) > 18) $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_add_editNameSoLong'); elseif (!preg_match ('/^[a-z0-9][a-z0-9_-]+$/', $value)) $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_add_editNameInvalidChars'); elseif (is_dir (FOLDER_DOMAINS . $value)) $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_add_editNameAlreadyExists'); if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_adminDomain_add_name //!eof:library/adminDomain/add/eclFilter_adminDomain_add_name.php; //!file:library/adminDomain/details/eclApp_adminDomain_details.php; class eclApp_adminDomain_details { // class eclApp_adminDomain_details static function is_child ($me, $name) { // function is_child global $store; if (!strlen ($name)) return false; if ($store->domain->getId ($name)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store, $system; $me->domainId = $store->domain->getId ($me->name); $me->data = $store->control->read ('adminDomain_details_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store, $system; $me = $document->application; $data = &$store->domainContent->open ($me->domainId, '-register'); if (!$data) { // creates a register $data = array ('domain_id' => $me->domainId, 'mode' => MODE_DOMAIN, 'parent_id' => 0, 'name' => '-register'); $store->domainContent->insert ($me->domainId, $data); $document->reload = $document->ref (); $document->application = $me->parent; $document->application->dispatch ($document); return; } // creates a register $remove = $document->createFormulary ('adminDomain_details_contextRemoveConfirm', array (), 'domainRemove'); if ($remove->save ()) return self::action_remove ($document); elseif ($remove->errorMsg) $document->mod->humperstilshen->alert ($remove->errorMsg); $formulary = $document->createFormulary ('adminDomain_details_edit', $data, 'domainEdit'); $formulary->data['name'] = $me->name; $status = $store->domain->getStatus ($me->name); $formulary->data['status'] = $status; if ($formulary->save ()) { // formulary submited if ($formulary->command ('admin_add') and $formulary->data['admin_id']) { // add a new administrator $group = &$store->domainGroup->open ($me->domainId, 1); $group[$formulary->data['admin_id']] = 4; } // add a new administrator elseif ($formulary->command ('admin_remove') and $formulary->data['admin_select']) { // remove an administrator $group = &$store->domainGroup->open ($me->id, 1); unset ($group[$formulary->data['admin_select']]); } // remove an administrator elseif ($formulary->command ('save') and !$formulary->errorMsg) { // save $formulary->data['name'] = '-register'; $formulary->data['text']['caption'] = $formulary->data['text']['title']; $data = $formulary->data; if ($formulary->data['status'] != $status) { // update status $domain = &$store->domain->open ($me->name); $domain['status'] = $formulary->data['status']; } // update status $formulary->errorMsg = 'systemFormulary_alertDataUpdated'; } // save } // returned formulary $formulary->data['name'] = $me->name; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); // Context Remove $document->mod->context->appendChild ('adminDomain_details_contextRemove') ->confirm ('adminDomain_details_contextRemoveConfirm', $remove); } // function dispatch static function action_remove ($document) { // function action_remove global $io, $store; $me = $document->application; $id = $me->domainId; $store->domain->delete ($id); $io->database->delete ($store->domainContent, array ('domain_id' => $id)); $io->database->delete ($store->domainGroup, array ('domain_id' => $id)); $io->database->delete ($store->userSubscription, array ('domain_id' => $id)); foreach (scandir (FOLDER_DOMAINS . $me->name) as $filename) { // each domain file if (is_file (FOLDER_DOMAINS . $me->name . '/' . $filename)) unlink (FOLDER_DOMAINS . $me->name . '/' . $filename); } // each domain file rmdir (FOLDER_DOMAINS . $me->name); // returns to parent page $parent = $me->parent; $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->ref (); } // function action_remove } // class eclApp_adminDomain_details //!eof:library/adminDomain/details/eclApp_adminDomain_details.php; //!file:library/adminDomain/details/eclFilter_adminDomain_details_adminAdd.php; class eclFilter_adminDomain_details_adminAdd { // class eclFilter_adminDomain_details_adminAdd static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!$formulary->command ('admin_add')) return; if (isset ($formulary->received[$fieldName])) { // received value $value = trim ($formulary->received[$fieldName], ' -_'); if (!preg_match ('/^[a-z0-9_-]+$/', $value)) $value = false; } // received value else $value = false; if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); $userId = $store->user->getId ($value); if (!$userId) $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_details_msgAdminRequired'); $domainId = $formulary->document->application->domainId; $group = $store->domainGroup->open ($domainId, 1); if (isset ($group[$userId]) and $group[$userId] == 4) $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_details_msgAdminAlreadyExists', $value); $formulary->setField ('admin_id', $userId); $formulary->setField ('admin_name', $value); } // function save } // class eclFilter_adminDomain_details_adminAdd //!eof:library/adminDomain/details/eclFilter_adminDomain_details_adminAdd.php; //!file:library/adminDomain/details/eclFilter_adminDomain_details_adminSelect.php; class eclFilter_adminDomain_details_adminSelect { // class eclFilter_adminDomain_details_adminSelect static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; $domainId = $me->domainId; $group = $store->domainGroup->open ($domainId, 1); foreach ($group as $userId => $status) { // each user if (!$userId or $status != 4) continue; $data = $store->userContent->open ($userId, '-register'); if (isset ($data['text']['title'])) $caption = $data['text']['title']; elseif (isset ($data['text']['caption'])) $caption = $data['text']['caption']; else $caption = $document->textMerge ('unknown'); $item->appendChild (false, array ( 'value' => $userId, 'caption' => $caption )); } // each user } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!$formulary->command ('admin_remove')) return false; if (isset ($formulary->received[$fieldName])) $userId = intval ($formulary->received[$fieldName]); if (!$userId) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_details_msgAdminPleaseSelect'); $domainId = $formulary->document->application->domainId; $group = $store->domainGroup->open ($domainId, 1); if (!isset ($group[$userId])) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_details_msgAdminRemoveError'); $i = 0; foreach ($group as $status) { // each status if ($status == 4) $i++; } // each status if ($i <= 1) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomain_details_msgAdminRemoveLast'); if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $userId); } // function save } // class eclFilter_adminDomain_details_adminSelect //!eof:library/adminDomain/details/eclFilter_adminDomain_details_adminSelect.php; //!file:library/adminDomain/eclApp_adminDomain.php; class eclApp_adminDomain { // class eclApp_adminDomain static function is_child ($me, $name) { // function is_child if ($name == 'domains') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('domains'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $io, $store; $me->data = $store->control->read ('adminDomain_content'); if ($io->database->tableEnabled ($store->domain) and is_dir (FOLDER_DOMAINS)) $me->map = array ('adminDomain_add', 'adminDomain_details'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; if (!$io->database->tableEnabled ($store->domain)) { // disabled $document->dataMerge ('adminDomain_contentDisabled'); return; } // disabled if (!is_dir (FOLDER_DOMAINS) and !$document->access (4)) { // no folder for visitors $document->dataMerge ('adminDomain_contentEmpty'); return; } // no folder for visitors if (!is_dir (FOLDER_DOMAINS)) { // create folder $formulary = $document->createFormulary ('adminDomain_edit', array (), 'createFolder'); if ($formulary->command ('create') and $formulary->save ()) { // create $folder_domains = FOLDER_ROOT . $io->systemConstants->get ('PATH_DOMAIN'); } // create else { // view form $document->mod->formulary = $formulary; return; } // view form } // create folder $document->mod->list = new eclMod_adminDomain_list ($document); if (!isset ($folder_domains)) $folder_domains = FOLDER_DOMAINS; if (count (scandir ($folder_domains)) == 2) { // empty $document->dataMerge ('adminDomain_contentEmpty'); return; } // empty } // function dispatch } // class eclApp_adminDomain //!eof:library/adminDomain/eclApp_adminDomain.php; //!file:library/adminDomain/eclMod_adminDomain_list.php; class eclMod_adminDomain_list { // class eclMod_adminDomain_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $row = $mod->appendChild(); if ($document->access (4)) { // access $pathway = $document->application->pathway; // Domain add $domain_pathway = $pathway; $domain_pathway[] = '-new-domain'; $row->appendChild ('adminDomain_add_content') ->virtual () ->ref ($domain_pathway); } // access else $pathway = array (); if (is_dir (FOLDER_DOMAINS)) $names = $store->domain->childrenNames (); else $names = array (); foreach ($names as $name) { // each name $domainId = $store->domain->getId ($name); $data = $store->domainContent->open ($domainId, '-register'); if (!isset ($data['text']['title'])) $data = $store->domainContent->open ($domainId, '-index'); if (isset ($data['text']['title'])) $caption = $data['text']['title']; else $caption = $document->textMerge ('! ' . $name); $domain_pathway = $pathway; $domain_pathway[] = $name; $row->appendChild (false, array ('title' => $caption)) ->ref ($domain_pathway) ->swapTitle (); } // each name $mod->data = $store->control->read ('modList_module'); $mod->enabled = true; } // function setModule } // class eclMod_adminDomain_list //!eof:library/adminDomain/eclMod_adminDomain_list.php; //!file:library/adminMail/eclApp_adminMail.php; class eclApp_adminMail { // class eclApp_adminMail static function is_child ($me, $name) { // function is_child if ($name == 'mail') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('mail'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminMail_content'); $me->access = 4; $me->map = array ( 'adminMail_smtp', 'adminMail_message' ); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = 'admin_list'; } // function dispatch } // class eclApp_adminMail //!eof:library/adminMail/eclApp_adminMail.php; //!file:library/adminMail/message/eclApp_adminMail_message.php; class eclApp_adminMail_message { // class eclApp_adminMail_message static function is_child ($me, $name) { // function is_child if ($name == 'message') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names if (defined ('SMTP_ENABLE') and SMTP_ENABLE) return array ('message'); return array(); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminMail_message_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminMail_message_edit'); if ($formulary->save ()) { // formulary saved $data = $formulary->data; $mail = new eclIo_smtp(); if (isset ($data['to'])) $mail->to ($data['to']); if (isset ($data['cc'])) $mail->cc ($data['cc']); if (isset ($data['bcc'])) $mail->bcc ($data['bcc']); if (isset ($data['subject'])) $mail->subject ($data['subject'], $document->charset); if (isset ($data['text'])) $mail->contentTXT ($data['text'], $document->charset); if (isset ($data['html'])) $mail->contentHTML ($data['html'], $document->charset); $errorMsg = $mail->send(); $buffer['log'] = $mail->log; $log = $document->createFormulary ('adminMail_message_view', $buffer, 'mail'); $document->mod->formulary = $log; if ($errorMsg) $document->mod->humperstilshen->alert ($errorMsg); return; } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminMail_message //!eof:library/adminMail/message/eclApp_adminMail_message.php; //!file:library/adminMail/smtp/eclApp_adminMail_smtp.php; class eclApp_adminMail_smtp { // class eclApp_adminMail_smtp static function is_child ($me, $name) { // function is_child if ($name == 'smtp') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('smtp'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminMail_smtp_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminMail_smtp_edit'); if ($formulary->save ()) { // formulary saved $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminMail_smtp //!eof:library/adminMail/smtp/eclApp_adminMail_smtp.php; //!file:library/adminSystem/admin/eclApp_adminSystem_admin.php; class eclApp_adminSystem_admin { // class eclApp_adminSystem_admin static function is_child ($me, $name) { // function is_child if ($name == 'admin') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('admin'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_admin_content'); $me->groups = array ( new eclGroup_adminSystem_admin ()); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; if ($document->actions ('admin', 'changed')) $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); $formulary = $document->createFormulary ('adminSystem_admin_edit'); if ($formulary->save ()) { // change login $document->session['user_id'] = true; $document->session['user_name'] = $io->systemConstants->constants['ADMIN_IDENTIFIER']; $document->reload = $document->ref (true, true, '_admin-changed'); } // change login else { // restore login $io->systemConstants->set ('ADMIN_IDENTIFIER', ADMIN_IDENTIFIER); } // restore login $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminSystem_admin //!eof:library/adminSystem/admin/eclApp_adminSystem_admin.php; //!file:library/adminSystem/eclApp_adminSystem.php; class eclApp_adminSystem { // class eclApp_adminSystem static function is_child ($me, $name) { // function is_child if ($name == 'system') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('system'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_content'); $me->access = 4; $me->map = array ( 'adminSystem_setup', 'adminSystem_admin', 'adminSystem_hosting', 'adminSystem_server', 'adminSystem_tracking', 'adminSystem_eval', 'adminSystem_log', 'adminSystem_update', 'adminSystem_extract', 'adminSystem_pack' ); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = 'admin_list'; } // function dispatch } // class eclApp_adminSystem //!eof:library/adminSystem/eclApp_adminSystem.php; //!file:library/adminSystem/eclGroup_adminSystem_admin.php; class eclGroup_adminSystem_admin { // class eclGroup_adminSystem_admin public function check ($document) { // function check if (!defined ('ADMIN_IDENTIFIER')) return 0; if ($document->user->name == ADMIN_IDENTIFIER) return 4; if ($document->user->userId) return 1; return 0; } // function check } // class eclGroup_adminSystem_admin //!eof:library/adminSystem/eclGroup_adminSystem_admin.php; //!file:library/adminSystem/eval/eclApp_adminSystem_eval.php; class eclApp_adminSystem_eval { // class eclApp_adminSystem_eval static function is_child ($me, $name) { // function is_child if ($name == 'eval') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('eval'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_eval_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->formulary = $document->createFormulary ('adminSystem_eval_edit'); } // function dispatch } // class eclApp_adminSystem_eval //!eof:library/adminSystem/eval/eclApp_adminSystem_eval.php; //!file:library/adminSystem/eval/eclFilter_adminSystem_eval_evalInput.php; class eclFilter_adminSystem_eval_evalInput { // class eclFilter_adminSystem_eval_evalInput static function create ($fieldName, $control, $formulary) { // function create global $io, $store, $system, $groups, $document; $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'textarea'; // eval if (isset ($formulary->received[$fieldName]) and $formulary->command ('save')) eval ($formulary->received[$fieldName]); return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminSystem_eval_evalInput //!eof:library/adminSystem/eval/eclFilter_adminSystem_eval_evalInput.php; //!file:library/adminSystem/extract/eclApp_adminSystem_extract.php; class eclApp_adminSystem_extract { // class eclApp_adminSystem_extract static function is_child ($me, $name) { // function is_child if (defined ('SYSTEM_IS_PACKED') and SYSTEM_IS_PACKED and $name == 'pack') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names if (defined ('SYSTEM_IS_PACKED') and SYSTEM_IS_PACKED) return array ('pack'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_extract_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminSystem_extract_edit'); if ($formulary->command ('save') and $formulary->save ()) { // options saved $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // options saved elseif ($formulary->command ('extract') and $formulary->save ()) { // extract files $io->packager->extract ($formulary->data); $document->reload = $document->ref (); return; } // extract files $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminSystem_extract //!eof:library/adminSystem/extract/eclApp_adminSystem_extract.php; //!file:library/adminSystem/hosting/eclApp_adminSystem_hosting.php; class eclApp_adminSystem_hosting { // class eclApp_adminSystem_hosting static function is_child ($me, $name) { // function is_child if ($name == 'hosting') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('hosting'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_hosting_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminSystem_hosting_edit'); if ($formulary->save ()) { // formulary saved $document->mode = $io->systemConstants->get ('SYSTEM_HOSTING_MODE'); $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_hosting //!eof:library/adminSystem/hosting/eclApp_adminSystem_hosting.php; //!file:library/adminSystem/log/eclApp_adminSystem_log.php; class eclApp_adminSystem_log { // class eclApp_adminSystem_log static function is_child ($me, $name) { // function is_child if ($name == 'log') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('log'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_log_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminSystem_log_edit'); if ($formulary->command ('save') and $formulary->save ()) $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_log //!eof:library/adminSystem/log/eclApp_adminSystem_log.php; //!file:library/adminSystem/log/eclFilter_adminSystem_log_logView.php; class eclFilter_adminSystem_log_logView { // class eclFilter_adminSystem_log_logView static function create ($fieldName, $control, $formulary) { // function create global $io; $item = $formulary->document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'textarea'; $string = &$io->fileBinary->open ('.error_log'); if ($formulary->command ('clear_log')) $string = ''; $log = $io->fileBinary->open ('.error_log'); $lines = array (); foreach (explode (LF, $log) as $line) { // each log line if (!trim ($line)) continue; list ($date, $info) = explode ("]", trim ($line)); if (isset ($lines[$info])) $lines[$info]++; else $lines[$info] = 1; } // each log line $buffer = ''; foreach ($lines as $info => $times) { // each line $buffer .= $info . ' (' . $times . ")" . CRLF; } // each line $item->data['value'] = $buffer; return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminSystem_log_logView //!eof:library/adminSystem/log/eclFilter_adminSystem_log_logView.php; //!file:library/adminSystem/pack/eclApp_adminSystem_pack.php; class eclApp_adminSystem_pack { // class eclApp_adminSystem_pack static function is_child ($me, $name) { // function is_child if (defined ('SYSTEM_IS_PACKED') and SYSTEM_IS_PACKED) return false; if ($name == 'pack') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names if (!defined ('SYSTEM_IS_PACKED') or !SYSTEM_IS_PACKED) return array ('pack'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_pack_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminSystem_pack_edit'); if ($formulary->command ('pack') and $formulary->save ()) { // pack file $io->packager->pack ($formulary->data); if (isset ($formulary->data['pack_mode']) and $formulary->data['pack_mode'] == 'replace') { // replace $document->reload = $document->ref (); return; } // replace $document->mod->humperstilshen->alert ('adminSystem_pack_alertFinished'); } // pack file $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminSystem_pack //!eof:library/adminSystem/pack/eclApp_adminSystem_pack.php; //!file:library/adminSystem/server/eclApp_adminSystem_server.php; class eclApp_adminSystem_server { // class eclApp_adminSystem_server static function is_child ($me, $name) { // function is_child if ($name == 'server') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('server'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_server_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminSystem_server_edit'); if ($formulary->save ()) { // formulary saved $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_server //!eof:library/adminSystem/server/eclApp_adminSystem_server.php; //!file:library/adminSystem/setup/eclApp_adminSystem_setup.php; class eclApp_adminSystem_setup { // class eclApp_adminSystem_setup static function is_child ($me, $name) { // function is_child if ($name == 'setup') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('setup'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_setup_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminSystem_setup_edit'); if ($formulary->save ()) { // formulary saved $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_setup //!eof:library/adminSystem/setup/eclApp_adminSystem_setup.php; //!file:library/adminSystem/tracking/eclApp_adminSystem_tracking.php; class eclApp_adminSystem_tracking { // class eclApp_adminSystem_tracking static function is_child ($me, $name) { // function is_child if ($name == 'tracking') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('tracking'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_tracking_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $formulary = $document->createFormulary ('adminSystem_tracking_edit'); if ($formulary->command ('save') and $formulary->save ()) { // formulary saved $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // formulary saved elseif ($formulary->command ('clear_geoip_cache')) { // clear cache $document->mod->humperstilshen->alert ('adminSystem_tracking_alertCacheCleared'); } // clear cache elseif ($formulary->command ('clear_removed_pages')) { // clear removed pages $count = $io->database->select ($store->domainContent, array ('access' => 255), '', array ('id')); $document->data['removed_pages'] = count ($count); if ($count) $io->database->delete ($store->domainContent, array ('access' => 255)); $document->mod->humperstilshen->alert ('adminSystem_tracking_alertPagesRemoved'); } // clear removed pages $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_tracking //!eof:library/adminSystem/tracking/eclApp_adminSystem_tracking.php; //!file:library/adminSystem/update/eclApp_adminSystem_update.php; class eclApp_adminSystem_update { // class eclApp_adminSystem_update static function is_child ($me, $name) { // function is_child if ($name == 'update') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('update'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminSystem_update_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $formulary = $document->createFormulary ('adminSystem_update_edit'); if ($formulary->command ('save') and $formulary->save ()) { // formulary saved $fieldName = $formulary->data['file_field']; $fileName = FOLDER_ROOT . SYSTEM_SCRIPT_NAME; unlink ($fileName); if (move_uploaded_file ($_FILES[$fieldName]['tmp_name'], $fileName)) exit ('System updated. Please reload.'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_update //!eof:library/adminSystem/update/eclApp_adminSystem_update.php; //!file:library/adminSystem/update/eclFilter_adminSystem_update_upload.php; class eclFilter_adminSystem_update_upload { // class eclFilter_adminSystem_update_upload static function create ($fieldName, $control, $formulary) { // function create $control['type'] = 'file'; $control['name'] = $fieldName; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($_FILES[$fieldName]['size']) or !$_FILES[$fieldName]['size']) return $formulary->setRequiredMsg ($control, $fieldName); $formulary->data['file_field'] = $fieldName; } // function save } // class eclFilter_adminSystem_update_upload //!eof:library/adminSystem/update/eclFilter_adminSystem_update_upload.php; //!file:library/adminTools/ecl2php/eclApp_adminTools_ecl2php.php; class eclApp_adminTools_ecl2php { // class eclApp_adminTools_ecl2php static function is_child ($me, $name) { // function is_child if ($name == 'ecl2php') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('ecl2php'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminTools_ecl2php_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminTools_ecl2php_edit'); $formulary->save(); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminTools_ecl2php //!eof:library/adminTools/ecl2php/eclApp_adminTools_ecl2php.php; //!file:library/adminTools/ecl2php/eclFilter_adminTools_ecl2php.php; class eclFilter_adminTools_ecl2php { // class eclFilter_adminTools_ecl2php static function create ($fieldName, $control, $formulary) { // function create $control['type'] = 'textarea_full'; $control['name'] = $fieldName; $control['value'] = $formulary->htmlSpecialChars ($formulary->getField ('php')); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->received[$fieldName])) return; $array = $formulary->document->render->render_tags ($formulary->received[$fieldName], true); $store->control->renderToPhp ($array); $formulary->data['php'] = $store->control->php; } // function save } // class eclFilter_adminTools_ecl2php //!eof:library/adminTools/ecl2php/eclFilter_adminTools_ecl2php.php; //!file:library/adminTools/eclApp_adminTools.php; class eclApp_adminTools { // class eclApp_adminTools static function is_child ($me, $name) { // function is_child if ($name == 'tools') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('tools'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminTools_content'); $me->map = array ( 'adminTools_ecl2php' ); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = 'admin_list'; } // function dispatch } // class eclApp_adminTools //!eof:library/adminTools/eclApp_adminTools.php; //!file:library/adminUser/add/eclApp_adminUser_add.php; class eclApp_adminUser_add { // class eclApp_adminUser_add static function is_child ($me, $name) { // function is_child global $store; if ($name == '-new-user') return true; if (!$store->user->getId ($name) and is_dir (FOLDER_PROFILES . $name)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-new-user'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminUser_add_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $data = array (); if ($document->application->name != '-new-user' and $document->application->name != '-default') $data['name'] = $document->application->name; $formulary = $document->createFormulary ('adminUser_add_edit', $data, 'useradd'); if ($formulary->command ('save') and $formulary->save ()) { // formulary saved $user['name'] = $formulary->data['name']; $user['password'] = $formulary->data['password']; $user['status'] = 1; $userId = $store->user->insert ($user); $data = $formulary->data; $data['mode'] = MODE_DOMAIN; $data['parent_id'] = 0; $data['name'] = '-register'; $store->userContent->insert ($userId, $data); $document->received = array (); unset ($document->actions['user']); $parent = $document->application->parent; unset ($document->application); $parent->reset (); $document->application = $parent->child ($formulary->data['name']); $document->application->dispatch ($document); $document->reload = $document->ref (); return; } // formulary saved $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminUser_add //!eof:library/adminUser/add/eclApp_adminUser_add.php; //!file:library/adminUser/add/eclFilter_adminUser_add_name.php; /* * Control flags * control_type * control_filter = adminUser_name * control_target * control_field_name * control_required */ class eclFilter_adminUser_add_name { // class eclFilter_adminUser_add_name static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text'; // target if (isset ($control['flags']['control_target'])) $local['value'] = $formulary->getField ($control['flags']['control_target']); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; // filter if (isset ($formulary->received[$fieldName])) { // received value $value = trim ($formulary->received[$fieldName], ' -_'); if (!preg_match ('/^[a-z0-9_-]+$/', $value)) $formulary->setErrorMsg ($control, $fieldName, 'adminUser_add_msgUserInvalidName', $value); elseif ($store->user->getId ($value)) $formulary->setErrorMsg ($control, $fieldName, 'adminUser_add_msgUserAlreadyExists', $value); } // received value else $value = false; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminUser_add_msgUserNameRequired'); // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $value); } // function save } // class eclFilter_adminUser_add_name //!eof:library/adminUser/add/eclFilter_adminUser_add_name.php; //!file:library/adminUser/add/eclFilter_adminUser_add_password.php; /* * Control flags * control_type * control_filter = adminUser_password * control_target * control_field_name * control_required * control_error_msg */ class eclFilter_adminUser_add_password { // class eclFilter_adminUser_add_password static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_password'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save isset ($formulary->received[$fieldName]) ? $password = strtolower ($formulary->received[$fieldName]) : $password = false; isset ($formulary->received[$fieldName . '_repeat']) ? $password2 = strtolower ($formulary->received[$fieldName . '_repeat']) : $password2 = false; if (!$password and $password !== '0') $password = false; // required if ($password === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminUser_add_msgPasswordRequired'); // no password, no required if (!$password) return; if ($password != $password2) return $formulary->setErrorMsg ($control, $fieldName, 'adminUser_add_msgPasswordRepeatError'); foreach (str_split ($password) as $char) { // each char if (ord ($char) < 32 or ord ($char) > 127) return $formulary->setErrorMsg ($control, $fieldName, 'adminUser_add_msgPasswordInvalidCharacter'); } // each char // target if (isset ($control['flags']['control_target'])) $formulary->setField ($control['flags']['control_target'], $password); } // function save } // class eclFilter_adminUser_add_password //!eof:library/adminUser/add/eclFilter_adminUser_add_password.php; //!file:library/adminUser/details/eclApp_adminUser_details.php; class eclApp_adminUser_details { // class eclApp_adminUser_details static function is_child ($me, $name) { // function is_child global $store; if (!strlen ($name)) return false; if ($store->user->getId ($name)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->userId = $store->user->getId ($me->name); $me->data = $store->control->read ('adminUser_details_content'); $data = $store->userContent->open ($me->userId, '-register'); if (isset ($data['text']['caption'])) $me->data['text']['caption'] = $data['text']['caption']; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; $data = &$store->userContent->open ($me->userId, '-register'); if (isset ($data['flags']['gender']) and $data['flags']['gender'] == 'female') $gender = 'F'; else $gender = 'M'; $remove = $document->createFormulary ('adminUser_details_removeConfirm' . $gender, array (), 'userRemove'); if ($remove->save ()) return self::action_remove ($document); elseif ($remove->errorMsg) $document->mod->humperstilshen->alert ($remove->errorMsg); $formulary = $document->createFormulary ('adminUser_details_edit', $data, 'userEdit'); $formulary->data['name'] = $me->name; $status = $store->user->getStatus ($me->name); $formulary->data['status'] = $status; if ($formulary->save ()) { // save $formulary->data['name'] = '-register'; $data = $formulary->data; if ($formulary->data['status'] != $status or isset ($formulary->data['password'])) { // update status $user = &$store->user->open ($me->name); $user['status'] = $formulary->data['status']; if (isset ($formulary->data['password'])) { // update password $user['password'] = $formulary->data['password']; unset ($data['password']); } // update password } // update status $formulary->errorMsg = 'systemFormulary_alertDataUpdated'; } // save $formulary->data['name'] = $me->name; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataMerge ('adminUser_details_content'); // Context Remove $document->mod->context->appendChild ('adminUser_details_remove' . $gender) ->confirm ('adminUser_details_removeConfirm' . $gender, $remove); } // function dispatch static function action_remove ($document) { // function action_remove global $io, $store; $me = $document->application; $id = $me->userId; $io->database->delete ($store->userContent, array ('user_id' => $id)); $io->database->delete ($store->domainGroup, array ('user_id' => $id)); $io->database->delete ($store->userFriend, array ('user_id' => $id)); $io->database->delete ($store->userFriend, array ('friend_id' => $id)); $io->database->delete ($store->userSubscription, array ('user_id' => $id)); $store->user->delete ($id); foreach (scandir (FOLDER_PROFILES . $me->name) as $filename) { // each user file if (is_file (FOLDER_PROFILES . $me->name . '/' . $filename)) unlink (FOLDER_PROFILES . $me->name . '/' . $filename); } // each user file rmdir (FOLDER_PROFILES . $me->name); // returns to parent page $parent = $me->parent; $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->ref (); } // function action_remove } // class eclApp_adminUser_details //!eof:library/adminUser/details/eclApp_adminUser_details.php; //!file:library/adminUser/eclApp_adminUser.php; class eclApp_adminUser { // class eclApp_adminUser static function is_child ($me, $name) { // function is_child if ($name == 'users') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('users'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $io, $store; $me->data = $store->control->read ('adminUser_content'); if ($io->database->tableEnabled ($store->user) and is_dir (FOLDER_PROFILES)) $me->map = array ('adminUser_add', 'adminUser_details', 'adminUser_survey'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; if (!$io->database->tableEnabled ($store->user)) { // disabled $document->dataMerge ('adminUser_contentDisabled'); return; } // disabled if (!is_dir (FOLDER_PROFILES) and !$document->access (4)) { // no folder for visitors $document->dataMerge ('adminUser_contentEmpty'); return; } // no folder for visitors if (!is_dir (FOLDER_PROFILES)) { // create folder $formulary = $document->createFormulary ('adminUser_createFolder', array (), 'createFolder'); if ($formulary->command ('create') and $formulary->save ()) { // create $folder_profiles = FOLDER_ROOT . $io->systemConstants->get ('PATH_PROFILES'); } // create else { // view form $document->mod->formulary = $formulary; return; } // view form } // create folder $document->mod->list = new eclMod_adminUser_list ($document); if (!isset ($folder_profiles)) $folder_profiles = FOLDER_PROFILES; if (count (scandir ($folder_profiles)) == 2) { // empty $document->dataMerge ('adminUser_contentEmpty'); return; } // empty if ($document->access (4)) { // admin access if ($document->actions ('user', 'update', 'request')) self::action_update_request ($document); $document->mod->context->appendChild ('adminUser_updateRequest') ->ref (true, true, '_user-update-request') ->confirm ('adminUser_updateRequestConfirm'); } // admin access } // function dispatch static function action_update_request ($document) { // function action_update_request if (isset ($document->received['action_confirm_ok']) and $document->received['action_confirm_ok'] == 'ok') { // ok foreach ($store->user->childrenNames () as $name) { // each name $user = &$store->user->open ($name); if (! ($user['status']&STATUS_UPDATE)) $user['status'] += STATUS_UPDATE; unset ($user); } // each name $document->mod->humperstilshen->alert ('systemFormulary_alertDataUpdated'); } // ok else $document->mod->humperstilshen->alert ('adminUser_updateRequestError'); } // function action_update_request } // class eclApp_adminUser //!eof:library/adminUser/eclApp_adminUser.php; //!file:library/adminUser/eclMod_adminUser_list.php; class eclMod_adminUser_list { // class eclMod_adminUser_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $row = $mod->appendChild(); if ($document->access (4)) { // access $pathway = $document->application->pathway; // User add $user_pathway = $pathway; $user_pathway[] = '-new-user'; $row->appendChild ('adminUser_add_content') ->virtual () ->ref ($user_pathway); } // access else $pathway = array (SYSTEM_PROFILES_URI); if (is_dir (PATH_PROFILES)) $names = $store->user->childrenNames (); else $names = array (); foreach ($names as $name) { // each name $userId = $store->user->getId ($name); $data = $store->userContent->open ($userId, '-register'); $user_pathway = $pathway; $user_pathway[] = $name; $row->appendChild ($data) ->swapTitle () ->ref ($user_pathway); } // each name $mod->data = $store->control->read ('modList_module'); $mod->enabled = true; } // function setModule } // class eclMod_adminUser_list //!eof:library/adminUser/eclMod_adminUser_list.php; //!file:library/adminUser/survey/eclApp_adminUser_survey.php; class eclApp_adminUser_survey { // class eclApp_adminUser_survey static function is_child ($me, $name) { // function is_child if ($name == '-survey') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names () { // function get_children_names global $store; foreach ($store->user->childrenNames () as $name) { // each user $status = $store->user->getStatus ($name); if ($status&STATUS_SURVEY) return array ('-survey'); } // each user return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminUser_survey'); $n = 0; foreach ($store->user->childrenNames () as $name) { // each user $status = $store->user->getStatus ($name); if ($status&STATUS_SURVEY) $n++; } // each user $me->data['number'] = $n; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $formulary = $document->createFormulary ('adminUser_survey'); if ($formulary->save ()) $document->data['number'] = $formulary->data['number']; if ($document->data['number']) $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminUser_survey //!eof:library/adminUser/survey/eclApp_adminUser_survey.php; //!file:library/adminUser/survey/eclFilter_adminUser_survey.php; /* * Control flags * control_type */ class eclFilter_adminUser_survey { // class eclFilter_adminUser_survey static function create ($fieldName, $control, $formulary) { // function create global $store; foreach ($store->user->childrenNames () as $name) { // each child name $user = $store->user->open ($name); if (! ($user['status']&STATUS_SURVEY)) continue; $data = $store->userContent->open ($user['id'], '-register'); $local = array ( 'type' => 'checkbox', 'name' => $fieldName . '_' . $user['id'], 'value' => 1 ); $formulary->appendChild ($data, $local) ->ref (array (SYSTEM_ADMIN_URI, 'users', $name)); } // each child name } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $n = 0; foreach ($store->user->childrenNames () as $name) { // each name $user = &$store->user->open ($name); if ( ($user['status']&STATUS_SURVEY) and isset ($formulary->received[$fieldName . '_' . $user['id']])) { // valid if ($formulary->command ('accept')) $user['status'] -= STATUS_SURVEY; elseif ($formulary->command ('block')) { // block $user['status'] -= STATUS_SURVEY; if (! ($user['status']&STATUS_REMOVED)) $user['status'] += STATUS_REMOVED; } // block } // valid if ($user['status']&STATUS_SURVEY) $n++; unset ($user); } // each name $formulary->data['number'] = $n; } // function save } // class eclFilter_adminUser_survey //!eof:library/adminUser/survey/eclFilter_adminUser_survey.php; //!file:library/dialog/eclApp_dialog.php; class eclApp_dialog { // class eclApp_dialog static function is_child ($me, $name) { // function is_child if ($name == '-dialog') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-dialog'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_dialog //!eof:library/dialog/eclApp_dialog.php; //!file:library/dialog/eclApp_dialog_media.php; class eclApp_dialog_media { // class eclApp_dialog_media static function is_child ($me, $name) { // function is_child switch ($name) { // switch name case 'audio': case 'box': case 'dinamic': case 'file': case 'html': case 'img': case 'video': return true; } // switch name return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('html'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('mod' . ucfirst ($me->name) . '_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $target = $document->application->name; $name = array_pop ($document->pathway); $parts = explode (CHR_FNS, $name); if (count ($parts) == 2) list ($name, $number) = $parts; else $number = '0'; if ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // search $me = $document->domain; foreach (array_slice ($document->pathway, 3) as $folder) { // each folder $me = $me->child ($folder); if (!$me) return; } // each folder $me = $me->child ($name); if (!$me) return; } // search if (!$document->access (4, $me->groups) or !$me->id) return; $document->pathway[] = $name . CHR_FNS . $number; if (isset ($document->received['save']) and $document->received['save'] == 'remove') { // remove $document->dataReplace ('dialog_close'); if (!isset ($me->data['extras'][$target . '_' . $number][$target])) return; $file = FOLDER_DOMAINS . $document->domain->name . '/' . $me->data['extras'][$target . '_' . $number][$target]; unlink ($file); unset ($me->data['extras'][$target . '_' . $number]); return; } // remove if (isset ($me->data['extras'][$target . '_' . $number])) $data = $me->data['extras'][$target . '_' . $number]; else $data = $store->control->read ('mod' . ucfirst ($target) . '_module'); $formulary = $document->createFormulary ('mod' . ucfirst($target) . '_edit', $data); $formulary->pathway = $document->pathway; if ($document->actions('return', 'tag')) $formulary->action = '_return-tag'; $formulary->flags['target_name'] = $me->data['name']; $formulary->flags['target_index'] = $number; $formulary->multipart = true; if ($formulary->save ()) { // save formulary $me->data['extras'][$target . '_' . $number] = $formulary->data; $document->dataReplace ('dialog_close'); if ($document->actions ('return', 'tag')) $document->data['module'] = $target . ':' . $number; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_dialog_media //!eof:library/dialog/eclApp_dialog_media.php; //!file:library/dialog/eclApp_dialog_mediaUpload.php; class eclApp_dialog_mediaUpload { // class eclApp_dialog_mediaUpload static function is_child ($me, $name) { // function is_child switch ($name) { // switch name case 'audio_upload': case 'img_upload': case 'file_upload': case 'video_upload': return true; } // switch name return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('audio'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; list ($target) = explode ('_', $me->name); $me->data = $store->control->read ('mod' . ucfirst ($target) . '_upload'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; list ($target) = explode ('_', $me->name); $name = array_pop ($document->pathway); $parts = explode (CHR_FNS, $name); if (count ($parts) == 2) list ($name, $number) = $parts; else $number = '0'; if ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // search $me = $document->domain; foreach (array_slice ($document->pathway, 3) as $folder) { // each folder $me = $me->child ($folder); if (!$me) return; } // each folder $me = $me->child ($name); if (!$me) return; } // search if (!$document->access (4, $me->groups) or !$me->id) return; $document->pathway[] = $name . CHR_FNS . $number; if (isset ($me->data['extras'][$target . '_' . $number])) $data = $me->data['extras'][$target . '_' . $number]; else $data = $store->control->read ('mod' . ucfirst ($target) . '_module'); $formulary = $document->createFormulary ('mod' . ucfirst ($target) . '_upload', $me->data); $formulary->pathway = $document->pathway; $formulary->action = '_save'; if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('dialog_cancel'); return; } // cancel if (isset ($document->actions['save'])) { // save formulary ini_set ('upload_max_filesize', '256M'); $document->buffer ='Ok'; if (!isset ($_FILES['file']['type']) or !$_FILES['file']['type']) return; $uploaded = $_FILES['file']['tmp_name']; $ext = strtolower (end (explode ('.', $_FILES['file']['name']))); $filename = $name . CHR_FNS . $target . '_' . $number . '.' . $ext; $path = FOLDER_DOMAINS . $document->domain->name . '/' . $filename; move_uploaded_file ($uploaded, $path); $me->data['extras'][$target . '_' . $number] = array ( $target => $filename, 'size' => $_FILES['file']['size'], 'plays' => 0, 'downloads' => 0, 'filename' => $_FILES['file']['name'] ); return; } // save formulary $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_dialog_mediaUpload //!eof:library/dialog/eclApp_dialog_mediaUpload.php; //!file:library/dialog/simple/eclApp_dialog_simple.php; class eclApp_dialog_simple { // class eclApp_dialog_simple static function is_child ($me, $name) { // function is_child if ( $name == 'background' or $name == 'border' or $name == 'color' or $name == 'font' or $name == 'paragraph' ) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('background', 'border', 'color', 'font', 'paragraph'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialog_simple_' . $me->name); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_dialog_simple //!eof:library/dialog/simple/eclApp_dialog_simple.php; //!file:library/dialogDetails/configure/eclApp_dialogDetails_configure.php; class eclApp_dialogDetails_configure { // class eclApp_dialogDetails_configure static function is_child ($me, $name) { // function is_child return true; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogDetails_configure_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_dialogDetails //!eof:library/dialogDetails/configure/eclApp_dialogDetails_configure.php; //!file:library/dialogDetails/eclApp_dialogDetails.php; class eclApp_dialogDetails { // class eclApp_dialogDetails static function is_child ($me, $name) { // function is_child if ($name == 'details') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('details'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogDetails_main'); $me->map = array ('dialogDetails_configure'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_dialogDetails_list ($document); } // function dispatch } // class eclApp_dialogDetails //!eof:library/dialogDetails/eclApp_dialogDetails.php; //!file:library/dialogDetails/eclMod_dialogDetails_list.php; class eclMod_dialogDetails_list { // class eclMod_dialogDetails_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; foreach ($store->control->scandir ('s', 'details') as $name) { // each detail $data = $store->control->read ('details/' . $name . '/_description'); if (!$data) continue; $data['name'] = $name; $mod->appendChild ($data); } // each detail $mod->enabled = true; } // function setModule } // class eclMod_dialogDetails_list //!eof:library/dialogDetails/eclMod_dialogDetails_list.php; //!file:library/dialogFields/checkbox/eclInteractive_dialogFields_checkbox.php; class eclInteractive_dialogFields_checkbox { // class eclInteractive_dialogFields_checkbox static function create ($fieldName, $control, $name, $formulary) { // function create $local = $control; $local['type'] = 'checkbox_create'; $local['name'] = $fieldName; if (isset ($formulary->data[$name]['value']) and $formulary->data[$name]['value']) $local['value'] = 1; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $name, $formulary) { // function save if (isset ($formulary->received[$fieldName])) $formulary->data[$name]['value'] = 1; else $formulary->data[$name]['value'] = 0; } // function save static function interact ($fieldName, $control, &$data, $formulary) { // function interact $local['type'] = ''; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $name, $formulary) { // function view global $store; $control['type'] = 'view'; if (isset ($formulary->data[$name]['value']) and $formulary->data[$name]['value']) $label = $store->control->read ('dialogFields_checkbox_valueYes'); else $label = $store->control->read ('dialogFields_checkbox_valueNo'); $control['content'] = $label['text']['caption']; $formulary->appendChild ($control); } // function view } // class eclInteractive_dialogFields_checkbox //!eof:library/dialogFields/checkbox/eclInteractive_dialogFields_checkbox.php; //!file:library/dialogFields/description/eclInteractive_dialogFields_description.php; class eclInteractive_dialogFields_description { // class eclInteractive_dialogFields_description static function create ($fieldName, $control, $data, $formulary) { // function create $control['type'] = 'description'; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $data, $formulary) { // function save } // function save static function interact ($fieldName, $control, $data, $formulary) { // function interact $control['type'] = 'description'; $formulary->appendChild ($control); } // function interact static function view ($fieldName, $control, $data, $formulary) { // function view $control['type'] = 'description'; if (!isset ($control['display_when_editing']) or !$control['display_when_editing']) $formulary->appendChild ($control); } // function view } // class eclInteractive_dialogFields_description //!eof:library/dialogFields/description/eclInteractive_dialogFields_description.php; //!file:library/dialogFields/eclApp_dialogFields.php; class eclApp_dialogFields { // class eclApp_dialogFields static function is_child ($me, $name) { // function is_child if ($name == 'fields') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('fields'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogFields_main'); $me->map = array ('dialogFields_config'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('dialogFields_add'); if ($formulary->command ('cancel')) return $document->dataReplace ('dialog_cancel'); $document->mod->formulary = $formulary; $document->mod->list = new eclMod_dialogFields_list ($document); } // function dispatch } // class eclApp_dialogFields //!eof:library/dialogFields/eclApp_dialogFields.php; //!file:library/dialogFields/eclApp_dialogFields_config.php; class eclApp_dialogFields_config { // class eclApp_dialogFields_config static function is_child ($me, $name) { // function is_child global $store; if ($store->control->read ('dialogFields_' . $name . '_content')) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogFields_' . $me->name . '_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; // Add new control if (isset ($document->actions['add'])) return self::action_add ($document); // Load data from main window if (!$document->received) { // load $document->dataReplace ('dialogFields_load'); $document->data['ref'] = $document->ref (); return; } // load $data = array (); if (isset ($document->received['field_content'])) { // receive packed content $value = str_replace (array ('#r', '#n', '#q', '#c'), array ("\r", "\n", '"', '#'), $document->received['field_content']); $data = eclIo_file::string2array ($value); } // receive packed content $formulary = $document->createFormulary ('dialogFields_' . $me->name . '_edit', $data); if (isset ($document->received['field_name'])) $formulary->hidden['field_name'] = $document->received['field_name']; if (isset ($document->received['field_content'])) $formulary->hidden['field_content'] = $document->received['field_content']; if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('dialog_cancel'); return; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $document->dataReplace ('dialogFields_close'); $document->data['field_name'] = $formulary->received['field_name']; $document->data['field_caption'] = $formulary->data['caption']; $document->data['field_filter'] = $formulary->data['filter']; $document->data['field_content'] = str_replace (array ('#', "\r", "\n", '"'), array ('#c', '#r', '#n', '#q'), eclIo_file::array2string ($formulary->data)); $document->data['field_replace'] = "true"; return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch static function action_add ($document) { // function action_add global $store; $me = $document->application; $data = $store->control->read ('dialogFields_' . $me->name . '_preset'); $formulary = $document->createFormulary ('dialogFields_' . $me->name . '_edit', $data); $formulary->action = '_add'; if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('dialog_cancel'); return; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $document->dataReplace ('dialogFields_close'); $document->data['field_name'] = $me->name; $document->data['field_caption'] = $formulary->data['caption']; $document->data['field_filter'] = $formulary->data['filter']; $document->data['field_content'] = str_replace (array ('#', "\r", "\n", '"'), array ('#c', '#r', '#n', '#q'), eclIo_file::array2string ($formulary->data)); return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function action_add } // class eclApp_dialogFields_config //!eof:library/dialogFields/eclApp_dialogFields_config.php; //!file:library/dialogFields/eclInteractive_dialogFields_end.php; class eclInteractive_dialogFields_end { // class eclInteractive_dialogFields_end static function create ($fieldName, $control, $data, $formulary) { // function create $local['name'] = $fieldName; $local['type'] = 'end_create'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $data, $formulary) { // function save } // function save static function interact ($fieldName, $control, $data, $formulary) { // function interact $local['type'] = 'end_view'; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $data, $formulary) { // function view $local['type'] = 'end_view'; $formulary->appendChild ($local); } // function view } // class eclInteractive_dialogFields_end //!eof:library/dialogFields/eclInteractive_dialogFields_end.php; //!file:library/dialogFields/eclInteractive_dialogFields_start.php; class eclInteractive_dialogFields_start { // class eclInteractive_dialogFields_start static function create ($fieldName, $control, $data, $formulary) { // function create $local['type'] = 'start_create'; $local['ref'] = $formulary->document->ref (true, true, $formulary->action); $local['prefix'] = $formulary->prefix; $local['time'] = TIME; $local['password'] = md5 (TIME . $formulary->prefix . ADMIN_PASSWORD . session_id ()); $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $data, $formulary) { // function save // User is connected if ($formulary->document->user->userId) return; // Hanney pot if (isset ($formulary->received[$formulary->prefix . '_command_mail']) and strlen ($formulary->received[$formulary->prefix . '_command_mail'])) return $formulary->setErrorMsg (false, array (), 'systemFormulary_alertRobotsPrevent'); if (!isset ($formulary->received[$formulary->prefix . '_command_time'])) return $formulary->setErrorMsg (false, array (), 'systemFormulary_alertRobotsPrevent'); $time = intval ($formulary->received[$formulary->prefix . '_command_time']); // Time left up to 60 minutes if ($time + SYSTEM_SESSION_TTL + 60 < TIME) return $formulary->setErrorMsg (false, array (), 'systemFormulary_alertRobotsPrevent'); // time left less than 5 seconds if ($time + 5 > TIME) return $formulary->setErrorMsg (false, array (), 'systemFormulary_alertRobotsPrevent'); // Probably javascript disabled if (!isset ($formulary->received[$formulary->prefix . '_command_password'])) return $formulary->setErrorMsg (false, array (), 'systemFormulary_alertRobotsPrevent'); $password = $formulary->received[$formulary->prefix . '_command_password']; if ($password != md5 ($time . $formulary->prefix . ADMIN_PASSWORD . session_id ())) return $formulary->setErrorMsg (false, array (), 'systemFormulary_alertRobotsPrevent'); // check IP tracking } // function save static function interact ($fieldName, $control, $data, $formulary) { // function interact $local['type'] = 'start_view'; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $data, $formulary) { // function view $local['type'] = 'start_view'; $formulary->appendChild ($local); } // function view } // class eclInteractive_dialogFields_start //!eof:library/dialogFields/eclInteractive_dialogFields_start.php; //!file:library/dialogFields/eclMod_dialogFields_list.php; class eclMod_dialogFields_list { // class eclMod_dialogFields_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('modList_module'); $list = array ( 'text', 'textarea', 'checkbox', 'select', 'radio', 'separator', 'description', 'mail' ); foreach ($list as $type) { // each type $pathway = $me->pathway; $pathway[] = $type; $mod->appendChild ('dialogFields_' . $type . '_content') ->ref ($pathway, true, '_add'); } // each type $mod->enabled = true; } // function setModule } // class eclMod_dialogFields_list //!eof:library/dialogFields/eclMod_dialogFields_list.php; //!file:library/dialogFields/mail/eclInteractive_dialogFields_mail.php; class eclInteractive_dialogFields_mail { // class eclInteractive_dialogFields_mail static function create ($fieldName, $control, $name, $formulary) { // function create static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); static $cs = array ('UTF-8', 'ISO-8859-1'); $document = $formulary->document; $lang = $document->lang; $charset = $document->charset; $local = $control; if (!isset ($local['type'])) $local['type'] = 'text'; $local['name'] = $fieldName; if (isset ($formulary->data[$name]['value'])) $local['value'] = $formulary->data[$name]['value']; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $name, $formulary) { // function save if (!isset ($formulary->received[$fieldName]) or !strlen ($formulary->received[$fieldName])) { // empty if (isset ($control['required']) and $control['required']) return $formulary->setRequiredMsg ($control, $fieldName); unset ($formulary->data[$name]['value']); return; } // empty if (preg_match ('/^[a-zA-Z0-9._-]+[@][a-zA-Z0-9_-]+[.][a-zA-Z0-9._-]+[;].+/', $formulary->received[$fieldName])) $formulary->setErrorMsg ($control, $fieldName, 'dialogFields_mail_alertMultipleNotAllowed'); if (!preg_match ('/^[a-zA-Z0-9._-]+[@][a-zA-Z0-9_-]+[.][a-zA-Z0-9._-]+$/', $formulary->received[$fieldName])) $formulary->setErrorMsg ($control, $fieldName, 'dialogFields_mail_alertInvalidMail', $formulary->received[$fieldName]); $formulary->data[$name]['value'] = $formulary->received[$fieldName]; } // function save static function interact ($fieldName, $control, &$data, $formulary) { // function interact $local['type'] = ''; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $name, $formulary) { // function view $control['type'] = 'view'; if (isset ($formulary->data[$name]['value'])) $control['content'] = $document->textMerge ($formulary->data[$name]['value']); $formulary->appendChild ($control); } // function view } // class eclInteractive_dialogFields_mail //!eof:library/dialogFields/mail/eclInteractive_dialogFields_mail.php; //!file:library/dialogFields/radio/eclInteractive_dialogFields_radio.php; class eclInteractive_dialogFields_radio extends eclInteractive_dialogFields_select { // class eclInteractive_dialogFields_radio } // class eclInteractive_dialogFields_radio //!eof:library/dialogFields/radio/eclInteractive_dialogFields_radio.php; //!file:library/dialogFields/select/eclFilter_dialogFields_select.php; class eclFilter_dialogFields_select { // class eclFilter_dialogFields_select static function create ($fieldName, $control, $formulary) { // function create static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); static $cs = array ('UTF-8', 'ISO-8859-1'); $document = $formulary->document; $lang = $document->lang; $charset = $document->charset; for ($index = 1; $index <= 20; $index++) { // each field $local = array ( 'caption' => $document->textMerge ('#' . $index), 'name' => $fieldName . $index, 'type' => 'text_small' ); $item = $formulary->appendChild ($local); if (!isset ($formulary->data['options'][$index])) continue; $text = $formulary->data['options'][$index]; if (isset ($text[$lang])) $found = $text[$lang]; else $found = current ($text); if (!isset ($found[TEXT_CONTENT])) continue; if (!isset ($found[TEXT_CHARSET])) $found[TEXT_CHARSET] = 0; if ($charset != $cs[$found[TEXT_CHARSET]]) $value = mb_convert_encoding ($found[TEXT_CONTENT], $charset, $cs[$found[TEXT_CHARSET]]); else $value = $found[TEXT_CONTENT]; $item->data['value'] = str_replace ($s, $r, $value); } // each field } // function create static function save ($fieldName, $control, $formulary) { // function save $document = $formulary->document; $received = $formulary->received; $formulary->data['options'] = array (); for ($index = 0; $index <= 20; $index++) { // each option if (!isset ($received[$fieldName . $index]) or !strlen ($received[$fieldName . $index])) continue; $formulary->data['options'][$index] = array ($document->lang => array (TEXT_CONTENT => $received[$fieldName . $index])); if ($document->charset == 'ISO-8859-1') $formulary->data['options'][$index][$document->lang][TEXT_CHARSET] = 1; } // each option } // function save } // class eclFilter_dialogFields_select //!eof:library/dialogFields/select/eclFilter_dialogFields_select.php; //!file:library/dialogFields/select/eclInteractive_dialogFields_select.php; class eclInteractive_dialogFields_select { // class eclInteractive_dialogFields_select static function create ($fieldName, $control, $data, $formulary) { // function create $local = $control; if (!isset ($local['type'])) $local['type'] = 'select'; $local['type'] .= '_create'; $local['name'] = $fieldName; if (isset ($data['value'])) $value = $data['value']; else $value = false; $select = $formulary->appendChild ($local); if (isset ($control['options'])) { // options exists foreach ($control['options'] as $name => $caption) { // each option $data = array ( 'name' => $fieldName, 'value' => $name, 'caption' => $caption ); if ($name == $value) $data['active'] = 1; $select->appendChild ($data); } // each option } // options exists } // function create static function save ($fieldName, $control, $name, $formulary) { // function save if (isset ($formulary->received[$fieldName])) $formulary->data[$name]['value'] = $formulary->received[$fieldName]; } // function save static function interact ($fieldName, $control, &$data, $formulary) { // function interact $local['type'] = ''; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $name, $formulary) { // function view $control['type'] = 'view'; $item = $formulary->appendChild ($control); if (!isset ($formulary->data[$name]['value'])) return; $value = $formulary->data[$name]['value']; if (!isset ($control['options'][$value])) return; $item->data['content'] = $control['options'][$value]; } // function view } // class eclInteractive_dialogFields_select //!eof:library/dialogFields/select/eclInteractive_dialogFields_select.php; //!file:library/dialogFields/separator/eclInteractive_dialogFields_separator.php; class eclInteractive_dialogFields_separator { // class eclInteractive_dialogFields_separator static function create ($fieldName, $control, $data, $formulary) { // function create $local['type'] = 'separator'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $data, $formulary) { // function save } // function save static function interact ($fieldName, $control, $data, $formulary) { // function interact $local['type'] = 'separator'; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $data, $formulary) { // function view $local['type'] = 'separator'; $formulary->appendChild ($local); } // function view } // class eclInteractive_dialogFields_separator //!eof:library/dialogFields/separator/eclInteractive_dialogFields_separator.php; //!file:library/dialogFields/text/eclInteractive_dialogFields_text.php; class eclInteractive_dialogFields_text { // class eclInteractive_dialogFields_text static function create ($fieldName, $control, $name, $formulary) { // function create static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); static $cs = array ('UTF-8', 'ISO-8859-1'); $document = $formulary->document; $lang = $document->lang; $charset = $document->charset; $local = $control; if (!isset ($local['type'])) $local['type'] = 'text'; $local['name'] = $fieldName; $item = $formulary->appendChild ($local); if (!isset ($formulary->data[$name]['value'])) return; $text = $formulary->data[$name]['value']; if (isset ($text[$lang])) $found = $text[$lang]; else $found = current ($text); if (!isset ($found[TEXT_CONTENT])) return; if (!isset ($found[TEXT_CHARSET])) $found[TEXT_CHARSET] = 0; if ($charset != $cs[$found[TEXT_CHARSET]]) $value = mb_convert_encoding ($found[TEXT_CONTENT], $charset, $cs[$found[TEXT_CHARSET]]); else $value = $found[TEXT_CONTENT]; $item->data['value'] = str_replace ($s, $r, $value); } // function create static function save ($fieldName, $control, $name, $formulary) { // function save if (!isset ($formulary->received[$fieldName]) or !strlen ($formulary->received[$fieldName])) { // empty if (isset ($control['required']) and $control['required']) $formulary->setRequiredMsg ($control, $fieldName); return; } // empty $formulary->data[$name]['value'] = array ($formulary->document->lang => array (TEXT_CONTENT => $formulary->received[$fieldName])); if ($formulary->document->charset == 'ISO-8859-1') $formulary->data[$name]['value'][$formulary->document->lang][TEXT_CHARSET] = 1; } // function save static function interact ($fieldName, $control, &$data, $formulary) { // function interact $local['type'] = ''; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $name, $formulary) { // function view $control['type'] = 'view'; if (isset ($formulary->data[$name]['value'])) $control['content'] = $formulary->data[$name]['value']; $formulary->appendChild ($control); } // function view } // class eclInteractive_dialogFields_text //!eof:library/dialogFields/text/eclInteractive_dialogFields_text.php; //!file:library/dialogFields/textarea/eclInteractive_dialogFields_textarea.php; class eclInteractive_dialogFields_textarea { // class eclInteractive_dialogFields_textarea static function create ($fieldName, $control, $name, $formulary) { // function create static $s = array ('&', '<', '"'); static $r = array ('&', '<', '"'); static $cs = array ('UTF-8', 'ISO-8859-1'); $document = $formulary->document; $lang = $document->lang; $charset = $document->charset; $local = $control; if (!isset ($local['type'])) $local['type'] = 'textarea'; $local['name'] = $fieldName; $item = $formulary->appendChild ($local); if (!isset ($formulary->data[$name]['value'])) return; $text = $formulary->data[$name]['value']; if (isset ($text[$lang])) $found = $text[$lang]; else $found = current ($text); if (!isset ($found[TEXT_CONTENT])) return; if (!isset ($found[TEXT_CHARSET])) $found[TEXT_CHARSET] = 0; if ($charset != $cs[$found[TEXT_CHARSET]]) $value = mb_convert_encoding ($found[TEXT_CONTENT], $charset, $cs[$found[TEXT_CHARSET]]); else $value = $found[TEXT_CONTENT]; $item->data['value'] = str_replace ($s, $r, $value); } // function create static function save ($fieldName, $control, $name, $formulary) { // function save if (!isset ($formulary->received[$fieldName]) or !strlen ($formulary->received[$fieldName])) { // empty if (isset ($control['required']) and $control['required']) $formulary->setRequiredMsg ($control, $fieldName); return; } // empty $formulary->data[$name]['value'] = array ($formulary->document->lang => array (TEXT_CONTENT => $formulary->received[$fieldName])); if ($formulary->document->charset == 'ISO-8859-1') $formulary->data[$name]['value'][$formulary->document->lang][TEXT_CHARSET] = 1; } // function save static function interact ($fieldName, $control, &$data, $formulary) { // function interact $local['type'] = ''; $formulary->appendChild ($local); } // function interact static function view ($fieldName, $control, $name, $formulary) { // function view $control['type'] = 'view_pre'; if (isset ($formulary->data[$name]['value'])) $control['content'] = $formulary->data[$name]['value']; $formulary->appendChild ($control); } // function view } // class eclInteractive_dialogFields_textarea //!eof:library/dialogFields/textarea/eclInteractive_dialogFields_textarea.php; //!file:library/dialogLink/eclApp_dialogLink.php; class eclApp_dialogLink { // class eclApp_dialogLink static function is_child ($me, $name) { // function is_child if ($name == 'link') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('link'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogLink_main'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $document->data['id'] = 'temp' . TIME; $document->data['ref'] = $document->ref (array ($document->domain->name, '-dialog', 'link'), true, '_id-temp' . TIME); } // function dispatch } // class eclApp_dialogLink //!eof:library/dialogLink/eclApp_dialogLink.php; //!file:library/dialogList/eclApp_dialogList.php; class eclApp_dialogList { // class eclApp_dialogList static function is_child ($me, $name) { // function is_child if ($name == 'list') return true; if (substr ($name, 0, 5) == 'list_') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('list'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogList_edit'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; if (!$document->access (4, $document->domain->groups)) return; // 1. Recupera o nome da lista if (!isset ($document->actions['personalite'])) { // load list name $document->mod->layout->fromcontrol ('dialogList_load'); $document->data['ref'] = $document->ref (true, true, '_personalite'); } // load list name if (!isset ($document->received['list_name'])) return; // 2. Consulta as opções de configuração $name = $document->received['list_name']; $controlName = 'lists/' . $name . '/_description'; if (!$store->control->read ($controlName)) { // list not editable $document->mod->layout->fromControl ('dialogList_notEditable'); return; } // list not editable // 3. Carrega as definições $template = &$io->file->open (FOLDER_DOMAINS . $document->domain->name . '/.templates.ecl.php'); if (isset ($document->received['list_content']) and strlen ($document->received['list_content'])) $data = $document->received['list_content']; elseif (isset ($template['lists/' . $name])) $data = $template['lists/' . $name]; else $data = $store->control->read ('lists/' . $name); $formulary = $document->createFormulary ($controlName, $data, 'list'); $formulary->hidden['list_name'] = $name; $formulary->action = '_personalite-save'; if ($document->actions ('personalite', 'save') and $formulary->save ()) { // save formulary if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore if (!isset ($document->received['apply']) or $document->received['apply'] != 'module') unset ($template['lists/' . $name]); $document->mod->layout->fromControl ('dialogList_close'); $document->data['list_name'] = $name; return; } // restore if (isset ($document->received['apply']) and $document->received['apply'] == 'module') { // apply to module $document->mod->layout->fromControl ('dialogList_close'); $me->data['list_name'] = $name; $in = array ('#', '"', '<', '&', '\\'); $out = array ('#C', '#Q', '#L', '#A', '#B'); $document->data['list_content'] = str_replace ($in, $out, $io->file->array2string ($formulary->data)); return; } // apply to module $template['lists/' . $name] = $formulary->data; $document->mod->layout->fromControl ('dialogList_close'); $document->data['list_name'] = $name; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataMerge ('dialogList_tabs'); if (isset ($document->received['list_content']) and strlen ($document->received['list_content'])) $document->data['apply_to_module'] = 1; else $document->data['apply_to_default'] = 1; } // function dispatch } // class eclApp_dialogList //!eof:library/dialogList/eclApp_dialogList.php; //!file:library/dialogModule/eclApp_dialogModule.php; class eclApp_dialogModule { // class eclApp_dialogModule static function is_child ($me, $name) { // function is_child if (substr ($name, 0, 4) == 'mod_') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('mod'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogModule_edit'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $name = substr ($me->name, 4); if (!strlen ($name)) return; if (!$document->access (4)) return; list ($prefix) = explode ('_', $name); $controlName = 'mod' . ucfirst ($prefix) . '_edit'; $control = $store->control->read ($controlName); if ($control) { // set module title if (!isset ($control['text']['title']) and isset ($control['text']['caption'])) $control['text']['title'] = $control['text']['caption']; $me->data['text']['title'] = $control['text']['title']; } // set module title else { // no configurable $document->dataMerge ('dialogModule_contentNotConfigurable'); $formulary = $document->createFormulary ('dialogModule_contentNotConfigurable', array(), 'not_configurable'); if ($formulary->command ('cancel')) return $document->dataReplace ('dialog_cancel'); $document->mod->formulary = $formulary; return; } // no configurable $saved = &$store->domainContent->open ($me->domainId, 'modules/' . $name); if ($saved) $data = $saved; else $data = $store->control->read ('mod' . ucfirst ($name) . '_module'); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations if ($saved) $store->domainContent->delete ($me->domainId, $saved['id']); return $document->dataReplace ('dialog_close'); } // restore default configurations $formulary = $document->createFormulary ($controlName, $data); if ($formulary->save ()) { // save formulary if ($saved) $saved = $formulary->data; else { // create saved module $data['mode'] = MODE_TEMPLATE; $data['name'] = 'modules/' . $name; $store->domainContent->insert ($me->domainId, $data); } // create saved module $document->dataReplace ('dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_dialogModule //!eof:library/dialogModule/eclApp_dialogModule.php; //!file:library/dialogTemplate/advanced/eclApp_dialogTemplate_advanced.php; class eclApp_dialogTemplate_advanced { // class eclApp_dialogTemplate_advanced static function is_child ($me, $name) { // function is_child if ($name == 'advanced') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('advanced'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogTemplate_advanced_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; $template = &$store->domainContent->open ($me->domainId, '-layouts-default'); if ($template) $data = $template['local']; else $data = $store->control->read ('layouts/default'); unset ($data['parsed']); $formulary = $document->createFormulary ('dialogTemplate_advanced_edit', $data); if ($formulary->save ()) { // save formulary if ($template) { // update $template['local'] = $formulary->data; $template['updated'] = TIME; } // update else { // create $data = array ( 'mode' => MODE_TEMPLATE, 'name' => '-layouts-default', 'local' => $formulary->data ); $store->domainContent->insert ($me->domainId, $data); } // create $document->dataReplace ('dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_dialogTemplate_advanced //!eof:library/dialogTemplate/advanced/eclApp_dialogTemplate_advanced.php; //!file:library/dialogTemplate/custom/eclApp_dialogTemplate_custom.php; class eclApp_dialogTemplate_custom { // class eclApp_dialogTemplate_custom static function is_child ($me, $name) { // function is_child if ($name == 'custom') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('custom'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogTemplate_custom_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_dialogTemplate_custom //!eof:library/dialogTemplate/custom/eclApp_dialogTemplate_custom.php; //!file:library/dialogTemplate/eclApp_dialogTemplate.php; class eclApp_dialogTemplate { // class eclApp_dialogTemplate static function is_child ($me, $name) { // function is_child if ($name == 'template') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('template'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('dialogTemplate_advanced_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; $template = &$store->domainContent->open ($me->domainId, '-layouts-default'); if ($template) $data = $template['local']; else $data = $store->control->read ('layouts/default'); unset ($data['parsed']); $formulary = $document->createFormulary ('dialogTemplate_advanced_edit', $data); if ($formulary->save ()) { // save formulary if ($template) { // update $template['local'] = $formulary->data; $template['updated'] = TIME; } // update else { // create $data = array ( 'mode' => MODE_TEMPLATE, 'name' => '-layouts-default', 'local' => $formulary->data ); $store->domainContent->insert ($me->domainId, $data); } // create $document->dataReplace ('dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_dialogTemplate //!eof:library/dialogTemplate/eclApp_dialogTemplate.php; //!file:library/dialogTemplate/eclFilter_dialogTemplate_CSS.php; class eclFilter_dialogTemplate_CSS { // class eclFilter_dialogTemplate_CSS static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $item = $formulary->appendChild (); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'textarea_full'; $data = $store->domainContent->open ($me->domainId, '-styles-main'); if (isset ($data['local']['html'])) $value = $data['local']['html']; else { // from default $default = $store->control->read ('domainStylesheet_style'); $value = $default['html']; } // default value $item->data['value'] = $formulary->htmlSpecialChars ($value); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $me = $formulary->document->application; $received = $formulary->received; $data = &$store->domainContent->open ($me->domainId, '-styles-main'); if (isset ($received[$fieldName]) and strlen ($received[$fieldName])) { // received data if ($data) { // update $data['local']['html'] = $received[$fieldName]; return; } // update $data['mode'] = MODE_TEMPLATE; $data['name'] = '-styles-main'; $data['local']['html'] = $received[$fieldName]; $store->domainContent->insert ($me->domainId, $data); return; } // received data unset ($data['local']['html']); } // function save } // class eclFilter_dialogTemplate_CSS //!eof:library/dialogTemplate/eclFilter_dialogTemplate_CSS.php; //!file:library/dialogTemplate/eclFilter_dialogTemplate_CSSVars.php; class eclFilter_dialogTemplate_CSSVars { // class eclFilter_dialogTemplate_CSSVars static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $me = $document->application; $item = $formulary->appendChild (); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'textarea_full'; $defaults = $store->control->read ('domainStylesheet_preset'); $colors = $store->control->read ('domainStylesheet_colors_default'); $theme = $store->control->read ('domainStylesheet_theme_default'); if ($data = $store->domainContent->open ($me->domainId, '-styles-vars')) $user = $data['local']; else $user = array (); $total = array_replace ($defaults, $theme, $colors, $user); $buffer = ''; foreach ($total as $key => $value) { // each value if ($key[0] == '/') $buffer .= $value . CRLF; else $buffer .= '$' . $key . ': ' . $value . ';' . CRLF; } // each value $item->data['value'] = $formulary->htmlSpecialChars ($buffer); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $received = $formulary->received; $me = $formulary->document->application; if (isset ($received[$fieldName]) and strlen ($received[$fieldName])) $receivedValues = self::extractValues ($received[$fieldName]); else $receivedValues = array (); $defaults = $store->control->read ('domainStylesheet_preset'); $colors = $store->control->read ('domainStylesheet_colors_default'); $theme = $store->control->read ('domainStylesheet_theme_default'); foreach (array_replace ($defaults, $theme, $colors) as $property => $value) { // each value if (isset ($receivedValues[$property]) and $receivedValues[$property] == $value) unset ($receivedValues[$property]); } // each value $data = &$store->domainContent->open ($me->domainId, '-styles-vars'); if ($data) { // already in database $data['local'] = $receivedValues; return; } // already in database if (!$receivedValues) return; $data = array ( 'mode' => MODE_TEMPLATE, 'name' => '-styles-vars', 'local' => $receivedValues ); $store->domainContent->insert ($me->domainId, $data); } // function save private function extractValues ($string) { // function extractValues $values = array (); $userComments = false; $commentIndex = 0; foreach (explode (LF, $string) as $line) { // loop lines $line = trim ($line); if (!isset ($line[0])) { // empty line if (!$userComments) continue; $commentIndex++; $values['/' . $commentIndex] = ''; continue; } // empty line if ($line[0] == '$') { // extract value $line = substr ($line, 1, - 1); list ($key, $value) = explode (':', $line); $values[$key] = trim ($value); continue; } // extract value // list user comments if (!$userComments and $line == '// == User definitions ==') { // start user comments $userComments = true; continue; } // start user comments if (!$userComments) continue; $commentIndex++; $values['/' . $commentIndex] = $line; } // loop lines return $values; } // function extractValues } // class eclFilter_dialogTemplate_CSSVars //!eof:library/dialogTemplate/eclFilter_dialogTemplate_CSSVars.php; //!file:library/dialogTemplate/eclFilter_dialogTemplate_themeSelect.php; class eclFilter_dialogTemplate_themeSelect { // class eclFilter_dialogTemplate_themeSelect static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; $folder = $control['flags']['control_folder']; $value = $formulary->getField ('local/' . $folder); foreach ($store->control->scandir ('s', $folder) as $name) { // each list $data = $store->control->read ($folder . '/' . $name . '/_description'); if (!$data) continue; $data['value'] = $name; $item->appendChild ($data) ->active ($name == $value); } // each list return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; $data = &$formulary->data; if (!isset ($received[$fieldName])) return false; $folder = $control['flags']['control_folder']; $name = $received[$fieldName]; $formulary->setField ('local/' . $folder, $name); } // function save } // class eclFilter_dialogTemplate_themeSelect //!eof:library/dialogTemplate/eclFilter_dialogTemplate_themeSelect.php; //!file:library/domain/disabled/eclApp_domain_disabled.php; class eclApp_domain_disabled { // class eclApp_domain_disabled static function is_child ($me, $name) { // function is_child return true; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->name = ''; $me->data = $store->control->read ('domain_disabled_content'); $me->ignoreSubfolders = true; array_pop ($me->pathway); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_domain_disabled //!eof:library/domain/disabled/eclApp_domain_disabled.php; //!file:library/domain/eclApp_domain.php; class eclApp_domain { // class eclApp_domain static function is_child ($me, $name) { // function is_child global $store; if ($store->domain->getStatus ($name)) return true; if (SYSTEM_HOSTING_MODE == 0 and $name == SYSTEM_DEFAULT_DOMAIN_NAME and $name != SYSTEM_ADMIN_URI and $name != SYSTEM_PROFILES_URI) { // creates the default domain $adminId = $store->user->getId (ADMIN_IDENTIFIER); if (!$adminId) { // creates profile // New profile for administrator $admin['name'] = ADMIN_IDENTIFIER; $admin['status'] = 1; $adminId = $store->user->insert ($admin); if (!is_dir (FOLDER_PROFILES)) mkdir (FOLDER_PROFILES); if (!is_dir (FOLDER_PROFILES . ADMIN_IDENTIFIER)) mkdir (FOLDER_PROFILES . ADMIN_IDENTIFIER); // register the administrator profile $caption[TEXT_CONTENT] = ADMIN_CAPTION; if (SYSTEM_DEFAULT_CHARSET == 'ISO-8859-1') $caption[TEXT_CHARSET] = 1; $admin_data['text'] = array ( 'caption' => array (SYSTEM_DEFAULT_LANGUAGE => $caption), 'title' => array (SYSTEM_DEFAULT_LANGUAGE => $caption), ); $admin_data['local']['mail'] = ADMIN_MAIL; $admin_data['local']['gender'] = ADMIN_GENDER; $admin_data['mode'] = MODE_DOMAIN; $admin_data['name'] = '-register'; $store->userContent->insert ($adminId, $admin_data); } // creates profile // Creates domain $domain['name'] = SYSTEM_DEFAULT_DOMAIN_NAME; $domain['status'] = 1; $domainId = $store->domain->insert ($domain); if (!is_dir (FOLDER_DOMAINS)) mkdir (FOLDER_DOMAINS); if (!is_dir (FOLDER_DOMAINS . SYSTEM_DEFAULT_DOMAIN_NAME)) mkdir (FOLDER_DOMAINS . SYSTEM_DEFAULT_DOMAIN_NAME); // Register domain $domain_data = $store->control->read ('domain_empty_templateForNewDomain'); $domain_data['mode'] = MODE_DOMAIN; $domain_data['name'] = '-register'; $store->domainContent->insert ($domainId, $domain_data); // Register administrator $group = &$store->domainGroup->open ($domainId, 1); $group[$adminId] = 4; return true; } // creates the default domain return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->domainId = $store->domain->getId ($me->name); $me->groups[] = new eclGroup_domain ($me->domainId); $status = $store->domain->getStatus ($me->name); if ($status == 1) { // empty $me->data = &$store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-register'); $me->map = array ('domainSubscription', 'userJoin', 'domainStylesheet', 'domain_empty'); } // empty elseif ($status == 4) { // disabled $me->map = array ('domainStylesheet', 'domain_disabled'); } // disabled elseif ($status == 2) { // active $me->data = &$store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-register'); $me->getMap (); } // active $me->isDomain = true; } // function constructor_helper } // class eclApp_domain //!eof:library/domain/eclApp_domain.php; //!file:library/domain/eclApp_domain_files.php; class eclApp_domain_files { // class eclApp_domain_files static function is_child ($me, $name) { // function is_child global $io; if (in_array ('-files', $io->request->pathway)) return true; if (in_array ('-downloads', $io->request->pathway)) return true; if (in_array ('-play', $io->request->pathway)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-files'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->ignoreSubfolders = true; $me->ignoreSession (true); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $pathway = $document->pathway; $mode = $document->application->name; $name = array_pop ($pathway); $target = array_pop ($pathway); if ($mode == '-downloads') $disposition = 'attachment'; else $disposition = 'inline'; $path = PATH_DOMAINS . $document->domain->name . '/' . $name; if (!is_file ($path)) exit ('File not found: ' . $name); $headers = array ( 'Content-Disposition' => $disposition, 'Cache-Control' => 'private, only-if-cached' ); list ($name) = explode (CHR_FNS, $name); if ($mode == '-downloads') { // download $data = $store->domainContent->open ($document->domain->domainId, $name); if (isset ($data['extras'][$target]['filename'])) $headers['Filename'] = $data['extras'][$target]['filename']; } // download $io->sendFile->send ($path, $headers); // print_a (headers_list()); if ($mode != '-play' and $mode != '-downloads') exit; list ($name) = explode (CHR_FNS, $name); if ($mode == '-play') $register = 'plays'; else $register = 'downloads'; $data = &$store->domainContent->open ($document->domain->domainId, $name); if (!isset ($data['extras'][$target])) exit; if (!isset ($data['extras'][$target][$register])) $data['extras'][$target][$register] = 1; else $data['extras'][$target][$register] ++; unset ($data); $store->close(); $io->close(); exit; } // function dispatch } // class eclApp_domain_files //!eof:library/domain/eclApp_domain_files.php; //!file:library/domain/eclFilter_domain_name.php; class eclFilter_domain_name { // class eclFilter_domain_name static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_small'; // target if (isset ($formulary->data['name'])) $local['value'] = $formulary->data['name']; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $document = $formulary->document; $name = ''; // If a previous problem was ocurred saving the formulary, we need to abort if ($formulary->errorMsg !== false) return; $received = $formulary->received; // Get name from formulary if (isset ($received[$fieldName]) and strlen ($received[$fieldName])) $name = $received[$fieldName]; // If has no name to receive, but the $data['name'] is set, silently abort elseif (isset ($formulary->data['name']) and strlen ($formulary->data['name'])) return; // But if $data['name'] is not set, we will try to create one based on // caption or title from formulary, because a new section or post needs a name else { // look for alternative name if (isset ($formulary->data['text']['caption'][$document->lang][TEXT_CONTENT])) $name = $formulary->data['text']['caption'][$document->lang][TEXT_CONTENT]; elseif (isset ($formulary->data['text']['title'][$document->lang][TEXT_CONTENT])) $name = $formulary->data['text']['title'][$document->lang][TEXT_CONTENT]; } // look for alternative name // We need to convert special characters. But the convertion only will works // currectly if the encoding are ASCII or ISO-8859-1 $charset = $formulary->document->charset; if ($charset != 'ISO-8859-1') $name = mb_convert_encoding ($name, 'ISO-8859-1', $charset); // Here is a table for character convertion: // the key represents the input character, // and the value is the valid character to use instead // Other characters will be ignored static $convert = array ('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'â' => 'a', 'Â' => 'a', 'ã' => 'a', 'Ã' => 'a', 'á' => 'a', 'Á' => 'a', 'à' => 'a', 'À' => 'a', 'ä' => 'a', 'Ä' => 'a', 'Ç' => 'c', 'ç' => 'c', 'ê' => 'e', 'Ê' => 'e', 'é' => 'e', 'É' => 'e', 'ë' => 'e', 'Ë' => 'e', 'î' => 'i', 'Î' => 'i', 'í' => 'i', 'Í' => 'i', 'ï' => 'i', 'Ï' => 'i', 'ô' => 'o', 'Ô' => 'o', 'õ' => 'o', 'Õ' => 'o', 'ó' => 'o', 'Ó' => 'o', 'ö' => 'o', 'Ö' => 'o', 'û' => 'u', 'Û' => 'u', 'ú' => 'u', 'Ú' => 'u', 'ü' => 'u', 'Ü' => 'u', 'Ý' => 'y', 'ý' => 'y', 'ÿ' => 'y', 'Ÿ' => 'y', ' ' => '_', '_' => '_', '-' => '-', '/' => '-', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0'); // The $last will remember the last character of the convertion // to prevent duplicated spacing "__" or "--" in the name $result = ''; $last = '_'; foreach (str_split ($name) as $char) { // each char if (!isset ($convert[$char])) continue; $valid = $convert[$char]; if ($valid != $last) { // not repeated separator if ($valid == '-' or $valid == '_') $last = $valid; else $last = ''; $result .= $valid; } // not repeated separator } // each char if (strlen ($result) > 34) $result = substr ($result, 0, 34); $name = trim ($result, '_-'); // Can happens that the convertion eats all characters! // But if $data['name'] is set, we can silently abort. if (!strlen ($name) and isset ($formulary->data['name'])) return false; // If the received name is equal the $data['name'], nothing has to be done if (isset ($formulary->data['name']) and $name == $formulary->data['name']) return false; // In cases that the name was not set, and we not found a valid one, // we will provide a default one if (!strlen ($name) or preg_match ('/^[0-9]+$/', $name)) { // provides a default value if (isset ($control['flags']['control_default_value'])) $name = $control['flags']['control_default_value']; else $name = 'page'; } // provides a default value // Name changed // Prevent duplicated names $domainId = $formulary->document->application->domainId; $testing = $name; while ($store->domainContent->open ($domainId, $testing)) { // unduplicate name isset ($index) ? $index++ : $index = 1; $testing = $name . str_pad (strval ($index), 3, '0', STR_PAD_LEFT); } // unduplicate name $name = $testing; // If the name was changed, we need to rename all files of this section or post if (isset ($formulary->data['name'])) { // rename files $store->domainFile->renamePrefixedFiles ($formulary->document->application->domainId, $formulary->data['name'], $name); $prefix = $formulary->data['name'] . CHR_FNS; $prefixLength = strlen ($prefix); $newPrefix = $name . CHR_FNS; foreach ($formulary->data['extras'] as &$module) { // each module foreach ($module as &$property) { // each property if (!is_string ($property) or strlen ($property) < $prefixLength) continue; if (substr ($property, 0, $prefixLength) == $prefix) $property = $newPrefix . substr ($property, $prefixLength); } // each property } // each module } // rename files // If you are not so tired, please set $data['name']! $formulary->data['name'] = $name; return false; } // function save } // class eclFilter_domain_name //!eof:library/domain/eclFilter_domain_name.php; //!file:library/domain/eclGroup_domain.php; class eclGroup_domain { // class eclGroup_domain private $domainId; public function __construct ($domainId) { // function __construct $this->domainId = $domainId; } // function __construct public function check ($document) { // function check global $store; $user = $document->user; static $opened; if (!$user->userId) return 0; if (!isset ($opened)) $opened = $store->domainGroup->open ($this->domainId, 1); if (isset ($opened[$user->userId])) return $opened[$user->userId]; return 1; } // function check } // class eclGroup_domain //!eof:library/domain/eclGroup_domain.php; //!file:library/domain/eclGroup_domain_group.php; class eclGroup_domain_group { // class eclGroup_domain_group private $domainId; private $groupId; public function __construct ($domainId, $groupId) { // function __construct $this->domainId = $domainId; $this->groupId = $groupId; } // function __construct public function check ($document) { // function check global $store; $user = $document->user; static $opened = array (); if (!$user->userId) return 0; if (!isset ($opened[$user->name])) $opened[$user->name] = $store->domainContent->open ($this->domainId, '-user-' . $user->name); if (isset ($opened[$user->name]['parent_id']) and $opened[$user->name]['parent_id'] == $this->groupId) return 3; return 1; } // function check } // class eclGroup_domain_group //!eof:library/domain/eclGroup_domain_group.php; //!file:library/domain/eclGroup_domain_owner.php; class eclGroup_domain_owner { // class eclGroup_domain_owner private $me; public function __construct ($me) { // function __construct $this->me = $me; } // function __construct public function check ($document) { // function check if (isset ($me->data['owner_id']) and $me->data['owner_id'] == $document->subscription->id) return 4; return 1; } // function check } // class eclGroup_domain_owner //!eof:library/domain/eclGroup_domain_owner.php; //!file:library/domain/empty/eclApp_domain_empty.php; class eclApp_domain_empty { // class eclApp_domain_empty static function is_child ($me, $name) { // function is_child if ($name == '' or $name == '-default') return true; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->name = ''; $me->data = $store->control->read ('domain_empty_content'); $me->ignoreSubfolders = true; unset ($me->pathway[1]); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (!$document->access (4)) return; $register_data = $store->domainContent->open ($me->domainId, '-register'); $formulary = $document->createFormulary ('domain_empty_edit', array (), 'domainEmpty'); $formulary->action = '_first-edit-save'; if ($formulary->command ('save') and $formulary->save ()) { // creates the index page $data = $formulary->data; $data['name'] = '-index'; $data['mode'] = MODE_DOMAIN; $data['parent_id'] = 0; $store->domainContent->insert ($me->domainId, $data); if (!$register_data) { // creates register $register_data = $data; $register_data['name'] = '-register'; $store->domainContent->insert ($me->domainId, $register_data); } // creates register $domain_data = &$store->domain->openById ($me->domainId); $domain_data['status'] = 2; unset ($domain_data); $domain = $me->parent; $domain->getMap (); $domain->reset (); $document->application = $domain->child (''); $document->application->dispatch ($document); return; } // creates the index page $register_data['text']['caption'] = $me->data['text']['caption']; if (!$formulary->data) $formulary->data = $register_data; $document->dataReplace ('domainIndex_edit'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->context->enabled = false; $document->mod->toolbox->enabled = false; return; } // function dispatch } // class eclApp_domain_empty //!eof:library/domain/empty/eclApp_domain_empty.php; //!file:library/domainAbout/eclApp_domainAbout.php; class eclApp_domainAbout { // class eclApp_domainAbout static function is_child ($me, $name) { // function is_child if ($name == '-about') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-about'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; if ($store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-about')) { // custom content $me->data = &$store->domainContent->open ($me->domainId, '-about'); $me->id = $me->data['id']; } // custom content else $me->data = $store->control->read ('domainAbout_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) { // user is admin if ($document->application->id) $view = 'custom'; else $view = 'default'; // action restore if ($document->actions ('default', 'restore') and $view == 'custom') $view = self::action_restore ($document); // action edit elseif ($document->actions ('default', 'edit') and $view == 'custom') $view = self::action_edit ($document); // action language clear elseif ($document->actions ('default', 'language', 'clear') and $view == 'custom') self::action_language_clear ($document); // action custom if ($document->actions ('default', 'edit') and $view == 'default') $document->actions['default'] = array ('default', 'custom'); if ( ($document->actions ('default', 'custom')) and $view == 'default') $view = self::action_custom ($document); // context custom if ($view == 'default' or $document->actions ('default', 'custom')) $document->mod->context->appendChild ('domainDefault_custom') ->active ($document->actions ('default', 'custom')) ->ref (true, true, '_default-custom'); else { // custom tools // context edit $document->mod->context->appendChild ('domainDefault_edit') ->active ($document->actions ('default', 'edit')) ->ref (true, true, '_default-edit'); // context language remove if (count ($document->application->data['text']['caption']) > 1 and isset ($document->application->data['text']['caption'][$document->lang])) $document->mod->context->appendChild ('systemFormulary_clearLanguage') ->ref (true, true, '_default-language-clear') ->confirm ('systemFormulary_clearLanguageConfirm'); // context restore $document->mod->context->appendChild ('domainDefault_restore') ->ref (true, true, '_default-restore'); $document->mod->editor->enable (); } // custom tools } // user is admin } // function dispatch static function action_custom ($document) { // function action_custom global $store; $me = $document->application; $formulary = $document->createFormulary ('domainDefault_edit', $store->control->read ('domainAbout_content')); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['default']); return 'default'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $data['name'] = '-about'; $data['mode'] = MODE_DOMAIN; $data['parent_id'] = 0; $me->id = $store->domainContent->insert ($document->application->domainId, $data); $me->data = $data; $document->dataReplace ($me->data); unset ($document->actions['default']); return 'custom'; } // save $formulary->action = '_default-custom'; $document->dataReplace ('domainDefault_custom'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_default-custom'; return 'form'; } // function action_custom static function action_edit ($document) { // function action_edit $formulary = $document->createFormulary ('domainDefault_edit', $document->application->data); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['default']); return 'custom'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $document->application->data = $data; $document->dataReplace ($data); unset ($document->actions['default']); return 'custom'; } // save $formulary->action = '_default-edit'; $document->dataReplace ('domainDefault_edit'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_default-edit'; return 'form'; } // function action_edit static function action_language_clear ($document) { // function action_language_clear unset ($document->actions['default']); if (count ($document->application->data['text']['caption']) == 1) return; foreach ($document->application->data['text'] as &$field) { // each field unset ($field[$document->lang]); } // each field $document->dataReplace ($document->application->data); } // function action_language_clear static function action_restore ($document) { // function action_restore global $store; $me = $document->application; unset ($me->data); $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, '-about'); $me->data = $store->control->read ('domainAbout_content'); $document->dataReplace ($me->data); $me->id = 0; return 'default'; } // function action_restore static function remove ($me) { // function remove global $store; if ($me->id) $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, '-about'); } // function remove } // class eclApp_domainAbout //!eof:library/domainAbout/eclApp_domainAbout.php; //!file:library/domainCategories/category/eclApp_domainCategories_category.php; class eclApp_domainCategories_category { // class eclApp_domainCategories_category static function is_child ($me, $name) { // function is_child global $store; $data = $store->domainContent->open ($me->domainId, $name); if ($data and $data['mode'] == MODE_CATEGORY and $data['parent_id'] == 0) return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->open ($me->domainId, $me->name); $me->id = $me->data['id']; $me->access = 0; } // function constructor_helper static function dispatch ($document) { // function dispatch $view = true; if ($document->access (4)) { // admin if ($document->actions ('category', 'remove')) return self::action_remove ($document); if ($document->actions ('category', 'edit')) $view = self::action_edit ($document); // Context edit $document->mod->context->appendChild ('domainCategories_category_edit') ->ref (true, true, '_category-edit') ->active ($document->actions ('category', 'edit')); // Context remove $document->mod->context->appendChild ('domainCategories_category_remove') ->ref (true, true, '_category-remove') ->confirm ('domainCategories_category_removeConfirm'); if ($view) $document->mod->editor->enable (); } // admin if ($view) $document->mod->list = new eclMod_domainCategories_category_list ($document); } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('domainCategories_category_edit', $me->data); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['category']); return true; } // cancel if ($formulary->command ('save') and $formulary->save()) { // save unset ($document->actions['category']); $me->data = $formulary->data; return true; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('domainCategories_category_edit'); return false; } // function action_edit static function action_remove ($document) { // function action_remove global $store; $me = $document->application; $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); $document->application = $me->parent; $document->application->dispatch ($document); $document->reload = $document->ref(); } // function action_remove } // class eclApp_domainCategories_category //!eof:library/domainCategories/category/eclApp_domainCategories_category.php; //!file:library/domainCategories/category/eclApp_domainCategories_category_new.php; class eclApp_domainCategories_category_new { // class eclApp_domainCategories_category_new static function is_child ($me, $name) { // function is_child if ($name == '-new-category') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-category'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('domainCategories_category_new'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('domainCategories_category_create', array(), 'new'); if ($formulary->command ('cancel')) { // cancel $document->application = $me->parent; $document->application->dispatch ($document); $document->reload = $document->ref(); return; } // cancel if ($formulary->command ('save') and $formulary->save()) { // save $data = $formulary->data; $data['mode'] = MODE_CATEGORY; $data['marker'] = 2; $store->domainContent->insert ($me->domainId, $data); $parent = $me->parent; $parent->reset(); $document->application = $parent->child ($data['name']); $document->application->dispatch ($document); $document->reload = $document->ref(); return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_domainCategories_category_new //!eof:library/domainCategories/category/eclApp_domainCategories_category_new.php; //!file:library/domainCategories/category/eclMod_domainCategories_category_list.php; class eclMod_domainCategories_category_list { // class eclMod_domainCategories_category_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $row = $mod->appendChild(); $mod->data = $store->control->read ('modList_preset_folder'); if (!isset ($me->data['links']['pages'])) return; foreach ($me->data['links']['pages'] as $name) { // each post $post = $me->findChild ($name); if (!$post) continue; if (!$document->access ($post->access, $post->groups)) continue; $row->appendChild ($post->data) ->virtual ($post->access) ->ref ($post->pathway); } // each post if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_domainCategories_category_list //!eof:library/domainCategories/category/eclMod_domainCategories_category_list.php; //!file:library/domainCategories/eclApp_domainCategories.php; class eclApp_domainCategories { // class eclApp_domainCategories static function is_child ($me, $name) { // function is_child if ($name == '-categories') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-categories'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('domainCategories_content'); $me->map = array ('domainCategories_category', 'domainCategories_category_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) { // admin // Context new category $pathway = $document->pathway; $pathway[] = '-new-category'; $document->mod->context->appendChild ('domainCategories_category_new') ->virtual () ->ref ($pathway); } // admin $document->mod->list = new eclMod_domainCategories_list ($document); } // function dispatch } // class eclApp_domainCategories //!eof:library/domainCategories/eclApp_domainCategories.php; //!file:library/domainCategories/eclFilter_domainCategories_link.php; class eclFilter_domainCategories_link { // class eclFilter_domainCategories_link static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application; // name $control['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $control['type'] = $control['flags']['control_type']; else $control['type'] = 'checkbox_group'; $categories = $store->domainContent->children ($document->domain->domainId, MODE_CATEGORY, 0); if (!$categories) return; $group = $formulary->appendChild ($control); foreach ($categories as $data) { // each category $local = array(); $local['caption'] = $data['text']['title']; $local['name'] = $fieldName . '_' . $data['id']; if ($me->id and isset ($data['links']['pages']) and in_array ($me->name, $data['links']['pages'])) $local['value'] = 1; $group->appendChild ($local); } // each category return; } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $me = $formulary->document->application; $received = $formulary->received; if (!$me->id) return; $names = $store->domainContent->childrenNames ($me->domainId, MODE_CATEGORY, 0); if (!$names) return; foreach ($names as $name) { // each category $data = &$store->domainContent->open ($me->domainId, $name); if (isset ($received[$fieldName . '_' . $data['id']]) and $received[$fieldName . '_' . $data['id']] != '') { // subscribe if (!isset ($data['links']['pages'])) $data['links']['pages'] = array ($me->name); elseif (!in_array ($me->name, $data['links']['pages'])) $data['links']['pages'][] = $me->name; } // subscribe elseif (isset ($data['links']['pages']) and in_array ($me->name, $data['links']['pages'])) { // unsubscribe $key = array_search ($me->name, $data['links']['pages']); unset ($data['links']['pages'][$key]); } // unsubscribe unset ($data); } // each category } // function save } // class eclFilter_domainCategories_link //!eof:library/domainCategories/eclFilter_domainCategories_link.php; //!file:library/domainCategories/eclMod_domainCategories_list.php; class eclMod_domainCategories_list { // class eclMod_domainCategories_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $row = $mod->appendChild(); $mod->data = $store->control->read ('modList_preset_folder'); $children = $store->domainContent->children ($me->domainId, MODE_CATEGORY, 0); foreach ($children as $data) { // each child $pathway = $me->pathway; $pathway[] = $data['name']; $row->appendChild ($data) ->ref ($pathway); } // each child if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_domainCategories_list //!eof:library/domainCategories/eclMod_domainCategories_list.php; //!file:library/domainCreate/eclApp_domainCreate.php; class eclApp_domainCreate { // class eclApp_domainCreate static function is_child ($me, $name) { // function is_child global $io, $store; if (!$name or $name[0] == '-') return false; if (!$io->database->tableEnabled ($store->domain)) return false; if ($store->domain->getStatus ($name) == 0) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('domainCreate_content'); $me->map = array ('userJoin', 'domainCreate_index'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_domainCreate //!eof:library/domainCreate/eclApp_domainCreate.php; //!file:library/domainCreate/eclApp_domainCreate_index.php; class eclApp_domainCreate_index { // class eclApp_domainCreate_index static function is_child ($me, $name) { // function is_child global $io, $store; if ($name == '' or $name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('domainCreate_content'); array_pop ($me->pathway); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $me = $document->application; $document->data['ref'] = $document->ref (true, false, false); $document->data['enable_user_domains'] = SYSTEM_ENABLE_USER_DOMAINS; $document->data['enable_user_subscriptions'] = SYSTEM_ENABLE_USER_SUBSCRIPTIONS; if (!SYSTEM_ENABLE_USER_DOMAINS) return; if (!$document->access (1)) return; $formulary = $document->createFormulary ('domainCreate_edit', array (), 'domaincreate'); if ($formulary->command ('save') and $formulary->save ()) { // save $domain['name'] = $document->domain->name; $domain['status'] = 1; mkdir (FOLDER_DOMAINS . $domain['name']); $domainId = $store->domain->insert ($domain); $data = $formulary->data; $data['mode'] = MODE_DOMAIN; $data['name'] = '-register'; $store->domainContent->insert ($domainId, $data); $group = &$store->domainGroup->open ($domainId, 1); $group[$document->user->userId] = 4; $document->dataReplace (array ()); $system->reset (); $document->domain = $system->child ($domain['name']); $document->application = $document->domain->child (''); $document->application->dispatch ($document); return; } // save $document->dataReplace ('domainCreate_contentCreate'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_domainCreate_index //!eof:library/domainCreate/eclApp_domainCreate_index.php; //!file:library/domainDefault/eclApp_domainDefault.php; class eclApp_domainDefault { // class eclApp_domainDefault static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type global $store; $data = $store->domainContent->open ($me->domainId, MODE_DOMAIN, '-register'); if (isset ($data['flags']['domainDefault_displayAsSection'])) return 'section'; return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; if ($store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-default')) { // custom content $me->data = &$store->domainContent->open ($me->domainId, '-default'); $me->id = $me->data['id']; } // custom content else $me->data = $store->control->read ('domainDefault_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) { // user is admin if ($document->application->id) $view = 'custom'; else $view = 'default'; // action restore if ($document->actions ('default', 'restore') and $view == 'custom') $view = self::action_restore ($document); // action edit elseif ($document->actions ('default', 'edit') and $view == 'custom') $view = self::action_edit ($document); // action language clear elseif ($document->actions ('default', 'language', 'clear') and $view == 'custom') self::action_language_clear ($document); // action custom if ($document->actions ('default', 'edit') and $view == 'default') $document->actions['default'] = array ('default', 'custom'); if ( ($document->actions ('default', 'custom')) and $view == 'default') $view = self::action_custom ($document); // context custom if ($view == 'default' or $document->actions ('default', 'custom')) $document->mod->context->appendChild ('domainDefault_custom') ->active ($document->actions ('default', 'custom')) ->ref (true, true, '_default-custom'); else { // custom tools // context edit $document->mod->context->appendChild ('domainDefault_edit') ->active ($document->actions ('default', 'edit')) ->ref (true, true, '_default-edit'); // context language remove if (count ($document->application->data['text']['caption']) > 1 and isset ($document->application->data['text']['caption'][$document->lang])) $document->mod->context->appendChild ('systemFormulary_clearLanguage') ->ref (true, true, '_default-language-clear') ->confirm ('systemFormulary_clearLanguageConfirm'); // context restore $document->mod->context->appendChild ('domainDefault_restore') ->ref (true, true, '_default-restore'); $document->mod->editor->enable (); } // custom tools } // user is admin } // function dispatch static function action_custom ($document) { // function action_custom global $store; $me = $document->application; $formulary = $document->createFormulary ('domainDefault_edit', $store->control->read ('domainDefault_content')); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['default']); return 'default'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $data['name'] = '-default'; $data['mode'] = MODE_DOMAIN; $data['parent_id'] = 0; $me->id = $store->domainContent->insert ($document->application->domainId, $data); $me->data = $data; $document->dataReplace ($me->data); unset ($document->actions['default']); return 'custom'; } // save $formulary->action = '_default-custom'; $document->dataReplace ('domainDefault_custom'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_default-custom'; return 'form'; } // function action_custom static function action_edit ($document) { // function action_edit $formulary = $document->createFormulary ('domainDefault_edit', $document->application->data); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['default']); return 'custom'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $document->application->data = $data; $document->dataReplace ($data); unset ($document->actions['default']); return 'custom'; } // save $formulary->action = '_default-edit'; $document->dataReplace ('domainDefault_edit'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_default-edit'; return 'form'; } // function action_edit static function action_language_clear ($document) { // function action_language_clear unset ($document->actions['default']); if (count ($document->application->data['text']['caption']) == 1) return; foreach ($document->application->data['text'] as &$field) { // each field unset ($field[$document->lang]); } // each field $document->dataReplace ($document->application->data); } // function action_language_clear static function action_restore ($document) { // function action_restore global $store; $me = $document->application; unset ($me->data); $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, '-default'); $me->data = $store->control->read ('domainDefault_content'); $document->dataReplace ($me->data); $me->id = 0; return 'default'; } // function action_restore static function remove ($me) { // function remove global $store; if ($me->id) $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, '-default'); } // function remove } // class eclApp_domainDefault //!eof:library/domainDefault/eclApp_domainDefault.php; //!file:library/domainGlossary/eclApp_domainGlossary.php; class eclApp_domainGlossary { // class eclApp_domainGlossary static function is_child ($me, $name) { // function is_child if ($name == '-glossary') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('domainGlossary_content'); $me->map = array ('domainGlossary_keyword'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_domainGlossary_list ($document); } // function dispatch } // class eclApp_domainGlossary //!eof:library/domainGlossary/eclApp_domainGlossary.php; //!file:library/domainGlossary/eclMod_domainGlossary_list.php; class eclMod_domainGlossary_list { // class eclMod_domainGlossary_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $row = $mod->appendChild(); $mod->data = $store->control->read ('modList_module'); $children = $store->domainContent->children ($me->domainId, MODE_KEYWORD, 0, 4, 0, 0, 'name', 'asc'); foreach ($children as $data) { // each child $pathway = $me->pathway; $pathway[] = substr ($data['name'], 5); $row->appendChild ($data) ->ref ($pathway); } // each child if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_domainGlossary_list //!eof:library/domainGlossary/eclMod_domainGlossary_list.php; //!file:library/domainGlossary/keyword/eclApp_domainGlossary_keyword.php; class eclApp_domainGlossary_keyword { // class eclApp_domainGlossary_keyword static function is_child ($me, $name) { // function is_child return true; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; if (substr ($me->name, 0, 5) == '-key-') $me->name = substr ($me->name, 5); $data = &$store->domainContent->open ($me->domainId, '-key-' . strtolower ($me->name)); if ($data) { // existing content $me->data = &$data; $me->id = $data['id']; } // existing content else $me->data = $store->control->read ('domainGlossary_keyword_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; if (!$me->id and $document->access (4)) self::action_create ($document); if (!$me->id) return; $view = true; if ($document->access (4)) { // admin access if ($document->actions ('entry', 'remove')) { // remove self::action_remove ($document); return; } // remove if ($document->actions ('entry', 'edit')) $view = self::action_edit ($document); // Context edit $document->mod->context->appendChild ('domainGlossary_keyword_edit') ->active ($document->actions ('entry', 'edit')) ->ref (true, true, '_entry-edit'); // context remove $document->mod->context->appendChild ('domainGlossary_keyword_remove') ->ref (true, true, '_entry-remove') ->confirm ('domainGlossary_keyword_removeConfirm'); if ($view) $document->mod->editor->enable (); } // admin access else $me->data['hits']++; if ($view) $document->mod->list = new eclMod_domainGlossary_keyword_list ($document); } // function dispatch static function action_create ($document) { // function action_create global $store; $me = $document->application; $formulary = $document->createFormulary ('domainGlossary_keyword_edit'); $formulary->action = '_entry-create'; if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $data['mode'] = MODE_KEYWORD; $data['parent_id'] = 0; $data['marker'] = 1; $data['name'] = '-key-' . $me->name; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = $data; $document->dataReplace ($data); return true; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return false; } // function action_create static function action_edit ($document) { // function action_edit global $store; $me = $document->application; $formulary = $document->createFormulary ('domainGlossary_keyword_edit', $me->data, 'entry'); $formulary->action = '_entry-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['entry']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['entry']); $me->data = $formulary->data; $document->dataReplace ($me->data); return true; } // save $document->mod->formulary = $formulary; $document->dataReplace ('domainGlossary_keyword_edit'); if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return false; } // function action_edit static function action_remove ($document) { // function action_remove global $store; $me = $document->application; $store->domainFile->deletePrefixedFiles ($me->domainId, $me->data['name']); $store->domainContent->delete ($me->domainId, $me->id); $me->data = $store->control->read ('domainGlossary_keyword_content'); $document->dataReplace ($me->data); self::action_create ($document); } // function action_remove } // class eclApp_domainGlossary_keyword //!eof:library/domainGlossary/keyword/eclApp_domainGlossary_keyword.php; //!file:library/domainGlossary/keyword/eclMod_domainGlossary_keyword_list.php; class eclMod_domainGlossary_keyword_list { // class eclMod_domainGlossary_keyword_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $io, $store; $document = $this->document; $me = $document->application; $row = $mod->appendChild(); $where['domain_id'] = $me->domainId; $where['keywords'] = ':' . $me->name . ':'; $results = $store->domainContent->search ($where); foreach ($results as $data) { // each result $post = $me->findChild ($data['name']); if (!$post) continue; if (!$document->access ($post->access, $post->groups)) continue; $row->appendChild ($post->data) ->ref ($post->pathway); } // each result $mod->data = $store->control->read ('modList_preset_related'); if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_domainGlossary_keyword_list //!eof:library/domainGlossary/keyword/eclMod_domainGlossary_keyword_list.php; //!file:library/domainIndex/eclApp_domainIndex.php; class eclApp_domainIndex { // class eclApp_domainIndex static function is_child ($me, $name) { // function is_child global $store; if ( ($name == '' or $name == '-index') and $store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-index')) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-index'); $me->id = $me->data['id']; unset ($me->pathway[1]); } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = 'page'; if ($document->access (4)) { // user is admin // action edit if ($document->actions ('index', 'edit')) $view = self::action_edit ($document); // action language remove if ($document->actions ('index', 'language', 'remove')) self::action_language_remove ($document); // context edit $document->mod->context->appendChild ('domainIndex_edit') ->active ($document->actions ('index')) ->ref (true, true, '_index-edit'); // context remove language if (count ($me->data['text']['caption']) > 1) $document->mod->context->appendChild ('systemFormulary_clearLanguage') ->ref (true, true, '_index-language-remove') ->confirm ('systemFormulary_clearLanguageConfirm'); // Context new section $pathway = $me->pathway; $pathway[] = '-new-section'; $document->mod->context->appendChild ('section_create_contextNewMain') ->ref ($pathway); if ($view == 'page') $document->mod->editor->enable (); } // user is admin else $me->data['hits']++; if ($view == 'page') { // view $document->mod->panel->main = array ('content'); if (isset ($me->data['local']['listSections'])) { // list sections $document->mod->panel->main[] = 'listsections'; $document->mod->listsections = new eclMod_modDinamic ($document, '-index'); } // list sections if (isset ($me->data['local']['listRecents'])) { // list recents $document->mod->panel->main[] = 'listrecents'; $document->mod->listrecents = new eclMod_modDinamic ($document, '-recents'); } // list recents } // view } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('domainIndex_edit', $me->data); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['index']); return 'page'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save the index page $me->data = $formulary->data; $document->dataReplace ($me->data); unset ($document->actions['index']); return 'page'; } // save the index page $formulary->action = '_index-edit'; $document->dataReplace ('domainIndex_edit'); $document->mod->context->help ('domainIndex_edit'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_index-edit'; $document->dataMerge ('domainIndex_contentEdit'); return 'form'; } // function action_edit static function action_language_remove ($document) { // function action_language_remove unset ($document->actions['index']); if (count ($document->application->data['text']['caption']) == 1) return; foreach ($document->application->data['text'] as &$field) { // each field unset ($field[$document->lang]); } // each field } // function action_language_remove static function remove ($me) { // function remove global $store; $store->domainContent->delete ($me->domainId, $me->id); } // function remove } // class eclApp_domainIndex //!eof:library/domainIndex/eclApp_domainIndex.php; //!file:library/domainRecents/eclApp_domainRecents.php; class eclApp_domainRecents { // class eclApp_domainRecents static function is_child ($me, $name) { // function is_child if ($name == '-recents') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-recents'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-recents'); if (!$me->data) { // create content $data['mode'] = MODE_DOMAIN; $data['name'] = '-recents'; $store->domainContent->insert ($me->domainId, $data); } // create content $me->data = &$store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-recents'); $me->id = $me->data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; } // function dispatch } // class eclApp_domainRecents //!eof:library/domainRecents/eclApp_domainRecents.php; //!file:library/domainRecents/eclFilter_domainRecents_link.php; class eclFilter_domainRecents_link { // class eclFilter_domainRecents_link static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $me = $document->application; // name $control['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $control['type'] = $control['flags']['control_type']; else $control['type'] = 'checkbox'; if (!$me->id) { // creating post $control['value'] = 1; $formulary->appendChild ($control); return; } // creating post $recents = $document->domain->child ('-recents'); if (isset ($recents->data['links']['pages']) and in_array ($me->name, $recents->data['links']['pages'])) $control['value'] = 1; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if ($formulary->errorMsg) return; if (!isset ($formulary->data['domain_id'])) return; if (!isset ($formulary->data['name'])) return; $received = $formulary->received; $recents = $formulary->document->domain->child ('-recents'); if (!isset ($recents->data['links']['pages'])) $recents->data['links']['pages'] = array(); $pages = &$recents->data['links']['pages']; $name = $formulary->data['name']; if (isset ($received[$fieldName])) { // register if (!in_array ($name, $pages)) array_unshift ($pages, $name); } // register elseif (in_array ($name, $pages)) { // unregister $key = array_search ($name, $pages); unset ($pages[$key]); } // unregister if (count ($pages) > 20) array_pop ($pages); } // function save } // class eclFilter_domainRecents_link //!eof:library/domainRecents/eclFilter_domainRecents_link.php; //!file:library/domainSearch/eclApp_domainSearch.php; class eclApp_domainSearch { // class eclApp_domainSearch static function is_child ($me, $name) { // function is_child if ($name == '-search') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-search'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('domainSearch_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->panel->main = array ('content', 'formulary', 'list'); $document->mod->formulary = new eclMod_domainSearch_formulary ($document); $document->mod->list = new eclMod_domainSearch_list ($document); } // function dispatch } // class eclApp_domainSearch //!eof:library/domainSearch/eclApp_domainSearch.php; //!file:library/domainSearch/eclMod_domainSearch_formulary.php; class eclMod_domainSearch_formulary { // class eclMod_domainSearch_formulary public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $formulary = $document->createFormulary ('domainSearch_search', array (), 'search'); $data = array(); if (isset ($document->actions['tag'][1])) { // tag $search = $document->actions['tag']; array_shift ($search); $formulary->data['key'] = implode (' ', $search); $formulary->data['tags_only'] = 1; } // tag if (isset ($document->actions['search'][1])) { // tag $search = $document->actions['search']; array_shift ($search); $formulary->data['key'] = implode (' ', $search); } // tag else { // from formulary $formulary->save(); if (isset ($formulary->data['tags_only']) and $formulary->data['tags_only']) { // tags if (isset ($formulary->data['key'])) { // key exists $action = explode (' ', $formulary->data['key']); array_unshift ($action, 'tag'); $document->actions['tag'] = $action; } // key exists } // tags else { // key if (isset ($formulary->data['key'])) { // key exists $action = explode (' ', $formulary->data['key']); array_unshift ($action, 'search'); $document->actions['search'] = $action; } // key exists } // key } // from formulary $mod->childrenMerge ($formulary->create()); $mod->data = $store->control->read ('modFormulary_module'); $mod->enabled = true; } // function setModule } // class eclMod_domainSearch_formulary //!eof:library/domainSearch/eclMod_domainSearch_formulary.php; //!file:library/domainSearch/eclMod_domainSearch_list.php; class eclMod_domainSearch_list { // class eclMod_domainSearch_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $io, $store; $document = $this->document; $me = $document->application; $row = $mod->appendChild(); $where['domain_id'] = $me->domainId; if (isset ($document->actions['tag'][1])) { // search tag $search = $document->actions['tag']; array_shift ($search); $where['keywords'] = ':' . implode (': :', $search) . ':'; } // search tag elseif (isset ($document->actions['search'][1])) { // search keywords $search = $document->actions['search']; array_shift ($search); $where['keywords'] = implode (' ', $search); } // search keywords else return; $results = $store->domainContent->search ($where); foreach ($results as $data) { // each result $post = $me->findChild ($data['name']); if (!$post) continue; if (!$document->access ($post->access, $post->groups)) continue; $row->appendChild ($post->data) ->ref ($post->pathway); } // each result $mod->data = $store->control->read ('modList_preset_folder'); if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_domainSearch_list //!eof:library/domainSearch/eclMod_domainSearch_list.php; //!file:library/domainStylesheet/eclApp_domainStylesheet.php; class eclApp_domainStylesheet { // class eclApp_domainStylesheet static function is_child ($me, $name) { // function is_child if ($name == '--style') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('--style'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; ob_end_clean (); header ('Content-type:text/css'); header ('Cache-Control: public, only-if-cached, max-age=2592000'); // if ($data = $store->domainContent->open ($me->domainId, '-styles-main')) // $style = $data['local']; // else $style = $store->control->read ('domainStylesheet_style'); $preset = $store->control->read ('domainStylesheet_preset'); $theme = $store->control->read ('domainStylesheet_theme_default'); $colors = $store->control->read ('domainStylesheet_colors_default'); $user = array (); if ($data = $store->domainContent->open ($document->domain->domainId, '-styles-vars')) $user = $data['local']; $preset = array_replace ($preset, $theme, $colors, $user); if (!isset ($style['parsed'])) $style['parsed'] = $document->render->render_tags ($style['html'], true); $notFound = array (); foreach ($style['parsed'] as $item) { // each parsed item if ($item[0] == 0) print $item[1]; elseif ($item[0] == 1) { // variable $key = $item[2][0][1]; if (isset ($preset[$key])) $value = $preset[$key]; else { // not found $notFound[] = $key; $value = ''; } // not found while (isset ($value[0]) and $value[0] == '$') { // redirect $key = substr ($value, 1); if (isset ($preset[$key])) $value = $preset[$key]; else { // not found $notFound[] = $key; $value = ''; } // not found } // redirect print $value; } // variable } // each parsed item if ($notFound) { // not found print '/' . '* Not found variables: ' . implode (' ', $notFound) . '*/'; } // not found exit; } // function dispatch } // class eclApp_domainStylesheet //!eof:library/domainStylesheet/eclApp_domainStylesheet.php; //!file:library/domainSubscription/eclApp_domainSubscription.php; class eclApp_domainSubscription { // class eclApp_domainSubscription static function is_child ($me, $name) { // function is_child if ($name == '-subscriptions') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-subscriptions'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->map = array ('domainSubscription_view'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_domainSubscription //!eof:library/domainSubscription/eclApp_domainSubscription.php; //!file:library/domainSubscription/view/eclApp_domainSubscription_view.php; class eclApp_domainSubscription_view { // class eclApp_domainSubscription_view static function is_child ($me, $name) { // function is_child return true; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; if (substr ($me->name, 0, 6) == '-user-') $me->name = substr ($me->name, 6); $me->data = &$store->domainContent->open ($me->domainId, '-user-' . $me->name); if (isset ($me->data['id'])) $me->id = $me->data['id']; $me->access = 4; $me->map = array ('domainSubscription_task'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_domainSubscription_view //!eof:library/domainSubscription/view/eclApp_domainSubscription_view.php; //!file:library/modAudio/eclFilter_dialogAudio.php; /* * Valid control flags * control_type = file * control_filter = audio * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_dialogAudio { // class eclFilter_dialogAudio static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'file'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterAudioHelp'; // reference for ajax submission $local['ref'] = $formulary->document->ref ($formulary->pathway, true, '_audio'); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_dialogAudio //!eof:library/modAudio/eclFilter_dialogAudio.php; //!file:library/modAudio/eclMod_modAudio.php; class eclMod_modAudio { // class eclMod_modAudio public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->domain->domainId) return; if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // search $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) $me = $document->application; elseif ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // search $number = isset ($arguments[1]) ? $arguments[1] : '0'; if (!isset ($name)) $name = $me->name; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['audio_' . $number])) { // module exists $audio = $me->data['extras']['audio_' . $number]; $mod->data = $audio; $mod->enabled = true; } // module exists if ($document->access (4, $me->groups)) { // personalite $mod->enabled = true; if (isset ($audio)) { // modify $pathway = array ($document->domain->name, '-dialog', 'audio'); foreach (array_slice ($me->pathway, 1, -1) as $folder) { // each folder $pathway[] = $folder; } // each folder $pathway[] = $name . CHR_FNS . $number; $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modAudio_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // modify } // personalite $mod->data['local']['number'] = $number; $mod->data['local']['list'] = 'details'; $mod->data['local']['details'] = 'media_audio'; if (isset ($audio)) $local['extras'] = array ('audio_' . $number => $audio); $local['pathway'] = $me->pathway; $mod->appendChild ($local); } // function setModule } // class eclMod_modAudio //!eof:library/modAudio/eclMod_modAudio.php; //!file:library/modBanner/eclApp_modBanner.php; class eclApp_modBanner { // class eclApp_modBanner static function is_child ($me, $name) { // function is_child if ($name == 'banner') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('banner'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modBanner_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $name = end ($document->pathway); $me = $document->domain->findChild ($name); if (!$me or !$document->access (4, $me->groups)) return; if (isset ($me->data['extras']['banner'])) $data = $me->data['extras']['banner']; else $data = $store->control->read ('modBanner_module'); if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore if (isset ($data['img']) and is_file (FOLDER_DOMAINS . $document->domain->name . '/' . $data['img'])) unlink (FOLDER_DOMAINS . $document->domain->name . '/' . $data['img']); if (isset ($data['img_mini']) and is_file (FOLDER_DOMAINS . $document->domain->name . '/' . $data['img_mini'])) unlink (FOLDER_DOMAINS . $document->domain->name . '/' . $data['img_mini']); unset ($me->data['extras']['banner']); $document->dataReplace ('dialog_close'); return; } // restore $formulary = $document->createFormulary ('modBanner_edit', $data); $formulary->pathway = $document->pathway; $formulary->flags['target_name'] = $me->data['name']; $formulary->flags['target_index'] = 'banner'; $formulary->multipart = true; if ($formulary->save () and $formulary->data['img']) { // save formulary $me->data['extras']['banner'] = $formulary->data; $document->dataReplace ('dialog_close'); } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_modBanner //!eof:library/modBanner/eclApp_modBanner.php; //!file:library/modBanner/eclMod_modBanner.php; class eclMod_modBanner { // class eclMod_modBanner public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; while (!isset ($me->data['extras']['banner']) and $me->parent->parent) { // search parent banner $me = $me->parent; } // search parent banner if ($me->isDomain) $me = $me->child (''); if (isset ($me->data['extras']['banner'])) { // banner found $mod->data = $me->data['extras']['banner']; $local['extras']['img_0'] = $me->data['extras']['banner']; $mod->appendChild ($local); $mod->enabled = true; } // banner found // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4)) { // reference // Crie um módulo if (!$mod->children) { // creates an image $mod->data = $store->control->read ('modBanner_moduleCreate'); $mod->appendChild ($store->control->read ('modBanner_moduleCreate')); } // creates an image $name = $document->application->name; if ($name == '') $name = '-index'; $pathway = array ($document->domain->name, '-dialog', 'banner', $name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modBanner_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; $mod->enabled = true; } // reference } // function setModule } // class eclMod_modBanner //!eof:library/modBanner/eclMod_modBanner.php; //!file:library/modBox/eclApp_modBox.php; class eclApp_modBox { // class eclApp_modBox static function is_child ($me, $name) { // function is_child if ($name == 'box') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('box'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modBox_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $pathway = $document->pathway; array_shift ($pathway); // domain array_shift ($pathway); // -dialog array_shift ($pathway); // box if (!isset ($document->actions['create'])) { // edit $name = array_pop ($pathway); $parts = explode (CHR_FNS, $name); if (count ($parts) == 2) list ($name, $number) = $parts; else $number = '0'; $pathway[] = $name; } // edit $me = $document->domain; foreach ($pathway as $name) { // each name $me = $me->child ($name); if ($me === false) return; } // each name if (!$document->access (4, $me->groups)) return; if (!isset ($number)) { // find last index $newBox = true; for ($number = 1; $number < 100; $number++) { // find number if (!isset ($me->data['extras']['box_' . $number])) break; } // find number $document->pathway[count ($document->pathway) - 1] .= CHR_FNS . $number; } // find last index if (isset ($me->data['extras']['box_' . $number])) $data = $me->data['extras']['box_' . $number]; else { // empty $data = $store->control->read ('modBox_module'); } // empty $formulary = $document->createFormulary ('modBox_edit', $data); $formulary->pathway = $document->pathway; if (isset ($document->actions['create'])) $formulary->action = '_return-tag'; if ($formulary->save ()) { // save box $me->data['extras']['box_' . $number] = $formulary->data; $document->dataReplace ('dialog_close'); if ($document->actions ('return', 'tag')) $document->data['module'] = 'box:' . $number; return; } // save box $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_modBox //!eof:library/modBox/eclApp_modBox.php; //!file:library/modBox/eclMod_modBox.php; class eclMod_modBox { // class eclMod_modBox public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->domain->domainId) return; if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // search $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) $me = $document->application; elseif ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // search $number = isset ($arguments[1]) ? $arguments[1] : '0'; if (!isset ($name)) $name = $me->name; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['box_' . $number])) { // module exists $box = $me->data['extras']['box_' . $number]; $mod->data = $box; } // module exists if ($document->access (4, $me->groups)) { // personalite $mod->enabled = true; if (!isset ($box)) { // empty if (!$document->contentEditable) $mod->data = $store->control->read ('modBox_moduleCreate'); else $box = array(); } // empty if ($document->contentEditable) { // editable $mod->data['local']['editable'] = 1; $mod->data['local']['id'] = $me->id; $mod->data['local']['number'] = $number; } // editable $pathway = array ($document->domain->name, '-dialog', 'box'); foreach (array_slice ($me->pathway, 1, -1) as $folder) { // each folder $pathway[] = $folder; } // each folder $pathway[] = $name . CHR_FNS . $number; $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modBox_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // personalite if (!isset ($box)) return; $mod->data['local']['list'] = 'box'; $mod->appendChild ($box); $mod->enabled = true; } // function setModule } // class eclMod_modBox //!eof:library/modBox/eclMod_modBox.php; //!file:library/modChildrens/eclMod_modChildrens.php; class eclMod_modChildren { // class eclMod_modChildren public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; if (!is_object ($render->data)) return; $me = $render->data; foreach ($me->children () as $child) { // each child if (!$document->access ($child->access, $child->groups)) continue; $mod->appendChild ($child) ->ref ($child->pathway) ->virtual ($child->access) ->swapTitle (); } // each child if (!$mod->children) return; if (isset ($render->blocks['modules/children'])) $mod->data = $render->blocks['modules/children']; else $mod->data = $store->control->read ('modules/navbar'); $mod->enabled = true; } // function setModule } // class eclMod_modChildren //!eof:library/modChildrens/eclMod_modChildrens.php; //!file:library/modContent/eclMod_modContent.php; class eclMod_modContent { // class eclMod_modContent public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; if (!isset ($document->data['text']['content']) and !$document->contentEditable) return; $mod->appendChild ($document->data) ->set ('editable', $document->contentEditable); if (isset ($render->blocks['modules/content'])) $mod->data = $render->blocks['modules/content']; else $mod->data = $store->control->read ('modContent_module'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-dialog', 'mod_content'); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modContent_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modContent //!eof:library/modContent/eclMod_modContent.php; //!file:library/modContext/eclMod_modContext.php; class eclMod_modContext extends eclEngine_listItem { // class eclMod_modContext public $mode = false; private $help = false; public $enabled = true; public $document; public function __construct ($document) { // function __construct global $store; $this->document = $document; } // function __construct public function help ($name) { // function help global $store; $data = $store->control->read ($name); if ($data) { // context help found $this->help = $this->document->createListItem ($data) ->virtual () ->swapTitle () ->dialog ($data); } // context help found } // function help public function setModule ($mod, $arguments) { // function setModule global $store; if (!$this->enabled) return; $document = $this->document; $mod->children = $this->children; if ($this->help) $mod->children[] = $this->help; foreach ($mod->children as &$child) { // each child $child->data['virtual'] = 1; } // each child if (!$document->access (2) and ($document->application->userId or $document->application->id)) { // abuse report $mod->appendChild ('modWelcome_goReport') ->ref (true, true, '_preload-report') ->active ($document->actions ('alert', 'report')); } // abuse report if (!$mod->children) return; if (isset ($document->data['flags']['modContext_mode'])) $name = 'context_' . $document->data['flags']['modContext_mode']; $mod->data = $store->control->read ('modContext_module'); $mod->enabled = true; } // function setModule } // class eclMod_modContext //!eof:library/modContext/eclMod_modContext.php; //!file:library/modDinamic/eclApp_modDinamic.php; class eclApp_modDinamic { // class eclApp_modDinamic static function is_child ($me, $name) { // function is_child if ($name == 'dinamic') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('dinamic'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modDinamic_content'); $me->isDomain = true; $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $parts = explode (CHR_FNS, end ($document->pathway)); if (count ($parts) < 2) return; list ($name, $number) = $parts; if ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else $me = $document->application->findChild ($name); if (!$me) return; if (!$document->access (4, $me->groups)) return; if (isset ($me->data['extras']['dinamic_' . $number])) $data = $me->data['extras']['dinamic_' . $number]; else $data = array (); $formulary = $document->createFormulary ('modDinamic_edit', $data); $formulary->pathway = $document->pathway; if ($formulary->save ()) { // save formulary if (!isset ($formulary->data['local']['list'])) $formulary->data['local']['list'] = 'default'; $me->data['extras']['dinamic_' . $number] = $formulary->data; $document->dataReplace ('dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('dialog_tabs'); } // function dispatch } // class eclApp_modDinamic //!eof:library/modDinamic/eclApp_modDinamic.php; //!file:library/modDinamic/eclMod_modDinamic.php; class eclMod_modDinamic { // class eclMod_modDinamic public $document, $name; public function __construct ($document, $name=false) { // function __construct $this->document = $document; $this->name = $name; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; $row = $mod->appendChild(); if (!$document->domain->domainId) return; // Identifique o nome da seção e o número do painel if ($this->name !== false) { // set name $arguments[0] = $this->name; $arguments[1] = '0'; } // set name if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // search $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) $me = $document->application; elseif ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // search $number = isset ($arguments[1]) ? $arguments[1] : '0'; if (!isset ($name)) $name = $me->name; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['dinamic_' . $number])) { // module exists $array = $me->data['extras']['dinamic_' . $number]; $mod->data = $array; } // module exists if ($document->access (4)) { // personalite $mod->enabled = true; if (!isset ($array)) $mod->data = $store->control->read ('modDinamic_moduleCreate'); $pathway = array ($document->domain->name, '-dialog', 'dinamic', $name . CHR_FNS . $number); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modDinamic_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; if (!isset ($array)) return; } // personalite // configurações de listagem if (isset ($mod->data['local'])) $local = $mod->data['local']; else $local = array(); isset ($local['list_sort']) or $local['list_sort'] = 'index'; isset ($local['list_direction']) or $local['list_direction'] = 'asc'; isset ($local['list_max']) or $local['list_max'] = 5; isset ($local['list_update']) or $local['list_update'] = 'auto'; isset ($local['list_offset']) or $local['list_offset'] = 0; isset ($local['list_filter']) or $local['list_filter'] = ''; // Extract items switch ($me->data['mode']) { // switch mode case MODE_SECTION: switch ($me->data['flags']['section_type']) { // switch section type case 'folder': $children = $store->domainContent->children ($me->domainId, MODE_SECTION, $me->id); break; case 'blog': $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id); } // switch section type break; case MODE_DOMAIN: if ($me->data['name'] == '-index') $children = $store->domainContent->children ($me->domainId, MODE_SECTION, 0); elseif ($me->data['name'] == '-recents' and isset ($me->data['links']['pages'])) { // recents foreach ($me->data['links']['pages'] as $name) { // each page $children[] = $store->domainContent->open ($me->domainId, $name); } // each page } // recents break; case MODE_CATEGORY: if (isset ($me->data['links']['pages'])) { // category pages foreach ($me->data['links']['pages'] as $name) { // each page $children[] = $store->domainContent->open ($me->domainId, $name); } // each page } // category pages } // switch mode if (!isset ($children) or !$children) return; $sort = $local['list_sort']; $filter = $local['list_filter']; switch ($sort) { // switch list sort case 'name': case 'index': case 'created': case 'updated': case 'event_start': case 'comments_last_update': case 'hits': case 'value': case 'spotlight': $sorted = array(); foreach ($children as $data) { // each child if (!$data) continue; if ($filter == 'event_start' and $data['event_start'] < TIME) continue; elseif ($filter == 'spotlight' and !$data['spotlight']) continue; if (isset ($data[$sort])) $sorted[$data[$sort]][] = $data; else $sorted['zzzzzzzzz'][] = $data; } // each child if ($local['list_direction'] == 'asc') ksort ($sorted); else krsort ($sorted); $children = array (); foreach ($sorted as $equal) { // each value foreach ($equal as $data) { // each equal $children[] = $data; } // each equal } // each value break; case 'shuffle': shuffle ($children); break; } // switch list sort switch ($local['list_update']) { // switch update mode case 'auto': $offset = 0; break; case 'hits': $offset = mt_rand (0, count ($children)); break; case 'hour': $offset = intval (date ('G')); break; case 'day': $offset = intval (date ('z')); break; case 'week': $offset = intval (date ('W')); break; case 'month': $offset = intval (date ('n')); break; default: $offset = 0; } // switch update mode $total = count ($children); if (!$total) return; if ($local['list_max'] == 0 or $local['list_max'] > $total) $max = $total; else $max = $local['list_max']; $offset += $local['list_offset']; $offset = $offset % $total; for ($i = 0; $i < $max; $i++) { // each child $data = $children[$offset]; $post = $me->findChild ($data['name']); if ($post and $document->access ($post->access, $post->groups)) { // access ok $row->appendChild ($data) ->set ('editable', $document->contentEditable and $document->access (4, $post->groups)) ->ref ($post->pathway); } // access ok $offset++; if ($offset >= $total) $offset = 0; } // each child if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_modDinamic //!eof:library/modDinamic/eclMod_modDinamic.php; //!file:library/modEditor/document/eclMod_modEditor_document.php; class eclMod_modEditor_document { // class eclMod_modEditor_document public $mode = false; public $enabled = false; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $control = $store->control->read ('modEditor_document_module'); $mod->data = $control; $mod->appendChild ('modEditor_document_save') ->set ('ref', 'javascript:humperstilshen.refresh()'); $mod->enabled = true; } // function setModule } // class eclMod_modEditor_document //!eof:library/modEditor/document/eclMod_modEditor_document.php; //!file:library/modEditor/eclApp_modEditor.php; class eclApp_modEditor { // class eclApp_modEditor static function is_child ($me, $name) { // function is_child if ($name == 'wysiwyg') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('wysiwyg'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // dispatch if (!isset ($document->received['fields'])) return; foreach (explode (' ', $document->received['fields']) as $from) { // each field if (!isset ($from[0])) continue; $parts = explode ('_', $from); $length = count ($parts); if ($length == 1) continue; switch ($parts[1]) { // switch target case 'caption': case 'title': case 'description': case 'content': self::update_text ($document, $from); break; case 'box': if ($length == 3) self:: update_box ($document, $from); break; case 'table': if ($length == 5) self::update_table ($document, $from); break; } // switch target } // each field } // dispatch static function &get_data ($document, $id) { // function get_data global $store; $empty = array(); $data = &$store->domainContent->openById ($document->domain->domainId, intval ($id)); if (!$data) return $empty; if ($data['mode'] == MODE_DOMAIN and $document->access (4, $document->domain->groups)) return $data; $me = $document->domain->findChild ($data['name']); if ($me == false) return $empty; if ($document->access (4, $me->groups)) return $data; return $empty; } // function get_data static function update_text ($document, $from) { // function update_text list ($id, $field) = explode ('_', $from); $data = &self::get_data ($document, $id); if (!$data) return; if (!isset ($data['text'][$field])) $data['text'][$field] = array(); if (isset ($document->received[$from][0])) { // received if ($field == 'content') $data['text'][$field][$document->lang] = array (4 => 1, 5 => 2, 6 => 1); else $data['text'][$field][$document->lang] = array(); $data['text'][$field][$document->lang][1] = $document->received[$from]; if ($document->charset == 'ISO-8859-1') $data['text'][$field][$document->lang][2] = 1; } // received else unset ($data['text'][$field][$document->lang]); } // function update_text static function update_box ($document, $from) { // function update_box list ($id, $target, $number) = explode ('_', $from); $data = &self::get_data ($document, $id); if (!$data) return; $target .= '_' . $number; if (!isset ($data['extras'][$target])) $data['extras'][$target] = array(); if (isset ($document->received[$from][0])) { // received $data['extras'][$target]['content'][$document->lang] = array ( 1 => $document->received[$from], 4 => 1, 5 => 2, 6 => 1 ); if ($document->charset == 'ISO-8859-1') $data['extras'][$target]['content'][$document->lang][2] = 1; } // received else unset ($data['extras'][$target]['content'][$document->lang]); } // function update_box static function update_table ($document, $from) { // function update_table static $saved = array(); list ($id, $target, $number) = explode ('_', $from); if (isset ($saved[$id . '_table_' . $number])) return; $saved[$id . '_table_' . $number] = true; $data = &self::get_data ($document, $id); if (!$data) return; if (!isset ($data['extras']['table_' . $number]['table'])) return; $received = $document->received; $table = &$data['extras']['table_' . $number]['table']; $numCols = 0; foreach ($table as $row) { // each row if (count ($row) > $numCols) $numCols = count ($row); } // each row $numRows = count ($table); $newTable = array(); for ($indexRow = 0; $indexRow < $numRows; $indexRow ++) { // each row for ($indexCol = 0; $indexCol < $numCols; $indexCol ++) { // each column if (isset ($received[$id . '_table_' . $number . '_' . $indexRow . '_' . $indexCol])) $content = $received[$id . '_table_' . $number . '_' . $indexRow . '_' . $indexCol]; elseif (isset ($table[$indexRow][$indexCol])) $content = $table[$indexRow][$indexCol]; else $content = ''; $newTable[$indexRow][$indexCol] = $content; } // each column } // each row $table = $newTable; } // function update_table } // class eclApp_modEditor //!eof:library/modEditor/eclApp_modEditor.php; //!file:library/modEditor/eclMod_modEditor.php; class eclMod_modEditor { // class eclMod_modEditor public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function enable () { // function enable $document = $this->document; if ($document->printableLayout) return; if ($document->actions ('wysiwyg', 'enable')) unset ($document->user->data['flags']['modContent_wysiwygDisabled']); elseif ($document->actions ('wysiwyg', 'disable')) $document->user->data['flags']['modContent_wysiwygDisabled'] = 1; if (isset ($document->user->data['flags']['modContent_wysiwygDisabled'])) { // disabled $document->mod->interface->appendChild ('modEditor_contextWisiwygEnable') ->ref (true, true, '_wysiwyg-enable'); } // disabled else { // enabled $document->mod->interface->appendChild ('modEditor_contextWisiwygDisable') ->ref (true, true, '_wysiwyg-disable'); $document->contentEditable = true; } // enabled } // function enable public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->contentEditable ) return; $control = $store->control->read ('modEditor_module'); $mod->data = $control; $mod->data['local']['ref_submit'] = $document->ref (true, true, '_preload-wysiwyg'); $mod->enabled = true; } // function setModule } // class eclMod_modEditor //!eof:library/modEditor/eclMod_modEditor.php; //!file:library/modEditor/insert/eclMod_modEditor_insert.php; class eclMod_modEditor_insert { // class eclMod_modEditor_insert public $mode = false; public $enabled = false; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $control = $store->control->read ('modEditor_insert_module'); $mod->data = $control; foreach ($control['children'] as $childName) { // each child $child = $store->control->read ($childName); // $local['ref_icon'] = $document->refFiles ('icons/editor/' . $child['local']['icon'], true, '-shared'); $item = $mod->appendChild ($child); if (isset ($child['local']['target'])) { // find next empty module $target = $child['local']['target']; if ($target == 'img') $number = 0; else $number = 1; for (; $number < 100; $number ++) { // check existing module if (!isset ($me->data['extras'][$target . '_' . $number])) break; } // check existing module if (isset ($child['local']['insert_module'])) $item->data['ref'] = "javascript:EcolaboreEditor.insertModule('" . $target . ':' . $number . "')"; } // find next empty module else $number = 0; if (isset ($child['local']['dialog'])) { // reference $pathway = $document->pathway; $domain = array_shift ($pathway); if (!$pathway) $pathway[] = '-index'; array_unshift ($pathway, $domain, '-dialog', $child['local']['dialog']); if ($number) { // add the number $name = array_pop ($pathway); $pathway[] = $name . CHR_FNS . $number; } // add the number $item->ref ($pathway, true, '_return-tag') ->popUpOpen (400, 300); } // reference } // each child $mod->enabled = true; } // function setModule } // class eclMod_modEditor_insert //!eof:library/modEditor/insert/eclMod_modEditor_insert.php; //!file:library/modEditor/objects/eclMod_modEditor_objects.php; class eclMod_modEditor_objects { // class eclMod_modEditor_objects public $mode = false; public $enabled = false; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $base = array_slice ($me->pathway, 1); $name = array_pop ($base); if (!$me->domainId or !isset ($me->data['mode']) or !$document->access (4)) return; switch ($me->data['mode']) { // switch mode case MODE_SECTION: $modeCaption = $store->control->read ('modEditor_objects_ofSection'); break; case MODE_POST: $modeCaption = $store->control->read ('modEditor_objects_ofPost'); break; default: $modeCaption = $store->control->read ('modEditor_objects_ofPage'); } // switch mode $documentObjects = array(); $contentObjects = array(); foreach ($me->data['extras'] as $field => $object) { // each object $parts = explode ('_', $field); if (count ($parts) < 2) continue; list ($target, $number) = $parts; switch ($target) { // switch target case 'audio': case 'box': case 'file': case 'html': case 'img': case 'table': case 'video': if ($number == '0') $documentObjects[$field] = $object; else $contentObjects[$field] = $object; } // switch target } // each object ksort ($documentObjects); ksort ($contentObjects); foreach ($documentObjects as $field => $object) { // each document object list ($target, $number) = explode ('_', $field); $pathway = $base; array_unshift ($pathway, $document->domain->name, '-dialog', $target); $pathway[] = $name . CHR_FNS . $number; $caption = $store->control->read ('modEditor_objects_' . $target); $local['caption'] = $document->textMerge ($caption['text']['caption'], ' ', $modeCaption['text']['caption']); $mod->appendChild ($local) ->ref ($pathway) ->popUpOpen (); } // each document object foreach ($contentObjects as $field => $object) { // each content object list ($target, $number) = explode ('_', $field); $pathway = $base; array_unshift ($pathway, $document->domain->name, '-dialog', $target); $pathway[] = $name . CHR_FNS . $number; $caption = $store->control->read ('modEditor_objects_' . $target); $local['caption'] = $document->textMerge ($caption['text']['caption'], ' ' . $number); $mod->appendChild ($local) ->ref ($pathway) ->popUpOpen (); } // each content object if (!$mod->children) return; $mod->data = $store->control->read ('modEditor_objects_module'); $mod->enabled = true; } // function setModule } // class eclMod_modEditor_objects //!eof:library/modEditor/objects/eclMod_modEditor_objects.php; //!file:library/modFile/eclMod_modFile.php; class eclMod_modFile { // class eclMod_modFile public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->domain->domainId) return; if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // search $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) $me = $document->application; elseif ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // search $number = isset ($arguments[1]) ? $arguments[1] : '0'; if (!isset ($name)) $name = $me->name; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['file_' . $number])) { // module exists $file = $me->data['extras']['file_' . $number]; $mod->data = $file; $mod->enabled = true; } // module exists if ($document->access (4, $me->groups)) { // personalite $mod->enabled = true; if (isset ($file)) { // modify $pathway = array ($document->domain->name, '-dialog', 'file'); foreach (array_slice ($me->pathway, 1, -1) as $folder) { // each folder $pathway[] = $folder; } // each folder $pathway[] = $name . CHR_FNS . $number; $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modFile_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // modify } // personalite $mod->data['local']['number'] = $number; $mod->data['local']['list'] = 'details'; $mod->data['local']['details'] = 'media_file'; if (isset ($file)) $local['extras'] = array ('file_' . $number => $file); $local['pathway'] = $me->pathway; $mod->appendChild ($local); } // function setModule } // class eclMod_modFile //!eof:library/modFile/eclMod_modFile.php; //!file:library/modFormulary/eclMod_modFormulary.php; class eclMod_modFormulary { // class eclMod_modFormulary public function setModule () { // function setModule } // function setModule } // class eclMod_modFormulary //!eof:library/modFormulary/eclMod_modFormulary.php; //!file:library/modHits/eclMod_modHits.php; class eclMod_modHits { // class eclMod_modHits public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; if (!isset ($document->data['hits']) or !$document->data['hits']) return; $mod->appendChild ($document->data); if (isset ($render->blocks['modules/hits'])) $mod->data = $render->blocks['modules/hits']; else $mod->data = $store->control->read ('modHits_module'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-dialog', 'mod_hits'); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modHits_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modHits //!eof:library/modHits/eclMod_modHits.php; //!file:library/modHtml/eclMod_modHtml.php; class eclMod_modHtml { // class eclMod_modHtml public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->domain->domainId) return; if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // search $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) $me = $document->application; elseif ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // search $number = isset ($arguments[1]) ? $arguments[1] : '0'; if (!isset ($name)) $name = $me->name; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['html_' . $number])) { // module exists $html = $me->data['extras']['html_' . $number]; $mod->data = $html; $mod->enabled = true; } // module exists if ($document->access (4, $me->groups)) { // personalite $mod->enabled = true; if (!isset ($html)) { // empty $mod->data = $store->control->read ('modHtml_moduleCreate'); $mod->appendChild ($mod->data); } // empty $pathway = array ($document->domain->name, '-dialog', 'html'); foreach (array_slice ($me->pathway, 1, -1) as $folder) { // each folder $pathway[] = $folder; } // each folder $pathway[] = $name . CHR_FNS . $number; $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modHtml_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // personalite if (!isset ($html)) return; $mod->data['local']['list'] = 'html'; $mod->appendChild ($html); } // function setModule } // class eclMod_modHtml //!eof:library/modHtml/eclMod_modHtml.php; //!file:library/modHumperstilshen/eclMod_modHumperstilshen.php; class eclMod_modHumperstilshen extends eclEngine_listItem { // class eclMod_modHumperstilshen public $children = array(); public $loginError = false; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $menu = $document->createListItem (array ('name' => 'menu', 'add_close_button' => 1)); if ($document->application->isDomain) { // is domain $menu->appendChild (array ('name' => 'context')); } // is domain elseif ($document->access (1)) { // connected if ($document->application->userId) $menu_list = array ('context', 'user_tools', 'user'); elseif (!$document->contentEditable) $menu_list = array ('context', 'editor_objects', 'interface', 'toolbox', 'user'); else $menu_list = array ('context', 'interface', 'toolbox', 'user'); if (!$menu_list and $this->children) $menu_list = array ('context'); foreach ($menu_list as $menuName) { // each menu $menu->appendChild (false, array ('name' => $menuName)); } // each menu if ($document->contentEditable) { // editor menu $editor = $this->appendChild (array ('name' => 'editor', 'add_close_button' => 1)); $editor->appendChild (array ('name' => 'editor_document')); $editor->appendChild (array ('name' => 'editor_objects')); $editor->appendChild (array ('name' => 'editor_insert')); } // editor menu } // connected else { // login $menu->appendChild (array ('name' => 'login')); $menu->appendChild (array ('name' => 'user_welcome')); if ($this->loginError) $menu->data['alert'] = 1; } // login if (!$menu->children) return; // Refresh window $mod->data['local']['refresh'] = $document->ref (); $mod->children = $this->children; $mod->appendChild ($menu); $mod->enabled = true; } // function setModule public function alert ($alert, $formulary=false) { // function alert $local = array ('alert' => 1); return $this->dialog ($alert, $local, $formulary); } // function alert public function dialog ($data, $local=array(), $formulary=false) { // function dialog global $store; if (is_string ($data)) $data = $store->control->read ($data); if (isset ($data['msg'])) $data = array_replace ($store->control->read ($data['msg']), $data); if ($local) $data = array_replace ($data, $local); $data['is_formulary'] = 1; $data['name'] = 'dialog_' . (1 + count ($this->children)); if (isset ($data['flags']['control_icon'])) $icon = $data['flags']['control_icon']; elseif (isset ($data['default_icon'])) $icon = $data['default_icon']; if (isset ($icon)) { // set icon $data['icon'] = $this->document->refFiles ('icons/humperstilshen/' . $icon . '.png', true, '-shared'); $iconDescription = $store->control->read ('modHumperstilshen_icon' . ucfirst ($icon)); if (isset ($iconDescription['text']['caption'])) $data['icon_description'] = $iconDescription['text']['caption']; } // set icon $dialog = $this->document->createListItem ($data); if ($formulary) $dialog->childrenMerge ($formulary->create ()); elseif (isset ($data['ref'])) $dialog->data['add_confirm_button'] = 1; else $dialog->data['add_close_button'] = 1; $this->children[] = $dialog; return "javascript:humperstilshen.dialogOpen('dialog_" . count ($this->children) . "')"; } // function dialog } // class eclMod_modHumperstilshen //!eof:library/modHumperstilshen/eclMod_modHumperstilshen.php; //!file:library/modImg/eclApp_modImg.php; class eclApp_modImg { // class eclApp_modImg static function is_child ($me, $name) { // function is_child if ($name == 'img') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('img'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modImg_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $pathway = $document->pathway; array_shift ($pathway); // domain array_shift ($pathway); // -dialog array_shift ($pathway); // img if (!isset ($document->actions['create'])) { // edit $name = array_pop ($pathway); $parts = explode (CHR_FNS, $name); if (count ($parts) == 2) list ($name, $number) = $parts; else $number = '0'; $pathway[] = $name; } // edit $me = $document->domain; foreach ($pathway as $childName) { // each name $me = $me->child ($childName); if ($me === false) return; } // each name if (!$document->access (4, $me->groups) or !isset ($me->data['name'])) return; if (!isset ($number)) { // find last index for ($number = 1; $number < 100; $number++) { // find number if (!isset ($me->data['extras']['img_' . $number])) break; } // find number $document->pathway[count ($document->pathway) - 1] .= CHR_FNS . $number; } // find last index if (isset ($me->data['extras']['img_' . $number])) $data = $me->data['extras']['img_' . $number]; else $data = array (); $formulary = $document->createFormulary ('modImg_edit', $data); $formulary->pathway = $document->pathway; if (isset ($document->actions['create'])) $formulary->action = '_return-tag'; $formulary->flags['target_name'] = $me->data['name']; $formulary->flags['target_index'] = $number; $formulary->multipart = true; if ($formulary->save ()) { // save formulary $me->data['extras']['img_' . $number] = $formulary->data; $document->dataReplace ('dialog_close'); if ($document->actions ('return', 'tag')) $document->data['module'] = 'img:' . $number; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_modImg //!eof:library/modImg/eclApp_modImg.php; //!file:library/modImg/eclFilter_modImg.php; /* * Valid control flags * control_type = file * control_filter = modImg * control_field_name * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg */ class eclFilter_modImg { // class eclFilter_modImg static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'file'; // help if (isset ($control['flags']['control_help']) and !isset ($control['flags']['control_help_msg'])) $local['control_help_msg'] = 'systemFormulary_filterImgHelp'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $flags = $formulary->flags; $received = $formulary->received; if ($formulary->errorMsg !== false) return; if (!isset ($_FILES[$fieldName]['type'])) { // error if (isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'systemFormulary_filterImgNotUploaded'); return false; } // error isset ($flags['img_size']) or $flags['img_size'] = 3840; isset ($flags['img_mini_size']) or $flags['img_mini_size'] = 256; isset ($flags['img_interlace']) ? $flags['img_interlace'] = true : $flags['img_interlace'] = false; isset ($flags['target_name']) or $flags['target_name'] = $formulary->data['name']; isset ($flags['target_index']) or $flags['target_index'] = 0; $uploaded = $_FILES[$fieldName]['tmp_name']; if (@getimagesize ($uploaded) === false) { // error if (isset ($control['flags']['control_error'])) return $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterImgNotUploaded'); return false; } // error list ($width_orig, $height_orig, $type) = getimagesize ($uploaded); $ratio_orig = $width_orig / $height_orig; // Calculate big image size if ($width_orig > $flags['img_size'] or $height_orig > $flags['img_size']) { // resize big image $img_width = $flags['img_size']; $img_height = $flags['img_size']; if ($img_width / $img_height > $ratio_orig) $img_width = $img_height * $ratio_orig; else $img_height = $img_width / $ratio_orig; } // resize big image else { // keep image size $img_width = $width_orig; $img_height = $height_orig; } // keep image size settype ($img_width, 'int'); settype ($img_height, 'int'); // Calculate miniature size if ($width_orig > $flags['img_mini_size'] or $height_orig > $flags['img_mini_size']) { // resize miniature $mini_width = $flags['img_mini_size']; $mini_height = $flags['img_mini_size']; if ($mini_width / $mini_height > $ratio_orig) $mini_width = $mini_height * $ratio_orig; else $mini_height = $mini_width / $ratio_orig; } // resize miniature else { // keep image size $mini_width = $width_orig; $mini_height = $height_orig; } // keep image size settype ($mini_width, 'int'); settype ($mini_height, 'int'); // Suported formats are if ($type == 1) $ext = '.gif'; elseif ($type == 2) $ext = '.jpg'; elseif ($type == 3) $ext = '.png'; else return 'systemFormulary_alertImgWrongFormat'; // Opens received file if ($type == 1) $image_orig = @imagecreatefromgif ($uploaded); elseif ($type == 2) $image_orig = @imagecreatefromjpeg ($uploaded); elseif ($type == 3) $image_orig = @imagecreatefrompng ($uploaded); if (!$image_orig) return 'systemFormulary_alertImageError'; $name = $flags['target_name'] . CHR_FNS; if ($flags['target_index']) $name .= $flags['target_index'] . CHR_FNS; $filename = FOLDER_DOMAINS . $formulary->document->domain->name . '/' . $name; // Resample big image $image_big = imagecreatetruecolor ($img_width, $img_height); imagecopyresampled ($image_big, $image_orig, 0, 0, 0, 0, $img_width, $img_height, $width_orig, $height_orig); // save big image if ($type == 1) $saved = imagegif ($image_big, $filename . $ext); elseif ($type == 2) $saved = imagejpeg ($image_big, $filename . $ext, 100); elseif ($type == 3) { // png file $saved = move_uploaded_file ($_FILES[$fieldName]['tmp_name'], $filename . $ext); $saved = true; // $saved = imagepng ($image_big, $filename . $ext); } // png file if (!$saved) return 'systemFormulary_alertImgError'; // Resample miniature $image_mini = imagecreatetruecolor ($mini_width, $mini_height); imagecopyresampled ($image_mini, $image_orig, 0, 0, 0, 0, $mini_width, $mini_height, $width_orig, $height_orig); // save miniature if ($type == 1) $saved = imagegif ($image_mini, $filename . 'mini.gif'); elseif ($type == 2) $saved = imagejpeg ($image_mini, $filename . 'mini.jpg', 100); elseif ($type == 3) { // png $saved = true; } // png if (!$saved) return 'systemFormulary_alertImgError'; // save image data if (!isset ($control['flags']['control_target'])) $data = &$formulary->data; else { // find target if (!isset ($formulary->data['extras'])) $formulary->data['extras'] = array (); if (!isset ($formulary->data['extras']['img_0'])) $formulary->data['extras']['img_0'] = array (); $data = &$formulary->data['extras']['img_0']; } // find target $data['img'] = $name . $ext; $data['img_width'] = $img_width; $data['img_height'] = $img_height; if ($type == 3) { // png hack $data['img_mini'] = $name . $ext; $data['img_mini_width'] = $img_width; $data['img_mini_height'] = $img_height; } // png hack else { // normal $data['img_mini'] = $name . 'mini' . $ext; $data['img_mini_width'] = $mini_width; $data['img_mini_height'] = $mini_height; } // normal if ($width_orig < $height_orig) $data['portrait'] = 'portrait'; else $data['landscape'] = 'landscape'; } // function save } // class eclFilter_modImg //!eof:library/modImg/eclFilter_modImg.php; //!file:library/modImg/eclFilter_modImg_view.php; /* * Valid control flags * control_type = content * control_filter = modImg_view */ class eclFilter_modImg_view { // class eclFilter_modImg_view static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; if (!isset ($formulary->data['extras']['img_0'])) return; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'content'; $local['text']['content']['pt'] = array ( TEXT_CONTENT => '
      ', TEXT_HTML => 2 ); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_modImg_view //!eof:library/modImg/eclFilter_modImg_view.php; //!file:library/modImg/eclMod_modImg.php; class eclMod_modImg { // class eclMod_modImg public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->domain->domainId) return; if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // search $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) $me = $document->application; elseif ($name == '-index') $me = $document->domain->child (''); elseif ($name == '-recents') $me = $document->domain->child ('-recents'); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // search $number = isset ($arguments[1]) ? $arguments[1] : '0'; if (!isset ($name)) $name = $me->name; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['img_' . $number])) { // module exists $img = $me->data['extras']['img_' . $number]; $mod->data = $img; } // module exists if ($document->access (4, $me->groups)) { // personalite $mod->enabled = true; if (!isset ($img)) $mod->data = $store->control->read ('modImg_moduleCreate'); $pathway = array ($document->domain->name, '-dialog', 'img'); foreach (array_slice ($me->pathway, 1, -1) as $folder) { // each folder $pathway[] = $folder; } // each folder $pathway[] = $name . CHR_FNS . $number; $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modImg_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // personalite if (!isset ($img)) return; $mod->data['local']['list'] = 'details'; $mod->data['local']['details'] = 'img'; $local['extras'] = array ('img_0' => $img); $mod->appendChild ($local); $mod->enabled = true; } // function setModule } // class eclMod_modImg //!eof:library/modImg/eclMod_modImg.php; //!file:library/modInstructor/eclInstructor_modInstructor_ava.php; class eclInstructor_modInstructor_ava { // class eclInstructor_modInstructor_ava static function route ($instructor) { // function route global $store; $document = $instructor->document; $me = $document->application; return false; } // function route } // class eclInstructor_modInstructor_ava //!eof:library/modInstructor/eclInstructor_modInstructor_ava.php; //!file:library/modInstructor/eclInstructor_modInstructor_welcome.php; class eclInstructor_modInstructor_welcome { // class eclInstructor_modInstructor_welcome static function route ($instructor) { // function route global $store; $document = $instructor->document; $me = $document->application; if ($me->applicationName != 'domain_empty') { // index page exists if ($me->applicationName == 'domainIndex' and $document->access (4) and !$store->domainContent->children ($me->domainId, MODE_SECTION, 0)) { // before new sections if (isset ($document->actions['login'])) goto WELCOME_RETURN; if ($document->actions ('first', 'edit', 'save')) goto WELCOME_DONE; if (!isset ($document->actions['instructor'])) goto WELCOME_DONE; } // before new sections return false; } // index page exists if ($document->access (4)) { // admin if (isset ($document->actions['login'])) goto WELCOME_EDIT; if ($document->mod->formulary->errorMsg) goto WELCOME_EDIT_ERROR; goto WELCOME_EDIT; } // admin if ($document->access (1)) goto WELCOME_ACCESS_DENIED; if ($document->mod->humperstilshen->loginError) goto WELCOME_LOGIN_ERROR; goto WELCOME_EMPTY; WELCOME_EMPTY: $instructor->addMessage ('domain_empty_help01empty'); $instructor->addMessage ('domain_empty_help01login'); return true; WELCOME_LOGIN_ERROR: $instructor->addMessage ('domain_empty_help01empty'); $instructor->addMessage ('domain_empty_help02loginError'); return true; WELCOME_ACCESS_DENIED: $instructor->addMessage ('domain_empty_help02accessDenied'); return true; WELCOME_EDIT: if (isset ($document->user->data['flags']['gender']) and $document->user->data['flags']['gender'] == 'female') $instructor->addMessage ('domain_empty_help02welcomeAdmin_f'); else $instructor->addMessage ('domain_empty_help02welcomeAdmin_m'); $instructor->addMessage ('domain_empty_help04index01edit'); return true; WELCOME_EDIT_ERROR: $instructor->addMessage ('domain_empty_help04index01edit'); $instructor->addMessage ('domain_empty_help04index01editError'); return true; WELCOME_DONE: $instructor->addMessage ('domain_empty_help04index02editDone') ->ref (true, true, '_instructor-next'); return true; WELCOME_RETURN: $instructor->addMessage ('domain_empty_help04index02return') ->ref (true, true, '_instructor-next'); return true; } // function route } // class eclInstructor_modInstructor_welcome //!eof:library/modInstructor/eclInstructor_modInstructor_welcome.php; //!file:library/modInstructor/eclMod_modInstructor.php; class eclMod_modInstructor { // class eclMod_modInstructor public $document; public $messages = array (); public function __construct ($document) { // function __construct global $store; $this->document = $document; if ($document->access (1)) { // context help $help = $document->application->applicationName . '_helpAbout'; if ($help == 'section_helpAbout' and isset ($document->application->data['flags']['section_type'])) $help = 'section' . ucfirst ($document->application->data['flags']['section_type']) . '_helpAbout'; $data = $store->control->read ($help); if ($data) { // context help found $document->mod->context->appendChild ($help) ->swapTitle () ->virtual () ->dialog ($help); } // context help found } // context help } // function __construct public function addMessage ($name, $formulary=false) { // function addMessage global $store; $document = $this->document; $data = $store->control->read ($name); if (!$data) return $document->createListItem (); // audio // if (isset ($data['local']['audio'])) // $data['audio'] = $document->refFiles ($data['local']['audio'], true, '-media'); $data['audio'] = ''; // autoplay if (!isset ($document->session['modInstructor'][$name])) $data['instructor_autoplay'] = 1; $document->session['modInstructor'][$name] = true; // onload if (!isset ($data['local']['instructor_onmenuopen'])) $data['instructor_onload'] = 1; // name $data['name'] = 'message' . strval (count ($this->messages)); $message = $this->document->createListItem ($data); $this->messages[] = $message; if ($formulary) $message->childrenMerge ($formulary->create ()); return $message; } // function addMessage public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (!$document->domain->domainId) return; // Enable or disable instructor return; eclInstructor_modInstructor_welcome::route ($this) or eclInstructor_modInstructor_quality::route ($this) or eclInstructor_modInstructor_ava::route ($this); if (!$this->messages) return; $mod->data = $store->control->read ('modInstructor_module'); $mod->children = $this->messages; $mod->enabled = true; } // function setModule } // class eclMod_modInstructor //!eof:library/modInstructor/eclMod_modInstructor.php; //!file:library/modInstructor/quality/eclInstructor_modInstructor_quality.php; class eclInstructor_modInstructor_quality { // class eclInstructor_modInstructor_quality static function route ($instructor) { // function route global $store; $document = $instructor->document; $me = $document->application; if (!$document->access (4, $document->domain->groups)) return false; if ($instructor->messages) return true; $tasks = $store->control->read ('modInstructor_quality_index'); $length = count ($tasks); $last = array (); if ($me->name == '-new-section' and isset ($document->actions['create'][1]) and $store->control->read ('section' . ucfirst ($document->actions['create'][1]) . '_helpCreate')) return self::taskExec ($document, 'section' . ucfirst ($document->actions['create'][1]), $instructor, 'Create'); for ($index = 0; $index < $length; $index++) { // each task $task = $tasks[$index]; $next = isset ($tasks[$index + 1]) ? $tasks[$index + 1] : array (); if (self::taskIsDone ($document, $task)) { // task is done $last = $task; continue; } // task is done if (isset ($document->actions['login'])) { // login if (self::isInSection ($document, $last)) return self::taskExec ($document, $last, $instructor, 'Return', $task); return self::taskExec ($document, 'modInstructor_quality', $instructor, 'Redirect', $last); } // login if ($document->actions ('instructor', 'redirect')) return self::taskExec ($document, $last, $instructor, 'Return', $task); if (self::isCreating ($document, $task)) return self::taskExec ($document, $task, $instructor, 'Create'); if (self::isInSection ($document, $last)) return self::taskExec ($document, $last, $instructor, 'Done', $task); if ($document->actions ('instructor', 'message', 'create') and isset ($me->data['flags']['section_type']) and $store->control->read ('section' . ucfirst ($me->data['flags']['section_type']) . '_helpCreate')) return self::taskExec ($document, 'section' . ucfirst ($me->data['flags']['section_type']), $instructor, 'Create'); $name = $document->application->applicationName; if ($name == 'section' and isset ($document->application->data['flags']['section_type'])) $name = 'section' . ucfirst ($document->application->data['flags']['section_type']); if ($store->control->read ($name . '_helpNavigate')) { // navigation context help if ($document->application->isDomain) return self::taskExec ($document, $name, $instructor, 'Navigate'); return self::taskExec ($document, $name, $instructor, 'Navigate', $task); } // navigation context help return self::taskExec ($document, 'modInstructor_quality', $instructor, 'Navigate', $task); } // each task return false; } // function route static function taskIsDone ($document, $task) { // function taskIsDone global $store; $data = $store->control->read ($task . '_helpInstructor'); if (!isset ($data['check']) or !is_array ($data['check']) or !isset ($data['check']['mode'])) return true; switch ($data['check']['mode']) { // switch mode case 'section': return $store->domainContent->findMarker ($document->domain->domainId, $data['check']['marker'], MODE_SECTION); } // switch mode return false; } // function taskIsDone static function isInSection ($document, $task) { // function isInSection global $store; $me = $document->application; $data = $store->control->read ($task . '_helpInstructor'); if (!isset ($data['check']) or !is_array ($data['check']) or !isset ($data['check']['mode'])) return false; switch ($data['check']['mode']) { // switch mode case 'section': if (isset ($me->data['mode']) and $me->data['mode'] == MODE_SECTION and $me->data['marker'] == $data['check']['marker']) return true; return false; } // switch mode return false; } // function isInSection static function isCreating ($document, $task) { // function isCreating global $store; $me = $document->application; $data = $store->control->read ($task . '_helpInstructor'); if (!isset ($data['create']) or !is_array ($data['create']) or !isset ($data['create']['mode'])) return false; switch ($data['create']['mode']) { // switch mode case 'section': if (!isset ($data['create']['type'])) return false; if ($me->name == '-new-section' and $document->actions ('create', $data['create']['type'])) return true; return false; } // switch mode return false; } // function isCreating static function taskExec ($document, $task, $instructor, $type, $next=array ()) { // function taskExec global $store; $name = $task . '_help' . $type; $message = $instructor->addMessage ($name); if (!$next) return true; $data = $store->control->read ($next . '_helpInstructor'); if ($type == 'Redirect') { // redirect if (!isset ($data['check'])) return true; switch ($data['check']['mode']) { // switch mode case 'section': $id = $store->domainContent->findMarker ($document->domain->domainId, $data['check']['marker']); $message->ref ($store->domainContent->pathway ($document->domain->domainId, $id), true, '_instructor-redirect'); return true; } // switch mode return true; } // redirect if (isset ($data['parent'])) { // goto parent switch ($data['parent']['mode']) { // switch mode case 'section': $id = $store->domainContent->findMarker ($document->domain->domainId, $data['parent']['marker']); if ($id) { // section found $pathway = $store->domainContent->pathway ($document->domain->domainId, $id); break; } // section found case 'index': $pathway = $document->domain->pathway; break; } // switch mode } // goto parent else $pathway = $document->domain->pathway; switch ($data['create']['mode']) { // switch creating mode case 'section': $pathway[] = '-new-section'; $message->ref ($pathway, true, '_create-' . $data['create']['type']); return true; } // switch creating mode return true; } // function taskExec } // class eclInstructor_modInstructor_quality //!eof:library/modInstructor/quality/eclInstructor_modInstructor_quality.php; //!file:library/modInterface/eclMod_modInterface.php; class eclMod_modInterface extends eclEngine_listItem { // class eclMod_modInterface public $mode = false; public $enabled = true; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; if (!$this->enabled) return; $document = $this->document; $mod->children = $this->children; foreach ($mod->children as &$child) { // each child $child->data['virtual'] = 1; } // each child if ($document->access (4, $document->domain->groups) and $document->data['flags']['modLayout_from'] == 'domain') { // personalite layout $mod->appendChild ('dialogTemplate_edit') ->virtual () ->ref (array ($document->domain->name, '-dialog', 'layout', 'scheme')) ->popUpOpen (750, 550); } // personalite layout // Printable version $mod->appendChild ('modLayout_print') ->virtual () ->ref (true, true, '_layout-print'); if (!$mod->children) return; if (isset ($document->data['flags']['modContext_mode'])) $name = 'context_' . $document->data['flags']['modContext_mode']; $mod->data = $store->control->read ('modInterface_module'); $mod->enabled = true; } // function setModule } // class eclMod_modInterface //!eof:library/modInterface/eclMod_modInterface.php; //!file:library/modLanguages/eclMod_modLanguages.php; class eclMod_modLanguages { // class eclMod_modLanguages public $action = true; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; $me = $document->application; if (!isset ($me->data['text']['caption'])) return; if ($document->printableLayout) return; if ($document->domain->domainId and !isset ($document->data['id'])) return; if ($document->access (4)) $access = 1; else $access = 0; $languages = array (); if (isset ($document->domain->data['flags']['languages'])) { // set domain languages foreach ($document->domain->data['flags']['languages'] as $lang => $true) { // each enabled language $languages[$lang] = $access; } // each enabled language } // set domain languages foreach ($me->data['text']['caption'] as $lang => $value) { // each document language $languages[$lang] = 2; } // each document language $row = $mod->appendChild(); foreach ($languages as $lang => $access) { // each valid languages if ($lang == $document->lang) $active = 1; else $active = 0; if ($active or $access) { // valid language if ($access == 1) $virtual = 1; else $virtual = 0; $label = $store->control->read ('renderLabels_lang_' . $lang); if (!isset ($label['text']['caption'])) continue; $caption = array (); if (isset ($label['text']['caption'][$lang])) $caption[$lang] = $label['text']['caption'][$lang]; else $caption = $label['text']['caption']; $local = array ( 'caption' => $caption, 'virtual' => $virtual, 'icon' => $document->refFiles ('modLanguages/' . $lang . '.png', true, '-media') ); $row->appendChild (false, $local) ->active ($active) ->ref (true, $lang, $this->action); } // valid language } // each valid languages if (count ($row->children) == 1 and $active) return; if (isset ($render->blocks['modules/languages'])) $mod->data = $render->blocks['modules/languages']; else $mod->data = $store->control->read ('modLanguages_module'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-dialog', 'mod_languages'); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modLanguages_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modLanguages //!eof:library/modLanguages/eclMod_modLanguages.php; //!file:library/modLayout/eclApp_modLayout.php; class eclApp_modLayout { // class eclApp_modLayout static function is_child ($me, $name) { // function is_child if ($name == 'layout') return true; if (substr ($name, 0, 7) == 'layout_') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('layout'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modLayout_edit'); $me->map = array ('modLayout_scheme'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $name = substr ($document->application->name, 7); if (!strlen ($name)) $name = 'default'; if (!$document->access (4, $document->domain->groups)) return; $template = &$io->file->open (FOLDER_DOMAINS . $document->domain->name . '/.templates.ecl.php'); if (isset ($template['layouts/' . $name])) $data = $template['layouts/' . $name]; else $data = $store->control->read ('layouts/' . $name); if (!$data) $data = $store->control->read ('layouts/default'); $formulary = $document->createFormulary ('modLayout_edit', $data); if ($formulary->save ()) { // save formulary $template['layouts/' . $name] = $formulary->data; $template['updated'] = TIME; $document->application->data = $store->control->read ('dialog_close'); $document->mod->layout = new eclMod_dialog_layout ($document); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->application->data = $store->control->read ('dialog_tabs'); $document->mod->layout = new eclMod_dialog_layout ($document); } // function dispatch } // class eclApp_modLayout //!eof:library/modLayout/eclApp_modLayout.php; //!file:library/modLayout/eclMod_modLayout.php; class eclMod_modLayout { // class eclMod_modLayout public $from = false; public $name = false; public $document; public $application; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function fromControl ($name) { // function fromControl $this->document->data['flags']['modLayout_base'] = 'responsive'; $this->document->data['flags']['modLayout_from'] = 'control'; $this->document->data['flags']['modLayout_name'] = $name; } // function fromControl public function fromShared ($name) { // function fromShared $this->document->data['flags']['modLayout_base'] = 'responsive'; $this->document->data['flags']['modLayout_from'] = 'shared'; $this->document->data['flags']['modLayout_name'] = $name; } // function fromShared public function setModule ($mod, $arguments) { // function setModule global $io, $store; $document = $this->document; $render = $document->render; $mod->enabled = true; if (!$this->from) $this->from = $document->data['flags']['modLayout_from']; if (!$this->name) $this->name = $document->data['flags']['modLayout_name']; switch ($this->from) { // switch from case 'shared': $data = $store->control->read ('layouts/' . $this->name); break; case 'control': $data = $store->control->read ($this->name); break; case 'application': $data = $this->application->data; break; case 'domain': if ($document->access (4, $document->domain->groups)) { // administrator access // switch personalite buttons on/off if (isset ($document->actions['personalite'][1])) { // switch personalite buttons if ($document->actions['personalite'][1] == 'on') $document->session['personalite'] = 1; else unset ($document->session['personalite']); } // switch personalite buttons // display Personalite buttons and context options if (isset ($document->session['personalite'])) { // personalite buttons on $document->templateEditable = true; $document->mod->interface->appendChild ('modLayout_personaliteOff') ->ref (true, true, '_personalite-off'); } // personalite buttons on else { // personalite buttons off $document->mod->interface->appendChild ('modLayout_personaliteOn') ->ref (true, true, '_personalite-on'); } // personalite buttons off } // administrator access $templates = $store->domainContent->children ($document->domain->domainId, MODE_TEMPLATE, 0); $blocks = array(); foreach ($templates as $data) { // each template $blocks[$data['name']]['text'] = $data['text']; $blocks[$data['name']]['local'] = $data['local']; if (isset ($data['extras']['html'])) $blocks[$data['name']]['html'] = $data['extras']['html']; } // each template if (isset ($blocks['layouts/default'])) $data = $blocks['layouts/default']; else $data = $store->control->read ('layouts/default'); if ($blocks) $data['blocks'] = $blocks; break; } // switch from if (!isset ($data) or !$data) $data = $store->control->read ('layouts/default'); if (isset ($data['flags'])) $document->data['flags'] = array_replace ($document->data['flags'], $data['flags']); $mod->data = $data; } // function setModule } // class eclMod_modLayout //!eof:library/modLayout/eclMod_modLayout.php; //!file:library/modLayout/scheme/eclApp_modLayout_scheme.php; class eclApp_modLayout_scheme { // class eclApp_modLayout_scheme static function is_child ($me, $name) { // function is_child if ($name == 'scheme') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modLayout_scheme_content'); $template = $store->domainContent->open ($me->domainId, '-styles-vars'); if (!$template) { // set template $data['mode'] = MODE_TEMPLATE; $data['name'] = '-styles-vars'; $store->domainContent->insert ($me->domainId, $data); } // set template $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $user = &$store->domainContent->open ($me->domainId, '-styles-vars'); $preset = $store->control->read ('domainStylesheet_preset'); $theme = $store->control->read ('domainStylesheet_theme_default'); $colors = $store->control->read ('domainStylesheet_colors_default'); $data['local'] = $user['local']; $data['defaults'] = array_replace ($preset, $theme, $colors); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations $user['local'] = array(); return $document->dataReplace ('dialog_close'); } // restore default configurations $formulary = $document->createFormulary ('modLayout_scheme_edit', $data); if ($formulary->save()) { // save $user['local'] = $formulary->data['local']; $document->dataReplace ('dialog_close'); return; } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_modLayout_scheme //!eof:library/modLayout/scheme/eclApp_modLayout_scheme.php; //!file:library/modList/eclApp_modList.php; class eclApp_modList { // class eclApp_modList static function is_child ($me, $name) { // function is_child if (substr ($name, 0, 8) == 'section_') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('section'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modList_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; @list ($section, $module, $preset, $name) = explode ('_', $document->application->name, 4); if (!strlen ($name)) return; $me = $document->application->findChild ($name); if (!$me) return; if (!$document->access (4, $me->groups)) return; // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations unset ($me->data['extras'][$module]); return $document->dataReplace ('dialog_close'); } // restore default configurations if (isset ($me->data['extras'][$module])) $data = $me->data['extras'][$module]; elseif ($module == 'post') $data = $store->control->read ('modList_preset_' . $preset . 'Content'); else $data = $store->control->read ('modList_preset_' . $preset); if ($module == 'post') $formulary = $document->createFormulary ('modList_postEdit', $data); else $formulary = $document->createFormulary ('modList_edit', $data); if ($formulary->save ()) { // save formulary if (!isset ($formulary->data['local']['list'])) $formulary->data['local']['list'] = 'default'; $me->data['extras'][$module] = $formulary->data; $document->dataReplace ('dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataMerge ('dialog_tabs'); } // function dispatch } // class eclApp_modList //!eof:library/modList/eclApp_modList.php; //!file:library/modList/eclMod_modList.php; class eclMod_modList { // class eclMod_modList public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule } // function setModule } // class eclMod_modList //!eof:library/modList/eclMod_modList.php; //!file:library/modLogin/eclMod_modLogin.php; class eclMod_modLogin { // class eclMod_modLogin public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if ($document->access (1) or (isset ($document->data['flags']['modLogin_enabled']) and !$document->data['flags']['modLogin_enabled'])) return; $mod->data = $store->control->read ('modLogin_module'); static $instances = 0; $instances++; $formulary = $document->createFormulary ('modLogin_login', array (), 'login' . $instances . 'fields'); if ($instances == 1) $formulary->action = '_login'; else $formulary->action = '_login-' . $instances; $mod->childrenMerge ($formulary->create ()); $mod->enabled = true; } // function setModule } // class eclMod_modLogin //!eof:library/modLogin/eclMod_modLogin.php; //!file:library/modNavbar/eclMod_modNavbar.php; class eclMod_modNavbar { // class eclMod_modNavbar public $document; public $children; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; if ($document->printableLayout) return; if ($document->pathway[0] == SYSTEM_PROFILES_URI) return $this->profileNavBar (); if (isset ($render->blocks['modules/navbar'])) $mod->data = $render->blocks['modules/navbar']; else $mod->data = $store->control->read ('modNavbar_module'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $mod->enabled = true; $pathway = array ($document->domain->name, '-dialog', 'mod_navbar'); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modNavbar_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference // Vamos iniciar a partir da aplicação ativa neste documento $level = 1; $app[1] = $document->application; $names[1] = $app[1]->name; // Agora, vamos subir a escada, percorrendo o endereço reversamente while (!$app[$level]->parent->isDomain) { // loop levels $level++; $app[$level] = $app[$level - 1]->parent; $names[$level] = $app[$level]->name; } // loop levels // Vamos criar as camadas for ($i = $level; $i; $i--) { // loop each layer $children = $app[$i]->parent->menuChildren ($document, $names[$i]); if ($i == $level and count ($children) == 1) continue; if ($i == 1 and count ($children) == 1) continue; if (!count ($children)) break; $layer = $mod->appendChild (); foreach ($children as $index => $child) { // each child if ($i == $level and $index == 0) continue; $layer->appendChild ($child->data) ->ref ($child->pathway) ->virtual ($child->access) ->active ($i == 1 and $child->name == $names[$i]) ->set ('editable', $i == 1 and $child->name == $names[$i] and $child->id and $document->contentEditable and $document->access (4, $child->groups)); } // each child } // loop each layer if ($this->children) { // last level $layer = $mod->appendChild (); $layer->children = $this->children; } // last level if ($mod->children) $mod->enabled = true; } // function setModule private function profileNavBar() { // function profileNavBar } // function profileNavBar } // class eclMod_modNavbar //!eof:library/modNavbar/eclMod_modNavbar.php; //!file:library/modPages/eclMod_modPages.php; class eclMod_modPages { // class eclMod_modPages public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule } // function setModule } // class eclMod_modPages //!eof:library/modPages/eclMod_modPages.php; //!file:library/modPanel/eclMod_modPanel.php; class eclMod_modPanel { // class eclMod_modPanel public $main = array ('content', 'list', 'formulary'); public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $buffer = '['; foreach ($this->main as $modName) { // each child $buffer .= 'mod`' . $modName . '`;'; } // each child $mod->data['html'] = $buffer; $mod->enabled = true; } // function setModule } // class eclMod_modPanel //!eof:library/modPanel/eclMod_modPanel.php; //!file:library/modTable/eclApp_modTable.php; class eclApp_modTable { // class eclApp_modTable static function is_child ($me, $name) { // function is_child if ($name == 'table') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('table'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modTable_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $pathway = $document->pathway; array_shift ($pathway); // domain array_shift ($pathway); // -dialog array_shift ($pathway); // table $name = array_pop ($pathway); $parts = explode (CHR_FNS, $name); if (count ($parts) == 2) list ($name, $number) = $parts; else $number = '0'; $pathway[] = $name; $me = $document->domain; foreach ($pathway as $name) { // each name $me = $me->child ($name); if ($me === false) return; } // each name if (!$document->access (4, $me->groups)) return; if (isset ($me->data['extras']['table_' . $number])) $data = $me->data['extras']['table_' . $number]; else { // empty $data = $store->control->read ('modTable_module'); $data['table'] = array (array ('', ''), array ('', '')); } // empty $formulary = $document->createFormulary ('modTable_edit', $data); $formulary->pathway = $document->pathway; if ($formulary->save ()) { // save formulary $me->data['extras']['table_' . $number] = $formulary->data; $document->dataReplace ('dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_modTable //!eof:library/modTable/eclApp_modTable.php; //!file:library/modTable/eclFilter_modTable.php; class eclFilter_modTable { // class eclFilter_modTable static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; if (!isset ($control['flags']['control_target'])) return; $table = $formulary->appendChild ($control); $table->data['name'] = $fieldName; $array = $formulary->getField ($control['flags']['control_target']); if (!is_array ($array) or !$array) $array = array (array ('', ''), array ('', '')); // Descobre o número máximo de células por linha $maxCols = 0; $maxRows = 0; foreach ($array as $row) { // each row if (!is_array ($row)) continue; $maxRows++; if (count ($row) > $maxCols) $maxCols = count ($row); } // each row $formulary->hidden[$fieldName . '_maxRows'] = $maxRows; $formulary->hidden[$fieldName . '_maxCols'] = $maxCols; $numRow = - 1; foreach ($array as $line) { // each line if (!is_array ($line)) continue; $numRow++; $row = $table->appendChild (false, array ('row' => $numRow)); for ($i = 0; $i < $maxCols; $i++) { // each cell if (isset ($line[$i])) { // value exists $local['value'] = $formulary->htmlSpecialChars ($line[$i]); if ($document->charset != 'UTF-8') $local['value'] = mb_convert_encoding ($local['value'], $document->charset, 'UTF-8'); } // value exists else $local['value'] = ''; $local['name'] = $fieldName . '_' . $numRow . '_' . $i; $row->appendChild (false, $local); } // each cell } // each line } // function create static function save ($fieldName, $control, $formulary) { // function save $received = $formulary->received; $document = $formulary->document; if (!isset ($control['flags']['control_target'])) return; if (!isset ($received[$fieldName . '_maxRows'])) return; if (!isset ($received[$fieldName . '_maxCols'])) return; $numCols = $received[$fieldName . '_maxCols']; $numRows = $received[$fieldName . '_maxRows']; $table = array (); for ($r = 0; $r < $numRows; $r++) { // each row for ($c = 0; $c < $numCols; $c++) { // each col if (isset ($received[$fieldName . '_' . $r . '_' . $c])) $value = trim ($received[$fieldName . '_' . $r . '_' . $c]); if (!strlen ($value)) continue; if ($document->charset != 'UTF-8') $value = mb_convert_encoding ($value, 'UTF-8', $document->charset); if (!isset ($table[$r])) $table[$r] = array ($c => $value); else $table[$r][$c] = $value; } // each col } // each row $formulary->setField ($control['flags']['control_target'], $table); } // function save } // class eclFilter_modTable //!eof:library/modTable/eclFilter_modTable.php; //!file:library/modTable/eclMod_modTable.php; class eclMod_modTable { // class eclMod_modTable public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; // Encontre a aplicação if (!isset ($arguments[0])) $me = $document->application; elseif (is_numeric ($arguments[0])) { // numeric $me = $document->application; $arguments[1] = $arguments[0]; } // numeric else { // find application $name = $arguments[0]; if ($name == '-index') $me = $document->domain->child (''); else { // import $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return; } // import } // find child $number = isset ($arguments[1]) ? $arguments[1] : '0'; // A tabela não pode ser editada e está vazia if ($document->printableLayout or !$document->access (4, $me->groups)) { // user cant edit if (!isset ($me->data['extras']['table_' . $number]['table'])) return; } // user cant edit else { // user is admin // O documento está em modo de edição if ($document->contentEditable) { // content editable $editable = true; if (!isset ($me->data['extras']['table_' . $number])) $me->data['extras']['table_' . $number] = $store->control->read ('modTable_module'); if (!isset ($me->data['extras']['table_' . $number]['local']['list'])) $me->data['extras']['table_' . $number]['local']['list'] = 'table_simple'; if (!isset ($me->data['extras']['table_' . $number]['table'])) $me->data['extras']['table_' . $number]['table'] = array (array ('', ''), array ('', '')); } // content editable else { // wysiwyg disabled if (!isset ($me->data['extras']['table_' . $number])) $mod->data = $store->control->read ('modTable_moduleCreate'); } // wysiwyg disabled // anchor $pathway = $me->pathway; array_shift ($pathway); // $domain array_unshift ($pathway, $document->domain->name, '-dialog', 'table'); if (!$me->name) $name = '-index'; else $name = array_pop ($pathway); $pathway[] = $name . CHR_FNS . strval ($number); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modTable_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // user is admin $mod->enabled = true; if (!isset ($me->data['extras']['table_' . $number]['table'])) return; $mod->data = array_replace_recursive ($mod->data, $me->data['extras']['table_' . $number]); if (isset ($editable) and $editable and isset ($me->data['id'])) { // editable $mod->data['local']['editable'] = 1; $mod->data['local']['id'] = $me->data['id']; $mod->data['local']['number'] = $number; } // editable // count max cols $table = &$me->data['extras']['table_' . $number]['table']; $maxCols = 0; foreach ($table as $row) { // count columns if (count ($row) > $maxCols) $maxCols = count ($row); } // count columns $lang = $document->lang; foreach ($table as $rowData) { // each row $row = $mod->appendChild (); for ($index = 0; $index < $maxCols; $index ++) { // each column if (isset ($rowData[$index])) $local['caption'][$lang] = array (1 => $rowData[$index], 4 => 1, 5 => 2, 6 =>1); else $local = array(); $row->appendChild ($local); } // each column } // each row } // function setModule } // class eclMod_modTable //!eof:library/modTable/eclMod_modTable.php; //!file:library/modTable/new/eclApp_modTable_new.php; class eclApp_modTable_new { // class eclApp_modTable_new static function is_child ($me, $name) { // function is_child if ($name == 'table_create') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('table_create'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('modTable_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $pathway = $document->pathway; array_shift ($pathway); // domain array_shift ($pathway); // -dialog array_shift ($pathway); // table $name = array_pop ($pathway); $parts = explode (CHR_FNS, $name); if (count ($parts) == 2) list ($name, $number) = $parts; else $number = '0'; $pathway[] = $name; $me = $document->domain; foreach ($pathway as $name) { // each name $me = $me->child ($name); if ($me === false) return; } // each name if (!$document->access (4, $me->groups)) return; $formulary = $document->createFormulary ('modTable_new_edit', array (), 'create'); $formulary->pathway = $document->pathway; $formulary->action = '_create'; if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('dialog_close'); return; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $alpha = array ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); $table = array (); for ($rows = 0; $rows < $formulary->data['rows']; $rows++) { // each row $table[$rows] = array (); for ($cols = 0; $cols < $formulary->data['cols']; $cols++) { // each column $table[$rows][$cols] = ''; } // each column } // each row unset ($formulary->data['rows']); unset ($formulary->data['cols']); $formulary->data['table'] = $table; $me->data['extras']['table_' . $number] = $formulary->data; $document->dataReplace ('dialog_close'); $document->data['module'] = 'table:' . $number; return; } // save $document->dataReplace ('modTable_new_content'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_modTable_new //!eof:library/modTable/new/eclApp_modTable_new.php; //!file:library/modTitle/eclMod_modTitle.php; class eclMod_modTitle { // class eclMod_modTitle public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; if (!isset ($document->data['text']['title'])) return; $mod->appendChild ($document->data) ->set ('editable', $document->contentEditable); if (isset ($render->blocks['modules/title'])) $mod->data = $render->blocks['modules/title']; else $mod->data = $store->control->read ('modTitle_module'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-dialog', 'mod_title'); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modTitle_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modTitle //!eof:library/modTitle/eclMod_modTitle.php; //!file:library/modToolbox/eclMod_modToolbox.php; class eclMod_modToolbox { // class eclMod_modToolbox public $enabled = true; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; if (isset ($document->data['flags']['modToolbox_enabled']) and $document->data['flags']['modToolbox_enabled'] == 0) return; $app = $document->application; while (!$app->isDomain) { // loop back $app = $app->parent; } // loop back $toolbox = $app->child ('-tools'); if ($toolbox === false) return; foreach ($toolbox->menuChildren ($document) as $child) { // each child if (!isset ($child->data['text']['caption'])) continue; $local = array ( 'virtual' => 1, 'ref' => "javaScript:humperstilshen.popUpOpen('" . $document->ref ($child->pathway) . "', 400, 600)", 'caption' => $child->data['text']['caption'] ); $mod->appendChild (false, $local); } // each child if (!$mod->children) return; $mod->data = $store->control->read ('modToolbox_module'); $mod->enabled = true; } // function setModule } // class eclMod_modToolbox //!eof:library/modToolbox/eclMod_modToolbox.php; //!file:library/modUser/alerts/eclMod_modUser_alerts.php; class eclMod_modUser_alerts extends eclEngine_listItem { // class eclMod_modUser_alerts public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; if (!$document->access (1)) return; if ($document->access (4, $system->groups)) { // webmaster $alerts = $system->child (SYSTEM_ADMIN_URI)->child ('alerts'); $mod->childrenMerge ($alerts->children); } // webmaster $mod->children = $this->children; foreach ($mod->children as &$child) { // each child $child->data['virtual'] = 1; } // each child if (!$mod->children) return; $mod->data = $store->control->read ('modUser_alerts_module'); $mod->enabled = true; } // function setModule } // class eclMod_modUser_alerts //!eof:library/modUser/alerts/eclMod_modUser_alerts.php; //!file:library/modUser/eclMod_modUser.php; class eclMod_modUser { // class eclMod_modUser public $enabled = false; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; if (!$document->access (1)) return; if ($document->application->isDomain) return; if (isset ($document->data['flags']['modUser_enabled']) and !$document->data['flags']['modUser_enabled']) return; // go to user profile main page $mod->appendChild ('modUser_goMain') ->ref (array (SYSTEM_PROFILES_URI, $document->user->name)) ->active (count ($document->application->pathway) > 1 and $document->application->pathway[0] == SYSTEM_PROFILES_URI and $document->application->pathway[1] == $document->user->name); // Go to admin area if ($document->access (4, $system->groups)) $mod->appendChild ('modUser_goAdmin') ->ref (array (SYSTEM_ADMIN_URI)) ->active ($document->application->pathway[0] == SYSTEM_ADMIN_URI); // Back to home if (SYSTEM_HOSTING_MODE == 0 and $document->application->pathway[0] != SYSTEM_DEFAULT_DOMAIN_NAME) $mod->appendChild ('modWelcome_goHome') ->ref (array (SYSTEM_DEFAULT_DOMAIN_NAME)); // logout $application = $document->application; while ($application->access) { // access denied $application = $application->parent; } // access denied $mod->appendChild ('modUser_goLogout') ->virtual () ->ref ($application->pathway, true, '_logout'); $mod->data = $store->control->read ('modUser_module'); $mod->enabled = true; } // function setModule } // class eclMod_modUser //!eof:library/modUser/eclMod_modUser.php; //!file:library/modUser/quoteoftheday/eclMod_modUser_quoteoftheday.php; class eclMod_modUser_quoteoftheday { // class eclMod_modUser_quoteoftheday public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $mod->data = $store->control->read ('modUser_quoteoftheday_module'); $quotes = $store->control->read ('modUser_quoteoftheday_quotes'); if (!isset ($quotes['quotes'])) return; $max = count ($quotes['quotes']) - 1; $n = mt_rand (0, $max); if (!isset ($quotes['quotes'][$n])) return; $data = array ('text' => array ('content' => array ($document->lang => array ( 1 => $quotes['quotes'][$n][0], 2 => 1, 5 => 2, 6 => 1 )), 'author' => array ($document->lang => array ( 1 => $quotes['quotes'][$n][1], 2 => 1, )) )); $mod->appendChild ($data); $mod->enabled = true; } // function setModule } // class eclMod_modUser_quoteoftheday //!eof:library/modUser/quoteoftheday/eclMod_modUser_quoteoftheday.php; //!file:library/modUser/tools/eclMod_modUser_tools.php; class eclMod_modUser_tools { // class eclMod_modUser_tools public $enabled = false; public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; if (!$document->access (4)) return; if ($document->application->isDomain) return; // personal data $mod->appendChild ('modUser_tools_goPersonal') ->ref (array (SYSTEM_PROFILES_URI, $document->user->name, '-personal')) ->popUpOpen (); // change password $mod->appendChild ('modUser_tools_goPassword') ->ref (array (SYSTEM_PROFILES_URI, $document->user->name, '-password')) ->popUpOpen (); $mod->data = $store->control->read ('modUser_tools_module'); $mod->enabled = true; } // function setModule } // class eclMod_modUser_tools //!eof:library/modUser/tools/eclMod_modUser_tools.php; //!file:library/modUser/welcome/eclMod_modUser_welcome.php; class eclMod_modUser_welcome { // class eclMod_modUser_welcome public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; if ($document->access (1)) return; if (isset ($document->data['flags']['modUser_enabled']) and !$document->data['flags']['modUser_enabled']) return; $domain = $document->domain; $main = $system->child (SYSTEM_DEFAULT_DOMAIN_NAME); // Recover password only if mails can be sent if (SMTP_ENABLE) { // recover password $mod->appendChild ('modUser_welcome_goPassword') ->ref (array (SYSTEM_PROFILES_URI, '-recover-password')) ->popUpOpen (); } // recover password // subscribe if (SYSTEM_ENABLE_USER_SUBSCRIPTIONS and $domain->child ('-join')) $mod->appendChild ('modUser_welcome_goSubscribe') ->ref (array ($domain->name, '-join')) ->popUpOpen (); elseif (SYSTEM_ENABLE_USER_SUBSCRIPTIONS) $mod->appendChild ('modUser_welcome_goSubscribe') ->ref (array (SYSTEM_PROFILES_URI, '-join')) ->popUpOpen (); // About if ($domain->name != SYSTEM_PROFILES_URI and $domain->name != SYSTEM_ADMIN_URI and $store->domain->getStatus ($domain->name) >= 2) $mod->appendChild ('modUser_welcome_goAbout') ->ref (array ($domain->name, '-about')) ->active ($document->pathway == array ($domain->name, '-about')); // Organization identification if (SYSTEM_HOSTING_MODE and strlen (SYSTEM_PROJECT_REF) and $domain->name != SYSTEM_DEFAULT_DOMAIN_NAME) $mod->appendChild ('modUser_welcome_goOrganization') ->set ('ref', SYSTEM_PROJECT_REF); // Go to profiles page /* * $mod->appendChild ('modUser_welcome_goProfiles') * ->ref (array (SYSTEM_PROFILES_URI)) * ->active ($document->application->pathway[0] == SYSTEM_PROFILES_URI); */ // Back to home if (SYSTEM_HOSTING_MODE == 0 and $document->application->pathway[0] != SYSTEM_DEFAULT_DOMAIN_NAME) $mod->appendChild ('modUser_welcome_goHome') ->ref (array (SYSTEM_DEFAULT_DOMAIN_NAME)); // Abuse report /* * if ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME and (($document->application->domainId and $document->application->id) or $document->application->userId)) * $mod->appendChild ('modUser_welcome_goReport') * ->ref (true, true, '_alert-report') * ->active ($document->actions ('alert', 'report')); */ // Service terms if ($store->domainContent->findMarker ($domain->domainId, 10)) $mod->appendChild ('modUser_welcome_goServiceTerms') ->ref ($store->domainContent->pathway ($domain->domainId, $store->domainContent->findMarker ($domain->domainId, 10))) ->active ($document->pathway == $store->domainContent->pathway ($domain->domainId, $store->domainContent->findMarker ($domain->domainId, 10))); elseif ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME and $store->domainContent->findMarker ($main->domainId, 10)) $mod->appendChild ('modUser_welcome_goServiceTerms') ->ref ($store->domainContent->pathway ($main->domainId, $store->domainContent->findMarker ($main->domainId, 10))) ->active ($document->pathway == $store->domainContent->pathway ($main->domainId, $store->domainContent->findMarker ($main->domainId, 10))); // About Ecolabore Engine $mod->appendChild ('modUser_welcome_goEcolabore', array ('ref' => SYSTEM_GENERATOR_URL)); $mod->data = $store->control->read ('modUser_welcome_module'); $mod->enabled = true; } // function setModule } // class eclMod_modUser_welcome //!eof:library/modUser/welcome/eclMod_modUser_welcome.php; //!file:library/renderBase/print/eclRender_renderBase_print.php; class eclRender_renderBase_print { // class eclRender_renderBase_print static function render ($render) { // function render $buffer = &$render->buffer; $buffer .= ' '; eclTag_text::render ($render, array ($render->getVar ('document.title'))); $buffer .= ' '; eclTag_paste::render ($render, array ('headerlinks')); eclTag_paste::render ($render, array ('style')); $buffer .= ' '; $local = eclTag_mod::render ($render, array ('title')); $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); $local = eclTag_mod::render ($render, array ('panel_main')); $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); $local = eclTag_mod::render ($render, array ('hits')); $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); $buffer .= ' '; } // function render } // class eclRender_renderBase_print //!eof:library/renderBase/print/eclRender_renderBase_print.php; //!file:library/renderBase/responsive/eclRender_renderBase_responsive.php; class eclRender_renderBase_responsive { // class eclRender_renderBase_responsive static function render ($render) { // function render $buffer = &$render->buffer; $buffer .= ' '; if ($render->getVar ('document.description')){ $buffer .= ''; $buffer .= CRLF; } if ($render->getVar ('document.keywords')){ $buffer .= ''; $buffer .= CRLF; } $buffer .= ' '; eclTag_text::render ($render, array ($render->getVar ('document.title'))); $buffer .= ' '; eclTag_paste::render ($render, array ('headerlinks')); eclTag_script::render ($render, array ()); $buffer .= ' humperstilshen = new humperstilshenClass(); humperstilshen.msgIconOpen = "'; eclTag_text::render ($render, array ('system_assistant_open')); $buffer .= '"; humperstilshen.msgIconClose = "'; eclTag_text::render ($render, array ('system_assistant_close')); $buffer .= '"; '; eclTag_endscript::render ($render, array ()); eclTag_paste::render ($render, array ('style')); $buffer .= 'getVar ('document.scheme')){ $buffer .= ' class="'; $buffer .= $render->getVar ('document.scheme'); $buffer .= '"'; } $buffer .= '>
      '; $local = eclTag_scope::render ($render, array('home')); $render->levelUp ($local); $buffer .= '
      '; if ($render->getVar ('editable')){ $buffer .= ''; eclTag_text::render ($render, array ($render->getVar ('title'))); $buffer .= ' '; } elseif ($render->getVar ('ref')){ $buffer .= ''; eclTag_text::render ($render, array ($render->getVar ('title'))); $buffer .= ' '; } else { $buffer .= ''; eclTag_text::render ($render, array ($render->getVar ('title'))); $buffer .= ' '; } $buffer .= '
      '; $render->levelDown (); $buffer .= '
      '; $local = eclTag_mod::render ($render, array ('layout')); $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); $buffer .= '
      '; $local = eclTag_mod::render ($render, array ('editor')); $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); $local = eclTag_mod::render ($render, array ('instructor')); $render->levelUp ($local); if (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); else eclRender_renderBorders_none::render ($render); $render->levelDown (); $buffer .= '
      '; eclTag_paste::render ($render, array ('editor_icon')); eclTag_paste::render ($render, array ('instructor_icon')); $buffer .= ' ';
eclTag_text::render ($render, array ('system_assistant_open'));
$buffer .= '
      '; eclTag_cut::render ($render, array ('footerscript')); $buffer .= 'if (humperstilshen.onLoad !== false && !humperstilshen.loadWait){ humperstilshen.onLoad(); humperstilshen.onLoad = false; } '; eclTag_endcut::render ($render, array ()); eclTag_paste::render ($render, array ('script')); eclTag_paste::render ($render, array ('footerscript')); $buffer .= ' '; } // function render } // class eclRender_renderBase_responsive //!eof:library/renderBase/responsive/eclRender_renderBase_responsive.php; //!file:library/renderBorders/none/eclRender_renderBorders_none.php; class eclRender_renderBorders_none { // class eclRender_renderBorders_none static function render ($render) { // function render $buffer = &$render->buffer; $buffer .= ' <'; $buffer .= eclTag_or::render ($render, array ($render->getVar ('mod-semantic'), 'div')); $buffer .= ' class="position-'; $buffer .= eclTag_or::render ($render, array ($render->getVar ('mod-position'), 'inline')); $buffer .= ' '; $buffer .= $render->getVar ('mod-size'); $buffer .= 'width-'; $buffer .= eclTag_or::render ($render, array ($render->getVar ('mod-width'), 'auto')); $buffer .= ' '; $buffer .= $render->getVar ('mod-size'); $buffer .= 'wide-'; $buffer .= eclTag_or::render ($render, array ($render->getVar ('mod-wide'), 'auto')); if ($value = $render->getVar ('margin-top')) $buffer .= ' margin-top-' . $value; if ($value = $render->getVar ('margin-right')) $buffer .= ' margin-right-' . $value; if ($value = $render->getVar ('margin-bottom')) $buffer .= ' margin-bottom-' . $value; if ($value = $render->getVar ('margin-left')) $buffer .= ' margin-left-' . $value; $buffer .= '"'; if ($render->getVar ('tag')){ $buffer .= ' data-tag="'; $buffer .= $render->getVar ('tag'); $buffer .= '"'; } $buffer .= '> '; if ($render->getVar ('caption-display') and !$render->getVar ('caption-legend')){ $buffer .= 'levelUp ($local); $render->render_tags ($local["html"]); $render->levelDown (); } // render html $buffer .= ' class="caption">'; eclTag_text::render ($render, array ()); $buffer .= ''; $buffer .= CRLF; } $buffer .= '
      getVar ('box-padding') or $render->getVar ('box-size') or $render->getVar ('box-rounded')){ $buffer .= ' style="'; if ($value = $render->getVar ('box-padding')){ $buffer .= 'padding:' . $value . '; '; } if ($value = $render->getVar ('box-size')){ $buffer .= 'font-size:' . $value . '; '; } if ($value = $render->getVar ('box-rounded')){ $buffer .= 'border-radius:' . $value . '; '; } $buffer .= '"'; } $buffer .= '> '; $value = $render->getVar ('list'); $local = eclTag_list::render ($render, array ($value)); $render->levelUp ($local); if ($value == 'default') eclRender_renderLists_default::render ($render); elseif (isset ($local["parsed"])) $render->render_tags_level ($local["parsed"]); elseif (isset ($local["html"])) $render->render_tags ($local["html"]); $render->levelDown (); $buffer .= '
      '; if ($render->getVar ('caption-display') and $render->getVar ('caption-legend')){ $buffer .= 'levelUp ($local); $render->render_tags ($local["html"]); $render->levelDown (); } // render html $buffer .= ' class="legend">'; eclTag_text::render ($render, array ()); $buffer .= ''; $buffer .= CRLF; } $local = eclTag_personalite::render ($render, array ()); if (isset ($local["parsed"])) { // parsed content $render->levelUp ($local); $render->render_tags_level ($local["parsed"]); $render->levelDown (); } // parsed content elseif (isset ($local["html"])) { // render html $render->levelUp ($local); $render->render_tags ($local["html"]); $render->levelDown (); } // render html $buffer .= 'getVar ('mod-semantic'), 'div')); $buffer .= '> '; } // function render } // class eclRender_renderBorders_none //!eof:library/renderBorders/none/eclRender_renderBorders_none.php; //!file:library/renderLists/default/eclRender_renderLists_default.php; class eclRender_renderLists_default { // class eclRender_renderLists_default static function render ($render) { // function render $buffer = &$render->buffer; do { if ($render->getVar ('first') == ''){ $buffer .= '
      '; } $local = eclTag_list::render ($render, array()); $render->levelUp ($local); $buffer .= '
      '; do { $buffer .= '
      '; $local = eclTag_details::render ($render, array ()); if (isset ($local["parsed"])) { // parsed content $render->levelUp ($local); $render->render_tags_level ($local["parsed"]); $render->levelDown (); } // parsed content elseif (isset ($local["html"])) { // render html $render->levelUp ($local); $render->render_tags ($local["html"]); $render->levelDown (); } // render html $buffer .= '
      '; } while (eclTag_loop::render ($render)); $buffer .= '
      '; $render->levelDown (); } while (eclTag_loop::render ($render)); } // function render } // class eclRender_renderLists_default //!eof:library/renderLists/default/eclRender_renderLists_default.php; //!file:library/section/create/eclApp_section_create.php; class eclApp_section_create { // class eclApp_section_create static function is_child ($me, $name) { // function is_child if ($name == '-new-section') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type global $store; $data = $store->domainContent->open ($me->domainId, '-register'); if (isset ($data['flags']['section_createOnMenu'])) return 'section'; return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-section'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('section_create_content'); $me->ignoreSubfolders = true; $me->access = 4; $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; if (!isset ($document->actions['create'][1])) goto show_list; $type = $document->actions['create'][1]; if (!is_object ($document->application->child ($type))) goto show_list; $preset = $document->application->child ($type)->child ('-preset'); if (!is_object ($preset)) goto show_list; $data = $preset->data; unset ($data['text']); $formulary = $document->createFormulary ('section_create_edit', $data, 'sectionEdit'); if ($formulary->command ('cancel')) { // return to parent page $parent = $document->application->parent; if ($parent->isDomain) $parent = $parent->child (''); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->ref (); return; } // return to parent page // Salvar formulário e redespachar if ($formulary->command ('save') and $formulary->save (1)) { // save section $parent = $document->application->parent; $data = &$formulary->data; $data['mode'] = MODE_SECTION; $data['parent_id'] = $parent->id; $data['id'] = $store->domainContent->insert ($parent->domainId, $data); $me->id = $data['id']; $formulary->save (2); $io->database->commit (); $me->data = &$store->domainContent->openById ($me->domainId, $me->id); $me->data = $formulary->data; $parent->reset (); $document->application = $parent->child ($data['name']); $document->reload = $document->ref (); $document->application->dispatch ($document); return; } // save section // Sugestão de texto if (!isset ($formulary->data['text']) and isset ($preset->data['text'])) $formulary->data['text'] = $preset->data['text']; // Exibir formulário $formulary->action = '_create-' . $type; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_create-' . $type; $document->mod->instructor->addMessage ('section' . ucfirst ($type) . '_helpCreate'); return; // Exibir lista de opções show_list: unset ($document->actions['create']); $document->mod->list = new eclMod_section_create_list ($document); } // function dispatch } // class eclApp_section_create //!eof:library/section/create/eclApp_section_create.php; //!file:library/section/create/eclMod_section_create_list.php; class eclMod_section_create_list { // class eclMod_section_create_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $row = $mod->appendChild(); $pathway = $this->document->application->pathway; foreach ($this->document->application->children () as $child) { // each child $row->appendChild ($child) ->virtual (1) ->ref ($pathway, true, '_create-' . $child->name); } // each child $mod->data = $store->control->read ('modList_preset_folder'); $mod->enabled = true; } // function setModule } // class eclMod_section_create_list //!eof:library/section/create/eclMod_section_create_list.php; //!file:library/section/eclApp_section.php; class eclApp_section { // class eclApp_section static function is_child ($me, $name) { // function is_child global $store; $data = $store->domainContent->openChild ($me->domainId, MODE_SECTION, $me->id, $name); if ($data) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return $store->domainContent->childrenNames ($me->domainId, MODE_SECTION, $me->id); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->open ($me->domainId, $me->name); $me->id = $me->data['id']; if ($me->data['access'] > $me->access) $me->access = $me->data['access']; if (isset ($me->data['flags']['section_type'])) $class = 'eclApp_section' . ucfirst ($me->data['flags']['section_type']); else $class = 'eclApp_sectionFolder'; $class::constructor_helper ($me); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $view = true; if ($document->access (4)) { // user is admin if ($document->actions ('section', 'edit')) $view = self::action_edit ($document); elseif ($document->actions ('section', 'remove')) return self::action_remove ($document); elseif ($document->actions ('section', 'move')) self::action_move ($document); // Context Edit $document->mod->context->appendChild ('section_edit') ->active ($document->actions ('section', 'edit')) ->ref (true, true, '_section-edit'); // Context Remove $document->mod->context->appendChild ('section_remove') ->ref (true, true, '_section-remove') ->confirm ('section_removeConfirm'); // Context Move up if ($me->data['index']) $document->mod->context->appendChild ('section_moveUp') ->ref (true, true, '_section-move-up'); // Context Move down if ($me->data['index'] < count ($store->domainContent->children ($me->domainId, MODE_SECTION, $me->parent->id)) - 1) $document->mod->context->appendChild ('section_moveDown') ->ref (true, true, '_section-move-down'); } // user is admin if ($view) { // view section if (!$document->access (3)) $me->data['hits']++; if (isset ($me->data['flags']['section_type'])) $class = 'eclApp_section' . ucfirst ($me->data['flags']['section_type']); else $class = 'eclApp_sectionFolder'; $class::dispatch ($document); } // view section } // function dispatch static function action_edit ($document) { // function action_edit $formulary = $document->createFormulary ('section_edit', $document->application->data, 'sectionEdit'); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['section']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save formulary unset ($document->actions['section']); $document->application->data = $formulary->data; $document->application->reset (); if ($document->application->name != $formulary->data['name']) { // update name $document->application->name = $formulary->data['name']; array_pop ($document->application->pathway); $document->application->pathway[] = $formulary->data['name']; $document->reload = $document->ref (); } // update name else $document->dataReplace ($document->application->data); return true; } // save formulary $formulary->action = '_section-edit-save'; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_section-edit'; $document->dataMerge ('section_contentEdit'); return false; } // function action_edit static function action_remove ($document) { // function action_remove global $store, $io; $me = $document->application; unset ($document->actions['section']); $parent = $me->parent; $me->remove (); $parent->reset (); // reindex brothers $store->domainContent->childrenReindex ($parent->domainId, MODE_SECTION, $parent->id); if ($parent->isDomain) $document->application = $parent->child (''); else $document->application = $parent; $document->reload = $document->ref (); $document->application->dispatch ($document); } // function action_remove static function action_move ($document) { // function action_move global $store; $name = $document->application->name; $parent = $document->application->parent; unset ($document->application); $parent->reset (); $store->domainContent->childrenReindex ($parent->domainId, MODE_SECTION, $parent->id); $names = $store->domainContent->childrenNames ($parent->domainId, MODE_SECTION, $parent->id); $index = array_search ($name, $names); $length = count ($names) - 1; if ($document->actions ('section', 'move', 'up') and $index) { // move up $move_up = &$store->domainContent->open ($parent->domainId, $names[$index]); $move_down = &$store->domainContent->open ($parent->domainId, $names[$index - 1]); $move_up['index']--; $move_down['index']++; } // move up elseif ($document->actions ('section', 'move', 'down') and $index < $length) { // move down $move_up = &$store->domainContent->open ($parent->domainId, $names[$index + 1]); $move_down = &$store->domainContent->open ($parent->domainId, $names[$index]); $move_up['index']--; $move_down['index']++; } // move down unset ($document->actions['section']); $document->application = $parent->child ($name); } // function action_move static function remove ($me) { // function remove if (isset ($me->data['flags']['section_type'])) $class = 'eclApp_section' . ucfirst ($me->data['flags']['section_type']); else $class = 'eclApp_sectionFolder'; if (is_callable ($class . '::remove')) $class::remove ($me); global $store; $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); } // function remove } // class eclApp_section //!eof:library/section/eclApp_section.php; //!file:library/section/eclFilter_section_selectGroup.php; class eclFilter_section_selectGroup { // class eclFilter_section_selectGroup static function create ($fieldName, $control, $formulary) { // function create global $store; $me = $formulary->document->application; $groups = $store->domainContent->mode ($me->domainId, MODE_GROUP); if (!$groups) return; $control['name'] = $fieldName; $control['type'] = 'select'; $item = $formulary->appendChild ($control); $value = $formulary->getField ('links/group'); $item->appendChild ('section_editGroupNone'); foreach ($groups as $data) { // each group $local = array ( 'caption' => $data['text']['title'], 'value' => $data['id'] ); $item->appendChild ($local) ->active ($data['id'] == $value); } // each group } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $me = $formulary->document->application; if (isset ($formulary->received[$fieldName])) $id = intval($formulary->received[$fieldName]); else $id = false; if ($id) { // find group $data = $store->domainContent->openById ($me->domainId, $id); if (!$data or $data['mode'] != MODE_GROUP) $id = false; } // find group $formulary->setField ('links/group', $id); } // function save } // class eclFilter_section_selectGroup //!eof:library/section/eclFilter_section_selectGroup.php; //!file:library/section/eclFilter_section_specialFields.php; class eclFilter_section_specialFields { // class eclFilter_section_specialFields static function create ($fieldName, $control, $formulary) { // function create global $store; if (!isset ($formulary->data['flags']['section_type'])) return; if (!isset ($control['flags']['control_sufix'])) return; $special = $store->control->read ('section' . ucfirst ($formulary->data['flags']['section_type']) . $control['flags']['control_sufix']); if (isset ($special['children'])) $formulary->insertControlChildren ($special); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->data['flags']['section_type'])) return; if (!isset ($control['flags']['control_sufix'])) return; $special = $store->control->read ('section' . ucfirst ($formulary->data['flags']['section_type']) . $control['flags']['control_sufix']); if (isset ($special['children'])) $formulary->insertControlChildren ($special); } // function save } // class eclFilter_section_specialFields //!eof:library/section/eclFilter_section_specialFields.php; //!file:library/section/preset/eclApp_section_preset.php; class eclApp_section_preset { // class eclApp_section_preset static function is_child ($me, $name) { // function is_child if (!isset ($me->data['flags']['preset'])) return false; if ($name == '-preset') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-preset'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ($me->parent->data['flags']['preset']); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_section_preset //!eof:library/section/preset/eclApp_section_preset.php; //!file:library/sectionBlog/create/eclApp_sectionBlog_create.php; class eclApp_sectionBlog_create { // class eclApp_sectionBlog_create static function is_child ($me, $name) { // function is_child switch ($name) { // switch name case 'blog': case 'galery': case 'events': case 'news': case 'podcast': case 'videocast': return true; } // switch name return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('blog', 'galery', 'news', 'events', 'podcast', 'videocast'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionBlog_create_' . $me->name); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionBlog_create //!eof:library/sectionBlog/create/eclApp_sectionBlog_create.php; //!file:library/sectionBlog/eclApp_sectionBlog.php; class eclApp_sectionBlog { // class eclApp_sectionBlog static function constructor_helper ($me) { // function constructor_helper $me->map = array ('sectionBlog_post', 'sectionBlog_post_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; if ($document->access (4)) { // admin // Context new post $pathway = $me->pathway; $pathway[] = '-new-post'; $document->mod->context->appendChild ('sectionBlog_post_contextNew') ->ref ($pathway); $document->mod->editor->enable (); } // admin $document->mod->list = new eclMod_sectionBlog_list ($document); $document->mod->pages = new eclMod_sectionBlog_pages ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionBlog //!eof:library/sectionBlog/eclApp_sectionBlog.php; //!file:library/sectionBlog/eclMod_sectionBlog_list.php; class eclMod_sectionBlog_list { // class eclMod_sectionBlog_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; if (isset ($me->data['extras']['list'])) $mod->data = $me->data['extras']['list']; else $mod->data = $store->control->read ('modList_preset_' . $preset); $mod->data['name'] = 'section_' . $me->name; // configurações de listagem $local = $mod->data['local']; isset ($local['list_sort']) or $local['list_sort'] = 'index'; isset ($local['list_direction']) or $local['list_direction'] = 'asc'; isset ($local['list_max']) or $local['list_max'] = 0; if ($local['list_max'] and isset ($document->actions['page'][1])) { // pagination $page = intval ($document->actions['page'][1]); if ($page <= 0) $page = 1; $offset = $local['list_max'] * intval ($document->actions['page'][1] - 1); } // pagination else $offset = 0; switch ($local['list_sort']) { // switch list sort case 'name': case 'created': case 'updated': case 'event_start': case 'comments_last_update': case 'hits': case 'value': case 'spotlight': $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id, 4, $local['list_max'], $offset, $local['list_sort'], $local['list_direction']); break; default: $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id, 4, $local['list_max'], $offset, 'index', $local['list_direction']); } // switch list sort $row = $mod->appendChild(); foreach ($children as $data) { // each child $pathway = $me->pathway; $pathway[] = $data['name']; $row->appendChild ($data) ->set ('editable', $document->contentEditable) ->ref ($pathway); } // each child if (!$row->children) return; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_list_' . $preset . '_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionBlog_list //!eof:library/sectionBlog/eclMod_sectionBlog_list.php; //!file:library/sectionBlog/eclMod_sectionBlog_pages.php; class eclMod_sectionBlog_pages { // class eclMod_sectionBlog_pages public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; isset ($me->data['extras']['list']['local']) ? $local = $me->data['extras']['list']['local'] : $local = array (); isset ($local['list_sort']) or $local['list_sort'] = 'index'; isset ($local['list_direction']) or $local['list_direction'] = 'asc'; isset ($local['list_max']) or $local['list_max'] = 0; if (!$local['list_max']) return; if (isset ($document->actions['page'][1])) $page = intval ($document->actions['page'][1]); else $page = 1; if (!$page) $page = 1; $names = $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id, true, 0, 0, $local['list_sort'], $local['list_direction']); $length = count ($names); if ($length <= $local['list_max']) return; $numPages = ceil ($length / $local['list_max']); $row = $mod->appendChild (); // First $row->appendChild ('renderLabels_navigation_first') ->active ($page == 1) ->ref (); for ($i = 1; $i <= $numPages; $i++) { // loop pages $caption['local']['caption'] = $document->textMerge (strval ($i)); $row->appendChild (false, $caption) ->active ($page == $i) ->ref (true, true, '_page-' . $i); } // loop pages // last $row->appendChild ('renderLabels_navigation_last') ->active ($page == $numPages) ->ref (true, true, '_page-' . $numPages); if (isset ($me->data['extras']['pages'])) $mod->data = $me->data['extras']['pages']; else $mod->data = $store->control->read ('modList_preset_pages'); if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_pages_pages_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modPages_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionBlog_pages //!eof:library/sectionBlog/eclMod_sectionBlog_pages.php; //!file:library/sectionBlog/post/eclApp_sectionBlog_post.php; class eclApp_sectionBlog_post { // class eclApp_sectionBlog_post static function is_child ($me, $name) { // function is_child global $store; if ($name[0] == '-') return false; $data = $store->domainContent->openChild ($me->domainId, MODE_POST, $me->id, $name); if ($data) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->open ($me->domainId, $me->name); $me->id = $me->data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch $view = true; if ($document->access (3)) { // user is admin if ($document->actions ('post', 'edit')) $view = self::action_edit ($document); elseif ($document->actions ('post', 'img', 'remove')) self::action_img_remove ($document); elseif ($document->actions ('post', 'remove')) return self::action_remove ($document); // Edit $document->mod->context->appendChild ('sectionBlog_post_edit') ->active ($document->actions ('post', 'edit')) ->ref (true, true, '_post-edit'); // context remove image if (isset ($me->data['extras']['img_0']['img'])) $document->mod->context->appendChild ('sectionBlog_post_imgRemove') ->active ($document->actions ('post', 'edit')) ->ref (true, true, '_post-img-remove') ->confirm ('sectionBlog_post_msgImgRemoveConfirm'); // Context Remove $document->mod->context->appendChild ('sectionBlog_post_remove') ->ref (true, true, '_post-remove') ->confirm ('sectionBlog_post_msgRemoveConfirm'); // Context new post $pathway = $document->application->parent->pathway; $pathway[] = '-new-post'; $document->mod->context->appendChild ('sectionBlog_post_contextNew') ->ref ($pathway); } // user is admin if ($view) { // view post // Hit counter if ($document->access (4)) $document->mod->editor->enable (); else $document->application->data['hits']++; $document->mod->content = new eclMod_sectionBlog_post_content ($document); $document->mod->keywords = new eclMod_sectionBlog_post_keywords ($document); $document->mod->pages = new eclMod_sectionBlog_post_pages ($document); } // view post } // function dispatch static function action_edit ($document) { // function action_edit global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionBlog_post_edit', $me->data, 'post'); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['post']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save formulary unset ($document->actions['post']); $me->data = $formulary->data; if (!$me->data['owner_id']) $me->data['owner_id'] = $document->user->userId; $me->name = $formulary->data['name']; array_pop ($me->pathway); $me->pathway[] = $formulary->data['name']; $document->dataReplace ($me->data); return true; } // save formulary $formulary->action = '_post-edit-save'; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_post-edit'; $document->dataReplace ('sectionBlog_post_edit'); return false; } // function action_edit static function action_img_remove ($document) { // function action_img_remove global $store; $me = $document->application; unset ($me->data['extras']['img_0']); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name, MODE_IMG); } // function action_img_remove static function action_remove ($document) { // function action_remove global $io, $store; unset ($document->actions['post']); $me = $document->application; $parent = $me->parent; $me->remove (); // reindex brothers $store->domainContent->childrenReindex ($parent->domainId, MODE_POST, $parent->id); $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->ref (); } // function action_remove static function remove ($me) { // function remove global $store; $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); } // function remove } // class eclApp_sectionBlog_post //!eof:library/sectionBlog/post/eclApp_sectionBlog_post.php; //!file:library/sectionBlog/post/eclApp_sectionBlog_post_new.php; class eclApp_sectionBlog_post_new { // class eclApp_sectionBlog_post_new static function is_child ($me, $name) { // function is_child if ($name == '-new-post') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-post'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionBlog_post_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionBlog_post_new', array (), 'create'); if ($formulary->command ('cancel')) { // cancel $document->application = $me->parent; $document->application->dispatch ($document); $document->reload = $document->ref(); return; } // cancel if ($formulary->command ('save') and $formulary->save (1)) { // save post $parent = $document->application->parent; $data = &$formulary->data; $data['mode'] = MODE_POST; $data['parent_id'] = $parent->id; $data['owner_id'] = $document->user->userId; $data['id'] = $store->domainContent->insert ($parent->domainId, $data); $formulary->save (2); $me->id = $data['id']; unset ($document->application); $parent->reset (); $document->application = $parent->child ($data['name']); $document->application->dispatch ($document); $document->reload = $document->ref (); return; } // save post $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionBlog_post_new //!eof:library/sectionBlog/post/eclApp_sectionBlog_post_new.php; //!file:library/sectionBlog/post/eclMod_sectionBlog_post_content.php; class eclMod_sectionBlog_post_content { // class eclMod_sectionBlog_post_content public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; $me = $document->application->parent; $mod->appendChild ($document->data) ->set ('editable', $document->contentEditable) ->set ('pathway', $document->pathway); if (isset ($render->blocks['modules/content'])) $mod->data = $render->blocks['modules/content']; else $mod->data = $store->control->read ('modContent_module'); if (isset ($me->data['extras']['post']['local']['details'])) $mod->data['local']['details'] = $me->data['extras']['post']['local']['details']; elseif (isset ($me->data['flags']['modList_preset'])) { // preset $preset = $me->data['flags']['modList_preset']; $control = $store->control->read ('modList_preset_' . $preset . 'Content'); $mod->data['local']['details'] = $control['local']['details']; } // preset // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $me->groups)) { // reference if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; $pathway = array ($document->domain->name, '-dialog', 'section_post_' . $preset . '_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modContent_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionBlog_post_content //!eof:library/sectionBlog/post/eclMod_sectionBlog_post_content.php; //!file:library/sectionBlog/post/eclMod_sectionBlog_post_keywords.php; class eclMod_sectionBlog_post_keywords { // class eclMod_sectionBlog_post_keywords public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; $me = $document->application; if (!isset ($me->data['text']['keywords'])) return; if ($document->printableLayout) return; $field = $document->selectLanguage ($me->data['text']['keywords']); if (!isset ($field[TEXT_CONTENT])) return; if (isset ($field[TEXT_CHARSET]) and $field[TEXT_CHARSET]) $charset= 1; else $charset = 0; if ($id = $store->domainContent->findMarker ($me->domainId, 7)) $pathway = $store->domainContent->pathway ($me->domainId, $id); else $pathway = array ($document->domain->name, '-search'); if ($id = $store->domainContent->findMarker ($me->domainId, 1)) $glossary = $store->domainContent->pathway ($me->domainId, $id); else $glossary = array ($document->domain->name, '-glossary'); $row = $mod->appendChild(); foreach (explode (' ', $field[TEXT_CONTENT]) as $keyword) { // each keyword $local = array(); if (!$charset) $search = $render->toKeyword (mb_convert_encoding ($keyword, 'ISO-8859-1', 'UTF-8')); else $search = $render->toKeyword ($keyword); $local['caption'][$document->lang] = array (TEXT_CONTENT => $keyword); if ($charset) $local['caption'][$document->lang][TEXT_CHARSET] = 1; if ($store->domainContent->open ($me->domainId, '-key-' . $search)) { // keyword exists $p = $glossary; $p[] = $search; $row->appendChild ($local) ->ref ($p); continue; } // keyword exists $row->appendChild ($local) ->ref ($pathway, true, '_tag-' . $search); } // each keyword $mod->data = $store->control->read ('modKeywords_module'); if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_sectionBlog_post_keywords //!eof:library/sectionBlog/post/eclMod_sectionBlog_post_keywords.php; //!file:library/sectionBlog/post/eclMod_sectionBlog_post_pages.php; class eclMod_sectionBlog_post_pages { // class eclMod_sectionBlog_post_pages public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $row = $mod->appendChild(); if (isset ($me->data['extras']['list'])) $list = $me->data['extras']['list']; elseif (isset ($me->data['flags']['modList_preset'])) $list = $store->control->read ('modList_preset_' . $me->data['flags']['modList_preset']); else $list = $store->control->read ('modList_preset_blog'); $sort = isset ($list['local']['list_sort']) ? $list['local']['list_sort'] : 'index'; $direction = isset ($list['local']['list_direction']) ? $list['local']['list_direction'] : 'asc'; switch ($sort) { // switch list sort case 'name': case 'created': case 'updated': case 'event_start': case 'comments_last_update': case 'hits': case 'value': case 'spotlight': $names = $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id, 4, 0, 0, $sort, $direction); break; default: $names = $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id, 4, 0, 0, 'index', $direction); } // switch list sort $index = array_search ($document->application->name, $names); if ($index === false) return; $length = count ($names); if ($length < 2) return; if ($index) { // previous $pathway = $me->pathway; $pathway[] = $names[$index - 1]; $row->appendChild ('renderLabels_navigation_previous') ->ref ($pathway); } // previous if ($index < $length - 1) { // next $pathway = $me->pathway; $pathway[] = $names[$index + 1]; $row->appendChild ('renderLabels_navigation_next') ->ref ($pathway); } // next if (isset ($me->data['extras']['navigate'])) $mod->data = $me->data['extras']['navigate']; else $mod->data = $store->control->read ('modList_preset_navigate'); if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_navigate_navigate_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modPages_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionBlog_post_pages //!eof:library/sectionBlog/post/eclMod_sectionBlog_post_pages.php; //!file:library/sectionCarte/all/eclApp_sectionCarte_all.php; class eclApp_sectionCarte_all { // class eclApp_sectionCarte_all static function is_child ($me, $name) { // function is_child if ($name == '-all') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-all'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCarte_all_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; // Context new dish $newDish = $me->parent->child ('-new-post'); $document->mod->context->appendChild ($newDish->data) ->ref ($newDish->pathway); $i = 0; foreach ($store->domainContent->childrenNames ($me->domainId, MODE_FOLDER, $me->parent->id) as $name) { // each name $i ++; $document->mod->panel->main[] = 'list' . $i; $list = 'list' . $i; $document->mod->$list = new eclMod_sectionCarte_all_list ($document, $name); } // each name $document->mod->list = new eclMod_sectionCarte_all_listOutside ($document); } // function dispatch } // class eclApp_sectionCarte_all //!eof:library/sectionCarte/all/eclApp_sectionCarte_all.php; //!file:library/sectionCarte/all/eclMod_sectionCarte_all_list.php; class eclMod_sectionCarte_all_list { // class eclMod_sectionCarte_all_list public $document; private $name; public function __construct ($document, $name) { // function __construct $this->document = $document; $this->name = $name; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $division = $store->domainContent->open ($me->domainId, $this->name); if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; if (isset ($me->data['extras']['list'])) $mod->data = $me->data['extras']['list']; else $mod->data = $store->control->read ('modList_preset_' . $preset); $mod->data['local']['caption-display'] = 1; $mod->data['text']['caption'] = $division['text']['title']; $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id); $row = $mod->appendChild(); foreach ($children as $data) { // each child if ($data['master_id'] != $division['id']) continue; $pathway = $me->pathway; $pathway[] = $data['name']; $row->appendChild ($data) ->set ('editable', $document->contentEditable) ->ref ($pathway); } // each child if (!$row->children) return; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_list_' . $preset . '_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_all_list //!eof:library/sectionCarte/all/eclMod_sectionCarte_all_list.php; //!file:library/sectionCarte/all/eclMod_sectionCarte_all_listOutside.php; class eclMod_sectionCarte_all_listOutside { // class eclMod_sectionCarte_all_listOutside public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $mod->data = $store->control->read ('sectionCarte_all_list'); $divisions = array(); foreach ($store->domainContent->children ($me->domainId, MODE_FOLDER, $me->id) as $data) { // each division $divisions[$data['id']] = true; } // each division $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id); $row = $mod->appendChild(); foreach ($children as $data) { // each child if (isset ($divisions[$data['master_id']])) continue; $pathway = $me->pathway; $pathway[] = $data['name']; $row->appendChild ($data) ->set ('editable', $document->contentEditable) ->ref ($pathway); } // each child if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_all_listOutside //!eof:library/sectionCarte/all/eclMod_sectionCarte_all_listOutside.php; //!file:library/sectionCarte/create/eclApp_sectionCarte_create.php; class eclApp_sectionCarte_create { // class eclApp_sectionCarte_create static function is_child ($me, $name) { // function is_child if ($name == 'carte') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('carte'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCarte_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionCarte_create //!eof:library/sectionCarte/create/eclApp_sectionCarte_create.php; //!file:library/sectionCarte/division/eclApp_sectionCarte_division.php; class eclApp_sectionCarte_division { // class eclApp_sectionCarte_division static function is_child ($me, $name) { // function is_child if ($name == '-divisions') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-divisions'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCarte_division_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; // Context new folder $document->mod->context->appendChild ('sectionCarte_division_contextNew') ->ref ($me->parent->child ('-new-division')->pathway) ->popUpOpen (); $document->mod->list = new eclMod_sectionCarte_division_list ($document); } // function dispatch } // class eclApp_sectionCarte_divisions //!eof:library/sectionCarte/division/eclApp_sectionCarte_division.php; //!file:library/sectionCarte/division/eclApp_sectionCarte_division_new.php; class eclApp_sectionCarte_division_new { // class eclApp_sectionCarte_division_new static function is_child ($me, $name) { // function is_child if ($name == '-new-division') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-division'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionCarte_division_new'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionCarte_division_new', array (), 'create'); if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('dialog_cancel'); return; } // cancel if ($formulary->command ('save') and $formulary->save (1)) { // save folder $parent = $document->application->parent; $data = &$formulary->data; $data['mode'] = MODE_FOLDER; $data['parent_id'] = $me->parent->id; $store->domainContent->insert ($me->domainId, $data); $document->dataReplace ('dialog_close'); return; } // save folder $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionCarte_folder_new //!eof:library/sectionCarte/division/eclApp_sectionCarte_division_new.php; //!file:library/sectionCarte/division/eclApp_sectionCarte_division_view.php; class eclApp_sectionCarte_division_view { // class eclApp_sectionCarte_division_view static function is_child ($me, $name) { // function is_child global $store; if ($name[0] == '-') return false; $data = $store->domainContent->openChild ($me->domainId, MODE_FOLDER, $me->id, $name); if ($data) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return $store->domainContent->childrenNames ($me->domainId, MODE_FOLDER, $me->id); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCarte_division_edit'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $data = &$store->domainContent->open ($me->domainId, $me->name); // Action remove if ($document->actions ('division', 'remove')) return self::action_remove ($document, $data['id']); // Action move if ($document->actions ('division', 'move')) return self::action_move ($document, $data['id']); // Context remove $document->mod->context->appendChild ('sectionCarte_division_remove') ->ref (true, true, '_division-remove') ->confirm ('sectionCarte_division_removeConfirm'); // Context move up if ($data['index']) $document->mod->context->appendChild ('sectionCarte_division_contextMoveUp') ->ref (true, true, '_division-move-up'); // Context move down if ($data['index'] < count ($store->domainContent->children ($me->domainId, MODE_FOLDER, $me->parent->id)) - 1) $document->mod->context->appendChild ('sectionCarte_division_contextMoveDown') ->ref (true, true, '_division-move-down'); $formulary = $document->createFormulary ('sectionCarte_division_edit', $data); if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('dialog_cancel'); return; } // cancel if ($formulary->command ('save') and $formulary->save()) { // save $data = $formulary->data; $document->dataReplace ('dialog_close'); return; } // save if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->formulary = $formulary; } // function dispatch static function action_remove ($document, $id) { // function action_remove global $store; $store->domainContent->delete ($document->domain->domainId, $id); $document->dataReplace ('dialog_close'); } // function action_remove static function action_move ($document, $id) { // function action_move global $store; $name = $document->application->name; $parent = $document->application->parent; $parent->reset (); $store->domainContent->childrenReindex ($parent->domainId, MODE_FOLDER, $parent->id); $names = $store->domainContent->childrenNames ($parent->domainId, MODE_FOLDER, $parent->id); $index = array_search ($name, $names); $length = count ($names) - 1; if ($document->actions ('division', 'move', 'up') and $index) { // move up $move_up = &$store->domainContent->open ($parent->domainId, $names[$index]); $move_down = &$store->domainContent->open ($parent->domainId, $names[$index - 1]); $move_up['index']--; $move_down['index']++; } // move up elseif ($document->actions ('division', 'move', 'down') and $index < $length) { // move down $move_up = &$store->domainContent->open ($parent->domainId, $names[$index + 1]); $move_down = &$store->domainContent->open ($parent->domainId, $names[$index]); $move_up['index']--; $move_down['index']++; } // move down unset ($document->actions['division']); $document->dataReplace ('dialog_close'); } // function action_move } // class eclApp_sectionCarte_division_view //!eof:library/sectionCarte/division/eclApp_sectionCarte_division_view.php; //!file:library/sectionCarte/division/eclMod_sectionCarte_division_list.php; class eclMod_sectionCarte_division_list { // class eclMod_sectionCarte_division_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; if (isset ($me->data['extras']['list'])) $mod->data = $me->data['extras']['list']; else $mod->data = $store->control->read ('modList_preset_' . $preset); $mod->data['name'] = 'section_' . $me->name; $children = $store->domainContent->children ($me->domainId, MODE_FOLDER, $me->id); $row = $mod->appendChild(); foreach ($children as $data) { // each child $pathway = $me->pathway; $pathway[] = $data['name']; $row->appendChild ($data) ->ref ($pathway) ->popUpOpen (); } // each child if (!$row->children) return; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_list_' . $preset . '_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_division_list //!eof:library/sectionCarte/division/eclMod_sectionCarte_division_list.php; //!file:library/sectionCarte/eclApp_sectionCarte.php; class eclApp_sectionCarte { // class eclApp_sectionCarte static function constructor_helper ($me) { // function constructor_helper $me->map = array ('sectionCarte_division', 'sectionCarte_division_new', 'sectionCarte_division_view', 'sectionCarte_all', 'sectionCarte_select', 'sectionCarte_store', 'sectionCarte_post', 'sectionCarte_post_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if ($document->access (4)) { // admin // Context new option $pathway = $me->pathway; $pathway[] = '-new-post'; $document->mod->context->appendChild ('sectionCarte_post_contextNew') ->ref ($pathway); $document->mod->editor->enable (); } // admin $document->mod->panel->main = array ('content'); $i = 0; foreach ($store->domainContent->childrenNames ($me->domainId, MODE_FOLDER, $me->id) as $name) { // each name $i ++; $document->mod->panel->main[] = 'list' . $i; $list = 'list' . $i; $document->mod->$list = new eclMod_sectionCarte_list ($document, $name); } // each name if ($document->access (4)) { // admin panel $document->mod->panel->main[] = 'list'; $document->mod->list = new eclMod_sectionCarte_listAdmin ($document); } // admin panel $document->mod->pages = new eclMod_sectionCarte_pages ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionBlog //!eof:library/sectionCarte/eclApp_sectionCarte.php; //!file:library/sectionCarte/eclFilter_sectionCarte_selectDivision.php; class eclFilter_sectionCarte_selectDivision { // class eclFilter_sectionCarte_selectDivision static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application->parent; $item = $formulary->appendChild ($control); $item->data['type'] = 'select'; $item->data['name'] = $fieldName; $value = $formulary->getField ('master_id'); $item->appendChild ('renderLabels_field_please_select'); foreach ($store->domainContent->children ($me->domainId, MODE_FOLDER, $me->id) as $data) { // each item $local = array (); $local['value'] = $data['id']; $local['caption'] = $data['text']['title']; if ($value == $data['id']) $local['active'] = 1; $item->appendChild (false, $local); } // each item } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $received = $formulary->received; if (!isset ($received[$fieldName]) or !$received[$fieldName]) return $formulary->setRequiredMsg ($control, $fieldName); $formulary->data['master_id'] = intval ($received[$fieldName]); } // function save } // class eclFilter_sectionCarte_selectDivision //!eof:library/sectionCarte/eclFilter_sectionCarte_selectDivision.php; //!file:library/sectionCarte/eclMod_sectionCarte_list.php; class eclMod_sectionCarte_list { // class eclMod_sectionCarte_list public $document; private $name; public function __construct ($document, $name) { // function __construct $this->document = $document; $this->name = $name; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $division = $store->domainContent->open ($me->domainId, $this->name); if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; if (isset ($me->data['extras']['list'])) $mod->data = $me->data['extras']['list']; else $mod->data = $store->control->read ('modList_preset_' . $preset); $mod->data['text']['caption'] = $division['text']['title']; $mod->data['local']['caption-display'] = 1; $mod->data['name'] = 'section_' . $me->name; if (isset ($document->actions['page'][1])) $page = intval ($document->actions['page'][1]); if (!isset ($page) or $page > 6) $page = 0; $week = date ('N'); $week += $page; if ($week > 7) $week -= 7; $row = $mod->appendChild(); $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id); foreach ($children as $data) { // each child if ($data['master_id'] != $division['id']) continue; if (!isset ($data['local']['w' . $week])) continue; $row->appendChild ($data); } // each child if (!$row->children) return; if ($document->access (4) and $document->templateEditable) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_list_' . $preset . '_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_list //!eof:library/sectionCarte/eclMod_sectionCarte_list.php; //!file:library/sectionCarte/eclMod_sectionCarte_listAdmin.php; class eclMod_sectionCarte_listAdmin { // class eclMod_sectionCarte_listAdmin public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; if (!$document->access (4)) return; $row = $mod->appendChild (); $select = $me->child ('-divisions'); $row->appendChild ($select->data) ->ref ($select->pathway); $select = $me->child ('-all'); $row->appendChild ($select->data) ->ref ($select->pathway); $select = $me->child ('-select'); $row->appendChild ($select->data) ->ref ($select->pathway); $select = $me->child ('-store'); $row->appendChild ($select->data) ->ref ($select->pathway); $mod->data = $store->control->read ('sectionCarte_listAdmin'); $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_listAdmin //!eof:library/sectionCarte/eclMod_sectionCarte_listAdmin.php; //!file:library/sectionCarte/eclMod_sectionCarte_pages.php; class eclMod_sectionCarte_pages { // class eclMod_sectionCarte_pages public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('sectionCarte_week'); $row = $mod->appendChild(); if (isset ($document->actions['page'][1])) $page = intval ($document->actions['page'][1]); if (!isset ($page) or $page > 6) $page = 0; $week = date ('N'); for ($i = 0; $i < 7; $i ++) { // each day $day = date ('j', TIME + ($i * 86400)); $caption = $store->control->read ('renderLabels_date_weekShort' . $week); $local['caption'] = $document->textMerge ($caption['text']['caption'], ' ' . $day); $row->appendChild ($local) ->active ($page == $i) ->ref (true, true, '_page-' . $i); $week ++; if ($week > 7) $week = 1; } // each day $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_pages //!eof:library/sectionCarte/eclMod_sectionCarte_pages.php; //!file:library/sectionCarte/post/eclApp_sectionCarte_post.php; class eclApp_sectionCarte_post { // class eclApp_sectionCarte_post static function is_child ($me, $name) { // function is_child global $store; if ($name[0] == '-') return false; $data = $store->domainContent->openChild ($me->domainId, MODE_POST, $me->id, $name); if ($data) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->open ($me->domainId, $me->name); $me->id = $me->data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch $view = true; if ($document->access (3)) { // user is admin if ($document->actions ('post', 'edit')) $view = self::action_edit ($document); elseif ($document->actions ('post', 'remove')) return self::action_remove ($document); // Edit $document->mod->context->appendChild ('sectionCarte_post_edit') ->active ($document->actions ('post', 'edit')) ->ref (true, true, '_post-edit'); // Context Remove $document->mod->context->appendChild ('sectionCarte_post_remove') ->ref (true, true, '_post-remove') ->confirm ('sectionCarte_post_removeConfirm'); // Context new post $pathway = $document->application->parent->pathway; $pathway[] = '-new-post'; $document->mod->context->appendChild ('sectionCarte_post_contextNew') ->ref ($pathway); } // user is admin if ($view) { // view post // Hit counter if ($document->access (4)) $document->mod->editor->enable (); else $document->application->data['hits']++; $document->mod->content = new eclMod_sectionCarte_post_content ($document); $document->mod->keywords = new eclMod_sectionCarte_post_keywords ($document); $document->mod->pages = new eclMod_sectionCarte_post_pages ($document); } // view post } // function dispatch static function action_edit ($document) { // function action_edit global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionCarte_post_edit', $me->data, 'post'); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['post']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save formulary unset ($document->actions['post']); $me->data = $formulary->data; $me->name = $formulary->data['name']; array_pop ($me->pathway); $me->pathway[] = $formulary->data['name']; $document->dataReplace ($me->data); return true; } // save formulary $formulary->action = '_post-edit-save'; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_post-edit'; $document->dataReplace ('sectionCarte_post_edit'); return false; } // function action_edit static function action_remove ($document) { // function action_remove global $io, $store; unset ($document->actions['post']); $me = $document->application; $parent = $me->parent; $me->remove (); // reindex brothers $store->domainContent->childrenReindex ($parent->domainId, MODE_POST, $parent->id); $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->ref (); } // function action_remove static function remove ($me) { // function remove global $store; $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); } // function remove } // class eclApp_sectionCarte_post //!eof:library/sectionCarte/post/eclApp_sectionCarte_post.php; //!file:library/sectionCarte/post/eclApp_sectionCarte_post_new.php; class eclApp_sectionCarte_post_new { // class eclApp_sectionCarte_post_new static function is_child ($me, $name) { // function is_child if ($name == '-new-post') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-post'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionCarte_post_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionCarte_post_new', array (), 'create'); if ($formulary->command ('cancel')) { // cancel $document->application = $me->parent; $document->application->dispatch ($document); $document->reload = $document->ref(); return; } // cancel if ($formulary->command ('save') and $formulary->save (1)) { // save post $parent = $document->application->parent; $data = &$formulary->data; $data['mode'] = MODE_POST; $data['parent_id'] = $parent->id; $data['owner_id'] = $document->subscription->id; $data['id'] = $store->domainContent->insert ($parent->domainId, $data); $formulary->save (2); $me->id = $data['id']; unset ($document->application); $parent->reset (); $document->application = $parent->child ($data['name']); $document->application->dispatch ($document); $document->reload = $document->ref (); return; } // save post $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionCarte_post_new //!eof:library/sectionCarte/post/eclApp_sectionCarte_post_new.php; //!file:library/sectionCarte/post/eclMod_sectionCarte_post_pages.php; class eclMod_sectionCarte_post_pages { // class eclMod_sectionCarte_post_pages public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $row = $mod->appendChild(); if (isset ($me->data['extras']['list'])) $list = $me->data['extras']['list']; elseif (isset ($me->data['flags']['modList_preset'])) $list = $store->control->read ('modList_preset_' . $me->data['flags']['modList_preset']); else $list = $store->control->read ('modList_preset_blog'); $sort = isset ($list['local']['list_sort']) ? $list['local']['list_sort'] : 'index'; $direction = isset ($list['local']['list_direction']) ? $list['local']['list_direction'] : 'asc'; switch ($sort) { // switch list sort case 'name': case 'created': case 'updated': case 'event_start': case 'comments_last_update': case 'hits': case 'value': case 'spotlight': $names = $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id, 4, 0, 0, $sort, $direction); break; default: $names = $store->domainContent->childrenNames ($me->domainId, MODE_POST, $me->id, 4, 0, 0, 'index', $direction); } // switch list sort $index = array_search ($document->application->name, $names); if ($index === false) return; $length = count ($names); if ($length < 2) return; if ($index) { // previous $pathway = $me->pathway; $pathway[] = $names[$index - 1]; $row->appendChild ('renderLabels_navigation_previous') ->ref ($pathway); } // previous if ($index < $length - 1) { // next $pathway = $me->pathway; $pathway[] = $names[$index + 1]; $row->appendChild ('renderLabels_navigation_next') ->ref ($pathway); } // next if (isset ($me->data['extras']['navigate'])) $mod->data = $me->data['extras']['navigate']; else $mod->data = $store->control->read ('modList_preset_navigate'); if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_navigate_navigate_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modPages_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_post_pages //!eof:library/sectionCarte/post/eclMod_sectionCarte_post_pages.php; //!file:library/sectionCarte/select/eclApp_sectionCarte_select.php; class eclApp_sectionCarte_select { // class eclApp_sectionCarte_select static function is_child ($me, $name) { // function is_child if ($name == '-select') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-select'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCarte_select_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $document->mod->list = new eclMod_sectionCarte_select_list ($document); } // function dispatch } // class eclApp_sectionCarte_select //!eof:library/sectionCarte/select/eclApp_sectionCarte_select.php; //!file:library/sectionCarte/select/eclMod_sectionCarte_select_list.php; class eclMod_sectionCarte_select_list { // class eclMod_sectionCarte_select_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $received = $document->received; $me = $document->application->parent; $mod->data = $store->control->read ('sectionCarte_select_select'); $divisions = $store->domainContent->children ($me->domainId, MODE_FOLDER, $me->id); $children = $store->domainContent->children ($me->domainId, MODE_POST, $me->id); foreach ($divisions as $division) { // each division $row = $document->createListItem ($division); foreach ($children as $child) { // each child if ($child['master_id'] != $division['id']) continue; $data = &$store->domainContent->openById ($me->domainId, $child['id']); if (isset ($received['save'])) { // save changes for ($i = 1; $i <= 7; $i++) { // save each checkbox if (isset ($received[$data['id'] . '_w' . strval($i)])) $data['local']['w' . strval ($i)] = 1; else unset ($data['local']['w' . strval ($i)]); } // save each checkbox } // save changes $row->appendChild ($data); unset ($data); } // each child if ($row->children) $mod->appendChild ($row); } // each division if (!$mod->children) return; $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_select_list //!eof:library/sectionCarte/select/eclMod_sectionCarte_select_list.php; //!file:library/sectionCarte/store/eclApp_sectionCarte_store.php; class eclApp_sectionCarte_store { // class eclApp_sectionCarte_store static function is_child ($me, $name) { // function is_child if ($name == '-store') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-store'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCarte_store_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionCarte_store_edit', array()); $formulary->save(); $document->mod->panel->main = array ('formulary', 'list'); $document->mod->formulary = $formulary; $document->mod->list = new eclMod_sectionCarte_store_list ($document, $formulary->data); } // function dispatch } // class eclApp_sectionCarte_store //!eof:library/sectionCarte/store/eclApp_sectionCarte_store.php; //!file:library/sectionCarte/store/eclFilter_sectionCarte_store_selectDays.php; class eclFilter_sectionCarte_store_selectDays { // class eclFilter_sectionCarte_store_selectDays static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application->parent; $week = date ('N'); for ($i = 0; $i < 7; $i ++) { // each day $day = date ('j', TIME + ($i * 86400)); $caption = $store->control->read ('renderLabels_date_weekShort' . $week); $local = array ( 'name' => $fieldName . '_' . $week, 'value' => isset ($formulary->data['w' . $week]) ? 1 : '', 'type' => 'checkbox', 'caption' => $document->textMerge ($caption['text']['caption'], ' ' . $day), ); $formulary->appendChild ($local); $week ++; if ($week > 7) $week = 1; } // each day } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $received = $formulary->received; for ($i = 1; $i < 8; $i ++) { // each day if (isset ($received[$fieldName . '_' . $i])) $formulary->data['w' . $i] = true; } // each day } // function save } // class eclFilter_sectionCarte_store_selectDays //!eof:library/sectionCarte/store/eclFilter_sectionCarte_store_selectDays.php; //!file:library/sectionCarte/store/eclMod_sectionCarte_store_list.php; class eclMod_sectionCarte_store_list { // class eclMod_sectionCarte_store_list public $document; private $days; public function __construct ($document, $days) { // function __construct $this->document = $document; $this->days = $days; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $ingredients = array(); $dishes = $store->domainContent->children ($me->domainId, MODE_POST, $me->id); foreach ($dishes as $dish) { // each dish if (!isset ($dish['text']['description'][$document->lang][1])) continue; $quantity = 0; foreach ($this->days as $d => $true) { // each day if (isset ($dish['local'][$d])) $quantity ++; } // each day if (!$quantity) continue; $list = explode (',', $dish['text']['description'][$document->lang][1]); foreach ($list as $ingredient) { // each ingredient $ingredient = ucfirst (trim ($ingredient)); $ingredients[$ingredient][] = array ( 'caption' => $dish['text']['title'], 'quantity' => $quantity ); } // each ingredient } // each dish if (!$ingredients) return; // Headers $row = $mod->appendChild(); $row->appendChild ('sectionCarte_store_listIngredient'); $row->appendChild ('sectionCarte_store_listDish'); $row->appendChild ('sectionCarte_store_listQuantity'); foreach ($ingredients as $caption => $group) { // each ingredient $row = $mod->appendChild(); $local = array ( 'caption' => $document->textMerge ($caption), 'rowspan' => count ($group) ); $row->appendChild ($local); $first = array_shift ($group); $row->appendChild ($first); $local = array ( 'caption' => $document->textMerge ($first['quantity']) ); $row->appendChild ($local); foreach ($group as $item) { // each ingredient dish $row = $mod->appendChild (); $row->appendChild ($item); $local = array ( 'caption' => $document->textMerge ($item['quantity']) ); $row->appendChild ($local); } // each ingredient dish } // each ingredient $mod->data = $store->control->read ('sectionCarte_store_list'); $mod->enabled = true; } // function setModule } // class eclMod_sectionCarte_store_list //!eof:library/sectionCarte/store/eclMod_sectionCarte_store_list.php; //!file:library/sectionCategories/create/eclApp_sectionCategories_create.php; class eclApp_sectionCategories_create { // class eclApp_sectionCategories_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 2) and $name == 'categories') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names global $store; if ($parent->parent->access) return array (); if (!$store->domainContent->findMarker ($parent->domainId, 2)) return array ('categories'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCategories_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionCategories_create //!eof:library/sectionCategories/create/eclApp_sectionCategories_create.php; //!file:library/sectionCategories/eclApp_sectionCategories.php; class eclApp_sectionCategories { // class eclApp_sectionCategories static function constructor_helper ($me) { // function constructor_helper $me->map = array ('domainCategories_category', 'domainCategories_category_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) { // admin // Context new category $pathway = $document->pathway; $pathway[] = '-new-category'; $document->mod->context->appendChild ('domainCategories_category_new') ->virtual () ->ref ($pathway); $document->mod->editor->enable (); } // admin $document->mod->list = new eclMod_domainCategories_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionCategories //!eof:library/sectionCategories/eclApp_sectionCategories.php; //!file:library/sectionFolder/create/eclApp_sectionFolder_create.php; class eclApp_sectionFolder_create { // class eclApp_sectionFolder_create static function is_child ($me, $name) { // function is_child if (count ($me->pathway) < 5 and $name == 'folder') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names if (count ($me->pathway) < 5) return array ('folder'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionFolder_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionFolder_create //!eof:library/sectionFolder/create/eclApp_sectionFolder_create.php; //!file:library/sectionFolder/eclApp_sectionFolder.php; class eclApp_sectionFolder { // class eclApp_sectionFolder static function constructor_helper ($me) { // function constructor_helper $me->map = array ('section', 'section_create'); } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; if ($document->access (4)) { // admin $document->mod->editor->enable (); $pathway = $me->pathway; $pathway[] = '-new-section'; $document->mod->context->appendChild ('section_create_contextNew') ->ref ($pathway); } // admin $document->mod->list = new eclMod_sectionFolder_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionFolder //!eof:library/sectionFolder/eclApp_sectionFolder.php; //!file:library/sectionFolder/eclMod_sectionFolder_list.php; class eclMod_sectionFolder_list { // class eclMod_sectionFolder_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; if (isset ($me->data['extras']['list'])) $mod->data = $me->data['extras']['list']; else $mod->data = $store->control->read ('modList_preset_folder'); $mod->data['name'] = 'section_' . $me->name; $row = $mod->appendChild(); foreach ($me->menuChildren ($document) as $child) { // each child $row->appendChild ($child->data) ->virtual ($child->access) ->set ('editable', $document->contentEditable) ->swapTitle () ->ref ($child->pathway); } // each child if (!$row->children) return; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array ($document->domain->name, '-dialog', 'section_list_folder_' . $me->name); $mod->data['local']['personalite_ref'] = $document->ref ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionFolder_list //!eof:library/sectionFolder/eclMod_sectionFolder_list.php; //!file:library/sectionFormulary/create/eclApp_sectionFormulary_create.php; class eclApp_sectionFormulary_create { // class eclApp_sectionFormulary_create static function is_child ($me, $name) { // function is_child if ($name == 'formulary') return true; if ($name == 'contact') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; if ($store->domainContent->findMarker ($me->domainId, 4)) return array ('formulary'); return array ('contact', 'formulary'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionFormulary_create_' . $me->name); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionFormulary_create //!eof:library/sectionFormulary/create/eclApp_sectionFormulary_create.php; //!file:library/sectionFormulary/done/eclApp_sectionFormulary_done.php; class eclApp_sectionFormulary_done { // class eclApp_sectionFormulary_done static function is_child ($me, $name) { // function is_child if ($name == '-done') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-done'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $children = $store->domainContent->children ($me->domainId, MODE_QUESTION, $me->parent->id); $data = reset ($children); if ($data) { // custom content $me->data = &$store->domainContent->open ($me->domainId, $data['name']); $me->id = $me->data['id']; } // custom content else $me->data = $store->control->read ('sectionFormulary_done_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = $me->id ? 'custom' : 'default'; if ($document->access (4)) { // admin access // Restore to default message if ($view == 'custom' and $document->actions ('message', 'restore')) $view = self::action_restore ($document); // Edit custom message elseif ($view == 'custom' and $document->actions ('message', 'edit')) $view = self::action_edit ($document); // Clear language elseif ($view == 'custom' and $document->actions ('message', 'language', 'clear')) self::action_language_clear ($document); // Edit default message elseif ($view == 'default' and $document->actions ('message', 'custom')) $view = self::action_custom ($document); // Create a custom message to save Wysiwyg edition elseif ($view == 'default' and $document->actions ('wysiwyg', 'save')) $view = self::action_wysiwyg_save ($document); if ($view == 'default' or $document->actions ('message', 'custom')) { // default tools // Context custom message $document->mod->context->appendChild ('sectionFormulary_done_custom') ->active ($document->actions ('message', 'custom')) ->ref (true, true, '_message-custom'); } // default tools else { // custom tools // context edit $document->mod->context->appendChild ('sectionFormulary_done_edit') ->active ($document->actions ('message', 'edit')) ->ref (true, true, '_message-edit'); // context language remove if (count ($document->application->data['text']['caption']) > 1 and isset ($document->application->data['text']['caption'][$document->lang])) $document->mod->context->appendChild ('systemFormulary_clearLanguage') ->ref (true, true, '_message-language-clear') ->confirm ('systemFormulary_clearLanguageConfirm'); // context restore $document->mod->context->appendChild ('sectionFormulary_done_restore') ->ref (true, true, '_message-restore'); } // custom tools if ($view != 'form') $document->mod->editor->enable (); } // admin access } // function dispatch static function action_wysiwyg_save ($document) { // function action_wysiwyg_save global $store; $me = $document->application; $data = $me->data; $data['name'] = 'm' . TIME; $data['mode'] = MODE_QUESTION; $data['parent_id'] = $me->parent->id; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = &$store->domainContent->openById ($me->domainId, $me->id); return 'custom'; } // function action_wysiwyg_save static function action_custom ($document) { // function action_custom global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionFormulary_done_edit', $store->control->read ('sectionFormulary_done_content')); $formulary->action = '_message-custom'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['message']); return 'default'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['message']); $data = $formulary->data; $data['name'] = 'm' . TIME; $data['mode'] = MODE_QUESTION; $data['parent_id'] = $me->parent->id; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = $data; $document->dataReplace ($me->data); return 'custom'; } // save $document->dataReplace ('sectionFormulary_done_custom'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_message-custom'; return 'form'; } // function action_custom static function action_edit ($document) { // function action_edit $formulary = $document->createFormulary ('sectionFormulary_done_edit', $document->application->data); $formulary->action = '_message-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['message']); return 'custom'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['message']); $data = $formulary->data; $document->application->data = $data; $document->dataReplace ($data); return 'custom'; } // save $document->dataReplace ('sectionFormulary_done_edit'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_message-edit'; return 'form'; } // function action_edit static function action_language_clear ($document) { // function action_language_clear unset ($document->actions['message']); if (count ($document->application->data['text']['caption']) == 1) return; foreach ($document->application->data['text'] as &$field) { // each field unset ($field[$document->lang]); } // each field $document->dataReplace ($document->application->data); } // function action_language_clear static function action_restore ($document) { // function action_restore global $store; $me = $document->application; unset ($document->actions['message']); $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->data['name']); $document->dataReplace ('sectionFormulary_done_content'); $me->id = 0; return 'default'; } // function action_restore static function remove ($me) { // function remove global $store; if ($me->id) $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->data['name']); } // function remove } // class eclApp_sectionFormulary_done //!eof:library/sectionFormulary/done/eclApp_sectionFormulary_done.php; //!file:library/sectionFormulary/eclApp_sectionFormulary.php; class eclApp_sectionFormulary { // class eclApp_sectionFormulary static function constructor_helper ($me) { // function constructor_helper $me->map = array ('sectionFormulary_received', 'sectionFormulary_removed', 'sectionFormulary_statistics', 'sectionFormulary_done'); } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = true; if ($document->access (4)) { // admin access // edit fields if ($document->actions ('fields', 'edit') or !isset ($me->data['extras']['formulary'])) $view = self::action_edit_fields ($document); // context edit fields $document->mod->context->appendChild ('sectionFormulary_fields') ->ref (true, true, '_fields-edit') ->active ($document->actions ('fields', 'edit')); // security if ($document->actions ('security', 'edit')) $view = self::action_edit_security ($document); // context edit security $document->mod->context->appendChild ('sectionFormulary_security') ->ref (true, true, '_security-edit') ->active ($document->actions ('security', 'edit')); } // admin access if (!$view) return; if ($document->access (4)) $document->mod->editor->enable (); if (isset ($me->data['extras']['formulary'])) $view = self::action_formulary ($document); $document->mod->list = new eclMod_sectionFolder_list ($document); } // function dispatch static function action_edit_fields ($document) { // function action_edit_fields $me = $document->application; $formulary = $document->createFormulary ('sectionFormulary_fields', $me->data, 'editfields'); $formulary->action = '_fields-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['fields']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['fields']); $me->data = $formulary->data; return true; } // save $document->dataReplace ('sectionFormulary_fields'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return false; } // function action_edit_fields static function action_edit_security ($document) { // function action_edit_security $me = $document->application; $formulary = $document->createFormulary ('sectionFormulary_security', $me->data, 'editsecurity'); $formulary->action = '_security-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['security']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['security']); $me->data = $formulary->data; return true; } // save $document->dataReplace ('sectionFormulary_security'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return false; } // function action_edit_security static function action_formulary ($document) { // function action_formulary global $store; if (isset ($document->actions['review'][1])) return self::action_review ($document); $me = $document->application; $interactive = $document->createInteractive ($me->data['extras']['formulary']); if ($interactive->command ('cancel')) $interactive->data = array (); elseif ($interactive->command ('save') and $interactive->interact ('save')) { // save if (isset ($me->data['flags']['form_review'])) { // review formulary $token = md5 (TIME . session_id ()); $document->session['form_' . $token] = $interactive->data; $formulary = $document->createFormulary ('sectionFormulary_review', array (), 'review'); $formulary->action = '_review-' . $token; $document->dataReplace ('sectionFormulary_review'); $document->mod->panel->main = array ('content', 'interactive', 'formulary'); $interactive->interact ('view'); $document->mod->interactive = $interactive; $document->mod->formulary = $formulary; return false; } // review formulary $data = array ( 'domain_id' => $me->domainId, 'mode' => MODE_FORM, 'parent_id' => $me->id, 'local' => array ('form' => $interactive->data) ); $id = $store->domainContent->insert ($me->domainId, $data); self::action_sendmail ($document, $id); $message = $me->child ('-done'); $document->dataReplace ($message->data); return false; } // save if ($interactive->errorMsg) $document->mod->humperstilshen->alert ($interactive->errorMsg); $interactive->interact ('create'); $document->mod->formulary = $interactive; $document->mod->panel->main = array ('content', 'formulary', 'list'); return true; } // function action_formulary static function action_review ($document) { // function action_review global $store; $me = $document->application; $token = $document->actions['review'][1]; $formulary = $document->createFormulary ('sectionFormulary_review', array (), 'review'); if ($formulary->command ('previous')) { // previous $interactive = $document->createInteractive ($me->data['extras']['formulary'], $document->session['form_' . $token]); $interactive->interact ('create'); $document->mod->formulary = $interactive; $document->mod->panel->main = array ('content', 'formulary', 'list'); return true; } // previous if ($formulary->command ('save') and isset ($document->session['form_' . $token])) { // save $data = array ( 'domain_id' => $me->domainId, 'mode' => MODE_FORM, 'parent_id' => $me->id, 'local' => array ('form' => $document->session['form_' . $token]) ); $store->domainContent->insert ($me->domainId, $data); unset ($document->session['form_' . $token]); $message = $me->child ('-done'); $document->dataReplace ($message->data); return false; } // save $document->mod->humperstilshen->alert ('systemFormulary_alertRobotsPrevent'); return false; } // function action_review static function action_sendmail ($document, $id) { // function action_sendmail global $store; $me = $document->application; if (!isset ($me->data['local']['mail'])) return; $data = $store->domainContent->openById ($me->domainId, $id); if (!$data) return; $template = clone $document; $template->application = $me->child ('-received')->child ($data['name']); $template->application->access = 0; $template->dispatch(); $template->data['flags']['modLayout_base'] = 'mail'; $template->charset = 'UTF-8'; $template->render(); $subject = $template->selectLanguage ($template->textMerge ($document->domain->data['text']['title'], ' -> ', $me->data['text']['caption'])); $mail = $document->createMail () ->subject ($subject[1]) ->to ($me->data['local']['mail']) ->contentHTML ($template->buffer); $errorMsg = $mail->send (); if ($errorMsg) { // mail error $document->mod->humperstilshen->alert ($errorMsg); return; } // mail error } // function action_sendmail static function remove ($me) { // function remove global $store; $children = $store->domainContent->children ($me->domainId, MODE_FORM, $me->id); foreach ($children as $child) { // each children $store->domainContent->delete ($me->domainId, $child['id']); $store->domainFile->deletePrefixedFiles ($me->domainId, $child['name']); } // each children } // function remove } // class eclApp_sectionFormulary //!eof:library/sectionFormulary/eclApp_sectionFormulary.php; //!file:library/sectionFormulary/received/eclApp_sectionFormulary_received.php; class eclApp_sectionFormulary_received { // class eclApp_sectionFormulary_received static function is_child ($me, $name) { // function is_child if ($name == '-received') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-received'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionFormulary_received_content'); $me->map = array ('sectionFormulary_record'); $children = $store->domainContent->children ($me->domainId, MODE_FORM, $me->parent->id); $num = 0; foreach ($children as $data) { // each children if (!$data['marker']) $num++; } // each children $me->data['num_children'] = $num; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $document->mod->list = new eclMod_sectionFormulary_received_list ($document); } // function dispatch } // class eclApp_sectionFormulary_received //!eof:library/sectionFormulary/received/eclApp_sectionFormulary_received.php; //!file:library/sectionFormulary/received/eclMod_sectionFormulary_received_list.php; class eclMod_sectionFormulary_received_list { // class eclMod_sectionFormulary_received_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('sectionFormulary_received_list'); $fieldsList = array ( 'created' => 'created', 'opened' => 'opened', ); $children = $store->domainContent->children ($me->domainId, MODE_FORM, $me->parent->id); foreach ($children as $data) { // each child if ($data['marker'] == 255) continue; $pathway = $me->pathway; $pathway[] = $data['name']; $row = $mod->appendChild (); foreach ($fieldsList as $fieldName => $fieldType) { // each field switch ($fieldType) { // switch type case 'created': $local['caption'] = $document->textMerge (date ('d-m-Y h:i', $data['created'])); $row->appendChild ($local) ->ref ($pathway); break; case 'opened': if (!$data['marker']) $row->appendChild ('sectionFormulary_received_listNew'); break; } // switch type } // each field } // each child $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_received_list //!eof:library/sectionFormulary/received/eclMod_sectionFormulary_received_list.php; //!file:library/sectionFormulary/record/eclApp_sectionFormulary_record.php; class eclApp_sectionFormulary_record { // class eclApp_sectionFormulary_record static function is_child ($me, $name) { // function is_child global $store; if ($name[0] == '-') return false; $data = $store->domainContent->open ($me->domainId, $name); if ($data and $data['mode'] == MODE_FORM and $data['parent_id'] == $me->parent->id) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return $store->domainContent->childrenNames ($me->domainId, MODE_FORM, $me->id); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->open ($me->domainId, $me->name); $me->id = $me->data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if ($me->parent->name == '-received') $me->data['marker'] = 1; if ($document->actions ('record', 'remove')) return self::action_remove ($document); // context remove $document->mod->context->appendChild ('sectionFormulary_record_remove') ->ref (true, true, '_record-remove'); $data = $store->control->read ('sectionFormulary_record_content'); $document->dataMerge ($data); $interactive = $document->createInteractive ($me->parent->parent->data['extras']['formulary'], $me->data['local']['form']); $interactive->interact ('view'); $document->mod->formulary = $interactive; } // function dispatch static function action_remove ($document) { // function action_remove $me = $document->application; if ($me->parent->name == '-received') $me->data['marker'] = 255; else $me->remove (); $parent = $me->parent; $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->ref ($parent->pathway); return; } // function action_remove static function remove ($me) { // function remove global $store; $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); } // function remove } // class eclApp_sectionFormulary_record //!eof:library/sectionFormulary/record/eclApp_sectionFormulary_record.php; //!file:library/sectionFormulary/removed/eclApp_sectionFormulary_removed.php; class eclApp_sectionFormulary_removed { // class eclApp_sectionFormulary_removed static function is_child ($me, $name) { // function is_child if ($name == '-removed') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; $children = $store->domainContent->children ($me->domainId, MODE_FORM, $me->parent->id); foreach ($children as $data) { // each children if ($data['marker'] == 255) return array ('-removed'); } // each data return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionFormulary_removed_content'); $me->map = array ('sectionFormulary_record'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $children = $store->domainContent->children ($me->domainId, MODE_FORM, $me->parent->id); $document->mod->list = new eclMod_sectionFormulary_removed_list ($document); } // function dispatch } // class eclApp_sectionFormulary_removed //!eof:library/sectionFormulary/removed/eclApp_sectionFormulary_removed.php; //!file:library/sectionFormulary/removed/eclMod_sectionFormulary_removed_list.php; class eclMod_sectionFormulary_removed_list { // class eclMod_sectionFormulary_removed_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('sectionFormulary_received_list'); $fieldsList = array ( 'created' => 'created' ); $children = $store->domainContent->children ($me->domainId, MODE_FORM, $me->parent->id); foreach ($children as $data) { // each child if (!$data['marker']) continue; $pathway = $me->pathway; $pathway[] = $data['name']; $row = $mod->appendChild (); foreach ($fieldsList as $fieldName => $fieldType) { // each field switch ($fieldType) { // switch type case 'created': $local['caption'] = $document->textMerge (date ('d-m-Y h:i', $data['created'])); $row->appendChild ($local) ->ref ($pathway); break; } // switch type } // each field } // each child $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_removed_list //!eof:library/sectionFormulary/removed/eclMod_sectionFormulary_removed_list.php; //!file:library/sectionFormulary/statistics/eclApp_sectionFormulary_statistics.php; class eclApp_sectionFormulary_statistics { // class eclApp_sectionFormulary_statistics static function is_child ($me, $name) { // function is_child if ($name == '-statistics') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names if (!isset ($me->data['extras']['formulary'])) return array (); foreach ($me->data['extras']['formulary'] as $field) { // each field if ($field['filter'] == 'radio' or $field['filter'] == 'checkbox' or $field['filter'] == 'select') return array ('-statistics'); } // each field return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionFormulary_statistics_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $document->mod->list = new eclMod_sectionFormulary_statistics_list ($document); } // function dispatch } // class eclApp_sectionFormulary_statistics //!eof:library/sectionFormulary/statistics/eclApp_sectionFormulary_statistics.php; //!file:library/sectionFormulary/statistics/eclMod_sectionFormulary_statistics_list.php; class eclMod_sectionFormulary_statistics_list { // class eclMod_sectionFormulary_statistics_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $mod->data = $store->control->read ('sectionFormulary_statistics_list'); if (!isset ($me->data['extras']['formulary'])) return; $children = array (); foreach ($store->domainContent->children ($me->domainId, MODE_FORM, $me->id) as $child) { // each child if ($child['marker'] == 255) continue; $children[] = $child; } // each child if (!$children) return; $total = count ($children); foreach ($me->data['extras']['formulary'] as $fieldName => $field) { // each field switch ($field['filter']) { // switch filter case 'checkbox': $counter = 0; foreach ($children as $child) { // each child if (isset ($child['local']['form'][$fieldName]['value']) and $child['local']['form'][$fieldName]['value']) $counter++; } // each child $item = $mod->appendChild (); $item->data['caption'] = $field['caption']; $item->data['units'] = strval ($counter); $item->data['percent'] = strval (round ( ($counter / $total) * 100, 1)); break; case 'select': case 'radio': $values = array (); foreach ($children as $child) { // each child if (isset ($child['local']['form'][$fieldName]['value'])) { // set value if (isset ($values[$child['local']['form'][$fieldName]['value']])) $values[$child['local']['form'][$fieldName]['value']]++; else $values[$child['local']['form'][$fieldName]['value']] = 1; } // set value } // each child $select = $mod->appendChild ($field); $select->data['header'] = 1; foreach ($field['options'] as $value => $caption) { // each option $option = $select->appendChild (); $option->data['caption'] = $caption; if (isset ($values[$value])) { // set values $option->data['units'] = strval ($values[$value]); $option->data['percent'] = strval (round ( ($values[$value] / $total) * 100, 1)); } // set values else { // empty $option->data['units'] = '0'; $option->data['percent'] = '0'; } // empty } // each option } // switch filter } // each field $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_statistics_list //!eof:library/sectionFormulary/statistics/eclMod_sectionFormulary_statistics_list.php; //!file:library/sectionGlossary/create/eclApp_sectionGlossary_create.php; class eclApp_sectionGlossary_create { // class eclApp_sectionGlossary_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 1) and $name == 'glossary') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names global $store; if ($parent->parent->access) return array (); if (!$store->domainContent->findMarker ($parent->domainId, 1)) return array ('glossary'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionGlossary_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionGlossary_create //!eof:library/sectionGlossary/create/eclApp_sectionGlossary_create.php; //!file:library/sectionGlossary/eclApp_sectionGlossary.php; class eclApp_sectionGlossary { // class eclApp_sectionGlossary static function constructor_helper ($me) { // function constructor_helper $me->map = array ('domainGlossary_keyword'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->list = new eclMod_domainGlossary_list ($document); } // function dispatch static function remove ($me) { // function remove global $store; $data = &$store->domainContent->open ($me->domainId, '-register'); unset ($data['links']['sectionGlossary']); } // function remove } // class eclApp_sectionGlossary //!eof:library/sectionGlossary/eclApp_sectionGlossary.php; //!file:library/sectionRedirect/create/eclApp_sectionRedirect_create.php; class eclApp_sectionRedirect_create { // class eclApp_sectionRedirect_create static function is_child ($me, $name) { // function is_child global $store; if ($name == 'redirect') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return array ('redirect'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionRedirect_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionRedirect_create //!eof:library/sectionRedirect/create/eclApp_sectionRedirect_create.php; //!file:library/sectionRedirect/eclApp_sectionRedirect.php; class eclApp_sectionRedirect { // class eclApp_sectionRedirect static function constructor_helper ($me) { // function constructor_helper $me->data['hits'] ++; $me->access = 0; } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) { // admin $document->dataMerge ('sectionRedirect_content'); return; } // admin $me = $document->application; if (!isset ($me->data['local']['url']) or !$me->data['local']['url']) return; $me->data['value'] ++; header ('Location: ' . $me->data['local']['url']); $document->buffer = CRLF; } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionRedirect //!eof:library/sectionRedirect/eclApp_sectionRedirect.php; //!file:library/sectionSearch/create/eclApp_sectionSearch_create.php; class eclApp_sectionSearch_create { // class eclApp_sectionSearch_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 3) and $name == 'search') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names global $store; if ($parent->parent->access) return array (); if (!$store->domainContent->findMarker ($parent->domainId, 3)) return array ('search'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionSearch_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionSearch_create //!eof:library/sectionSearch/create/eclApp_sectionSearch_create.php; //!file:library/sectionSearch/eclApp_sectionSearch.php; class eclApp_sectionSearch { // class eclApp_sectionSearch static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->panel->main = array ('content', 'formulary', 'list'); $document->mod->formulary = new eclMod_domainSearch_formulary ($document); $document->mod->list = new eclMod_domainSearch_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionSearch //!eof:library/sectionSearch/eclApp_sectionSearch.php; //!file:library/sectionSubdomains/create/eclApp_sectionSubdomains_create.php; class eclApp_sectionSubdomains_create { // class eclApp_sectionSubdomains_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->domainContent->findMarker ($me->domainId, 11) and $name == 'subdomains') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; $domain = $me; while (!$domain->isDomain and $domain = $domain->parent); if ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME) return array (); if (!$store->domainContent->findMarker ($me->domainId, 11)) return array ('subdomains'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionSubdomains_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionSubdomains_create //!eof:library/sectionSubdomains/create/eclApp_sectionSubdomains_create.php; //!file:library/sectionSubdomains/eclApp_sectionSubdomains.php; class eclApp_sectionSubdomains { // class eclApp_sectionSubdomains static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->list = new eclMod_sectionSubdomains_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionSubdomains //!eof:library/sectionSubdomains/eclApp_sectionSubdomains.php; //!file:library/sectionSubdomains/eclMod_sectionSubdomains_list.php; class eclMod_sectionSubdomains_list { // class eclMod_sectionSubdomains_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('sectionSubdomains_list'); foreach ($store->domain->childrenNames() as $name) { // each domain $domainId = $store->domain->getId ($name); $status = $store->domain->getStatus ($name); if ($status != 2) continue; $data = $store->domainContent->open ($domainId, '-register'); $mod->appendChild ($data) ->swapTitle() ->ref (array ($name)); } // each domain $mod->enabled = true; } // function setModule } // class eclMod_sectionSubdomains_list //!eof:library/sectionSubdomains/eclMod_sectionSubdomains_list.php; //!file:library/sectionTerms/create/eclApp_sectionTerms_create.php; class eclApp_sectionTerms_create { // class eclApp_sectionTerms_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->domainContent->findMarker ($me->domainId, 10) and $name == 'terms') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; $domain = $me; while (!$domain->isDomain and $domain = $domain->parent); if ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME) return array (); if (!$store->domainContent->findMarker ($me->domainId, 10)) return array ('terms'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionTerms_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionTerms_create //!eof:library/sectionTerms/create/eclApp_sectionTerms_create.php; //!file:library/sectionTerms/eclApp_sectionTerms.php; class eclApp_sectionTerms { // class eclApp_sectionTerms static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionTerms //!eof:library/sectionTerms/eclApp_sectionTerms.php; //!file:library/system/eclApp_system.php; class eclApp_system { // class eclApp_system static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function constructor_helper ($me) { // function constructor_helper global $io, $store; // Set default layout $me->data['flags'] = array ( 'modLayout_base' => 'responsive', 'modLayout_from' => 'domain', 'modLayout_name' => 'default' ); // Default settings $me->data['generator'] = SYSTEM_GENERATOR; $me->data['version'] = SYSTEM_VERSION; $me->data['release'] = SYSTEM_RELEASE; // Project name and reference $me->data['text']['caption'][SYSTEM_DEFAULT_LANGUAGE][TEXT_CONTENT] = SYSTEM_PROJECT_CAPTION; if (SYSTEM_DEFAULT_CHARSET == 'ISO-8859-1') $me->data['text']['caption'][SYSTEM_DEFAULT_LANGUAGE][TEXT_CHARSET] = 1; $me->data['ref'] = SYSTEM_PROJECT_REF; $me->getMap (); $me->isDomain = true; $me->groups[] = new eclGroup_system (); } // function constructor_helper } // class eclApp_system //!eof:library/system/eclApp_system.php; //!file:library/system/eclApp_system_accessDenied.php; class eclApp_system_accessDenied { // class eclApp_system_accessDenied static function is_child ($me, $name) { // function is_child if ($name == '-access-denied') return true; if ($name == '-resource-denied') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-access-denied', '-resource-denied'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->ignoreSubfolders = true; if ($me->name == '-access-denied') $me->data = $store->control->read ('system_accessDenied'); else $me->data = $store->control->read ('system_resourceDenied'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->base = 'system_message'; } // function dispatch } // class eclApp_system_accessDenied //!eof:library/system/eclApp_system_accessDenied.php; //!file:library/system/eclApp_system_error.php; class eclApp_system_error { // class eclApp_system_error static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('system_error'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->base = 'system_message'; } // function dispatch } // class eclApp_system_error //!eof:library/system/eclApp_system_error.php; //!file:library/system/eclApp_system_maintenance.php; class eclApp_system_maintenance { // class eclApp_system_maintenance static function is_child ($me, $name) { // function is_child if ($name == '-maintenance') return true; if ($name[0] == '-') return false; if (defined ('SYSTEM_MAINTENANCE') and SYSTEM_MAINTENANCE) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->ignoreSubfolders = true; $me->data = $store->control->read ('system_maintenance'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->base = 'system_message'; } // function dispatch } // class eclApp_system_maintenance //!eof:library/system/eclApp_system_maintenance.php; //!file:library/system/eclApp_system_overload.php; class eclApp_system_overload { // class eclApp_system_overload static function is_child ($me, $name) { // function is_child global $io; if ($name == '-overload') return true; if (!defined ('DATABASE_ENABLED') or !DATABASE_ENABLED) return false; if (defined ('DATABASE_CLIENT') and DATABASE_CLIENT == 'sqlite') return false; if (!$io->database->status) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->ignoreSubfolders = true; $me->data = $store->control->read ('system_overload'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->base = 'system_message'; } // function dispatch } // class eclApp_system_overload //!eof:library/system/eclApp_system_overload.php; //!file:library/system/eclApp_system_preload.php; class eclApp_system_preload { // class eclApp_system_preload static function is_child ($me, $name) { // function is_child if ($name == '-preload') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-preload'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_system_preload //!eof:library/system/eclApp_system_preload.php; //!file:library/system/eclApp_system_sessionRestore.php; class eclApp_system_sessionRestore { // class eclApp_system_sessionRestore static function is_child ($me, $name) { // function is_child if ($name == '-session-restore') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-session-restore'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('system_sessionRestore'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $system; $document->base = 'system_message'; $document->application = $system->child ('-session-restore'); $document->application->pathway = $document->pathway; } // function dispatch } // class eclApp_system_sessionRestore //!eof:library/system/eclApp_system_sessionRestore.php; //!file:library/system/eclApp_system_shared.php; class eclApp_system_shared { // class eclApp_system_shared static function is_child ($me, $name) { // function is_child global $io; if (in_array ('-shared', $io->request->pathway)) return true; if (in_array ('-media', $io->request->pathway)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $io; if (in_array ('-shared', $io->request->pathway)) $me->name = '-shared'; elseif (in_array ('-media', $io->request->pathway)) $me->name = '-media'; $me->ignoreSubfolders = true; $me->ignoreSession (true); } // function constructor_helper static function dispatch ($document) { // function dispatch global $dataMap, $io; $me = $document->application; $pathway = $document->pathway; while (array_shift ($pathway) != $me->name); if (count ($pathway) < 2) exit; static $mime = array ( 'css' => 'text/css', 'gif' => 'image/gif', 'html' => 'text/html', 'htm' => 'text/html', 'jpg' => 'image/jpeg', 'js' => 'text/javascript', 'mp3' => 'audio/mpeg', 'png' => 'image/png', 'svg' => 'image/svg+xml', 'txt' => 'text/plain' ); $folders = $pathway; $name = array_pop ($folders); $path = implode ('/', $folders); if ($me->name == '-media') { // media $path = PATH_LIBRARY . $path . '/_media/' . $name; $io->sendFile->send ($path, array ('Content-Disposition' => 'inline')); exit; } // media if (isset ($dataMap['f'][$path][$name])) { // embeded @list (, $extension) = explode ('.', $name, 2); if (!isset ($mime[$extension])) exit; header ('Content-type: ' . $mime[$extension]); header ('Cache-Control: public, only-if-cached, max-age=2592000'); print $io->cachedControls->file ($path, $name); exit; } // embeded $path = PATH_SHARED . implode ('/', $pathway); $headers = array ( 'Content-Disposition' => 'inline', 'Cache-Control' => 'private, only-if-cached' ); $io->sendFile->send ($path, $headers); exit; } // function dispatch } // class eclApp_system_shared //!eof:library/system/eclApp_system_shared.php; //!file:library/system/eclGroup_system.php; class eclGroup_system { // class eclGroup_system public function check ($document) { // function check if (!defined ('ADMIN_IDENTIFIER')) return 0; if ($document->user->name == ADMIN_IDENTIFIER) return 4; if (defined ('ADMIN_HELPERS') and strlen (ADMIN_HELPERS) and in_array ($document->user->name, explode (' ', ADMIN_HELPERS))) return 4; return 0; } // function check } // class eclGroup_system //!eof:library/system/eclGroup_system.php; //!file:library/systemConstants/eclFilter_systemConstants_flag.php; /* * control_type * control_filter * control_target * control_field_name * control_value_cast int | string | bool */ class eclFilter_systemConstants_flag { // class eclFilter_systemConstants_flag static function create ($fieldName, $control, $formulary) { // function create global $io, $store; // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_small'; // target $value = ''; if (defined ('SYSTEM_INSTALLATION_PROGRESS') and isset ($formulary->data[$target])) $value = $formulary->data[$target]; else { // from constant if ($io->systemConstants->check ($target)) $value = $io->systemConstants->constants[$target]; elseif (defined ($target)) $value = constant ($target); } // from constant if ($formulary->document->charset != 'UTF-8' and is_string ($value)) $value = mb_convert_encoding ($value, $formulary->document->charset, 'UTF-8'); if (!isset ($control['children'])) { // no children $local['value'] = $value; $formulary->appendChild ($control, $local); return; } // no children $item = $formulary->appendChild ($control, $local); foreach ($control['children'] as $child) { // each child $data = $store->control->read ($child); if (!isset ($data['flags']['control_value']) or !isset ($data['text']['caption'])) continue; $local = array ( 'value' => $data['flags']['control_value'], 'caption' => $data['text']['caption'] ); $item->appendChild (false, $local) ->active ($data['flags']['control_value'] == $value); } // each child } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; if (isset ($formulary->received[$fieldName])) $value = $formulary->received[$fieldName]; else $value = false; if ($value === false and isset ($control['flags']['control_required'])) $formulary->setRequiredMsg ($control, $fieldName); if (isset ($control['flags']['control_value_cast'])) { // cast value switch ($control['flags']['control_value_cast']) { // switch type case 'int': $value = intval ($value); break; case 'string': $value = strval ($value); if (!preg_match ('/^[\ -~]*$/', $value)) return $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterFlagError', $value); $value = str_replace (array ("'", "\\"), "", $value); break; case 'bool': if ($value === 'false' or !$value) $value = false; else $value = true; break; case 'free': $value = $formulary->received[$fieldName]; if ($formulary->document->charset != 'UTF-8') $value = mb_convert_encoding ($value, 'UTF-8', $formulary->document->charset); $value = str_replace (array ("'", "\\"), "", $value); } // switch type } // cast value // target if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $formulary->data[$target] = $value; else $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_systemConstants_flag //!eof:library/systemConstants/eclFilter_systemConstants_flag.php; //!file:library/systemConstants/eclFilter_systemConstants_folder.php; /* * control_type * control_filter * control_target * control_field_name */ class eclFilter_systemConstants_folder { // class eclFilter_systemConstants_folder static function create ($fieldName, $control, $formulary) { // function create global $io; // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_small'; // get value $value = ''; if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $value = $formulary->getField ($target); if ($value === false) $value = ''; if ($value == '') { // get value from constant if ($io->systemConstants->check ($target)) $value = $io->systemConstants->constants[$target]; elseif (defined ($target)) $value = constant ($target); } // from constant $local['value'] = $value; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $old = $formulary->getField ($target); else { // from constant // Old value if ($io->systemConstants->check ($target)) $old = $io->systemConstants->constants[$target]; elseif (defined ($target)) $old = constant ($target); } // from constant if (!isset ($formulary->received[$fieldName])) return $formulary->setErrorMsg ($control, $fieldName, 'systemConstants_filterFolderError'); $value = $formulary->received[$fieldName]; if (substr ($value, - 1) != '/') $value .= '/'; if (defined ('SYSTEM_INSTALLATION_PROGRESS')) { // installation in progress if ($value === $old) return; } // installation in progress else { // normal if ($value == $old and is_dir (FOLDER_ROOT . $old)) return; } // normal if (!preg_match ('%^[.]?[a-zA-Z0-9_-]+\/?$%', $value)) return $formulary->setErrorMsg ($control, $fieldName, 'systemConstants_filterFolderError', $value); // check for name conflict $folders = array ('PATH_DATABASE', 'PATH_DOMAINS', 'PATH_ENGINE', 'PATH_LIBRARY', 'PATH_PROFILES', 'PATH_SHARED'); foreach ($folders as $folder) { // check folder if ($folder == $target) continue; if (defined ('SYSTEM_INSTALLATION_PROGRESS')) { // installation in progress if (!isset ($formulary->data[$folder])) continue; if ($formulary->data[$folder] != $value) continue; return $formulary->setErrorMsg ($control, $fieldName, 'systemConstants_filterFolderExists', $value); } // installation in progress if (!$io->systemConstants->check ($folder) and constant ($folder) != $value) continue; if ($io->systemConstants->check ($folder) and $io->systemConstants->constants[$folder] != $value) continue; return $formulary->setErrorMsg ($control, $fieldName, 'systemConstants_filterFolderExists', $value); } // check folder if (defined ('SYSTEM_INSTALLATION_PROGRESS')) return $formulary->setField ($target, $value); if (is_dir (FOLDER_ROOT . $value)) return $formulary->setErrorMsg ($control, $fieldName, 'systemConstants_filterFolderExists', $value); if (is_dir (FOLDER_ROOT . $old)) rename (FOLDER_ROOT . $old, FOLDER_ROOT . $value); elseif (!is_dir (FOLDER_ROOT . $value)) mkdir (FOLDER_ROOT . $value); $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_systemConstants_folder //!eof:library/systemConstants/eclFilter_systemConstants_folder.php; //!file:library/systemConstants/eclFilter_systemConstants_password.php; /* * control_type * control_filter * control_target * control_field_name */ class eclFilter_systemConstants_password { // class eclFilter_systemConstants_password static function create ($fieldName, $control, $formulary) { // function create global $io, $store; // target if (!isset ($control['flags']['control_target'])) return; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $local['type'] = $control['flags']['control_type']; else $local['type'] = 'text_small'; $formulary->appendChild ($control, $local); $control = $store->control->read ('labels/field/password2'); $local['name'] = $fieldName . '_2'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; // target if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; if (isset ($formulary->received[$fieldName])) $value = $formulary->received[$fieldName]; else $value = false; if ($value == '') $value = false; if (defined ('SYSTEM_INSTALLATION_PROGRESS') and $value === false and isset ($formulary->data[$target])) return; if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'systemFormulary_filterPasswordRequired'); if (!preg_match ('/^[\ -~]+$/', $value)) return $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterPasswordInvalidCharacter'); if (!isset ($formulary->received[$fieldName . '_2'])) return $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterPasswordRepeatError'); if ($formulary->received[$fieldName . '_2'] != $value) return $formulary->setErrorMsg ($control, $fieldName, 'systemFormulary_filterPasswordRepeatError'); // target if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $formulary->data[$target] = md5 ($value); else $io->systemConstants->set ($target, md5 ($value)); } // function save } // class eclFilter_systemConstants_password //!eof:library/systemConstants/eclFilter_systemConstants_password.php; //!file:library/systemConstants/eclFilter_systemConstants_select.php; class eclFilter_systemConstants_select { // class eclFilter_systemConstants_select static function create ($fieldName, $control, $formulary) { // function create global $io, $store; if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; // target if ($io->systemConstants->check ($target)) $value = $io->systemConstants->constants[$target]; elseif (defined ($target)) $value = constant ($target); else $value = false; if (isset ($control['children'])) { // children exists foreach ($control['children'] as $child_name) { // each child $data = $store->control->read ($child_name); $child = $item->appendChild ($data); if (isset ($data['flags']['control_value'])) { // value exists $child->data['value'] = $data['flags']['control_value']; $child->active ($data['flags']['control_value'] == $value); } // value exists } // each child } // children exists } // function create static function save ($fieldName, $control, $formulary) { // function save global $io, $store; if (isset ($formulary->received[$fieldName])) $value = $formulary->received[$fieldName]; else $value = false; $found = false; if (isset ($control['children'])) { // children exists foreach ($control['children'] as $child_name) { // each child $child = $store->control->read ($child_name); if (isset ($child['flags']['control_value']) and $child['flags']['control_value'] == $value) { // value found $found = $value; break; } // value found } // each child } // children exists $value = $found; // required if ($value === false and isset ($control['flags']['control_required'])) return $formulary->setRequiredMsg ($control, $fieldName); // control_default_value elseif ($value === false and isset ($control['flags']['control_default_value'])) $value = $control['flags']['control_default_value']; // value cast if (isset ($control['flags']['control_value_cast'])) { // cast value switch ($control['flags']['control_value_cast']) { // switch type case 'int': $value = intval ($value); break; case 'string': $value = strval ($value); break; case 'bool': if ($value === 'false' or !$value) $value = false; else $value = true; } // switch type } // cast value // target if (isset ($control['flags']['control_target'])) $io->systemConstants->set ($control['flags']['control_target'], $value); } // function save } // class eclFilter_systemConstants_select //!eof:library/systemConstants/eclFilter_systemConstants_select.php; //!file:library/systemConstants/eclFilter_systemConstants_selectLang.php; class eclFilter_systemConstants_selectLang { // class eclFilter_systemConstants_selectLang static function create ($fieldName, $control, $formulary) { // function create global $dataMap, $io, $store; $document = $formulary->document; if (!isset ($control['flags']['control_target'])) return; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; if ($io->systemConstants->check ($control['flags']['control_target'])) $value = $io->systemConstants->constants[$control['flags']['control_target']]; elseif (defined ($control['flags']['control_target'])) $value = constant ($control['flags']['control_target']); else $value = false; $names = array (); if (isset ($dataMap['s']['labels']['lang'])) { // from embeded $names = array_keys ($dataMap['s']['labels']['lang']); } // from embeded elseif (is_dir (FOLDER_SHARED . 'labels/lang')) { // from folder foreach (scandir (FOLDER_SHARED . 'labels/lang') as $filename) { // each file if ($filename[0] == '.') continue; $names[] = substr ($filename, 0, 2); } // each file } // from folder foreach ($names as $lang) { // each lang $data = $store->control->read ('labels/lang/' . $lang); $item->appendChild ($data, array ('value' => $lang)) ->active ($lang == $value); } // each lang } // function create static function save ($fieldName, $control, $formulary) { // function save global $io, $store; if (!isset ($formulary->received[$fieldName])) return; $value = $formulary->received[$fieldName]; // target if (isset ($control['flags']['control_target'])) $io->systemConstants->set ($control['flags']['control_target'], $value); } // function save } // class eclFilter_systemConstants_selectLang //!eof:library/systemConstants/eclFilter_systemConstants_selectLang.php; //!file:library/systemConstants/eclFilter_systemConstants_selectOptions.php; class eclFilter_systemConstants_selectOptions { // class eclFilter_systemConstants_selectOptions static function create ($fieldName, $control, $formulary) { // function create global $dataMap, $io, $store; $document = $formulary->document; if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $item->data['type'] = $control['flags']['control_type']; else $item->data['type'] = 'select'; if ($io->systemConstants->check ($target)) $value = $io->systemConstants->constants[$target]; elseif (defined ($target)) $value = constant ($target); else $value = false; if (!isset ($control['options'])) return; foreach ($control['options'] as $option) { // each option $item->appendChild (false, array ('value' => $option, 'caption' => $document->textMerge ($option))) ->active ($option == $value); } // each option } // function create static function save ($fieldName, $control, $formulary) { // function save global $io, $store; if (!isset ($control['flags']['control_target'])) return; $target = $control['flags']['control_target']; if (!isset ($formulary->received[$fieldName])) return; $value = $formulary->received[$fieldName]; $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_systemConstants_selectOptions //!eof:library/systemConstants/eclFilter_systemConstants_selectOptions.php; //!file:library/systemInstallation/eclApp_systemInstallation.php; class eclApp_systemInstallation { // class eclApp_systemInstallation static function is_child ($parent, $name) { // function is_child if (!defined ('ADMIN_IDENTIFIER')) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('systemInstallation_index'); $me->map = array ('systemInstallation_index'); $me->isDomain = true; } // function constructor_helper } // class eclApp_systemInstallation //!eof:library/systemInstallation/eclApp_systemInstallation.php; //!file:library/systemInstallation/eclApp_systemInstallation_index.php; class eclApp_systemInstallation_index { // class eclApp_systemInstallation_index static function is_child ($parent, $name) { // function is_child if ($name == '') return true; if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; // As subpastas deverão ser ignoradas $me->ignoreSubfolders = true; $me->data = $store->control->read ('systemInstallation_index'); unset ($me->pathway[1]); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; if (!is_file (FOLDER_ROOT . SYSTEM_CONFIG_FILE)) { // config file not found $n = @file_put_contents (FOLDER_ROOT . SYSTEM_CONFIG_FILE, 'dataReplace ('systemInstallation_accessDenied'); return; } // unable to write unlink (FOLDER_ROOT . SYSTEM_CONFIG_FILE); } // config file not found if (!isset ($document->session['systemInstallation'])) { // presets $document->session['systemInstallation'] = $store->control->read ('systemInstallation_templateForConfig'); if ($document->protocol == 'https') $document->session['systemInstallation']['SYSTEM_HTTPS_REDIRECT'] = true; if ($document->rewriteEngine or strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache')) $document->session['systemInstallation']['SYSTEM_REWRITE_ENGINE'] = true; } // presets if (!isset ($document->session['systemInstallation_page'])) $document->session['systemInstallation_page'] = 0; PROCESS_PAGE: $page = $document->session['systemInstallation_page']; $formulary = $document->createFormulary ('systemInstallation_' . $page, $document->session['systemInstallation'], 'page' . $page); if (!$document->rewriteEngine and strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache')) $formulary->flags['rewrite_engine_choose'] = true; if ($formulary->command ('next') and $formulary->save ()) { // next $document->session['systemInstallation'] = $formulary->data; $document->session['systemInstallation_page']++; if ($document->session['systemInstallation_page'] == 3) return self::finish_installation ($document); goto PROCESS_PAGE; } // next elseif ($formulary->command ('previous')) { // previous $formulary->save (); $document->session['systemInstallation'] = $formulary->data; $document->session['systemInstallation_page']--; goto PROCESS_PAGE; } // previous $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->data['ref'] = $document->ref (); $document->data['folder'] = FOLDER_ROOT; } // function dispatch static function finish_installation ($document) { // function finish_installation $constants = $document->session['systemInstallation']; if ($constants['SYSTEM_HOSTING_MODE'] == 0) { // set default configuration $constants['DATABASE_ENABLED'] = true; $constants['DATABASE_CLIENT'] = 'sqlite'; $constants['SYSTEM_DEFAULT_DOMAIN_NAME'] = 'ecolabore'; $constants['SYSTEM_DEFAULT_LANGUAGE'] = $document->lang; } // set default configuration ksort ($constants); $buffer = ' $value) { // each constant $buffer .= "define ('" . $key . "', "; if ($value === false) $buffer .= 'false'; elseif ($value === true) $buffer .= 'true'; elseif (is_int ($value)) $buffer .= strval ($value); elseif (is_string ($value)) $buffer .= "'" . str_replace ("'", CHR_BSLASH . CHR_TIC, $value) . "'"; $buffer .= ");" . CRLF; } // each constant $buffer .= CRLF . '?>'; header ('Content-type: application/force-download'); header ('Content-Disposition: attachment; filename="config.php"'); print $buffer; $document->session = array (); exit; } // function finish_installation } // class eclApp_systemInstallation_index //!eof:library/systemInstallation/eclApp_systemInstallation_index.php; //!file:library/tool/eclApp_tool.php; class eclApp_tool { // class eclApp_tool static function is_child ($me, $name) { // function is_child if ($name == '-tools') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-tools'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('tool_main'); $me->getMap (); $me->isDomain = true; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->context->appendChild ('toolGuide_intro_humperstilshen') ->ref (array ($document->domain->name, '-tools', 'guide', 'intro', 'humperstilshen')); $document->mod->list = new eclMod_sectionFolder_list ($document); $document->mod->sections = new eclMod_tool_sections ($document); } // function dispatch } // class eclApp_tool //!eof:library/tool/eclApp_tool.php; //!file:library/tool/eclMod_tool_sections.php; class eclMod_tool_sections { // class eclMod_tool_sections public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $mod->data = $store->control->read ('modToolbox_module'); $document->mod->toolbox->enabled = false; if ($document->application->name == '-tools') { // loop this level foreach ($document->application->menuChildren ($document) as $child) { // each submenu child $mod->appendChild ($child) ->ref ($child->pathway) ->virtual ($child->access); } // each submenu child return; } // loop this level // Vamos iniciar a partir da aplicação ativa neste documento $level = 1; $app[1] = $document->application; $names[1] = $app[1]->name; // Agora, vamos subir a escada, percorrendo o endereço reversamente while (!$app[$level]->parent->parent->isDomain) { // loop levels $level++; $app[$level] = $app[$level - 1]->parent; $names[$level] = $app[$level]->name; } // loop levels // Vamos procurar os filhos da aplicação atual // pois eles irão formar um submenu $menu[0] = $document->createListItem (); foreach ($app[1]->menuChildren ($document) as $child) { // each submenu child $menu[0]->appendChild ($child, array ('ref' => $document->ref ($child->pathway), 'virtual' => $child->access)); } // each submenu child // Agora, vamos criar os menus - a partir do nível mais interno ao mais externo // "pregando" os menus internos no item aberto do menu mais externo for ($i = 1; $i <= $level; $i++) { // loop menus $menu[$i] = $document->createListItem (); foreach ($app[$i]->parent->menuChildren ($document, $names[$i]) as $child) { // each child $local = array ('ref' => $document->ref ($child->pathway)); if ($child->access) $local['virtual'] = 1; if ($child->name == $names[$i]) { // opened child $local['opened'] = 1; if ($i == 1) $local['active'] = 1; $menu[$i]->appendChild ($child, $local) ->childrenMerge ($menu[$i - 1]); } // opened child else $menu[$i]->appendChild ($child, $local); } // each child } // loop menus // Porfim, vamos adicionar os menus como filhos do módulo $mod->childrenMerge ($menu[$level]); $mod->enabled = true; } // function setModule } // class eclMod_tool_sections //!eof:library/tool/eclMod_tool_sections.php; //!file:library/user/admin/eclApp_user_admin.php; class eclApp_user_admin { // class eclApp_user_admin static function is_child ($me, $name) { // function is_child global $store; if ($name != ADMIN_IDENTIFIER) return false; if ($store->user->getId ($name)) return false; return true; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $io, $store; $me->name = ADMIN_IDENTIFIER; $me->map = array ('user_admin_index', 'userAlert'); $me->data = &$io->session->cache; $me->data['text']['caption'] = array ('en' => array (1 => ADMIN_CAPTION)); $me->data['text']['title'] = array ('en' => array (1 => ADMIN_CAPTION)); $me->data['name'] = ADMIN_IDENTIFIER; $me->data['local']['mail'] = ADMIN_MAIL; $me->data['local']['gender'] = ADMIN_GENDER; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->application = $document->application->child ('-index'); $document->application->dispatch ($document); } // function dispatch } // class eclApp_user_admin //!eof:library/user/admin/eclApp_user_admin.php; //!file:library/user/admin/eclApp_user_admin_index.php; class eclApp_user_admin_index { // class eclApp_user_admin_index static function is_child ($me, $name) { // function is_child if ($name == '' or $name == '-index') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('user_admin_content'); array_pop ($me->pathway); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_user_admin_index //!eof:library/user/admin/eclApp_user_admin_index.php; //!file:library/user/anonimous/eclApp_user_anonimous.php; class eclApp_user_anonimous { // class eclApp_user_anonimous static function is_child ($me, $name) { // function is_child if ($name == '-anonimous') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-anonimous'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('user_anonimous_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_user_anonimous //!eof:library/user/anonimous/eclApp_user_anonimous.php; //!file:library/user/default/eclApp_user_default.php; class eclApp_user_default { // class eclApp_user_default static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('user_default_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_user_default //!eof:library/user/default/eclApp_user_default.php; //!file:library/user/eclApp_user.php; class eclApp_user { // class eclApp_user static function is_child ($me, $name) { // function is_child if ($name == SYSTEM_PROFILES_URI) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (SYSTEM_PROFILES_URI); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('user_content'); $me->getMap (); $me->isDomain = true; } // function constructor_helper } // class eclApp_user //!eof:library/user/eclApp_user.php; //!file:library/user/eclGroup_user.php; class eclGroup_user { // class eclGroup_user private $userId; public function __construct ($userId) { // function __construct $this->userId = $userId; } // function __construct public function check ($document) { // function check if ($this->userId == $document->user->userId) return 4; if (defined ('ADMIN_IDENTIFIER') and $document->user->name == ADMIN_IDENTIFIER) return 1; elseif (!$document->user->userId) return 0; return 1; } // function check } // class eclGroup_user //!eof:library/user/eclGroup_user.php; //!file:library/user/index/eclApp_user_index.php; class eclApp_user_index { // class eclApp_user_index static function is_child ($me, $name) { // function is_child if ($name == '') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('user_index_content'); unset ($me->pathway[1]); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_user_index_list ($document); } // function dispatch } // class eclApp_user_index //!eof:library/user/index/eclApp_user_index.php; //!file:library/user/index/eclMod_user_index_list.php; class eclMod_user_index_list { // class eclMod_user_index_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $names = $store->user->childrenNames (); $userId; $name; $data; $pathway; foreach ($names as $name) { // each name $userId = $store->user->getId ($name); $data = $store->userContent->open ($userId, '-register'); if (!$data) $data = $store->userContent->open ($userId, '-index'); $pathway = array (SYSTEM_PROFILES_URI, $name); $mod->appendChild ($data) ->swapTitle() ->ref ($pathway); } // each name $mod->data = $store->control->read ('modList_module'); $mod->enabled = true; } // function setModule } // class eclMod_user_index_list //!eof:library/user/index/eclMod_user_index_list.php; //!file:library/userAlert/eclApp_userAlert.php; class eclApp_userAlert { // class eclApp_userAlert static function is_child ($me, $name) { // function is_child if ($name == '-login-alerts') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store, $system; $me = $document->user; if (isset ($me->data['flags']['gender']) and $document->user->data['flags']['gender'] == 'female') $gender = 'F'; else $gender = 'M'; $document->mod->humperstilshen->audioOnAlert = 'modLogin_logged' . $gender; if (isset ($document->actions['loginform'][1])) { // login form $name = $document->actions['loginform'][1]; switch ($name) { // switch formulary case 'update': $formulary = $document->createFormulary ('userAlert_updateForm', $document->user->data, 'profileUpdate'); if (!$formulary->command ('save')) return; if ($formulary->save ()) { // save $document->user->data = $formulary->data; $user = &$store->user->open ($document->user->name); $user['status'] -= STATUS_UPDATE; $document->mod->humperstilshen->alert ('userAlert_updateDone'); return; } // save $document->mod->humperstilshen->alert ('userAlert_updateError', $formulary); return; } // switch formulary } // login form else { // login welcome if ($me->name == ADMIN_IDENTIFIER) $status = STATUS_ADMIN; else $status = $store->user->getStatus ($me->name); if ($status == STATUS_REMOVED and !$document->access (4, $system->groups)) { // disabled if (isset ($document->user->data['flags']['gender']) and $document->user->data['flags']['gender'] == 'female') $gender = 'F'; else $gender = 'M'; $document->session = array ('session_time' => TIME); $document->mod->humperstilshen->alert ('userAlert_disabled' . $gender); } // disabled elseif ($status&STATUS_UPDATE) { // please update $formulary = $document->createFormulary ('userAlert_updateForm', $document->user->data, 'profileUpdate'); $document->mod->humperstilshen->alert ('userAlert_update', $formulary); } // please update else { // welcome if ($document->pathway[0] == SYSTEM_PROFILES_URI) $document->mod->humperstilshen->alert ('userAlert_welcomeToProfile'); else $document->mod->humperstilshen->alert ('userAlert_welcome'); $document->mod->useralerts = new eclMod_userAlert_list ($document); } // welcome } // login welcome } // function dispatch } // class eclApp_userAlert //!eof:library/userAlert/eclApp_userAlert.php; //!file:library/userAlert/eclApp_userAlert_message.php; class eclApp_userAlert_message { // class eclApp_userAlert_message static function is_child ($me, $name) { // function is_child if ($name == 'messages') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); return array ('messages'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userAlert_alertNewMessage'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userAlert_message //!eof:library/userAlert/eclApp_userAlert_message.php; //!file:library/userAlert/eclApp_userAlert_status.php; class eclApp_userAlert_status { // class eclApp_userAlert_status static function is_child ($me, $name) { // function is_child if ($name == 'status') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('status'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userAlert_alertStatus'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->humperstilshen->alert ('userAlert_alertSurvey'); } // function dispatch } // class eclApp_userAlert_status //!eof:library/userAlert/eclApp_userAlert_status.php; //!file:library/userAlert/eclFilter_userAlert_formulary.php; class eclFilter_userAlert_formulary { // class eclFilter_userAlert_formulary static function create ($fieldName, $control, $formulary) { // function create $f = $formulary->document->createFormulary ($fieldName); $f->data = $document->user->data; $f->flags = $formulary->flags; foreach ($f->create () as $child) { // $formulary->appendChild ($child); } } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_userAlert_formulary //!eof:library/userAlert/eclFilter_userAlert_formulary.php; //!file:library/userAlert/eclMod_userAlert_list.php; class eclMod_userAlert_list { // class eclMod_userAlert_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; $me = $document->user->child ('-login-alerts'); $mod->data = $store->control->read ('userAlert_module'); if ($document->subscription->id) { // tasks $where = array ( 'domain_id' => $document->domain->domainId, 'mode' => MODE_NOTIFICATION, 'marker' => '< 204', 'owner_id' => $document->subscription->id ); $notification = $store->domainContent->search ($where); foreach ($notification as $data) { // each task $child = $document->application->findChild ($data['name']); if ($child === false) continue; if (!$child->data['marker']) $child->data['marker'] = 1; elseif ($child->data['marker'] > 200) continue; $mod->appendChild ($child) ->swapTitle () ->ref ($child->pathway); } // each task } // tasks foreach ($me->children () as $child) { // each child $mod->appendChild ($child) ->swapTitle () ->ref ($child->pathway) ->virtual ($child->access); } // each child $status = $store->user->getStatus ($document->user->name); if ($status&STATUS_SURVEY) { // survey $mod->appendChild ('userAlert_alertSurvey') ->virtual () ->ref (true, true, '_alert-user-status'); } // survey if ($document->access (4, $system->groups)) { // system administration $children = $system->child (SYSTEM_ADMIN_URI)->child ('alerts')->children (); foreach ($children as $child) { // each child $mod->appendChild ($child) ->swapTitle () ->ref ($child->pathway) ->virtual ($child->access); } // each child } // system administration if ($mod->children) $mod->enabled = true; } // function setModule } // class eclMod_userAlert_list //!eof:library/userAlert/eclMod_userAlert_list.php; //!file:library/userHome/default/eclApp_userHome_default.php; class eclApp_userHome_default { // class eclApp_userHome_default static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_default_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userHome_default //!eof:library/userHome/default/eclApp_userHome_default.php; //!file:library/userHome/eclApp_userHome.php; class eclApp_userHome { // class eclApp_userHome static function is_child ($me, $name) { // function is_child global $store; if (!strlen ($name) or $name[0] == '-') return false; if ($store->user->getId ($name)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->userId = $store->user->getId ($me->name); $me->getMap (); $me->groups = array ( new eclGroup_user ($me->userId)); $me->data = &$store->userContent->open ($me->userId, '-register'); if (isset ($me->data['id'])) $me->id = $me->data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->application = $document->application->child ('-index'); $document->pathway = $document->application->pathway; $document->application->dispatch ($document); } // function dispatch } // class eclApp_userHome //!eof:library/userHome/eclApp_userHome.php; //!file:library/userHome/index/eclApp_userHome_index.php; class eclApp_userHome_index { // class eclApp_userHome_index static function is_child ($me, $name) { // function is_child if ($name == '-index') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-index'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_index_content'); $me->data['text']['profile'] = $me->parent->data['text']['caption']; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_userHome_index_recents ($document); } // function dispatch } // class eclApp_userHome_index //!eof:library/userHome/index/eclApp_userHome_index.php; //!file:library/userHome/index/eclMod_userHome_index_recents.php; class eclMod_userHome_index_recents { // class eclMod_userHome_index_recents public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('userHome_index_recents'); $row = $mod->appendChild(); $where = array ( 'mode' => MODE_POST, 'owner_id' => $me->userId ); $recents = $store->domainContent->search ($where); foreach ($recents as $data) { // each recent post $pathway = $store->domainContent->pathway ($data['domain_id'], $data['name']); $row->appendChild ($data) ->ref ($pathway); } // each recent post $mod->enabled = true; } // function setModule } // class eclMod_userHome_index_recents //!eof:library/userHome/index/eclMod_userHome_index_recents.php; //!file:library/userHome/password/eclApp_userHome_password.php; class eclApp_userHome_password { // class eclApp_userHome_password static function is_child ($me, $name) { // function is_child if ($name == '-password') return true; if ($name == '-recover-password') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-password'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_password_content'); $me->isDomain = true; if ($me->name == '-recover-password') $me->access = 0; else $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if ($me->name == '-recover-password') { // test token $document->user = $me->parent; if (!isset ($document->actions['token'][1])) return $document->dataMerge ('userHome_password_msgInvalidToken'); if (!isset ($me->parent->data['flags']['userRecoverPassword_token'])) return $document->dataMerge ('userHome_password_msgInvalidToken'); if ($document->actions['token'][1] != $me->parent->data['flags']['userRecoverPassword_token']) return $document->dataMerge ('userHome_password_msgInvalidToken'); $formulary = $document->createFormulary ('userHome_password_editRecoverPassword', $me->parent->data, 'change'); $formulary->action = '_token-' . $document->actions['token'][1]; } // test token else $formulary = $document->createFormulary ('userHome_password_edit', $me->parent->data, 'change'); if ($formulary->command ('cancel')) { // close pop up $document->dataReplace ('dialog_cancel'); } // close pop up if ($formulary->command ('save') and $formulary->save()) { // change password $user = &$store->user->open ($document->user->name); $user['password'] = $formulary->data['password']; if ($me->name == '-recover-password') { // close dialog $document->dataReplace ('userHome_password_msgPasswordRecovered'); unset ($me->parent->data['flags']['userRecoverPassword_token']); return; } // close dialog $document->mod->humperstilshen->alert ('userHome_password_alertPasswordChanged'); } // change password if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_userHome_password //!eof:library/userHome/password/eclApp_userHome_password.php; //!file:library/userHome/personal/eclApp_userHome_personal.php; class eclApp_userHome_personal { // class eclApp_userHome_personal static function is_child ($me, $name) { // function is_child if ($name == '-personal') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-personal'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_personal_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application->parent; $formulary = $document->createFormulary ('userHome_personal_edit', $me->data, 'personal'); if ($formulary->command ('cancel')) { // close pop up $document->dataReplace ('dialog_cancel'); } // close pop up if ($formulary->command ('save') and $formulary->save()) { // save $me->data = $formulary->data; $document->mod->humperstilshen->alert ('userHome_personal_alertDataUpdated'); } // save if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_userHome_personal //!eof:library/userHome/personal/eclApp_userHome_personal.php; //!file:library/userJoin/eclApp_userJoin.php; class eclApp_userJoin { // class eclApp_userJoin static function is_child ($me, $name) { // function is_child if ($name == '-join') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-join'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userJoin_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $session = &$document->session; if (!isset ($session['page'])) $document->session['page'] = 0; do { // process pages $process = 'page' . $document->session['page']; } // process pages while (self::$process ($document) != 'stop'); } // function dispatch static function page0 ($document) { // function page0 global $store; if ($domainId = $store->domain->getId (SYSTEM_DEFAULT_DOMAIN_NAME) and $id = $store->domainContent->findMarker ($domainId, 10)) { // service terms found $formulary = $document->createFormulary ('userJoin_page0', $document->session, 'page0'); if ($formulary->command ('next') and $formulary->save () and isset ($formulary->data['agree'])) { // go page 1 $document->session = $formulary->data; $document->session['page'] = 1; return 'go next'; } // go page 1 $document->dataReplace ('userJoin_page0'); $document->mod->formulary = $formulary; return 'stop'; } // service terms found $document->session['page'] = 1; return 'go next'; } // function page0 static function page1 ($document) { // function page1 global $store, $system; if (isset ($document->session['agree'])) $formulary = $document->createFormulary ('userJoin_page1previous', $document->session, 'page1'); else $formulary = $document->createFormulary ('userJoin_page1', $document->session, 'page1'); if ($formulary->command ('previous')) { // previous $formulary->save (); $document->session = $formulary->data; $document->session['page'] = 0; return 'go next'; } // previous if ($formulary->command ('next') and $formulary->save ()) { // next $user['name'] = $formulary->data['name']; $user['password'] = $formulary->data['password']; $user['status'] = 1; $userId = $store->user->insert ($user); $data = $formulary->data; $data['mode'] = MODE_DOMAIN; $data['name'] = '-register'; $store->userContent->insert ($userId, $data); // login $document->session['user_id'] = $userId; $document->session['user_name'] = $user['name']; $document->session['time'] = TIME; $document->user = $system->child (SYSTEM_PROFILES_URI)->child ($document->session['user_name']); $document->mod->humperstilshen->alert ('userJoin_alertWelcome'); $document->session['page'] = 2; return 'go next'; } // next $document->dataReplace ('userJoin_page1'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return 'stop'; } // function page1 static function page2 ($document) { // function page2 $formulary = $document->createFormulary ('userJoin_page2', $document->user->data, 'page2'); if ($formulary->command ('cancel')) { // close $document->user->data = $formulary->data; $document->dataReplace ('dialog_close'); return 'stop'; } // close $document->dataReplace ('userJoin_page2'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return 'stop'; } // function page2 } // class eclApp_userJoin //!eof:library/userJoin/eclApp_userJoin.php; //!file:library/userJoin/eclFilter_userJoin_termsView.php; class eclFilter_userJoin_termsView { // class eclFilter_userJoin_termsView static function create ($fieldName, $control, $formulary) { // function create global $store; $control['type'] = 'content_box'; if ($domainId = $store->domain->getId (SYSTEM_DEFAULT_DOMAIN_NAME) and $id = $store->domainContent->findMarker ($domainId, 10)) { // terms found $data = $store->domainContent->openById ($domainId, $id); $formulary->appendChild ($control, $data); } // terms found } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_userJoin_termsView //!eof:library/userJoin/eclFilter_userJoin_termsView.php; //!file:library/userRecoverPassword/eclApp_userRecoverPassword.php; class eclApp_userRecoverPassword { // class eclApp_userRecoverPassword static function is_child ($me, $name) { // function is_child if ($name == '-recover-password') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-recover-password'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userRecoverPassword_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $system; $formulary = $document->createFormulary ('userRecoverPassword_edit'); if ($formulary->save()) { // save formulary $token = md5 (mt_rand () . TIME); $user = $system->child (SYSTEM_PROFILES_URI)->child ($formulary->data['identifier']); $user->data['flags']['userRecoverPassword_token'] = $token; $template = clone $document; $template->user = $user; $template->charset = 'UTF-8'; $template->dataReplace ('userRecoverPassword_messageTemplate'); $template->data['ref'] = $document->ref (array (SYSTEM_PROFILES_URI, $template->user->name, '-recover-password'), true, '_token-' . $token); $template->render(); $subject = $template->selectLanguage ($template->textMerge ($template->data['text']['title'], ' ', $user->data['text']['caption'])); $mail = $document->createMail () ->subject ($subject[1]) ->to ($formulary->data['local']['mail']) ->contentHTML ($template->buffer); $errorMsg = $mail->send (); if ($errorMsg) { // mail error $document->mod->humperstilshen->alert ($errorMsg); return; } // mail error $document->dataMerge ('userRecoverPassword_msgMailSent'); $document->data['mail_from'] = SMTP_FROM; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_userRecoverPassword //!eof:library/userRecoverPassword/eclApp_userRecoverPassword.php; //!file:library/userRecoverPassword/eclFilter_userRecoverPassword_identifier.php; class eclFilter_userRecoverPassword_identifier { // class eclFilter_userRecoverPassword_identifier static function create ($fieldName, $control, $formulary) { // function create // name $control['name'] = $fieldName; // type if (isset ($control['flags']['control_type'])) $control['type'] = $control['flags']['control_type']; else $control['type'] = 'text'; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->received[$fieldName]) or !preg_match ('/^[a-z0-9_-]+$/', $formulary->received[$fieldName])) return $formulary->setRequiredMsg ($control, $fieldName, 'userRecoverPassword_editAdminNotFound'); $userId = $store->user->getId ($formulary->received[$fieldName]); // required if (!$userId) return $formulary->setRequiredMsg ($control, $fieldName, 'userRecoverPassword_editAdminNotFound'); $data = $store->userContent->open ($userId, '-register'); if (!$data or !isset ($data['local']['mail'])) return $formulary->setRequiredMsg ($control, $fieldName, 'userRecoverPassword_editAdminMailNotFound'); $formulary->data = $data; $formulary->data['identifier'] = $formulary->received[$fieldName]; } // function save } // class eclFilter_userRecoverPassword_identifier //!eof:library/userRecoverPassword/eclFilter_userRecoverPassword_identifier.php; //!packager:end_of_files // Input and output drivers $io = new eclEngine_io (); // Data managers $store = new eclEngine_store(); // Applications tre $system = new eclEngine_application (); // The document $document = new eclEngine_document (); $document->route($io->request); if (!$document->application->ignoreSession ()) $document->sessionStart ($io->session); $document->dispatch(); $document->render(); $store->close(); $io->close(); if (isset ($io->request->actions['html'])) { // output page source print nl2br (str_replace (array ('&', '<', '"'), array ('&', '<', '"'), $document->buffer)); if (!$io->log->silent) print nl2br (str_replace (array ('&', '<', '"'), array ('&', '<', '"'), $io->buffer)); } // output page source else { // normal output print $document->buffer; if (!$io->log->silent) print $io->buffer; } // normal output header ('Connection: Keep-Alive'); header("Cache-Control: no-cache, must-revalidate"); header ('Content-Type: text/html; charset=' . strtolower ($document->charset)); header ('Keep-Alive: timeout=60, max=1000'); header ('Content-length: ' . strval (ob_get_length ())); ob_end_flush(); __HALT_COMPILER();a:2:{s:5:"flags";a:3:{s:14:"modLayout_base";s:10:"responsive";s:14:"modLayout_from";s:6:"shared";s:14:"modLayout_name";s:7:"default";}s:4:"text";a:3:{s:7:"caption";a:2:{s:2:"pt";a:3:{i:1;s:39:"Administração do [text $system.caption]";i:2;i:1;i:6;i:1;}s:2:"en";a:3:{i:1;s:37:"[text $system.caption] Administration";i:2;i:1;i:6;i:1;}}s:5:"title";a:2:{s:2:"pt";a:3:{i:1;s:39:"Administração do [text $system.caption]";i:2;i:1;i:6;i:1;}s:2:"en";a:3:{i:1;s:37:"[text $system.caption] Administration";i:2;i:1;i:6;i:1;}}s:11:"description";a:1:{s:2:"pt";a:3:{i:1;s:81:"Oferece um conjunto de ferramentas para a administração do [text $system.caption]";i:2;i:1;i:6;i:1;}}}}a:1:{s:4:"text";a:3:{s:7:"caption";a:2:{s:2:"en";a:2:{i:1;s:14:"Page not found";i:2;i:1;}s:2:"pt";a:2:{i:1;s:21:"Página não encontrada";i:2;i:1;}}s:5:"title";a:2:{s:2:"en";a:2:{i:1;s:14:"Page not found";i:2;i:1;}s:2:"pt";a:2:{i:1;s:21:"Página não encontrada";i:2;i:1;}}s:7:"content";a:2:{s:2:"en";a:5:{i:1;s:72:"The address you provided does not match a valid address in this server. ";i:2;i:1;i:4;i:1;i:5;i:2;i:6;i:1;}s:2:"pt";a:5:{i:1;s:66:"O endereço que você forneceu não corresponde a um endereço válido.";i:2;i:1;i:4;i:1;i:5;i:2;i:6;i:1;}}}}a:1:{s:4:"text";a:3:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:6:"Início";i:2;i:1;}s:2:"en";a:2:{i:1;s:4:"Home";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:3:{i:1;s:39:"Administração do [text $system.caption]";i:2;i:1;i:6;i:1;}s:2:"en";a:3:{i:1;s:37:"[text $system.caption] Administration";i:2;i:1;i:6;i:1;}}s:7:"content";a:2:{s:2:"pt";a:4:{i:1;s:355:"#r#n[if $document.user_is_admin{]#r#nOlá [text $user.caption],#r#n#r#nBem-vind[gender:o|a] como administrador[gender:|a].#r#n#r#n[}elseif $document.user_is_connected{]#r#n#r#nPrezad[gender:o|a] [text $user.caption],#r#n#r#nSua credencial não lhe dá direito de acesso à estas ferramentas.#r#n#r#n[}else{]#r#n#r#nSe você é um administrador, conecte-se para obter acesso.#r#n#r#n[} // if]#r#n";i:2;i:1;i:4;i:1;i:6;i:1;}s:2:"en";a:5:{i:1;s:309:"[if $document.user_is_admin{]#r#nHello [text $user.caption],#r#n#r#nWelcome as administrator.#r#n#r#n[}elseif $document.user_is_connected{]#r#n#r#nDear [text $user.caption],#r#n#r#nYour profile does not give you right of access to these tools.#r#n#r#n[}else{]#r#n#r#nIf you are an administrator, connect to guive access.#r#n#r#n[} // if]#r#n";i:2;i:1;i:4;i:1;i:5;i:2;i:6;i:1;}}}}a:1:{s:4:"text";a:3:{s:7:"caption";a:1:{s:2:"pt";a:3:{i:1;s:39:"Administração do [text $system.caption]";i:2;i:1;i:6;i:1;}}s:5:"title";a:1:{s:2:"pt";a:3:{i:1;s:39:"Sobre a página inicial da administração";i:2;i:1;i:6;i:1;}}s:7:"content";a:1:{s:2:"pt";a:5:{i:1;s:401:"#r#nEste é o ambiente administrativo do [text$system.caption].#r#n#r#nAqui encontram-se reunidas diversas ferramentas que englobam todos os ambientes criados neste sistema.#r#n#r#nPara obter informações sobre as ferramentas deste administrador, procure ajuda no menu de contexto em cada página.#r#n#r#nAjuda mais específica também pode ser obtida acionando os ícones presentes ao lado dos campos dos formulários.#r#n";i:2;i:1;i:4;i:1;i:5;i:2;i:6;i:1;}}}}a:1:{s:4:"text";a:3:{s:7:"caption";a:1:{s:2:"pt";a:3:{i:1;s:6:"Avisos";i:2;i:1;i:6;i:1;}}s:5:"title";a:1:{s:2:"pt";a:3:{i:1;s:24:"Sobre o quadro de avisos";i:2;i:1;i:6;i:1;}}s:7:"content";a:1:{s:2:"pt";a:5:{i:1;s:253:"#r#nNesta página são reunidos todos os avisos gerados por diferentes ferramentas.#r#n#r#nAcionando um item da lista você será direcionad[gender:o|a] para a ferramenta que produziu a mensagem.#r#n#r#nProblemas solucionados são removidos automaticamente da lista.#r#n";i:2;i:1;i:4;i:1;i:5;i:2;i:6;i:1;}}}}a:1:{s:4:"text";a:2:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:43:"Mensagens de erros no log do banco de dados";i:2;i:1;}s:2:"en";a:2:{i:1;s:31:"Messages in database errors log";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:2:{i:1;s:46:"Há mensagens no log de erros do banco de dados";i:2;i:1;}s:2:"en";a:2:{i:1;s:31:"Messages in database errors log";i:2;i:1;}}}}a:1:{s:4:"text";a:2:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:32:"O banco de dados está desativado";i:2;i:1;}s:2:"en";a:2:{i:1;s:24:"The database is disabled";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:2:{i:1;s:32:"O banco de dados está desativado";i:2;i:1;}s:2:"en";a:2:{i:1;s:24:"The database is disabled";i:2;i:1;}}}}a:1:{s:4:"text";a:2:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:24:"Erros de execução do PHP";i:2;i:1;}s:2:"en";a:2:{i:1;s:19:"PHP execution error";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:2:{i:1;s:35:"Há mensagens no log de erros do PHP";i:2;i:1;}s:2:"en";a:2:{i:1;s:26:"Messages in PHP errors log";i:2;i:1;}}}}a:1:{s:4:"text";a:2:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:6:"Avisos";i:2;i:1;}s:2:"en";a:2:{i:1;s:6:"Alerts";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:2:{i:1;s:17:"Avisos do sistema";i:2;i:1;}s:2:"en";a:2:{i:1;s:13:"System alerts";i:2;i:1;}}}}a:1:{s:4:"text";a:1:{s:7:"content";a:2:{s:2:"pt";a:3:{i:1;s:14:"Não há avisos.";i:2;i:1;i:4;i:1;}s:2:"en";a:3:{i:1;s:18:"There#ss no alerts.";i:2;i:1;i:4;i:1;}}}}a:1:{s:4:"text";a:1:{s:5:"title";a:2:{s:2:"pt";a:3:{i:1;s:41:"Usuários aguardando avaliação ([$number])";i:2;i:1;i:6;i:1;}s:2:"en";a:3:{i:1;s:32:"Users waiting survey ([$number])";i:2;i:1;i:6;i:1;}}}}a:1:{s:4:"text";a:2:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:14:"Banco de dados";i:2;i:1;}s:2:"en";a:2:{i:1;s:8:"Database";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:2:{i:1;s:14:"Banco de dados";i:2;i:1;}s:2:"en";a:2:{i:1;s:8:"Database";i:2;i:1;}}}}a:1:{s:8:"children";a:5:{i:0;s:6:"_start";i:1;s:8:"~editMsg";i:2;s:28:"systemConstants_pathDatabase";i:3;s:11:"~editSubmit";i:4;s:4:"_end";}}a:2:{s:5:"flags";a:1:{s:14:"control_filter";s:7:"content";}s:4:"text";a:1:{s:7:"content";a:2:{s:2:"pt";a:3:{i:1;s:182:"#r#nAntes de configurar o banco de dados, é necessário criar uma pasta para acomodar arquivos relacionados ao banco de dados.#r#n#r#nPara criar esta pasta agora, clique em "Criar pasta".#r#n";i:2;i:1;i:4;i:1;}s:2:"en";a:2:{i:1;s:159:"#r#nBefore adding users, it#ss necessary to create a folder to accommodate the personal files of each user.#r#n#r#nTo create this folder now, click "Create folder".#r#n";i:4;i:1;}}}}a:2:{s:5:"flags";a:2:{s:14:"control_filter";s:6:"submit";s:18:"control_field_name";s:6:"create";}s:4:"text";a:1:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:11:"Criar pasta";i:2;i:1;}s:2:"en";a:1:{i:1;s:13:"Create folder";}}}}a:1:{s:4:"text";a:2:{s:7:"caption";a:2:{s:2:"pt";a:2:{i:1;s:27:"Configurar o Banco de dados";i:2;i:1;}s:2:"en";a:2:{i:1;s:22:"Database configuration";i:2;i:1;}}s:5:"title";a:2:{s:2:"pt";a:2:{i:1;s:27:"Configurar o banco de dados";i:2;i:1;}s:2:"en";a:2:{i:1;s:22:"Database configuration";i:2;i:1;}}}}a:1:{s:8:"children";a:1