log)) $io->log->addMessage ($class_name . ' not found', 'autoload'); eval ('class ' . $class_name . '{ public $is_phantom = true; }'); } // not found else { // not found if (isset ($io->log)) $io->log->addMessage ($class_name . ' not found', 'autoload'); eval ('class ' . $class_name . ' extends eclClass_' . strtolower( substr ($prefix, 3)) . '{ public $is_phantom = true; }'); } // not found return; } // do not include external scripts $ob_length = ob_get_length(); if (is_file (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))); } $systemMap = 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', 'Tue, 19 Feb 2019 18:09:05 -0300'); //!end_of_packager_settings //!packager:start_of_map $systemMap = array ( 'admin' => array('adminIndex', 'adminAlerts', 'adminUsers', 'adminDomains', 'adminSystem', 'adminDatabase', 'adminIntegrations', 'adminComponents', 'adminTools', 'domainIcons', 'domainScripts', 'domainStyles', 'adminDefault'), 'adminAlerts' => array('adminAlerts_log'), 'domain' => array('domainIndex', 'section', 'section_create', 'domainFiles', 'domainGlossary', 'domainIcons', 'domainInfo', 'domainRecents', 'domainScripts', 'domainSearch', 'domainStyles', 'domainSubscription', 'personalite', 'tool', 'userJoin', 'domainSitemap', 'domainDefault'), 'integration' => array('integrationGoogleWebmasters', 'integrationRSS', 'integrationSMS', 'integrationSMTP'), 'personalite' => array('personaliteApearance', 'personaliteDetails', 'personaliteExtras', 'personaliteInstall', 'personaliteModules', 'personaliteObjects', 'personaliteTemplate', 'personaliteExport'), 'section_create' => array('sectionFolder_create', 'sectionCart_create', 'sectionBlog_create', 'sectionCategories_create', 'sectionSearch_create', 'sectionAbout_create', 'sectionHistoric_create', 'sectionBranch_create', 'sectionMission_create', 'sectionStatute_create', 'sectionTeam_create', 'sectionCourse_create', 'sectionAVA_create', 'sectionQuestionsBank_create', 'sectionAdministration_create', 'sectionChart_create', 'sectionDoc_create', 'sectionAudit_create', 'sectionFinancial_create', 'sectionFormulary_create', 'sectionGlossary_create', 'sectionInfo_create', 'sectionLogin_create', 'sectionSubdomains_create', 'sectionTerms_create', 'sectionMenu_create', 'sectionRedirect_create'), 'system' => array('systemShared', 'user', 'systemInstallation', 'admin', 'domain', 'domainCreate', 'systemAccessDenied', 'systemPreload', 'systemDefault'), 'systemPreload' => array('sectionCart_preload', 'modEditor'), 'tool' => array('toolConfig', 'financial', 'integration'), 'user' => array('userIndex', 'userAnonimous', 'userHome', 'userAdmin', 'userJoin', 'userRecoverPassword', 'domainIcons', 'domainScripts', 'domainStyles', 'userDefault'), 'userHome' => array('userHome_index', 'home', 'home_create', 'userHome_alerts', 'userHome_password', 'userHome_personal', 'userHome_mail', 'userHome_phone', 'userHome_welcome', 'userHome_default'), 'userHome_alerts' => array('userHome_alerts_phone', 'userHome_alerts_mail') ); //!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', 'pathDatabase' => '14598:822', 'pathDomains' => '15420:695', 'pathEngine' => '16115:734', 'pathLibrary' => '16849:783', 'pathProfiles' => '17632:744', 'pathShared' => '18376:886', 'pathTemplates' => '19262:1013', 'systemAdminUri' => '20275:1320', 'systemDefaultCharset' => '21595:1162', 'systemDefaultCharsetIso88591' => '22757:216', 'systemDefaultCharsetUtf8' => '22973:133', 'systemDefaultCurrency' => '23106:690', 'systemDefaultDomainName' => '23796:1027', 'systemDefaultLanguage' => '24823:701', 'systemDisplayErrors' => '25524:919', 'systemEnableUserDomains' => '26443:758', 'systemEnableUserSubscriptions' => '27201:780', 'systemHost' => '27981:660', 'systemHostingMode' => '28641:1871', 'systemHostingModePortal' => '30512:169', 'systemHostingModeSingle' => '30681:172', 'systemHostingModeSubfolders' => '30853:180', 'systemHttpsRedirect' => '31033:1218', 'systemLogErrors' => '32251:739', 'systemPackedMapFirst' => '32990:1264', 'systemPackedSharedFirst' => '34254:1186', 'systemProfilesUri' => '35440:1244', 'systemProjectCaption' => '36684:721', 'systemProjectRef' => '37405:749', 'systemRewriteEngine' => '38154:2248', 'systemSessionCacheExpire' => '40402:1012', 'systemSessionTTL' => '41414:738', 'systemTimeLimit' => '42152:853', 'systemTimezone' => '43005:13331', 'trackingEnable' => '56336:1522', 'trackingGeoipCache' => '57858:855', 'trackingGeoipCache1month' => '58713:157', 'trackingGeoipCache3months' => '58870:160', 'trackingGeoipCache6months' => '59030:160', 'trackingGeoipCacheNoExpire' => '59190:165', 'trackingGeoipEnable' => '59355:819', 'trackingGeoipService' => '60174:986', 'trackingRemovedPages' => '61160:673', 'trackingStoreFullBacktrace' => '61833:1045' ), 'adminAlerts' => array ( 'help' => '62878:521', 'main' => '63399:241', 'mainEmpty' => '63640:162' ), 'adminAlerts_log' => array ( 'database' => '63802:352', 'databasedisabled' => '64154:313', 'php' => '64467:305' ), 'adminComponents' => array ( 'content' => '64772:227', 'contentEmpty' => '64999:292', 'helpAbout' => '65291:555' ), 'adminDatabase' => array ( 'content' => '65846:243', 'edit' => '66089:141', 'editMsg' => '66230:549', 'editSubmit' => '66779:204' ), 'adminDatabase_config' => array ( 'content' => '66983:299', 'edit' => '67282:392', 'editMessage' => '67674:314' ), 'adminDatabase_log' => array ( 'content' => '67988:269', 'edit' => '68257:242', 'editLogClear' => '68499:225', 'editLogView' => '68724:196' ), 'adminDatabase_query' => array ( 'content' => '68920:241', 'edit' => '69161:122', 'editInput' => '69283:219', 'editResult' => '69502:268' ), 'adminDefault' => array ( 'content' => '69770:547' ), 'adminDomains' => array ( 'content' => '70317:227', 'contentDisabled' => '70544:443', 'contentEmpty' => '70987:180', 'edit' => '71167:140', 'editMsg' => '71307:541', 'editSubmit' => '71848:204' ), 'adminDomains_add' => array ( 'content' => '72052:255', 'edit' => '72307:265', 'editAdmin' => '72572:339', 'editAdminRequired' => '72911:371', 'editDefaultLanguage' => '73282:281', 'editDescription' => '73563:209', 'editName' => '73772:268', 'editNameAlreadyExists' => '74040:385', 'editNameInvalidChars' => '74425:532', 'editNameSoLong' => '74957:415', 'editTitle' => '75372:284' ), 'adminDomains_details' => array ( 'alertAdminAlreadyExists' => '75656:397', 'alertAdminPleaseSelect' => '76053:419', 'alertAdminRemoveError' => '76472:327', 'alertAdminRemoveLast' => '76799:463', 'alertAdminRequired' => '77262:371', 'content' => '77633:267', 'contextRemove' => '77900:141', 'contextRemoveConfirm' => '78041:1044', 'contextRemoveConfirmError' => '79085:430', 'contextRemoveConfirmOk' => '79515:256', 'edit' => '79771:507', 'editAdminAddName' => '80278:297', 'editAdminAddSubmit' => '80575:147', 'editAdminRemoveList' => '80722:319', 'editAdminRemoveSubmit' => '81041:154', 'editCaption' => '81195:284', 'editCurrency' => '81479:258', 'editDefaultLanguage' => '81737:281', 'editDescription' => '82018:209', 'editName' => '82227:233', 'editStatus' => '82460:379', 'editStatusAlert' => '82839:160', 'editStatusDefault' => '82999:160', 'editStatusDisabled' => '83159:165', 'editStatusReserved' => '83324:178', 'editStatusWaiting' => '83502:188', 'editTitle' => '83690:284', 'editUpdate' => '83974:145' ), 'adminIndex' => array ( 'content' => '84119:1163', 'helpAbout' => '85282:722' ), 'adminIntegrations' => array ( 'content' => '86004:213', 'contentEmpty' => '86217:284', 'helpAbout' => '86501:547' ), 'adminSystem' => array ( 'content' => '87048:223' ), 'adminSystem_admin' => array ( 'content' => '87271:253', 'edit' => '87524:360' ), 'adminSystem_eval' => array ( 'content' => '87884:271', 'edit' => '88155:103', 'editEvalInput' => '88258:190' ), 'adminSystem_extract' => array ( 'content' => '88448:970', 'edit' => '89418:613', 'editBackupFilename' => '90031:389', 'editCreateBackup' => '90420:308', 'editDataExtension' => '90728:437', 'editDataExtensionEcl' => '91165:197', 'editDataExtensionJson' => '91362:154', 'editIndentStart' => '91516:420', 'editIndentStart1' => '91936:161', 'editIndentStart2' => '92097:161', 'editIndentStart3' => '92258:187', 'editIndentString' => '92445:415', 'editIndentString2spaces' => '92860:162', 'editIndentString4spaces' => '93022:169', 'editIndentStringTab' => '93191:147', 'editNlMode' => '93338:350', 'editNlModeLinux' => '93688:127', 'editNlModeWindows' => '93815:133', 'editScriptAccessibility' => '93948:329', 'editSubmit' => '94277:214' ), 'adminSystem_hosting' => array ( 'content' => '94491:233', 'edit' => '94724:501' ), 'adminSystem_log' => array ( 'content' => '95225:250', 'edit' => '95475:281', 'editLogClear' => '95756:225', 'editLogView' => '95981:186' ), 'adminSystem_pack' => array ( 'alertFinished' => '96167:317', 'content' => '96484:634', 'edit' => '97118:172', 'editClearServer' => '97290:287', 'editExportFilename' => '97577:371', 'editPackMediaFiles' => '97948:323', 'editSubmit' => '98271:206' ), 'adminSystem_server' => array ( 'content' => '98477:225', 'edit' => '98702:205' ), 'adminSystem_setup' => array ( 'content' => '98907:286', 'edit' => '99193:361' ), 'adminSystem_update' => array ( 'content' => '99554:237', 'edit' => '99791:102', 'editSendFile' => '99893:201' ), 'adminUsers' => array ( 'adminProfile' => '100094:118', 'adminProfileButtom' => '100212:229', 'adminProfileMsg' => '100441:881', 'alertPasswordInvalidCharacter' => '101322:680', 'alertPasswordRepeatError' => '102002:384', 'alertPasswordRequired' => '102386:364', 'alertUserAlreadyExists' => '102750:429', 'alertUserInvalidName' => '103179:657', 'alertUserNameRequired' => '103836:658', 'content' => '104494:223', 'contentDisabled' => '104717:443', 'contentEmpty' => '105160:178', 'createFolder' => '105338:158', 'createFolderButtom' => '105496:204', 'createFolderMsg' => '105700:537', 'editAddress' => '106237:249', 'editBornDate' => '106486:276', 'editCaption' => '106762:302', 'editCPF' => '107064:218', 'editDescription' => '107282:292', 'editGender' => '107574:370', 'editGenderFemale' => '107944:157', 'editGenderMale' => '108101:156', 'editGenderUndefined' => '108257:184', 'editMail' => '108441:225', 'editName' => '108666:283', 'editPassword' => '108949:224', 'editPassword2' => '109173:171', 'editPhone' => '109344:231', 'editTitle' => '109575:255' ), 'adminUsers_add' => array ( 'content' => '109830:249', 'edit' => '110079:359' ), 'adminUsers_details' => array ( 'content' => '110438:263', 'edit' => '110701:401', 'editComments' => '111102:270', 'editName' => '111372:173', 'editPassword' => '111545:205', 'editPasswordDescription' => '111750:319', 'removeConfirmErrorF' => '112069:428', 'removeConfirmErrorM' => '112497:428', 'removeConfirmF' => '112925:1028', 'removeConfirmM' => '113953:1023', 'removeConfirmOkF' => '114976:250', 'removeConfirmOkM' => '115226:250', 'removeF' => '115476:139', 'removeM' => '115615:139' ), 'domain_disabled' => array ( 'content' => '115754:920' ), 'domain_empty' => array ( 'content' => '116674:1149', 'edit' => '117823:647', 'editCaption' => '118470:356', 'editContent' => '118826:418', 'editDescription' => '119244:338', 'editKeywords' => '119582:224', 'editKeywordsPack' => '119806:102', 'editTitle' => '119908:813', 'templateForNewDomain' => '120721:265' ), 'domainCreate' => array ( 'content' => '120986:1225', 'contentCreate' => '122211:333', 'edit' => '122544:248', 'editCaption' => '122792:546', 'editDescription' => '123338:511', 'editTitle' => '123849:464' ), 'domainDefault' => array ( 'content' => '124313:628', 'custom' => '124941:291', 'edit' => '125232:664', 'editCaption' => '125896:334', 'editContent' => '126230:354', 'editRecognizeEcolabore' => '126584:275', 'editRecognizeHTML' => '126859:237', 'editRecognizeParagraphs' => '127096:267', 'editTitle' => '127363:266', 'editUpdated' => '127629:167', 'helpAbout' => '127796:503', 'helpTip' => '128299:624', 'restore' => '128923:303' ), 'domainGlossary' => array ( 'content' => '129226:532', 'helpAbout' => '129758:550' ), 'domainGlossary_keyword' => array ( 'content' => '130308:707', 'edit' => '131015:448', 'editCaption' => '131463:148', 'editContent' => '131611:351', 'editKeywordsPack' => '131962:52', 'editTitle' => '132014:266', 'editUpdated' => '132280:167', 'helpAbout' => '132447:895', 'remove' => '133342:140', 'removeConfirm' => '133482:560' ), 'domainIcons' => array ( 'layout' => '134042:367' ), 'domainIndex' => array ( 'contentEdit' => '134409:197', 'edit' => '134606:616', 'editCaption' => '135222:356', 'editContent' => '135578:418', 'editDescription' => '135996:338', 'editKeywords' => '136334:180', 'editKeywordsPack' => '136514:102', 'editList' => '136616:280', 'editListRecents' => '136896:284', 'editListSections' => '137180:295', 'editTitle' => '137475:813', 'editUpdated' => '138288:167', 'helpAbout' => '138455:637', 'helpNavigate' => '139092:391', 'helpTip' => '139483:662', 'mainSections' => '140145:640' ), 'domainInfo' => array ( 'content' => '140785:1010', 'list' => '141795:134', 'view' => '141929:264', 'viewAddress' => '142193:229', 'viewCaption' => '142422:203', 'viewDescription' => '142625:203', 'viewMail' => '142828:240', 'viewPhone' => '143068:223', 'viewTitle' => '143291:198' ), 'domainRecents' => array ( 'content' => '143489:145', 'helpAbout' => '143634:371', 'helpTip' => '144005:442', 'link' => '144447:290' ), 'domainRecents_rss' => array ( 'layout' => '144737:682' ), 'domainSearch' => array ( 'content' => '145419:227', 'help' => '145646:767', 'msgNoResults' => '146413:207', 'search' => '146620:134', 'searchInput' => '146754:260', 'searchSubmit' => '147014:190', 'searchTagOnly' => '147204:260' ), 'domainSitemap' => array ( 'layout' => '147464:272' ), 'domainStyles' => array ( 'preset' => '147736:8474' ), 'integration' => array ( 'content' => '156210:345' ), 'integrationGoogleWebmasters' => array ( 'content' => '156555:313', 'create' => '156868:100', 'createFile' => '156968:235', 'view' => '157203:130', 'viewFileContent' => '157333:225', 'viewFileName' => '157558:243' ), 'integrationRSS' => array ( 'content' => '157801:250', 'edit' => '158051:126', 'editRssEnable' => '158177:344', 'editRssMax' => '158521:356' ), 'integrationSMS' => array ( 'content' => '158877:237', 'contentDisabled' => '159114:181', 'contentEnabled' => '159295:178' ), 'integrationSMS_config' => array ( 'content' => '159473:294', 'edit' => '159767:145', 'editPass' => '159912:332', 'editServiceEnable' => '160244:1050', 'editUser' => '161294:330' ), 'integrationSMS_test' => array ( 'content' => '161624:252', 'edit' => '161876:145', 'editPass' => '162021:332', 'editServiceEnable' => '162353:1050', 'editUser' => '163403:330' ), 'integrationSMTP' => array ( 'content' => '163733:253' ), 'integrationSMTP_config' => array ( 'alertDisabled' => '163986:617', 'alertLoginError' => '164603:564', 'alertSendingError' => '165167:362', 'alertSocketError' => '165529:539', 'alertToError' => '166068:375', 'content' => '166443:296', 'edit' => '166739:307', 'integrationSmtpEnable' => '167046:895', 'integrationSmtpFrom' => '167941:324', 'integrationSmtpHost' => '168265:323', 'integrationSmtpPassword' => '168588:332', 'integrationSmtpPort' => '168920:320', 'integrationSmtpTTL' => '169240:352', 'integrationSmtpUser' => '169592:322' ), 'integrationSMTP_test' => array ( 'content' => '169914:252', 'edit' => '170166:196', 'editBcc' => '170362:258', 'editCc' => '170620:258', 'editHtml' => '170878:270', 'editSubject' => '171148:256', 'editText' => '171404:277', 'editTo' => '171681:238', 'view' => '171919:94', 'viewLog' => '172013:258' ), 'modAudio' => array ( 'edit' => '172271:349', 'editAudio' => '172620:207', 'editDescription' => '172827:273', 'tabAudio' => '173100:231', 'tabCaption' => '173331:312', 'tabStyle' => '173643:344' ), 'modBanner' => array ( 'create' => '173987:731', 'edit' => '174718:375' ), 'modBox' => array ( 'content' => '175093:279', 'create' => '175372:682', 'edit' => '176054:319', 'editContent' => '176373:332', 'tabCaption' => '176705:268', 'tabContent' => '176973:235' ), 'modBreadcrumbs' => array ( 'edit' => '177208:452' ), 'modCart' => array ( 'edit' => '177660:373' ), 'modCart_scope' => array ( 'module' => '178033:323' ), 'modComments' => array ( 'edit' => '178356:453' ), 'modComments_add' => array ( 'edit' => '178809:379', 'form' => '179188:101', 'formAnonimous' => '179289:164', 'formComment' => '179453:353' ), 'modContent' => array ( 'edit' => '179806:379', 'post' => '180185:247' ), 'modContext' => array ( 'goChat' => '180432:189', 'goHelp' => '180621:181', 'help' => '180802:129', 'module' => '180931:126' ), 'modDinamic' => array ( 'content' => '181057:469', 'create' => '181526:708', 'edit' => '182234:468', 'listDirection' => '182702:324', 'listDirectionAsc' => '183026:163', 'listDirectionDesc' => '183189:167', 'listFilter' => '183356:369', 'listFilterNextEvents' => '183725:181', 'listFilterNone' => '183906:166', 'listFilterSpotlight' => '184072:182', 'listMax' => '184254:283', 'listOffset' => '184537:536', 'listUpdate' => '185073:425', 'listUpdateAuto' => '185498:164', 'listUpdateDay' => '185662:166', 'listUpdateHits' => '185828:172', 'listUpdateHour' => '186000:169', 'listUpdateMonth' => '186169:170', 'listUpdateWeek' => '186339:172', 'sort' => '186511:487', 'sortByCreated' => '186998:177', 'sortByEventStart' => '187175:184', 'sortByHits' => '187359:182', 'sortByIndex' => '187541:172', 'sortByLastComment' => '187713:191', 'sortByName' => '187904:152', 'sortByUpdated' => '188056:181', 'sortByValue' => '188237:157', 'sortShuffled' => '188394:164', 'tabSort' => '188558:318' ), 'modEditor' => array ( 'contextWisiwygDisable' => '188876:152', 'contextWisiwygEnable' => '189028:148', 'module' => '189176:1157' ), 'modEditor_document' => array ( 'module' => '190333:423', 'save' => '190756:142' ), 'modEditor_insert' => array ( 'editor' => '190898:1150', 'editorA' => '192048:223', 'editorAudio' => '192271:188', 'editorBox' => '192459:208', 'editorFile' => '192667:191', 'editorH1' => '192858:238', 'editorH2' => '193096:238', 'editorH3' => '193334:238', 'editorH4' => '193572:238', 'editorH5' => '193810:238', 'editorH6' => '194048:238', 'editorHR' => '194286:233', 'editorHtml' => '194519:198', 'editorImg' => '194717:187', 'editorLA' => '194904:249', 'editorLO' => '195153:246', 'editorLU' => '195399:251', 'editorP' => '195650:238', 'editorTable' => '195888:188', 'editorVideo' => '196076:188', 'module' => '196264:787' ), 'modEditor_objects' => array ( 'audio' => '197051:121', 'box' => '197172:134', 'file' => '197306:122', 'html' => '197428:140', 'img' => '197568:122', 'module' => '197690:146', 'ofBanner' => '197836:144', 'ofPage' => '197980:127', 'ofPost' => '198107:125', 'ofSection' => '198232:130', 'table' => '198362:122', 'video' => '198484:121' ), 'modFile' => array ( 'content' => '198605:338', 'create' => '198943:599', 'edit' => '199542:349', 'editDescription' => '199891:273', 'editFile' => '200164:202', 'module' => '200366:180', 'tabCaption' => '200546:312', 'tabFile' => '200858:230', 'tabStyle' => '201088:344', 'uploadFile' => '201432:203' ), 'modFooter' => array ( 'create' => '201635:528', 'edit' => '202163:355', 'editContent' => '202518:332', 'tabContent' => '202850:235' ), 'modFormulary' => array ( 'edit' => '203085:362' ), 'modFormulary_view' => array ( 'edit' => '203447:369' ), 'modHits' => array ( 'edit' => '203816:413' ), 'modHtml' => array ( 'content' => '204229:316', 'create' => '204545:641', 'edit' => '205186:308', 'editHtml' => '205494:239', 'tabCaption' => '205733:312', 'tabHtml' => '206045:199' ), 'modHumperstilshen' => array ( 'iconAlert' => '206244:193', 'iconCrash' => '206437:179', 'iconDefault' => '206616:154', 'iconError' => '206770:203', 'iconHappy' => '206973:183', 'iconQuestion' => '207156:189', 'iconTip' => '207345:178', 'iconWelcome' => '207523:189', 'iconWhait' => '207712:182', 'sessionCheck' => '207894:660', 'sessionCheckSubmit' => '208554:134', 'sessionCheckSubmitConfirm' => '208688:282', 'showAlert' => '208970:164', 'showTip' => '209134:156', 'submitCancel' => '209290:206', 'submitConfirm' => '209496:122', 'submitConfirmCancel' => '209618:122' ), 'modImg' => array ( 'content' => '209740:312', 'create' => '210052:642', 'edit' => '210694:348', 'editDescription' => '211042:273', 'editImg' => '211315:277', 'imgFilterBrightness' => '211592:398', 'imgFilterContrast' => '211990:394', 'imgFilterHueRotate' => '212384:394', 'imgFilterSaturate' => '212778:394', 'tabCaption' => '213172:312', 'tabFilters' => '213484:308', 'tabImg' => '213792:229', 'tabStyle' => '214021:344' ), 'modInstructor' => array ( 'module' => '214365:2153' ), 'modInstructor_quality' => array ( 'helpNavigate' => '216518:308', 'helpRedirect' => '216826:409', 'index' => '217235:391' ), 'modInterface' => array ( 'module' => '217626:129' ), 'modLanguages' => array ( 'edit' => '217755:449' ), 'modLayout' => array ( 'personaliteOff' => '218204:140', 'personaliteOn' => '218344:152', 'print' => '218496:150' ), 'modList' => array ( 'content' => '218646:160', 'edit' => '218806:476', 'listDirection' => '219282:324', 'listDirectionAsc' => '219606:163', 'listDirectionDesc' => '219769:167', 'listMax' => '219936:295', 'sort' => '220231:462', 'sortByCreated' => '220693:177', 'sortByEventStart' => '220870:184', 'sortByHits' => '221054:182', 'sortByIndex' => '221236:172', 'sortByLastComment' => '221408:191', 'sortByName' => '221599:152', 'sortByUpdated' => '221751:181', 'sortByValue' => '221932:157', 'tabSort' => '222089:248' ), 'modLogin' => array ( 'alertCookiesRequired' => '222337:375', 'alertInvalidLogin' => '222712:417', 'anonimous' => '223129:119', 'login' => '223248:179', 'loginName' => '223427:132', 'loginPassword' => '223559:137', 'loginSubmit' => '223696:229' ), 'modNavbar' => array ( 'edit' => '223925:475', 'specialHomeDisplay' => '224400:331', 'tabSpecial' => '224731:217' ), 'modNavbottom' => array ( 'edit' => '224948:445' ), 'modPages' => array ( 'edit' => '225393:452' ), 'modSearch' => array ( 'edit' => '225845:327', 'search' => '226172:132' ), 'modSort' => array ( 'edit' => '226304:358' ), 'modTable' => array ( 'content' => '226662:5016', 'edit' => '231678:333', 'list' => '232011:308', 'module' => '232319:55', 'moduleCreate' => '232374:741', 'tabApearance' => '233115:205', 'tabCaption' => '233320:318', 'tabContent' => '233638:219' ), 'modTable_new' => array ( 'content' => '233857:351', 'edit' => '234208:142', 'editCols' => '234350:264', 'editList' => '234614:308', 'editRows' => '234922:263' ), 'modTitle' => array ( 'edit' => '235185:334' ), 'modToolbox' => array ( 'module' => '235519:130' ), 'modUser' => array ( 'goAdmin' => '235649:205', 'goLogout' => '235854:134', 'goMain' => '235988:190', 'module' => '236178:158' ), 'modUser_alerts' => array ( 'module' => '236336:123' ), 'modUser_quoteoftheday' => array ( 'module' => '236459:391', 'quotes' => '236850:45066' ), 'modUser_subscribe' => array ( 'module' => '281916:419' ), 'modUser_tools' => array ( 'goPassword' => '282335:135', 'goPersonal' => '282470:132', 'module' => '282602:125' ), 'modUser_welcome' => array ( 'goEcolabore' => '282727:187', 'goHome' => '282914:161', 'goInfo' => '283075:151', 'goOrganization' => '283226:193', 'goPassword' => '283419:161', 'goProfiles' => '283580:132', 'goReport' => '283712:147', 'goServiceTerms' => '283859:151', 'goSubscribe' => '284010:140', 'module' => '284150:131' ), 'modVideo' => array ( 'content' => '284281:337', 'create' => '284618:738', 'edit' => '285356:349', 'editDescription' => '285705:273', 'editVideo' => '285978:207', 'tabCaption' => '286185:312', 'tabStyle' => '286497:344', 'tabVideo' => '286841:231', 'upload' => '287072:419', 'uploadVideo' => '287491:243' ), 'personalite' => array ( 'content' => '287734:432' ), 'personaliteApearance' => array ( 'content' => '288166:527', 'fieldsColor' => '288693:2083', 'fieldsFont' => '290776:3774', 'fieldsSelect' => '294550:879', 'layout' => '295429:5894' ), 'personaliteApearance_color' => array ( 'content' => '301323:46532' ), 'personaliteApearance_font' => array ( 'layout' => '347855:6066' ), 'personaliteApearance_scheme' => array ( '000defaultPadding' => '353921:183', '000defaultRounding' => '354104:179', '000noPadding' => '354283:176', '000noRounding' => '354459:172', '010' => '354631:118', '020' => '354749:118', '030' => '354867:118', '040' => '354985:118', '050' => '355103:118', '060' => '355221:118', '080' => '355339:118', 100 => '355457:114', 125 => '355571:120', 150 => '355691:118', 175 => '355809:120', 200 => '355929:114', 'activeBackgroundColor' => '356043:389', 'activeTextColor' => '356432:354', 'buttonBackgroundColor' => '356786:392', 'buttonBorderRadius' => '357178:623', 'buttonTextColor' => '357801:357', 'cardActiveColor' => '358158:356', 'cardBackgroundColor' => '358514:369', 'cardBorderColor' => '358883:350', 'cardBorderRadius' => '359233:681', 'cardCaptionColor' => '359914:349', 'cardHeaderColor' => '360263:344', 'cardLinkColor' => '360607:334', 'cardMarkColor' => '360941:350', 'cardPadding' => '361291:651', 'cardTextColor' => '361942:333', 'defaultBorderRadius' => '362275:577', 'defaultPadding' => '362852:575', 'documentActiveColor' => '363427:368', 'documentBackgroundColor' => '363795:381', 'documentBorderColor' => '364176:362', 'documentCaptionColor' => '364538:361', 'documentHeaderColor' => '364899:356', 'documentLinkColor' => '365255:346', 'documentMarkColor' => '365601:362', 'documentTextColor' => '365963:345', 'edit' => '366308:256', 'focusBackgroundColor' => '366564:387', 'focusTextColor' => '366951:352', 'fontBar' => '367303:386', 'fontBlockquote' => '367689:385', 'fontBlockquoteExample' => '368074:373', 'fontButton' => '368447:383', 'fontCaption' => '368830:407', 'fontFootnote' => '369237:369', 'fontFootnoteExample' => '369606:281', 'fontHeader' => '369887:356', 'fontInput' => '370243:404', 'fontLabel' => '370647:410', 'fontLegend' => '371057:404', 'fontLink' => '371461:318', 'fontMonospace' => '371779:434', 'fontMonospaceExample' => '372213:369', 'fontText' => '372582:345', 'formularyActiveColor' => '372927:371', 'formularyBackgroundColor' => '373298:384', 'formularyBorderColor' => '373682:365', 'formularyBorderRadius' => '374047:696', 'formularyCaptionColor' => '374743:364', 'formularyHeaderColor' => '375107:359', 'formularyLinkColor' => '375466:349', 'formularyMarkColor' => '375815:365', 'formularyPadding' => '376180:666', 'formularyTextColor' => '376846:348', 'inputBackgroundColor' => '377194:390', 'inputBorderRadius' => '377584:620', 'inputTextColor' => '378204:355', 'navActiveColor' => '378559:353', 'navBackgroundColor' => '378912:366', 'navBorderColor' => '379278:347', 'navBorderRadius' => '379625:678', 'navCaptionColor' => '380303:346', 'navHeaderColor' => '380649:341', 'navLinkColor' => '380990:331', 'navMarkColor' => '381321:347', 'navPadding' => '381668:648', 'navTextColor' => '382316:330', 'panelActiveColor' => '382646:359', 'panelBackgroundColor' => '383005:372', 'panelBorderColor' => '383377:353', 'panelBorderRadius' => '383730:684', 'panelCaptionColor' => '384414:352', 'panelHeaderColor' => '384766:347', 'panelLinkColor' => '385113:337', 'panelMarkColor' => '385450:353', 'panelPadding' => '385803:654', 'panelTextColor' => '386457:336', 'spotlightActiveColor' => '386793:371', 'spotlightBackgroundColor' => '387164:384', 'spotlightBorderColor' => '387548:365', 'spotlightBorderRadius' => '387913:696', 'spotlightCaptionColor' => '388609:364', 'spotlightHeaderColor' => '388973:359', 'spotlightLinkColor' => '389332:349', 'spotlightMarkColor' => '389681:365', 'spotlightPadding' => '390046:666', 'spotlightTextColor' => '390712:348', 'systemActiveColor' => '391060:362', 'systemBackgroundColor' => '391422:375', 'systemBorderColor' => '391797:356', 'systemBorderRadius' => '392153:687', 'systemCaptionColor' => '392840:355', 'systemHeaderColor' => '393195:350', 'systemLinkColor' => '393545:340', 'systemMarkColor' => '393885:356', 'systemPadding' => '394241:657', 'systemTextColor' => '394898:339', 'tabButton' => '395237:719', 'tabCard' => '395956:958', 'tabDocument' => '396914:1025', 'tabFonts' => '397939:1251', 'tabFormulary' => '399190:1043', 'tabNav' => '400233:944', 'tabPanel' => '401177:963', 'tabSpotlight' => '402140:1076', 'tabSystem' => '403216:1111' ), 'personaliteDetails' => array ( 'main' => '404327:315' ), 'personaliteDetails_configure' => array ( 'edit' => '404642:464', 'editCaption' => '405106:265', 'editDescription' => '405371:254', 'editHTML' => '405625:256', 'editName' => '405881:259', 'tabCaption' => '406140:272', 'tabHTML' => '406412:199' ), 'personaliteExport' => array ( 'content' => '406611:434', 'edit' => '407045:159', 'editComponentsList' => '407204:185', 'editContent' => '407389:331', 'editName' => '407720:291' ), 'personaliteExtras' => array ( 'edit' => '408011:316' ), 'personaliteExtras_upload' => array ( 'audio' => '408327:511', 'audioAjaxSend' => '408838:269', 'fieldEnd' => '409107:144', 'fieldFileBig' => '409251:1567', 'fieldStart' => '410818:190', 'file' => '411008:512', 'fileAjaxSend' => '411520:259', 'layout' => '411779:253', 'video' => '412032:511', 'videoAjaxSend' => '412543:269' ), 'personaliteFields' => array ( 'add' => '412812:98', 'alertShareUserDataRequest' => '412910:583', 'close' => '413493:612', 'content' => '414105:541', 'editCaption' => '414646:262', 'editRequired' => '414908:259', 'editType' => '415167:131', 'load' => '415298:711', 'module' => '416009:254' ), 'personaliteFields_address' => array ( 'content' => '416263:211', 'edit' => '416474:238', 'editType' => '416712:137', 'editUseUserAddress' => '416849:345', 'preset' => '417194:128' ), 'personaliteFields_checkbox' => array ( 'content' => '417322:239', 'edit' => '417561:165', 'editType' => '417726:138', 'preset' => '417864:34', 'valueNo' => '417898:108', 'valueYes' => '418006:109' ), 'personaliteFields_created' => array ( 'content' => '418115:235', 'edit' => '418350:145', 'preset' => '418495:137', 'value' => '418632:145' ), 'personaliteFields_descriptive' => array ( 'content' => '418777:249', 'edit' => '419026:228', 'editContent' => '419254:319', 'editDisplayWhenEditingOnly' => '419573:323', 'editType' => '419896:142', 'preset' => '420038:38' ), 'personaliteFields_mail' => array ( 'alertInvalidMail' => '420076:588', 'alertMultipleNotAllowed' => '420664:476', 'content' => '421140:245', 'edit' => '421385:235', 'editType' => '421620:134', 'editUseUserMail' => '421754:336', 'preset' => '422090:112' ), 'personaliteFields_phone' => array ( 'alertInvalidAreaCode' => '422202:625', 'alertInvalidCountryCode' => '422827:673', 'alertInvalidNumber' => '423500:655', 'content' => '424155:207', 'edit' => '424362:236', 'editType' => '424598:135', 'editUseUserPhone' => '424733:341', 'preset' => '425074:124' ), 'personaliteFields_radio' => array ( 'content' => '425198:241', 'edit' => '425439:277', 'editType' => '425716:135', 'preset' => '425851:54' ), 'personaliteFields_select' => array ( 'content' => '425905:237', 'edit' => '426142:234', 'editExplain' => '426376:203', 'editFields' => '426579:111', 'editType' => '426690:136', 'preset' => '426826:56' ), 'personaliteFields_separator' => array ( 'content' => '426882:217', 'edit' => '427099:165', 'editType' => '427264:139', 'preset' => '427403:109' ), 'personaliteFields_status' => array ( 'content' => '427512:205', 'edit' => '427717:145', 'preset' => '427862:138' ), 'personaliteFields_text' => array ( 'content' => '428000:227', 'edit' => '428227:207', 'editType' => '428434:134', 'preset' => '428568:30' ), 'personaliteFields_textarea' => array ( 'content' => '428598:273', 'edit' => '428871:207', 'editType' => '429078:138', 'preset' => '429216:83' ), 'personaliteInstall' => array ( 'content' => '429299:436', 'edit' => '429735:106', 'editFiles' => '429841:188', 'select' => '430029:113', 'selectComponents' => '430142:228' ), 'personaliteModules' => array ( '000auto' => '430370:160', '000noPadding' => '430530:177', '012rem' => '430707:159', '025rem' => '430866:170', '050rem' => '431036:166', '075rem' => '431202:170', '083rem' => '431372:170', '091rem' => '431542:170', '100rem' => '431712:157', '110rem' => '431869:163', '125rem' => '432032:167', '150rem' => '432199:163', '200rem' => '432362:159', '250rem' => '432521:166', '300rem' => '432687:159', 'alignBottom' => '432846:160', 'alignCenter' => '433006:165', 'alignLeft' => '433171:155', 'alignRight' => '433326:159', 'alignTop' => '433485:151', 'boxDisplay' => '433636:347', 'boxPadding' => '433983:540', 'boxRounded' => '434523:543', 'boxRoundedElipse' => '435066:155', 'boxRoundedOff' => '435221:187', 'boxScheme' => '435408:528', 'boxSchemeAuto' => '435936:165', 'boxSchemeCard' => '436101:154', 'boxSchemeFormulary' => '436255:169', 'boxSchemeNav' => '436424:177', 'boxSchemePanel' => '436601:156', 'boxSchemeSpotlight' => '436757:166', 'boxSchemeSystem' => '436923:159', 'boxShadow' => '437082:433', 'boxShadowAuto' => '437515:165', 'boxShadowOff' => '437680:181', 'boxShadowOn' => '437861:183', 'boxShadowSmoke' => '438044:176', 'boxSize' => '438220:527', 'caption' => '438747:246', 'captionDisplay' => '438993:305', 'captionLegend' => '439298:318', 'contentNotConfigurable' => '439616:465', 'details' => '440081:207', 'detailsHorizontalAlign' => '440288:449', 'detailsHorizontalSpacing' => '440737:623', 'detailsSpacing000' => '441360:171', 'detailsSpacing006' => '441531:124', 'detailsSpacing012' => '441655:125', 'detailsSpacing025' => '441780:124', 'detailsSpacing037' => '441904:125', 'detailsSpacing050' => '442029:123', 'detailsSpacing075' => '442152:125', 'detailsSpacing100' => '442277:122', 'detailsVerticalAlign' => '442399:440', 'detailsVerticalSpacing' => '442839:615', 'edit' => '443454:501', 'formularyLayout' => '443955:457', 'formularyLayoutBox' => '444412:151', 'formularyLayoutGrid' => '444563:153', 'formularyLayoutInline' => '444716:160', 'formularyLayoutStack' => '444876:155', 'imgFilterGrayscale' => '445031:390', 'imgFilterSepia' => '445421:364', 'imgFormat' => '445785:463', 'imgFormatAuto' => '446248:191', 'imgFormatCircle' => '446439:159', 'imgFormatElipse' => '446598:158', 'imgFormatSquare' => '446756:160', 'imgFormatThumbnail' => '446916:159', 'imgSmoke' => '447075:322', 'listAlign' => '447397:403', 'listColumns1' => '447800:108', 'listColumns2' => '447908:108', 'listColumns3' => '448016:108', 'listColumns4' => '448124:108', 'listColumns5' => '448232:108', 'listColumns6' => '448340:108', 'listColumnsAuto' => '448448:165', 'listColumnsExtraLarge' => '448613:518', 'listColumnsLarge' => '449131:522', 'listColumnsMedium' => '449653:521', 'listColumnsSmall' => '450174:521', 'listType' => '450695:420', 'listTypeColumns' => '451115:161', 'listTypeGrid' => '451276:153', 'listTypeInline' => '451429:155', 'margin025' => '451584:166', 'margin050' => '451750:163', 'margin075' => '451913:166', 'margin100' => '452079:156', 'margin150' => '452235:160', 'margin200' => '452395:158', 'marginAuto' => '452553:173', 'marginBottom' => '452726:523', 'marginLeft' => '453249:517', 'marginNone' => '453766:160', 'marginRight' => '453926:519', 'marginTop' => '454445:514', 'modPosition' => '454959:515', 'modPositionCenter' => '455474:165', 'modPositionFloatLeft' => '455639:181', 'modPositionFloatRight' => '455820:182', 'modPositionInline' => '456002:164', 'modPositionLeft' => '456166:159', 'modPositionRight' => '456325:159', 'modSemantic' => '456484:549', 'modSemanticAddress' => '457033:181', 'modSemanticArticle' => '457214:179', 'modSemanticAside' => '457393:179', 'modSemanticFooter' => '457572:158', 'modSemanticHeader' => '457730:161', 'modSemanticNav' => '457891:163', 'modSemanticNone' => '458054:147', 'modWidth1' => '458201:119', 'modWidth10' => '458320:121', 'modWidth11' => '458441:121', 'modWidth12' => '458562:129', 'modWidth2' => '458691:119', 'modWidth3' => '458810:126', 'modWidth4' => '458936:119', 'modWidth5' => '459055:119', 'modWidth6' => '459174:126', 'modWidth7' => '459300:119', 'modWidth8' => '459419:119', 'modWidth9' => '459538:119', 'modWidthAuto' => '459657:165', 'modWidthExtraLarge' => '459822:646', 'modWidthHidden' => '460468:159', 'modWidthLarge' => '460627:656', 'modWidthMedium' => '461283:654', 'modWidthSmall' => '461937:655', 'tabCaption' => '462592:278', 'tabDetails' => '462870:205', 'tabEffects' => '463075:285', 'tabFormulary' => '463360:219', 'tabList' => '463579:485', 'tabPosition' => '464064:422', 'tabStyle' => '464486:291' ), 'personaliteTemplate' => array ( 'content' => '464777:480', 'edit' => '465257:472', 'manageDetails' => '465729:235', 'manageFields' => '465964:255', 'manageFonts' => '466219:229', 'manageIcons' => '466448:229', 'manageLabels' => '466677:337', 'manageLabelsAction' => '467014:264', 'manageLabelsDate' => '467278:260', 'manageLabelsField' => '467538:263', 'manageLabelsLang' => '467801:266', 'manageLabelsNavigation' => '468067:275', 'manageLayouts' => '468342:234', 'manageLists' => '468576:229', 'manageModules' => '468805:234', 'managePalettes' => '469039:236', 'manageScripts' => '469275:234', 'manageStyles' => '469509:238', 'manageThemes' => '469747:230', 'tabDetails' => '469977:212', 'tabFields' => '470189:216', 'tabFonts' => '470405:206', 'tabIcons' => '470611:206', 'tabLabels' => '470817:227', 'tabLabelsAction' => '471044:276', 'tabLabelsDate' => '471320:272', 'tabLabelsField' => '471592:275', 'tabLabelsLang' => '471867:278', 'tabLabelsNavigation' => '472145:287', 'tabLayouts' => '472432:211', 'tabLists' => '472643:206', 'tabModules' => '472849:211', 'tabPalettes' => '473060:230', 'tabScripts' => '473290:211', 'tabStyles' => '473501:226', 'tabThemes' => '473727:207' ), 'personaliteTemplate_add' => array ( 'content' => '473934:1389' ), 'personaliteTemplate_configure' => array ( 'details' => '475323:427', 'edit' => '475750:429', 'editCaption' => '476179:265', 'editCSS' => '476444:234', 'editDescription' => '476678:254', 'editFilters' => '476932:223', 'editFiltersDescription' => '477155:302', 'editFlags' => '477457:208', 'editFontFace' => '477665:274', 'editFontStack' => '477939:274', 'editHTML' => '478213:237', 'editName' => '478450:299', 'editScript' => '478749:253', 'editVars' => '479002:206', 'fields' => '479208:420', 'fonts' => '479628:400', 'icons' => '480028:399', 'layouts' => '480427:422', 'lists' => '480849:399', 'modules' => '481248:422', 'palettes' => '481670:404', 'scripts' => '482074:406', 'styles' => '482480:416', 'tabCaption' => '482896:272', 'tabCSS' => '483168:196', 'tabFilters' => '483364:250', 'tabFlags' => '483614:212', 'tabFonts' => '483826:231', 'tabHTML' => '484057:199', 'tabScript' => '484256:206', 'tabVars' => '484462:209', 'templates' => '484671:424', 'themes' => '485095:400' ), 'personaliteTemplate_filters' => array ( 'content' => '485495:322' ), 'personaliteTemplate_labels' => array ( 'edit' => '485817:399', 'editCaption' => '486216:265', 'editName' => '486481:259', 'tabCaption' => '486740:272' ), 'section' => array ( 'contentEdit' => '487012:180', 'edit' => '487192:542', 'editAccess' => '487734:448', 'editAccessAdmin' => '488182:193', 'editAccessAll' => '488375:157', 'editAccessMember' => '488532:204', 'editAccessSubscribed' => '488736:187', 'editCaption' => '488923:396', 'editCaptionRequired' => '489319:443', 'editContent' => '489762:363', 'editDescription' => '490125:201', 'editGroup' => '490326:209', 'editGroupNone' => '490535:125', 'editImg' => '490660:210', 'editKeywords' => '490870:180', 'editKeywordsPack' => '491050:52', 'editName' => '491102:279', 'editTitle' => '491381:190', 'editUpdated' => '491571:167', 'moveDown' => '491738:135', 'moveTo' => '491873:330', 'moveToFooter' => '492203:130', 'moveToList' => '492333:236', 'moveToMain' => '492569:127', 'moveUp' => '492696:134', 'remove' => '492830:140', 'removeConfirm' => '492970:617', 'specialFieldsOnEdit' => '493587:106' ), 'section_create' => array ( 'content' => '493693:256', 'contextNew' => '493949:132', 'contextNewMain' => '494081:141', 'edit' => '494222:527', 'editCaptionHidden' => '494749:117', 'editDescription' => '494866:201', 'editKeywordsPack' => '495067:52', 'editNameHidden' => '495119:142', 'editTitle' => '495261:190', 'helpNavigate' => '495451:852', 'specialFieldsAfterCreate' => '496303:133', 'specialFieldsOnCreate' => '496436:108' ), 'sectionBlog' => array ( 'editComment' => '496544:502', 'editCommentDisabled' => '497046:170', 'helpAbout' => '497216:844', 'helpCreate' => '498060:699', 'helpDone' => '498759:160', 'helpNavigate' => '498919:699', 'reindex' => '499618:390', 'reindexList' => '500008:222', 'sort' => '500230:479', 'sortAlphabetically' => '500709:147', 'sortCheaper' => '500856:131', 'sortEvent' => '500987:137', 'sortExpensive' => '501124:137', 'sortHits' => '501261:138', 'sortPost' => '501399:137', 'sortRatings' => '501536:144', 'sortRecents' => '501680:132', 'specialFieldsOnCreate' => '501812:82', 'specialFieldsOnEdit' => '501894:82' ), 'sectionBlog_create' => array ( 'blog' => '501976:377', 'blogPreset' => '502353:55', 'events' => '502408:412', 'eventsPreset' => '502820:90', 'galery' => '502910:421', 'galeryPreset' => '503331:90', 'news' => '503421:384', 'newsPreset' => '503805:88', 'podcast' => '503893:371', 'podcastPreset' => '504264:91', 'products' => '504355:473', 'productsPreset' => '504828:92', 'videocast' => '504920:408', 'videocastPreset' => '505328:93' ), 'sectionBlog_post' => array ( 'contextNew' => '505421:128', 'edit' => '505549:529', 'editCaption' => '506078:326', 'editCaptionHidden' => '506404:359', 'editContactAddress' => '506763:302', 'editContactMail' => '507065:294', 'editContactPhone' => '507359:240', 'editContactSite' => '507599:250', 'editContent' => '507849:369', 'editDescription' => '508218:323', 'editEventDate' => '508541:253', 'editEventPlace' => '508794:306', 'editImg' => '509100:282', 'editKeywords' => '509382:295', 'editKeywordsPack' => '509677:52', 'editMediaBox' => '509729:395', 'editName' => '510124:152', 'editNameHidden' => '510276:187', 'editProduct' => '510463:257', 'editSpecialFields' => '510720:75', 'editTitle' => '510795:308', 'editTitleRequired' => '511103:427', 'editUpdated' => '511530:167', 'msgRemoveConfirm' => '511697:444', 'new' => '512141:509', 'remove' => '512650:136', 'specialProductAvailable' => '512786:206', 'specialProductOrder' => '512992:190', 'specialProductPrice' => '513182:166', 'specialProductStock' => '513348:175' ), 'sectionFolder' => array ( 'helpAbout' => '513523:890', 'specialFieldsOnCreate' => '514413:58', 'specialFieldsOnEdit' => '514471:58' ), 'sectionFolder_create' => array ( 'content' => '514529:408', 'contentPreset' => '514937:248' ), 'sectionFormulary' => array ( 'editMail' => '515185:207', 'fields' => '515392:410', 'fieldsList' => '515802:234', 'formulary' => '516036:110', 'formularyFields' => '516146:68', 'helpAbout' => '516214:566', 'helpInstructor' => '516780:177', 'review' => '516957:358', 'security' => '517315:591', 'securityAccess' => '517906:611', 'securityBasics' => '518517:570', 'securityBasicsEnable' => '519087:269', 'securityContent' => '519356:482', 'securityContentUrlBlock' => '519838:269', 'securityReview' => '520107:422', 'securityReviewEnable' => '520529:237', 'specialFieldsOnCreate' => '520766:78', 'specialFieldsOnEdit' => '520844:78', 'view' => '520922:91', 'viewFields' => '521013:72' ), 'sectionFormulary_create' => array ( 'contact' => '521085:434', 'contactPreset' => '521519:1203', 'formulary' => '522722:534', 'formularyPreset' => '523256:60' ), 'sectionFormulary_done' => array ( 'content' => '523316:544', 'custom' => '523860:291', 'edit' => '524151:664', 'editCaption' => '524815:334', 'editContent' => '525149:354', 'editRecognizeEcolabore' => '525503:275', 'editRecognizeHTML' => '525778:237', 'editRecognizeParagraphs' => '526015:267', 'editTitle' => '526282:266', 'editUpdated' => '526548:167', 'restore' => '526715:303' ), 'sectionFormulary_received' => array ( 'content' => '527018:467', 'list' => '527485:246', 'listNew' => '527731:127', 'selectColumns' => '527858:549', 'selectColumnsList' => '528407:235' ), 'sectionFormulary_record' => array ( 'content' => '528642:219', 'remove' => '528861:139' ), 'sectionFormulary_removed' => array ( 'content' => '529000:251' ), 'sectionFormulary_selectColumns' => array ( 'content' => '529251:437' ), 'sectionFormulary_statistics' => array ( 'content' => '529688:245', 'list' => '529933:1133' ), 'sectionGlossary' => array ( 'helpAbout' => '531066:613', 'helpInstructor' => '531679:178', 'specialFieldsOnCreate' => '531857:58', 'specialFieldsOnEdit' => '531915:58' ), 'sectionGlossary_create' => array ( 'content' => '531973:399', 'contentPreset' => '532372:731' ), 'sectionInfo' => array ( 'helpAbout' => '533103:428', 'helpInstructor' => '533531:174', 'specialFieldsOnCreate' => '533705:58', 'specialFieldsOnEdit' => '533763:58' ), 'sectionInfo_create' => array ( 'content' => '533821:431', 'contentPreset' => '534252:409' ), 'sectionMenu' => array ( 'helpAbout' => '534661:421' ), 'sectionMenu_create' => array ( 'menu' => '535082:412', 'menuPreset' => '535494:55' ), 'sectionRedirect' => array ( 'content' => '535549:588', 'editURL' => '536137:281', 'helpAbout' => '536418:518', 'specialFieldsOnCreate' => '536936:46', 'specialFieldsOnEdit' => '536982:46' ), 'sectionRedirect_create' => array ( 'content' => '537028:531', 'contentPreset' => '537559:59' ), 'sectionSearch' => array ( 'helpAbout' => '537618:255', 'helpInstructor' => '537873:176', 'specialFieldsOnCreate' => '538049:58', 'specialFieldsOnEdit' => '538107:58' ), 'sectionSearch_create' => array ( 'content' => '538165:410', 'contentPreset' => '538575:390' ), 'sectionSubdomains' => array ( 'helpAbout' => '538965:451', 'helpInstructor' => '539416:140', 'list' => '539556:173', 'specialFieldsOnCreate' => '539729:58', 'specialFieldsOnEdit' => '539787:58' ), 'sectionSubdomains_create' => array ( 'content' => '539845:419', 'contentPreset' => '540264:447' ), 'sectionTeam' => array ( 'helpAbout' => '540711:375', 'helpCreate' => '541086:457', 'helpDone' => '541543:593', 'helpInstructor' => '542136:195', 'helpNavigate' => '542331:237', 'helpReturn' => '542568:243', 'listAllClients' => '542811:141', 'listAllGroups' => '542952:123', 'listAllMembers' => '543075:140', 'listAllPartners' => '543215:143', 'listAllStudents' => '543358:140', 'listAllSuppliers' => '543498:147', 'listSectorMembers' => '543645:154', 'specialFieldsOnCreate' => '543799:58', 'specialFieldsOnEdit' => '543857:58' ), 'sectionTeam_create' => array ( 'clients' => '543915:364', 'clientsPreset' => '544279:375', 'partners' => '544654:383', 'partnersPreset' => '545037:379', 'students' => '545416:374', 'studentsPreset' => '545790:400', 'subscriptions' => '546190:428', 'subscriptionsPreset' => '546618:433', 'suppliers' => '547051:384', 'suppliersPreset' => '547435:393', 'team' => '547828:388', 'teamPreset' => '548216:401' ), 'sectionTeam_group' => array ( 'edit' => '548617:411', 'editCaption' => '549028:396', 'editContent' => '549424:336', 'editName' => '549760:242', 'editTitle' => '550002:171', 'new' => '550173:221', 'remove' => '550394:138', 'removeConfirm' => '550532:657' ), 'sectionTeam_member' => array ( 'contentClient' => '551189:522', 'contentMember' => '551711:520', 'contentPartner' => '552231:524', 'contentStudant' => '552755:520', 'contentSubscription' => '553275:526', 'contentSuplier' => '553801:530', 'edit' => '554331:613', 'editGroup' => '554944:219', 'editGroupNone' => '555163:134', 'helpNavigate' => '555297:556', 'import' => '555853:555', 'import_helpAbout' => '556408:722', 'import_helpNavigate' => '557130:381', 'importList' => '557511:210', 'importListError' => '557721:385', 'inactive' => '558106:571', 'inactive_helpNavigate' => '558677:521', 'inactiveList' => '559198:216', 'new' => '559414:773', 'new_helpNavigate' => '560187:417', 'unlink' => '560604:160', 'unlinkMember' => '560764:872', 'unlinkMessage' => '561636:641' ), 'sectionTerms' => array ( 'helpAbout' => '562277:685', 'helpInstructor' => '562962:133', 'specialFieldsOnCreate' => '563095:58', 'specialFieldsOnEdit' => '563153:58' ), 'sectionTerms_create' => array ( 'content' => '563211:501', 'contentPreset' => '563712:454' ), 'system_form' => array ( 'add' => '564166:117', 'back' => '564283:121', 'cancel' => '564404:123', 'close' => '564527:122', 'create' => '564649:121', 'end' => '564770:68', 'endView' => '564838:50', 'finish' => '564888:121', 'formularyIdCrash' => '565009:427', 'go' => '565436:117', 'next' => '565553:119', 'previous' => '565672:127', 'previousFinish' => '565799:109', 'previousNext' => '565908:107', 'previousSubmit' => '566015:109', 'save' => '566124:119', 'saveCancel' => '566243:129', 'saveClose' => '566372:128', 'separator' => '566500:51', 'start' => '566551:72', 'startView' => '566623:53', 'submit' => '566676:121', 'submitCancel' => '566797:131' ), 'system_msg' => array ( 'alertConfigurationRestored' => '566928:182', 'alertConfigurationSaved' => '567110:156', 'alertDataUpdated' => '567266:338', 'alertInternalError' => '567604:376', 'alertOperationCanceled' => '567980:529', 'alertRequiredField' => '568509:547', 'alertUnexpectedError' => '569056:861', 'clearLanguageConfirm' => '569917:584' ), 'systemAccessDenied' => array ( 'content' => '570501:1278', 'contentProfile' => '571779:872' ), 'systemDefault' => array ( 'content' => '572651:618', 'help' => '573269:664' ), 'systemInstallation' => array ( 0 => '573933:248', '0description' => '574181:203', 1 => '574384:247', '1description' => '574631:198', 2 => '574829:133', '2description' => '574962:679', 'accessDenied' => '575641:751', 'adminCaption' => '576392:234', 'adminGender' => '576626:349', 'adminIdentifier' => '576975:263', 'adminMail' => '577238:199', 'adminPassword' => '577437:288', 'index' => '577725:550', 'systemHostingMode' => '578275:1817', 'systemHostingModeMultiple' => '580092:343', 'systemHostingModeSingle' => '580435:229', 'systemHttpsRedirect' => '580664:268', 'systemRewriteEngine' => '580932:313', 'templateForConfig' => '581245:146' ), 'tool' => array ( 'content' => '581391:395' ), 'toolConfig' => array ( 'content' => '581786:419' ), 'toolConfig_about' => array ( 'content' => '582205:425', 'edit' => '582630:288' ), 'toolConfig_languages' => array ( 'content' => '582918:393', 'edit' => '583311:205', 'editLanguagesManager' => '583516:241', 'select' => '583757:324' ), 'toolConfig_versioning' => array ( 'content' => '584081:611', 'edit' => '584692:288' ), 'user' => array ( 'content' => '584980:489', 'you' => '585469:211' ), 'userAdmin' => array ( 'content' => '585680:697' ), 'userAnonimous' => array ( 'content' => '586377:127' ), 'userDefault' => array ( 'content' => '586504:612' ), 'userHome_alerts' => array ( 'content' => '587116:340', 'mail' => '587456:239', 'phone' => '587695:239' ), 'userHome_default' => array ( 'content' => '587934:410' ), 'userHome_index' => array ( 'content' => '588344:444', 'domains' => '588788:135', 'recents' => '588923:139' ), 'userHome_mail' => array ( 'content' => '589062:374', 'contentFail' => '589436:201', 'contentMailSent' => '589637:316', 'contentReady' => '589953:289', 'contentVerified' => '590242:316', 'contextVerified' => '590558:165', 'editSecurity' => '590723:269', 'input' => '590992:120', 'messageTemplate' => '591112:1552', 'sent' => '592664:83', 'sentButtons' => '592747:111', 'sentUpdate' => '592858:123', 'update' => '592981:130' ), 'userHome_password' => array ( 'alertPasswordChanged' => '593111:375', 'content' => '593486:424', 'edit' => '593910:206', 'editRecoverPassword' => '594116:210', 'help' => '594326:957', 'msgInvalidToken' => '595283:487', 'msgPasswordRecovered' => '595770:452' ), 'userHome_personal' => array ( 'alertDataUpdated' => '596222:384', 'content' => '596606:422', 'edit' => '597028:284', 'help' => '597312:343' ), 'userHome_phone' => array ( 'alertInvalidCode' => '597655:630', 'check' => '598285:126', 'checkCode' => '598411:289', 'content' => '598700:414', 'contentVerified' => '599114:354', 'input' => '599468:98', 'inputPhone' => '599566:98', 'update' => '599664:150', 'verified' => '599814:792', 'verifiedButtons' => '600606:115', 'verifiedUpdate' => '600721:124' ), 'userHome_welcome' => array ( 'disabledF' => '600845:666', 'disabledM' => '601511:670', 'welcome' => '602181:875', 'welcomeToProfile' => '603056:891' ), 'userIndex' => array ( 'content' => '603947:489' ), 'userJoin' => array ( 'alertWelcome' => '604436:677', 'content' => '605113:544', 'editTermsAgree' => '605657:296', 'editTermsView' => '605953:63', 'helpDescription' => '606016:82', 'page0' => '606098:534', 'page1' => '606632:445', 'page1previous' => '607077:297', 'page2' => '607374:448' ), 'userRecoverPassword' => array ( 'content' => '607822:538', 'edit' => '608360:104', 'editAdminMailNotFound' => '608464:596', 'editAdminNotFound' => '609060:379', 'editIdentifier' => '609439:233', 'messageTemplate' => '609672:1539', 'msgMailSent' => '611211:842' ) ), 't' => array ( 'base' => array ( 'empty' => '612053:37', 'mail' => '612090:452', 'print' => '612542:580', 'responsive' => '613122:4999', 'simple' => '618121:557', 'system' => '618678:733' ), 'blocks' => array ( 'help' => '619411:108', 'personalite' => '619519:253' ), 'borders' => array ( 'default' => '619772:1163' ), 'details' => array ( 'button_caption' => '620935:1150', 'button_title' => '622085:491', 'caption' => '622576:262', 'contact_address' => '622838:447', 'contact_mail' => '623285:255', 'contact_phone' => '623540:232', 'contact_site' => '623772:289', 'content' => '624061:494', 'description' => '624555:483', 'event_date' => '625038:303', 'img' => '625341:837', 'img_mini' => '626178:966', 'img_mini_title_description' => '627144:1581', 'info_hits' => '628725:203', 'info_owner' => '628928:310', 'info_posted' => '629238:258', 'info_posted_datetime' => '629496:286', 'info_posted_elapsed' => '629782:252', 'info_updated' => '630034:274', 'list_categories' => '630308:302', 'list_keywords' => '630610:352', 'list_location' => '630962:330', 'list_location_full' => '631292:369', 'list_location_inline' => '631661:330', 'media_audio' => '631991:659', 'media_box' => '632650:220', 'media_file' => '632870:469', 'media_video' => '633339:383', 'subitens' => '633722:96', 'title_1' => '633818:549', 'title_2' => '634367:270', 'title_3' => '634637:270', 'title_4' => '634907:554', 'title_5' => '635461:554', 'title_6' => '636015:554' ), 'fields' => array ( 'address' => '636569:2161', 'address_buscacep' => '638730:2869', 'checkbox' => '641599:541', 'descriptive' => '642140:294', 'end' => '642434:285', 'file' => '642719:496', 'list' => '643215:617', 'manager' => '643832:7108', 'phone' => '650940:1010', 'radio' => '651950:517', 'range' => '652467:556', 'select' => '653023:626', 'separator' => '653649:195', 'start' => '653844:834', 'submit' => '654678:654', 'text' => '655332:552', 'text_password' => '655884:511', 'text_small' => '656395:580', 'text_tiny' => '656975:594', 'textarea' => '657569:556', 'textarea_big' => '658125:565', 'textarea_small' => '658690:571', 'view' => '659261:403', 'view_end' => '659664:176', 'view_start' => '659840:225' ), 'fonts' => array ( 'arial' => '660065:167', 'book-antiqua' => '660232:191', 'century-gothic' => '660423:233', 'consolas' => '660656:334', 'courier-new' => '660990:205', 'times-new-roman' => '661195:197' ), 'icons' => array ( 'action_add' => '661392:239', 'action_configure' => '661631:268', 'action_remove' => '661899:206', 'ecolabore_flower' => '662105:1200', 'menu' => '663305:283', 'nav_down_arrow' => '663588:242', 'nav_left_arrow' => '663830:247', 'nav_right_arrow' => '664077:247', 'nav_up_arrow' => '664324:239', 'square' => '664563:204' ), 'labels/action' => array ( 'add' => '664767:115', 'answer' => '664882:118', 'back' => '665000:121', 'cancel' => '665121:125', 'choose' => '665246:125', 'clear' => '665371:122', 'close' => '665493:114', 'configure' => '665607:131', 'confirm' => '665738:127', 'connect' => '665865:122', 'create' => '665987:114', 'download' => '666101:117', 'edit' => '666218:113', 'finish' => '666331:125', 'go' => '666456:115', 'move_down' => '666571:129', 'move_left' => '666700:132', 'move_right' => '666832:133', 'move_to' => '666965:128', 'move_up' => '667093:126', 'next' => '667219:114', 'ok' => '667333:107', 'pause' => '667440:114', 'play' => '667554:118', 'previous' => '667672:122', 'redo' => '667794:114', 'remove' => '667908:116', 'remove_object' => '668024:132', 'restore' => '668156:166', 'save' => '668322:113', 'submit' => '668435:115', 'undo' => '668550:115', 'update' => '668665:118' ), 'labels/currency' => array ( 'AED' => '668783:172', 'ALL' => '668955:127', 'ANG' => '669082:166', 'ARS' => '669248:129', 'AUD ' => '669377:51', 'AUD' => '669428:88', 'AWG' => '669516:134', 'BBD' => '669650:148', 'BDT' => '669798:141', 'BGN' => '669939:142', 'BHD' => '670081:160', 'BIF' => '670241:148', 'BMD' => '670389:149', 'BND' => '670538:139', 'BOB' => '670677:141', 'BRL' => '670818:138', 'BSD' => '670956:141', 'BTN' => '671097:148', 'BWP' => '671245:128', 'BYR' => '671373:136', 'BZD' => '671509:146', 'CAD ' => '671655:59', 'CAD' => '671714:86', 'CHF ' => '671800:66', 'CHF' => '671866:84', 'CLP' => '671950:127', 'CNY' => '672077:127', 'COP' => '672204:130', 'CRC' => '672334:140', 'CUP' => '672474:141', 'CVE' => '672615:150', 'CZK' => '672765:160', 'DJF' => '672925:148', 'DKK ' => '673073:59', 'DKK' => '673132:88', 'DOP' => '673220:145', 'DZD' => '673365:144', 'EEK' => '673509:144', 'EGP' => '673653:151', 'ETB' => '673804:135', 'EUR ' => '673939:59', 'EUR' => '673998:73', 'FJD' => '674071:144', 'FKP ' => '674215:51', 'FKP' => '674266:88', 'GBP ' => '674354:51', 'GBP' => '674405:85', 'GHS' => '674490:138', 'GMD ' => '674628:51', 'GMD' => '674679:84', 'GNF' => '674763:139', 'GTQ' => '674902:132', 'GYD' => '675034:146', 'HKD ' => '675180:66', 'HKD' => '675246:89', 'HNL' => '675335:131', 'HRK' => '675466:137', 'HTG' => '675603:82', 'HUF' => '675685:138', 'IDR ' => '675823:59', 'IDR' => '675882:86', 'ILS' => '675968:145', 'INR' => '676113:143', 'IQD' => '676256:152', 'IRR' => '676408:84', 'ISK' => '676492:138', 'JOD' => '676630:146', 'JPY ' => '676776:51', 'JPY' => '676827:83', 'KES' => '676910:144', 'KGS' => '677054:142', 'KHR' => '677196:142', 'KMF' => '677338:146', 'KPW' => '677484:140', 'KRW' => '677624:138', 'KWD' => '677762:153', 'KYD' => '677915:133', 'KZT ' => '678048:66', 'KZT' => '678114:88', 'LKR' => '678202:148', 'MAD' => '678350:156', 'MDL' => '678506:143', 'MKD' => '678649:146', 'MMK' => '678795:128', 'MNT' => '678923:146', 'MOP ' => '679069:51', 'MOP' => '679120:82', 'MRO' => '679202:142', 'MUR' => '679344:142', 'MVR' => '679486:139', 'MWK' => '679625:139', 'MXN' => '679764:128', 'MYR' => '679892:139', 'NAD ' => '680031:59', 'NAD' => '680090:86', 'NGN' => '680176:137', 'NIO' => '680313:142', 'NOK' => '680455:136', 'NPR' => '680591:137', 'NZD' => '680728:139', 'OMR ' => '680867:75', 'OMR' => '680942:80', 'PAB' => '681022:129', 'PEN' => '681151:137', 'PGK' => '681288:137', 'PHP' => '681425:136', 'PKR' => '681561:146', 'PLN' => '681707:144', 'PYG' => '681851:87', 'QAR ' => '681938:73', 'QAR' => '682011:83', 'RON ' => '682094:51', 'RON' => '682145:80', 'RUB' => '682225:149', 'RWF' => '682374:138', 'SAR' => '682512:158', 'SBD' => '682670:155', 'SCR' => '682825:143', 'SDG' => '682968:144', 'SEK' => '683112:136', 'SGD' => '683248:142', 'SHP' => '683390:136', 'SKK' => '683526:140', 'SLL' => '683666:142', 'SOS' => '683808:145', 'STD' => '683953:139', 'SVC' => '684092:141', 'SYP' => '684233:142', 'SZL' => '684375:145', 'THB ' => '684520:58', 'THB' => '684578:85', 'TND' => '684663:148', 'TOP' => '684811:138', 'TRY' => '684949:140', 'TTD' => '685089:157', 'TWD' => '685246:146', 'TZS' => '685392:131', 'UAH' => '685523:86', 'UGX' => '685609:143', 'USD ' => '685752:47', 'USD' => '685799:95', 'UYU' => '685894:143', 'UZS' => '686037:142', 'VEF' => '686179:150', 'VND' => '686329:136', 'VUV ' => '686465:59', 'VUV' => '686524:82', 'WST' => '686606:140', 'XAF' => '686746:154', 'XCD' => '686900:155', 'XOF' => '687055:162', 'XPF ' => '687217:51', 'XPF' => '687268:86', 'YER ' => '687354:66', 'YER' => '687420:83', 'ZAR' => '687503:134', 'ZMK ' => '687637:66', 'ZMK' => '687703:85' ), 'labels/date' => array ( 'day' => '687788:109', 'days_ago' => '687897:122', 'elapsed_1day' => '688019:135', 'elapsed_1hour' => '688154:140', 'elapsed_1minute' => '688294:144', 'elapsed_1month' => '688438:140', 'elapsed_1year' => '688578:139', 'elapsed_days' => '688717:162', 'elapsed_hours' => '688879:164', 'elapsed_minutes' => '689043:168', 'elapsed_months' => '689211:165', 'elapsed_now' => '689376:129', 'elapsed_years' => '689505:163', 'formated' => '689668:197', 'hour' => '689865:113', 'hours' => '689978:113', 'hours_ago' => '690091:124', 'minutes' => '690215:117', 'minutes_ago' => '690332:129', 'month' => '690461:111', 'month_short1' => '690572:109', 'month_short10' => '690681:109', 'month_short11' => '690790:109', 'month_short12' => '690899:109', 'month_short2' => '691008:109', 'month_short3' => '691117:109', 'month_short4' => '691226:109', 'month_short5' => '691335:109', 'month_short6' => '691444:109', 'month_short7' => '691553:109', 'month_short8' => '691662:109', 'month_short9' => '691771:109', 'month1' => '691880:117', 'month10' => '691997:117', 'month11' => '692114:119', 'month12' => '692233:119', 'month2' => '692352:120', 'month3' => '692472:113', 'month4' => '692585:113', 'month5' => '692698:110', 'month6' => '692808:112', 'month7' => '692920:112', 'month8' => '693032:115', 'month9' => '693147:120', 'seconds' => '693267:118', 'weekShort1' => '693385:109', 'weekShort2' => '693494:109', 'weekShort3' => '693603:109', 'weekShort4' => '693712:109', 'weekShort5' => '693821:109', 'weekShort6' => '693930:109', 'weekShort7' => '694039:109', 'year' => '694148:110', 'yesterday' => '694258:117' ), 'labels/field' => array ( 'address' => '694375:118', 'address_city' => '694493:113', 'address_complement' => '694606:126', 'address_country' => '694732:114', 'address_district' => '694846:117', 'address_number' => '694963:115', 'address_postal_code' => '695078:118', 'address_state' => '695196:114', 'address_street' => '695310:112', 'captcha_donotfill' => '695422:149', 'cart_add' => '695571:137', 'cart_go' => '695708:125', 'cart_items' => '695833:113', 'categories' => '695946:133', 'comment' => '696079:121', 'content' => '696200:118', 'description' => '696318:124', 'folder' => '696442:122', 'hits' => '696564:122', 'info_by' => '696686:108', 'info_posted' => '696794:123', 'info_updated' => '696917:128', 'keywords' => '697045:134', 'location' => '697179:116', 'location_at' => '697295:122', 'media_add_audio' => '697417:128', 'media_add_file' => '697545:129', 'media_add_video' => '697674:128', 'media_downloads' => '697802:121', 'media_plays' => '697923:120', 'phone' => '698043:124', 'phone_area' => '698167:124', 'phone_country' => '698291:122', 'phone_number' => '698413:123', 'title' => '698536:122', 'user_identifier' => '698658:136', 'user_password' => '698794:116', 'user_repeat_password' => '698910:133' ), 'labels/lang' => array ( 'aa' => '699043:133', 'ab' => '699176:150', 'ae' => '699326:143', 'af' => '699469:150', 'ak' => '699619:134', 'am' => '699753:149', 'an' => '699902:148', 'ar' => '700050:148', 'as' => '700198:159', 'av' => '700357:143', 'ay' => '700500:139', 'az' => '700639:157', 'ba' => '700796:150', 'be' => '700946:165', 'bg' => '701111:157', 'bh' => '701268:156', 'bi' => '701424:144', 'bm' => '701568:147', 'bn' => '701715:151', 'bo' => '701866:158', 'br' => '702024:143', 'bs' => '702167:143', 'ca' => '702310:143', 'ce' => '702453:151', 'ch' => '702604:144', 'co' => '702748:139', 'cr' => '702887:145', 'cs' => '703032:138', 'cu' => '703170:181', 'cv' => '703351:148', 'cy' => '703499:139', 'da' => '703638:145', 'de' => '703783:141', 'dv' => '703924:158', 'dz' => '704082:151', 'ee' => '704233:135', 'el' => '704368:149', 'en' => '704517:116', 'eo' => '704633:148', 'es' => '704781:144', 'et' => '704925:143', 'eu' => '705068:139', 'fa' => '705207:144', 'ff' => '705351:138', 'fi' => '705489:144', 'fj' => '705633:152', 'fo' => '705785:144', 'fr' => '705929:144', 'fy' => '706073:140', 'ga' => '706213:142', 'gd' => '706355:154', 'gl' => '706509:141', 'gn' => '706650:146', 'gu' => '706796:159', 'gv' => '706955:136', 'ha' => '707091:148', 'he' => '707239:152', 'hi' => '707391:151', 'ho' => '707542:148', 'hr' => '707690:143', 'ht' => '707833:169', 'hu' => '708002:144', 'hy' => '708146:152', 'hz' => '708298:145', 'ia' => '708443:158', 'id' => '708601:160', 'ie' => '708761:158', 'ig' => '708919:132', 'ii' => '709051:149', 'ik' => '709200:143', 'in' => '709343:123', 'io' => '709466:130', 'is' => '709596:148', 'it' => '709744:144', 'iu' => '709888:158', 'iw' => '710046:117', 'ja' => '710163:146', 'ji' => '710309:76', 'jv' => '710385:146', 'ka' => '710531:160', 'kg' => '710691:138', 'ki' => '710829:142', 'kj' => '710971:150', 'kk' => '711121:149', 'kl' => '711270:158', 'km' => '711428:159', 'kn' => '711587:151', 'ko' => '711738:143', 'kr' => '711881:139', 'ks' => '712020:176', 'ku' => '712196:151', 'kv' => '712347:137', 'kw' => '712484:143', 'ky' => '712627:153', 'la' => '712780:137', 'lb' => '712917:165', 'lg' => '713082:140', 'li' => '713222:153', 'ln' => '713375:142', 'lo' => '713517:141', 'lt' => '713658:148', 'lu' => '713806:160', 'lv' => '713966:143', 'mg' => '714109:152', 'mh' => '714261:162', 'mi' => '714423:145', 'mk' => '714568:164', 'ml' => '714732:158', 'mn' => '714890:149', 'mo' => '715039:162', 'mr' => '715201:150', 'ms' => '715351:175', 'mt' => '715526:144', 'my' => '715670:159', 'na' => '715829:151', 'nb' => '715980:165', 'nd' => '716145:159', 'ne' => '716304:154', 'ng' => '716458:145', 'nl' => '716603:146', 'nn' => '716749:169', 'no' => '716918:146', 'nr' => '717064:161', 'nv' => '717225:146', 'ny' => '717371:146', 'oc' => '717517:143', 'oj' => '717660:151', 'om' => '717811:137', 'or' => '717948:147', 'os' => '718095:147', 'pa' => '718242:154', 'pi' => '718396:143', 'pl' => '718539:141', 'ps' => '718680:141', 'pt' => '718821:123', 'qu' => '718944:145', 'rm' => '719089:156', 'rn' => '719245:138', 'ro' => '719383:143', 'ru' => '719526:148', 'rw' => '719674:158', 'sa' => '719832:162', 'sc' => '719994:140', 'sd' => '720134:148', 'se' => '720282:161', 'sg' => '720443:138', 'si' => '720581:155', 'sk' => '720736:147', 'sl' => '720883:152', 'sm' => '721035:147', 'sn' => '721182:139', 'so' => '721321:144', 'sq' => '721465:142', 'sr' => '721607:148', 'ss' => '721755:139', 'st' => '721894:155', 'su' => '722049:150', 'sv' => '722199:140', 'sw' => '722339:144', 'ta' => '722483:148', 'te' => '722631:152', 'tg' => '722783:146', 'th' => '722929:158', 'ti' => '723087:151', 'tk' => '723238:152', 'tl' => '723390:141', 'tn' => '723531:141', 'to' => '723672:146', 'tr' => '723818:141', 'ts' => '723959:139', 'tt' => '724098:142', 'tw' => '724240:130', 'ty' => '724370:148', 'ug' => '724518:147', 'uk' => '724665:160', 'ur' => '724825:137', 'uz' => '724962:144', 've' => '725106:138', 'vi' => '725244:158', 'vo' => '725402:146', 'wa' => '725548:139', 'wo' => '725687:136', 'xh' => '725823:136', 'yi' => '725959:149', 'yo' => '726108:142', 'za' => '726250:146', 'zh' => '726396:158', 'zu' => '726554:133' ), 'labels/layout' => array ( 'assistant_close' => '726687:279', 'assistant_open' => '726966:181', 'editor_flag_green' => '727147:184', 'editor_flag_red' => '727331:191', 'first' => '727522:124', 'last' => '727646:121', 'menu_access' => '727767:151', 'menu_colapse' => '727918:146', 'menu_colapsed' => '728064:128', 'menu_opened' => '728192:126', 'next' => '728318:122', 'panel_left_close' => '728440:151', 'panel_left_open' => '728591:153', 'panel_right_close' => '728744:151', 'panel_right_open' => '728895:153', 'previous' => '729048:127', 'spotlight_end' => '729175:157', 'spotlight_start' => '729332:143', 'tabs' => '729475:119', 'top' => '729594:118' ), 'labels/status' => array ( 700 => '729712:116', 720 => '729828:117', 721 => '729945:111', 730 => '730056:118' ), 'layouts' => array ( 'default' => '730174:500', 'dialog' => '730674:184', 'dialog_basic' => '730858:222', 'dialog_cancel' => '731080:199', 'dialog_close' => '731279:413', 'dialog_select' => '731692:1549', 'dialog_tabs' => '733241:3561' ), 'lists' => array ( 'box' => '736802:311', 'default' => '737113:612', 'details' => '737725:42', 'formulary' => '737767:38', 'html' => '737805:31', 'menu_simple_vertical' => '737836:215', 'table' => '738051:191', 'table_simple' => '738242:184' ), 'modules' => array ( 'audio' => '738426:197', 'banner' => '738623:275', 'box' => '738898:481', 'breadcrumbs' => '739379:518', 'cart' => '739897:504', 'comments' => '740401:668', 'comments_add' => '741069:229', 'content' => '741298:460', 'dinamic_blog' => '741758:835', 'dinamic_events' => '742593:859', 'dinamic_galery' => '743452:788', 'dinamic_news' => '744240:794', 'dinamic_podcast' => '745034:843', 'dinamic_products' => '745877:785', 'dinamic_recents' => '746662:824', 'dinamic_videocast' => '747486:835', 'file' => '748321:419', 'footer' => '748740:265', 'formulary' => '749005:562', 'formulary_edit' => '749567:578', 'formulary_system' => '750145:404', 'formulary_view' => '750549:530', 'hits' => '751079:446', 'html' => '751525:172', 'img' => '751697:291', 'languages' => '751988:644', 'list' => '752632:634', 'list_blog' => '753266:709', 'list_card' => '753975:497', 'list_events' => '754472:760', 'list_folder' => '755232:672', 'list_formulary' => '755904:544', 'list_galery' => '756448:753', 'list_glossary' => '757201:737', 'list_info_administrators' => '757938:633', 'list_news' => '758571:746', 'list_podcast' => '759317:773', 'list_products' => '760090:740', 'list_related' => '760830:729', 'list_search_results' => '761559:739', 'list_system' => '762298:499', 'list_videocast' => '762797:767', 'login' => '763564:432', 'navbar' => '763996:442', 'navbottom' => '764438:448', 'pages' => '764886:510', 'pages_post' => '765396:523', 'post_blog' => '765919:126', 'post_events' => '766045:156', 'post_galery' => '766201:96', 'post_news' => '766297:133', 'post_podcast' => '766430:148', 'post_products' => '766578:121', 'post_videocast' => '766699:141', 'related' => '766840:690', 'search' => '767530:294', 'search_options' => '767824:436', 'sort_blog' => '768260:394', 'system_menu' => '768654:475', 'title' => '769129:379', 'video' => '769508:299' ), 'palettes' => array ( 'default' => '769807:1445', 'white' => '771252:1136' ), 'scripts' => array ( 'empty' => '772388:131' ), 'styles' => array ( 'default' => '772519:28847', 'print' => '801366:1247' ), 'templates' => array ( 'default' => '802613:254' ), 'themes' => array ( 'default' => '802867:2386' ) ), 'f' => array ( 'icons' => array ( 'blank.gif' => '805253:68', 'ecolabore-flower.svg' => '805321:1270', 'ecolabore-humperstilshen-alert.png' => '806591:18219', 'ecolabore-humperstilshen-crash.png' => '824810:11061', 'ecolabore-humperstilshen-default.png' => '835871:10383', 'ecolabore-humperstilshen-error.png' => '846254:9283', 'ecolabore-humperstilshen-happy.png' => '855537:9594', 'ecolabore-humperstilshen-question.png' => '865131:10254', 'ecolabore-humperstilshen-tip.png' => '875385:8695', 'ecolabore-humperstilshen-welcome.png' => '884080:10383', 'ecolabore-humperstilshen-whait.png' => '894463:12007', 'help64.gif' => '906470:2540' ), 'scripts' => array ( 'ecolabore-humperstilshen.js' => '909010:8255' ), 'styles' => array ( 'ecolabore-basics.css' => '917265:23429', 'ecolabore-print.css' => '940694: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 $systemMap; if ($applicationName == false) $applicationName = $this->applicationName; // com SYSTEM_PACKED_MAP_FIRST o mapa interno tem preferência if (SYSTEM_PACKED_MAP_FIRST and isset ($systemMap[$applicationName])) { // packed map first $this->map = $systemMap[$applicationName]; return; } // packed map first if (!isset ($systemMap[$applicationName])) { // open map $result = array (); $systemMap[$applicationName] = array (); list ($prefix) = explode ('_', $applicationName, 2); // O arquivo do mapa terá o mesmo nome da aplicação, seguido por ".txt" $file = FOLDER_LIBRARY . $prefix . '/app_' . $applicationName . '.txt'; if (is_file ($file)) { // open file $string = file_get_contents ($file); $array = explode (LF, $string); foreach ($array as $line) { // each line $line = trim ($line); if (preg_match ('%^[a-zA-Z0-9_]+$%', $line)) $result[] = $line; } // each line } // open file $systemMap[$applicationName] = $result; } // open map $this->map = $systemMap[$applicationName]; } // function getMap public function child ($name, $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 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 list ($lang, $content) = each ($field); $content[TEXT_LANG] = $lang; } // next language // Se não for especificada uma codificação if (!isset ($content[TEXT_CHARSET])) $content[TEXT_CHARSET] = 0; // UTF-8 // Se o conteúdo estiver em uma codificação diferente da do documento if (isset ($cs[$content[TEXT_CHARSET]]) and $cs[$content[TEXT_CHARSET]] != $this->charset) $content[TEXT_CONTENT] = mb_convert_encoding ($content[TEXT_CONTENT], $this->charset, $cs[$content[TEXT_CHARSET]]); return $content; } // function selectLanguage public function 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 $data; public $children = array (); public function __construct ($document, $from=false, $local=array ()) { // function __construct global $store; $this->document = $document; if (is_string ($from)) $this->data = $store->control->read ($from); elseif (is_object ($from)) $this->data = $from->data; elseif (is_array ($from)) $this->data = $from; if ($local) { // local if (!$this->data) $this->data = $local; else $this->data = array_replace_recursive ($this->data, $local); } // local } // function __construct public function appendChild ($from=false, $local=array ()) { // function appendChild if (is_object ($from) and isset ($from->document)) { // from list item if ($local) $from->data = array_replace_recursive ($from->data, $local); $this->children[] = $from; return $from; } // from list item else $this->children[] = new eclEngine_listItem ($this->document, $from, $local); return end ($this->children); } // function appendChild public function childrenMerge ($from) { // function childrenMerge if (is_object ($from)) { // is object foreach ($from->children as $child) { // each child if (isset ($child->document)) $this->children[] = $child; else $this->children[] = new eclEngine_listItem ($this->document, $child); } // each child } // is object } // function childrenMerge public function url ($pathway=true, $lang=true, $action=true, $protocol=true) { // function url if ($pathway === true) $pathway = $this->document->application->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'])) $this->data['pathway'] = $this->document->application->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 $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 (); private $levelIndex = 0; private $levelArray = array (); public function __construct ($document=false) { // function __construct $this->document = $document; } // function __construct public function levelUp ($data) { // function levelUp $this->levelIndex++; $this->levelArray[$this->levelIndex] = array (); $a = &$this->levelArray[$this->levelIndex]; if (isset ($data['data']) or isset ($data['local']) or isset ($data['text'])) { // data $a['data'] = $this->data; $this->data = array (); if (isset ($data['data'])) $this->data = $data['data']; if (isset ($data['local'])) $this->data = array_replace ($this->data, $data['local']); if (isset ($data['text'])) $this->data = array_replace ($this->data, $data['text']); } // data if (isset ($data['mod'])) { // mod $a['mod'] = $this->mod; $this->mod = $data['mod']; } // mod if (isset ($data['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]) $this->render_tags ($content); elseif ( (!isset ($content[TEXT_FORMAT]) or !$content[TEXT_FORMAT]) and (!isset ($content[TEXT_HTML]) or !$content[TEXT_HTML])) $this->buffer .= str_replace ($s, $r, $content[TEXT_CONTENT]); else $this->buffer .= $content[TEXT_CONTENT]; } // function render private function 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 duas quebras de linha consecutivas: $paragraph_end = strpos ($string, LF . LF, $paragraph_start); if ($paragraph_end === false) $paragraph_end = $strlen; else $paragraph_end += 2; // pega o primeiro caractére do parágrafo $char = $string[$paragraph_start]; switch ($char) { // switch char // Ignora os caractéres case CR: case LF: case "\t": $paragraph_end = $paragraph_start + 1; break; // Listas case '*': case '#': case '@': if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $paragraph = substr ($string, $paragraph_start, $paragraph_end - $paragraph_start); // Separa as linhas do parágrafo $lines = explode (LF, $paragraph); $last = ''; $last_level = 0; // Percorre as linhas deste parágrafo foreach ($lines as $line) { // each line if (!strlen (trim ($line))) continue; // Quantos símbolos existem no início desta linha $current_level = strspn ($line, '*#@'); // Recorta os símbolos encontrados para análize posterior $current = substr ($line, 0, $current_level); $line = $this->filter_html (trim (substr ($line, $current_level)), $text_html, $editable); // Uma versão mais descomplicada da linha acima: // Retira os símbolos do início da linha // $line = substr ($line, $current_level); // $line = trim ($line); // $line = $this->filter_html ($line, $text_html, $editable); // Se não houverem símbolos no início desta linha, trata-se de uma // quebra acidental, o que nos leva a emendar esta linha com a linha anterior if (!$current_level and strlen ($line)) $result .= ' ' . $line; else { // valid line // Vamos comparar os símbolos da linha atual com a linha anterior // para determinar até que ponto são iguais for ($equal = 0; $equal < $last_level and $equal < $current_level and $current[$equal] == $last[$equal]; $equal++) { } // compare levels // Se o resultado indica que precisamos descer algum nível da lista for ($level = $last_level; $level > $equal; $level--) { // loop level down $char = $last[$level - 1]; if ($char == '*') $result .= $marks['li_close'] . LF . $marks['ul_close'] . LF; elseif ($char == '#') $result .= $marks['li_close'] . LF . $marks['ol_close'] . LF; else $result .= $marks['li_close'] . LF . $marks['al_close'] . LF; } // loop level down // Se fechamos uma lista, a linha atual deverá ser criada como um novo item if ($last_level > $equal and $equal) { // new item after close a list $result .= $marks['li_close'] . LF . $marks['li_open']; } // new item after close a list // Se o prefixo da lista anterior for idêntico ao desta, // simplesmente criamos um novo item if ($last_level == $equal and $current_level == $equal and $equal) { // item in same level $result .= $marks['li_close'] . LF . $marks['li_open']; } // item in same level // Se for preciso criar sublistas for ($level = $equal; $level < $current_level; $level++) { // level up if ($level) $result .= LF; $char = $current[$level]; if ($char == '*') $result .= $marks['ul_open'] . LF . $marks['li_open']; elseif ($char == '#' and $level == 0) $result .= $marks['ol_open_first'] . LF . $marks['li_open']; elseif ($char == '#') $result .= $marks['ol_open'] . LF . $marks['li_open']; else $result .= $marks['al_open'] . LF . $marks['li_open']; } // level up // Finalmente, colocamos o conteúdo desta linha $result .= $line; // Preparamos a próxima iteração anotando os itens desta linha como // sendo os símbolos da linha anterior $last = $current; $last_level = $current_level; } // valid line } // each line // Acrescenta o fechamento do último item da lista for ($level = $last_level; $level > 0; $level--) { // loop level down $char = $last[$level - 1]; if ($char == '*') $result .= $marks['li_close'] . LF . $marks['ul_close'] . LF; elseif ($char == '#') $result .= $marks['li_close'] . LF . $marks['ol_close'] . LF; else $result .= $marks['li_close'] . LF . $marks['al_close'] . LF; } // loop level down break; // Cabeçálhos - ou Títulos case '=': $previousIsParagraph = true; $paragraph = substr ($string, $paragraph_start, $paragraph_end - $paragraph_start); // Vamos ver quantos símbolos = tem no início do parágrafo $level = strspn ($paragraph, '='); // Se forem de 1 a 6 if ($level <= 6) { // valid header level // Vamos filtrar o parágrafo, removendo os sinais de = no início e no final $paragraph = trim ($paragraph, "= \r\n\t"); $paragraph = $this->filter_html ($paragraph, $text_html, $editable); $result .= $marks['h' . $level . '_open'] . $paragraph . $marks['h' . $level . '_close'] . LF; } // valid header level // Se tiverem mais de 6 sinais de =, será tratado como um parágrafo normal else $result .= $marks['p_open'] . $this->filter_html (trim ($paragraph), $text_html, $editable) . $marks['p_close'] . LF; break; // Um separador horizontal case '-': $paragraph = substr ($string, $paragraph_start, $paragraph_end - $paragraph_start); // Quantos hifens ("-") tem no parágrafo $level = strspn ($paragraph, '-'); // Vamos limpar o parágrafo $clean = trim ($paragraph, "- \r\n\t"); // Somente se houverem mais de 4 hifens e se não houver restado nada após a limpeza if ($level > 4 and !strlen ($clean)) { // insert separator if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $result .= $marks['hr'] . LF; } // insert separator // Caso contrário, este será mais um parágrafo comum else { // insert paragraph $previousIsParagraph = true; $result .= $marks['p_open'] . $this->filter_html (trim ($paragraph), $text_html, $editable) . $marks['p_close'] . LF; } // insert paragraph break; // procura por marcações que alteram o método de formatação case '[': $start = $paragraph_start + 1; // Procura por ] $end = strpos ($string, ']', $start); // Se for encontrado if (is_int ($end)) { // end of tag found // Recortamos a tag $tag = substr ($string, $start, $end - $start); list ($type) = explode (':', $tag); $original = $type; // Vamos analizar seu conteúdo switch ($type) { // switch tag case 'style': case 'script': // Se não for permitido script ou style, as marcas serão convertidas if ($text_html != 2) $type = 'pre'; case 'code': case 'pre': // Vamos procurar pela marca de fechamento $close_tag = '[/' . $original . ']'; $close_length = strlen ($close_tag); $close_pos = strpos ($string, $close_tag, $end); // Se a encontrarmos if ($close_pos) { // close tag found if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $paragraph_end = $close_pos + $close_length; $end++; $paragraph = substr ($string, $end, $close_pos - $end); // Se o conteudo for do tipo code ou pre, escapamos o HTML if ($type == 'code' or $type == 'pre') $paragraph = str_replace ('<', '<', $paragraph); // Se o conteúdo for do tipo code e for preciso pular as marcações if ($type == 'code' and $text_ecolabore) $paragraph = '[jump]' . str_replace ('[/jump]', '[[/jump]/jump][jump]', $paragraph) . '[/jump]'; $result .= $marks[$type . '_open'] . $paragraph . $marks[$type . '_close'] . LF; break 2; } // close tag found // outras marcações serão consideradas como um parágrafo normal // simplesmente deixando o fluxo do programa prosseguir } // switch tag } // end of tag found // Um parágrafo normal default: $paragraph = trim (substr ($string, $paragraph_start, $paragraph_end - $paragraph_start)); if ($editable and substr ($paragraph, 0, 13) == '[placeholder:') { // placeholder $result .= $marks['p_open'] . $this->filter_html ($paragraph, 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = true; } // placeholder elseif ($text_ecolabore and strlen ($paragraph) > 1 and $paragraph[0] == '[' and $paragraph[strlen ($paragraph) - 1] == ']') { // markup alone if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; $previousIsParagraph = false; $result .= $paragraph; } // markup alone else { // insert paragraph $previousIsParagraph = true; $result .= $marks['p_open'] . $this->filter_html ($paragraph, $text_html, $editable) . $marks['p_close'] . LF; } // insert paragraph } // switch char // Movemos o ponteiro adiante $paragraph_start = $paragraph_end; } // move pointer if ($editable and !$previousIsParagraph) $result .= $marks['p_open'] . $this->filter_html ('', 2, $editable) . $marks['p_close'] . LF; // converte quebras de linhas Linux para Windows $result = str_replace (LF, CRLF, $result); $content[TEXT_CONTENT] = $result; } // function text2html /* * 0 type * 1 value * 2 arguments * 3 sublevel * 4 silent * 5 parse error * * Type values * 0 string buffer * 1 function * 2 variable * 3 number * 4 operator * 5 precedent operator */ public function render_tags ($content, $parseOnly=false) { // function render_tags if (is_string ($content)) $_string = $content; elseif (is_array ($content) and isset ($content[1])) $_string = $content[TEXT_CONTENT]; else return; $_length = strlen ($_string); $_pointer = 0; $_array = array (); $_level = 1; $_index = array (1 => 0); PARSE_TAG_SEEK: $_pos = strpos ($_string, '[', $_pointer); if ($_pos === false) { // open tag not found $_array[$_level][$_index[$_level]] = array (0, substr ($_string, $_pointer)); goto PARSE_END_OF_STRING; } // open tag not found if ($_pos > $_pointer) { // buffer $_array[$_level][$_index[$_level]] = array (0, substr ($_string, $_pointer, $_pos - $_pointer)); $_index[$_level]++; } // buffer $_pointer = $_pos + 1; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); if ($_char == 91) { // [[ $_pos = strpos ($_string, ']]', $_pointer); if ($_pos === false) { // end tag not found $_array[$_level][$_index[$_level]] = array (0, '[['); $_index[$_level]++; $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_TAG_SEEK; } // end tag not found $_pointer++; $_array[$_level][$_index[$_level]] = array ( 0 => 1, 1 => 'key', 2 => array ( 0 => array ( 0 => 0, 1 => substr ($_string, $_pointer, $_pos - $_pointer) ) ) ); $_index[$_level]++; $_pointer = $_pos + 2; if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_TAG_SEEK; } // [[ if ($_char == 93) { // [] $_array[$_level][$_index[$_level]] = array (0, '['); $_index[$_level]++; $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; goto PARSE_TAG_SEEK; } // [] PARSE_NEXT_INSTRUCTION: while ($_char == 9 or $_char == 10 or $_char == 13 or $_char == 32) // tab 9 lf 10 cr 13 espace 32 { // empty space $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); } // empty space if ($_char == 47 and $_pointer + 1 < $_length and ($_string[$_pointer + 1] == '/' or $_string[$_pointer + 1] == '*')) { // comment $_pointer++; $_char = ord ($_string[$_pointer]); if ($_char == 47) { // inline comment $_offset = strcspn ($_string, "\r\n;]", $_pointer); $_pointer += $_offset; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); } // inline comment elseif ($_char == 42) { // block comment $_pos = strpos ($_string, '*/', $_pointer); if ($_pos === false) goto PARSE_END_OF_STRING; $_pointer = $_pos + 2; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); } // block comment goto PARSE_NEXT_INSTRUCTION; } // comment if ($_char == 125) { // } level down $_level--; if (!$_level) goto PARSE_END_OF_STRING; $_array[$_level][$_index[$_level]][3] = $_array[$_level + 1]; $_index[$_level]++; unset ($_array[$_level + 1]); $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // } level down if ($_char == 96) { // ` string $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $pos = strpos ($_string, '`', $_pointer); if ($pos === false) goto PARSE_END_OF_STRING; $_array[$_level][$_index[$_level]] = array ( 0 => 0, 1 => substr ($_string, $_pointer, $pos - $_pointer) ); $_index[$_level]++; $_pointer = $pos + 1; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // ` string $_offset = strcspn ($_string, '{};]', $_pointer); if (!$_offset) goto PARSE_END_OF_INSTRUCTION; $length = $_pointer + $_offset; $pointer = $_pointer; $char = ord ($_string[$pointer]); $silent = false; $name = ''; $level = 1; $index[1] = 0; $array = array (1 => array ()); if ($char == 64) { // @ silent $silent = true; while ($char == 9 or $char == 10 or $char == 13 or $char == 32 or $char == 64) // tab 9 lf 10 cr 13 espace 32 @ 64 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space } // @ silent if ($char == 47) { // / end function $name .= 'end'; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // / end function if ( ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122)) { // a-z _ A-Z do { // . a-z _ A-Z 0-9 $name .= $_string[$pointer]; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // . a-z _ A-Z 0-9 while ($char == 46 or ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122) or ($char >= 48 and $char <= 57)); } // a-z _ A-Z // Elimina parênteses e espaços desnecessários while ($char == 9 or $char == 10 or $char == 13 or $char == 32) // tab 9 lf 10 cr 13 espace 32 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space if ($char == 40) { // () $char = ord ($_string[$length - 1]); while ($char == 9 or $char == 10 or $char == 13 or $char == 32 or $char == 64) // tab 9 lf 10 cr 13 espace 32 @ 64 { // rtrim $length--; $char = ord ($_string[$length - 1]); } // rtrim if ($char == 41) $length--; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // () if ($char == 58) { // : string $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $offset = strcspn ($_string, '{]', $pointer); $array[1][0] = array ( 0 => 0, 1 => substr ($_string, $pointer, $offset) ); $_offset = ($pointer + $offset) - $_pointer; goto PARSE_END_OF_ARGUMENTS; } // string goto PARSE_NEXT_ARGUMENT_NO_DOWN; PARSE_NEXT_ARGUMENT: while (isset ($down[$level])) { // operator level down unset ($down[$level]); $level--; if (!$level) goto PARSE_END_OF_ARGUMENTS; $array[$level][$index[$level]][2] = $array[$level + 1]; unset ($array[$level + 1]); $index[$level]++; } // operator level down PARSE_NEXT_ARGUMENT_NO_DOWN: while ($char == 9 or $char == 10 or $char == 13 or $char == 32) // tab 9 lf 10 cr 13 espace 32 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space if ($char == 45 or $char == 46 or ($char >= 48 and $char <= 57)) { // number $buffer = ''; do { // loop numbers $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) break; $char = ord ($_string[$pointer]); } // loop numbers while ($char == 46 or ($char >= 48 and $char <= 57)); $array[$level][$index[$level]] = array ( 0 => 3, 1 => $buffer ); $index[$level]++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // number if ($char == 36) { // $ variable $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $buffer = ''; do { // . a-z _ A-Z 0-9 $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) break; $char = ord ($_string[$pointer]); } // . a-z _ A-Z 0-9 while ($char == 45 or $char == 46 or ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122) or ($char >= 48 and $char <= 57)); $array[$level][$index[$level]] = array ( 0 => 2, 1 => $buffer ); $index[$level]++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // $ variable if ( ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122)) { // function $buffer = ''; do { // . a-z _ A-Z 0-9 $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) break; $char = ord ($_string[$pointer]); } // . a-z _ A-Z 0-9 while ($char == 46 or ($char >= 65 and $char <= 90) or $char == 95 or ($char >= 97 and $char <= 122) or ($char >= 48 and $char <= 57)); if ($buffer == 'and' or $buffer == 'or') { // operator if (!$index[$level]) goto PARSE_END_OF_ARGUMENTS; $index[$level]--; $operand = $array[$level][$index[$level]]; $array[$level][$index[$level]] = array (0 => 4, 1 => $buffer); // puts the operand into argument list $level++; $array[$level] = array (0 => $operand); $index[$level] = 1; // Alert to down a level after next operand $down[$level] = true; goto PARSE_NEXT_ARGUMENT_NO_DOWN; } // operator else $array[$level][$index[$level]] = array (0 => 1, 1 => $buffer); if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; while ($char == 9 or $char == 10 or $char == 13 or $char == 32 or $char == 44) // tab 9 lf 10 cr 13 espace 32 , 44 { // empty space $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // empty space if ($char == 40) { // ( level up $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $level++; $index[$level] = 0; $array[$level] = array (); $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ( level up $index[$level]++; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // function if ($char == 40) { // ( level up $array[$level][$index[$level]] = array ( 0 => 1, 1 => '' ); $level++; $index[$level] = 0; $array[$level] = array (); $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ( level up if ($char == 41) { // ) level down $level--; if (!$level) goto PARSE_END_OF_ARGUMENTS; $array[$level][$index[$level]][2] = $array[$level + 1]; $index[$level]++; while (isset ($down[$level])) { // operator level down unset ($down[$level]); $level--; if (!$level) goto PARSE_END_OF_ARGUMENTS; $array[$level][$index[$level]][2] = $array[$level + 1]; $index[$level]++; } // operator level down $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ) level down if ($char == 96) { // ` string $pointer++; if ($pointer == $_length) goto PARSE_END_OF_STRING; $pos = strpos ($_string, '`', $pointer); if ($pos === false) goto PARSE_END_OF_STRING; $array[$level][$index[$level]] = array ( 0 => 0, 1 => substr ($_string, $pointer, $pos - $pointer) ); $index[$level]++; if ($pos > $length) { // new ending $pointer = $pos + 1; $_pointer = $pointer; $_offset = strcspn ($_string, ';{]', $pointer); if (!$_offset) goto PARSE_END_OF_ARGUMENTS; $length = $pointer + $_offset; } // new ending else $pointer = $pos + 1; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // ` string if ($char == 33) { // ! operator $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); $array[$level][$index[$level]] = array (0 => 5, 1 => '!'); $level++; $array[$level] = array (); $index[$level] = 0; // Alert to down a level after next operand $down[$level] = true; goto PARSE_NEXT_ARGUMENT_NO_DOWN; } // ! operator if ($char == 38 or $char == 42 or $char == 43 or $char == 45 or $char == 47 or $char == 60 or $char == 61 or $char == 62) { // = + - / * += -= /= *= == & | operadores $buffer = $_string[$pointer]; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); if ($char == 38 or $char == 42 or $char == 43 or $char == 45 or $char == 47 or $char == 60 or $char == 61 or $char == 62) { // second operator $buffer .= $_string[$pointer]; $pointer++; if ($pointer == $length) goto PARSE_END_OF_ARGUMENTS; $char = ord ($_string[$pointer]); } // second operator if (!$index[$level]) goto PARSE_END_OF_ARGUMENTS; $index[$level]--; $operand = $array[$level][$index[$level]]; $array[$level][$index[$level]] = array (0 => 4, 1 => $buffer); // puts the operand into argument list $level++; $array[$level] = array (0 => $operand); $index[$level] = 1; // Alert to down a level after next operand $down[$level] = true; goto PARSE_NEXT_ARGUMENT_NO_DOWN; } // = + - / * += -= /= *= == & | operadores // salta caractéres não reconhecidos até aqui $pointer++; if ($pointer < $length) { // unrecognized char $char = ord ($_string[$pointer]); goto PARSE_NEXT_ARGUMENT; } // unrecognized char PARSE_END_OF_ARGUMENTS: while (isset ($down[$level])) { // operator level down unset ($down[$level]); $level--; if (!$level) break; $array[$level][$index[$level]][2] = $array[$level + 1]; unset ($array[$level + 1]); } // operator level down if (strlen ($name) or $array[1]) { // creates a new function $_array[$_level][$_index[$_level]] = array ( 0 => 1, 1 => $name, 2 => $array[1], 4 => $silent ); $_pointer += $_offset; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); if ($_char == 123) { // { level up $_level++; $_array[$_level] = array (); $_index[$_level] = 0; $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // { level up else $_index[$_level]++; goto PARSE_END_OF_INSTRUCTION; } // creates a new function $_pointer += $_offset; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); PARSE_END_OF_INSTRUCTION: if ($_char == 59) { // ; end of instruction $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; } // ; end of instruction if ($_char == 93) { // ] $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; if (ord ($_string[$_pointer]) == 13) { // cr $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; } // cr if (ord ($_string[$_pointer]) == 10) { // lf $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; } // lf goto PARSE_TAG_SEEK; } // ] // unrecognized char $_pointer++; if ($_pointer == $_length) goto PARSE_END_OF_STRING; $_char = ord ($_string[$_pointer]); goto PARSE_NEXT_INSTRUCTION; PARSE_END_OF_STRING: if ($parseOnly) return $_array[1]; $this->render_tags_level ($_array[1]); } // function render_tags public function render_tags_level ($array) { // function render_tags_level $length = count ($array); if (!$length) return; $index = 0; goto LEVEL_NEXT_INSTRUCTION_1; LEVEL_NEXT_INSTRUCTION: $index++; if ($index == $length) return; LEVEL_NEXT_INSTRUCTION_1: $current = $array[$index]; if (!isset ($current[1])) goto LEVEL_NEXT_INSTRUCTION; if ($current[0] == 0) { // buffer $this->buffer .= $current[1]; goto LEVEL_NEXT_INSTRUCTION; } // buffer if (isset ($current[2]) and $current[2]) $arguments = $this->render_tags_arguments ($current[2]); else $arguments = array (); switch ($current[1]) { // switch function name case 'if': if ($arguments and ( (is_string ($arguments[0]) and strlen ($arguments[0]) and $arguments[0] != '0') or (!is_string ($arguments[0]) and $arguments[0]) )) { // if condition evaluates true if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); goto LEVEL_NEXT_INSTRUCTION; } // if condition evaluates true while ($index + 1 != $length and isset ($array[$index + 1][1]) and $array[$index + 1][1] == 'elseif') { // loop elseif $current = $array[$index + 1]; if (isset ($current[2])) { // conditions exists $arguments = $this->render_tags_arguments ($current[2]); if ($arguments and $arguments[0]) { // elseif condition evaluates true if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); $index++; goto LEVEL_NEXT_INSTRUCTION; } // elseif condition evaluates true } // conditions exists $index++; } // loop elseif if ($index + 1 != $length and isset ($array[$index + 1][1]) and $array[$index + 1][1] == 'else') { // else $current = $array[$index + 1]; if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); $index++; } // else goto LEVEL_NEXT_INSTRUCTION; case 'elseif': case 'else': goto LEVEL_NEXT_INSTRUCTION; case 'loop': do { // loop if (isset ($current[3]) and $current[3]) $this->render_tags_level ($current[3]); } // loop while (eclTag_loop::render ($this)); goto LEVEL_NEXT_INSTRUCTION; case '': if (isset ($arguments[0]) and (!isset ($current[4]) or !$current[4])) $this->buffer .= strval ($arguments[0]); goto LEVEL_NEXT_INSTRUCTION; default: 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': continue; 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 $func = 'eclTag_' . $current[1]; $arguments[] = $func::render ($this, $sub); } // sub function break; case 2: $arguments[] = $this->getVar ($current[1]); break; case 4: if (!isset ($current[2]) or !$current[2]) break; $sub = $this->render_tags_arguments ($current[2]); if (count ($sub) < 2) break; switch ($current[1]) { // switch operator case 'and': if ($sub[0] and $sub[1]) $arguments[] = 1; else $arguments[] = 0; break; case 'or': if ($sub[0]) $arguments[] = $sub[0]; elseif ($sub[1]) $arguments[] = $sub[1]; else $arguments[] = ''; break; } // switch operator break; case 5: if (!isset ($current[2]) or !$current[2]) break; $sub = $this->render_tags_arguments ($current[2]); if (!count ($sub)) break; switch ($current[1]) { // switch operator case '!': if ($sub[0]) $arguments[] = 0; else $arguments[] = 1; } // switch operator break; } // switch argument type } // each argument return $arguments; } // function render_tags_arguments public function toKeyword ($key) { // function toKeyword static $convert = array ('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'â' => 'a', 'Â' => 'a', 'ã' => 'a', 'Ã' => 'a', 'á' => 'a', 'Á' => 'a', 'à' => 'a', 'À' => 'a', 'ä' => 'a', 'Ä' => 'a', 'Ç' => 'c', 'ç' => 'c', 'ê' => 'e', 'Ê' => 'e', 'é' => 'e', 'É' => 'e', 'ë' => 'e', 'Ë' => 'e', 'î' => 'i', 'Î' => 'i', 'í' => 'i', 'Í' => 'i', 'ï' => 'i', 'Ï' => 'i', 'ô' => 'o', 'Ô' => 'o', 'õ' => 'o', 'Õ' => 'o', 'ó' => 'o', 'Ó' => 'o', 'ö' => 'o', 'Ö' => 'o', 'û' => 'u', 'Û' => 'u', 'ú' => 'u', 'Ú' => 'u', 'ü' => 'u', 'Ü' => 'u', 'Ý' => 'y', 'ý' => 'y', 'ÿ' => 'y', 'Ÿ' => 'y', '-' => '-', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0', '_' => '_', ' ' => '_'); // The $last will remember the last character of the convertion // to prevent duplicated spacing "__" or "--" in the name $result = ''; $last = ' '; foreach (str_split ($key) as $char) { // each char if (!isset ($convert[$char])) continue; $valid = $convert[$char]; if ($valid != $last) { // not repeated separator if ($valid == '-' or $valid == ' ' or $valid == '_') $last = $valid; else $last = ''; $result .= $valid; } // not repeated separator } // each char return trim ($result, '-_'); } // function toKeyword 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 } // 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']['clear']) and !$value) $value = false; if ($value === false and isset ($control['flags']['required'])) { // required field if (isset ($control['flags']['error_msg'])) return $control['flags']['error_msg']; return 'system_alertRequiredField'; } // 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_int ($field_value)) $conditions[] = '`' . $fieldName . '`=' . strval ($field_value); break; case 'name': if (preg_match ('%^[a-zA-Z0-9@:/._-]*$%', $field_value)) $conditions[] = '`' . $fieldName . "`='" . $field_value . "'"; break; } // switch filter } // valid field } // each where condition // The query $this->query ('DELETE FROM `' . $this->databasePrefix . $table->name . '` WHERE ' . implode (' AND ', $conditions)); } // function delete public function drop ($table) { // function drop $this->query ('DROP TABLE `' . $this->databasePrefix . $table->name . '`'); } // function drop public function close () { // function close global $io; $this->batchQuery ($this->batchQuery); $this->batchQuery = array (); // $io->log->addMessage ($this->performed_queries, 'database'); } // function close public function stringToDatabase ($string) { // function stringToDatabase if (!isset ($this->externalString)) { // set replace sequence $this->externalString = array ( '#', chr (0), chr (26), // chr (34), chr (39), chr (92) ); $this->databaseString = array ( '#c', '#0', '#z', // '#q', '#s', '#e' ); } // set replace sequence return str_replace ($this->externalString, $this->databaseString, $string); } // function stringToDatabase public function stringFromDatabase ($string) { // function stringFromDatabase if (!isset ($this->externalString2)) { // set replace sequence $this->externalString2 = array ( chr (0), chr (26), chr (34), chr (39), chr (92) ); $this->databaseString2 = array ( '#0', '#z', '#q', '#s', '#e' ); } // set replace sequence if (strpos ($string, '\\') === false) return str_replace ('#c', '#', str_replace ($this->databaseString2, $this->externalString2, $string)); return stripslashes ($string); } // function stringFromDatabase public static function filterKeywords ($string) { // function filterKeywords static $convert = array ('a' => 'a', 'b' => 'b', 'c' => 'c', 'd' => 'd', 'e' => 'e', 'f' => 'f', 'g' => 'g', 'h' => 'h', 'i' => 'i', 'j' => 'j', 'k' => 'k', 'l' => 'l', 'm' => 'm', 'n' => 'n', 'o' => 'o', 'p' => 'p', 'q' => 'q', 'r' => 'r', 's' => 's', 't' => 't', 'u' => 'u', 'v' => 'v', 'w' => 'w', 'x' => 'x', 'y' => 'y', 'z' => 'z', 'A' => 'a', 'B' => 'b', 'C' => 'c', 'D' => 'd', 'E' => 'e', 'F' => 'f', 'G' => 'g', 'H' => 'h', 'I' => 'i', 'J' => 'j', 'K' => 'k', 'L' => 'l', 'M' => 'm', 'N' => 'n', 'O' => 'o', 'P' => 'p', 'Q' => 'q', 'R' => 'r', 'S' => 's', 'T' => 't', 'U' => 'u', 'V' => 'v', 'W' => 'w', 'X' => 'x', 'Y' => 'y', 'Z' => 'z', 'â' => 'a', 'Â' => 'a', 'ã' => 'a', 'Ã' => 'a', 'á' => 'a', 'Á' => 'a', 'à' => 'a', 'À' => 'a', 'ä' => 'a', 'Ä' => 'a', 'Ç' => 'c', 'ç' => 'c', 'ê' => 'e', 'Ê' => 'e', 'é' => 'e', 'É' => 'e', 'ë' => 'e', 'Ë' => 'e', 'î' => 'i', 'Î' => 'i', 'í' => 'i', 'Í' => 'i', 'ï' => 'i', 'Ï' => 'i', 'ô' => 'o', 'Ô' => 'o', 'õ' => 'o', 'Õ' => 'o', 'ó' => 'o', 'Ó' => 'o', 'ö' => 'o', 'Ö' => 'o', 'û' => 'u', 'Û' => 'u', 'ú' => 'u', 'Ú' => 'u', 'ü' => 'u', 'Ü' => 'u', 'Ý' => 'y', 'ý' => 'y', 'ÿ' => 'y', 'Ÿ' => 'y', ' ' => ' ', '-' => '-', '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '0' => '0', '_' => ' ', ':' => ':', ';' => ';'); // The $last will remember the last character of the convertion // to prevent duplicated spacing "__" or "--" in the name $result = ''; $last = ' '; foreach (str_split ($string) as $char) { // each char if (!isset ($convert[$char])) continue; $valid = $convert[$char]; if ($valid != $last) { // not repeated separator if ($valid == '-' or $valid == ' ') $last = $valid; else $last = ''; $result .= $valid; } // not repeated separator } // each char $words = explode (' ', $result); $keywords = array (); $validWords = array (); foreach ($words as $word) { // each word $validWords[strlen ($word)][] = $word; } // each word krsort ($validWords); foreach ($validWords as $index => $group) { // each group if ($index < 3) break; foreach ($group as $word) { // each word $valid = true; foreach ($keywords as $value) { // each keyword if (is_int (strpos ($value, $word))) { // existing word $valid = false; } // existing word } // each keyword if ($valid) $keywords[] = $word; } // each word } // each group sort ($keywords); return $keywords; } // function filterKeywords } // class eclIo_database //!eof:engine/eclIo/eclIo_database.php; //!file:engine/eclIo/eclIo_file.php; class eclIo_file { // class eclIo_file private $openedFiles = array (); public function &open ($name) { // function & if (!isset ($this->openedFiles[$name])) { // open file if (is_file ($name)) $this->openedFiles[$name][0] = $this->string2array (file_get_contents ($name, FILE_BINARY)); else $this->openedFiles[$name][0] = array (); $this->openedFiles[$name][1] = $this->openedFiles[$name][0]; } // open file $data = &$this->openedFiles[$name][0]; return $data; } // function & public function read ($name) { // function read if (is_file ($name)) return $this->string2array (file_get_contents ($name, FILE_BINARY)); return array (); } // function read public function close () { // function close foreach ($this->openedFiles as $name => $contents) { // each opened file // protection mode // 'array2string ($contents[0])); if (!$contents[0] and is_file ($name)) unlink ($name); } // each opened files } // function close public static function array2string ($array, $use_counter=false) { // function array2string if (!is_array ($array)) return ''; // a string resultante $string = ''; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; // iniciaremos copiando o array para o primeiro andar do edifício reset ($array); $building[$floor] = $array; // nosso processo se dará em um loop "infinito" while (1) { // loop // capturaremos o item corrente do array no andar em que nos encontramos // com each, após a captura, o ponteiro interno do array deverá avançar para o próximo item $item = each ($building[$floor]); // se o array tiver terminado, desceremos um andar if ($item === false) { // end of array unset ($building[$floor]); $floor--; // Se chegarmos ao "térreo", o processo terminou if (!$floor) break; // Se não terminou, imprime "}" $string .= "}" . CRLF; } // end of array else { // array item // capturamos a chave e o valor do item corrente $key = $item[0]; $value = $item[1]; // imprimimos a chave do array if (is_int ($key)) { // int key if ($floor < 3 and $use_counter) $string .= '#'; else $string .= strval ($key); } // int key else { // string key $string .= "'" . str_replace ("'", "''", $key) . "'"; } // string key // Se o valor for um "subarray", if (is_array ($value)) { // value is array // subimos um andar $floor++; // copiamos o array deste valor para o andar em que nos encontramos reset ($value); $building[$floor] = $value; // Imprimimos "={" $string .= "={" . CRLF; } // value is array // Caso o valor seja numérico elseif (is_int ($value)) { // numeric value // imprimimos "=" e o valor sem os apóstrofos $string .= '=' . strval ($value) . CRLF; } // numeric value elseif (is_object ($value)) { // is object } // is object // Ou consideraremos o valor como string else { // string value // imprimimos a string englobada por "'", e duplicamos os apóstrofos encontrados dentro dela $string .= "='" . str_replace ("'", "''", $value) . "'" . CRLF; } // string value } // array item } // loop return $string; } // function array2string public static function string2array ($string, $counter1=0) { // function string2array if (!is_string ($string)) return array (); // acrescentamos à string recebida uma quebra de linha $string .= LF; // o cumprimento total da string $strlen = strlen ($string); // o ponteiro que percorrerá a string $pointer = 0; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; $building[$floor] = array (); // O contador que substituirá os coringas encontrados $counter[$floor] = $counter1; // Sinalizadores $buffer = ''; $buffer_enabled = false; $buffer_string = false; $key_enabled = false; // iremos varrer a string até que o ponteiro alcance seu cumprimento total while ($pointer < $strlen) { // get char // capturamos o caractére da string que se encontra sob o ponteiro $char = $string[$pointer]; // Verificamos que caractére é este switch ($char) { // char // ao encontrar uma quebra de linha, criamos um novo item de array case "\n": if (!$buffer_string)settype ($buffer, 'int'); if ($key_enabled) { // creates a value $building[$floor][$key] = $buffer; } // creates a value $buffer = ''; $key_enabled = false; $buffer_enabled = false; $buffer_string = false; break; // ao encontrar "=", o que estiver no $buffer representa a chave de um item case '=': if ($buffer_enabled) { // creates key if ($buffer == '#') { // counter $buffer = $counter[$floor]; $counter[$floor]++; } // counter elseif (!$buffer_string) { // numeric settype ($buffer, 'int'); } // numeric $key = $buffer; $buffer = ''; $buffer_enabled = false; $buffer_string = false; $key_enabled = true; } // creates key break; // ao encontrar "{", subiremos um andar case '{': if ($key_enabled) { // sublevel $array_key[$floor] = $key; $floor++; $building[$floor] = array (); $counter[$floor] = 0; } // sublevel $key = ''; $key_enabled = false; $buffer = ''; $buffer_enabled = false; $buffer_string = false; break; // ao encontrar "}", copiamos o array do andar corrente para o item atual do andar inferior e descemos um andar case '}': if ($floor <= 1) break 2; $building[$floor - 1][$array_key[$floor - 1]] = $building[$floor]; $counter[$floor] = 0; $floor--; $buffer = ''; $buffer_enabled = false; $buffer_string = false; $key = ''; $key_enabled = false; break; // Ao encontrar "'", procuramos uma string com apóstrofos duplicados ("''") case "'": case '"': loop_escape_char: $n_close_string = strpos ($string, $char, $pointer + 1); if ($n_close_string === false) break; $buffer .= substr ($string, $pointer + 1, $n_close_string - ($pointer + 1)); $buffer_enabled = true; $buffer_string = true; $pointer = $n_close_string; if ($string[$pointer + 1] != $char) break; $buffer .= $char; $pointer++; goto loop_escape_char; // Caractéres ignorados case "\r": case "\t": case ' ': break; // Ao encontrar "/" ou "<", seguiremos ignorando uma linha de comentário case '<': case '/': $n_close_string = strpos ($string, LF, $pointer + 1); if ($n_close_string === false) break; else { // coment $pointer = $n_close_string - 1; } // coment break; // outros caractéres são guardados em $buffer default: $buffer .= $char; $buffer_enabled = true; break; } // char // avança o ponteiro para o próximo caractére $pointer++; } // get char return $building[1]; } // function string2array public static function array2xml ($array, $use_counter=false) { // function array2xml if (!is_array ($array)) return ''; // a string resultante $string = ''; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; // iniciaremos copiando o array para o primeiro andar do edifício $building[$floor] = $array; // nosso processo se dará em um loop "infinito" while (1) { // loop // capturaremos o item corrente do array no andar em que nos encontramos // com each, após a captura, o ponteiro interno do array deverá avançar para o próximo item $item = each ($building[$floor]); // se o array tiver terminado, desceremos um andar if ($item === false) { // end of array unset ($building[$floor]); $floor--; // Se chegarmos ao "térreo", o processo terminou if (!$floor) break; // Se não terminou, imprime a marcação de fechamento $string .= '<' . current ($building[$floor]) . ">" . CRLF; } // end of array else { // array item // capturamos a chave e o valor do item corrente $key = $item[0]; $value = $item[1]; // imprimimos a chave do array $string .= '<' . $key . '>'; // Se o valor for um "subarray", if (is_array ($value)) { // value is array // subimos um andar $floor++; // copiamos o array deste valor para o andar em que nos encontramos $building[$floor] = $value; // Imprimimos uma quebra de linha $string .= CRLF; } // value is array elseif (is_object ($value)) { // is object } // is object else { // numeric value // imprimimos "=" e o valor sem os apóstrofos $string .= strval ($value) . '" . CRLF; } // numeric value } // array item } // loop return $string; } // function array2xml } // class eclIo_file //!eof:engine/eclIo/eclIo_file.php; //!file:engine/eclIo/eclIo_fileBinary.php; class eclIo_fileBinary { // class eclIo_fileBinary private $openedFiles = array (); public function &open ($name) { // function & if (!isset ($this->openedFiles[$name])) { // open file if (is_file ($name)) $this->openedFiles[$name][0] = file_get_contents ($name); else $this->openedFiles[$name][0] = ''; $this->openedFiles[$name][1] = $this->openedFiles[$name][0]; } // open file $data = &$this->openedFiles[$name][0]; return $data; } // function & public function close () { // function close foreach ($this->openedFiles as $name => $contents) { // each opened file if (strlen ($contents[0]) and $contents[0] != $contents[1]) file_put_contents ($name, $contents[0]); if (!strlen ($contents[0]) and is_file ($name)) unlink ($name); } // each opened files } // function close } // class eclIo_fileBinary //!eof:engine/eclIo/eclIo_fileBinary.php; //!file:engine/eclIo/eclIo_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 = '//!' . 'packager:start_of_map' . CRLF; $map .= '$systemMap = array (' . CRLF; $first = true; 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; $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)) $lines[] = $line; } // each line if ($lines) { // lines exists if ($first) $first = false; else $map .= ',' . CRLF; $map .= "'" . substr ($name, 4, - 4) . "' => array('" . implode ("', '", $lines) . "')"; } // lines exists } // each file } // scan library $map .= CRLF; $map .= ');' . CRLF; $map .= '//!' . 'packager:end_of_map' . CRLF; return $map; } // function pack_map private function add ($mode, $path, $name, $content) { // function add $content = str_replace ($this->externalString, $this->databaseString, $content); $offset = strlen ($this->dataBuffer); $length = strlen ($content); $this->dataBuffer .= $content; $this->dataIndex[$mode][$path][$name] = strval ($offset) . ':' . strval ($length); } // function add private function pack_controls () { // function pack_controls foreach ($this->getAllFilesNames (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 = ''; // o edifício $building = array (); // o andar em que nos encontramos $floor = 1; // iniciaremos copiando o array para o primeiro andar do edifício $building[$floor] = $array; $started[$floor] = false; // nosso processo se dará em um loop "infinito" while (1) { // loop // capturaremos o item corrente do array no andar em que nos encontramos // com each, após a captura, o ponteiro interno do array deverá avançar para o próximo item $item = each ($building[$floor]); // se o array tiver terminado, desceremos um andar if ($item === false) { // end of array unset ($building[$floor]); $floor--; // Se chegarmos ao "térreo", o processo terminou if (!$floor) break; // Se não terminou, imprime ")" $string .= CRLF . ')'; } // end of array else { // array item // capturamos a chave e o valor do item corrente $key = $item[0]; $value = $item[1]; // Se não for o primeiro item, acrescentaremos uma vírgula após o item anterior if ($started[$floor]) $string .= ',' . CRLF; else { // start $string .= CRLF; $started[$floor] = true; } // start // imprimimos a chave do array if (is_int ($key)) { // int key $string .= $key . ' => '; } // int key else { // string key $string .= "'" . str_replace ("'", "''", $key) . "'" . ' => '; } // string key // Se o valor for um "subarray", if (is_array ($value)) { // value is array // subimos um andar $floor++; // copiamos o array deste valor para o andar em que nos encontramos $building[$floor] = $value; $started[$floor] = false; // Imprimimos "array (" $string .= "array ("; } // value is array // Caso o valor seja numérico elseif (is_int ($value)) { // numeric value // imprimimos o valor sem os apóstrofos $string .= strval ($value); } // numeric value elseif (is_object ($value)) { // is object $string .= "''"; } // is object // Ou consideraremos o valor como string else { // string value // imprimimos a string englobada por "'", e duplicamos os apóstrofos encontrados dentro dela $string .= "'" . str_replace ("'", "''", $value) . "'"; } // string value } // array item } // loop return $string; } // function array2php public function extract ($params=array ()) { // function extract if (!defined ('SYSTEM_IS_PACKED') or !SYSTEM_IS_PACKED) return; set_time_limit (3600); ignore_user_abort (true); $this->index_contents = file_get_contents (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 $systemMap; // extract maps foreach ($systemMap as $application => $names) { // each map list ($module) = explode ('_', $application); $content = implode (CRLF, $names); $this->filePutContents (PATH_ROOT, $this->folder_library . $module . '/app_' . $application . '.txt', $content); } // each map } // function extract_map private function extract_controls () { // function extract_controls global $io, $dataMap; // extract controls foreach ($dataMap['c'] as $module => $names) { // each module controls $path = str_replace ('_', '/', $module); foreach ($names as $name => $pos) { // each name $content = $io->file->array2string ($io->cachedControls->read ('c', $module, $name), '#'); $this->filePutContents (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; protected function openConfigFile () { // function openConfigFile $this->constants = array (); if (!is_file (SYSTEM_CONFIG_FILE)) return; $file = file_get_contents (SYSTEM_CONFIG_FILE); foreach (explode (LF, $file) as $line) { // loop each line if (!strlen ($line)) continue; if (preg_match ('%define\ ?[(][\'"]([a-zA-Z0-9_]+)[\'"][,]\ ?([^)]+)%', $line, $results)) { // is a definition line list (, $key, $value) = $results; if ($value == 'true') $value = true; elseif ($value == 'false') $value = false; elseif (is_numeric ($value)) $value = intval ($value); elseif ($value[0] == "'") $value = substr ($value, 1, - 1); $this->constants[$key] = $value; } // is a definition line } // loop each line $this->originalRows = $this->constants; } // function openConfigFile public function set ($name, $value) { // function set if (!isset ($this->constants)) $this->openConfigFile (); $this->constants[$name] = $value; if (!defined ($name)) define ($name, $value); } // function set public function check ($name) { // function check if (!isset ($this->constants)) $this->openConfigFile (); if (isset ($this->constants[$name])) return true; return false; } // function check public function drop ($name) { // function drop if (!isset ($this->constants)) $this->openConfigFile (); if (isset ($this->constants[$name])) unset ($this->constants[$name]); } // function drop public function get ($name) { // function get if (!isset ($this->constants)) $this->openConfigFile (); if (isset ($this->constants[$name])) return $this->constants[$name]; if (defined ($name)) return constant ($name); return false; } // function get public function close () { // function close if ($this->constants != $this->originalRows) { // save changed file $grouped = array (); foreach ($this->constants as $key => $value) { // group constants @list ($prefix) = explode ('_', $key); $grouped[$prefix][$key] = $value; } // group constants $string = ' $value) { // each constant if ($value === false) $string .= "define ('" . $key . "', false);" . CRLF; elseif ($value === true) $string .= "define ('" . $key . "', true);" . CRLF; elseif (is_int ($value)) $string .= "define ('" . $key . "', " . strval ($value) . ");" . CRLF; elseif (is_string ($value)) $string .= "define ('" . $key . "', '" . $value . "');" . CRLF; } // each constant $string .= CRLF; } // each group $string .= '?>'; file_put_contents (SYSTEM_CONFIG_FILE, $string); } // save changed file } // function close } // class eclIo_systemConstants //!eof:engine/eclIo/eclIo_systemConstants.php; //!file:engine/eclIo/eclIo_webservice.php; class eclIo_webservice { // class eclIo_webservice private $socket = false; private $url = false; private $endpoint = false; private $port = 80; private $params = array (); public $headers = array (); public $data = array (); public $responseHeaders = array (); public $responseData = array (); public function open ($url, $endpoint, $params=array (), $port=80) { // function open $this->url = $url; $this->endpoint = $endpoint; $this->params = $params; $this->port = $port; return $this; } // function open public function headers ($headers) { // function headers $this->headers = $headers; return $this; } // function headers public function data ($data) { // function data $this->data = $data; return $this; } // function data public function send () { // function send } // function send static function array2json ($array) { // function array2json $buffer = ''; if (!is_array ($array) or !$array) return '{}'; reset ($array); list ($key) = each ($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 } // 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_audio.php; class eclScope_audio { // class eclScope_audio 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 = 'audio_' . $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']['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_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'); 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])) 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 $io, $store; if (isset ($this->controls[$controlName])) return $this->controls[$controlName]; $folders = explode ('/', $controlName); $count = count ($folders); switch ($count) { // switch number of folders case 1: $parts = explode ('_', $controlName, 3); $name = array_pop ($parts); $file = 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); return $this->rows[$id]['name']; } // function getName public function getStatus ($name) { // function getStatus if (!isset ($this->indexByName[$name])) $this->open ($name); if (!isset ($this->indexByName[$name])) return 0; $id = $this->indexByName[$name]; $row = &$this->rows[$id]; return $row['status']; } // function getStatus public function childrenNames () { // function childrenNames $names = array (); foreach (scandir (FOLDER_DOMAINS) as $dirName) { // each directory if ($dirName[0] != '.') $names[] = $dirName; } // each directory return $names; } // function childrenNames public function delete ($id) { // function delete if (isset ($this->originalRows[$id])) { // domain in database $this->database->delete ($this, array ('id' => $id)); $this->rows[$id] = array (); unset ($this->originalRows[$id]); } // domain in database } // function delete public function close () { // function close foreach ($this->originalRows as $id => $originalRow) { // each row if ($this->rows[$id] != $originalRow) $this->database->update ($this, $this->rows[$id], $originalRow); } // each row } // function close } // class eclStore_domain //!eof:engine/eclStore/eclStore_domain.php; //!file:engine/eclStore/eclStore_domainContent.php; class eclStore_domainContent { // class eclStore_domainContent public $name = 'domain_content'; public $fields = array ( // Indexing 'domain_id' => 'mediumint', 'mode' => 'tinyint', 'parent_id' => 'mediumint', 'master_id' => 'mediumint', 'id' => 'primary_key', // Class identifiers 'name' => 'name', 'marker' => 'tinyint', '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 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_code.php; class eclTag_code { // class eclTag_code static function render ($render, $arguments) { // function render $render->buffer .= $render->tags['inline_code_open']; } // function render } // class eclTag_code //!eof:engine/eclTag/eclTag_code.php; //!file:engine/eclTag/eclTag_cut.php; class eclTag_cut { // class eclTag_cut static function render ($render, $arguments) { // function render @list ($name, $once) = explode (' ', $arguments[0]); $render->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_endcode.php; class eclTag_endcode { // class eclTag_endcode static function render ($render, $arguments) { // function render $render->buffer .= $render->tags['inline_code_close']; } // function render } // class eclTag_endcode //!eof:engine/eclTag/eclTag_endcode.php; //!file:engine/eclTag/eclTag_endcut.php; class eclTag_endcut { // class eclTag_endcut static function render ($render, $arguments) { // function render 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_endscript.php; class eclTag_endscript { // class eclTag_endscript static function render ($render) { // function render 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 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_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_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_interactive.php; class eclTag_interactive { // class eclTag_interactive static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; $name = 'fields/interactive/' . $render->getVar ('type'); $data = $store->control->read ($name); if (!isset ($data['html'])) return; if (isset ($data['local'])) $data['local'] = array_replace ($render->data, $data['local']); else $data['local'] = $render->data; if ($render->data) $data['data'] = $render->data; return $data; } // function render } // class eclTag_interactive //!eof:engine/eclTag/eclTag_interactive.php; //!file:engine/eclTag/eclTag_key.php; class eclTag_key { // class eclTag_key static function render ($render, $arguments) { // function render global $store; if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $document = $render->document; $domain = $document->domain; $label = $key = $arguments[0]; if ($document->charset != 'ISO-8859-1') $key = mb_convert_encoding ($key, 'ISO-8859-1', $document->charset); $key = $render->toKeyword ($key); if (!strlen ($key)) return; if ($id = $store->domainContent->findMarker ($document->domain->domainId, 1)) $pathway = $store->domainContent->pathway ($document->domain->domainId, $id); else $pathway = array ($domain->name, '-glossary'); $pathway[] = $key; $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_lang.php; class eclTag_lang { // class eclTag_lang static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; // Vamos encontrar o nome do campo selecionado if (!isset ($arguments[0])) $field = $render->getVar ('caption'); elseif (is_string ($arguments[0])) { // from constant @list ($prefix, $sufix) = explode ('_', $arguments[0], 2); $name = 'labels/' . $prefix . '/' . $sufix; $data = array (); if (isset ($render->blocks[$name])) $data = $render->blocks[$name]; if (!isset ($data['text']['caption'])) $data = $store->control->read ($name); if (!isset ($data['text']['caption'])) return; $field = $data['text']['caption']; } // from constant elseif (is_array ($arguments[0])) $field = $arguments[0]; else return; if (!is_array ($field)) return; $text = $render->document->selectLanguage ($field); if ($text[3] == $render->document->lang) return; $data['lang'] = $text[3]; $data['html'] = ' lang="' . $text[3] . '"'; return $data; } // function render } // class eclTag_lang //!eof:engine/eclTag/eclTag_lang.php; //!file:engine/eclTag/eclTag_list.php; class eclTag_list { // class eclTag_list static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; // Se não existir uma lista if (!count ($render->children)) return; if (isset ($arguments[0]) and is_string ($arguments[0])) $name = 'lists/' . $arguments[0]; else $name = 'lists/menu_list_vertical'; // Procuramos o bloco if (isset ($render->blocks[$name])) $data = $render->blocks[$name]; else $data = $store->control->read ($name); 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; if (count ($data['children']) == 1) $data['local']['last'] = 1; $data['local']['index'] = 1; } // subitem else { // list from module level 0 $data['data'] = $render->children[0]->data; $render->index = 1; if (count ($render->children) == 1) $data['local']['last'] = 1; $data['local']['index'] = 1; } // list from module level 0 $data['local']['first'] = 1; return $data; } // function render } // class eclTag_list //!eof:engine/eclTag/eclTag_list.php; //!file:engine/eclTag/eclTag_loop.php; class eclTag_loop { // class eclTag_loop static function render ($render) { // function render $render->index++; // Se não houver um próximo item, prosseguiremos if ($render->index > count ($render->children)) return false; $render->data = $render->children[$render->index - 1]->data; $render->data['index'] = $render->index; if ($render->index == count ($render->children)) $render->data['last'] = 1; return true; } // function render } // class eclTag_loop //!eof:engine/eclTag/eclTag_loop.php; //!file:engine/eclTag/eclTag_mailto.php; class eclTag_mailto { // class eclTag_mailto static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; $args = explode (' ', $arguments[0], 2); $buffer = ''; if (isset ($args[1]) and strlen ($args[1])) $buffer .= $args[1]; else $buffer .= $args[0]; $buffer .= '' . CRLF; // 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->data['index'] = $render->index; if ($render->index == count ($render->children)) $render->data['last'] = 1; return; } // next item $render->data = array (); $render->data = array (); return; } // function render } // class eclTag_next //!eof:engine/eclTag/eclTag_next.php; //!file:engine/eclTag/eclTag_nl.php; class eclTag_nl { // class eclTag_nl static function render ($render, $arguments) { // function render $render->buffer .= CRLF; } // function render } // class eclTag_nl //!eof:engine/eclTag/eclTag_nl.php; //!file:engine/eclTag/eclTag_or.php; class eclTag_or { // class eclTag_or static function render ($render, $arguments) { // function render if (!isset ($arguments[0])) return ''; if ($arguments[0]) return $arguments[0]; if (isset ($arguments[1])) return $arguments[1]; return ''; } // function render } // class eclTag_or //!eof:engine/eclTag/eclTag_or.php; //!file:engine/eclTag/eclTag_paste.php; class eclTag_paste { // class eclTag_paste static function render ($render, $arguments) { // function render if (!isset ($arguments[0]) or !is_string ($arguments[0]) or !strlen ($arguments[0])) return; // Vamos anotar a posição e o nome desta colagem $render->pasteIndex++; $render->pastePointer[$render->pasteIndex] = strlen ($render->buffer); $render->pasteNames[$render->pasteIndex] = $arguments[0]; } // function render } // class eclTag_paste //!eof:engine/eclTag/eclTag_paste.php; //!file:engine/eclTag/eclTag_personalite.php; class eclTag_personalite { // class eclTag_personalite static $type = 'scope'; static function render ($render, $arguments) { // function render global $store; if (!$render->getVar ('mod.personalite_url')) return; $block = $store->control->read ('blocks/personalite'); return $block; } // function render } // class eclTag_personalite //!eof:engine/eclTag/eclTag_personalite.php; //!file:engine/eclTag/eclTag_rendertable.php; class eclTag_rendertable { // class eclTag_rendertable static function render ($render, $arguments) { // function render $buffer = &$render->buffer; $heading = $render->getVar ('table_heading'); $editable = $render->getVar ('mod.editable'); $id = $render->getVar ('mod.id'); $number = $render->getVar ('mod.number'); $buffer .= 'children as $row) { // each row // Row class $buffer .= ''; $cellIndex = 0; foreach ($row->children as $cell) { // each cell if ($rowIndex < $heading) $buffer .= 'data['rowspan'])) $buffer .= ' rowspan="' . $cell->data['rowspan'] . '"'; // Colspan if (isset ($cell->data['colspan'])) $buffer .= ' colspan="' . $cell->data['colspan'] . '"'; // editable if ($editable) $buffer .= ' data-name="' . $id . '_table_' . $number . '_' . $rowIndex . '_' . $cellIndex . '" data-mode="stack"'; // Cell class $class = 'col-' . $cellIndex . ' cell-' . $rowIndex . '-' . $cellIndex; if (!isset ($cell->data['text']['caption']) and !isset ($cell->data['caption'])) $class .= ' empty'; if (isset ($cell->data['class'])) $class .= ' ' . $cell->data['class']; // Cell style if (isset ($cell->data['style'])) { // style $buffer .= ' style="'; foreach ($cell->data['style'] as $selector => $value) { // each selector if (strpos ($value, ':')) $buffer .= $value; else $buffer .= $selector . ':' . $value . '; '; } // each selector $buffer .= '"'; } // style $buffer .= '>'; // Cell link if (isset ($cell->data['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->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->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 $type = 'module'; static function render ($render, $arguments) { // function render global $store; $document = $render->document; $tagArguments = implode (' ', $arguments); $arguments = explode (' ', $tagArguments); switch (count ($arguments)) { // switch number of arguments case 0: if (!isset ($document->application->data['name'])) return false; $arguments[0] = $document->application->data['name']; $arguments[1] = '0'; break; case 1: if (is_numeric ($arguments[0])) { // number if (!isset ($document->application->data['name'])) return false; $arguments[1] = $arguments[0]; $arguments[0] = $document->application->data['name']; break; } // number $arguments[1] = '0'; } // switch number of arguments // Vamos abrir o módulo $mod = $document->createModule ('table', $arguments); // Se o módulo estiver marcado como vazio if (!$mod->enabled) return; $data = $mod->data; $data['local']['tag'] = 'table:' . $tagArguments; $data['mod'] = $data['local']; $data['children'] = $mod->children; return $data; } // function render } // class eclTag_table //!eof:engine/eclTag/eclTag_table.php; //!file:engine/eclTag/eclTag_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_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 (!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); $value = str_replace (array ("'", "\\"), "", $value); break; case 'bool': if ($value === 'false' or !$value) $value = false; else $value = true; break; case 'free': $value = $formulary->received[$fieldName]; if ($formulary->document->charset != 'UTF-8') $value = mb_convert_encoding ($value, 'UTF-8', $formulary->document->charset); $value = str_replace (array ("'", "\\"), "", $value); } // switch type } // cast value // target if (defined ('SYSTEM_INSTALLATION_PROGRESS')) $formulary->data[$target] = $value; else $io->systemConstants->set ($target, $value); } // function save } // class eclFilter_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/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->getMap ('adminComponents'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (!count ($me->children ())) $document->dataMerge ('adminComponents_contentEmpty'); else $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_adminComponents //!eof:library/adminComponents/eclApp_adminComponents.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_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/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_selectLang //!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 ('integration'); } // 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_eval adminSystem_log adminSystem_update 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 $formulary = $document->createFormulary ('adminSystem_update_edit'); if ($formulary->command ('save') and $formulary->save ()) { // formulary saved $fieldName = $formulary->data['file_field']; $fileName = PATH_ROOT . SYSTEM_SCRIPT_NAME; unlink ($fileName); if (move_uploaded_file ($_FILES[$fieldName]['tmp_name'], $fileName)) exit ('System updated. Please reload.'); } // formulary saved $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_adminSystem_update //!eof:library/adminSystem/update/eclApp_adminSystem_update.php; //!file:library/adminSystem/update/eclFilter_adminSystem_update_upload.php; class eclFilter_adminSystem_update_upload { // class eclFilter_adminSystem_update_upload static function create ($fieldName, $control, $formulary) { // function create $control['type'] = 'file'; $control['name'] = $fieldName; $formulary->appendChild ($control); } // function create static function save ($fieldName, $control, $formulary) { // function save if (!isset ($_FILES[$fieldName]['size']) or !$_FILES[$fieldName]['size']) return $formulary->setRequiredMsg ($control, $fieldName); $formulary->data['file_field'] = $fieldName; } // function save } // class eclFilter_adminSystem_update_upload //!eof:library/adminSystem/update/eclFilter_adminSystem_update_upload.php; //!file:library/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']; //!start version 3 compatibility if ($mode == 'play' and !isset ($data['extras'][$target][$mode]) and isset ($data['extras'][$target]['plays'])) $data['extras'][$target][$mode] = $data['extras'][$target]['plays']; //!end version 3 compatibility 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; 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 ($me->name == 'rss.xml') return self::rss ($document); } // function dispatch static function rss ($document) { // function rss global $io; $io->log->silent = true; $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; $me = $document->domain; $mod->enabled = true; $mod->data = $store->control->read ('domainSitemap_layout'); $this->indexPath ($me, $mod); } // function setModule private function indexPath ($me, $mod) { // function indexPath foreach ($me->children () as $child) { // each child if ($child->access) continue; if ($child->menuType != 'section' and $child->menuType != 'post') continue; $mode = isset ($child->data['mode']) ? $child->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 ($child->data['name'] == '-index') $priority = '1'; else $priority = '0'; break; default: $priority = '0.6'; } // switch mode if (isset ($child->data['updated'])) $updated = date ('c', $child->data['updated']); elseif (defined ('SYSTEM_PACKED_DATE')) $updated = date ('c', SYSTEM_PACKED_DATE); else $updated = date ('c', TIME); $mod->appendChild (array ( 'url' => $this->document->url ($child->pathway), 'date' => $date, 'priority' => $priority )); $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'); $template = $render->block ('templates/default'); $all = array (); $preset = $store->control->read ('domainStyles_preset'); $local = $preset['local']; foreach (array ('palettes', 'themes') as $folder) { // each folder if (isset ($template['flags'][$folder])) $all[$folder] = explode (CRLF, $template['flags'][$folder]); else $all[$folder][] = 'default'; foreach ($all[$folder] as $name) { // each block $block = $render->block ($folder . '/' . $name); if (isset ($block['local']) and $block['local']) $local = array_replace ($local, $block['local']); } // each block } // each folder $buffer = ''; if (isset ($template['flags']['styles'])) $all['styles'] = explode (CRLF, $template['flags']['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'] = $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/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 false; if ($me->applicationName == 'adminIntegrations') return false; 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 if ($me->applicationName == 'adminIntegrations') return array (); 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 false; if ($me->applicationName == 'adminIntegrations') return false; 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 if ($me->applicationName == 'adminIntegrations') return array (); 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 ($parent, $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'; if (isset ($audio)) $local['extras'] = array ('audio_' . $number => $audio); $local['pathway'] = $me->pathway; $mod->appendChild ($local); } // function setModule } // class eclMod_modAudio //!eof:library/modAudio/eclMod_modAudio.php; //!file:library/modBanner/eclMod_modBanner.php; class eclMod_modBanner { // class eclMod_modBanner public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; while (!isset ($me->data['extras']['banner']) and $me->parent->parent) { // search parent banner $me = $me->parent; } // search parent banner if ($me->isDomain) $me = $me->child (''); if (isset ($me->data['extras']['banner'])) { // banner found $mod->data = $me->data['extras']['banner']; $local['extras']['img_0'] = $me->data['extras']['banner']; $mod->appendChild ($local); $mod->enabled = true; } // banner found // Se o módulo pode ser editado if ($document->templateEditable and $document->access (4)) { // reference // Crie um módulo if (!$mod->children) { // creates an image $mod->data = $store->control->read ('modBanner_moduleCreate'); $mod->appendChild ($store->control->read ('modBanner_moduleCreate')); } // creates an image $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; // Condições if (!isset ($document->session['order'])) return; if ($me->isDomain) return; if (!$me->id) return; if ($document->printableLayout) return; $me = $document->application; if ($me->name == '-cart') return; if (isset ($me->data['mode']) and $me->data['mode'] == MODE_SECTION and isset ($me->data['marker']) and $me->data['marker'] == 12) return; // Configurações $mod->data = $render->block ('modules/cart'); // Itens da lista $row = $mod->appendChild (); $quantity = 0; $value = 0; foreach ($document->session['order'] as $product) { // each product $quantity += $product['quantity']; $value += $product['value'] * $product['quantity']; } // each product $captionItems = $store->control->read ('labels/field/cart_items'); $local['caption'] = $document->textMerge ($quantity, ' ', $captionItems['text']['caption'], ' (R$' . $value . ')'); $row->appendChild ($local); if ($id = $store->domainContent->findMarker ($document->domain->domainId, 12)) $row->appendChild ('labels/field/cart_go') ->url ($store->domainContent->pathway ($document->domain->domainId, $id)); else $row->appendChild ('labels/field/cart_go') ->url (array ($document->domain->name, '-cart')); // 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 = 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 ($data) ->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 list ($lang) = each ($me->data['text']['caption']); $mod->data['local']['url_canonical'] = $document->url (true, $lang); } // first language } // no index, go canonical 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 // RSS if ($document->application->id) { // search rss } // search rss $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 $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->data) ->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/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 // 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)) continue; $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'); $local = $preset['local']; $all = array (); foreach (array ('palettes', 'themes') as $folder) { // each folder if (isset ($template['flags'][$folder])) $all[$folder] = explode (CRLF, $template['flags'][$folder]); else $all[$folder][] = 'default'; foreach ($all[$folder] as $name) { // each block if ($folder == 'themes' and $name == 'user') continue; $block = $store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $folder . '/' . $name); if (!$block) $block = $store->control->read ($folder . '/' . $name); if (isset ($block['local']) and $block['local']) $local = array_replace ($local, $block['local']); } // each block } // each folder $data['local'] = $user['local']; $data['defaults'] = $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 } // 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 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 $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 // find target 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 '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) return $document->buffer = '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 } // 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; $filename = PATH_DOMAINS . $document->domain->name . '/-install.zip'; $zip = new ZipArchive (); $zip->open ($filename); for ($i = 0; $i < $zip->numFiles; $i++) { // each file $current = $zip->statIndex ($i); $local = array ( 'type' => 'checkbox', 'name' => $fieldName . '_' . md5 ($current['name']), 'caption' => $document->textMerge ($current['name']) ); $formulary->appendChild ($local); } // each file $zip->close (); } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $document = $formulary->document; $me = $formulary->document->application; $received = $formulary->received; $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 (!isset ($received[$fieldName . '_' . md5 ($name)])) continue; if (!zip_entry_open ($zip, $zip_entry, "r")) continue; $parts = explode ('.', $name); if (end ($parts) == 'json') { // json files $buffer = zip_entry_read ($zip_entry, zip_entry_filesize ($zip_entry)); $component = eclIo_webservice::json2array ($buffer); if (!isset ($component['name']) or !preg_match ('%^[a-z]+\/[a-z][a-z0-9_]*$%', $component['name'])) continue; list ($prefix, $sufix) = explode ('/', $component['name'], 2); switch ($prefix) { // switch prefix case 'blocks': case 'borders': case 'details': case 'fields': case 'fonts': case 'icons': case 'labels': case 'layouts': case 'lists': case 'modules': case 'palettes': case 'scripts': case 'styles': case 'templates': case 'themes': $name = $component['name']; $data = &$store->domainExtras->openChild ($me->domainId, MODE_TEMPLATE, 0, $name); $saved = $data ? true : false; $data['text'] = isset ($component['text']) ? $component['text'] : array (); $data['local'] = isset ($component['local']) ? $component['local'] : array (); $data['html'] = isset ($component['html']) ? $component['html'] : ''; if (!$saved) { // create $data['name'] = $name; $data['mode'] = MODE_TEMPLATE; $store->domainExtras->insert ($me->domainId, $data); } // create unset ($data); } // switch prefix } // json files zip_entry_close ($zip_entry); } // each entry zip_close ($zip); } // 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 $pathway = $me->pathway; $pathway[] = $data['name']; $row->appendChild ($data) ->set ('editable', $document->contentEditable) ->url ($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_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->data) ->set ('editable', $document->contentEditable) ->set ('pathway', $document->pathway); // 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/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->createFormulary ('sectionFormulary_done_edit', $me->data); $formulary->action = '_message-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['message']); return 'custom'; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['message']); $me->data = $formulary->data; $store->domainExtras->createVersion ($me->domainId, $me->data, $document); $document->dataReplace ($me->data); return 'custom'; } // save $document->dataReplace ('sectionFormulary_done_edit'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->languages->action = '_message-edit'; return 'form'; } // function action_edit static function action_restore ($document) { // function action_restore global $store; $me = $document->application; unset ($document->actions['message']); $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->data['name']); $store->domainExtras->deleteAllChildren ($me->domainId, $me->id); $document->dataReplace ('sectionFormulary_done_content'); $me->id = 0; return 'default'; } // function action_restore static function remove ($me) { // function remove global $store; if ($me->id) $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->data['name']); } // function remove } // class eclApp_sectionFormulary_done //!eof:library/sectionFormulary/done/eclApp_sectionFormulary_done.php; //!file:library/sectionFormulary/eclApp_sectionFormulary.php; class eclApp_sectionFormulary { // class eclApp_sectionFormulary static function constructor_helper ($me) { // function constructor_helper $me->map = array ('sectionFormulary_received', 'sectionFormulary_removed', 'sectionFormulary_statistics', 'sectionFormulary_done', 'sectionFormulary_selectColumns', 'personaliteFields'); } // function constructor_helper static function dispatch ($document) { // function dispatch $me = $document->application; $view = true; if ($document->access (4)) { // admin access // edit fields if ($document->actions ('fields', 'edit') or !isset ($me->data['extras']['formulary'])) $view = self::action_edit_fields ($document); // context edit fields $document->mod->context->appendChild ('sectionFormulary_fields') ->url (true, true, '_fields-edit') ->active ($document->actions ('fields', 'edit') or !isset ($me->data['extras']['formulary'])); // security if ($document->actions ('security', 'edit')) $view = self::action_edit_security ($document); // context edit security $document->mod->context->appendChild ('sectionFormulary_security') ->url (true, true, '_security-edit') ->active ($document->actions ('security', 'edit')); } // admin access if (!$view) return; if (isset ($document->actions['review'][1])) $view = self::action_review ($document); elseif (isset ($me->data['extras']['formulary'])) $view = self::action_formulary ($document); if (!$view) return; if ($document->access (4)) $document->mod->editor->enable (); $document->mod->list = new eclMod_sectionFolder_list ($document); } // function dispatch static function action_edit_fields ($document) { // function action_edit_fields $me = $document->application; $formulary = $document->createFormulary ('sectionFormulary_fields', $me->data, 'editfields'); $formulary->action = '_fields-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['fields']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['fields']); $me->data = $formulary->data; return true; } // save $document->dataReplace ('sectionFormulary_fields'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return false; } // function action_edit_fields static function action_edit_security ($document) { // function action_edit_security $me = $document->application; $formulary = $document->createFormulary ('sectionFormulary_security', $me->data, 'editsecurity'); $formulary->action = '_security-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['security']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['security']); $me->data = $formulary->data; return true; } // save $document->dataReplace ('sectionFormulary_security'); $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); return false; } // function action_edit_security static function action_formulary ($document) { // function action_formulary $me = $document->application; if (isset ($document->actions['review'][1]) and $token = $document->actions['review'][1] and isset ($document->session['form_' . $token])) $data = $document->session['form_' . $token]; elseif ($document->actions ('share', 'user', 'data', 'enable')) { // share user data $data = array ('share_user_data' => true); } // share user data elseif ($document->user->userId and !$document->received) { // user is connected $data = array(); foreach ($me->data['extras']['formulary'] as $field) { // each field if (isset ($field['share_user_data'])) { // share request $local = array ( 'alert' => 1, 'url' => $document->url (true, true, '_share-user-data-enable') ); $document->mod->humperstilshen->dialog ('personaliteFields_alertShareUserDataRequest', $local); break; } // share request } // each field } // user is connected else $data = array(); $formulary = $document->createFormulary ('sectionFormulary_formulary', $data, 'page0'); if ($formulary->command ('cancel')) { // cancel $formulary->data = array (); } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $token = md5 (TIME . session_id ()); $document->actions['review'] = array ('review', $token); $document->session['form_' . $token] = $formulary->data; if (isset ($document->application->data['flags']['form_review'])) return self::action_review ($document); return self::action_done ($document); } // save if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->formulary = $formulary; $document->mod->panel->main = array ('content', 'formulary', 'list'); return true; } // function action_formulary static function action_review ($document) { // function action_review $token = $document->actions['review'][1]; if (isset ($document->session['form_' . $token])) $data = $document->session['form_' . $token]; else return false; $formulary = $document->createFormulary ('sectionFormulary_review', $data, 'review'); if ($formulary->command ('previous')) return self::action_formulary ($document); if ($formulary->command ('save')) return self::action_done ($document); $formulary->action = '_review-' . $token; $document->mod->formulary = $formulary; $document->mod->panel->main = array ('content', 'formulary', 'list'); return false; } // function action_review static function action_done ($document) { // function action_done global $store; $me = $document->application; $token = $document->actions['review'][1]; $data = $document->session['form_' . $token]; $data['domain_id'] = $me->domainId; $data['mode'] = MODE_FORM; $data['parent_id'] = $me->id; $data['owner_id'] = $document->user->userId; $data['status'] = 720; $id = $store->domainExtras->insert ($me->domainId, $data); unset ($document->actions['review']); unset ($document->session['form_' . $token]); $message = $me->child ('-done'); $document->dataReplace ($message->data); if (!isset ($me->data['local']['mail']) or !INTEGRATION_SMTP_ENABLE) return false; $template = clone $document; $template->application = $me->child ('-received')->child ($id); $template->application->access = 0; $template->dispatch (); $template->data['flags']['modLayout_base'] = 'mail'; $template->charset = 'UTF-8'; $template->render (); $subject = $template->selectLanguage ($template->textMerge ($document->domain->data['text']['title'], ' -> ', $me->data['text']['caption'])); $mail = $document->createMail () ->subject ($subject[1]) ->to ($me->data['local']['mail']) ->contentHTML ($template->buffer); $errorMsg = $mail->send (); if ($errorMsg) $document->mod->humperstilshen->alert ($errorMsg); return false; } // function action_done static function remove ($me) { // function remove } // function remove } // class eclApp_sectionFormulary //!eof:library/sectionFormulary/eclApp_sectionFormulary.php; //!file:library/sectionFormulary/eclFilter_sectionFormulary_fields.php; class eclFilter_sectionFormulary_fields { // class eclFilter_sectionFormulary_fields static function create ($fieldName, $control, $formulary) { // function create $fields['children'] = self::getFields ($formulary->document->application); $formulary->insertControlChildren ($fields); } // function create static function save ($fieldName, $control, $formulary) { // function save $fields['children'] = self::getFields ($formulary->document->application); $formulary->insertControlChildren ($fields); } // function save static function getFields ($me) { // function getFields if (!isset ($me->data['extras']['formulary'])) return array (); $index = 0; $formulary = $me->data['extras']['formulary']; $sorted = array(); $fields = array (); foreach ($formulary as $name => $field) { // sort fields if (isset ($field[$index])) $sorted[$index][] = $name; else $sorted[100000][] = $name; } // sort fields ksort ($sorted); foreach ($sorted as $group) { // each group foreach ($group as $name) { // each field $field = $formulary[$name]; list ($filter) = explode ('_', $name, 2); if (!isset ($field['caption'])) continue; $flags = array ( 'field_name' => $name, 'filter' => 'personaliteFields_' . $filter ); if (isset ($field['type'])) $flags['type'] = $field['type']; $fields[] = array ( 'flags' => $flags, 'text' => array ('caption' => $field['caption']), 'local' => $field ); } // each field } // each group return $fields; } // function getFields } // class eclFilter_sectionFormulary_fields //!eof:library/sectionFormulary/eclFilter_sectionFormulary_fields.php; //!file:library/sectionFormulary/eclFilter_sectionFormulary_fieldsView.php; class eclFilter_sectionFormulary_fieldsView { // class eclFilter_sectionFormulary_fieldsView static function create ($fieldName, $control, $formulary) { // function create $me = $formulary->document->application; if ($me->applicationName == 'sectionFormulary_record') $me = $me->parent->parent; $fields['children'] = self::getFields ($me); $formulary->insertControlChildren ($fields); } // function create static function save ($fieldName, $control, $formulary) { // function save } // function save static function getFields ($me) { // function getFields if (!isset ($me->data['extras']['formulary'])) return array (); $fields = array (); foreach ($me->data['extras']['formulary'] as $name => $field) { // each field if (!isset ($field['caption'])) continue; list ($filter) = explode ('_', $name, 2); $flags = array ( 'field_name' => $name, 'filter' => 'personaliteFields_' . $filter, 'view' => true ); $fields[] = array ( 'flags' => $flags, 'text' => array ('caption' => $field['caption']), 'local' => $field ); } // each field return $fields; } // function getFields } // class eclFilter_sectionFormulary_fieldsView //!eof:library/sectionFormulary/eclFilter_sectionFormulary_fieldsView.php; //!file:library/sectionFormulary/eclMod_sectionFormulary.php; class eclMod_sectionFormulary { // class eclMod_sectionFormulary public $document; public $formulary; public function __construct ($document, $formulary) { // function __construct $this->document = $document; $this->formulary = $formulary; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->children = $this->formulary->create(); // Procure o módulo dentro da aplicação if (isset ($me->data['extras']['formulary'])) $mod->data = $me->data['extras']['formulary']; else { // from preset if (isset ($me->data['flags']['modFormulary_preset'])) $preset = $me->data['flags']['modFormulary_preset']; else $preset = 'edit'; $mod->data = $render->block ('modules/formulary_' . $preset); if (!$mod->data) $mod->data = $render->block ('modules/formulary'); } // from preset $mod->data['name'] = 'section_' . $me->name; if ($document->templateEditable and $document->access (4)) { // personalite reference $pathway = array_slice ($me->pathway, 1); array_unshift ($pathway, $document->domain->name, '-personalite', 'extras', 'formulary'); $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_sectionFormulary //!eof:library/sectionFormulary/eclMod_sectionFormulary.php; //!file:library/sectionFormulary/received/eclApp_sectionFormulary_received.php; class eclApp_sectionFormulary_received { // class eclApp_sectionFormulary_received static function is_child ($me, $name) { // function is_child if ($name == '-received') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-received'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionFormulary_received_content'); $me->map = array ('sectionFormulary_record'); $children = $store->domainExtras->children ($me->domainId, MODE_FORM, $me->parent->id); $num = 0; foreach ($children as $data) { // each children if (!$data['status'] or $data['status'] == 720) $num++; } // each children $me->data['num_children'] = $num; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $view = true; if (isset ($document->actions['selectcolumns'])) $view = self::action_selectcolumns ($document); $document->mod->context->appendChild ('sectionFormulary_received_selectColumns') ->active (isset ($document->actions['selectcolumns'])) ->url (true, true, '_selectcolumns'); if (!$view) return; $document->mod->list = new eclMod_sectionFormulary_received_list ($document); } // function dispatch static function action_selectcolumns ($document) { // function action_selectcolumns $formulary = $document->createFormulary ('sectionFormulary_received_selectColumns', array (), 'selectcolumns'); $formulary->action = '_selectcolumns'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['selectcolumns']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['selectcolumns']); return true; } // save $document->mod->formulary = $formulary; $document->dataReplace ('sectionFormulary_received_selectColumns'); return false; } // function action_selectcolumns } // class eclApp_sectionFormulary_received //!eof:library/sectionFormulary/received/eclApp_sectionFormulary_received.php; //!file:library/sectionFormulary/received/eclFilter_sectionFormulary_received_selectColumns.php; class eclFilter_sectionFormulary_received_selectColumns { // class eclFilter_sectionFormulary_received_selectColumns static function create ($fieldName, $control, $formulary) { // function create global $store; $document = $formulary->document; $me = $document->application->parent; $control['name'] = $fieldName; $control['type'] = 'manager'; $item = $formulary->appendChild ($control); // references $pathway = $me->pathway; $pathway[] = '-columns'; $item->data['url_add'] = $document->url ($pathway); $item->data['move-enable'] = 1; $item->data['remove-enable'] = 1; $item->data['edit-enable'] = 0; if (!isset ($me->data['extras']['formulary'])) return; $sorted = array (); foreach ($me->data['extras']['formulary'] as $name => $field) { // each field switch ($field['filter']) { // switch filter case 'checkbox': case 'created': case 'mail': case 'radio': case 'select': case 'text': if (isset ($field['list_index'])) $sorted[$field['list_index']][] = array ($name, $field); } // switch filter } // each field ksort ($sorted); $buffer = ''; foreach ($sorted as $group) { // each group foreach ($group as $column) { // each column list ($name, $field) = $column; $buffer .= $name . CRLF; // $pathway = $me->pathway; // $pathway[] = '-columns'; // $pathway[] = $name; $local = array ( 'value' => $name, 'caption' => $field['caption'], // 'url' => $document->url ($pathway) ); $item->appendChild ($local); } // each column } // each group $item->data['serialized'] = $buffer; } // function create static function save ($fieldName, $control, $formulary) { // function save $me = $formulary->document->application->parent; if (!isset ($me->data['extras']['formulary'])) return; if (!isset ($formulary->received[$fieldName . '_serialized'])) return $formulary->setRequiredMsg ($fieldName, $control); foreach ($me->data['extras']['formulary'] as &$field) { // clear each field unset ($field['list_index']); } // clear each field unset ($field); $serialized = $formulary->received[$fieldName . '_serialized']; $index = 0; foreach (explode (LF, $serialized) as $name) { // each line $index++; $name = trim ($name); if (isset ($me->data['extras']['formulary'][$name])) $me->data['extras']['formulary'][$name]['list_index'] = $index; } // each line } // function save } // class eclFilter_sectionFormulary_received_selectColumns //!eof:library/sectionFormulary/received/eclFilter_sectionFormulary_received_selectColumns.php; //!file:library/sectionFormulary/received/eclMod_sectionFormulary_received_list.php; class eclMod_sectionFormulary_received_list { // class eclMod_sectionFormulary_received_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('sectionFormulary_received_list'); // Conditions if (!isset ($me->parent->data['extras']['formulary'])) return; $from = &$me->parent->data['extras']['formulary']; // Get listable fields $sorted = array (); foreach ($from as $name => $field) { // sort fields if (isset ($field['list_index'])) $sorted[$field['list_index']] = $name; } // sort fields ksort ($sorted); if (!$sorted) { // append created column $from['created'] = $store->control->read ('personaliteFields_created_preset'); $sorted[] = 'created'; } // append created column // Table headers $row = $mod->appendChild (); foreach ($sorted as $name) { // each field $row->appendChild ($from[$name]); } // each field // list received forms $children = $store->domainExtras->children ($me->domainId, MODE_FORM, $me->parent->id); foreach ($children as $data) { // each child if ($data['status'] != 0 and ($data['status'] < 720 or $data['status'] > 729)) continue; $pathway = $me->pathway; $pathway[] = $data['id']; $url = $document->url ($pathway); $row = $mod->appendChild (); foreach ($sorted as $name) { // each column list ($filter) = explode ('_', $name, 2); if (!preg_match ('/[a-z]+/', $filter)) { // error $row->appendChild (); continue; } // error $class = 'eclFilter_personaliteFields_' . $filter; $local = $class::column ($document, $data, $name, $from[$name], $url); if (!$local) continue; $row->appendChild ($local); } // each column } // each child $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_received_list //!eof:library/sectionFormulary/received/eclMod_sectionFormulary_received_list.php; //!file:library/sectionFormulary/record/eclApp_sectionFormulary_record.php; class eclApp_sectionFormulary_record { // class eclApp_sectionFormulary_record static function is_child ($me, $name) { // function is_child global $store; if ($name[0] == '-') return false; $data = $store->domainExtras->openById ($me->domainId, intval ($name)); if ($data and $data['mode'] == MODE_FORM and $data['parent_id'] == $me->parent->id) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainExtras->openById ($me->domainId, intval ($me->name)); $me->id = $me->data['id']; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if ($me->parent->name == '-received') $me->data['status'] = 721; if ($document->actions ('record', 'remove')) return self::action_remove ($document); // context remove $document->mod->context->appendChild ('sectionFormulary_record_remove') ->url (true, true, '_record-remove'); $data = $store->control->read ('sectionFormulary_record_content'); $document->dataMerge ($data); $formulary = $document->createFormulary ('sectionFormulary_view', $me->data, 'form'); $document->mod->formulary = $formulary; } // function dispatch static function action_remove ($document) { // function action_remove $me = $document->application; if ($me->parent->name == '-received') $me->data['status'] = 730; else $me->remove (); $parent = $me->parent; $parent->reset (); $document->application = $parent; $document->application->dispatch ($document); $document->reload = $document->url ($parent->pathway); return; } // function action_remove static function remove ($me) { // function remove global $store; $store->domainExtras->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); } // function remove } // class eclApp_sectionFormulary_record //!eof:library/sectionFormulary/record/eclApp_sectionFormulary_record.php; //!file:library/sectionFormulary/removed/eclApp_sectionFormulary_removed.php; class eclApp_sectionFormulary_removed { // class eclApp_sectionFormulary_removed static function is_child ($me, $name) { // function is_child if ($name == '-removed') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; $children = $store->domainExtras->children ($me->domainId, MODE_FORM, $me->parent->id); foreach ($children as $data) { // each children if ($data['status'] >= 730) return array ('-removed'); } // each data return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionFormulary_removed_content'); $me->map = array ('sectionFormulary_record'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $children = $store->domainExtras->children ($me->domainId, MODE_FORM, $me->parent->id); $document->mod->list = new eclMod_sectionFormulary_removed_list ($document); } // function dispatch } // class eclApp_sectionFormulary_removed //!eof:library/sectionFormulary/removed/eclApp_sectionFormulary_removed.php; //!file:library/sectionFormulary/removed/eclMod_sectionFormulary_removed_list.php; class eclMod_sectionFormulary_removed_list { // class eclMod_sectionFormulary_removed_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $mod->data = $store->control->read ('sectionFormulary_received_list'); $fieldsList = array ( 'created' => 'created' ); $children = $store->domainExtras->children ($me->domainId, MODE_FORM, $me->parent->id); foreach ($children as $data) { // each child if ($data['status'] < 730 or $data['status'] > 739) continue; $pathway = $me->pathway; $pathway[] = $data['id']; $row = $mod->appendChild (); foreach ($fieldsList as $fieldName => $fieldType) { // each field switch ($fieldType) { // switch type case 'created': $local['caption'] = $document->textMerge (date ('d-m-Y h:i', $data['created'])); $row->appendChild ($local) ->url ($pathway); break; } // switch type } // each field } // each child $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_removed_list //!eof:library/sectionFormulary/removed/eclMod_sectionFormulary_removed_list.php; //!file:library/sectionFormulary/selectColumns/eclApp_sectionFormulary_selectColumns.php; class eclApp_sectionFormulary_selectColumns { // class eclApp_sectionFormulary_selectColumns static function is_child ($me, $name) { // function is_child if ($name == '-columns') 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 ('-columns'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionFormulary_selectColumns_content'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_sectionFormulary_selectColumns_list ($document); } // function dispatch } // class eclApp_sectionFormulary_selectColumns //!eof:library/sectionFormulary/selectColumns/eclApp_sectionFormulary_selectColumns.php; //!file:library/sectionFormulary/selectColumns/eclMod_sectionFormulary_selectColumns_list.php; class eclMod_sectionFormulary_selectColumns_list { // class eclMod_sectionFormulary_selectColumns_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $mod->data = $store->control->read ('modules/list'); if (!isset ($me->data['extras']['formulary'])) return; foreach ($me->data['extras']['formulary'] as $name => $field) { // each field if (!isset ($field['filter'])) continue; switch ($field['filter']) { // switch filter case 'address': case 'checkbox': case 'created': case 'mail': case 'phone': case 'radio': case 'select': case 'text': case 'user': case 'status': $mod->appendChild ($field, array ('name' => $name)); } // switch filter } // each field $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_selectColumns_list //!eof:library/sectionFormulary/selectColumns/eclMod_sectionFormulary_selectColumns_list.php; //!file:library/sectionFormulary/statistics/eclApp_sectionFormulary_statistics.php; class eclApp_sectionFormulary_statistics { // class eclApp_sectionFormulary_statistics static function is_child ($me, $name) { // function is_child if ($name == '-statistics') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names if (!isset ($me->data['extras']['formulary'])) return array (); foreach ($me->data['extras']['formulary'] as $name => $field) { // each field list ($filter) = explode ('_', $name); if ($filter == 'radio' or $filter == 'checkbox' or $filter == 'select') return array ('-statistics'); } // each field return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionFormulary_statistics_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $document->mod->list = new eclMod_sectionFormulary_statistics_list ($document); } // function dispatch } // class eclApp_sectionFormulary_statistics //!eof:library/sectionFormulary/statistics/eclApp_sectionFormulary_statistics.php; //!file:library/sectionFormulary/statistics/eclMod_sectionFormulary_statistics_list.php; class eclMod_sectionFormulary_statistics_list { // class eclMod_sectionFormulary_statistics_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application->parent; $mod->data = $store->control->read ('sectionFormulary_statistics_list'); if (!isset ($me->data['extras']['formulary'])) return; $children = array (); foreach ($store->domainContent->children ($me->domainId, MODE_FORM, $me->id) as $child) { // each child if ($child['marker'] == 255) continue; $children[] = $child; } // each child if (!$children) return; $total = count ($children); foreach ($me->data['extras']['formulary'] as $fieldName => $field) { // each field switch ($field['filter']) { // switch filter case 'checkbox': $counter = 0; foreach ($children as $child) { // each child if (isset ($child['local']['form'][$fieldName]['value']) and $child['local']['form'][$fieldName]['value']) $counter++; } // each child $item = $mod->appendChild (); $item->data['caption'] = $field['caption']; $item->data['units'] = strval ($counter); $item->data['percent'] = strval (round ( ($counter / $total) * 100, 1)); break; case 'select': case 'radio': $values = array (); foreach ($children as $child) { // each child if (isset ($child['local']['form'][$fieldName]['value'])) { // set value if (isset ($values[$child['local']['form'][$fieldName]['value']])) $values[$child['local']['form'][$fieldName]['value']]++; else $values[$child['local']['form'][$fieldName]['value']] = 1; } // set value } // each child $select = $mod->appendChild ($field); $select->data['header'] = 1; foreach ($field['options'] as $value => $caption) { // each option $option = $select->appendChild (); $option->data['caption'] = $caption; if (isset ($values[$value])) { // set values $option->data['units'] = strval ($values[$value]); $option->data['percent'] = strval (round ( ($values[$value] / $total) * 100, 1)); } // set values else { // empty $option->data['units'] = '0'; $option->data['percent'] = '0'; } // empty } // each option } // switch filter } // each field $mod->enabled = true; } // function setModule } // class eclMod_sectionFormulary_statistics_list //!eof:library/sectionFormulary/statistics/eclMod_sectionFormulary_statistics_list.php; //!file:library/sectionGlossary/create/eclApp_sectionGlossary_create.php; class eclApp_sectionGlossary_create { // class eclApp_sectionGlossary_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 1) and $name == 'glossary') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names global $store; if ($parent->parent->access) return array (); if (!$store->domainContent->findMarker ($parent->domainId, 1)) return array ('glossary'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionGlossary_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionGlossary_create //!eof:library/sectionGlossary/create/eclApp_sectionGlossary_create.php; //!file:library/sectionGlossary/eclApp_sectionGlossary.php; class eclApp_sectionGlossary { // class eclApp_sectionGlossary static function constructor_helper ($me) { // function constructor_helper $me->map = array ('domainGlossary_keyword'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->list = new eclMod_domainGlossary_list ($document); } // function dispatch static function remove ($me) { // function remove global $store; $data = &$store->domainContent->open ($me->domainId, '-register'); unset ($data['links']['sectionGlossary']); } // function remove } // class eclApp_sectionGlossary //!eof:library/sectionGlossary/eclApp_sectionGlossary.php; //!file:library/sectionInfo/create/eclApp_sectionInfo_create.php; class eclApp_sectionInfo_create { // class eclApp_sectionInfo_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 6) and $name == 'info') 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, 6)) return array ('info'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionInfo_create_content'); $me->map = array ('section_preset'); } // function constructor_helper } // class eclApp_sectionInfo_create //!eof:library/sectionInfo/create/eclApp_sectionInfo_create.php; //!file:library/sectionInfo/eclApp_sectionInfo.php; class eclApp_sectionInfo { // class eclApp_sectionInfo 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->formulary = $document->createFormulary ('domainInfo_view', $document->domain->data); $document->mod->list = new eclMod_domainInfo_listAdministrators ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionInfo //!eof:library/sectionInfo/eclApp_sectionInfo.php; //!file:library/sectionMenu/create/eclApp_sectionMenu_create.php; class eclApp_sectionMenu_create { // class eclApp_sectionMenu_create static function is_child ($me, $name) { // function is_child if (count ($me->pathway) < 3 and $name == 'menu') 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) < 3) return array ('menu'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionMenu_create_menu'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionMenu_create //!eof:library/sectionMenu/create/eclApp_sectionMenu_create.php; //!file:library/sectionMenu/eclApp_sectionMenu.php; class eclApp_sectionMenu { // class eclApp_sectionMenu 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 $pathway = $me->pathway; $pathway[] = '-new-section'; $document->mod->context->appendChild ('section_create_contextNew') ->url ($pathway); } // admin $document->mod->list = new eclMod_sectionMenu_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionMenu //!eof:library/sectionMenu/eclApp_sectionMenu.php; //!file:library/sectionMenu/eclMod_sectionMenu_list.php; class eclMod_sectionMenu_list { // class eclMod_sectionMenu_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 ($document->domain->name, '-dialog', 'section_list_menu_' . $me->name); $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_sectionMenu_list //!eof:library/sectionMenu/eclMod_sectionMenu_list.php; //!file:library/sectionRedirect/create/eclApp_sectionRedirect_create.php; class eclApp_sectionRedirect_create { // class eclApp_sectionRedirect_create static function is_child ($me, $name) { // function is_child global $store; if ($name == 'redirect') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; return array ('redirect'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionRedirect_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionRedirect_create //!eof:library/sectionRedirect/create/eclApp_sectionRedirect_create.php; //!file:library/sectionRedirect/eclApp_sectionRedirect.php; class eclApp_sectionRedirect { // class eclApp_sectionRedirect static function constructor_helper ($me) { // function constructor_helper $me->data['hits']++; $me->access = 0; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; if ($document->access (4)) { // admin $document->dataMerge ('sectionRedirect_content'); return; } // admin $me = $document->application; if (!isset ($me->data['local']['url']) or !$me->data['local']['url']) return; $me->data['value']++; $document->reload = $me->data['local']['url']; $io->log->silent = true; } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionRedirect //!eof:library/sectionRedirect/eclApp_sectionRedirect.php; //!file:library/sectionSearch/create/eclApp_sectionSearch_create.php; class eclApp_sectionSearch_create { // class eclApp_sectionSearch_create static function is_child ($me, $name) { // function is_child global $store; if ($me->parent->access) return false; if (!$store->domainContent->findMarker ($me->domainId, 3) and $name == 'search') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names global $store; if ($parent->parent->access) return array (); if (!$store->domainContent->findMarker ($parent->domainId, 3)) return array ('search'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionSearch_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionSearch_create //!eof:library/sectionSearch/create/eclApp_sectionSearch_create.php; //!file:library/sectionSearch/eclApp_sectionSearch.php; class eclApp_sectionSearch { // class eclApp_sectionSearch static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->panel->main = array ('content', 'formulary', 'list'); $document->mod->formulary = new eclMod_domainSearch_formulary ($document); $document->mod->list = new eclMod_domainSearch_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionSearch //!eof:library/sectionSearch/eclApp_sectionSearch.php; //!file:library/sectionSubdomains/create/eclApp_sectionSubdomains_create.php; class eclApp_sectionSubdomains_create { // class eclApp_sectionSubdomains_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->domainContent->findMarker ($me->domainId, 91) and $name == 'subdomains') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; $domain = $me; while (!$domain->isDomain and $domain = $domain->parent); if ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME) return array (); if (!$store->domainContent->findMarker ($me->domainId, 91)) return array ('subdomains'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionSubdomains_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionSubdomains_create //!eof:library/sectionSubdomains/create/eclApp_sectionSubdomains_create.php; //!file:library/sectionSubdomains/eclApp_sectionSubdomains.php; class eclApp_sectionSubdomains { // class eclApp_sectionSubdomains static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->list = new eclMod_sectionSubdomains_list ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionSubdomains //!eof:library/sectionSubdomains/eclApp_sectionSubdomains.php; //!file:library/sectionSubdomains/eclMod_sectionSubdomains_list.php; class eclMod_sectionSubdomains_list { // class eclMod_sectionSubdomains_list public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store; $document = $this->document; $me = $document->application; $row = $mod->appendChild(); foreach ($store->domain->childrenNames () as $name) { // each domain $domainId = $store->domain->getId ($name); $status = $store->domain->getStatus ($name); if ($status != 2) continue; $data = $store->domainContent->open ($domainId, '-register'); $row->appendChild ($data) ->swapTitle () ->url (array ($name)); } // each domain if (!$row->children) return; 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; 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_sectionSubdomains_list //!eof:library/sectionSubdomains/eclMod_sectionSubdomains_list.php; //!file:library/sectionTeam/create/eclApp_sectionTeam_create.php; class eclApp_sectionTeam_create { // class eclApp_sectionTeam_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->domainContent->findMarker ($me->domainId, 30) and $name == 'team') return true; if (!$store->domainContent->findMarker ($me->domainId, 31) and $name == 'partners') return true; if (!$store->domainContent->findMarker ($me->domainId, 32) and $name == 'students') return true; if (!$store->domainContent->findMarker ($me->domainId, 33) and $name == 'subscriptions') return true; if (!$store->domainContent->findMarker ($me->domainId, 34) and $name == 'suppliers') return true; if (!$store->domainContent->findMarker ($me->domainId, 35) and $name == 'clients') 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; $names = array (); if (!$store->domainContent->findMarker ($me->domainId, 30)) $names[] = 'team'; if (!$store->domainContent->findMarker ($me->domainId, 31)) $names[] = 'partners'; if (!$store->domainContent->findMarker ($me->domainId, 32)) $names[] = 'students'; if (!$store->domainContent->findMarker ($me->domainId, 33)) $names[] = 'subscriptions'; if (!$store->domainContent->findMarker ($me->domainId, 34)) $names[] = 'suppliers'; if (!$store->domainContent->findMarker ($me->domainId, 35)) $names[] = 'clients'; return $names; } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionTeam_create_' . $me->name); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionTeam_create //!eof:library/sectionTeam/create/eclApp_sectionTeam_create.php; //!file:library/sectionTeam/eclApp_sectionTeam.php; class eclApp_sectionTeam { // class eclApp_sectionTeam static function constructor_helper ($me) { // function constructor_helper $me->map = array ('sectionTeam_group', 'sectionTeam_group_new', 'sectionTeam_member', 'sectionTeam_member_import', 'sectionTeam_member_inactive', 'sectionTeam_member_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); $document->mod->panel->main = array ('content', 'listmembers', 'listgroups'); $document->mod->listmembers = new eclMod_sectionTeam_listAllMembers ($document); $document->mod->listgroups = new eclMod_sectionTeam_listAllGroups ($document); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionTeam //!eof:library/sectionTeam/eclApp_sectionTeam.php; //!file:library/sectionTeam/eclMod_sectionTeam_listAllGroups.php; class eclMod_sectionTeam_listAllGroups { // class eclMod_sectionTeam_listAllGroups 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; $marker = $me->data['marker']; $mod->data = array_replace_recursive ( $store->control->read ('modules/list_card'), $store->control->read ('sectionTeam_listAllGroups') ); $row = $mod->appendChild (); $sectors = $store->domainContent->children ($me->domainId, MODE_GROUP, 0); foreach ($sectors as $sector) { // each sector if ($sector['marker'] != $marker) continue; $pathway = $me->pathway; $pathway[] = $sector['name']; $row->appendChild ($sector) ->url ($pathway); } // each sector if ($document->access (4)) { // admin access if ($row->children) $row = $mod->appendChild (); $pathway = $me->pathway; $pathway[] = '-new-group'; $row->appendChild ('sectionTeam_group_new') ->url ($pathway); } // admin access if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_sectionTeam_listAllGroups //!eof:library/sectionTeam/eclMod_sectionTeam_listAllGroups.php; //!file:library/sectionTeam/eclMod_sectionTeam_listAllMembers.php; class eclMod_sectionTeam_listAllMembers { // class eclMod_sectionTeam_listAllMembers 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; $marker = $me->data['marker']; if ($marker == 30) $mod->data = $store->control->read ('sectionTeam_listAllMembers'); elseif ($marker == 31) $mod->data = $store->control->read ('sectionTeam_listAllPartners'); elseif ($marker == 32) $mod->data = $store->control->read ('sectionTeam_listAllStudents'); elseif ($marker == 33) $mod->data = $store->control->read ('sectionTeam_listAllSubscriptions'); elseif ($marker == 34) $mod->data = $store->control->read ('sectionTeam_listAllSuppliers'); elseif ($marker == 35) $mod->data = $store->control->read ('sectionTeam_listAllClients'); $mod->data = array_replace_recursive ($store->control->read ('modules/list_card'), $mod->data); $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_SUBSCRIPTION, 'marker' => $marker, ); $members = $store->domainContent->search ($where, 255, 0, 0, 'name', 'desc'); $row = $mod->appendChild (); foreach ($members as $member) { // each member if ($member['access'] > 4) { // inactive $inactive = true; continue; } // inactive $pathway = $me->pathway; $pathway[] = $member['name']; $row->appendChild ($member) ->swapTitle () ->url ($pathway) ->popUpOpen (); } // each member if ($document->access (4)) { // add new member if ($row->children) $row = $mod->appendChild (); // inactive if (isset ($inactive)) { // inactive member $pathway = $me->pathway; $pathway[] = '-inactive-member'; $row->appendChild ('sectionTeam_member_inactive') ->url ($pathway) ->popUpOpen (); } // inactive member // new $pathway = $me->pathway; $pathway[] = '-new-member'; $row->appendChild ('sectionTeam_member_new') ->url ($pathway) ->popUpOpen (); // import existing profile $pathway = $me->pathway; $pathway[] = '-import-profile'; $row->appendChild ('sectionTeam_member_import') ->url ($pathway) ->popUpOpen (); } // add new member if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_sectionTeam_listAllMembers //!eof:library/sectionTeam/eclMod_sectionTeam_listAllMembers.php; //!file:library/sectionTeam/group/eclApp_sectionTeam_group.php; class eclApp_sectionTeam_group { // class eclApp_sectionTeam_group static function is_child ($me, $name) { // function is_child global $store; $data = $store->domainContent->openChild ($me->domainId, MODE_GROUP, 0, $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 array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = &$store->domainContent->open ($me->domainId, $me->name); $me->id = $me->data['id']; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $view = true; // Action remove if ($document->actions ('group', 'remove')) return self::action_remove ($document); // action edit if ($document->actions ('group', 'edit')) $view = self::action_edit ($document); // context edit $document->mod->context->appendChild ('sectionTeam_group_edit') ->active ($document->actions ('group', 'edit')) ->url (true, true, '_group-edit'); // Context remove $document->mod->context->appendChild ('sectionTeam_group_remove') ->url (true, true, '_group-remove') ->confirm ('sectionTeam_group_removeConfirm'); if ($view) { // view $document->mod->editor->enable (); $document->mod->list = new eclMod_sectionTeam_group_listMembers ($document); } // view } // function dispatch static function action_edit ($document) { // function action_edit $me = $document->application; $formulary = $document->createFormulary ('sectionTeam_group_edit', $me->data, 'group_edit'); $formulary->action = '_group-edit'; if ($formulary->command ('cancel')) { // cancel unset ($document->actions['group']); return true; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save unset ($document->actions['group']); $me->data = $formulary->data; $document->dataReplace ($me->data); return true; } // save $document->mod->formulary = $formulary; 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; unset ($document->actions['group']); $parent = $me->parent; $store->domainContent->delete ($me->domainId, $me->id); $store->domainFile->deletePrefixedFiles ($me->domainId, $me->name); $parent->reset (); // reindex brothers $store->domainContent->childrenReindex ($parent->domainId, MODE_group, $parent->id); $document->application = $parent; $document->reload = $document->url (); $document->application->dispatch ($document); } // function action_remove static function remove ($me) { // function remove global $store; /* * Do not remove by parent */ } // function remove } // class eclApp_sectionTeam_group //!eof:library/sectionTeam/group/eclApp_sectionTeam_group.php; //!file:library/sectionTeam/group/eclApp_sectionTeam_group_new.php; class eclApp_sectionTeam_group_new { // class eclApp_sectionTeam_group_new static function is_child ($me, $name) { // function is_child if ($name == '-new-group') 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 ('-new-group'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->access = 4; $me->data = $store->control->read ('sectionTeam_group_new'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionTeam_group_edit', array (), 'new_group'); if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $data['domain_id'] = $me->domainId; $data['mode'] = MODE_GROUP; $data['marker'] = $me->parent->data['marker']; $store->domainContent->insert ($me->domainId, $data); $parent = $me->parent; $parent->reset (); $document->application = $parent->child ($data['name']); $document->application->dispatch ($document); $document->reload = $document->url (); return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionTeam_group_new //!eof:library/sectionTeam/group/eclApp_sectionTeam_group_new.php; //!file:library/sectionTeam/group/eclMod_sectionTeam_group_listMembers.php; class eclMod_sectionTeam_group_listMembers { // class eclMod_sectionTeam_group_listMembers 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; $marker = $me->data['marker']; if ($marker == 30) $mod->data = $store->control->read ('sectionTeam_listAllMembers'); elseif ($marker == 31) $mod->data = $store->control->read ('sectionTeam_listAllPartners'); elseif ($marker == 32) $mod->data = $store->control->read ('sectionTeam_listAllStudents'); elseif ($marker == 33) $mod->data = $store->control->read ('sectionTeam_listAllSubscriptions'); elseif ($marker == 34) $mod->data = $store->control->read ('sectionTeam_listAllSuppliers'); elseif ($marker == 35) $mod->data = $store->control->read ('sectionTeam_listAllClients'); $mod->data = array_replace_recursive ($store->control->read ('modules/list_card'), $mod->data); $members = $store->domainContent->children ($me->domainId, MODE_SUBSCRIPTION, $me->id);; $row = $mod->appendChild (); foreach ($members as $member) { // each member if ($member['access'] > 4) { // inactive $inactive = true; continue; } // inactive $pathway = $me->parent->pathway; $pathway[] = $member['name']; $row->appendChild ($member) ->swapTitle () ->url ($pathway) ->popUpOpen (); } // each member if ($document->access (4)) { // add new member if ($row->children) $row = $mod->appendChild (); // inactive if (isset ($inactive)) { // inactive member $pathway = $me->parent->pathway; $pathway[] = '-inactive-member'; $row->appendChild ('sectionTeam_member_inactive') ->url ($pathway) ->popUpOpen (); } // inactive member // new $pathway = $me->parent->pathway; $pathway[] = '-new-member'; $row->appendChild ('sectionTeam_member_new') ->url ($pathway) ->popUpOpen (); // import existing profile $pathway = $me->parent->pathway; $pathway[] = '-import-profile'; $row->appendChild ('sectionTeam_member_import') ->url ($pathway) ->popUpOpen (); } // add new member if ($row->children) $mod->enabled = true; } // function setModule } // class eclMod_sectionTeam_group_listMembers //!eof:library/sectionTeam/group/eclMod_sectionTeam_group_listMembers.php; //!file:library/sectionTeam/member/eclApp_sectionTeam_member.php; class eclApp_sectionTeam_member { // class eclApp_sectionTeam_member static function is_child ($me, $name) { // function is_child global $store; if (substr ($name, 0, 6) != '-user-') $name = '-user-' . $name; $data = $store->domainContent->open ($me->domainId, $name); if ($data and $data['mode'] == MODE_SUBSCRIPTION and $data['marker'] == $me->data['marker']) 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; $names = array (); $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_SUBSCRIPTION, 'marker' => $me->data['marker'] ); foreach ($store->domainContent->search ($where) as $data) { // each group $names[] = $data['name']; } // each group asort ($names); return $names; } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; switch ($me->parent->data['marker']) { // switch marker case 30: $me->data = $store->control->read ('sectionTeam_member_contentMember'); break; case 31: $me->data = $store->control->read ('sectionTeam_member_contentPartner'); break; case 32: $me->data = $store->control->read ('sectionTeam_member_contentStudant'); break; case 33: $me->data = $store->control->read ('sectionTeam_member_contentSubscription'); break; case 34: $me->data = $store->control->read ('sectionTeam_member_contentSuplier'); break; case 35: $me->data = $store->control->read ('sectionTeam_member_contentClient'); break; } // switch marker $me->access = 2; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; if (substr ($me->name, 0, 6) != '-user-') $data = &$store->domainContent->open ($me->domainId, '-user-' . $me->name); else $data = &$store->domainContent->open ($me->domainId, $me->name); if ($document->access (4)) { // admin access $formulary = $document->createFormulary ('sectionTeam_member_edit', $data); if ($formulary->command ('remove') or $document->actions ('member', 'unlink')) { // remove self::action_unlink ($document, $data); return; } // remove if ($data['marker'] <= 245) $document->mod->context->appendChild ('sectionTeam_member_unlink') ->url (true, true, '_member-unlink'); if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $document->dataReplace ('layouts/dialog_close'); return; } // save } // admin access else $formulary = $document->createFormulary ('sectionTeam_member_view', $data); if ($formulary->command ('cancel') or $formulary->command ('close')) { // close $document->dataReplace ('layouts/dialog_cancel'); return; } // close if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->mod->formulary = $formulary; } // function dispatch static function action_unlink ($document, &$data) { // function action_unlink if ($data['marker'] == 0) $document->mod->humperstilshen->alert ('sectionTeam_member_unlinkMember'); else $document->mod->humperstilshen->alert ('sectionTeam_member_unlinkMessage'); $data['parent_id'] = 0; $data['master_id'] = 0; $data['marker'] = 246; $data['updated'] = TIME; $formulary = $document->createFormulary ('sectionTeam_member_view', $data, 'view'); $document->mod->formulary = $formulary; } // function action_unlink } // class eclApp_sectionTeam_member //!eof:library/sectionTeam/member/eclApp_sectionTeam_member.php; //!file:library/sectionTeam/member/eclApp_sectionTeam_member_import.php; class eclApp_sectionTeam_member_import { // class eclApp_sectionTeam_member_import static function is_child ($me, $name) { // function is_child if ($name == '-import-profile') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-import-profile'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionTeam_member_import'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionTeam_member_import'); if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('layouts/dialog_close'); return; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; $name = $data['name']; $userId = $store->user->getId ($name); $data['name'] = '-user-' . $name; $data['mode'] = MODE_SUBSCRIPTION; $data['marker'] = $me->parent->data['marker']; $data['owner_id'] = $userId; $store->domainContent->insert ($me->domainId, $data); $document->dataReplace ('layouts/dialog_close'); return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionTeam_member_import //!eof:library/sectionTeam/member/eclApp_sectionTeam_member_import.php; //!file:library/sectionTeam/member/eclApp_sectionTeam_member_inactive.php; class eclApp_sectionTeam_member_inactive { // class eclApp_sectionTeam_member_inactive static function is_child ($me, $name) { // function is_child if ($name == '-inactive-member') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-inactive-member'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionTeam_member_inactive'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionTeam_member_inactive'); if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('layouts/dialog_close'); return; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $data = &$store->domainContent->open ($me->domainId, $formulary->data['name']); $data['parent_id'] = 0; $data['master_id'] = 0; $data['marker'] = $me->parent->data['marker']; $document->dataReplace ('layouts/dialog_close'); return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionTeam_member_inactive //!eof:library/sectionTeam/member/eclApp_sectionTeam_member_inactive.php; //!file:library/sectionTeam/member/eclApp_sectionTeam_member_new.php; class eclApp_sectionTeam_member_new { // class eclApp_sectionTeam_member_new static function is_child ($me, $name) { // function is_child if ($name == '-new-member') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-new-member'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionTeam_member_new'); $me->access = 4; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $formulary = $document->createFormulary ('sectionTeam_member_new'); if ($formulary->command ('cancel')) { // cancel $document->dataReplace ('layouts/dialog_close'); return; } // cancel if ($formulary->command ('save') and $formulary->save ()) { // save $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); $data = $formulary->data; $name = $data['name']; $data['name'] = '-user-' . $name; $data['mode'] = MODE_SUBSCRIPTION; $data['master_id'] = 0; $data['marker'] = $me->parent->data['marker']; $data['owner_id'] = $userId; $store->domainContent->insert ($me->domainId, $data); $document->dataReplace ('layouts/dialog_close'); return; } // save $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); } // function dispatch } // class eclApp_sectionTeam_member_new //!eof:library/sectionTeam/member/eclApp_sectionTeam_member_new.php; //!file:library/sectionTeam/member/eclFilter_sectionTeam_member_importList.php; class eclFilter_sectionTeam_member_importList { // class eclFilter_sectionTeam_member_importList 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'] = 'list'; $item->data['size'] = 15; $users = $store->domainGroup->getDomainSubscribedUsers ($me->domainId); foreach ($store->user->childrenNames () as $name) { // each user $userId = $store->user->getId ($name); if (isset ($users[$userId])) 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' => $name, 'caption' => $caption )); } // each user } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; if (!isset ($formulary->received[$fieldName])) goto ERROR; if (!strlen ($formulary->received[$fieldName])) goto ERROR; $name = $formulary->received[$fieldName]; $userId = $store->user->getId ($name); if (!$userId) goto ERROR; $formulary->data = $store->userContent->open ($userId, '-register'); $formulary->data['name'] = $name; return; ERROR: $formulary->setErrorMsg ($control, $fieldName, 'sectionTeam_member_importListError'); } // function save } // class eclFilter_sectionTeam_member_importList //!eof:library/sectionTeam/member/eclFilter_sectionTeam_member_importList.php; //!file:library/sectionTeam/member/eclFilter_sectionTeam_member_inactiveList.php; class eclFilter_sectionTeam_member_inactiveList { // class eclFilter_sectionTeam_member_inactiveList 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'] = 'list'; $item->data['size'] = 15; $where = array ( 'domain_id' => $me->domainId, 'mode' => MODE_SUBSCRIPTION, 'marker' => $me->parent->data['marker'], 'access' => '> 200' ); $profiles = $store->domainContent->search ($where, 255, 0, 0, 'name', 'asc'); foreach ($profiles as $data) { // each user $item->appendChild ($data, array ('value' => $data['name'])); } // each user } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $me = $formulary->document->application; if (!isset ($formulary->received[$fieldName])) goto ERROR; if (!strlen ($formulary->received[$fieldName])) goto ERROR; $name = $formulary->received[$fieldName]; $data = &$store->domainContent->open ($me->domainId, $name); if ($data['mode'] != MODE_SUBSCRIPTION or $data['marker'] < 245) goto ERROR; $formulary->data = $data; return; ERROR: $formulary->setErrorMsg ($control, $fieldName, 'sectionTeam_member_importListError'); } // function save } // class eclFilter_sectionTeam_member_inactiveList //!eof:library/sectionTeam/member/eclFilter_sectionTeam_member_inactiveList.php; //!file:library/sectionTeam/member/eclFilter_sectionTeam_member_selectGroup.php; class eclFilter_sectionTeam_member_selectGroup { // class eclFilter_sectionTeam_member_selectGroup static function create ($fieldName, $control, $formulary) { // function create global $io, $store; $document = $formulary->document; $me = $document->application; $marker = $me->parent->data['marker']; $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'; $item->appendChild ('sectionTeam_member_editGroupNone'); // value $id = $formulary->getField ('parent_id'); $groups = $store->domainContent->children ($me->domainId, MODE_GROUP, 0); foreach ($groups as $data) { // each user if ($data['marker'] != $marker) continue; $item->appendChild (false, array ( 'value' => $data['id'], 'caption' => $data['text']['caption'] )) ->active ($data['id'] == $id); } // each user } // function create static function save ($fieldName, $control, $formulary) { // function save global $store; $me = $formulary->document->application; if (!isset ($formulary->received[$fieldName][0])) return $formulary->data['parent_id'] = 0; $id = intval ($formulary->received[$fieldName]); if (!$id) return $formulary->data['parent_id'] = 0; $data = $store->domainContent->openById ($me->domainId, $id); if (!$data or $data['mode'] != MODE_GROUP) return $formulary->data['parent_id'] = 0; $formulary->data['parent_id'] = $id; } // function save } // class eclFilter_sectionTeam_member_selectGroup //!eof:library/sectionTeam/member/eclFilter_sectionTeam_member_selectGroup.php; //!file:library/sectionTerms/create/eclApp_sectionTerms_create.php; class eclApp_sectionTerms_create { // class eclApp_sectionTerms_create static function is_child ($me, $name) { // function is_child global $store; if (!$store->domainContent->findMarker ($me->domainId, 5) and $name == 'terms') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names global $store; $domain = $me; while (!$domain->isDomain and $domain = $domain->parent); if ($domain->name != SYSTEM_DEFAULT_DOMAIN_NAME) return array (); if (!$store->domainContent->findMarker ($me->domainId, 5)) return array ('terms'); return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('sectionTerms_create_content'); $me->map = array ('section_preset'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_sectionTerms_create //!eof:library/sectionTerms/create/eclApp_sectionTerms_create.php; //!file:library/sectionTerms/eclApp_sectionTerms.php; class eclApp_sectionTerms { // class eclApp_sectionTerms static function constructor_helper ($me) { // function constructor_helper } // function constructor_helper static function dispatch ($document) { // function dispatch if ($document->access (4)) $document->mod->editor->enable (); } // function dispatch static function remove ($me) { // function remove } // function remove } // class eclApp_sectionTerms //!eof:library/sectionTerms/eclApp_sectionTerms.php; //!file:library/system/eclApp_system.php; class eclApp_system { // class eclApp_system static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function constructor_helper ($me) { // function constructor_helper global $io, $store; // Set default layout $me->data['flags'] = array ( 'modLayout_base' => 'responsive', 'modLayout_from' => 'domain', 'modLayout_name' => 'default' ); // Default settings $me->data['generator'] = SYSTEM_GENERATOR; $me->data['version'] = SYSTEM_VERSION; $me->data['release'] = SYSTEM_RELEASE; // Project name and reference $me->data['text']['caption'][SYSTEM_DEFAULT_LANGUAGE][TEXT_CONTENT] = SYSTEM_PROJECT_CAPTION; if (SYSTEM_DEFAULT_CHARSET == 'ISO-8859-1') $me->data['text']['caption'][SYSTEM_DEFAULT_LANGUAGE][TEXT_CHARSET] = 1; $me->data['url'] = SYSTEM_PROJECT_URL; $me->getMap (); $me->isDomain = true; $me->groups[] = new eclGroup_system (); } // function constructor_helper } // class eclApp_system //!eof:library/system/eclApp_system.php; //!file:library/system/eclGroup_system.php; class eclGroup_system { // class eclGroup_system public function check ($document) { // function check if (!defined ('ADMIN_IDENTIFIER')) return 0; if ($document->user->name == ADMIN_IDENTIFIER) return 4; if (defined ('ADMIN_HELPERS') and strlen (ADMIN_HELPERS) and in_array ($document->user->name, explode (' ', ADMIN_HELPERS))) return 4; return 0; } // function check } // class eclGroup_system //!eof:library/system/eclGroup_system.php; //!file:library/systemAccessDenied/eclApp_systemAccessDenied.php; class eclApp_systemAccessDenied { // class eclApp_systemAccessDenied static function is_child ($me, $name) { // function is_child if ($name == '-access-denied') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-access-denied'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('systemAccessDenied_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $io; $document->base = 'system_message'; if ($document->pathway[0] == SYSTEM_PROFILES_URI) $document->dataMerge ('systemAccessDenied_contentProfile'); $io->request->header ('HTTP/1.1 503 Service Temporarily Unavailable'); $io->request->header ('X-Robots-Tag: noindex'); $io->request->header ('Retry-After: 86400'); } // function dispatch } // class eclApp_systemAccessDenied //!eof:library/systemAccessDenied/eclApp_systemAccessDenied.php; //!file:library/systemDefault/eclApp_systemDefault.php; class eclApp_systemDefault { // class eclApp_systemDefault static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('systemDefault_content'); $me->ignoreSubfolders = true; $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->base = 'system_message'; } // function dispatch } // class eclApp_systemDefault //!eof:library/systemDefault/eclApp_systemDefault.php; //!file:library/systemInstallation/eclApp_systemInstallation.php; class eclApp_systemInstallation { // class eclApp_systemInstallation static function is_child ($parent, $name) { // function is_child if (!defined ('ADMIN_IDENTIFIER')) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('systemInstallation_index'); $me->map = array ('systemInstallation_index'); $me->isDomain = true; } // function constructor_helper } // class eclApp_systemInstallation //!eof:library/systemInstallation/eclApp_systemInstallation.php; //!file:library/systemInstallation/eclApp_systemInstallation_index.php; class eclApp_systemInstallation_index { // class eclApp_systemInstallation_index static function is_child ($parent, $name) { // function is_child if ($name == '') return true; if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($parent) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; // As subpastas deverão ser ignoradas $me->ignoreSubfolders = true; $me->data = $store->control->read ('systemInstallation_index'); unset ($me->pathway[1]); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; if (!is_file (PATH_ROOT . SYSTEM_CONFIG_FILE)) { // config file not found $n = @file_put_contents (PATH_ROOT . SYSTEM_CONFIG_FILE, 'dataMerge ('systemInstallation_accessDenied'); return; } // unable to write unlink (PATH_ROOT . SYSTEM_CONFIG_FILE); } // config file not found if (!isset ($document->session['systemInstallation'])) { // presets $document->session['systemInstallation'] = $store->control->read ('systemInstallation_templateForConfig'); if ($document->protocol == 'https') $document->session['systemInstallation']['SYSTEM_HTTPS_REDIRECT'] = true; if ($document->rewriteEngine or strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache')) $document->session['systemInstallation']['SYSTEM_REWRITE_ENGINE'] = true; } // presets if (!isset ($document->session['systemInstallation_page'])) $document->session['systemInstallation_page'] = 0; PROCESS_PAGE: $page = $document->session['systemInstallation_page']; $formulary = $document->createFormulary ('systemInstallation_' . $page, $document->session['systemInstallation'], 'page' . $page); if (!$document->rewriteEngine and strpos (' ' . strtolower ($_SERVER['SERVER_SOFTWARE']), 'apache')) $formulary->flags['rewrite_engine_choose'] = true; if ($formulary->command ('next') and $formulary->save ()) { // next $document->session['systemInstallation'] = $formulary->data; $document->session['systemInstallation_page']++; if ($document->session['systemInstallation_page'] == 3) return self::finish_installation ($document); goto PROCESS_PAGE; } // next elseif ($formulary->command ('previous')) { // previous $formulary->save (); $document->session['systemInstallation'] = $formulary->data; $document->session['systemInstallation_page']--; goto PROCESS_PAGE; } // previous $document->mod->formulary = $formulary; if ($formulary->errorMsg) $document->mod->humperstilshen->alert ($formulary->errorMsg); $document->data['url'] = $document->url (); $document->data['folder'] = PATH_ROOT; } // function dispatch static function finish_installation ($document) { // function finish_installation $constants = $document->session['systemInstallation']; if ($constants['SYSTEM_HOSTING_MODE'] == 0) { // set default configuration $constants['DATABASE_ENABLED'] = true; $constants['DATABASE_CLIENT'] = 'sqlite'; $constants['SYSTEM_DEFAULT_DOMAIN_NAME'] = 'ecolabore'; $constants['SYSTEM_DEFAULT_LANGUAGE'] = $document->lang; } // set default configuration ksort ($constants); $buffer = ' $value) { // each constant $buffer .= "define ('" . $key . "', "; if ($value === false) $buffer .= 'false'; elseif ($value === true) $buffer .= 'true'; elseif (is_int ($value)) $buffer .= strval ($value); elseif (is_string ($value)) $buffer .= "'" . str_replace ("'", CHR_BSLASH . CHR_TIC, $value) . "'"; $buffer .= ");" . CRLF; } // each constant $buffer .= CRLF . '?>'; header ('Content-type: application/force-download'); header ('Content-Disposition: attachment; filename="config.php"'); print $buffer; $document->session = array (); exit; } // function finish_installation } // class eclApp_systemInstallation_index //!eof:library/systemInstallation/eclApp_systemInstallation_index.php; //!file:library/systemInstallation/eclFilter_systemInstallation_password.php; /* * Control flags * control_type * control_filter = password * control_target * control_field_name * control_required * control_error_msg */ class eclFilter_systemInstallation_password { // class eclFilter_systemInstallation_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); $local['name'] .= '_repeat'; $formulary->appendChild ('labels/field/user_repeat_password', $local); } // function create static function save ($fieldName, $control, $formulary) { // function save isset ($formulary->received[$fieldName]) ? $password = $formulary->received[$fieldName] : $password = false; isset ($formulary->received[$fieldName . '_repeat']) ? $password2 = $formulary->received[$fieldName . '_repeat'] : $password2 = false; if (!$password and $password !== '0') $password = false; // required if ($password === false and isset ($control['flags']['required'])) return $formulary->setRequiredMsg ($control, $fieldName, 'adminUsers_add_msgPasswordRequired'); // no password, no required if (!$password) return; if ($password != $password2) return $formulary->setErrorMsg ($control, $fieldName, 'adminUsers_add_msgPasswordRepeatError'); foreach (str_split ($password) as $char) { // each char if (ord ($char) < 32 or ord ($char) > 127) return $formulary->setErrorMsg ($control, $fieldName, 'adminUsers_add_msgPasswordInvalidCharacter'); } // each char // md5 if (isset ($control['flags']['password_md5'])) $password = md5 ($password); // target if (isset ($control['flags']['target'])) $formulary->setField ($control['flags']['target'], $password); } // function save } // class eclFilter_systemInstallation_password //!eof:library/systemInstallation/eclFilter_systemInstallation_password.php; //!file:library/systemPreload/eclApp_systemPreload.php; class eclApp_systemPreload { // class eclApp_systemPreload static function is_child ($me, $name) { // function is_child if ($name == '-preload') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-preload'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->getMap (); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_systemPreload //!eof:library/systemPreload/eclApp_systemPreload.php; //!file:library/systemShared/eclApp_systemShared.php; class eclApp_systemShared { // class eclApp_systemShared static function is_child ($me, $name) { // function is_child global $io; if (in_array ('-shared', $io->request->pathway)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper $me->name = '-shared'; $me->ignoreSubfolders = true; $me->ignoreSession (true); } // function constructor_helper static function dispatch ($document) { // function dispatch global $dataMap, $io; $me = $document->application; $pathway = $document->pathway; while (array_shift ($pathway) != $me->name); if (count ($pathway) < 2) exit; static $mime = array ( 'css' => 'text/css', 'gif' => 'image/gif', 'html' => 'text/html', 'htm' => 'text/html', 'jpg' => 'image/jpeg', 'js' => 'text/javascript', 'mp3' => 'audio/mpeg', 'png' => 'image/png', 'svg' => 'image/svg+xml', 'txt' => 'text/plain', 'ttf' => 'font/ttf' ); $folders = $pathway; $name = array_pop ($folders); $path = implode ('/', $folders); if (isset ($dataMap['f'][$path][$name])) { // embeded @list (, $extension) = explode ('.', $name, 2); if (!isset ($mime[$extension])) { // bad request header ('HTTP/1.0 400 Bad Request'); exit; } // bad request if (SYSTEM_TIME_LIMIT) set_time_limit (0); 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'); $buffer = $io->cachedControls->file ($path, $name); $size = strval (strlen ($buffer)); $eTag = md5 ($name . SYSTEM_PACKED_DATE); 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'] == SYSTEM_PACKED_DATE) { // not modified header ('HTTP/1.1 304 Not Modified'); exit; } // not modified header ('HTTP/1.1 200 OK'); header ('Access-Control-Allow-Origin: *'); header ('Cache-Control: public, only-if-cached, max-age=172800'); header ('Last-Modified: ' . SYSTEM_PACKED_DATE); header ('ETag: "' . $eTag . '"'); header ('Content-type: ' . $mime[$extension]); header ('Content-Length: ' . $size); header ('Connection: close'); print $buffer; exit; } // embeded $path = PATH_SHARED . implode ('/', $pathway); $headers = array ( 'Content-Disposition' => 'inline', 'Cache-Control' => 'public, only-if-cached, max-age=2592000' ); $io->sendFile->send ($path, $headers); exit; } // function dispatch } // class eclApp_systemShared //!eof:library/systemShared/eclApp_systemShared.php; //!file:library/tool/eclApp_tool.php; class eclApp_tool { // class eclApp_tool static function is_child ($parent, $name) { // function is_child if ($name == '-tools') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names () { // function get_children_names return array ('-tools'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('tool_content'); $me->access = 4; $me->getMap (); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_tool //!eof:library/tool/eclApp_tool.php; //!file:library/toolConfig/about/eclApp_toolConfig_about.php; class eclApp_toolConfig_about { // class eclApp_toolConfig_about static function is_child ($parent, $name) { // function is_child if ($name == 'about') 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 ('about'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('toolConfig_about_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $data = &$store->domainContent->open ($me->domainId, '-register'); $formulary = $document->createFormulary ('toolConfig_about_edit', $data); if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_toolConfig_about //!eof:library/toolConfig/about/eclApp_toolConfig_about.php; //!file:library/toolConfig/eclApp_toolConfig.php; class eclApp_toolConfig { // class eclApp_toolConfig const name = 'config'; const menuType = 'section'; const dataFrom = 'toolConfig_content'; const map = 'toolConfig_about toolConfig_languages toolConfig_versioning'; const isDomain = true; static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_admin_list ($document); } // function dispatch } // class eclApp_toolConfig //!eof:library/toolConfig/eclApp_toolConfig.php; //!file:library/toolConfig/languages/eclApp_toolConfig_languages.php; class eclApp_toolConfig_languages { // class eclApp_toolConfig_languages static function is_child ($parent, $name) { // function is_child if ($name == 'languages') 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 ('languages'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('toolConfig_languages_content'); $me->map = array ('toolConfig_languages_select'); } // function constructor_helper static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $data = &$store->domainContent->open ($me->domainId, '-register'); $formulary = $document->createFormulary ('toolConfig_languages_edit', $data); if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_toolConfig_languages //!eof:library/toolConfig/languages/eclApp_toolConfig_languages.php; //!file:library/toolConfig/languages/eclApp_toolConfig_languages_select.php; class eclApp_toolConfig_languages_select { // class eclApp_toolConfig_languages_select static function is_child ($parent, $name) { // function is_child if ($name == 'select') 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 ('select'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('toolConfig_languages_select'); $me->isDomain = true; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_toolConfig_languages_select ($document); } // function dispatch } // class eclApp_toolConfig_languages_select //!eof:library/toolConfig/languages/eclApp_toolConfig_languages_select.php; //!file:library/toolConfig/languages/eclFilter_toolConfig_languages_manager.php; class eclFilter_toolConfig_languages_manager { // class eclFilter_toolConfig_languages_manager 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, '-tools', 'config', 'languages', 'select'); $item->data['url_add'] = $document->url ($pathway); $item->data['move-enable'] = 1; $item->data['remove-enable'] = 1; // $item->data['edit-enable'] = 1; $value = $formulary->getField ('flags/languages'); $buffer = ''; foreach (explode (CRLF, $value) as $lang) { // each line $lang = trim ($lang); if (!isset ($lang[0])) continue; $data = $store->control->read ('labels/lang/' . $lang); if (isset ($data['text']['caption'])) $caption = $data['text']['caption']; else $caption = $document->textMerge ($lang); $buffer .= $lang . CRLF; $item->appendChild (false, array ('value' => $lang, 'caption' => $caption)); } // 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-z]$/', $line)) $buffer[] = $line; } // each line } // received if ($buffer) $buffer = implode (CRLF, $buffer); else $buffer = false; $formulary->setField ('flags/languages', $buffer); } // function save } // class eclFilter_toolConfig_languages_manager //!eof:library/toolConfig/languages/eclFilter_toolConfig_languages_manager.php; //!file:library/toolConfig/languages/eclMod_toolConfig_languages_select.php; class eclMod_toolConfig_languages_select { // class eclMod_toolConfig_languages_select 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; $names = $store->control->scandir ('t', 'labels/lang'); foreach ($names as $lang) { // each lang $data = $store->control->read ('labels/lang/' . $lang); $mod->appendChild ($data, array ('name' => $lang)); } // each lang $mod->enabled = true; } // function setModule } // class eclMod_toolConfig_languages_select //!eof:library/toolConfig/languages/eclMod_toolConfig_languages_select.php; //!file:library/toolConfig/versioning/eclApp_toolConfig_versioning.php; class eclApp_toolConfig_versioning { // class eclApp_toolConfig_versioning const name = 'versioning'; const menuType = 'section'; const dataFrom = 'toolConfig_versioning_content'; static function dispatch ($document) { // function dispatch global $store; $me = $document->application; $data = &$store->domainContent->open ($me->domainId, '-register'); $formulary = $document->createFormulary ('toolConfig_versioning_edit', $data); if ($formulary->command ('clear')) { // clear cache } // clear cache if ($formulary->command ('save') and $formulary->save ()) { // save $data = $formulary->data; } // save $document->mod->formulary = $formulary; } // function dispatch } // class eclApp_toolConfig_versioning //!eof:library/toolConfig/versioning/eclApp_toolConfig_versioning.php; //!file:library/user/eclApp_user.php; class eclApp_user { // class eclApp_user static function is_child ($me, $name) { // function is_child if ($name == SYSTEM_PROFILES_URI) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'domain'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (SYSTEM_PROFILES_URI); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('user_content'); $me->groups = array(); $me->getMap (); $me->isDomain = true; } // function constructor_helper } // class eclApp_user //!eof:library/user/eclApp_user.php; //!file:library/user/eclGroup_user.php; class eclGroup_user { // class eclGroup_user private $userId; public function __construct ($userId) { // function __construct $this->userId = $userId; } // function __construct public function check ($document) { // function check if ($this->userId == $document->user->userId) return 4; if (defined ('ADMIN_IDENTIFIER') and $document->user->name == ADMIN_IDENTIFIER) return 1; elseif (!$document->user->userId) return 0; return 1; } // function check } // class eclGroup_user //!eof:library/user/eclGroup_user.php; //!file:library/userAdmin/eclApp_userAdmin.php; class eclApp_userAdmin { // class eclApp_userAdmin static function is_child ($me, $name) { // function is_child global $store; if (!defined ('ADMIN_IDENTIFIER')) return false; if ($name != ADMIN_IDENTIFIER) return false; if ($store->user->getId ($name)) return false; return true; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $io, $store; $me->name = ADMIN_IDENTIFIER; $me->map = array ('userAdmin_index', 'userHome_welcome'); $me->data = &$io->session->cache; $me->data['text']['caption'] = array ('en' => array (1 => ADMIN_CAPTION)); $me->data['text']['title'] = array ('en' => array (1 => ADMIN_CAPTION)); $me->data['name'] = ADMIN_IDENTIFIER; $me->data['local']['mail'] = ADMIN_MAIL; $me->data['local']['gender'] = ADMIN_GENDER; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->application = $document->application->child ('-index'); $document->application->dispatch ($document); } // function dispatch } // class eclApp_userAdmin //!eof:library/userAdmin/eclApp_userAdmin.php; //!file:library/userAdmin/eclApp_userAdmin_index.php; class eclApp_userAdmin_index { // class eclApp_userAdmin_index static function is_child ($me, $name) { // function is_child if ($name == '' or $name == '-index') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (''); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userAdmin_content'); array_pop ($me->pathway); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userAdmin_index //!eof:library/userAdmin/eclApp_userAdmin_index.php; //!file:library/userAnonimous/eclApp_userAnonimous.php; class eclApp_userAnonimous { // class eclApp_userAnonimous static function is_child ($me, $name) { // function is_child if ($name == '-anonimous') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-anonimous'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userAnonimous_content'); } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userAnonimous //!eof:library/userAnonimous/eclApp_userAnonimous.php; //!file:library/userDefault/eclApp_userDefault.php; class eclApp_userDefault { // class eclApp_userDefault static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userDefault_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userDefault //!eof:library/userDefault/eclApp_userDefault.php; //!file:library/userHome/alerts/eclApp_userHome_alerts.php; class eclApp_userHome_alerts { // class eclApp_userHome_alerts static function is_child ($me, $name) { // function is_child if ($name == '-alerts') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-alerts'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_alerts_content'); $me->isDomain = true; $me->getMap (); $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list = new eclMod_user_alerts ($document); } // function dispatch } // class eclApp_userHome_alerts //!eof:library/userHome/alerts/eclApp_userHome_alerts.php; //!file:library/userHome/alerts/eclApp_userHome_alerts_mail.php; class eclApp_userHome_alerts_mail { // class eclApp_userHome_alerts_mail static function is_child ($me, $name) { // function is_child if (INTEGRATION_SMTP_ENABLE and $name == '-mail') 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 (!INTEGRATION_SMTP_ENABLE) return array (); $name = $me->pathway[1]; $user = $store->user->open ($name); if (!$user['mail']) return array ('-mail'); else return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_alerts_mail'); $me->pathway = array_slice ($me->pathway, 0, - 2); $me->pathway[] = $me->name; $me->isDomain = true; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userHome_alerts_mail //!eof:library/userHome/alerts/eclApp_userHome_alerts_mail.php; //!file:library/userHome/alerts/eclApp_userHome_alerts_phone.php; class eclApp_userHome_alerts_phone { // class eclApp_userHome_alerts_phone static function is_child ($me, $name) { // function is_child if (INTEGRATION_SMS_ENABLE and $name == '-phone') 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 (!INTEGRATION_SMS_ENABLE) return array (); $name = $me->pathway[1]; $user = $store->user->open ($name); if (!$user['phone']) return array ('-phone'); else return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_alerts_phone'); $me->pathway = array_slice ($me->pathway, 0, - 2); $me->pathway[] = $me->name; $me->isDomain = true; $me->access = 4; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userHome_alerts_phone //!eof:library/userHome/alerts/eclApp_userHome_alerts_phone.php; //!file:library/userHome/default/eclApp_userHome_default.php; class eclApp_userHome_default { // class eclApp_userHome_default static function is_child ($me, $name) { // function is_child if ($name == '-default') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'hidden'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-default'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_default_content'); $me->ignoreSubfolders = true; } // function constructor_helper static function dispatch ($document) { // function dispatch } // function dispatch } // class eclApp_userHome_default //!eof:library/userHome/default/eclApp_userHome_default.php; //!file:library/userHome/eclApp_userHome.php; class eclApp_userHome { // class eclApp_userHome static function is_child ($me, $name) { // function is_child global $store; if (!strlen ($name) or $name[0] == '-') return false; if ($store->user->getId ($name)) return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'post'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array (); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->userId = $store->user->getId ($me->name); $me->getMap (); $me->groups = array ( new eclGroup_user ($me->userId)); $me->data = &$store->userContent->open ($me->userId, '-register'); } // function constructor_helper static function dispatch ($document) { // function dispatch $document->application = $document->application->child ('-index'); $document->pathway = $document->application->pathway; $document->application->dispatch ($document); } // function dispatch } // class eclApp_userHome //!eof:library/userHome/eclApp_userHome.php; //!file:library/userHome/index/eclApp_userHome_index.php; class eclApp_userHome_index { // class eclApp_userHome_index static function is_child ($me, $name) { // function is_child if ($name == '-index') return true; return false; } // function is_child static function get_menu_type () { // function get_menu_type return 'section'; } // function get_menu_type static function get_children_names ($me) { // function get_children_names return array ('-index'); } // function get_children_names static function constructor_helper ($me) { // function constructor_helper global $store; $me->data = $store->control->read ('userHome_index_content'); $me->data['text']['profile'] = $me->parent->data['text']['caption']; } // function constructor_helper static function dispatch ($document) { // function dispatch $document->mod->list1 = new eclMod_userHome_index_domains ($document); $document->mod->list2 = new eclMod_userHome_index_recents ($document); $document->mod->panel->main = array ('content', 'list1', 'list2'); } // function dispatch } // class eclApp_userHome_index //!eof:library/userHome/index/eclApp_userHome_index.php; //!file:library/userHome/index/eclMod_userHome_index_domains.php; class eclMod_userHome_index_domains { // class eclMod_userHome_index_domains public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $io, $store, $system; $document = $this->document; $me = $document->application; $mod->data = array_replace ($store->control->read ('modules/list_card'), $store->control->read ('userHome_index_domains')); $row = $mod->appendChild (); $where = array ( 'user_id' => $me->userId, 'group_id' => 1 ); $groups = $io->database->select ($store->domainGroup, $where); if (!$groups) return; $names = array(); foreach ($groups as $group) { // each group $name = $store->domain->getName ($group['domain_id']); $status = $store->domain->getStatus ($name); if ($status == 2 or $status == 4) $names[] = $name; } // each group if (!$names) return; asort ($names); foreach ($names as $name) { // list domains $domain = $system->child ($name); $row->appendChild ($domain->data) ->swapTitle () ->url ($domain->pathway); } // list domains $mod->enabled = true; } // function setModule } // class eclMod_userHome_index_domains //!eof:library/userHome/index/eclMod_userHome_index_domains.php; //!file:library/userHome/index/eclMod_userHome_index_recents.php; class eclMod_userHome_index_recents { // class eclMod_userHome_index_recents public $document; public function __construct ($document) { // function __construct $this->document = $document; } // function __construct public function setModule ($mod, $arguments) { // function setModule global $store, $system; $document = $this->document; $me = $document->application; $mod->data = array_replace ($store->control->read ('modules/list_card'), $store->control->read ('userHome_index_recents')); $row = $mod->appendChild (); $where = array ( 'mode' => MODE_POST, 'owner_id' => $me->userId ); $recents = $store->domainContent-