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 (isset ($aliases[$component]) and isset ($components[$aliases[$component]])) { // include from component $path = PATH_COMPONENTS . $aliases[$component] . '/' . $components[$aliases[$component]] . '/' . $component . '/' . $class_name . '.php'; if (is_file ($path)) { // file found include $path; return; } // file found if (count ($parts) > 2) { // try subdirectory $path = PATH_COMPONENTS . $aliases[$component] . '/' . $components[$aliases[$component]] . '/' . $component . '/' . $parts[2] . '/' . $class_name . '.php'; if (is_file ($path)) { // file found include $path; return; } // file found } // try subdirectory } // include from component if (is_file (PATH_ENGINE . $prefix . '/' . $class_name . '.php')) include PATH_ENGINE . $prefix . '/' . $class_name . '.php'; elseif (count ($parts) >= 3 and is_file (PATH_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php')) include PATH_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php'; elseif (is_file (PATH_LIBRARY . $component . '/' . $class_name . '.php')) include PATH_LIBRARY . $component . '/' . $class_name . '.php'; elseif (count ($parts) == 4 and is_file (PATH_LIBRARY . $parts[1] . '/' . $parts[2] . '/' . $class_name . '.php')) include PATH_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))); } /* 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); define('SYSTEM_PACKED_DATE', 'Thu, 04 Jul 2019 05:19:55 -0300'); //!end_of_packager_settings //!packager:start_of_map $mapPrepend = array ( 'admin' => array ('adminIndex', 'adminAlerts', 'adminUsers', 'adminDomains', 'adminSystem', 'adminDatabase', 'adminIntegrations', 'adminComponents', 'adminTools'), 'adminAlerts' => array ('adminAlerts_log', 'adminAlerts_update'), 'adminIntegrations' => array ('integrationSMTP', 'integrationSMS'), 'domain' => array ('domainIndex', 'section', 'section_create', 'domainFiles', 'domainGlossary', 'domainIcons', 'domainInfo', 'domainRecents', 'domainScripts', 'domainSearch', 'domainStyles', 'domainSubscription'), 'financialAccount_create' => array ('financialAccountCash_create', 'financialAccountBank_create'), 'home_create' => array ('homeCurriculum_create', 'homePublications_create', 'homeChat_create'), 'integration' => array ('integrationSMTP', 'integrationSMS', 'integrationRSS', 'integrationGoogleWebmasters'), 'personalite' => array ('personaliteApearance', 'personaliteDetails', 'personaliteExtras', 'personaliteInstall', 'personaliteModules', 'personaliteObjects', 'personaliteTemplate', 'personaliteExport'), 'section_create' => array ('sectionFolder_create', 'sectionCart_create', 'sectionBlog_create', 'sectionCategories_create', 'sectionSearch_create', 'sectionFormulary_create'), 'system' => array ('systemShared', 'user', 'systemInstallation', 'admin', 'domain', 'domainCreate', 'systemAccessDenied', 'systemPreload'), 'systemPreload' => array ('sectionCart_preload', 'modEditor'), 'tool' => array ('toolConfig', 'toolMediaGalery', 'integration', 'financial'), 'user' => array ('userIndex', 'userAnonimous', 'userHome', 'userAdmin', 'userJoin', 'userRecoverPassword'), 'userHome' => array ('userHome_index', 'home', 'home_create', 'userHome_alerts', 'userHome_password', 'userHome_personal', 'userHome_mail', 'userHome_phone', 'userHome_welcome'), ); $mapAppend = array ( 'admin' => array ('domainIcons', 'domainScripts', 'domainServices', 'domainStyles', 'adminDefault'), 'domain' => array ('endpoints', 'personalite', 'tool', 'userJoin', 'domainSitemap', 'domainDefault'), 'section_create' => array ('sectionGlossary_create', 'sectionInfo_create', 'sectionLogin_create', 'sectionSubdomains_create', 'sectionTerms_create', 'sectionPrivacyPolicy_create', 'sectionMenu_create', 'sectionRedirect_create'), 'system' => array ('systemDefault'), 'user' => array ('domainIcons', 'domainScripts', 'domainStyles', 'userDefault'), 'userHome' => array ('userHome_alerts_phone', 'userHome_alerts_mail', 'userHome_default'), ); //!packager:end_of_map //!packager:start_of_data_index $dataMap = array ( 'c' => array ( 'admin' => array ( 'content' => '0:666', ), 'admin_constants' => array ( 'adminCaption' => '666:510', 'adminGender' => '1176:728', 'adminGenderFemale' => '1904:164', 'adminGenderMale' => '2068:164', 'adminHelpers' => '2232:876', 'adminIdentifier' => '3108:772', 'adminMail' => '3880:940', 'adminPassword' => '4820:849', 'adminPassword2' => '5669:133', 'chrFns' => '5802:612', 'databaseClient' => '6414:831', 'databaseClientMysql' => '7245:163', 'databaseClientSqlite' => '7408:166', 'databaseDb' => '7574:314', 'databaseDisplayErrors' => '7888:934', 'databaseEnabled' => '8822:969', 'databaseEnabledDisabled' => '9791:415', 'databaseEnabledFailed' => '10206:370', 'databaseEnabledSuccess' => '10576:303', 'databaseHost' => '10879:303', 'databaseLogErrors' => '11182:619', 'databasePassword' => '11801:316', 'databasePrefix' => '12117:927', 'databaseUser' => '13044:306', 'filterFlagError' => '13350:439', 'filterFolderError' => '13789:393', 'filterFolderExists' => '14182:416', 'pathComponents' => '14598:740', 'pathDatabase' => '15338:822', 'pathDomains' => '16160:695', 'pathEngine' => '16855:734', 'pathLibrary' => '17589:783', 'pathProfiles' => '18372:744', 'pathShared' => '19116:886', 'pathTemplates' => '20002:1013', 'systemAdminUri' => '21015:1320', 'systemDefaultCharset' => '22335:1162', 'systemDefaultCharsetIso88591' => '23497:216', 'systemDefaultCharsetUtf8' => '23713:133', 'systemDefaultCurrency' => '23846:690', 'systemDefaultDomainName' => '24536:1027', 'systemDefaultLanguage' => '25563:701', 'systemDisplayErrors' => '26264:919', 'systemEnableUserDomains' => '27183:758', 'systemEnableUserSubscriptions' => '27941:780', 'systemHost' => '28721:660', 'systemHostingMode' => '29381:1871', 'systemHostingModePortal' => '31252:169', 'systemHostingModeSingle' => '31421:172', 'systemHostingModeSubfolders' => '31593:180', 'systemHttpsRedirect' => '31773:1218', 'systemLogErrors' => '32991:739', 'systemPackedMapFirst' => '33730:1264', 'systemPackedSharedFirst' => '34994:1186', 'systemProfilesUri' => '36180:1244', 'systemProjectCaption' => '37424:721', 'systemProjectRef' => '38145:749', 'systemRewriteEngine' => '38894:2248', 'systemSessionCacheExpire' => '41142:1012', 'systemSessionTTL' => '42154:738', 'systemTimeLimit' => '42892:853', 'systemTimezone' => '43745:13331', 'trackingEnable' => '57076:1522', 'trackingGeoipCache' => '58598:855', 'trackingGeoipCache1month' => '59453:157', 'trackingGeoipCache3months' => '59610:160', 'trackingGeoipCache6months' => '59770:160', 'trackingGeoipCacheNoExpire' => '59930:165', 'trackingGeoipEnable' => '60095:819', 'trackingGeoipService' => '60914:986', 'trackingRemovedPages' => '61900:673', 'trackingStoreFullBacktrace' => '62573:1045', ), 'adminAlerts' => array ( 'help' => '63618:521', 'main' => '64139:241', 'mainEmpty' => '64380:162', ), 'adminAlerts_log' => array ( 'database' => '64542:352', 'databasedisabled' => '64894:313', 'php' => '65207:305', ), 'adminAlerts_update' => array ( 'newReleaseAvailable' => '65512:287', ), 'adminComponents' => array ( 'content' => '65799:227', 'contentEmpty' => '66026:292', 'edit' => '66318:102', 'editComponentDisabled' => '66420:116', 'editComponents' => '66536:108', 'folder' => '66644:148', 'folderMsg' => '66792:520', 'folderSubmit' => '67312:204', 'helpAbout' => '67516:555', ), 'adminComponents_config' => array ( 'content' => '68071:262', 'contentEmpty' => '68333:292', 'helpAbout' => '68625:555', ), 'adminDatabase' => array ( 'content' => '69180:243', 'edit' => '69423:141', 'editMsg' => '69564:549', 'editSubmit' => '70113:204', ), 'adminDatabase_config' => array ( 'content' => '70317:299', 'edit' => '70616:392', 'editMessage' => '71008:314', ), 'adminDatabase_encrypt' => array ( 'content' => '71322:245', 'contentGenerate' => '71567:957', 'contentImport' => '72524:478', 'contentKey' => '73002:301', 'editMessage' => '73303:914', 'generate' => '74217:178', 'generateAlgorithm' => '74395:274', 'import' => '74669:84', 'key' => '74753:97', 'keyMethod' => '74850:360', 'keyMethodGenerate' => '75210:241', 'keyMethodImport' => '75451:250', ), 'adminDatabase_log' => array ( 'content' => '75701:269', 'edit' => '75970:242', 'editLogClear' => '76212:225', 'editLogView' => '76437:196', ), 'adminDatabase_query' => array ( 'content' => '76633:241', 'edit' => '76874:122', 'editInput' => '76996:219', 'editResult' => '77215:268', ), 'adminDefault' => array ( 'content' => '77483:547', ), 'adminDomains' => array ( 'content' => '78030:227', 'contentDisabled' => '78257:443', 'contentEmpty' => '78700:180', 'edit' => '78880:140', 'editMsg' => '79020:541', 'editSubmit' => '79561:204', ), 'adminDomains_add' => array ( 'content' => '79765:255', 'edit' => '80020:265', 'editAdmin' => '80285:339', 'editAdminRequired' => '80624:371', 'editDefaultLanguage' => '80995:281', 'editDescription' => '81276:209', 'editName' => '81485:268', 'editNameAlreadyExists' => '81753:385', 'editNameInvalidChars' => '82138:532', 'editNameSoLong' => '82670:415', 'editTitle' => '83085:284', ), 'adminDomains_details' => array ( 'alertAdminAlreadyExists' => '83369:397', 'alertAdminPleaseSelect' => '83766:419', 'alertAdminRemoveError' => '84185:327', 'alertAdminRemoveLast' => '84512:463', 'alertAdminRequired' => '84975:371', 'content' => '85346:267', 'contextRemove' => '85613:141', 'contextRemoveConfirm' => '85754:1044', 'contextRemoveConfirmError' => '86798:430', 'contextRemoveConfirmOk' => '87228:256', 'edit' => '87484:507', 'editAdminAddName' => '87991:297', 'editAdminAddSubmit' => '88288:147', 'editAdminRemoveList' => '88435:319', 'editAdminRemoveSubmit' => '88754:154', 'editCaption' => '88908:284', 'editCurrency' => '89192:258', 'editDefaultLanguage' => '89450:281', 'editDescription' => '89731:209', 'editName' => '89940:233', 'editStatus' => '90173:379', 'editStatusAlert' => '90552:160', 'editStatusDefault' => '90712:160', 'editStatusDisabled' => '90872:165', 'editStatusReserved' => '91037:178', 'editStatusWaiting' => '91215:188', 'editTitle' => '91403:284', 'editUpdate' => '91687:145', ), 'adminIndex' => array ( 'content' => '91832:1163', 'helpAbout' => '92995:722', ), 'adminIntegrations' => array ( 'content' => '93717:213', 'contentEmpty' => '93930:284', 'helpAbout' => '94214:547', ), 'adminSystem' => array ( 'content' => '94761:223', ), 'adminSystem_admin' => array ( 'content' => '94984:253', 'edit' => '95237:360', ), 'adminSystem_eval' => array ( 'content' => '95597:271', 'edit' => '95868:103', 'editEvalInput' => '95971:190', ), 'adminSystem_extract' => array ( 'content' => '96161:970', 'edit' => '97131:613', 'editBackupFilename' => '97744:389', 'editCreateBackup' => '98133:308', 'editDataExtension' => '98441:437', 'editDataExtensionEcl' => '98878:197', 'editDataExtensionJson' => '99075:154', 'editIndentStart' => '99229:420', 'editIndentStart1' => '99649:161', 'editIndentStart2' => '99810:161', 'editIndentStart3' => '99971:187', 'editIndentString' => '100158:415', 'editIndentString2spaces' => '100573:162', 'editIndentString4spaces' => '100735:169', 'editIndentStringTab' => '100904:147', 'editNlMode' => '101051:350', 'editNlModeLinux' => '101401:127', 'editNlModeWindows' => '101528:133', 'editScriptAccessibility' => '101661:329', 'editSubmit' => '101990:214', ), 'adminSystem_hosting' => array ( 'content' => '102204:233', 'edit' => '102437:501', ), 'adminSystem_log' => array ( 'content' => '102938:250', 'edit' => '103188:281', 'editLogClear' => '103469:225', 'editLogView' => '103694:186', ), 'adminSystem_pack' => array ( 'alertFinished' => '103880:317', 'content' => '104197:634', 'edit' => '104831:172', 'editClearServer' => '105003:287', 'editExportFilename' => '105290:371', 'editPackMediaFiles' => '105661:323', 'editSubmit' => '105984:206', ), 'adminSystem_server' => array ( 'content' => '106190:225', 'edit' => '106415:205', ), 'adminSystem_setup' => array ( 'content' => '106620:286', 'edit' => '106906:361', ), 'adminSystem_update' => array ( 'content' => '107267:237', 'edit' => '107504:215', 'editCheckNow' => '107719:213', 'editUpdateNow' => '107932:205', 'viewCurrentRelease' => '108137:197', 'viewCurrentVersion' => '108334:208', 'viewLastVerification' => '108542:218', 'viewNewVersionAvailable' => '108760:229', 'viewReleaseNotes' => '108989:133', 'viewSystemUpdated' => '109122:297', ), 'adminUsers' => array ( 'adminProfile' => '109419:118', 'adminProfileButtom' => '109537:229', 'adminProfileMsg' => '109766:881', 'alertPasswordInvalidCharacter' => '110647:680', 'alertPasswordRepeatError' => '111327:384', 'alertPasswordRequired' => '111711:364', 'alertUserAlreadyExists' => '112075:429', 'alertUserInvalidName' => '112504:657', 'alertUserNameRequired' => '113161:658', 'content' => '113819:223', 'contentDisabled' => '114042:443', 'contentEmpty' => '114485:178', 'createFolder' => '114663:158', 'createFolderButtom' => '114821:204', 'createFolderMsg' => '115025:537', 'editAddress' => '115562:249', 'editBornDate' => '115811:276', 'editCaption' => '116087:302', 'editCPF' => '116389:218', 'editDescription' => '116607:292', 'editGender' => '116899:370', 'editGenderFemale' => '117269:157', 'editGenderMale' => '117426:156', 'editGenderUndefined' => '117582:184', 'editMail' => '117766:225', 'editName' => '117991:283', 'editPassword' => '118274:224', 'editPassword2' => '118498:171', 'editPhone' => '118669:231', 'editTitle' => '118900:255', ), 'adminUsers_add' => array ( 'content' => '119155:249', 'edit' => '119404:359', ), 'adminUsers_details' => array ( 'content' => '119763:263', 'edit' => '120026:401', 'editComments' => '120427:270', 'editName' => '120697:173', 'editPassword' => '120870:205', 'editPasswordDescription' => '121075:319', 'removeConfirmErrorF' => '121394:428', 'removeConfirmErrorM' => '121822:428', 'removeConfirmF' => '122250:1028', 'removeConfirmM' => '123278:1023', 'removeConfirmOkF' => '124301:250', 'removeConfirmOkM' => '124551:250', 'removeF' => '124801:139', 'removeM' => '124940:139', ), 'domain_disabled' => array ( 'content' => '125079:920', ), 'domain_empty' => array ( 'content' => '125999:1149', 'edit' => '127148:647', 'editCaption' => '127795:356', 'editContent' => '128151:418', 'editDescription' => '128569:338', 'editKeywords' => '128907:224', 'editKeywordsPack' => '129131:102', 'editTitle' => '129233:813', 'templateForNewDomain' => '130046:265', ), 'domainCreate' => array ( 'content' => '130311:1225', 'contentCreate' => '131536:333', 'edit' => '131869:248', 'editCaption' => '132117:546', 'editDescription' => '132663:511', 'editTitle' => '133174:464', ), 'domainDefault' => array ( 'content' => '133638:628', 'custom' => '134266:291', 'edit' => '134557:664', 'editCaption' => '135221:334', 'editContent' => '135555:354', 'editRecognizeEcolabore' => '135909:275', 'editRecognizeHTML' => '136184:237', 'editRecognizeParagraphs' => '136421:267', 'editTitle' => '136688:266', 'editUpdated' => '136954:167', 'helpAbout' => '137121:503', 'helpTip' => '137624:624', 'restore' => '138248:303', ), 'domainGlossary' => array ( 'content' => '138551:532', 'helpAbout' => '139083:550', ), 'domainGlossary_keyword' => array ( 'content' => '139633:707', 'edit' => '140340:448', 'editCaption' => '140788:148', 'editContent' => '140936:351', 'editKeywordsPack' => '141287:52', 'editTitle' => '141339:266', 'editUpdated' => '141605:167', 'helpAbout' => '141772:895', 'remove' => '142667:140', 'removeConfirm' => '142807:560', ), 'domainIcons' => array ( 'layout' => '143367:367', ), 'domainIndex' => array ( 'contentEdit' => '143734:197', 'edit' => '143931:616', 'editCaption' => '144547:356', 'editContent' => '144903:418', 'editDescription' => '145321:338', 'editKeywords' => '145659:180', 'editKeywordsPack' => '145839:102', 'editList' => '145941:280', 'editListRecents' => '146221:284', 'editListSections' => '146505:295', 'editTitle' => '146800:813', 'editUpdated' => '147613:167', 'helpAbout' => '147780:637', 'helpNavigate' => '148417:391', 'helpTip' => '148808:662', 'mainSections' => '149470:640', ), 'domainInfo' => array ( 'content' => '150110:1010', 'list' => '151120:134', 'view' => '151254:264', 'viewAddress' => '151518:229', 'viewCaption' => '151747:203', 'viewDescription' => '151950:203', 'viewMail' => '152153:240', 'viewPhone' => '152393:223', 'viewTitle' => '152616:198', ), 'domainRecents' => array ( 'content' => '152814:145', 'helpAbout' => '152959:371', 'helpTip' => '153330:442', 'link' => '153772:290', ), 'domainRecents_rss' => array ( 'layout' => '154062:682', ), 'domainSearch' => array ( 'content' => '154744:227', 'help' => '154971:767', 'msgNoResults' => '155738:207', 'search' => '155945:134', 'searchInput' => '156079:260', 'searchSubmit' => '156339:190', 'searchTagOnly' => '156529:260', ), 'domainSitemap' => array ( 'layout' => '156789:272', ), 'domainStyles' => array ( 'preset' => '157061:32158', ), 'financial' => array ( 'content' => '189219:401', ), 'financialAccount' => array ( 'contentEdit' => '189620:180', 'edit' => '189800:473', 'editCaption' => '190273:396', 'editCaptionRequired' => '190669:443', 'editContent' => '191112:363', 'editDescription' => '191475:201', 'editName' => '191676:198', 'editTitle' => '191874:190', 'moveDown' => '192064:129', 'moveUp' => '192193:126', 'remove' => '192319:140', 'removeConfirm' => '192459:642', 'specialFieldsOnEdit' => '193101:115', ), 'financialAccount_create' => array ( 'content' => '193216:256', 'contextNew' => '193472:126', 'edit' => '193598:520', 'editCaptionHidden' => '194118:117', 'editDescription' => '194235:201', 'editNameHidden' => '194436:142', 'editTitle' => '194578:190', 'specialFieldsAfterCreate' => '194768:142', 'specialFieldsOnCreate' => '194910:117', ), 'financialAccountBank' => array ( 'editPayCardMachine' => '195027:351', 'editPayDeposit' => '195378:359', 'editPaySlip' => '195737:467', 'helpAbout' => '196204:777', 'specialFieldsOnCreate' => '196981:109', 'specialFieldsOnEdit' => '197090:109', ), 'financialAccountBank_create' => array ( 'content' => '197199:440', 'contentPreset' => '197639:148', ), 'financialAccountBank_deposit' => array ( 'content' => '197787:331', ), 'financialAccountCash' => array ( 'editPayCash' => '198118:328', 'helpAbout' => '198446:790', 'specialFieldsOnCreate' => '199236:51', 'specialFieldsOnEdit' => '199287:51', ), 'financialAccountCash_cash' => array ( 'content' => '199338:276', ), 'financialAccountCash_create' => array ( 'content' => '199614:473', 'contentPreset' => '200087:151', ), 'financialCharges' => array ( 'content' => '200238:369', 'edit' => '200607:288', 'list' => '200895:138', 'listDescription' => '201033:124', 'listDue' => '201157:117', 'listOwner' => '201274:116', ), 'financialIncoming' => array ( 'edit' => '201390:417', 'editCaptionHidden' => '201807:359', 'editTitle' => '202166:190', 'list' => '202356:123', 'preset' => '202479:211', ), 'financialOutgoing' => array ( 'edit' => '202690:417', 'editCaptionHidden' => '203107:359', 'editTitle' => '203466:190', 'list' => '203656:123', 'preset' => '203779:211', ), 'financialProjects' => array ( 'edit' => '203990:417', 'editCaptionHidden' => '204407:359', 'editTitle' => '204766:190', 'list' => '204956:127', 'preset' => '205083:213', ), 'financialResources' => array ( 'edit' => '205296:419', 'editCaptionHidden' => '205715:359', 'editTitle' => '206074:190', 'list' => '206264:125', 'preset' => '206389:215', ), 'home' => array ( 'contentEdit' => '206604:173', 'edit' => '206777:528', 'editAccess' => '207305:448', 'editAccessAdmin' => '207753:193', 'editAccessAll' => '207946:157', 'editAccessMember' => '208103:204', 'editAccessSubscribed' => '208307:187', 'editCaption' => '208494:396', 'editCaptionRequired' => '208890:443', 'editContent' => '209333:363', 'editDescription' => '209696:201', 'editGroup' => '209897:209', 'editGroupNone' => '210106:125', 'editImg' => '210231:210', 'editKeywords' => '210441:180', 'editKeywordsPack' => '210621:52', 'editName' => '210673:197', 'editTitle' => '210870:190', 'editUpdated' => '211060:167', 'moveDown' => '211227:135', 'moveTo' => '211362:330', 'moveToFooter' => '211692:130', 'moveToList' => '211822:236', 'moveToMain' => '212058:127', 'moveUp' => '212185:134', 'remove' => '212319:140', 'removeConfirm' => '212459:617', 'specialFieldsOnEdit' => '213076:103', ), 'home_create' => array ( 'content' => '213179:242', 'contextNew' => '213421:118', 'edit' => '213539:527', 'editCaptionHidden' => '214066:117', 'editDescription' => '214183:201', 'editKeywordsPack' => '214384:52', 'editNameHidden' => '214436:142', 'editTitle' => '214578:190', 'helpNavigate' => '214768:852', 'specialFieldsAfterCreate' => '215620:130', 'specialFieldsOnCreate' => '215750:105', ), 'homeChat' => array ( 'specialFieldsOnCreate' => '215855:27', 'specialFieldsOnEdit' => '215882:27', ), 'homeChat_create' => array ( 'content' => '215909:380', 'contentPreset' => '216289:286', ), 'homeChat_group' => array ( 'contextRemove' => '216575:164', ), 'homeChat_user' => array ( 'contextClear' => '216739:130', 'contextRemove' => '216869:164', 'form' => '217033:101', 'formComment' => '217134:353', ), 'homePublications' => array ( 'specialFieldsOnCreate' => '217487:55', 'specialFieldsOnEdit' => '217542:55', ), 'homePublications_create' => array ( 'content' => '217597:414', 'contentPreset' => '218011:319', ), 'integration' => array ( 'content' => '218330:345', ), 'integrationGoogleWebmasters' => array ( 'content' => '218675:313', 'create' => '218988:100', 'createFile' => '219088:235', 'view' => '219323:130', 'viewFileContent' => '219453:225', 'viewFileName' => '219678:243', ), 'integrationRSS' => array ( 'content' => '219921:250', 'edit' => '220171:126', 'editRssEnable' => '220297:344', 'editRssMax' => '220641:356', ), 'integrationSMS' => array ( 'content' => '220997:237', 'contentDisabled' => '221234:181', 'contentEnabled' => '221415:178', ), 'integrationSMS_config' => array ( 'content' => '221593:294', 'edit' => '221887:145', 'editPass' => '222032:332', 'editServiceEnable' => '222364:1050', 'editUser' => '223414:330', ), 'integrationSMS_test' => array ( 'content' => '223744:252', 'edit' => '223996:145', 'editPass' => '224141:332', 'editServiceEnable' => '224473:1050', 'editUser' => '225523:330', ), 'integrationSMTP' => array ( 'content' => '225853:253', ), 'integrationSMTP_config' => array ( 'alertDisabled' => '226106:617', 'alertLoginError' => '226723:564', 'alertSendingError' => '227287:362', 'alertSocketError' => '227649:539', 'alertToError' => '228188:375', 'content' => '228563:296', 'edit' => '228859:307', 'integrationSmtpEnable' => '229166:895', 'integrationSmtpFrom' => '230061:324', 'integrationSmtpHost' => '230385:323', 'integrationSmtpPassword' => '230708:332', 'integrationSmtpPort' => '231040:320', 'integrationSmtpTTL' => '231360:352', 'integrationSmtpUser' => '231712:322', ), 'integrationSMTP_test' => array ( 'content' => '232034:252', 'edit' => '232286:196', 'editBcc' => '232482:258', 'editCc' => '232740:258', 'editHtml' => '232998:270', 'editSubject' => '233268:256', 'editText' => '233524:277', 'editTo' => '233801:238', 'view' => '234039:94', 'viewLog' => '234133:258', ), 'modAudio' => array ( 'edit' => '234391:349', 'editAudio' => '234740:207', 'editDescription' => '234947:273', 'tabAudio' => '235220:231', 'tabCaption' => '235451:312', 'tabStyle' => '235763:344', ), 'modBanner' => array ( 'create' => '236107:731', 'edit' => '236838:375', ), 'modBox' => array ( 'content' => '237213:279', 'create' => '237492:682', 'edit' => '238174:319', 'editContent' => '238493:332', 'tabCaption' => '238825:268', 'tabContent' => '239093:235', ), 'modBreadcrumbs' => array ( 'edit' => '239328:452', ), 'modCard' => array ( 'edit' => '239780:227', ), 'modCart' => array ( 'edit' => '240007:373', ), 'modCart_scope' => array ( 'module' => '240380:323', ), 'modComments' => array ( 'edit' => '240703:453', ), 'modComments_add' => array ( 'edit' => '241156:379', 'form' => '241535:101', 'formAnonimous' => '241636:164', 'formComment' => '241800:353', ), 'modContent' => array ( 'edit' => '242153:379', 'post' => '242532:247', ), 'modContext' => array ( 'goChat' => '242779:189', 'goHelp' => '242968:181', 'help' => '243149:129', 'module' => '243278:126', ), 'modDinamic' => array ( 'content' => '243404:469', 'create' => '243873:708', 'edit' => '244581:468', 'listDirection' => '245049:324', 'listDirectionAsc' => '245373:163', 'listDirectionDesc' => '245536:167', 'listFilter' => '245703:369', 'listFilterNextEvents' => '246072:181', 'listFilterNone' => '246253:166', 'listFilterSpotlight' => '246419:182', 'listMax' => '246601:283', 'listOffset' => '246884:536', 'listUpdate' => '247420:425', 'listUpdateAuto' => '247845:164', 'listUpdateDay' => '248009:166', 'listUpdateHits' => '248175:172', 'listUpdateHour' => '248347:169', 'listUpdateMonth' => '248516:170', 'listUpdateWeek' => '248686:172', 'sort' => '248858:487', 'sortByCreated' => '249345:177', 'sortByEventStart' => '249522:184', 'sortByHits' => '249706:182', 'sortByIndex' => '249888:172', 'sortByLastComment' => '250060:191', 'sortByName' => '250251:152', 'sortByUpdated' => '250403:181', 'sortByValue' => '250584:157', 'sortShuffled' => '250741:164', 'tabSort' => '250905:318', ), 'modEditor' => array ( 'contextWisiwygDisable' => '251223:152', 'contextWisiwygEnable' => '251375:148', 'module' => '251523:1157', ), 'modEditor_document' => array ( 'module' => '252680:423', 'save' => '253103:142', ), 'modEditor_insert' => array ( 'editor' => '253245:1150', 'editorA' => '254395:223', 'editorAudio' => '254618:188', 'editorBox' => '254806:208', 'editorFile' => '255014:191', 'editorH1' => '255205:238', 'editorH2' => '255443:238', 'editorH3' => '255681:238', 'editorH4' => '255919:238', 'editorH5' => '256157:238', 'editorH6' => '256395:238', 'editorHR' => '256633:233', 'editorHtml' => '256866:198', 'editorImg' => '257064:187', 'editorLA' => '257251:249', 'editorLO' => '257500:246', 'editorLU' => '257746:251', 'editorP' => '257997:238', 'editorTable' => '258235:188', 'editorVideo' => '258423:188', 'module' => '258611:787', ), 'modEditor_objects' => array ( 'audio' => '259398:121', 'box' => '259519:134', 'file' => '259653:122', 'html' => '259775:140', 'img' => '259915:122', 'module' => '260037:146', 'ofBanner' => '260183:144', 'ofPage' => '260327:127', 'ofPost' => '260454:125', 'ofSection' => '260579:130', 'table' => '260709:122', 'video' => '260831:121', ), 'modFile' => array ( 'content' => '260952:338', 'create' => '261290:599', 'edit' => '261889:349', 'editDescription' => '262238:273', 'editFile' => '262511:202', 'module' => '262713:180', 'tabCaption' => '262893:312', 'tabFile' => '263205:230', 'tabStyle' => '263435:344', 'uploadFile' => '263779:203', ), 'modFooter' => array ( 'create' => '263982:528', 'edit' => '264510:355', 'editContent' => '264865:332', 'tabContent' => '265197:235', ), 'modFormulary' => array ( 'edit' => '265432:362', ), 'modFormulary_view' => array ( 'edit' => '265794:369', ), 'modGrid' => array ( 'edit' => '266163:323', ), 'modHits' => array ( 'edit' => '266486:413', ), 'modHtml' => array ( 'content' => '266899:316', 'create' => '267215:641', 'edit' => '267856:308', 'editHtml' => '268164:239', 'tabCaption' => '268403:312', 'tabHtml' => '268715:199', ), 'modHumperstilshen' => array ( 'iconAlert' => '268914:193', 'iconCrash' => '269107:179', 'iconDefault' => '269286:154', 'iconError' => '269440:203', 'iconHappy' => '269643:183', 'iconQuestion' => '269826:189', 'iconTip' => '270015:178', 'iconWelcome' => '270193:189', 'iconWhait' => '270382:182', 'sessionCheck' => '270564:660', 'sessionCheckSubmit' => '271224:134', 'sessionCheckSubmitConfirm' => '271358:282', 'showAlert' => '271640:164', 'showTip' => '271804:156', 'submitCancel' => '271960:206', 'submitConfirm' => '272166:122', 'submitConfirmCancel' => '272288:122', ), 'modImg' => array ( 'content' => '272410:312', 'create' => '272722:642', 'edit' => '273364:348', 'editDescription' => '273712:273', 'editImg' => '273985:277', 'imgFilterBrightness' => '274262:398', 'imgFilterContrast' => '274660:394', 'imgFilterHueRotate' => '275054:394', 'imgFilterSaturate' => '275448:394', 'tabCaption' => '275842:312', 'tabFilters' => '276154:308', 'tabImg' => '276462:229', 'tabStyle' => '276691:344', ), 'modInstructor' => array ( 'module' => '277035:2153', ), 'modInstructor_quality' => array ( 'helpNavigate' => '279188:308', 'helpRedirect' => '279496:409', 'index' => '279905:391', ), 'modInterface' => array ( 'module' => '280296:129', ), 'modLanguages' => array ( 'edit' => '280425:449', ), 'modLayout' => array ( 'personaliteOff' => '280874:140', 'personaliteOn' => '281014:152', 'print' => '281166:150', ), 'modList' => array ( 'content' => '281316:160', 'edit' => '281476:476', 'listDirection' => '281952:324', 'listDirectionAsc' => '282276:163', 'listDirectionDesc' => '282439:167', 'listMax' => '282606:295', 'sort' => '282901:462', 'sortByCreated' => '283363:177', 'sortByEventStart' => '283540:184', 'sortByHits' => '283724:182', 'sortByIndex' => '283906:172', 'sortByLastComment' => '284078:191', 'sortByName' => '284269:152', 'sortByUpdated' => '284421:181', 'sortByValue' => '284602:157', 'tabSort' => '284759:248', ), 'modLogin' => array ( 'alertCookiesRequired' => '285007:375', 'alertInvalidLogin' => '285382:417', 'anonimous' => '285799:119', 'login' => '285918:179', 'loginName' => '286097:132', 'loginPassword' => '286229:137', 'loginSubmit' => '286366:229', ), 'modNavbar' => array ( 'edit' => '286595:475', 'specialHomeDisplay' => '287070:331', 'tabSpecial' => '287401:217', ), 'modNavbottom' => array ( 'edit' => '287618:445', ), 'modNavmain' => array ( 'edit' => '288063:443', ), 'modPages' => array ( 'edit' => '288506:452', ), 'modSearch' => array ( 'edit' => '288958:327', 'search' => '289285:132', ), 'modSort' => array ( 'edit' => '289417:358', ), 'modTable' => array ( 'content' => '289775:5016', 'edit' => '294791:333', 'list' => '295124:308', 'module' => '295432:55', 'moduleCreate' => '295487:741', 'tabApearance' => '296228:205', 'tabCaption' => '296433:318', 'tabContent' => '296751:219', ), 'modTable_new' => array ( 'content' => '296970:351', 'edit' => '297321:142', 'editCols' => '297463:264', 'editList' => '297727:308', 'editRows' => '298035:263', ), 'modTitle' => array ( 'edit' => '298298:334', ), 'modToolbox' => array ( 'module' => '298632:130', ), 'modUser' => array ( 'goAdmin' => '298762:205', 'goLogout' => '298967:134', 'goMain' => '299101:190', 'module' => '299291:158', ), 'modUser_alerts' => array ( 'module' => '299449:123', ), 'modUser_quoteoftheday' => array ( 'module' => '299572:391', 'quotes' => '299963:45066', ), 'modUser_subscribe' => array ( 'module' => '345029:419', ), 'modUser_tools' => array ( 'goPassword' => '345448:135', 'goPersonal' => '345583:132', 'module' => '345715:125', ), 'modUser_welcome' => array ( 'goEcolabore' => '345840:187', 'goHome' => '346027:161', 'goInfo' => '346188:151', 'goOrganization' => '346339:193', 'goPassword' => '346532:161', 'goPrivacyPolicy' => '346693:158', 'goProfiles' => '346851:132', 'goReport' => '346983:147', 'goServiceTerms' => '347130:151', 'goSubscribe' => '347281:140', 'module' => '347421:131', ), 'modVideo' => array ( 'content' => '347552:337', 'create' => '347889:738', 'edit' => '348627:349', 'editDescription' => '348976:273', 'editVideo' => '349249:207', 'tabCaption' => '349456:312', 'tabStyle' => '349768:344', 'tabVideo' => '350112:231', 'upload' => '350343:419', 'uploadVideo' => '350762:243', ), 'personalite' => array ( 'content' => '351005:432', ), 'personaliteApearance' => array ( 'content' => '351437:527', 'fieldsColor' => '351964:2082', 'fieldsFont' => '354046:3774', 'fieldsSelect' => '357820:886', 'layout' => '358706:5894', ), 'personaliteApearance_color' => array ( 'content' => '364600:47007', ), 'personaliteApearance_font' => array ( 'layout' => '411607:6066', ), 'personaliteApearance_scheme' => array ( 'cardBackgroundColor' => '417673:302', 'cardBorderColor' => '417975:282', 'cardButton' => '418257:178', 'cardCaptionColor' => '418435:279', 'cardHeaderColor' => '418714:275', 'cardInput' => '418989:174', 'cardLinkActiveColor' => '419163:294', 'cardLinkColor' => '419457:267', 'cardTextColor' => '419724:266', 'documentBackgroundColor' => '419990:381', 'documentBorderColor' => '420371:362', 'documentButton' => '420733:259', 'documentCaptionColor' => '420992:361', 'documentHeaderColor' => '421353:356', 'documentInput' => '421709:282', 'documentLinkActiveColor' => '421991:383', 'documentLinkColor' => '422374:346', 'documentTextColor' => '422720:345', 'edit' => '423065:233', 'fontBar' => '423298:389', 'fontBlockquote' => '423687:396', 'fontCaption' => '424083:404', 'fontHeader' => '424487:378', 'fontLabel' => '424865:406', 'fontLegend' => '425271:401', 'fontLink' => '425672:312', 'fontParagraph' => '425984:382', 'fontPre' => '426366:400', 'formularyBackgroundColor' => '426766:317', 'formularyBorderColor' => '427083:297', 'formularyButton' => '427380:188', 'formularyCaptionColor' => '427568:294', 'formularyHeaderColor' => '427862:290', 'formularyInput' => '428152:184', 'formularyLinkActiveColor' => '428336:309', 'formularyLinkColor' => '428645:282', 'formularyTextColor' => '428927:281', 'navBackgroundColor' => '429208:299', 'navBorderColor' => '429507:279', 'navButton' => '429786:176', 'navCaptionColor' => '429962:276', 'navHeaderColor' => '430238:272', 'navInput' => '430510:170', 'navLinkActiveColor' => '430680:291', 'navLinkColor' => '430971:264', 'navTextColor' => '431235:263', 'panelBackgroundColor' => '431498:305', 'panelBorderColor' => '431803:285', 'panelButton' => '432088:180', 'panelCaptionColor' => '432268:282', 'panelHeaderColor' => '432550:278', 'panelInput' => '432828:176', 'panelLinkActiveColor' => '433004:297', 'panelLinkColor' => '433301:270', 'panelTextColor' => '433571:269', 'spotlightBackgroundColor' => '433840:317', 'spotlightBorderColor' => '434157:297', 'spotlightButton' => '434454:188', 'spotlightCaptionColor' => '434642:294', 'spotlightHeaderColor' => '434936:290', 'spotlightInput' => '435226:184', 'spotlightLinkActiveColor' => '435410:309', 'spotlightLinkColor' => '435719:282', 'spotlightTextColor' => '436001:281', 'systemBackgroundColor' => '436282:308', 'systemBorderColor' => '436590:288', 'systemButton' => '436878:182', 'systemCaptionColor' => '437060:285', 'systemHeaderColor' => '437345:281', 'systemInput' => '437626:178', 'systemLinkActiveColor' => '437804:300', 'systemLinkColor' => '438104:273', 'systemTextColor' => '438377:272', 'tabCard' => '438649:1410', 'tabDocument' => '440059:1478', 'tabFonts' => '441537:578', 'tabFormulary' => '442115:1500', 'tabNav' => '443615:1388', 'tabPanel' => '445003:1426', 'tabSpotlight' => '446429:1492', 'tabSystem' => '447921:1580', ), 'personaliteDetails' => array ( 'main' => '449501:315', ), 'personaliteDetails_configure' => array ( 'edit' => '449816:464', 'editCaption' => '450280:265', 'editDescription' => '450545:254', 'editHTML' => '450799:256', 'editName' => '451055:259', 'tabCaption' => '451314:272', 'tabHTML' => '451586:199', ), 'personaliteExport' => array ( 'content' => '451785:434', 'edit' => '452219:159', 'editComponentsList' => '452378:185', 'editContent' => '452563:331', 'editName' => '452894:291', ), 'personaliteExtras' => array ( 'edit' => '453185:316', ), 'personaliteExtras_upload' => array ( 'audio' => '453501:511', 'audioAjaxSend' => '454012:269', 'fieldEnd' => '454281:144', 'fieldFileBig' => '454425:1574', 'fieldStart' => '455999:190', 'file' => '456189:512', 'fileAjaxSend' => '456701:259', 'layout' => '456960:253', 'video' => '457213:511', 'videoAjaxSend' => '457724:269', ), 'personaliteFields' => array ( 'add' => '457993:98', 'alertShareUserDataRequest' => '458091:583', 'close' => '458674:612', 'content' => '459286:541', 'editCaption' => '459827:262', 'editRequired' => '460089:259', 'editType' => '460348:131', 'load' => '460479:711', 'module' => '461190:254', ), 'personaliteFields_address' => array ( 'content' => '461444:211', 'edit' => '461655:238', 'editType' => '461893:137', 'editUseUserAddress' => '462030:345', 'preset' => '462375:128', ), 'personaliteFields_checkbox' => array ( 'content' => '462503:239', 'edit' => '462742:165', 'editType' => '462907:138', 'preset' => '463045:34', 'valueNo' => '463079:108', 'valueYes' => '463187:109', ), 'personaliteFields_created' => array ( 'content' => '463296:235', 'edit' => '463531:145', 'preset' => '463676:137', 'value' => '463813:145', ), 'personaliteFields_descriptive' => array ( 'content' => '463958:249', 'edit' => '464207:228', 'editContent' => '464435:319', 'editDisplayWhenEditingOnly' => '464754:323', 'editType' => '465077:142', 'preset' => '465219:38', ), 'personaliteFields_mail' => array ( 'alertInvalidMail' => '465257:588', 'alertMultipleNotAllowed' => '465845:476', 'content' => '466321:245', 'edit' => '466566:235', 'editType' => '466801:134', 'editUseUserMail' => '466935:336', 'preset' => '467271:112', ), 'personaliteFields_phone' => array ( 'alertInvalidAreaCode' => '467383:625', 'alertInvalidCountryCode' => '468008:673', 'alertInvalidNumber' => '468681:655', 'content' => '469336:207', 'edit' => '469543:236', 'editType' => '469779:135', 'editUseUserPhone' => '469914:341', 'preset' => '470255:124', ), 'personaliteFields_radio' => array ( 'content' => '470379:241', 'edit' => '470620:277', 'editType' => '470897:135', 'preset' => '471032:54', ), 'personaliteFields_select' => array ( 'content' => '471086:237', 'edit' => '471323:234', 'editExplain' => '471557:203', 'editFields' => '471760:111', 'editType' => '471871:136', 'preset' => '472007:56', ), 'personaliteFields_separator' => array ( 'content' => '472063:217', 'edit' => '472280:165', 'editType' => '472445:139', 'preset' => '472584:109', ), 'personaliteFields_status' => array ( 'content' => '472693:205', 'edit' => '472898:145', 'preset' => '473043:138', ), 'personaliteFields_text' => array ( 'content' => '473181:227', 'edit' => '473408:207', 'editType' => '473615:134', 'preset' => '473749:30', ), 'personaliteFields_textarea' => array ( 'content' => '473779:273', 'edit' => '474052:207', 'editType' => '474259:138', 'preset' => '474397:83', ), 'personaliteInstall' => array ( 'checkboxComponents' => '474480:118', 'checkboxSections' => '474598:117', 'content' => '474715:436', 'edit' => '475151:106', 'editFiles' => '475257:188', 'select' => '475445:113', 'selectComponents' => '475558:228', ), 'personaliteModules' => array ( '000auto' => '475786:160', '000noPadding' => '475946:170', '012rem' => '476116:159', '025rem' => '476275:170', '050rem' => '476445:166', '075rem' => '476611:170', '083rem' => '476781:170', '091rem' => '476951:170', '100rem' => '477121:157', '110rem' => '477278:163', '125rem' => '477441:167', '150rem' => '477608:163', '200rem' => '477771:159', '250rem' => '477930:166', '300rem' => '478096:159', 'alignBottom' => '478255:160', 'alignCenter' => '478415:165', 'alignLeft' => '478580:155', 'alignRight' => '478735:159', 'alignTop' => '478894:151', 'boxBorderRadius' => '479045:559', 'boxBorderRadiusElipse' => '479604:155', 'boxBorderRadiusOff' => '479759:184', 'boxDisplay' => '479943:347', 'boxFontSize' => '480290:532', 'boxPadding' => '480822:559', 'boxScheme' => '481381:528', 'boxSchemeAuto' => '481909:165', 'boxSchemeCard' => '482074:154', 'boxSchemeFormulary' => '482228:169', 'boxSchemeNav' => '482397:177', 'boxSchemePanel' => '482574:156', 'boxSchemeSpotlight' => '482730:166', 'boxSchemeSystem' => '482896:159', 'boxShadow' => '483055:433', 'boxShadowAuto' => '483488:165', 'boxShadowOff' => '483653:181', 'boxShadowOn' => '483834:183', 'boxShadowSmoke' => '484017:176', 'caption' => '484193:246', 'captionDisplay' => '484439:305', 'captionLegend' => '484744:318', 'contentNotConfigurable' => '485062:465', 'details' => '485527:207', 'detailsHorizontalAlign' => '485734:470', 'detailsVerticalAlign' => '486204:461', 'edit' => '486665:501', 'formularyLayout' => '487166:457', 'formularyLayoutBox' => '487623:151', 'formularyLayoutGrid' => '487774:153', 'formularyLayoutInline' => '487927:160', 'formularyLayoutStack' => '488087:155', 'imgFilterGrayscale' => '488242:390', 'imgFilterSepia' => '488632:364', 'imgShape' => '488996:456', 'imgShapeAuto' => '489452:191', 'imgShapeCircle' => '489643:159', 'imgShapeElipse' => '489802:158', 'imgShapeSquare' => '489960:160', 'imgShapeThumbnail' => '490120:159', 'imgSmoke' => '490279:322', 'listAlign' => '490601:403', 'listColumns1' => '491004:108', 'listColumns2' => '491112:108', 'listColumns3' => '491220:108', 'listColumns4' => '491328:108', 'listColumns5' => '491436:108', 'listColumns6' => '491544:108', 'listColumnsAuto' => '491652:165', 'listColumnsExtraLarge' => '491817:518', 'listColumnsLarge' => '492335:522', 'listColumnsMedium' => '492857:521', 'listColumnsSmall' => '493378:521', 'listGap000' => '493899:171', 'listGap012' => '494070:125', 'listGap025' => '494195:124', 'listGap037' => '494319:125', 'listGap050' => '494444:123', 'listGap075' => '494567:125', 'listGap100' => '494692:122', 'listGap125' => '494814:116', 'listGap150' => '494930:115', 'listGap200' => '495045:122', 'listGapColumn' => '495167:617', 'listGapRow' => '495784:620', 'listLayout' => '496404:455', 'listLayoutColumns' => '496859:161', 'listLayoutFlex' => '497020:152', 'listLayoutGrid' => '497172:149', 'listLayoutInline' => '497321:161', 'modPadding0' => '497482:161', 'modPaddingAuto' => '497643:169', 'modPaddingBottom' => '497812:565', 'modPaddingLeft' => '498377:559', 'modPaddingRight' => '498936:561', 'modPaddingTop' => '499497:556', 'modPosition' => '500053:511', 'modPositionCenter' => '500564:165', 'modPositionFloatLeft' => '500729:181', 'modPositionFloatRight' => '500910:182', 'modPositionInline' => '501092:170', 'modPositionLeft' => '501262:155', 'modPositionRight' => '501417:159', 'modSemantic' => '501576:549', 'modSemanticAddress' => '502125:181', 'modSemanticArticle' => '502306:179', 'modSemanticAside' => '502485:179', 'modSemanticFooter' => '502664:158', 'modSemanticHeader' => '502822:161', 'modSemanticNav' => '502983:163', 'modSemanticNone' => '503146:147', 'modWidth1' => '503293:119', 'modWidth10' => '503412:121', 'modWidth11' => '503533:121', 'modWidth12' => '503654:129', 'modWidth2' => '503783:119', 'modWidth3' => '503902:126', 'modWidth4' => '504028:119', 'modWidth5' => '504147:119', 'modWidth6' => '504266:126', 'modWidth7' => '504392:119', 'modWidth8' => '504511:119', 'modWidth9' => '504630:119', 'modWidthAuto' => '504749:165', 'modWidthExtraLarge' => '504914:646', 'modWidthHidden' => '505560:159', 'modWidthLarge' => '505719:656', 'modWidthMedium' => '506375:654', 'modWidthSmall' => '507029:655', 'tabCaption' => '507684:278', 'tabDetails' => '507962:205', 'tabEffects' => '508167:283', 'tabFormulary' => '508450:219', 'tabList' => '508669:465', 'tabPosition' => '509134:438', 'tabStyle' => '509572:301', ), 'personaliteTemplate' => array ( 'content' => '509873:480', 'edit' => '510353:472', 'manageDetails' => '510825:235', 'manageFields' => '511060:255', 'manageFonts' => '511315:229', 'manageIcons' => '511544:229', 'manageLabels' => '511773:337', 'manageLabelsAction' => '512110:264', 'manageLabelsDate' => '512374:260', 'manageLabelsField' => '512634:263', 'manageLabelsLang' => '512897:266', 'manageLabelsNavigation' => '513163:275', 'manageLayouts' => '513438:234', 'manageLists' => '513672:229', 'manageModules' => '513901:234', 'managePalettes' => '514135:236', 'manageScripts' => '514371:234', 'manageStyles' => '514605:238', 'manageThemes' => '514843:230', 'tabDetails' => '515073:212', 'tabFields' => '515285:216', 'tabFonts' => '515501:206', 'tabIcons' => '515707:206', 'tabLabels' => '515913:227', 'tabLabelsAction' => '516140:276', 'tabLabelsDate' => '516416:272', 'tabLabelsField' => '516688:275', 'tabLabelsLang' => '516963:278', 'tabLabelsNavigation' => '517241:287', 'tabLayouts' => '517528:211', 'tabLists' => '517739:206', 'tabModules' => '517945:211', 'tabPalettes' => '518156:230', 'tabScripts' => '518386:211', 'tabStyles' => '518597:226', 'tabThemes' => '518823:207', ), 'personaliteTemplate_add' => array ( 'content' => '519030:1396', ), 'personaliteTemplate_configure' => array ( 'details' => '520426:427', 'edit' => '520853:429', 'editCaption' => '521282:265', 'editCSS' => '521547:234', 'editDescription' => '521781:254', 'editFilters' => '522035:223', 'editFiltersDescription' => '522258:302', 'editFlags' => '522560:208', 'editFontFace' => '522768:274', 'editFontStack' => '523042:274', 'editHTML' => '523316:237', 'editName' => '523553:299', 'editScript' => '523852:253', 'editVars' => '524105:206', 'fields' => '524311:420', 'fonts' => '524731:400', 'icons' => '525131:399', 'layouts' => '525530:422', 'lists' => '525952:399', 'modules' => '526351:422', 'palettes' => '526773:404', 'scripts' => '527177:406', 'styles' => '527583:416', 'tabCaption' => '527999:272', 'tabCSS' => '528271:196', 'tabFilters' => '528467:250', 'tabFlags' => '528717:212', 'tabFonts' => '528929:231', 'tabHTML' => '529160:199', 'tabScript' => '529359:206', 'tabVars' => '529565:209', 'templates' => '529774:424', 'themes' => '530198:400', ), 'personaliteTemplate_filters' => array ( 'content' => '530598:322', ), 'personaliteTemplate_labels' => array ( 'edit' => '530920:399', 'editCaption' => '531319:265', 'editName' => '531584:259', 'tabCaption' => '531843:272', ), 'section' => array ( 'contentEdit' => '532115:180', 'edit' => '532295:542', 'editAccess' => '532837:448', 'editAccessAdmin' => '533285:193', 'editAccessAll' => '533478:157', 'editAccessMember' => '533635:204', 'editAccessSubscribed' => '533839:187', 'editCaption' => '534026:396', 'editCaptionRequired' => '534422:443', 'editContent' => '534865:363', 'editDescription' => '535228:201', 'editGroup' => '535429:209', 'editGroupNone' => '535638:125', 'editImg' => '535763:210', 'editKeywords' => '535973:180', 'editKeywordsPack' => '536153:52', 'editName' => '536205:279', 'editTitle' => '536484:190', 'editUpdated' => '536674:167', 'moveDown' => '536841:135', 'moveTo' => '536976:330', 'moveToFooter' => '537306:130', 'moveToList' => '537436:236', 'moveToMain' => '537672:127', 'moveUp' => '537799:134', 'remove' => '537933:140', 'removeConfirm' => '538073:617', 'specialFieldsOnEdit' => '538690:106', ), 'section_create' => array ( 'content' => '538796:256', 'contextNew' => '539052:132', 'contextNewMain' => '539184:141', 'edit' => '539325:527', 'editCaptionHidden' => '539852:117', 'editDescription' => '539969:201', 'editKeywordsPack' => '540170:52', 'editNameHidden' => '540222:142', 'editTitle' => '540364:190', 'helpNavigate' => '540554:852', 'specialFieldsAfterCreate' => '541406:133', 'specialFieldsOnCreate' => '541539:108', ), 'sectionBlog' => array ( 'editComment' => '541647:502', 'editCommentDisabled' => '542149:170', 'helpAbout' => '542319:844', 'helpCreate' => '543163:699', 'helpDone' => '543862:160', 'helpNavigate' => '544022:699', 'reindex' => '544721:390', 'reindexList' => '545111:222', 'sort' => '545333:479', 'sortAlphabetically' => '545812:147', 'sortCheaper' => '545959:131', 'sortEvent' => '546090:137', 'sortExpensive' => '546227:137', 'sortHits' => '546364:138', 'sortPost' => '546502:137', 'sortRatings' => '546639:144', 'sortRecents' => '546783:132', 'specialFieldsOnCreate' => '546915:82', 'specialFieldsOnEdit' => '546997:82', ), 'sectionBlog_create' => array ( 'blog' => '547079:377', 'blogPreset' => '547456:55', 'events' => '547511:412', 'eventsPreset' => '547923:90', 'galery' => '548013:421', 'galeryPreset' => '548434:90', 'news' => '548524:384', 'newsPreset' => '548908:88', 'podcast' => '548996:371', 'podcastPreset' => '549367:91', 'products' => '549458:473', 'productsPreset' => '549931:92', 'videocast' => '550023:408', 'videocastPreset' => '550431:93', ), 'sectionBlog_post' => array ( 'contextNew' => '550524:128', 'edit' => '550652:529', 'editCaption' => '551181:326', 'editCaptionHidden' => '551507:359', 'editContactAddress' => '551866:302', 'editContactMail' => '552168:313', 'editContactPhone' => '552481:240', 'editContactSite' => '552721:250', 'editContent' => '552971:369', 'editDescription' => '553340:323', 'editEventDate' => '553663:253', 'editEventPlace' => '553916:306', 'editImg' => '554222:282', 'editKeywords' => '554504:295', 'editKeywordsPack' => '554799:52', 'editMediaBox' => '554851:395', 'editName' => '555246:152', 'editNameHidden' => '555398:187', 'editProduct' => '555585:257', 'editSpecialFields' => '555842:75', 'editTitle' => '555917:308', 'editTitleRequired' => '556225:427', 'editUpdated' => '556652:167', 'msgRemoveConfirm' => '556819:444', 'new' => '557263:509', 'remove' => '557772:136', 'specialProductAvailable' => '557908:206', 'specialProductOrder' => '558114:190', 'specialProductPrice' => '558304:166', 'specialProductStock' => '558470:175', ), 'sectionCart' => array ( 'alertTimeout' => '558645:625', 'choosePaymentMethod' => '559270:111', 'choosePaymentMethodList' => '559381:81', 'contentPleaseConnect' => '559462:297', 'helpAbout' => '559759:271', 'helpInstructor' => '560030:175', 'listAction' => '560205:121', 'listCode' => '560326:119', 'listDescription' => '560445:129', 'listPrice' => '560574:122', 'listQuantity' => '560696:119', 'listTotal' => '560815:121', 'listValue' => '560936:121', 'specialFieldsOnCreate' => '561057:58', 'specialFieldsOnEdit' => '561115:58', ), 'sectionCart_create' => array ( 'content' => '561173:522', 'contentPreset' => '561695:424', ), 'sectionFolder' => array ( 'helpAbout' => '562119:890', 'specialFieldsOnCreate' => '563009:58', 'specialFieldsOnEdit' => '563067:58', ), 'sectionFolder_create' => array ( 'content' => '563125:408', 'contentPreset' => '563533:248', ), 'sectionFormulary' => array ( 'editMail' => '563781:226', 'fields' => '564007:410', 'fieldsList' => '564417:234', 'formulary' => '564651:110', 'formularyFields' => '564761:68', 'helpAbout' => '564829:566', 'helpInstructor' => '565395:177', 'review' => '565572:358', 'security' => '565930:591', 'securityAccess' => '566521:611', 'securityBasics' => '567132:570', 'securityBasicsEnable' => '567702:269', 'securityContent' => '567971:482', 'securityContentUrlBlock' => '568453:269', 'securityReview' => '568722:422', 'securityReviewEnable' => '569144:237', 'specialFieldsOnCreate' => '569381:78', 'specialFieldsOnEdit' => '569459:78', 'view' => '569537:91', 'viewFields' => '569628:72', ), 'sectionFormulary_create' => array ( 'contact' => '569700:434', 'contactPreset' => '570134:1203', 'formulary' => '571337:534', 'formularyPreset' => '571871:60', ), 'sectionFormulary_done' => array ( 'content' => '571931:544', 'custom' => '572475:291', 'edit' => '572766:664', 'editCaption' => '573430:334', 'editContent' => '573764:354', 'editRecognizeEcolabore' => '574118:275', 'editRecognizeHTML' => '574393:237', 'editRecognizeParagraphs' => '574630:267', 'editTitle' => '574897:266', 'editUpdated' => '575163:167', 'restore' => '575330:303', ), 'sectionFormulary_received' => array ( 'content' => '575633:467', 'list' => '576100:246', 'listNew' => '576346:127', 'selectColumns' => '576473:549', 'selectColumnsList' => '577022:235', ), 'sectionFormulary_record' => array ( 'content' => '577257:219', 'remove' => '577476:139', ), 'sectionFormulary_removed' => array ( 'content' => '577615:251', ), 'sectionFormulary_selectColumns' => array ( 'content' => '577866:437', ), 'sectionFormulary_statistics' => array ( 'content' => '578303:245', 'list' => '578548:1133', ), 'sectionGlossary' => array ( 'helpAbout' => '579681:613', 'helpInstructor' => '580294:178', 'specialFieldsOnCreate' => '580472:58', 'specialFieldsOnEdit' => '580530:58', ), 'sectionGlossary_create' => array ( 'content' => '580588:399', 'contentPreset' => '580987:731', ), 'sectionInfo' => array ( 'helpAbout' => '581718:428', 'helpInstructor' => '582146:174', 'specialFieldsOnCreate' => '582320:58', 'specialFieldsOnEdit' => '582378:58', ), 'sectionInfo_create' => array ( 'content' => '582436:431', 'contentPreset' => '582867:409', ), 'sectionMenu' => array ( 'helpAbout' => '583276:421', ), 'sectionMenu_create' => array ( 'menu' => '583697:412', 'menuPreset' => '584109:55', ), 'sectionPrivacyPolicy' => array ( 'helpAbout' => '584164:704', 'helpInstructor' => '584868:142', 'specialFieldsOnCreate' => '585010:58', 'specialFieldsOnEdit' => '585068:58', ), 'sectionPrivacyPolicy_create' => array ( 'content' => '585126:530', 'contentPreset' => '585656:456', ), 'sectionRedirect' => array ( 'content' => '586112:588', 'editURL' => '586700:281', 'helpAbout' => '586981:518', 'specialFieldsOnCreate' => '587499:46', 'specialFieldsOnEdit' => '587545:46', ), 'sectionRedirect_create' => array ( 'content' => '587591:531', 'contentPreset' => '588122:59', ), 'sectionSearch' => array ( 'helpAbout' => '588181:255', 'helpInstructor' => '588436:176', 'specialFieldsOnCreate' => '588612:58', 'specialFieldsOnEdit' => '588670:58', ), 'sectionSearch_create' => array ( 'content' => '588728:410', 'contentPreset' => '589138:390', ), 'sectionSubdomains' => array ( 'helpAbout' => '589528:451', 'helpInstructor' => '589979:140', 'list' => '590119:173', 'specialFieldsOnCreate' => '590292:58', 'specialFieldsOnEdit' => '590350:58', ), 'sectionSubdomains_create' => array ( 'content' => '590408:419', 'contentPreset' => '590827:447', ), 'sectionTeam' => array ( 'helpAbout' => '591274:375', 'helpCreate' => '591649:457', 'helpDone' => '592106:593', 'helpInstructor' => '592699:195', 'helpNavigate' => '592894:237', 'helpReturn' => '593131:243', 'listAllClients' => '593374:141', 'listAllGroups' => '593515:123', 'listAllMembers' => '593638:140', 'listAllPartners' => '593778:143', 'listAllStudents' => '593921:140', 'listAllSuppliers' => '594061:147', 'listSectorMembers' => '594208:154', 'specialFieldsOnCreate' => '594362:58', 'specialFieldsOnEdit' => '594420:58', ), 'sectionTeam_create' => array ( 'clients' => '594478:364', 'clientsPreset' => '594842:375', 'partners' => '595217:383', 'partnersPreset' => '595600:379', 'students' => '595979:374', 'studentsPreset' => '596353:400', 'subscriptions' => '596753:428', 'subscriptionsPreset' => '597181:433', 'suppliers' => '597614:384', 'suppliersPreset' => '597998:393', 'team' => '598391:388', 'teamPreset' => '598779:401', ), 'sectionTeam_group' => array ( 'edit' => '599180:411', 'editCaption' => '599591:396', 'editContent' => '599987:336', 'editName' => '600323:242', 'editTitle' => '600565:171', 'new' => '600736:221', 'remove' => '600957:138', 'removeConfirm' => '601095:657', ), 'sectionTeam_member' => array ( 'contentClient' => '601752:522', 'contentMember' => '602274:520', 'contentPartner' => '602794:524', 'contentStudant' => '603318:520', 'contentSubscription' => '603838:526', 'contentSuplier' => '604364:530', 'edit' => '604894:613', 'editGroup' => '605507:219', 'editGroupNone' => '605726:134', 'helpNavigate' => '605860:556', 'import' => '606416:555', 'import_helpAbout' => '606971:722', 'import_helpNavigate' => '607693:381', 'importList' => '608074:210', 'importListError' => '608284:385', 'inactive' => '608669:571', 'inactive_helpNavigate' => '609240:521', 'inactiveList' => '609761:216', 'new' => '609977:773', 'new_helpNavigate' => '610750:417', 'unlink' => '611167:160', 'unlinkMember' => '611327:872', 'unlinkMessage' => '612199:641', ), 'sectionTerms' => array ( 'helpAbout' => '612840:685', 'helpInstructor' => '613525:133', 'specialFieldsOnCreate' => '613658:58', 'specialFieldsOnEdit' => '613716:58', ), 'sectionTerms_create' => array ( 'content' => '613774:516', 'contentPreset' => '614290:454', ), 'system_form' => array ( 'add' => '614744:117', 'back' => '614861:121', 'cancel' => '614982:123', 'close' => '615105:122', 'create' => '615227:121', 'end' => '615348:68', 'endView' => '615416:50', 'finish' => '615466:121', 'formularyIdCrash' => '615587:427', 'go' => '616014:117', 'next' => '616131:119', 'previous' => '616250:127', 'previousFinish' => '616377:109', 'previousNext' => '616486:107', 'previousSubmit' => '616593:109', 'save' => '616702:119', 'saveCancel' => '616821:129', 'saveClose' => '616950:128', 'separator' => '617078:51', 'start' => '617129:72', 'startView' => '617201:53', 'submit' => '617254:121', 'submitCancel' => '617375:131', ), 'system_msg' => array ( 'alertConfigurationRestored' => '617506:182', 'alertConfigurationSaved' => '617688:156', 'alertDataUpdated' => '617844:338', 'alertInternalError' => '618182:376', 'alertOperationCanceled' => '618558:529', 'alertRequiredField' => '619087:547', 'alertUnexpectedError' => '619634:861', 'clearLanguageConfirm' => '620495:584', ), 'systemAccessDenied' => array ( 'content' => '621079:1278', 'contentProfile' => '622357:872', ), 'systemDefault' => array ( 'content' => '623229:618', 'help' => '623847:664', ), 'systemInstallation' => array ( 0 => '624511:248', '0description' => '624759:203', 1 => '624962:247', '1description' => '625209:198', 2 => '625407:133', '2description' => '625540:679', 'accessDenied' => '626219:751', 'adminCaption' => '626970:234', 'adminGender' => '627204:349', 'adminIdentifier' => '627553:263', 'adminMail' => '627816:199', 'adminPassword' => '628015:288', 'index' => '628303:550', 'systemHostingMode' => '628853:1817', 'systemHostingModeMultiple' => '630670:343', 'systemHostingModeSingle' => '631013:229', 'systemHttpsRedirect' => '631242:268', 'systemRewriteEngine' => '631510:313', 'templateForConfig' => '631823:146', ), 'tool' => array ( 'content' => '631969:395', ), 'toolConfig' => array ( 'content' => '632364:419', ), 'toolConfig_about' => array ( 'content' => '632783:425', 'edit' => '633208:288', ), 'toolConfig_languages' => array ( 'content' => '633496:393', 'currencies' => '633889:315', 'edit' => '634204:261', 'editCurrenciesManager' => '634465:253', 'editLanguagesManager' => '634718:241', 'select' => '634959:316', ), 'toolConfig_market' => array ( 'content' => '635275:415', 'edit' => '635690:126', 'editCartTimer' => '635816:435', 'editCartTimer00' => '636251:174', 'editCartTimer10' => '636425:165', 'editCartTimer20' => '636590:166', 'editCartTimer30' => '636756:166', 'editCartType' => '636922:368', 'editCartTypeBag' => '637290:152', 'editCartTypeCart' => '637442:152', ), 'toolConfig_versioning' => array ( 'content' => '637594:611', 'edit' => '638205:288', ), 'toolMediaGalery' => array ( 'content' => '638493:423', ), 'user' => array ( 'content' => '638916:489', 'you' => '639405:211', ), 'userAdmin' => array ( 'content' => '639616:697', ), 'userAnonimous' => array ( 'content' => '640313:127', ), 'userDefault' => array ( 'content' => '640440:612', ), 'userHome_alerts' => array ( 'content' => '641052:340', 'mail' => '641392:239', 'phone' => '641631:239', ), 'userHome_default' => array ( 'content' => '641870:410', ), 'userHome_index' => array ( 'content' => '642280:444', 'domains' => '642724:135', 'recents' => '642859:139', ), 'userHome_mail' => array ( 'content' => '642998:374', 'contentFail' => '643372:201', 'contentMailSent' => '643573:316', 'contentReady' => '643889:289', 'contentVerified' => '644178:316', 'contextVerified' => '644494:165', 'editSecurity' => '644659:269', 'input' => '644928:120', 'messageTemplate' => '645048:1552', 'sent' => '646600:83', 'sentButtons' => '646683:111', 'sentUpdate' => '646794:123', 'update' => '646917:130', ), 'userHome_password' => array ( 'alertPasswordChanged' => '647047:375', 'content' => '647422:424', 'edit' => '647846:206', 'editRecoverPassword' => '648052:210', 'help' => '648262:957', 'msgInvalidToken' => '649219:487', 'msgPasswordRecovered' => '649706:452', ), 'userHome_personal' => array ( 'alertDataUpdated' => '650158:384', 'content' => '650542:422', 'edit' => '650964:284', 'help' => '651248:343', ), 'userHome_phone' => array ( 'alertInvalidCode' => '651591:630', 'check' => '652221:126', 'checkCode' => '652347:289', 'content' => '652636:414', 'contentVerified' => '653050:354', 'input' => '653404:98', 'inputPhone' => '653502:98', 'update' => '653600:150', 'verified' => '653750:792', 'verifiedButtons' => '654542:115', 'verifiedUpdate' => '654657:124', ), 'userHome_welcome' => array ( 'disabledF' => '654781:666', 'disabledM' => '655447:670', 'welcome' => '656117:875', 'welcomeToProfile' => '656992:891', ), 'userIndex' => array ( 'content' => '657883:489', ), 'userJoin' => array ( 'alertWelcome' => '658372:677', 'content' => '659049:544', 'editTermsAgree' => '659593:296', 'editTermsView' => '659889:63', 'helpDescription' => '659952:82', 'page0' => '660034:534', 'page1' => '660568:445', 'page1previous' => '661013:297', 'page2' => '661310:448', ), 'userRecoverPassword' => array ( 'content' => '661758:538', 'edit' => '662296:104', 'editAdminMailNotFound' => '662400:596', 'editAdminNotFound' => '662996:379', 'editIdentifier' => '663375:233', 'messageTemplate' => '663608:1539', 'msgMailSent' => '665147:842', ), ), 't' => array ( 'base' => array ( 'empty' => '665989:37', 'mail' => '666026:452', 'print' => '666478:580', 'responsive' => '667058:5279', 'simple' => '672337:557', 'system' => '672894:733', ), 'blocks' => array ( 'help' => '673627:146', 'personalite' => '673773:198', 'personalite_paragraph' => '673971:225', ), 'borders' => array ( 'card' => '674196:531', 'columns' => '674727:549', 'default' => '675276:1125', 'font' => '676401:262', 'format' => '676663:479', 'grid' => '677142:742', ), 'details' => array ( 'button_caption' => '677884:1150', 'button_title' => '679034:491', 'caption' => '679525:262', 'contact_address' => '679787:447', 'contact_mail' => '680234:255', 'contact_phone' => '680489:232', 'contact_site' => '680721:289', 'content' => '681010:494', 'description' => '681504:483', 'event_date' => '681987:303', 'img' => '682290:859', 'img_mini' => '683149:943', 'img_mini_title_description' => '684092:1618', 'info_hits' => '685710:203', 'info_owner' => '685913:310', 'info_posted' => '686223:258', 'info_posted_datetime' => '686481:286', 'info_posted_elapsed' => '686767:252', 'info_updated' => '687019:274', 'list_categories' => '687293:302', 'list_keywords' => '687595:352', 'list_location' => '687947:330', 'list_location_full' => '688277:369', 'list_location_inline' => '688646:330', 'media_audima' => '688976:322', 'media_audio' => '689298:705', 'media_box' => '690003:220', 'media_file' => '690223:497', 'media_font' => '690720:3012', 'media_video' => '693732:383', 'product_cart' => '694115:1572', 'product_price' => '695687:599', 'subitens' => '696286:96', 'title_1' => '696382:549', 'title_2' => '696931:270', 'title_3' => '697201:270', 'title_4' => '697471:554', 'title_5' => '698025:554', 'title_6' => '698579:554', ), 'fields' => array ( 'address' => '699133:2162', 'address_buscacep' => '701295:2869', 'checkbox' => '704164:542', 'checkbox_tree' => '704706:1841', 'descriptive' => '706547:294', 'end' => '706841:285', 'file' => '707126:497', 'list' => '707623:618', 'manager' => '708241:7344', 'phone' => '715585:1011', 'radio' => '716596:517', 'range' => '717113:557', 'select' => '717670:627', 'separator' => '718297:195', 'start' => '718492:834', 'submit' => '719326:654', 'text' => '719980:553', 'text_password' => '720533:512', 'text_small' => '721045:581', 'text_tiny' => '721626:595', 'textarea' => '722221:557', 'textarea_big' => '722778:566', 'textarea_small' => '723344:572', 'view' => '723916:403', 'view_end' => '724319:176', 'view_start' => '724495:225', ), 'fonts' => array ( 'arial' => '724720:167', 'book-antiqua' => '724887:191', 'century-gothic' => '725078:233', 'consolas' => '725311:334', 'courier-new' => '725645:205', 'helvetica-neue' => '725850:182', 'times-new-roman' => '726032:197', ), 'icons' => array ( 'action_add' => '726229:239', 'action_configure' => '726468:268', 'action_remove' => '726736:206', 'ecolabore_flower' => '726942:1200', 'menu' => '728142:283', 'nav_down_arrow' => '728425:242', 'nav_left_arrow' => '728667:247', 'nav_right_arrow' => '728914:247', 'nav_up_arrow' => '729161:239', 'square' => '729400:204', ), 'labels/action' => array ( 'add' => '729604:115', 'answer' => '729719:118', 'back' => '729837:121', 'cancel' => '729958:125', 'choose' => '730083:125', 'clear' => '730208:122', 'close' => '730330:114', 'configure' => '730444:131', 'confirm' => '730575:127', 'connect' => '730702:122', 'create' => '730824:114', 'download' => '730938:117', 'edit' => '731055:113', 'finish' => '731168:125', 'go' => '731293:115', 'move_down' => '731408:129', 'move_left' => '731537:132', 'move_right' => '731669:133', 'move_to' => '731802:128', 'move_up' => '731930:126', 'next' => '732056:114', 'ok' => '732170:107', 'pause' => '732277:114', 'play' => '732391:118', 'previous' => '732509:122', 'redo' => '732631:114', 'remove' => '732745:116', 'remove_object' => '732861:132', 'restore' => '732993:166', 'save' => '733159:113', 'submit' => '733272:115', 'undo' => '733387:115', 'update' => '733502:118', ), 'labels/currency' => array ( 'AED' => '733620:172', 'ALL' => '733792:127', 'ANG' => '733919:166', 'ARS' => '734085:129', 'AUD ' => '734214:51', 'AUD' => '734265:88', 'AWG' => '734353:134', 'BBD' => '734487:148', 'BDT' => '734635:141', 'BGN' => '734776:142', 'BHD' => '734918:160', 'BIF' => '735078:148', 'BMD' => '735226:149', 'BND' => '735375:139', 'BOB' => '735514:141', 'BRL' => '735655:138', 'BSD' => '735793:141', 'BTN' => '735934:148', 'BWP' => '736082:128', 'BYR' => '736210:136', 'BZD' => '736346:146', 'CAD ' => '736492:59', 'CAD' => '736551:86', 'CHF ' => '736637:66', 'CHF' => '736703:84', 'CLP' => '736787:127', 'CNY' => '736914:127', 'COP' => '737041:130', 'CRC' => '737171:140', 'CUP' => '737311:141', 'CVE' => '737452:150', 'CZK' => '737602:160', 'DJF' => '737762:148', 'DKK ' => '737910:59', 'DKK' => '737969:88', 'DOP' => '738057:145', 'DZD' => '738202:144', 'EEK' => '738346:144', 'EGP' => '738490:151', 'ETB' => '738641:135', 'EUR ' => '738776:59', 'EUR' => '738835:73', 'FJD' => '738908:144', 'FKP ' => '739052:51', 'FKP' => '739103:88', 'GBP ' => '739191:51', 'GBP' => '739242:85', 'GHS' => '739327:138', 'GMD ' => '739465:51', 'GMD' => '739516:84', 'GNF' => '739600:139', 'GTQ' => '739739:132', 'GYD' => '739871:146', 'HKD ' => '740017:66', 'HKD' => '740083:89', 'HNL' => '740172:131', 'HRK' => '740303:137', 'HTG' => '740440:82', 'HUF' => '740522:138', 'IDR ' => '740660:59', 'IDR' => '740719:86', 'ILS' => '740805:145', 'INR' => '740950:143', 'IQD' => '741093:152', 'IRR' => '741245:84', 'ISK' => '741329:138', 'JOD' => '741467:146', 'JPY ' => '741613:51', 'JPY' => '741664:83', 'KES' => '741747:144', 'KGS' => '741891:142', 'KHR' => '742033:142', 'KMF' => '742175:146', 'KPW' => '742321:140', 'KRW' => '742461:138', 'KWD' => '742599:153', 'KYD' => '742752:133', 'KZT ' => '742885:66', 'KZT' => '742951:88', 'LKR' => '743039:148', 'MAD' => '743187:156', 'MDL' => '743343:143', 'MKD' => '743486:146', 'MMK' => '743632:128', 'MNT' => '743760:146', 'MOP ' => '743906:51', 'MOP' => '743957:82', 'MRO' => '744039:142', 'MUR' => '744181:142', 'MVR' => '744323:139', 'MWK' => '744462:139', 'MXN' => '744601:128', 'MYR' => '744729:139', 'NAD ' => '744868:59', 'NAD' => '744927:86', 'NGN' => '745013:137', 'NIO' => '745150:142', 'NOK' => '745292:136', 'NPR' => '745428:137', 'NZD' => '745565:139', 'OMR ' => '745704:75', 'OMR' => '745779:80', 'PAB' => '745859:129', 'PEN' => '745988:137', 'PGK' => '746125:137', 'PHP' => '746262:136', 'PKR' => '746398:146', 'PLN' => '746544:144', 'PYG' => '746688:87', 'QAR ' => '746775:73', 'QAR' => '746848:83', 'RON ' => '746931:51', 'RON' => '746982:80', 'RUB' => '747062:149', 'RWF' => '747211:138', 'SAR' => '747349:158', 'SBD' => '747507:155', 'SCR' => '747662:143', 'SDG' => '747805:144', 'SEK' => '747949:136', 'SGD' => '748085:142', 'SHP' => '748227:136', 'SKK' => '748363:140', 'SLL' => '748503:142', 'SOS' => '748645:145', 'STD' => '748790:139', 'SVC' => '748929:141', 'SYP' => '749070:142', 'SZL' => '749212:145', 'THB ' => '749357:58', 'THB' => '749415:85', 'TND' => '749500:148', 'TOP' => '749648:138', 'TRY' => '749786:140', 'TTD' => '749926:157', 'TWD' => '750083:146', 'TZS' => '750229:131', 'UAH' => '750360:86', 'UGX' => '750446:143', 'USD ' => '750589:47', 'USD' => '750636:95', 'UYU' => '750731:143', 'UZS' => '750874:142', 'VEF' => '751016:150', 'VND' => '751166:136', 'VUV ' => '751302:59', 'VUV' => '751361:82', 'WST' => '751443:140', 'XAF' => '751583:154', 'XCD' => '751737:155', 'XOF' => '751892:162', 'XPF ' => '752054:51', 'XPF' => '752105:86', 'YER ' => '752191:66', 'YER' => '752257:83', 'ZAR' => '752340:134', 'ZMK ' => '752474:66', 'ZMK' => '752540:85', ), 'labels/date' => array ( 'day' => '752625:109', 'days_ago' => '752734:122', 'elapsed_1day' => '752856:135', 'elapsed_1hour' => '752991:140', 'elapsed_1minute' => '753131:144', 'elapsed_1month' => '753275:140', 'elapsed_1year' => '753415:139', 'elapsed_days' => '753554:162', 'elapsed_hours' => '753716:164', 'elapsed_minutes' => '753880:168', 'elapsed_months' => '754048:165', 'elapsed_now' => '754213:129', 'elapsed_years' => '754342:163', 'formated' => '754505:197', 'hour' => '754702:113', 'hours' => '754815:113', 'hours_ago' => '754928:124', 'minutes' => '755052:117', 'minutes_ago' => '755169:129', 'month' => '755298:111', 'month_short1' => '755409:109', 'month_short10' => '755518:109', 'month_short11' => '755627:109', 'month_short12' => '755736:109', 'month_short2' => '755845:109', 'month_short3' => '755954:109', 'month_short4' => '756063:109', 'month_short5' => '756172:109', 'month_short6' => '756281:109', 'month_short7' => '756390:109', 'month_short8' => '756499:109', 'month_short9' => '756608:109', 'month1' => '756717:117', 'month10' => '756834:117', 'month11' => '756951:119', 'month12' => '757070:119', 'month2' => '757189:120', 'month3' => '757309:113', 'month4' => '757422:113', 'month5' => '757535:110', 'month6' => '757645:112', 'month7' => '757757:112', 'month8' => '757869:115', 'month9' => '757984:120', 'seconds' => '758104:118', 'weekShort1' => '758222:109', 'weekShort2' => '758331:109', 'weekShort3' => '758440:109', 'weekShort4' => '758549:109', 'weekShort5' => '758658:109', 'weekShort6' => '758767:109', 'weekShort7' => '758876:109', 'year' => '758985:110', 'yesterday' => '759095:117', ), 'labels/field' => array ( 'address' => '759212:118', 'address_city' => '759330:113', 'address_complement' => '759443:126', 'address_country' => '759569:114', 'address_district' => '759683:117', 'address_number' => '759800:115', 'address_postal_code' => '759915:118', 'address_state' => '760033:114', 'address_street' => '760147:112', 'captcha_donotfill' => '760259:149', 'cart_add' => '760408:137', 'cart_add_bag' => '760545:133', 'cart_go' => '760678:125', 'cart_item' => '760803:111', 'cart_items' => '760914:113', 'categories' => '761027:133', 'comment' => '761160:121', 'content' => '761281:118', 'description' => '761399:124', 'folder' => '761523:122', 'hits' => '761645:122', 'info_by' => '761767:108', 'info_posted' => '761875:123', 'info_updated' => '761998:128', 'keywords' => '762126:134', 'location' => '762260:116', 'location_at' => '762376:122', 'media_add_audio' => '762498:128', 'media_add_file' => '762626:129', 'media_add_video' => '762755:128', 'media_continuous_play' => '762883:142', 'media_downloads' => '763025:121', 'media_plays' => '763146:120', 'phone' => '763266:124', 'phone_area' => '763390:124', 'phone_country' => '763514:122', 'phone_number' => '763636:123', 'title' => '763759:122', 'user_identifier' => '763881:136', 'user_password' => '764017:116', 'user_repeat_password' => '764133:133', ), 'labels/lang' => array ( 'aa' => '764266:133', 'ab' => '764399:150', 'ae' => '764549:143', 'af' => '764692:150', 'ak' => '764842:134', 'am' => '764976:149', 'an' => '765125:148', 'ar' => '765273:148', 'as' => '765421:159', 'av' => '765580:143', 'ay' => '765723:139', 'az' => '765862:157', 'ba' => '766019:150', 'be' => '766169:165', 'bg' => '766334:157', 'bh' => '766491:156', 'bi' => '766647:144', 'bm' => '766791:147', 'bn' => '766938:151', 'bo' => '767089:158', 'br' => '767247:143', 'bs' => '767390:143', 'ca' => '767533:143', 'ce' => '767676:151', 'ch' => '767827:144', 'co' => '767971:139', 'cr' => '768110:145', 'cs' => '768255:138', 'cu' => '768393:181', 'cv' => '768574:148', 'cy' => '768722:139', 'da' => '768861:145', 'de' => '769006:141', 'dv' => '769147:158', 'dz' => '769305:151', 'ee' => '769456:135', 'el' => '769591:149', 'en' => '769740:116', 'eo' => '769856:148', 'es' => '770004:144', 'et' => '770148:143', 'eu' => '770291:139', 'fa' => '770430:144', 'ff' => '770574:138', 'fi' => '770712:144', 'fj' => '770856:152', 'fo' => '771008:144', 'fr' => '771152:144', 'fy' => '771296:140', 'ga' => '771436:142', 'gd' => '771578:154', 'gl' => '771732:141', 'gn' => '771873:146', 'gu' => '772019:159', 'gv' => '772178:136', 'ha' => '772314:148', 'he' => '772462:152', 'hi' => '772614:151', 'ho' => '772765:148', 'hr' => '772913:143', 'ht' => '773056:169', 'hu' => '773225:144', 'hy' => '773369:152', 'hz' => '773521:145', 'ia' => '773666:158', 'id' => '773824:160', 'ie' => '773984:158', 'ig' => '774142:132', 'ii' => '774274:149', 'ik' => '774423:143', 'in' => '774566:123', 'io' => '774689:130', 'is' => '774819:148', 'it' => '774967:144', 'iu' => '775111:158', 'iw' => '775269:117', 'ja' => '775386:146', 'ji' => '775532:76', 'jv' => '775608:146', 'ka' => '775754:160', 'kg' => '775914:138', 'ki' => '776052:142', 'kj' => '776194:150', 'kk' => '776344:149', 'kl' => '776493:158', 'km' => '776651:159', 'kn' => '776810:151', 'ko' => '776961:143', 'kr' => '777104:139', 'ks' => '777243:176', 'ku' => '777419:151', 'kv' => '777570:137', 'kw' => '777707:143', 'ky' => '777850:153', 'la' => '778003:137', 'lb' => '778140:165', 'lg' => '778305:140', 'li' => '778445:153', 'ln' => '778598:142', 'lo' => '778740:141', 'lt' => '778881:148', 'lu' => '779029:160', 'lv' => '779189:143', 'mg' => '779332:152', 'mh' => '779484:162', 'mi' => '779646:145', 'mk' => '779791:164', 'ml' => '779955:158', 'mn' => '780113:149', 'mo' => '780262:162', 'mr' => '780424:150', 'ms' => '780574:175', 'mt' => '780749:144', 'my' => '780893:159', 'na' => '781052:151', 'nb' => '781203:165', 'nd' => '781368:159', 'ne' => '781527:154', 'ng' => '781681:145', 'nl' => '781826:146', 'nn' => '781972:169', 'no' => '782141:146', 'nr' => '782287:161', 'nv' => '782448:146', 'ny' => '782594:146', 'oc' => '782740:143', 'oj' => '782883:151', 'om' => '783034:137', 'or' => '783171:147', 'os' => '783318:147', 'pa' => '783465:154', 'pi' => '783619:143', 'pl' => '783762:141', 'ps' => '783903:141', 'pt' => '784044:123', 'qu' => '784167:145', 'rm' => '784312:156', 'rn' => '784468:138', 'ro' => '784606:143', 'ru' => '784749:148', 'rw' => '784897:158', 'sa' => '785055:162', 'sc' => '785217:140', 'sd' => '785357:148', 'se' => '785505:161', 'sg' => '785666:138', 'si' => '785804:155', 'sk' => '785959:147', 'sl' => '786106:152', 'sm' => '786258:147', 'sn' => '786405:139', 'so' => '786544:144', 'sq' => '786688:142', 'sr' => '786830:148', 'ss' => '786978:139', 'st' => '787117:155', 'su' => '787272:150', 'sv' => '787422:140', 'sw' => '787562:144', 'ta' => '787706:148', 'te' => '787854:152', 'tg' => '788006:146', 'th' => '788152:158', 'ti' => '788310:151', 'tk' => '788461:152', 'tl' => '788613:141', 'tn' => '788754:141', 'to' => '788895:146', 'tr' => '789041:141', 'ts' => '789182:139', 'tt' => '789321:142', 'tw' => '789463:130', 'ty' => '789593:148', 'ug' => '789741:147', 'uk' => '789888:160', 'ur' => '790048:137', 'uz' => '790185:144', 've' => '790329:138', 'vi' => '790467:158', 'vo' => '790625:146', 'wa' => '790771:139', 'wo' => '790910:136', 'xh' => '791046:136', 'yi' => '791182:149', 'yo' => '791331:142', 'za' => '791473:146', 'zh' => '791619:158', 'zu' => '791777:133', ), 'labels/layout' => array ( 'assistant_close' => '791910:279', 'assistant_open' => '792189:181', 'editor_flag_green' => '792370:184', 'editor_flag_red' => '792554:191', 'first' => '792745:124', 'last' => '792869:121', 'menu' => '792990:135', 'menu_access' => '793125:151', 'menu_colapse' => '793276:146', 'menu_colapsed' => '793422:128', 'menu_opened' => '793550:126', 'next' => '793676:122', 'panel_left_close' => '793798:151', 'panel_left_open' => '793949:153', 'panel_right_close' => '794102:151', 'panel_right_open' => '794253:153', 'previous' => '794406:127', 'spotlight_end' => '794533:157', 'spotlight_start' => '794690:143', 'tabs' => '794833:119', 'tip_for' => '794952:127', 'top' => '795079:118', ), 'labels/status' => array ( 700 => '795197:116', 720 => '795313:117', 721 => '795430:111', 730 => '795541:118', ), 'layouts' => array ( 'audio_player' => '795659:1839', 'default' => '797498:1194', 'dialog' => '798692:184', 'dialog_basic' => '798876:222', 'dialog_cancel' => '799098:199', 'dialog_close' => '799297:413', 'dialog_select' => '799710:1556', 'dialog_tabs' => '801266:3561', ), 'lists' => array ( 'box' => '804827:311', 'default' => '805138:541', 'details' => '805679:42', 'formulary' => '805721:38', 'html' => '805759:31', 'layered' => '805790:415', 'menu_simple_vertical' => '806205:215', 'table' => '806420:191', 'table_simple' => '806611:184', ), 'modules' => array ( 'audio' => '806795:220', 'banner' => '807015:370', 'box' => '807385:350', 'breadcrumbs' => '807735:317', 'card' => '808052:170', 'cart' => '808222:289', 'comments' => '808511:272', 'comments_add' => '808783:250', 'content' => '809033:231', 'dinamic_blog' => '809264:398', 'dinamic_events' => '809662:384', 'dinamic_galery' => '810046:485', 'dinamic_news' => '810531:357', 'dinamic_podcast' => '810888:406', 'dinamic_products' => '811294:348', 'dinamic_recents' => '811642:408', 'dinamic_videocast' => '812050:835', 'file' => '812885:419', 'footer' => '813304:448', 'formulary' => '813752:210', 'formulary_edit' => '813962:226', 'formulary_system' => '814188:171', 'formulary_view' => '814359:178', 'grid' => '814537:271', 'hits' => '814808:284', 'html' => '815092:195', 'img' => '815287:307', 'languages' => '815594:471', 'list' => '816065:205', 'list_blog' => '816270:242', 'list_card' => '816512:101', 'list_events' => '816613:293', 'list_folder' => '816906:205', 'list_formulary' => '817111:544', 'list_galery' => '817655:370', 'list_glossary' => '818025:216', 'list_info_administrators' => '818241:237', 'list_news' => '818478:249', 'list_podcast' => '818727:243', 'list_products' => '818970:237', 'list_related' => '819207:213', 'list_search_results' => '819420:232', 'list_system' => '819652:103', 'list_videocast' => '819755:767', 'login' => '820522:252', 'navbar' => '820774:643', 'navbottom' => '821417:613', 'navmain' => '822030:449', 'pages' => '822479:337', 'pages_post' => '822816:350', 'post_blog' => '823166:126', 'post_events' => '823292:156', 'post_galery' => '823448:96', 'post_news' => '823544:133', 'post_podcast' => '823677:148', 'post_products' => '823825:121', 'post_videocast' => '823946:141', 'radiolegal' => '824087:304', 'related' => '824391:255', 'search' => '824646:203', 'search_options' => '824849:171', 'sort_blog' => '825020:175', 'system_menu' => '825195:204', 'title' => '825399:226', 'video' => '825625:299', ), 'palettes' => array ( 'default' => '825924:1245', 'white' => '827169:1136', ), 'scripts' => array ( 'empty' => '828305:131', ), 'styles' => array ( 'default' => '828436:56782', 'print' => '885218:1247', ), 'templates' => array ( 'default' => '886465:245', ), 'themes' => array ( 'default' => '886710:183', ), ), 'f' => array ( 'icons' => array ( 'blank.gif' => '886893:68', 'ecolabore-flower.svg' => '886961:1270', 'ecolabore-humperstilshen-alert.png' => '888231:18219', 'ecolabore-humperstilshen-crash.png' => '906450:11061', 'ecolabore-humperstilshen-default.png' => '917511:10383', 'ecolabore-humperstilshen-error.png' => '927894:9283', 'ecolabore-humperstilshen-happy.png' => '937177:9594', 'ecolabore-humperstilshen-question.png' => '946771:10254', 'ecolabore-humperstilshen-tip.png' => '957025:8695', 'ecolabore-humperstilshen-welcome.png' => '965720:10383', 'ecolabore-humperstilshen-whait.png' => '976103:12007', 'hamburger.svg' => '988110:272', 'help64.gif' => '988382:2540', ), 'scripts/ecolabore-humperstilshen' => array ( 'dialog.__properties__.js' => '990922:55', 'dialog.actionCloseAll().js' => '990977:145', 'dialog.eventLoad().js' => '991122:172', 'dialog.eventOpen(id).js' => '991294:254', 'dropdown.__properties__.js' => '991548:61', 'dropdown.eventLoad().js' => '991609:180', 'dropdown.eventOpen(id).js' => '991789:260', 'interface.__properties__.js' => '992049:96', 'interface.actions.dropdownCloseAll().js' => '992145:246', ), 'scripts' => array ( 'ecolabore-humperstilshen.js' => '992391:8447', ), 'styles' => array ( 'ecolabore-basics.css' => '1000838:23429', 'ecolabore-print.css' => '1024267:909', ), ), ); //!packager:end_of_data_index //!file:engine/eclClass/eclClass_app.php; class eclClass_app { // class eclClass_app // const name = 'name'; -> the folder for the application // const menuType = 'section'; -> 'section', 'hidden', 'post', 'domain' // const dataFrom = ''; -> the name of the control to generate the content // const map = 'myModule_create myModule_edit myModule_config'; -> a space separated applications names // const access = 0; -> 0=all 1=connected 2=subscribed 3=member 4=owner or admin // const isDomain = false; -> true creates a subgroup of pages to navigate // const ignoreSubfolders = false; -> true ignore all childrens on the url 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 static function view ($fieldName, $control, $formulary) { // function view } // function view static function scope ($render, $arguments) { // function scope return array (); } // function scope static function target ($document, $value, $arguments) { // function target global $store; } // function target static function column ($document, $data, $name, $field, $url) { // function column return array ('caption' => $document->textMerge ('-')); } // function column } // class eclClass_filter //!eof:engine/eclClass/eclClass_filter.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, $arguments) { // 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; public $name; public $parent; public $pathway; public $groups; public $access; public $map = array (); public $data = array (); public $id = 0; public $domainId = 0; public $userId = 0; public $ignoreSubfolders = false; public $isDomain = false; public $menuType = 'hidden'; private $childrenByName = array (); private $children = false; public function __construct ($applicationName='system', $name='system', $parent=false, $document=false) { // function __construct global $store; $this->applicationName = $applicationName; $this->name = $name; $this->parent = $parent; if ($parent) { // inherit parent properties $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; } // inherit parent properties $class = 'eclApp_' . $applicationName; if (defined ($class . '::ignoreSubfolders')) $this->ignoreSubfolders = $class::ignoreSubfolders; if (defined ($class . '::dataFrom')) $this->data = $store->control->read ($class::dataFrom); if (defined ($class . '::map')) $this->map = explode (' ', $class::map); if (defined ($class . '::access') and $class::access > $this->access) $this->access = $class::access; if (defined ($class . '::isDomain')) $this->isDomain = $class::isDomain; // menu if (defined ($class . '::menuType')) $this->menuType = $class::menuType; elseif (is_callable (array ($class, 'get_menu_type'))) $this->menuType = $class::get_menu_type ($this, $document); // Chama a classe de aplicação para auxiliar na construção if (is_callable (array ($class, 'constructor_helper'))) $class::constructor_helper ($this, $document); } // function __construct public function getMap ($applicationName=false) { // function getMap global $mapPrepend, $map, $mapAppend; static $openedMaps = array (); if ($applicationName == false) $applicationName = $this->applicationName; if (isset ($openedMaps[$applicationName])) return $this->map = $openedMaps[$applicationName]; $openedMaps[$applicationName] = array (); if (SYSTEM_IS_PACKED) { // internal map if (isset ($mapPrepend[$applicationName])) $openedMaps[$applicationName] = $mapPrepend[$applicationName]; if (isset ($map[$applicationName])) $openedMaps[$applicationName] = array_merge ($openedMaps[$applicationName], $map[$applicationName]); if (isset ($mapAppend[$applicationName])) $openedMaps[$applicationName] = array_merge ($openedMaps[$applicationName], $mapAppend[$applicationName]); $this->map = $openedMaps[$applicationName]; return; } // internal map $result = array (); list ($prefix) = explode ('_', $applicationName, 2); $file = FOLDER_LIBRARY . $prefix . '/app_' . $applicationName . '_prepend.txt'; if (is_file ($file)) { // open file foreach (explode (LF, file_get_contents ($file)) as $line) { // each line $line = trim ($line); if (preg_match ('%^[a-zA-Z0-9_]+$%', $line)) $result[] = $line; } // each line } // open file if (isset ($map[$applicationName])) $result = array_merge ($result, $map[$applicationName]); $file = FOLDER_LIBRARY . $prefix . '/app_' . $applicationName . '_append.txt'; if (is_file ($file)) { // open file foreach (explode (LF, file_get_contents ($file)) as $line) { // each line $line = trim ($line); if (preg_match ('%^[a-zA-Z0-9_]+$%', $line)) $result[] = $line; } // each line } // open file $openedMaps[$applicationName] = $result; $this->map = $openedMaps[$applicationName]; } // function getMap public function child ($name, $document=false) { // function child if (isset ($this->childrenByName[$name])) return $this->childrenByName[$name]; // Será que os filhos já foram todos abertos? if ($this->children !== false) return false; // Vamos percorrer o mapa, testando cada aplicação foreach ($this->map as $applicationName) { // each application $class = 'eclApp_' . $applicationName; if ( (defined ($class . '::name') and $name == $class::name) or (is_callable (array ($class, 'is_child')) and $class::is_child ($this, $name, $document))) { // child found $this->childrenByName[$name] = new eclEngine_application ($applicationName, $name, $this, $document); return $this->childrenByName[$name]; } // child found } // each application // Não existe um filho com este nome return false; } // function child public function children ($document=false) { // function children if (!is_array ($this->children)) { // open children $this->children = array (); foreach ($this->map as $applicationName) { // each application $class = 'eclApp_' . $applicationName; $names = array (); if (defined ($class . '::name')) $names[] = $class::name; elseif (is_callable (array ($class, 'get_children_names'))) $names = $class::get_children_names ($this, $document); 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, $document); // Vamos copiá-lo para a lista em ordem de índice $this->children[] = $this->childrenByName[$name]; } // each name } // each application } // open children return $this->children; } // function children public function menuChildren ($document, $name=false) { // function menuChildren $menu = array (); if (!is_array ($this->children)) { // open children foreach ($this->map as $applicationName) { // each application $class = 'eclApp_' . $applicationName; $menuType = 'hidden'; if (defined ($class . '::menuType')) $menuType = $class::menuType; elseif (is_callable (array ($class, 'get_menu_type'))) $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 (); if (defined ($class . '::name')) $names[] = $class::name; elseif (is_callable (array ($class, 'get_children_names'))) $names = $class::get_children_names ($this, $document); 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->children = false; $this->childrenByName = array (); } // function reset public function dispatch ($document) { // function dispatch $document->data = array_replace_recursive (array ('flags' => $this->flags ()), $this->data); $class = 'eclApp_' . $this->applicationName; if (is_callable (array ($class, 'dispatch'))) $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 flags () { // function flags if (is_object ($this->parent)) $flags = $this->parent->flags (); else $flags = array (); // Agora vamos fundir com as flags deste objeto - se houverem if (isset ($this->data['flags'])) $flags = array_replace ($flags, $this->data['flags']); return $flags; } // function flags 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 public function findModuleTarget ($document, &$arguments) { // function findModuleTarget if (!$document->domain->domainId) return false; if (!isset ($arguments[0])) { // no arguments $arguments = array (false, '0'); return $document->application; } // no arguments if (is_numeric ($arguments[0])) { // numeric $arguments[1] = $arguments[0]; return $document->application; } // numeric if (!isset ($arguments[1]) or !is_numeric ($arguments[1])) $arguments[1] = '0'; $name = $arguments[0]; if (isset ($document->application->data['name']) and $name == $document->application->data['name']) return $document->application; if ($name == '-index') return $document->domain->child (''); if ($name == '-recents') return $document->domain->child ('-recents'); $me = $document->application->findChild ($name); if (!$me or !$document->access ($me->access, $me->groups)) return false; return $me; } // function findModuleTarget public function ignoreSession ($set=123) { // function ignoreSession static $ignore = false; if ($set != 123) $ignore = $set; return $ignore; } // function ignoreSession } // 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 $beta = ''; 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; // bool true if the user can edit template modules public $contentEditable = false; // bool true if the online visual editor is enable public $printableLayout = false; // bool true advises modules that the user wish to print the document public $reload = false; // false or an url string to redirect the browser public $preload = array (); // array eclEngine_application => an array with the applications to be dispatched before the main application public function __construct () { // function __construct global $system; $this->render = new eclEngine_render ($this); $this->mod = new eclEngine_mod ($this); $this->user = $system->child (SYSTEM_PROFILES_URI)->child ('-anonimous'); $this->subscription = $system->child (SYSTEM_PROFILES_URI)->child ('-anonimous'); } // function __construct public function __clone () { // function __clone $this->actions = array (); // array => the actions from url $this->received = array (); // array => the posted data from formularies unset ($this->session); $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->beta = $request->beta; $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 systemDefault 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 ($ignore=false) { // function sessionStart global $io, $store, $system; if ($ignore) return; $this->session = &$io->session->cache; if (!defined ('ADMIN_IDENTIFIER') or !defined ('ADMIN_PASSWORD')) return; if (isset ($this->actions['logout'])) { // logout $this->session = array (); unset ($this->actions['logout']); return; } // logout if (isset ($this->actions['login'])) { // login $instance = isset ($this->actions['login'][1]) ? $this->actions['login'][1] : '1'; $name = isset ($this->received['login' . $instance . 'fields_name']) ? strtolower ($this->received['login' . $instance . 'fields_name']) : ''; $password = isset ($this->received['login' . $instance . 'fields_password']) ? strtolower ($this->received['login' . $instance . 'fields_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 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->actions['session'][1])) { // check session while (@ob_end_clean ()); if ($this->actions['session'][1] == 'check') { // check remaining time if (!isset ($this->session['time'])) print '0'; elseif (TIME - $this->session['time'] > SYSTEM_SESSION_TTL) print '0'; else print SYSTEM_SESSION_TTL - (TIME - $this->session['time']); exit; } // check remaining time $this->session['time'] = TIME; $io->close (); print SYSTEM_SESSION_TTL; exit; } // check session if (isset ($this->session['user_name'][0])) { // connected $this->user = $system->child (SYSTEM_PROFILES_URI)->child ($this->session['user_name']); if ($subscription = $store->domainContent->getUserSubscription ($this)) $this->subscription = $subscription; if (!isset ($this->session['time'])) { // first load $this->session['time'] = TIME; $this->preload[] = $this->user->child ('-welcome'); } // first load else { // else load $this->session['time'] = TIME; } // else load } // connected if (isset ($this->actions['session'])) { // keep connected $io->close (); print 'fail'; exit; } // keep 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['preload']) and count ($this->actions['preload']) > 1) { // preload 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; } // preload 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->url (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'); // Moeda corrente if (isset ($this->data['flags']['currency'])) $this->data['currency'] = $this->data['flags']['currency']; else $this->data['currency'] = SYSTEM_DEFAULT_CURRENCY; // Nome e código da moeda corrente $currency = $store->control->read ('labels/currency/' . $this->data['currency']); if (isset ($currency['text']['caption'])) $this->data['currency_caption'] = $currency['text']['caption']; else $this->data['currency_caption'] = $this->textMerge ($this->data['currency']); if (isset ($currency['local']['symbol'])) $this->data['currency_symbol'] = $currency['local']['symbol']; else $this->data['currency_symbol'] = $this->data['currency']; // Folha de estilo if (isset ($this->data['flags']['modLayout_sharedStyle'])) { // set shared references $this->data['url_styles'] = $this->urlFiles ($this->data['flags']['modLayout_sharedStyle'], true, '-shared'); $this->data['url_scripts'] = $this->urlFiles ($this->data['flags']['modLayout_sharedScript'], true, '-shared'); } // set shared references else { // define paths $template = $store->domainExtras->openChild ($this->domain->domainId, MODE_TEMPLATE, 0, 'templates/default'); if (isset ($template['updated'])) { // updated $date = TIME; $this->data['url_styles'] = $this->url (array ($this->domain->name, '-styles', 'ecolabore-generated-template-' . $date . '.css'), false); $this->data['url_icons'] = $this->url (array ($this->domain->name, '-icons', 'ecolabore-icons-' . $date . '.svg'), false); $this->data['url_scripts'] = $this->url (array ($this->domain->name, '-scripts', 'ecolabore-scripts-' . $date . '.js'), false); } // updated else { // static $this->data['url_styles'] = $this->url (array ($this->domain->name, '-styles', 'ecolabore-generated-template.css'), false); $this->data['url_icons'] = $this->url (array ($this->domain->name, '-icons', 'ecolabore-icons.svg'), false); $this->data['url_scripts'] = $this->url (array ($this->domain->name, '-scripts', 'ecolabore-scripts.js'), false); } // static } // define paths // 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 if ($this->contentEditable) $this->data['editor_is_enabled'] = 1; // Renderiza o documento if ($this->printableLayout) $documentBase = $store->control->read ('base/print'); elseif (isset ($this->data['flags']['modLayout_base']) and $store->control->read ('base/' . $this->data['flags']['modLayout_base'])) $documentBase = $store->control->read ('base/' . $this->data['flags']['modLayout_base']); else $documentBase = $store->control->read ('base/responsive'); 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']); // Cola os recortes $this->renderCuts (); // Recolhe o documento pronto $this->buffer = $this->render->buffer; } // function render private function renderCuts () { // function renderCuts $render = $this->render; if (isset ($render->cuts['style'])) $render->cuts['style'] = $render->tags['style_open'] . CRLF . $render->cuts['style'] . $render->tags['style_close'] . CRLF; if (isset ($render->cuts['script']) or isset ($render->cuts['footerscript'])) { // script if (isset ($render->cuts['script'])) $render->cuts['script'] = $render->tags['script_open'] . CRLF . $render->cuts['script']; else $render->cuts['script'] = $render->tags['script_open'] . CRLF; if (isset ($render->cuts['footerscript'])) $render->cuts['script'] .= $render->cuts['footerscript']; $render->cuts['script'] .= $render->tags['script_close'] . CRLF; } // script 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 renderCuts public function access ($level, $groups=false) { // function access if (!$level) return true; if (!defined ('ADMIN_IDENTIFIER')) return false; if (!$this->user->userId and $this->user->name != ADMIN_IDENTIFIER) return false; if ($level == 1) 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 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 createFormulary ($controlName=false, $data=false, $prefix='edit') { // function createFormulary return new eclEngine_formulary ($this, $controlName, $data, $prefix); } // function createFormulary public function createListItem ($data=false, $local=array ()) { // function createListItem return new eclEngine_listItem ($this, $data, $local); } // function createListItem public function createMail () { // function createMail return new eclIo_smtp (); } // function createMail 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 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 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 $lang = key ($field); $content = current ($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 textRender ($field) { // function textRender $render = $this->render; $buffer = $render->buffer; $render->buffer = ''; $render->render ($this->selectLanguage ($field)); $result = $render->buffer; $render->buffer = $buffer; return $result; } // function textRender 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 url ($pathway=true, $lang=true, $actions=true, $protocol=true) { // function url 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 or $pathway[0] == '-default') 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) $url = $protocol . $this->beta . SYSTEM_HOST . '/'; else $url = $protocol . $this->beta . $domain . '.' . SYSTEM_HOST . '/'; if (!$this->rewriteEngine) { // add script name if (!$pathway) { // empty if (SYSTEM_SCRIPT_NAME == 'index.php') return $url; else return $url . SYSTEM_SCRIPT_NAME; } // empty $url .= SYSTEM_SCRIPT_NAME . '?url='; } // add script name if ($pathway) $url .= implode ('/', $pathway); return $url; } // virtual hosts enabled $url = $protocol . $this->host; if (!$this->rewriteEngine) { // add script name if (!$pathway) { // empty if (SYSTEM_SCRIPT_NAME == 'index.php') return $url; else return $url . SYSTEM_SCRIPT_NAME; } // empty $url .= SYSTEM_SCRIPT_NAME . '?url='; } // add script name $url .= implode ('/', $pathway); return $url; } // function url public function urlFiles ($file, $domain=true, $special='-files') { // function urlFiles if (is_bool ($domain)) $domain = $this->domain->name; if (SYSTEM_HOSTING_MODE == 2) { // virtual hosts enabled if ($domain == SYSTEM_DEFAULT_DOMAIN_NAME) $url = $this->protocol . '://' . $this->beta . SYSTEM_HOST . '/'; else $url = $this->protocol . '://' . $this->beta . $domain . '.' . SYSTEM_HOST . '/'; if (!$this->rewriteEngine) $url .= SYSTEM_SCRIPT_NAME . '?url='; $url .= $special . '/' . $file; return $url; } // virtual hosts enabled $url = $this->protocol . '://' . $this->host; if (!$this->rewriteEngine) $url .= SYSTEM_SCRIPT_NAME . '?url='; if (SYSTEM_HOSTING_MODE == 0) return $url . $special . '/' . $file; return $url . $domain . '/' . $special . '/' . $file; } // function urlFiles } // 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 $application; 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->application = $document->application; $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 if (is_array ($controlName)) $this->control = $controlName; else $this->control = $store->control->read ($controlName); if (isset ($this->control['flags'])) $this->flags = array_replace ($this->flags, $this->control['flags']); if (isset ($this->flags['prefix'])) $this->prefix = $this->flags['prefix']; if (isset ($this->flags['action'])) $this->action = $this->flags['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']['base_target'])) $this->baseTarget = $this->control['flags']['base_target']; else $this->baseTarget = ''; if (isset ($this->control['flags']['base_name'])) $this->baseName = $this->control['flags']['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 = 'system_form' . $name; $control = $store->control->read ($name); } // open control elseif (is_array ($name) and isset ($name['flags']['field_name'])) { // embed control $control = $name; $name = $control['flags']['field_name']; } // embed control else continue; // condition if (isset ($control['flags']['condition']) and !$this->condition ($control['flags']['condition'])) continue; // display field if (isset ($control['flags']['field_display']) and !$this->condition ($control['flags']['field_display'])) continue; // field name if (isset ($control['flags']['field_name'])) $fieldName = $this->prefix . $this->baseName . $control['flags']['field_name']; else $fieldName = $this->prefix . $this->baseName . $name; // required if (isset ($control['flags']['required'])) { // required $this->required = true; $control['required'] = 1; } // required // help if (isset ($control['flags']['help'])) $control['help'] = 1; // filter if (isset ($control['flags']['filter'])) { // use filter if (preg_match ('%^[a-z][a-zA-Z0-9_]*$%', $control['flags']['filter'])) { // valid filter name $filter = 'eclFilter_' . $control['flags']['filter']; if (isset ($control['flags']['view'])) $item = $filter::view ($fieldName, $control, $this); else $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']['type'])) $type = $control['flags']['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']['field_name'])) { // embed control $control = $name; $name = $control['flags']['field_name']; } // embed control else continue; if (!isset ($control['flags']['filter'])) continue; if (!preg_match ('%^[a-z][a-zA-Z0-9_]*$%', $control['flags']['filter'])) continue; if (isset ($control['flags']['condition']) and !$this->condition ($control['flags']['condition'])) continue; if (isset ($control['flags']['posteriori']) and $posteriori == 1) continue; if (!isset ($control['flags']['posteriori']) and $posteriori == 2) continue; if (isset ($control['flags']['view'])) continue; if (isset ($control['flags']['field_name'])) $fieldName = $this->prefix . $this->baseName . $control['flags']['field_name']; else $fieldName = $this->prefix . $this->baseName . $name; $filter = 'eclFilter_' . $control['flags']['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']['condition']) or $this->condition ($control['flags']['condition'])) and isset ($control['flags']['target'])) { // valid condition $target = $control['flags']['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['icon']); if (isset ($local['error_msg'])) $local['msg'] = $local['error_msg']; elseif ($msg !== false) $local['msg'] = $msg; else $local['msg'] = 'system_msg_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['icon']); if (isset ($local['required_msg'])) $local['msg'] = $local['required_msg']; elseif ($msg !== false) $local['msg'] = $msg; else $local['msg'] = 'system_msg_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; $document = $this->document; if (isset ($this->flags['modFormulary_preset'])) $template = 'formulary_' . $this->flags['modFormulary_preset']; elseif ($document->application->isDomain) $template = 'formulary_system'; else $template = 'formulary'; $mod->data = $document->render->block ('modules/' . $template); $mod->childrenMerge ($this->create ()); if (!$mod->children) return; 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->data['local']['list'] = 'formulary'; // Se o módulo pode ser editado if (!$document->application->isDomain and $document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', $template); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modFormulary_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclEngine_formulary //!eof:engine/eclEngine/eclEngine_formulary.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' or $name == 'request') continue; if (!isset ($driver->isPhantom)) $driver->close (); } // close each driver // log é o penúltimo a ser fechado $this->log->close (); $this->buffer = $this->log->buffer; $this->request->close (); } // 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 $me = false; 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)) { // from object $this->data = $from->data; if (get_class ($from) == 'eclEngine_application') $this->me = $from; } // from object 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 url ($pathway=true, $lang=true, $action=true, $protocol=true) { // function url if ($pathway === true) { // get pathway if (isset ($this->me->pathway)) $pathway = $this->me->pathway; else $pathway = $this->document->application->pathway; } // get pathway $this->data['pathway'] = $pathway; $this->data['url'] = $this->document->url ($pathway, $lang, $action, $protocol); return $this; } // function url public function appendFolder ($folder) { // function appendFolder if (!isset ($this->data['pathway'])) { // set pathway if (isset ($this->me->pathway)) $this->data['pathway'] = $this->me->pathway; else $this->data['pathway'] = $this->document->application->pathway; } // set pathway $this->data['pathway'][] = $folder; $this->data['url'] = $this->document->url ($this->data['pathway']); return $this; } // function appendFolder public function confirm ($name, $formulary=false) { // function confirm if (!isset ($this->data['url'])) $this->data['url'] = $this->document->mod->humperstilshen->dialog ($name, array ('url' => $this->document->url ()), $formulary); else $this->data['url'] = $this->document->mod->humperstilshen->dialog ($name, array ('url' => $this->data['url']), $formulary); return $this; } // function confirm public function popUpOpen ($width=410, $height=600) { // function popUpOpen if (!isset ($this->data['url'])) $this->data['url'] = $this->document->url (); $this->data['url'] = "javaScript:humperstilshen.popUpOpen('" . $this->data['url'] . "', " . $width . ", " . $height . ")"; return $this; } // function popUpOpen public function dialog ($data) { // function dialog $this->data['url'] = $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 public function sort ($sortBy="created", $sortDirection="asc") { // function sort if (!$this->children) return; $sorted = array (); $unsorted = array (); foreach ($this->children as $child) { // each child if (isset ($child->data[$sortBy])) $sorted[$child->data[$sortBy]][] = $child; else $unsorted[] = $child; } // each child if ($sortDirection == "asc") ksort ($sorted); else krsort ($sorted); $sorted[] = $unsorted; $result = array (); foreach ($sorted as $group) { // each group foreach ($group as $child) { // each child $result[] = $child; } // each child } // each group $this->children = $result; return $this; } // function sort } // class eclEngine_listItem //!eof:engine/eclEngine/eclEngine_listItem.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 $me = 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 $cuts = array (); public $cutOnce = array (); public $scissorsIndex = 0; public $scissors = array (); public $pasteIndex = 0; public $pastePointer = array (); public $pasteNames = array (); public $tagsStack = 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['me'])) { // me $a['me'] = $this->me; $this->me = $data['me']; } // me 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['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['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]) { // text format if ($content[TEXT_FORMAT] == 2) { // pre formated text $content[TEXT_CONTENT] = str_replace ($s, $r, $content[TEXT_CONTENT]); $this->text2pre ($content); $this->buffer .= $content[TEXT_CONTENT]; return; } // pre formated text $this->text2html ($content); } // text format if (isset ($content[TEXT_ECOLABORE]) and $content[TEXT_ECOLABORE]) { // render tags $tagsLevel = count ($this->tagsStack); $this->render_tags ($content); for ($i = count ($this->tagsStack) - $tagsLevel; $i > 0; $i--) { // close pending tags $item = end ($this->tagsStack); $class = 'eclTag_end' . $item[0]; $class::render ($this, array ()); } // close pending tags } // render tags 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 text2pre (&$content) { // function text2pre $string = trim ($content[TEXT_CONTENT]); // Converte quebras de linhas Windows para Linux $string = str_replace (CRLF, LF, $string); $string = str_replace (LF, CRLF, $string); $content[TEXT_CONTENT] = $this->tags['pre_open'] . $string . $this->tags['pre_close']; } // function text2pre 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 uma quebra de linha -- modificado v4.01 $paragraph_end = strpos ($string, LF, $paragraph_start); if ($paragraph_end === false) $paragraph_end = $strlen; else $paragraph_end++; // 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 == 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 or $char == 94 or $char == 42) { // : ^ * string $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; if ($char == 94) $name = 'up'; if ($char == 42) $name = 'footnote'; $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 if ($name == 'noparse') { // noparse $offset = strcspn ($_string, ']', $_pointer); $_pointer += $offset + 1; $end = strpos ($_string, '[/noparse', $_pointer); if ($end === false) $end = $_length; $_array[$_level][$_index[$_level]] = array ( 0 => 0, 1 => substr ($_string, $_pointer, $end), 2 => array (), 4 => false ); $_pointer = $end; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_pointer += 9; $_char = ord ($_string[$_pointer]); if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_NEXT_INSTRUCTION; } // noparse $_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: if (!preg_match ('/^[a-z][a-z0-9_]+$/', $current[1])) goto LEVEL_NEXT_INSTRUCTION; $class = 'eclTag_' . $current[1]; $local = $class::render ($this, $arguments); if (!is_array ($local) or !$local) { // empty 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; } // empty if (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'][0])) { // 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); $border = $this->block ('borders/default'); $this->render ($border['html']); $this->levelDown (); goto LEVEL_NEXT_INSTRUCTION; } // switch tag } // switch function name goto LEVEL_NEXT_INSTRUCTION; } // function render_tags_level public function getVar ($name) { // function getVar if ($name[0] == '$') $name = substr ($name, 1); for ($watchDog = 10; $watchDog; $watchDog--) { // loop search value $value = $this->getVarSearch ($name); if (!is_string ($value)) return $value; if (!isset ($value[0])) return $value; if ($value[0] != '$') return $value; $name = substr ($value, 1); } // loop search value } // function getVar private function getVarSearch ($name) { // function getVarSearch global $system; $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 '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]; return ''; case 'system': $me = $system; break; case 'user': case 'subscription': if ($this->document->pathway[0] != SYSTEM_PROFILES_URI or !isset ($document->data['user_data_access_enabled'])) { // prevent access to user data switch ($name) { // switch name case 'caption': case 'title': break; default: return 'Access denied for user data'; } // switch name } // prevent access to user data case 'domain': case 'home': $me = $this->document->$prefix; break; case 'document': $me = $this->document; break; case 'session': if (isset ($this->document->session[$name])) return $this->document->session[$name]; if (isset ($this->document->session['text'][$name])) return $this->document->session['text'][$name]; if (isset ($this->document->session['local'][$name])) return $this->document->session['local'][$name]; return ''; 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 getVarSearch 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 if (preg_match ('/^[a-z][a-z0-9_]*$/', $current[1])) { // valid function $func = 'eclTag_' . $current[1]; $arguments[] = $func::render ($this, $sub); } // valid function } // 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 public function block ($name) { // function block global $store; static $opened = false; if (!strpos ($name, '/')) return array (); if (!$opened and !$this->blocks) { // open $opened = true; if ($this->document->domain->domainId) { // open template $children = $store->domainExtras->children ($this->document->domain->domainId, MODE_TEMPLATE, 0); foreach ($children as $data) { // each block $this->blocks[$data['name']] = $data; } // each block } // open template } // open if (isset ($this->blocks[$name])) return $this->blocks[$name]; return $store->control->read ($name); } // function block public function stackPop ($type) { // function stackPop $exists = false; foreach ($this->tagsStack as $item) { // each stack item if ($item[0] == $type) { // exists $exists = true; break; } // exists } // each item if (!$exists) return false; do { // loop each level $item = end ($this->tagsStack); if ($item[0] == $type) { // found $item = array_pop ($this->tagsStack); return $item[1]; } // found $class = 'eclTag_end' . $item[0]; $class::render ($render, array ()); } // each stack item while (true); } // function stackPop } // 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_amount.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_amount { // class eclFilter_amount static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'text_small'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_msg_filterIntegerHelp'; // target if (isset ($control['flags']['target'])) $value = $formulary->getField ($control['flags']['target']); else $value = false; // default_value if ($value === false and isset ($control['flags']['default_value'])) $value = $control['flags']['default_value']; $local['value'] = $value; if (isset ($control['flags']['min_input'])) $local['min'] = $control['flags']['min_input']; if (isset ($control['flags']['max_input'])) $local['max'] = $control['flags']['max_input']; if (isset ($control['flags']['step'])) $local['step'] = $control['flags']['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']['clear'])) $value = 0; if (isset ($control['flags']['default_value']) and isset ($control['flags']['clear_default_value']) and $value == $control['flags']['default_value']) $value = false; if ($value !== false) { // valid value settype ($value, 'int'); // min_input if (isset ($control['flags']['min_input']) and $value < $control['flags']['min_input']) $value = $control['flags']['min_input']; // max_input if (isset ($control['flags']['max_input']) and $value > $control['flags']['max_input']) $value = $control['flags']['max_input']; } // received value // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_amount //!eof:engine/eclFilter/eclFilter_amount.php; //!file:engine/eclFilter/eclFilter_caption.php; class eclFilter_caption { // class eclFilter_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']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'text'; if (isset ($control['flags']['target']) and $text = $formulary->getField ($control['flags']['target'])) { // get field $lang = $document->lang; $charset = $document->charset; if (isset ($text[$lang])) $found = $text[$lang]; elseif (isset ($control['flags']['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']['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']['target'])) { // set field $current = $formulary->getField ($control['flags']['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']['target'], $current); } // set field } // function save } // class eclFilter_caption //!eof:engine/eclFilter/eclFilter_caption.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']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'checkbox'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_filterCheckboxHelp'; // value $value = 0; if (isset ($control['flags']['target'])) $value = $formulary->getField ($control['flags']['target']); if (isset ($control['flags']['true_value'])) { // predefined value if ($value == $control['flags']['true_value']) $value = 1; else $value = 0; } // predefined value elseif (isset ($control['flags']['false_value'])) { // predefined false value if ($value == $control['flags']['false_value']) $value = 0; else $value = 1; } // predefined false value elseif ($value) $value = 1; else $value = 0; // invert if (isset ($control['flags']['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']['invert'])) $value ? $value = 0 : $value = 1; // clear if (isset ($control['flags']['clear']) and !$value) $value = false; // true value if ($value and isset ($control['flags']['true_value'])) $value = $control['flags']['true_value']; // false value elseif (!$value and isset ($control['flags']['false_value'])) $value = $control['flags']['false_value']; // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_checkbox //!eof:engine/eclFilter/eclFilter_checkbox.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_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']['type'])) $local['type'] = $control['flags']['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 * control_clear */ class eclFilter_free { // class eclFilter_free static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'textarea'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_filterFreeHelp'; // target if (isset ($control['flags']['target'])) $value = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['target'])); else $value = false; // default value if ( ($value === false or $value === '') and isset ($control['flags']['default_value'])) $value = $control['flags']['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']['required'])) return $formulary->setRequiredMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['clear'])) $value = ''; // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_free //!eof:engine/eclFilter/eclFilter_free.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']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'text_small'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_msg_filterIntegerHelp'; // target if (isset ($control['flags']['target'])) $value = $formulary->getField ($control['flags']['target']); else $value = false; // default_value if ($value === false and isset ($control['flags']['default_value'])) $value = $control['flags']['default_value']; $local['value'] = $value; if (isset ($control['flags']['min_input'])) $local['min'] = $control['flags']['min_input']; if (isset ($control['flags']['max_input'])) $local['max'] = $control['flags']['max_input']; if (isset ($control['flags']['step'])) $local['step'] = $control['flags']['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']['clear'])) $value = 0; if (isset ($control['flags']['default_value']) and isset ($control['flags']['clear_default_value']) and $value == $control['flags']['default_value']) $value = false; if ($value !== false) { // valid value settype ($value, 'int'); // min_input if (isset ($control['flags']['min_input']) and $value < $control['flags']['min_input']) $value = $control['flags']['min_input']; // max_input if (isset ($control['flags']['max_input']) and $value > $control['flags']['max_input']) $value = $control['flags']['max_input']; } // received value // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_integer //!eof:engine/eclFilter/eclFilter_integer.php; //!file:engine/eclFilter/eclFilter_keywords.php; /* * Valid control flags * control_filter = keywords */ class eclFilter_keywords { // class eclFilter_keywords 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', 'licence') 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 //!eof:engine/eclFilter/eclFilter_keywords.php; //!file:engine/eclFilter/eclFilter_regexp.php; /* * Valid control flags * control_type = text_small | text | text_tiny | textarea_small | textarea | textarea_big | textarea_full * control_filter = regexp * control_target * control_field_name * control_regexp => an regular expression like /[a-z][a-z0-9_-]+ * control_default_value * control_help * control_help_msg * control_error * control_error_msg * control_required * control_required_msg * control_clear */ class eclFilter_regexp { // class eclFilter_regexp static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'text'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_filterFreeHelp'; // target if (isset ($control['flags']['target'])) $value = $formulary->htmlSpecialChars ($formulary->getField ($control['flags']['target'])); else $value = false; // default value if ( ($value === false or $value === '') and isset ($control['flags']['default_value'])) $value = $control['flags']['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']['required'])) return $formulary->setRequiredMsg ($control, $fieldName); // the regular expression if ($value !== false and isset ($control['flags']['regexp']) and !preg_match ($control['flags']['regexp'], $value)) return $formulary->setErrorMsg ($control, $fieldName); // clear if ($value === false and !isset ($control['flags']['clear'])) $value = ''; // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_regexp //!eof:engine/eclFilter/eclFilter_regexp.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']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'select'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $item->data['help_msg'] = 'system_filterSelectHelp'; // target if (!isset ($control['flags']['target'])) return; $value = $formulary->getField ($control['flags']['target']); // Default value if ($value === false and isset ($control['flags']['default_value'])) $value = $control['flags']['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']['value'])) { // value exists if (isset ($control['flags']['mask_values'])) $child->data['value'] = $counter; else $child->data['value'] = $child->data['flags']['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']['value'])) continue; if (isset ($control['flags']['mask_values'])) { // mask value if ($value == $counter) { // value found $found = $child['flags']['value']; break; } // value found continue; } // mask value if ($child['flags']['value'] === $value) { // value found $found = $value; break; } // value found } // each child } // children exists $value = $found; if ($value === false and isset ($control['flags']['default_value'])) $value = $control['flags']['default_value']; // Clear default value if (isset ($control['flags']['default_value']) and isset ($control['flags']['clear']) and $value === $control['flags']['default_value']) $value = false; // cast if (isset ($control['flags']['cast']) and $control['flags']['cast'] == 'int') settype ($value, 'int'); // clear if (!isset ($control['flags']['default_value']) and isset ($control['flags']['clear']) and !$value) $value = false; if ($value === false and isset ($control['flags']['required'])) { // required field if (isset ($control['flags']['error_msg'])) return $formulary->setRequiredMsg ($control, $fieldName, $control['flags']['error_msg']); return $formulary->setRequiredMsg ($control, $fieldName); } // required field // value cast if ($value !== false and isset ($control['flags']['value_cast']) and $control['flags']['value_cast'] == 'int') $value = intval ($value); // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_select //!eof:engine/eclFilter/eclFilter_select.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['field_name'])) $item->data['name'] = $formulary->flags['field_name']; if (isset ($formulary->flags['action'])) $formulary->action = $formulary->flags['action']; $item->data['url'] = $formulary->document->url ($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 = 'system_form' . $name; $data = $store->control->read ($name); if (!isset ($data['flags']['field_name'])) continue; if (!isset ($data['text']['caption'])) continue; if ($data['flags']['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']['field_name']; $item->appendChild ($data, $local); } // each submit item } // children exists else { // self submit if (isset ($control['flags']['field_name'])) $item->appendChild ($control, array ('name' => $formulary->prefix . 'command_' . $control['flags']['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']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'text'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $item->data['help_msg'] = 'system_filterTextHelp'; // target if (isset ($control['flags']['target']) and $text = $formulary->getField ($control['flags']['target'])) { // get field $text = $formulary->getField ($control['flags']['target']); $lang = $document->lang; $defaultLang = $document->defaultLang; $charset = $document->charset; if (isset ($text[$lang])) $found = $text[$lang]; elseif (isset ($text[$defaultLang])) $found = $text[$defaultLang]; else $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']['target'])) { // set field $current = $formulary->getField ($control['flags']['target']); $current === false ? $current = array () : null; if (isset ($control['flags']['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']['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']['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']['format_force'])) $current[$lang][TEXT_FORMAT] = $control['flags']['format_force']; if (isset ($control['flags']['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']['html_force'])) $current[$lang][TEXT_HTML] = $control['flags']['html_force']; if (isset ($control['flags']['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']['ecolabore_force'])) $current[$lang][TEXT_ECOLABORE] = $control['flags']['ecolabore_force']; } // received data if (!$current)$current = false; $formulary->setField ($control['flags']['target'], $current); } // set field } // function save } // class eclFilter_text //!eof:engine/eclFilter/eclFilter_text.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'; // 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_view.php; /* * Valid control flags * control_type = view * control_filter = flag_view * control_target * control_field_name * control_default_value */ class eclFilter_view { // class eclFilter_view static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'view'; // target if (isset ($control['flags']['target'])) $value = $formulary->getField ($control['flags']['target']); else $value = false; if ($value !== false and $value !== '') $local['content'] = $formulary->document->textMerge ($value); elseif (isset ($control['flags']['default_value'])) $local['content'] = $document->textMerge ($control['flags']['default_value']); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_view //!eof:engine/eclFilter/eclFilter_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 'binary': 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]) or $data[$fieldName] == 0) $data[$fieldName] = TIME; $fields[] = $fieldName; $values[] = strval (intval ($data[$fieldName])); break; case 'array': $fields[] = $fieldName; if (!isset ($data[$fieldName]) or !is_array ($data[$fieldName])) $data[$fieldName] = array (); if (!$data[$fieldName]) $values[] = "''"; else $values[] = "'" . $this->stringToDatabase (serialize ($data[$fieldName])) . "'"; break; case 'keywords': $fields[] = $fieldName; if (!isset ($data[$fieldName]) or !is_string ($data[$fieldName])) $data[$fieldName] = ''; if (!isset ($data[$fieldName][0])) $values[] = "''"; else $values[] = "'" . implode (' ', $this->filterKeywords ($data[$fieldName])) . "'"; break; case 'password': if (!isset ($data[$fieldName]) or !is_string ($data[$fieldName])) $data[$fieldName] = ''; $fields[] = $fieldName; $values[] = "'" . strval (md5 ($data[$fieldName])) . "'"; break; case 'binary': $fields[] = $fieldName; if (!isset ($data[$fieldName]) or !is_string ($data[$fieldName])) $data[$fieldName] = ''; if (!isset ($data[$fieldName][0])) $values[] = "''"; else $values[] = "'" . $this->stringToDatabase ($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 is_numeric ($field_value)) $conditions[] = '`' . $fieldName . '`=' . $field_value; elseif (is_string ($field_value) and preg_match ('%^[<=>\ ]*[0-9]+$%', trim ($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 (isset ($row[$fieldName][0])) $data[$fieldName] = unserialize ($this->stringFromDatabase ($row[$fieldName])); else $data[$fieldName] = array (); break; default: if (isset ($row[$fieldName][0])) $data[$fieldName] = $this->stringFromDatabase ($row[$fieldName]); else $data[$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])) $data[$fieldName] = false; if (!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 (is_string ($data[$fieldName]) and preg_match ('%^[a-zA-Z0-9@:/._-]*$%', $data[$fieldName])) $set[] = '`' . $fieldName . "`='" . $data[$fieldName] . "'"; break; case 'array': if (!is_array ($data[$fieldName])) $data[$fieldName] = array (); $set[] = '`' . $fieldName . "`='" . $this->stringToDatabase (serialize ($data[$fieldName])) . "'"; break; case 'password': if (md5 (strval ($data[$fieldName])) != $originalData[$fieldName]) $set[] = '`' . $fieldName . "`='" . md5 ($data[$fieldName]) . "'"; break; case 'keywords': if (isset ($data[$fieldName][0])) { // filter keywords $keywords = implode (' ', $this->filterKeywords (strval ($data[$fieldName]))); if (!isset ($originalData[$fieldName]) or $keywords != $originalData[$fieldName]) $set[] = '`' . $fieldName . "`='" . $keywords . "'"; break; } // filter keywords if (isset ($originalData[$fieldName][0])) $set[] = '`' . $fieldName . "`=''"; break; case 'binary': if (!is_string ($data[$fieldName]) or !isset ($data[$fieldName][0])) $set[] = '`' . $fieldName . "`=''"; else $set[] = '`' . $fieldName . "`='" . $this->stringToDatabase ($data[$fieldName]) . "'"; 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_numeric ($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, $level=0) { // function array2string $string = ''; foreach ($array as $key => $value) { // each item if (is_int ($key) and $level < 2) $string .= '#='; elseif (is_int ($key)) $string .= strval ($key) . '='; elseif (is_string ($key)) $string .= "'" . str_replace ("'", "''", $key) . "'="; else continue; if (is_int ($value)) $string .= strval ($value) . CRLF; elseif (is_string ($value)) $string .= "'" . str_replace ("'", "''", $value) . "'" . CRLF; elseif (is_array ($value)) $string .= '{' . CRLF . self::array2string ($value, $level + 1) . '}' . CRLF; else $string .= '0' . CRLF; } // each item 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 } // 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_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 $folder_engine, $folder_library, $folder_shared, $folder_templates; 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 ('FOLDER_ENGINE')) $this->folder_engine = $io->systemConstants->constants['FOLDER_ENGINE']; else $this->folder_engine = FOLDER_ENGINE; if ($io->systemConstants->check ('FOLDER_LIBRARY')) $this->folder_library = $io->systemConstants->constants['FOLDER_LIBRARY']; else $this->folder_library = FOLDER_LIBRARY; if ($io->systemConstants->check ('FOLDER_SHARED')) $this->folder_shared = $io->systemConstants->constants['FOLDER_SHARED']; else $this->folder_shared = FOLDER_SHARED; if ($io->systemConstants->check ('FOLDER_TEMPLATES')) $this->folder_templates = $io->systemConstants->constants['FOLDER_TEMPLATES']; else $this->folder_templates = FOLDER_TEMPLATES; } // 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 (PATH_ROOT . SYSTEM_SCRIPT_NAME); $this->clearFiles = array (); $this->pack_controls (); $this->pack_shared (); $this->pack_templates (); $this->pack_embeded (); $settings = array ( 'SYSTEM_IS_PACKED' => true, 'SYSTEM_PACKED_DATE' => date ('r', TIME) ); if ($params['pack_mode'] == 'export') $fileName = PATH_ROOT . $params['filename']; else $fileName = PATH_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 (PATH_ENGINE, PATH_LIBRARY, PATH_SHARED, PATH_TEMPLATES); $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 = array (); foreach (scandir (PATH_LIBRARY) as $module) { // scan library if ($module[0] == '.') continue; foreach (scandir (PATH_LIBRARY . $module) as $name) { // each file if (!is_file (PATH_LIBRARY . $module . '/' . $name)) continue; if (substr ($name, 0, 4) != 'app_' or substr ($name, - 4) != '.txt') continue; $this->clearFiles[] = PATH_LIBRARY . $module . '/' . $name; if (substr ($name, - 12) == '_prepend.txt') { // prepend map $target = 'prepend'; $applicationName = substr ($name, 4, - 12); } // prepend map else { // append $target = 'append'; $applicationName = substr ($name, 4, - 11); } // append $content = file_get_contents (PATH_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)) $map[$target][$applicationName][] = $line; } // each line } // each file } // scan library if (!$map) return ''; $buffer = '//!' . 'packager:start_of_map' . CRLF; $buffer .= CRLF; if (isset ($map['prepend'])) { // prepend $buffer .= '$mapPrepend = array (' . CRLF; foreach ($map['prepend'] as $module => $list) { // each module $buffer .= "'" . $module . "' => array ('" . implode ("', '", $list) . "')," . CRLF; } // each module $buffer .= ');' . CRLF . CRLF; } // prepend if (isset ($map['append'])) { // append $buffer .= '$mapAppend = array (' . CRLF; foreach ($map['append'] as $module => $list) { // each module $buffer .= "'" . $module . "' => array ('" . implode ("', '", $list) . "')," . CRLF; } // each module $buffer .= ');' . CRLF . CRLF; } // append $buffer .= '//!' . 'packager:end_of_map' . CRLF; return $buffer; } // 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 (PATH_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[] = PATH_LIBRARY . $file; $content = serialize (eclIo_file::string2array (file_get_contents (PATH_LIBRARY . $file))); } // control elseif (!$this->packMediaFiles) continue; else { // media $this->clearFiles[] = PATH_LIBRARY . $file; $content = file_get_contents (PATH_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 (PATH_SHARED) as $file) { // each file if (substr ($file, - 8) != '.ecl.php') continue; $this->clearFiles[] = PATH_SHARED . $file; $content = serialize (eclIo_file::string2array (file_get_contents (PATH_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_templates () { // function pack_templates foreach ($this->getAllFilesNames (PATH_TEMPLATES) as $file) { // each file $parts = explode ('/', $file); $name = array_pop ($parts); if (substr ($file, - 8) != '.ecl.php') continue; $name = substr ($name, 0, - 8); $this->clearFiles[] = PATH_TEMPLATES . $file; $content = serialize (eclIo_file::string2array (file_get_contents (PATH_TEMPLATES . $file))); $path = implode ('/', $parts); $this->add ('t', $path, $name, $content); } // each file } // function pack_templates private function pack_embeded () { // function pack_embeded foreach ($this->getAllFilesNames (PATH_SHARED) as $file) { // each file if (substr ($file, - 8) == '.ecl.php') continue; if (!$this->packMediaFiles and substr ($file, - 4) == '.mp3') continue; $this->clearFiles[] = PATH_SHARED . $file; $content = file_get_contents (PATH_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 (PATH_ENGINE) as $file) { // loop engine files if (substr ($file, - 8) == '.ecl.php') continue; if (substr ($file, - 4) != '.php') continue; $allFiles[PATH_ENGINE . $file] = 'engine/' . $file; } // loop engine files foreach ($this->getAllFilesNames (PATH_LIBRARY) as $file) { // loop library files if (substr ($file, - 8) == '.ecl.php') continue; if (substr ($file, - 4) != '.php') continue; $allFiles[PATH_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 = ''; foreach ($array as $key => $value) { // each item if (is_int ($key)) $string .= strval ($key); else $string .= "'" . $key . "'"; $string .= ' => '; if ($value === false) $string .= 'false'; elseif ($value === true) $stirng .= 'true'; elseif (is_int ($value) or is_float ($value)) $string .= strval ($value); elseif (is_string ($value)) $string .= "'" . $value . "'"; elseif (is_array ($value)) $string .= 'array (' . CRLF . self::array2php ($value) . ')'; else $string .= "''"; $string .= ',' . CRLF; } // each item 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 (PATH_ROOT . SYSTEM_SCRIPT_NAME); $this->extract_scripts ($params); $this->extract_controls ($params); $this->extract_map (); $this->extract_shared ($params); $this->extract_templates ($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 (PATH_ROOT . $fileName, 'a+b'); ftruncate ($package, 0); fwrite ($package, $this->index_contents); fclose ($package); } // create backup $index = fopen (PATH_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->folder_engine; elseif ($folders[0] == 'library') $folders[0] = $this->folder_library; if (substr ($folders[0], - 1) == '/') $folders[0] = substr ($folders[0], 0, - 1); $fileName = implode ('/', $folders); $this->filePutContents (PATH_ROOT, $fileName, $file); } // loop } // function extract_scripts private function extract_map () { // function extract_map global $mapPrepend, $mapAppend; // extract maps foreach ($mapPrepend as $application => $names) { // each map list ($module) = explode ('_', $application); $content = implode (CRLF, $names); $this->filePutContents (PATH_ROOT, $this->folder_library . $module . '/app_' . $application . '_prepend.txt', $content); } // each map foreach ($mapAppend as $application => $names) { // each map list ($module) = explode ('_', $application); $content = implode (CRLF, $names); $this->filePutContents (PATH_ROOT, $this->folder_library . $module . '/app_' . $application . '_append.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 (PATH_ROOT, $this->folder_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 (PATH_ROOT, $this->folder_library . $path . '/_help/' . $name . '.ecl.php', $content); } // control else { // media $content = $io->cachedControls->file ($module, $name, 'h'); $this->filePutContents (PATH_ROOT, $this->folder_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 (PATH_ROOT, $this->folder_shared . $path . '/' . $name . '.ecl.php', $content); } // each name } // each module } // function extract_shared private function extract_templates () { // function extract_templates global $io, $dataMap; foreach ($dataMap['t'] as $path => $names) { // each module foreach ($names as $name => $pos) { // each name $content = $io->file->array2string ($io->cachedControls->read ('t', $path, $name)); $this->filePutContents (PATH_ROOT, $this->folder_templates . $path . '/' . $name . '.ecl.php', $content); } // each name } // each module } // function extract_templates 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 (PATH_ROOT, $this->folder_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 $beta = ''; public $host; public $pathway; public $lang = false; public $actions = array (); public $received = array (); public $uploaded = array (); public $rewriteEngine = false; private $headers = array (); private $headersRemove = array (); private $headersRemoveAll = false; public function __construct () { // function __construct global $io; // Protocol if (isset ($_SERVER['HTTPS']) and $_SERVER['HTTPS'] == 'on') $this->protocol = 'https'; else $this->protocol = 'http'; // Beta if (isset ($_GET['beta'])) $this->beta = 'beta.'; // Rewrite Engine if (isset ($_GET['RewriteEngine'])) $this->rewriteEngine = true; elseif (SYSTEM_REWRITE_ENGINE and strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache') and !is_file (PATH_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); $parts = explode ('.', $v_host); if ($parts and $parts[0] == 'beta') $this->beta = array_shift ($parts) . '.'; elseif ($parts and $parts[0] == 'www') array_shift ($parts); if ($parts and strlen ($parts[0])) array_unshift ($pathway, $parts[0]); 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 foreach ($_FILES as $name => $entry) { // each uploaded file if (is_string ($entry['name'])) { // single file $this->uploaded[$name][0] = $entry; continue; } // single file $count = count ($entry['name']); for ($i = 0; $i < $count; $i++) { // loop index foreach ($entry as $key => $array) { // each key $this->uploaded[$name][$i][$key] = $array[$i]; } // each key } // loop index } // each uploaded file } // function __construct public function isLanguage ($lang) { // function isLanguage global $store; if (strlen ($lang) != 2) return false; if ($lang == 'pt' or $lang == 'en' or $lang == 'es' or $lang == 'it' or $lang == 'fr') return true; if ($store->control->read ('labels/lang/' . $lang)) return true; return false; } // function isLanguage public function header ($header) { // function header $this->headers[] = $header; } // function header public function headerRemove ($header=false) { // function headerRemove if ($header === false) $this->headersRemoveAll = true; else $this->headersRemove[] = $header; } // function headerRemove public function giveBack ($document) { // function giveBack global $io; if (isset ($this->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 if ($this->headersRemoveAll) header_remove (); elseif ($this->headersRemove) { // clear headers foreach ($this->headersRemove as $header) { // clear each header header_remove ($header); } // clear each header } // clear headers header ('HTTP/1.1 200 OK'); header ('X-Powered-By: ECOLABORE/' . SYSTEM_VERSION); header ("Cache-Control: no-cache, must-revalidate, max-age=0"); header ('Content-Type: text/html; charset=' . strtolower ($document->charset)); header ('Content-length: ' . strval (ob_get_length ())); if (isset ($document->application->data['flags']['modLayout_cacheable'])) { // cacheable header_remove ('Pragma'); header_remove ('Expires'); header ('Cache-Control: public, only-if-cached, max-age=' . $document->application->data['flags']['modLayout_cacheable']); } // cacheable foreach ($this->headers as $header) { // each header header ($header); } // each header header ('Connection: close'); ob_end_flush (); } // function giveBack 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); if (SYSTEM_TIME_LIMIT) set_time_limit (0); 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); header_remove ('Pragma'); header_remove ('Expires'); header_remove ('X-Powered-By'); 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); $eTag = md5 ($name . $updated); if (isset ($headers['ETag']) and $headers['ETag'] == $eTag) { // not modified header ('HTTP/1.1 304 Not Modified'); return 304; } // not modified 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 header ('HTTP/1.1 200 OK'); header ('Access-Control-Allow-Origin: *'); // 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 ('ETag: "' . $eTag . '"'); header ('Last-Modified: ' . $updated); header ('Content-Type: ' . $mime); if ($stream) header ('Accept-Ranges: bytes'); // check if http_range is sent by browser (or download manager) if (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 ($start) = explode ('-', $range); $start = intval ($start); if ($requested_size_unit != 'bytes' or $start >= $end) { // out of range header ('HTTP/1.1 416 Requested Range Not Satisfiable'); return 416; } // out of range } // 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)); } // partial content else header ('Content-Length: ' . $size); if (!$stream) { // fopen failed print file_get_contents ($path); return 0; } // fopen failed fseek ($stream, $start); 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; $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_sms.php; class eclIo_sms { // class eclIo_sms public function enabled () { // function enabled if (defined ('INTEGRATION_PAPO_SMS_ENABLE') and INTEGRATION_PAPO_SMS_ENABLE) return true; return false; } // function enabled public function send ($sms) { // function send global $io; if (defined ('INTEGRATION_PAPO_SMS_ENABLE') and INTEGRATION_PAPO_SMS_ENABLE) return $io->integrationSMS->send ($sms); return false; } // function send public function close () { // function close } // function close } // class eclIo_sms //!eof:engine/eclIo/eclIo_sms.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 ('INTEGRATION_SMTP_ENABLE') or !INTEGRATION_SMTP_ENABLE) return; $this->host = $host ? $host : INTEGRATION_SMTP_HOST; $this->port = $port ? $port : INTEGRATION_SMTP_PORT; $this->user = $user ? $user : INTEGRATION_SMTP_USER; $this->password = $password ? $password : INTEGRATION_SMTP_PASSWORD; $this->from = $from ? $from : INTEGRATION_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, INTEGRATION_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; public $components; public $aliases; public $map; public function __construct () { // function __construct global $components, $aliases, $map; $this->components = $components; $this->aliases = $aliases; $this->map = $map; $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 __construct public function set ($name, $value) { // function set $this->constants[$name] = $value; if (!defined ($name)) define ($name, $value); } // function set public function check ($name) { // function check if (isset ($this->constants[$name])) return true; return false; } // function check public function drop ($name) { // function drop if (isset ($this->constants[$name])) unset ($this->constants[$name]); } // function drop public function get ($name) { // function get if (isset ($this->constants[$name])) return $this->constants[$name]; if (defined ($name)) return constant ($name); return false; } // function get public function close () { // function close global $aliases, $components; if ($this->constants == $this->originalRows and $this->aliases == $aliases and $this->components == $components) return; $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 . "', '" . str_replace (array ("'", "\\", "\r", "\n"), "", $value) . "');" . CRLF; } // each constant $string .= CRLF; } // each group $string .= '$components = array ('; $string .= eclIo_packager::array2php ($this->components) . CRLF; $string .= ');' . CRLF . CRLF; $string .= '$aliases = array ('; $string .= eclIo_packager::array2php ($this->aliases) . CRLF; $string .= ');' . CRLF . CRLF; $string .= '$map = array ('; $string .= eclIo_packager::array2php ($this->map) . CRLF; $string .= ');' . CRLF . CRLF; $string .= '?>'; file_put_contents (SYSTEM_CONFIG_FILE, $string); } // function close } // class eclIo_systemConstants //!eof:engine/eclIo/eclIo_systemConstants.php; //!file:engine/eclIo/eclIo_webservice.php; class eclIo_webservice { // class eclIo_webservice public function request ($url, $data=array ()) { // function request global $io; if (!$data) return $this->json2array (file_get_contents ($url)); if (!function_exists ('curl_init')) { // error $io->log->addMessage ('curl library not found'); return array (); } // error $data = $this->array2json ($data); $ch = curl_init ($url); curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt ($ch, CURLOPT_POSTFIELDS, $data); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_HTTPHEADER, array ( 'Content-Type: application/json', 'Content-Length: ' . strlen ($data)) ); $result = curl_exec ($ch); return $this->json2array ($result); } // function request public function read () { // function read $string = file_get_contents ("php://input"); return $this->json2array ($string); } // function read public function send ($data) { // function send print $this->array2json ($data); header_remove (); header ('HTTP/1.1 200 OK'); header ('X-Powered-By: ECOLABORE/' . SYSTEM_VERSION); header ("Cache-Control: no-cache, must-revalidate, max-age=0"); header ('Content-Type: text/json; charset=utf-8'); header ('Content-length: ' . strval (ob_get_length ())); } // function send static function array2json ($array) { // function array2json $buffer = ''; if (!is_array ($array) or !$array) return '{}'; reset ($array); $key = key ($array); if ($key === 0) { // is indexed array $buffer .= '[' . CRLF; foreach ($array as $key => $value) { // each value if ($key) $buffer .= ',' . CRLF; if ($value === true) $buffer .= 'true'; elseif ($value === false) $buffer .= 'false'; elseif (is_int ($value)) $buffer .= strval ($value); elseif (is_float ($value)) $buffer .= strval ($value); elseif (is_string ($value)) $buffer .= '"' . str_replace ('"', '\\"', $value) . '"'; elseif (is_array ($value)) $buffer .= self::array2json ($value); } // each value $buffer .= CRLF . ']'; return $buffer; } // is indexed array $buffer .= '{' . CRLF; $index = 0; foreach ($array as $key => $value) { // each array element if ($index++) $buffer .= ',' . CRLF; $buffer .= '"' . str_replace ('"', '\\"', $key) . '":'; if ($value === true) $buffer .= 'true'; elseif ($value === false) $buffer .= 'false'; elseif (is_int ($value)) $buffer .= strval ($value); elseif (is_float ($value)) $buffer .= strval ($value); elseif (is_string ($value)) $buffer .= '"' . str_replace ('"', '\\"', $value) . '"'; elseif (is_array ($value)) $buffer .= self::array2json ($value); } // each array element $buffer .= CRLF . '}'; return $buffer; } // function array2json public static function json2array ($string) { // function json2array $pointer = 0; $floor = 0; $array[0] = array (); $key[0] = false; $isFloat = false; $value = array (); while (isset ($string[$pointer])) { // each character switch ($string[$pointer]) { // switch char case ' ': case "\r": case "\n": case "\t": $pointer++; break; case '[': case '{': $pointer++; $floor++; $array[$floor] = array (); $key[$floor] = false; $value = array (); break; case ']': case '}': $pointer++; if (!is_array ($value)) { // append last item if ($key[$floor] === false) $array[$floor][] = $value; else $array[$floor][$key[$floor]] = $value; $key[$floor] = false; $value = array (); } // append last item if ($floor < 0) return $array[0]; $floor--; if ($key[$floor] === false) $array[$floor][] = $array[$floor + 1]; else $array[$floor][$key[$floor]] = $array[$floor + 1]; $key[$floor] = false; break; case ':': $pointer++; if (!is_array ($value) and !is_bool ($value) and preg_match ('/^[$a-zA-Z][a-zA-Z0-9_-]*$/', $value)) $key[$floor] = $value; elseif (!is_array ($value) and !is_bool ($value) and preg_match ('/^[0-9]+$/', $value)) $key[$floor] = intval ($value); $value = array (); break; case ',': $pointer++; if (is_array ($value)) break; if ($key[$floor] === false) $array[$floor][] = $value; else $array[$floor][$key[$floor]] = $value; break; case '"': $pointer++; $start = $pointer; $pointer = strpos ($string, '"', $pointer); if ($pointer === false) return $array[0]; while ($string[$pointer - 1] == CHR_BSLASH) { // loop escaped quotes $pointer = strpos ($string, '"', $pointer + 1); if ($pointer === false) return $array[0]; } // loop escaped quotes $value = substr ($string, $start, $pointer - $start); $pointer++; break; case 't': case 'T': $pointer += 4; $value = true; break; case 'f': case 'F': $pointer += 5; $value = false; break; case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': $value = ''; while (isset ($string[$pointer])) { // search numbers switch ($string[$pointer]) { // switch chars case '.': $isFloat = true; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': $value .= $string[$pointer]; $pointer++; break; default: if ($isFloat) $value = floatval ($value); else $value = intval ($value); $isFloat = false; break 2; } // switch chars } // search numbers break; } // switch char } // each character if (count ($array[0]) == 1 and isset ($array[0][0])) return $array[0][0]; return $array[0]; } // function json2array public function close () { // function close } // function close } // class eclIo_webservice //!eof:engine/eclIo/eclIo_webservice.php; //!file:engine/eclScope/eclScope_address.php; class eclScope_address { // class eclScope_address static function get ($render, $arguments) { // function get $data['data'] = $render->getVar ('address'); return $data; } // function get } // class eclScope_address //!eof:engine/eclScope/eclScope_address.php; //!file:engine/eclScope/eclScope_audima.php; class eclScope_audima { // class eclScope_audima static function get ($render, $arguments) { // function get global $store, $system; if ($render->me === false) return false; $document = $render->document; $me = $render->me; if ($document->data['id'] != $me->data['id']) return array (); if (isset ($me->data['extras']['audio_0'])) return array (); $data = array ('local' => array ('audima' => 1)); return $data; } // function get } // class eclScope_audima //!eof:engine/eclScope/eclScope_audima.php; //!file:engine/eclScope/eclScope_audio.php; class eclScope_audio { // class eclScope_audio static function get ($render, $arguments) { // function get global $store, $system; if ($render->me === false) return false; $document = $render->document; $me = $render->me; $number = $render->getVar ('mod.number'); if (!$number) $number = '0'; $extras = $me->data['extras']; $target = 'audio_' . $number; if (!isset ($extras[$target])) { // no media if (!$me->id or !$me->domainId) return false; if (!$document->access (4, $me->groups)) return; $data['local']['editable'] = 1; $pathway = $me->pathway; $domain = array_shift ($pathway); array_unshift ($pathway, $domain, '-personalite', 'extras', $target); $url = $document->url ($pathway); $data['local']['url'] = "javaScript:humperstilshen.popUpOpen('" . $url . "', 300, 200)"; return $data; } // no media $data['local'] = $extras[$target]; if (isset ($data['local']['files']['audio'])) { // url $data['local']['url_download'] = $document->urlFiles ($data['local']['files']['audio'], true, '-downloads'); $data['local']['url_play'] = $document->urlFiles ($data['local']['files']['audio'], true, '-play'); } // url //!start version 3 compatibility if (isset ($data['local']['audio'])) { // Version 3 compatibility $data['local']['url_download'] = $document->urlFiles ($data['local']['audio'], true, '-downloads'); $data['local']['url_play'] = $document->urlFiles ($data['local']['audio'], true, '-play'); } // Version 3 compatibility //!end version 3 compatibility if (isset ($data['local']['play'])) $data['local']['play'] = strval ($data['local']['play']); //!start version 3 compatibility elseif (isset ($data['local']['plays'])) $data['local']['play'] = strval ($data['local']['plays']); //!end version 3 compatibility return $data; } // function get } // class eclScope_audio //!eof:engine/eclScope/eclScope_audio.php; //!file:engine/eclScope/eclScope_card.php; class eclScope_card { // class eclScope_card static function get ($render, $arguments) { // function get if (isset ($render->me->data['extras']['card']['local'])) return $render->me->data['extras']['card']; return; } // function get } // class eclScope_card //!eof:engine/eclScope/eclScope_card.php; //!file:engine/eclScope/eclScope_cart.php; class eclScope_cart { // class eclScope_cart static function get ($render, $arguments) { // function get global $store; $document = $render->document; if (!$render->getVar ('value')) return; if (!$store->domainContent->findMarker ($document->domain->domainId, 12)) return; $data['local'] = $render->data; $data['local']['url'] = $document->url (true, true, '_preload-cart'); if (isset ($document->domain->data['flags']['modCart_type']) and $document->domain->data['flags']['modCart_type'] == 'bag') $data['local']['bag'] = 1; return $data; } // function get } // class eclScope_cart //!eof:engine/eclScope/eclScope_cart.php; //!file:engine/eclScope/eclScope_categories.php; class eclScope_categories { // class eclScope_categories static function get ($render, $arguments) { // function get global $store; if (!isset ($render->data['domain_id']) or !isset ($render->data['name'])) return false; $document = $render->document; $domainId = $render->data['domain_id']; $name = $render->data['name']; $data = array (); $sections = $store->domainContent->mode ($domainId, MODE_SECTION); foreach ($sections as $section) { // each section if (!isset ($section['flags']['section_type']) or $section['flags']['section_type'] != 'categories') continue; $categories = $store->domainContent->children ($document->domain->domainId, MODE_CATEGORY, $section['id']); if (!$categories) continue; $group = $document->createListItem ($section); foreach ($categories as $category) { // each category if (!isset ($category['links']['pages']) or !in_array ($name, $category['links']['pages'])) continue; $group->appendChild ($category) ->swapTitle () ->url ($store->domainContent->pathway ($domainId, $category['id'])); } // each category if ($group->children) $data['children'][] = $group; } // each section return $data; } // function get } // class eclScope_categories //!eof:engine/eclScope/eclScope_categories.php; //!file:engine/eclScope/eclScope_credits.php; class eclScope_credits { // class eclScope_credits static function get ($render, $arguments) { // function get if (!isset ($render->data['text']['author'])) return false; $data = $render->data; if (isset ($render->data['extras']['credits'])) $data['local'] = $render->data['extras']['credits']; return $data; } // function get } // class eclScope_credits //!eof:engine/eclScope/eclScope_credits.php; //!file:engine/eclScope/eclScope_date.php; class eclScope_date { // class eclScope_date static function get ($render, $arguments) { // function get global $store; $document = $render->document; if (!isset ($arguments[0])) return false; $time = intval ($arguments[0]); if (!$time) return false; if (isset ($arguments[1]) and $time == intval ($arguments[1])) 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 = $render->block ('labels/date/month' . $parts[5]); if (isset ($month['text']['caption'])) $local['month'] = $month['text']['caption']; $data['local'] = $local; return $data; } // function get } // class eclScope_date //!eof:engine/eclScope/eclScope_date.php; //!file:engine/eclScope/eclScope_date_elapsed.php; class eclScope_date_elapsed { // class eclScope_date_elapsed static function get ($render, $arguments) { // function get global $store; if (!isset ($arguments[0])) return false; $time = intval ($arguments[0]); 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 = $render->block ('labels/date/elapsed_' . $message); $local['elapsed'] = $description['text']['caption']; $data['local'] = $local; return $data; } // function get } // class eclScope_date_elapsed //!eof:engine/eclScope/eclScope_date_elapsed.php; //!file:engine/eclScope/eclScope_file.php; class eclScope_file { // class eclScope_file static function get ($render, $arguments) { // function get global $store, $system; $document = $render->document; if (isset ($render->data['extras'])) $extras = $render->data['extras']; else $extras = array (); $number = $render->getVar ('mod.number'); if (!$number) $number = '0'; $target = 'file_' . $number; if (!isset ($extras[$target])) { // no media $pathway = $render->getVar ('pathway'); if (!$pathway) { // get pathway if (!isset ($render->data['id']) or !isset ($render->data['domain_id'])) return false; $id = $render->data['id']; $pathway = $store->domainContent->pathway ($render->data['domain_id'], $id); } // get pathway $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); array_unshift ($pathway, $domain, '-personalite', 'extras', $target); $url = $document->url ($pathway); $data['local']['url'] = "javaScript:humperstilshen.popUpOpen('" . $url . "', 300, 200)"; return $data; } // no media $data['local'] = $extras[$target]; if (isset ($data['local']['files']['file'])) { // url $data['local']['url_download'] = $document->urlFiles ($data['local']['files']['file'], true, '-downloads'); $data['local']['url_play'] = $document->urlFiles ($data['local']['files']['file'], true, '-play'); } // url //!start version 3 compatibility if (isset ($data['local']['file'])) { // Version 3 compatibility $data['local']['url_download'] = $document->urlFiles ($data['local']['file'], true, '-downloads'); $data['local']['url_play'] = $document->urlFiles ($data['local']['file'], true, '-play'); } // Version 3 compatibility //!end version 3 compatibility if (isset ($data['local']['play'])) $data['local']['play'] = strval ($data['local']['play']); //!start version 3 compatibility elseif (isset ($data['local']['plays'])) $data['local']['play'] = strval ($data['local']['plays']); //!end version 3 compatibility return $data; } // function get } // class eclScope_file //!eof:engine/eclScope/eclScope_file.php; //!file:engine/eclScope/eclScope_fonts.php; class eclScope_fonts { // class eclScope_fonts static function get ($render, $arguments) { // function get global $store; if (!isset ($render->data['extras']['fonts'])) return false; $document = $render->document; $fonts = $render->data['extras']['fonts']; $data = array (); $demonstration = $store->control->read ('dialog_fonts_demonstration'); if (isset ($document->session['scope-fonts-demonstration'])) $demonstration = array_replace ($demonstration, $document->session['scope-fonts-demonstration']); $demonstration['ref_demonstration'] = $document->url ($document->domain->name, '-dialog', 'font-change-preview'); foreach (array ('light-' => '-light', '' => '', 'heavy-' => '-heavy') as $prefix => $sufix) { // each family if (!isset ($fonts[$prefix . 'regular'])) continue; $local = array (); $local['font-family'] = 'ecl-' . $render->data['name'] . $sufix; foreach (array ('regular', 'italic', 'bold', 'bold-italic') as $style) { // each style if (!isset ($fonts[$prefix . $style])) continue; $local[$style . '-url'] = $document->urlFiles ($fonts[$prefix . $style], true, '-files/fonts'); $parts = explode ('.', $fonts[$prefix . $style]); $local[$style . '-format'] = end ($parts); } // each style if (isset ($fonts[$prefix . 'stack-start'])) { // start of stack $buffer = ''; $list = explode (',', $fonts[$prefix . 'stack-start']); foreach ($list as $font) { // each font $font = trim ($font, '"\' '); if (isset ($font[0])) { // add font $buffer .= 'local("' . $font . '"), '; } // add font } // each font if (isset ($buffer[0])) $local['stack-start'] = $buffer; } // start of stack $buffer = $local['font-family']; if (isset ($fonts[$prefix . 'stack-end'])) { // end of stack $list = explode (',', $fonts[$prefix . 'stack-end']); foreach ($list as $font) { // each font $font = trim ($font, '"\' '); if (isset ($font[0])) { // add font if (strpos ($font, ' ')) $buffer .= ", '" . $font . "'"; else $buffer .= ', ' . $font; } // add font } // each font } // end of stack $local['stack'] = $buffer; if ($prefix == 'light-') $caption = $store->control->read ('labels/detail/font_light'); elseif ($prefix == 'heavy-') $caption = $store->control->read ('labels/detail/font_heavy'); else $caption = $store->control->read ('labels/detail/font_normal'); $local['caption'] = $caption['text']['caption']; $data['children'][] = $document->createListItem ($local, $demonstration); } // each family return $data; } // function get } // class eclScope_fonts //!eof:engine/eclScope/eclScope_fonts.php; //!file:engine/eclScope/eclScope_home.php; class eclScope_home { // class eclScope_home static function get ($render, $arguments) { // function get global $store; $document = $render->document; $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']['url'] = $document->url ($home->pathway); if ($document->contentEditable and $document->application->name == '') $data['data']['editable'] = 1; return $data; } // function get } // class eclScope_home //!eof:engine/eclScope/eclScope_home.php; //!file:engine/eclScope/eclScope_img.php; class eclScope_img { // class eclScope_img static function get ($render, $arguments) { // function get global $store; $document = $render->document; $extras = $render->getVar ('extras'); if (!isset ($extras['img_0'])) return false; $domainId = $render->getVar ('domain_id'); $domainName = $store->domain->getName ($domainId); $scope = array ('data' => array ()); $data = &$scope['data']; $data = $extras['img_0']; $data['url'] = $render->getVar ('url'); if (isset ($data['files']['img'])) $data['url_img'] = $document->urlFiles ($data['files']['img'], $domainName); // Version 3 compatibility elseif (isset ($data['img'])) $data['url_img'] = $document->urlFiles ($data['img'], $domainName); if (isset ($data['files']['img_mini'])) $data['url_img_mini'] = $document->urlFiles ($data['files']['img_mini'], $domainName); // Version 3 compatibility elseif (isset ($data['img_mini'])) $data['url_img_mini'] = $document->urlFiles ($data['img_mini'], $domainName); if (!isset ($data['local']['description'])) { // provides a description $data['local']['description'] = $render->getVar ('description'); if ($data['local']['description'] == '') $data['local']['description'] = $render->getVar ('title'); if ($data['local']['description'] == '') $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_location.php; class eclScope_location { // class eclScope_location static function get ($render, $arguments) { // function get global $store, $system; if (!isset ($render->data['domain_id']) or !isset ($render->data['name'])) return false; $document = $render->document; $domainId = $render->data['domain_id']; $domainName = $store->domain->getName ($domainId); $name = $render->data['name']; $domain = $system->child ($domainName); $me = $domain->findChild ($name); if ($me == false) return false; $levels = array (); $levels[] = $me; while (!$me->parent->isDomain) { // loop levels $me = $me->parent; $levels[] = $me; } // loop levels $data['children'] = array (); $length = count ($levels); for ($i = $length - 1; $i > 0; $i--) { // each level $data['children'][] = $document->createListItem ($levels[$i]->data) ->url ($levels[$i]->pathway); } // each level if (!count ($data['children'])) $data['children'][] = $document->createListItem ($levels[0]->data) ->url ($levels[0]->pathway); return $data; } // function get } // class eclScope_location //!eof:engine/eclScope/eclScope_location.php; //!file:engine/eclScope/eclScope_locationFull.php; class eclScope_locationFull { // class eclScope_locationFull static function get ($render, $arguments) { // function get global $store, $system; if (!isset ($render->data['domain_id']) or !isset ($render->data['name'])) return false; $document = $render->document; $domainId = $render->data['domain_id']; $domainName = $store->domain->getName ($domainId); $name = $render->data['name']; $domain = $system->child ($domainName); $me = $domain->findChild ($name); if ($me == false) return false; $levels = array (); $levels[] = $me; while (!$me->isDomain) { // loop levels $me = $me->parent; $levels[] = $me; } // loop levels $data['children'] = array (); $length = count ($levels); for ($i = $length - 1; $i >= 0; $i--) { // each level if ($i == $length - 1) $data['children'][] = $document->createListItem ($levels[$i]->data) ->swapTitle () ->url ($levels[$i]->pathway); else $data['children'][] = $document->createListItem ($levels[$i]->data) ->url ($levels[$i]->pathway); } // each level return $data; } // function get } // class eclScope_locationFull //!eof:engine/eclScope/eclScope_locationFull.php; //!file:engine/eclScope/eclScope_system.php; class eclScope_system { // class eclScope_system static function get ($render, $arguments) { // function get global $system; $data['data'] = $system->data; return $data; } // function get } // class eclScope_system //!eof:engine/eclScope/eclScope_system.php; //!file:engine/eclScope/eclScope_user.php; class eclScope_user { // class eclScope_user static function get ($render, $arguments) { // function get global $store; $document = $render->document; if (!isset ($arguments[0]) or !$arguments[0]) return false; if ($document->user->userId == $arguments[0]) { // you return $store->control->read ('user_you'); } // you $userName = $store->user->getName ($arguments[0]); $user = $store->userContent->open ($arguments[0], '-register'); if (!$user) return; $data['local'] = $user; $data['local']['url'] = $render->document->url (array (SYSTEM_PROFILES_URI, $userName)); return $data; } // function get } // class eclScope_user //!eof:engine/eclScope/eclScope_user.php; //!file:engine/eclScope/eclScope_video.php; class eclScope_video { // class eclScope_video static function get ($render, $arguments) { // function get global $store; $document = $render->document; $extras = $render->getVar ('extras'); $target = 'video'; $number = $render->getVar ('mod.number'); if (!$number) $number = '0'; if (!isset ($extras[$target . '_' . $number])) { // no media $pathway = $render->getVar ('pathway'); if (!$pathway) return; $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); array_unshift ($pathway, $domain, '-personalite', 'extras', $target . '_' . $number); $url = $document->url ($pathway); $data['local']['url'] = "javaScript:humperstilshen.popUpOpen('" . $url . "', 300, 200)"; return $data; } // no media $data['local'] = $extras[$target . '_' . $number]; if (isset ($data['local']['files'][$target])) { // url $data['local']['url_download'] = $document->urlFiles ($data['local']['files'][$target], true, '-downloads'); $data['local']['url_play'] = $document->urlFiles ($data['local']['files'][$target], true, '-play'); } // url return $data; } // function get } // class eclScope_video //!eof:engine/eclScope/eclScope_video.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 $aliases, $components, $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); if (count ($parts) < 2) return array(); $name = array_pop ($parts); if (isset ($aliases[$parts[0]]) and isset ($components[$aliases[$parts[0]]])) $file = PATH_COMPONENTS . $aliases[$parts[0]] . '/' . $components[$aliases[$parts[0]]] . '/' . implode ('/', $parts) . '/_controls/' . $name . '.ecl.php'; else $file = PATH_LIBRARY . implode ('/', $parts) . '/_controls/' . $name . '.ecl.php'; $path = implode ('_', $parts); $prefix = $path . '_'; $mode = 'c'; break; default: $file = PATH_TEMPLATES . $controlName . '.ecl.php'; $name = array_pop ($folders); $path = implode ('/', $folders); $prefix = $path . '/'; $mode = 't'; } // 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 $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 if (isset ($control['flags']['caption'])) { // set caption if (!isset ($control['text'])) $control['text'] = array (); $caption = $this->read ($control['flags']['caption']); if (isset ($caption['text'])) $control['text'] = array_replace ($caption['text'], $control['text']); } // 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 if (!is_dir (PATH_LIBRARY . $dir . '/_controls')) return array (); $names = array (); foreach (scandir (PATH_LIBRARY . $dir . '/_controls') as $name) { // each name if ($name[0] == '.') continue; if (substr ($name, - 8) == '.ecl.php') $names[] = substr ($name, 0, - 8); } // each name return $names; } // control mode if ($mode == 's') { // shared mode if (!is_dir (PATH_SHARED . $dir)) return array (); $names = array (); foreach (scandir (PATH_SHARED . $dir) as $name) { // each name if ($name[0] == '.') continue; $names[] = $name; } // each name return $names; } // shared mode if ($mode == 't') { // template mode if (!is_dir (PATH_TEMPLATES . $dir)) return array (); $names = array (); foreach (scandir (PATH_TEMPLATES . $dir) as $name) { // each name if ($name[0] == '.') continue; if (substr ($name, - 8) == '.ecl.php') $name = substr ($name, 0, - 8); $names[] = $name; } // each name return $names; } // templates 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' => 'name', '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); if (isset ($this->rows[$id]['name'])) return $this->rows[$id]['name']; return ''; } // 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', 'status' => 'tinyint', 'access' => 'tinyint', 'subscription_id' => 'mediumint', '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'), 'domain_find_owner' => array ('owner_id', 'mode') ); private $indexByName = array (); public $indexByParent = array (); public $chargedParents = array (); public $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; if ($data['parent_id'] != 0 or $data['mode'] != MODE_SECTION or !isset ($data['flags']['section_type']) or $data['flags']['section_type'] != 'menu') array_unshift ($pathway, $data['name']); $id = $data['parent_id']; if ($id == 1) $id = 0; 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 (defined ('TRACKING_REMOVED_PAGES') and 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 getUserSubscription ($document) { // function getUserSubscription if (!$document->domain->domainId) return false; if (!$document->user->userId) return false; $where = array ( 'domain_id' => $document->domain->domainId, 'mode' => MODE_SUBSCRIPTION, 'owner_id' => $document->user->userId ); $rows = $this->search ($where); if (!$rows) return false; return $document->domain->child ('-subscriptions')->child ($rows[0]['name']); } // function getUserSubscription 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_domainExtras.php; class eclStore_domainExtras { // class eclStore_domainExtras public $name = 'domain_extras'; public $fields = array ( // Indexing 'domain_id' => 'mediumint', 'mode' => 'tinyint', 'parent_id' => 'mediumint', 'master_id' => 'mediumint', 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'status' => 'mediumint', 'access' => 'tinyint', 'subscription_id' => 'mediumint', 'owner_id' => 'mediumint', // Dates 'created' => 'time', 'updated' => 'time', // Contents 'text' => 'array', 'local' => 'array', 'extras' => 'array', 'html' => 'binary' ); // Index public $index = array ( 'domain_find_extras' => array ('domain_id', 'mode', 'parent_id'), 'domain_find_extras_owner' => array ('owner_id', 'mode') ); public $indexByParent = array (); public $chargedParents = array (); public $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['access'] == 255) 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->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; $id = $database->insert ($this, $data); $data['id'] = $id; $this->rows[$domainId][$id] = $data; $this->originalRows[$domainId][$id] = $data; $this->indexByParent[$domainId][$data['mode']][$data['parent_id']][$id] = $id; $this->lastInsertedData = $data; return $id; } // function insert 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 children ($domainId, $mode, $parentId, $access=4) { // 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])) { // return found rows $found = array (); foreach ($this->indexByParent[$domainId][$mode][$parentId] as $id) { // each row $found[] = $this->rows[$domainId][$id]; } // each row return $found; } // return found rows else return array (); } // function children public function &openChild ($domainId, $mode, $parentId, $name) { // function & $children = $this->children ($domainId, $mode, $parentId); foreach ($children as $data) { // each child if ($data['name'] != $name) continue; $found = &$this->openById ($domainId, $data['id']); return $found; } // each child $found = array (); return $found; } // function & 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 search ($where, $access=4) { // function search if ( (!isset ($where['domain_id']) or is_int ($where['domain_id'])) and is_object ($this->database)) { // search on database return $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']); return $this->indexFoundRows ($database->select ($this, $where), $where['domain_id']); } // search on file else return array (); } // function search public function createVersion ($domainId, &$from, $document) { // function createVersion $lang = $document->lang; $from['flags']['updated_' . $lang] = TIME; $data = array ( 'domain_id' => $domainId, 'mode' => MODE_VERSION, 'parent_id' => $from['id'], 'name' => $document->lang, 'owner_id' => $document->user->userId, 'created' => TIME, 'updated' => TIME, 'text' => array () ); foreach (array_keys ($from['text']) as $field) { // each field if (isset ($from['text'][$field][$lang])) $data['text'][$field] = array ($lang => $from['text'][$field][$lang]); } // each field if (isset ($from['extras'])) { // extras exists $data['extras'] = array (); foreach ($from['extras'] as $target => $extras) { // each extra list ($prefix) = explode ('_', $target); switch ($prefix) { // switch prefix case 'box': if (isset ($from['extras'][$target]['text'])) { // text exists foreach ($from['extras'][$target]['text'] as $field => $value) { // each field if (isset ($value[$lang])) $data['extras'][$target]['text'][$field][$lang] = $value[$lang]; } // each field } // text exists if (isset ($from['extras'][$target]['local'])) $data['extras'][$target]['local'] = $from['extras'][$target]['local']; } // switch prefix } // each extra } // extras exists $this->insert ($domainId, $data); } // function createVersion public function clearLanguage ($document) { // function clearLanguage global $store; $me = $document->application; if (!isset ($me->data['text']['caption']) or count ($me->data['text']['caption']) < 2) return; if ($document->actions ('version', 'clear') and isset ($document->actions['version'][2]) and strlen ($document->actions['version'][2]) == 2) { // language clear $lang = $document->actions['version'][2]; foreach (array_keys ($me->data['text']) as $field) { // each field unset ($me->data['text'][$field][$lang]); if (!$me->data['text'][$field]) unset ($me->data['text'][$field]); } // each field foreach (array_keys ($me->data['extras']) as $target) { // each target list ($prefix) = explode ('_', $target, 2); switch ($prefix) { // switch prefix case 'box': if (isset ($me->data['extras'][$field]['text'])) { // text exists foreach (array_keys ($me->data['extras'][$target]['text']) as $field) { // each field unset ($me->data['extras'][$target]['text'][$field][$lang]); if (!$me->data['extras'][$target]['text'][$field]) unset ($me->data['extras'][$target]['text'][$field]); } // each field if (!$me->data['extras'][$target]['text']) unset ($me->data['extras'][$target]); } // text exists } // switch prefix } // each target } // language clear if (count ($me->data['text']['caption']) > 1 and isset ($me->data['text']['caption'][$document->lang])) { // context clear language $langCaption = $store->control->read ('labels/lang/' . $document->lang); $document->mod->context->appendChild ('labels/action/remove_language') ->set ('lang_caption', $langCaption['text']['caption']) ->url (true, true, '_version-remove-' . $document->lang) ->confirm ('system_msg_clearLanguageConfirm'); } // context clear language } // function clearLanguage public function versioning ($document) { // function versioning $this->clearLanguage ($document); $me = $document->application; if (isset ($me->data['flags']['updated_' . $document->lang])) $updated = $me->data['flags']['updated_' . $document->lang]; else $updated = $me->data['updated']; $versions = $this->children ($me->domainId, MODE_VERSION, $me->id); if (!$versions) return; $undo = array (); $redo = array (); $current = false; foreach ($versions as $version) { // each version if ($version['name'] != $document->lang) continue; if ($version['created'] < $updated) $undo[] = $version; elseif ($version['created'] == $updated) $current = true; elseif ($version['created'] > $updated) $redo[] = $version; } // each version if ($document->actions ('version', 'undo') and $undo) { // undo $update = array_pop ($undo); if ($current) $redo = true; } // undo elseif ($document->actions ('version', 'redo') and $redo) { // redo $update = array_shift ($redo); if ($current) $undo = true; } // redo if (isset ($update)) { // update $lang = $document->lang; $data = &$me->data; $data['updated'] = $update['created']; $data['flags']['updated_' . $lang] = $update['created']; $fields = array_keys (array_replace ($data['text'], $update['text'])); foreach ($fields as $field) { // update each field if (!isset ($data['text'][$field])) $data['text'][$field] = $update['text'][$field]; elseif (isset ($update['text'][$field][$lang])) $data['text'][$field][$lang] = $update['text'][$field][$lang]; else { // clear unset ($data['text'][$field][$lang]); if (!$data['text'][$field]) unset ($data['text'][$field]); } // clear } // update each field if (isset ($data['extras']) and $data['extras']) { // filter extras $modules = array_keys (array_replace ($data['extras'], $update['extras'])); foreach ($modules as $target) { // each target list ($prefix) = explode ('_', $target); switch ($prefix) { // switch prefix case 'box': if (!isset ($data['extras'][$target])) { // recreate $data['extras'][$target] = $update['extras'][$target]; break; } // recreate $fields = array_keys (array_replace ($data['extras'][$target]['text'], $update['extras'][$field]['text'])); foreach ($fields as $field) { // each field if (isset ($update['extras'][$target]['text'][$field][$lang])) $data['extras'][$target]['text'][$field][$lang] = $update['extras'][$target]['text'][$field][$lang]; else { // clear language unset ($update['extras'][$target]['text'][$field][$lang]); if (!$data['extras'][$target]['text'][$field]) unset ($data['extras'][$target]['text'][$field]); } // clear language } // each field if (!$data['extras'][$target]['text']) unset ($data['extras'][$target]); } // switch prefix } // each target } // filter extras $document->dataReplace ($me->data); } // update if ($undo) $document->mod->context->appendChild ('labels/action/undo') ->url (true, true, '_version-undo'); if ($redo) $document->mod->context->appendChild ('labels/action/redo') ->url (true, true, '_version-redo'); } // function versioning public function delete ($domainId, $id) { // function delete if (defined ('TRACKING_REMOVED_PAGES') and TRACKING_REMOVED_PAGES) { // do not remove page $data = &$this->openById ($domainId, $id); $data['access'] = 255; 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]); } // 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 deleteAllChildren ($domainId, $parentId) { // function deleteAllChildren $where = array ( 'domain_id' => $domainId, 'parent_id' => $parentId ); foreach ($this->search ($where) as $data) { // each row $this->delete ($domainId, $data['id']); } // each row } // function deleteAllChildren 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->indexByParent = array (); $this->chargedParents = array (); $this->rows = array (); $this->originalRows = array (); $this->deletedRows = array (); $this->notFound = array (); } // function close } // class eclStore_domainExtras //!eof:engine/eclStore/eclStore_domainExtras.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 scanPrefixedFiles ($domainId, $prefix) { // function scanPrefixedFiles global $store; $domainName = $store->domain->getName ($domainId); $prefix .= CHR_FNS; $prefixLength = strlen ($prefix); $names = array (); $dir = scandir (FOLDER_DOMAINS . $domainName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) $names[] = $fileName; } // each file return $names; } // function scanPrefixedFiles 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 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_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', 'mail' => 'name', 'phone' => 'name', 'document' => '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 (); if (intval ($name)) $data = $this->openById ($userId, $name); else $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, SYSTEM_PROFILES_URI, $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 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_userExtras.php; class eclStore_userExtras { // class eclStore_userExtras public $name = 'user_extras'; public $fields = array ( // Indexing 'user_id' => 'mediumint', 'mode' => 'tinyint', 'parent_id' => 'mediumint', 'master_id' => 'mediumint', 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'status' => 'tinyint', 'access' => 'tinyint', 'owner_id' => 'mediumint', // Dates 'created' => 'time', 'updated' => 'time', // Contents 'text' => 'array', 'local' => 'array', 'extras' => 'array', 'html' => 'binary' ); // Index public $index = array ( 'user_find_extras' => array ('user_id', 'mode', 'parent_id'), 'user_find_extras_owner' => array ('owner_id', 'mode') ); public $indexByParent = array (); public $chargedParents = array (); public $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['access'] == 255) continue; if (!$data['user_id']) $data['user_id'] = $domainName; $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->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; if (is_int ($userId) and $this->database) $database = $this->database; elseif (is_string ($userId) and $database = $this->getDatabase ($userId)) null; else return 0; $data['user_id'] = $userId; if (!isset ($data['parent_id'])) $data['parent_id'] = 0; $id = $database->insert ($this, $data); $data['id'] = $id; $this->rows[$userId][$id] = $data; $this->originalRows[$userId][$id] = $data; $this->indexByParent[$userId][$data['mode']][$data['parent_id']][$id] = $id; $this->lastInsertedData = $data; return $id; } // function insert 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 ('user_id' => $userId, '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 children ($userId, $mode, $parentId, $access=4) { // 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])) { // return found rows $found = array (); foreach ($this->indexByParent[$userId][$mode][$parentId] as $id) { // each row $found[] = $this->rows[$userId][$id]; } // each row return $found; } // return found rows else return array (); } // function children 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 search ($where, $access=4) { // function search if ( (!isset ($where['user_id']) or is_int ($where['user_id'])) and is_object ($this->database)) { // search on database return $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']); return $this->indexFoundRows ($database->select ($this, $where), $where['user_id']); } // search on file else return array (); } // function search public function createVersion ($userId, &$from, $document) { // function createVersion $lang = $document->lang; $from['flags']['updated_' . $lang] = TIME; $data = array ( 'user_id' => $userId, 'mode' => MODE_VERSION, 'parent_id' => $from['id'], 'name' => $document->lang, 'owner_id' => $document->user->userId, 'created' => TIME, 'updated' => TIME, 'text' => array () ); foreach (array_keys ($from['text']) as $field) { // each field if (isset ($from['text'][$field][$lang])) $data['text'][$field] = array ($lang => $from['text'][$field][$lang]); } // each field if (isset ($from['extras'])) { // extras exists $data['extras'] = array (); foreach ($from['extras'] as $target => $extras) { // each extra list ($prefix) = explode ('_', $target); switch ($prefix) { // switch prefix case 'box': if (isset ($from['extras'][$target]['text'])) { // text exists foreach ($from['extras'][$target]['text'] as $field => $value) { // each field if (isset ($value[$lang])) $data['extras'][$target]['text'][$field][$lang] = $value[$lang]; } // each field } // text exists if (isset ($from['extras'][$target]['local'])) $data['extras'][$target]['local'] = $from['extras'][$target]['local']; } // switch prefix } // each extra } // extras exists $this->insert ($userId, $data); } // function createVersion public function clearLanguage ($document) { // function clearLanguage global $store; $me = $document->application; if (!isset ($me->data['text']['caption']) or count ($me->data['text']['caption']) < 2) return; if ($document->actions ('version', 'clear') and isset ($document->actions['version'][2]) and strlen ($document->actions['version'][2]) == 2) { // language clear $lang = $document->actions['version'][2]; foreach (array_keys ($me->data['text']) as $field) { // each field unset ($me->data['text'][$field][$lang]); if (!$me->data['text'][$field]) unset ($me->data['text'][$field]); } // each field foreach (array_keys ($me->data['extras']) as $target) { // each target list ($prefix) = explode ('_', $target, 2); switch ($prefix) { // switch prefix case 'box': if (isset ($me->data['extras'][$field]['text'])) { // text exists foreach (array_keys ($me->data['extras'][$target]['text']) as $field) { // each field unset ($me->data['extras'][$target]['text'][$field][$lang]); if (!$me->data['extras'][$target]['text'][$field]) unset ($me->data['extras'][$target]['text'][$field]); } // each field if (!$me->data['extras'][$target]['text']) unset ($me->data['extras'][$target]); } // text exists } // switch prefix } // each target } // language clear if (count ($me->data['text']['caption']) > 1 and isset ($me->data['text']['caption'][$document->lang])) { // context clear language $langCaption = $store->control->read ('labels/lang/' . $document->lang); $document->mod->context->appendChild ('labels/action/remove_language') ->set ('lang_caption', $langCaption['text']['caption']) ->url (true, true, '_version-remove-' . $document->lang); } // context clear language } // function clearLanguage public function versioning ($document) { // function versioning $this->clearLanguage ($document); $me = $document->application; if (isset ($me->data['flags']['updated_' . $document->lang])) $updated = $me->data['flags']['updated_' . $document->lang]; else $updated = $me->data['updated']; $versions = $this->children ($me->userId, MODE_VERSION, $me->id); if (!$versions) return; $undo = array (); $redo = array (); $current = false; foreach ($versions as $version) { // each version if ($version['name'] != $document->lang) continue; if ($version['created'] < $updated) $undo[] = $version; elseif ($version['created'] == $updated) $current = true; elseif ($version['created'] > $updated) $redo[] = $version; } // each version if ($document->actions ('version', 'undo') and $undo) { // undo $update = array_pop ($undo); if ($current) $redo = true; } // undo elseif ($document->actions ('version', 'redo') and $redo) { // redo $update = array_shift ($redo); if ($current) $undo = true; } // redo if (isset ($update)) { // update $lang = $document->lang; $data = &$me->data; $data['updated'] = $update['created']; $data['flags']['updated_' . $lang] = $update['created']; $fields = array_keys (array_replace ($data['text'], $update['text'])); foreach ($fields as $field) { // update each field if (!isset ($data['text'][$field])) $data['text'][$field] = $update['text'][$field]; elseif (isset ($update['text'][$field][$lang])) $data['text'][$field][$lang] = $update['text'][$field][$lang]; else { // clear unset ($data['text'][$field][$lang]); if (!$data['text'][$field]) unset ($data['text'][$field]); } // clear } // update each field if (isset ($data['extras']) and $data['extras']) { // filter extras $modules = array_keys (array_replace ($data['extras'], $update['extras'])); foreach ($modules as $target) { // each target list ($prefix) = explode ('_', $target); switch ($prefix) { // switch prefix case 'box': if (!isset ($data['extras'][$target])) { // recreate $data['extras'][$target] = $update['extras'][$target]; break; } // recreate $fields = array_keys (array_replace ($data['extras'][$target]['text'], $update['extras'][$field]['text'])); foreach ($fields as $field) { // each field if (isset ($update['extras'][$target]['text'][$field][$lang])) $data['extras'][$target]['text'][$field][$lang] = $update['extras'][$target]['text'][$field][$lang]; else { // clear language unset ($update['extras'][$target]['text'][$field][$lang]); if (!$data['extras'][$target]['text'][$field]) unset ($data['extras'][$target]['text'][$field]); } // clear language } // each field if (!$data['extras'][$target]['text']) unset ($data['extras'][$target]); } // switch prefix } // each target } // filter extras $document->dataReplace ($me->data); } // update if ($undo) $document->mod->context->appendChild ('labels/action/undo') ->url (true, true, '_version-undo'); if ($redo) $document->mod->context->appendChild ('labels/action/redo') ->url (true, true, '_version-redo'); } // function versioning public function delete ($userId, $id) { // function delete if (defined ('TRACKING_REMOVED_PAGES') and TRACKING_REMOVED_PAGES) { // do not remove page $data = &$this->openById ($userId, $id); $data['access'] = 255; return; } // do not remove page 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]); } // 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 deleteAllChildren ($userId, $parentId) { // function deleteAllChildren $where = array ( 'user_id' => $userId, 'parent_id' => $parentId ); foreach ($this->search ($where) as $data) { // each row $this->delete ($userId, $data['id']); } // each row } // function deleteAllChildren public function close () { // function close foreach ($this->originalRows as $userId => $domainRows) { // each domain foreach ($domainRows 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 domain $this->indexByParent = array (); $this->chargedParents = array (); $this->rows = array (); $this->originalRows = array (); $this->deletedRows = array (); $this->notFound = array (); } // function close } // class eclStore_userExtras //!eof:engine/eclStore/eclStore_userExtras.php; //!file:engine/eclStore/eclStore_userFile.php; class eclStore_userFile { // class eclStore_userFile public function unlink ($userId, $name) { // function unlink global $store; $userName = $store->user->getName ($userId); if (!is_string ($name) or !strlen ($name)) return; if (is_file (FOLDER_PROFILES . $userName . '/' . $name)) unlink (FOLDER_PROFILES . $userName . '/' . $name); } // function unlink public function deletePrefixedFiles ($userId, $prefix, $mode=false) { // function deletePrefixedFiles global $store; $userName = $store->user->getName ($userId); $prefix .= CHR_FNS; $prefixLength = strlen ($prefix); $dir = scandir (FOLDER_PROFILES . $userName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) { // valid file if ($mode === false) unlink (FOLDER_PROFILES . $userName . '/' . $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_PROFILES . $userName . '/' . $fileName); break; default: if ($mode == MODE_FILE) unlink (FOLDER_PROFILES . $userName . '/' . $fileName); } // switch file type } // select file type } // valid file } // each file } // function deletePrefixedFiles public function clonePrefixedFiles ($userId, $prefix, $newPrefix) { // function clonePrefixedFiles global $store; $userName = $store->user->getName ($userId); $prefix .= CHR_FNS; $newPrefix .= CHR_FNS; $prefixLength = strlen ($prefix); $dir = scandir (FOLDER_PROFILES . $userName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) { // valid file $newFileName = $newPrefix . substr ($fileName, $prefixLength); copy (FOLDER_PROFILES . $userName . '/' . $fileName, FOLDER_PROFILES . $userName . '/' . $newFileName); } // valid file } // each file } // function clonePrefixedFiles public function renamePrefixedFiles ($userId, $prefix, $newPrefix) { // function renamePrefixedFiles global $store; $userName = $store->user->getName ($userId); $newPrefix .= CHR_FNS; $prefix .= CHR_FNS; $prefixLength = strlen ($prefix); $dir = scandir (FOLDER_PROFILES . $userName); foreach ($dir as $fileName) { // each file if (substr ($fileName, 0, $prefixLength) == $prefix) { // valid file $oldFileName = FOLDER_PROFILES . $userName . '/' . $fileName; $newFileName = FOLDER_PROFILES . $userName . '/' . $newPrefix . substr ($fileName, $prefixLength); rename ($oldFileName, $newFileName); } // valid file } // each file } // function renamePrefixedFiles public function close () { // function close } // function close } // class eclStore_userFile //!eof:engine/eclStore/eclStore_userFile.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_card.php; class eclTag_card { // class eclTag_card static function render ($render, $arguments) { // function render global $store; if (isset ($arguments[0])) $name = 'card_' . $arguments[0]; else $name = 'card'; $render->tagsStack[] = array ('card', $name); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'name' => $name, ); } // function render } // class eclTag_card //!eof:engine/eclTag/eclTag_card.php; //!file:engine/eclTag/eclTag_columns.php; class eclTag_columns { // class eclTag_columns static function render ($render, $arguments) { // function render if (isset ($arguments[0])) $name = 'columns_' . $arguments[0]; else $name = 'columns'; $render->tagsStack[] = array ('columns', $name); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'name' => $name, ); } // function render } // class eclTag_columns //!eof:engine/eclTag/eclTag_columns.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->tagsStack[] = array ('cut', $name); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'label' => $name, 'once' => $once ); } // 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['parsed'] = array (); foreach ($details as $name) { // each detail if (!strlen ($name = trim ($name))) continue; $data = $render->block ('details/' . $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)); } // 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_endcard.php; class eclTag_endcard { // class eclTag_endcard static function render ($render, $arguments) { // function render $name = $render->stackPop ('card'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $render->scissorsIndex--; $border = $render->block ('borders/card'); if (!isset ($border['html'])) return; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); $data = $render->block ('modules/' . $name); if (!$data) $data = $render->block ('modules/card'); $data['html'] = $border['html']; $data['local']['value'] = $cut; return $data; } // function render } // class eclTag_endcard //!eof:engine/eclTag/eclTag_endcard.php; //!file:engine/eclTag/eclTag_endcolumns.php; class eclTag_endcolumns { // class eclTag_endcolumns static function render ($render, $arguments) { // function render $name = $render->stackPop ('columns'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $render->scissorsIndex--; $border = $render->block ('borders/columns'); if (!isset ($border['html'])) return; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); $data = $render->block ('modules/' . $name); if (!$data) $data = $render->block ('modules/columns'); $data['html'] = $border['html']; $data['local']['value'] = $cut; return $data; } // function render } // class eclTag_endcolumns //!eof:engine/eclTag/eclTag_endcolumns.php; //!file:engine/eclTag/eclTag_endcut.php; class eclTag_endcut { // class eclTag_endcut static function render ($render, $arguments) { // function render $name = $render->stackPop ('cut'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $label = $render->scissors[$render->scissorsIndex]['label']; $once = $render->scissors[$render->scissorsIndex]['once']; $render->scissorsIndex--; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); if (is_bool ($label) or $label == '') return; while ($render->pasteIndex and $render->pastePointer[$render->pasteIndex] > $position) { // clear paste points $render->pasteIndex--; } // clear paste points 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[$label])) $render->cuts[$label] .= $cut; else $render->cuts[$label] = $cut; } // function render } // class eclTag_endcut //!eof:engine/eclTag/eclTag_endcut.php; //!file:engine/eclTag/eclTag_endgrid.php; class eclTag_endgrid { // class eclTag_endgrid static function render ($render, $arguments) { // function render $name = $render->stackPop ('grid'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $render->scissorsIndex--; $border = $render->block ('borders/grid'); if (!isset ($border['html'])) return; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); $data = $render->block ('modules/' . $name); if (!$data) $data = $render->block ('modules/grid'); $data['html'] = $border['html']; $data['local']['value'] = $cut; return $data; } // function render } // class eclTag_endgrid //!eof:engine/eclTag/eclTag_endgrid.php; //!file:engine/eclTag/eclTag_endscript.php; class eclTag_endscript { // class eclTag_endscript static function render ($render) { // function render $name = $render->stackPop ('script'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $label = $render->scissors[$render->scissorsIndex]['label']; $once = $render->scissors[$render->scissorsIndex]['once']; $render->scissorsIndex--; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); if (is_bool ($label) or $label == '') 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[$label])) $render->cuts[$label] .= $cut; else $render->cuts[$label] = $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 $name = $render->stackPop ('style'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $label = $render->scissors[$render->scissorsIndex]['label']; $once = $render->scissors[$render->scissorsIndex]['once']; $render->scissorsIndex--; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); if (is_bool ($label) or $label == '') 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[$label])) $render->cuts[$label] .= $cut; else $render->cuts[$label] = $cut; } // function render } // class eclTag_endstyle //!eof:engine/eclTag/eclTag_endstyle.php; //!file:engine/eclTag/eclTag_endtable.php; class eclTag_endtable { // class eclTag_endtable static function render ($render, $arguments) { // function render $name = $render->stackPop ('table'); if ($name === false) return; if (!$render->scissorsIndex) return; $position = $render->scissors[$render->scissorsIndex]['position']; $render->scissorsIndex--; $border = $render->block ('borders/table'); if (!isset ($border['html'])) return; $cut = substr ($render->buffer, $position); $render->buffer = substr ($render->buffer, 0, $position); $data = $render->block ('modules/' . $name); if (!$data) $data = $render->block ('modules/table'); $data['html'] = $border['html']; $data['local']['value'] = $cut; return $data; } // function render } // class eclTag_endtable //!eof:engine/eclTag/eclTag_endtable.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/' . $render->getVar ('type'); $data = $render->block ($name); if (!isset ($data['html'])) return; unset ($data['text']); 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_font_stack.php; class eclTag_font_stack { // class eclTag_font_stack static function render ($render, $arguments) { // function render if (!$arguments) return; $font = $render->block ('fonts/' . $arguments[0]); if (isset ($font['local']['font-stack'])) $render->buffer .= $font['local']['font-stack']; if (isset ($font['local']['font-face'])) { // append font-face $fontFace = $font['local']['font-face']; if (!isset ($render->cuts['font-face'])) { // first cut $render->cuts['font-face'] = $fontFace . CRLF; return; } // first cut if (strpos ($render->cuts['font-face'], $fontFace) === false) $render->cuts['font-face'] .= $fontFace . CRLF; } // append font-face } // function render } // class eclTag_font_stack //!eof:engine/eclTag/eclTag_font_stack.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['local']['gender'])) $render->buffer .= $male; elseif ($render->document->user->data['local']['gender'] == 'female') $render->buffer .= $female; else $render->buffer .= $male; } // function render } // class eclTag_gender //!eof:engine/eclTag/eclTag_gender.php; //!file:engine/eclTag/eclTag_grid.php; class eclTag_grid { // class eclTag_grid static function render ($render, $arguments) { // function render if (isset ($arguments[0])) $name = 'grid_' . $arguments[0]; else $name = 'grid'; $render->tagsStack[] = array ('grid', $name); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'name' => $name, ); } // function render } // class eclTag_grid //!eof:engine/eclTag/eclTag_grid.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; $control = array (); $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 ('icon')) $local['icon'] = $render->getVar ('icon'); } // from current control elseif ($render->getVar ('help_msg')) { // from previous defined message $control = $store->control->read ($render->getVar ('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['url'] = $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_inline_class.php; class eclTag_inline_class { // class eclTag_inline_class static function render ($render, $arguments) { // function render if (!isset ($arguments[0][0])) return false; $result = array(); foreach (explode (' ', $arguments[0]) as $field) { // each field $parts = explode ('$', $field); if (!isset ($parts[1])) { // discrete class $result[] = $parts[0]; continue; } // discrete class $options = explode ('??', $parts[1]); $value = $render->getVar ($options[0]); if ($value !== '') { // exists $result[] = $parts[0] . $value; continue; } // exists if (!isset ($options[1])) continue; $result[] = $parts[0] . $options[1]; } // each field if (!$result) return false; $render->buffer .= ' class="' . implode (' ', $result) . '"'; return false; } // function render } // class eclTag_inline_class //!eof:engine/eclTag/eclTag_inline_class.php; //!file:engine/eclTag/eclTag_inline_lang.php; class eclTag_inline_lang { // class eclTag_inline_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_inline_lang //!eof:engine/eclTag/eclTag_inline_lang.php; //!file:engine/eclTag/eclTag_inline_style.php; class eclTag_inline_style { // class eclTag_inline_style static function render ($render, $arguments) { // function render if (!isset ($arguments[0][0])) return false; $result = array(); foreach (explode (';', $arguments[0]) as $field) { // each field if (!isset ($field[0])) continue; if (!strpos ($field, ':')) continue; list ($property, $value) = explode (':', $field); $property = trim ($property); $value = trim ($value); if ($value[0] != '$') { // static value $result[] = $property . ':' . $value; continue; } // static value $value = $render->getVar (substr ($value, 1)); if ($value === '') continue; $result[] = $property . ':' . strval ($value); } // each field if (!$result) return false; $render->buffer .= ' style="' . implode ('; ', $result) . '"'; return false; } // function render } // class eclTag_inline_style //!eof:engine/eclTag/eclTag_inline_style.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; $url = $document->url ($pathway); $buffer = '' . $label . "" . CRLF; $render->buffer .= $buffer; } // function render } // class eclTag_key //!eof:engine/eclTag/eclTag_key.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]) and isset ($arguments[0][0])) $name = 'lists/' . $arguments[0]; else $name = 'lists/default'; // Procuramos o bloco $data = $render->block ($name); unset ($data['text'], $data['local']); // 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; $data['me'] = $render->children[$render->index - 1]->children[0]->me; 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; $data['me'] = $render->children[0]->me; $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->me = $render->children[$render->index - 1]->me; $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; // hide $buffer = ''; $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->me = $render->children[$render->index - 1]->me; $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 (!$arguments) $arguments[0] = 'module'; switch ($arguments[0]) { // switch argument case 'post': if (!$render->document->templateEditable) return; if ($render->me === false) return; $document = $render->document; $me = $render->me; if (!$me->domainId or !$me->id) return; if (!$document->access (4, $me->groups)) return; $data = $store->control->read ('blocks/personalite'); $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'card'); $data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modCard_edit'); $data['local']['personalite_caption'] = $caption['text']['caption']; return $data; break; default: if (!isset ($render->data['personalite_url'])) return; $block = $store->control->read ('blocks/personalite'); $block['local']['personalite_url'] = $render->data['personalite_url']; $block['local']['personalite_caption'] = $render->data['personalite_caption']; return $block; } // switch argument } // 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['url'])) $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['url'])) $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; $class = array_shift ($arguments); if (!preg_match ('/^[a-z][a-z0-9_]*$/', $class)) return false; $class = 'eclScope_' . $class; return $class::get ($render, $arguments); } // 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->tagsStack[] = array ('script', true); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'label' => 'script', 'once' => false ); } // 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->urlFiles ($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->tagsStack[] = array ('style', true); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'label' => 'style', 'once' => false ); } // function render } // class eclTag_style //!eof:engine/eclTag/eclTag_style.php; //!file:engine/eclTag/eclTag_table.php; class eclTag_table { // class eclTag_table static function render ($render, $arguments) { // function render if (isset ($arguments[0])) $name = 'table_' . $arguments[0]; else $name = 'table'; $render->tagsStack[] = array ('table', $name); $render->scissorsIndex++; $render->scissors[$render->scissorsIndex] = array ( 'position' => strlen ($render->buffer), 'name' => $name, ); } // function render } // class eclTag_table //!eof:engine/eclTag/eclTag_table.php; //!file:engine/eclTag/eclTag_tel.php; class eclTag_tel { // class eclTag_tel 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_tel //!eof:engine/eclTag/eclTag_tel.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])) return; 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 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_up.php; class eclTag_up { // class eclTag_up static function render ($render, $arguments) { // function render if (!$arguments) return false; $value = implode (' ', $arguments); $buffer = '' . $value . ''; $render->buffer .= $buffer; } // function render } // class eclTag_up //!eof:engine/eclTag/eclTag_up.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/constants/eclFilter_admin_constants_flag.php; /* * control_type * control_filter * control_target * control_field_name * control_value_cast int | string | bool */ class eclFilter_admin_constants_flag { // class eclFilter_admin_constants_flag static function create ($fieldName, $control, $formulary) { // function create global $io, $store; // target if (!isset ($control['flags']['target'])) return; $target = $control['flags']['target']; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['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 (is_string ($value)) $value = $formulary->htmlSpecialChars ($value); 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']['value']) or !isset ($data['text']['caption'])) continue; $local = array ( 'value' => $data['flags']['value'], 'caption' => $data['text']['caption'] ); $item->appendChild (false, $local) ->active ($data['flags']['value'] == $value); } // each child } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; // target if (!isset ($control['flags']['target'])) return; $target = $control['flags']['target']; if (isset ($formulary->received[$fieldName])) $value = $formulary->received[$fieldName]; else $value = false; if ($value === false and isset ($control['flags']['required'])) $formulary->setRequiredMsg ($control, $fieldName); if (isset ($control['flags']['value_cast'])) { // cast value switch ($control['flags']['value_cast']) { // switch type case 'int': $value = intval ($value); break; case 'string': $value = strval ($value); if (!preg_match ('/^[\ -~]*$/', $value)) return $formulary->setErrorMsg ($control, $fieldName, 'system_msg_filterFlagError', $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); } // switch type } // cast value // target if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $formulary->data[$target] = $value; else $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_admin_constants_flag //!eof:library/admin/constants/eclFilter_admin_constants_flag.php; //!file:library/admin/constants/eclFilter_admin_constants_folder.php; /* * control_type * control_filter * control_target * control_field_name */ class eclFilter_admin_constants_folder { // class eclFilter_admin_constants_folder static function create ($fieldName, $control, $formulary) { // function create global $io; // target if (!isset ($control['flags']['target'])) return; $target = $control['flags']['target']; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['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']['target'])) return; $target = $control['flags']['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, 'admin_constants_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 (PATH_ROOT . $old)) return; } // normal if (!preg_match ('%^[.]?[a-zA-Z0-9_-]+\/?$%', $value)) return $formulary->setErrorMsg ($control, $fieldName, 'admin_constants_filterFolderError', $value); // check for name conflict $folders = array ('FOLDER_DATABASE', 'FOLDER_DOMAINS', 'FOLDER_ENGINE', 'FOLDER_LIBRARY', 'FOLDER_PROFILES', 'FOLDER_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, 'admin_constants_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, 'admin_constants_filterFolderExists', $value); } // check folder if (defined ('SYSTEM_INSTALLATION_PROGRESS')) return $formulary->setField ($target, $value); if (is_dir (PATH_ROOT . $value)) return $formulary->setErrorMsg ($control, $fieldName, 'admin_constants_filterFolderExists', $value); if (is_dir (PATH_ROOT . $old)) rename (PATH_ROOT . $old, PATH_ROOT . $value); elseif (!is_dir (PATH_ROOT . $value)) mkdir (PATH_ROOT . $value); $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_admin_constants_folder //!eof:library/admin/constants/eclFilter_admin_constants_folder.php; //!file:library/admin/constants/eclFilter_admin_constants_password.php; /* * control_type * control_filter * control_target * control_field_name */ class eclFilter_admin_constants_password { // class eclFilter_admin_constants_password static function create ($fieldName, $control, $formulary) { // function create global $io, $store; // target if (!isset ($control['flags']['target'])) return; // name $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['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']['target'])) return; $target = $control['flags']['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']['required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'system_msg_filterPasswordRequired'); if (!preg_match ('/^[\ -~]+$/', $value)) return $formulary->setErrorMsg ($control, $fieldName, 'system_msg_filterPasswordInvalidCharacter'); if (!isset ($formulary->received[$fieldName . '_2'])) return $formulary->setErrorMsg ($control, $fieldName, 'system_msg_filterPasswordRepeatError'); if ($formulary->received[$fieldName . '_2'] != $value) return $formulary->setErrorMsg ($control, $fieldName, 'system_msg_filterPasswordRepeatError'); // target if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $formulary->data[$target] = md5 ($value); else $io->systemConstants->set ($target, md5 ($value)); } // function save } // class eclFilter_admin_constants_password //!eof:library/admin/constants/eclFilter_admin_constants_password.php; //!file:library/admin/constants/eclFilter_admin_constants_select.php; class eclFilter_admin_constants_select { // class eclFilter_admin_constants_select static function create ($fieldName, $control, $formulary) { // function create global $io, $store; if (!isset ($control['flags']['target'])) return; $target = $control['flags']['target']; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['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']['value'])) { // value exists $child->data['value'] = $data['flags']['value']; $child->active ($data['flags']['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']['value']) and $child['flags']['value'] == $value) { // value found $found = $value; break; } // value found } // each child } // children exists $value = $found; // required if ($value === false and isset ($control['flags']['required'])) return $formulary->setRequiredMsg ($control, $fieldName); // control_default_value elseif ($value === false and isset ($control['flags']['default_value'])) $value = $control['flags']['default_value']; // value cast if (isset ($control['flags']['value_cast'])) { // cast value switch ($control['flags']['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']['target'])) $io->systemConstants->set ($control['flags']['target'], $value); } // function save } // class eclFilter_admin_constants_select //!eof:library/admin/constants/eclFilter_admin_constants_select.php; //!file:library/admin/constants/eclFilter_admin_constants_selectCurrency.php; class eclFilter_admin_constants_selectCurrency { // class eclFilter_admin_constants_selectCurrency static function create ($fieldName, $control, $formulary) { // function create global $dataMap, $io, $store; $document = $formulary->document; if (!isset ($control['flags']['target'])) return; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'select'; if ($io->systemConstants->check ($control['flags']['target'])) $value = $io->systemConstants->constants[$control['flags']['target']]; elseif (defined ($control['flags']['target'])) $value = constant ($control['flags']['target']); else $value = false; $names = array (); if (isset ($dataMap['t']['labels/currency'])) { // from embeded $names = array_keys ($dataMap['t']['labels/currency']); } // from embeded elseif (is_dir (PATH_TEMPLATES . 'labels/currency')) { // from folder foreach (scandir (PATH_TEMPLATES . 'labels/currency') as $filename) { // each file if ($filename[0] == '.') continue; $names[] = substr ($filename, 0, 3); } // each file } // from folder foreach ($names as $currency) { // each currency $data = $store->control->read ('labels/currency/' . $currency); $symbol = $currency . ' '; if (isset ($data['local']['symbol'])) $symbol .= '(' . $data['local']['symbol'] . ') '; $local = array ('value' => $currency); if (isset ($data['text'])) $local['caption'] = $document->textMerge ($symbol, $data['text']['caption']); else $local['caption'] = $document->textMerge ($symbol, $data['text']['caption']); if ($value == $currency) $local['active'] = 1; $item->appendChild ($local); } // 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']['target'])) $io->systemConstants->set ($control['flags']['target'], $value); } // function save } // class eclFilter_admin_constants_selectCurrency //!eof:library/admin/constants/eclFilter_admin_constants_selectCurrency.php; //!file:library/admin/constants/eclFilter_admin_constants_selectLang.php; class eclFilter_admin_constants_selectLang { // class eclFilter_admin_constants_selectLang static function create ($fieldName, $control, $formulary) { // function create global $dataMap, $io, $store; $document = $formulary->document; if (!isset ($control['flags']['target'])) return; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'select'; if ($io->systemConstants->check ($control['flags']['target'])) $value = $io->systemConstants->constants[$control['flags']['target']]; elseif (defined ($control['flags']['target'])) $value = constant ($control['flags']['target']); else $value = false; $names = array (); if (isset ($dataMap['t']['labels/lang'])) { // from embeded $names = array_keys ($dataMap['t']['labels/lang']); } // from embeded elseif (is_dir (PATH_TEMPLATES . 'labels/lang')) { // from folder foreach (scandir (PATH_TEMPLATES . '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']['target'])) $io->systemConstants->set ($control['flags']['target'], $value); } // function save } // class eclFilter_admin_constants_selectLang //!eof:library/admin/constants/eclFilter_admin_constants_selectLang.php; //!file:library/admin/constants/eclFilter_admin_constants_selectOptions.php; class eclFilter_admin_constants_selectOptions { // class eclFilter_admin_constants_selectOptions static function create ($fieldName, $control, $formulary) { // function create global $dataMap, $io, $store; $document = $formulary->document; if (!isset ($control['flags']['target'])) return; $target = $control['flags']['target']; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['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']['target'])) return; $target = $control['flags']['target']; if (!isset ($formulary->received[$fieldName])) return; $value = $formulary->received[$fieldName]; $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_admin_constants_selectOptions //!eof:library/admin/constants/eclFilter_admin_constants_selectOptions.php; //!file:library/admin/eclApp_admin.php; class eclApp_admin { // class eclApp_admin const menuType = 'domain'; 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_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/eclFilter_admin_ok.php; class eclFilter_admin_ok { // class eclFilter_admin_ok static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['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, 'system_msg_filterConfirmWithOkError'); } // function save } // class eclFilter_admin_ok //!eof:library/admin/eclFilter_admin_ok.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 ('modules/list'); $row = $mod->appendChild (); foreach ($me->menuChildren ($document) as $child) { // each child $row->appendChild ($child) ->swapTitle () ->url ($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/adminAlerts/eclApp_adminAlerts.php; class eclApp_adminAlerts { // class eclApp_adminAlerts const name = 'alerts'; const menuType = 'section'; const dataFrom = 'adminAlerts_main'; const access = 4; static function constructor_helper ($me) { // function constructor_helper $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (!count ($me->children ())) $document->dataMerge ('adminAlerts_mainEmpty'); else $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_adminAlerts //!eof:library/adminAlerts/eclApp_adminAlerts.php; //!file:library/adminAlerts/log/eclApp_adminAlerts_log.php; class eclApp_adminAlerts_log { // class eclApp_adminAlerts_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 (PATH_DATABASE . 'log/.ht_error')) $names[] = 'log_error'; if (is_file (PATH_DATABASE . '.database.log')) $names[] = 'log_database'; if (is_file (PATH_ROOT . '.error_log')) $names[] = 'log_php'; if (!defined ('DATABASE_ENABLED') or !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 ('adminAlerts_' . $me->name); 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', 'config'); 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_adminAlerts_log //!eof:library/adminAlerts/log/eclApp_adminAlerts_log.php; //!file:library/adminAlerts/update/eclApp_adminAlerts_update.php; class eclApp_adminAlerts_update { // class eclApp_adminAlerts_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 global $io; if (defined ('SYSTEM_ENGINE_UPDATE_CHECK')) { // last check defined $value = $io->webservice->json2array (SYSTEM_ENGINE_UPDATE_CHECK); if (isset ($value['request_date'])) { // request exists list ($y, $m, $d) = explode ('-', $value['request_date']); $requestDate = mktime (0, 0, 30, $m, $d, $y); if ($requestDate + 1296000 > TIME) { // do not check again if (isset ($value['release']) and $value['release'] == SYSTEM_RELEASE) return array (); // compare dates list ($y, $m, $d) = explode ('-', SYSTEM_RELEASE); $currentRelease = mktime (0, 0, 30, $m, $d, $y); list ($y, $m, $d) = explode ('-', $value['release']); $nextRelease = mktime (0, 0, 30, $m, $d, $y); if ($currentRelease > $nextRelease) return array (); return array ('update'); } // do not check again } // request exists } // last check defined $data = $io->webservice->request (SYSTEM_ENGINE_UPDATE_URL); if (isset ($data['EcolaboreEngine'])) { // update found $data = $data['EcolaboreEngine']; $data['request_date'] = date ('Y-m-d', TIME); $io->systemConstants->set ('SYSTEM_ENGINE_UPDATE_CHECK', $io->webservice->array2json ($data)); if (isset ($data['release']) and $data['release'] == SYSTEM_RELEASE) return array (); // compare dates list ($y, $m, $d) = explode ('-', SYSTEM_RELEASE); $currentRelease = mktime (0, 0, 30, $m, $d, $y); list ($y, $m, $d) = explode ('-', $data['release']); $nextRelease = mktime (0, 0, 30, $m, $d, $y); if ($currentRelease > $nextRelease) return array (); return array ('update'); } // update found // A problem occurred return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('adminAlerts_update_newReleaseAvailable'); $me->pathway = array (SYSTEM_ADMIN_URI, 'system', 'update'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $system; $me = $document->application; $document->application = $system->child (SYSTEM_ADMIN_URI)->child ('system')->child ('update'); $document->application->dispatch ($document); } // function dispatch } // class eclApp_adminAlerts_update //!eof:library/adminAlerts/update/eclApp_adminAlerts_update.php; //!file:library/adminComponents/config/eclApp_adminComponents_config.php; class eclApp_adminComponents_config { // class eclApp_adminComponents_config const name = 'config'; const menuType = 'section'; const dataFrom = 'adminComponents_config_content'; static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_adminComponents_config //!eof:library/adminComponents/config/eclApp_adminComponents_config.php; //!file:library/adminComponents/eclApp_adminComponents.php; class eclApp_adminComponents { // class eclApp_adminComponents const name = 'components'; const menuType = 'section'; const dataFrom = 'adminComponents_content'; const access = 4; static function constructor_helper ($me) { // function constructor_helper $me->map = array ('adminComponents_config'); } // function constructor_helper static function dispatch ($document) { // function dispatch if (!is_dir (PATH_COMPONENTS)) { // create folder $formulary = $document->createFormulary ('adminComponents_folder', array (), 'createFolder'); if (!$formulary->command ('create') or !$formulary->save ()) { // view form $document->mod->formulary = $formulary; return; } // view form } // create folder $formulary = $document->createFormulary ('adminComponents_edit'); $formulary->command ('save') and $formulary->save (); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminComponents //!eof:library/adminComponents/eclApp_adminComponents.php; //!file:library/adminComponents/eclFilter_adminComponents_selectVersion.php; class eclFilter_adminComponents_selectVersion { // class eclFilter_adminComponents_selectVersion static function create ($fieldName, $control, $formulary) { // function create global $io; $components = $io->systemConstants->components; $document = $formulary->document; foreach (scandir (PATH_COMPONENTS) as $component) { // each folder if ($component[0] == '.') continue; if (!is_dir (PATH_COMPONENTS . $component)) continue; $local = array (); $local['text']['caption'] = $document->textMerge ($component); $local['name'] = $fieldName . '_' . $component; $local['type'] = 'select'; $select = $formulary->appendChild ($local); $select->appendChild ('adminComponents_editComponentDisabled') ->active (!isset ($components[$component]) or !is_dir (PATH_COMPONENTS . $component . '/' . $components[$component])); foreach (scandir (PATH_COMPONENTS . $component) as $version) { // each version if ($version[0] == '.') continue; if (!is_dir (PATH_COMPONENTS . $component . '/' . $version)) continue; $data['value'] = $version; $data['caption'] = $document->textMerge ($version); $select->appendChild ($data) ->active (isset ($components[$component]) and $version == $components[$component]); } // each version } // each folder } // function create static function save ($fieldName, $control, $formulary) { // function save global $io; $received = $formulary->received; $components = array (); $aliases = array (); $map = array (); foreach (scandir (PATH_COMPONENTS) as $component) { // each component if ($component[0] == '.') continue; if (!is_dir (PATH_COMPONENTS . $component)) continue; if (!isset ($received[$fieldName . '_' . $component][0])) continue; if (!is_dir (PATH_COMPONENTS . $component . '/' . $received[$fieldName . '_' . $component])) continue; $components[$component] = $received[$fieldName . '_' . $component]; foreach (scandir (PATH_COMPONENTS . $component . '/' . $components[$component]) as $folder) { // aliase each folder if ($folder[0] == '.') continue; if ($folder == 'shared' or $folder == 'templates') continue; if (!is_dir (PATH_COMPONENTS . $component . '/' . $components[$component] . '/' . $folder)) continue; $aliases[$folder] = $component; } // aliase each folder if (!is_file (PATH_COMPONENTS . $component . '/' . $components[$component] . '/about.ecl.php')) continue; $data = $io->file->open (PATH_COMPONENTS . $component . '/' . $components[$component] . '/about.ecl.php'); if (!isset ($data['map'])) continue; foreach ($data['map'] as $module => $list) { // map each module foreach ($list as $item) { // map each item if (!isset ($map[$module])) $map[$module] = array (); $map[$module][] = $item; } // map each item } // map each module } // each component ksort ($components); ksort ($map); ksort ($aliases); $io->systemConstants->components = $components; $io->systemConstants->aliases = $aliases; $io->systemConstants->map = $map; } // function save } // class eclFilter_adminComponents_selectVersion //!eof:library/adminComponents/eclFilter_adminComponents_selectVersion.php; //!file:library/adminDatabase/config/eclApp_adminDatabase_config.php; class eclApp_adminDatabase_config { // class eclApp_adminDatabase_config const name = 'config'; const menuType = 'section'; const dataFrom = 'adminDatabase_config_content'; 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 ('admin_constants_databaseEnabledSuccess'); else $document->mod->humperstilshen->alert ('admin_constants_databaseEnabledFailed'); } // check database connection else $document->mod->humperstilshen->alert ('admin_constants_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 const name = 'database'; const menuType = 'section'; const dataFrom = 'adminDatabase_content'; const access = 4; const map = 'adminDatabase_config adminDatabase_encrypt adminDatabase_query adminDatabase_log'; static function dispatch ($document) { // function dispatch if (!is_dir (PATH_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/encrypt/eclApp_adminDatabase_encrypt.php; class eclApp_adminDatabase_encrypt { // class eclApp_adminDatabase_encrypt const name = 'encrypt'; const menuType = 'section'; const dataFrom = 'adminDatabase_encrypt_content'; static function dispatch ($document) { // function dispatch if ($document->actions ('key', 'generate')) return self::action_key_generate ($document); if ($document->actions ('key', 'import')) return self::action_key_import ($document); if (!defined ('SYSTEM_ENCRYPT_TYPE')) return self::action_create_key ($document); } // function dispatch static function action_create_key ($document) { // function action_create_key $formulary = $document->createFormulary ('adminDatabase_encrypt_key', array (), 'step1'); if ($formulary->command ('next') and $formulary->save ()) { // go next if ($formulary->data['mode'] == 'generate') return self::action_key_generate ($document); return self::action_key_import ($document); } // go next $document->mod->formulary = $formulary; $document->dataMerge ('adminDatabase_encrypt_contentKey'); } // function action_create_key static function action_key_generate ($document) { // function action_key_generate $formulary = $document->createFormulary ('adminDatabase_encrypt_generate', array (), 'generate'); if ($formulary->command ('previous')) return self::action_create_key ($document); if ($formulary->command ('next') and $formulary->save ()) { // generate key } // generate key $formulary->action = '_key-generate'; $document->mod->formulary = $formulary; $document->dataMerge ('adminDatabase_encrypt_contentGenerate'); } // function action_key_generate static function action_key_import ($document) { // function action_key_import $formulary = $document->createFormulary ('adminDatabase_encrypt_import', array (), 'import'); if ($formulary->command ('previous')) return self::action_create_key ($document); if ($formulary->command ('next') and $formulary->save ()) { // import key } // import key $formulary->action = '_key-import'; $document->mod->formulary = $formulary; $document->dataMerge ('adminDatabase_encrypt_contentImport'); } // function action_key_import } // class eclApp_adminDatabase_encrypt //!eof:library/adminDatabase/encrypt/eclApp_adminDatabase_encrypt.php; //!file:library/adminDatabase/encrypt/eclFilter_adminDatabase_encrypt_algorithms.php; class eclFilter_adminDatabase_encrypt_algorithms { // class eclFilter_adminDatabase_encrypt_algorithms static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'select'; if (defined ('SYSTEM_ENCRYPT_ALGORITHM')) $value = SYSTEM_ENCRYPT_ALGORITHM; else $value = 'blowfish'; foreach (mcrypt_list_algorithms () as $algorithm) { // each algorithm $item->appendChild (array ( 'value' => $algorithm, 'caption' => $document->textMerge ($algorithm), 'active' => $algorithm == $value, )); } // each algorithm } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminDatabase_encrypt_algorithms //!eof:library/adminDatabase/encrypt/eclFilter_adminDatabase_encrypt_algorithms.php; //!file:library/adminDatabase/log/eclApp_adminDatabase_log.php; class eclApp_adminDatabase_log { // class eclApp_adminDatabase_log const name = 'log'; const menuType = 'section'; const dataFrom = 'adminDatabase_log_content'; static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminDatabase_log_edit'); if ($formulary->command ('save') and $formulary->save ()) $document->mod->humperstilshen->alert ('system_msg_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']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'textarea'; $string = &$io->fileBinary->open (PATH_DATABASE . '.database.log'); if ($formulary->command ('clear_log')) $string = ''; $log = $io->fileBinary->open (PATH_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 const name = 'query'; const menuType = 'section'; const dataFrom = 'adminDatabase_query_content'; 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/adminDefault/eclApp_adminDefault.php; class eclApp_adminDefault { // class eclApp_adminDefault const name = '-default'; const dataFrom = 'adminDefault_content'; const ignoreSubfolders = true; } // class eclApp_adminDefault //!eof:library/adminDefault/eclApp_adminDefault.php; //!file:library/adminDomains/add/eclApp_adminDomains_add.php; class eclApp_adminDomains_add { // class eclApp_adminDomains_add const name = '-new-domain'; const menuType = 'section'; const dataFrom = 'adminDomains_add_content'; const access = 4; static function dispatch ($document) { // function dispatch global $io, $store; $formulary = $document->createFormulary ('adminDomains_add_edit', array (), 'domainAdd'); if ($formulary->command ('save') and $formulary->save ()) { // formulary saved $domain['name'] = $formulary->data['name']; $domain['status'] = 1; mkdir (PATH_DOMAINS . $domain['name']); $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; $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->url (); return; } // formulary saved $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminDomains_add //!eof:library/adminDomains/add/eclApp_adminDomains_add.php; //!file:library/adminDomains/add/eclFilter_adminDomains_add_admin.php; class eclFilter_adminDomains_add_admin { // class eclFilter_adminDomains_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']['type'])) $item->data['type'] = $control['flags']['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, 'adminDomains_add_editAdminRequired'); $userId = $store->user->getId ($formulary->received[$fieldName]); // required if (!$userId) return $formulary->setRequiredMsg ($control, $fieldName, 'adminDomains_add_editAdminRequired'); $formulary->data['admin_id'] = $userId; } // function save } // class eclFilter_adminDomains_add_admin //!eof:library/adminDomains/add/eclFilter_adminDomains_add_admin.php; //!file:library/adminDomains/add/eclFilter_adminDomains_add_name.php; /* * Control flags * control_type * control_target * control_field_name * control_required */ class eclFilter_adminDomains_add_name { // class eclFilter_adminDomains_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']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'text'; // target if (isset ($control['flags']['target'])) $item->data['value'] = $formulary->getField ($control['flags']['target']); return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->received[$fieldName])) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_add_editNameInvalidChars'); $value = trim ($formulary->received[$fieldName], ' -_'); if (!strlen ($value)) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_add_editNameInvalidChars'); if (strlen ($value) > 18) $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_add_editNameSoLong'); elseif (!preg_match ('/^[a-z0-9][a-z0-9_-]+$/', $value)) $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_add_editNameInvalidChars'); elseif (is_dir (PATH_DOMAINS . $value)) $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_add_editNameAlreadyExists'); if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_adminDomains_add_name //!eof:library/adminDomains/add/eclFilter_adminDomains_add_name.php; //!file:library/adminDomains/details/eclApp_adminDomains_details.php; class eclApp_adminDomains_details { // class eclApp_adminDomains_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 ('adminDomains_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->url (); $document->application = $me->parent; $document->application->dispatch ($document); return; } // creates a register $remove = $document->createFormulary ('adminDomains_details_contextRemoveConfirm', array (), 'domainRemove'); if ($remove->save ()) return self::action_remove ($document); elseif ($remove->errorMsg) $document->mod->humperstilshen->alert ($remove->errorMsg); $formulary = $document->createFormulary ('adminDomains_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->domainId, 1); unset ($group[$formulary->data['admin_select']]); } // remove an administrator elseif ($formulary->command ('save') and !$formulary->errorMsg) { // save $formulary->data['name'] = '-register'; if (!isset ($formulary->data['text']['caption'])) $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 = 'system_msg_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 ('adminDomains_details_contextRemove') ->confirm ('adminDomains_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->domainExtras, array ('domain_id' => $id)); $io->database->delete ($store->domainGroups, array ('domain_id' => $id)); foreach (scandir (PATH_DOMAINS . $me->name) as $filename) { // each domain file if (is_file (PATH_DOMAINS . $me->name . '/' . $filename)) unlink (PATH_DOMAINS . $me->name . '/' . $filename); } // each domain file rmdir (PATH_DOMAINS . $me->name); // returns to parent page $parent = $me->parent; $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->url (); } // function action_remove } // class eclApp_adminDomains_details //!eof:library/adminDomains/details/eclApp_adminDomains_details.php; //!file:library/adminDomains/details/eclFilter_adminDomains_details_adminAdd.php; class eclFilter_adminDomains_details_adminAdd { // class eclFilter_adminDomains_details_adminAdd static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['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][0])) { // received value $value = trim ($formulary->received[$fieldName], ' -_'); if (!preg_match ('/^[a-z0-9_-]+$/', $value)) $value = false; } // received value else $value = false; if ($value === false) return $formulary->setRequiredMsg ($control, $fieldName); $userId = $store->user->getId ($value); if (!$userId) $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_details_alertAdminRequired'); $domainId = $formulary->document->application->domainId; $group = $store->domainGroup->open ($domainId, 1); if (isset ($group[$userId]) and $group[$userId] == 4) $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_details_alertAdminAlreadyExists', $value); $formulary->setField ('admin_id', $userId); $formulary->setField ('admin_name', $value); } // function save } // class eclFilter_adminDomains_details_adminAdd //!eof:library/adminDomains/details/eclFilter_adminDomains_details_adminAdd.php; //!file:library/adminDomains/details/eclFilter_adminDomains_details_adminSelect.php; class eclFilter_adminDomains_details_adminSelect { // class eclFilter_adminDomains_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']['type'])) $item->data['type'] = $control['flags']['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; $userId = 0; if (isset ($formulary->received[$fieldName][0])) $userId = intval ($formulary->received[$fieldName]); if (!$userId) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_details_alertAdminPleaseSelect'); $domainId = $formulary->document->application->domainId; $group = $store->domainGroup->open ($domainId, 1); if (!isset ($group[$userId])) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_details_alertAdminRemoveError'); $i = 0; foreach ($group as $status) { // each status if ($status == 4) $i++; } // each status if ($i <= 1) return $formulary->setErrorMsg ($control, $fieldName, 'adminDomains_details_alertAdminRemoveLast'); $formulary->data['admin_select'] = $userId; } // function save } // class eclFilter_adminDomains_details_adminSelect //!eof:library/adminDomains/details/eclFilter_adminDomains_details_adminSelect.php; //!file:library/adminDomains/eclApp_adminDomains.php; class eclApp_adminDomains { // class eclApp_adminDomains const name = 'domains'; const menuType = 'section'; const dataFrom = 'adminDomains_content'; static function constructor_helper ($me) { // function constructor_helper global $io, $store; if ($io->database->tableEnabled ($store->domain) and is_dir (PATH_DOMAINS)) $me->map = array ('adminDomains_add', 'adminDomains_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 ('adminDomains_contentDisabled'); return; } // disabled if (!is_dir (PATH_DOMAINS) and !$document->access (4)) { // no folder for visitors $document->dataMerge ('adminDomains_contentEmpty'); return; } // no folder for visitors if (!is_dir (PATH_DOMAINS)) { // create folder $formulary = $document->createFormulary ('adminDomains_edit', array (), 'createFolder'); if ($formulary->command ('create') and $formulary->save ()) { // create $folder_domains = PATH_ROOT . $io->systemConstants->get ('FOLDER_DOMAIN'); } // create else { // view form $document->mod->formulary = $formulary; return; } // view form } // create folder $document->mod->list = new eclMod_adminDomains_list ($document); if (!isset ($folder_domains)) $folder_domains = PATH_DOMAINS; if (count (scandir ($folder_domains)) == 2) { // empty $document->dataMerge ('adminDomains_contentEmpty'); return; } // empty } // function dispatch } // class eclApp_adminDomains //!eof:library/adminDomains/eclApp_adminDomains.php; //!file:library/adminDomains/eclFilter_adminDomains_selectCurrency.php; class eclFilter_adminDomains_selectCurrency { // class eclFilter_adminDomains_selectCurrency static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; if (!isset ($control['flags']['target'])) return; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'select'; if (isset ($formulary->data['flags']['currency'])) $value = $formulary->data['flags']['currency']; else $value = SYSTEM_DEFAULT_CURRENCY; $names = array (); if (isset ($dataMap['t']['labels/currency'])) { // from embeded $names = array_keys ($dataMap['t']['labels/currency']); } // from embeded elseif (is_dir (PATH_TEMPLATES . 'labels/currency')) { // from folder foreach (scandir (PATH_TEMPLATES . 'labels/currency') as $filename) { // each file if ($filename[0] == '.') continue; $names[] = substr ($filename, 0, 3); } // each file } // from folder foreach ($names as $currency) { // each currency $data = $store->control->read ('labels/currency/' . $currency); $symbol = $currency . ' '; if (isset ($data['local']['symbol'])) $symbol .= '(' . $data['local']['symbol'] . ') '; $local = array ('value' => $currency); if (isset ($data['text'])) $local['caption'] = $document->textMerge ($symbol, $data['text']['caption']); else $local['caption'] = $document->textMerge ($symbol, $data['text']['caption']); if ($value == $currency) $local['active'] = 1; $item->appendChild ($local); } // each lang } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->received[$fieldName][0])) return; $formulary->data['flags']['currency'] = $formulary->received[$fieldName]; } // function save } // class eclFilter_adminDomains_selectCurrency //!eof:library/adminDomains/eclFilter_adminDomains_selectCurrency.php; //!file:library/adminDomains/eclFilter_adminDomains_selectLang.php; class eclFilter_adminDomains_selectLang { // class eclFilter_adminDomains_selectLang static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; if (!isset ($control['flags']['target'])) return; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'select'; if (isset ($formulary->data['flags']['default_lang'])) $value = $formulary->data['flags']['default_lang']; elseif (defined ('SYSTEM_DEFAULT_LANGUAGE')) $value = SYSTEM_DEFAULT_LANGUAGE; else $value = 'en'; $names = $store->control->scandir ('t', 'labels/lang'); 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 $store; if (!isset ($formulary->received[$fieldName][0])) return; $formulary->data['flags']['default_lang'] = $formulary->received[$fieldName]; } // function save } // class eclFilter_adminDomains_selectLang //!eof:library/adminDomains/eclFilter_adminDomains_selectLang.php; //!file:library/adminDomains/eclMod_adminDomains_list.php; class eclMod_adminDomains_list { // class eclMod_adminDomains_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 ('adminDomains_add_content') ->virtual () ->url ($domain_pathway); } // access else $pathway = array (); if (is_dir (PATH_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)) ->url ($domain_pathway) ->swapTitle (); } // each name $mod->data = $store->control->read ('modules/list'); $mod->enabled = true; } // function setModule } // class eclMod_adminDomains_list //!eof:library/adminDomains/eclMod_adminDomains_list.php; //!file:library/adminIndex/eclApp_adminIndex.php; class eclApp_adminIndex { // class eclApp_adminIndex const name = ''; const menuType = 'section'; const dataFrom = 'adminIndex_content'; static function constructor_helper ($me) { // function constructor_helper array_pop ($me->pathway); } // function constructor_helper } // class eclApp_adminIndex //!eof:library/adminIndex/eclApp_adminIndex.php; //!file:library/adminIntegrations/eclApp_adminIntegrations.php; class eclApp_adminIntegrations { // class eclApp_adminIntegrations const name = 'integrations'; const menuType = 'section'; const dataFrom = 'adminIntegrations_content'; const access = 4; static function constructor_helper ($me) { // function constructor_helper $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (!count ($me->children ())) $document->dataMerge ('adminIntegrations_contentEmpty'); else $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_adminIntegrations //!eof:library/adminIntegrations/eclApp_adminIntegrations.php; //!file:library/adminSystem/admin/eclApp_adminSystem_admin.php; class eclApp_adminSystem_admin { // class eclApp_adminSystem_admin const name = 'admin'; const menuType = 'section'; const dataFrom = 'adminSystem_admin_content'; static function constructor_helper ($me) { // function constructor_helper $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 ('system_msg_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->url (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 const name = 'system'; const menuType = 'section'; const dataFrom = 'adminSystem_content'; const map = 'adminSystem_setup adminSystem_admin adminSystem_hosting adminSystem_server adminSystem_update adminSystem_eval adminSystem_log adminSystem_extract adminSystem_pack'; const access = 4; static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // 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 const name = 'eval'; const menuType = 'section'; const dataFrom = 'adminSystem_eval_content'; 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']['type'])) $item->data['type'] = $control['flags']['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'); return array (); } // 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 ('system_msg_alertDataUpdated'); } // options saved elseif ($formulary->command ('extract') and $formulary->save ()) { // extract files $io->packager->extract ($formulary->data); $document->reload = $document->url (); 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 const name = 'hosting'; const menuType = 'section'; const dataFrom = 'adminSystem_hosting_content'; 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 ('system_msg_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 const name = 'log'; const menuType = 'section'; const dataFrom = 'adminSystem_log_content'; static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminSystem_log_edit'); if ($formulary->command ('save') and $formulary->save ()) $document->mod->humperstilshen->alert ('system_msg_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']['type'])) $item->data['type'] = $control['flags']['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->url (); 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 const name = 'server'; const menuType = 'section'; const dataFrom = 'adminSystem_server_content'; static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminSystem_server_edit'); if ($document->rewriteEngine or strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache')) $formulary->flags['server_is_apache'] = true; if ($formulary->save ()) $document->mod->humperstilshen->alert ('system_msg_alertDataUpdated'); $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 const name = 'setup'; const menuType = 'section'; const dataFrom = 'adminSystem_setup_content'; static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('adminSystem_setup_edit'); if ($formulary->save ()) $document->mod->humperstilshen->alert ('system_msg_alertDataUpdated'); $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_setup //!eof:library/adminSystem/setup/eclApp_adminSystem_setup.php; //!file:library/adminSystem/update/eclApp_adminSystem_update.php; class eclApp_adminSystem_update { // class eclApp_adminSystem_update const name = 'update'; const menuType = 'section'; const dataFrom = 'adminSystem_update_content'; static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('adminSystem_update_edit'); if ($formulary->command ('check')) { // check $data = $io->webservice->request (SYSTEM_ENGINE_UPDATE_URL); if (isset ($data['EcolaboreEngine'])) { // update found $data = $data['EcolaboreEngine']; $data['request_date'] = date ('Y-m-d', TIME); $io->systemConstants->set ('SYSTEM_ENGINE_UPDATE_CHECK', $io->webservice->array2json ($data)); } // update found } // check if ($formulary->command ('update') and defined ('SYSTEM_ENGINE_UPDATE_CHECK')) { // formulary update if (SYSTEM_TIME_LIMIT) set_time_limit (0); $data = $io->webservice->json2array (SYSTEM_ENGINE_UPDATE_CHECK); if (isset ($data['url'])) { // update $io->systemConstants->drop ('SYSTEM_ENGINE_UPDATE_CHECK'); $io->close (); $document->reload = $document->url (); $document->render (); $string = file_get_contents ($data['url']); $fileName = PATH_ROOT . SYSTEM_SCRIPT_NAME; @unlink ($fileName); file_put_contents ($fileName, $string); print $document->buffer; exit; } // update } // 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/adminSystem/update/eclFilter_adminSystem_update_viewCurrentRelease.php; class eclFilter_adminSystem_update_viewCurrentRelease { // class eclFilter_adminSystem_update_viewCurrentRelease static function create ($fieldName, $control, $formulary) { // function create $control['type'] = 'view'; $control['content'] = $formulary->document->textMerge (SYSTEM_RELEASE); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminSystem_update_viewCurrentRelease //!eof:library/adminSystem/update/eclFilter_adminSystem_update_viewCurrentRelease.php; //!file:library/adminSystem/update/eclFilter_adminSystem_update_viewCurrentVersion.php; class eclFilter_adminSystem_update_viewCurrentVersion { // class eclFilter_adminSystem_update_viewCurrentVersion static function create ($fieldName, $control, $formulary) { // function create $control['type'] = 'view'; $control['content'] = $formulary->document->textMerge (SYSTEM_VERSION); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminSystem_update_viewCurrentVersion //!eof:library/adminSystem/update/eclFilter_adminSystem_update_viewCurrentVersion.php; //!file:library/adminSystem/update/eclFilter_adminSystem_update_viewLastVerification.php; class eclFilter_adminSystem_update_viewLastVerification { // class eclFilter_adminSystem_update_viewLastVerification static function create ($fieldName, $control, $formulary) { // function create global $io; $control['type'] = 'view'; $value = $io->systemConstants->get ('SYSTEM_ENGINE_UPDATE_CHECK'); if ($value === false) return; $value = $io->webservice->json2array ($value); if (!isset ($value['request_date'])) return; $control['content'] = $formulary->document->textMerge ($value['request_date']); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminSystem_update_viewLastVerification //!eof:library/adminSystem/update/eclFilter_adminSystem_update_viewLastVerification.php; //!file:library/adminSystem/update/eclFilter_adminSystem_update_viewNewVersionAvailable.php; class eclFilter_adminSystem_update_viewNewVersionAvailable { // class eclFilter_adminSystem_update_viewNewVersionAvailable static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $control['type'] = 'view'; $value = $io->systemConstants->get ('SYSTEM_ENGINE_UPDATE_CHECK'); if ($value === false) return; $value = $io->webservice->json2array ($value); if (!isset ($value['release'])) return; list ($y, $m, $d) = explode ('-', $value['release']); $lastRelease = mktime (0, 0, 0, $m, $d, $y); list ($y, $m, $d) = explode ('-', SYSTEM_RELEASE); $systemRelease = mktime (0, 0, 0, $m, $d, $y); if ($systemRelease >= $lastRelease) { // system updated $formulary->appendChild ('adminSystem_update_viewSystemUpdated'); return; } // system updated $control['content'] = $formulary->document->textMerge ($value['release']); $formulary->appendChild ($control); if (!isset ($value['info'])) return; $control = array ('type' => 'view'); $label = $store->control->read ('adminSystem_update_viewReleaseNotes'); $control['content'] = $label['text']['caption']; $control['url'] = $value['info']; $formulary->appendChild ($control); $submit = $formulary->appendChild (array ('type' => 'submit')); $control = array ('name' => $formulary->prefix . 'command_update'); $submit->appendChild ('adminSystem_update_editUpdateNow', $control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_adminSystem_update_viewNewVersionAvailable //!eof:library/adminSystem/update/eclFilter_adminSystem_update_viewNewVersionAvailable.php; //!file:library/adminUsers/add/eclApp_adminUsers_add.php; class eclApp_adminUsers_add { // class eclApp_adminUsers_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 (PATH_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 ('adminUsers_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 ('adminUsers_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->url (); return; } // formulary saved $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_adminUsers_add //!eof:library/adminUsers/add/eclApp_adminUsers_add.php; //!file:library/adminUsers/details/eclApp_adminUsers_details.php; class eclApp_adminUsers_details { // class eclApp_adminUsers_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 ('adminUsers_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['local']['gender']) and $data['local']['gender'] == 'female') $gender = 'F'; else $gender = 'M'; $remove = $document->createFormulary ('adminUsers_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 ('adminUsers_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 = 'system_msg_alertDataUpdated'; } // save $formulary->data['name'] = $me->name; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataMerge ('adminUsers_details_content'); // Context Remove $document->mod->context->appendChild ('adminUsers_details_remove' . $gender) ->confirm ('adminUsers_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 (PATH_PROFILES . $me->name) as $filename) { // each user file if (is_file (PATH_PROFILES . $me->name . '/' . $filename)) unlink (PATH_PROFILES . $me->name . '/' . $filename); } // each user file rmdir (PATH_PROFILES . $me->name); // returns to parent page $parent = $me->parent; $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->url (); } // function action_remove } // class eclApp_adminUsers_details //!eof:library/adminUsers/details/eclApp_adminUsers_details.php; //!file:library/adminUsers/eclApp_adminUsers.php; class eclApp_adminUsers { // class eclApp_adminUsers const name = 'users'; const menuType = 'section'; const dataFrom = 'adminUsers_content'; static function constructor_helper ($me) { // function constructor_helper global $io, $store; if ($io->database->tableEnabled ($store->user) and is_dir (PATH_PROFILES)) $me->map = array ('adminUsers_add', 'adminUsers_details'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; if (!$io->database->tableEnabled ($store->user)) { // disabled $document->dataMerge ('adminUsers_contentDisabled'); return; } // disabled if (!is_dir (PATH_PROFILES) and !$document->access (4)) { // no folder for visitors $document->dataMerge ('adminUsers_contentEmpty'); return; } // no folder for visitors if (!is_dir (PATH_PROFILES)) { // create folder $formulary = $document->createFormulary ('adminUsers_createFolder', array (), 'createFolder'); if ($formulary->command ('create') and $formulary->save ()) { // create $folder_profiles = PATH_ROOT . $io->systemConstants->get ('FOLDER_PROFILES'); } // create else { // view form $document->mod->formulary = $formulary; return; } // view form } // create folder $document->mod->list = new eclMod_adminUsers_list ($document); if (!isset ($folder_profiles)) $folder_profiles = PATH_PROFILES; if ($document->access (4) and !$store->User->getStatus (ADMIN_IDENTIFIER)) { // create the admin profile $formulary = $document->createFormulary ('adminUsers_adminProfile', array (), 'admin_profile'); if ($formulary->command ('create')) { // create $user = array ( 'name' => ADMIN_IDENTIFIER, 'password' => ADMIN_PASSWORD, 'status' => 1 ); $userId = $store->user->insert ($user); $data['mode'] = MODE_DOMAIN; $data['name'] = '-register'; $data['text'] = array ( 'caption' => array ($document->lang => array (TEXT_CONTENT => ADMIN_CAPTION)), 'title' => array ($document->lang => array (TEXT_CONTENT => ADMIN_CAPTION)) ); $data['local']['mail'] = ADMIN_MAIL; $data['local']['gender'] = ADMIN_GENDER; $store->userContent->insert ($userId, $data); } // create else $document->mod->formulary = $formulary; $document->mod->panel->main = array ('content', 'formulary', 'list'); } // create the admin profile if (count (scandir ($folder_profiles)) == 2) $document->dataMerge ('adminUsers_contentEmpty'); } // function dispatch } // class eclApp_adminUsers //!eof:library/adminUsers/eclApp_adminUsers.php; //!file:library/adminUsers/eclFilter_adminUsers_name.php; class eclFilter_adminUsers_name { // class eclFilter_adminUsers_name static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'text'; // target if (isset ($control['flags']['target'])) $local['value'] = $formulary->getField ($control['flags']['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, 'adminUsers_alertUserInvalidName', $value); elseif ($store->user->getId ($value)) $formulary->setErrorMsg ($control, $fieldName, 'adminUsers_alertUserAlreadyExists', $value); } // received value else $value = false; // required if ($value === false and isset ($control['flags']['required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminUsers_alertUserNameRequired'); // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_adminUsers_name //!eof:library/adminUsers/eclFilter_adminUsers_name.php; //!file:library/adminUsers/eclFilter_adminUsers_password.php; class eclFilter_adminUsers_password { // class eclFilter_adminUsers_password static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['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']['required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminUsers_alertPasswordRequired'); // no password, no required if (!$password) return; if ($password != $password2) return $formulary->setErrorMsg ($control, $fieldName, 'adminUsers_alertPasswordRepeatError'); foreach (str_split ($password) as $char) { // each char if (ord ($char) < 32 or ord ($char) > 127) return $formulary->setErrorMsg ($control, $fieldName, 'adminUsers_alertPasswordInvalidCharacter'); } // each char // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $password); } // function save } // class eclFilter_adminUsers_password //!eof:library/adminUsers/eclFilter_adminUsers_password.php; //!file:library/adminUsers/eclMod_adminUsers_list.php; class eclMod_adminUsers_list { // class eclMod_adminUsers_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 ('adminUsers_add_content') ->virtual () ->url ($user_pathway); } // access else $pathway = array (SYSTEM_PROFILES_URI); if (is_dir (FOLDER_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 () ->url ($user_pathway); } // each name $mod->data = $store->control->read ('modules/list'); $mod->enabled = true; } // function setModule } // class eclMod_adminUsers_list //!eof:library/adminUsers/eclMod_adminUsers_list.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 } // 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 (PATH_PROFILES)) mkdir (PATH_PROFILES); if (!is_dir (PATH_PROFILES . ADMIN_IDENTIFIER)) mkdir (PATH_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 (PATH_DOMAINS)) mkdir (PATH_DOMAINS); if (!is_dir (PATH_DOMAINS . SYSTEM_DEFAULT_DOMAIN_NAME)) mkdir (PATH_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 ('userJoin', 'domainStyles', 'domain_empty'); } // empty elseif ($status == 5) { // disabled $me->map = array ('domainStyles', 'domain_disabled'); } // disabled elseif ($status == 2 or $status == 4) { // active $me->data = &$store->domainContent->openChild ($me->domainId, MODE_DOMAIN, 0, '-register'); $me->getMap (); if ($status == 4) $me->access = 4; } // active $me->isDomain = true; } // function constructor_helper } // class eclApp_domain //!eof:library/domain/eclApp_domain.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']['type'])) $local['type'] = $control['flags']['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']['default_value'])) $name = $control['flags']['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 (!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 0; } // 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 0; } // 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); $store->domainExtras->createVersion ($me->domainId, $data, $document); 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/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['url'] = $document->url (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; $data['local'] = $document->user->data['local']; $formulary = $document->createFormulary ('domainCreate_edit', $data, 'domaincreate'); if ($formulary->command ('save') and $formulary->save ()) { // save $domain['name'] = $document->domain->name; $domain['status'] = 1; mkdir (PATH_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 const name = '-default'; const menuType = 'hidden'; 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 global $store; 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 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')) ->url (true, true, '_default-custom'); else { // custom tools // context edit $document->mod->context->appendChild ('domainDefault_edit') ->active ($document->actions ('default', 'edit')) ->url (true, true, '_default-edit'); // Versioning $store->domainExtras->versioning ($document); // context restore $document->mod->context->appendChild ('domainDefault_restore') ->url (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; $store->domainExtras->createVersion ($me->domainId, $data, $document); $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 global $store; $me = $document->application; $formulary = $document->createFormulary ('domainDefault_edit', $me->data); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['default']); return 'custom'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $me->data = $data; $store->domainExtras->createVersion ($me->domainId, $data, $document); $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_restore ($document) { // function action_restore global $store; $me = $document->application; unset ($me->data); $store->domainContent->delete ($me->domainId, $me->id); $store->domainExtras->deleteAllChildren ($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/domainFiles/eclApp_domainFiles.php; class eclApp_domainFiles { // class eclApp_domainFiles static function is_child ($me, $name) { // function is_child switch ($name) { // switch name case '-files': case '-downloads': case '-play': 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 (); } // 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 = substr ($document->application->name, 1); $fileName = array_pop ($pathway); if ($mode == 'downloads') $disposition = 'attachment'; else $disposition = 'inline'; $path = FOLDER_DOMAINS . $document->domain->name . '/' . $fileName; $headers = array ( 'Content-Disposition' => $disposition, 'Cache-Control' => 'public, only-if-cached, max-age=172800' ); if ($mode == 'downloads' or $mode == 'play') { // download @list ($filePrefix, $extension) = explode ('.', $fileName); @list ($name, $target) = explode (CHR_FNS, $filePrefix); $data = &$store->domainContent->open ($document->domain->domainId, $name); if (!$data) exit; if ($mode == 'downloads' and isset ($data['extras'][$target]['filename'])) $headers['Filename'] = $data['extras'][$target]['filename']; if (!isset ($data['extras'][$target][$mode])) $data['extras'][$target][$mode] = 1; else $data['extras'][$target][$mode]++; } // download $io->sendFile->send ($path, $headers); } // function dispatch } // class eclApp_domainFiles //!eof:library/domainFiles/eclApp_domainFiles.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 (); $children = $store->domainContent->children ($me->domainId, MODE_KEYWORD, 0, 4, 0, 0, 'name', 'asc'); if (!$children) return; foreach ($children as $data) { // each child $pathway = $me->pathway; $pathway[] = substr ($data['name'], 5); $row->appendChild ($data) ->url ($pathway); } // each child $mod->data = $document->render->block ('modules/list_glossary'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'list_glossary'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $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 global $store; $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')) return self::action_remove ($document); if ($document->actions ('entry', 'edit')) $view = self::action_edit ($document); // Context edit $document->mod->context->appendChild ('domainGlossary_keyword_edit') ->active ($document->actions ('entry', 'edit')) ->url (true, true, '_entry-edit'); // Versioning $store->domainExtras->versioning ($document); // context remove $document->mod->context->appendChild ('domainGlossary_keyword_remove') ->url (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; $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $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; $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $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->domainExtras->deleteAllChildren ($me->domainId, $me->id); $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) ->url ($post->pathway); } // each result if (!$row->children) return; $mod->data = $document->render->block ('modules/list_related'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'list_related'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_domainGlossary_keyword_list //!eof:library/domainGlossary/keyword/eclMod_domainGlossary_keyword_list.php; //!file:library/domainIcons/eclApp_domainIcons.php; class eclApp_domainIcons { // class eclApp_domainIcons static function is_child ($me, $name) { // function is_child if ($name == '-icons') 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 ('-icons'); } // 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; $me = $document->application; $name = array_pop ($document->pathway); $data = $store->domainContent->open ($document->domain->domainId, '-styles-vars'); if (isset ($data['updated'])) $updated = date ('r', $data['updated']); elseif (defined ('SYSTEM_PACKED_DATE')) $updated = SYSTEM_PACKED_DATE; else $updated = date ('r', TIME); $document->data['flags']['modLayout_base'] = 'empty'; $document->mod->layout = new eclMod_domainIcons_layout ($document); $document->render (); $size = strval (strlen ($document->buffer)); // error_reporting (0); while (@ob_end_clean ()); $headers = is_callable ('apache_request_headers') ? apache_request_headers () : array (); header_remove ('Pragma'); header_remove ('Expires'); header_remove ('X-Powered-By'); $eTag = ($name . $updated); if (isset ($headers['ETag']) and $headers['ETag'] == $eTag) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified if (isset ($headers['If-Modified-Since']) and $headers['If-Modified-Since'] == $updated) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified header ('HTTP/1.1 200 OK'); header ('Cache-Control: public, only-if-cached, max-age=172800'); header ('Last-Modified: ' . $updated); header ('ETag: "' . $eTag . '"'); header ('Content-type: image/svg+xml'); header ('Content-Length: ' . $size); header ('Connection: close'); print $document->buffer; exit; } // function dispatch } // class eclApp_domainIcons //!eof:library/domainIcons/eclApp_domainIcons.php; //!file:library/domainIcons/eclMod_domainIcons_layout.php; class eclMod_domainIcons_layout { // class eclMod_domainIcons_layout 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->enabled = true; $svg = $store->control->read ('domainIcons_layout'); $mod->data['html'] = $svg['html']; $children = $store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0); $blocks = array (); foreach ($children as $data) { // each custom block if (substr ($data['name'], 0, 6) == 'icons/') $blocks[substr ($data['name'], 6)] = $data; } // each custom block $icons = $store->control->scandir ('t', 'icons'); foreach ($icons as $name) { // each icon if (!isset ($blocks[$name])) $blocks[$name] = $store->control->read ('icons/' . $name); } // each icon foreach ($blocks as $name => $data) { // each icon $data['id'] = $name; if (isset ($data['local']['width'])) $data['scale'] = 32 / $data['local']['width']; else $data['scale'] = 1; if (isset ($data['html'])) $mod->appendChild ($data); } // each icon } // function setModule } // class eclMod_domainIcons_layout //!eof:library/domainIcons/eclMod_domainIcons_layout.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 global $store; $me = $document->application; $view = 'page'; if ($document->access (4)) { // user is admin // action edit if ($document->actions ('index', 'edit')) $view = self::action_edit ($document); // context edit $document->mod->context->appendChild ('domainIndex_edit') ->active ($document->actions ('index')) ->url (true, true, '_index-edit'); // Versioning $store->domainExtras->versioning ($document); // Context new section $pathway = $me->pathway; $pathway[] = '-new-section'; $document->mod->context->appendChild ('section_create_contextNewMain') ->url ($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 global $store; $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; $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $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 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/domainInfo/eclApp_domainInfo.php; class eclApp_domainInfo { // class eclApp_domainInfo const name = '-info'; const menuType = 'hidden'; const dataFrom = 'domainInfo_content'; static function dispatch ($document) { // function dispatch $document->mod->formulary = $document->createFormulary ('domainInfo_view', $document->domain->data); $document->mod->list = new eclMod_domainInfo_listAdministrators ($document); $document->mod->panel->main = array ('formulary', 'list', 'content'); } // function dispatch } // class eclApp_domainInfo //!eof:library/domainInfo/eclApp_domainInfo.php; //!file:library/domainInfo/eclMod_domainInfo_listAdministrators.php; class eclMod_domainInfo_listAdministrators { // class eclMod_domainInfo_listAdministrators 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 (); $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 (!$data) continue; $row->appendChild ($data) ->url (array (SYSTEM_PROFILES_URI, $store->user->getName ($userId))); } // each user $mod->data = $document->render->block ('modules/list_info_administrators'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'list_glossary'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_domainInfo_listAdministrators //!eof:library/domainInfo/eclMod_domainInfo_listAdministrators.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; if (isset ($me->data['flags']['modRss_disable'])) return false; if ($name == 'rss.xml') return true; if (substr ($name, 0, 4) == 'rss-' and substr ($name, - 4) == '.xml') 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'; $data['flags']['modList_preset'] = '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; if (substr ($me->name, 0, 3) == 'rss') return self::rss ($document); } // function dispatch static function rss ($document) { // function rss global $io; $me = $document->application; $io->log->silent = true; if (preg_match ('/^rss-([a-z]+)\.xml$/', $me->name, $match)) $document->lang = $match[1]; $document->data['flags']['modLayout_base'] = 'empty'; $document->mod->layout = new eclMod_domainRecents_rss_layout ($document); } // function rss } // 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']['type'])) $control['type'] = $control['flags']['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/domainRecents/rss/eclMod_domainRecents_rss_layout.php; class eclMod_domainRecents_rss_layout { // class eclMod_domainRecents_rss_layout 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->domain; $mod->enabled = true; $mod->data = $store->control->read ('domainRecents_rss_layout'); $mod->data['local']['url_self'] = $document->url (true, false, false); $mod->data['local']['pubDate'] = date ('r'); $me = $document->domain->child ('-recents'); if (!isset ($me->data['links']['pages'])) exit (''); $data = array (); $sorted = array (); foreach ($me->data['links']['pages'] as $name) { // each page $data = $store->domainContent->open ($me->domainId, $name); if (!$data) continue; $sorted[$data['event_start']][] = $data; } // each page krsort ($sorted); $max = 20; if (isset ($document->domain->data['flags']['modRss_max'])) $max = $document->domain->data['flags']['modRss_max']; $index = 0; foreach ($sorted as $group) { // each group foreach ($group as $data) { // each data $post = $me->findChild ($data['name']); if (!$post or !$document->access ($post->access, $post->groups)) continue; $index++; if ($index >= $max) break 2; $mod->appendChild ($data) ->set ('pubDate', date ('r', $data['created'])) ->url ($post->pathway); } // each data } // each group } // function setModule } // class eclMod_domainRecents_rss_layout //!eof:library/domainRecents/rss/eclMod_domainRecents_rss_layout.php; //!file:library/domainScripts/eclApp_domainScripts.php; class eclApp_domainScripts { // class eclApp_domainScripts const name = '-scripts'; const ignoreSubfolders = true; static function dispatch ($document) { // function dispatch global $store; exit; } // function dispatch } // class eclApp_domainScripts //!eof:library/domainScripts/eclApp_domainScripts.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; $document->mod->search->enabled = false; } // 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 = $document->render->block ('modules/search_options'); $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; $keywords = ''; if (isset ($document->actions['tag'][1])) { // search tag $search = $document->actions['tag']; array_shift ($search); $keywords = implode (' ', $search); $where['keywords'] = ':' . implode (': :', $search) . ':'; } // search tag elseif (isset ($document->actions['search'][1])) { // search keywords $search = $document->actions['search']; array_shift ($search); $keywords = implode (' ', $search); $where['keywords'] = implode (' ', $search); } // search keywords else return; if (!isset ($where['keywords'][0])) 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) ->url ($post->pathway); } // each result $mod->data = $document->render->block ('modules/list'); if (!$row->children) { // no results $local['keywords'] = $keywords; $row->appendChild ('domainSearch_msgNoResults', $local); } // no results $mod->data = $document->render->block ('modules/list_search_results'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'list_search_results'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modList_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_domainSearch_list //!eof:library/domainSearch/eclMod_domainSearch_list.php; //!file:library/domainSitemap/eclApp_domainSitemap.php; class eclApp_domainSitemap { // class eclApp_domainSitemap static function is_child ($me, $name) { // function is_child global $store; if ($name == 'robots.txt') return true; if ($name == 'sitemap.xml') return true; if (!strpos ($name, '.')) return false; $data = $store->domainContent->open ($me->domainId, '-google-webmasters'); if ($data and $data['local']['file_name'] == $name) 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 ('robots.txt', 'sitemap.xml'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper if ($me->name == '-google-verify') $me->access = 4; $me->ignoreSubfolders = true; $me->ignoreSession (true); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; $data = $store->domainContent->open ($me->domainId, '-google-webmasters'); if ($data and $data['local']['file_name'] == $me->name) return self::action_verify_page ($document); if ($me->name == 'robots.txt') { // robots.txt if (defined ('SYSTEM_PACKED_DATE')) $updated = SYSTEM_PACKED_DATE; else $updated = date ('r', TIME); $eTag = ('robots.txt' . $updated); $buffer = 'sitemap: ' . $document->url (array ($document->domain->name, 'sitemap.xml'), false, false) . CRLF; $size = strval (strlen ($buffer)); error_reporting (0); while (@ob_end_clean ()); header_remove ('Pragma'); header_remove ('Expires'); header_remove ('X-Powered-By'); if (isset ($headers['ETag']) and $headers['ETag'] == $eTag) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified if (isset ($headers['If-Modified-Since']) and $headers['If-Modified-Since'] == $updated) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified header ('HTTP/1.1 200 OK'); header ('Cache-Control: public, only-if-cached, max-age=172800'); header ('Last-Modified: ' . $updated); header ('ETag: "' . $eTag . '"'); header ('Content-type:text/plain'); header ('Content-Length: ' . $size); header ('Connection: close'); print $buffer; exit; } // robots.txt $document->data['flags']['modLayout_base'] = 'empty'; $document->mod->layout = new eclMod_domainSitemap_layout ($document); $document->render (); $updated = date ('r', TIME); $size = strval (strlen ($document->buffer)); // error_reporting (0); while (@ob_end_clean ()); header_remove ('Pragma'); header_remove ('Expires'); header_remove ('X-Powered-By'); header ('HTTP/1.1 200 OK'); header ('Cache-Control: public, only-if-cached, max-age=172800'); header ('Last-Modified: ' . $updated); header ('Content-type:text/xml'); header ('Content-Length: ' . $size); header ('Connection: close'); print $document->buffer; exit; } // function dispatch static function action_verify_page ($document) { // function action_verify_page global $store; $me = $document->application; $data = $store->domainContent->open ($me->domainId, '-google-webmasters'); header_remove ('Pragma'); header_remove ('Expires'); header_remove ('X-Powered-By'); header ('HTTP/1.1 200 OK'); header ('Last-Modified: ' . date ('r', $data['updated'])); header ('Content-type:text/html'); header ('Content-Length: ' . strlen ($data['local']['file_content'])); header ('Connection: close'); print $data['local']['file_content']; exit; } // function action_verify_page } // class eclApp_domainSitemap //!eof:library/domainSitemap/eclApp_domainSitemap.php; //!file:library/domainSitemap/eclMod_domainSitemap_layout.php; class eclMod_domainSitemap_layout { // class eclMod_domainSitemap_layout 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; $domain = $document->domain; $mod->enabled = true; $mod->data = $store->control->read ('domainSitemap_layout'); foreach ($domain->children () as $child) { // each child $this->indexPath ($child, $mod); } // each child $domain->reset (); $names = $store->domainContent->childrenNames ($domain->domainId, MODE_SECTION, 1); foreach ($names as $name) { // each child $child = $domain->child ($name); if ($child) $this->indexPath ($child, $mod); } // each child } // function setModule private function indexPath ($me, $mod) { // function indexPath if ($me->access) return; if ($me->menuType != 'section' and $me->menuType != 'post') return; $mode = isset ($me->data['mode']) ? $me->data['mode'] : 0; switch ($mode) { // switch mode case MODE_SECTION: $priority = '0.4'; break; case MODE_POST: $priority = '0.9'; break; case MODE_DOMAIN: if ($me->data['name'] == '-index') $priority = '1'; else $priority = '0'; break; default: $priority = '0.6'; } // switch mode if (isset ($me->data['updated']) and intval ($me->data['updated'])) $updated = date ('c', intval ($me->data['updated'])); elseif (defined ('SYSTEM_PACKED_DATE')) $updated = date ('c', intval (SYSTEM_PACKED_DATE)); else $updated = date ('c', TIME); $mod->appendChild (array ( 'url' => $this->document->url ($me->pathway), 'date' => $updated, 'priority' => $priority )); foreach ($me->children () as $child) { // each child $this->indexPath ($child, $mod); } // each child } // function indexPath } // class eclMod_domainSitemap_layout //!eof:library/domainSitemap/eclMod_domainSitemap_layout.php; //!file:library/domainStyles/eclApp_domainStyles.php; class eclApp_domainStyles { // class eclApp_domainStyles static function is_child ($me, $name) { // function is_child if ($name == '-styles') 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 ('-styles'); } // 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; $me = $document->application; $name = array_pop ($document->pathway); $data = $store->domainContent->open ($document->domain->domainId, '-styles-vars'); if (isset ($data['updated'])) $updated = date ('r', $data['updated']); elseif (defined ('SYSTEM_PACKED_DATE')) $updated = SYSTEM_PACKED_DATE; else $updated = date ('r', TIME); $document->data['flags']['modLayout_base'] = 'empty'; $document->mod->layout = new eclMod_domainStyles_layout ($document); $document->render (); $size = strval (strlen ($document->buffer)); // error_reporting (0); while (@ob_end_clean ()); $headers = is_callable ('apache_request_headers') ? apache_request_headers () : array (); header_remove ('Pragma'); header_remove ('Expires'); header_remove ('X-Powered-By'); $eTag = ($name . $updated); if (isset ($headers['ETag']) and $headers['ETag'] == $eTag) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified if (isset ($headers['If-Modified-Since']) and $headers['If-Modified-Since'] == $updated) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified header ('HTTP/1.1 200 OK'); header ('Cache-Control: public, only-if-cached, max-age=172800'); header ('Last-Modified: ' . $updated); header ('ETag: "' . $eTag . '"'); header ('Content-type:text/css'); header ('Content-Length: ' . $size); header ('Connection: close'); print $document->buffer; exit; } // function dispatch } // class eclApp_domainStyles //!eof:library/domainStyles/eclApp_domainStyles.php; //!file:library/domainStyles/eclMod_domainStyles_layout.php; class eclMod_domainStyles_layout { // class eclMod_domainStyles_layout 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; $mod->enabled = true; $template = $render->block ('templates/default'); $preset = $store->control->read ('domainStyles_preset'); $palette = $render->block ('palettes/default'); if (isset ($palette['local'])) $preset['local'] = array_replace ($preset['local'], $palette['local']); $theme = $render->block ('themes/default'); if (isset ($theme['local'])) $preset['local'] = array_replace ($preset['local'], $theme['local']); $user = $render->block ('themes/user'); if (isset ($user['local'])) $preset['local'] = array_replace ($preset['local'], $user['local']); $buffer = ''; if (isset ($template['local']['styles'])) $all['styles'] = explode (CRLF, $template['local']['styles']); else $all['styles'][] = 'default'; foreach ($all['styles'] as $name) { // each stylesheet $block = $render->block ('styles/' . $name); if (isset ($block['html'])) $buffer .= $block['html']; } // each stylesheet $mod->data['local'] = $preset['local']; $mod->data['html'] = $buffer; } // function setModule } // class eclMod_domainStyles_layout //!eof:library/domainStyles/eclMod_domainStyles_layout.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/endpoints/eclApp_endpoints.php; class eclApp_endpoints { // class eclApp_endpoints static function is_child ($me, $name) { // function is_child if ($name == '-services' or $name == '-endpoints') 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 ('-services'); } // 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_endpoints //!eof:library/endpoints/eclApp_endpoints.php; //!file:library/financial/eclApp_financial.php; class eclApp_financial { // class eclApp_financial const name = 'financial'; const menuType = 'section'; const dataFrom = 'financial_content'; const map = 'financialProjects financialIncoming financialOutgoing financialResources financialCharges'; const access = 4; const isDomain = true; static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_financial //!eof:library/financial/eclApp_financial.php; //!file:library/financialAccount/create/eclApp_financialAccount_create.php; class eclApp_financialAccount_create { // class eclApp_financialAccount_create static function is_child ($me, $name) { // function is_child if ($name == '-new-account') return true; return false; } // function is_child static function get_menu_type ($me) { // function get_menu_type global $store; return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-account'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('financialAccount_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 ('financialAccount_create_edit', $data, 'accountEdit'); 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->url (); return; } // return to parent page // Salvar formulário e redespachar if ($formulary->command ('save') and $formulary->save (1)) { // save account $parent = $document->application->parent; $data = &$formulary->data; $data['mode'] = MODE_ACCOUNT; $data['parent_id'] = 0; $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->url (); $document->application->dispatch ($document); return; } // save account // 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 ('financialAccount' . ucfirst ($type) . '_helpCreate'); return; // Exibir lista de opções show_list: unset ($document->actions['create']); $document->mod->list = new eclMod_financialAccount_create_list ($document); } // function dispatch } // class eclApp_financialAccount_create //!eof:library/financialAccount/create/eclApp_financialAccount_create.php; //!file:library/financialAccount/create/eclMod_financialAccount_create_list.php; class eclMod_financialAccount_create_list { // class eclMod_financialAccount_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) ->url ($pathway, true, '_create-' . $child->name); } // each child $mod->data = $store->control->read ('modules/list_folder'); $mod->enabled = true; } // function setModule } // class eclMod_financialAccount_create_list //!eof:library/financialAccount/create/eclMod_financialAccount_create_list.php; //!file:library/financialAccount/eclApp_financialAccount.php; class eclApp_financialAccount { // class eclApp_financialAccount static function is_child ($me, $name) { // function is_child global $store; $data = $store->domainContent->openChild ($me->domainId, MODE_ACCOUNT, 0, $name); if ($data) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'account'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return $store->domainContent->childrenNames ($me->domainId, MODE_ACCOUNT, 0); } // 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']['financialAccount_type'])) $class = 'eclApp_financialAccount' . ucfirst ($me->data['flags']['financialAccount_type']); else $class = 'eclApp_financialAccountBank'; $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 ('account', 'edit')) $view = self::action_edit ($document); elseif ($document->actions ('account', 'remove')) return self::action_remove ($document); elseif ($document->actions ('account', 'move')) self::action_move ($document); // Context Edit $document->mod->context->appendChild ('financialAccount_edit') ->active ($document->actions ('account', 'edit')) ->url (true, true, '_account-edit'); // Context Remove $document->mod->context->appendChild ('financialAccount_remove') ->url (true, true, '_account-remove') ->confirm ('financialAccount_removeConfirm'); // Context Move up if ($me->data['index']) $document->mod->context->appendChild ('financialAccount_moveUp') ->url (true, true, '_account-move-up'); // Context Move down if ($me->data['index'] < count ($store->domainContent->children ($me->domainId, MODE_ACCOUNT, $me->data['parent_id'])) - 1) $document->mod->context->appendChild ('financialAccount_moveDown') ->url (true, true, '_account-move-down'); } // user is admin if ($view) { // view account if (!$document->access (3) and !isset ($me->data['flags']['modHits_disable'])) $me->data['hits']++; if (isset ($me->data['flags']['financialAccount_type'])) $class = 'eclApp_financialAccount' . ucfirst ($me->data['flags']['financialAccount_type']); else $class = 'eclApp_financialAccountBank'; $class::dispatch ($document); } // view account } // function dispatch static function action_edit ($document) { // function action_edit $formulary = $document->createFormulary ('financialAccount_edit', $document->application->data, 'accountEdit'); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['account']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save formulary unset ($document->actions['account']); $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->url (); } // update name else $document->dataReplace ($document->application->data); return true; } // save formulary $formulary->action = '_account-edit-save'; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_account-edit'; $document->dataMerge ('financialAccount_contentEdit'); return false; } // function action_edit static function action_remove ($document) { // function action_remove global $store, $io; $me = $document->application; unset ($document->actions['account']); $parent = $me->parent; $me->remove (); $parent->reset (); // reindex brothers $store->domainContent->childrenReindex ($parent->domainId, MODE_ACCOUNT, $parent->id); if ($parent->isDomain) $document->application = $parent->child (''); else $document->application = $parent; $document->reload = $document->url (); $document->application->dispatch ($document); } // function action_remove static function action_move ($document) { // function action_move global $store; $parentId = $document->application->data['parent_id']; $name = $document->application->name; $parent = $document->application->parent; unset ($document->application); $parent->reset (); $store->domainContent->childrenReindex ($parent->domainId, MODE_ACCOUNT, $parentId); $names = $store->domainContent->childrenNames ($parent->domainId, MODE_ACCOUNT, $parentId); $index = array_search ($name, $names); $length = count ($names) - 1; if ($document->actions ('account', '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 ('account', '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['account']); $document->application = $parent->child ($name); } // function action_move static function remove ($me) { // function remove if (isset ($me->data['flags']['financialAccount_type'])) $class = 'eclApp_financialAccount' . ucfirst ($me->data['flags']['financialAccount_type']); else $class = 'eclApp_financialAccountBank'; 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_financialAccount //!eof:library/financialAccount/eclApp_financialAccount.php; //!file:library/financialAccount/eclFilter_financialAccount_choosePaymentMethod.php; class eclFilter_financialAccount_choosePaymentMethod { // class eclFilter_financialAccount_choosePaymentMethod static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->domain->child ('-tools')->child ('financial')->child ('resources'); $control['local']['type'] = 'radio'; $control['local']['name'] = $fieldName; $item = $formulary->appendChild ($control); foreach ($me->children () as $account) { // each account foreach ($account->children () as $method) { // each method if ($method->menuType != 'method') continue; $item->appendChild ($method->data, array ( 'value' => $account->name . '/' . $method->name, 'name' => $fieldName )); } // each method } // each account } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->received[$fieldName][0])) return $formulary->setErrorMsg ($control, $fieldName); $parts = explode ('/', $formulary->received[$fieldName]); if (count ($parts) < 2) return $formulary->setErrorMsg ($control, $fieldName); $formulary->data['account'] = $parts[0]; $formulary->data['method'] = $parts[1]; } // function save } // class eclFilter_financialAccount_choosePaymentMethod //!eof:library/financialAccount/eclFilter_financialAccount_choosePaymentMethod.php; //!file:library/financialAccount/eclFilter_financialAccount_specialFields.php; class eclFilter_financialAccount_specialFields { // class eclFilter_financialAccount_specialFields static function create ($fieldName, $control, $formulary) { // function create global $store; if (!isset ($formulary->data['flags']['financialAccount_type'])) return; if (!isset ($control['flags']['sufix'])) return; $special = $store->control->read ('financialAccount' . ucfirst ($formulary->data['flags']['financialAccount_type']) . $control['flags']['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']['financialAccount_type'])) return; if (!isset ($control['flags']['sufix'])) return; $special = $store->control->read ('financialAccount' . ucfirst ($formulary->data['flags']['financialAccount_type']) . $control['flags']['sufix']); if (isset ($special['children'])) $formulary->insertControlChildren ($special); } // function save } // class eclFilter_financialAccount_specialFields //!eof:library/financialAccount/eclFilter_financialAccount_specialFields.php; //!file:library/financialAccountBank/create/eclApp_financialAccountBank_create.php; class eclApp_financialAccountBank_create { // class eclApp_financialAccountBank_create static function is_child ($me, $name) { // function is_child if ($name == 'bank') 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 ('bank'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('financialAccountBank_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_financialAccountBank_create //!eof:library/financialAccountBank/create/eclApp_financialAccountBank_create.php; //!file:library/financialAccountBank/deposit/eclApp_financialAccountBank_deposit.php; class eclApp_financialAccountBank_deposit { // class eclApp_financialAccountBank_deposit static function is_child ($me, $name) { // function is_child if ($name != 'deposit') return false; if (isset ($me->data['flags']['pay']['deposit'])) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'method'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names if (isset ($me->data['flags']['pay']['deposit'])) return array ('deposit'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('financialAccountBank_deposit_content'); $me->data['text']['account'] = $me->parent->data['text']['title']; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_financialAccountBank_deposit //!eof:library/financialAccountBank/deposit/eclApp_financialAccountBank_deposit.php; //!file:library/financialAccountBank/eclApp_financialAccountBank.php; class eclApp_financialAccountBank { // class eclApp_financialAccountBank static function constructor_helper ($me) { // function constructor_helper $me->map = array ('financialAccountBank_deposit'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_financialAccountBank //!eof:library/financialAccountBank/eclApp_financialAccountBank.php; //!file:library/financialAccountCash/cash/eclApp_financialAccountCash_cash.php; class eclApp_financialAccountCash_cash { // class eclApp_financialAccountCash_cash static function is_child ($me, $name) { // function is_child if ($name != 'cash') return false; if (isset ($me->data['flags']['pay']['cash'])) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'method'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names if (isset ($me->data['flags']['pay']['cash'])) return array ('cash'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('financialAccountCash_cash_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_financialAccountCash_cash //!eof:library/financialAccountCash/cash/eclApp_financialAccountCash_cash.php; //!file:library/financialAccountCash/create/eclApp_financialAccountCash_create.php; class eclApp_financialAccountCash_create { // class eclApp_financialAccountCash_create static function is_child ($me, $name) { // function is_child if ($name == 'cash') 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 ('cash'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('financialAccountCash_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_financialAccountCash_create //!eof:library/financialAccountCash/create/eclApp_financialAccountCash_create.php; //!file:library/financialAccountCash/eclApp_financialAccountCash.php; class eclApp_financialAccountCash { // class eclApp_financialAccountCash static function constructor_helper ($me) { // function constructor_helper $me->map = array ('financialAccountCash_cash'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_financialAccountCash //!eof:library/financialAccountCash/eclApp_financialAccountCash.php; //!file:library/financialCharges/eclApp_financialCharges.php; class eclApp_financialCharges { // class eclApp_financialCharges static function is_child ($parent, $name) { // function is_child if ($name == 'charges') 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 ('charges'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('financialCharges_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $document->mod->list = new eclMod_financialCharges_list ($document); } // function dispatch } // class eclApp_financialCharges //!eof:library/financialCharges/eclApp_financialCharges.php; //!file:library/financialCharges/eclMod_financialCharges_list.php; class eclMod_financialCharges_list { // class eclMod_financialCharges_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 ('financialCharges_list'); $mod->data = array_replace_recursive ($store->control->read ('modules/list_card'), $mod->data); $mod->data['local']['list'] = 'table'; // Headers $row = $mod->appendChild (); $row->appendChild ('financialCharges_listOwner'); $row->appendChild ('financialCharges_listDescription'); $row->appendChild ('financialCharges_listDue'); $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_CONTRACT, 'spotlight' => 101 ); $contracts = $store->domainContent->search ($where, 4, 0, 0, 'event_start'); foreach ($contracts as $contract) { // each contract $row = $mod->appendChild (); // Owner $owner = $store->domainContent->openById ($me->domainId, $contract['subscription_id']); $row->appendChild ($owner); // Contract subject $subject = $store->domainContent->openById ($me->domainId, $contract['parent_id']); $row->appendChild ($subject) ->url ($store->domainContent->pathway ($me->domainId, $contract['id'])) ->popUpOpen (); // date $local['text']['caption'] = $document->textMerge (date ('Y-m-d', $contract['event_start'])); $row->appendChild ($local); } // each contract $mod->enabled = true; } // function setModule } // class eclMod_financialCharges_list //!eof:library/financialCharges/eclMod_financialCharges_list.php; //!file:library/financialIncoming/eclApp_financialIncoming.php; class eclApp_financialIncoming { // class eclApp_financialIncoming static function is_child ($me, $name) { // function is_child if ($name == 'incoming') 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 ('incoming'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->openChild ($me->domainId, MODE_FOLDER, 0, '-incoming'); if ($me->data) { // data exists $me->id = $me->data['id']; return; } // data exists $data = $store->control->read ('financialIncoming_preset'); $data['mode'] = MODE_FOLDER; $data['marker'] = 52; $data['name'] = '-incoming'; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = $data; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = true; // action edit if ($document->actions ('incoming', 'edit')) $view = self::action_edit ($document); // context edit $document->mod->context->appendChild ('financialIncoming_edit') ->active ($document->actions ('incoming', 'edit')) ->url (true, true, '_incoming-edit'); if (!$view) return; $document->mod->list = new eclMod_financialIncoming_list ($document); } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('financialIncoming_edit', $me->data, 'incoming'); $formulary->action = '_incoming-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['incoming']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['incoming']); $me->data = $formulary->data; $document->dataReplace ($me->data); return true; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('financialIncoming_edit'); return false; } // function action_edit } // class eclApp_financialIncoming //!eof:library/financialIncoming/eclApp_financialIncoming.php; //!file:library/financialOutgoing/eclApp_financialOutgoing.php; class eclApp_financialOutgoing { // class eclApp_financialOutgoing static function is_child ($me, $name) { // function is_child if ($name == 'outgoing') 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 ('outgoing'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->openChild ($me->domainId, MODE_FOLDER, 0, '-outgoing'); if ($me->data) { // data exists $me->id = $me->data['id']; return; } // data exists $data = $store->control->read ('financialOutgoing_preset'); $data['mode'] = MODE_FOLDER; $data['marker'] = 52; $data['name'] = '-outgoing'; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = $data; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = true; // action edit if ($document->actions ('outgoing', 'edit')) $view = self::action_edit ($document); // context edit $document->mod->context->appendChild ('financialOutgoing_edit') ->active ($document->actions ('outgoing', 'edit')) ->url (true, true, '_outgoing-edit'); if (!$view) return; $document->mod->list = new eclMod_financialOutgoing_list ($document); } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('financialOutgoing_edit', $me->data, 'outgoing'); $formulary->action = '_outgoing-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['outgoing']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['outgoing']); $me->data = $formulary->data; $document->dataReplace ($me->data); return true; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('financialOutgoing_edit'); return false; } // function action_edit } // class eclApp_financialOutgoing //!eof:library/financialOutgoing/eclApp_financialOutgoing.php; //!file:library/financialProjects/course/eclApp_financialProjects_course.php; class eclApp_financialProjects_course { // class eclApp_financialProjects_course static function is_child ($me, $name) { // function is_child global $store; if ($store->domainContent->open ($me->domainId, $name)) 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->domainContent->open ($me->domainId, $me->name); $me->map = array (); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_financialProjects_course //!eof:library/financialProjects/course/eclApp_financialProjects_course.php; //!file:library/financialProjects/course/eclApp_financialProjects_course_class.php; class eclApp_financialProjects_course_class { // class eclApp_financialProjects_course_class static function is_child ($me, $name) { // function is_child global $store; if ($store->domainContent->open ($me->domainId, $name)) 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->domainContent->open ($me->domainId, $me->name); $me->map = array (); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_financialProjects_course_class //!eof:library/financialProjects/course/eclApp_financialProjects_course_class.php; //!file:library/financialProjects/course/eclMod_financialProjects_course_list.php; class eclMod_financialProjects_course_list { // class eclMod_financialProjects_course_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 ('financialProjects_list'); $mod->data = array_replace_recursive ($store->control->read ('modules/list_card'), $mod->data); $row = $mod->appendChild (); $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_SECTION, 'marker' => 60 ); $projects = $store->domainContent->search ($where); foreach ($projects as $data) { // each data $row->appendChild ($data) ->appendFolder ($data['name']); } // each data $mod->enabled = true; } // function setModule } // class eclMod_financialProjects_course_list //!eof:library/financialProjects/course/eclMod_financialProjects_course_list.php; //!file:library/financialProjects/eclApp_financialProjects.php; class eclApp_financialProjects { // class eclApp_financialProjects static function is_child ($me, $name) { // function is_child if ($name == 'projects') 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 ('projects'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->map = array ('financialProjects_course'); $me->data = &$store->domainContent->openChild ($me->domainId, MODE_FOLDER, 0, '-projects'); if ($me->data) { // data exists $me->id = $me->data['id']; return; } // data exists $data = $store->control->read ('financialProjects_preset'); $data['mode'] = MODE_FOLDER; $data['marker'] = 52; $data['name'] = '-projects'; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = $data; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = true; // action edit if ($document->actions ('projects', 'edit')) $view = self::action_edit ($document); // context edit $document->mod->context->appendChild ('financialProjects_edit') ->active ($document->actions ('projects', 'edit')) ->url (true, true, '_projects-edit'); if (!$view) return; $document->mod->list = new eclMod_financialProjects_list ($document); } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('financialProjects_edit', $me->data, 'projects'); $formulary->action = '_projects-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['projects']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['projects']); $me->data = $formulary->data; $document->dataReplace ($me->data); return true; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('financialProjects_edit'); return false; } // function action_edit } // class eclApp_financialProjects //!eof:library/financialProjects/eclApp_financialProjects.php; //!file:library/financialProjects/eclMod_financialProjects_list.php; class eclMod_financialProjects_list { // class eclMod_financialProjects_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 ('financialProjects_list'); $mod->data = array_replace_recursive ($store->control->read ('modules/list_card'), $mod->data); $row = $mod->appendChild (); $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_SECTION, 'marker' => 60 ); $projects = $store->domainContent->search ($where); foreach ($projects as $data) { // each data $row->appendChild ($data) ->appendFolder ($data['name']); } // each data $mod->enabled = true; } // function setModule } // class eclMod_financialProjects_list //!eof:library/financialProjects/eclMod_financialProjects_list.php; //!file:library/financialResources/eclApp_financialResources.php; class eclApp_financialResources { // class eclApp_financialResources static function is_child ($me, $name) { // function is_child if ($name == 'resources') 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 ('resources'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->map = array ('financialAccount', 'financialAccount_create'); $me->data = &$store->domainContent->openChild ($me->domainId, MODE_FOLDER, 0, '-resources'); if ($me->data) { // data exists $me->id = $me->data['id']; return; } // data exists $data = $store->control->read ('financialResources_preset'); $data['mode'] = MODE_FOLDER; $data['marker'] = 52; $data['name'] = '-resources'; $me->id = $store->domainContent->insert ($me->domainId, $data); $me->data = $data; } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = true; // action edit if ($document->actions ('resources', 'edit')) $view = self::action_edit ($document); // context edit $document->mod->context->appendChild ('financialResources_edit') ->active ($document->actions ('resources', 'edit')) ->url (true, true, '_resources-edit'); // context new account $document->mod->context->appendChild ('financialAccount_create_contextNew') ->appendFolder ('-new-account'); if (!$view) return; $document->mod->list = new eclMod_financialResources_list ($document); } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('financialResources_edit', $me->data, 'resources'); $formulary->action = '_resources-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['resources']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['resources']); $me->data = $formulary->data; $document->dataReplace ($me->data); return true; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('financialResources_edit'); return false; } // function action_edit } // class eclApp_financialResources //!eof:library/financialResources/eclApp_financialResources.php; //!file:library/financialResources/eclMod_financialResources_list.php; class eclMod_financialResources_list { // class eclMod_financialResources_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 ('financialResources_list'); $mod->data = array_replace_recursive ($store->control->read ('modules/list_card'), $mod->data); $row = $mod->appendChild (); $children = $store->domainContent->children ($me->domainId, MODE_ACCOUNT, 0); foreach ($children as $data) { // each data $row->appendChild ($data) ->appendFolder ($data['name']); } // each data $mod->enabled = true; } // function setModule } // class eclMod_financialResources_list //!eof:library/financialResources/eclMod_financialResources_list.php; //!file:library/home/create/eclApp_home_create.php; class eclApp_home_create { // class eclApp_home_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 return 'section'; } // 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 ('home_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 ('home_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->url (); 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->userContent->insert ($parent->userId, $data); $me->id = $data['id']; $formulary->save (2); $io->database->commit (); $me->data = &$store->userContent->openById ($me->userId, $me->id); $me->data = $formulary->data; $store->userExtras->createVersion ($me->userId, $data, $document); $parent->reset (); $document->application = $parent->child ($data['name']); $document->reload = $document->url (); $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 ('home' . ucfirst ($type) . '_helpCreate'); return; // Exibir lista de opções show_list: unset ($document->actions['create']); $document->mod->list = new eclMod_home_create_list ($document); } // function dispatch } // class eclApp_home_create //!eof:library/home/create/eclApp_home_create.php; //!file:library/home/create/eclMod_home_create_list.php; class eclMod_home_create_list { // class eclMod_home_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) ->url ($pathway, true, '_create-' . $child->name); } // each child $mod->data = $store->control->read ('modules/list'); $mod->enabled = true; } // function setModule } // class eclMod_home_create_list //!eof:library/home/create/eclMod_home_create_list.php; //!file:library/home/eclApp_home.php; class eclApp_home { // class eclApp_home static function is_child ($me, $name) { // function is_child global $store; $data = $store->userContent->openChild ($me->userId, 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->userContent->childrenNames ($me->userId, MODE_SECTION, $me->id); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->userContent->open ($me->userId, $me->name); $me->id = $me->data['id']; if ($me->data['access'] > $me->access) $me->access = $me->data['access']; if (isset ($me->data['flags']['home_type'])) $class = 'eclApp_home' . ucfirst ($me->data['flags']['home_type']); else $class = 'eclApp_homeFolder'; $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 ('home', 'edit')) $view = self::action_edit ($document); elseif ($document->actions ('home', 'moveto')) $view = self::action_moveto ($document); elseif ($document->actions ('home', 'remove')) return self::action_remove ($document); elseif ($document->actions ('home', 'move')) self::action_move ($document); // Context Edit $document->mod->context->appendChild ('home_edit') ->active ($document->actions ('home', 'edit')) ->url (true, true, '_home-edit'); // Versioning $store->userExtras->versioning ($document); // Context Remove $document->mod->context->appendChild ('home_remove') ->url (true, true, '_home-remove') ->confirm ('home_removeConfirm'); // Context Move up if ($me->data['index'] and ($me->data['parent_id'] == 1 or $me->data['parent_id'] == $me->parent->id)) $document->mod->context->appendChild ('home_moveUp') ->url (true, true, '_home-move-up'); // Context Move down if ($me->data['index'] < count ($store->userContent->children ($me->userId, MODE_SECTION, $me->data['parent_id'])) - 1 and ($me->data['parent_id'] == 1 or $me->data['parent_id'] == $me->parent->id)) $document->mod->context->appendChild ('home_moveDown') ->url (true, true, '_home-move-down'); // Context Move to... $document->mod->context->appendChild ('home_moveTo') ->url (true, true, '_home-moveto'); } // user is admin if ($view) { // view home if (!$document->access (3) and !isset ($me->data['flags']['modHits_disable'])) $me->data['hits']++; if (isset ($me->data['flags']['home_type'])) $class = 'eclApp_home' . ucfirst ($me->data['flags']['home_type']); else $class = 'eclApp_homeFolder'; $class::dispatch ($document); } // view home } // function dispatch static function action_edit ($document) { // function action_edit global $store; $me = $document->application; $formulary = $document->createFormulary ('home_edit', $me->data, 'homeEdit'); if ($formulary->command ('cancel')) { // cancel unset ($document->actions['home']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save formulary unset ($document->actions['home']); $me->data = $formulary->data; $me->data['updated'] = TIME; $store->userExtras->createVersion ($me->userId, $me->data, $document); $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->url (); } // update name else $document->dataReplace ($document->application->data); return true; } // save formulary $formulary->action = '_home-edit-save'; $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_home-edit'; $document->dataMerge ('home_contentEdit'); return false; } // function action_edit static function action_remove ($document) { // function action_remove global $store, $io; $me = $document->application; unset ($document->actions['home']); $parent = $me->parent; $me->remove (); $parent->reset (); // reindex brothers $store->userContent->childrenReindex ($parent->userId, MODE_SECTION, $parent->id); if ($parent->isDomain) $document->application = $parent->child (''); else $document->application = $parent; $document->reload = $document->url (); $document->application->dispatch ($document); } // function action_remove static function action_move ($document) { // function action_move global $store; $parentId = $document->application->data['parent_id']; $name = $document->application->name; $parent = $document->application->parent; unset ($document->application); $parent->reset (); $store->userContent->childrenReindex ($parent->userId, MODE_SECTION, $parentId); $names = $store->userContent->childrenNames ($parent->userId, MODE_SECTION, $parentId); $index = array_search ($name, $names); $length = count ($names) - 1; if ($document->actions ('home', 'move', 'up') and $index) { // move up $move_up = &$store->userContent->open ($parent->userId, $names[$index]); $move_down = &$store->userContent->open ($parent->userId, $names[$index - 1]); $move_up['index']--; $move_down['index']++; } // move up elseif ($document->actions ('home', 'move', 'down') and $index < $length) { // move down $move_up = &$store->userContent->open ($parent->userId, $names[$index + 1]); $move_down = &$store->userContent->open ($parent->userId, $names[$index]); $move_up['index']--; $move_down['index']++; } // move down unset ($document->actions['home']); $document->application = $parent->child ($name); } // function action_move static function action_moveto ($document) { // function action_moveto global $store; unset ($document->actions['home']); $me = $document->application; $oldParentId = $me->data['parent_id']; $formulary = $document->createFormulary ('home_moveTo', $me->data, 'moveto'); $formulary->action = '_home-moveto'; if ($formulary->command ('cancel')) return true; if ($formulary->command ('save') and $formulary->save ()) { // save $newParentId = $formulary->data['parent_id']; if ($newParentId == $oldParentId) return true; $me->data['parent_id'] = $newParentId; unset ($store->userContent->chargedMode[$me->userId][MODE_SECTION]); $store->userContent->childrenReindex ($me->userId, MODE_SECTION, $newParentId); $me->data['index'] = count ($store->userContent->children ($me->userId, MODE_SECTION, $newParentId)); unset ($store->userContent->indexByParent[$me->userId][MODE_SECTION][$oldParentId][$me->id]); $store->userContent->childrenReindex ($me->userId, MODE_SECTION, $oldParentId); $store->userContent->indexByParent[$me->userId][MODE_SECTION][$newParentId][$me->id] = $me->id; unset ($store->userContent->chargedParents[$me->userId][MODE_SECTION][$oldParentId]); unset ($store->userContent->chargedParents[$me->userId][MODE_SECTION][$newParentId]); $document->reload = $document->url ($store->userContent->pathway ($me->userId, $me->id)); return false; } // save $document->mod->formulary = $formulary; $document->dataReplace ('home_moveTo'); return false; } // function action_moveto static function remove ($me) { // function remove if (isset ($me->data['flags']['home_type'])) $class = 'eclApp_home' . ucfirst ($me->data['flags']['home_type']); else $class = 'eclApp_homeFolder'; if (is_callable ($class . '::remove')) $class::remove ($me); global $store; $store->userContent->delete ($me->userId, $me->id); $store->userFile->deletePrefixedFiles ($me->userId, $me->name); $store->userExtras->deleteAllChildren ($me->userId, $me->id); } // function remove } // class eclApp_home //!eof:library/home/eclApp_home.php; //!file:library/home/eclFilter_home_specialFields.php; class eclFilter_home_specialFields { // class eclFilter_home_specialFields static function create ($fieldName, $control, $formulary) { // function create global $store; if (!isset ($formulary->data['flags']['home_type'])) return; if (!isset ($control['flags']['sufix'])) return; $special = $store->control->read ('home' . ucfirst ($formulary->data['flags']['home_type']) . $control['flags']['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']['home_type'])) return; if (!isset ($control['flags']['sufix'])) return; $special = $store->control->read ('home' . ucfirst ($formulary->data['flags']['home_type']) . $control['flags']['sufix']); if (isset ($special['children'])) $formulary->insertControlChildren ($special); } // function save } // class eclFilter_home_specialFields //!eof:library/home/eclFilter_home_specialFields.php; //!file:library/home/preset/eclApp_home_preset.php; class eclApp_home_preset { // class eclApp_home_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_home_preset //!eof:library/home/preset/eclApp_home_preset.php; //!file:library/homeChat/create/eclApp_homeChat_create.php; class eclApp_homeChat_create { // class eclApp_homeChat_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->userContent->findMarker ($me->userId, 3) and $name == 'chat') 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->userContent->findMarker ($me->userId, 3)) return array ('chat'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('homeChat_create_content'); $me->map = array ('home_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_homeChat_create //!eof:library/homeChat/create/eclApp_homeChat_create.php; //!file:library/homeChat/eclApp_homeChat.php; class eclApp_homeChat { // class eclApp_homeChat static function constructor_helper ($me) { // function constructor_helper $me->map = array ('homeChat_group', 'homeChat_user'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->list = new eclMod_homeChat_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_homeChat //!eof:library/homeChat/eclApp_homeChat.php; //!file:library/homeChat/eclMod_homeChat_list.php; class eclMod_homeChat_list { // class eclMod_homeChat_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 ('userHome_index_recents'); $row = $mod->appendChild (); $where = array ( 'owner_id' => $me->userId, 'mode' => MODE_GROUP, ); $groups = $store->domainExtras->search ($where); foreach ($groups as $group) { // each recent chat $data = $store->domainContent->openById ($group['domain_id'], $group['parent_id']); $row->appendChild ($data) ->set ('updated', $data['coments_last_update']) ->appendFolder ('group-' . $group['domain_id'] . '-' . $group['id']); } // each recent chat $chats = $store->userExtras->children ($me->userId, MODE_GROUP, 0); foreach ($chats as $chat) { // each recent chat $data = $store->userContent->open ($chat['owner_id'], '-register'); $row->appendChild ($data) ->set ('updated', $chat['updated']) ->appendFolder ($store->user->getName ($chat['owner_id'])); } // each recent chat if (!$row->children) return; $row->sort ('updated', 'desc'); $mod->enabled = true; $mod->data = $store->control->read ('modules/list'); } // function setModule } // class eclMod_homeChat_list //!eof:library/homeChat/eclMod_homeChat_list.php; //!file:library/homeChat/group/eclApp_homeChat_group.php; class eclApp_homeChat_group { // class eclApp_homeChat_group static function is_child ($me, $name) { // function is_child global $store; $parts = explode ('-', $name); if (count ($parts) < 3) return false; if ($parts[0] != 'group') return false; $domainId = intval ($parts[1]); $id = intval ($parts[2]); if (!$domainId or !$id) return false; $data = $store->domainExtras->openById ($domainId, $id); if (!$data) return false; if ($data['mode'] != MODE_GROUP or $data['owner_id'] != $me->userId) return false; 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 global $store; return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; list ($prefix, $domainId, $id) = explode ('-', $me->name); $group = $store->domainExtras->openById (intval ($domainId), intval ($id)); $data = $store->domainContent->openById ($group['domain_id'], $group['parent_id']); if (isset ($data['text']['title'])) $me->data['text']['title'] = $data['text']['title']; else $me->data['text']['title'] = $data['text']['caption']; $me->data['text']['caption'] = $data['text']['caption']; $me->domainId = $data['domain_id']; $me->id = $data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->actions ('group', 'remove')) return self::action_remove ($document); // Context remove $document->mod->context->appendChild ('homeChat_group_contextRemove') ->url (true, true, '_group-remove'); $document->mod->comments->enable (); } // function dispatch static function action_remove ($document) { // function action_remove global $store; $me = $document->application; $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_GROUP, 'parent_id' => $me->id, 'owner_id' => $document->user->userId, ); $groups = $store->domainExtras->search ($where); if (!isset ($groups[0]['id'])) return; $store->domainExtras->delete ($me->domainId, $groups[0]['id']); $document->application = $me->parent; $document->application->dispatch ($document); $document->reload = $document->url (); } // function action_remove } // class eclApp_homeChat_group //!eof:library/homeChat/group/eclApp_homeChat_group.php; //!file:library/homeChat/user/eclApp_homeChat_user.php; class eclApp_homeChat_user { // class eclApp_homeChat_user static function is_child ($me, $name) { // function is_child global $store; if ($store->user->getStatus ($name)) 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 (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $id = $store->user->getId ($me->name); $data = $store->userContent->open ($id, '-register'); if (isset ($data['text']['title'])) $me->data['text']['title'] = $data['text']['title']; else $me->data['text']['title'] = $data['text']['caption']; $me->data['text']['caption'] = $data['text']['caption']; $me->data['owner_id'] = $id; } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->actions ('chat', 'clear')) self::action_clear ($document); if ($document->actions ('chat', 'remove') and self::action_remove ($document)) return; // Context clear $document->mod->context->appendChild ('homeChat_user_contextClear') ->url (true, true, '_chat-clear-' . TIME); // Context remove $document->mod->context->appendChild ('homeChat_user_contextRemove') ->url (true, true, '_chat-remove-' . TIME); $document->mod->comments = new eclMod_homeChat_user_comments ($document); $document->mod->comments_add = new eclMod_homeChat_user_commentsAdd ($document); } // function dispatch static function action_clear ($document) { // function action_clear global $store; $me = $document->application; if (!isset ($document->actions['chat'][2]) or intval ($document->actions['chat'][2]) < TIME - 1800) return; $time = intval ($document->actions['chat'][2]); $where = array ( 'user_id' => $me->userId, 'mode' => MODE_GROUP, 'owner_id' => $me->data['owner_id'], ); $groups = $store->userExtras->search ($where); if (!isset ($groups[0]['id'])) return; $comments = $store->userExtras->children ($me->userId, MODE_COMMENT, $groups[0]['id']); foreach ($comments as $data) { // clear each comment if ($data['created'] < $time) $store->userExtras->delete ($me->userId, $data['id']); } // clear each comment } // function action_clear static function action_remove ($document) { // function action_remove global $store; $me = $document->application; if (!isset ($document->actions['chat'][2]) or intval ($document->actions['chat'][2]) < TIME - 1800) return false; $time = intval ($document->actions['chat'][2]); $where = array ( 'user_id' => $me->userId, 'mode' => MODE_GROUP, 'owner_id' => $me->data['owner_id'], ); $groups = $store->userExtras->search ($where); if (!isset ($groups[0]['id'])) return false; $newComments = 0; $comments = $store->userExtras->children ($me->userId, MODE_COMMENT, $groups[0]['id']); foreach ($comments as $data) { // clear each comment if ($data['created'] < $time) $store->userExtras->delete ($me->userId, $data['id']); else $newComments++; } // clear each comment if ($newComments) return false; $store->userExtras->delete ($me->userId, $groups[0]['id']); $document->application = $me->parent; $document->application->dispatch ($document); $document->reload = $document->url (); return true; } // function action_remove } // class eclApp_homeChat_user //!eof:library/homeChat/user/eclApp_homeChat_user.php; //!file:library/homeChat/user/eclMod_homeChat_user_comments.php; class eclMod_homeChat_user_comments { // class eclMod_homeChat_user_comments 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; $user = $document->user; $render = $document->render; $friend = $system->child (SYSTEM_PROFILES_URI)->child ($document->application->name); $userChats = $store->userExtras->search (array ( 'user_id' => $user->userId, 'mode' => MODE_GROUP, 'owner_id' => $friend->userId )); if (!isset ($userChats[0]['id'])) return; $userChatId = $userChats[0]['id']; $posts = $store->userExtras->children ($user->userId, MODE_COMMENT, $userChatId); if (!$posts) return; $row = $mod->appendChild (); foreach ($posts as $data) { // each comment $row->appendChild ($data); } // each comment $row->sort (); $mod->data = $render->block ('modules/comments'); $mod->enabled = true; } // function setModule } // class eclMod_homeChat_user_comments //!eof:library/homeChat/user/eclMod_homeChat_user_comments.php; //!file:library/homeChat/user/eclMod_homeChat_user_commentsAdd.php; class eclMod_homeChat_user_commentsAdd { // class eclMod_homeChat_user_commentsAdd public $document; private $children; public function __construct ($document) { // function __construct global $store, $system; $this->document = $document; $formulary = $document->createFormulary ('homeChat_user_form', array (), 'chat'); if ($formulary->command ('save') and $formulary->save ()) { // save $friend = $system->child (SYSTEM_PROFILES_URI)->child ($document->application->name); $user = $document->user; $friendChats = $store->userExtras->search (array ( 'user_id' => $friend->userId, 'mode' => MODE_GROUP, 'owner_id' => $user->userId )); if (isset ($friendChats[0]['id'])) { // existing friend chat $friendChatId = $friendChats[0]['id']; $friendChat = &$store->userExtras->openById ($friend->userId, $friendChatId); $friendChat['updated'] = TIME; } // existing friend chat else { // create friend chat id $data = array ( 'user_id' => $friend->userId, 'mode' => MODE_GROUP, 'owner_id' => $user->userId ); $friendChatId = $store->userExtras->insert ($friend->userId, $data); } // create friend chat id $userChats = $store->userExtras->search (array ( 'user_id' => $user->userId, 'mode' => MODE_GROUP, 'owner_id' => $friend->userId )); if (isset ($userChats[0]['id'])) { // existing user chat $userChatId = $userChats[0]['id']; $userChat = &$store->userExtras->openById ($user->userId, $userChatId); $userChat['updated'] = TIME; } // existing user chat else { // create user chat id $data = array ( 'user_id' => $user->userId, 'mode' => MODE_GROUP, 'owner_id' => $friend->userId ); $userChatId = $store->userExtras->insert ($user->userId, $data); } // create user chat id $toUserData = $formulary->data; $toUserData['mode'] = MODE_COMMENT; $toUserData['parent_id'] = $userChatId; $toUserData['owner_id'] = $user->userId; $masterId = $store->userExtras->insert ($user->userId, $toUserData); $data = $formulary->data; $data['mode'] = MODE_COMMENT; $data['parent_id'] = $friendChatId; $data['master_id'] = $masterId; $data['owner_id'] = $user->userId; $store->userExtras->insert ($friend->userId, $data); } // save $formulary->data = array (); $this->children = $formulary->create ()->children; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $render = $document->render; $mod->children = $this->children; $mod->data = $render->block ('modules/comments_add'); $mod->enabled = true; } // function setModule } // class eclMod_homeChat_user_commentsAdd //!eof:library/homeChat/user/eclMod_homeChat_user_commentsAdd.php; //!file:library/homePublications/create/eclApp_homePublications_create.php; class eclApp_homePublications_create { // class eclApp_homePublications_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->userContent->findMarker ($me->userId, 2) and $name == 'publications') 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->userContent->findMarker ($me->userId, 2)) return array ('publications'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('homePublications_create_content'); $me->map = array ('home_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_homePublications_create //!eof:library/homePublications/create/eclApp_homePublications_create.php; //!file:library/homePublications/eclApp_homePublications.php; class eclApp_homePublications { // class eclApp_homePublications 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_homePublications_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_homePublications //!eof:library/homePublications/eclApp_homePublications.php; //!file:library/homePublications/eclMod_homePublications_list.php; class eclMod_homePublications_list { // class eclMod_homePublications_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 ('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) ->url ($pathway); } // each recent post if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_homePublications_list //!eof:library/homePublications/eclMod_homePublications_list.php; //!file:library/integration/eclApp_integration.php; class eclApp_integration { // class eclApp_integration static function is_child ($parent, $name) { // function is_child if ($name == 'integration') 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 ('integration'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('integration_content'); $me->access = 4; $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_integration //!eof:library/integration/eclApp_integration.php; //!file:library/integrationGoogleWebmasters/eclApp_integrationGoogleWebmasters.php; class eclApp_integrationGoogleWebmasters { // class eclApp_integrationGoogleWebmasters static function is_child ($me, $name) { // function is_child if ($name == 'google-webmasters') 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 ('google-webmasters'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('integrationGoogleWebmasters_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $me = $document->application; $saved = &$store->domainContent->open ($me->domainId, '-google-webmasters'); if ($io->request->uploaded) { // save $fields = reset ($io->request->uploaded); $file = reset ($fields); if (!$file['size'] or $file['size'] > 2048) return; $data['local']['file_name'] = $file['name']; $data['local']['file_content'] = file_get_contents ($file['tmp_name']); if ($saved) { // saved $saved['local'] = $data['local']; } // saved else { // create $data['mode'] = MODE_CONFIG; $data['name'] = '-google-webmasters'; $store->domainContent->insert ($me->domainId, $data); $saved = $data; } // create } // save if ($saved) $formulary = $document->createFormulary ('integrationGoogleWebmasters_view', $saved); else $formulary = $document->createFormulary ('integrationGoogleWebmasters_create', array (), 'new'); if ($saved and $formulary->command ('remove')) { // remove $store->domainContent->delete ($me->domainId, $saved['id']); $formulary = $document->createFormulary ('integrationGoogleWebmasters_create', array (), 'new'); } // remove $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_integrationGoogleWebmasters //!eof:library/integrationGoogleWebmasters/eclApp_integrationGoogleWebmasters.php; //!file:library/integrationRSS/eclApp_integrationRSS.php; class eclApp_integrationRSS { // class eclApp_integrationRSS static function is_child ($me, $name) { // function is_child if ($name == 'rss') 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 ('rss'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store, $system; $me->data = $store->control->read ('integrationRSS_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('integrationRSS_edit', $document->domain->data, 'rss'); if ($formulary->command ('save') and $formulary->save ()) { // save $document->domain->data = $formulary->data; $document->mod->humperstilshen->alert ('system_msg_alertDataUpdated'); } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_integrationRSS //!eof:library/integrationRSS/eclApp_integrationRSS.php; //!file:library/integrationSMS/config/eclApp_integrationSMS_config.php; class eclApp_integrationSMS_config { // class eclApp_integrationSMS_config static function is_child ($parent, $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 ('integrationSMS_config_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('integrationSMS_config_edit'); if ($formulary->command ('save') and $formulary->save ()) { // save $document->mod->humperstilshen->alert ('system_msg_alertDataUpdated'); } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_integrationSMS_config //!eof:library/integrationSMS/config/eclApp_integrationSMS_config.php; //!file:library/integrationSMS/eclApp_integrationSMS.php; class eclApp_integrationSMS { // class eclApp_integrationSMS static function is_child ($parent, $name) { // function is_child if ($name != 'sms') return false; if (SYSTEM_HOSTING_MODE == 0) return true; if ($me->applicationName == 'adminIntegrations') return true; if (defined ('INTEGRATION_SMS_MODE') and INTEGRATION_SMS_MODE > 1) 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 (SYSTEM_HOSTING_MODE == 0) return array ('sms'); if ($me->applicationName == 'adminIntegrations') return array ('sms'); if (defined ('INTEGRATION_SMS_MODE') and INTEGRATION_SMS_MODE > 1) return array ('sms'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store, $system; $me->data = $store->control->read ('integrationSMS_content'); $me->map = array ('integrationSMS_config', 'integrationSMS_test'); $me->groups = $system->groups; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (defined ('INTEGRATION_PAPO_SMS_ENABLE') and INTEGRATION_PAPO_SMS_ENABLE) $document->dataMerge ('integrationSMS_contentEnabled'); else $document->dataMerge ('integrationSMS_contentDisabled'); $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_integrationSMS //!eof:library/integrationSMS/eclApp_integrationSMS.php; //!file:library/integrationSMS/eclIo_integrationSMS_papo.php; class eclIo_integrationSMS { // class eclIo_integrationSMS public function send ($sms) { // function send global $store; if ( !defined ('INTEGRATION_PAPO_SMS_ENABLE') or !INTEGRATION_PAPO_SMS_ENABLE or INTEGRATION_PAPO_SMS_USER == '' or INTEGRATION_PAPO_SMS_PASS == '' or !isset ($sms['number']) or !isset ($sms['message']) ) return false; $url = 'https://www.paposms.com/webservice/1.0/send/'; $fields = array ( 'user' => INTEGRATION_PAPO_SMS_USER, 'pass' => INTEGRATION_PAPO_SMS_PASS, 'numbers' => $sms['number'], 'message' => $sms['message'], 'return_format' => 'json' ); $url .= '?' . http_build_query ($fields, 'a', '&'); $result = eclIo_webservice::json2array (file_get_contents ($url)); return $result; } // function send public function close () { // function close } // function close } // class eclIo_integrationSMS //!eof:library/integrationSMS/eclIo_integrationSMS_papo.php; //!file:library/integrationSMS/test/eclApp_integrationSMS_test.php; class eclApp_integrationSMS_test { // class eclApp_integrationSMS_test static function is_child ($parent, $name) { // function is_child if ($name == 'test') 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 ('test'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('integrationSMS_test_content'); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('integrationSMS_test_edit'); if ($formulary->command ('save') and $formulary->save ()) { // save $document->mod->humperstilshen->alert ('system_msg_alertDataUpdated'); } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_integrationSMS_test //!eof:library/integrationSMS/test/eclApp_integrationSMS_test.php; //!file:library/integrationSMTP/config/eclApp_integrationSMTP_config.php; class eclApp_integrationSMTP_config { // class eclApp_integrationSMTP_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 ('integrationSMTP_config_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('integrationSMTP_config_edit'); if ($formulary->save ()) { // formulary saved $document->mod->humperstilshen->alert ('system_msg_alertDataUpdated'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_integrationSMTP_config //!eof:library/integrationSMTP/config/eclApp_integrationSMTP_config.php; //!file:library/integrationSMTP/eclApp_integrationSMTP.php; class eclApp_integrationSMTP { // class eclApp_integrationSMTP static function is_child ($me, $name) { // function is_child if ($name != 'smtp') return false; if (SYSTEM_HOSTING_MODE == 0) return true; if ($me->applicationName == 'adminIntegrations') return true; if (defined ('INTEGRATION_SMTP_MODE') and INTEGRATION_SMTP_MODE > 1) 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 (SYSTEM_HOSTING_MODE == 0) return array ('smtp'); if ($me->applicationName == 'adminIntegrations') return array ('smtp'); if (defined ('INTEGRATION_SMTP_MODE') and INTEGRATION_SMTP_MODE > 1) return array ('smtp'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store, $system; $me->data = $store->control->read ('integrationSMTP_content'); $me->map = array ('integrationSMTP_config', 'integrationSMTP_test'); $me->groups = $system->groups; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_integrationSMTP //!eof:library/integrationSMTP/eclApp_integrationSMTP.php; //!file:library/integrationSMTP/test/eclApp_integrationSMTP_test.php; class eclApp_integrationSMTP_test { // class eclApp_integrationSMTP_test static function is_child ($me, $name) { // function is_child if ($name == 'test') 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 ('INTEGRATION_SMTP_ENABLE') and INTEGRATION_SMTP_ENABLE) return array ('test'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('integrationSMTP_test_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $formulary = $document->createFormulary ('integrationSMTP_test_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 ('integrationSMTP_test_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_integrationSMTP_test //!eof:library/integrationSMTP/test/eclApp_integrationSMTP_test.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; // Procure a aplicação $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // 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_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'audio_' . $number); $mod->data['local']['personalite_url'] = $document->url ($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'; $mod->appendChild ($me); } // function setModule } // class eclMod_modAudio //!eof:library/modAudio/eclMod_modAudio.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_create'); $mod->appendChild ($store->control->read ('modBanner_create')); } // creates an image $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'banner'); $mod->data['local']['personalite_url'] = $document->url ($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 = 0; $number < 100; $number++) { // find number if (!isset ($me->data['extras']['box_' . strval ($number)])) break; } // find number $document->pathway[count ($document->pathway) - 1] .= CHR_FNS . strval ($number); } // find last index if (isset ($me->data['extras']['box_' . strval ($number)])) $data = $me->data['extras']['box_' . strval ($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_' . strval ($number)] = $formulary->data; $document->dataReplace ('layouts/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; $render = $document->render; $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // 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 = array_replace_recursive ($render->block ('modules/box'), $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_create'); 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_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'box_' . $number); $mod->data['local']['personalite_url'] = $document->url ($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/modBreadcrumbs/eclMod_modBreadcrumbs.php; class eclMod_modBreadcrumbs { // class eclMod_modBreadcrumbs 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 ($document->printableLayout) return; if ($document->domain->domainId and !isset ($document->data['id'])) return; if (count ($document->pathway) == 1) return; $list[] = $me; while (!$me->parent->isDomain) { // parent is not a domain $me = $me->parent; $list[] = $me; } // parent is not a domain $length = count ($list); if (!$length) return; $row = $mod->appendChild (); // The index page $row->appendChild ($document->domain->child ('')->data) ->url ($document->domain->pathway); for ($i = $length - 1; $i >= 0; $i--) { // loop each breadcrumb $row->appendChild ($list[$i]->data) ->url ($list[$i]->pathway) ->active ($i == 0); } // loop each breadcrumb // Configurações $mod->data = $render->block ('modules/breadcrumbs'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'breadcrumbs'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modBreadcrumbs_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modBreadcrumbs //!eof:library/modBreadcrumbs/eclMod_modBreadcrumbs.php; //!file:library/modCart/eclMod_modCart.php; class eclMod_modCart { // class eclMod_modCart 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; $render = $document->render; $cart = 'cart_' . $document->domain->name; // Condições if (!isset ($document->session[$cart])) return; if ($me->isDomain) return; if (!$me->id) return; if ($document->printableLayout) return; if (isset ($document->domain->data['flags']['modCart_timer']) and $timer = $document->domain->data['flags']['modCart_timer'] and isset ($me->data['marker']) and $me->data['marker'] == 12) return; $me = $document->application; // Configurações $mod->data = $render->block ('modules/cart'); // Itens da lista $local = array(); $quantity = 0; $value = 0; foreach ($document->session[$cart]['order'] as $product) { // each product $quantity += $product['quantity']; $value += $product['value'] * $product['quantity']; } // each product if ($quantity == 1) $captionItems = $store->control->read ('labels/field/cart_item'); else $captionItems = $store->control->read ('labels/field/cart_items'); $local['caption'] = $document->textMerge ($quantity, ' ', $captionItems['text']['caption'], ' (R$' . $value . ')'); if ($me->name != '-cart' and (!isset ($me->data['mode']) or $me->data['mode'] != MODE_SECTION or !isset ($me->data['marker']) or $me->data['marker'] != 12)) { // go to cart if ($id = $store->domainContent->findMarker ($document->domain->domainId, 12)) $local['url'] = $document->url ($store->domainContent->pathway ($document->domain->domainId, $id)); else $local['url'] = $document->url (array ($document->domain->name, '-cart')); } // go to cart if (isset ($timer) and $timer) { // timer on if (isset ($document->session[$cart]['start_time'])) { // set timer $local['timer_on'] = 1; $local['timer'] = $timer - (TIME - $document->session[$cart]['start_time']); $local['url_timeout'] = $document->url (true, true, '_preload-cart_cart-timeout'); if ($local['timer'] < 10) $local['timeout'] = 1; } // set timer } // timer on $mod->appendChild ($local); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'cart'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modCart_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modCart //!eof:library/modCart/eclMod_modCart.php; //!file:library/modCart/scope/eclMod_modCart_scope.php; class eclMod_modCart_scope { // class eclMod_modCart_scope 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 (!$render->getVar ('value')) return; if (!$store->domainContent->findMarker ($document->domain->domainId, 12)) return; $mod->data = $store->control->read ('modCart_scope_module'); $row = $mod->appendChild ($render->data); $row->data['url'] = $document->url (true, true, '_preload-cart'); $mod->enabled = true; } // function setModule } // class eclMod_modCart_scope //!eof:library/modCart/scope/eclMod_modCart_scope.php; //!file:library/modComments/add/eclMod_modComments_add.php; class eclMod_modComments_add { // class eclMod_modComments_add 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 (!$document->mod->comments->children) return; $mod->children = $document->mod->comments->children; // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'comments_add'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modComments_add_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->data = $render->block ('modules/comments_add'); $mod->enabled = true; } // function setModule } // class eclMod_modComments_add //!eof:library/modComments/add/eclMod_modComments_add.php; //!file:library/modComments/eclMod_modComments.php; class eclMod_modComments { // class eclMod_modComments public $document; public $enable = false; public $children = array (); public function __construct ($document) { // function __construct global $store; $this->document = $document; } // function __construct public function enable () { // function enable global $store; $document = $this->document; $me = $document->application; $this->enable = true; // Conditions if (!$document->user->userId) return; if (!$me->userId and !isset ($me->parent->data['flags']['comments_access'])) return; if (!$me->userId and !$document->access ($me->parent->data['flags']['comments_access'])) return; $formulary = $document->createFormulary ('modComments_add_form', array (), 'add_comment'); if ($formulary->command ('save') and $formulary->save ()) { // save comment $section = &$store->domainContent->openById ($me->domainId, $me->id); $section['coments_last_update'] = TIME; $data = $formulary->data; $data['mode'] = MODE_COMMENT; $data['parent_id'] = $me->id; $data['owner_id'] = $document->user->userId; $store->domainExtras->insert ($me->domainId, $data); $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_GROUP, 'parent_id' => $me->id, 'owner_id' => $document->user->userId, ); $groups = $store->domainExtras->search ($where); if ($groups) { // group found } // group ofound else { // create group $group = array ( 'domain_id' => $me->domainId, 'mode' => MODE_GROUP, 'parent_id' => $me->id, 'owner_id' => $document->user->userId ); $store->domainExtras->insert ($me->domainId, $group); } // create group $formulary->data = array (); } // save comment $this->children = $formulary->create ()->children; } // function enable public function setModule ($mod, $arguments) { // function setModule global $store; if (!$this->enable) return; $document = $this->document; $me = $document->application; $render = $document->render; $comments = $store->domainExtras->children ($me->domainId, MODE_COMMENT, $me->id); if (!$comments) return; $row = $mod->appendChild (); foreach ($comments as $data) { // each comment $row->appendChild ($data); } // each comment $row->sort (); $mod->data = $render->block ('modules/comments'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'comments'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modComments_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modComments //!eof:library/modComments/eclMod_modComments.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; // Condições if (!isset ($document->data['text']['content']) and !$document->contentEditable) return; // Configurações $mod->data = $render->block ('modules/content'); // Itens da lista $mod->appendChild ($document->data) ->set ('editable', $document->contentEditable); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'content'); $mod->data['local']['personalite_url'] = $document->url ($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; public $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) return false; if (!isset ($data['text']['caption'])) { // get title $title = $store->control->read ('modContext_goHelp'); $data['text']['caption'] = $title['text']['caption']; if (!isset ($data['text']['title'])) $data['text']['title'] = $title['text']['caption']; } // get title $this->help = $this->document->createListItem ($data) ->dialog ($data); return true; } // function help public function setModule ($mod, $arguments) { // function setModule global $store; if (!$this->enabled) return; $document = $this->document; $me = $document->application; $render = $document->render; $row = $mod->appendChild (); $row->children = $this->children; if ($document->user->userId and $me->userId and $me->userId != $document->user->userId) $this->socialTools ($row); if ($this->help) $row->children[] = $this->help; foreach ($row->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 $row->appendChild ('modWelcome_goReport') ->url (true, true, '_preload-report') ->active ($document->actions ('alert', 'report')); } // abuse report if (!$row->children) return; $mod->data = array_replace ($render->block ('modules/system_menu'), $store->control->read ('modContext_module')); $mod->enabled = true; } // function setModule private function socialTools ($row) { // function socialTools global $store; $document = $this->document; $me = $document->application; $user = $document->user; $friend = $store->userContent->open ($me->userId, '-register'); if ($chatId = $store->userContent->findMarker ($user->userId, 3)) $pathway = $store->userContent->pathway ($user->userId, $chatId); else $pathway = array (SYSTEM_PROFILES_URI, $user->name, '-chat'); $pathway[] = $store->user->getName ($me->userId); $row->appendChild ('modContext_goChat') ->set ('friend_caption', $friend['text']['caption']) ->url ($pathway); } // function socialTools } // class eclMod_modContext //!eof:library/modContext/eclMod_modContext.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; $render = $document->render; // Identifique o nome da seção e o número do painel if (is_string ($this->name)) $arguments = array ($this->name, '0'); // Procure a aplicação $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['dinamic_' . $number])) $mod->data = $me->data['extras']['dinamic_' . $number]; else { // from preset if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; $mod->data = $render->block ('modules/dinamic_' . $preset); if (!$mod->data) $mod->data = $render->block ('modules/dinamic_blog'); } // from preset if ($document->access (4)) { // personalite $mod->enabled = true; if (!$mod->data) $mod->data = $store->control->read ('modDinamic_create'); $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'dinamic_' . $number); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modDinamic_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // 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 'coments_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 = (24 * intval (date ('z'))) + 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; // Itens da lista $row = $mod->appendChild (); 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 ($post) ->set ('editable', $document->contentEditable and $document->access (4, $post->groups)) ->url ($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 ('url', '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) { // function 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 } // function dispatch static function &get_data ($document, $id) { // function & 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 & 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 return; $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') ->url (true, true, '_wysiwyg-enable'); } // disabled else { // enabled $document->mod->interface->appendChild ('modEditor_contextWisiwygDisable') ->url (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->url (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); $item = $mod->appendChild ($child); if (isset ($child['local']['target'])) { // open dialog $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', $child['local']['personalite'], $child['local']['target']); $item->url ($pathway, true, '_return-tag') ->popUpOpen (400, 300); } // open dialog } // 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; $render = $document->render; $me = $document->application; $base = array_slice ($me->pathway, 1); 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); $row = $mod->appendChild (); foreach ($documentObjects as $field => $object) { // each document object $pathway = $base; array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', $field); $caption = $store->control->read ('modEditor_objects_' . $target); $local['caption'] = $document->textMerge ($caption['text']['caption'], ' ', $modeCaption['text']['caption']); $row->appendChild ($local) ->url ($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, '-personalite', 'extras', $field); $caption = $store->control->read ('modEditor_objects_' . $target); $local['caption'] = $document->textMerge ($caption['text']['caption'], ' ' . $number); $row->appendChild ($local) ->url ($pathway) ->popUpOpen (); } // each content object if (!$row->children) return; $mod->data = array_replace ($render->block ('modules/system_menu'), $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; // Procure a aplicação $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // 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; $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'file_' . $number); if (!isset ($file)) { // create $mod->data = $store->control->read ('modFile_create'); $mod->appendChild ($mod->data) ->url ($pathway) ->popUpOpen (); return; } // create $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'file_' . $number); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modFile_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // personalite $mod->data['local']['number'] = $number; $mod->data['local']['list'] = 'details'; $mod->data['local']['details'] = 'media_file'; if (!isset ($file)) return; $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/modFooter/eclMod_modFooter.php; class eclMod_modFooter { // class eclMod_modFooter 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 (!$document->domain->domainId) return; // Configurações $mod->data = $render->block ('modules/footer'); // 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, '-personalite', 'modules', 'footer'); if (!isset ($mod->data['text']['content'])) { // insert info $mod->data = $store->control->read ('modFooter_create'); $row = $mod->appendChild (); $row->appendChild ('modFooter_create') ->url ($pathway) ->popUpOpen (); return; } // insert info $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modFooter_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference if (!isset ($mod->data['text']['content'])) return; $mod->appendChild ($mod->data); $mod->enabled = true; } // function setModule } // class eclMod_modFooter //!eof:library/modFooter/eclMod_modFooter.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; // Condições if (!isset ($document->data['hits']) or !$document->data['hits']) return; // Configurações $mod->data = $render->block ('modules/hits'); // Itens da lista $mod->appendChild ($document->data); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'hits'); $mod->data['local']['personalite_url'] = $document->url ($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; // Procure a aplicação $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // 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; $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'html_' . $number); if (!isset ($html)) { // empty $mod->data = $store->control->read ('modHtml_create'); $mod->appendChild ($mod->data) ->url ($pathway) ->popUpOpen (); return; } // empty $mod->data['local']['personalite_url'] = $document->url ($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->access (1) or $document->application->isDomain) and !$document->mod->context->help) { // application help $help = $document->application->applicationName . '_help'; if ($help == 'section_help' and isset ($document->application->data['flags']['section_type'])) $help = 'section' . ucfirst ($document->application->data['flags']['section_type']) . '_help'; $data = $store->control->read ($help); if ($data) { // context help found $document->mod->context->help ($help); } // context help found } // application help if ($document->application->isDomain) { // is domain $menu->appendChild (array ('name' => 'context')); } // is domain elseif ($document->access (1)) { // connected if ($document->domain->name == SYSTEM_ADMIN_URI) $menu_list = array ('context', 'user'); if ($document->domain->name == SYSTEM_ADMIN_URI) $menu_list = array ('context', 'user'); elseif ($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->url (); if ($document->access (1)) { // check session expiration $mod->data['local']['session_check_url'] = $document->url ($document->domain->pathway, true, '_session-check'); $mod->data['local']['session_refresh_url'] = $document->url ($document->domain->pathway, true, '_session-refresh'); $mod->data['local']['session_ttl'] = SYSTEM_SESSION_TTL; $formulary = $document->createFormulary ('modHumperstilshen_sessionCheck', array (), 'session_check'); $this->dialog ('modHumperstilshen_sessionCheck', array (), $formulary); $mod->data['local']['session_dialog'] = 'dialog_' . count ($this->children); } // check session expiration $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']['icon'])) $icon = $data['flags']['icon']; elseif (isset ($data['default_icon'])) $icon = $data['default_icon']; if (isset ($icon)) { // set icon $data['icon'] = $this->document->urlFiles ('icons/ecolabore-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['url'])) $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/eclFilter_modImg.php; class eclFilter_modImg { // class eclFilter_modImg static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; $local['type'] = 'file'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_msg_filterImgHelp'; $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save global $io, $store; $flags = $formulary->flags; $received = $formulary->received; if ($formulary->errorMsg !== false) return; if (!$io->request->uploaded) { // error if (isset ($control['flags']['required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'system_msg_filterImgNotUploaded'); return false; } // error $uploaded = reset ($io->request->uploaded); $uploaded = $uploaded[0]; if (!isset ($uploaded['type'])) { // error if (isset ($control['flags']['required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'system_msg_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; $uploaded = $uploaded['tmp_name']; if (@getimagesize ($uploaded) === false) { // error if (isset ($control['flags']['error'])) return $formulary->setErrorMsg ($control, $fieldName, 'system_msg_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 'system_msg_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 'system_msg_alertImageError'; if (isset ($flags['target'])) $name = $formulary->application->data['name'] . CHR_FNS . $flags['target']; else $name = $formulary->data['name'] . CHR_FNS . 'img_0'; $filename = PATH_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 ($uploaded['tmp_name'], $filename . $ext); $saved = true; // $saved = imagepng ($image_big, $filename . $ext); } // png file if (!$saved) return 'system_msg_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 . CHR_FNS . 'mini.gif'); elseif ($type == 2) $saved = imagejpeg ($image_mini, $filename . CHR_FNS . 'mini.jpg', 100); elseif ($type == 3) { // png $saved = true; } // png if (!$saved) return 'system_msg_alertImgError'; // save image data if (isset ($flags['target'])) { // section image $data = &$formulary->data; } // section image 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['files']['img'] = $name . $ext; $data['img_width'] = $img_width; $data['img_height'] = $img_height; if ($type == 3) { // png hack $data['files']['img_mini'] = $name . $ext; $data['img_mini_width'] = $img_width; $data['img_mini_height'] = $img_height; } // png hack else { // normal $data['files']['img_mini'] = $name . CHR_FNS . '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; 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']['files']['img'])) return; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'descriptive'; $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; // Procure a aplicação $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // 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; $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'img_' . $number); if (!isset ($img)) { // creates a new image $mod->data = $store->control->read ('modImg_create'); $mod->appendChild ('modImg_create') ->url ($pathway) ->popUpOpen (); return; } // creates a new image $mod->data['local']['personalite_url'] = $document->url ($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 = $me->data; $local['extras']['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['local']['gender']) and $document->user->data['local']['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') ->url (true, true, '_instructor-next'); return true; WELCOME_RETURN: $instructor->addMessage ('domain_empty_help04index02return') ->url (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->urlFiles ($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->url ($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->url ($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; $render = $document->render; $row = $mod->appendChild (); $row->children = $this->children; foreach ($row->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 /* * $row->appendChild ('dialogTemplate_edit') * ->virtual () * ->url (array ($document->domain->name, '-dialog', 'layout', 'scheme')) * ->popUpOpen (750, 550); * * $row->appendChild ('modLayout_advanced_content') * ->virtual () * ->url (array ($document->domain->name, '-dialog', 'advanced')) * ->popUpOpen (750, 550); */ $row->appendChild ('personalite_content') ->url (array ($document->domain->name, '-personalite')) ->popUpOpen (750, 550); } // personalite layout // Printable version $row->appendChild ('modLayout_print') ->virtual () ->url (true, true, '_layout-print'); if (!$row->children) return; $mod->data = array_replace ($render->block ('modules/system_menu'), $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; // Condições if (!isset ($me->data['text']['caption'])) return; if ($document->printableLayout) return; if ($document->domain->domainId and !isset ($document->data['id'])) return; // Preparação if ($document->access (4)) $access = 1; else $access = 1; $languages = array (); if (isset ($document->domain->data['flags']['languages'])) { // set domain languages foreach (explode (CRLF, $document->domain->data['flags']['languages']) as $lang) { // 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 // Itens da lista $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 ('labels/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->urlFiles ('modLanguages/' . $lang . '.png', true, '-shared'), 'LANG' => strtoupper ($lang), 'lang' => $lang ); $row->appendChild ($local) ->active ($active) ->url (true, $lang, $this->action); } // valid language } // each valid languages if (count ($row->children) == 1 and $active) return; // Configurações $mod->data = $render->block ('modules/languages'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'languages'); $mod->data['local']['personalite_url'] = $document->url ($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/modLanguages/header/eclMod_modLanguages_header.php; class eclMod_modLanguages_header { // class eclMod_modLanguages_header 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 (!isset ($me->data['text']['caption'][$document->lang])) { // no index, go canonical if (isset ($me->data['text']['caption'][$document->defaultLang])) $mod->data['local']['url_canonical'] = $document->url (true, $document->defaultLang); else { // first language $lang = key ($me->data['text']['caption']); $mod->data['local']['url_canonical'] = $document->url (true, $lang); } // first language } // no index, go canonical if ($me->name == '' and !isset ($me->parent->data['flags']['modRss_disable'])) { // rss if ($document->lang == $document->defaultLang) $mod->data['local']['url_rss'] = $document->url (array ($document->domain->name, 'rss.xml'), false, false); else $mod->data['local']['url_rss'] = $document->url (array ($document->domain->name, 'rss-' . $document->lang . '.xml'), false, false); $mod->data['local']['rss'] = $me->parent->data['text']['title']; } // rss foreach ($me->data['text']['caption'] as $lang => $text) { // each lang if ($lang == $document->lang) continue; $mod->appendChild (array ( 'lang' => $lang, 'url' => $document->url (true, $lang) )); } // each lang $mod->enabled = true; } // function setModule } // class eclMod_modLanguages_header //!eof:library/modLanguages/header/eclMod_modLanguages_header.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 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': case 'templates': $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') ->url (true, true, '_personalite-off'); } // personalite buttons on else { // personalite buttons off $document->mod->interface->appendChild ('modLayout_personaliteOn') ->url (true, true, '_personalite-on'); } // personalite buttons off } // administrator access $templates = $store->domainExtras->children ($document->domain->domainId, MODE_TEMPLATE, 0); $blocks = array (); foreach ($templates as $data) { // each template $blocks[$data['name']] = $data; } // 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']); if (isset ($data['blocks'])) { // blocks foreach ($data['blocks'] as $name => $block) { // each block if (is_string ($block)) $render->blocks[$name] = $store->control->read ($block); else $render->blocks[$name] = $block; } // each block } // blocks unset ($data['blocks']); $mod->data = $data; } // function setModule } // class eclMod_modLayout //!eof:library/modLayout/eclMod_modLayout.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 ('layouts/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 ('layouts/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; $render = $document->render; if ($document->access (1) or (isset ($document->data['flags']['modLogin_enabled']) and !$document->data['flags']['modLogin_enabled'])) return; $mod->data = $render->block ('modules/login'); 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 $showSublevel = false; 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; // Condições if ($document->printableLayout) return; if ($document->pathway[0] == SYSTEM_PROFILES_URI) return $this->profileNavBar ($mod); // 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]->isDomain and !$app[$level]->parent->isDomain) { // loop levels $level++; $app[$level] = $app[$level - 1]->parent; $names[$level] = $app[$level]->name; } // loop levels if ($app[$level]->parent->applicationName == 'domain') $isDomain = true; // Vamos criar as camadas static $menuIndex = 0; 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 (isset ($isDomain) and $i == $level and $index == 0 and !isset ($mod->data['local']['home_display'])) continue; $menu = $layer->appendChild ($child->data) ->url ($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)); if (isset ($child->data['flags']['section_type']) and $child->data['flags']['section_type'] == 'menu') { // submenu $menu->data['menu'] = 'menu' . (++$menuIndex); if ($document->access (4, $child->groups)) $menu->data['can_edit'] = 1; $menuItens = $child->menuChildren ($document); foreach ($menuItens as $menuItem) { // each menu item $menu->appendChild ($menuItem->data) ->url (array ($document->domain->name, $menuItem->name)) ->virtual ($child->access); } // each menu item } // submenu } // each child } // loop each layer if ($this->showSublevel) { // last level $lastLayer = $document->application->menuChildren ($document); if ($lastLayer) $layer = $mod->appendChild (); foreach ($lastLayer as $child) { // each child $layer->appendChild ($child) ->url ($child->pathway); } // each child } // last level if (!$mod->children) return; // Configurações $mod->data = $render->block ('modules/navbar'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'navbar'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modNavbar_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule private function profileNavBar ($mod) { // function profileNavBar global $store; $document = $this->document; $me = $document->application; while (!$me->parent->isDomain) { // find domain $me = $me->parent; } // find domain $row = $mod->appendChild (); foreach ($me->menuChildren ($document) as $child) { // each child $row->appendChild ($child->data) ->url ($child->pathway) ->active ($child->pathway == $document->pathway); } // each child if (!$row->children) return; $mod->data = $store->control->read ('modules/navbar'); $mod->enabled = true; } // function profileNavBar } // class eclMod_modNavbar //!eof:library/modNavbar/eclMod_modNavbar.php; //!file:library/modNavbottom/eclMod_modNavbottom.php; class eclMod_modNavbottom { // class eclMod_modNavbottom 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; // Condições if ($document->printableLayout) return; if (!$document->domain->domainId) return; $names = $store->domainContent->childrenNames ($document->domain->domainId, MODE_SECTION, 1); if (!$names) return; $row = $mod->appendChild (); foreach ($names as $name) { // each child $child = $document->domain->child ($name); if (!$child or !$document->access ($child->access, $child->groups)) continue; $row->appendChild ($child) ->url ($child->pathway) ->active ($child->pathway == $document->pathway); } // each child if (!$row->children) return; // Configurações $mod->data = $render->block ('modules/navbottom'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'navbottom'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modNavbottom_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modNavbottom //!eof:library/modNavbottom/eclMod_modNavbottom.php; //!file:library/modNavmain/eclMod_modNavmain.php; class eclMod_modNavmain { // class eclMod_modNavmain public $document; public $showSublevel = false; 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; // Condições if ($document->printableLayout) return; if ($document->pathway[0] == SYSTEM_PROFILES_URI) return $this->profileNavBar ($mod); $row = $mod->appendChild(); foreach ($document->domain->menuChildren ($document) as $child) { // each child $row->appendChild ($child) ->swapTitle() ->url ($child->pathway) ->active ($child->pathway == $document->pathway); } // each child if (!$row->children) return; // Configurações $mod->data = $render->block ('modules/navmain'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'navmain'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modNavmain_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule private function profileNavBar ($mod) { // function profileNavBar global $store; $document = $this->document; $me = $document->application; while (!$me->parent->isDomain) { // find domain $me = $me->parent; } // find domain $row = $mod->appendChild (); foreach ($me->menuChildren ($document) as $child) { // each child $row->appendChild ($child->data) ->url ($child->pathway) ->active ($child->pathway == $document->pathway); } // each child if (!$row->children) return; $mod->data = $store->control->read ('modules/navbar'); $mod->enabled = true; } // function profileNavBar } // class eclMod_modNavmain //!eof:library/modNavmain/eclMod_modNavmain.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/modSearch/eclMod_modSearch.php; class eclMod_modSearch { // class eclMod_modSearch public $document; public $enabled = true; 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; if ($document->application->isDomain) return; if ($document->printableLayout) return; $document = $this->document; $render = $document->render; $me = $document->application; $formulary = $document->createFormulary ('modSearch_search', array (), 'search'); if ($id = $store->domainContent->findMarker ($me->domainId, 3)) $formulary->pathway = $store->domainContent->pathway ($me->domainId, $id); else $formulary->pathway = array ($document->domain->name, '-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 = $render->block ('modules/search'); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'search'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modSearch_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_modSearch //!eof:library/modSearch/eclMod_modSearch.php; //!file:library/modSort/eclMod_modSort.php; class eclMod_modSort { // class eclMod_modSort public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule } // function setModule } // class eclMod_modSort //!eof:library/modSort/eclMod_modSort.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 ('layouts/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']['target'])) return; $table = $formulary->appendChild ($control); $table->data['name'] = $fieldName; $array = $formulary->getField ($control['flags']['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']['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']['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 $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // 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 = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'tables', 'table_' . $number); $mod->data['local']['personalite_url'] = $document->url ($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 ('layouts/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 ('layouts/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; // Condições if (!isset ($document->data['text']['title'])) return; // Configurações $mod->data = $render->block ('modules/title'); // Itens da lista $mod->appendChild ($document->data) ->set ('editable', $document->contentEditable); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $document->domain->groups)) { // reference $pathway = array ($document->domain->name, '-personalite', 'modules', 'title'); $mod->data['local']['personalite_url'] = $document->url ($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; $render = $document->render; 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; $row = $mod->appendChild (); foreach ($toolbox->menuChildren ($document) as $child) { // each child if (!isset ($child->data['text']['caption'])) continue; $local = array ( 'virtual' => 1, 'url' => "javaScript:humperstilshen.popUpOpen('" . $document->url ($child->pathway) . "', 400, 600)", 'caption' => $child->data['text']['caption'] ); $row->appendChild (false, $local); } // each child if (!$row->children) return; $mod->data = array_replace ($render->block ('modules/system_menu'), $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; $render = $document->render; if (!$document->access (1)) return; $row = $mod->appendChild (); $row->children = $this->children; if ($document->access (4, $system->groups)) { // webmaster if ($system->child (SYSTEM_ADMIN_URI) and $system->child (SYSTEM_ADMIN_URI)->child ('alerts')) { // exists $alerts = $system->child (SYSTEM_ADMIN_URI)->child ('alerts'); foreach ($alerts->children () as $child) { // each child $row->appendChild ($child->data) ->swapTitle () ->url ($child->pathway); } // each child } // alerts exists } // webmaster $alerts = $system->child (SYSTEM_PROFILES_URI)->child ($document->user->name)->child ('-alerts'); if ($alerts) { // user alerts foreach ($alerts->children () as $child) { // each child if (isset ($child->data['flags']['modUser_alerts_popUp'])) $row->appendChild ($child->data) ->url ($child->pathway) ->popUpOpen (); else $row->appendChild ($child->data) ->url ($child->pathway); } // each child } // user alerts foreach ($row->children as &$child) { // each child $child->data['virtual'] = 1; } // each child if (!$row->children) return; $mod->data = array_replace ($render->block ('modules/system_menu'), $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; $render = $document->render; if (!$document->access (1)) return; if ($document->application->isDomain) return; if (isset ($document->data['flags']['modUser_enabled']) and !$document->data['flags']['modUser_enabled']) return; $row = $mod->appendChild (); // go to user profile main page $row->appendChild ('modUser_goMain') ->url (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)) $row->appendChild ('modUser_goAdmin') ->url (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) $row->appendChild ('modUser_welcome_goHome') ->url (array (SYSTEM_DEFAULT_DOMAIN_NAME)); // logout $application = $document->application; while ($application->access) { // access denied $application = $application->parent; } // access denied $row->appendChild ('modUser_goLogout') ->virtual () ->url ($application->pathway, true, '_logout'); $mod->data = array_replace ($render->block ('modules/system_menu'), $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; $content = '
      ' . $quotes['quotes'][$n][0] . '

      (' . $quotes['quotes'][$n][1] . ')

      '; $data = array ('text' => array ('content' => array ($document->lang => array ( 1 => $content, 2 => 1, 5 => 2, 6 => 1 )))); $mod->appendChild ($data); $mod->enabled = true; } // function setModule } // class eclMod_modUser_quoteoftheday //!eof:library/modUser/quoteoftheday/eclMod_modUser_quoteoftheday.php; //!file:library/modUser/subscribe/eclMod_modUser_subscribe.php; class eclMod_modUser_subscribe { // class eclMod_modUser_subscribe 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; $domain = $document->domain; $main = $system->child (SYSTEM_DEFAULT_DOMAIN_NAME); if (!$main) return; // Recover password only if mails can be sent if (INTEGRATION_SMTP_ENABLE) { // recover password $mod->appendChild ('modUser_welcome_goPassword') ->url (array (SYSTEM_PROFILES_URI, '-recover-password')) ->popUpOpen (); } // recover password // subscribe if ($domain->child ('-join')) $mod->appendChild ('modUser_welcome_goSubscribe') ->url (array ($domain->name, '-join')) ->popUpOpen (); $mod->data = $store->control->read ('modUser_subscribe_module'); $mod->enabled = true; } // function setModule } // class eclMod_modUser_subscribe //!eof:library/modUser/subscribe/eclMod_modUser_subscribe.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; $render = $document->render; if (!$document->access (4)) return; if ($document->application->isDomain) return; $row = $mod->appendChild (); // personal data $row->appendChild ('modUser_tools_goPersonal') ->url (array (SYSTEM_PROFILES_URI, $document->user->name, '-personal')) ->popUpOpen (); $user = $store->user->open ($document->user->name); // Verify phone if (INTEGRATION_SMS_ENABLE) { // verify by SMS if ($user['phone'] == '') $row->appendChild ('userHome_phone_content') ->url (array (SYSTEM_PROFILES_URI, $document->user->name, '-phone')) ->popUpOpen (); else $row->appendChild ('userHome_phone_contentVerified') ->url (array (SYSTEM_PROFILES_URI, $document->user->name, '-phone')) ->popUpOpen (); } // verify by SMS // Verify mail if (INTEGRATION_SMTP_ENABLE) { // verify by SMTP if ($user['mail'] == '') $row->appendChild ('userHome_mail_content') ->url (array (SYSTEM_PROFILES_URI, $document->user->name, '-mail')) ->popUpOpen (); else $row->appendChild ('userHome_mail_contextVerified') ->url (array (SYSTEM_PROFILES_URI, $document->user->name, '-mail')) ->popUpOpen (); } // verify by SMTP // change password $row->appendChild ('modUser_tools_goPassword') ->url (array (SYSTEM_PROFILES_URI, $document->user->name, '-password')) ->popUpOpen (); $mod->data = array_replace ($render->block ('modules/system_menu'), $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; $row = $mod->appendChild (); $domain = $document->domain; $main = $system->child (SYSTEM_DEFAULT_DOMAIN_NAME); if ($main === false) $main = $domain; // Recover password only if mails can be sent if (INTEGRATION_SMTP_ENABLE) { // recover password $row->appendChild ('modUser_welcome_goPassword') ->url (array (SYSTEM_PROFILES_URI, '-recover-password')) ->popUpOpen (); } // recover password // subscribe if (SYSTEM_ENABLE_USER_SUBSCRIPTIONS and $domain->child ('-join')) $row->appendChild ('modUser_welcome_goSubscribe') ->url (array ($domain->name, '-join')) ->popUpOpen (); elseif (SYSTEM_ENABLE_USER_SUBSCRIPTIONS) $row->appendChild ('modUser_welcome_goSubscribe') ->url (array (SYSTEM_PROFILES_URI, '-join')) ->popUpOpen (); // info if ($domain->name != SYSTEM_PROFILES_URI and $domain->name != SYSTEM_ADMIN_URI and $store->domain->getStatus ($domain->name) >= 2) { // show info if ($id = $store->domainContent->findMarker ($domain->domainId, 6)) { // info page exists $pathway = $store->domainContent->pathway ($domain->domainId, $id); $row->appendChild ('modUser_welcome_goInfo') ->url ($pathway) ->active ($document->pathway == $pathway); } // info page exists else $row->appendChild ('modUser_welcome_goInfo') ->url (array ($domain->name, '-info')) ->active ($document->pathway == array ($domain->name, '-info')); } // show info // Organization identification if (SYSTEM_HOSTING_MODE and strlen (SYSTEM_PROJECT_URL) and $domain->name != SYSTEM_DEFAULT_DOMAIN_NAME) $row->appendChild ('modUser_welcome_goOrganization') ->set ('url', SYSTEM_PROJECT_URL); // Go to profiles page /* * $row->appendChild ('modUser_welcome_goProfiles') * ->url (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) $row->appendChild ('modUser_welcome_goHome') ->url (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)) * $row->appendChild ('modUser_welcome_goReport') * ->url (true, true, '_alert-report') * ->active ($document->actions ('alert', 'report')); */ // Service terms if ($id = $store->domainContent->findMarker ($domain->domainId, 5)) { // this service terms $pathway = $store->domainContent->pathway ($domain->domainId, $id); $row->appendChild ('modUser_welcome_goServiceTerms') ->url ($pathway) ->active ($document->pathway == $pathway); } // this service terms elseif ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME and $id = $store->domainContent->findMarker ($main->domainId, 5)) { // global service terms $row->appendChild ('modUser_welcome_goServiceTerms') ->url ($store->domainContent->pathway ($main->domainId, $id)); } // global service terms // Privacy policy if ($id = $store->domainContent->findMarker ($domain->domainId, 7)) { // this privacy policy $pathway = $store->domainContent->pathway ($domain->domainId, $id); $row->appendChild ('modUser_welcome_goPrivacyPolicy') ->url ($pathway) ->active ($document->pathway == $pathway); } // this privacy policy elseif ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME and $id = $store->domainContent->findMarker ($main->domainId, 7)) { // global privacy policy $row->appendChild ('modUser_welcome_goPrivacyPolicy') ->url ($store->domainContent->pathway ($main->domainId, $id)); } // global privacy policy // About Ecolabore Engine $row->appendChild ('modUser_welcome_goEcolabore', array ('url' => SYSTEM_GENERATOR_URL)); $mod->data = array_replace ($document->render->block ('modules/system_menu'), $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/modVideo/eclMod_modVideo.php; class eclMod_modVideo { // class eclMod_modVideo 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; // Procure a aplicação $me = $document->application->findModuleTarget ($document, $arguments); if (!$me) return; $number = $arguments[1]; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['video_' . $number])) { // module exists $video = $me->data['extras']['video_' . $number]; $mod->data = $video; $mod->enabled = true; } // module exists if ($document->access (4, $me->groups)) { // personalite $mod->enabled = true; if (isset ($video)) { // modify $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'video_' . $number); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modVideo_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_video'; if (isset ($video)) $local['extras'] = array ('video_' . $number => $video); $local['pathway'] = $me->pathway; $mod->appendChild ($local); } // function setModule } // class eclMod_modVideo //!eof:library/modVideo/eclMod_modVideo.php; //!file:library/personalite/eclApp_personalite.php; class eclApp_personalite { // class eclApp_personalite static function is_child ($me, $name) { // function is_child if ($name == '-personalite') 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 ('-personalite'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personalite_content'); $me->access = 4; $me->getMap (); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_sectionFolder_list ($document); } // function dispatch } // class eclApp_personalite //!eof:library/personalite/eclApp_personalite.php; //!file:library/personalite/eclFilter_personalite_flags.php; class eclFilter_personalite_flags { // class eclFilter_personalite_flags static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'textarea'; if (isset ($formulary->data['flags'])) $local['value'] = $formulary->htmlSpecialChars (eclIo_file::array2string ($formulary->data['flags'])); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName][0])) $formulary->data['flags'] = eclIo_file::string2array ($formulary->received[$fieldName]); else $formulary->data['flags'] = array (); } // function save } // class eclFilter_personalite_flags //!eof:library/personalite/eclFilter_personalite_flags.php; //!file:library/personalite/eclFilter_personalite_vars.php; class eclFilter_personalite_vars { // class eclFilter_personalite_vars static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $local['type'] = $control['flags']['type']; else $local['type'] = 'textarea'; $buffer = CRLF; if (isset ($formulary->data['local'])) { // format output foreach ($formulary->data['local'] as $key => $value) { // each variable $buffer .= '$' . $key . ':' . $value . ';' . CRLF; } // each variable } // format output $local['value'] = $formulary->htmlSpecialChars ($buffer); $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName][0])) $buffer = $formulary->received[$fieldName]; else return $formulary->data['local'] = array (); $local = array (); foreach (explode (";", $buffer) as $line) { // each line $value = ''; $parts = explode (':', $line, 2); switch (count ($parts)) { // switch parts case 2: $value = trim ($parts[1]); case 1: $key = substr (trim ($parts[0]), 1); if (!is_string ($key) or !strlen ($key)) continue2; $local[$key] = $value; } // switch parts } // each line $formulary->data['local'] = $local; } // function save } // class eclFilter_personalite_vars //!eof:library/personalite/eclFilter_personalite_vars.php; //!file:library/personaliteApearance/color/eclApp_personaliteApearance_color.php; class eclApp_personaliteApearance_color { // class eclApp_personaliteApearance_color static function is_child ($me, $name) { // function is_child if ($name == 'color') 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 ('color'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteApearance_color_content'); $me->access = 0; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_personaliteApearance_color //!eof:library/personaliteApearance/color/eclApp_personaliteApearance_color.php; //!file:library/personaliteApearance/eclApp_personaliteApearance.php; class eclApp_personaliteApearance { // class eclApp_personaliteApearance static function is_child ($me, $name) { // function is_child if ($name == 'apearance') 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 ('apearance'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteApearance_content'); if (!$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, 'templates/default')) { // create user template $data = $store->control->read ('templates/default'); $data['mode'] = MODE_TEMPLATE; $data['name'] = 'templates/default'; $store->domainExtras->insert ($me->domainId, $data); } // create user template if (!$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, 'themes/user')) { // create user theme $data['mode'] = MODE_TEMPLATE; $data['name'] = 'themes/user'; $store->domainExtras->insert ($me->domainId, $data); } // create user theme $me->map = array ('personaliteApearance_color', 'personaliteApearance_font'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $template = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, 'templates/user'); $user = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, 'themes/user'); $preset = $store->control->read ('domainStyles_preset'); $palette = $document->render->block ('palettes/default'); if (isset ($palette['local'])) $preset['local'] = array_replace ($preset['local'], $palette['local']); $theme = $document->render->block ('themes/default'); if (isset ($theme['local'])) $preset['local'] = array_replace ($preset['local'], $theme['local']); $data['local'] = $user['local']; $data['defaults'] = $preset['local']; // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations $user['local'] = array (); $template['updated'] = TIME; return $document->dataReplace ('layouts/dialog_close'); } // restore default configurations $formulary = $document->createFormulary ('personaliteApearance_scheme_edit', $data); if ($formulary->save ()) { // save $user['local'] = $formulary->data['local']; $template['updated'] = TIME; $document->dataReplace ('layouts/dialog_close'); return; } // save $document->mod->formulary = $formulary; $document->mod->fontfaces = new eclMod_personaliteApearance_fontfaces ($document); } // function dispatch } // class eclApp_personaliteApearance //!eof:library/personaliteApearance/eclApp_personaliteApearance.php; //!file:library/personaliteApearance/eclFilter_personaliteApearance_color.php; class eclFilter_personaliteApearance_color { // class eclFilter_personaliteApearance_color static function create ($fieldName, $control, $formulary) { // function create $local['url'] = $formulary->document->url (array ($formulary->document->domain->name, '-personalite', 'apearance', 'color')); // name $local['name'] = $fieldName; // type $local['type'] = 'color_testable'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_msg_filterColorHelp'; // target if (isset ($control['flags']['target'])) $local['value'] = $formulary->getField ($control['flags']['target']); // default if (isset ($control['flags']['default'])) { // default $default = $formulary->getField ($control['flags']['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']['property'])) $local['property'] = $control['flags']['property']; // class if (isset ($control['flags']['field_name'])) { // class $local['class'] = $control['flags']['field_name']; $local['target'] = str_replace ('-', '_', $control['flags']['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']['error'])) $formulary->setErrorMsg ($control, $fieldName, 'system_msg_filterColorError', $value); else $value = false; } // error } // received value else $value = false; // required if ($value === false and isset ($control['flags']['required'])) return $formulary->setRequiredMsg ($control, $fieldName); // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_personaliteApearance_color //!eof:library/personaliteApearance/eclFilter_personaliteApearance_color.php; //!file:library/personaliteApearance/eclFilter_personaliteApearance_font.php; /* * control_type = font * control_filter = font * control_field_name * control_target * font-family-enabled = 1 / 0 * font-weight-enabled, font-size-enabled, line-height-enabled * * This filter aways clears empty fields */ class eclFilter_personaliteApearance_font { // class eclFilter_personaliteApearance_font static function create ($fieldName, $control, $formulary) { // function create $local['url'] = $formulary->document->url (array ($formulary->document->domain->name, '-personalite', 'apearance', 'font')); // name $local['name'] = $fieldName; // Type $local['type'] = 'font_testable'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $local['help_msg'] = 'system_msg_filterFontHelp'; // target if (!isset ($control['flags']['target'])) return; $target = $control['flags']['target']; foreach (array ('font-name', 'font-weight', 'font-size', 'line-height') as $property) { // each property if (!isset ($control['flags'][$property . '-enable'])) { // disabled $local[$property . '-value'] = 'disabled'; continue; } // disabled $local[$property . '-enabled'] = 1; $local[$property . '-value'] = str_replace ('"', "'", $formulary->getField ('local/' . $target . '-' . $property)); // default $default = str_replace ('"', "'", $formulary->getField ('defaults/' . $target . '-' . $property)); if (isset ($default[0]) and $default[0] == '$') $local[$property . '-from'] = str_replace ('-', '_', substr ($default, 1)); else $local[$property . '-default'] = $default; // Current if (isset ($local[$property . '-value'])) $local[$property . '-current'] = $local[$property . '-value']; elseif (isset ($local[$property . '-default'])) $local[$property . '-current'] = $local[$property . '-default']; } // each property if (isset ($local['font-name-value'])) { // font family $font = $formulary->document->render->block ('fonts/' . $local['font-name-value']); if (isset ($font['local']['font-stack'])) $local['font-family-value'] = $font['local']['font-stack']; } // font family // class if (isset ($control['flags']['field_name'])) { // class $local['class'] = $control['flags']['field_name']; $local['target'] = str_replace ('-', '_', $control['flags']['field_name']); } // class $formulary->appendChild ($control, $local); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($control['flags']['target'])) return; $received = $formulary->received; $target = $control['flags']['target']; foreach (array ('font-name', 'font-weight', 'font-size', 'line-height') as $property) { // each property if (!isset ($control['flags'][$property . '-enable'])) continue; $name = $fieldName . '_' . str_replace ('-', '_', $property); if (isset ($received[$name][0])) $formulary->setField ('local/' . $target . '-' . $property, $received[$name]); else $formulary->setField ('local/' . $target . '-' . $property, false); } // each property } // function save } // class eclFilter_personaliteApearance_font //!eof:library/personaliteApearance/eclFilter_personaliteApearance_font.php; //!file:library/personaliteApearance/eclFilter_personaliteApearance_select.php; /* * control_type = select_testable * control_filter = selectTestable * control_field_name * control_target * control_default * control_help_msg * * This filter aways clears empty fields */ class eclFilter_personaliteApearance_select { // class eclFilter_personaliteApearance_select static function create ($fieldName, $control, $formulary) { // function create global $store; $local['url'] = $formulary->document->url (array ($formulary->document->domain->name, '-dialog', 'color')); // name $local['name'] = $fieldName; // type $local['type'] = 'select_testable'; // target if (isset ($control['flags']['target'])) $value = $formulary->getField ($control['flags']['target']); else $value = false; // default if (isset ($control['flags']['default'])) $default = $formulary->getField ($control['flags']['default']); else $default = false; if (is_string ($default)) { // set default if ($default[0] == '$') { // default from target $local['from'] = str_replace ('-', '_', substr ($default, 1)); $default = false; } // default from target else $local['default'] = $default; } // set default if ($value === false or $value === '') $value = $default; if ($value === false) $value = ''; // property if (isset ($control['flags']['property'])) $local['property'] = $control['flags']['property']; // class if (isset ($control['flags']['field_name'])) { // class $local['class'] = $control['flags']['field_name']; $local['target'] = str_replace ('-', '_', $control['flags']['field_name']); } // class $select = $formulary->appendChild ($control, $local); if (!isset ($control['children'])) return; foreach ($control['children'] as $childName) { // each child $child = $store->control->read ($childName); if (!$child) continue; $currentValue = $child['flags']['value']; if ($currentValue === $value) $active = 'true'; else $active = ''; $select->appendChild ($child, array ( 'value' => $currentValue, 'active' => $active )); } // each child } // function create static function save ($fieldName, $control, $formulary) { // function save $default = false; if (isset ($control['flags']['default'])) $default = $formulary->getField ($control['flags']['default']); if (is_string ($default) and $default[0] == '$') $default = false; if (isset ($formulary->received[$fieldName]) and strlen ($formulary->received[$fieldName])) { // received $value = $formulary->received[$fieldName]; if (!preg_match ('/^[a-zA-Z0-9\ #(),.-]+$/', $value)) $value = false; } // received value else $value = false; if ($value === $default) $value = false; // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $value); } // function save } // class eclFilter_personaliteApearance_select //!eof:library/personaliteApearance/eclFilter_personaliteApearance_select.php; //!file:library/personaliteApearance/eclMod_personaliteApearance_fontfaces.php; class eclMod_personaliteApearance_fontfaces { // class eclMod_personaliteApearance_fontfaces 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; $folder = 'fonts/'; $length = strlen ($folder); $render = $document->render; $buffer = ''; $userDetails = array (); foreach ($store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0) as $data) { // each user detail if (substr ($data['name'], 0, $length) != $folder) continue; $userDetails[substr ($data['name'], $length)] = $data['id']; } // each user detail foreach ($store->control->scandir ('t', 'fonts') as $name) { // each detail if (isset ($userDetails[$name])) { // user detail $data = $store->domainExtras->openById ($me->domainId, $userDetails[$name]); unset ($userDetails[$name]); } // user detail else $data = $store->control->read ($folder . $name); if (!$data or !isset ($data['text']['caption'])) continue; if (isset ($data['local']['font-face'])) $buffer .= $data['local']['font-face'] . CRLF; } // each detail foreach ($userDetails as $name => $id) { // each user detail $data = $store->domainExtras->openById ($me->domainId, $id); if (isset ($data['local']['font-face'])) $buffer .= $data['local']['font-face'] . CRLF; } // each user detail if (strlen ($buffer)) $render->cuts['style'] = $buffer; } // function setModule } // class eclMod_personaliteApearance_fontfaces //!eof:library/personaliteApearance/eclMod_personaliteApearance_fontfaces.php; //!file:library/personaliteApearance/font/eclApp_personaliteApearance_font.php; class eclApp_personaliteApearance_font { // class eclApp_personaliteApearance_font static function is_child ($me, $name) { // function is_child if ($name == 'font') 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 ('font'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteApearance_font_layout'); $me->access = 0; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_personaliteApearance_font_list ($document); } // function dispatch } // class eclApp_personaliteApearance_font //!eof:library/personaliteApearance/font/eclApp_personaliteApearance_font.php; //!file:library/personaliteApearance/font/eclMod_personaliteApearance_font_list.php; class eclMod_personaliteApearance_font_list { // class eclMod_personaliteApearance_font_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; $folder = 'fonts/'; $length = strlen ($folder); $render = $document->render; $userDetails = array (); foreach ($store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0) as $data) { // each user detail if (substr ($data['name'], 0, $length) != $folder) continue; $userDetails[substr ($data['name'], $length)] = $data['id']; } // each user detail foreach ($store->control->scandir ('t', 'fonts') as $name) { // each detail if (isset ($userDetails[$name])) { // user detail $data = $store->domainExtras->openById ($me->domainId, $userDetails[$name]); unset ($userDetails[$name]); } // user detail else $data = $store->control->read ($folder . $name); if (!$data or !isset ($data['text']['caption'])) continue; $data['name'] = $name; $mod->appendChild ($data); } // each detail foreach ($userDetails as $name => $id) { // each user detail $data = $store->domainExtras->openById ($me->domainId, $id); $data['name'] = $name; $mod->appendChild ($data); } // each user detail $mod->sort ('name'); $mod->enabled = true; } // function setModule } // class eclMod_personaliteApearance_font_list //!eof:library/personaliteApearance/font/eclMod_personaliteApearance_font_list.php; //!file:library/personaliteDetails/configure/eclApp_personaliteDetails_configure.php; class eclApp_personaliteDetails_configure { // class eclApp_personaliteDetails_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 ('personaliteDetails_configure_edit'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, 'details/' . $me->name); if ($saved) $data = $saved; elseif ($store->control->read ('details/' . $me->name)) $data = $store->control->read ('details/' . $me->name); else $data = array (); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations if ($saved) $store->domainExtras->delete ($me->domainId, $saved['id']); $data = $store->control->read ('details/' . $me->name); $document->dataReplace ('layouts/dialog_close'); if ($data) { // update to default $caption = $document->selectLanguage ($data['text']['caption']); $identifier = $me->name; } // update to system default else { // remove $identifier = ''; $caption[1] = ''; } // remove $pathway = $me->parent->pathway; $pathway[] = $me->name; $url = $document->url ($pathway); $document->data['script'] = 'window.opener.listManager.update ("' . $me->name . '", "' . $identifier . '", "' . $caption[1] . '", "' . $url . '");'; return; } // restore default configurations $data['identifier'] = $me->name; $formulary = $document->createFormulary ('personaliteDetails_configure_edit', $data); if ($formulary->save ()) { // save formulary $data = $formulary->data; if (!isset ($data['identifier']) or !preg_match ('/^[a-z][a-z0-9_]*$/', $data['identifier'])) $data['identifier'] = $me->name; if ($data['identifier'] == $me->name and $saved) $saved = $formulary->data; else { // create saved modules if ($data['identifier'] != $me->name and $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $data['identifier'])) { // overwrite existing detail $saved['text'] = $data['text']; $saved['local'] = $data['local']; $saved['html'] = $data['html']; } // overwrite existing detail else { // create new detail $data['mode'] = MODE_TEMPLATE; $data['name'] = 'details/' . $data['identifier']; $store->domainExtras->insert ($me->domainId, $data); } // create new detail } // create saved modules $document->dataReplace ('layouts/dialog_close'); $caption = $document->selectLanguage ($data['text']['caption']); $pathway = $me->parent->pathway; $pathway[] = $data['identifier']; $url = $document->url ($pathway); $document->data['script'] = 'window.opener.listManager.update ("' . $me->name . '", "' . $data['identifier'] . '", "' . $caption[1] . '", "' . $url . '");'; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_personaliteDetails_configure //!eof:library/personaliteDetails/configure/eclApp_personaliteDetails_configure.php; //!file:library/personaliteDetails/eclApp_personaliteDetails.php; class eclApp_personaliteDetails { // class eclApp_personaliteDetails 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 ('personaliteDetails_main'); $me->map = array ('personaliteDetails_configure'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_personaliteDetails_list ($document); } // function dispatch } // class eclApp_personaliteDetails //!eof:library/personaliteDetails/eclApp_personaliteDetails.php; //!file:library/personaliteDetails/eclFilter_personaliteDetails.php; /* * Valid control flags * control_type = manager * control_filter = personaliteDetails * control_field_name * control_target = local/details * control_help * control_help_msg */ class eclFilter_personaliteDetails { // class eclFilter_personaliteDetails static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $me = $document->application; $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'manager'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $item->data['help_msg'] = 'system_msg_filterDetailsHelp'; // references $pathway = array ($document->domain->name, '-personalite', 'details'); $item->data['url_add'] = $document->url ($pathway); $item->data['move-enable'] = 1; $item->data['remove-enable'] = 1; $item->data['edit-enable'] = 1; $userDetails = array (); foreach ($store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0) as $data) { // each user detail if (substr ($data['name'], 0, 8) != 'details/') continue; $userDetails[substr ($data['name'], 8)] = $data; } // each user detail $value = trim (strval ($formulary->getField ('local/details'))); $buffer = ''; foreach (explode (CRLF, $value) as $name) { // each line $name = trim ($name); if (!strlen ($name)) continue; if (isset ($userDetails[$name])) $data = $userDetails[$name]; else $data = $store->control->read ('details/' . $name); if (isset ($data['text']['caption'])) $caption = $data['text']['caption']; else $caption = $document->textMerge ($name); $p = $pathway; $p[] = $name; $buffer .= $name . CRLF; $item->appendChild (false, array ('value' => $name, 'caption' => $caption)) ->url ($p); } // each line $item->data['serialized'] = $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; $formulary->setField ('local/details', $buffer); } // function save } // class eclFilter_personaliteDetails //!eof:library/personaliteDetails/eclFilter_personaliteDetails.php; //!file:library/personaliteDetails/eclMod_personaliteDetails_list.php; class eclMod_personaliteDetails_list { // class eclMod_personaliteDetails_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; $render = $document->render; $userDetails = array (); foreach ($store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0) as $data) { // each user detail if (substr ($data['name'], 0, 8) != 'details/') continue; $userDetails[substr ($data['name'], 8)] = $data['id']; } // each user detail foreach ($store->control->scandir ('t', 'details') as $name) { // each detail if (isset ($userDetails[$name])) { // user detail $data = $store->domainExtras->openById ($me->domainId, $userDetails[$name]); unset ($userDetails[$name]); } // user detail else $data = $store->control->read ('details/' . $name); if (!$data or !isset ($data['text']['caption'])) continue; $data['name'] = $name; $mod->appendChild ($data) ->appendFolder ($name); } // each detail foreach ($userDetails as $name => $id) { // each user detail $data = $store->domainExtras->openById ($me->domainId, $id); $data['name'] = $name; $mod->appendChild ($data) ->appendFolder ($name); } // each user detail $mod->enabled = true; } // function setModule } // class eclMod_personaliteDetails_list //!eof:library/personaliteDetails/eclMod_personaliteDetails_list.php; //!file:library/personaliteExport/eclApp_personaliteExport.php; class eclApp_personaliteExport { // class eclApp_personaliteExport static function is_child ($me, $name) { // function is_child if ($name == 'export') 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 ('export'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteExport_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io, $store; $data['ecolabore-template'] = '1.0'; $data['created'] = date ('Y-m-d'); $data['name'] = 'ecolabore-template+' . date ('Y-m-d') . '.zip'; $formulary = $document->createFormulary ('personaliteExport_edit', $data, 'export'); if ($formulary->command ('save') and $formulary->save ()) { // save and export return; } // save and export $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_personaliteExport //!eof:library/personaliteExport/eclApp_personaliteExport.php; //!file:library/personaliteExport/eclFilter_personaliteExport_components.php; class eclFilter_personaliteExport_components { // class eclFilter_personaliteExport_components static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application; $children = $store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0); foreach ($children as $data) { // each child $local = array ( 'name' => $fieldName . '_' . $data['id'], 'type' => 'checkbox', 'caption' => $document->textMerge ($data['name'] . ' ', $data['text']['caption']) ); $formulary->appendChild ($local); } // each child $formulary->appendChild ('system_form_separator'); $sections = $store->domainContent->mode ($me->domainId, MODE_SECTION); array_unshift ($sections, $store->domainContent->open ($me->domainId, '-index')); foreach ($sections as $data) { // each section $local = array ( 'name' => $fieldName . '_' . $data['id'], 'type' => 'checkbox', 'caption' => $document->textMerge ($data['name'] . ' ', $data['text']['caption']) ); $formulary->appendChild ($local); } // each section } // function create static function save ($fieldName, $control, $formulary) { // function save global $io, $store; $document = $formulary->document; $me = $formulary->document->application; $received = $formulary->received; $zip = new ZipArchive (); $filename = PATH_DOMAINS . $document->domain->name . '/-export.zip'; if ($zip->open ($filename, ZIPARCHIVE::CREATE) !== TRUE) return; $children = $store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0); foreach ($children as $data) { // each child template if (!isset ($received[$fieldName . '_' . $data['id']])) continue; $component = array (); $component['name'] = $data['name']; if ($data['text']) $component['text'] = $data['text']; if ($data['local']) $component['local'] = $data['local']; if (isset ($data['html'][0])) $component['html'] = $data['html']; if (count ($component) == 1) continue; $name = '-' . str_replace ('/', '+', $data['name']) . '.json'; $content = eclIo_webservice::array2json ($component); $zip->addFromString ($name, $content); } // each child template $sections = $store->domainContent->mode ($me->domainId, MODE_SECTION); array_unshift ($sections, $store->domainContent->open ($me->domainId, '-index')); foreach ($sections as $data) { // each child section if (!isset ($received[$fieldName . '_' . $data['id']])) continue; $component = array (); foreach (array ('name', 'marker', 'access', 'text', 'local', 'flags', 'extras', 'keywords') as $field) { // copy each field if (isset ($data[$field]) and $data[$field]) $component[$field] = $data[$field]; } // copy each field if ($data['parent_id'] == 1) $component['parent_id'] = 1; elseif ($data['parent_id']) { // find parent $parent = $store->domainContent->openById ($me->domainId, $data['parent_id']); if (!$parent) continue; $data['parent_name'] = $parent['name']; } // find parent $name = $data['name'] . '.json'; $content = eclIo_webservice::array2json ($component); $zip->addFromString ($name, $content); foreach ($store->domainFile->scanPrefixedFiles ($me->domainId, $data['name']) as $name) { // each file $zip->addFromString ($name, file_get_contents (PATH_DOMAINS . $document->domain->name . '/' . $name)); } // each file } // each child section $zip->close (); $headers = array ( 'Content-Disposition' => 'attachment', 'Cache-Control' => 'no-cache', 'Filename' => $formulary->data['name'] ); $io->sendFile->send ($filename, $headers); } // function save } // class eclFilter_personaliteExport_components //!eof:library/personaliteExport/eclFilter_personaliteExport_components.php; //!file:library/personaliteExtras/eclApp_personaliteExtras.php; class eclApp_personaliteExtras { // class eclApp_personaliteExtras static function is_child ($me, $name) { // function is_child if ($name == 'extras') return true; if ($name == 'post') 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 ('extras'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteExtras_edit'); $me->access = 4; $me->isDomain = true; $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch if (!self::find_target ($document, $me, $target, $prefix, $isBigFile)) return self::not_configurable ($document); // Save uploaded big files if ($isBigFile and $document->actions ('upload', 'save')) return self::save_uploaded_big_file ($document, $me, $target, $prefix); // Upload big files formulary if ($isBigFile and !isset ($me->data['extras'][$target]['files'])) return self::upload_big_file ($document, $me, $target, $prefix); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') return self::restore_default_configurations ($document, $me, $target); // get formulary data $data = self::get_formulary_data ($document, $me, $target, $prefix); // Create formulary $formulary = $document->createFormulary ($document->application->data, $data); $formulary->application = $me; $formulary->flags['target'] = $target; // Save formulary if ($formulary->save ()) { // save formulary $me->data['extras'][$target] = $formulary->data; $document->dataReplace ('layouts/dialog_close'); return; } // save formulary // Show formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('layouts/dialog_tabs'); switch ($prefix) { // switch prefix case 'audio': case 'banner': case 'box': case 'file': case 'html': case 'img': case 'video': $document->data['local']['remove_object'] = 1; } // switch prefix } // function dispatch static function find_target ($document, &$me, &$target, &$prefix, &$isBigFile) { // function find_target global $store; $document->application->pathway = $document->pathway; $pathway = array_slice ($document->pathway, 3); $target = array_shift ($pathway); $me = $document->domain; if (!$pathway) $me = $me->child (''); else { // find child foreach ($pathway as $folder) { // each folder $me = $me->child ($folder); if ($me === false) return false; } // each folder } // find child if (!$document->access (4, $me->groups)) return false; $parts = explode ('_', $target); $prefix = $parts[0]; if ($document->application->name == 'post') $target = 'post_' . $target; $isBigFile = false; switch ($prefix) { // switch prefix case 'audio': case 'file': case 'video': $isBigFile = true; case 'banner': case 'box': case 'card': case 'dinamic': case 'formulary': case 'html': case 'img': case 'list': case 'pages': case 'sort': $document->application->data = $store->control->read ('mod' . ucfirst ($prefix) . '_edit'); return true; case 'post': $document->application->data = $store->control->read ('modContent_post'); return true; default: return false; } // switch prefix } // function find_target static function not_configurable ($document) { // function not_configurable $formulary = $document->createFormulary ('personaliteModules_contentNotConfigurable', array (), 'not_configurable'); if ($formulary->command ('cancel')) return $document->dataReplace ('layouts/dialog_cancel'); $document->mod->formulary = $formulary; $document->dataReplace ('layouts/dialog'); } // function not_configurable static function upload_big_file ($document, $me, $target, $prefix) { // function upload_big_file global $store; $formulary = $document->createFormulary ('personaliteExtras_upload_' . $prefix, array (), 'upload'); $formulary->action = '_upload-save'; $document->mod->formulary = $formulary; $document->application->data = $store->control->read ('personaliteExtras_upload_' . $prefix); $document->dataReplace ('personaliteExtras_upload_' . $prefix); } // function upload_big_file static function save_uploaded_big_file ($document, $me, $target, $prefix) { // function save_uploaded_big_file global $io; ini_set ('upload_max_filesize', '1024M'); ini_set ('post_max_size', '1024M'); $document->buffer = 'ok'; $uploaded = reset ($io->request->uploaded); if (!$uploaded) { // fail $document->buffer = 'fail'; return; } // fail $uploaded = $uploaded[0]; if ($uploaded['error']) return $document->buffer = 'fail'; $ext = strtolower (end (explode ('.', $uploaded['name']))); $filename = $me->data['name'] . CHR_FNS . $target . '.' . $ext; $path = PATH_DOMAINS . $document->domain->name . '/' . $filename; move_uploaded_file ($uploaded['tmp_name'], $path); $me->data['extras'][$target] = array ( 'files' => array ($prefix => $filename), 'size' => $uploaded['size'], 'play' => 0, 'downloads' => 0, 'type' => $uploaded['type'], 'filename' => $uploaded['name'] ); } // function save_uploaded_big_file static function restore_default_configurations ($document, $me, $target) { // function restore_default_configurations if (isset ($me->data['extras'][$target]['files'])) { // remove files foreach ($me->data['extras'][$target]['files'] as $name) { // each file $file = FOLDER_DOMAINS . $document->domain->name . '/' . $name; if (is_file ($file)) unlink ($file); } // each file } // remove files unset ($me->data['extras'][$target]); $document->dataReplace ('layouts/dialog_close'); } // function restore_default_configurations static function get_formulary_data ($document, $me, $target, $prefix) { // function get_formulary_data if (isset ($me->data['extras'][$target])) return $me->data['extras'][$target]; if ($document->application->name == 'post') { // try post if ($data = $document->render->block ('modules/' . $prefix . '_post')) return $data; return $document->render->block ('modules/' . $prefix); } // try post if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; if ($data = $document->render->block ('modules/' . $prefix . '_' . $preset)) return $data; if ($data = $document->render->block ('modules/' . $prefix . '_blog')) return $data; return $document->render->block ('modules/' . $prefix); } // function get_formulary_data } // class eclApp_personaliteExtras //!eof:library/personaliteExtras/eclApp_personaliteExtras.php; //!file:library/personaliteExtras/eclFilter_personaliteExtras_upload.php; class eclFilter_personaliteExtras_upload { // class eclFilter_personaliteExtras_upload static function create ($fieldName, $control, $formulary) { // function create $control['name'] = $fieldName; // type $control['type'] = 'file_big'; $control['url'] = $formulary->document->url ($formulary->document->pathway, true, '_upload-save', $formulary->protocol); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_personaliteExtras_upload //!eof:library/personaliteExtras/eclFilter_personaliteExtras_upload.php; //!file:library/personaliteFields/address/eclFilter_personaliteFields_address.php; class eclFilter_personaliteFields_address { // class eclFilter_personaliteFields_address static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $control['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'address'; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postal_code', 'country'); if (!isset ($formulary->data['local']['address']) and isset ($control['local']['share_user_data']) and isset ($formulary->data['share_user_data'])) { // use user address foreach ($list as $item) { // each item if (!isset ($document->user->data['local']['address'][$item])) continue; $value = $document->user->data['local']['address'][$item]; if ($document->charset != 'UTF-8') $value = mb_convert_encoding ($value, $formulary->document->charset, 'UTF-8'); $control['address_' . $item] = $formulary->htmlSpecialChars ($value); } // each item } // use user address else { // from formulary foreach ($list as $item) { // each item $value = $formulary->getField ('local/address/' . $item); if ($value === false) continue; if ($document->charset != 'UTF-8') $value = mb_convert_encoding ($value, $formulary->document->charset, 'UTF-8'); $control['address_' . $item] = $formulary->htmlSpecialChars ($value); } // each item } // from formulary $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save unset ($formulary->data['local']['address']); $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postal_code', 'country'); foreach ($list as $item) { // each item if (!isset ($formulary->received[$fieldName . '_' . $item])) $formulary->setField ('local/address/' . $item, false); continue; $value = $formulary->received[$fieldName . '_' . $item]; if ($formulary->document->charset != 'UTF-8') $value = mb_convert_encoding ($value, 'UTF-8', $formulary->document->charset); $formulary->setField ('local/address/' . $item, $value); } // each item } // function save static function view ($fieldName, $control, $formulary) { // function view $document = $formulary->document; $enabled = false; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postal_code', 'country'); foreach ($list as $field) { // verify each field if (isset ($formulary->data['local']['address'][$field][0])) { // found $enabled = true; break; } // found } // verify each field if (!$enabled) return; // type if (isset ($control['flags']['view_type'])) $control['type'] = $control['flags']['view_type']; else $control['type'] = 'view'; if (!isset ($formulary->data['local']['address'])) return; $address = $formulary->data['local']['address']; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postal_code', 'country'); $buffer = ''; $lines = array (); $line = array (); if (isset ($address['street'][0])) $line[] = $address['street']; if (isset ($address['number'][0])) $line[] = $address['number']; if (isset ($address['complement'][0])) $line[] = $address['complement']; if ($line) $lines[] = implode (', ', $line); if (isset ($address['district'][0])) $lines[] = $address['district']; $line = array (); if (isset ($address['city'][0])) $line[] = $address['city']; if (isset ($address['state'][0])) $line[] = $address['state']; if ($line) $lines[] = implode (' - ', $line); if (isset ($address['postal_code'][0])) $lines[] = $address['postal_code']; if (isset ($address['country'][0])) $lines[] = $address['country']; $buffer = implode ('
      ', $lines); $control['content'] = $document->textMerge ($buffer); $formulary->appendChild ($control); } // function view static function scope ($render) { // function scope $data['data'] = $render->getVar ('address'); return $data; } // function scope static function target ($document, $value, $arguments) { // function target if (count ($arguments) < 2) return; list ($id, $field) = $arguments; $me = $document->domain->findChild (intval ($id)); if (!$me or !$document->access (4, $me->groups)) return; if ($document->charset != 'UTF-8') $value = mb_convert_encoding ($value, 'UTF-8', $document->charset); $me->data['local']['address'][$field] = $value; } // function target static function column ($document, $control, $data) { // function column if (!isset ($formulary->data['local']['address'])) return array ('caption' => $document->textMerge ('-')); $enabled = false; $list = array ('street', 'number', 'complement', 'district', 'city', 'state', 'postal_code', 'country'); foreach ($list as $field) { // verify each field if (isset ($formulary->data['local']['address'][$field][0])) { // found $enabled = true; break; } // found } // verify each field if (!$enabled) return array ('caption' => $document->textMerge ('-')); $address = $data['local']['address']; $buffer = ''; $lines = array (); $line = array (); if (isset ($address['street'][0])) $line[] = $address['street']; if (isset ($address['number'][0])) $line[] = $address['number']; if (isset ($address['complement'][0])) $line[] = $address['complement']; if ($line) $lines[] = implode (', ', $line); if (isset ($address['district'][0])) $lines[] = $address['district']; $line = array (); if (isset ($address['city'][0])) $line[] = $address['city']; if (isset ($address['state'][0])) $line[] = $address['state']; if ($line) $lines[] = implode (' - ', $line); if (isset ($address['postal_code'][0])) $lines[] = $address['postal_code']; if (isset ($address['country'][0])) $lines[] = $address['country']; $buffer = implode ('
      ', $lines); return array ('caption' => $document->textMerge ($buffer)); } // function column } // class eclFilter_personaliteFields_address //!eof:library/personaliteFields/address/eclFilter_personaliteFields_address.php; //!file:library/personaliteFields/checkbox/eclFilter_personaliteFields_checkbox.php; class eclFilter_personaliteFields_checkbox { // class eclFilter_personaliteFields_checkbox static function create ($fieldName, $control, $formulary) { // function create $name = $control['flags']['field_name']; $local = $control; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'checkbox'; $local['name'] = $fieldName; if (isset ($formulary->data['local'][$name]['value']) and $formulary->data['local'][$name]['value']) $local['value'] = 1; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $formulary) { // function save $name = $control['flags']['field_name']; if (isset ($formulary->received[$fieldName])) $formulary->data['local'][$name]['value'] = 1; else $formulary->data['local'][$name]['value'] = 0; } // function save static function view ($fieldName, $control, $formulary) { // function view global $store; $name = $control['flags']['field_name']; $control['type'] = 'view'; if (isset ($formulary->data['local'][$name]['value']) and $formulary->data['local'][$name]['value']) $caption = $store->control->read ('personaliteFields_checkbox_valueYes'); else $caption = $store->control->read ('personaliteFields_checkbox_valueNo'); $control['content'] = $caption['text']['caption']; $formulary->appendChild ($control); } // function view static function column ($data, $name, $field, $url, $document) { // function column if (isset ($data['local'][$name]['value']) and $data['local'][$name]['value']) $caption = $store->control->read ('personaliteFields_checkbox_valueYes'); else $caption = $store->control->read ('personaliteFields_checkbox_valueNo'); return $caption['text']; } // function column } // class eclFilter_personaliteFields_checkbox //!eof:library/personaliteFields/checkbox/eclFilter_personaliteFields_checkbox.php; //!file:library/personaliteFields/created/eclFilter_personaliteFields_created.php; class eclFilter_personaliteFields_created { // class eclFilter_personaliteFields_created static function create ($fieldName, $control, $formulary) { // function create } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function view ($fieldName, $control, $formulary) { // function view global $store; if (!isset ($formulary->data['created'])) return; $control['type'] = 'view'; $caption = $store->control->read ('personaliteFields_created_value'); $control['content'] = $caption['text']['caption']; $control['created'] = $formulary->data['created']; $formulary->appendChild ($control); } // function view static function column ($document, $data, $name, $field, $url) { // function column if ($document->printableLayout) return array ('caption' => $document->textMerge (date ('d-m-Y h:i', $data['created']))); return array ( 'caption' => $document->textMerge (date ('d-m-Y h:i', $data['created'])), 'url' => $url ); } // function column } // class eclFilter_personaliteFields_created //!eof:library/personaliteFields/created/eclFilter_personaliteFields_created.php; //!file:library/personaliteFields/descriptive/eclFilter_personaliteFields_descriptive.php; class eclFilter_personaliteFields_descriptive { // class eclFilter_personaliteFields_descriptive static function create ($fieldName, $control, $formulary) { // function create // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'descriptive'; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function view ($fieldName, $control, $formulary) { // function view if (!isset ($control['local']['display_when_editing']) or !$control['local']['display_when_editing']) return; $control['type'] = 'descriptive'; $formulary->appendChild ($control); } // function view static function column ($data, $name, $field, $url, $document) { // function column return array (); } // function column } // class eclFilter_personaliteFields_descriptive //!eof:library/personaliteFields/descriptive/eclFilter_personaliteFields_descriptive.php; //!file:library/personaliteFields/eclApp_personaliteFields.php; class eclApp_personaliteFields { // class eclApp_personaliteFields 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 ('personaliteFields_content'); $me->map = array ('personaliteFields_config'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $formulary = $document->createFormulary ('personaliteFields_add'); if ($formulary->command ('cancel')) return $document->dataReplace ('layouts/dialog_cancel'); $document->mod->formulary = $formulary; $document->mod->list = new eclMod_personaliteFields_list ($document); } // function dispatch } // class eclApp_personaliteFields //!eof:library/personaliteFields/eclApp_personaliteFields.php; //!file:library/personaliteFields/eclApp_personaliteFields_config.php; class eclApp_personaliteFields_config { // class eclApp_personaliteFields_config 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 ('dialogFields_' . $me->name . '_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $name = $document->application->name; $me = $document->application->parent->parent; list ($filter) = explode ('_', $name, 2); if (isset ($me->data['extras']['formulary'][$name])) $data = &$me->data['extras']['formulary'][$name]; elseif ($filter == $name) $data = $store->control->read ('personaliteFields_' . $filter . '_preset'); else $data = array (); $formulary = $document->createFormulary ('personaliteFields_' . $filter . '_edit', $data, 'field'); if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('layouts/dialog_cancel'); return; } // cancel if ($formulary->command ('save') and $formulary->save () and $formulary->data) { // save switch ($filter) { // switch filter case 'address': case 'created': case 'mail': case 'phone': $document->dataReplace ('layouts/dialog_close'); $url = $document->url ($document->pathway); $caption = $document->selectLanguage ($formulary->data['caption']); if (!isset ($me->data['extras']['formulary'])) $me->data['extras']['formulary'] = array (); $me->data['extras']['formulary'][$filter] = $formulary->data; $document->data['script'] = 'window.opener.listManager.update ("' . $name . '", "' . $name . '", "' . $caption[1] . '", "' . $url . '");'; return; } // switch filter if ($filter != $name) { // update $data = $formulary->data; $document->dataReplace ('layouts/dialog_close'); $url = $document->url ($document->pathway); $caption = $document->selectLanguage ($formulary->data['caption']); $document->data['script'] = 'window.opener.listManager.update ("' . $name . '", "' . $name . '", "' . $caption[1] . '", "' . $url . '");'; return; } // update if (!isset ($me->data['extras']['formulary'])) $me->data['extras']['formulary'] = array (); $index = 1; while (isset ($me->data['extras']['formulary'][$name . '_' . $index])) $index++; $me->data['extras']['formulary'][$name . '_' . $index] = $formulary->data; $document->dataReplace ('layouts/dialog_close'); $pathway = $document->application->parent->pathway; $pathway[] = $name . '_' . $index; $url = $document->url ($pathway); $caption = $document->selectLanguage ($formulary->data['caption']); $document->data['script'] = 'window.opener.listManager.append ("' . $name . '_' . $index . '", "' . $caption[1] . '", "' . $url . '");'; return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->dataReplace ('personaliteFields_' . $filter . '_content'); } // function dispatch } // class eclApp_personaliteFields_config //!eof:library/personaliteFields/eclApp_personaliteFields_config.php; //!file:library/personaliteFields/eclFilter_personaliteFields.php; class eclFilter_personaliteFields { // class eclFilter_personaliteFields static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $me = $document->application; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'manager'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $item->data['help_msg'] = 'system_msg_filterDetailsHelp'; // references $pathway = $me->pathway; $pathway[] = '-fields'; $item->data['url_add'] = $document->url ($pathway); $item->data['move-enable'] = 1; $item->data['remove-enable'] = 1; $item->data['edit-enable'] = 1; if (!isset ($formulary->data['extras']['formulary'])) return; $buffer = ''; foreach ($formulary->data['extras']['formulary'] as $name => $field) { // each field $pathway = $me->pathway; $pathway[] = '-fields'; $pathway[] = $name; $local = array ( 'value' => $name, 'caption' => $field['caption'], 'url' => $document->url ($pathway) ); $item->appendChild ($local); } // each field $item->data['serialized'] = $buffer; } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->data['extras']['formulary'])) $formulary->data['extras']['formulary'] = array (); $original = $formulary->data['extras']['formulary']; unset ($formulary->data['extras']['formulary']); $fields = array (); if (!isset ($formulary->received[$fieldName . '_serialized'])) return $formulary->setRequiredMsg ($fieldName, $control); $index = 0; $serialized = $formulary->received[$fieldName . '_serialized']; foreach (explode (LF, $serialized) as $name) { // each line $name = trim ($name); if (isset ($original[$name])) { // exists $fields[$name] = $original[$name]; $fields[$name]['index'] = $index; $index++; } // exists } // each line $formulary->data['extras']['formulary'] = $fields; } // function save } // class eclFilter_personaliteFields //!eof:library/personaliteFields/eclFilter_personaliteFields.php; //!file:library/personaliteFields/eclFilter_personaliteFields_end.php; class eclFilter_personaliteFields_end { // class eclFilter_personaliteFields_end static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; $local['type'] = 'end'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_personaliteFields_end //!eof:library/personaliteFields/eclFilter_personaliteFields_end.php; //!file:library/personaliteFields/eclFilter_personaliteFields_end_view.php; class eclFilter_personaliteFields_end_view { // class eclFilter_personaliteFields_end_view static function create ($fieldName, $control, $formulary) { // function create $local['name'] = $fieldName; $local['type'] = 'view_end'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_personaliteFields_end_view //!eof:library/personaliteFields/eclFilter_personaliteFields_end_view.php; //!file:library/personaliteFields/eclFilter_personaliteFields_selectType.php; class eclFilter_personaliteFields_selectType { // class eclFilter_personaliteFields_selectType static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application; $control['name'] = $fieldName; $control['type'] = 'select'; $item = $formulary->appendChild ('personaliteFields_editType', $control); if (!isset ($control['flags']['search_filter'])) return; $filter = $control['flags']['search_filter']; $value = $formulary->getField ('type'); $userDetails = array (); foreach ($store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0) as $data) { // each user detail if (substr ($data['name'], 0, 7) != 'fields/') continue; $userDetails[substr ($data['name'], 7)] = $data['id']; } // each user detail foreach ($store->control->scandir ('t', 'fields') as $name) { // each detail if (isset ($userDetails[$name])) { // user detail $data = $store->domainExtras->openById ($me->domainId, $userDetails[$name]); unset ($userDetails[$name]); } // user detail else $data = $store->control->read ('fields/' . $name); if (!$data or !isset ($data['text']['caption'])) continue; if (!isset ($data['local']['filters'])) continue; foreach (explode (LF, $data['local']['filters']) as $line) { // each line if ($filter != trim ($line)) continue; $data['value'] = $name; if ($name == $value) $data['active'] = 1; $item->appendChild ($data); break; } // each line } // each detail foreach ($userDetails as $name => $id) { // each user detail $data = $store->domainExtras->openById ($me->domainId, $id); $data['value'] = $name; if (!isset ($data['local']['filters'])) continue; foreach (explode (LF, $data['local']['filters']) as $line) { // each line if ($filter != trim ($line)) continue; $data['name'] = $name; if ($name == $value) $data['active'] = 1; $item->appendChild ($data); break; } // each line } // each user detail } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName])) $formulary->data['type'] = $formulary->received[$fieldName]; } // function save } // class eclFilter_personaliteFields_selectType //!eof:library/personaliteFields/eclFilter_personaliteFields_selectType.php; //!file:library/personaliteFields/eclFilter_personaliteFields_start.php; class eclFilter_personaliteFields_start { // class eclFilter_personaliteFields_start static function create ($fieldName, $control, $formulary) { // function create $local['type'] = 'start'; $local['url'] = $formulary->document->url (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, $formulary) { // function save 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 } // class eclFilter_personaliteFields_start //!eof:library/personaliteFields/eclFilter_personaliteFields_start.php; //!file:library/personaliteFields/eclFilter_personaliteFields_start_view.php; class eclFilter_personaliteFields_start_view { // class eclFilter_personaliteFields_start_view static function create ($fieldName, $control, $data, $formulary) { // function create $local['type'] = 'view_start'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $data, $formulary) { // function save } // function save } // class eclFilter_personaliteFields_start_view //!eof:library/personaliteFields/eclFilter_personaliteFields_start_view.php; //!file:library/personaliteFields/eclMod_personaliteFields_list.php; class eclMod_personaliteFields_list { // class eclMod_personaliteFields_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 ('modules/list'); $row = $mod->appendChild (); $list = array ( 'text', 'textarea', 'checkbox', 'select', 'radio', 'separator', 'descriptive', 'mail', 'address', 'created', 'status' ); foreach ($list as $type) { // each type $pathway = $me->pathway; $pathway[] = $type; $row->appendChild ('personaliteFields_' . $type . '_content') ->url ($pathway, true, '_add'); } // each type $mod->enabled = true; } // function setModule } // class eclMod_personaliteFields_list //!eof:library/personaliteFields/eclMod_personaliteFields_list.php; //!file:library/personaliteFields/mail/eclFilter_personaliteFields_mail.php; class eclFilter_personaliteFields_mail { // class eclFilter_personaliteFields_mail static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'text'; $control['name'] = $fieldName; if (isset ($formulary->data['local']['mail'])) $control['value'] = $formulary->htmlSpecialChars ($formulary->data['local']['mail']); elseif (isset ($control['local']['share_user_data']) and isset ($formulary->document->user->data['local']['mail']) and isset ($formulary->data['share_user_data'])) $control['value'] = $formulary->document->user->data['local']['mail']; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($formulary->received[$fieldName][0])) { // empty if (isset ($control['local']['required']) and $control['local']['required']) return $formulary->setRequiredMsg ($control, $fieldName); unset ($formulary->data['local']['mail']); return; } // empty $formulary->data['local']['mail'] = $formulary->received[$fieldName]; if (preg_match ('/^[a-zA-Z0-9._-]+[@][a-zA-Z0-9_-]+[.][a-zA-Z0-9._-]+[;].+/', $formulary->received[$fieldName])) $formulary->setErrorMsg ($control, $fieldName, 'personaliteFields_mail_alertMultipleNotAllowed'); if (!preg_match ('/^[a-zA-Z0-9._-]+[@][a-zA-Z0-9_-]+[.][a-zA-Z0-9._-]+$/', $formulary->received[$fieldName])) $formulary->setErrorMsg ($control, $fieldName, 'personaliteFields_mail_alertInvalidMail', $formulary->received[$fieldName]); } // function save static function view ($fieldName, $control, $formulary) { // function view $document = $formulary->document; if (!isset ($formulary->data['local']['mail'])) return; $control['type'] = 'view'; $mail = $formulary->data['local']['mail']; $mail = '' . $mail . ''; $content = ''; $control['content'] = $document->textMerge ($content); $formulary->appendChild ($control); } // function view static function column ($document, $data, $name, $field) { // function column if (!isset ($data['local']['mail'])) return array ('caption' => $document->textMerge ('-')); $mail = $data['local']['mail']; $mail = '' . $mail . ''; $content = ''; return array ('caption' => $document->textMerge ($content)); } // function column } // class eclFilter_personaliteFields_mail //!eof:library/personaliteFields/mail/eclFilter_personaliteFields_mail.php; //!file:library/personaliteFields/phone/eclFilter_personaliteFields_phone.php; class eclFilter_personaliteFields_phone { // class eclFilter_personaliteFields_phone static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $control['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'phone'; $list = array ('country', 'area', 'number'); if (!isset ($formulary->data['phone']) and isset ($control['local']['share_user_data']) and isset ($formulary->data['share_user_data'])) { // use user phone foreach ($list as $item) { // each item if (!isset ($document->user->data['local']['phone'][$item])) continue; $value = $document->user->data['local']['phone'][$item]; if ($document->charset != 'UTF-8') $value = mb_convert_encoding ($value, $formulary->document->charset, 'UTF-8'); $control['phone_' . $item] = $formulary->htmlSpecialChars ($value); } // each item } // use user phone else { // from formulary foreach ($list as $item) { // each item $value = $formulary->getField ('local/phone/' . $item); if ($value === false) continue; $control['phone_' . $item] = $value; } // each item } // from formulary $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save unset ($formulary->data['local']['phone']); if (isset ($formulary->received[$fieldName . '_country'][0])) { // filter received country $value = $formulary->received[$fieldName . '_country']; if (!preg_match ('/^[+]?[0-9]+$/', $value)) $formulary->setErrorMsg ($control, $fieldName, 'personaliteFields_phone_alertInvalidCountryCode', $value); $formulary->setField ('local/phone/country', $value); } // received country if (isset ($formulary->received[$fieldName . '_area'][0])) { // filter received area $value = $formulary->received[$fieldName . '_area']; if (!preg_match ('/^[0-9]+$/', $value)) $formulary->setErrorMsg ($control, $fieldName, 'personaliteFields_phone_alertInvalidAreaCode', $value); $formulary->setField ('local/phone/area', $value); } // received area if (isset ($formulary->received[$fieldName . '_number'][0])) { // filter received number $value = $formulary->received[$fieldName . '_number']; if (!preg_match ('/^[0-9]+$/', $value)) $formulary->setErrorMsg ($control, $fieldName, 'personaliteFields_phone_alertInvalidNumber', $value); $formulary->setField ('local/phone/number', $value); } // received number } // function save static function view ($fieldName, $control, $formulary) { // function view $document = $formulary->document; // type $control['type'] = 'view'; if (!isset ($formulary->data['local']['phone'])) return; if (isset ($formulary->data['local']['phone']['country'])) $tel[] = $formulary->data['local']['phone']['country']; if (isset ($formulary->data['local']['phone']['area'])) $tel[] = $formulary->data['local']['phone']['area']; if (isset ($formulary->data['local']['phone']['number'])) $tel[] = $formulary->data['local']['phone']['number']; $control['content'] = $document->textMerge (implode (' ', $tel)); $control['url'] = 'tel:' . implode ('-', $tel); $formulary->appendChild ($control); } // function view static function column ($document, $data, $name, $field, $url) { // function column if (!isset ($formulary->data['local']['phone'])) return array ('caption' => $document->textMerge ('-')); if (isset ($formulary->data['local']['phone']['country'])) $tel[] = $formulary->data['local']['phone']['country']; if (isset ($formulary->data['local']['phone']['area'])) $tel[] = $formulary->data['local']['phone']['area']; if (isset ($formulary->data['local']['phone']['number'])) $tel[] = $formulary->data['local']['phone']['number']; return array ( 'caption' => $document->textMerge (implode (' ', $tel)), 'url' => 'tel:' . implode ('-', $tel) ); } // function column } // class eclFilter_personaliteFields_phone //!eof:library/personaliteFields/phone/eclFilter_personaliteFields_phone.php; //!file:library/personaliteFields/phone/eclFilter_personaliteFields_phone_view.php; class eclFilter_personaliteFields_phone_view { // class eclFilter_personaliteFields_phone_view static function create ($fieldName, $control, $formulary) { // function create $document = $formulary->document; $control['name'] = $fieldName; // type $control['type'] = 'view'; if (!isset ($formulary->data['local']['phone'])) return; if (isset ($formulary->data['local']['phone']['country'])) $tel[] = $formulary->data['local']['phone']['country']; if (isset ($formulary->data['local']['phone']['area'])) $tel[] = $formulary->data['local']['phone']['area']; if (isset ($formulary->data['local']['phone']['number'])) $tel[] = $formulary->data['local']['phone']['number']; $control['content'] = $document->textMerge (implode (' ', $tel)); $control['url'] = 'tel:' . implode ('-', $tel); $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function column ($data, $name, $field, $url, $document) { // function column return array (); } // function column } // class eclFilter_personaliteFields_phone_view //!eof:library/personaliteFields/phone/eclFilter_personaliteFields_phone_view.php; //!file:library/personaliteFields/radio/eclFilter_personaliteFields_radio.php; class eclFilter_personaliteFields_radio extends eclFilter_personaliteFields_select { // class eclFilter_personaliteFields_radio } // class eclFilter_personaliteFields_radio //!eof:library/personaliteFields/radio/eclFilter_personaliteFields_radio.php; //!file:library/personaliteFields/select/eclFilter_personaliteFields_select.php; class eclFilter_personaliteFields_select { // class eclFilter_personaliteFields_select static function create ($fieldName, $control, $formulary) { // function create $name = $control['flags']['field_name']; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'select'; $control['name'] = $fieldName; if (isset ($formulary->data['local'][$name]['value'])) $value = $formulary->data['local'][$name]['value']; else $value = false; $select = $formulary->appendChild ($control); if (isset ($control['local']['options'])) { // options exists foreach ($control['local']['options'] as $index => $caption) { // each option $data = array ( 'name' => $fieldName, 'value' => strval ($index), 'caption' => $caption ); if ($index == $value) $data['active'] = 1; $select->appendChild ($data); } // each option } // options exists } // function create static function save ($fieldName, $control, $formulary) { // function save $name = $control['flags']['field_name']; if (isset ($formulary->received[$fieldName])) $formulary->data['local'][$name]['value'] = $formulary->received[$fieldName]; } // function save static function view ($fieldName, $control, $formulary) { // function view $name = $control['flags']['field_name']; $control['type'] = 'view'; if (isset ($formulary->data['local'][$name]['value'])) $value = $formulary->data['local'][$name]['value']; else $value = false; if (isset ($control['local']['options'])) { // options exists foreach ($control['local']['options'] as $index => $caption) { // each option if ($index != $value) continue; $control['content'] = $caption; $formulary->appendChild ($control); break; } // each option } // values exists } // function view static function column ($document, $data, $name, $field, $url) { // function column if (isset ($data['local'][$name])) $value = $data['local'][$name]['value']; else $value = false; if (isset ($field['options'])) { // options exists foreach ($field['options'] as $index => $caption) { // each option if ($index != $value) continue; return array ('caption' => $caption); } // each option } // values exists return array ('caption' => $document->textMerge ('-')); } // function column } // class eclFilter_personaliteFields_select //!eof:library/personaliteFields/select/eclFilter_personaliteFields_select.php; //!file:library/personaliteFields/select/eclFilter_personaliteFields_select_editFields.php; class eclFilter_personaliteFields_select_editFields { // class eclFilter_personaliteFields_select_editFields 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 <= 30; $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 <= 30; $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 static function view ($fieldName, $control, $formulary) { // function view $name = $control['flags']['field_name']; $control['type'] = 'view'; if (isset ($formulary->data[$name]['value'])) $value = $formulary->data[$name]['value']; else $value = false; if (isset ($control['local']['options'])) { // options exists foreach ($control['local']['options'] as $name => $caption) { // each option if ($name != $value) continue; $control['content'] = $caption; break; } // each option } // values exists $formulary->appendChild ($control); } // function view static function column ($document, $data, $name, $field, $url) { // function column if (isset ($data['local'][$name]['value'])) $value = $data['local'][$name]['value']; else $value = false; if (isset ($field['options'])) { // options exists foreach ($field['options'] as $name => $caption) { // each option if ($name != $value) continue; return array ('caption' => $caption); } // each option } // values exists return array ('caption' => $document->textMerge ('-')); } // function column } // class eclFilter_personaliteFields_select_editFields //!eof:library/personaliteFields/select/eclFilter_personaliteFields_select_editFields.php; //!file:library/personaliteFields/separator/eclFilter_personaliteFields_separator.php; class eclFilter_personaliteFields_separator { // class eclFilter_personaliteFields_separator static function create ($fieldName, $control, $formulary) { // function create // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $local['type'] = 'separator'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function view ($fieldName, $control, $formulary) { // function view $local['type'] = 'separator'; $formulary->appendChild ($local); } // function view static function column ($document, $data, $name, $field, $url) { // function column return false; } // function column } // class eclFilter_personaliteFields_separator //!eof:library/personaliteFields/separator/eclFilter_personaliteFields_separator.php; //!file:library/personaliteFields/separator/eclFilter_personaliteFields_separator_view.php; class eclFilter_personaliteFields_separator_view { // class eclFilter_personaliteFields_separator_view static function create ($fieldName, $control, $formulary) { // function create $local['type'] = 'separator'; $formulary->appendChild ($local); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function column ($data, $name, $field, $url, $document) { // function column return array (); } // function column } // class eclFilter_personaliteFields_separator_view //!eof:library/personaliteFields/separator/eclFilter_personaliteFields_separator_view.php; //!file:library/personaliteFields/status/eclFilter_personaliteFields_status.php; class eclFilter_personaliteFields_status { // class eclFilter_personaliteFields_status static function create ($fieldName, $control, $formulary) { // function create } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function view ($fieldName, $control, $formulary) { // function view global $store; if (!isset ($formulary->data['status']) or !$formulary->data['status']) return; $control['type'] = 'view'; $caption = $store->control->read ('labels/status/' . $formulary->data['status']); if (!$caption) return; $control['content'] = $caption['text']['caption']; $formulary->appendChild ($control); } // function view static function column ($document, $data, $name, $field, $url) { // function column global $store; if (!isset ($data['status']) or !$data['status']) return array ('caption' => $document->textMerge (' ')); $caption = $store->control->read ('labels/status/' . $data['status']); if (!isset ($caption['text']['caption'])) return array ('caption' => $document->textMerge (' ')); return $caption; } // function column } // class eclFilter_personaliteFields_status //!eof:library/personaliteFields/status/eclFilter_personaliteFields_status.php; //!file:library/personaliteFields/text/eclFilter_personaliteFields_text.php; class eclFilter_personaliteFields_text { // class eclFilter_personaliteFields_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; $lang = $document->lang; $charset = $document->charset; $name = $control['flags']['field_name']; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'text'; $control['name'] = $fieldName; $item = $formulary->appendChild ($control); if (!isset ($formulary->data['text'][$name])) return; $text = $formulary->data['text'][$name]; 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, $formulary) { // function save if (!isset ($formulary->received[$fieldName][0])) { // empty if (isset ($control['local']['required']) and $control['local']['required']) $formulary->setRequiredMsg ($control, $fieldName); return; } // empty $name = $control['flags']['field_name']; $formulary->data['text'][$name] = array ($formulary->document->lang => array (TEXT_CONTENT => $formulary->received[$fieldName])); if ($formulary->document->charset == 'ISO-8859-1') $formulary->data['text'][$name][$formulary->document->lang][TEXT_CHARSET] = 1; } // function save static function view ($fieldName, $control, $formulary) { // function view $name = $control['flags']['field_name']; $control['type'] = 'view'; if (isset ($formulary->data['text'][$name])) $control['content'] = $formulary->data['text'][$name]; $formulary->appendChild ($control); } // function view static function column ($document, $data, $name, $field, $url) { // function column if (isset ($data['text'][$name])) return array ('caption' => $data['text'][$name]); return array ('caption' => $document->textMerge ('-')); } // function column } // class eclFilter_personaliteFields_text //!eof:library/personaliteFields/text/eclFilter_personaliteFields_text.php; //!file:library/personaliteFields/textarea/eclFilter_personaliteFields_textarea.php; class eclFilter_personaliteFields_textarea { // class eclFilter_personaliteFields_textarea 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; $name = $control['flags']['field_name']; // type if (isset ($control['flags']['type'])) $control['type'] = $control['flags']['type']; else $control['type'] = 'textarea'; $control['name'] = $fieldName; $item = $formulary->appendChild ($control); if (!isset ($formulary->data['text'][$name])) return; $text = $formulary->data['text'][$name]; 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, $formulary) { // function save if (!isset ($formulary->received[$fieldName][0])) { // empty if (isset ($control['local']['required']) and $control['local']['required']) $formulary->setRequiredMsg ($control, $fieldName); return; } // empty $name = $control['flags']['field_name']; $formulary->data['text'][$name] = array ($formulary->document->lang => array ( TEXT_CONTENT => $formulary->received[$fieldName], TEXT_FORMAT => 2 )); if ($formulary->document->charset == 'ISO-8859-1') $formulary->data['text'][$name][$formulary->document->lang][TEXT_CHARSET] = 1; } // function save static function view ($fieldName, $control, $formulary) { // function view $name = $control['flags']['field_name']; $control['type'] = 'view'; if (isset ($formulary->data['text'][$name])) $control['content'] = $formulary->data['text'][$name]; $formulary->appendChild ($control); } // function view static function column () { // function column return false; } // function column } // class eclFilter_personaliteFields_textarea //!eof:library/personaliteFields/textarea/eclFilter_personaliteFields_textarea.php; //!file:library/personaliteInstall/eclApp_personaliteInstall.php; class eclApp_personaliteInstall { // class eclApp_personaliteInstall static function is_child ($me, $name) { // function is_child if ($name == 'install') 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 ('install'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteInstall_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; if ($io->request->uploaded) self::action_install ($document); if (is_file (PATH_DOMAINS . $document->domain->name . '/-install.zip')) return self::action_select_components ($document); $formulary = $document->createFormulary ('personaliteInstall_edit', array (), 'install'); if ($formulary->command ('cancel')) return $document->dataReplace ('layouts/dialog_cancel'); $document->mod->formulary = $formulary; } // function dispatch static function action_install ($document) { // function action_install global $io, $store; $me = $document->application; foreach ($io->request->uploaded as $name => $files) { // each entry foreach ($files as $file) { // each file if ($file['size'] > 100000000 or $file['size'] < 3) continue; @list ($name, $ext) = explode ('.', $file['name']); if ($ext == 'zip') { // move install file $folder = PATH_DOMAINS . $document->domain->name . '/-install.zip'; move_uploaded_file ($file['tmp_name'], $folder); return; } // move install file } // each file } // each entry $filename = PATH_DOMAINS . $document->domain->name . '/-install.zip'; $zip = new ZipArchive (); if ($zip->open ($filename, ZIPARCHIVE::CREATE) !== TRUE) return; foreach ($io->request->uploaded as $name => $files) { // each entry foreach ($files as $file) { // each file if ($file['size'] > 100000000 or $file['size'] < 3) continue; $zip->addFile ($file['tmp_name'], '/' . $file['name']); } // each file } // each entry $zip->close (); } // function action_install static function action_select_components ($document) { // function action_select_components $formulary = $document->createFormulary ('personaliteInstall_select', array (), 'select'); if ($formulary->command ('cancel')) return $document->dataReplace ('layouts/dialog_cancel'); if ($formulary->command ('save') and $formulary->save ()) { // save if (isset ($formulary->data['saved'])) { // saved $fileName = PATH_DOMAINS . $document->domain->name . '/-install.zip'; if (is_file ($fileName)) unlink ($fileName); $document->dataReplace ('layouts/dialog_close'); return; } // saved } // save $document->mod->formulary = $formulary; } // function action_select_components } // class eclApp_personaliteInstall //!eof:library/personaliteInstall/eclApp_personaliteInstall.php; //!file:library/personaliteInstall/eclFilter_personaliteInstall_selectComponents.php; class eclFilter_personaliteInstall_selectComponents { // class eclFilter_personaliteInstall_selectComponents static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application; $templates = array (); $sections = array (); $all = array (); $filename = PATH_DOMAINS . $document->domain->name . '/-install.zip'; $zip = zip_open ($filename); if (!$zip) return; while ($zip_entry = zip_read ($zip)) { // each file $name = zip_entry_name ($zip_entry); if (substr ($name, - 5) != '.json') { // cancel zip_entry_close ($zip_entry); continue; } // cancel $buffer = zip_entry_read ($zip_entry, zip_entry_filesize ($zip_entry)); $data = eclIo_webservice::json2array ($buffer); if (!isset ($data['name'])) { // cancel zip_entry_close ($zip_entry); continue; } // cancel $all[$data['name']] = $data; if (strpos ($data['name'], '/') === false) { // section if ($store->domainContent->open ($me->domainId, $data['name'])) $sections[$data['name']] = 0; elseif (isset ($data['marker']) and $store->domainContent->findMarker ($me->domainId, $data['marker'])) $sections[$data['name']] = 0; else $sections[$data['name']] = 1; } // section else $templates[$data['name']] = 1; zip_entry_close ($zip_entry); } // each entry zip_close ($zip); if ($templates) { // create components checkboxes foreach ($templates as $name => $value) { // loop each component $data = $all[$name]; $local = array ( 'type' => 'checkbox', 'name' => $fieldName . '_' . md5 ($data['name']), 'value' => $value, 'caption' => $document->textMerge ($data['name'] . ' ', $data['text']['caption']) ); $formulary->appendChild ($local); } // loop each component } // create components checkboxes $formulary->appendChild (array ('type' => 'separator')); if ($sections) { // create sections checkboxes foreach ($sections as $name => $value) { // loop each section $data = $all[$name]; $local = array ( 'type' => 'checkbox', 'name' => $fieldName . '_' . md5 ($data['name']), 'value' => $value, 'caption' => $data['text']['caption'] ); $formulary->appendChild ($local); } // loop each section } // create section checkboxes } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $document = $formulary->document; $me = $formulary->document->application; $received = $formulary->received; $names = array (); $saved = array (); $filename = PATH_DOMAINS . $document->domain->name . '/-install.zip'; $zip = zip_open ($filename); if (!$zip) return; while ($zip_entry = zip_read ($zip)) { // each file $name = zip_entry_name ($zip_entry); if (substr ($name, - 5) == '.json') { // read json file $buffer = zip_entry_read ($zip_entry, zip_entry_filesize ($zip_entry)); $data = eclIo_webservice::json2array ($buffer); if (isset ($data['name']) and isset ($received[$fieldName . '_' . md5 ($data['name'])][0])) { // save file $names[$data['name']] = true; $saved[] = $data['name']; if (strpos ($data['name'], '/')) { // save template component $component = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $name); if ($component) { // components exists $component = array_replace ($component, $data); unset ($component); } // components exists else { // create component $data['mode'] = MODE_TEMPLATE; $store->domainExtras->insert ($me->domainId, $data); } // create component } // save template component else { // save section if (isset ($data['marker']) and $id = $store->domainContent->findMarker ($me->domainId, $data['marker'])) { // marker found $section = $me->findChild ($id); if ($section) $section->remove (); } // marker found if ($sectionData = $store->domainContent->open ($me->domainId, $data['name'])) { // same name $section = $me->findChild ($sectionData['id']); $section->remove (); } // same name $data['mode'] = MODE_SECTION; $store->domainContent->insert ($me->domainId, $data); } // save section } // save file } // read json file zip_entry_close ($zip_entry); } // each entry zip_close ($zip); // second turn to save extra files $zip = zip_open ($filename); while ($zip_entry = zip_read ($zip)) { // each file $name = zip_entry_name ($zip_entry); list ($prefix) = explode ('.', $name); list ($prefix) = explode (CHR_FNS, $prefix); if (isset ($names[$prefix])) { // save extras file $saved[] = $name; $buffer = zip_entry_read ($zip_entry, zip_entry_filesize ($zip_entry)); file_put_contents (PATH_DOMAINS . $document->domain->name . '/' . $name, $buffer); } // save extras file zip_entry_close ($zip_entry); } // each entry zip_close ($zip); $formulary->data['saved'] = implode (CRLF, $saved); } // function save } // class eclFilter_personaliteInstall_selectComponents //!eof:library/personaliteInstall/eclFilter_personaliteInstall_selectComponents.php; //!file:library/personaliteModules/eclApp_personaliteModules.php; class eclApp_personaliteModules { // class eclApp_personaliteModules static function is_child ($me, $name) { // function is_child if ($name == 'modules') 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 ('modules'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteModules_edit'); $me->access = 4; $me->isDomain = true; $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $me->pathway = $document->pathway; $name = end ($document->pathway); list ($prefix) = explode ('_', $name); $controlName = 'mod' . ucfirst ($prefix) . '_edit'; $control = $store->control->read ($controlName); if ($control) { // set modules 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 modules title else { // no configurable $document->dataMerge ('personaliteModules_contentNotConfigurable'); $formulary = $document->createFormulary ('personaliteModules_contentNotConfigurable', array (), 'not_configurable'); if ($formulary->command ('cancel')) return $document->dataReplace ('layouts/dialog_cancel'); $document->mod->formulary = $formulary; return; } // no configurable $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, 'modules/' . $name); if ($saved) $data = $saved; elseif ($store->control->read ('modules/' . $name)) $data = $store->control->read ('modules/' . $name); else $data = $store->control->read ('modules/' . $prefix); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations if ($saved) $store->domainExtras->delete ($me->domainId, $saved['id']); return $document->dataReplace ('layouts/dialog_close'); } // restore default configurations $formulary = $document->createFormulary ($controlName, $data); if ($formulary->save ()) { // save formulary if ($saved) $saved = $formulary->data; else { // create saved modules $data = $formulary->data; $data['mode'] = MODE_TEMPLATE; $data['name'] = 'modules/' . $name; $store->domainExtras->insert ($me->domainId, $data); } // create saved modules $document->dataReplace ('layouts/dialog_close'); return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_personaliteModules //!eof:library/personaliteModules/eclApp_personaliteModules.php; //!file:library/personaliteTemplate/add/eclApp_personaliteTemplate_add.php; class eclApp_personaliteTemplate_add { // class eclApp_personaliteTemplate_add static function is_child ($me, $name) { // function is_child switch ($name) { // switch name case 'details': case 'fields': case 'fonts': case 'layouts': case 'lists': case 'icons': case 'modules': case 'palettes': case 'scripts': case 'styles': case 'themes': return true; default: return false; } // switch name } // 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 ('personaliteTemplate_add_content'); $me->map = array ('personaliteTemplate_configure'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_personaliteTemplate_add_list ($document); } // function dispatch } // class eclApp_personaliteTemplate_add //!eof:library/personaliteTemplate/add/eclApp_personaliteTemplate_add.php; //!file:library/personaliteTemplate/add/eclMod_personaliteTemplate_add_list.php; class eclMod_personaliteTemplate_add_list { // class eclMod_personaliteTemplate_add_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; $render = $document->render; $folder = $me->name; foreach ($store->control->scandir ('t', $folder) as $name) { // each detail $data = $store->control->read ($folder . '/' . $name); if (!$data or !isset ($data['text']['caption'])) continue; $data['name'] = $name; $data['text']['caption'] = $document->textMerge ($data['name'], ' ', $data['text']['caption']); $mod->appendChild ($data) ->appendFolder ($name); } // each detail $mod->enabled = true; } // function setModule } // class eclMod_personaliteTemplate_add_list //!eof:library/personaliteTemplate/add/eclMod_personaliteTemplate_add_list.php; //!file:library/personaliteTemplate/configure/eclApp_personaliteTemplate_configure.php; class eclApp_personaliteTemplate_configure { // class eclApp_personaliteTemplate_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 ('personaliteTemplate_configure_' . $me->parent->name); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $folder = $me->parent->name; $name = $folder . '/' . $me->name; $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $name); if ($saved) $data = $saved; elseif ($store->control->read ($name)) $data = $store->control->read ($name); else $data = array (); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations if ($saved) $store->domainExtras->delete ($me->domainId, $saved['id']); $data = $store->control->read ($name); $document->dataReplace ('layouts/dialog_close'); if ($data) { // update to default $caption = $document->selectLanguage ($data['text']['caption']); $identifier = $me->name; } // update to system default else { // remove $identifier = ''; $caption[1] = ''; } // remove $pathway = $me->parent->pathway; $pathway[] = $me->name; $url = $document->url ($pathway); $document->data['script'] = 'window.opener.listManager.update ("' . $me->name . '", "' . $identifier . '", "' . $caption[1] . '", "' . $url . '");'; return; } // restore default configurations $data['identifier'] = $me->name; $formulary = $document->createFormulary ('personaliteTemplate_configure_' . $me->parent->name, $data); if ($formulary->save ()) { // save formulary $data = $formulary->data; if (!isset ($data['identifier']) or !preg_match ('/^[a-z][a-z0-9_]*$/', $data['identifier'])) $data['identifier'] = $me->name; if ($data['identifier'] == $me->name and $saved) $saved = $formulary->data; else { // create saved modules if ($data['identifier'] != $me->name and $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $folder . '/' . $data['identifier'])) { // overwrite existing detail $saved['text'] = $data['text']; $saved['local'] = $data['local']; $saved['html'] = $data['html']; } // overwrite existing detail else { // create new detail $data['mode'] = MODE_TEMPLATE; $data['name'] = $folder . '/' . $data['identifier']; $store->domainExtras->insert ($me->domainId, $data); } // create new detail } // create saved modules $document->dataReplace ('layouts/dialog_close'); $caption = $document->selectLanguage ($data['text']['caption']); $pathway = $me->parent->pathway; $pathway[] = $data['identifier']; $url = $document->url ($pathway); $document->data['script'] = 'window.opener.listManager.update ("' . $me->name . '", "' . $data['identifier'] . '", "' . $caption[1] . '", "' . $url . '");'; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_personaliteTemplate_configure //!eof:library/personaliteTemplate/configure/eclApp_personaliteTemplate_configure.php; //!file:library/personaliteTemplate/configure/eclFilter_personaliteTemplate_configure_filters.php; class eclFilter_personaliteTemplate_configure_filters { // class eclFilter_personaliteTemplate_configure_filters static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $item = $formulary->appendChild ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'manager'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $item->data['help_msg'] = 'system_msg_filterDetailsHelp'; // references $pathway = array ($document->domain->name, '-personalite', 'template', '-filters'); $item->data['url_add'] = $document->url ($pathway); $item->data['move-enable'] = 1; $item->data['remove-enable'] = 1; $item->data['edit-enable'] = 0; $filters = $formulary->getField ('local/filters'); if (!isset ($filters[0])) return; $item->data['serialized'] = $filters; foreach (explode (CRLF, $filters) as $name) { // each filter $data = $store->control->read ('sectionBlog_post_edit' . ucfirst ($name)); if (!isset ($data['flags']['filters_manager'])) continue; $item->appendChild (array ( 'value' => $name, 'caption' => $data['text']['caption'], )); } // each line } // function create static function save ($fieldName, $control, $formulary) { // function save if (isset ($formulary->received[$fieldName . '_serialized'])) $formulary->data['local']['filters'] = $formulary->received[$fieldName . '_serialized']; else unset ($formulary->data['local']['filters']); } // function save } // class eclFilter_personaliteTemplate_configure_filters //!eof:library/personaliteTemplate/configure/eclFilter_personaliteTemplate_configure_filters.php; //!file:library/personaliteTemplate/eclApp_personaliteTemplate.php; class eclApp_personaliteTemplate { // class eclApp_personaliteTemplate 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 'section'; } // 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 ('personaliteTemplate_content'); $me->map = array ('personaliteTemplate_add', 'personaliteTemplate_labels', 'personaliteTemplate_filters'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; if (isset ($document->actions['remove'][1])) return self::action_remove ($document); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations $domainId = $document->domain->domainId; foreach ($store->domainExtras->children ($domainId, MODE_TEMPLATE, 0) as $data) { // each block $store->domainExtras->delete ($domainId, $data['id']); } // each block return $document->dataReplace ('layouts/dialog_close'); } // restore default configurations $formulary = $document->createFormulary ('personaliteTemplate_edit', array (), 'template'); if ($formulary->save ()) return $document->dataReplace ('layouts/dialog_close'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch static function action_remove ($document) { // function action_remove $id = intval ($document->actions['remove'][1]); if (!$id) return $document->buffer = 'error'; $data = $store->domainExtras->openById ($document->domain->domainId, $id); if (!$data) return $document->buffer = 'ok'; if ($data['mode'] != MODE_TEMPLATE) return $document->buffer = 'error'; $store->domainExtras->delete ($data['domain_id'], $data['id']); $document->buffer = 'ok'; } // function action_remove } // class eclApp_personaliteTemplate //!eof:library/personaliteTemplate/eclApp_personaliteTemplate.php; //!file:library/personaliteTemplate/eclFilter_personaliteTemplate_manager.php; class eclFilter_personaliteTemplate_manager { // class eclFilter_personaliteTemplate_manager static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $me = $document->application; $folder = $control['flags']['folder']; $length = strlen ($folder); $item = $document->createListItem ($control); // name $item->data['name'] = $fieldName; // type if (isset ($control['flags']['type'])) $item->data['type'] = $control['flags']['type']; else $item->data['type'] = 'manager'; // help if (isset ($control['flags']['help']) and !isset ($control['flags']['help_msg'])) $item->data['help_msg'] = 'system_msg_filterDetailsHelp'; // references $pathway = array ($document->domain->name, '-personalite', 'template', $control['flags']['folder']); $item->data['url_add'] = $document->url ($pathway); $item->data['move-enable'] = 0; $item->data['remove-enable'] = 1; $item->data['edit-enable'] = 1; foreach ($store->domainExtras->children ($me->domainId, MODE_TEMPLATE, 0) as $data) { // each user detail if (substr ($data['name'], 0, $length) != $folder) continue; if (isset ($data['text']['caption'])) $caption = $document->textMerge ($data['name'], ' ', $data['text']['caption']); else $caption = $document->textMerge ($data['name']); $configure = $me->pathway; $configure[] = $data['name']; $item->appendChild (array ( 'value' => $data['name'], 'caption' => $caption, 'url' => $document->url ($configure), 'url_remove' => $document->url (true, true, '_remove-' . $data['id']) )); } // each line return $item; } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save } // class eclFilter_personaliteTemplate_manager //!eof:library/personaliteTemplate/eclFilter_personaliteTemplate_manager.php; //!file:library/personaliteTemplate/filters/eclApp_personaliteTemplate_filters.php; class eclApp_personaliteTemplate_filters { // class eclApp_personaliteTemplate_filters static function is_child ($me, $name) { // function is_child if ($name == '-filters') 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 ('-filters'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('personaliteTemplate_filters_content'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_personaliteTemplate_filters_list ($document); } // function dispatch } // class eclApp_personaliteTemplate_filters //!eof:library/personaliteTemplate/filters/eclApp_personaliteTemplate_filters.php; //!file:library/personaliteTemplate/filters/eclMod_personaliteTemplate_filters_list.php; class eclMod_personaliteTemplate_filters_list { // class eclMod_personaliteTemplate_filters_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; $render = $document->render; foreach ($store->control->scandir ('c', 'sectionBlog/post') as $name) { // each detail $data = $store->control->read ('sectionBlog_post_' . $name); if (!isset ($data['flags']['filters_manager'])) continue; if (!$data or !isset ($data['text']['caption'])) continue; $data['name'] = $data['flags']['filters_manager']; $mod->appendChild ($data); } // each detail $mod->enabled = true; } // function setModule } // class eclMod_personaliteTemplate_filters_list //!eof:library/personaliteTemplate/filters/eclMod_personaliteTemplate_filters_list.php; //!file:library/personaliteTemplate/labels/eclApp_personaliteTemplate_labels.php; class eclApp_personaliteTemplate_labels { // class eclApp_personaliteTemplate_labels static function is_child ($me, $name) { // function is_child if ($name == 'labels') 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 ('personaliteTemplate_add_content'); $me->map = array ('personaliteTemplate_labels_add'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_personaliteTemplate_labels //!eof:library/personaliteTemplate/labels/eclApp_personaliteTemplate_labels.php; //!file:library/personaliteTemplate/labels/eclApp_personaliteTemplate_labels_add.php; class eclApp_personaliteTemplate_labels_add { // class eclApp_personaliteTemplate_labels_add static function is_child ($me, $name) { // function is_child switch ($name) { // switch name case 'action': case 'date': case 'field': case 'lang': case 'navigation': return true; default: return false; } // switch name } // 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 ('personaliteTemplate_add_content'); $me->map = array ('personaliteTemplate_labels_configure'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_personaliteTemplate_labels_add ($document); } // function dispatch } // class eclApp_personaliteTemplate_labels_add //!eof:library/personaliteTemplate/labels/eclApp_personaliteTemplate_labels_add.php; //!file:library/personaliteTemplate/labels/eclApp_personaliteTemplate_labels_configure.php; class eclApp_personaliteTemplate_labels_configure { // class eclApp_personaliteTemplate_labels_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 ('personaliteTemplate_labels_edit'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $folder = 'labels/' . $me->parent->name; $name = $folder . '/' . $me->name; $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $name); if ($saved) $data = $saved; elseif ($store->control->read ($name)) $data = $store->control->read ($name); else $data = array (); // Restore default configurations if (isset ($document->received['save']) and $document->received['save'] == 'restore') { // restore default configurations if ($saved) $store->domainExtras->delete ($me->domainId, $saved['id']); $data = $store->control->read ($name); $document->dataReplace ('layouts/dialog_close'); if ($data) { // update to default $caption = $document->selectLanguage ($data['text']['caption']); $identifier = $me->name; } // update to system default else { // remove $identifier = ''; $caption[1] = ''; } // remove $pathway = $me->parent->pathway; $pathway[] = $me->name; $url = $document->url ($pathway); $document->data['script'] = 'window.opener.listManager.update ("' . $me->name . '", "' . $identifier . '", "' . $caption[1] . '", "' . $url . '");'; return; } // restore default configurations $data['identifier'] = $me->name; $formulary = $document->createFormulary ('personaliteTemplate_labels_edit', $data); if ($formulary->save ()) { // save formulary $data = $formulary->data; if (!isset ($data['identifier']) or !preg_match ('/^[a-z][a-z0-9_]*$/', $data['identifier'])) $data['identifier'] = $me->name; if ($data['identifier'] == $me->name and $saved) $saved = $formulary->data; else { // create saved modules if ($data['identifier'] != $me->name and $saved = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $folder . '/' . $data['identifier'])) { // overwrite existing detail $saved['text'] = $data['text']; } // overwrite existing detail else { // create new detail $data['mode'] = MODE_TEMPLATE; $data['name'] = $folder . '/' . $data['identifier']; $store->domainExtras->insert ($me->domainId, $data); } // create new detail } // create saved modules $document->dataReplace ('layouts/dialog_close'); $caption = $document->selectLanguage ($data['text']['caption']); $pathway = $me->parent->pathway; $pathway[] = $data['identifier']; $url = $document->url ($pathway); $document->data['script'] = 'window.opener.listManager.update ("' . $me->name . '", "' . $data['identifier'] . '", "' . $caption[1] . '", "' . $url . '");'; return; } // save formulary $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_personaliteTemplate_labels_configure //!eof:library/personaliteTemplate/labels/eclApp_personaliteTemplate_labels_configure.php; //!file:library/personaliteTemplate/labels/eclMod_personaliteTemplate_labels_add.php; class eclMod_personaliteTemplate_labels_add { // class eclMod_personaliteTemplate_labels_add 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; $render = $document->render; $folder = $me->parent->name . '/' . $me->name; foreach ($store->control->scandir ('t', $folder) as $name) { // each detail $data = $store->control->read ($folder . '/' . $name); if (!$data or !isset ($data['text']['caption'])) continue; $data['name'] = $name; $data['text']['caption'] = $document->textMerge ($data['name'], ' ', $data['text']['caption']); $mod->appendChild ($data) ->appendFolder ($name); } // each detail $mod->enabled = true; } // function setModule } // class eclMod_personaliteTemplate_labels_add //!eof:library/personaliteTemplate/labels/eclMod_personaliteTemplate_labels_add.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->url (); 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; $store->domainExtras->createVersion ($me->domainId, $data, $document); $parent->reset (); $document->application = $parent->child ($data['name']); $document->reload = $document->url (); $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) ->url ($pathway, true, '_create-' . $child->name); } // each child $mod->data = $store->control->read ('modules/list'); $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; if (!$me->isDomain) return false; $data = $store->domainContent->open ($me->domainId, $name); if (!$data or !$data['parent_id']) return false; if ($data['parent_id'] == 1) return true; $parent = $store->domainContent->openById ($me->domainId, $data['parent_id']); if (isset ($parent['flags']['section_type']) and $parent['flags']['section_type'] == 'menu') 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', 'moveto')) $view = self::action_moveto ($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')) ->url (true, true, '_section-edit'); // Versioning $store->domainExtras->versioning ($document); // Context Remove $document->mod->context->appendChild ('section_remove') ->url (true, true, '_section-remove') ->confirm ('section_removeConfirm'); // Context Move up if ($me->data['index'] and ($me->data['parent_id'] == 1 or $me->data['parent_id'] == $me->parent->id)) $document->mod->context->appendChild ('section_moveUp') ->url (true, true, '_section-move-up'); // Context Move down if ($me->data['index'] < count ($store->domainContent->children ($me->domainId, MODE_SECTION, $me->data['parent_id'])) - 1 and ($me->data['parent_id'] == 1 or $me->data['parent_id'] == $me->parent->id)) $document->mod->context->appendChild ('section_moveDown') ->url (true, true, '_section-move-down'); // Context Move to... $document->mod->context->appendChild ('section_moveTo') ->url (true, true, '_section-moveto'); } // user is admin if ($view) { // view section if (!$document->access (3) and !isset ($me->data['flags']['modHits_disable'])) $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 global $store; $me = $document->application; $formulary = $document->createFormulary ('section_edit', $me->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']); $me->data = $formulary->data; $me->data['updated'] = TIME; $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $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->url (); } // 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->url (); $document->application->dispatch ($document); } // function action_remove static function action_move ($document) { // function action_move global $store; $parentId = $document->application->data['parent_id']; $name = $document->application->name; $parent = $document->application->parent; unset ($document->application); $parent->reset (); $store->domainContent->childrenReindex ($parent->domainId, MODE_SECTION, $parentId); $names = $store->domainContent->childrenNames ($parent->domainId, MODE_SECTION, $parentId); $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 action_moveto ($document) { // function action_moveto global $store; unset ($document->actions['section']); $me = $document->application; $oldParentId = $me->data['parent_id']; $formulary = $document->createFormulary ('section_moveTo', $me->data, 'moveto'); $formulary->action = '_section-moveto'; if ($formulary->command ('cancel')) return true; if ($formulary->command ('save') and $formulary->save ()) { // save $newParentId = $formulary->data['parent_id']; if ($newParentId == $oldParentId) return true; $me->data['parent_id'] = $newParentId; unset ($store->domainContent->chargedMode[$me->domainId][MODE_SECTION]); $store->domainContent->childrenReindex ($me->domainId, MODE_SECTION, $newParentId); $me->data['index'] = count ($store->domainContent->children ($me->domainId, MODE_SECTION, $newParentId)); unset ($store->domainContent->indexByParent[$me->domainId][MODE_SECTION][$oldParentId][$me->id]); $store->domainContent->childrenReindex ($me->domainId, MODE_SECTION, $oldParentId); $store->domainContent->indexByParent[$me->domainId][MODE_SECTION][$newParentId][$me->id] = $me->id; unset ($store->domainContent->chargedParents[$me->domainId][MODE_SECTION][$oldParentId]); unset ($store->domainContent->chargedParents[$me->domainId][MODE_SECTION][$newParentId]); $document->reload = $document->url ($store->domainContent->pathway ($me->domainId, $me->id)); return false; } // save $document->mod->formulary = $formulary; $document->dataReplace ('section_moveTo'); return false; } // function action_moveto 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); $store->domainExtras->deleteAllChildren ($me->domainId, $me->id); } // function remove } // class eclApp_section //!eof:library/section/eclApp_section.php; //!file:library/section/eclFilter_section_moveto.php; class eclFilter_section_moveto { // class eclFilter_section_moveto static function create ($fieldName, $control, $formulary) { // function create global $store; $control['type'] = 'list'; $control['name'] = $fieldName; $parentId = $formulary->data['parent_id']; $id = $formulary->data['id']; $item = $formulary->appendChild ($control); // Main menu $item->appendChild ('section_moveToMain') ->set ('value', '0') ->active ($parentId == 0); // Footer menu $item->appendChild ('section_moveToFooter') ->set ('value', '1') ->active ($parentId == 1); foreach ($store->domainContent->mode ($formulary->data['domain_id'], MODE_SECTION) as $data) { // each section if ($data['id'] == $id) continue; if (isset ($data['flags']['section_type']) and ($data['flags']['section_type'] == 'folder' or $data['flags']['section_type'] == 'menu')) $item->appendChild ($data) ->set ('value', $data['id']) ->active ($data['id'] == $parentId); } // each section } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->received[$fieldName])) return; $id = strval ($formulary->received[$fieldName]); if ($id == 0 or $id == 1) return $formulary->data['parent_id'] = $id; $data = $store->domainContent->openById ($formulary->data['domain_id'], $id); if (!$data or $data['mode'] != MODE_SECTION or !isset ($data['flags']['section_type'])) return; if ($data['flags']['section_type'] == 'folder' or $data['flags']['section_type'] == 'menu') $formulary->data['parent_id'] = $id; } // function save } // class eclFilter_section_moveto //!eof:library/section/eclFilter_section_moveto.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']['sufix'])) return; $special = $store->control->read ('section' . ucfirst ($formulary->data['flags']['section_type']) . $control['flags']['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']['sufix'])) return; $special = $store->control->read ('section' . ucfirst ($formulary->data['flags']['section_type']) . $control['flags']['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 'products': 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 global $store; $names = array ('blog', 'galery', 'news', 'events', 'podcast', 'videocast'); if ($store->domainContent->findMarker ($me->domainId, 12)) $names[] = 'products'; return $names; } // 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') ->url ($pathway); $document->mod->editor->enable (); } // admin $document->mod->sort = new eclMod_sectionBlog_sort ($document); $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; $render = $document->render; $me = $document->application; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['list'])) $mod->data = $me->data['extras']['list']; else { // from preset if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; $mod->data = $render->block ('modules/list_' . $preset); if (!$mod->data) $mod->data = $render->block ('modules/list_blog'); } // from 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 (isset ($document->actions['sort'][1])) { // force sorting mode switch ($document->actions['sort'][1]) { // switch sorgting mode case 'cheaper': $local['list_sort'] = 'value'; $local['list_direction'] = 'asc'; break; case 'expensive': $local['list_sort'] = 'value'; $local['list_direction'] = 'desc'; break; case 'hits': $local['list_sort'] = 'hits'; $local['list_direction'] = 'desc'; break; case 'ratings': $local['list_sort'] = 'spotlight'; $local['list_direction'] = 'desc'; break; case 'recents': $local['list_sort'] = 'created'; $local['list_direction'] = 'desc'; break; case 'post': $local['list_sort'] = 'created'; $local['list_direction'] = 'asc'; break; case 'event': $local['list_sort'] = 'event_start'; $local['list_direction'] = 'asc'; break; case 'alphabetically': $local['list_sort'] = 'name'; $local['list_direction'] = 'asc'; break; } // switch sorting mode } // force sorting mode 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 'coments_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 $row->appendChild ($me->child ($data['name'])) ->set ('editable', $document->contentEditable) ->url (); } // each child if (!$row->children) return; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'list'); $mod->data['local']['personalite_url'] = $document->url ($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; $action = ''; if (isset ($document->actions['sort'][1])) { // force sorting mode $action = '_sort-' . $document->actions['sort'][1]; switch ($document->actions['sort'][1]) { // switch sorgting mode case 'cheaper': $local['list_sort'] = 'value'; $local['list_direction'] = 'asc'; break; case 'expensive': $local['list_sort'] = 'value'; $local['list_direction'] = 'desc'; break; case 'hits': $local['list_sort'] = 'hits'; $local['list_direction'] = 'desc'; break; case 'ratings': $local['list_sort'] = 'spotlight'; $local['list_direction'] = 'desc'; break; case 'recents': $local['list_sort'] = 'created'; $local['list_direction'] = 'desc'; break; case 'post': $local['list_sort'] = 'created'; $local['list_direction'] = 'asc'; break; case 'event': $local['list_sort'] = 'event_start'; $local['list_direction'] = 'asc'; break; case 'alphabetically': $local['list_sort'] = 'name'; $local['list_direction'] = 'asc'; break; default: $action = ''; } // switch sorting mode } // force sorting mode 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 ('labels/navigation/first') ->active ($page == 1) ->url (true, true, $action); for ($i = 1; $i <= $numPages; $i++) { // loop pages $caption['local']['caption'] = $document->textMerge (strval ($i)); $row->appendChild (false, $caption) ->active ($page == $i) ->url (true, true, $action . '_page-' . $i); } // loop pages // last $row->appendChild ('labels/navigation/last') ->active ($page == $numPages) ->url (true, true, $action . '_page-' . $numPages); if (isset ($me->data['extras']['pages'])) $mod->data = $me->data['extras']['pages']; else $mod->data = $document->render->block ('modules/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_url'] = $document->url ($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/eclMod_sectionBlog_sort.php; class eclMod_sectionBlog_sort { // class eclMod_sectionBlog_sort 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; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['sort'])) $mod->data = $me->data['extras']['sort']; else { // from preset if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; $mod->data = $render->block ('modules/sort_' . $preset); if (!$mod->data) $mod->data = $render->block ('modules/sort_blog'); } // from preset $mod->data['name'] = 'sort_' . $me->name; // configurações de listagem $local = isset ($me->data['extras']['list']['local']) ? $me->data['extras']['list']['local'] : array (); $sort = isset ($local['list_sort']) ? $local['list_sort'] : 'index'; $direction = isset ($local['list_direction']) ? $local['list_direction'] : 'asc'; if (isset ($document->actions['sort'][1])) $value = $document->actions['sort'][1]; elseif ($sort == 'value' and $direction == 'asc') $value = 'cheaper'; elseif ($sort == 'value' and $direction == 'desc') $value = 'expensive'; elseif ($sort == 'hits') $value = 'hits'; elseif ($sort == 'spotlight') $value = 'ratings'; elseif ($sort == 'created' and $direction == 'desc') $value = 'recents'; elseif ($sort == 'created' and $direction == 'asc') $value = 'post'; elseif ($sort == 'event_start') $value = 'event'; elseif ($sort == 'name') $value = 'alphabetically'; else $value = ''; foreach (array ('cheaper', 'expensive', 'hits', 'ratings', 'recents', 'post', 'event', 'alphabetically') as $mode) { // each mode $mod->appendChild ('sectionBlog_sort' . ucfirst ($mode)) ->set ('value', $document->url (true, true, '_sort-' . $mode)) ->active ($value == $mode); } // each mode if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'sort'); $mod->data['local']['personalite_url'] = $document->url ($pathway); $caption = $store->control->read ('modSort_edit'); $mod->data['local']['personalite_caption'] = $caption['text']['caption']; } // reference $mod->enabled = true; } // function setModule } // class eclMod_sectionBlog_sort //!eof:library/sectionBlog/eclMod_sectionBlog_sort.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 global $store; $view = true; if ($document->access (4)) { // 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 ('sectionBlog_post_edit') ->active ($document->actions ('post', 'edit')) ->url (true, true, '_post-edit'); // Versioning $store->domainExtras->versioning ($document); // Context Remove $document->mod->context->appendChild ('sectionBlog_post_remove') ->url (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') ->url ($pathway); } // user is admin if (!$view) return; // 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->pages = new eclMod_sectionBlog_post_pages ($document); $document->mod->comments->enable (); } // 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; // New version $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $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_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->url (); } // function action_remove static function remove ($me) { // function remove global $store; $store->domainContent->delete ($me->domainId, $me->id); $store->domainExtras->deleteAllChildren ($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->url (); 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['subscription_id'] = $document->subscription->id; $data['id'] = $store->domainContent->insert ($parent->domainId, $data); $me->id = $data['id']; $formulary->save (2); $store->domainExtras->createVersion ($me->domainId, $data, $document); unset ($document->application); $parent->reset (); $document->application = $parent->child ($data['name']); $document->application->dispatch ($document); $document->reload = $document->url (); 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/eclFilter_sectionBlog_post_product.php; class eclFilter_sectionBlog_post_product { // class eclFilter_sectionBlog_post_product static function create ($fieldName, $control, $formulary) { // function create $formulary->appendChild ('sectionBlog_post_specialProductPrice', array ( 'name' => $fieldName . '_price', 'value' => $formulary->getField ('local/product_price') )); } // function create static function save ($fieldName, $control, $formulary) { // function save $received = $formulary->received; if (isset ($received[$fieldName . '_price'])) { // save value $formulary->setField ('local/product_price', $received[$fieldName . '_price']); $formulary->setField ('value', intval ($received[$fieldName . '_price'])); } // save value else { // clear value $formulary->setField ('local/product_price', false); $formulary->setField ('value', 0); } // clear value } // function save } // class eclFilter_sectionBlog_post_product //!eof:library/sectionBlog/post/eclFilter_sectionBlog_post_product.php; //!file:library/sectionBlog/post/eclFilter_sectionBlog_post_specialFields.php; class eclFilter_sectionBlog_post_specialFields { // class eclFilter_sectionBlog_post_specialFields static function create ($fieldName, $control, $formulary) { // function create $formulary->insertControlChildren (self::findSpecialFields ($formulary)); } // function create static function save ($fieldName, $control, $formulary) { // function save $formulary->insertControlChildren (self::findSpecialFields ($formulary)); } // function save static function findSpecialFields ($formulary) { // function findSpecialFields global $store; $render = $formulary->document->render; $fields['title'] = true; foreach (array ('list', 'post') as $from) { // loop post and list $details = self::getDetails ($formulary->document, $from); foreach (explode (CRLF, $details) as $name) { // each detail $detail = $render->block ('details/' . $name); if (!isset ($detail['local']['filters'])) continue; foreach (explode (CRLF, $detail['local']['filters']) as $filter) { // each filter $fields[$filter] = true; } // each filter } // each detail } // loop post and list unset ($fields['title'], $fields['caption'], $fields['name'], $fields['specialFields']); $control = array (); foreach ($fields as $field => $notImportant) { // each field $control['children'][] = 'sectionBlog_post_edit' . ucfirst ($field); } // each field return $control; } // function findSpecialFields static function getDetails ($document, $from) { // function getDetails $render = $document->render; $me = $document->application->parent; if (isset ($me->data['extras'][$from]['local']['details'])) return $me->data['extras'][$from]['local']['details']; if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; $post = $render->block ('modules/' . $from . '_' . $preset); if (!$post) $post = $render->block ('modules/' . $from . '_blog'); if (isset ($post['local']['details'])) return $post['local']['details']; return array (); } // function getDetails } // class eclFilter_sectionBlog_post_specialFields //!eof:library/sectionBlog/post/eclFilter_sectionBlog_post_specialFields.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; // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['post'])) $data = $me->data['extras']['post']; else { // from preset if (isset ($me->data['flags']['modList_preset'])) $preset = $me->data['flags']['modList_preset']; else $preset = 'blog'; $data = $render->block ('modules/post_' . $preset); if (!$data) $data = $render->block ('modules/post_blog'); } // from preset $mod->data = $render->block ('modules/content'); $mod->data = array_replace_recursive ($mod->data, $data); // Itens da lista $mod->appendChild ($document->application) ->set ('editable', $document->contentEditable); // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4, $me->groups)) { // reference $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'post'); $mod->data['local']['personalite_url'] = $document->url ($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_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 = $document->render->block ('modules/list_' . $me->data['flags']['modList_preset']); else $list = $document->render->block ('modules/list_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 'coments_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 ('labels/layout/previous') ->url ($pathway); } // previous if ($index < $length - 1) { // next $pathway = $me->pathway; $pathway[] = $names[$index + 1]; $row->appendChild ('labels/layout/next') ->url ($pathway); } // next if (isset ($me->data['extras']['post_pages'])) $mod->data = $me->data['extras']['post_pages']; else $mod->data = $document->render->block ('modules/pages_post'); if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'post', 'pages'); $mod->data['local']['personalite_url'] = $document->url ($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/sectionCart/create/eclApp_sectionCart_create.php; class eclApp_sectionCart_create { // class eclApp_sectionCart_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 12) and $name == 'cart') 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, 12)) return array ('cart'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionCart_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionCart_create //!eof:library/sectionCart/create/eclApp_sectionCart_create.php; //!file:library/sectionCart/eclApp_sectionCart.php; class eclApp_sectionCart { // class eclApp_sectionCart static function constructor_helper ($me) { // function constructor_helper $me->map = array ('financialAccount'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) { // admin $document->mod->editor->enable (); } // admin if (!$document->access (1)) { // please connect $document->mod->panel->main = array ('content', 'login', 'user_subscribe'); $document->dataMerge ('sectionCart_contentPleaseConnect'); return; } // please connect if (isset ($document->session['order'])) return self::action_view_order ($document); } // function dispatch static function action_view_order ($document) { // function action_view_order $formulary = $document->createFormulary ('sectionCart_choosePaymentMethod', array (), 'method'); if ($formulary->command ('next') and $formulary->save ()) { // next $document->application = $document->application->child ($formulary->data['account'])->child ($formulary->data['method']); $document->application->dispatch ($document); return; } // next $document->mod->list = new eclMod_sectionCart_order ($document); $document->mod->formulary = $formulary; } // function action_view_order static function remove ($me) { // function remove } // function remove } // class eclApp_sectionCart //!eof:library/sectionCart/eclApp_sectionCart.php; //!file:library/sectionCart/eclApp_sectionCart_preload.php; class eclApp_sectionCart_preload { // class eclApp_sectionCart_preload static function is_child ($me, $name) { // function is_child if ($name == 'cart') 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 } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; if ($document->actions ('cart', 'timeout')) { // cart timeout unset ($document->session['cart_' . $document->domain->name]); if (isset ($document->domain->data['flags']['modCart_type']) and $document->domain->data['flags']['modCart_type'] == 'bag') $bag = 1; else $bag = ''; $document->mod->humperstilshen->dialog ('sectionCart_alertTimeout', array ('alert' => 1, 'bag' => $bag)); return; } // cart timeout $received = $document->received; if (!isset ($received['id']) or !intval ($received['id'])) return; $data = $store->domainContent->openById ($document->domain->domainId, intval ($received['id'])); if (!$data or !$data['value'] or !isset ($data['local']['product_price'])) return; if (isset ($received['quantity']) and intval ($received['quantity'])) $quantity = $received['quantity']; else $quantity = 1; preg_match ('/([0-9]+)[,][0]?([0-9]+)/', $data['local']['product_price'], $match); $value = floatval ($match[1]) + (floatval ($match[2]) / 100); $cart = 'cart_' . $document->domain->name; if (!isset ($document->session[$cart])) $document->session[$cart] = array(); if (!isset ($document->session[$cart]['start_time'])) $document->session[$cart]['start_time'] = TIME; if (!isset ($document->session[$cart]['order'])) $document->session[$cart]['order'] = array(); $document->session[$cart]['order'][] = array ( 'domain_id' => $data['domain_id'], 'id' => $data['id'], 'caption' => $data['text']['caption'], 'value' => $value, 'quantity' => $quantity ); } // function dispatch } // class eclApp_sectionCart_preload //!eof:library/sectionCart/eclApp_sectionCart_preload.php; //!file:library/sectionCart/eclMod_sectionCart_order.php; class eclMod_sectionCart_order { // class eclMod_sectionCart_order 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['local']['list'] = 'table_simple'; $row = $mod->appendChild (); $row->appendChild ('sectionCart_listCode'); $row->appendChild ('sectionCart_listDescription'); $row->appendChild ('sectionCart_listPrice'); $row->appendChild ('sectionCart_listQuantity'); $row->appendChild ('sectionCart_listValue'); $row->appendChild ('sectionCart_listAction'); $order = $document->session['order']; $remove = 0; if (isset ($document->actions['product'][2]) and $document->actions['product'][1] == 'remove' and intval ($document->actions['product'][2])) $remove = $document->actions['product'][2]; $total = 0; foreach ($order as $key => $product) { // each product if ($remove and $product['id'] == $remove) { // remove product unset ($document->session['order'][$key]); continue; } // remove product $data = $store->domainContent->openById ($product['domain_id'], $product['id']); if (!isset ($data['local']['product_price'])) { // remove product unset ($document->session['order'][$key]); continue; } // remove product $price = $data['local']['product_price']; $total += $price * $product['quantity']; $row = $mod->appendChild (); if (isset ($data['local']['product_code'])) $row->appendChild (array ( 'caption' => $document->textMerge ($data['local']['code']) )); else $row->appendChild (array ( 'caption' => $document->textMerge ('-') )); $row->appendChild (array ( 'caption' => $data['text']['title'] )); $row->appendChild (array ( 'caption' => $document->textMerge ($price) )); $row->appendChild (array ( 'caption' => $document->textMerge ($product['quantity']) )); $row->appendChild (array ( 'caption' => $document->textMerge ($product['quantity'] * $price) )); $row->appendChild ('labels/action/remove') ->url (true, true, '_product-remove-' . $product['id']); } // each product // total $row = $mod->appendChild (); $row->appendChild ('sectionCart_listTotal', array ( 'rowspan' => 4 )); $row->appendChild (array ( 'caption' => $document->textMerge ($total) )); $mod->enabled = true; } // function setModule } // class eclMod_sectionCart_order //!eof:library/sectionCart/eclMod_sectionCart_order.php; //!file:library/sectionCart/order/eclApp_sectionCart_order.php; class eclApp_sectionCart_order { // class eclApp_sectionCart_order static function is_child ($me, $name) { // function is_child global $store; $data = $store->domainComplement->openById ($me->domainId, intval ($name)); if ($data and $data['mode'] == MODE_ORDER) 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 } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionCart_order //!eof:library/sectionCart/order/eclApp_sectionCart_order.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') ->url ($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 = $document->render->block ('modules/list'); $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 () ->url ($child->pathway); } // each child if (!$row->children) return; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'list'); $mod->data['local']['personalite_url'] = $document->url ($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; if ($store->domainContent->open ($me->domainId, '-' . $me->parent->id . '-done')) { // custom content $me->data = &$store->domainContent->open ($me->domainId, '-' . $me->parent->id . '-done'); $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 global $store; $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); // 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')) ->url (true, true, '_message-custom'); } // default tools else { // custom tools // context edit $document->mod->context->appendChild ('sectionFormulary_done_edit') ->active ($document->actions ('message', 'edit')) ->url (true, true, '_message-edit'); // Versioning $store->domainExtras->versioning ($document); // context restore $document->mod->context->appendChild ('sectionFormulary_done_restore') ->url (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; $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $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 global $store; $me = $document->application; $formulary = $document->createF