application/mxchange/main/.htaccess -text
application/mxchange/starter.php -text
application/mxchange/templates/.htaccess -text
+/clear-cache.sh -text
db/.htaccess -text
devel/.htaccess -text
devel/class_Debug.php -text
inc/classes.php -text
inc/classes/.htaccess -text
inc/classes/exceptions/.htaccess -text
+inc/classes/exceptions/actions/.htaccess -text
+inc/classes/exceptions/actions/class_InvalidActionException.php -text
inc/classes/exceptions/auth/.htaccess -text
inc/classes/exceptions/auth/class_UserAuthorizationException.php -text
inc/classes/exceptions/class_ -text
inc/classes/exceptions/container/class_ContainerMaybeDamagedException.php -text
inc/classes/exceptions/controller/.htaccess -text
inc/classes/exceptions/controller/class_DefaultControllerException.php -text
+inc/classes/exceptions/controller/class_InvalidControllerException.php -text
inc/classes/exceptions/criteria/.htaccess -text
+inc/classes/exceptions/crypto/.htaccess -text
+inc/classes/exceptions/crypto/class_EncryptInvalidLengthException.php -text
+inc/classes/exceptions/crypto/class_EncryptMissingException.php -text
inc/classes/exceptions/database/.htaccess -text
+inc/classes/exceptions/database/class_ -text
inc/classes/exceptions/database/class_DatabaseException.php -text
inc/classes/exceptions/database/general/.htaccess -text
+inc/classes/exceptions/database/general/class_DatabaseUpdateSupportException.php -text
inc/classes/exceptions/database/general/class_SqlException.php -text
inc/classes/exceptions/database/local_file/.htaccess -text
inc/classes/exceptions/database/local_file/class_SavePathIsEmptyException.php -text
inc/classes/exceptions/helper/class_FormClosedException.php -text
inc/classes/exceptions/helper/class_FormGroupClosedException.php -text
inc/classes/exceptions/helper/class_FormOpenedException.php -text
+inc/classes/exceptions/helper/class_HelperGroupAlreadyCreatedException.php -text
+inc/classes/exceptions/helper/class_HelperNoPreviousOpenedSubGroupException.php -text
+inc/classes/exceptions/helper/class_HelperSubGroupAlreadyCreatedException.php -text
inc/classes/exceptions/helper/class_InvalidFormNameException.php -text
+inc/classes/exceptions/helper/class_NoGroupOpenedException.php -text
inc/classes/exceptions/helper/class_UserInstanceMissingException.php -text
inc/classes/exceptions/io/.htaccess -text
inc/classes/exceptions/io/class_DirPointerNotOpenedException.php -text
+inc/classes/exceptions/io/class_FileNotFoundException.php -text
inc/classes/exceptions/io/class_FilePointerNotOpenedException.php -text
+inc/classes/exceptions/io/class_FileReadProtectedException.php -text
inc/classes/exceptions/io/class_InvalidDataLengthException.php -text
inc/classes/exceptions/io/class_InvalidDirectoryResourceException.php -text
inc/classes/exceptions/io/class_InvalidMD5ChecksumException.php -text
inc/classes/exceptions/language/class_MissingFileIoHandlerException.php -text
inc/classes/exceptions/language/class_MissingLanguageHandlerException.php -text
inc/classes/exceptions/main/.htaccess -text
+inc/classes/exceptions/main/class_AssertionException.php -text
inc/classes/exceptions/main/class_ClassMismatchException.php -text
inc/classes/exceptions/main/class_ClassNotFoundException.php -text
inc/classes/exceptions/main/class_ConfigEntryIsEmptyException.php -text
inc/classes/exceptions/main/class_EmptyVariableException.php -text
inc/classes/exceptions/main/class_ExceptionNotChangedException.php -text
inc/classes/exceptions/main/class_ExceptionNotFoundException.php -text
+inc/classes/exceptions/main/class_FatalErrorException.php -text
inc/classes/exceptions/main/class_GetterNotFoundException.php -text
inc/classes/exceptions/main/class_InvalidArrayCountException.php -text
inc/classes/exceptions/main/class_InvalidCommandException.php -text
inc/classes/exceptions/main/class_InvalidCommandInstanceException.php -text
inc/classes/exceptions/main/class_InvalidControllerException.php -text
+inc/classes/exceptions/main/class_InvalidInterfaceException.php -text
inc/classes/exceptions/main/class_InvalidObjectException.php -text
inc/classes/exceptions/main/class_MissingArrayElementsException.php -text
inc/classes/exceptions/main/class_MissingDecimalsThousandsSeperatorException.php -text
inc/classes/exceptions/main/class_NullPointerException.php -text
inc/classes/exceptions/main/class_ResponseHeadersAlreadySentException.php -text
inc/classes/exceptions/main/class_VariableIsNotSetException.php -text
+inc/classes/exceptions/result/.htaccess -text
+inc/classes/exceptions/result/class_InvalidDatabaseResultException.php -text
+inc/classes/exceptions/result/class_ResultUpdateException.php -text
inc/classes/exceptions/template/.htaccess -text
inc/classes/exceptions/template/class_BasePathIsEmptyException.php -text
inc/classes/exceptions/template/class_BasePathIsNoDirectoryException.php -text
inc/classes/exceptions/template/class_UnsupportedTemplateEngineException.php -text
inc/classes/exceptions/template/class_ViewHelperNotFoundException.php -text
inc/classes/exceptions/user/.htaccess -text
+inc/classes/exceptions/user/class_AccountPasswordMismatchException.php -text
inc/classes/exceptions/user/class_UserEmailMissingException.php -text
inc/classes/exceptions/user/class_UserPasswordMismatchException.php -text
inc/classes/exceptions/user/class_UsernameMissingException.php -text
+inc/classes/exceptions/xml/.htaccess -text
+inc/classes/exceptions/xml/class_InvalidXmlNodeException.php -text
+inc/classes/exceptions/xml/class_XmlNodeMismatchException.php -text
+inc/classes/exceptions/xml/class_XmlParserException.php -text
inc/classes/interfaces/.htaccess -text
+inc/classes/interfaces/actions/.htaccess -text
+inc/classes/interfaces/actions/class_PerformableAction.php -text
+inc/classes/interfaces/actions/commands/.htaccess -text
+inc/classes/interfaces/actions/commands/class_Commandable.php -text
inc/classes/interfaces/application/.htaccess -text
inc/classes/interfaces/application/class_ManageableApplication.php -text
inc/classes/interfaces/auth/.htaccess -text
inc/classes/interfaces/auth/class_Authorizeable.php -text
inc/classes/interfaces/cache/.htaccess -text
inc/classes/interfaces/cache/class_Cacheable.php -text
+inc/classes/interfaces/captcha/.htaccess -text
+inc/classes/interfaces/captcha/class_SolveableCaptcha.php -text
inc/classes/interfaces/class_ -text
inc/classes/interfaces/class_FrameworkInterface.php -text
inc/classes/interfaces/commands/.htaccess -text
inc/classes/interfaces/criteria/class_Criteria.php -text
inc/classes/interfaces/criteria/extended/.htaccess -text
inc/classes/interfaces/criteria/extended/class_LocalSearchCriteria.php -text
+inc/classes/interfaces/criteria/extended/class_LocalUpdateCriteria.php -text
inc/classes/interfaces/criteria/extended/class_StoreableCriteria.php -text
+inc/classes/interfaces/crypto/.htaccess -text
+inc/classes/interfaces/crypto/class_Cryptable.php -text
inc/classes/interfaces/database/.htaccess -text
inc/classes/interfaces/database/class_FrameworkDatabaseInterface.php -text
+inc/classes/interfaces/database/class_Updateable.php -text
inc/classes/interfaces/database/frontend/.htaccess -text
inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php -text
inc/classes/interfaces/database/middleware/.htaccess -text
inc/classes/interfaces/filter/class_Filterable.php -text
inc/classes/interfaces/helper/.htaccess -text
inc/classes/interfaces/helper/class_HelpableLogin.php -text
+inc/classes/interfaces/helper/class_HelpableTemplate.php -text
inc/classes/interfaces/io/.htaccess -text
inc/classes/interfaces/io/class_Streamable.php -text
inc/classes/interfaces/io/file/.htaccess -text
inc/classes/interfaces/language/class_ManageableLanguage.php -text
inc/classes/interfaces/login/.htaccess -text
inc/classes/interfaces/login/class_LoginableUser.php -text
+inc/classes/interfaces/mailer/.htaccess -text
+inc/classes/interfaces/mailer/class_DeliverableMail.php -text
inc/classes/interfaces/reader/.htaccess -text
inc/classes/interfaces/reader/class_ReadableNews.php -text
inc/classes/interfaces/registration/.htaccess -text
inc/classes/interfaces/request/.htaccess -text
inc/classes/interfaces/request/class_Requestable.php -text
inc/classes/interfaces/resolver/.htaccess -text
+inc/classes/interfaces/resolver/actions/.htaccess -text
+inc/classes/interfaces/resolver/actions/class_ActionResolver.php -text
inc/classes/interfaces/resolver/class_CommandResolver.php -text
inc/classes/interfaces/resolver/class_ControllerResolver.php -text
+inc/classes/interfaces/resolver/class_Resolver.php -text
+inc/classes/interfaces/resolver/commands/.htaccess -text
+inc/classes/interfaces/resolver/commands/class_CommandResolver.php -text
+inc/classes/interfaces/resolver/controller/.htaccess -text
+inc/classes/interfaces/resolver/controller/class_ControllerResolver.php -text
inc/classes/interfaces/response/.htaccess -text
inc/classes/interfaces/response/class_Responseable.php -text
inc/classes/interfaces/result/.htaccess -text
inc/classes/interfaces/result/class_SearchableResult.php -text
+inc/classes/interfaces/result/class_UpdateableResult.php -text
inc/classes/interfaces/template/.htaccess -text
inc/classes/interfaces/template/class_CompileableTemplate.php -text
inc/classes/interfaces/template/view/class_ViewHelper.php -text
inc/classes/interfaces/user/.htaccess -text
+inc/classes/interfaces/user/class_ManageableAccount.php -text
inc/classes/interfaces/user/class_ManageableUser.php -text
+inc/classes/interfaces/user/extended/.htaccess -text
+inc/classes/interfaces/user/extended/class_ManageableGuest.php -text
+inc/classes/interfaces/user/extended/class_ManageableMember.php -text
inc/classes/main/.htaccess -text
inc/classes/main/actions/.htaccess -text
inc/classes/main/actions/class_ -text
inc/classes/main/actions/class_BaseAction.php -text
inc/classes/main/actions/post_registration/.htaccess -text
inc/classes/main/actions/post_registration/class_LoginAfterRegistrationAction.php -text
+inc/classes/main/actions/web/.htaccess -text
+inc/classes/main/actions/web/class_WebLoginLogoutAction.php -text
+inc/classes/main/actions/web/class_WebLoginProfileAction.php -text
inc/classes/main/auth/.htaccess -text
inc/classes/main/auth/class_CookieAuth.php -text
inc/classes/main/cache/.htaccess -text
inc/classes/main/cache/class_MemoryCache.php -text
inc/classes/main/class_ -text
+inc/classes/main/class_Base -text
inc/classes/main/class_BaseFrameworkSystem.php -text
inc/classes/main/class_FrameworkArrayObject.php -text
inc/classes/main/commands/.htaccess -text
inc/classes/main/commands/class_ -text
inc/classes/main/commands/class_BaseCommand.php -text
+inc/classes/main/commands/image/.htaccess -text
+inc/classes/main/commands/image/class_ImageCodeCaptchaCommand.php -text
inc/classes/main/commands/web/.htaccess -text
+inc/classes/main/commands/web/class_WebConfirmCommand.php -text
inc/classes/main/commands/web/class_WebDoFormCommand.php -text
inc/classes/main/commands/web/class_WebHomeCommand.php -text
inc/classes/main/commands/web/class_WebLoginAreaCommand.php -text
+inc/classes/main/commands/web/class_WebLoginCommand.php -text
+inc/classes/main/commands/web/class_WebLoginFailedCommand.php -text
+inc/classes/main/commands/web/class_WebLogoutDoneCommand.php -text
inc/classes/main/commands/web/class_WebRegisterCommand.php -text
+inc/classes/main/commands/web/class_WebResendLinkCommand.php -text
inc/classes/main/compressor/.htaccess -text
inc/classes/main/compressor/class_Bzip2Compressor.php -text
inc/classes/main/compressor/class_GzipCompressor.php -text
inc/classes/main/console/.htaccess -text
inc/classes/main/console/class_ConsoleTools.php -text
inc/classes/main/controller/.htaccess -text
+inc/classes/main/controller/captcha/.htaccess -text
+inc/classes/main/controller/captcha/class_ImageCodeCaptchaController.php -text
inc/classes/main/controller/class_ -text
inc/classes/main/controller/class_BaseController.php -text
inc/classes/main/controller/default/.htaccess -text
inc/classes/main/controller/default/class_WebDefaultNewsController.php -text
inc/classes/main/controller/form/.htaccess -text
inc/classes/main/controller/form/class_WebDoFormController.php -text
+inc/classes/main/controller/image/.htaccess -text
+inc/classes/main/controller/image/class_ImageDefaultController.php -text
inc/classes/main/controller/login/.htaccess -text
inc/classes/main/controller/login/class_WebLoginAreaController.php -text
+inc/classes/main/controller/web/.htaccess -text
+inc/classes/main/controller/web/class_WebConfirmController.php -text
+inc/classes/main/controller/web/class_WebDefaultController.php -text
+inc/classes/main/controller/web/class_WebDefaultNewsController.php -text
+inc/classes/main/controller/web/class_WebLoginController.php -text
+inc/classes/main/controller/web/class_WebLoginFailedController.php -text
+inc/classes/main/controller/web/class_WebLogoutDoneController.php -text
+inc/classes/main/controller/web/class_WebRegisterController.php -text
+inc/classes/main/controller/web/class_WebStatusController.php -text
inc/classes/main/criteria/.htaccess -text
inc/classes/main/criteria/class_DataSetCriteria.php -text
inc/classes/main/criteria/class_SearchCriteria.php -text
+inc/classes/main/criteria/class_UpdateCriteria.php -text
inc/classes/main/crypto/.htaccess -text
inc/classes/main/crypto/class_CryptoHelper.php -text
inc/classes/main/database/.htaccess -text
inc/classes/main/database/databases/.htaccess -text
inc/classes/main/database/databases/class_LocalFileDatabase.php -text
inc/classes/main/database/wrapper/.htaccess -text
+inc/classes/main/database/wrapper/class_NewsDatabaseWrapper.php -text
inc/classes/main/database/wrapper/class_UserDatabaseWrapper.php -text
+inc/classes/main/database/wrapper/class_UserPointsDatabaseWrapper.php -text
inc/classes/main/debug/.htaccess -text
inc/classes/main/debug/class_DebugConsoleOutput.php -text
inc/classes/main/debug/class_DebugErrorLogOutput.php -text
inc/classes/main/filter/.htaccess -text
inc/classes/main/filter/auth/.htaccess -text
inc/classes/main/filter/auth/class_UserAuthFilter.php -text
+inc/classes/main/filter/change/.htaccess -text
+inc/classes/main/filter/change/class_EmailChangeFilter.php -text
+inc/classes/main/filter/change/class_PasswordChangeFilter.php -text
inc/classes/main/filter/checkboxes/.htaccess -text
inc/classes/main/filter/checkboxes/class_RulesAcceptedFilter.php -text
inc/classes/main/filter/class_ -text
inc/classes/main/filter/class_AbstractFilterDecorator.php -text
inc/classes/main/filter/class_BaseFilter.php -text
inc/classes/main/filter/class_FilterChain.php -text
+inc/classes/main/filter/crypto/.htaccess -text
+inc/classes/main/filter/crypto/class_CaptchaEncryptFilter.php -text
inc/classes/main/filter/decorator/.htaccess -text
+inc/classes/main/filter/guest/.htaccess -text
+inc/classes/main/filter/guest/class_UserNameIsGuestFilter.php -text
inc/classes/main/filter/news/.htaccess -text
inc/classes/main/filter/news/class_NewsDownloadFilter.php -text
inc/classes/main/filter/news/class_NewsProcessFilter.php -text
inc/classes/main/filter/null/.htaccess -text
inc/classes/main/filter/null/class_NullFilter.php -text
+inc/classes/main/filter/update/.htaccess -text
+inc/classes/main/filter/update/class_UserStatusConfimedUpdateFilter.php -text
+inc/classes/main/filter/update/class_UserUpdateFilter.php -text
inc/classes/main/filter/validator/.htaccess -text
inc/classes/main/filter/validator/class_EmailValidatorFilter.php -text
inc/classes/main/filter/validator/class_PasswordValidatorFilter.php -text
inc/classes/main/filter/validator/class_UserNameValidatorFilter.php -text
+inc/classes/main/filter/verifier/.htaccess -text
+inc/classes/main/filter/verifier/class_AccountPasswordVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_ConfirmCodeVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_GraphicalCodeCaptchaVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_PasswordGuestVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_PasswordVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_UserGuestVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_UserNameVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_UserStatusVerifierFilter.php -text
+inc/classes/main/filter/verifier/class_UserUnconfirmedVerifierFilter.php -text
inc/classes/main/helper/.htaccess -text
+inc/classes/main/helper/captcha/.htaccess -text
+inc/classes/main/helper/captcha/class_ -text
+inc/classes/main/helper/captcha/class_BaseCaptcha.php -text
+inc/classes/main/helper/captcha/images/.htaccess -text
+inc/classes/main/helper/captcha/images/class_ImageHelper.php -text
+inc/classes/main/helper/captcha/web/.htaccess -text
+inc/classes/main/helper/captcha/web/class_GraphicalCodeCaptcha.php -text
inc/classes/main/helper/class_ -text
inc/classes/main/helper/class_BaseHelper.php -text
inc/classes/main/helper/login/.htaccess -text
inc/classes/main/helper/login/class_BaseLoginHelper.php -text
inc/classes/main/helper/web/.htaccess -text
+inc/classes/main/helper/web/blocks/.htaccess -text
+inc/classes/main/helper/web/blocks/class_WebBlockHelper.php -text
+inc/classes/main/helper/web/class_ -text
+inc/classes/main/helper/web/class_BaseWebHelper.php -text
inc/classes/main/helper/web/class_WebFormHelper.php -text
+inc/classes/main/helper/web/forms/.htaccess -text
+inc/classes/main/helper/web/forms/class_WebFormHelper.php -text
+inc/classes/main/helper/web/links/.htaccess -text
+inc/classes/main/helper/web/links/class_WebLinkHelper.php -text
+inc/classes/main/images/.htaccess -text
+inc/classes/main/images/class_ -text
+inc/classes/main/images/class_BaseImage.php -text
+inc/classes/main/images/extended/.htaccess -text
+inc/classes/main/images/extended/class_PngImage.php -text
inc/classes/main/io/.htaccess -text
inc/classes/main/io/class_FileIoStream.php -text
inc/classes/main/io/class_FrameworkDirectoryPointer.php -text
inc/classes/main/io/class_FrameworkFileOutputPointer.php -text
inc/classes/main/language/.htaccess -text
inc/classes/main/language/class_LanguageSystem.php -text
+inc/classes/main/mailer/.htaccess -text
+inc/classes/main/mailer/class_ -text
+inc/classes/main/mailer/class_BaseMailer.php -text
+inc/classes/main/mailer/debug/.htaccess -text
+inc/classes/main/mailer/debug/class_DebugMailer.php -text
inc/classes/main/output/.htaccess -text
inc/classes/main/output/class_ConsoleOutput.php -text
inc/classes/main/output/class_WebOutput.php -text
+inc/classes/main/points/.htaccess -text
+inc/classes/main/points/class_UserPoints.php -text
inc/classes/main/reader/.htaccess -text
inc/classes/main/reader/class_DefaultNewsReader.php -text
inc/classes/main/registration/.htaccess -text
inc/classes/main/request/.htaccess -text
inc/classes/main/request/class_HttpRequest.php -text
inc/classes/main/resolver/.htaccess -text
+inc/classes/main/resolver/action/.htaccess -text
+inc/classes/main/resolver/action/class_BaseActionResolver.php -text
+inc/classes/main/resolver/action/web/.htaccess -text
+inc/classes/main/resolver/action/web/class_WebActionResolver.php -text
inc/classes/main/resolver/class_BaseResolver.php -text
+inc/classes/main/resolver/command/.htaccess -text
+inc/classes/main/resolver/command/class_BaseCommandResolver.php -text
+inc/classes/main/resolver/command/image/.htaccess -text
+inc/classes/main/resolver/command/image/class_ImageCommandResolver.php -text
+inc/classes/main/resolver/command/web/.htaccess -text
+inc/classes/main/resolver/command/web/class_WebCommandResolver.php -text
+inc/classes/main/resolver/controller/.htaccess -text
+inc/classes/main/resolver/controller/class_BaseControllerResolver.php -text
+inc/classes/main/resolver/controller/image/.htaccess -text
+inc/classes/main/resolver/controller/image/class_ImageControllerResolver.php -text
+inc/classes/main/resolver/controller/web/.htaccess -text
+inc/classes/main/resolver/controller/web/class_WebControllerResolver.php -text
inc/classes/main/resolver/web/.htaccess -text
inc/classes/main/resolver/web/class_WebCommandResolver.php -text
inc/classes/main/resolver/web/class_WebControllerResolver.php -text
inc/classes/main/response/.htaccess -text
inc/classes/main/response/class_HttpResponse.php -text
+inc/classes/main/response/class_ImageResponse.php -text
inc/classes/main/result/.htaccess -text
inc/classes/main/result/class_DatabaseResult.php -text
inc/classes/main/rng/.htaccess -text
inc/classes/main/rng/class_RandomNumberGenerator.php -text
inc/classes/main/template/.htaccess -text
+inc/classes/main/template/class_BaseTemplateEngine.php -text
inc/classes/main/template/class_TemplateEngine.php -text
+inc/classes/main/template/image/.htaccess -text
+inc/classes/main/template/image/class_ImageTemplateEngine.php -text
+inc/classes/main/template/mail/.htaccess -text
+inc/classes/main/template/mail/class_MailTemplateEngine.php -text
+inc/classes/main/template/web/.htaccess -text
+inc/classes/main/template/web/class_WebTemplateEngine.php -text
inc/classes/main/user/.htaccess -text
+inc/classes/main/user/class_BaseUser.php -text
inc/classes/main/user/class_User.php -text
+inc/classes/main/user/guest/.htaccess -text
+inc/classes/main/user/guest/class_Guest.php -text
+inc/classes/main/user/member/.htaccess -text
+inc/classes/main/user/member/class_Member.php -text
inc/classes/middleware/.htaccess -text
inc/classes/middleware/class_BaseMiddleware.php -text
inc/classes/middleware/compressor/.htaccess -text
inc/classes/middleware/debug/class_DebugMiddleware.php -text
inc/classes/middleware/io/.htaccess -text
inc/classes/middleware/io/class_FileIoHandler.php -text
+inc/classes/third_party/.htaccess -text
+inc/classes/third_party/api/.htaccess -text
+inc/classes/third_party/api/primusportal/.htaccess -text
+inc/classes/third_party/api/primusportal/class_PrimeraApi.php -text
+inc/classes/third_party/api/wernisportal/.htaccess -text
+inc/classes/third_party/api/wernisportal/class_WernisApi.php -text
+inc/classes/third_party/php_mailer/.htaccess -text
+inc/classes/third_party/php_mailer/ChangeLog.txt -text
+inc/classes/third_party/php_mailer/LICENSE -text
+inc/classes/third_party/php_mailer/README -text
+inc/classes/third_party/php_mailer/class.phpmailer.php -text
+inc/classes/third_party/php_mailer/class.pop3.php -text
+inc/classes/third_party/php_mailer/class.smtp.php -text
+inc/classes/third_party/php_mailer/docs/extending.html -text
+inc/classes/third_party/php_mailer/docs/faq.html -text
+inc/classes/third_party/php_mailer/docs/pop3_article.txt -text
+inc/classes/third_party/php_mailer/docs/use_gmail.txt -text
+inc/classes/third_party/php_mailer/examples/contents.html -text
+inc/classes/third_party/php_mailer/examples/images/bkgrnd.gif -text
+inc/classes/third_party/php_mailer/examples/images/phpmailer.gif -text
+inc/classes/third_party/php_mailer/examples/images/phpmailer.png -text
+inc/classes/third_party/php_mailer/examples/images/phpmailer_mini.gif -text
+inc/classes/third_party/php_mailer/examples/index.html -text
+inc/classes/third_party/php_mailer/examples/pop3_before_smtp_test.php -text
+inc/classes/third_party/php_mailer/examples/test_gmail.php -text
+inc/classes/third_party/php_mailer/examples/test_mail.php -text
+inc/classes/third_party/php_mailer/examples/test_sendmail.php -text
+inc/classes/third_party/php_mailer/examples/test_smtp.php -text
+inc/classes/third_party/php_mailer/language/.htaccess -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-br.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-ca.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-cz.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-de.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-dk.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-en.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-es.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-et.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-fi.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-fo.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-fr.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-hu.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-it.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-ja.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-nl.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-no.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-pl.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-ro.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-ru.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-se.php -text
+inc/classes/third_party/php_mailer/language/phpmailer.lang-tr.php -text
+inc/classes/third_party/php_mailer/phpdoc/PHPMailer/PHPMailer.html -text
+inc/classes/third_party/php_mailer/phpdoc/PHPMailer/SMTP.html -text
+inc/classes/third_party/php_mailer/phpdoc/PHPMailer/_class_phpmailer_php.html -text
+inc/classes/third_party/php_mailer/phpdoc/PHPMailer/_class_smtp_php.html -text
+inc/classes/third_party/php_mailer/phpdoc/blank.html -text
+inc/classes/third_party/php_mailer/phpdoc/classtrees_PHPMailer.html -text
+inc/classes/third_party/php_mailer/phpdoc/elementindex.html -text
+inc/classes/third_party/php_mailer/phpdoc/elementindex_PHPMailer.html -text
+inc/classes/third_party/php_mailer/phpdoc/errors.html -text
+inc/classes/third_party/php_mailer/phpdoc/index.html -text
+inc/classes/third_party/php_mailer/phpdoc/li_PHPMailer.html -text
+inc/classes/third_party/php_mailer/phpdoc/media/banner.css -text
+inc/classes/third_party/php_mailer/phpdoc/media/stylesheet.css -text
+inc/classes/third_party/php_mailer/phpdoc/packages.html -text
+inc/classes/third_party/php_mailer/test/phpmailer_test.php -text
+inc/classes/third_party/php_mailer/test/phpunit.php -text
+inc/classes/third_party/php_mailer/test/test.png -text
inc/config.php -text
inc/config/.htaccess -text
inc/config/class_FrameworkConfiguration.php -text
inc/output.php -text
inc/selector.php -text
/index.php -text
+/package.sh -text
+/pdepend.sh -text
/rebuild_doc.sh -text
templates/.htaccess -text
templates/_compiled/.htaccess -text
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Application-Helper");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Tidy up a little
$this->removeSystemArray();
+ $this->removeNumberFormaters();
}
/**
--- /dev/null
+#!/bin/sh
+
+echo "$0: Cleaning up..."
+rm -f templates/images/_cache/*.png application/*/templates/images/_cache/*.png
+
+echo "$0: All done."
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
*
* This program is free software: you can redistribute it and/or modify
);
// Load all classes
-foreach ($lowerClasses as $class) {
+foreach ($lowerClasses as $className) {
// Try to load the framework classes
try {
- ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $class));
+ ClassLoader::getInstance()->loadClasses(sprintf("inc/classes/%s/", $className));
} catch (PathIsNoDirectoryException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
- $class
+ $className
));
} catch (PathIsEmptyException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
- $class
+ $className
));
} catch (PathReadProtectedException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
- $class
+ $className
));
} catch (DirPointerNotOpenedException $e) {
ApplicationEntryPoint::app_die(sprintf("[Main:] Could not load framework classes from path <strong>%s</strong> for the follwing reason: <strong>%s</strong>",
- $class
+ $className
));
}
}
// Clean up the global namespace
unset($lowerClasses[3]); // Applications shall not have any middleware
-unset($class);
+unset($className);
////// Until here the framework classes are loaded //////
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * This exception is thrown when a requested action is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidActionException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve action <span id=\"exception_reason\">%s</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]
+ );
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
<?php
/**
- *
+ * An exception thrown when authorization of the user has failed
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class UserAuthorizationException extends FrameworkException {
/**
* The super constructor for all exceptions
*
- * @param $filterInstance An instance of the filter throwing this exception
- * @param $code Error code
+ * @param $filterInstance An instance of the filter throwing this exception
+ * @param $code Error code
* @return void
*/
public function __construct(Filterable $filterInstance, $code) {
// Construct the message
- $message = sprintf("[%s:%d] Authorization has failed. Error code <u>%s</u>",
+ $message = sprintf("[%s:%d] Authorization has failed. Error code <span id=\"exception_reason\">%s</span>",
$filterInstance->__toString(),
$this->getLine(),
$this->getHexCode($code)
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ???Exception extends FrameworkException {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class FrameworkException extends ReflectionException {
/**
*/
private $backTrace = array();
+ /**
+ * Extra data
+ */
+ private $extraData = "";
+
/**
* The super constructor for all exceptions
*
- * @param $message The non-optional message for the exception
- * @param $code An optional code for better debugging
+ * @param $message The non-optional message for the exception
+ * @param $code An optional code for better debugging
* @return void
*/
public function __construct($message, $code = 0) {
$message = (string) $message;
$code = (int) $code;
+ // In emergency exit?
+ if (defined('EMERGENCY_EXIT_CALLED')) {
+ // Output message
+ printf("[%s:] Message: %s, Backtrace: <pre>%s</pre>",
+ $this->__toString(),
+ $message,
+ $this->getPrintableBackTrace()
+ );
+
+ // End here
+ exit;
+ } // END - if
+
// Make sure everything is assigned properly
parent::__construct($message, $code);
}
* @return void
*/
private final function saveBackTrace () {
+ // Get full backtrace
$this->backTrace = debug_backtrace();
+
+ // Remove this call
+ $dummy = array_shift($this->backTrace);
+
+ // resort the array
+ ksort($this->backTrace);
}
/**
return $this->backTrace;
}
+ /**
+ * Getter for printable backtrace
+ *
+ * @return $backTrace Backtrace for web pages
+ */
+ public final function getPrintableBackTrace () {
+ // Get the backtrace
+ $dbgTrace = $this->getBackTrace();
+
+ // Taken from de.php.net user comments
+ $dbgMsg = "<br />\nDebug backtrace begin:<br />\n";
+ foreach ($dbgTrace as $dbgIndex => $dbgInfo) {
+ // No info by default
+ $info = "NULL";
+
+ // Are there arguments?
+ if ((isset($dbgInfo['args'])) && (is_array($dbgInfo['args'])) && (isset($dbgInfo['args'][0]))) {
+ //* DEBUG: */ echo $dbgIndex.": <pre>".htmlentities(print_r($dbgInfo['args'], true))."</pre>";
+ $info = "";
+ foreach ($dbgInfo['args'] as $debug) {
+ // Add only non-array elements
+ if (!is_array($debug)) {
+ $info .= $debug.", ";
+ } // END - if
+ } // END - if
+
+ $info = substr($info, 0, -2);
+ } // END - if
+
+ // Prepare argument infos
+ $info = "<em id=\"debug_args\">{$info}</em>";
+
+ // File detection
+ $file = "Unknown file";
+ if (isset($dbgInfo['file'])) {
+ $file = basename($dbgInfo['file']);
+ } // END - if
+
+ // Line detection
+ $line = "Unknown line";
+ if (isset($dbgInfo['line'])) {
+ $line = "line {$dbgInfo['line']}";
+ } // END - if
+
+ // The message
+ $dbgMsg .= "\t at <em id=\"debug_id\">".$dbgIndex."</em> <em id=\"debug_file\">".$file."</em> (<em id=\"debug_line\">".$line."</em>) -> ".$dbgInfo['function']."(".$info.")<br />\n";
+ } // END - if
+ $dbgMsg .= "Debug backtrace end<br />\n";
+
+ return $dbgMsg;
+ }
+
/**
* Returns the name of the thrown exception
*
// Return it
return $hexCode;
}
+
+ /**
+ * Setter for extra data
+ *
+ * @param $extraData Extra data to store
+ * @return void
+ */
+ protected final function setExtraData ($extraData) {
+ $this->extraData = $extraData;
+ }
+
+ /**
+ * Getter for extra data
+ *
+ * @return $extraData Extra data to store
+ */
+ public final function getExtraData () {
+ return $this->extraData;
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MismatchingCompressorsException extends FrameworkException {
/**
*/
public function __construct (array $array, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Kompressor <u>%s</u> zu den geladenen Daten aus <u>%s</u> und der aktuell verwendete Kompressor <u>%s</u> stimmen nicht überein!",
+ $message = sprintf("[%s:%d] Der Kompressor <span id=\"exception_reason\">%s</span> zu den geladenen Daten aus <span id=\"exception_reason\">%s</span> und der aktuell verwendete Kompressor <span id=\"exception_reason\">%s</span> stimmen nicht überein!",
$array[0]->__toString(),
$this->getLine(),
strtoupper($array[1]),
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @deprecated
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ContainerItemIsNoArrayException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Ein Container-Item ist kein Array.",
+ $message = sprintf("[%s:%d] A container item is not an array.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @deprecated
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ContainerItemIsNullException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Ein Container-Item ist auf <em>null</em> gesetzt.",
+ $message = sprintf("[%s:%d] A container item is <em>null</em>.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @deprecated
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ContainerMaybeDamagedException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Ein Container ist möglicherweise beschädigt.",
+ $message = sprintf("[%s:%d] A container is possibly damaged.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The super constructor for all exceptions
*
- * @param $resolverInstance An instance of a resolver class
- * @param $code An optional code for better debugging
+ * @param $resolverInstance An instance of a resolver class
+ * @param $code An optional code for better debugging
* @return void
*/
public function __construct(ControllerResolver $resolverInstance, $code) {
$this->getLine()
);
+ // Set extra data
+ $this->setExtraData($resolverInstance->getClassName().":".$this->getLine());
+
// Call parent contructor with message
parent::__construct($message, $code);
}
--- /dev/null
+<?php
+/**
+ * This exception is thrown when the default controller is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidControllerException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray An array with message parts
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Prepare the message
+ $message = sprintf("[%s:%d] Cannot resolve controller <span id=\"exception_reason\">%s (class name: %s)</span>.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1],
+ $msgArray[0]->getClassName()
+ );
+
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().":".$this->getLine());
+
+ // Call parent contructor with message
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when the decrypted "encrypt" string has an invalid length
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class EncryptInvalidLengthException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $message Error message
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(Filterable $filterInstance, $code) {
+ // Get length
+ $length = $filterInstance->getConfigInstance()->readConfig('captcha_string_length');
+
+ // Construct message
+ $message = sprintf("[%s:%d] Encrypt string has an invalid length. Valid: %d",
+ $filterInstance->__toString(),
+ $this->getLine(),
+ $length
+ );
+
+ // Set extra data
+ $this->setExtraData($filterInstance->__toString().":".$length);
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when the "encrypt" string is missing
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class EncryptMissingException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $message Error message
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(Filterable $filterInstance, $code) {
+ // Construct message
+ $message = sprintf("[%s:%d] Encrypt string is missing.",
+ $filterInstance->__toString(),
+ $this->getLine()
+ );
+
+ // Set extra data
+ $this->setExtraData($filterInstance->__toString());
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ???Exception extends DatabaseException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct ($message, $code) {
+ // Just call the parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DatabaseException extends FrameworkException {
/**
--- /dev/null
+<?php
+/**
+ * An exception thrown when a class tries an unallowed database update
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class DatabaseUpdateSupportException extends DatabaseException {
+ /**
+ * The constructor
+ *
+ * @param $class Class trying the invalid database update
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (FrameworkInterface $class, $code) {
+ // Generate message
+ $message = sprintf("[%s:%d] Database updated not allowed for this class.",
+ $class->__toString(),
+ $this->getLine()
+ );
+
+ // Just call the parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SqlException extends DatabaseException {
/**
*/
public function __construct (array $msgArray, $code) {
// Construct the message
- $message = sprintf("[%s:%d] SQL error detected. Message from database: <u>%s</u>, code: <u>0x%s</u>.",
+ $message = sprintf("[%s:%d] SQL error detected. Message from database: <span id=\"exception_reason\">%s</span>, code: <span id=\"exception_reason\">%s</span>.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1],
- dechex($msgArray[2])
+ $this->getHexCode($msgArray[2])
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SavePathIsEmptyException extends DatabaseException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Speicherpfad ist leer.",
+ $message = sprintf("[%s:%d] Save path is empty.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SavePathIsNoDirectoryException extends DatabaseException {
/**
*/
public function __construct ($path, $code) {
// Add a message around the missing class
- $message = sprintf("Der angegebene Speicherpfad <u>%s</u> ist ungütig (kein Pfad).", $path);
+ $message = sprintf("Der angegebene Speicherpfad <span id=\"exception_reason\">%s</span> ist ungütig (kein Pfad).", $path);
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SavePathReadProtectedException extends DatabaseException {
/**
*/
public function __construct ($path, $code) {
// Add a message around the missing class
- $message = sprintf("Der Pfad <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
+ $message = sprintf("Der Pfad <span id=\"exception_reason\">%s</span> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SavePathWriteProtectedException extends DatabaseException {
/**
*/
public function __construct ($path, $code) {
// Add a message around the missing class
- $message = sprintf("Der angegebene Speicherpfad <u>%s</u> ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path);
+ $message = sprintf("Der angegebene Speicherpfad <span id=\"exception_reason\">%s</span> ist schreibgeschützt. Bitte Zugriffsrechte (CHMOD) entsprechend setzen.", $path);
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class WrapperUserNameNotFoundException extends DatabaseException {
/**
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Username <u>%s</u> was not found. Requesting class: <u>%s</u>",
+ $message = sprintf("[%s:%d] Username <span id=\"exception_reason\">%s</span> was not found. Requesting class: <span id=\"exception_reason\">%s</span>",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]->getUserName(),
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class FilterChainException extends FrameworkException {
/**
* The super constructor for all exceptions
*
- * @param $filterInstance Instance of a filter class
- * @param $code Exception code for better debugging
+ * @param $filterInstance Instance of a filter class
+ * @param $code Exception code for better debugging
* @return void
*/
public function __construct(Filterable $filterInstance, $code) {
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $classArray Class throwing the exception
- * @param $code Code number for the exception
+ * @param $classArray Class throwing the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Could not add form element <u>%s</u> because form is closed.",
+ $message = sprintf("[%s:%d] Could not add form element <span id=\"exception_reason\">%s</span> because form is closed.",
$classArray[0]->__toString(),
$this->getLine(),
$classArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $classArray Class throwing the exception
- * @param $code Code number for the exception
+ * @param $classArray Class throwing the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Could not add sub group <u>%s</u> because no form group has been opened before.",
+ $message = sprintf("[%s:%d] Could not add sub group <span id=\"exception_reason\">%s</span> because no form group has been opened before.",
$classArray[0]->__toString(),
$this->getLine(),
$classArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $class Class throwing the exception
- * @param $code Code number for the exception
+ * @param $helperInstance Class throwing the exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (BaseHelper $helperInstance, $code) {
// Add a message around the missing class
$message = sprintf("[%s:%d] Form is not yet closed. Close it with method <u>%s::addFormTag()</u> and add no parameters.",
- $class->__toString(),
+ $helperInstance->__toString(),
$this->getLine(),
- $class->__toString()
+ $helperInstance->__toString()
);
// Call parent constructor
--- /dev/null
+<?php
+/**
+ * An exception thrown when a group was added twice
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HelperGroupAlreadyCreatedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $msgArray Array containing exception data
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $msgArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Group %s already opened before.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when no sub group was opened previously
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HelperNoPreviousOpenedSubGroupException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $msgArray Array containing exception data
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $msgArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Sub group not opened before. Raw text follows: <span id=\"exception_reason\">%s</span>",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when a sub group was added twice
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class HelperSubGroupAlreadyCreatedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $msgArray Array containing exception data
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $msgArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Sub group %s already opened before.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $class Class throwing the exception
- * @param $code Code number for the exception
+ * @param $helperInstance Class throwing the exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (BaseHelper $helperInstance, $code) {
// Add a message around the missing class
$message = sprintf("[%s:%d] Form name not set.",
- $class->__toString(),
+ $helperInstance->__toString(),
$this->getLine()
);
--- /dev/null
+<?php
+/**
+ * An exception thrown when a group was not opened before
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class NoGroupOpenedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $msgArray Array containing exception data
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $msgArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Group not opened before. Raw text follows: <span id=\"exception_reason\">%s</span>",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $classArray Array with class instance and registry key
- * @param $code Code number for the exception
+ * @param $classArray Array with class instance and registry key
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Registry key <u>%s</u> does not include a class with implemented interface <u>ManageableUser</u>.",
+ $message = sprintf("[%s:%d] Registry key <span id=\"exception_reason\">%s</span> does not include a class with implemented interface <u>Manageable(User|Guest)</u>.",
$classArray[0]->__toString(),
$this->getLine(),
$classArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
public function __construct ($path, $code) {
// Add a message around the missing class
- $message = sprintf("Für den Pfad <u>%s</u> konnte kein Pointer initialisiert werden.", $path);
+ $message = sprintf("Für den Pfad <span id=\"exception_reason\">%s</span> konnte kein Pointer initialisiert werden.", $path);
// Call parent constructor
parent::__construct($message, $code);
--- /dev/null
+<?php
+/**
+ * An exception thrown when a file was not found
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FileNotFoundException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $fqfn Full-qualified file name of (maybe) missing file
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct ($fqfn, $code) {
+ // Add a message around the missing class
+ $message = sprintf("The requested file <span id=\"exception_reason\">%s</span> was not found.",
+ $fqfn
+ );
+
+ // Set extra data
+ $this->setExtraData(basename($fqfn));
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $fqfn Full-qualified file name of (maybe) missing file
- * @param $code Code number for the exception
+ * @param $fqfn Full-qualified file name of (maybe) missing file
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($fqfn, $code) {
// Add a message around the missing class
- $message = sprintf("Not able to initialize a pointer for the file <u>%s</u>. Maybe the file is missing.", $fqfn);
+ $message = sprintf("Not able to initialize a pointer for the file <span id=\"exception_reason\">%s</span>. Maybe the file is missing.", $fqfn);
// Call parent constructor
parent::__construct($message, $code);
--- /dev/null
+<?php
+/**
+ * An exception thrown when a file is read-protected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FileReadProtectedException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $fileName File which cannot be read from
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct ($fileName, $code) {
+ // Add a message around the missing class
+ $message = sprintf("File <span id=\"exception_reason\">%s</span> is read-protected. Please set read access rights (CHMOD).", $fileName);
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidDataLengthException extends FrameworkException {
/**
* The constructor
*
- * @param $array Message from the exception
- * @param $code Code number for the exception
+ * @param $msgArray Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (array $array, $code) {
+ public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von <u>%s</u> Byte ist aufgetreten. <u>%s</u> wurden erwartet!",
- $array[0]->__toString(),
+ $message = sprintf("[%s:%d] Eine unerwartete Datenlänge von <span id=\"exception_reason\">%s</span> Byte ist aufgetreten. <span id=\"exception_reason\">%s</span> wurden erwartet!",
+ $msgArray[0]->__toString(),
$this->getLine(),
- $array[1],
- $array[2]
+ $msgArray[1],
+ $msgArray[2]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidDirectoryResourceException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- if (is_null($class)) {
- $message = "[???:] Ungütige Verzeichnis-Resource.";
- } elseif (is_object($class)) {
- $message = sprintf("[%s:%d] Ungütige Verzeichnis-Resource.",
- $class->__toString(),
- $this->getLine()
- );
- }
+ $message = sprintf("[%s:%d] Has an invalid directory resource.",
+ $class->__toString(),
+ $this->getLine()
+ );
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidMD5ChecksumException extends FrameworkException {
/**
* The constructor
*
- * @param $array Message from the exception
- * @param $code Code number for the exception
+ * @param $msgArray Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (array $array, $code) {
+ public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Die MD5-Prüfsummen <u>%s</u> und <u>%s</u> stimmen nicht überein!",
- $array[0]->__toString(),
+ $message = sprintf("[%s:%d] Die MD5-Prüfsummen <span id=\"exception_reason\">%s</span> und <span id=\"exception_reason\">%s</span> stimmen nicht überein!",
+ $msgArray[0]->__toString(),
$this->getLine(),
- $array[1],
- $array[2]
+ $msgArray[1],
+ $msgArray[2]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class PathIsEmptyException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- if (is_null($class)) {
- $message = "[???:] Der Verzeichnisname ist leer.";
- } elseif (is_object($class)) {
- $message = sprintf("[%s:%d] Der Verzeichnisname ist leer.",
- $class->__toString(),
- $this->getLine()
- );
- }
+ $message = sprintf("[%s:%d] Directory path is empty.",
+ $class->__toString(),
+ $this->getLine()
+ );
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class PathIsNoDirectoryException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($path, $code) {
// Add a message around the missing class
- $message = sprintf("Der angegebene Pfad <u>%s</u> ist ungütig (kein Pfad).", $path);
+ $message = sprintf("Der angegebene Pfad <span id=\"exception_reason\">%s</span> ist ungütig (kein Pfad).", $path);
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class PathReadProtectedException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($path, $code) {
// Add a message around the missing class
- $message = sprintf("Der Pfad <u>%s</u> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
+ $message = sprintf("Der Pfad <span id=\"exception_reason\">%s</span> ist lese-geschützt. Bitte Zugriffsrechte (CHMOD) zum Lesen setzen.", $path);
// Call parent constructor
parent::__construct($message, $code);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidLanguagePathStringException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array holding exception data
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] <u>%s</u> ist keine Zeichenkette!",
- $class[0]->__toString(),
+ $message = sprintf("[%s:%d] <span id=\"exception_reason\">%s</span> is not a string with path!",
+ $classArray[0]->__toString(),
$this->getLine(),
- $class[1]
+ $classArray[1]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class LanguagePathIsEmptyException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Sprachen-Basispfad ist leer.",
+ $message = sprintf("[%s:%d] Language base path is empty.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class LanguagePathIsNoDirectoryException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array holding exception data
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Sprach-Basispfad <u>%s</u> existiert nicht oder ist eine Datei!",
- $class[0]->__toString(),
+ $message = sprintf("[%s:%d] Der Sprach-Basispfad <span id=\"exception_reason\">%s</span> existiert nicht oder ist eine Datei!",
+ $classArray[0]->__toString(),
$this->getLine(),
- $class[1]
+ $classArray[1]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class LanguagePathReadProtectedException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Array holding exception data
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Sprach-Basispfad <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
- $class[0]->__toString(),
+ $message = sprintf("[%s:%d] Base language path <span id=\"exception_reason\">%s</span> is read-protected. Please change access rights (CHMOD).",
+ $classArray[0]->__toString(),
$this->getLine(),
- $class[1]
+ $classArray[1]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MissingFileIoHandlerException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
$message = sprintf("[%s:%d] File i/o sub-system not initialized!",
$class->__toString(),
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MissingLanguageHandlerException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
$message = sprintf("[%s:%d] Language sub-system not initialized!",
$class->__toString(),
--- /dev/null
+<?php
+/**
+ * An exception thrown when a assertion fails
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class AssertionException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct ($message, $code) {
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ClassMismatchException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array holding the exception informations
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("Die Klasse <u>%s</u> ist ungleich <u>%s</u>.",
+ $message = sprintf("The class <span id=\"exception_reason\">%s</span> does not match class <span id=\"exception_reason\">%s</span>.",
$classArray[0],
$classArray[1]
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ClassNotFoundException extends FrameworkException {
/**
* The constructor
*
- * @param $msgArray Message from the exception
- * @param $code Code number for the exception
+ * @param $msgArray Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Internal class <u>%s</u> not found.",
+ $message = sprintf("[%s:%d] Internal class <span id=\"exception_reason\">%s</span> not found.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]
);
+ // Set extra data
+ $this->setExtraData($msgArray[1]);
+
// Call parent constructor
parent::__construct($message, $code);
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ConfigEntryIsEmptyException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (FrameworkConfiguration $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Leeren Konfigurationseintrag angegeben!",
+ $message = sprintf("[%s:%d] Empty configuration entry provided!",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ConfigEntryNotFoundException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array with exception data
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
- // Cast the array
- $classArray = (array) $classArray;
-
// Add a message around the missing class
- $message = sprintf("[%s:%d] Konfigurationseintrag <u>%s</u> nicht gefunden.",
+ $message = sprintf("[%s:%d] Configuration entry <span id=\"exception_reason\">%s</span> not found.",
$classArray[0],
$this->getLine(),
$classArray[1]
);
+ // Set extra data
+ $this->setExtraData($classArray[1].":".$this->getLine());
+
// Call parent constructor
parent::__construct($message, $code);
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DimNotFoundInArrayException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing the exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
if (is_object($class)) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Abmasse konnten nicht extrahiert werden!",
+ $message = sprintf("[%s:%d] Dimensions not found in array, array is invalid!",
$class->__toString(),
$this->getLine()
);
} else {
// No class given
- $message = sprintf("Please provide a class for <u>%s</u>", __CLASS__);
+ $message = sprintf("Please provide a class for <span id=\"exception_reason\">%s</span>", __CLASS__);
}
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $msgArray Message array holding all needed data
- * @param $code Code number for the exception
+ * @param $msgArray Message array holding all needed data
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Variable <u>%s</u> is not set.",
+ $message = sprintf("[%s:%d] Variable <span id=\"exception_reason\">%s</span> is not set.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ExceptionNotFoundException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array with exception data
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
- // Cast the array
- $classArray = (array) $classArray;
-
// Add a message around the missing class
- $message = sprintf("[%s:%d] Exception <u>%s</u> nicht gefunden.",
+ $message = sprintf("[%s:%d] Exception <span id=\"exception_reason\">%s</span> not found.",
$classArray[0],
$this->getLine(),
$classArray[1]
--- /dev/null
+<?php
+/**
+ * An exception thrown when a "fatal" error has been captured by an error handler
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class FatalErrorException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct ($message, $code) {
+ die($message);
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class GetterNotFoundException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($dataArray, $code) {
$dataArray = (array) $dataArray;
// Add a message around the missing class
- $message = sprintf("[%s:%d] Getter-Methode für Attribut <u>%s</u> nicht gefunden.",
+ $message = sprintf("[%s:%d] Getter-Methode für Attribut <span id=\"exception_reason\">%s</span> nicht gefunden.",
$dataArray[0]->__toString(),
$this->getLine(),
$dataArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidArrayCountException extends FrameworkException {
/**
*/
public function __construct (array $array, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] <u>%s</u> hat <u>%d</u> Elemente, soll aber <u>%d</u> enthalten!",
+ $message = sprintf("[%s:%d] <span id=\"exception_reason\">%s</span> hat <u>%d</u> Elemente, soll aber <u>%d</u> enthalten!",
$array[0]->__toString(),
$this->getLine(),
$array[1],
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Invalid command <u>%s</u> detected.",
+ $message = sprintf("[%s:%d] Invalid command <span id=\"exception_reason\">%s (class %s)</span> detected.",
$msgArray[0]->__toString(),
$this->getLine(),
- htmlentities(strip_tags($msgArray[1]), ENT_QUOTES)
+ $msgArray[1],
+ $msgArray[0]->getClassName()
);
+ // Set extra data
+ $this->setExtraData($msgArray[0]->getClassName().":".$this->getLine());
+
// Call parent constructor
parent::__construct($message, $code);
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Invalid command <u>%s</u> detected.",
+ $message = sprintf("[%s:%d] Invalid command <span id=\"exception_reason\">%s</span> detected.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $msgArray Array with data from the exception point
- * @param $code Code number for the exception
+ * @param $msgArray Array with data from the exception point
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Invalid controller <u>%s</u> detected.",
+ $message = sprintf("[%s:%d] Invalid controller <span id=\"exception_reason\">%s</span> detected.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]
--- /dev/null
+<?php
+/**
+ * An exception thrown when an class instance does not implement a given interface
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidInterfaceException extends FrameworkException {
+ /**
+ * The constructor
+ *
+ * @param $classArray Array with exception data
+ * @param $code Code number for the exception
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Add a message around the missing class
+ $message = sprintf("[%s:%d] Object does not implement expected interface <span id=\"exception_reason\">.",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1]
+ );
+
+ // Call parent constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidObjectException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing the exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Objekte sind nicht erlaubt. (Objekt: <u>%s</u>)",
+ $message = sprintf("[%s:%d] Object is not allowed here.",
$class->__toString(),
- $this->getLine(),
- $class->getObjectDescription()
+ $this->getLine()
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MissingArrayElementsException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array with exception data
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
- // Cast the array
- $classArray = (array) $classArray;
-
// Extract all elements
$elements = "";
if ((isset($classArray[2])) && (is_array($classArray[2]))) {
}
// Add a message around the missing class
- $message = sprintf("[%s:%d] Das Array <u>%s()</u> keine Elemente <u>%s</u> auf!",
+ $message = sprintf("[%s:%d] Array <u>%s()</u> Does not have these elements: <span id=\"exception_reason\">%s</span>",
$classArray[0]->__toString(),
$this->getLine(),
$classArray[1],
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MissingDecimalsThousandsSeperatorException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($instance, $code) {
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
+ * @deprecated
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MissingMethodException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $classArray Array holding the exception data
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $classArray, $code) {
- // Cast the array
- $classArray = (array) $classArray;
-
// Add a message around the missing class
- $message = sprintf("[%s:%d] Weisst keine Methode <u>%s()</u> auf!",
+ $message = sprintf("[%s:%d] This class has no method <u>%s()</u>!",
$classArray[0]->__toString(),
$this->getLine(),
$classArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class NoArrayCreatedException extends FrameworkException {
/**
*/
public function __construct (array $array, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] <u>%s</u> ist kein erstelltes Objekt.",
+ $message = sprintf("[%s:%d] <span id=\"exception_reason\">%s</span> ist kein erstelltes Objekt.",
$array[0]->__toString(),
$this->getLine(),
$array[1]
/**
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class NoArrayException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $message Message from the exception
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($string, $code) {
// Add a message around the missing class
- $message = sprintf("<u>%s</u> ist kein Array!",
+ $message = sprintf("<span id=\"exception_reason\">%s</span> ist kein Array!",
$string
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
* @deprecated
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class NoObjectException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $string Name of variable
+ * @param $code Code number for the exception
* @return void
*/
public function __construct ($string, $code) {
// Add a message around the missing class
- $message = sprintf("<u>%s</u> ist kein Objekt!",
+ $message = sprintf("<span id=\"exception_reason\">%s</span> ist kein Objekt!",
$string
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class NullPointerException extends FrameworkException {
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Eine Instanz/Pointer ist auf <em>null</em> gesetzt.",
+ $message = sprintf("[%s:%d] An object instance is set to <em>null</em>.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $message Message from the exception
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
$message = sprintf("[%s:%d] Headers are already sent!",
$class->__toString(),
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class VariableIsNotSetException extends FrameworkException {
/**
*/
public function __construct (array $array, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation <u>%s</u> wurde keine Variable <u>%s</u> erzeugt.",
+ $message = sprintf("[%s:%d] Bei der Initialisierung der Applikation <span id=\"exception_reason\">%s</span> wurde keine Variable <span id=\"exception_reason\">%s</span> erzeugt.",
$array[0]->__toString(),
$this->getLine(),
$array[1],
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown if a database result does not contain expected entries
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidDatabaseResultException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $msgArray Error message array
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(array $msgArray, $code) {
+ // Construct the message
+ $message = sprintf("[%s:%d] Database instance <span id=\"exception_reason\">%s</span> contains invalid entries.",
+ $msgArray[0]->__toString(),
+ $this->getLine(),
+ $msgArray[1]->__toString()
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown if the result was not updated
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ResultUpdateException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $resultInstance Instance of the failed result update
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct(UpdateableResult $resultInstance, $code) {
+ // Construct the message
+ $message = sprintf("[%s:%d] Update of result instance has nothing changed.",
+ $resultInstance->__toString(),
+ $this->getLine()
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BasePathIsEmptyException extends FrameworkException {
/**
* The constructor
*
- * @param $class An array holding our informations
- * @param $code Code number for the exception
+ * @param $class Class throwing this exception
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Template-Basispfad ist leer.",
+ $message = sprintf("[%s:%d] Template path is empty.",
$class->__toString(),
$this->getLine()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BasePathIsNoDirectoryException extends FrameworkException {
/**
* The constructor
*
- * @param $class An array holding our informations
- * @param $code Code number for the exception
+ * @param $classArray An array holding our informations
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Template-Basispfad <u>%s</u> existiert nicht oder ist eine Datei!",
- $class[0]->__toString(),
+ $message = sprintf("[%s:%d] Der Template-Basispfad <span id=\"exception_reason\">%s</span> existiert nicht oder ist eine Datei!",
+ $classArray[0]->__toString(),
$this->getLine(),
- $class[1]
+ $classArray[1]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BasePathReadProtectedException extends FrameworkException {
/**
* The constructor
*
- * @param $class An array holding our informations
- * @param $code Code number for the exception
+ * @param $classArray An array holding our informations
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Template-Basispfad <u>%s</u> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
- $class[0]->__toString(),
+ $message = sprintf("[%s:%d] Der Template-Basispfad <span id=\"exception_reason\">%s</span> ist lesegeschützt! Bitte Zugriffsrechte (CHMOD) ändern.",
+ $classArray[0]->__toString(),
$this->getLine(),
- $class[1]
+ $classArray[1]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class InvalidBasePathStringException extends FrameworkException {
/**
* The constructor
*
- * @param $class An array holding our informations
- * @param $code Code number for the exception
+ * @param $classArray Array holding exception data
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (array $classArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] <u>%s</u> ist keine Zeichenkette!",
- $class[0]->__toString(),
+ $message = sprintf("[%s:%d] <span id=\"exception_reason\">%s</span> is not a string with a base path!",
+ $classArray[0]->__toString(),
$this->getLine(),
- $class[1]
+ $classArray[1]
);
// Call parent constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The constructor
*
- * @param $msgArray An array holding our informations
- * @param $code Code number for the exception
+ * @param $msgArray An array holding our informations
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:%d] Der Template-Typ <u>%s</u> entspricht nicht dem erwartetem Template-Typ <u>%s</u>.",
+ $message = sprintf("[%s:%d] Der Template-Typ <span id=\"exception_reason\">%s</span> entspricht nicht dem erwartetem Template-Typ <span id=\"exception_reason\">%s</span>.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1],
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class UnsupportedTemplateEngineException extends FrameworkException {
/**
* The constructor
*
- * @param $class An array holding our informations
- * @param $code Code number for the exception
+ * @param $class Class throwing this class
+ * @param $code Code number for the exception
* @return void
*/
- public function __construct (BaseFrameworkSystem $class, $code) {
+ public function __construct (FrameworkInterface $class, $code) {
// Add a message around the missing class
- $message = sprintf("Template-Engine %s wird nicht unterstützt.",
+ $message = sprintf("Template-Engine %s not (yet) supported.",
$class->__toString()
);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ViewHelperNotFoundException extends FrameworkException {
/**
* The constructor
*
- * @param $msgArray An array holding our informations
- * @param $code Code number for the exception
+ * @param $msgArray An array holding our informations
+ * @param $code Code number for the exception
* @return void
*/
public function __construct (array $msgArray, $code) {
// Add a message around the missing class
- $message = sprintf("[%s:] View-Helper <u>%s</u> ist ungültig.",
+ $message = sprintf("[%s:] View-Helper <span id=\"exception_reason\">%s</span> ist ungültig.",
$msgArray[0]->__toString(),
$msgArray[1]
);
--- /dev/null
+<?php
+/**
+ * A class for mismatching passwords
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class AccountPasswordMismatchException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $filterInstance A filterable class instance
+ * @param $code An optional code for better debugging
+ * @return void
+ */
+ public function __construct(Filterable $filterInstance, $code) {
+ // Create the message
+ $message = sprintf("[%s:%d] Supplied account password did not match with stored.",
+ $filterInstance->__toString(),
+ $this->getLine()
+ );
+
+ // Make sure everything is assigned properly
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The super constructor for all exceptions
*
- * @param $msgArray The non-optional message for the exception
- * @param $code An optional code for better debugging
+ * @param $msgArray The non-optional message for the exception
+ * @param $code An optional code for better debugging
* @return void
*/
public function __construct(array $msgArray, $code = 0) {
// Create the message
- $message = sprintf("[%s:%d] User email <u>%s</u> was not found.",
+ $message = sprintf("[%s:%d] User email <span id=\"exception_reason\">%s</span> was not found.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The super constructor for all exceptions
*
- * @param $msgArray The non-optional message for the exception
- * @param $code An optional code for better debugging
+ * @param $msgArray The non-optional message for the exception
+ * @param $code An optional code for better debugging
* @return void
*/
public function __construct(array $msgArray, $code = 0) {
// Create the message
- $message = sprintf("[%s:%d] Supplied password for user <u>%s</u> did not match with stored password.",
+ $message = sprintf("[%s:%d] Supplied password for user <span id=\"exception_reason\">%s</span> did not match with stored password.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]->getUserName()
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* The super constructor for all exceptions
*
- * @param $msgArray The non-optional message for the exception
- * @param $code An optional code for better debugging
+ * @param $msgArray The non-optional message for the exception
+ * @param $code An optional code for better debugging
* @return void
*/
public function __construct(array $msgArray, $code = 0) {
// Create the message
- $message = sprintf("[%s:%d] Username <u>%s</u> was not found.",
+ $message = sprintf("[%s:%d] Username <span id=\"exception_reason\">%s</span> was not found.",
$msgArray[0]->__toString(),
$this->getLine(),
$msgArray[1]
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An exception thrown when an XML parser error was detected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class InvalidXmlNodeException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $classArray Array holding the exception data
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Extract attributes
+ $attributes = "<em>None</em>";
+ if ((is_array($classArray[2])) && (count($classArray[2]) > 0)) {
+ $attributes = implode(", ", $classArray[2]);
+ } // END - if
+
+ // Construct our message
+ $message = sprintf("[%s:%d] Invalid XML node found: %s, attributes: %s.",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1],
+ $attributes
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when an XML node does not match the excepted
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlNodeMismatchException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $classArray Array holding the exception data
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Construct our message
+ $message = sprintf("[%s:%d] XML nodes mismatch. Given: %s, Expected: %s",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ $classArray[1],
+ $classArray[2]
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An exception thrown when an XML parser error was detected
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class XmlParserException extends FrameworkException {
+ /**
+ * The super constructor for all exceptions
+ *
+ * @param $classArray Array holding the exception data
+ * @param $code Error code
+ * @return void
+ */
+ public function __construct (array $classArray, $code) {
+ // Construct our message
+ $message = sprintf("[%s:%d] XML Error: %s at line %d.",
+ $classArray[0]->__toString(),
+ $this->getLine(),
+ xml_error_string(xml_get_error_code($classArray[1])),
+ xml_get_current_line_number($classArray[1])
+ );
+
+ // Call parent exception constructor
+ parent::__construct($message, $code);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for performable actions
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface PerformableAction extends FrameworkInterface {
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ function execute (Requestable $requestInstance, Responseable $responseInstance);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for commands for the front controller
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Commandable extends PerformableAction {
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance);
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* @return void
*/
function destroyAuthData();
+
+ /**
+ * Updates the authorization data and/or sets additional tracking data
+ *
+ * @return void
+ */
+ function updateAuthData ();
}
//
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for solveable CAPTCHAs
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface SolveableCaptcha extends FrameworkInterface {
+ /**
+ * Initiates the CAPTCHA
+ *
+ * @return void
+ */
+ function initiateCaptcha ();
+
+ /**
+ * Render the CAPTCHA code
+ *
+ * @return void
+ */
+ function renderCode ();
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface FrameworkInterface {
+ /**
+ * Getter for field name
+ *
+ * @param $fieldName Field name which we shall get
+ * @return $fieldValue Field value from the user
+ * @throws NullPointerException If the result instance is null
+ */
+ function getField ($fieldName);
}
//
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Compressor extends FrameworkInterface {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+<?php
+/**
+ * An interface for local criterias
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface LocalUpdateCriteria extends Criteria {
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface StoreableCriteria extends Criteria {
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper class for cryptographical things like hashing passwords and so on
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Cryptable extends FrameworkInterface {
+ /**
+ * Hashes a string with salt and returns the hash. If an old previous hash
+ * is supplied the method will use the first X chars of that hash for hashing
+ * the password. This is useful if you want to check if the password is
+ * identical for authorization purposes.
+ *
+ * @param $str Unhashed string
+ * @param $oldHash A hash from previous hashed string
+ * @return $hashed The hashed and salted string
+ */
+ function hashString ($str, $oldHash = "");
+
+ /**
+ * Encrypt the string with fixed salt
+ *
+ * @param $str The unencrypted string
+ * @return $encrypted Encrypted string
+ */
+ function encryptString ($str);
+
+ /**
+ * Decrypt the string with fixed salt
+ *
+ * @param $encrypted Encrypted string
+ * @return $str The unencrypted string
+ */
+ function decryptString ($encrypted);
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface FrameworkDatabaseInterface extends FrameworkInterface {
/**
* Analyses if a unique ID has already been used or not. This method does
* only pass the given ID through to the "real" database layer.
*
- * @param $uniqueID A unique ID number which shall be checked
- * before it will be used
- * @param $inConstructor If called from a constructor or from
- * somewhere else
- * @return $isUnused true = The unique ID was not found in the database,
- * false = It is already in use by an other object
- * @throws NullPointerException If $dbInstance is null
- * @throws NoObjectException If $dbInstance is not an object
- * @throws MissingMethodException If the required method
- * isUniqueIdUsed() was not found
+ * @param $uniqueID A unique ID number which shall be checked
+ * before it will be used
+ * @param $inConstructor If called from a constructor or from
+ * somewhere else
+ * @return $isUnused true = The unique ID was not found in the database,
+ * false = It is already in use by an other object
*/
function isUniqueIdUsed ($uniqueID, $inConstructor = false);
}
--- /dev/null
+<?php
+/**
+ * An interface for classes which are allowed to update database records
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Updateable extends FrameworkInterface {
+ /**
+ * Updates a given field with new value
+ *
+ * @param $fieldName Field to update
+ * @param $fieldValue New value to store
+ * @return void
+ * @throws DatabaseUpdateSupportException If this class does not support database updates
+ */
+ function updateDatabaseField ($fieldName, $fieldValue);
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface DatabaseFrontendInterface extends FrameworkDatabaseInterface {
- /**
- * Loads data saved with saveObject from the database and re-creates a
- * full object from it.
- * If limitObject() was called before a new object ObjectContainer with
- * all requested attributes will be returned instead.
- *
- * @return Object The fully re-created object or instance to
- * ObjectContainer
- * @deprecated
- */
- function loadObject ();
-
/**
* Makes sure that the database connection is up and alive
*
* @throws SqlException If an SQL error occurs
*/
function queryInsertDataSet (StoreableCriteria $dataSetInstance);
+
+ /**
+ * "Updates" a data set instance with a database layer
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ * @throws SqlException If an SQL error occurs
+ */
+ function queryUpdateDataSet (StoreableCriteria $dataSetInstance);
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface DatabaseConnector extends FrameworkDatabaseInterface {
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Debugger extends FrameworkInterface {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+<?php
+/**
+ * A helper interface for template helper ;)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface HelpableTemplate extends FrameworkInterface {
+ /**
+ * Flush the content out,e g. to a template variable
+ *
+ * @return void
+ */
+ function flushContent ();
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface Streamable extends FrameworkInterface {
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface FileInputStreamer extends Streamable {
/**
* Reads from a local or remote file
*
- * @param $fqfn The file's FQFN we shall load
+ * @param $fqfn The file's FQFN we shall load
* @return $array An array containing all read lines
- * @throws NullPointerException If an instance is null
- * @throws NoObjectException If the instance is not an object
- * instance
- * @throws MissingMethodException If a required method is missing.
* @throws InvalidArrayCountException If an array has not the
* expected size
* @throws InvalidMD5ChecksumException If two MD5 hashes did not match
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface FileOutputStreamer extends Streamable {
/**
* Saves streamed (that are mostly serialized objects) data to files or
* external servers.
*
- * @param $fileName The local file's name including full path
- * @param $dataArray Array containing the compressor's extension
+ * @param $fileName The local file's name including full path
+ * @param $dataArray Array containing the compressor's extension
* and streamed data
* @return void
- * @throws NullPointerException If an instance is null
- * @throws NoObjectException If the instance is not an object
- * instance
- * @throws MissingMethodException If a required method is missing.
*/
function saveFile ($fileName, $dataArray);
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface OutputStreamer extends Streamable {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface ManageableLanguage extends FrameworkInterface {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for deliverable mail aka. mailer classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface DeliverableMail extends FrameworkInterface {
+ /**
+ * Adds a user class to the recipient list for current template
+ *
+ * @param $userInstance An instance of a user class
+ * @return void
+ */
+ function addRecipientByUserInstance (ManageableMember $userInstance);
+
+ /**
+ * Use subject line provided by the (XML) template otherwise a subject line must be set
+ *
+ * @return void
+ */
+ function useSubjectFromTemplate ();
+
+ /**
+ * Deliver email to the recipient(s)
+ *
+ * @return void
+ */
+ function deliverEmail ();
+
+ /**
+ * Send notification to the admin
+ *
+ * @return void
+ */
+ function sendAdminNotification ();
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An instance for action resolver classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ActionResolver extends Resolver {
+ /**
+ * Returns an action instance for the current action
+ *
+ * @return $actionInstance An instance of the resolved action
+ */
+ function resolveAction ();
+
+ /**
+ * Returns an action instance for a given request class
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $actionInstance An instance of the resolved action
+ */
+ function resolveActionByRequest (Requestable $requestInstance);
+
+ /**
+ * Checks wether the given action is valid
+ *
+ * @param $actionName The default action we shall execute
+ * @return $isValid Wether the given action is valid
+ * @throws EmptyVariableException Thrown if the given action is not set
+ */
+ function isActionValid ($actionName);
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * An interface for all resolvers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface Resolver extends FrameworkInterface {
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An instance for command resolver classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface CommandResolver extends Resolver {
+ /**
+ * Returns an command instance for a given request class
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $commandInstance An instance of the resolved command
+ */
+ function resolveCommandByRequest (Requestable $requestInstance);
+
+ /**
+ * Checks wether the given command is valid
+ *
+ * @param $commandName The default command we shall execute
+ * @return $isValid Wether the given command is valid
+ * @throws EmptyVariableException Thrown if the given command is not set
+ */
+ function isCommandValid ($commandName);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An instance for controller resolver classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ControllerResolver extends Resolver {
+ /**
+ * Resolves the default controller of the given command
+ *
+ * @return $controllerInstance A controller instance for the default command
+ */
+ function resolveController ();
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* Flushs the cached HTTP response to the outer world
*
- * @param $foce Wether we shall force the output or abort if headers are
+ * @param $force Wether we shall force the output or abort if headers are
* already sent with an exception
* @return void
* @throws ResponseHeadersAlreadySentException Thrown if headers are
* @return void
*/
function expireCookie ($cookieName);
+
+ /**
+ * Refreshs a given cookie. This will make the cookie live longer
+ *
+ * @param $cookieName Cookie to refresh
+ * @return void
+ */
+ function refreshCookie ($cookieName);
}
//
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+<?php
+/**
+ * An interface for searchable results
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface UpdateableResult extends FrameworkInterface {
+ /**
+ * Adds an update request to the database result for writing it to the
+ * database layer
+ *
+ * @param $criteriaInstance An instance of a updateable criteria
+ * @return void
+ * @throws ResultUpdateException If no result was updated
+ */
+ function add2UpdateQueue (LocalUpdateCriteria $criteriaInstance);
+
+ /**
+ * Adds registration elements to a given dataset instance
+ *
+ * @param $criteriaInstance An instance of a storeable criteria
+ * @return void
+ */
+ function addElementsToDataSet (StoreableCriteria $criteriaInstance);
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface CompileableTemplate extends FrameworkInterface {
/**
* Assign variables for templates
*
- * @param $var The "variable" we want to assign
- * @param $value The value we want to store in the variable
+ * @param $var The "variable" we want to assign
+ * @param $value The value we want to store in the variable
* @return void
*/
function assignVariable ($var, $value);
- /**
- * Assign a configuration variables for templates
- *
- * @param $var The configuration "variable" we want to assign
- * @param $value The value we want to store in the variable
- * @return void
- */
- function assignConfigVariable ($var, $value);
-
/**
* Load a specified web template into the engine
*
- * @param $template The web template we shall load which is
- * located in "html" by default
+ * @param $template The web template we shall load which is located in
+ * "html" by default
* @return void
*/
function loadWebTemplate ($template);
* Load a specified code template into the engine for later compilation
* with other code/web/email templates.
*
- * @param $template The code template we shall load which is
+ * @param $template The code template we shall load which is
* located in "html" by default
* @return void
*/
/**
* Load a specified email template into the engine
*
- * @param $template The email template we shall load which is
+ * @param $template The email template we shall load which is
* located in "emails" by default
* @return void
*/
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
interface ViewHelper extends FrameworkInterface {
/**
--- /dev/null
+<?php
+/**
+ * An interface for manageable accounts (logged-in users and guests likewise)
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableAccount extends FrameworkInterface {
+ /**
+ * Determines wether the username exists or not
+ *
+ * @return $exists Wether the username exists
+ */
+ function ifUsernameExists ();
+
+ /**
+ * Determines wether the email exists or not
+ *
+ * @return $exists Wether the email exists
+ */
+ function ifEmailAddressExists ();
+
+ /**
+ * Checks if the supplied password hash in request matches with the stored
+ * in database.
+ *
+ * @param $requestInstance A requestable class instance
+ * @return $matches Wether the supplied password hash matches
+ */
+ function ifPasswordHashMatches (Requestable $requestInstance);
+}
+
+//
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An interface for manageable guests
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableGuest extends ManageableAccount {
+}
+
+//
+?>
--- /dev/null
+<?php
+/**
+ * An interface for manageable users
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+interface ManageableMember extends ManageableAccount {
+}
+
+//
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class ???Action extends BaseAction implements Commandable {
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseAction extends BaseFrameworkSystem {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class LoginAfterRegistrationAction extends BaseAction implements Commandable {
+class LoginAfterRegistrationAction extends BaseAction implements PerformableAction {
/**
* Protected constructor
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Post registration action for logging in");
-
- // Generate unique key
- $this->generateUniqueId();
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * An action class for the logout page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLoginLogoutAction extends BaseAction implements Commandable, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this action
+ *
+ * @return $actionInstance An instance of this action class
+ */
+ public final static function createWebLoginLogoutAction () {
+ // Get a new instance
+ $actionInstance = new WebLoginLogoutAction();
+
+ // Return the instance
+ return $actionInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Shall we logout or display logout page or logout immediately?
+ if (($this->getConfigInstance()->readConfig('logout_immediate') === "Y") || ($requestInstance->isRequestElementSet('logout'))) {
+ // Get an auth instance for checking and updating the auth cookies
+ $authInstance = ObjectFactory::createObjectByConfiguredName('auth_method_class', array($responseInstance));
+
+ // Set request instance
+ $authInstance->setRequestInstance($requestInstance);
+
+ // Destroy the auth data
+ $authInstance->destroyAuthData();
+
+ // Redirect to "logout done" page
+ $responseInstance->redirectToConfiguredUrl('logout_done_url');
+ } // END - if
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * An action for the profile page in login area
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLoginProfileAction extends BaseAction implements Commandable, Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this action
+ *
+ * @param $resolverInstance An instance of an action resolver
+ * @return $actionInstance An instance of this action class
+ */
+ public final static function createWebLoginProfileAction (ActionResolver $resolverInstance) {
+ // Get a new instance
+ $actionInstance = new WebLoginProfileAction();
+
+ // Set the resolver instance
+ $actionInstance->setResolverInstance($resolverInstance);
+
+ // Return the instance
+ return $actionInstance;
+ }
+
+ /**
+ * Executes the command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Dummy method
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Add user status filter here
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_class'));
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class CookieAuth extends BaseFrameworkSystem implements Authorizeable, Registerable {
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Cookie-based login");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
$this->getResponseInstance()->expireCookie('username');
$this->getResponseInstance()->expireCookie('u_hash');
}
+
+ /**
+ * Updates the authorization data and/or sets additional tracking data
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return void
+ */
+ public function updateAuthData () {
+ $this->getResponseInstance()->refreshCookie('username');
+ $this->getResponseInstance()->refreshCookie('u_hash');
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class MemoryCache extends BaseFrameworkSystem implements Cacheable {
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Memory cache");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
*/
protected function initCache () {
// Now create the "data cache"
- $this->dataCache = new FrameworkArrayObject("FakedDataCache");
+ $this->dataCache = new FrameworkArrayObject('FakedDataCache');
}
/**
* @param $offset The offset we shall set
* @return $data Data to store in the cache
*/
- public final function offsetget ($offset) {
+ public final function offsetGet ($offset) {
// Default is offset not found
$data = null;
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class extends BaseFrameworkSystem {
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
--- /dev/null
+<?php
+/**
+ * A general
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Base??? extends BaseFrameworkSystem {
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* The language instance for the template loader
*/
private static $langInstance = null;
+
+ /**
+ * Debug instance
+ */
+ private static $debugInstance = null;
+
/**
* Instance of a request class
*/
private $responseInstance = null;
/**
- * The real class name
+ * Search criteria instance
*/
- private $realClass = "FrameworkSystem";
+ private $searchInstance = null;
/**
- * A human-readable description for this simulator part
+ * The file I/O instance for the template loader
*/
- private $objectDescription = "Namenlose Framework-Einheit";
+ private $fileIoInstance = null;
/**
- * The unique ID string for identifying all type of classes
+ * Resolver instance
*/
- private $uniqueID = "";
+ private $resolverInstance = null;
+
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = null;
+
+ /**
+ * Database result instance
+ */
+ private $resultInstance = null;
+
+ /**
+ * Instance for user class
+ */
+ private $userInstance = null;
+
+ /**
+ * The real class name
+ */
+ private $realClass = "FrameworkSystem";
/**
* Thousands seperator
*/
private $decimals = ","; // German
- /**
- * The file I/O instance for the template loader
- */
- private $fileIoInstance = null;
-
/***********************
* Exception codes.... *
***********************/
const EXCEPTION_MISSING_LANGUAGE_HANDLER = 0x02e;
const EXCEPTION_MISSING_FILE_IO_HANDLER = 0x02f;
const EXCEPTION_MISSING_ELEMENT = 0x030;
- const EXCEPTION_INVALID_COMMAND = 0x031;
- const EXCEPTION_INVALID_CONTROLLER = 0x032;
- const EXCEPTION_HEADERS_ALREADY_SENT = 0x033;
- const EXCEPTION_DEFAUL_CONTROLLER_GONE = 0x034;
- const EXCEPTION_CLASS_NOT_FOUND = 0x035;
- const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x036;
+ const EXCEPTION_HEADERS_ALREADY_SENT = 0x031;
+ const EXCEPTION_DEFAULT_CONTROLLER_GONE = 0x032;
+ const EXCEPTION_CLASS_NOT_FOUND = 0x033;
+ const EXCEPTION_REQUIRED_INTERFACE_MISSING = 0x034;
+ const EXCEPTION_FATAL_ERROR = 0x035;
+ const EXCEPTION_FILE_NOT_FOUND = 0x036;
+ const EXCEPTION_ASSERTION_FAILED = 0x037;
+ const EXCEPTION_FILE_CANNOT_BE_READ = 0x038;
+ const EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED = 0x039;
/**
* In the super constructor these system classes shall be ignored or else
* we would get an endless calling loop.
*
- *--------------------------------------------------------------------*
- * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL SHOOT YOUR SERVER!!! *
- *--------------------------------------------------------------------*
+ *---------------------------------------------------------------------*
+ * ATTENTION: IF YOU REMOVE ONE OF THEM YOU WILL RUN YOUR SERVER IN AN *
+ * ENDLESS LOOP !!! *
+ *---------------------------------------------------------------------*
*/
private $systemClasses = array(
"DebugMiddleware", // Debug middleware output sub-system
/**
* Private super constructor
*
+ * @param $className Name of the class
* @return void
*/
- protected function __construct ($class) {
+ protected function __construct ($className) {
// Set real class
- $this->setRealClass($class);
+ $this->setRealClass($className);
// Initialize the class if the registry is there
if ((class_exists('Registry')) && (Registry::isInitialized() === false)) {
$this->initInstance();
- }
+ } // END - if
}
/**
* Destructor reached...
*
* @return void
+ * @todo This is old code. Do we still need this old lost code?
*/
public function __destruct() {
// Is this object already destroyed?
- if ($this->__toString() != "DestructedObject") {
- // Debug message
- if ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
- $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wird zerstört.<br />\n",
- __CLASS__, $this->__toString()
- ));
- }
-
+ if ($this->__toString() != 'DestructedObject') {
// Destroy all informations about this class but keep some text about it alive
- $this->setObjectDescription(sprintf("Entferntes Objekt <em>%s</em>", $this->__toString()));
- $this->setRealClass("DestructedObject");
- $this->resetUniqueID();
+ $this->setRealClass('DestructedObject');
} elseif ((defined('DEBUG_DESTRUCTOR')) && (is_object($this->getDebugInstance()))) {
// Already destructed object
- $this->getDebugInstance()->output(sprintf("[%s:] Das Objekt <strong>%s</strong> wurde bereits zerstört.<br />\n",
+ $this->debugOutput(sprintf("[%s:] The object <strong>%s</strong> is already destroyed.",
__CLASS__, $this->__toString()
));
}
} elseif (is_array($args)) {
// Some arguments are there
foreach ($args as $arg) {
- // Check the type
- if (is_bool($arg)) {
- // Boolean!
- if ($arg) $argsString .= "true(bool)"; else $argsString .= "false(bool)";
- } elseif (is_int($arg)) {
- // Integer
- $argsString .= $arg."(int)";
- } elseif (is_float($arg)) {
- // Floating point
- $argsString .= $arg."(float)";
- } elseif ($arg instanceof BaseFrameworkSystem) {
- // Own object instance
- $argsString .= $arg->__toString()."(Object)";
- } elseif (is_object($arg)) {
- // External object
- $argsString .= "unknown object(!)";
- } elseif (is_array($arg)) {
- // Array
- $argsString .= "Array(array)";
- } elseif (is_string($arg)) {
- // String
- $argsString .= "\"".$arg."\"(string)";
- } elseif (is_null($arg)) {
- // Null
- $argsString .= "(null)";
- } else {
- // Unknown type (please report!)
- $argsString .= $arg."(unknown!)";
- }
-
- // Add comma
- $argsString .= ", ";
- }
+ // Add the type
+ $argsString .= $arg." (".gettype($arg);
+
+ // Add length if type is string
+ if (gettype($arg) == 'string') $argsString .= ", ".strlen($arg);
+
+ // Closing bracket
+ $argsString .= "), ";
+ } // END - foreach
// Remove last comma
- if (substr($argsString, -2, 1) === ",") $argsString = substr($argsString, 0, -2);
+ if (substr($argsString, -2, 1) === ",") {
+ $argsString = substr($argsString, 0, -2);
+ } // END - if
} else {
// Invalid arguments!
$argsString = sprintf("!INVALID:%s!", $args);
}
- $this->getDebugInstance()->output(sprintf("[%s::%s] Stub! Args: %s",
+ // Output stub message
+ $this->debugOutput(sprintf("[%s->%s] Stub! Args: %s",
$this->__toString(),
$methodName,
$argsString
)));
// Initialization done! :D
- Registry::isInitialized("OK");
- } elseif ($this->__toString() == "DebugMiddleware") {
+ Registry::isInitialized('OK');
+ } elseif ($this->__toString() == 'DebugMiddleware') {
// Set configuration instance
$this->setConfigInstance(FrameworkConfiguration::createFrameworkConfiguration());
}
}
+ /**
+ * Setter for database result instance
+ *
+ * @param $resultInstance An instance of a database result class
+ * @return void
+ * @todo SearchableResult and UpdateableResult shall have a super interface to use here
+ */
+ protected final function setResultInstance (SearchableResult $resultInstance) {
+ $this->resultInstance = $resultInstance;
+ }
+
+ /**
+ * Getter for database result instance
+ *
+ * @return $resultInstance An instance of a database result class
+ */
+ public final function getResultInstance () {
+ return $this->resultInstance;
+ }
+
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ protected final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
+ /**
+ * Setter for search instance
+ *
+ * @param $searchInstance Searchable criteria instance
+ * @return void
+ */
+ public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
+ $this->searchInstance = $searchInstance;
+ }
+
+ /**
+ * Getter for search instance
+ *
+ * @return $searchInstance Searchable criteria instance
+ */
+ public final function getSearchInstance () {
+ return $this->searchInstance;
+ }
+
+ /**
+ * Setter for resolver instance
+ *
+ * @param $resolverInstance Instance of a command resolver class
+ * @return void
+ */
+ public final function setResolverInstance (Resolver $resolverInstance) {
+ $this->resolverInstance = $resolverInstance;
+ }
+
+ /**
+ * Getter for resolver instance
+ *
+ * @return $resolverInstance Instance of a command resolver class
+ */
+ public final function getResolverInstance () {
+ return $this->resolverInstance;
+ }
+
/**
* Setter for language instance
*
/**
* Getter for configuration instance
*
- * @return $cfhInstance - Configuration instance
+ * @return $cfgInstance Configuration instance
*/
- protected final function getConfigInstance () {
- return Registry::getRegistry()->getInstance('config');
+ public final function getConfigInstance () {
+ $cfgInstance = Registry::getRegistry()->getInstance('config');
+ return $cfgInstance;
}
/**
* Setter for debug instance
*
- * @param $debugInstance The instance for debug output class
+ * @param $debugInstance The instance for debug output class
* @return void
*/
public final function setDebugInstance (DebugMiddleware $debugInstance) {
- Registry::getRegistry()->addInstance('debug', $debugInstance);
+ self::$debugInstance = $debugInstance;
}
/**
* Getter for debug instance
*
- * @return $debug - Instance to class DebugConsoleOutput or DebugWebOutput
+ * @return $debugInstance Instance to class DebugConsoleOutput or DebugWebOutput
*/
public final function getDebugInstance () {
- return Registry::getRegistry()->getInstance('debug');
+ return self::$debugInstance;
}
/**
* @return $dbInstance The database layer instance
*/
public final function getDatabaseInstance () {
+ // Default is invalid db instance
+ $dbInstance = null;
+
+ // Is the registry there and initialized?
if ((class_exists('Registry')) && (Registry::isInitialized() === true)) {
- return Registry::getRegistry()->getInstance('dbInstance');
- } else {
- return null;
- }
+ $dbInstance = Registry::getRegistry()->getInstance('dbInstance');
+ } // END - if
+
+ // Return instance
+ return $dbInstance;
}
/**
$this->realClass = $realClass;
}
- /**
- * Generate unique ID from a lot entropy
- *
- * @return void
- */
- public final function generateUniqueId () {
- // Is the id set for this class?
- if (empty($this->uniqueID)) {
-
- // Correct missing class name
- $corrected = false;
- if ($this->__toString() == "") {
- $this->setRealClass(__CLASS__);
- $corrected = true;
- }
-
- // Cache datbase instance
- $db = $this->getDatabaseInstance();
-
- // Generate new id
- $tempID = false;
- while (true) {
- // Generate a unique ID number
- $tempID = $this->generateIdNumber();
- $isUsed = false;
-
- // Try to figure out if the ID number is not yet used
- try {
- // Is this a registry?
- if ($this->__toString() == "Registry") {
- // Registry, then abort here
- break;
- } elseif (is_object($db)) {
- $isUsed = $db->isUniqueIdUsed($tempID, true);
- }
- } catch (FrameworkException $e) {
- // Catches all and ignores all ;-)
- }
-
- if (
- (
- $tempID !== false
- ) && (
- (
- $db === null
- ) || (
- (
- is_object($db)
- ) && (
- !$isUsed
- )
- )
- )
- ) {
- // Abort the loop
- break;
- }
- } // END - while
-
- // Apply the new ID
- $this->setUniqueID($tempID);
-
- // Revert maybe corrected class name
- if ($corrected) {
- $this->setRealClass("");
- }
-
- // Remove system classes if we are in a system class
- if ((isset($this->systemClasses)) && (in_array($this->__toString(), $this->systemClasses))) {
- // This may save some RAM...
- $this->removeSystemArray();
- }
- }
- }
-
- /**
- * Generates a new ID number for classes based from the class' real name,
- * the description and some random data
- *
- * @return $tempID The new (temporary) ID number
- */
- private final function generateIdNumber () {
- return sprintf("%s@%s",
- $this->__toString(),
- md5(sprintf("%s:%s:%s:%s:%s:%s",
- $this->__toString(),
- $this->getObjectDescription(),
- time(),
- getenv('REMOTE_ADDR'),
- getenv('SERVER_ADDR'),
- mt_rand()
- ))
- );
- }
-
- /**
- * Setter for unique ID
- *
- * @param $uniqueID The newly generated unique ID number
- * @return void
- */
- private final function setUniqueID ($uniqueID) {
- // Cast to string
- $uniqueID = (string) $uniqueID;
-
- // Set the ID number
- $this->uniqueID = $uniqueID;
- }
-
- /**
- * Getter for unique ID
- *
- * @return $uniqueID The unique ID of this class
- */
- public final function getUniqueID () {
- return $this->uniqueID;
- }
-
- /**
- * Resets or recreates the unique ID number
- *
- * @return void
- */
- public final function resetUniqueID() {
- // Sweet and simple... ;-)
- $newUniqueID = $this->generateIdNumber();
- $this->setUniqueID($newUniqueID);
- }
-
- /**
- * Getter for simulator description
- *
- * @return $objectDescription The description of this simulation part
- */
- public final function getObjectDescription () {
- if (isset($this->objectDescription)) {
- return $this->objectDescription;
- } else {
- return null;
- }
- }
-
- /**
- * Setter for simulation part description
- *
- * @param $objectDescription The description as string for this simulation part
- * @return void
- */
- public final function setObjectDescription ($objectDescription) {
- $this->objectDescription = (String) $objectDescription;
- }
-
- /**
- * Validate if given object is the same as current
- *
- * @param $object An object instance for comparison with this class
- * @return boolean The result of comparing both's unique ID
- */
- public final function equals ($object) {
- return ($this->getUniqueID() == $object->getUniqueID());
- }
-
/**
* Compare if both simulation part description and class name matches
- * (shall be enougth)
+ * (shall be enough)
*
- * @param $itemInstance An object instance to an other class
- * @return boolean The result of comparing class name simulation part description
+ * @param $itemInstance An object instance to an other class
+ * @return boolean The result of comparing class name simulation part description
+ * @deprecated
*/
public function itemMatches ($itemInstance) {
+ $this->partialStub("Deprecated!");
return (
(
$this->__toString() == $itemInstance->__toString()
/**
* Compare class name of this and given class name
*
- * @param $class The class name as string from the other class
+ * @param $className The class name as string from the other class
* @return boolean The result of comparing both class names
*/
- public final function isClass ($class) {
- return ($this->__toString() == $class);
+ public final function isClass ($className) {
+ return ($this->__toString() == $className);
}
/**
unset($this->systemClasses);
}
- /**
- * Create a file name and path name from the object's unique ID number.
- * The left part of the ID shall always be a valid class name and the
- * right part an ID number.
- *
- * @return $pfn The file name with a prepended path name
- * @throws NoArrayCreatedException If explode() fails to create an array
- * @throws InvalidArrayCountException If the array contains less or
- * more than two elements
- */
- public final function getPathFileNameFromObject () {
- // Get the main object's unique ID. We use this as a path/filename combination
- $pathFile = $this->getUniqueID();
-
- // Split it up in path and file name
- $pathFile = explode("@", $pathFile);
-
- // Are there two elements? Index 0 is the path, 1 the file name + global extension
- if (!is_array($pathFile)) {
- // No array found
- throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
- } elseif (count($pathFile) != 2) {
- // Invalid ID returned!
- throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
- }
-
- // Auto-append missing trailing slash
- $pathFile[0] = $this->addMissingTrailingSlash($pathFile[0]);
-
- // Create the file name and return it
- $pfn = ($pathFile[0] . $pathFile[1]);
- return $pfn;
- }
-
/**
* Appends a trailing slash to a string
*
}
/**
- * Prepare the template engine (TemplateEngine by default) for a given
+ * Prepare the template engine (WebTemplateEngine by default) for a given
* application helper instance (ApplicationHelper by default).
*
* @param $appInstance An application helper instance or
* null if we shall use the default
- * @return $tplEngine The template engine instance
+ * @return $templateInstance The template engine instance
* @throws NullPointerException If the template engine could not
* be initialized
- * @throws UnsupportedTemplateEngineException If $tplEngine is an
+ * @throws UnsupportedTemplateEngineException If $templateInstance is an
* unsupported template engine
* @throws MissingLanguageHandlerException If the language sub-system
* is not yet initialized
* @throws NullPointerException If the discovered application
* instance is still null
*/
- protected function prepareTemplateEngine (BaseFrameworkSystem $appInstance=null) {
+ protected function prepareTemplateInstance (BaseFrameworkSystem $appInstance=null) {
// Is the application instance set?
if (is_null($appInstance)) {
// Get the current instance
if (is_null($appInstance)) {
// Thrown an exception
throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- }
- }
+ } // END - if
+ } // END - if
// Generate FQFN for all application templates
$fqfn = sprintf("%s%s/%s/%s",
}
// Initialize the template engine
- $tplEngine = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
+ $templateInstance = ObjectFactory::createObjectByConfiguredName('template_class', array($fqfn, $appInstance->getLanguageInstance(), $appInstance->getFileIoInstance()));
// Return the prepared instance
- return $tplEngine;
+ return $templateInstance;
}
/**
* @return void
*/
public final function debugInstance () {
+ // Restore the error handler to avoid trouble with missing array elements or undeclared variables
+ restore_error_handler();
+
// Generate the output
$content = sprintf("<pre>%s</pre>",
- trim(print_r($this, true))
+ trim(
+ htmlentities(
+ print_r($this, true)
+ )
+ )
);
// Output it
- ApplicationEntryPoint::app_die(sprintf("<strong>%s debug output:</strong>%s", $this->__toString(), $content));
+ ApplicationEntryPoint::app_die(sprintf("<strong>%s debug output:</strong><div id=\"debug_content\">%s</div>\nLoaded includes: <div id=\"debug_include_list\">%s</div>",
+ $this->__toString(),
+ $content,
+ ClassLoader::getInstance()->getPrintableIncludeList()
+ ));
}
/**
$backtrace = debug_backtrace();
// Generate the class::method string
- $methodName = "UnknownClass::unknownMethod";
+ $methodName = "UnknownClass->unknownMethod";
if ((isset($backtrace[1]['class'])) && (isset($backtrace[1]['function']))) {
- $methodName = $backtrace[1]['class']."::".$backtrace[1]['function'];
- }
+ $methodName = $backtrace[1]['class']."->".$backtrace[1]['function'];
+ } // END - if
// Construct the full message
$stubMessage = sprintf("[%s:] Partial stub!",
// Is the extra message given?
if (!empty($message)) {
// Then add it as well
- $stubMessage .= sprintf(" Message: <u>%s</u>", $message);
- }
+ $stubMessage .= sprintf(" Message: <span id=\"stub_message\">%s</span>", $message);
+ } // END - if
// Debug instance is there?
if (!is_null($this->getDebugInstance())) {
// Output stub message
- $this->getDebugInstance()->output($stubMessage);
+ $this->debugOutput($stubMessage);
} else {
// Trigger an error
trigger_error($stubMessage."<br />\n");
}
}
+ /**
+ * Outputs a debug backtrace and stops further script execution
+ *
+ * @return void
+ */
+ public function debugBackTrace () {
+ // Sorry, there is no other way getting this nice backtrace
+ print "<pre>\n";
+ debug_print_backtrace();
+ print "</pre>";
+ exit;
+ }
+
+ /**
+ * Outputs a debug message wether to debug instance (should be set!) or dies with or pints the message
+ *
+ * @param $message Message we shall send out...
+ * @param $doPrint Wether we shall print or die here which first is the default
+ * @return void
+ */
+ public function debugOutput ($message, $doPrint = true) {
+ // Get debug instance
+ $debugInstance = $this->getDebugInstance();
+
+ // Is the debug instance there?
+ if (is_object($debugInstance)) {
+ // Use debug output handler
+ $debugInstance->output($message);
+ if (!$doPrint) die(); // Die here if not printed
+ } else {
+ // Put directly out
+ if ($doPrint) {
+ print($message);
+ } else {
+ // DO NOT REWRITE THIS TO app_die() !!!
+ die($message);
+ }
+ }
+ }
+
/**
* Converts e.g. a command from URL to a valid class by keeping out bad characters
*
}
/**
- * Outputs a debug backtrace and stops further script execution
+ * Marks up the code by adding e.g. line numbers
+ *
+ * @param $phpCode Unmarked PHP code
+ * @return $markedCode Marked PHP code
+ */
+ public function markupCode ($phpCode) {
+ // Init marked code
+ $markedCode = "";
+
+ // Get last error
+ $errorArray = error_get_last();
+
+ // Init the code with error message
+ if (is_array($errorArray)) {
+ // Get error infos
+ $markedCode = sprintf("<div id=\"error_header\">File: <span id=\"error_data\">%s</span>, Line: <span id=\"error_data\">%s</span>, Message: <span id=\"error_data\">%s</span>, Type: <span id=\"error_data\">%s</span></div>",
+ basename($errorArray['file']),
+ $errorArray['line'],
+ $errorArray['message'],
+ $errorArray['type']
+ );
+ } // END - if
+
+ // Add line number to the code
+ foreach (explode("\n", $phpCode) as $lineNo=>$code) {
+ // Add line numbers
+ $markedCode .= sprintf("<span id=\"code_line\">%s</span>: %s\n",
+ ($lineNo + 1),
+ htmlentities($code, ENT_QUOTES)
+ );
+ } // END - foreach
+
+ // Return the code
+ return $markedCode;
+ }
+
+ /**
+ * Filter a given GMT timestamp (non Uni* stamp!) to make it look more
+ * beatiful for web-based front-ends. If null is given a message id
+ * null_timestamp will be resolved and returned.
+ *
+ * @param $timestamp Timestamp to prepare (filter) for display
+ * @return $readable A readable timestamp
+ */
+ public function doFilterFormatTimestamp ($timestamp) {
+ // Default value to return
+ $readable = "???";
+
+ // Is the timestamp null?
+ if (is_null($timestamp)) {
+ // Get a message string
+ $readable = $this->getLanguageInstance()->getMessage('null_timestamp');
+ } else {
+ switch ($this->getLanguageInstance()->getLanguageCode()) {
+ case "de": // German format is a bit different to default
+ // Split the GMT stamp up
+ $dateTime = explode(" ", $timestamp);
+ $dateArray = explode("-", $dateTime[0]);
+ $timeArray = explode(":", $dateTime[1]);
+
+ // Construct the timestamp
+ $readable = sprintf($this->getConfigInstance()->readConfig('german_date_time'),
+ $dateArray[0],
+ $dateArray[1],
+ $dateArray[2],
+ $timeArray[0],
+ $timeArray[1],
+ $timeArray[2]
+ );
+ break;
+
+ default: // Default is pass-through
+ $readable = $timestamp;
+ break;
+ }
+ }
+
+ // Return the stamp
+ return $readable;
+ }
+
+ /**
+ * "Getter" for databse entry
+ *
+ * @return $entry An array with database entries
+ * @throws NullPointerException If the database result is not found
+ * @throws InvalidDatabaseResultException If the database result is invalid
+ */
+ protected final function getDatabaseEntry () {
+ // Is there an instance?
+ if (is_null($this->getResultInstance())) {
+ // Throw an exception here
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Rewind it
+ $this->getResultInstance()->rewind();
+
+ // Do we have an entry?
+ if (!$this->getResultInstance()->valid()) {
+ throw new InvalidDatabaseResultException(array($this, $this->getResultInstance()), DatabaseResult::EXCEPTION_INVALID_DATABASE_RESULT);
+ } // END - if
+
+ // Get next entry
+ $this->getResultInstance()->next();
+
+ // Fetch it
+ $entry = $this->getResultInstance()->current();
+
+ // And return it
+ return $entry;
+ }
+
+ /**
+ * Getter for field name
+ *
+ * @param $fieldName Field name which we shall get
+ * @return $fieldValue Field value from the user
+ * @throws NullPointerException If the result instance is null
+ */
+ public final function getField ($fieldName) {
+ // Default field value
+ $fieldValue = null;
+
+ // Get result instance
+ $resultInstance = $this->getResultInstance();
+
+ // Is this instance null?
+ if (is_null($resultInstance)) {
+ // Then the user instance is no longer valid (expired cookies?)
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Get current array
+ $fieldArray = $resultInstance->current();
+
+ // Does the field exist?
+ if (isset($fieldArray[$fieldName])) {
+ // Get it
+ $fieldValue = $fieldArray[$fieldName];
+ } // END - if
+
+ // Return it
+ return $fieldValue;
+ }
+
+ /**
+ * Protected setter for user instance
*
+ * @param $userInstance An instance of a user class
* @return void
*/
- public function debugBacktrace () {
- // Sorry, there is no other way getting this nice backtrace
- print "<pre>\n";
- debug_print_backtrace();
- print "</pre>";
- exit;
+ protected final function setUserInstance (ManageableAccount $userInstance) {
+ $this->userInstance = $userInstance;
+ }
+
+ /**
+ * Getter for user instance
+ *
+ * @return $userInstance An instance of a user class
+ */
+ public final function getUserInstance () {
+ return $this->userInstance;
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class FrameworkArrayObject extends ArrayObject {
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
* Creates an instance of this class
*
- * @param $resolverInstance An instance of a command resolver class
- * @return $commandInstance An instance a prepared command class
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
*/
public final static function create???Command (CommandResolver $resolverInstance) {
// Get new instance
/**
* Executes the given command with given request and response objects
*
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
private $controllerName = "";
- /**
- * Resolver instance
- */
- private $resolverInstance = null;
-
/**
* Protected constructor
*
+ * @param $className Name of the class
* @return void
*/
- protected function __construct ($class) {
+ protected function __construct ($className) {
// Call parent constructor
- parent::__construct($class);
+ parent::__construct($className);
}
/**
public final function getControllerName () {
return $this->controllerName;
}
-
- /**
- * Setter for resolver instance
- *
- * @param $resolverInstance Instance of a command resolver class
- * @return void
- */
- public final function setResolverInstance (CommandResolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
- }
-
- /**
- * Getter for resolver instance
- *
- * @return $resolverInstance Instance of a command resolver class
- */
- public final function getResolverInstance () {
- return $this->resolverInstance;
- }
}
// [EOF]
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command for creating code CAPTCHAs
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageCodeCaptchaCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public final static function createImageCodeCaptchaCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new ImageCodeCaptchaCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the decrypted string from request (previously created by a filter!)
+ $decryptedCode = $requestInstance->getRequestElement('decrypted');
+
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign variable
+ $templateInstance->assignVariable('decrypted_code', $decryptedCode);
+
+ // Load the code (pardon, image...) template
+ $templateInstance->loadCodeTemplate('code_captcha');
+
+ // Compile the template
+ $templateInstance->compileTemplate();
+
+ // Compile all variables
+ $templateInstance->compileVariables();
+
+ // Transfer it to the response
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Extra filters here...
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the confirmation link handling
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebConfirmCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public final static function createWebConfirmCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebConfirmCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign application data with template engine
+ $templateInstance->assignApplicationData($appInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Load the master template
+ $masterTemplate = $appInstance->getMasterTemplate();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load the home template
+ $templateInstance->loadCodeTemplate('confirm_link');
+
+ // Assign the home template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('confirm_link', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_confirm_link_title'));
+
+ // Get user instance
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Set username
+ $templateInstance->assignVariable('username', $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USERNAME));
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in the response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
+ }
+}
+
+// [EOF]
+?>
<?php
/**
- * A command for the "home" page
+ * A command for the form processor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for handling forms on a centralized place");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
* Creates an instance of this class
*
- * @param $resolverInstance An instance of a command resolver class
- * @return $commandInstance An instance a prepared command class
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
*/
public final static function createWebDoFormCommand (CommandResolver $resolverInstance) {
// Get new instance
/**
* Executes the given command with given request and response objects
*
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Should never be executed...
- echo "<strong>This should never be executed!</strong><pre>";
- debug_print_backtrace();
- die("</pre>Good bye...");
+ $this->debugBackTrace();
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
}
+
}
// [EOF]
<?php
/**
- * A command for the "home" page
+ * A command for the home page
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the "home" page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
* Creates an instance of this class
*
- * @param $resolverInstance An instance of a command resolver class
- * @return $commandInstance An instance a prepared command class
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
*/
public final static function createWebHomeCommand (CommandResolver $resolverInstance) {
// Get new instance
/**
* Executes the given command with given request and response objects
*
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
$appInstance = $this->getResolverInstance()->getApplicationInstance();
// Prepare a template instance
- $templateInstance = $this->prepareTemplateEngine($appInstance);
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Transfer application data
+ $templateInstance->assignApplicationData($appInstance);
// Load the master template
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the home template
- $templateInstance->loadCodeTemplate("home");
+ $templateInstance->loadCodeTemplate('home');
// Assign the home template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable("home", "content");
+ $templateInstance->assignTemplateWithVariable('home', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $title = ucfirst($requestInstance->getRequestElement("page"));
- if (empty($title)) $title = "Home";
- $templateInstance->assignVariable('title', $title);
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_home_title'));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
// Get the content back from the template engine and put it in the response class
$templateInstance->transferToResponse($responseInstance);
}
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class WebLoginAreaCommand extends BaseCommand implements Commandable {
+ /**
+ * Name of the action
+ */
+ private $actionName = "";
+
/**
* Protected constructor
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the "home" page");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
* Creates an instance of this class
*
- * @param $resolverInstance An instance of a command resolver class
- * @return $commandInstance An instance a prepared command class
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
*/
public final static function createWebLoginAreaCommand (CommandResolver $resolverInstance) {
// Get new instance
// Set the application instance
$commandInstance->setResolverInstance($resolverInstance);
+ // Load general data like user status and such
+ $commandInstance->prepareCommand();
+
// Return the prepared instance
return $commandInstance;
}
+ /**
+ * Prepares some general data which shall be displayed on every page
+ *
+ * @return void
+ * @todo Add some stuff here: Some personal data, app/game related data
+ */
+ protected function prepareCommand () {
+ }
+
/**
* Executes the given command with given request and response objects
*
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- // Default action is the one from configuration
- $action = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
+ // Get the action instance from registry
+ $actionInstance = Registry::getRegistry()->getInstance('action');
+
+ // Do we have an action here?
+ if ($actionInstance instanceof PerformableAction) {
+ // Execute the action (shall not output anything, see below why)
+ $actionInstance->execute($requestInstance, $responseInstance);
+ } // END - if
// Get the application instance
$appInstance = $this->getResolverInstance()->getApplicationInstance();
// Prepare a template instance
- $templateInstance = $this->prepareTemplateEngine($appInstance);
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Assign all the application's data with template variables
+ $templateInstance->assignApplicationData($appInstance);
// Load the master template
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
-
- // Get "action" from request
- $actReq = $requestInstance->getRequestElement("action");
-
- // Do we have a "action" parameter set?
- if (is_string($actReq)) {
- // Then use it with prefix
- $action = sprintf("login_%s", $actReq);
- } // END - if
-
- // TODO Do the action somewhere here
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the matching template
- $templateInstance->loadCodeTemplate($action);
+ $templateInstance->loadCodeTemplate('action_' . $this->actionName);
// Assign the template with the master template as a content ... ;)
- $templateInstance->assignTemplateWithVariable($action, "content");
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('action_' . $this->actionName, 'login_content');
+
+ // Load main template
+ $templateInstance->loadCodeTemplate('login_main');
+
+ // Assign the main template with the master template as a content ... ;)
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('login_main', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_{$action}_title'));
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage($this->actionName . '_title'));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
// Get the content back from the template engine and put it in the response class
$templateInstance->transferToResponse($responseInstance);
}
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Default is no action
+ $actionInstance = null;
+
+ // Default action is the one from configuration
+ $this->actionName = sprintf("login_%s", $this->getConfigInstance()->readConfig('login_default_action'));
+
+ // Get "action" from request
+ $actReq = $requestInstance->getRequestElement('action');
+
+ // Do we have a "action" parameter set?
+ if ((is_string($actReq)) && (!empty($actReq))) {
+ // Then use it with prefix
+ $this->actionName = sprintf("login_%s", $actReq);
+ } // END - if
+
+ // Get application instance
+ $applicationInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Try to get an action resolver for the given action
+ try {
+ // Get a resolver
+ $actionResolver = WebActionResolver::createWebActionResolver($this->actionName, $applicationInstance);
+
+ // Resolve the action
+ $actionInstance = $actionResolver->resolveAction();
+
+ // Add more action-specific filters
+ $actionInstance->addExtraFilters($controllerInstance, $requestInstance);
+
+ // Remember this action in registry
+ Registry::getRegistry()->addInstance('action', $actionInstance);
+ } catch (InvalidActionException $e) {
+ // Silently ignored because no special action was found
+ }
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * A command for the login form
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLoginCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public final static function createWebLoginCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLoginCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign application data with template engine
+ $templateInstance->assignApplicationData($appInstance);
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // Load the master template
+ $masterTemplate = $appInstance->getMasterTemplate();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load the home template
+ $templateInstance->loadCodeTemplate('login_form');
+
+ // Assign the home template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('login_form', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_login_title'));
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in the response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the login failed page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLoginFailedCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public final static function createWebLoginFailedCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLoginFailedCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Load the master template
+ $masterTemplate = $appInstance->getMasterTemplate();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load the login_failed template
+ $templateInstance->loadCodeTemplate('login_failed');
+
+ // Assign the login_failed template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('login_failed', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('login_failed_title'));
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in the response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A command for the login failed page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLogoutDoneCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public final static function createWebLogoutDoneCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebLogoutDoneCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Prepare a template instance
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Load the master template
+ $masterTemplate = $appInstance->getMasterTemplate();
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load the logout_done template
+ $templateInstance->loadCodeTemplate('logout_done');
+
+ // Assign the logout_done template with the master template as a content ... ;)
+ $templateInstance->assignTemplateWithVariable('logout_done', 'content');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($masterTemplate);
+
+ // Set title
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('logout_done_title'));
+
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
+ // ... and all variables. This should be merged together in a pattern
+ // to make things easier. A cache mechanism should be added between
+ // these two calls to cache compiled templates.
+ $templateInstance->compileVariables();
+
+ // Get the content back from the template engine and put it in the response class
+ $templateInstance->transferToResponse($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty for now
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class WebRegisterCommand extends BaseCommand implements Commandable {
+class WebRegisterCommand extends BaseCommand implements Commandable, Registerable {
/**
* Protected constructor
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set special description
- $this->setObjectDescription("Command for the registration form");
-
- // Create unique ID number
- $this->generateUniqueId();
-
- // Clean up a little
- $this->removeSystemArray();
}
/**
* Creates an instance of this class
*
- * @param $resolverInstance An instance of a command resolver class
- * @return $commandInstance An instance a prepared command class
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
*/
public final static function createWebRegisterCommand (CommandResolver $resolverInstance) {
// Get new instance
/**
* Executes the given command with given request and response objects
*
- * @param $requestInstance An instance of a class with an Requestable interface
- * @param $responseInstance An instance of a class with an Responseable interface
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
* @return void
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Set request instance as extra instance
+ Registry::getRegistry()->addInstance('extra', $this);
+
// Get the application instance
$appInstance = $this->getResolverInstance()->getApplicationInstance();
// Prepare a template instance
- $templateInstance = $this->prepareTemplateEngine($appInstance);
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
// Assign all the application's data with template variables
$templateInstance->assignApplicationData($appInstance);
+ // Assign base URL
+ $templateInstance->assignConfigVariable('base_url');
+
// Load the master template
$masterTemplate = $appInstance->getMasterTemplate();
// Load header template
- $templateInstance->loadCodeTemplate("header");
+ $templateInstance->loadCodeTemplate('header');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("header", "header");
+ $templateInstance->assignTemplateWithVariable('header', 'header');
// Load footer template
- $templateInstance->loadCodeTemplate("footer");
+ $templateInstance->loadCodeTemplate('footer');
// Compile and assign it with a variable
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("footer", "footer");
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
// Load the register template
- $templateInstance->loadCodeTemplate("register");
+ $templateInstance->loadCodeTemplate('register_form');
// Assign the register template with the master template as a content ... ;)
$templateInstance->compileTemplate();
- $templateInstance->assignTemplateWithVariable("register", "content");
+ $templateInstance->assignTemplateWithVariable('register_form', 'content');
// Load the master template
$templateInstance->loadCodeTemplate($masterTemplate);
// Set title
- $title = ucfirst($requestInstance->getRequestElement("page"));
- if (empty($title)) $title = "Register";
- $templateInstance->assignVariable('title', $title);
+ $templateInstance->assignVariable('title', $this->getLanguageInstance()->getMessage('page_register_title'));
// ... and all variables. This should be merged together in a pattern
// to make things easier. A cache mechanism should be added between
// Get the content back from the template engine and put it in the response class
$templateInstance->transferToResponse($responseInstance);
}
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Empty class
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * A command class for resending the confirmation link
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebResendLinkCommand extends BaseCommand implements Commandable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $commandInstance An instance a prepared command class
+ */
+ public final static function createWebResendLinkCommand (CommandResolver $resolverInstance) {
+ // Get new instance
+ $commandInstance = new WebResendLinkCommand();
+
+ // Set the application instance
+ $commandInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $commandInstance;
+ }
+
+ /**
+ * Executes the given command with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @throws InvalidInterfaceException If the user class does not implement ManageableMember
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Does the user instance implement ManageableMember?
+ if (!$userInstance instanceof ManageableMember) {
+ // Throw exception here
+ throw new InvalidInterfaceException(array($userInstance, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+ } // END - if
+
+ // Get an application instance
+ $appInstance = $this->getResolverInstance()->getApplicationInstance();
+
+ // Get a RNG instance (Random Number Generator)
+ $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
+
+ // Generate a pseudo-random string
+ $randomString = $rngInstance->randomString(255);
+
+ // Get a crypto instance
+ $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Hash and encrypt the string
+ $hashedString = $cryptoInstance->hashString($cryptoInstance->encryptString($randomString));
+
+ // Update the user class
+ $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, $hashedString);
+
+ // Re-set config entry to mailer engine
+ $this->getConfigInstance()->setConfigEntry('template_class', $this->getConfigInstance()->readConfig('mail_template_class'));
+
+ // Prepare the template engine
+ $templateInstance = $this->prepareTemplateInstance($appInstance);
+
+ // Assign the application data with the template engine
+ $templateInstance->assignApplicationData($appInstance);
+
+ // Get a mailer class
+ $mailerInstance = ObjectFactory::createObjectByConfiguredName('mailer_class', array($templateInstance, $appInstance, 'resend_link'));
+
+ // Set this mailer in our template engine
+ $templateInstance->setMailerInstance($mailerInstance);
+
+ // Add template variables we shall get
+ $mailerInstance->addConfigTemplateVariable('base_url');
+ $mailerInstance->addConfigTemplateVariable('admin_email');
+ $mailerInstance->addValueTemplateVariable('confirm_hash');
+ $mailerInstance->addValueTemplateVariable('username');
+ $mailerInstance->addValueTemplateVariable('email');
+
+ // Add the value instance for the confirmation hash
+ $mailerInstance->addValueInstance('confirm_hash', $userInstance);
+ $mailerInstance->addValueInstance('username', $userInstance);
+ $mailerInstance->addValueInstance('email', $userInstance);
+
+ // Add the recipient
+ $mailerInstance->addRecipientByUserInstance($userInstance);
+
+ // Use subject line from template
+ $mailerInstance->useSubjectFromTemplate();
+
+ // Send the email out
+ $mailerInstance->deliverEmail($responseInstance);
+
+ // Send out notification to admin (depends on settings)
+ $mailerInstance->sendAdminNotification($responseInstance);
+ }
+
+ /**
+ * Adds extra filters to the given controller instance
+ *
+ * @param $controllerInstance A controller instance
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @return void
+ */
+ public function addExtraFilters (Controller $controllerInstance, Requestable $requestInstance) {
+ // Filter for checking if account is unconfirmed
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_class'));
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("BZIP2 compressor");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("GZIP compressor");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Null compressor");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("General console tools");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
// Read the file
$hostname = trim($io->readFromFile());
- $helper->getDebugInstance()->output(sprintf("[%s:] Our host name is: <strong>%s</strong><br />\n",
+ $helper->debugOutput(sprintf("[%s:] Our host name is: <strong>%s</strong>",
$helper->__toString(),
$hostname
));
$ip = $ipResolved;
// Debug message
- $helper->getDebugInstance()->output(sprintf("[%s:] Resolved IP address is: <strong>%s</strong><br />\n",
+ $helper->debugOutput(sprintf("[%s:] Resolved IP address is: <strong>%s</strong>\n",
$helper->__toString(),
$ip
));
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A controller for a code-based CAPTCHA where the user has to repeat a shown code
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageCodeCaptchaController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createImageCodeCaptchaController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new ImageCodeCaptchaController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Add filter for checking the "encrypt" string
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('captcha_encrypt_validator_class'));
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Execute pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Execute post filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class Controller extends BaseController implements Controller {
+class ???Controller extends BaseController implements Controller {
/**
* Protected constructor
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function create???Controller (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new ???Controller();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
- // Set part description
- $this->setObjectDescription("Ein spezieller Controller");
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
- // Create unique ID number
- $this->generateUniqueId();
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
- // Clean up a little
- $this->removeSystemArray();
+ // Flush the response out
+ $responseInstance->flushBuffer();
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class BaseController extends BaseFrameworkSystem {
- /**
- * Instance of a CommandResolver class
- */
- private $resolverInstance = null;
-
+class BaseController extends BaseFrameworkSystem implements Registerable {
/**
* Pre filter chain instance
*/
/**
* Protected constructor
*
+ * @param $className Name of the class
* @return void
*/
- protected function __construct ($class) {
+ protected function __construct ($className) {
// Call parent constructor
- parent::__construct($class);
+ parent::__construct($className);
// Clean up a little
$this->removeNumberFormaters();
// Initialize both filter chains
$this->preFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
$this->postFilterChain = ObjectFactory::createObjectByConfiguredName('filter_chain_class');
- }
- /**
- * Getter for a command resolver instance
- *
- * @return $resolverInstance An instance of a command resolver class
- */
- public final function getResolverInstance () {
- return $this->resolverInstance;
- }
-
- /**
- * Setter for a command resolver instance
- *
- * @param $resolverInstance An instance of a command resolver class
- * @return void
- */
- public final function setResolverInstance (CommandResolver $resolverInstance) {
- $this->resolverInstance = $resolverInstance;
+ // Add this controller to the registry
+ Registry::getRegistry()->addInstance('controller', $this);
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default controller for all other requests");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default controller with news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Controller for handling forms");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Get command instance from resolver
$commandInstance = $this->getResolverInstance()->resolveCommand($formAction);
- // Execute *very* generic pre filters
- $this->executePreFilters($requestInstance, $responseInstance);
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Try to run the pre filters, if auth exceptions come through redirect here
+ try {
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+ } catch (UserAuthorizationException $e) {
+ // Redirect to main page
+ $responseInstance->redirectToConfiguredUrl('login_failed_url');
+ }
// Is the request still valid? Post filters shall only be executed of
// the request is valid
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A default controller for images
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageDefaultController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createImageDefaultController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new ImageDefaultController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Default controller with news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Set the command resolver
$controllerInstance->setResolverInstance($resolverInstance);
- // Add some filters to this controller
+ // User auth filter
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_auth_class'));
+
+ // User update filter
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_update_class'));
+
+ // News fetcher filter
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class'));
+
+ // News proccess/display-preparation
$controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class'));
+ /* @todo: Add some filters to this controller */
+
// Return the prepared instance
return $controllerInstance;
}
* @return void
*/
public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
- // Run the pre filters
- $this->executePreFilters($requestInstance, $responseInstance);
-
// Get the command instance from the resolver by sending a request instance to the resolver
- $commandInstance = $this->getResolverInstance()->resolvCommandByRequest($requestInstance);
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Try to run the pre filters, if auth exceptions come through redirect here
+ try {
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+ } catch (UserAuthorizationException $e) {
+ // Redirect to main page
+ $responseInstance->redirectToConfiguredUrl('login_failed_url');
+ }
// This request was valid! :-D
$requestInstance->requestIsValid();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Controller for confirmation link
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebConfirmController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ * @todo Add some filters to this controller
+ */
+ public final static function createWebConfirmController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebConfirmController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Add filters for handling confirmation code and username
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('username_verifier_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_unconfirmed_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('confirm_code_verifier_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('user_status_confirmed_class'));
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * The default controller for all other web requests
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ * @todo This controller shall still provide some headlines for sidebars
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebDefaultController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createWebDefaultController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebDefaultController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * The default controller with news for e.g. home or news page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebDefaultNewsController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createWebDefaultNewsController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebDefaultNewsController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Add news filters to this controller
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_download_class'));
+ $controllerInstance->addPreFilter(ObjectFactory::createObjectByConfiguredName('news_process_class'));
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Controller for login form with password reminder and maybe enabled
+ * "guest-login" button
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLoginController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ * @todo Add some filters to this controller
+ */
+ public final static function createWebLoginController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebLoginController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A controller for login failed page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLoginFailedController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createWebLoginFailedController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebLoginFailedController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Controller for logout done page
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLogoutDoneController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ * @todo Add some filters to this controller
+ */
+ public final static function createWebLogoutDoneController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebLogoutDoneController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Controller for register form
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebRegisterController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ * @todo Add some filters to this controller
+ */
+ public final static function createWebRegisterController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebRegisterController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance from the resolver by sending a request instance to the resolver
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // Add more filters by the command
+ $commandInstance->addExtraFilters($this, $requestInstance);
+
+ // Run the pre filters
+ $this->executePreFilters($requestInstance, $responseInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Run the pre filters
+ $this->executePostFilters($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * Controller for changing user status
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ * @todo This controller shall still provide some headlines for sidebars
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebStatusController extends BaseController implements Controller {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this class
+ *
+ * @param $resolverInstance An instance of a command resolver class
+ * @return $controllerInstance A prepared instance of this class
+ */
+ public final static function createWebStatusController (CommandResolver $resolverInstance) {
+ // Create the instance
+ $controllerInstance = new WebStatusController();
+
+ // Set the command resolver
+ $controllerInstance->setResolverInstance($resolverInstance);
+
+ // Return the prepared instance
+ return $controllerInstance;
+ }
+
+ /**
+ * Handles the given request and response
+ *
+ * @param $requestInstance An instance of a request class
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function handleRequest (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the command instance
+ $commandInstance = $this->getResolverInstance()->resolveCommandByRequest($requestInstance);
+
+ // This request was valid! :-D
+ $requestInstance->requestIsValid();
+
+ // Execute the command
+ $commandInstance->execute($requestInstance, $responseInstance);
+
+ // Flush the response out
+ $responseInstance->flushBuffer();
+ }
+}
+
+// [EOF]
+?>
* @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
private $uniqueKey = "";
+ /**
+ * Primary key
+ */
+ private $primaryKey = "";
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Storeable data set for databases");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
/**
* Creates an instance of this criteria
*
- * @return $criteriaInstance An instance of this criteria
+ * @param $tableName Name of the table
+ * @return $criteriaInstance An instance of this criteria
*/
- public final static function createDataSetCriteria () {
+ public final static function createDataSetCriteria ($tableName) {
// Get a new instance
$criteriaInstance = new DataSetCriteria();
+ // Set table name
+ $criteriaInstance->setTableName($tableName);
+
// Return the instance
return $criteriaInstance;
}
public final function getCriteriaArray () {
return $this->tableColumns;
}
+
+ /**
+ * Getter for primary key or unique key if not set
+ *
+ * @return $primaryKey Primary key or unique key if not set
+ */
+ public final function getPrimaryKey () {
+ // Get primary key by default
+ $primaryKey = $this->primaryKey;
+
+ if (empty($primaryKey)) {
+ // Get uniqueKey
+ $primaryKey = $this->getUniqueKey();
+ } // END - if
+
+ // Return it
+ return $primaryKey;
+ }
+
+ /**
+ * Setter for primary key
+ *
+ * @param $primaryKey Primary key to set
+ * @return void
+ */
+ public final function setPrimaryKey ($primaryKey) {
+ $this->primaryKey = (string) $primaryKey;
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class SearchCriteria extends BaseFrameworkSystem implements LocalSearchCriteria {
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Search criteria class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
/**
* Getter for limit
*
- * @param
* @return $limit Search limit
*/
public final function getLimit () {
/**
* Getter for skip
*
- * @param
* @return $skip Search skip
*/
public final function getSkip () {
// Return the value
return $value;
}
+
+ /**
+ * Checks wether given array entry matches
+ *
+ * @param $entryArray Array with the entries to find
+ * @return $matches Wether the entry matches or not
+ */
+ public function ifEntryMatches (array $entryArray) {
+ // First nothing matches and nothing is counted
+ $matches = false;
+ $counted = 0;
+
+ // Walk through all entries
+ foreach ($entryArray as $key=>$entry) {
+ // Then walk through all search criteria
+ foreach ($this->searchCriteria as $criteriaKey=>$criteriaValue) {
+ // Is the element found and does it match?
+ if (($key == $criteriaKey) && ($criteriaValue == $entry)) {
+ // Then count this one up
+ $counted++;
+ } // END - if
+ } // END - foreach
+ } // END - foreach
+
+ // Now check if the criteria matches
+ $matches = ($counted == count($this->searchCriteria));
+
+ // Return the result
+ return $matches;
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * Search criteria for e.g. searching in databases. Do not use this class if
+ * you are looking for a ship or company, or what ever. Instead use this class
+ * for looking in storages like the database.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UpdateCriteria extends BaseFrameworkSystem implements LocalUpdateCriteria {
+ /**
+ * Criteria to handle
+ */
+ private $updateCriteria = array();
+
+ /**
+ * Limitation for the update
+ */
+ private $limit = 0;
+
+ /**
+ * Skip these entries before using them
+ */
+ private $skip = 0;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Create an instance of this class
+ *
+ * @return $criteriaInstance An instance of this criteria
+ */
+ public final static function createUpdateCriteria () {
+ // Get a new instance
+ $criteriaInstance = new UpdateCriteria();
+
+ // Return this instance
+ return $criteriaInstance;
+ }
+
+ /**
+ * Add criteria
+ *
+ * @param $criteriaKey Criteria key
+ * @param $criteriaValue Criteria value
+ * @return void
+ */
+ public function addCriteria ($criteriaKey, $criteriaValue) {
+ $this->updateCriteria[$criteriaKey] = $criteriaValue;
+ }
+
+ /**
+ * Add configured criteria
+ *
+ * @param $criteriaKey Criteria key
+ * @param $configEntry Configuration entry
+ * @return void
+ */
+ public function addConfiguredCriteria ($criteriaKey, $configEntry) {
+ // Add the configuration entry as a criteria
+ $value = $this->getConfigInstance()->readConfig($configEntry);
+ $this->addCriteria($criteriaKey, $value);
+ }
+
+ /**
+ * Getter for update criteria array
+ *
+ * @return $updateCriteria Array holding the update criteria
+ */
+ public final function getUpdateCriteria () {
+ return $this->updateCriteria;
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class CryptoHelper extends BaseFrameworkSystem {
+class CryptoHelper extends BaseFrameworkSystem implements Cryptable {
+ // Exception constants
+ const EXCEPTION_ENCRYPT_MISSING = 0x1f0;
+ const EXCEPTION_ENCRYPT_INVALID = 0x1f1;
+
/**
* An instance of this own clas
*/
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Cryptographical helper");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
*/
public final static function createCryptoHelper () {
// Get a new instance
- $cryptoInstance = self::getInstance();
+ $cryptoInstance = new CryptoHelper();
// Initialize the hasher
$cryptoInstance->initHasher();
// Is no instance there?
if (is_null(self::$selfInstance)) {
// Then get a new one
- self::$selfInstance = new CryptoHelper();
+ self::$selfInstance = self::createCryptoHelper();
}
// Return the instance
*/
private function generateSalt () {
// Get a random string from the RNG
- $randomString = $this->rngInstance->makeRandomString();
+ $randomString = $this->rngInstance->randomString();
// Get config entry for salt length
$length = $this->getConfigInstance()->readConfig('salt_length');
}
/**
- * Hashes a password with salt and returns the hash. If an old previous hash
+ * Hashes a string with salt and returns the hash. If an old previous hash
* is supplied the method will use the first X chars of that hash for hashing
* the password. This is useful if you want to check if the password is
* identical for authorization purposes.
*
- * @param $plainPassword The plain password to use
- * @param $oldHash A previously hashed password
- * @return $hashed The hashed and salted password
+ * @param $str Unhashed string
+ * @param $oldHash A hash from previous hashed string
+ * @return $hashed The hashed and salted string
*/
- public function hashPassword ($plainPassword, $oldHash = "") {
+ public function hashString ($str, $oldHash = "") {
+ // Cast the string
+ $str = (string) $str;
+
+ // Default is the default salt ;-)
+ $salt = $this->salt;
+
// Is the old password set?
- if (empty($oldHash)) {
- // No, then use the current salt
- $salt = $this->salt;
- } else {
+ if (!empty($oldHash)) {
// Use the salt from hash, first get length
$length = $this->getConfigInstance()->readConfig('salt_length');
// Then extract the X first characters from the hash as our salt
$salt = substr($oldHash, 0, $length);
- }
+ } // END - if
// Hash the password with salt
+ //* DEBUG: */ echo "salt=".$salt."/plain=".$str."<br />\n";
$hashed = $salt . md5(sprintf($this->getConfigInstance()->readConfig('hash_mask'),
$salt,
- $this->rngInstance->getExtraSalt(),
- $plainPassword
+ $this->rngInstance->getFixedSalt(),
+ $str
));
// And return it
return $hashed;
}
+
+ /**
+ * Encrypt the string with fixed salt
+ *
+ * @param $str The unencrypted string
+ * @return $encrypted Encrypted string
+ */
+ public function encryptString ($str) {
+ // Init crypto module
+ $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
+ $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
+
+ // Get key
+ if ($this->getConfigInstance()->readConfig('crypt_fixed_salt') === "Y") {
+ $key = md5($this->rngInstance->getFixedSalt());
+ } else {
+ $key = md5($this->rngInstance->getExtraSalt());
+ }
+
+ // Add some "garbage" to the string
+ switch ($this->rngInstance->randomNumber(0, 8)) {
+ case 0:
+ $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20));
+ break;
+
+ case 1:
+ $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20));
+ break;
+
+ case 2:
+ $garbageString = crc32($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20));
+ break;
+
+ case 3:
+ $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20));
+ break;
+
+ case 4:
+ $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20));
+ break;
+
+ case 5:
+ $garbageString = md5($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20));
+ break;
+
+ case 6:
+ $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".crc32($this->rngInstance->randomString(20));
+ break;
+
+ case 7:
+ $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".md5($this->rngInstance->randomString(20));
+ break;
+
+ case 8:
+ $garbageString = sha1($this->rngInstance->randomString(10))."|".base64_encode($str)."|".sha1($this->rngInstance->randomString(20));
+ break;
+ }
+
+ // Encrypt the string
+ $encrypted = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $garbageString, MCRYPT_MODE_ECB, $iv);
+
+ // Return the string
+ return $encrypted;
+ }
+
+ /**
+ * Decrypt the string with fixed salt
+ *
+ * @param $encrypted Encrypted string
+ * @return $str The unencrypted string
+ */
+ public function decryptString ($encrypted) {
+ // Init crypto module
+ $iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
+ $iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
+
+ // Get key
+ if ($this->getConfigInstance()->readConfig('crypt_fixed_salt') === "Y") {
+ $key = md5($this->rngInstance->getFixedSalt());
+ } else {
+ $key = md5($this->rngInstance->getExtraSalt());
+ }
+
+ // Decrypt the string
+ $garbageString = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $encrypted, MCRYPT_MODE_ECB, $iv);
+
+ // Get the real string out
+ $strArray = explode("|", $garbageString);
+ $str = base64_decode($strArray[1]);
+
+ // Trim trailing nulls away
+ $str = rtrim($str, "\0");
+
+ // Return the string
+ return $str;
+ }
}
// [EOF]
* @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct($class);
- // Set part description
- $this->setObjectDescription("");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
* @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject {
+abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface {
// Constants for exceptions
- const EXCEPTION_SQL_QUERY = 0x050;
+ const EXCEPTION_SQL_QUERY = 0x140;
/**
* The limiter instance
/**
* Protected constructor
*
+ * @param $className Name of the class
* @return void
*/
- protected function __construct($class) {
+ protected function __construct($className) {
// Call parent constructor
- parent::__construct($class);
+ parent::__construct($className);
// Clean up a little
$this->removeNumberFormaters();
}
-
- /**
- * Getter for limitation instance
- *
- * @return $limitInstance The instance to the object ObjectLimits
- */
- public final function getLimitInstance () {
- return $this->limitInstance;
- }
-
- /**
- * Setup limitation for the saving process
- *
- * @param $limitInstance An instance of ObjectLimits which contains
- * elements we shall exclusivly include in
- * saving process
- * @return void
- */
- public final function limitObject (ObjectLimits $limitInstance) {
- // Get limitArray for validation
- $array = $limitInstance->getLimitArray();
-
- // Sanity-check if some limitations are in the object
- if ($array->count() > 0) {
- // Okay, there is enougth
- $this->limitInstance = $limitInstance;
- }
- }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseDatabaseWrapper extends BaseFrameworkSystem {
+ /**
+ * Cache instance
+ */
+ private $cacheInstance = null;
+
+ /**
+ * Current table name to use
+ */
+ private $tableName = "unknown";
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct($class);
+ // Initialize the cache instance
+ $this->initCacheInstance();
+
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
}
+
+ /**
+ * Initializes the cache instance with a new object
+ *
+ * @return void
+ */
+ private final function initCacheInstance () {
+ // Set the new instance
+ $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache();
+ }
+
+ /**
+ * Do a "select" query on the current table with the given search criteria and
+ * store it in cache for later usage
+ *
+ * @param $criteriaInstance An instance of a Criteria class
+ * @return $resultInstance An instance of a database result class
+ */
+ public function doSelectByCriteria (Criteria $criteriaInstance) {
+ // First get a key suitable for our cache and extend it with this class name
+ $cacheKey = sprintf("%s@%s",
+ $this->__toString(),
+ $criteriaInstance->getCacheKey()
+ );
+
+ // Does this key exists in cache?
+ if ($this->cacheInstance->offsetExists($cacheKey)) {
+ // Then use this result
+ $result = $cacheInstance->offsetGet($cacheKey);
+ } else {
+ // Now it's time to ask the database layer for this select statement
+ $result = $this->getDatabaseInstance()->doSelectByTableCriteria($this->getTableName(), $criteriaInstance);
+
+ // Cache the result if not null
+ if (!is_null($result)) {
+ // A valid result has returned from the database layer
+ $this->cacheInstance->offsetSet($cacheKey, $result);
+ } else {
+ // This invalid result must be wrapped
+ $result = array(
+ 'status' => "invalid",
+ 'exception' => $this->getDatabaseInstance()->getLastException()
+ );
+ }
+ }
+
+ // Create an instance of a DatabaseResult class with the given result
+ $resultInstance = DatabaseResult::createDatabaseResult($result);
+
+ // And return the instance
+ return $resultInstance;
+ }
+
+ /**
+ * Count the numbers of rows we shall receive
+ *
+ * @param $criteriaInstance An instance of a Criteria class
+ * @return $numRows Numbers of rows of database entries
+ */
+ public function doSelectCountByCriteria (Criteria $criteriaInstance) {
+ // Total numbers is zero by default
+ $numRows = 0;
+
+ // Get the result from above method
+ $resultInstance = $this->doSelectByCriteria($criteriaInstance);
+
+ // Was that query fine?
+ if ($resultInstance->ifStatusIsOkay()) {
+ // Then get the number of rows
+ $numRows = $resultInstance->getAffectedRows();
+ } // END - if
+
+ // Return the result
+ return $numRows;
+ }
+
+ /**
+ * Setter for table name
+ *
+ * @param $tableName Name of table name to set
+ * @return void
+ */
+ protected final function setTableName ($tableName) {
+ $this->tableName = (string) $tableName;
+ }
+
+ /**
+ * Getter for table name
+ *
+ * @return $tableName Name of table name to set
+ */
+ protected final function getTableName () {
+ return $this->tableName;
+ }
+
+ /**
+ * Getter for primary key used in wrapped table
+ *
+ * @return $primaryKey Primary key used in wrapped table
+ */
+ public final function getPrimaryKeyValue () {
+ // Get the table name and a database instance and ask for it
+ $primaryKey = $this->getDatabaseInstance()->getPrimaryKeyOfTable($this->getTableName());
+
+ // Return value
+ return $primaryKey;
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontendInterface {
// Constants for MySQL backward-compatiblity (PLEASE FIX THEM!)
- const DB_CODE_TABLE_MISSING = 0x010;
- const DB_CODE_TABLE_UNWRITEABLE = 0x011;
+ const DB_CODE_TABLE_MISSING = 0x100;
+ const DB_CODE_TABLE_UNWRITEABLE = 0x101;
+ const DB_CODE_DATA_FILE_CORRUPT = 0x102;
/**
* Save path for "file database"
*/
private $lastException = null;
+ /**
+ * Table information array
+ */
+ private $tableInfo = array();
+
/**
* The protected constructor. Do never instance from outside! You need to
* set a local file path. The class will then validate it.
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Class for local file databases");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean up a little
+ $this->removeNumberFormaters();
$this->removeSystemArray();
}
return $this->lastException;
}
- /**
- * Saves a given object to the local file system by serializing and
- * transparently compressing it
- *
- * @param $object The object we shall save to the local file system
- * @return void
- */
- public final function saveObject (FrameworkInterface $object) {
- // Get a string containing the serialized object. We cannot exchange
- // $this and $object here because $object does not need to worry
- // about it's limitations... ;-)
- $serialized = $this->serializeObject($object);
-
- // Get a path name plus file name and append the extension
- $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension();
-
- // Save the file to disc we don't care here if the path is there,
- // this must be done in later methods.
- $this->getFileIoInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized));
- }
-
- /**
- * Get a serialized string from the given object
- *
- * @param $object The object we want to serialize and transparently
- * compress
- * @return $serialized A string containing the serialzed/compressed object
- * @see ObjectLimits An object holding limition information
- * @see SerializationContainer A special container class for e.g.
- * attributes from limited objects
- */
- private function serializeObject (FrameworkInterface $object) {
- // If there is no limiter instance we serialize the whole object
- // otherwise only in the limiter object (ObjectLimits) specified
- // attributes summarized in a special container class
- if ($this->getLimitInstance() === null) {
- // Serialize the whole object. This tribble call is the reason
- // why we need a fall-back implementation in CompressorChannel
- // of the methods compressStream() and decompressStream().
- $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($object));
- } else {
- // Serialize only given attributes in a special container
- $container = SerializationContainer::createSerializationContainer($this->getLimitInstance(), $object);
-
- // Serialize the container
- $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($container));
- }
-
- // Return the serialized object string
- return $serialized;
- }
-
/**
* Analyses if a unique ID has already been used or not by search in the
* local database folder.
* @throws NoArrayCreatedException If explode() fails to create an array
* @throws InvalidArrayCountException If the array contains less or
* more than two elements
+ * @deprecated
*/
public function isUniqueIdUsed ($uniqueID, $inConstructor = false) {
// Currently not used... ;-)
if ($inConstructor) {
return false;
} else {
- throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
+ throw new NoArrayCreatedException(array($this, 'pathFile'), self::EXCEPTION_ARRAY_EXPECTED);
}
} elseif (count($pathFile) != 2) {
// Invalid ID returned!
if ($inConstructor) {
return false;
} else {
- throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ throw new InvalidArrayCountException(array($this, 'pathFile', count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
}
// Initialize the search loop
$isValid = false;
- while ($dataFile = $dirInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn"))) {
+ while ($dataFile = $dirInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) {
// Generate FQFN for testing
$fqfn = sprintf("%s/%s", $pathName, $dataFile);
$this->setLastFile($fqfn);
}
/**
- * Get cached (last fetched) data from the local file database
+ * Reads a local data file and returns it's contents in an array
*
- * @param $uniqueID The ID number for looking up the data
- * @return $object The restored object from the maybe compressed
- * serialized data
- * @throws MismatchingCompressorsException If the compressor from
- * the loaded file
- * mismatches with the
- * current used one.
- * @throws NullPointerException If the restored object
- * is null
- * @throws NoObjectException If the restored "object"
- * is not an object instance
- * @throws MissingMethodException If the required method
- * toString() is missing
+ * @param $fqfn The FQFN for the requested file
+ * @return $dataArray
*/
- public final function getObjectFromCachedData ($uniqueID) {
- // Get instance for file handler
- $inputHandler = $this->getFileIoInstance();
-
- // Get last file's name and contents
- $fqfn = $this->repairFQFN($this->getLastFile(), $uniqueID);
- $contents = $this->repairContents($this->getLastContents(), $fqfn);
-
- // Let's decompress it. First we need the instance
- $compressInstance = $this->getCompressorChannel();
-
- // Is the compressor's extension the same as the one from the data?
- if ($compressInstance->getCompressorExtension() != $contents['header'][0]) {
- /**
- * @todo For now we abort here but later we need to make this a little more dynamic.
- */
- throw new MismatchingCompressorsException(array($this, $contents['header'][0], $fqfn, $compressInstance->getCompressorExtension()), self::EXCEPTION_MISMATCHING_COMPRESSORS);
- }
+ private function getDataArrayFromFile ($fqfn) {
+ // Get a file pointer
+ $fileInstance = FrameworkFileInputPointer::createFrameworkFileInputPointer($fqfn);
- // Decompress the data now
- $serialized = $compressInstance->getCompressor()->decompressStream($contents['data']);
-
- // And unserialize it...
- $object = unserialize($serialized);
-
- // This must become a valid object, so let's check it...
- if (is_null($object)) {
- // Is null, throw exception
- throw new NullPointerException($object, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_object($object)) {
- // Is not an object, throw exception
- throw new NoObjectException($object, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!$object instanceof FrameworkInterface) {
- // A highly required method was not found... :-(
- throw new MissingMethodException(array($object, '__toString'), self::EXCEPTION_MISSING_METHOD);
- }
+ // Get the raw data and BASE64-decode it
+ $compressedData = base64_decode($fileInstance->readLinesFromFile());
+
+ // Close the file and throw the instance away
+ $fileInstance->closeFile();
+ unset($fileInstance);
+
+ // Decompress it
+ $serializedData = $this->getCompressorChannel()->getCompressor()->decompressStream($compressedData);
+
+ // Unserialize it
+ $dataArray = unserialize($serializedData);
- // And return the object
- return $object;
+ // Finally return it
+ return $dataArray;
}
/**
- * Private method for re-gathering (repairing) the FQFN
+ * Writes data array to local file
*
- * @param $fqfn The current FQFN we shall validate
- * @param $uniqueID The unique ID number
- * @return $fqfn The repaired FQFN when it is empty
- * @throws NoArrayCreatedException If explode() has not
- * created an array
- * @throws InvalidArrayCountException If the array count is not
- * as the expected
+ * @param $fqfn The FQFN of the local file
+ * @param $dataArray An array with all the data we shall write
+ * @return void
*/
- private function repairFQFN ($fqfn, $uniqueID) {
- // Cast both strings
- $fqfn = (string) $fqfn;
- $uniqueID = (string) $uniqueID;
-
- // Is there pre-cached data available?
- if (empty($fqfn)) {
- // Split the unique ID up in path and file name
- $pathFile = explode("@", $uniqueID);
-
- // Are there two elements? Index 0 is the path, 1 the file name + global extension
- if (!is_array($pathFile)) {
- // No array found
- throw new NoArrayCreatedException(array($this, "pathFile"), self::EXCEPTION_ARRAY_EXPECTED);
- } elseif (count($pathFile) != 2) {
- // Invalid ID returned!
- throw new InvalidArrayCountException(array($this, "pathFile", count($pathFile), 2), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
- }
+ private function writeDataArrayToFqfn ($fqfn, array $dataArray) {
+ // Get a file pointer instance
+ $fileInstance = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fqfn, 'w');
- // Create full path name
- $pathName = $this->getSavePath() . $pathFile[0];
+ // Serialize and compress it
+ $compressedData = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($dataArray));
- // Nothing cached, so let's create a FQFN first
- $fqfn = sprintf("%s/%s.%s", $pathName, $pathFile[1], $this->getFileExtension());
- $this->setLastFile($fqfn);
- }
+ // Write this data BASE64 encoded to the file
+ $fileInstance->writeToFile(base64_encode($compressedData));
- // Return repaired FQFN
- return $fqfn;
+ // Close the file pointer
+ $fileInstance->closeFile();
}
/**
- * Private method for re-gathering the contents of a given file
+ * Getter for table information file contents or an empty if the info file was not created
*
- * @param $contents The (maybe) already cached contents as an array
- * @param $fqfn The current FQFN we shall validate
- * @return $contents The repaired contents from the given file
+ * @param $dataSetInstance An instance of a database set class
+ * @return $infoArray An array with all table informations
*/
- private function repairContents ($contents, $fqfn) {
- // Is there some content and header (2 indexes) in?
- if ((!is_array($contents)) || (count($contents) != 2) || (!isset($contents['header'])) || (!isset($contents['data']))) {
- // No content found so load the file again
- $contents = $inputHandler->loadFileContents($fqfn);
-
- // And remember all data for later usage
- $this->setLastContents($contents);
+ private function getContentsFromTableInfoFile (StoreableCriteria $dataSetInstance) {
+ // Default content is no data
+ $infoArray = array();
+
+ // Create FQFN for getting the table information file
+ $fqfn = $this->getSavePath() . $dataSetInstance->getTableName() . '/info.' . $this->getFileExtension();
+
+ // Get the file contents
+ try {
+ $infoArray = $this->getDataArrayFromFile($fqfn);
+ } catch (FileNotFoundException $e) {
+ // Not found, so ignore it here
}
- // Return the repaired contents
- return $contents;
+ // ... and return it
+ return $infoArray;
}
/**
- * Makes sure that the database connection is alive
+ * Creates the table info file from given dataset instance
*
+ * @param $dataSetInstance An instance of a database set class
* @return void
*/
- public function connectToDatabase () {
- // @TODO Do some checks on the database directory and files here
+ private function createTableInfoFile (StoreableCriteria $dataSetInstance) {
+ // Create FQFN for creating the table information file
+ $fqfn = $this->getSavePath() . $dataSetInstance->getTableName() . '/info.' . $this->getFileExtension();
+
+ // Get the data out from dataset in a local array
+ $this->tableInfo[$dataSetInstance->getTableName()] = array(
+ 'primary' => $dataSetInstance->getPrimaryKey(),
+ 'created' => time(),
+ 'last_updated' => time()
+ );
+
+ // Write the data to the file
+ $this->writeDataArrayToFqfn($fqfn, $this->tableInfo[$dataSetInstance->getTableName()]);
}
/**
- * Loads data saved with saveObject from the database and re-creates a
- * full object from it.
- * If limitObject() was called before a new object ObjectContainer with
- * all requested attributes will be returned instead.
+ * Updates the primary key information or creates the table info file if not found
*
- * @return Object The fully re-created object or instance to
- * ObjectContainer
- * @throws SavePathIsEmptyException If the given save path is an
- * empty string
- * @throws SavePathIsNoDirectoryException If the save path is no
- * path (e.g. a file)
- * @throws SavePathReadProtectedException If the save path is read-
- * protected
- * @throws SavePathWriteProtectedException If the save path is write-
- * protected
+ * @param $dataSetInstance An instance of a database set class
+ * @return void
*/
- public function loadObject () {
- // Already connected? Then abort here
- if ($this->alreadyConnected === true) return true;
-
- // Get the save path
- $savePath = $this->getSavePath();
-
- if (empty($savePath)) {
- // Empty string
- throw new SavePathIsEmptyException($dbInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- } elseif (!is_dir($savePath)) {
- // Is not a dir
- throw new SavePathIsNoDirectoryException($savePath, self::EXCEPTION_INVALID_PATH_NAME);
- } elseif (!is_readable($savePath)) {
- // Path not readable
- throw new SavePathReadProtectedException($savePath, self::EXCEPTION_READ_PROTECED_PATH);
- } elseif (!is_writeable($savePath)) {
- // Path not writeable
- throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH);
+ private function updatePrimaryKey (StoreableCriteria $dataSetInstance) {
+ // Get the information array from lower method
+ $infoArray = $this->getContentsFromTableInfoFile($dataSetInstance);
+
+ // Is the primary key there?
+ if (!isset($this->tableInfo['primary'])) {
+ // Then create the info file
+ $this->createTableInfoFile($dataSetInstance);
+ } elseif (($this->getConfigInstance()->readConfig('db_update_primary_forced') === "Y") && ($dataSetInstance->getPrimaryKey() != $this->tableInfo['primary'])) {
+ // Set the array element
+ $this->tableInfo[$dataSetInstance->getTableName()]['primary'] = $dataSetInstance->getPrimaryKey();
+
+ // Update the entry
+ $this->updateTableInfoFile($dataSetInstance);
}
+ }
- // "Connection" established... ;-)
- $this->alreadyConnected = true;
+ /**
+ * Makes sure that the database connection is alive
+ *
+ * @return void
+ * @todo Do some checks on the database directory and files here
+ */
+ public function connectToDatabase () {
}
/**
);
// Initialize limit/skip
- $limitFound = 0; $skipFound = 0;
+ $limitFound = 0;
+ $skipFound = 0;
// Read the directory with some exceptions
- while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn"))) && ($limitFound < $criteriaInstance->getLimit())) {
- // Open this file for reading
- $filePointer = FrameworkFileInputPointer::createFrameworkFileInputPointer($pathName . $dataFile);
-
- // Get the raw data and BASE64-decode it
- $compressedData = base64_decode($filePointer->readLinesFromFile());
+ while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) && ($limitFound < $criteriaInstance->getLimit())) {
+ // Does the extension match?
+ if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
+ // Skip this file!
+ continue;
+ }
- // Close the file and throw the instance away
- $filePointer->closeFile();
- unset($filePointer);
-
- // Decompress it
- $serializedData = $this->getCompressorChannel()->getCompressor()->decompressStream($compressedData);
-
- // Unserialize it
- $dataArray = unserialize($serializedData);
+ // Read the file
+ $dataArray = $this->getDataArrayFromFile($pathName . $dataFile);
// Is this an array?
if (is_array($dataArray)) {
} // END - if
// Entry found!
- $resultData['rows'][] = $dataArray;
+ $resultData['rows'][] = $dataArray;
$limitFound++;
break;
} // END - if
} // END - foreach
- } // END - if
+ } else {
+ // Throw an exception here
+ throw new SqlException(array($this, sprintf("File '%s' contains invalid data.", $dataFile), self::DB_CODE_DATA_FILE_CORRUPT), self::EXCEPTION_SQL_QUERY);
+ }
} // END - while
// Close directory and throw the instance away
);
// Try to save the request away
+ try {
+ // Write the data away
+ $this->writeDataArrayToFqfn($fqfn, $dataSetInstance->getCriteriaArray());
+
+ // Update the primary key
+ $this->updatePrimaryKey($dataSetInstance);
+
+ // Reset last error message and exception
+ $this->resetLastError();
+ } catch (FrameworkException $e) {
+ // Catch all exceptions and store them in last error
+ $this->lastException = $e;
+ $this->lastError = $e->getMessage();
+
+ // Throw an SQL exception
+ throw new SqlException (array($this, sprintf("Cannot write data to table '%s'", $tableName), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
+ }
+ }
+
+ /**
+ * "Updates" a data set instance with a database layer
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ * @throws SqlException If an SQL error occurs
+ */
+ public function queryUpdateDataSet (StoreableCriteria $dataSetInstance) {
+ // Create full path name
+ $pathName = $this->getSavePath() . $dataSetInstance->getTableName() . '/';
+
+ // Try all the requests
try {
// Get a file pointer instance
- $filePointer = FrameworkFileOutputPointer::createFrameworkFileOutputPointer($fqfn, 'w');
+ $directoryInstance = FrameworkDirectoryPointer::createFrameworkDirectoryPointer($pathName);
+
+ // Initialize limit/skip
+ $limitFound = 0;
+ $skipFound = 0;
// Get the criteria array from the dataset
$criteriaArray = $dataSetInstance->getCriteriaArray();
- // Serialize and compress it
- $compressedData = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($criteriaArray));
+ // Get search criteria
+ $searchInstance = $dataSetInstance->getSearchInstance();
+
+ // Read the directory with some exceptions
+ while (($dataFile = $directoryInstance->readDirectoryExcept(array(".", "..", ".htaccess", ".svn", "info." . $this->getFileExtension()))) && ($limitFound < $searchInstance->getLimit())) {
+ // Does the extension match?
+ if (substr($dataFile, -(strlen($this->getFileExtension()))) !== $this->getFileExtension()) {
+ // Skip this file!
+ continue;
+ }
+
+ // Open this file for reading
+ $dataArray = $this->getDataArrayFromFile($pathName . $dataFile);
+
+ // Is this an array?
+ if (is_array($dataArray)) {
+ // Search in the criteria with FMFW (First Matches, First Wins)
+ foreach ($dataArray as $key=>$value) {
+ // Get criteria element
+ $criteria = $searchInstance->getCriteriaElemnent($key);
+
+ // Is the criteria met?
+ if ((!is_null($criteria)) && ($criteria == $value)) {
+
+ // Shall we skip this entry?
+ if ($searchInstance->getSkip() > 0) {
+ // We shall skip some entries
+ if ($skipFound < $searchInstance->getSkip()) {
+ // Skip this entry
+ $skipFound++;
+ break;
+ } // END - if
+ } // END - if
+
+ // Entry found, so update it
+ foreach ($criteriaArray as $criteriaKey=>$criteriaValue) {
+ $dataArray[$criteriaKey] = $criteriaValue;
+ } // END - foreach
+
+ // Write the data to a local file
+ $this->writeDataArrayToFqfn($pathName . $dataFile, $dataArray);
- // Write this data BASE64 encoded to the file
- $filePointer->writeToFile(base64_encode($compressedData));
+ // Count it
+ $limitFound++;
+ break;
+ } // END - if
+ } // END - foreach
+ } // END - if
+ } // END - while
// Close the file pointer
- $filePointer->closeFile();
+ $directoryInstance->closeDirectory();
+
+ // Update the primary key
+ $this->updatePrimaryKey($dataSetInstance);
// Reset last error message and exception
$this->resetLastError();
$this->lastError = $e->getMessage();
// Throw an SQL exception
- throw new SqlException (array($this, sprintf("Cannot write data to table '%s'", $tableName), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
+ throw new SqlException (array($this, sprintf("Cannot write data to table '%s'", $dataSetInstance->getTableName()), self::DB_CODE_TABLE_UNWRITEABLE), self::EXCEPTION_SQL_QUERY);
}
}
+
+ /**
+ * Getter for primary key of specified table or if not found null will be
+ * returned. This must be database-specific.
+ *
+ * @param $tableName Name of the table we need the primary key from
+ * @return $primaryKey Primary key column of the given table
+ */
+ public function getPrimaryKeyOfTable ($tableName) {
+ // Default key is null
+ $primaryKey = null;
+
+ // Does the table information exist?
+ if (isset($this->tableInfo[$tableName])) {
+ // Then return the primary key
+ $primaryKey = $this->tableInfo[$tableName]['primary'];
+ } // END - if
+
+ // Return the column
+ return $primaryKey;
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * A database wrapper for news classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class NewsDatabaseWrapper extends BaseDatabaseWrapper {
+ // Constants for database table names
+ const DB_TABLE_NEWS = "news";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct() {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database wrapper by a provided user class
+ *
+ * @return $wrapperInstance An instance of the created wrapper class
+ */
+ public final static function createNewsDatabaseWrapper () {
+ // Get a new instance
+ $wrapperInstance = new NewsDatabaseWrapper();
+
+ // Set (primary!) table name
+ $wrapperInstance->setTableName(self::DB_TABLE_NEWS);
+
+ // Return the instance
+ return $wrapperInstance;
+ }
+}
+
+// [EOF]
+?>
/**
* A database wrapper for the User class
*
- * @see DatabaseFrontendInterface - An interface for database frontends (front-end to the application)
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class UserDatabaseWrapper extends BaseDatabaseWrapper {
- /**
- * Cache instance
- */
- private $cacheInstance = null;
-
// Constants for exceptions
- const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x070;
+ const EXCEPTION_CLIENT_USERNAME_NOT_FOUND = 0x180;
// Constants for database columns
- const DB_COLUMN_USERNAME = "username";
- const DB_COLUMN_EMAIL = "email";
+ const DB_COLUMN_USERNAME = "username";
+ const DB_COLUMN_EMAIL = "email";
+ const DB_COLUMN_CONFIRM_HASH = "confirm_hash";
+ const DB_COLUMN_USER_STATUS = "user_status";
// Constants for database table names
const DB_TABLE_USER = "user";
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Database wrapper for user objects");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Get a new instance
$wrapperInstance = new UserDatabaseWrapper();
- // Initialize the cache instance
- $wrapperInstance->initCacheInstance();
+ // Set (primary!) table name
+ $wrapperInstance->setTableName(self::DB_TABLE_USER);
// Return the instance
return $wrapperInstance;
}
- /**
- * Initializes the cache instance with a new object
- *
- * @return void
- */
- protected function initCacheInstance () {
- // Set the new instance
- $this->cacheInstance = CacheFactory::getFactory()->createConfiguredCache();
- }
-
- /**
- * Do a "select" query on the user table with the given search criteria and
- * store it in cache for later usage
- *
- * @param $criteriaInstance An instance of a Criteria class
- * @return $resultInstance An instance of a database result class
- */
- public function doSelectByCriteria (Criteria $criteriaInstance) {
- // First get a key suitable for our cache and extend it with this class name
- $cacheKey = sprintf("%s@%s",
- $this->__toString(),
- $criteriaInstance->getCacheKey()
- );
-
- // Does this key exists in cache?
- if ($this->cacheInstance->offsetExists($cacheKey)) {
- // Then use this result
- $result = $cacheInstance->offsetGet($cacheKey);
- } else {
- // Now it's time to ask the database layer for this select statement
- $result = $this->getDatabaseInstance()->doSelectByTableCriteria(self::DB_TABLE_USER, $criteriaInstance);
-
- // Cache the result if not null
- if (!is_null($result)) {
- // A valid result has returned from the database layer
- $this->cacheInstance->offsetSet($cacheKey, $result);
- } else {
- // This invalid result must be wrapped
- $result = array(
- 'status' => "invalid",
- 'exception' => $this->getDatabaseInstance()->getLastException()
- );
- }
- }
-
- // Create an instance of a DatabaseResult class with the given result
- $resultInstance = DatabaseResult::createDatabaseResult($result);
-
- // And return the instance
- return $resultInstance;
- }
-
/**
* Handles inserting the registration data from a registration instance into the database
*
*/
public function insertRegistrationObject (UserRegister $registrationInstance) {
// Generate a data set for the request
- $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class');
- $dataSetInstance->setTableName(self::DB_TABLE_USER);
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER));
+
+ // Set the primary key
+ $dataSetInstance->setUniqueKey('username');
// Add registration elements to the dataset
$registrationInstance->addElementsToDataSet($dataSetInstance);
// "Insert" this request instance completely into the database
$this->getDatabaseInstance()->queryInsertDataSet($dataSetInstance);
}
+
+ /**
+ * Updates an user database entry with given result
+ *
+ * @param $resultInstance An instance of a Updateable database result
+ * @return void
+ */
+ public function doUpdateByResult (UpdateableResult $resultInstance) {
+ // Generate a data set object
+ $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_USER));
+
+ // Add all update criteria to the database set
+ $resultInstance->addElementsToDataSet($dataSetInstance);
+
+ // Add seach criteria
+ $dataSetInstance->setSearchInstance($resultInstance->getSearchInstance());
+
+ // Set the primary key
+ $dataSetInstance->setUniqueKey('username');
+
+ // "Update" this request with the database
+ $this->getDatabaseInstance()->queryUpdateDataSet($dataSetInstance);
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * A database wrapper for user points classes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserPointsDatabaseWrapper extends BaseDatabaseWrapper {
+ // Constants for database table names
+ const DB_TABLE_USER_POINTS = "user_points";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct() {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this database wrapper by a provided user class
+ *
+ * @return $wrapperInstance An instance of the created wrapper class
+ */
+ public final static function createUserPointsDatabaseWrapper () {
+ // Get a new instance
+ $wrapperInstance = new UserPointsDatabaseWrapper();
+
+ // Set (primary!) table name
+ $wrapperInstance->setTableName(self::DB_TABLE_USER_POINTS);
+
+ // Return the instance
+ return $wrapperInstance;
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Debug output for the console");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
* @return void
*/
public final function outputStream ($output) {
- print html_entity_decode(strip_tags($output));
+ print(html_entity_decode(strip_tags($output)));
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Debug output to error_log()");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Debug output for webpages");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
* @return void
*/
public final function outputStream ($output) {
- trigger_error($output);
+ // Strip out <br />
+ $output = str_replace("<br />", "", $output);
+ print($output."<br />\n");
}
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Class for "limiting" other classes. See description for details.");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set object description
- $this->setObjectDescription("Factory for cache objects");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
*/
public function createConfiguredCache () {
// Read the config entry
- $cacheType = $this->getConfigInstance()->readConfig("cache_class");
+ $cacheType = $this->getConfigInstance()->readConfig('cache_class');
// And get a new instance
$cacheInstance = ObjectFactory::createObjectByName($cacheType);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* Protected constructor
*
- * @param $class Name of the real class (not BaseFactory)
+ * @param $className Name of the real class (not BaseFactory)
* @return void
*/
- protected function __construct ($class) {
+ protected function __construct ($className) {
// Call parent constructor
- parent::__construct($class);
+ parent::__construct($className);
// Clean up a little
$this->removeNumberFormaters();
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set object description
- $this->setObjectDescription("Simple generic object factory");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Factory for webpages with news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
class UserAuthFilter extends BaseFilter implements Filterable {
// Exception constants
- const EXCEPTION_AUTH_DATA_INVALID = 0x0a0;
+ const EXCEPTION_AUTH_DATA_INVALID = 0x1b0;
/**
* The login method we shall choose
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A user authorization filter");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
* @throws UserAuthorizationException If the auth login was not found or if it was invalid
+ * @throws UserPasswordMismatchException If the supplied password hash does not match
+ * @throws ClassNotFoundException If the user (guest/member) class was not found
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// Then get an auth instance for checking and updating the auth cookies
// Stop here
throw new UserAuthorizationException($this, self::EXCEPTION_AUTH_DATA_INVALID);
- }
-
- // Destroy safely the auth instance
- unset($authInstance);
+ } // END - if
+
+ // Regular user account
+ $className = $this->getConfigInstance()->readConfig('user_class');
+ $methodName = 'createMemberByUserName';
+
+ // Now, try to get a user or guest instance
+ if ($authLogin == $this->getConfigInstance()->readConfig('guest_login_user')) {
+ // Set class
+ $className = $this->getConfigInstance()->readConfig('guest_class');
+ $methodName = 'createGuestByUserName';
+ } // END - if
+
+ // Does the guest class exist?
+ if (!class_exists($className)) {
+ // Then abort here
+ throw new ClassNotFoundException (array($this, $className), self::EXCEPTION_CLASS_NOT_FOUND);
+ } // END - if
+
+ // Now try the dynamic login
+ $userInstance = call_user_func_array(array($className, $methodName), array($authLogin));
+
+ // Is the password correct?
+ if ($userInstance->getPasswordHash() !== $authHash) {
+ // Mismatching password
+ throw new UserPasswordMismatchException(array($this, $userInstance), BaseUser::EXCEPTION_USER_PASS_MISMATCH);
+ } // END - if
+
+ // Remember auth and user instances in registry
+ Registry::getRegistry()->addInstance('auth', $authInstance);
+ Registry::getRegistry()->addInstance('user', $userInstance);
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for detecting email changes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class EmailChangeFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createEmailChangeFilter () {
+ // Get a new instance
+ $filterInstance = new EmailChangeFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo Implement email change of the user here. HINT: Use the User class!
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get both emails
+ $email1 = $requestInstance->getRequestElement('email1');
+ $email2 = $requestInstance->getRequestElement('email2');
+
+ // Is only first email set?
+ if ((!empty($email1)) && (empty($email2))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Email 2 is empty
+ $responseInstance->addFatalMessage('email2_empty');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Is only second email set?
+ if ((empty($email1)) && (!empty($email2))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Email 1 is empty
+ $responseInstance->addFatalMessage('email1_empty');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Do both match?
+ if ($email1 != $email2) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Emails are mismatching
+ $responseInstance->addFatalMessage('emails_mismatch');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Now, get a user instance for comparison
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Get the email field
+ $userEmail = $userInstance->getField('email');
+
+ // Are they different?
+ if ($userEmail != $email1) {
+ // Update the "new_email" field
+ $this->partialStub("Unfinished part.");
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for password change detection
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PasswordChangeFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createPasswordChangeFilter () {
+ // Get a new instance
+ $filterInstance = new PasswordChangeFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo Finished updating user password hash here. HINT: Use the User class again.
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get both passwords
+ $pass1 = $requestInstance->getRequestElement('pass1');
+ $pass2 = $requestInstance->getRequestElement('pass2');
+
+ // Is only first email set?
+ if ((!empty($pass1)) && (empty($pass2))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Email 2 is empty
+ $responseInstance->addFatalMessage('pass2_empty');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Is only second pass set?
+ if ((empty($pass1)) && (!empty($pass2))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Email 1 is empty
+ $responseInstance->addFatalMessage('pass1_empty');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Do both match?
+ if ($pass1 != $pass2) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Emails are mismatching
+ $responseInstance->addFatalMessage('pass_mismatch');
+
+ // Stop processing here
+ return false;
+ } // END - if
+
+ // Now, get a user instance for comparison
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Update the "password" field
+ $this->partialStub("Unfinished part.");
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for checking if rules where accepted");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("A concrete filter");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
class BaseFilter extends BaseFrameworkSystem {
// Exception constants
- const EXCEPTION_FILTER_CHAIN_ABORTED = 0x090;
+ const EXCEPTION_FILTER_CHAIN_ABORTED = 0x1a0;
/**
* Protected constructor
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("A filter chain class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for checking if the "encrypt" value is set and fine
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class CaptchaEncryptFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createCaptchaEncryptFilter () {
+ // Get a new instance
+ $filterInstance = new CaptchaEncryptFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @throws EncryptMissingException If the "encrypt" value is not set
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get "encrypt" string barely from the request
+ $encryptRequest = $requestInstance->getRequestElement('encrypt');
+
+ // Is it there?
+ if (is_null($encryptRequest)) {
+ // Not found, so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Throw exception
+ throw new EncryptMissingException($this, CryptoHelper::EXCEPTION_ENCRYPT_MISSING);
+ } // END - if
+
+ // Decode it fully
+ $encryptDecoded = base64_decode(str_replace(" ", "+", urldecode($encryptRequest)));
+
+ // Get a crypto helper and decrypt the string
+ $decryptedString = ObjectFactory::createObjectByConfiguredName('crypto_class')->decryptString($encryptDecoded);
+
+ // Is it the expected length?
+ if (strlen($decryptedString) != $this->getConfigInstance()->readConfig('captcha_string_length')) {
+ // Not found, so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Throw exception
+ throw new EncryptInvalidLengthException($this, CryptoHelper::EXCEPTION_ENCRYPT_INVALID);
+ } // END - if
+
+ // Write it to the request
+ $requestInstance->setRequestElement('decrypted', $decryptedString);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for checking if the username "guest" has been choosen as configured.
+ * If so the password will be set to the configured password.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserNameIsGuestFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserNameIsGuestFilter () {
+ // Get a new instance
+ $filterInstance = new UserNameIsGuestFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get username from request
+ $userName = $requestInstance->getRequestElement('username');
+
+ // Does the user name match the guest login?
+ if ($userName == $this->getConfigInstance()->readConfig('guest_login_user')) {
+ // Then set the password to the configured password
+ $requestInstance->setRequestElement('pass1', $this->getConfigInstance()->readConfig('guest_login_passwd'));
+ $requestInstance->setRequestElement('pass2', $this->getConfigInstance()->readConfig('guest_login_passwd'));
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for downloading news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Get a news instance
$newsInstance = WebNewsFactory::createFactoryByRequest($requestInstance);
- // TODO Need to extend/rewrite this
- $this->partialStub("Unfinished work.");
+ // Store the news instance in registry
+ Registry::getRegistry()->addInstance('news', $newsInstance);
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for processing news");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
* @param $requestInstance An instance of a class with an Requestable interface
* @param $responseInstance An instance of a class with an Responseable interface
* @return void
+ * @todo Unfinished stub, add functionality here
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
- $this->partialStub("Unfinished work.");
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A null filter");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A filter for updating the user account status to confirmed
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserStatusConfimedUpdateFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserStatusConfimedUpdateFilter () {
+ // Get a new instance
+ $filterInstance = new UserStatusConfimedUpdateFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Get "confirmed" status from config
+ $confirmed = $this->getConfigInstance()->readConfig('user_status_confirmed');
+
+ // Update the user status to "confirmed" here
+ $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS, $confirmed);
+
+ // Wipe out the confirm hash for extra security
+ $userInstance->updateDatabaseField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH, "");
+
+ // Write all updates to the database
+ $userInstance->flushPendingUpdates();
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for updating the user account like last activity, last action
+ * performed and so on.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserUpdateFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserUpdateFilter () {
+ // Get a new instance
+ $filterInstance = new UserUpdateFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @todo Add more user updates here
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Now update last activity
+ $userInstance->updateLastActivity($requestInstance);
+
+ // Update auth data as well
+ $authInstance = Registry::getRegistry()->getInstance('auth');
+ $authInstance->updateAuthData();
+
+ // Write all updates to the database
+ $userInstance->flushPendingUpdates();
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for Email validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
$email = $requestInstance->getRequestElement('email');
// Is the Email set?
- if ((is_null($email)) || ($this->getConfigInstance()->readConfig('register_email_unique') == "Y")) {
+ if ((is_null($email)) || ($this->getConfigInstance()->readConfig('register_email_unique') === "Y")) {
// Try it again
$email1 = $requestInstance->getRequestElement('email1');
$email2 = $requestInstance->getRequestElement('email2');
$userInstance->setEmailAddress($email);
} else {
// If this instance is created then the username *does* exist
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByEmail"), array($email));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByEmail'), array($email));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for Password validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// Is the password empty?
if (empty($password1)) {
// Add a message to the response
- $responseInstance->addFatalMessage('password1_empty');
+ $responseInstance->addFatalMessage('pass1_empty');
} // END - if
// Is the confirmation empty?
if (empty($password2)) {
// Add a message to the response
- $responseInstance->addFatalMessage('password2_empty');
+ $responseInstance->addFatalMessage('pass2_empty');
} // END - if
// Abort here
$requestInstance->requestIsValid(false);
// Add a message to the response
- $responseInstance->addFatalMessage('passwords_mismatching');
+ $responseInstance->addFatalMessage('pass_mismatch');
// Abort here
return false;
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("A filter for username validation");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
// If this instance is created then the username *does* exist
try {
// Get a new instance
- $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), "createUserByUsername"), array($userName));
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByUsername'), array($userName));
// Remember this user instance in our registry for later usage
$registry->addInstance('user', $userInstance);
if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
// This username is still available
$alreadyTaken = false;
- }
+ } // END - if
// Return the result
return $alreadyTaken;
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating the password. This filter may intercept
+ * the filter chain if no password is given or the password is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class AccountPasswordVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createAccountPasswordVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new AccountPasswordVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @throws AccountPasswordMismatchException If the account password does not match
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get password
+ $password = $requestInstance->getRequestElement('pass_old');
+
+ // Is the password still not set?
+ if (is_null($password)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('pass_old_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($password)) {
+ // Password is empty
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('pass_old_empty');
+
+ // Abort here
+ return false;
+ }
+
+ // Get a user instance
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Get old hash
+ $oldHash = $userInstance->getField('pass_hash');
+
+ // Get an encryption helper and encrypt the password
+ $passHash = ObjectFactory::createObjectByConfiguredName('crypto_class')->hashString($password, $oldHash);
+
+ // Does it match?
+ if ($oldHash != $passHash) {
+ // Throw an exception here to stop the proccessing
+ throw new AccountPasswordMismatchException($this, BaseUser::EXCEPTION_USER_PASS_MISMATCH);
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for checking if the the supplied confirmation code is valid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ConfirmCodeVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createConfirmCodeVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new ConfirmCodeVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ * @throws NullPointerException If the user instance from registry is null
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get confirmation code from request
+ $confirmCode = $requestInstance->getRequestElement('confirm');
+
+ // Is this code set?
+ if (is_null($confirmCode)) {
+ // Is not in request
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('confirm_code_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($confirmCode)) {
+ // Email is empty
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('confirm_code_empty');
+
+ // Abort here
+ return false;
+ }
+
+ // Get a user instance from registry
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Is the instance there?
+ if (is_null($userInstance)) {
+ // Throw an exception here
+ throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Get the confirm code from user for comparison
+ $userCode = $userInstance->getField(UserDatabaseWrapper::DB_COLUMN_CONFIRM_HASH);
+
+ // Do we have the same code or different?
+ if ($userCode != $confirmCode) {
+ // Email is empty
+ $requestInstance->requestIsValid(false);
+
+ // Redirect to error page
+ $responseInstance->redirectToConfiguredUrl('confirm_code_invalid_url');
+
+ // Stop processing here
+ exit;
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating code graphical CAPTCHAs with hashes
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class GraphicalCodeCaptchaVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createGraphicalCodeCaptchaVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new GraphicalCodeCaptchaVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get the captcha code
+ $captchaCode = $requestInstance->getRequestElement('c_code');
+
+ // Is this set?
+ if (is_null($captchaCode)) {
+ // Not set so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Add fatal message
+ $responseInstance->addFatalMessage('captcha_code_unset');
+
+ // Skip further processing
+ return false;
+ } elseif (empty($captchaCode)) {
+ // Empty value so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Add fatal message
+ $responseInstance->addFatalMessage('captcha_code_empty');
+
+ // Skip further processing
+ return false;
+ }
+
+ // Get the hash as well
+ $captchaHash = $requestInstance->getRequestElement('hash');
+
+ // Is this set?
+ if (is_null($captchaHash)) {
+ // Not set so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Add fatal message
+ $responseInstance->addFatalMessage('captcha_hash_unset');
+
+ // Skip further processing
+ return false;
+ } elseif (empty($captchaHash)) {
+ // Empty value so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Add fatal message
+ $responseInstance->addFatalMessage('captcha_hash_empty');
+
+ // Skip further processing
+ return false;
+ }
+
+ // Now, both are set hash the given one. First get a crypto instance
+ $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Then hash the code
+ $hashedCode = $cryptoInstance->hashString($captchaCode, $captchaHash);
+
+ // Is this CAPTCHA valid?
+ if ($hashedCode != $captchaHash) {
+ // Not the same so request is invalid
+ $requestInstance->requestIsValid(false);
+
+ // Add fatal message
+ $responseInstance->addFatalMessage('captcha_hash_mismatch');
+ } // END - not the same!
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating the guest password. This filter may intercept
+ * the filter chain if no password is given or the password is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PasswordGuestVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createPasswordGuestVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new PasswordGuestVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get password
+ $password = $requestInstance->getRequestElement('passwd');
+
+ // Is the password still not set?
+ if (is_null($password)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('password_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($password)) {
+ // Password is empty
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('password_empty');
+
+ // Abort here
+ return false;
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for validating the password. This filter may intercept
+ * the filter chain if no password is given or the password is invalid
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PasswordVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createPasswordVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new PasswordVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get password
+ $password = $requestInstance->getRequestElement('pass');
+
+ // Is the password still not set?
+ if (is_null($password)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('password_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($password)) {
+ // Password is empty
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('password_empty');
+
+ // Abort here
+ return false;
+ }
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for verfying the guest username. This filter may intercept the
+ * filter chain if no username is given or if the supplied username has an
+ * invalid form. It could also intercept the filter chain if the username was
+ * not found.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserGuestVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserGuestVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new UserGuestVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get username from request
+ $userName = $requestInstance->getRequestElement('user');
+
+ // Is the username set?
+ if (is_null($userName)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($userName)) {
+ // Empty field!
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_empty');
+
+ // Abort here
+ return false;
+ } elseif (!$this->ifUserGuestIsTaken($userName)) {
+ // Username is already taken
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_not_found');
+
+ // Abort here
+ return false;
+ }
+
+ // Set the element for compatiblity reasons
+ $requestInstance->setRequestElement('username', $userName);
+ }
+
+ /**
+ * Check wether the username as already been taken
+ *
+ * @param $userName Username to check for existence
+ * @return $alreadyTaken Wether the username has been taken
+ */
+ private function ifUserGuestIsTaken ($userName) {
+ // Default is already taken
+ $alreadyTaken = true;
+
+ // Initialize instance
+ $userInstance = null;
+
+ // Get a registry instance
+ $registry = Registry::getRegistry();
+
+ // Is the user already there?
+ if ($registry->instanceExists('user')) {
+ // Use the instance for checking for the email
+ $userInstance = $registry->getInstance('user');
+ $userInstance->setUserGuest($userName);
+ } else {
+ // If this instance is created then the username *does* exist
+ try {
+ // Get a new instance
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('guest_class'), 'createGuestByUsername'), array($userName));
+
+ // Remember this user instance in our registry for later usage
+ $registry->addInstance('user', $userInstance);
+ } catch (UsernameMissingException $e) {
+ // User was not found
+ }
+ }
+
+ // Does the username exist?
+ if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
+ // This username is still available
+ $alreadyTaken = false;
+ }
+
+ // Return the result
+ return $alreadyTaken;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A concrete filter for verfying the username. This filter may intercept the
+ * filter chain if no username is given or if the supplied username has an
+ * invalid form. It could also intercept the filter chain if the username was
+ * not found.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserNameVerifierFilter extends BaseFilter implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserNameVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new UserNameVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get username from request
+ $userName = $requestInstance->getRequestElement('username');
+
+ // Is the username set?
+ if (is_null($userName)) {
+ // Not found in form so stop the filtering process
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_unset');
+
+ // Abort here
+ return false;
+ } elseif (empty($userName)) {
+ // Empty field!
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_empty');
+
+ // Abort here
+ return false;
+ } elseif (!$this->ifUserNameIsTaken($userName)) {
+ // Username is already taken
+ $requestInstance->requestIsValid(false);
+
+ // Add a message to the response
+ $responseInstance->addFatalMessage('username_not_found');
+
+ // Abort here
+ return false;
+ }
+ }
+
+ /**
+ * Check wether the username as already been taken
+ *
+ * @param $userName Username to check for existence
+ * @return $alreadyTaken Wether the username has been taken
+ */
+ private function ifUserNameIsTaken ($userName) {
+ // Default is already taken
+ $alreadyTaken = true;
+
+ // Initialize instance
+ $userInstance = null;
+
+ // Get a registry instance
+ $registry = Registry::getRegistry();
+
+ // Is the user already there?
+ if ($registry->instanceExists('user')) {
+ // Use the instance for checking for the email
+ $userInstance = $registry->getInstance('user');
+ $userInstance->setUserName($userName);
+ } else {
+ // If this instance is created then the username *does* exist
+ try {
+ // Get a new instance
+ $userInstance = call_user_func_array(array($this->getConfigInstance()->readConfig('user_class'), 'createMemberByUsername'), array($userName));
+
+ // Remember this user instance in our registry for later usage
+ $registry->addInstance('user', $userInstance);
+ } catch (UsernameMissingException $e) {
+ // User was not found
+ }
+ }
+
+ // Does the username exist?
+ if ((is_null($userInstance)) || (!$userInstance->ifUsernameExists())) {
+ // This username is still available
+ $alreadyTaken = false;
+ } // END - if
+
+ // Return the result
+ return $alreadyTaken;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for checking if the user status is GUEST or CONFIRMED
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserStatusVerifierFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserStatusVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new UserStatusVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get a user instance for comparison
+ $userInstance = Registry::getRegistry()->getInstance('user');
+
+ // Is the user account confirmed?
+ if (($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) != $this->getConfigInstance()->readConfig('user_status_confirmed')) && ($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) != $this->getConfigInstance()->readConfig('user_status_guest'))) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Redirect to configured URL
+ $responseInstance->redirectToConfiguredUrl('login_user_status_url');
+
+ // Stop processing here
+ exit();
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A filter for checking if the user status is UNCONFIRMED
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserUnconfirmedVerifierFilter extends BaseFrameworkSystem implements Filterable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this filter class
+ *
+ * @return $filterInstance An instance of this filter class
+ */
+ public final static function createUserUnconfirmedVerifierFilter () {
+ // Get a new instance
+ $filterInstance = new UserUnconfirmedVerifierFilter();
+
+ // Return the instance
+ return $filterInstance;
+ }
+
+ /**
+ * Executes the filter with given request and response objects
+ *
+ * @param $requestInstance An instance of a class with an Requestable interface
+ * @param $responseInstance An instance of a class with an Responseable interface
+ * @return void
+ */
+ public function execute (Requestable $requestInstance, Responseable $responseInstance) {
+ // Get member class
+ $userClass = $this->getConfigInstance()->readConfig('user_class');
+
+ // Get a user instance for comparison
+ $userInstance = call_user_func_array(array($userClass, 'createMemberByRequest'), array($requestInstance));
+
+ // Is the email address valid?
+ if (!$userInstance->ifEmailAddressExists()) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Redirect to configured URL
+ $responseInstance->redirectToConfiguredUrl('user_unconfirmed_email_missing_url');
+
+ // Stop processing here
+ exit();
+ } // END - if
+
+ // Is the user account confirmed?
+ if ($userInstance->getField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) != $this->getConfigInstance()->readConfig('user_status_unconfirmed')) {
+ // Request is invalid!
+ $requestInstance->requestIsValid(false);
+
+ // Redirect to configured URL
+ $responseInstance->redirectToConfiguredUrl('user_not_unconfirmed_url');
+
+ // Stop processing here
+ exit();
+ } // END - if
+
+ // Add this instance to registry
+ Registry::getRegistry()->addInstance('user', $userInstance);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A solveable CAPTCHA
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ???Captcha extends BaseCaptcha implements SolveableCaptcha {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this captcha class
+ *
+ * @param $templateInstance An instance of a template engine
+ * @param $extraInstance An extra instance, just for better hash data
+ * @return $captchaInstance An instance of this captcha class
+ */
+ public final static function create???Captcha (CompileableTemplate $templateInstance, FrameworkInterface $extraInstance = null) {
+ // Get a new instance
+ $captchaInstance = new ???Captcha();
+
+ // Set template instance
+ $captchaInstance->setTemplateInstance($templateInstance);
+
+ // Initialize the RNG
+ $captchaInstance->initializeRandomNumberGenerator($extraInstance);
+
+ // Return the instance
+ return $captchaInstance;
+ }
+
+ /**
+ * Initiates the CAPTCHA
+ *
+ * @return void
+ */
+ public function initiateCaptcha () {
+ $this->partialStub("Please implement this method.");
+ }
+
+ /**
+ * Render the CAPTCHA code
+ *
+ * @return void
+ */
+ public function renderCode () {
+ $this->partialStub("Please implement this method.");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general captcha
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseCaptcha extends BaseHelper {
+ /**
+ * A helper instance for the form
+ */
+ private $helperInstance = null;
+
+ /**
+ * Instance of an RNG
+ */
+ private $rngInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Initializes the random number generator (RNG)
+ *
+ * @param $extraInstance An extra instance, just for better hash data
+ * @return void
+ */
+ protected final function initializeRandomNumberGenerator (FrameworkInterface $extraInstance = null) {
+ // Get an RNG from factory
+ $this->rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class', array($extraInstance));
+ }
+
+ /**
+ * Getter for RNG instance
+ *
+ * @return $rngInstance An instance of a random number generator (RNG)
+ */
+ public final function getRngInstance () {
+ return $this->rngInstance;
+ }
+
+ /**
+ * Setter for helper instance
+ *
+ * @param $helperInstance An instance of a helper class
+ * @return void
+ */
+ protected final function setHelperInstance (HelpableTemplate $helperInstance) {
+ $this->helperInstance = $helperInstance;
+ }
+
+ /**
+ * Getter for helper instance
+ *
+ * @return $helperInstance An instance of a helper class
+ */
+ public final function getHelperInstance () {
+ return $this->helperInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper for creating images
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageHelper extends BaseCaptcha implements HelpableTemplate {
+ /**
+ * The image type
+ */
+ private $imageType = "png";
+
+ /**
+ * The image name
+ */
+ private $imageName = "";
+
+ /**
+ * Width of the image in pixel
+ */
+ private $width = 0;
+
+ /**
+ * Height of the image in pixel
+ */
+ private $height = 0;
+
+ /**
+ * Array for background color values
+ */
+ private $backgroundColor = array(
+ 'red' => 0,
+ 'green' => 0,
+ 'blue' => 0
+ );
+
+ /**
+ * Array for foreground color values
+ */
+ private $foregroundColor = array(
+ 'red' => 0,
+ 'green' => 0,
+ 'blue' => 0
+ );
+
+ /**
+ * All image strings
+ */
+ private $imageStrings = array();
+
+ /**
+ * Current string name
+ */
+ private $currString = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates the helper class
+ *
+ * @param $templateInstance An instance of a template engine
+ * @param $imageType Type of the image
+ * @return $helperInstance A preparedf instance of this helper
+ */
+ public final static function createImageHelper (CompileableTemplate $templateInstance, $imageType) {
+ // Get new instance
+ $helperInstance = new ImageHelper();
+
+ // Set template instance
+ $helperInstance->setTemplateInstance($templateInstance);
+
+ // Set image type (blindly)
+ $helperInstance->setImageType($imageType);
+
+ // Initialize RNG
+ $helperInstance->initializeRandomNumberGenerator($templateInstance);
+
+ // Return the prepared instance
+ return $helperInstance;
+ }
+
+ /**
+ * Setter for image type
+ *
+ * @param $imageType Type of the image
+ * @return void
+ */
+ protected final function setImageType ($imageType) {
+ $this->imageType = (string) $imageType;
+ }
+
+ /**
+ * Getter for image name
+ *
+ * @return $imageType Type of the image
+ */
+ public final function getImageType () {
+ return $this->imageType;
+ }
+
+ /**
+ * Setter for base image
+ *
+ * @param $baseImage A base image template
+ * @return void
+ */
+ public final function setBaseImage ($baseImage) {
+ $this->baseImage = (string) $baseImage;
+ }
+
+ /**
+ * Getter for base image
+ *
+ * @return $baseImage A base image template
+ */
+ public final function getBaseImage () {
+ return $this->baseImage;
+ }
+
+ /**
+ * Setter for image name
+ *
+ * @param $imageName Name of the image
+ * @return void
+ */
+ public final function setImageName ($imageName) {
+ $this->imageName = (string) $imageName;
+ }
+
+ /**
+ * Getter for image name
+ *
+ * @return $imageName Name of the image
+ */
+ protected final function getImageName () {
+ return $this->imageName;
+ }
+
+ /**
+ * Setter for image width
+ *
+ * @param $width Width of the image
+ * @return void
+ */
+ public final function setWidth ($width) {
+ $this->width = (int) $width;
+ }
+
+ /**
+ * Getter for image width
+ *
+ * @return $width Width of the image
+ */
+ public final function getWidth () {
+ return $this->width;
+ }
+
+ /**
+ * Setter for image height
+ *
+ * @param $height Height of the image
+ * @return void
+ */
+ public final function setHeight ($height) {
+ $this->height = (int) $height;
+ }
+
+ /**
+ * Getter for image height
+ *
+ * @return $height Height of the image
+ */
+ public final function getHeight () {
+ return $this->height;
+ }
+
+ /**
+ * Setter for RGB of background color
+ *
+ * @param $red Color value for red
+ * @param $green Color value for green
+ * @param $blue Color value for blue
+ * @return void
+ */
+ public final function setBackgroundColorRedGreenBlue ($red, $green, $blue) {
+ // Random numbers?
+ if ($red === "rand") {
+ $red = $this->getRngInstance()->randomNumber(0, 255);
+ } // END - if
+ if ($green === "rand") {
+ $green = $this->getRngInstance()->randomNumber(0, 255);
+ } // END - if
+ if ($blue === "rand") {
+ $blue = $this->getRngInstance()->randomNumber(0, 255);
+ } // END - if
+
+ $this->backgroundColor['red'] = (int) $red;
+ $this->backgroundColor['green'] = (int) $green;
+ $this->backgroundColor['blue'] = (int) $blue;
+ }
+
+ /**
+ * Setter for RGB of foreground color
+ *
+ * @param $red Color value for red
+ * @param $green Color value for green
+ * @param $blue Color value for blue
+ * @return void
+ */
+ public final function setForegroundColorRedGreenBlue ($red, $green, $blue) {
+ // Random numbers?
+ if ($red === "rand") {
+ $red = $this->getRngInstance()->randomNumber(0, 255);
+ } // END - if
+ if ($green === "rand") {
+ $green = $this->getRngInstance()->randomNumber(0, 255);
+ } // END - if
+ if ($blue === "rand") {
+ $blue = $this->getRngInstance()->randomNumber(0, 255);
+ } // END - if
+
+ $this->foregroundColor['red'] = (int) $red;
+ $this->foregroundColor['green'] = (int) $green;
+ $this->foregroundColor['blue'] = (int) $blue;
+ }
+
+ /**
+ * Adds an image string to the buffer by the given string name
+ *
+ * @param $stringName String name (identifier)
+ */
+ public function addTextLine ($stringName) {
+ // Create the image string
+ $this->imageStrings[$stringName] = array(
+ 'x' => "",
+ 'y' => "",
+ 'size' => "",
+ 'string' => ""
+ );
+
+ // Set current string name
+ $this->currString = $stringName;
+ }
+
+ /**
+ * Setter for image message string
+ *
+ * @param $imageString A message to display in the image
+ * @return void
+ */
+ public final function setImageString ($imageString) {
+ $this->imageStrings[$this->currString]['string'] = (string) $imageString;
+ }
+
+ /**
+ * Getter for image message string
+ *
+ * @return $imageString A message to display in the image
+ */
+ public final function getImageString () {
+ return $this->imageStrings[$this->currString]['string'];
+ }
+
+ /**
+ * Setter for X/Y coordinates for strings
+ *
+ * @param $x X coordinate
+ * @param $y Y coordinate
+ * @return void
+ */
+ public final function setCoord ($x, $y) {
+ $this->imageStrings[$this->currString]['x'] = (int) $x;
+ $this->imageStrings[$this->currString]['y'] = (int) $y;
+ }
+
+ /**
+ * Getter for X coordinate
+ *
+ * @return $x X coordinate
+ */
+ public final function getX () {
+ return $this->imageStrings[$this->currString]['x'];
+ }
+
+ /**
+ * Getter for Y coordinate
+ *
+ * @return $y Y coordinate
+ */
+ public final function getY () {
+ return $this->imageStrings[$this->currString]['y'];
+ }
+
+ /**
+ * Setter for font size
+ *
+ * @param $fontSize Font size for strings
+ * @return void
+ */
+ public final function setFontSize ($fontSize) {
+ // Random font size?
+ if ($fontSize === "rand") {
+ $fontSize = $this->getRngInstance()->randomNumber(4, 9);
+ } // END - if
+
+ $this->imageStrings[$this->currString]['size'] = (int) $fontSize;
+ }
+
+ /**
+ * Getter for font size
+ *
+ * @return $fontSize Font size for strings
+ */
+ public final function getFontSize () {
+ return $this->imageStrings[$this->currString]['size'];
+ }
+
+ /**
+ * Flushs the content out
+ *
+ * @return void
+ */
+ public function flushContent () {
+ // Get a template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // Get the base image
+ $templateInstance->loadCodeTemplate($this->getBaseImage());
+
+ // Assign all the image values with the template
+ $templateInstance->assignVariable('image_name' , $this->getImageName());
+ $templateInstance->assignVariable('image_type' , $this->getImageType());
+ $templateInstance->assignVariable('image_width' , $this->getWidth());
+ $templateInstance->assignVariable('image_height' , $this->getHeight());
+ $templateInstance->assignVariable('image_bg_red' , $this->backgroundColor['red']);
+ $templateInstance->assignVariable('image_bg_green', $this->backgroundColor['green']);
+ $templateInstance->assignVariable('image_bg_blue' , $this->backgroundColor['blue']);
+ $templateInstance->assignVariable('image_fg_red' , $this->foregroundColor['red']);
+ $templateInstance->assignVariable('image_fg_green', $this->foregroundColor['green']);
+ $templateInstance->assignVariable('image_fg_blue' , $this->foregroundColor['blue']);
+
+ // Add all strings
+ foreach ($this->imageStrings as $id => $imageString) {
+ // Set current string id to keep this helper in sync with template engine
+ $this->currString = $id;
+
+ // Set variable group
+ $templateInstance->setVariableGroup($id);
+
+ // Add group variables
+ $templateInstance->addGroupVariable('image_x' , $this->getX());
+ $templateInstance->addGroupVariable('image_y' , $this->getY());
+ $templateInstance->addGroupVariable('image_size' , $this->getFontSize());
+ $templateInstance->addGroupVariable('image_string', $this->getImageString());
+ } // END - foreach
+
+ // Get the raw content
+ $imageContent = $templateInstance->getRawTemplateData();
+
+ // Transfer all to the template engine
+ $templateInstance->renderXmlContent($imageContent);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A solveable graphical code CAPTCHA
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class GraphicalCodeCaptcha extends BaseCaptcha implements SolveableCaptcha {
+ /**
+ * Hash of the CAPTCHA string
+ */
+ private $hashedString = "";
+
+ /**
+ * Encrypted string
+ */
+ private $encryptedString = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this captcha class
+ *
+ * @param $helperInstance An instance of a helper class
+ * @param $extraInstance An extra instance, just for better hash data
+ * @return $captchaInstance An instance of this captcha class
+ */
+ public final static function createGraphicalCodeCaptcha (HelpableTemplate $helperInstance, FrameworkInterface $extraInstance = null) {
+ // Get a new instance
+ $captchaInstance = new GraphicalCodeCaptcha();
+
+ // Set template instance
+ $captchaInstance->setHelperInstance($helperInstance);
+
+ // Initialize the RNG
+ $captchaInstance->initializeRandomNumberGenerator($extraInstance);
+
+ // Return the instance
+ return $captchaInstance;
+ }
+
+ /**
+ * Initiates the CAPTCHA
+ *
+ * @return void
+ */
+ public function initiateCaptcha () {
+ // Get total length
+ $captchaLength = $this->getConfigInstance()->readConfig('captcha_string_length');
+
+ // Get max string length
+ $strLength = $this->getConfigInstance()->readConfig('random_string_length');
+
+ // Calculate starting position based on random place
+ $start = $this->getRngInstance()->randomNumber(0, ($strLength - $captchaLength));
+
+ // Test it
+ assert($start >= 0);
+
+ // Generate a random string for confirmation
+ $randomString = $this->getRngInstance()->randomString($strLength);
+
+ // Encode the string with BASE64
+ $base64String = base64_encode($randomString);
+
+ // Make this string a bit more readable for humans
+ $captchaString = substr($base64String, $start, $captchaLength);
+
+ // Get all characters we want to replace
+ $searchChars = $this->getConfigInstance()->readConfig('captcha_search_chars');
+
+ // Get fixed salt and use it as "replacement characters"
+ $replaceChars = $this->getRngInstance()->getExtraSalt();
+
+ // Remove any plus, equals or slashes
+ for ($searchIdx = 0; $searchIdx < strlen($searchChars); $searchIdx++) {
+ // Get search character
+ $search = substr($searchChars, $searchIdx, 1);
+
+ // Random array index
+ $charIdx = $this->getRngInstance()->randomNumber(0, (strlen($replaceChars) - 1));
+
+ // Get replacement
+ $replace = substr($replaceChars, $charIdx, 1);
+
+ // Replace character
+ $captchaString = str_replace($search, $replace, $captchaString, $captchaLength);
+ } // END - foreach
+
+ // Get crypto instance
+ $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Hash the CAPTCHA code for later comparison
+ $this->hashedString = $cryptoInstance->hashString($captchaString);
+
+ // Encrypt the string for later usage
+ $this->encryptedString = $cryptoInstance->encryptString($captchaString);
+ }
+
+ /**
+ * Render the CAPTCHA code
+ *
+ * @return void
+ */
+ public function renderCode () {
+ // Get helper instance
+ $helperInstance = $this->getHelperInstance();
+
+ // Get template instance
+ $templateInstance = $helperInstance->getTemplateInstance();
+
+ // Load a template for this CAPTCHA
+ $templateInstance->loadCodeTemplate('captch_graphic_code');
+
+ // Rename variable
+ $templateInstance->renameVariable('captcha_code', $helperInstance->getFormName().'_captcha');
+ $templateInstance->renameVariable('captcha_hash', $helperInstance->getFormName().'_hash');
+ $templateInstance->renameVariable('encrypted_code', $helperInstance->getFormName().'_encrypt');
+
+ // Assign variables
+ $templateInstance->assignVariable($helperInstance->getFormName().'_encrypt', urlencode(base64_encode($this->encryptedString)));
+ $templateInstance->assignVariable($helperInstance->getFormName().'_hash', $this->hashedString);
+
+ // Compile the template
+ $templateInstance->compileTemplate();
+
+ // Get the content back
+ $this->addContent($templateInstance->getRawTemplateData());
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class extends BaseHelper {
+class ???Helper extends BaseHelper {
/**
* Protected constructor
*
/**
* Creates the helper class
*
- * @return $helperInstance A preparedf instance of this class
+ * @return $helperInstance A prepared instance of this helper
*/
- public final static function createHelper () {
+ public final static function create???Helper () {
// Get new instance
- $helperInstance = new Helper();
+ $helperInstance = new ???Helper();
// Return the prepared instance
return $helperInstance;
}
+
+ /**
+ * Flush the content out,e g. to a template variable
+ *
+ * @return void
+ */
+ public function flushContent () {
+ $this->partialStub("Please implement this method.");
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
class BaseHelper extends BaseFrameworkSystem {
/**
- * Template engine instance
+ * Instance to the class which provides field values
*/
- private $templateInstance = null;
+ private $valueInstance = null;
/**
* Rendered content created by the helper class
*/
private $content = "";
+ /**
+ * Array with groups
+ */
+ private $groups = array();
+
+ /**
+ * Array with sub group
+ */
+ private $subGroups = array();
+
+ /**
+ * Previously opened group
+ */
+ private $previousGroupId = "";
+
+ /**
+ * Previously opened sub group
+ */
+ private $previousSubGroupId = "";
+
+ /**
+ * Total counter for groups and sub groups
+ */
+ private $totalCounter = 0;
+
+ // Exception constants
+ const EXCEPTION_XML_PARSER_ERROR = 0x1e0;
+ const EXCEPTION_XML_NODE_UNKNOWN = 0x1e1;
+ const EXCEPTION_XML_NODE_MISMATCH = 0x1e2;
+ const EXCEPTION_GROUP_NOT_OPENED = 0x1e3;
+ const EXCEPTION_GROUP_ALREADY_FOUND = 0x1e4;
+ const EXCEPTION_SUB_GROUP_ALREADY_FOUND = 0x1e5;
+ const EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED = 0x1e6;
+ const EXCEPTION_NO_PREVIOUS_GROUP_OPENED = 0x1e7;
+
/**
* Protected constructor
*
}
/**
- * Setter for template engine instances
+ * Adds content directly
+ *
+ * @param $newContent New content to add
+ * @return void
+ */
+ protected final function addContent ($newContent) {
+ $this->content .= (string) trim($newContent)."\n";
+ }
+
+ /**
+ * Add header content to the helper
*
- * @param $templateInstance An instance of a template engine class
+ * @param $content Content to to the base
* @return void
*/
- protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
- $this->templateInstance = $templateInstance;
+ protected function addHeaderContent ($content) {
+ // Add the header content
+ $this->groups['header']['content'] = (string) trim($content);
}
/**
- * Getter for template engine instances
+ * Add footer content to the helper
*
- * @return $templateInstance An instance of a template engine class
+ * @param $content Content to to the base
+ * @return void
*/
- protected final function getTemplateInstance () {
- return $this->templateInstance;
+ protected function addFooterContent ($content) {
+ // Add the footer content
+ $this->groups['footer']['content'] = (string) trim($content);
}
/**
- * Add content
+ * Adds content to the previously opened group or sub group. If a sub group
+ * was found it will be taken. If no group/sub group is opened at the moment
+ * the code will be passed to addContent().
*
* @param $newContent New content to add
* @return void
*/
- protected final function addContent ($newContent) {
- $this->content .= (string) trim($newContent)."\r\n";
+ protected final function addContentToPreviousGroup ($newContent) {
+ // Check for sub/group
+ if ($this->ifSubGroupOpenedPreviously()) {
+ // Get sub group id
+ $subGroupId = $this->getPreviousSubGroupId();
+
+ // Add the content
+ $this->subGroups[$subGroupId]['content'] .= $newContent;
+ } elseif ($this->ifGroupOpenedPreviously()) {
+ // Get group id
+ $groupId = $this->getPreviousGroupId();
+
+ // Add the content
+ $this->groups[$groupId]['content'] .= $newContent;
+ } else {
+ // Add it directly
+ $this->addContent($newContent);
+ }
}
/**
protected final function getContent () {
return $this->content;
}
+
+ /**
+ * Assigns a field from the value instance with a template variable
+ *
+ * @param $fieldName Name of the field to assign
+ * @return void
+ */
+ public function assignField ($fieldName) {
+ // Get the value from value instance
+ $fieldValue = $this->getValueField($fieldName);
+
+ // Assign it with a template variable
+ $this->getTemplateInstance()->assignVariable('block_' . $fieldName, $fieldValue);
+ }
+
+ /**
+ * Assigns a field from the value instance with a template variable but
+ * parses its content through a given filter method of the value instance
+ *
+ * @param $fieldName Name of the field to assign
+ * @param $filterMethod Method name to call of the value instance
+ * @return void
+ * @todo Rewrite this method using a helper class for filtering data
+ */
+ public function assignFieldWithFilter ($fieldName, $filterMethod) {
+ // Get the value
+ $fieldValue = $this->getValueField($fieldName);
+
+ // Now filter it through the value through the filter method
+ $filteredValue = call_user_func_array(array($this, 'doFilter' . $this->convertToClassName($filterMethod)), array($fieldValue));
+
+ // Assign it with a template variable
+ $this->getTemplateInstance()->assignVariable('block_' . $fieldName, $filteredValue);
+ }
+
+ /**
+ * Pre-fetches field default values from the given registry key instance into this class
+ *
+ * @param $registryKey Registry key which holds an object with values
+ * @param $extraKey Extra value instance key used if registryKey is null
+ * @return void
+ * @throws NullPointerException If recovery of requested value instance failed
+ */
+ public function prefetchValueInstance ($registryKey, $extraKey = null) {
+ // Get the required instance
+ $this->valueInstance = Registry::getRegistry()->getInstance($registryKey);
+
+ // Is the value instance valid?
+ if (is_null($this->valueInstance)) {
+ // Try to create it "from scratch", by first init extra instance
+ $extraInstance = null;
+
+ // Shall we get an extra instance?
+ if (!is_null($extraKey)) {
+ // Get the extra instance.
+ $extraInstance = Registry::getRegistry()->getInstance($extraKey);
+ } // END - if
+
+ // Get the requested instance
+ try {
+ $this->valueInstance = ObjectFactory::createObjectByConfiguredName($registryKey . '_class', array($extraInstance));
+
+ } catch (FrameworkException $e) {
+ // Okay, nothing found so throw a null pointer exception here
+ throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
+ }
+ } // END - if
+ }
+
+ /**
+ * Opens a helper group with given group id and content or throws an
+ * exception if that group is already found regardless if it is open or
+ * closed.
+ *
+ * @param $groupId Group id to open
+ * @param $content Initial content to add to the group
+ * @return void
+ * @throws HelperGroupAlreadyCreatedException If the group was already created before
+ */
+ protected function openGroupByIdContent ($groupId, $content) {
+ //* DEBUG: */ echo "OPEN:groupId={$groupId}<br />\n";
+ // Is the group already there?
+ if (isset($this->groups[$groupId])) {
+ // Then throw an exception here
+ throw new HelperGroupAlreadyCreatedException(array($this, $groupId), self::EXCEPTION_GROUP_ALREADY_FOUND);
+ } // END - if
+
+ // Count one up
+ $this->totalCounter++;
+
+ // Add the group to the stack
+ $this->groups[$this->totalCounter] = $groupId;
+ $this->groups[$groupId]['opened'] = true;
+ $this->groups[$groupId]['content'] = $content."\n";
+
+ // Mark this group as previously opened
+ $this->setPreviousGroupId($groupId);
+ }
+
+ /**
+ * Closes the previously opened group by added given content to it or
+ * throws an exception if no previous group was opened
+ *
+ * @param $content Content for previously opened grouop
+ * @return void
+ * @throws HelperNoPreviousOpenedGroupException If no previously opened group was found
+ */
+ public function closePreviousGroupByContent ($content) {
+ // Check if any group was opened before
+ if (!$this->ifGroupOpenedPreviously()) {
+ // Then throw an exception
+ throw new HelperNoPreviousOpenedGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
+ } // END - if
+
+ // Get previous group
+ $groupId = $this->getPreviousGroupId();
+
+ // Add content to it and mark it as closed
+ $this->groups[$groupId]['content'] .= $content."\n";
+ $this->groups[$groupId]['opened'] = false;
+
+ // Mark previous group as closed
+ $this->setPreviousGroupId("");
+ //* DEBUG: */ echo "CLOSE:groupId={$groupId}<br />\n";
+ }
+
+ /**
+ * Opens a helper sub group with given group id and content or throws an
+ * exception if that sub group is already found regardless if it is open or
+ * closed.
+ *
+ * @param $subGroupId Sub group id to open
+ * @param $content Initial content to add to the sub group
+ * @return void
+ * @throws HelperSubGroupAlreadyCreatedException If the sub group was already created before
+ */
+ protected function openSubGroupByIdContent ($subGroupId, $content) {
+ //* DEBUG: */ echo "OPEN:subGroupId={$subGroupId},content=".htmlentities($content)."<br />\n";
+ // Is the group already there?
+ if (isset($this->subGroups[$subGroupId])) {
+ // Then throw an exception here
+ throw new HelperSubGroupAlreadyCreatedException(array($this, $subGroupId), self::EXCEPTION_SUB_GROUP_ALREADY_FOUND);
+ } // END - if
+
+ // Count one up
+ $this->totalCounter++;
+
+ // Add the group to the stack
+ $this->subGroups[$this->totalCounter] = $subGroupId;
+ $this->subGroups[$subGroupId]['opened'] = true;
+ $this->subGroups[$subGroupId]['content'] = $content."\n";
+
+ // Mark this group as previously opened
+ $this->setPreviousSubGroupId($subGroupId);
+ }
+
+ /**
+ * Closes the previously opened sub group by added given content to it or
+ * throws an exception if no previous sub group was opened
+ *
+ * @param $content Content for previously opened sub grouop
+ * @return void
+ * @throws HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
+ */
+ public function closePreviousSubGroupByContent ($content) {
+ // Check if any sub group was opened before
+ if (!$this->ifSubGroupOpenedPreviously()) {
+ // Then throw an exception
+ throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
+ } // END - if
+
+ // Get previous sub group
+ $subGroupId = $this->getPreviousSubGroupId();
+
+ // Add content to it and mark it as closed
+ $this->subGroups[$subGroupId]['content'] .= $content."\n";
+ $this->subGroups[$subGroupId]['opened'] = false;
+
+ // Mark previous sub group as closed
+ $this->setPreviousSubGroupId("");
+ //* DEBUG: */ echo "CLOSE:subGroupId={$subGroupId}<br />\n";
+ }
+
+ /**
+ * Renders all group and sub group in their order
+ *
+ * @return $content Rendered HTML content
+ */
+ public function renderContent () {
+ // Initialize content
+ $content = "";
+
+ // Is header content there?
+ if (isset($this->groups['header'])) {
+ // Then add it
+ $content .= $this->groups['header']['content']."\n";
+ } // END - if
+
+ // Initiate content
+ $content .= $this->getContent();
+
+ // Now "walk" through all groups and sub-groups
+ for ($idx = 1; $idx <= $this->totalCounter; $idx++) {
+ // Is this a group and is it closed?
+ if ((isset($this->groups[$idx])) && ($this->groups[$this->groups[$idx]]['opened'] === false)) {
+ // Then add it's content
+ $groupContent = $this->groups[$this->groups[$idx]]['content'];
+ //* DEBUG: */ echo "group={$this->groups[$idx]},content=<pre>".htmlentities($groupContent)."</pre><br />\n";
+ $content .= $groupContent;
+ } elseif ((isset($this->subGroups[$idx])) && ($this->subGroups[$this->subGroups[$idx]]['opened'] === false)) {
+ // Then add it's content
+ $subGroupContent = $this->subGroups[$this->subGroups[$idx]]['content'];
+ //* DEBUG: */ echo "subgroup={$this->subGroups[$idx]},content=<pre>".htmlentities($subGroupContent)."</pre><br />\n";
+ $content .= $subGroupContent;
+ } else {
+ // Something went wrong
+ $this->debugInstance();
+ }
+
+ } // END - for
+
+ // Is footer content there?
+ if (isset($this->groups['footer'])) {
+ // Then add it
+ $content .= $this->groups['footer']['content']."\n";
+ } // END - if
+
+ // Return it
+ //* DEBUG: */ echo "content=<pre>".htmlentities($content)."</pre> (".strlen($content).")<br />\n";
+ return $content;
+ }
+
+ /**
+ * Checks wether the specified group is opened
+ *
+ * @param $groupId Id of group to check
+ * @return $isOpened Wether the specified group is open
+ */
+ protected function ifGroupIsOpened ($groupId) {
+ // Is the group open?
+ $isOpened = ((isset($this->groups[$groupId])) && ($this->groups[$groupId]['opened'] === true));
+
+ // Return status
+ return $isOpened;
+ }
+
+ /**
+ * Getter for direct field values
+ *
+ * @param $fieldName Name of the field we shall fetch
+ * @return $fieldValue Value from field
+ */
+ public function getValueField ($fieldName) {
+ // Get the field value
+ $fieldValue = call_user_func_array(array($this->valueInstance, 'getField'), array($fieldName));
+
+ // Return it
+ return $fieldValue;
+ }
+
+ /**
+ * Getter for value instance
+ *
+ * @return $valueInstance Instance of the class holding our values
+ */
+ public final function getValueInstance () {
+ return $this->valueInstance;
+ }
+
+ /**
+ * Check wether a group was opened previously
+ *
+ * @return $groupOpened Wether any group was opened before
+ */
+ protected final function ifGroupOpenedPreviously () {
+ $groupOpened = (!empty($this->previousGroupId));
+ return $groupOpened;
+ }
+
+ /**
+ * Check wether a group was opened previously
+ *
+ * @return $subGroupOpened Wether any group was opened before
+ */
+ protected final function ifSubGroupOpenedPreviously () {
+ $subGroupOpened = (!empty($this->previousSubGroupId));
+ return $subGroupOpened;
+ }
+
+ /**
+ * Getter for previous group id
+ *
+ * @return $previousGroupId Id of previously opened group
+ */
+ protected final function getPreviousGroupId () {
+ return $this->previousGroupId;
+ }
+
+ /**
+ * Setter for previous group id
+ *
+ * @param $previousGroupId Id of previously opened group
+ * @return void
+ */
+ protected final function setPreviousGroupId ($previousGroupId) {
+ $this->previousGroupId = (string) $previousGroupId;
+ }
+
+ /**
+ * Getter for previous sub group id
+ *
+ * @return $previousSubGroupId Id of previously opened sub group
+ */
+ protected final function getPreviousSubGroupId () {
+ return $this->previousSubGroupId;
+ }
+
+ /**
+ * Setter for previous sub group id
+ *
+ * @param $previousSubGroupId Id of previously opened sub group
+ * @return void
+ */
+ protected final function setPreviousSubGroupId ($previousSubGroupId) {
+ $this->previousSubGroupId = (string) $previousSubGroupId;
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper for generating blocks (div or span) on web pages
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebBlockHelper extends BaseWebHelper implements HelpableTemplate {
+ /**
+ * Name of the block
+ */
+ private $blockName = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates the helper class
+ *
+ * @param $templateInstance An instance of a template engine
+ * @param $blockName Name of the block we shall generate
+ * @return $helperInstance A prepared instance of this helper
+ */
+ public final static function createWebBlockHelper (CompileableTemplate $templateInstance, $blockName) {
+ // Get new instance
+ $helperInstance = new WebBlockHelper();
+
+ // Set template instance
+ $helperInstance->setTemplateInstance($templateInstance);
+
+ // Set block name
+ $helperInstance->setBlockName($blockName);
+
+ // Return the prepared instance
+ return $helperInstance;
+ }
+
+ /**
+ * Setter for block name
+ *
+ * @param $blockName Name of the block we shall generate
+ * @return void
+ */
+ protected final function setBlockName ($blockName) {
+ $this->blockName = (string) $blockName;
+ }
+
+ /**
+ * Getter for block name
+ *
+ * @return $blockName Name of the block we shall generate
+ */
+ public final function getBlockName () {
+ return $this->blockName;
+ }
+
+ /**
+ * Checks wether include registration date in this block
+ *
+ * @return $withRegistration Wether with registration date
+ */
+ public function ifIncludeRegistrationStamp () {
+ $withRegistration = ($this->getConfigInstance()->readConfig('block_shows_registration') === "Y");
+ return $withRegistration;
+ }
+
+ /**
+ * Assignes a template variable with a message from a given message id
+ *
+ * @param $templateVariable Template variable to assign
+ * @param $messageId Message id to load an assign
+ * @return void
+ */
+ public function assignMessageField ($templateVariable, $messageId) {
+ // Get message
+ $message = $this->getLanguageInstance()->getMessage($messageId);
+
+ // And assign it
+ $this->getTemplateInstance()->assignVariable($templateVariable, $message);
+ }
+
+ /**
+ * Assigns a link field with a given value
+ *
+ * @param $linkField "Link field" (variable) to assign
+ * @param $actionValue Action value to assign
+ * @return void
+ */
+ public function assignLinkFieldWithAction ($linkField, $actionValue) {
+ $this->getTemplateInstance()->assignVariable($linkField . '_action', $actionValue);
+ }
+
+ /**
+ * "Filter" method for translating the raw user status into something human-readable
+ *
+ * @param $userStatus Raw user status from database layer
+ * @return $translated Translated user status
+ */
+ protected function doFilterUserStatusTranslator ($userStatus) {
+ // Generate message id
+ $messageId = 'user_status_' . strtolower($userStatus);
+
+ // Get that message
+ $translated = $this->getLanguageInstance()->getMessage($messageId);
+
+ // Return it
+ return $translated;
+ }
+
+ /**
+ * Flush the content out,e g. to a template variable
+ *
+ * @return void
+ */
+ public function flushContent () {
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // Get the template named like this block
+ $templateInstance->loadCodeTemplate("block_" . $this->getBlockName());
+
+ // Transfer it to the template instance
+ $templateInstance->assignVariable($this->getBlockName(), $templateInstance->getRawTemplateData());
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Web???Helper extends BaseWebHelper implements HelpableTemplate {
+ /**
+ * Name of the ???
+ */
+ private $???Name = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set part description
+ $this->setObjectDescription("");
+ }
+
+ /**
+ * Creates the helper class
+ *
+ * @param $templateInstance An instance of a template engine
+ * @param $???Name Name of the ??? we shall generate
+ * @return $helperInstance A prepared instance of this helper
+ */
+ public final static function createWeb???Helper (CompileableTemplate $templateInstance, $???Name) {
+ // Get new instance
+ $helperInstance = new Web???Helper();
+
+ // Set template instance
+ $helperInstance->setTemplateInstance($templateInstance);
+
+ // Set ??? name
+ $helperInstance->set???Name($???Name);
+
+ // Return the prepared instance
+ return $helperInstance;
+ }
+
+ /**
+ * Flush the content out,e g. to a template variable
+ *
+ * @return void
+ */
+ public function flushContent () {
+ $this->partialStub("Please implement this method.");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general purpose web helper. You should not instance this like all the other
+ * base classes. Instead write your own web helper class and inherit this class.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseWebHelper extends BaseHelper {
+ /**
+ * Protected constructor
+ *
+ * @param $className The real class name
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Checks wether the registration requires a valid email address
+ *
+ * @return $required Wether the email address is required
+ */
+ public function ifRegisterRequiresEmailVerification () {
+ $required = ($this->getConfigInstance()->readConfig('register_requires_email') === "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether profile data shall be asked
+ *
+ * @return $required Wether profile shall be asked
+ */
+ public function ifRegisterIncludesProfile () {
+ $required = ($this->getConfigInstance()->readConfig('register_includes_profile') === "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether personal data shall be asked
+ *
+ * @return $required Wether personal data shall be asked
+ */
+ public function ifRegisterIncludesPersonaData () {
+ $required = ($this->getConfigInstance()->readConfig('register_personal_data') === "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether email addresses can only be once used
+ *
+ * @return $isUnique
+ */
+ public function ifEmailMustBeUnique () {
+ $isUnique = ($this->getConfigInstance()->readConfig('register_email_unique') === "Y");
+ return $isUnique;
+ }
+
+ /**
+ * Checks wether the specified chat protocol is enabled in this form
+ *
+ * @return $required Wether the specified chat protocol is enabled
+ */
+ public function ifChatEnabled ($chatProtocol) {
+ $required = ($this->getConfigInstance()->readConfig(sprintf("chat_enabled_%s", $chatProtocol)) == "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether login is enabled or disabled
+ *
+ * @return $isEnabled Wether the login is enabled or disabled
+ */
+ public function ifLoginIsEnabled () {
+ $isEnabled = ($this->getConfigInstance()->readConfig('login_enabled') === "Y");
+ return $isEnabled;
+ }
+
+ /**
+ * Checks wether login shall be done by username
+ *
+ * @return $isEnabled Wether the login shall be done by username
+ */
+ public function ifLoginWithUsername () {
+ $isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "username");
+ return $isEnabled;
+ }
+
+ /**
+ * Checks wether login shall be done by email
+ *
+ * @return $isEnabled Wether the login shall be done by email
+ */
+ public function ifLoginWithEmail () {
+ $isEnabled = ($this->getConfigInstance()->readConfig('login_type') == "email");
+ return $isEnabled;
+ }
+
+ /**
+ * Checks wether guest login is allowed
+ *
+ * @return $isAllowed Wether guest login is allowed
+ */
+ public function ifGuestLoginAllowed () {
+ $isAllowed = ($this->getConfigInstance()->readConfig('guest_login_allowed') === "Y");
+ return $isAllowed;
+ }
+
+ /**
+ * Checks wether the email address change must be confirmed
+ *
+ * @return $requireConfirm Wether email change must be confirmed
+ */
+ public function ifEmailChangeRequireConfirmation () {
+ $requireConfirm = ($this->getConfigInstance()->readConfig('email_change_confirmation') === "Y");
+ return $requireConfirm;
+ }
+
+ /**
+ * Checks wether the rules has been updated
+ *
+ * @return $rulesUpdated Wether rules has been updated
+ * @todo Implement check if rules have been changed
+ */
+ public function ifRulesHaveChanged () {
+ return false;
+ }
+
+ /**
+ * Checks wether email change is allowed
+ *
+ * @return $emailChange Wether changing email address is allowed
+ */
+ public function ifEmailChangeAllowed () {
+ $emailChange = ($this->getConfigInstance()->readConfig('email_change_allowed') === "Y");
+ return $emailChange;
+ }
+
+ /**
+ * Checks wether the user account is unconfirmed
+ *
+ * @return $isUnconfirmed Wether the user account is unconfirmed
+ */
+ public function ifUserAccountUnconfirmed () {
+ $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_unconfirmed'));
+ return $isUnconfirmed;
+ }
+
+ /**
+ * Checks wether the user account is locked
+ *
+ * @return $isUnconfirmed Wether the user account is locked
+ */
+ public function ifUserAccountLocked () {
+ $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_locked'));
+ return $isUnconfirmed;
+ }
+
+ /**
+ * Checks wether the user account is a guest
+ *
+ * @return $isUnconfirmed Wether the user account is a guest
+ */
+ public function ifUserAccountGuest () {
+ $isUnconfirmed = ($this->getValueField(UserDatabaseWrapper::DB_COLUMN_USER_STATUS) === $this->getConfigInstance()->readConfig('user_status_guest'));
+ return $isUnconfirmed;
+ }
+
+ /**
+ * Checks wether the refill page is active which should be not the default
+ * on non-web applications.
+ *
+ * @return $refillActive Wether the refill page is active
+ */
+ public function ifRefillPageActive () {
+ $refillActive = ($this->getConfigInstance()->readConfig('refill_page_active') === "Y");
+ return $refillActive;
+ }
+}
+
+// [EOF]
+?>
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set part description
- $this->setObjectDescription("Helper class for HTML forms");
-
- // Create unique ID number
- $this->generateUniqueId();
}
/**
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper for constructing web forms
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebFormHelper extends BaseWebHelper implements HelpableTemplate {
+ /**
+ * Wether the form tag is opened (keep at false or else your forms will
+ * never work!)
+ */
+ private $formOpened = false;
+
+ /**
+ * Name of the form
+ */
+ private $formName = "";
+
+ /**
+ * Wether form tag is enabled (default: true)
+ */
+ private $formEnabled = true;
+
+ // Class Constants
+ const EXCEPTION_FORM_NAME_INVALID = 0x120;
+ const EXCEPTION_CLOSED_FORM = 0x121;
+ const EXCEPTION_OPENED_FORM = 0x122;
+ const EXCEPTION_UNEXPECTED_CLOSED_GROUP = 0x123;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates the helper class with the given template engine instance and form name
+ *
+ * @param $templateInstance An instance of a valid template engine
+ * @param $formName Name of the form
+ * @param $formId Value for "id" attribute (default: $formName)
+ * @param $withForm Wether include the form tag
+ * @return $helperInstance A preparedf instance of this helper
+ */
+ public final static function createWebFormHelper (CompileableTemplate $templateInstance, $formName, $formId = false, $withForm = true) {
+ // Get new instance
+ $helperInstance = new WebFormHelper();
+
+ // Set template instance
+ $helperInstance->setTemplateInstance($templateInstance);
+
+ // Is the form id not set?
+ if ($formId === false) {
+ // Use form id from form name
+ $formId = $formName;
+ } // END - if
+
+ // Set form name
+ $helperInstance->setFormName($formName);
+
+ // A form-less field may say "false" here...
+ if ($withForm === true) {
+ // Create the form
+ $helperInstance->addFormTag($formName, $formId);
+ } else {
+ // Disable form
+ $helperInstance->enableForm(false);
+ }
+
+ // Return the prepared instance
+ return $helperInstance;
+ }
+
+ /**
+ * Add the form tag or close it an already opened form tag
+ *
+ * @param $formName Name of the form (default: false)
+ * @param $formId Id of the form (attribute "id"; default: false)
+ * @return void
+ * @throws InvalidFormNameException If the form name is invalid (=false)
+ * @todo Add some unique PIN here to bypass problems with some browser and/or extensions
+ */
+ public function addFormTag ($formName = false, $formId = false) {
+ // When the form is not yet opened at least form name must be valid
+ if (($this->formOpened === false) && ($formName === false)) {
+ // Thrown an exception
+ throw new InvalidFormNameException ($this, self::EXCEPTION_FORM_NAME_INVALID);
+ } // END - if
+
+ // Close the form is default
+ $formContent = "</form>";
+
+ // Check wether we shall open or close the form
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Add HTML code
+ $formContent = sprintf("<form name=\"%s\" class=\"forms\" action=\"%s/%s\" method=\"%s\" target=\"%s\"",
+ $formName,
+ $this->getConfigInstance()->readConfig('base_url'),
+ $this->getConfigInstance()->readConfig('form_action'),
+ $this->getConfigInstance()->readConfig('form_method'),
+ $this->getConfigInstance()->readConfig('form_target')
+ );
+
+ // Add form id as well
+ $formContent .= sprintf(" id=\"%s_form\"",
+ $formId
+ );
+
+ // Add close bracket
+ $formContent .= ">";
+
+ // Open the form and remeber the form name
+ $this->formOpened = true;
+
+ // Add it to the content
+ $this->addHeaderContent($formContent);
+ } else {
+ // Add the hidden field required to identify safely this form
+ $this->addInputHiddenField('form', $this->getFormName());
+
+ // Is a group open?
+ if ($this->ifGroupOpenedPreviously()) {
+ // Then automatically close it here
+ $this->addFormGroup();
+ } // END - if
+
+ // Simply close it
+ $this->formOpened = false;
+
+ // Add it to the content
+ $this->addFooterContent($formContent);
+ }
+ }
+
+ /**
+ * Add a text input tag to the form or throw an exception if it is not yet
+ * opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldValue Input default value (default: empty)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputTextField ($fieldName, $fieldValue = "") {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"text\" class=\"textfield %s_field\" name=\"%s\" value=\"%s\" />",
+ $fieldName,
+ $fieldName,
+ $fieldValue
+ );
+
+ // And add it maybe with a "li" tag
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add a text input tag to the form with pre-loaded default value
+ *
+ * @param $fieldName Input field name
+ * @return void
+ */
+ public function addInputTextFieldWithDefault ($fieldName) {
+ // Get the value from instance
+ $fieldValue = $this->getValueField($fieldName);
+ //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+
+ // Add the text field
+ $this->addInputTextField($fieldName, $fieldValue);
+ }
+
+ /**
+ * Add a password input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldValue Input default value (default: empty)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputPasswordField ($fieldName, $fieldValue = "") {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"password\" class=\"password %s_field\" name=\"%s\" value=\"%s\" />",
+ $fieldName,
+ $fieldName,
+ $fieldValue
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add a hidden input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldValue Input default value (default: empty)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputHiddenField ($fieldName, $fieldValue = "") {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"hidden\" name=\"%s\" value=\"%s\" />",
+ $fieldName,
+ $fieldValue
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add a hidden input tag to the form with pre-loaded default value
+ *
+ * @param $fieldName Input field name
+ * @return void
+ */
+ public function addInputHiddenFieldWithDefault ($fieldName) {
+ // Get the value from instance
+ $fieldValue = $this->getValueField($fieldName);
+ //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+
+ // Add the text field
+ $this->addInputHiddenField($fieldName, $fieldValue);
+ }
+
+ /**
+ * Add a hidden input tag to the form with configuration value
+ *
+ * @param $fieldName Input field name
+ * @param $prefix Prefix for configuration without trailing _
+ * @return void
+ */
+ public function addInputHiddenConfiguredField ($fieldName, $prefix) {
+ // Get the value from instance
+ $fieldValue = $this->getConfigInstance()->readConfig("{$prefix}_{$fieldName}");
+ //* DEBUG: */ echo __METHOD__.":".$fieldName."=".$fieldValue."<br />\n";
+
+ // Add the text field
+ $this->addInputHiddenField($fieldName, $fieldValue);
+ }
+
+ /**
+ * Add a checkbox input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $fieldName Input field name
+ * @param $fieldChecked Wether the field is checked (defaut: checked)
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputCheckboxField ($fieldName, $fieldChecked = true) {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Set wether the check box is checked...
+ $checked = " checked=\"checked\"";
+ if ($fieldChecked === false) $checked = " ";
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"checkbox\" name=\"%s\" class=\"checkbox %s_field\" value=\"1\"%s/>",
+ $fieldName,
+ $fieldName,
+ $checked
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add a reset input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $buttonText Text displayed on the button
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputResetButton ($buttonText) {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "reset"), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"reset\" class=\"reset_button\" id=\"%s_reset\" value=\"%s\" />",
+ $this->getFormName(),
+ $buttonText
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add a reset input tag to the form or throw an exception if it is not
+ * yet opened. The field's name will be set as id.
+ *
+ * @param $buttonText Text displayed on the button
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputSubmitButton ($buttonText) {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "submit"), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Generate the content
+ $inputContent = sprintf("<input type=\"submit\" class=\"submit_button\" id=\"%s_submit\" name=\"%s_button\" value=\"%s\" />",
+ $this->getFormName(),
+ $this->getFormName(),
+ $buttonText
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add a form group or close an already opened and open a new one
+ *
+ * @param $groupId Name of the group or last opened if empty
+ * @param $groupText Text including HTML to show above this group
+ * @return void
+ * @throws FormClosedException If no form has been opened before
+ * @throws EmptyVariableException If $groupId is not set
+ */
+ public function addFormGroup ($groupId = "", $groupText = "") {
+ // Is a form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw exception here
+ throw new FormClosedException(array($this, $groupId), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // At least the group name should be set
+ if ((empty($groupId)) && (!$this->ifGroupOpenedPreviously())) {
+ // Throw exception here
+ throw new EmptyVariableException(array($this, 'groupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (empty($groupId)) {
+ // Close the last opened
+ $groupId = $this->getPreviousGroupId();
+ }
+
+ // Same group to open?
+ if ((!$this->ifGroupOpenedPreviously()) && ($groupId == $this->getPreviousGroupId())) {
+ // Abort here silently
+ return false;
+ } // END - if
+
+ // Initialize content with closing div by default
+ $content = " </div>\n</div><!-- Group - CLOSE //-->";
+
+ // Is this group opened?
+ if (!$this->ifGroupOpenedPreviously()) {
+ // Begin the div/span blocks
+ $content = sprintf("<!-- Group %s - OPEN //-->
+<div class=\"group_box\" id=\"%s_group_box\">
+ <span class=\"group_text\" id=\"%s_group_text\">
+ %s
+ </span>
+ <div class=\"group_field\" id=\"%s_group_field\">",
+ $groupId,
+ $groupId,
+ $groupId,
+ $groupText,
+ $groupId
+ );
+
+ // Switch the state
+ $this->openGroupByIdContent($groupId, $content);
+ } else {
+ // Is a sub group opened?
+ if ($this->ifSubGroupOpenedPreviously()) {
+ // Close it here
+ $this->addFormSubGroup();
+ } // END - if
+
+ // Get previous group id
+ $prevGroupId = $this->getPreviousGroupId();
+
+ // Switch the state
+ $this->closePreviousGroupByContent($content);
+
+ // All call it again if the group name is not empty
+ if ((!empty($groupId)) && ($groupId != $prevGroupId)) {
+ //* DEBUG: */ echo $groupId."/".$prevGroupId."<br />\n";
+ $this->addFormGroup($groupId, $groupText);
+ } // END - if
+ }
+ }
+
+ /**
+ * Add a form sub group or close an already opened and open a new one or
+ * throws an exception if no group has been opened before or if the sub
+ * group name is empty.
+ *
+ * @param $subGroupId Name of the group or last opened if empty
+ * @param $subGroupText Text including HTML to show above this group
+ * @return void
+ * @throws FormFormClosedException If no group has been opened before
+ * @throws EmptyVariableException If $subGroupId is not set
+ */
+ public function addFormSubGroup ($subGroupId = "", $subGroupText = "") {
+ // Is a group opened?
+ if (!$this->ifGroupOpenedPreviously()) {
+ // Throw exception here
+ throw new FormFormClosedException(array($this, $subGroupId), self::EXCEPTION_UNEXPECTED_CLOSED_GROUP);
+ } // END - if
+
+ // At least the sub group name should be set
+ if ((empty($subGroupId)) && (!$this->ifSubGroupOpenedPreviously())) {
+ // Throw exception here
+ throw new EmptyVariableException(array($this, 'subGroupId'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (empty($subGroupId)) {
+ // Close the last opened
+ $subGroupId = $this->getPreviousSubGroupId();
+ }
+
+ // Same sub group to open?
+ if ((!$this->ifSubGroupOpenedPreviously()) && ($subGroupId == $this->getPreviousSubGroupId())) {
+ // Abort here silently
+ return false;
+ } // END - if
+
+ // Initialize content with closing div by default
+ $content = " </div>\n</div><!-- Sub group- CLOSE //-->";
+
+ // Is this group opened?
+ if (!$this->ifSubGroupOpenedPreviously()) {
+ // Begin the span block
+ $content = sprintf("<!-- Sub group %s - OPEN //-->
+<div class=\"subgroup_box\" id=\"%s_subgroup_box\">
+ <span class=\"subgroup_text\" id=\"%s_subgroup_text\">
+ %s
+ </span>
+ <div class=\"subgroup_field\" id=\"%s_subgroup_field\">",
+ $subGroupId,
+ $subGroupId,
+ $subGroupId,
+ $subGroupText,
+ $subGroupId
+ );
+
+ // Switch the state and remeber the name
+ $this->openSubGroupByIdContent($subGroupId, $content);
+ } else {
+ // Get previous sub group id
+ $prevSubGroupId = $this->getPreviousSubGroupId();
+
+ // Switch the state
+ $this->closePreviousSubGroupByContent($content);
+
+ // All call it again if sub group name is not empty
+ if ((!empty($subGroupId)) && ($subGroupId != $prevSubGroupId)) {
+ $this->addFormSubGroup($subGroupId, $subGroupText);
+ } // END - if
+ }
+ }
+
+ /**
+ * Add text surrounded by a span block when there is a group opened before
+ * or else by a div block.
+ *
+ * @param $fieldName Field name
+ * @param $fieldText Text for the field
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addFieldText ($fieldName, $fieldText) {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, $fieldName), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Set the block type
+ $block = "div";
+ if ($this->ifGroupOpenedPreviously()) $block = "span";
+
+ // Generate the content
+ $inputContent = sprintf(" <%s id=\"%s_text\">
+ %s
+ </%s>",
+ $block,
+ $fieldName,
+ $fieldText,
+ $block
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Add text (notes) surrounded by a div block. Still opened groups or sub
+ * groups will be automatically closed.
+ *
+ * @param $noteId Id for this note
+ * @param $formNotes The form notes we shell addd
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addFormNote ($noteId, $formNotes) {
+ // Is the form opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Is a group open?
+ if ($this->ifGroupOpenedPreviously()) {
+ // Then automatically close it here
+ $this->addFormGroup();
+ } // END - if
+
+ // Generate the content
+ $inputContent = sprintf(" <div id=\"form_note_%s\">
+ %s
+ </div>",
+ $noteId,
+ $formNotes
+ );
+
+ // And add it
+ $this->addContentToPreviousGroup($inputContent);
+ }
+
+ /**
+ * Adds a selection box as a sub group to the form. Do not box this into
+ * another sub group. Sub-sub groups are not (yet) supported.
+ *
+ * @param $selectId Id of the selection box
+ * @param $firstEntry Content to be added as first non-selectable entry
+ * @return void
+ * @throws FormClosedException If the form is not yet opened
+ */
+ public function addInputSelectField ($selectId, $firstEntry) {
+ // Is the form group opened?
+ if (($this->formOpened === false) && ($this->formEnabled === true)) {
+ // Throw an exception
+ throw new FormClosedException (array($this, "form_notes"), self::EXCEPTION_CLOSED_FORM);
+ } // END - if
+
+ // Shall we close or open the sub group?
+ if ((!$this->ifSubGroupOpenedPreviously()) && ($this->getPreviousSubGroupId() !== $selectId)) {
+ // Initialize first entry (which might be non-selectable if content is provided
+ if (!empty($firstEntry)) {
+ // Add selection around it
+ $firstEntry = sprintf("<option value=\"invalid\" disabled=\"disabled\">%s</option>\n",
+ $firstEntry
+ );
+ } // END - if
+
+ // Construct the opening select tag
+ $content = sprintf("<select class=\"select_box\" id=\"%s_%s\" name=\"%s\">\n%s",
+ $this->getFormName(),
+ $selectId,
+ $selectId,
+ $firstEntry
+ );
+
+ // Open the sub group
+ $this->openSubGroupByIdContent($selectId, $content);
+ } elseif ($this->getPreviousSubGroupId() != $selectId) {
+ // Something went wrong!
+ $this->debugInstance();
+ } else {
+ // Close the sub group
+ $this->closePreviousSubGroupByContent("</select>");
+ }
+ }
+
+ /**
+ * Adds a non-selectable sub option to a previously added selection box.
+ * This method does *not* validate if there is already a sub option added
+ * with the same name. We need to finish this here!
+ *
+ * @param $subName Name of the sub action
+ * @param $subValue Value of the sub action
+ * @return void
+ * @throws HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
+ * @todo Add checking if sub option is already added
+ */
+ public function addSelectSubOption ($subName, $subValue) {
+ // Is there a sub group (shall be a selection box!)
+ if (!$this->ifSubGroupOpenedPreviously()) {
+ // Then throw an exception here
+ throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
+ } // END - if
+
+ // Render the content
+ $content = sprintf("<option value=\"%s\" class=\"suboption suboption_%s\" disabled=\"disabled\">%s</option>\n",
+ $subName,
+ $subName,
+ $subValue
+ );
+
+ // Add the content to the previously opened sub group
+ $this->addContentToPreviousGroup($content);
+ }
+
+ /**
+ * Adds a selectable option to a previously added selection box. This method
+ * does *not* validate if there is already a sub option added with the same
+ * name. We need to finish this here!
+ *
+ * @param $optionName Name of the sub action
+ * @param $optionValue Value of the sub action
+ * @return void
+ * @throws HelperNoPreviousOpenedSubGroupException If no previously opened sub group was found
+ * @todo Add checking if sub option is already added
+ */
+ public function addSelectOption ($optionName, $optionValue) {
+ // Is there a sub group (shall be a selection box!)
+ if (!$this->ifSubGroupOpenedPreviously()) {
+ // Then throw an exception here
+ throw new HelperNoPreviousOpenedSubGroupException(array($this, $content), self::EXCEPTION_NO_PREVIOUS_SUB_GROUP_OPENED);
+ } // END - if
+
+ // Render the content
+ $content = sprintf("<option value=\"%s\" class=\"option option_%s\">%s</option>\n",
+ $optionName,
+ $optionName,
+ $optionValue
+ );
+
+ // Add the content to the previously opened sub group
+ $this->addContentToPreviousGroup($content);
+ }
+
+ /**
+ * Adds a pre-configured CAPTCHA
+ *
+ * @return void
+ */
+ public function addCaptcha () {
+ // Get last executed pre filter
+ $extraInstance = Registry::getRegistry()->getInstance('extra');
+
+ // Get a configured instance
+ $captchaInstance = ObjectFactory::createObjectByConfiguredName($this->getFormName().'_captcha', array($this, $extraInstance));
+
+ // Initiate the CAPTCHA
+ $captchaInstance->initiateCaptcha();
+
+ // Render the CAPTCHA code
+ $captchaInstance->renderCode();
+
+ // Get the content and add it to the helper
+ $this->addContentToPreviousGroup($captchaInstance->renderContent());
+ }
+
+ /**
+ * Enables/disables the form tag usage
+ *
+ * @param $formEnabled Wether form is enabled or disabled
+ * @return void
+ */
+ public final function enableForm ($formEnabled = true) {
+ $this->formEnabled = (bool) $formEnabled;
+ }
+
+ /**
+ * Setter for form name
+ *
+ * @param $formName Name of this form
+ * @return void
+ */
+ public final function setFormName ($formName) {
+ $this->formName = (string) $formName;
+ }
+
+ /**
+ * Getter for form name
+ *
+ * @return $formName Name of this form
+ */
+ public final function getFormName () {
+ return $this->formName;
+ }
+
+ /**
+ * Checks wether the registration requires a valid email address
+ *
+ * @return $required Wether the email address is required
+ */
+ public function ifRegisterRequiresEmailVerification () {
+ $required = ($this->getConfigInstance()->readConfig('register_requires_email') === "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether profile data shall be asked
+ *
+ * @return $required Wether profile data shall be asked
+ */
+ public function ifRegisterIncludesProfile () {
+ $required = ($this->getConfigInstance()->readConfig('register_includes_profile') === "Y");
+ return $required;
+ }
+
+ /**
+ * Checks wether this form is secured by a CAPTCHA
+ *
+ * @return $isSecured Wether this form is secured by a CAPTCHA
+ */
+ public function ifFormSecuredWithCaptcha () {
+ $isSecured = ($this->getConfigInstance()->readConfig($this->getFormName().'_captcha_secured') === "Y");
+ return $isSecured;
+ }
+
+ /**
+ * Flushs the content out (not yet secured against open forms, etc.!) or
+ * close the form automatically
+ *
+ * @return void
+ * @throws FormOpenedException If the form is still open
+ */
+ public function flushContent () {
+ // Is the form still open?
+ if (($this->formOpened === true) && ($this->formEnabled === true)) {
+ // Close the form automatically
+ $this->addFormTag();
+ } elseif ($this->formEnabled === false) {
+ if ($this->ifSubGroupOpenedPreviously()) {
+ // Close sub group
+ $this->addFormSubGroup();
+ } elseif ($this->ifGroupOpenedPreviously()) {
+ // Close group
+ $this->addFormGroup();
+ }
+ }
+
+ // Send content to template engine
+ //* DEBUG: */ echo __METHOD__.": form=".$this->getFormName().", size=".strlen($this->renderContent())."<br />\n";
+ $this->getTemplateInstance()->assignVariable($this->getFormName(), $this->renderContent());
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A helper for web links
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebLinkHelper extends BaseWebHelper implements HelpableTemplate {
+ /**
+ * Name of the link
+ */
+ private $linkName = "";
+
+ /**
+ * Base of the link
+ */
+ private $linkBase = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates the helper class
+ *
+ * @param $templateInstance An instance of a template engine
+ * @param $linkName Name of the link we shall generate
+ * @param $linkBase Link base for all generated links
+ * @return $helperInstance A prepared instance of this helper
+ */
+ public final static function createWebLinkHelper (CompileableTemplate $templateInstance, $linkName, $linkBase) {
+ // Get new instance
+ $helperInstance = new WebLinkHelper();
+
+ // Set template instance
+ $helperInstance->setTemplateInstance($templateInstance);
+
+ // Set link name
+ $helperInstance->setLinkName($linkName);
+
+ // Set link base
+ $helperInstance->setLinkBase($linkBase);
+
+ // Return the prepared instance
+ return $helperInstance;
+ }
+
+ /**
+ * Setter for link name
+ *
+ * @param $linkName Name of the link we shall generate
+ * @return void
+ */
+ protected final function setLinkName ($linkName) {
+ $this->linkName = (string) $linkName;
+ }
+
+ /**
+ * Getter for link name
+ *
+ * @return $linkName Name of the link we shall generate
+ */
+ public final function getLinkName () {
+ return $this->linkName;
+ }
+
+ /**
+ * Setter for link base
+ *
+ * @param $linkBase Base of the link we shall generate
+ * @return void
+ */
+ protected final function setLinkBase ($linkBase) {
+ $this->linkBase = (string) $linkBase;
+ }
+
+ /**
+ * Getter for link base
+ *
+ * @return $linkBase Base of the link we shall generate
+ */
+ public final function getLinkBase () {
+ return $this->linkBase;
+ }
+
+ /**
+ * Flush the content out,e g. to a template variable
+ *
+ * @return void
+ * @todo Completely unimplemented
+ */
+ public function flushContent () {
+ // Is a previous opened group still open?
+ if ($this->ifGroupOpenedPreviously()) {
+ // Then close it
+ $this->closePreviousGroupByContent("</div>");
+ } // END - if
+
+ // Get the content
+ $content = $this->renderContent();
+
+ // Get template engine
+ $templateInstance = $this->getTemplateInstance();
+
+ // Add content to variable
+ $templateInstance->assignVariable($this->getLinkName(), $content);
+ }
+
+ /**
+ * Adds a link group (like the form group is) with some raw language to the
+ * helper.
+ *
+ * @param $groupId Id string of the group
+ * @param $groupText Text for this group to add
+ * @return void
+ */
+ public function addLinkGroup ($groupId, $groupText) {
+ // Is a group with that name open?
+ if ($this->ifGroupIsOpened($groupId)) {
+ // Then close it here
+ $this->closePreviousGroupByContent("</div>");
+ } else {
+ // Is a previous opened group still open?
+ if ($this->ifGroupOpenedPreviously()) {
+ // Then close it
+ $this->closePreviousGroupByContent("</div>");
+ } // END - if
+
+ // Generate the group content
+ $content = sprintf("<div id=\"group_%s_%s\">%s",
+ $this->getLinkName(),
+ $groupId,
+ $groupText
+ );
+
+ // Open the new group
+ $this->openGroupByIdContent($groupId, $content);
+ }
+ }
+
+ /**
+ * Adds text (note) to the previously opened group or throws an exception
+ * if no previous group was opened.
+ *
+ * @param $groupNote Note to be added to a group
+ * @return void
+ * @throws NoGroupOpenedException If no previous group was opened
+ */
+ public function addLinkNote ($groupNote) {
+ // Check if a previous group was opened
+ if (!$this->ifGroupOpenedPreviously()) {
+ // No group was opened before!
+ throw new NoGroupOpenedException(array($this, $groupNote), self::EXCEPTION_GROUP_NOT_OPENED);
+ } // END - if
+
+ // Add the content to the previous group
+ $this->addContentToPreviousGroup($groupNote);
+ }
+
+ /**
+ * Adds a link to the previously opened group or throws an exception if no group has been opened
+ *
+ * @param $linkAction Action (action=xxx) value for the link
+ * @param $linkText Link text and title (title="xxx") for the link
+ * @return void
+ * @throws NoGroupOpenedException If no previous group was opened
+ */
+ public function addActionLink ($linkAction, $linkText) {
+ // Check if a previous group was opened
+ if (!$this->ifGroupOpenedPreviously()) {
+ // No group was opened before!
+ throw new NoGroupOpenedException(array($this, $groupNote), self::EXCEPTION_GROUP_NOT_OPENED);
+ } // END - if
+
+ // Default parameter seperator is &
+ $seperator = "&";
+
+ // Get link base
+ $linkBase = $this->getLinkBase();
+
+ // Is there a question mark in?
+ $linkArray = explode("?", $linkBase);
+ if (count($linkArray) == 0) {
+ // No question mark
+ $seperator = "?";
+ }
+
+ // Renders the link content
+ $linkContent = sprintf("<a href=\"%s%saction=%s\" title=\"%s\">%s</a>",
+ $linkBase,
+ $seperator,
+ $linkAction,
+ $linkText,
+ $linkText
+ );
+
+ // Add the content to the previous group
+ $this->addContentToPreviousGroup($linkContent);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ???Image extends BaseImage {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this image class
+ *
+ * @return $imageInstance An instance of this image class
+ */
+ public final static function create???Image() {
+ // Get a new instance
+ $imageInstance = new ???Image();
+
+ // Set image type
+ $imageInstance->setImageType("???");
+
+ // Return the instance
+ return $imageInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general image class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseImage extends BaseFrameworkSystem implements Registerable {
+ /**
+ * Image type
+ */
+ private $imageType = "";
+
+ /**
+ * Width of the image
+ */
+ private $width = "";
+
+ /**
+ * Height of the image
+ */
+ private $height = "";
+
+ /**
+ * Background color in RGB
+ */
+ private $backgroundColor = array(
+ 'red' => "",
+ 'green' => "",
+ 'blue' => ""
+ );
+
+ /**
+ * Foreground color in RGB
+ */
+ private $foregroundColor = array(
+ 'red' => "",
+ 'green' => "",
+ 'blue' => ""
+ );
+
+ /**
+ * Current choosen color array
+ */
+ private $colorMode = "";
+
+ /**
+ * Image resource
+ */
+ private $imageResource = null;
+
+ /**
+ * Image name
+ */
+ private $imageName = "";
+
+ /**
+ * String name
+ */
+ private $stringName = "";
+
+ /**
+ * Groupable image strings?
+ */
+ private $groupable = "single";
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Private setter for all colors
+ *
+ * @param $colorMode Wether background or foreground color
+ * @param $colorChannel Red, green or blue channel?
+ * @param $colorValue Value to set
+ */
+ private final function setColor ($colorMode, $colorChannel, $colorValue) {
+ // Construct the eval() command
+ $eval = sprintf("\$this->%s['%s'] = \"%s\";",
+ $colorMode,
+ $colorChannel,
+ $colorValue
+ );
+
+ // Run the command
+ //* DEBUG: */ echo "mode={$colorMode}, channel={$colorChannel}, value={$colorValue}<br />\n";
+ eval($eval);
+ }
+
+ /**
+ * Setter for image width
+ *
+ * @param $width Width of the image
+ * @return void
+ */
+ public final function setWidth ($width) {
+ $this->width = $width;
+ }
+
+ /**
+ * Getter for image width
+ *
+ * @return $width Width of the image
+ */
+ public final function getWidth () {
+ return $this->width;
+ }
+
+ /**
+ * Setter for image height
+ *
+ * @param $height Height of the image
+ * @return void
+ */
+ public final function setHeight ($height) {
+ $this->height = $height;
+ }
+
+ /**
+ * Getter for image height
+ *
+ * @return $height Height of the image
+ */
+ public final function getHeight () {
+ return $this->height;
+ }
+
+ /**
+ * Finish the type handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishType () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Prepares the class for resolution (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function initResolution () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Finish resolution handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishResolution () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Prepares the class for base (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function initBase () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Finish base handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishBase () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Prepares the class for background color
+ *
+ * @return void
+ */
+ public function initBackgroundColor () {
+ $this->colorMode = "backgroundColor";
+ }
+
+ /**
+ * Finish background color handling
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishBackgroundColor () {
+ // Empty at the moment
+ }
+
+ /**
+ * Prepares the class for foreground color
+ *
+ * @return void
+ */
+ public function initForegroundColor () {
+ $this->colorMode = "foregroundColor";
+ }
+
+ /**
+ * Finish foreground color handling
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishForegroundColor () {
+ // Empty at the moment
+ }
+
+ /**
+ * Prepares the class for string (unused at the moment)
+ *
+ * @param $groupable Wether this image string is groupable or single
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function initImageString ($groupable = "single") {
+ $this->groupable = $groupable;
+ }
+
+ /**
+ * Finish string handling (unused at the moment)
+ *
+ * @return void
+ * @todo Find something usefull for this method.
+ */
+ public function finishImageString () {
+ // Empty at the momemt
+ }
+
+ /**
+ * Setter for red color
+ *
+ * @param $red Red color value
+ * @return void
+ */
+ public final function setRed ($red) {
+ // Get array name
+ $arrayName = $this->colorMode;
+
+ // Set image color
+ $this->setColor($arrayName, 'red', $red);
+ }
+
+ /**
+ * Setter for green color
+ *
+ * @param $green Green color value
+ * @return void
+ */
+ public final function setGreen ($green) {
+ // Get array name
+ $arrayName = $this->colorMode;
+
+ // Set image color
+ $this->setColor($arrayName, 'green', $green);
+ }
+
+ /**
+ * Setter for blue color
+ *
+ * @param $blue Blue color value
+ * @return void
+ */
+ public final function setBlue ($blue) {
+ // Get array name
+ $arrayName = $this->colorMode;
+
+ // Set image color
+ $this->setColor($arrayName, 'blue', $blue);
+ }
+
+ /**
+ * Setter for image string
+ *
+ * @param $string String to set in image
+ * @return void
+ */
+ public final function setString ($string) {
+ $this->imageString = (string) $string;
+ }
+
+ /**
+ * Getter for image string
+ *
+ * @return $string String to set in image
+ */
+ public final function getString () {
+ return $this->imageString;
+ }
+
+ /**
+ * Setter for image type
+ *
+ * @param $imageType Type to set in image
+ * @return void
+ */
+ protected final function setImageType ($imageType) {
+ $this->imageType = (string) $imageType;
+ }
+
+ /**
+ * Getter for image type
+ *
+ * @return $imageType Type to set in image
+ */
+ public final function getImageType () {
+ return $this->imageType;
+ }
+
+ /**
+ * Setter for image name
+ *
+ * @param $name Name of the image
+ * @return void
+ */
+ public final function setImageName ($name) {
+ $this->imageName = (string) $name;
+ }
+
+ /**
+ * Getter for image name
+ *
+ * @return $name Name of the image
+ */
+ public final function getImageName () {
+ return $this->imageName;
+ }
+
+ /**
+ * Getter for image resource
+ *
+ * @return $imageResource An image resource from imagecreatetruecolor() function
+ */
+ public final function getImageResource() {
+ return $this->imageResource;
+ }
+
+ /**
+ * Setter for X coordinate
+ *
+ * @param $x X coordinate
+ * @return void
+ */
+ public final function setX ($x) {
+ $this->x = $x;
+ }
+
+ /**
+ * Getter for X coordinate
+ *
+ * @return $x X coordinate
+ */
+ public final function getX () {
+ return $this->x;
+ }
+
+ /**
+ * Setter for Y coordinate
+ *
+ * @param $y Y coordinate
+ * @return void
+ */
+ public final function setY ($y) {
+ $this->y = $y;
+ }
+
+ /**
+ * Getter for Y coordinate
+ *
+ * @return $y Y coordinate
+ */
+ public final function getY () {
+ return $this->y;
+ }
+
+ /**
+ * Setter for font size
+ *
+ * @param $fontSize Font size for strings
+ * @return void
+ */
+ public final function setFontSize ($fontSize) {
+ $this->fontSize = $fontSize;
+ }
+
+ /**
+ * Getter for font size
+ *
+ * @return $fontSize Font size for strings
+ */
+ public final function getFontSize () {
+ return $this->fontSize;
+ }
+
+ /**
+ * Setter for string name
+ *
+ * @param $stringName String name to set
+ * @return void
+ */
+ public final function setStringName($stringName) {
+ $this->stringName = $stringName;
+ }
+
+ /**
+ * Finish this image by producing it
+ *
+ * @return void
+ */
+ public function finishImage () {
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // Compile width and height
+ $width = $templateInstance->compileRawCode($this->getWidth());
+ $height = $templateInstance->compileRawCode($this->getHeight());
+
+ // Set both again
+ $this->setWidth($width);
+ $this->setHeight($height);
+
+ // Get a image resource
+ $this->imageResource = imagecreatetruecolor($width, $height);
+
+ // Compile background colors
+ $red = $templateInstance->compileRawCode($this->backgroundColor['red']);
+ $green = $templateInstance->compileRawCode($this->backgroundColor['green']);
+ $blue = $templateInstance->compileRawCode($this->backgroundColor['blue']);
+
+ // Set all back
+ $this->initBackgroundColor();
+ $this->setRed($red);
+ $this->setGreen($green);
+ $this->setBlue($blue);
+
+ // Get a pointer for background color
+ $backColor = imagecolorallocate($this->imageResource, $red, $green, $blue);
+
+ // Fill the image
+ imagefill($this->imageResource, 0, 0, $backColor);
+
+ // Compile foreground colors
+ $red = $templateInstance->compileRawCode($this->foregroundColor['red']);
+ $green = $templateInstance->compileRawCode($this->foregroundColor['green']);
+ $blue = $templateInstance->compileRawCode($this->foregroundColor['blue']);
+
+ // Set all fore
+ $this->initForegroundColor();
+ $this->setRed($red);
+ $this->setGreen($green);
+ $this->setBlue($blue);
+
+ // Get a pointer for foreground color
+ $foreColor = imagecolorallocate($this->imageResource, $red, $green, $blue);
+
+ switch ($this->groupable) {
+ case "single": // Single image string
+ // Compile image string
+ $imageString = $templateInstance->compileRawCode($this->getString());
+
+ // Set it back
+ $this->setString($imageString);
+
+ // Compile X/Y coordinates and font size
+ $x = $templateInstance->compileRawCode($this->getX());
+ $y = $templateInstance->compileRawCode($this->getY());
+ $size = $templateInstance->compileRawCode($this->getFontSize());
+
+ // Set the image string
+ imagestring($this->imageResource, $size, $x, $y, $imageString, $foreColor);
+ break;
+
+ case "groupable": // More than one string allowed
+ // Walk through all groups
+ foreach ($templateInstance->getVariableGroups() as $group => $set) {
+ // Set the group
+ $templateInstance->setVariableGroup($group, false);
+
+ // Compile image string
+ $imageString = $templateInstance->compileRawCode($this->getString());
+
+ // Compile X/Y coordinates and font size
+ $x = $templateInstance->compileRawCode($this->getX());
+ $y = $templateInstance->compileRawCode($this->getY());
+ $size = $templateInstance->compileRawCode($this->getFontSize());
+
+ // Set the image string
+ //* DEBUG: */ echo __METHOD__.": size={$size}, x={$x}, y={$y}, string={$imageString}<br />\n";
+ imagestring($this->imageResource, $size, $x, $y, $imageString, $foreColor);
+ } // END - foreach
+ break;
+ }
+
+ // You need finishing in your image class!
+ }
+
+ /**
+ * Getter for full created image content
+ *
+ * @return $imageContent The raw image content
+ */
+ public function getContent () {
+ // Get cache file name
+ $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
+
+ // Load the content
+ $imageContent = file_get_contents($cacheFile);
+
+ // And return it
+ return $imageContent;
+ }
+}
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A PNG image generator
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class PngImage extends BaseImage {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this image class
+ *
+ * @param $templateInstance A template instance
+ * @return $imageInstance An instance of this image class
+ */
+ public final static function createPngImage(CompileableTemplate $templateInstance) {
+ // Get a new instance
+ $imageInstance = new PngImage();
+
+ // Set template instance
+ $imageInstance->setTemplateInstance($templateInstance);
+
+ // Set image type
+ $imageInstance->setImageType('png');
+
+ // Return the instance
+ return $imageInstance;
+ }
+
+ /**
+ * Finish this image by producing it
+ *
+ * @return void
+ */
+ public function finishImage () {
+ // Call parent method
+ parent::finishImage();
+
+ // Get a file name for our image
+ $cacheFile = $this->getTemplateInstance()->getImageCacheFqfn();
+
+ // Finish the image and send it to a cache file
+ imagepng($this->getImageResource(), $cacheFile, 9, PNG_ALL_FILTERS);
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Universal file I/O stream system");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
// Is the header (maybe) valid?
if (count($header) != 4) {
// Throw an exception
- throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
} elseif (substr($rawLine, 0, 5) == "@data") {
// Is a data line!
// Was a header found?
if (count($header) != 4) {
// Throw an exception
- throw new InvalidArrayCountException(array($this, "header", count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
+ throw new InvalidArrayCountException(array($this, 'header', count($header), 4), self::EXCEPTION_ARRAY_HAS_INVALID_COUNT);
}
// Decode all from Base64
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Helper for handling directories");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
+ $this->removeSystemArray();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* Protected constructor
+ *
+ * @return void
*/
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Handler for reading from files");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
+ $this->removeSystemArray();
}
/**
* Destructor for cleaning purposes, etc
+ *
+ * @return void
*/
public final function __destruct() {
// Is there a resource pointer? Then we have to close the file here!
* Create a file pointer based on the given file. The file will also
* be verified here.
*
- * @param $fileName The file name we shall pass
- * to fopen()
+ * @param $fileName The file name we shall pass to fopen()
* @throws FileIsEmptyException If the provided file name is empty.
- * @throws FilePointerNotOpenedException If fopen() returns not a
- * file resource
+ * @throws FilePointerNotOpenedException If fopen() returns not a
+ * file resource
* @return void
*/
public final static function createFrameworkFileInputPointer ($fileName) {
// Some pre-sanity checks...
- if (is_null($fileName)) {
+ if ((is_null($fileName)) || (empty($fileName))) {
// No filename given
throw new FileIsEmptyException(null, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!file_exists($fileName)) {
+ // File does not exist!
+ throw new FileNotFoundException($fileName, self::EXCEPTION_FILE_NOT_FOUND);
+ } elseif (!is_readable($fileName)) {
+ // File does not exist!
+ throw new FileReadProtectedException($fileName, self::EXCEPTION_FILE_CANNOT_BE_READ);
}
// Try to open a handler
$filePointer = @fopen($fileName, 'rb');
- if (($filePointer === null) || ($filePointer === false)) {
+ if ((is_null($filePointer)) || ($filePointer === false)) {
// Something bad happend
throw new FilePointerNotOpenedException ($fileName, self::EXCEPTION_FILE_POINTER_INVALID);
- }
+ } // END - if
// Create new instance
$pointerInstance = new FrameworkFileInputPointer();
*
* @return mixed The result of fread()
* @throws NullPointerException If the file pointer instance
- * is not set by setPointer()
+ * is not set by setPointer()
* @throws InvalidFileResourceException If there is being set
* an invalid file resource
*/
*
* @return mixed The result of fread()
* @throws NullPointerException If the file pointer instance
- * is not set by setPointer()
+ * is not set by setPointer()
* @throws InvalidFileResourceException If there is being set
* an invalid file resource
*/
*
* @return void
* @throws NullPointerException If the file pointer instance
- * is not set by setPointer()
+ * is not set by setPointer()
* @throws InvalidFileResourceException If there is being set
*/
public function closeFile () {
/**
* Setter for the file pointer
*
- * @param $filePointer File resource
+ * @param $filePointer File resource
* @return void
*/
public final function setPointer ($filePointer) {
* Getter for the file pointer
*
* @return $filePointer The file pointer which shall be a valid
- * file resource
+ * file resource
*/
public final function getPointer () {
return $this->filePointer;
/**
* Setter for file name
*
- * @param $fileName The new file name
+ * @param $fileName The new file name
* @return void
*/
public final function setFileName ($fileName) {
/**
* Getter for file name
*
- * @return $fileName The current file name
+ * @return $fileName The current file name
*/
public final function getFileName () {
return $this->fileName;
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Handler for writing to files");
-
- // Create unique ID
- $this->generateUniqueId();
-
// Clean-up a little
$this->removeNumberFormaters();
+ $this->removeSystemArray();
}
/**
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Language sub-system");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ *
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ???Mailer extends BaseMailer implements DeliverableMail {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this mailer class
+ *
+ * @return $mailerInstance An instance of this mailer class
+ */
+ public final static function create???Mailer () {
+ // Get a new instance
+ $mailerInstance = new ???Mailer();
+
+ // Return the instance
+ return $mailerInstance;
+ }
+
+ /**
+ * Deliver email to the recipient(s)
+ *
+ * @return void
+ */
+ public function deliverEmail() {
+ $this->partialStub("You have to implement this method.");
+ }
+
+ /**
+ * Send notification to the admin
+ *
+ * @return void
+ */
+ public function sendAdminNotification() {
+ $this->partialStub("You have to implement this method.");
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general mailer class for all other mailers
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseMailer extends BaseFrameworkSystem {
+ /**
+ * Iterateable list of recipients
+ */
+ private $recipientList = array();
+
+ /**
+ * Template name
+ */
+ private $templateName = "";
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Loads a text or HTML template depending on configuration into the template engine
+ *
+ * @param $templateName Name of the template we shall load
+ * @return void
+ */
+ protected final function loadTemplate ($templateName) {
+ // Set template name
+ $this->setTemplateName($templateName);
+
+ // Get configuration entry
+ $templatePrefix = $this->getConfigInstance()->readConfig('email_tpl_' . $templateName);
+
+ // Load this email template
+ $this->getTemplateInstance()->loadEmailTemplate($templatePrefix . '_' . $templateName);
+ }
+
+ /**
+ * Adds a user class to the recipient list for current template
+ *
+ * @param $userInstance An instance of a user class
+ * @return void
+ */
+ public function addRecipientByUserInstance (ManageableMember $userInstance) {
+ // Get template name
+ $templateName = $this->getTemplateName();
+
+ // Is the list initialized?
+ if (!isset($this->recipientList[$templateName]['recipients'])) {
+ // Then initialize it here
+ $this->recipientList[$templateName]['recipients'] = array();
+ } // END - if
+
+ // Add it as a recipient
+ $this->recipientList[$templateName]['recipients'][] = $userInstance;
+ }
+
+ /**
+ * Adds a template variable (just the name) to the recipient list in given section of current template
+ *
+ * @param $section Section can be "config" or "value" currently
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ private final function addTemplateVariable ($section, $variableName) {
+ // Get template name
+ $templateName = $this->getTemplateName();
+
+ // Generate full section name
+ $sectionName = $section . '_vars';
+
+ // Is the list initialized?
+ if (!isset($this->recipientList[$templateName][$sectionName])) {
+ // Then initialize it here
+ $this->recipientList[$templateName][$sectionName] = array();
+ } // END - if
+
+ // Add the variable to the list
+ $this->recipientList[$templateName][$sectionName][$variableName] = 'OK';
+ }
+
+ /**
+ * Adds a config template variable to the recipient list of current template
+ *
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ public final function addConfigTemplateVariable ($variableName) {
+ $this->addTemplateVariable("config", $variableName);
+ }
+
+ /**
+ * Adds a "value" template variable to the recipient list of current template
+ *
+ * @param $variableName Template variable name to add
+ * @return void
+ */
+ public final function addValueTemplateVariable ($variableName) {
+ $this->addTemplateVariable("value", $variableName);
+ }
+
+ /**
+ * Adds a value instance for a given variable name. It should be set!
+ *
+ * @param $variableName Template variable we want to assign a value instance
+ * @param $valueInstance An object instance which can provide "field values"
+ * @return void
+ */
+ public final function addValueInstance ($variableName, FrameworkInterface $valueInstance) {
+ $this->recipientList[$this->getTemplateName()]['values'][$variableName] = $valueInstance;
+ }
+
+ /**
+ * Protected setter for template name
+ *
+ * @param $templateName Name of email template
+ * @return void
+ */
+ public final function setTemplateName ($templateName) {
+ $this->templateName = (string) $templateName;
+ }
+
+ /**
+ * Protected getter for template name
+ *
+ * @return $templateName Name of email template
+ */
+ protected final function getTemplateName () {
+ return $this->templateName;
+ }
+
+ /**
+ * Setter for subject line
+ *
+ * @param $subjectLine Subject line to set
+ * @return void
+ */
+ public final function setSubjectLine ($subjectLine) {
+ $this->recipientList[$this->getTemplateName()]['subject'] = (string) $subjectLine;
+ }
+
+ /**
+ * Getter for subject line or null if not found
+ *
+ * @return $subjectLine Subject line to set
+ */
+ public final function getSubjectLine () {
+ // Default subject is null
+ $subjectLine = null;
+
+ // Get template name
+ $templateName = $this->getTemplateName();
+
+ // Does the subject line exist?
+ if ((!empty($templateName)) && (isset($this->recipientList[$templateName]['subject']))) {
+ // Then use it
+ $subjectLine = $this->recipientList[$templateName]['subject'];
+ } // END - if
+
+ // Return it
+ return $subjectLine;
+ }
+
+ /**
+ * Use subject line provided by the (XML) template otherwise a subject line must be set
+ *
+ * @return void
+ */
+ public function useSubjectFromTemplate () {
+ // Set the subject line
+ $this->setSubjectLine("{?subject?}");
+ }
+
+ /**
+ * Getter for recipient list array
+ *
+ * @return $recipientList Array with reciepients
+ */
+ public final function getRecipientList () {
+ return $this->recipientList;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A mailer class for debugging purposes only. This class will print the
+ * prepared mail out and will not send it to the recipient.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class DebugMailer extends BaseMailer implements DeliverableMail {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this mailer class
+ *
+ * @param $templateInstance A template instance
+ * @param $appInstance An application helper class
+ * @param $templateName Name of email template to set
+ * @return $mailerInstance An instance of this mailer class
+ */
+ public final static function createDebugMailer (CompileableTemplate $templateInstance, ManageableApplication $appInstance, $templateName) {
+ // Get a new instance
+ $mailerInstance = new DebugMailer();
+
+ // Set template instance
+ $mailerInstance->setTemplateInstance($templateInstance);
+
+ // Set application instance
+ $mailerInstance->setApplicationInstance($appInstance);
+
+ // Set template name
+ $mailerInstance->setTemplateName('resend_link');
+
+ // Return the instance
+ return $mailerInstance;
+ }
+
+ /**
+ * Deliver email to the recipient(s)
+ *
+ * @return void
+ * @throws InvalidInterfaceException If the recipient instance does not implement ManageableMember
+ */
+ public function deliverEmail () {
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // "Deliver" all emails
+ foreach ($this->getRecipientList() as $templateName => $recipientList) {
+ // Walk through all recipients and "sent", or better print, it out
+ foreach ($recipientList['recipients'] as $recipientInstance) {
+ // The recipient should be a user instance, right?
+ if (!$recipientInstance instanceof ManageableMember) {
+ // Invalid entry found!
+ throw new InvalidInterfaceException(array($this, 'ManageableMember'), self::EXCEPTION_REQUIRED_INTERFACE_MISSING);
+ }
+
+ // User class found, so entry is valid, first load the template
+ $this->loadTemplate($templateName);
+
+ // Set subject line
+ $templateInstance->assignVariable('subject', $this->getSubjectLine());
+
+ // Walk through all variables, first config to assign them
+ foreach ($recipientList['config_vars'] as $variable=>$dummy) {
+ // Load the config value and set it
+ $templateInstance->assignConfigVariable($variable);
+ } // END - if
+
+ // Now do the same with the values but ask the "value instance" instead!
+ foreach ($recipientList['value_vars'] as $variable=>$dummy) {
+ // Is the value instance there?
+ if (!isset($recipientList['values'][$variable])) {
+ // Throw exception
+ throw new NullPointerException ($this, self::EXCEPTION_IS_NULL_POINTER);
+ } // END - if
+
+ // Get the field from the value instance
+ $fieldValue = $recipientList['values'][$variable]->getField($variable);
+
+ // Set it in the template engine
+ $templateInstance->assignVariable($variable, $fieldValue);
+ }
+
+ // Render the content
+ $templateInstance->renderXmlContent();
+
+ // Get responce instance
+ $responseInstance = $this->getApplicationInstance()->getResponseInstance();
+
+ // Transfer the data to the response
+ $this->getTemplateInstance()->transferToResponse($responseInstance);
+ } // END - foreach
+ } // END - foreach
+ }
+
+ /**
+ * Send notification to the admin
+ *
+ * @return void
+ * @todo 0% done
+ */
+ public function sendAdminNotification () {
+ // Unfinished work
+ }
+
+ /**
+ * Invokes the mail delivery process which will prepare the output of the message in a code template
+ *
+ * @return void
+ */
+ public function invokeMailDelivery () {
+ // Get template instance
+ $templateInstance = $this->getTemplateInstance();
+
+ // Get the compiled message and set it as new template variable
+ $message = $templateInstance->getCompiledData();
+ $templateInstance->assignVariable('message', $message);
+
+ // Load the code template
+ $templateInstance->loadCodeTemplate('mail_debug');
+
+ // Compile the template
+ $templateInstance->compileTemplate();
+
+ // Assign this template with variable
+ $templateInstance->assignTemplateWithVariable('mail_debug', 'content');
+
+ // Load header template
+ $templateInstance->loadCodeTemplate('header');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('header', 'header');
+
+ // Load footer template
+ $templateInstance->loadCodeTemplate('footer');
+
+ // Compile and assign it with a variable
+ $templateInstance->compileTemplate();
+ $templateInstance->assignTemplateWithVariable('footer', 'footer');
+
+ // Load the master template
+ $templateInstance->loadCodeTemplate($this->getApplicationInstance()->getMasterTemplate());
+
+ // Then compile it again
+ $templateInstance->compileVariables();
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Console output class");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
* Create a new web output system and set the content type
*
- * @param $contentType A valid content-type
- * @return $debugInstance An instance of this middleware class
+ * @param $contentType A valid content-type
+ * @return $debugInstance An instance of this middleware class
*/
public final static function createConsoleOutput ($contentType) {
// Cast the content-type to string
/**
* Getter for an instance of this class
*
- * @return $consoleInstance An instance of this class
+ * @return $consoleInstance An instance of this class
*/
public final static function getInstance() {
if (is_null(self::$consoleInstance)) {
/**
* Output the code
*
- * @param $outStream Something we shall sent to the console
+ * @param $outStream Something we shall sent to the console
* @return void
*/
public final function output ($outStream=false) {
/**
* Assigns a variable for output
*
- * @param $var The variable we shall assign
- * @param $value The value to store in the variable
+ * @param $var The variable we shall assign
+ * @param $value The value to store in the variable
* @return void
*/
public function assignVariable ($var, $value) {
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Class for web output e.g. XHTML code");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
* @return void
*/
public final function output ($outStream=false) {
- print $outStream;
+ print($outStream);
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A class for handling user points which can be real or Internet currency
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class UserPoints extends BaseFrameworkSystem implements Registerable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this points class
+ *
+ * @param $userInstance An instance of a user class
+ * @return $pointsInstance An instance of this class
+ */
+ public final static function createUserPoints (ManageableAccount $userInstance) {
+ // Get a new instance
+ $pointsInstance = new UserPoints();
+
+ // Set user instance
+ $pointsInstance->setUserInstance($userInstance);
+
+ // Return instance
+ return $pointsInstance;
+ }
+
+ /**
+ * Checks wether the user has the required amount of points left for the specified action
+ *
+ * @param $action The action or configuration entry plus prefix the user wants to perform
+ * @return $hasRequired Wether the user has the required points
+ */
+ public function ifUserHasRequiredPoints ($action) {
+ // Default is that everyone is poor... ;-)
+ $hasRequired = false;
+
+ // Get the required points entry
+ $requiredPoints = $this->getConfigInstance()->readConfig($action . '_action_points');
+
+ // Get a wrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_points_db_wrapper_class');
+
+ // Now get a search criteria and set the user's name as criteria
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+ $criteriaInstance->addCriteria('points_uid', $this->getUserInstance()->getUserName());
+ $criteriaInstance->setLimit(1);
+
+ // Get result back
+ $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Do we have an entry?
+ if ($resultInstance->next()) {
+ // Load points here - TODO!
+ $this->partialStub("Load points here for comparison.");
+ } // END - if
+
+ // Return the result
+ return $hasRequired;
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews {
+class DefaultNewsReader extends BaseFrameworkSystem implements ReadableNews, Registerable {
/**
* Protected constructor
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Default news reader");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
* @return void
*/
public function initializeReader () {
- // TODO Need to implement this method
+ // Get "page" for saving some calls
+ $page = $this->getRequestInstance()->getRequestElement('page');
+
+ // First get a wrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('news_db_wrapper_class');
+
+ // Next create a searchable criteria instance
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add the page as criteria to it at lease
+ $criteriaInstance->addCriteria('page', $page);
+
+ // Add limitation from config
+ $criteriaInstance->setLimit($this->getConfigInstance()->readConfig("news_{$page}_limit"));
+
+ // Get a resultInstance back from the database
+ $resultInstance = $wrapperInstance->doSelectByCriteria($criteriaInstance);
+
+ // Save that resultInstance in this class
+ $this->setResultInstance($resultInstance);
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseRegistration extends BaseFrameworkSystem implements UserRegister {
/**
*/
protected function executePostFilters () {
// Execute all post filters
- $this->postRegistrationFilter->processFilters($this->requestInstance, $this->responseInstance);
+ $this->postRegistrationFilter->processFilters($this->getRequestInstance(), $this->getResponseInstance());
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class Registry extends BaseFrameworkSystem implements Register {
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Registry class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
<?php
/**
- * A concrete HTTP request class to make HTTP requests more abstract
+ * A concrete and secured HTTP request class to make HTTP requests more abstract
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("HTTP request");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
* Checks wether a request element is set
* @param $element Name of the request element we want to check
* @return $isSet Wether the request element is set
- * @throws MissingArrayElementsException Thrown if a request element is not set
*/
public function isRequestElementSet ($element) {
// Is this element found?
if (!isset($this->requestData[$element])) {
- // Then throw an exception
- throw new MissingArrayElementsException(array($this, 'requestData', $element), self::EXCEPTION_MISSING_ELEMENT);
+ // Then return false
+ return false;
} // END - if
// All clear
// Initialize value
$value = null;
- try {
- if ($this->isRequestElementSet($element)) {
- $value = $this->requestData[$element];
- } // END - if
- } catch (MissingArrayElementsException $e) {
- // Do nothing here
- }
+ // Is the element set?
+ if ($this->isRequestElementSet($element)) {
+ // Get the bare value
+ $value = $this->requestData[$element];
+
+ // Secure it against attacks
+ $value = htmlentities(strip_tags($value), ENT_QUOTES);
+ } // END - if
// Return the element's value
return $value;
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A generic action resolver class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseActionResolver extends BaseResolver {
+ /**
+ * Prefix for local, remote or other resolver
+ */
+ private $actionPrefix = "";
+
+ /**
+ * Validated action name
+ */
+ private $actionName = "";
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Setter for action prefix
+ *
+ * @param $actionPrefix Last validated actionPrefix
+ * @return void
+ */
+ protected final function setActionPrefix ($actionPrefix) {
+ $this->actionPrefix = $actionPrefix;
+ }
+
+ /**
+ * Setter for action name
+ *
+ * @param $actionName Last validated action name
+ * @return void
+ */
+ protected final function setActionName ($actionName) {
+ $this->actionName = $actionName;
+ }
+
+ /**
+ * Getter for action name
+ *
+ * @return $actionName Last validated action name
+ */
+ protected final function getActionName () {
+ return $this->actionName;
+ }
+
+ /**
+ * Checks wether the given action is valid
+ *
+ * @param $actionName The default action we shall execute
+ * @return $isValid Wether the given action is valid
+ * @throws EmptyVariableException Thrown if the given action is not set
+ */
+ public function isActionValid ($actionName) {
+ // By default nothing shall be valid
+ $isValid = false;
+
+ // Is a action set?
+ if (empty($actionName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($this, 'actionName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } // END - if
+
+ // Now, let us create the full name of the action class
+ $this->setClassName(sprintf("%s%sAction",
+ $this->actionPrefix,
+ $this->convertToClassName($actionName)
+ ));
+
+ // Is this class already loaded?
+ if (class_exists($this->getClassName())) {
+ // This class does exist. :-)
+ $isValid = true;
+ } // END - if
+
+ // Debug output
+ //* DEBUG: */ $this->debugBackTrace();
+
+ // Set action name
+ $this->setActionName($actionName);
+
+ // Return the result
+ return $isValid;
+ }
+
+ /**
+ * "Loads" current action and instances it if not yet cached
+ *
+ * @return $actionInstance A loaded action instance
+ * @throws InvalidActionException Thrown if even the default
+ * action class is missing (bad!)
+ */
+ protected function loadAction () {
+ // Init action instance
+ $actionInstance = null;
+
+ // Create action class name
+ $this->setClassName(sprintf("Web%sAction",
+ $this->convertToClassName($this->getActionName())
+ ));
+
+ // Initiate the action
+ $actionInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
+
+ // Return the result
+ return $actionInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A action resolver for local (non-hubbed) actions
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebActionResolver extends BaseActionResolver implements ActionResolver {
+ /**
+ * Last successfull resolved action
+ */
+ private $lastActionInstance = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "Web"
+ $this->setActionPrefix("Web");
+ }
+
+ /**
+ * Creates an instance of a Web action resolver with a given default action
+ *
+ * @param $actionName The default action we shall execute
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared action resolver instance
+ * @throws EmptyVariableException Thrown if the default action is not set
+ * @throws InvalidActionException Thrown if the default action is invalid
+ */
+ public final static function createWebActionResolver ($actionName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new WebActionResolver();
+
+ // Is the variable $actionName set and the action is valid?
+ if (empty($actionName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'defaultAction'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->isActionValid($actionName)) {
+ // Invalid action found
+ throw new InvalidActionException(array($resolverInstance, $actionName), self::EXCEPTION_INVALID_ACTION);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Returns an action instance for a given request class or null if
+ * it was not found
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $actionInstance An instance of the resolved action
+ * @throws InvalidActionException Thrown if $actionName is
+ * invalid
+ * @throws InvalidActionInstanceException Thrown if $actionInstance
+ * is an invalid instance
+ */
+ public function resolveActionByRequest (Requestable $requestInstance) {
+ // Init variables
+ $actionName = "";
+ $actionInstance = null;
+
+ // This goes fine so let's resolv the action
+ $actionName = $requestInstance->getRequestElement('action');
+
+ // Is the action empty? Then fall back to default action
+ if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
+
+ // Check if the action is valid
+ if (!$this->isActionValid($actionName)) {
+ // This action is invalid!
+ throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
+ } // END - if
+
+ // Get the action
+ $actionInstance = $this->loadAction();
+
+ // And validate it
+ if ((!is_object($actionInstance)) || (!$actionInstance instanceof Actionable)) {
+ // This action has an invalid instance!
+ throw new InvalidActionInstanceException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
+ } // END - if
+
+ // Set last action
+ $this->lastActionInstance = $actionInstance;
+
+ // Return the resolved action instance
+ return $actionInstance;
+ }
+
+ /**
+ * Resolves the action by its direct name and returns an instance of its class
+ *
+ * @return $actionInstance An instance of the action class
+ * @throws InvalidActionException Thrown if $actionName is invalid
+ */
+ public function resolveAction () {
+ // Initiate the instance variable
+ $actionInstance = null;
+
+ // Get action name
+ $actionName = $this->getActionName();
+
+ // Is the action empty? Then fall back to default action
+ if (empty($actionName)) $actionName = $this->getConfigInstance()->readConfig('default_action');
+
+ // Check if the action is valid
+ if (!$this->isActionValid($actionName)) {
+ // This action is invalid!
+ throw new InvalidActionException(array($this, $actionName), self::EXCEPTION_INVALID_ACTION);
+ }
+
+ // Get the action
+ $actionInstance = $this->loadAction();
+
+ // Return the instance
+ return $actionInstance;
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*/
class BaseResolver extends BaseFrameworkSystem {
/**
- * Validated command name
+ * Class name
*/
- private $commandName = "";
+ private $className = "";
- /**
- * Prefix for local, remote or other resolver
- */
- private $commandPrefix = "";
-
- /**
- * A controller instance
- */
- private $controllerInstance = null;
+ // Exception constants
+ const EXCEPTION_INVALID_COMMAND = 0x1d0;
+ const EXCEPTION_INVALID_CONTROLLER = 0x1d1;
+ const EXCEPTION_INVALID_ACTION = 0x1d2;
/**
* Protected constructor
*
+ * @param $className Real name of the class
* @return void
*/
- protected function __construct ($class) {
+ protected function __construct ($className) {
// Call parent constructor
- parent::__construct($class);
+ parent::__construct($className);
// Clean up a little
$this->removeNumberFormaters();
}
/**
- * Setter for controller instance (this surely breaks a bit the MVC patterm)
+ * Setter for class name
*
- * @param $controllerInstance An instance of the controller
+ * @param $className Name of the class
* @return void
*/
- public final function setControllerInstance (Controller $controllerInstance) {
- $this->controllerInstance = $controllerInstance;
+ protected final function setClassName ($className) {
+ $this->className = $className;
}
/**
- * Getter for controller instance (this surely breaks a bit the MVC patterm)
+ * Getter for class name
*
- * @return $controllerInstance An instance of the controller
+ * @return $className Name of the class
*/
- public final function getControllerInstance () {
- return $this->controllerInstance;
- }
-
- /**
- * Setter for command name
- *
- * @param $commandName Last validated command name
- * @return void
- */
- protected final function setCommandName ($commandName) {
- $this->commandName = $commandName;
- }
-
- /**
- * Getter for command name
- *
- * @return $commandName Last validated command name
- */
- protected final function getCommandName () {
- return $this->commandName;
- }
-
- /**
- * Setter for command prefix
- *
- * @param $commandPrefix Last validated commandPrefix
- * @return void
- */
- protected final function setCommandPrefix ($commandPrefix) {
- $this->commandPrefix = $commandPrefix;
- }
-
- /**
- * Checks wether the given command is valid
- *
- * @param $commandName The default command we shall execute
- * @return $isValid Wether the given command is valid
- * @throws EmptyVariableException Thrown if the given command is not set
- */
- public function isCommandValid ($commandName) {
- // By default nothing shall be valid
- $isValid = false;
-
- // Is a command set?
- if (empty($commandName)) {
- // Then thrown an exception here
- throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
- }
-
- // Now, let us create the full name of the command class
- $class = sprintf("%s%sCommand",
- $this->commandPrefix,
- $this->convertToClassName($commandName)
- );
-
- // Is this class already loaded?
- if (class_exists($class)) {
- // This class does exist. :-)
- $isValid = true;
- }
-
- // Debug output
- //echo "<strong>----- ".__METHOD__." -----</strong><br />\n";
- //print($class."<pre>");
- //debug_print_backtrace();
- //var_dump($isValid);
- //print("</pre>");
-
- // Set command name
- $this->setCommandName($commandName);
-
- // Return the result
- return $isValid;
+ public final function getClassName () {
+ return $this->className;
}
}
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A generic command resolver class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseCommandResolver extends BaseResolver {
+ /**
+ * Prefix for local, remote or other resolver
+ */
+ private $commandPrefix = "";
+
+ /**
+ * Validated command name
+ */
+ private $commandName = "";
+
+ /**
+ * A controller instance
+ */
+ private $controllerInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Setter for command prefix
+ *
+ * @param $commandPrefix Last validated commandPrefix
+ * @return void
+ */
+ protected final function setCommandPrefix ($commandPrefix) {
+ $this->commandPrefix = $commandPrefix;
+ }
+
+ /**
+ * Setter for command name
+ *
+ * @param $commandName Last validated command name
+ * @return void
+ */
+ protected final function setCommandName ($commandName) {
+ $this->commandName = $commandName;
+ }
+
+ /**
+ * Getter for command name
+ *
+ * @return $commandName Last validated command name
+ */
+ protected final function getCommandName () {
+ return $this->commandName;
+ }
+
+ /**
+ * Setter for controller instance (this surely breaks a bit the MVC patterm)
+ *
+ * @param $controllerInstance An instance of the controller
+ * @return void
+ */
+ public final function setControllerInstance (Controller $controllerInstance) {
+ $this->controllerInstance = $controllerInstance;
+ }
+
+ /**
+ * Getter for controller instance (this surely breaks a bit the MVC patterm)
+ *
+ * @return $controllerInstance An instance of the controller
+ */
+ public final function getControllerInstance () {
+ return $this->controllerInstance;
+ }
+
+ /**
+ * Checks wether the given command is valid
+ *
+ * @param $commandName The default command we shall execute
+ * @return $isValid Wether the given command is valid
+ * @throws EmptyVariableException Thrown if the given command is not set
+ */
+ public function isCommandValid ($commandName) {
+ // By default nothing shall be valid
+ $isValid = false;
+
+ // Is a command set?
+ if (empty($commandName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($this, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ }
+
+ // Now, let us create the full name of the command class
+ $this->setClassName(sprintf("%s%sCommand",
+ $this->commandPrefix,
+ $this->convertToClassName($commandName)
+ ));
+
+ // Is this class already loaded?
+ if (class_exists($this->getClassName())) {
+ // This class does exist. :-)
+ $isValid = true;
+ } // END - if
+
+ // Debug output
+ //* DEBUG: */ $this->debugBackTrace();
+
+ // Set command name
+ $this->setCommandName($commandName);
+
+ // Return the result
+ return $isValid;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command resolver for local (non-hubbed) image commands
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageCommandResolver extends BaseCommandResolver implements CommandResolver {
+ /**
+ * Last successfull resolved command
+ */
+ private $lastCommandInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "Image"
+ $this->setCommandPrefix("Image");
+ }
+
+ /**
+ * Creates an instance of a Image command resolver with a given default command
+ *
+ * @param $commandName The default command we shall execute
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared command resolver instance
+ * @throws EmptyVariableException Thrown if the default command is not set
+ * @throws InvalidCommandException Thrown if the default command is invalid
+ */
+ public final static function createImageCommandResolver ($commandName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new ImageCommandResolver();
+
+ // Is the variable $commandName set and the command is valid?
+ if (empty($commandName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->isCommandValid($commandName)) {
+ // Invalid command found
+ throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Returns an command instance for a given request class or null if
+ * it was not found
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $commandInstance An instance of the resolved command
+ * @throws InvalidCommandException Thrown if $commandName is
+ * invalid
+ * @throws InvalidCommandInstanceException Thrown if $commandInstance
+ * is an invalid instance
+ */
+ public function resolveCommandByRequest (Requestable $requestInstance) {
+ // Init variables
+ $commandName = "";
+ $commandInstance = null;
+
+ // This goes fine so let's resolv the command
+ $commandName = $requestInstance->getRequestElement('page');
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
+
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // And validate it
+ if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+ // This command has an invalid instance!
+ throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Set last command
+ $this->lastCommandInstance = $commandInstance;
+
+ // Return the resolved command instance
+ return $commandInstance;
+ }
+
+ /**
+ * Resolves the command by its direct name and returns an instance of its class
+ *
+ * @param $commandName The direct command name we shall resolve
+ * @return $commandInstance An instance of the command class
+ * @throws InvalidCommandException Thrown if $commandName is invalid
+ */
+ public function resolveCommand ($commandName) {
+ // Initiate the instance variable
+ $commandInstance = null;
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_image_command');
+
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // Return the instance
+ return $commandInstance;
+ }
+
+ /**
+ * "Loads" a given command and instances it if not yet cached
+ *
+ * @param $commandName A command name we shall look for
+ * @return $commandInstance A loaded command instance
+ * @throws InvalidCommandException Thrown if even the default
+ * command class is missing (bad!)
+ */
+ private function loadCommand ($commandName) {
+ // Cache default command
+ $defaultCommand = $this->getConfigInstance()->readConfig('default_image_command');
+
+ // Init command instance
+ $commandInstance = null;
+
+ // Create command class name
+ $this->setClassName(sprintf("Image%sCommand",
+ $this->convertToClassName($commandName)
+ ));
+
+ // Is this class loaded?
+ if (!class_exists($this->getClassName())) {
+ // Class not found, so throw an exception
+ throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Initiate the command
+ $commandInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
+
+ // Return the result
+ return $commandInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A command resolver for local (non-hubbed) web commands
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebCommandResolver extends BaseCommandResolver implements CommandResolver {
+ /**
+ * Last successfull resolved command
+ */
+ private $lastCommandInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "Web"
+ $this->setCommandPrefix("Web");
+ }
+
+ /**
+ * Creates an instance of a Web command resolver with a given default command
+ *
+ * @param $commandName The default command we shall execute
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared command resolver instance
+ * @throws EmptyVariableException Thrown if the default command is not set
+ * @throws InvalidCommandException Thrown if the default command is invalid
+ */
+ public final static function createWebCommandResolver ($commandName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new WebCommandResolver();
+
+ // Is the variable $commandName set and the command is valid?
+ if (empty($commandName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->isCommandValid($commandName)) {
+ // Invalid command found
+ throw new InvalidCommandException(array($resolverInstance, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Returns an command instance for a given request class or null if
+ * it was not found
+ *
+ * @param $requestInstance An instance of a request class
+ * @return $commandInstance An instance of the resolved command
+ * @throws InvalidCommandException Thrown if $commandName is
+ * invalid
+ * @throws InvalidCommandInstanceException Thrown if $commandInstance
+ * is an invalid instance
+ */
+ public function resolveCommandByRequest (Requestable $requestInstance) {
+ // Init variables
+ $commandName = "";
+ $commandInstance = null;
+
+ // This goes fine so let's resolv the command
+ $commandName = $requestInstance->getRequestElement('page');
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
+
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // And validate it
+ if ((!is_object($commandInstance)) || (!$commandInstance instanceof Commandable)) {
+ // This command has an invalid instance!
+ throw new InvalidCommandInstanceException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Set last command
+ $this->lastCommandInstance = $commandInstance;
+
+ // Return the resolved command instance
+ return $commandInstance;
+ }
+
+ /**
+ * Resolves the command by its direct name and returns an instance of its class
+ *
+ * @param $commandName The direct command name we shall resolve
+ * @return $commandInstance An instance of the command class
+ * @throws InvalidCommandException Thrown if $commandName is invalid
+ */
+ public function resolveCommand ($commandName) {
+ // Initiate the instance variable
+ $commandInstance = null;
+
+ // Is the command empty? Then fall back to default command
+ if (empty($commandName)) $commandName = $this->getConfigInstance()->readConfig('default_web_command');
+
+ // Check if the command is valid
+ if (!$this->isCommandValid($commandName)) {
+ // This command is invalid!
+ throw new InvalidCommandException(array($this, $commandName), self::EXCEPTION_INVALID_COMMAND);
+ }
+
+ // Get the command
+ $commandInstance = $this->loadCommand($commandName);
+
+ // Return the instance
+ return $commandInstance;
+ }
+
+ /**
+ * "Loads" a given command and instances it if not yet cached
+ *
+ * @param $commandName A command name we shall look for
+ * @return $commandInstance A loaded command instance
+ * @throws InvalidCommandException Thrown if even the default
+ * command class is missing (bad!)
+ */
+ private function loadCommand ($commandName) {
+ // Cache default command
+ $defaultCommand = $this->getConfigInstance()->readConfig('default_web_command');
+
+ // Init command instance
+ $commandInstance = null;
+
+ // Create command class name
+ $this->setClassName(sprintf("Web%sCommand",
+ $this->convertToClassName($commandName)
+ ));
+
+ // Is this class loaded?
+ if (!class_exists($this->getClassName())) {
+ // Class not found, so throw an exception
+ throw new InvalidCommandException(array($this, $defaultCommand), self::EXCEPTION_INVALID_COMMAND);
+ } // END - if
+
+ // Initiate the command
+ $commandInstance = ObjectFactory::createObjectByName($this->getClassName(), array($this));
+
+ // Return the result
+ return $commandInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A generic controller resolver class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseControllerResolver extends BaseResolver {
+ /**
+ * Prefix for local, remote or other resolver
+ */
+ private $controllerPrefix = "";
+
+ /**
+ * Validated controller name
+ */
+ private $controllerName = "";
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the real class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+ }
+
+ /**
+ * Setter for controller prefix
+ *
+ * @param $controllerPrefix Last validated controllerPrefix
+ * @return void
+ */
+ protected final function setControllerPrefix ($controllerPrefix) {
+ $this->controllerPrefix = $controllerPrefix;
+ }
+
+ /**
+ * Setter for controller name
+ *
+ * @param $controllerName Last validated controller name
+ * @return void
+ */
+ protected final function setControllerName ($controllerName) {
+ $this->controllerName = $controllerName;
+ }
+
+ /**
+ * Getter for controller name
+ *
+ * @return $controllerName Last validated controller name
+ */
+ public final function getControllerName () {
+ return $this->controllerName;
+ }
+
+ /**
+ * Checks wether the given controller is valid
+ *
+ * @param $controllerName The default controller we shall execute
+ * @return $isValid Wether the given controller is valid
+ * @throws EmptyVariableException Thrown if the given controller is not set
+ * @throws DefaultControllerException If the default controller was not found
+ */
+ public function isControllerValid ($controllerName) {
+ // By default nothing shall be valid
+ $isValid = false;
+
+ // Is a controller set?
+ if (empty($controllerName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($this, 'controllerName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } // END - if
+
+ // Now, let us create the full name of the controller class
+ $this->setClassName(sprintf("%s%sController",
+ $this->controllerPrefix,
+ $this->convertToClassName($controllerName)
+ ));
+
+ // Try it hard to get an controller
+ while (!$isValid) {
+ // Is this class already loaded?
+ if (class_exists($this->getClassName())) {
+ // This class does exist. :-)
+ $isValid = true;
+ } elseif (($this->getClassName() != $this->controllerPrefix.'DefaultController') && ($this->getClassName() != $this->controllerPrefix.'DefaultNewsController')) {
+ // Do we have news?
+ if ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
+ // Yes, display news in home then set default controller with news
+ $this->setClassName($this->controllerPrefix . 'DefaultNewsController');
+ } else {
+ // No news at home page or non-news page
+ $this->setClassName($this->controllerPrefix . 'DefaultController');
+ }
+ } else {
+ // All is tried, give it up here
+ throw new DefaultControllerException($this, self::EXCEPTION_DEFAULT_CONTROLLER_GONE);
+ }
+ } // END - while
+
+ // Debug output
+ //* DEBUG: */ $this->debugBackTrace();
+
+ // Return the result
+ return $isValid;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageControllerResolver extends BaseControllerResolver implements ControllerResolver {
+ /**
+ * Last successfull resolved controller (name)
+ */
+ private $lastControllerName = "";
+
+ /**
+ * Last successfull resolved controller (instance)
+ */
+ private $lastControllerInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "Image"
+ $this->setControllerPrefix("Image");
+ }
+
+ /**
+ * Creates an instance of a resolver class with a given command
+ *
+ * @param $controllerName The controller we shall resolve
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared controller resolver instance
+ * @throws EmptyVariableException Thrown if the default command is not set
+ * @throws InvalidControllerException Thrown if the default controller is invalid
+ */
+ public final static function createImageControllerResolver ($controllerName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new ImageControllerResolver();
+
+ // Is the variable $controllerName set and the command is valid?
+ if (empty($controllerName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->isControllerValid($controllerName)) {
+ // Invalid command found
+ throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Set command name
+ $resolverInstance->setControllerName($controllerName);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Resolves the default controller of the given command
+ *
+ * @return $controllerInstance A controller instance for the default
+ * command
+ * @throws InvalidControllerInstanceException Thrown if $controllerInstance
+ * is invalid
+ */
+ public function resolveController () {
+ // Init variables
+ $controllerName = "";
+ $controllerInstance = null;
+
+ // Get the command name
+ $controllerName = $this->getControllerName();
+
+ // Get the command
+ $controllerInstance = $this->loadController($controllerName);
+
+ // And validate it
+ if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+ // This command has an invalid instance!
+ throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Set last controller
+ $this->lastControllerInstance = $controllerInstance;
+
+ // Return the maybe resolved instance
+ return $controllerInstance;
+ }
+
+ /**
+ * "Loads" a given controller and instances it if not yet cached. If the
+ * controller was not found one of the default controllers will be used
+ * depending on wether news shall be displayed.
+ *
+ * @param $controllerName A controller name we shall look for
+ * @return $controllerInstance A loaded controller instance
+ * @throws InvalidControllerException Thrown if even the requested
+ * controller class is missing (bad!)
+ */
+ private function loadController ($controllerName) {
+ // Debug message
+ //* DEBUG: */ $this->debugBackTrace();
+
+ // Cache default command
+ $defaultController = $this->getConfigInstance()->readConfig('default_image_command');
+
+ // Init controller instance
+ $controllerInstance = null;
+
+ // Default controller
+ $this->setClassName($defaultController);
+
+ // Generate the class name
+ //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
+ if ($controllerName != $defaultController) {
+ // Create controller class name
+ $this->setClassName(sprintf("Image%sController",
+ $this->convertToClassName($controllerName)
+ ));
+ } // END - if
+ //* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
+
+ // Is this class loaded?
+ if (!class_exists($this->getClassName())) {
+ // Class not found, so or throw an exception
+ throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Initiate the resolver and controller
+ $resolverInstance = ObjectFactory::createObjectByConfiguredName('image_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
+ $controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
+
+ // Remove resolver
+ unset($resolverInstance);
+
+ // Return the result
+ return $controllerInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A resolver for resolving controllers locally
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebControllerResolver extends BaseControllerResolver implements ControllerResolver {
+ /**
+ * Last successfull resolved controller (name)
+ */
+ private $lastControllerName = "";
+
+ /**
+ * Last successfull resolved controller (instance)
+ */
+ private $lastControllerInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Set prefix to "Web"
+ $this->setControllerPrefix("Web");
+ }
+
+ /**
+ * Creates an instance of a resolver class with a given command
+ *
+ * @param $controllerName The controller we shall resolve
+ * @param $appInstance An instance of a manageable application helper class
+ * @return $resolverInstance The prepared controller resolver instance
+ * @throws EmptyVariableException Thrown if the default command is not set
+ * @throws InvalidControllerException Thrown if the default controller is invalid
+ */
+ public final static function createWebControllerResolver ($controllerName, ManageableApplication $appInstance) {
+ // Create the new instance
+ $resolverInstance = new WebControllerResolver();
+
+ // Is the variable $controllerName set and the command is valid?
+ if (empty($controllerName)) {
+ // Then thrown an exception here
+ throw new EmptyVariableException(array($resolverInstance, 'commandName'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!$resolverInstance->isControllerValid($controllerName)) {
+ // Invalid command found
+ throw new InvalidControllerException(array($resolverInstance, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ }
+
+ // Set the application instance
+ $resolverInstance->setApplicationInstance($appInstance);
+
+ // Set command name
+ $resolverInstance->setControllerName($controllerName);
+
+ // Return the prepared instance
+ return $resolverInstance;
+ }
+
+ /**
+ * Resolves the default controller of the given command
+ *
+ * @return $controllerInstance A controller instance for the default
+ * command
+ * @throws InvalidControllerInstanceException Thrown if $controllerInstance
+ * is invalid
+ */
+ public function resolveController () {
+ // Init variables
+ $controllerName = "";
+ $controllerInstance = null;
+
+ // Get the command name
+ $controllerName = $this->getControllerName();
+
+ // Get the command
+ $controllerInstance = $this->loadController($controllerName);
+
+ // And validate it
+ if ((!is_object($controllerInstance)) || (!$controllerInstance instanceof Controller)) {
+ // This command has an invalid instance!
+ throw new InvalidControllerInstanceException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Set last controller
+ $this->lastControllerInstance = $controllerInstance;
+
+ // Return the maybe resolved instance
+ return $controllerInstance;
+ }
+
+ /**
+ * "Loads" a given controller and instances it if not yet cached. If the
+ * controller was not found one of the default controllers will be used
+ * depending on wether news shall be displayed.
+ *
+ * @param $controllerName A controller name we shall look for
+ * @return $controllerInstance A loaded controller instance
+ * @throws InvalidControllerException Thrown if even the requested
+ * controller class is missing (bad!)
+ */
+ private function loadController ($controllerName) {
+ // Debug message
+ //* DEBUG: */ $this->debugBackTrace();
+
+ // Cache default command
+ $defaultController = $this->getConfigInstance()->readConfig('default_web_command');
+
+ // Init controller instance
+ $controllerInstance = null;
+
+ // Default controller
+ $this->setClassName('WebDefaultController');
+
+ // Generate the class name
+ //* DEBUG: */ echo __METHOD__.": Controller=".$controllerName;
+ if ($controllerName != $defaultController) {
+ // Create controller class name
+ $this->setClassName(sprintf("Web%sController",
+ $this->convertToClassName($controllerName)
+ ));
+ } elseif ($this->getConfigInstance()->readConfig('page_with_news') == $this->getApplicationInstance()->getRequestInstance()->getRequestElement('page')) {
+ // Yes, display news in home then set default controller with news
+ $this->setClassName('WebDefaultNewsController');
+ } else {
+ // No news at home page or non-news page
+ $this->setClassName('WebDefaultController');
+ }
+ //* DEBUG: */ echo ", controller=".$this->getClassName()."<br />\n";
+
+ // Is this class loaded?
+ if (!class_exists($this->getClassName())) {
+ // Throw an exception here
+ throw new InvalidControllerException(array($this, $controllerName), self::EXCEPTION_INVALID_CONTROLLER);
+ } // END - if
+
+ // Initiate the resolver and controller
+ $resolverInstance = ObjectFactory::createObjectByConfiguredName('web_cmd_resolver_class', array($controllerName, $this->getApplicationInstance()));
+ $controllerInstance = ObjectFactory::createObjectByName($this->getClassName(), array($resolverInstance));
+
+ // Remove resolver
+ unset($resolverInstance);
+
+ // Return the result
+ return $controllerInstance;
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local web commands");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Web"
$this->setCommandPrefix("Web");
}
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Resolver for local web controllers");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Set prefix to "Web"
$this->setCommandPrefix("Web");
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
/**
* Instance of the template engine
*/
- private $templateEngine = null;
+ private $templateInstance = null;
/**
* Fatal resolved messages from filters and so on
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("HTTP response");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
/**
* Flushs the cached HTTP response to the outer world
*
- * @param $foce Wether we shall force the output or abort if headers are
+ * @param $force Wether we shall force the output or abort if headers are
* already sent with an exception
* @return void
* @throws ResponseHeadersAlreadySentException Thrown if headers are
* @return void
*/
public final function initTemplateEngine (ManageableApplication $appInstance) {
- $this->templateEngine = $this->prepareTemplateEngine($appInstance);
- }
-
- /**
- * Getter for the template engine instance
- *
- * @return $templateEngine An instance of the used template engine
- */
- public final function getTemplateEngine () {
- return $this->templateEngine;
+ $this->setTemplateInstance($this->prepareTemplateInstance($appInstance));
}
/**
* @param $expires Timestamp of expiration (default: configured)
* @return void
* @throws ResponseHeadersAlreadySentException If headers are already sent
+ * @todo Encryption of cookie data not yet supported.
+ * @todo Why are these parameters conflicting?
+ * @todo If the return statement is removed and setcookie() commented out,
+ * @todo this will send only one cookie out, the first one.
*/
public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) {
+ //* DEBUG: */ echo $cookieName."=".$cookieValue."<br />\n";
// Are headers already sent?
if (headers_sent()) {
// Throw an exception here
+ //* DEBUG: */ return;
throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
} // END - if
// Shall we encrypt the cookie?
if ($encrypted === true) {
- // @TODO Encryption of cookie data not yet supported
} // END - if
// For slow browsers set the cookie array element first
$domain = $this->getConfigInstance()->readConfig('cookie_domain');
setcookie($cookieName, $cookieValue, $expires);
- // TODO Why are these parameters conflicting?
//, $path, $domain, (isset($_SERVER['HTTPS']))
return;
- // TODO This will send only one cookie out, the first one.
// Now construct the full header
$cookieString = $cookieName . "=" . $cookieValue . "; ";
$cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
- // TODO Why are these parameters conflicting?
// $cookieString .= "; path=".$path."; domain=".$domain;
// Set the cookie as a header
unset($_COOKIE[$cookieName]);
} // END - if
}
+
+ /**
+ * Refreshs a given cookie. This will make the cookie live longer
+ *
+ * @param $cookieName Cookie to refresh
+ * @return void
+ */
+ public function refreshCookie ($cookieName) {
+ // Only update existing cookies
+ if (isset($_COOKIE[$cookieName])) {
+ // Update the cookie
+ $this->addCookie($cookieName, $_COOKIE[$cookieName], false);
+ } // END - if
+ }
+
+ /**
+ * Getter for default command
+ *
+ * @return $defaultCommand Default command for this response
+ */
+ public function getDefaultCommand () {
+ $defaultCommand = $this->getConfigInstance()->readConfig('default_web_command');
+ return $defaultCommand;
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * A class for an image response on an HTTP request
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The extended headers are taken from phpMyAdmin setup tool, written by
+ * Michal Cihar <michal@cihar.com>, licensed under GNU GPL 2.0.
+ */
+class ImageResponse extends BaseFrameworkSystem implements Responseable {
+ /**
+ * Response status
+ */
+ private $responseStatus = "200 OK";
+
+ /**
+ * Array with all headers
+ */
+ private $responseHeaders = array();
+
+ /**
+ * Cookies we shall sent out
+ */
+ private $cookies = array();
+
+ /**
+ * Body of the response
+ */
+ private $responseBody = "";
+
+ /**
+ * Fatal resolved messages from filters and so on
+ */
+ private $fatalMessages = array();
+
+ /**
+ * Instance of the image
+ */
+ private $imageInstance = null;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an object of this class
+ *
+ * @param $appInstance An instance of a manageable application
+ * @return $responseInstance A prepared instance of this class
+ */
+ public final static function createImageResponse (ManageableApplication $appInstance) {
+ // Get a new instance
+ $responseInstance = new ImageResponse();
+
+ // Set the application instance
+ $responseInstance->setApplicationInstance($appInstance);
+
+ // Initialize the template engine here
+ $responseInstance->initTemplateEngine($appInstance);
+
+ // Return the prepared instance
+ return $responseInstance;
+ }
+
+ /**
+ * Setter for status
+ *
+ * @param $status New response status
+ * @return void
+ */
+ public final function setResponseStatus ($status) {
+ $this->responseStatus = (string) $status;
+ }
+
+ /**
+ * Add header element
+ *
+ * @param $name Name of header element
+ * @param $value Value of header element
+ * @return void
+ */
+ public final function addHeader ($name, $value) {
+ $this->responseHeaders[$name] = $value;
+ }
+
+ /**
+ * Reset the header array
+ *
+ * @return void
+ */
+ public final function resetResponseHeaders () {
+ $this->responseHeaders = array();
+ }
+
+ /**
+ * "Writes" data to the response body
+ *
+ * @param $output Output we shall sent in the HTTP response
+ * @return void
+ */
+ public function writeToBody ($output) {
+ $this->responseBody .= $output;
+ }
+
+ /**
+ * Sets the response body to something new
+ *
+ * @param $output Output we shall sent in the HTTP response
+ * @return void
+ */
+ public function setResponseBody ($output) {
+ $this->responseBody = $output;
+ }
+
+ /**
+ * Flushs the cached HTTP response to the outer world
+ *
+ * @param $force Wether we shall force the output or abort if headers are
+ * already sent with an exception
+ * @return void
+ * @throws ResponseHeadersAlreadySentException Thrown if headers are
+ * already sent
+ */
+ public function flushBuffer ($force=false) {
+ if ((headers_sent()) && (!$force)) {
+ // Headers are already sent!
+ throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
+ } elseif (!headers_sent()) {
+ // Send headers out
+ header("HTTP/1.1 {$this->responseStatus}");
+
+ // Used later
+ $now = gmdate('D, d M Y H:i:s') . ' GMT';
+
+ // General header for no caching
+ $this->addHeader('Expired', $now); // rfc2616 - Section 14.21
+ $this->addHeader('Last-Modified', $now);
+ $this->addHeader('Cache-Control', 'no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
+ $this->addHeader('Pragma', 'no-cache'); // HTTP/1.0
+ $this->addHeader('Content-type', 'image/'.$this->imageInstance->getImageType());
+
+ // Define the charset to be used
+ //$this->addHeader('Content-Type:', sprintf("text/html; charset=%s", $this->getConfigInstance()->readConfig('header_charset')));
+
+ foreach ($this->responseHeaders as $name=>$value) {
+ header("{$name}: {$value}");
+ } // END - foreach
+
+ // Send cookies out?
+ if (count($this->cookies) > 0) {
+ // Send all cookies
+ $cookieString = implode(" ", $this->cookies);
+ header("Set-Cookie: {$cookieString}");
+
+ // Remove them all
+ $this->cookies = array();
+ } // END - if
+ }
+
+ // Are there some error messages?
+ if (count($this->fatalMessages) == 0) {
+ // Get image content from cache
+ $imageContent = $this->imageInstance->getContent();
+ die($imageContent);
+ } else {
+ // Display all error messages
+ $this->partialStub("Fatal messages are currently unsupported in image response.");
+ }
+
+ // Clear response header and body
+ $this->setResponseBody("");
+ $this->resetResponseHeaders();
+ }
+
+ /**
+ * Initializes the template engine instance
+ *
+ * @param $appInstance An instance of a manageable application
+ * @return void
+ */
+ public final function initTemplateEngine (ManageableApplication $appInstance) {
+ // Get config instance
+ $cfg = $this->getConfigInstance();
+
+ // Set new template engine
+ $cfg->setConfigEntry('template_class' , $cfg->readConfig('image_template_class'));
+ $cfg->setConfigEntry('raw_template_extension' , ".img");
+ $cfg->setConfigEntry('code_template_extension', ".itp");
+ $cfg->setConfigEntry('tpl_base_path' , "templates/images/");
+ $cfg->setConfigEntry('code_template_type' , "image");
+
+ // Get a prepared instance
+ $this->setTemplateInstance($this->prepareTemplateInstance($appInstance));
+ }
+
+ /**
+ * Adds a fatal message id to the response. The added messages can then be
+ * processed and outputed to the world
+ *
+ * @param $messageId The message id we shall add
+ * @return void
+ */
+ public final function addFatalMessage ($messageId) {
+ // Adds the resolved message id to the fatal message list
+ $this->fatalMessages[] = $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId);
+ }
+
+ /**
+ * Adds a cookie to the response
+ *
+ * @param $cookieName Cookie's name
+ * @param $cookieValue Value to store in the cookie
+ * @param $encrypted Do some extra encryption on the value
+ * @param $expires Timestamp of expiration (default: configured)
+ * @return void
+ * @throws ResponseHeadersAlreadySentException If headers are already sent
+ * @todo Encryption of cookie data not yet supported.
+ * @todo Why are these parameters conflicting?
+ * @todo If the return statement is removed and setcookie() commented out,
+ * @todo this will send only one cookie out, the first one.
+ */
+ public function addCookie ($cookieName, $cookieValue, $encrypted = false, $expires = null) {
+ // Are headers already sent?
+ if (headers_sent()) {
+ // Throw an exception here
+ throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
+ } // END - if
+
+ // Shall we encrypt the cookie?
+ if ($encrypted === true) {
+ } // END - if
+
+ // For slow browsers set the cookie array element first
+ $_COOKIE[$cookieName] = $cookieValue;
+
+ // Get all config entries
+ if (is_null($expires)) {
+ $expires = (time() + $this->getConfigInstance()->readConfig('cookie_expire'));
+ } // END - if
+
+ $path = $this->getConfigInstance()->readConfig('cookie_path');
+ $domain = $this->getConfigInstance()->readConfig('cookie_domain');
+
+ setcookie($cookieName, $cookieValue, $expires);
+ //, $path, $domain, (isset($_SERVER['HTTPS']))
+ return;
+
+ // Now construct the full header
+ $cookieString = $cookieName . "=" . $cookieValue . "; ";
+ $cookieString .= "expires=" . date("D, d-F-Y H:i:s", $expires) . " GMT";
+ // $cookieString .= "; path=".$path."; domain=".$domain;
+
+ // Set the cookie as a header
+ $this->cookies[$cookieName] = $cookieString;
+ }
+
+ /**
+ * Redirect to a configured URL. The URL can be absolute or relative. In
+ * case of relative URL it will be extended automatically.
+ *
+ * @param $configEntry The configuration entry which holds our URL
+ * @return void
+ * @throws ResponseHeadersAlreadySentException If headers are already sent
+ */
+ public function redirectToConfiguredUrl ($configEntry) {
+ // Is the header not yet sent?
+ if (headers_sent()) {
+ // Throw an exception here
+ throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
+ } // END - if
+
+ // Get the url from config
+ $url = $this->getConfigInstance()->readConfig($configEntry);
+
+ // Do we have a "http" in front of the URL?
+ if (substr(strtolower($url), 0, 4) != "http") {
+ // Is there a / in front of the relative URL?
+ if (substr($url, 0, 1) == "/") $url = substr($url, 1);
+
+ // No, then extend it with our base URL
+ $url = $this->getConfigInstance()->readConfig('base_url') . "/" . $url;
+ } // END - if
+
+ // Add redirect header
+ $this->addHeader("Location", $url);
+
+ // Set correct response status
+ $this->setResponseStatus("301 Moved Permanently");
+
+ // Clear the body
+ $this->setResponseBody("");
+
+ // Flush the result
+ $this->flushBuffer();
+
+ // All done here...
+ exit();
+ }
+
+ /**
+ * Expires the given cookie if it is set
+ *
+ * @param $cookieName Cookie to expire
+ * @return void
+ */
+ public function expireCookie ($cookieName) {
+ // Is the cookie there?
+ if (isset($_COOKIE[$cookieName])) {
+ // Then expire it with 20 minutes past
+ $this->addCookie($cookieName, "", false, (time() - 1200));
+
+ // Remove it from array
+ unset($_COOKIE[$cookieName]);
+ } // END - if
+ }
+
+ /**
+ * Refreshs a given cookie. This will make the cookie live longer
+ *
+ * @param $cookieName Cookie to refresh
+ * @return void
+ */
+ public function refreshCookie ($cookieName) {
+ // Only update existing cookies
+ if (isset($_COOKIE[$cookieName])) {
+ // Update the cookie
+ $this->addCookie($cookieName, $_COOKIE[$cookieName], false);
+ } // END - if
+ }
+
+ /**
+ * Setter for image instanxe
+ *
+ * @param $imageInstance An instance of an image
+ * @return void
+ */
+ public final function setImageInstance (BaseImage $imageInstance) {
+ $this->imageInstance = $imageInstance;
+ }
+
+ /**
+ * Getter for default command
+ *
+ * @return $defaultCommand Default command for this response
+ */
+ public function getDefaultCommand () {
+ $defaultCommand = $this->getConfigInstance()->readConfig('default_image_command');
+ return $defaultCommand;
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, SeekableIterator {
+class DatabaseResult extends BaseFrameworkSystem implements SearchableResult, UpdateableResult, SeekableIterator {
+ // Exception constants
+ const EXCEPTION_INVALID_DATABASE_RESULT = 0x1c0;
+ const EXCEPTION_RESULT_UPDATE_FAILED = 0x1c1;
+
/**
* Current position in array
*/
*/
private $resultArray = array();
+ /**
+ * Array of out-dated entries
+ */
+ private $outDated = array();
+
+ /**
+ * Affected rows
+ */
+ private $affectedRows = 0;
+
/**
* Protected constructor
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Database result");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
$this->resultArray = $resultArray;
}
+ /**
+ * Updates the current entry by given update criteria
+ *
+ * @param $updateInstance An instance of an Updateable criteria
+ * @return void
+ */
+ private function updateCurrentEntryByCriteria (LocalUpdateCriteria $updateInstance) {
+ // Get the current entry key
+ $entryKey = $this->key();
+
+ // Now get the update criteria array and update all entries
+ foreach ($updateInstance->getUpdateCriteria() as $criteriaKey=>$criteriaValue) {
+ // Update data
+ $this->resultArray['rows'][$entryKey][$criteriaKey] = $criteriaValue;
+
+ // Mark it as out-dated
+ $this->outDated[$criteriaKey] = 1;
+ } // END - foreach
+ }
+
/**
* "Iterator" method next() to advance to the next valid entry. This method
* does also check if the result is invalid
$nextValid = false;
// Is the result valid?
- if ($this->resultArray['status'] === "ok") {
- // The status is fine so let's have a look for the next entry
- if ($this->valid()) {
- // Next entry found, so count one up and cache it
- $this->currentPos++;
- $this->currentRow = $this->resultArray['rows'][$this->currentPos];
- $nextValid = true;
- } // END - if
+ if ($this->valid()) {
+ // Next entry found, so count one up and cache it
+ $this->currentPos++;
+ $this->currentRow = $this->resultArray['rows'][$this->currentPos];
+ $nextValid = true;
} // END - if
// Return the result
$isValid = false;
// Check if
- if ((isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
+ if (($this->ifStatusIsOkay()) && (isset($this->resultArray['rows'][($this->currentPos + 1)])) && (isset($this->resultArray['rows'][0]))) {
// All fine!
$isValid = true;
} // END - if
return $isValid;
}
+ /**
+ * Determines wether the status of the query was fine ("ok")
+ *
+ * @return $ifStatusOkay Wether the status of the query was okay
+ */
+ public function ifStatusIsOkay () {
+ return ((isset($this->resultArray['status'])) && ($this->resultArray['status'] === "ok"));
+ }
+
/**
* Gets the current key of iteration
*
* @return void
*/
public function rewind () {
- $this->currentPos = 0;
+ $this->currentPos = -1;
}
/**
*
* @param $criteriaInstance The criteria to look inside the data set
* @return $result Found result entry
+ * @todo 0% done
*/
public function searchEntry (LocalSearchCriteria $criteriaInstance) {
- die("OK");
+ die(__METHOD__.": Unfinished!");
+ }
+
+ /**
+ * Adds an update request to the database result for writing it to the
+ * database layer
+ *
+ * @param $criteriaInstance An instance of a updateable criteria
+ * @return void
+ * @throws ResultUpdateException If no result was updated
+ */
+ public function add2UpdateQueue (LocalUpdateCriteria $criteriaInstance) {
+ // Rewind the pointer
+ $this->rewind();
+
+ // Get search criteria
+ $searchInstance = $criteriaInstance->getSearchInstance();
+
+ // And start looking for the result
+ $foundEntries = 0;
+ while (($this->valid()) && ($foundEntries < $searchInstance->getLimit())) {
+ // Get next entry
+ $this->next();
+ $currentEntry = $this->current();
+
+ // Is this entry found?
+ if ($searchInstance->ifEntryMatches($currentEntry)) {
+ // Update this entry
+ $this->updateCurrentEntryByCriteria($criteriaInstance);
+
+ // Count one up
+ $foundEntries++;
+ } // END - if
+ } // END - while
+
+ // Set affected rows
+ $this->setAffectedRows($foundEntries);
+
+ // If no entry is found/updated throw an exception
+ if ($foundEntries == 0) {
+ // Throw an exception here
+ throw new ResultUpdateException($this, self::EXCEPTION_RESULT_UPDATE_FAILED);
+ } // END - if
+
+ // Set search instance
+ $this->setSearchInstance($searchInstance);
+ }
+
+ /**
+ * Setter for affected rows
+ *
+ * @param $rows Number of affected rows
+ * @return void
+ */
+ public final function setAffectedRows ($rows) {
+ $this->affectedRows = $rows;
+ }
+
+ /**
+ * Getter for affected rows
+ *
+ * @return $rows Number of affected rows
+ */
+ public final function getAffectedRows () {
+ return $this->affectedRows;
+ }
+
+ /**
+ * Checks wether we have out-dated entries or not
+ *
+ * @return $needsUpdate Wether we have out-dated entries
+ */
+ public function ifDataNeedsFlush () {
+ $needsUpdate = (count($this->outDated) > 0);
+ return $needsUpdate;
+ }
+
+ /**
+ * Adds registration elements to a given dataset instance
+ *
+ * @param $criteriaInstance An instance of a storeable criteria
+ * @return void
+ */
+ public function addElementsToDataSet (StoreableCriteria $criteriaInstance) {
+ // Rewind the pointer
+ $this->rewind();
+
+ // Walk through all entries
+ while ($this->valid()) {
+ // Get next entry
+ $this->next();
+ $currentEntry = $this->current();
+
+ // Walk only through out-dated columns
+ foreach ($this->outDated as $key=>$dummy) {
+ // Does this key exist?
+ //* DEBUG: */ echo "outDated: {$key}<br />\n";
+ if (isset($currentEntry[$key])) {
+ // Then update it
+ $criteriaInstance->addCriteria($key, $currentEntry[$key]);
+ } // END - foreach
+ } // END - foreach
+ } // END - while
}
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class RandomNumberGenerator extends BaseFrameworkSystem {
/**
*/
private $extraSalt = "";
+ /**
+ * Fixed salt for secured hashing
+ */
+ private $fixedSalt = "";
+
/**
* Maximum length for random string
*/
// Call parent constructor
parent::__construct($className);
- // Set part description
- $this->setObjectDescription("Standard random number generator");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
/**
* Creates an instance of this class
*
+ * @param $extraInstance An extra instance for more salt (default: null)
* @return $rngInstance An instance of this random number generator
*/
- public final static function createRandomNumberGenerator () {
+ public final static function createRandomNumberGenerator (FrameworkInterface $extraInstance = null) {
// Get a new instance
$rngInstance = new RandomNumberGenerator();
// Initialize the RNG now
- $rngInstance->initRng();
+ $rngInstance->initRng($extraInstance);
// Return the instance
return $rngInstance;
/**
* Initializes the random number generator
*
+ * @param $extraInstance An extra instance for more salt (default: null)
* @return void
+ * @todo Add site key for stronger salt!
*/
- protected function initRng () {
- // Seed mt_rand()
- mt_srand((double) microtime() * 1000000);
-
+ protected function initRng ($extraInstance) {
// Get the prime number from config
$this->prime = $this->getConfigInstance()->readConfig('math_prime');
// a better prime number
$this->extraNumber = ($this->prime * $this->prime / (pi() ^ 2));
+ // Seed mt_rand()
+ mt_srand((double) sqrt(microtime() * 100000000 * $this->extraNumber));
+
// Set the server IP to cluster
$serverIp = "cluster";
+
// Do we have a single server?
- if ($this->getConfigInstance()->readConfig('is_single_server') == "Y") {
+ if ($this->getConfigInstance()->readConfig('is_single_server') === "Y") {
// Then use that IP for extra security
$serverIp = getenv('SERVER_ADDR');
+ } // END - if
+
+ // Yet-another fixed salt. This is not dependend on server software or date
+ if ($extraInstance instanceof FrameworkInterface) {
+ // With extra instance information
+ $this->fixedSalt = sha1($serverIp . ":" . $extraInstance->__toString() . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
+ } else {
+ // Without extra information
+ $this->fixedSalt = sha1($serverIp . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
}
// One-way data we need for "extra-salting" the random number
- // @TODO Add site for stronger salt!
- $this->extraSalt = sha1($serverIp . ":" . getenv('SERVER_SOFTWARE') . ":" . $this->getConfigInstance()->readConfig('date_key') . ":" . serialize($this->getDatabaseInstance()->getConnectionData()));
+ $this->extraSalt = sha1($this->fixedSalt . ":" . getenv('SERVER_SOFTWARE') . ":" . $this->getConfigInstance()->readConfig('date_key') . $this->getConfigInstance()->readConfig('base_url'));
// Get config entry for max salt length
$this->rndStrLen = $this->getConfigInstance()->readConfig('rnd_str_length');
* @param $length Length of the string, default: 128
* @return $randomString The pseudo-random string
*/
- public function makeRandomString ($length = -1) {
+ public function randomString ($length = -1) {
// Is the number <1, then fix it to default length
if ($length < 1) $length = $this->rndStrLen;
// And generate it
for ($idx = 0; $idx < $length; $idx++) {
// Add a random character and add it to our string
- $randomString .= chr($this->randomNumnber(0, 255));
+ $randomString .= chr($this->randomNumber(0, 255));
}
- // Return the random string mixed up
+ // Return the random string a little mixed up
return str_shuffle($randomString);
}
* @param $min Min value to generate
* @param $max Max value to generate
* @return $num Pseudo-random number
+ * @todo I had a better random number generator here but now it is somewhere lost :(
*/
- public function randomNumnber ($min, $max) {
- // @TODO I had a better random number generator here
+ public function randomNumber ($min, $max) {
return mt_rand($min, $max);
}
public final function getExtraSalt () {
return $this->extraSalt;
}
+
+ /**
+ * Getter for fixed salt
+ *
+ * @return $fixedSalt
+ */
+ public final function getFixedSalt () {
+ return $this->fixedSalt;
+ }
}
// [EOF]
--- /dev/null
+<?php
+/**
+ * A generic template engine
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseTemplateEngine extends BaseFrameworkSystem {
+ /**
+ * The local path name where all templates and sub folders for special
+ * templates are stored. We will internally determine the language plus
+ * "html" for web templates or "emails" for email templates
+ */
+ private $basePath = "";
+
+ /**
+ * Template type
+ */
+ private $templateType = "html";
+
+ /**
+ * The extension for web and email templates (not compiled templates)
+ */
+ private $templateExtension = ".tpl";
+
+ /**
+ * The extension for code templates (not compiled templates)
+ */
+ private $codeExtension = ".ctp";
+
+ /**
+ * Path relative to $basePath and language code for compiled code-templates
+ */
+ private $compileOutputPath = "templates/_compiled";
+
+ /**
+ * The raw (maybe uncompiled) template
+ */
+ private $rawTemplateData = "";
+
+ /**
+ * Template data with compiled-in variables
+ */
+ private $compiledData = "";
+
+ /**
+ * The last loaded template's FQFN for debugging the engine
+ */
+ private $lastTemplate = "";
+
+ /**
+ * The variable stack for the templates
+ */
+ private $varStack = array();
+
+ /**
+ * Configuration variables in a simple array
+ */
+ private $configVariables = array();
+
+ /**
+ * Loaded templates for recursive protection and detection
+ */
+ private $loadedTemplates = array();
+
+ /**
+ * Compiled templates for recursive protection and detection
+ */
+ private $compiledTemplates = array();
+
+ /**
+ * Loaded raw template data
+ */
+ private $loadedRawData = null;
+
+ /**
+ * Raw templates which are linked in code templates
+ */
+ private $rawTemplates = null;
+
+ /**
+ * A regular expression for variable=value pairs
+ */
+ private $regExpVarValue = '/([\w_]+)(="([^"]*)"|=([\w_]+))?/';
+
+ /**
+ * A regular expression for filtering out code tags
+ *
+ * E.g.: {?template:variable=value;var2=value2;[...]?}
+ */
+ private $regExpCodeTags = '/\{\?([a-z_]+)(:("[^"]+"|[^?}]+)+)?\?\}/';
+
+ /**
+ * Loaded helpers
+ */
+ private $helpers = array();
+
+ /**
+ * Current variable group
+ */
+ private $currGroup = 'general';
+
+ /**
+ * All template groups except "general"
+ */
+ private $varGroups = array();
+
+ // Exception codes for the template engine
+ const EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED = 0x110;
+ const EXCEPTION_TEMPLATE_CONTAINS_INVALID_VAR = 0x111;
+ const EXCEPTION_INVALID_VIEW_HELPER = 0x112;
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Search for a variable in the stack
+ *
+ * @param $var The variable we are looking for
+ * @return $idx FALSE means not found, >=0 means found on a specific index
+ */
+ private function isVariableAlreadySet ($var) {
+ // First everything is not found
+ $found = false;
+
+ // Is the group there?
+ if (isset($this->varStack[$this->currGroup])) {
+ // Now search for it
+ foreach ($this->varStack[$this->currGroup] as $idx=>$currEntry) {
+ // Is the entry found?
+ if ($currEntry['name'] == $var) {
+ // Found!
+ $found = $idx;
+ break;
+ } // END - if
+ } // END - foreach
+ } // END - if
+
+ // Return the current position
+ return $found;
+ }
+
+ /**
+ * Return a content of a variable or null if not found
+ *
+ * @param $var The variable we are looking for
+ * @return $content Content of the variable or null if not found
+ */
+ protected function readVariable ($var) {
+ // First everything is not found
+ $content = null;
+
+ // Get variable index
+ $found = $this->isVariableAlreadySet($var);
+
+ // Is the variable found?
+ if ($found !== false) {
+ // Read it
+ $found = $this->varStack[$this->currGroup][$found]['value'];
+ } // END - if
+
+ //* DEBUG: */ echo __METHOD__.": group=".$this->currGroup.",var=".$var.", found=".$found."<br />\n";
+
+ // Return the current position
+ return $found;
+ }
+
+ /**
+ * Add a variable to the stack
+ *
+ * @param $var The variable we are looking for
+ * @param $value The value we want to store in the variable
+ * @return void
+ */
+ private function addVariable ($var, $value) {
+ // Set general variable group
+ $this->setVariableGroup('general');
+
+ // Add it to the stack
+ $this->addGroupVariable($var, $value);
+ }
+
+ /**
+ * Returns all variables of current group or empty array
+ *
+ * @return $result Wether array of found variables or empty array
+ */
+ private function readCurrentGroup () {
+ // Default is not found
+ $result = array();
+
+ // Is the group there?
+ if (isset($this->varStack[$this->currGroup])) {
+ // Then use it
+ $result = $this->varStack[$this->currGroup];
+ } // END - if
+
+ // Return result
+ return $result;
+ }
+
+ /**
+ * Settter for variable group
+ *
+ * @param $groupName Name of variable group
+ * @param $add Wether add this group
+ * @retur4n void
+ */
+ public function setVariableGroup ($groupName, $add = true) {
+ // Set group name
+ //* DEBIG: */ echo __METHOD__.": currGroup=".$groupName."<br />\n";
+ $this->currGroup = $groupName;
+
+ // Skip group 'general'
+ if (($groupName != 'general') && ($add === true)) {
+ $this->varGroups[$groupName] = 'OK';
+ } // END - if
+ }
+
+
+ /**
+ * Adds a variable to current group
+ *
+ * @param $var Variable to set
+ * @param $value Value to store in variable
+ * @return void
+ */
+ public function addGroupVariable ($var, $value) {
+ //* DEBUG: */ echo __METHOD__.": group=".$this->currGroup.", var=".$var.", value=".$value."<br />\n";
+
+ // Get current variables in group
+ $currVars = $this->readCurrentGroup();
+
+ // Append our variable
+ $currVars[] = array(
+ 'name' => $var,
+ 'value' => $value
+ );
+
+ // Add it to the stack
+ $this->varStack[$this->currGroup] = $currVars;
+ }
+
+ /**
+ * Modify an entry on the stack
+ *
+ * @param $var The variable we are looking for
+ * @param $value The value we want to store in the variable
+ * @return void
+ */
+ private function modifyVariable ($var, $value) {
+ // Get index for variable
+ $idx = $this->isVariableAlreadySet($var);
+
+ // Is the variable set?
+ if ($idx !== false) {
+ // Then modify it
+ $this->varStack[$this->currGroup][$idx]['value'] = $value;
+ } // END - if
+ }
+
+ /**
+ * Setter for template type. Only "html", "emails" and "compiled" should
+ * be sent here
+ *
+ * @param $templateType The current template's type
+ * @return void
+ */
+ private final function setTemplateType ($templateType) {
+ $this->templateType = (string) $templateType;
+ }
+
+ /**
+ * Setter for the last loaded template's FQFN
+ *
+ * @param $template The last loaded template
+ * @return void
+ */
+ private final function setLastTemplate ($template) {
+ $this->lastTemplate = (string) $template;
+ }
+
+ /**
+ * Getter for the last loaded template's FQFN
+ *
+ * @return $template The last loaded template
+ */
+ private final function getLastTemplate () {
+ return $this->lastTemplate;
+ }
+
+ /**
+ * Setter for base path
+ *
+ * @param $basePath The local base path for all templates
+ * @return void
+ */
+ public final function setBasePath ($basePath) {
+ // And set it
+ $this->basePath = (string) $basePath;
+ }
+
+ /**
+ * Getter for base path
+ *
+ * @return $basePath The local base path for all templates
+ */
+ public final function getBasePath () {
+ // And set it
+ return $this->basePath;
+ }
+
+ /**
+ * Setter for template extension
+ *
+ * @param $templateExtension The file extension for all uncompiled
+ * templates
+ * @return void
+ */
+ public final function setRawTemplateExtension ($templateExtension) {
+ // And set it
+ $this->templateExtension = (string) $templateExtension;
+ }
+
+ /**
+ * Setter for code template extension
+ *
+ * @param $codeExtension The file extension for all uncompiled
+ * templates
+ * @return void
+ */
+ public final function setCodeTemplateExtension ($codeExtension) {
+ // And set it
+ $this->codeExtension = (string) $codeExtension;
+ }
+
+ /**
+ * Getter for template extension
+ *
+ * @return $templateExtension The file extension for all uncompiled
+ * templates
+ */
+ public final function getRawTemplateExtension () {
+ // And set it
+ return $this->templateExtension;
+ }
+
+ /**
+ * Getter for code-template extension
+ *
+ * @return $codeExtension The file extension for all code-
+ * templates
+ */
+ public final function getCodeTemplateExtension () {
+ // And set it
+ return $this->codeExtension;
+ }
+
+ /**
+ * Setter for path of compiled templates
+ *
+ * @param $compileOutputPath The local base path for all compiled
+ * templates
+ * @return void
+ */
+ public final function setCompileOutputPath ($compileOutputPath) {
+ // And set it
+ $this->compileOutputPath = (string) $compileOutputPath;
+ }
+
+ /**
+ * Getter for template type
+ *
+ * @return $templateType The current template's type
+ */
+ public final function getTemplateType () {
+ return $this->templateType;
+ }
+
+ /**
+ * Assign (add) a given variable with a value
+ *
+ * @param $var The variable we are looking for
+ * @param $value The value we want to store in the variable
+ * @return void
+ * @throws EmptyVariableException If the variable name is left empty
+ */
+ public final function assignVariable ($var, $value) {
+ // Trim spaces of variable name
+ $var = trim($var);
+
+ // Empty variable found?
+ if (empty($var)) {
+ // Throw an exception
+ throw new EmptyVariableException(array($this, 'var'), self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } // END - if
+
+ // First search for the variable if it was already added
+ $idx = $this->isVariableAlreadySet($var);
+
+ // Was it found?
+ if ($idx === false) {
+ // Add it to the stack
+ //* DEBUG: */ echo "ADD: ".$var."<br />\n";
+ $this->addVariable($var, $value);
+ } elseif (!empty($value)) {
+ // Modify the stack entry
+ //* DEBUG: */ echo "MOD: ".$var."<br />\n";
+ $this->modifyVariable($var, $value);
+ }
+ }
+
+ /**
+ * Removes a given variable
+ *
+ * @param $var The variable we are looking for
+ * @return void
+ */
+ public final function removeVariable ($var) {
+ // First search for the variable if it was already added
+ $idx = $this->isVariableAlreadySet($var);
+
+ // Was it found?
+ if ($idx !== false) {
+ // Remove this variable
+ $this->varStack->offsetUnset($idx);
+ }
+ }
+
+ /**
+ * Private setter for raw template data
+ *
+ * @param $rawTemplateData The raw data from the template
+ * @return void
+ */
+ protected final function setRawTemplateData ($rawTemplateData) {
+ // And store it in this class
+ //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($rawTemplateData)." Bytes set.<br />\n";
+ //* DEBUG: */ echo $this->currGroup." variables: ".count($this->varStack[$this->currGroup]).", groups=".count($this->varStack)."<br />\n";
+ $this->rawTemplateData = (string) $rawTemplateData;
+ }
+
+ /**
+ * Getter for raw template data
+ *
+ * @return $rawTemplateData The raw data from the template
+ */
+ public final function getRawTemplateData () {
+ //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($this->rawTemplateData)." Bytes read.<br />\n";
+ return $this->rawTemplateData;
+ }
+
+ /**
+ * Private setter for compiled templates
+ *
+ * @return void
+ */
+ private final function setCompiledData ($compiledData) {
+ // And store it in this class
+ //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($compiledData)." Bytes set.<br />\n";
+ $this->compiledData = (string) $compiledData;
+ }
+
+ /**
+ * Getter for compiled templates
+ *
+ * @return $compiledData Compiled template data
+ */
+ public final function getCompiledData () {
+ //* DEBUG: */ echo __METHOD__.":".$this->getUniqueId().": ".strlen($this->compiledData)." Bytes read.<br />\n";
+ return $this->compiledData;
+ }
+
+ /**
+ * Private loader for all template types
+ *
+ * @param $template The template we shall load
+ * @return void
+ */
+ private function loadTemplate ($template) {
+ // Get extension for the template
+ $ext = $this->getRawTemplateExtension();
+
+ // If we shall load a code-template we need to switch the file extension
+ if ($this->getTemplateType() == $this->getConfigInstance()->readConfig('code_template_type')) {
+ // Switch over to the code-template extension
+ $ext = $this->getCodeTemplateExtension();
+ } // END - if
+
+ // Construct the FQFN for the template by honoring the current language
+ $fqfn = sprintf("%s%s/%s/%s%s",
+ $this->getBasePath(),
+ $this->getLanguageInstance()->getLanguageCode(),
+ $this->getTemplateType(),
+ (string) $template,
+ $ext
+ );
+
+ // Load the raw template data
+ $this->loadRawTemplateData($fqfn);
+ }
+
+ /**
+ * A private loader for raw template names
+ *
+ * @param $fqfn The full-qualified file name for a template
+ * @return void
+ */
+ private function loadRawTemplateData ($fqfn) {
+ // Get a input/output instance from the middleware
+ $ioInstance = $this->getFileIoInstance();
+
+ // Some debug code to look on the file which is being loaded
+ //* DEBUG: */ echo __METHOD__.": FQFN=".$fqfn."<br />\n";
+
+ // Load the raw template
+ $rawTemplateData = $ioInstance->loadFileContents($fqfn);
+
+ // Store the template's contents into this class
+ $this->setRawTemplateData($rawTemplateData);
+
+ // Remember the template's FQFN
+ $this->setLastTemplate($fqfn);
+ }
+
+ /**
+ * Try to assign an extracted template variable as a "content" or 'config'
+ * variable.
+ *
+ * @param $varName The variable's name (shall be content orconfig) by
+ * default
+ * @param $var The variable we want to assign
+ */
+ private function assignTemplateVariable ($varName, $var) {
+ // Is it not a config variable?
+ if ($varName != 'config') {
+ // Regular template variables
+ $this->assignVariable($var, "");
+ } else {
+ // Configuration variables
+ $this->assignConfigVariable($var);
+ }
+ }
+
+ /**
+ * Extract variables from a given raw data stream
+ *
+ * @param $rawData The raw template data we shall analyze
+ * @return void
+ */
+ private function extractVariablesFromRawData ($rawData) {
+ // Cast to string
+ $rawData = (string) $rawData;
+
+ // Search for variables
+ @preg_match_all('/\$(\w+)(\[(\w+)\])?/', $rawData, $variableMatches);
+
+ // Did we find some variables?
+ if ((is_array($variableMatches)) && (count($variableMatches) == 4) && (count($variableMatches[0]) > 0)) {
+ // Initialize all missing variables
+ foreach ($variableMatches[3] as $key=>$var) {
+ // Variable name
+ $varName = $variableMatches[1][$key];
+
+ // Workarround: Do not assign empty variables
+ if (!empty($var)) {
+ // Try to assign it, empty strings are being ignored
+ $this->assignTemplateVariable($varName, $var);
+ } // END - if
+ } // END - foreach
+ } // END - if
+ }
+
+ /**
+ * Main analysis of the loaded template
+ *
+ * @param $templateMatches Found template place-holders, see below
+ * @return void
+ *
+ *---------------------------------
+ * Structure of $templateMatches:
+ *---------------------------------
+ * [0] => Array - An array with all full matches
+ * [1] => Array - An array with left part (before the ":") of a match
+ * [2] => Array - An array with right part of a match including ":"
+ * [3] => Array - An array with right part of a match excluding ":"
+ */
+ private function analyzeTemplate (array $templateMatches) {
+ // Backup raw template data
+ $backup = $this->getRawTemplateData();
+
+ // Initialize some arrays
+ if (is_null($this->loadedRawData)) { $this->loadedRawData = array(); $this->rawTemplates = array(); }
+
+ // Load all requested templates
+ foreach ($templateMatches[1] as $template) {
+
+ // Load and compile only templates which we have not yet loaded
+ // RECURSIVE PROTECTION! BE CAREFUL HERE!
+ if ((!isset($this->loadedRawData[$template])) && (!in_array($template, $this->loadedTemplates))) {
+
+ // Template not found, but maybe variable assigned?
+ if ($this->isVariableAlreadySet($template) !== false) {
+ // Use that content here
+ $this->loadedRawData[$template] = $this->readVariable($template);
+
+ // Recursive protection:
+ $this->loadedTemplates[] = $template;
+ } else {
+ // Then try to search for code-templates
+ try {
+ // Load the code template and remember it's contents
+ $this->loadCodeTemplate($template);
+ $this->loadedRawData[$template] = $this->getRawTemplateData();
+
+ // Remember this template for recursion detection
+ // RECURSIVE PROTECTION!
+ $this->loadedTemplates[] = $template;
+ } catch (FileNotFoundException $e) {
+ // Even this is not done... :/
+ $this->rawTemplates[] = $template;
+ } catch (FilePointerNotOpenedException $e) {
+ // Even this is not done... :/
+ $this->rawTemplates[] = $template;
+ }
+ }
+ } // END - if
+ } // END - foreach
+
+ // Restore the raw template data
+ $this->setRawTemplateData($backup);
+ }
+
+ /**
+ * Compile a given raw template code and remember it for later usage
+ *
+ * @param $code The raw template code
+ * @param $template The template's name
+ * @return void
+ */
+ private function compileCode ($code, $template) {
+ // Is this template already compiled?
+ if (in_array($template, $this->compiledTemplates)) {
+ // Abort here...
+ return;
+ }
+
+ // Remember this template being compiled
+ $this->compiledTemplates[] = $template;
+
+ // Compile the loaded code in five steps:
+ //
+ // 1. Backup current template data
+ $backup = $this->getRawTemplateData();
+
+ // 2. Set the current template's raw data as the new content
+ $this->setRawTemplateData($code);
+
+ // 3. Compile the template data
+ $this->compileTemplate();
+
+ // 4. Remember it's contents
+ $this->loadedRawData[$template] = $this->getRawTemplateData();
+
+ // 5. Restore the previous raw content from backup variable
+ $this->setRawTemplateData($backup);
+ }
+
+ /**
+ * Insert all given and loaded templates by running through all loaded
+ * codes and searching for their place-holder in the main template
+ *
+ * @param $templateMatches See method analyzeTemplate()
+ * @return void
+ */
+ private function insertAllTemplates (array $templateMatches) {
+ // Run through all loaded codes
+ foreach ($this->loadedRawData as $template=>$code) {
+
+ // Search for the template
+ $foundIndex = array_search($template, $templateMatches[1]);
+
+ // Lookup the matching template replacement
+ if (($foundIndex !== false) && (isset($templateMatches[0][$foundIndex]))) {
+
+ // Get the current raw template
+ $rawData = $this->getRawTemplateData();
+
+ // Replace the space holder with the template code
+ $rawData = str_replace($templateMatches[0][$foundIndex], $code, $rawData);
+
+ // Set the new raw data
+ $this->setRawTemplateData($rawData);
+ } // END - if
+ } // END - foreach
+ }
+
+ /**
+ * Load all extra raw templates
+ *
+ * @return void
+ */
+ private function loadExtraRawTemplates () {
+ // Are there some raw templates we need to load?
+ if (count($this->rawTemplates) > 0) {
+ // Try to load all raw templates
+ foreach ($this->rawTemplates as $key => $template) {
+ try {
+ // Load the template
+ $this->loadWebTemplate($template);
+
+ // Remember it's contents
+ $this->rawTemplates[$template] = $this->getRawTemplateData();
+
+ // Remove it from the loader list
+ unset($this->rawTemplates[$key]);
+
+ // Remember this template for recursion detection
+ // RECURSIVE PROTECTION!
+ $this->loadedTemplates[] = $template;
+ } catch (FileNotFoundException $e) {
+ // This template was never found. We silently ignore it
+ unset($this->rawTemplates[$key]);
+ } catch (FilePointerNotOpenedException $e) {
+ // This template was never found. We silently ignore it
+ unset($this->rawTemplates[$key]);
+ }
+ } // END - foreach
+ } // END - if
+ }
+
+ /**
+ * Assign all found template variables
+ *
+ * @param $varMatches An array full of variable/value pairs.
+ * @return void
+ * @todo Unfinished work or don't die here.
+ */
+ private function assignAllVariables (array $varMatches) {
+ // Search for all variables
+ foreach ($varMatches[1] as $key=>$var) {
+
+ // Detect leading equals
+ if (substr($varMatches[2][$key], 0, 1) == "=") {
+ // Remove and cast it
+ $varMatches[2][$key] = (string) substr($varMatches[2][$key], 1);
+ }
+
+ // Do we have some quotes left and right side? Then it is free text
+ if ((substr($varMatches[2][$key], 0, 1) == "\"") && (substr($varMatches[2][$key], -1, 1) == "\"")) {
+ // Free string detected! Which we can assign directly
+ $this->assignVariable($var, $varMatches[3][$key]);
+ } elseif (!empty($varMatches[2][$key])) {
+ // Non-string found so we need some deeper analysis...
+ die("Deeper analysis not yet implemented!");
+ }
+
+ } // for ($varMatches ...
+ }
+ /**
+ * Compiles all loaded raw templates
+ *
+ * @param $templateMatches See method analyzeTemplate() for details
+ * @return void
+ */
+ private function compileRawTemplateData (array $templateMatches) {
+ // Are some code-templates found which we need to compile?
+ if (count($this->loadedRawData) > 0) {
+
+ // Then compile all!
+ foreach ($this->loadedRawData as $template=>$code) {
+
+ // Is this template already compiled?
+ if (in_array($template, $this->compiledTemplates)) {
+ // Then skip it
+ continue;
+ }
+
+ // Search for the template
+ $foundIndex = array_search($template, $templateMatches[1]);
+
+ // Lookup the matching variable data
+ if (($foundIndex !== false) && (isset($templateMatches[3][$foundIndex]))) {
+
+ // Split it up with another reg. exp. into variable=value pairs
+ preg_match_all($this->regExpVarValue, $templateMatches[3][$foundIndex], $varMatches);
+
+ // Assign all variables
+ $this->assignAllVariables($varMatches);
+
+ } // END - if (isset($templateMatches ...
+
+ // Compile the loaded template
+ $this->compileCode($code, $template);
+
+ } // END - foreach ($this->loadedRawData ...
+
+ // Insert all templates
+ $this->insertAllTemplates($templateMatches);
+
+ } // END - if (count($this->loadedRawData) ...
+ }
+
+ /**
+ * Inserts all raw templates into their respective variables
+ *
+ * @return void
+ */
+ private function insertRawTemplates () {
+ // Load all templates
+ foreach ($this->rawTemplates as $template=>$content) {
+ // Set the template as a variable with the content
+ $this->assignVariable($template, $content);
+ }
+ }
+
+ /**
+ * Finalizes the compilation of all template variables
+ *
+ * @return void
+ */
+ private function finalizeVariableCompilation () {
+ // Get the content
+ $content = $this->getRawTemplateData();
+ //* DEBUG: */ echo __METHOD__.": content before=".strlen($content)." (".md5($content).")<br />\n";
+
+ // Walk through all variables
+ foreach ($this->varStack['general'] as $currEntry) {
+ //* DEBUG: */ echo __METHOD__.": name=".$currEntry['name'].", value=<pre>".htmlentities($currEntry['value'])."</pre>\n";
+ // Replace all [$var] or {?$var?} with the content
+ // Old behaviour, will become obsolete!
+ $content = str_replace("\$content[".$currEntry['name']."]", $currEntry['value'], $content);
+
+ // Yet another old way
+ $content = str_replace("[".$currEntry['name']."]", $currEntry['value'], $content);
+
+ // The new behaviour
+ $content = str_replace("{?".$currEntry['name']."?}", $currEntry['value'], $content);
+ } // END - for
+
+ //* DEBUG: */ echo __METHOD__.": content after=".strlen($content)." (".md5($content).")<br />\n";
+
+ // Set the content back
+ $this->setRawTemplateData($content);
+ }
+
+ /**
+ * Load a specified web template into the engine
+ *
+ * @param $template The web template we shall load which is located in
+ * "html" by default
+ * @return void
+ */
+ public function loadWebTemplate ($template) {
+ // Set template type
+ $this->setTemplateType($this->getConfigInstance()->readConfig('web_template_type'));
+
+ // Load the special template
+ $this->loadTemplate($template);
+ }
+
+ /**
+ * Assign a given congfiguration variable with a value
+ *
+ * @param $var The configuration variable we want to assign
+ * @return void
+ */
+ public function assignConfigVariable ($var) {
+ // Sweet and simple...
+ $this->configVariables[$var] = $this->getConfigInstance()->readConfig($var);
+ }
+
+ /**
+ * Load a specified email template into the engine
+ *
+ * @param $template The email template we shall load which is located in
+ * "emails" by default
+ * @return void
+ */
+ public function loadEmailTemplate ($template) {
+ // Set template type
+ $this->setTemplateType($this->getConfigInstance()->readConfig('email_template_type'));
+
+ // Load the special template
+ $this->loadTemplate($template);
+ }
+
+ /**
+ * Load a specified code template into the engine
+ *
+ * @param $template The code template we shall load which is
+ * located in "code" by default
+ * @return void
+ */
+ public function loadCodeTemplate ($template) {
+ // Set template type
+ $this->setTemplateType($this->getConfigInstance()->readConfig('code_template_type'));
+
+ // Load the special template
+ $this->loadTemplate($template);
+ }
+
+ /**
+ * Compile all variables by inserting their respective values
+ *
+ * @return void
+ * @todo Make this code some nicer...
+ */
+ public final function compileVariables () {
+ // Initialize the $content array
+ $validVar = $this->getConfigInstance()->readConfig('tpl_valid_var');
+ $dummy = array();
+
+ // Iterate through all general variables
+ foreach ($this->varStack['general'] as $currVariable) {
+ // Transfer it's name/value combination to the $content array
+ //* DEBUG: */ echo $currVariable['name']."=<pre>".htmlentities($currVariable['value'])."</pre>\n";
+ $dummy[$currVariable['name']] = $currVariable['value'];
+
+ }// END - if
+
+ // Set the new variable (don't remove the second dollar !)
+ $$validVar = $dummy;
+
+ // Prepare all configuration variables
+ $config = $this->configVariables;
+
+ // Remove some variables
+ unset($idx);
+ unset($currVariable);
+
+ // Run the compilation twice to get content from helper classes in
+ $cnt = 0;
+ while ($cnt < 3) {
+ // Finalize the compilation of template variables
+ $this->finalizeVariableCompilation();
+
+ // Prepare the eval() command for comiling the template
+ $eval = sprintf("\$result = \"%s\";",
+ addslashes($this->getRawTemplateData())
+ );
+
+ // This loop does remove the backslashes (\) in PHP parameters
+ while (strpos($eval, "<?php") !== false) {
+ // Get left part before "<?"
+ $evalLeft = substr($eval, 0, strpos($eval, "<?php"));
+
+ // Get all from right of "<?"
+ $evalRight = substr($eval, (strpos($eval, "<?php") + 5));
+
+ // Cut middle part out and remove escapes
+ $evalMiddle = trim(substr($evalRight, 0, strpos($evalRight, "?>")));
+ $evalMiddle = stripslashes($evalMiddle);
+
+ // Remove the middle part from right one
+ $evalRight = substr($evalRight, (strpos($evalRight, "?>") + 2));
+
+ // And put all together
+ $eval = sprintf("%s<%%php %s %%>%s", $evalLeft, $evalMiddle, $evalRight);
+ } // END - while
+
+ // Prepare PHP code for eval() command
+ $eval = str_replace(
+ "<%php", "\";",
+ str_replace(
+ "%>", "\n\$result .= \"", $eval
+ )
+ );
+
+ // Run the constructed command. This will "compile" all variables in
+ @eval($eval);
+
+ // Goes something wrong?
+ if (!isset($result)) {
+ // Output eval command
+ $this->debugOutput(sprintf("Failed eval() code: <pre>%s</pre>", $this->markupCode($eval, true)), true);
+
+ // Output backtrace here
+ $this->debugBackTrace();
+ } // END - if
+
+ // Set raw template data
+ $this->setRawTemplateData($result);
+ $cnt++;
+ } // END - while
+
+ // Final variable assignment
+ $this->finalizeVariableCompilation();
+
+ // Set the new content
+ $this->setCompiledData($this->getRawTemplateData());
+ }
+
+ /**
+ * Compile all required templates into the current loaded one
+ *
+ * @return void
+ * @throws UnexpectedTemplateTypeException If the template type is
+ * not "code"
+ * @throws InvalidArrayCountException If an unexpected array
+ * count has been found
+ */
+ public function compileTemplate () {
+ // We will only work with template type "code" from configuration
+ if ($this->getTemplateType() != $this->getConfigInstance()->readConfig('code_template_type')) {
+ // Abort here
+ throw new UnexpectedTemplateTypeException(array($this, $this->getTemplateType(), $this->getConfigInstance()->readConfig('code_template_type')), self::EXCEPTION_TEMPLATE_TYPE_IS_UNEXPECTED);
+ } // END - if
+
+ // Get the raw data.
+ $rawData = $this->getRawTemplateData();
+
+ // Remove double spaces and trim leading/trailing spaces
+ $rawData = trim(str_replace(" ", " ", $rawData));
+
+ // Search for raw variables
+ $this->extractVariablesFromRawData($rawData);
+
+ // Search for code-tags which are {? ?}
+ preg_match_all($this->regExpCodeTags, $rawData, $templateMatches);
+
+ // Analyze the matches array
+ if ((is_array($templateMatches)) && (count($templateMatches) == 4) && (count($templateMatches[0]) > 0)) {
+ // Entries are found:
+ //
+ // The main analysis
+ $this->analyzeTemplate($templateMatches);
+
+ // Compile raw template data
+ $this->compileRawTemplateData($templateMatches);
+
+ // Are there some raw templates left for loading?
+ $this->loadExtraRawTemplates();
+
+ // Are some raw templates found and loaded?
+ if (count($this->rawTemplates) > 0) {
+
+ // Insert all raw templates
+ $this->insertRawTemplates();
+
+ // Remove the raw template content as well
+ $this->setRawTemplateData("");
+
+ } // END - if
+
+ } // END - if($templateMatches ...
+ }
+
+ /**
+ * A old deprecated method
+ *
+ * @return void
+ * @deprecated
+ * @see BaseTemplateEngine::transferToResponse
+ */
+ public function output () {
+ // Check which type of template we have
+ switch ($this->getTemplateType()) {
+ case "html": // Raw HTML templates can be send to the output buffer
+ // Quick-N-Dirty:
+ $this->getWebOutputInstance()->output($this->getCompiledData());
+ break;
+
+ default: // Unknown type found
+ // Construct message
+ $msg = sprintf("[%s->%s] Unknown/unsupported template type <strong>%s</strong> detected.",
+ $this->__toString(),
+ __FUNCTION__,
+ $this->getTemplateType()
+ );
+
+ // Write the problem to the world...
+ $this->debugOutput($msg);
+ break;
+ }
+ }
+
+ /**
+ * Loads a given view helper (by name)
+ *
+ * @param $helperName The helper's name
+ * @return void
+ * @throws ViewHelperNotFoundException If the given view helper was not found
+ */
+ protected function loadViewHelper ($helperName) {
+ // Make first character upper case, rest low
+ $helperName = ucfirst($helperName);
+
+ // Is this view helper loaded?
+ if (!isset($this->helpers[$helperName])) {
+ // Create a class name
+ $className = "{$helperName}ViewHelper";
+
+ // Does this class exists?
+ if (!class_exists($className)) {
+ // Abort here!
+ throw new ViewHelperNotFoundException(array($this, $helperName), self::EXCEPTION_INVALID_VIEW_HELPER);
+ } // END - if
+
+ // Generate new instance
+ $eval = sprintf("\$this->helpers[%s] = %s::create%s();",
+ $helperName,
+ $className,
+ $className
+ );
+
+ // Run the code
+ eval($eval);
+ } // END - if
+
+ // Return the requested instance
+ return $this->helpers[$helperName];
+ }
+
+ /**
+ * Assigns the last loaded raw template content with a given variable
+ *
+ * @param $templateName Name of the template we want to assign
+ * @param $variableName Name of the variable we want to assign
+ * @return void
+ */
+ public function assignTemplateWithVariable ($templateName, $variableName) {
+ // Get the content from last loaded raw template
+ $content = $this->getRawTemplateData();
+
+ // Assign the variable
+ $this->assignVariable($variableName, $content);
+
+ // Purge raw content
+ $this->setRawTemplateData("");
+ }
+
+ /**
+ * Transfers the content of this template engine to a given response instance
+ *
+ * @param $responseInstance An instance of a response class
+ * @return void
+ */
+ public function transferToResponse (Responseable $responseInstance) {
+ // Get the content and set it in the response class
+ $responseInstance->writeToBody($this->getCompiledData());
+ }
+
+ /**
+ * Assigns all the application data with template variables
+ *
+ * @param $appInstance A manageable application instance
+ * @return void
+ */
+ public function assignApplicationData (ManageableApplication $appInstance) {
+ // Get long name and assign it
+ $this->assignVariable('app_full_name' , $appInstance->getAppName());
+
+ // Get short name and assign it
+ $this->assignVariable('app_short_name', $appInstance->getAppShortName());
+
+ // Get version number and assign it
+ $this->assignVariable('app_version' , $appInstance->getAppVersion());
+ }
+
+ /**
+ * "Compiles" a variable by replacing {?var?} with it's content
+ *
+ * @param $rawCode Raw code to compile
+ * @return $rawCode Compile code with inserted variable value
+ */
+ public function compileRawCode ($rawCode) {
+ // Find the variables
+ //* DEBUG: */ echo "rawCode=<pre>".htmlentities($rawCode)."</pre>\n";
+ preg_match_all($this->regExpVarValue, $rawCode, $varMatches);
+
+ // Compile all variables
+ //* DEBUG: */ echo "<pre>".print_r($varMatches, true)."</pre>";
+ foreach ($varMatches[0] as $match) {
+ // Add variable tags around it
+ $varCode = "{?".$match."?}";
+
+ // Is the variable found in code? (safes some calls)
+ if (strpos($rawCode, $varCode) !== false) {
+ // Replace the variable with it's value, if found
+ //* DEBUG: */ echo __METHOD__.": match=".$match."<br />\n";
+ $rawCode = str_replace($varCode, $this->readVariable($match), $rawCode);
+ } // END - if
+ } // END - foreach
+
+ // Return the compiled data
+ return $rawCode;
+ }
+
+ /**
+ * Getter for variable group array
+ *
+ * @return $vargroups All variable groups
+ */
+ public final function getVariableGroups () {
+ return $this->varGroups;
+ }
+
+ /**
+ * Renames a variable in code and in stack
+ *
+ * @param $oldName Old name of variable
+ * @param $newName New name of variable
+ * @return void
+ */
+ public function renameVariable ($oldName, $newName) {
+ //* DEBUG: */ echo __METHOD__.": oldName={$oldName}, newName={$newName}<br />\n";
+ // Get raw template code
+ $rawData = $this->getRawTemplateData();
+
+ // Replace it
+ $rawData = str_replace($oldName, $newName, $rawData);
+
+ // Set the code back
+ $this->setRawTemplateData($rawData);
+ }
+
+ /**
+ * Renders the given XML content
+ *
+ * @param $content Valid XML content or if not set the current loaded raw content
+ * @return void
+ * @throws XmlParserException If an XML error was found
+ */
+ public final function renderXmlContent ($content = null) {
+ // Is the content set?
+ if (is_null($content)) {
+ // Get current content
+ $content = $this->getRawTemplateData();
+ } // END - if
+
+ // Convert all to UTF8
+ $content = recode("html..utf8", $content);
+
+ // Get an XML parser
+ $xmlParser = xml_parser_create();
+
+ // Force case-folding to on
+ xml_parser_set_option($xmlParser, XML_OPTION_CASE_FOLDING, true);
+
+ // Set object
+ xml_set_object($xmlParser, $this);
+
+ // Set handler call-backs
+ xml_set_element_handler($xmlParser, 'startElement', 'endElement');
+ xml_set_character_data_handler($xmlParser, 'characterHandler');
+
+ // Now parse the XML tree
+ if (!xml_parse($xmlParser, $content)) {
+ // Error found in XML!
+ //die("<pre>".htmlentities($content)."</pre>");
+ throw new XmlParserException(array($this, $xmlParser), BaseHelper::EXCEPTION_XML_PARSER_ERROR);
+ } // END - if
+
+ // Free the parser
+ xml_parser_free($xmlParser);
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct(__CLASS__);
- // Set part description
- $this->setObjectDescription("Web template engine");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The own template engine for loading caching and sending out images
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class ImageTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
+ /**
+ * Main nodes in the XML tree ('image' is ignored)
+ */
+ private $mainNodes = array("base", "type", "resolution", "background-color", "foreground-color", "image-string");
+
+ /**
+ * Sub nodes in the XML tree
+ */
+ private $subNodes = array("name", "string-name", "x", "y", "font-size", "width", "height", "red", "green", "blue", "text");
+
+ /**
+ * Image instance
+ */
+ private $imageInstance = null;
+
+ /**
+ * Current main node
+ */
+ private $currMainNode = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @param $basePath The local base path for all templates
+ * @param $langInstance An instance of LanguageSystem (default)
+ * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @return $tplInstance An instance of TemplateEngine
+ * @throws BasePathIsEmptyException If the provided $basePath is empty
+ * @throws InvalidBasePathStringException If $basePath is no string
+ * @throws BasePathIsNoDirectoryException If $basePath is no
+ * directory or not found
+ * @throws BasePathReadProtectedException If $basePath is
+ * read-protected
+ */
+ public final static function createImageTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ // Get a new instance
+ $tplInstance = new ImageTemplateEngine();
+
+ // Is the base path valid?
+ if (empty($basePath)) {
+ // Base path is empty
+ throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!is_string($basePath)) {
+ // Is not a string
+ throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($basePath)) {
+ // Is not a path
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($basePath)) {
+ // Is not readable
+ throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ }
+
+ // Get configuration instance
+ $cfgInstance = FrameworkConfiguration::getInstance();
+
+ // Set the base path
+ $tplInstance->setBasePath($basePath);
+
+ // Set the language and IO instances
+ $tplInstance->setLanguageInstance($langInstance);
+ $tplInstance->setFileIoInstance($ioInstance);
+
+ // Set template extensions
+ $tplInstance->setRawTemplateExtension($cfgInstance->readConfig('raw_template_extension'));
+ $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
+
+ // Absolute output path for compiled templates
+ $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+
+ // Return the prepared instance
+ return $tplInstance;
+ }
+
+ /**
+ * Getter for current main node
+ *
+ * @return $currMainNode Current main node
+ */
+ public final function getCurrMainNode () {
+ return $this->currMainNode;
+ }
+
+ /**
+ * Getter for main node array
+ *
+ * @return $mainNodes Array with valid main node names
+ */
+ public final function getMainNodes () {
+ return $this->mainNodes;
+ }
+
+ /**
+ * Getter for sub node array
+ *
+ * @return $subNodes Array with valid sub node names
+ */
+ public final function getSubNodes () {
+ return $this->subNodes;
+ }
+
+ /**
+ * Handles the start element of an XML resource
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $element The element we shall handle
+ * @param $attributes All attributes
+ * @return void
+ * @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
+ */
+ public function startElement ($resource, $element, array $attributes) {
+ // Initial method name which will never be called...
+ $methodName = 'initImage';
+
+ // Make the element name lower-case
+ $element = strtolower($element);
+
+ // Is the element a main node?
+ //* DEBUG: */ echo "START: >".$element."<<br />\n";
+ if (in_array($element, $this->mainNodes)) {
+ // Okay, main node found!
+ $methodName = 'setImage' . $this->convertToClassName($element);
+ } elseif (in_array($element, $this->subNodes)) {
+ // Sub node found
+ $methodName = 'setImageProperty' . $this->convertToClassName($element);
+ } elseif ($element != 'image') {
+ // Invalid node name found
+ throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN);
+ }
+
+ // Call method
+ //* DEBUG: */ echo "call: ".$methodName."<br />\n";
+ call_user_func_array(array($this, $methodName), $attributes);
+ }
+
+ /**
+ * Ends the main or sub node by sending out the gathered data
+ *
+ * @param $resource An XML resource pointer (currently ignored)
+ * @param $nodeName Name of the node we want to finish
+ * @return void
+ * @throws XmlNodeMismatchException If current main node mismatches the closing one
+ */
+ protected function endElement ($resource, $nodeName) {
+ // Make all lower-case
+ $nodeName = strtolower($nodeName);
+
+ // Does this match with current main node?
+ //* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
+ if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
+ // Did not match!
+ throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), BaseHelper::EXCEPTION_XML_NODE_MISMATCH);
+ } elseif (in_array($nodeName, $this->getSubNodes())) {
+ // Silently ignore sub nodes
+ return;
+ }
+
+ // Construct method name
+ $methodName = 'finish' . $this->convertToClassName($nodeName);
+
+ // Call the corresponding method
+ call_user_func_array(array($this->imageInstance, $methodName), array());
+ }
+
+ /**
+ * Currently not used
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ * @todo Find something usefull with this!
+ */
+ protected function characterHandler ($resource, $characters) {
+ // Trim all spaces away
+ $characters = trim($characters);
+
+ // Is this string empty?
+ if (empty($characters)) {
+ // Then skip it silently
+ return false;
+ } // END - if
+
+ // Unfinished work!
+ $this->partialStub("Handling extra characters is not yet supported!");
+ }
+
+ /**
+ * Intializes the image
+ *
+ * @return void
+ * @todo Add cache creation here
+ */
+ private function initImage () {
+ // Unfinished work!
+ }
+
+ /**
+ * Set the image type
+ *
+ * @param $imageType Code fragment or direct value holding the image type
+ * @return void
+ */
+ private function setImageType ($imageType) {
+ // Set group to general
+ $this->setVariableGroup('general');
+
+ // Try to compile it first to get the value from variable stack
+ $imageType = $this->compileRawCode($imageType);
+
+ // Now make a class name of it
+ $className = $this->convertToClassName($imageType.'_image');
+
+ // And try to initiate it
+ $this->imageInstance = ObjectFactory::createObjectByName($className, array($this));
+
+ // Set current main node to type
+ $this->currMainNode = 'type';
+ }
+
+ /**
+ * "Setter" for resolution, we first need to collect the resolution from the
+ * sub-nodes. So first, this method will prepare an array for it
+ *
+ * @return void
+ */
+ private function setImageResolution () {
+ // Call the image class
+ $this->imageInstance->initResolution();
+
+ // Current main node is resolution
+ $this->currMainNode = 'resolution';
+ }
+
+ /**
+ * "Setter" for base information. For more details see above method!
+ *
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageBase () {
+ // Call the image class
+ $this->imageInstance->initBase();
+
+ // Current main node is resolution
+ $this->currMainNode = 'base';
+ }
+
+ /**
+ * "Setter" for background-color. For more details see above method!
+ *
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageBackgroundColor () {
+ // Call the image class
+ $this->imageInstance->initBackgroundColor();
+
+ // Current main node is background-color
+ $this->currMainNode = 'background-color';
+ }
+
+ /**
+ * "Setter" for foreground-color. For more details see above method!
+ *
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageForegroundColor () {
+ // Call the image class
+ $this->imageInstance->initForegroundColor();
+
+ // Current main node is foreground-color
+ $this->currMainNode = 'foreground-color';
+ }
+
+ /**
+ * "Setter" for image-string. For more details see above method!
+ *
+ * @param $groupable Wether this image string is groupable
+ * @return void
+ * @see ImageTemplateEngine::setImageResolution
+ */
+ private function setImageImageString ($groupable = 'single') {
+ // Call the image class
+ $this->imageInstance->initImageString($groupable);
+
+ // Current main node is foreground-color
+ $this->currMainNode = 'image-string';
+ }
+
+ /**
+ * Setter for image name
+ *
+ * @param $imageName Name of the image
+ * @return void
+ */
+ private function setImagePropertyName ($imageName) {
+ // Call the image class
+ $this->imageInstance->setImageName($imageName);
+ }
+
+ /**
+ * Setter for image width
+ *
+ * @param $width Width of the image or variable
+ * @return void
+ */
+ private function setImagePropertyWidth ($width) {
+ // Call the image class
+ $this->imageInstance->setWidth($width);
+ }
+
+ /**
+ * Setter for image height
+ *
+ * @param $height Height of the image or variable
+ * @return void
+ */
+ private function setImagePropertyHeight ($height) {
+ // Call the image class
+ $this->imageInstance->setHeight($height);
+ }
+
+ /**
+ * Setter for image red color
+ *
+ * @param $red Red color value
+ * @return void
+ */
+ private function setImagePropertyRed ($red) {
+ // Call the image class
+ $this->imageInstance->setRed($red);
+ }
+
+ /**
+ * Setter for image green color
+ *
+ * @param $green Green color value
+ * @return void
+ */
+ private function setImagePropertyGreen ($green) {
+ // Call the image class
+ $this->imageInstance->setGreen($green);
+ }
+
+ /**
+ * Setter for image blue color
+ *
+ * @param $blue Blue color value
+ * @return void
+ */
+ private function setImagePropertyBlue ($blue) {
+ // Call the image class
+ $this->imageInstance->setBlue($blue);
+ }
+
+ /**
+ * Setter for string name (identifier)
+ *
+ * @param $stringName String name (identifier)
+ * @return void
+ */
+ private function setImagePropertyStringName ($stringName) {
+ // Call the image class
+ $this->imageInstance->setStringName($stringName);
+ }
+
+ /**
+ * Setter for font size
+ *
+ * @param $fontSize Size of the font
+ * @return void
+ */
+ private function setImagePropertyFontSize ($fontSize) {
+ // Call the image class
+ $this->imageInstance->setFontSize($fontSize);
+ }
+
+ /**
+ * Setter for image string
+ *
+ * @param $imageString Image string to set
+ * @return void
+ */
+ private function setImagePropertyText ($imageString) {
+ // Call the image class
+ $this->imageInstance->setString($imageString);
+ }
+
+ /**
+ * Setter for X coordinate
+ *
+ * @param $x X coordinate
+ * @return void
+ */
+ private function setImagePropertyX ($x) {
+ // Call the image class
+ $this->imageInstance->setX($x);
+ }
+
+ /**
+ * Setter for Y coordinate
+ *
+ * @param $y Y coordinate
+ * @return void
+ */
+ private function setImagePropertyY ($y) {
+ // Call the image class
+ $this->imageInstance->setY($y);
+ }
+
+ /**
+ * Getter for image cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the image cache
+ */
+ public function getImageCacheFqfn () {
+ // Get the FQFN ready
+ $fqfn = $this->getBasePath().'_cache/' . md5($this->imageInstance->getImageName().":".$this->__toString().":".$this->imageInstance->__toString()) . "." . $this->imageInstance->getImageType();
+
+ // Return it
+ return $fqfn;
+ }
+
+ /**
+ * Outputs the image to the world
+ *
+ * @param $responseInstance An instance of a Responseable class
+ * @return void
+ */
+ public function transferToResponse (Responseable $responseInstance) {
+ // Set the image instance
+ $responseInstance->setImageInstance($this->imageInstance);
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The own template engine for loading caching and sending out images
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class MailTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
+ /**
+ * Main nodes in the XML tree
+ */
+ private $mainNodes = array("mail-data");
+
+ /**
+ * Sub nodes in the XML tree
+ */
+ private $subNodes = array("subject-line", "sender-address", "recipient-address", "message");
+
+ /**
+ * Mailer instance
+ */
+ private $mailerInstance = null;
+
+ /**
+ * Current main node
+ */
+ private $currMainNode = "";
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @param $basePath The local base path for all templates
+ * @param $langInstance An instance of LanguageSystem (default)
+ * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @return $tplInstance An instance of TemplateEngine
+ * @throws BasePathIsEmptyException If the provided $basePath is empty
+ * @throws InvalidBasePathStringException If $basePath is no string
+ * @throws BasePathIsNoDirectoryException If $basePath is no
+ * directory or not found
+ * @throws BasePathReadProtectedException If $basePath is
+ * read-protected
+ */
+ public final static function createMailTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ // Get a new instance
+ $tplInstance = new MailTemplateEngine();
+
+ // Is the base path valid?
+ if (empty($basePath)) {
+ // Base path is empty
+ throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!is_string($basePath)) {
+ // Is not a string
+ throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($basePath)) {
+ // Is not a path
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($basePath)) {
+ // Is not readable
+ throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ }
+
+ // Get configuration instance
+ $cfgInstance = FrameworkConfiguration::getInstance();
+
+ // Set the base path
+ $tplInstance->setBasePath($basePath);
+
+ // Set the language and IO instances
+ $tplInstance->setLanguageInstance($langInstance);
+ $tplInstance->setFileIoInstance($ioInstance);
+
+ // Set template extensions
+ $tplInstance->setRawTemplateExtension($cfgInstance->readConfig('raw_template_extension'));
+ $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
+
+ // Absolute output path for compiled templates
+ $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+
+ // Return the prepared instance
+ return $tplInstance;
+ }
+
+ /**
+ * Getter for current main node
+ *
+ * @return $currMainNode Current main node
+ */
+ public final function getCurrMainNode () {
+ return $this->currMainNode;
+ }
+
+ /**
+ * Getter for main node array
+ *
+ * @return $mainNodes Array with valid main node names
+ */
+ public final function getMainNodes () {
+ return $this->mainNodes;
+ }
+
+ /**
+ * Getter for sub node array
+ *
+ * @return $subNodes Array with valid sub node names
+ */
+ public final function getSubNodes () {
+ return $this->subNodes;
+ }
+
+ /**
+ * Handles the start element of an XML resource
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $element The element we shall handle
+ * @param $attributes All attributes
+ * @return void
+ * @throws InvalidXmlNodeException If an unknown/invalid XML node name was found
+ */
+ protected function startElement ($resource, $element, array $attributes) {
+ // Initial method name which will never be called...
+ $methodName = 'initEmail';
+
+ // Make the element name lower-case
+ $element = strtolower($element);
+
+ // Is the element a main node?
+ //* DEBUG: */ echo "START: >".$element."<<br />\n";
+ if (in_array($element, $this->getMainNodes())) {
+ // Okay, main node found!
+ $methodName = 'setEmail' . $this->convertToClassName($element);
+ } elseif (in_array($element, $this->getSubNodes())) {
+ // Sub node found
+ $methodName = 'setEmailProperty' . $this->convertToClassName($element);
+ } elseif ($element != 'text-mail') {
+ // Invalid node name found
+ throw new InvalidXmlNodeException(array($this, $element, $attributes), BaseHelper::EXCEPTION_XML_NODE_UNKNOWN);
+ }
+
+ // Call method
+ //* DEBUG: */ echo "call: ".$methodName."<br />\n";
+ call_user_func_array(array($this, $methodName), $attributes);
+ }
+
+ /**
+ * Ends the main or sub node by sending out the gathered data
+ *
+ * @param $resource An XML resource pointer (currently ignored)
+ * @param $nodeName Name of the node we want to finish
+ * @return void
+ * @throws XmlNodeMismatchException If current main node mismatches the closing one
+ */
+ protected function endElement ($resource, $nodeName) {
+ // Make all lower-case
+ $nodeName = strtolower($nodeName);
+
+ // Does this match with current main node?
+ //* DEBUG: */ echo "END: >".$nodeName."<<br />\n";
+ if (($nodeName != $this->getCurrMainNode()) && (in_array($nodeName, $this->getMainNodes()))) {
+ // Did not match!
+ throw new XmlNodeMismatchException (array($this, $nodeName, $this->getCurrMainNode()), BaseHelper::EXCEPTION_XML_NODE_MISMATCH);
+ } elseif (in_array($nodeName, $this->getSubNodes())) {
+ // Silently ignore sub nodes
+ return;
+ }
+
+ // Construct method name
+ $methodName = 'finish' . $this->convertToClassName($nodeName);
+
+ // Call the corresponding method
+ call_user_func_array(array($this, $methodName), array());
+ }
+
+ /**
+ * Adds the message text to the template engine
+ *
+ * @param $resource XML parser resource (currently ignored)
+ * @param $characters Characters to handle
+ * @return void
+ */
+ protected function characterHandler ($resource, $characters) {
+ // Trim all spaces away
+ $characters = trim($characters);
+
+ // Is this string empty?
+ if (empty($characters)) {
+ // Then skip it silently
+ return false;
+ } // END - if
+
+ // Add the message now
+ $this->assignVariable('message', $characters);
+ }
+
+ /**
+ * Intializes the mail
+ *
+ * @return void
+ * @todo Add cache creation here
+ */
+ private function initEmail () {
+ // Unfinished work!
+ }
+
+ /**
+ * Setter for mail data node
+ *
+ * @return void
+ * @todo Should we call back the mailer class here?
+ */
+ private function setEmailMailData () {
+ // Set current main node
+ $this->currMainNode = 'mail-data';
+ }
+
+ /**
+ * Setter for sender address property
+ *
+ * @param $senderAddress Sender address to set in email
+ * @return void
+ */
+ private function setEmailPropertySenderAddress ($senderAddress) {
+ // Set the template variable
+ $this->assignVariable('sender', $senderAddress);
+ }
+
+ /**
+ * Setter for recipient address property
+ *
+ * @param $recipientAddress Recipient address to set in email
+ * @return void
+ */
+ private function setEmailPropertyRecipientAddress ($recipientAddress) {
+ // Set the template variable
+ $this->assignVariable('recipient', $recipientAddress);
+ }
+
+ /**
+ * Setter for subject line property
+ *
+ * @param $subjectLine Subject line to set in email
+ * @return void
+ */
+ private function setEmailPropertySubjectLine ($subjectLine) {
+ // Set the template variable
+ $this->assignVariable('subject', $subjectLine);
+ }
+
+ /**
+ * Method stub to avoid output
+ *
+ * @return void
+ */
+ private function setEmailPropertyMessage () {
+ // Empty for now
+ }
+
+ /**
+ * Gets the template variable "message", stores it back as raw template data
+ * and compiles all variables so the mail message got prepared for output
+ *
+ * @return void
+ */
+ private function finishMailData () {
+ // Get the message and set it as new raw template data back
+ $message = $this->readVariable('message');
+ $this->setRawTemplateData($message);
+
+ // Get some variables to compile
+ //$sender = $this->compileRawCode($this->readVariable('sender'));
+ //$this->assignVariable('sender', $sender);
+
+ // Then compile all variables
+ $this->compileVariables();
+ }
+
+ /**
+ * Invokes the final mail process
+ *
+ * @return void
+ */
+ private function finishTextMail () {
+ $this->getMailerInstance()->invokeMailDelivery();
+ }
+
+ /**
+ * Getter for image cache file (FQFN)
+ *
+ * @return $fqfn Full-qualified file name of the image cache
+ * @todo 0% done
+ */
+ public function getMailCacheFqfn () {
+ // Initialize FQFN
+ $fqfn = "";
+ $this->debugBackTrace();
+
+ // Return it
+ return $fqfn;
+ }
+
+ /**
+ * Setter for mailer instance
+ *
+ * @param $mailerInstance A mailer instance
+ * @return void
+ */
+ public final function setMailerInstance (DeliverableMail $mailerInstance) {
+ $this->mailerInstance = $mailerInstance;
+ }
+
+ /**
+ * Getter for mailer instance
+ *
+ * @return $mailerInstance A mailer instance
+ */
+ protected final function getMailerInstance () {
+ return $this->mailerInstance;
+ }
+
+ /**
+ * Outputs the mail to the world. This should only the mailer debug class do!
+ *
+ * @param $responseInstance An instance of a Responseable class
+ * @return void
+ */
+ public function transferToResponse (Responseable $responseInstance) {
+ $responseInstance->writeToBody($this->getCompiledData());
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * The own template engine for loading caching and sending out the web pages
+ * and emails.
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WebTemplateEngine extends BaseTemplateEngine implements CompileableTemplate {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of the class TemplateEngine and prepares it for usage
+ *
+ * @param $basePath The local base path for all templates
+ * @param $langInstance An instance of LanguageSystem (default)
+ * @param $ioInstance An instance of FileIoHandler (default, middleware!)
+ * @return $tplInstance An instance of TemplateEngine
+ * @throws BasePathIsEmptyException If the provided $basePath is empty
+ * @throws InvalidBasePathStringException If $basePath is no string
+ * @throws BasePathIsNoDirectoryException If $basePath is no
+ * directory or not found
+ * @throws BasePathReadProtectedException If $basePath is
+ * read-protected
+ */
+ public final static function createWebTemplateEngine ($basePath, ManageableLanguage $langInstance, FileIoHandler $ioInstance) {
+ // Get a new instance
+ $tplInstance = new WebTemplateEngine();
+
+ // Is the base path valid?
+ if (empty($basePath)) {
+ // Base path is empty
+ throw new BasePathIsEmptyException($tplInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING);
+ } elseif (!is_string($basePath)) {
+ // Is not a string
+ throw new InvalidBasePathStringException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_STRING);
+ } elseif (!is_dir($basePath)) {
+ // Is not a path
+ throw new BasePathIsNoDirectoryException(array($tplInstance, $basePath), self::EXCEPTION_INVALID_PATH_NAME);
+ } elseif (!is_readable($basePath)) {
+ // Is not readable
+ throw new BasePathReadProtectedException(array($tplInstance, $basePath), self::EXCEPTION_READ_PROTECED_PATH);
+ }
+
+ // Get configuration instance
+ $cfgInstance = FrameworkConfiguration::getInstance();
+
+ // Set the base path
+ $tplInstance->setBasePath($basePath);
+
+ // Set the language and IO instances
+ $tplInstance->setLanguageInstance($langInstance);
+ $tplInstance->setFileIoInstance($ioInstance);
+
+ // Set template extensions
+ $tplInstance->setRawTemplateExtension($cfgInstance->readConfig('raw_template_extension'));
+ $tplInstance->setCodeTemplateExtension($cfgInstance->readConfig('code_template_extension'));
+
+ // Absolute output path for compiled templates
+ $tplInstance->setCompileOutputPath(PATH . $cfgInstance->readConfig('compile_output_path'));
+
+ // Return the prepared instance
+ return $tplInstance;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+<?php
+/**
+ * A general user class
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class BaseUser extends BaseFrameworkSystem {
+ // Exception constances
+ const EXCEPTION_USERNAME_NOT_FOUND = 0x150;
+ const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x151;
+ const EXCEPTION_USER_PASS_MISMATCH = 0x152;
+
+ /**
+ * Username of current user
+ */
+ private $userName = "";
+
+ /**
+ * Email of current user
+ */
+ private $email = "";
+
+ /**
+ * Protected constructor
+ *
+ * @param $className Name of the class
+ * @return void
+ */
+ protected function __construct ($className) {
+ // Call parent constructor
+ parent::__construct($className);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Setter for username
+ *
+ * @param $userName The username to set
+ * @return void
+ */
+ public final function setUserName ($userName) {
+ $this->userName = $userName;
+ }
+
+ /**
+ * Setter for email
+ *
+ * @param $email The email to set
+ * @return void
+ */
+ protected final function setEmail ($email) {
+ $this->email = $email;
+ }
+
+ /**
+ * Getter for username
+ *
+ * @return $userName The username to get
+ */
+ public final function getUsername () {
+ return $this->userName;
+ }
+
+ /**
+ * Getter for email
+ *
+ * @return $email The email to get
+ */
+ public final function getEmail () {
+ return $this->email;
+ }
+
+ /**
+ * Determines wether the username exists or not
+ *
+ * @return $exists Wether the username exists
+ */
+ public function ifUsernameExists () {
+ // By default the username does not exist
+ $exists = false;
+
+ // Is a previous result there?
+ if (is_null($this->getResultInstance())) {
+ // Get a UserDatabaseWrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+
+ // Create a search criteria
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add the username as a criteria and set limit to one entry
+ $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUsername());
+ $criteriaInstance->setLimit(1);
+
+ // Get a search result
+ $this->setResultInstance($wrapperInstance->doSelectByCriteria($criteriaInstance));
+ } else {
+ // Rewind it
+ $this->getResultInstance()->rewind();
+ }
+
+ // Search for it
+ if ($this->getResultInstance()->next()) {
+ // Entry found
+ $exists = true;
+ } // END - if
+
+ // Return the status
+ return $exists;
+ }
+
+ /**
+ * Determines wether the email exists or not
+ *
+ * @return $exists Wether the email exists
+ */
+ public function ifEmailAddressExists () {
+ // By default the email does not exist
+ $exists = false;
+
+ // Is a previous result there?
+ if (is_null($this->getResultInstance())) {
+ // Get a UserDatabaseWrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+
+ // Create a search criteria
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add the username as a criteria and set limit to one entry
+ $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_EMAIL, $this->getEmail());
+ $criteriaInstance->setLimit(1);
+
+ // Get a search resultInstance
+ $this->setResultInstance($wrapperInstance->doSelectByCriteria($criteriaInstance));
+ } else {
+ // Rewind it
+ $this->getResultInstance()->rewind();
+ }
+
+ // Search for it
+ if ($this->getResultInstance()->next()) {
+ // Entry found
+ $exists = true;
+
+ // Is the username set?
+ if ($this->getUserName() == "") {
+ // Get current entry
+ $currEntry = $this->getResultInstance()->current();
+
+ // Set the username
+ $this->setUserName($currEntry['username']);
+ } // END - if
+ } // END - if
+
+ // Return the status
+ return $exists;
+ }
+
+ /**
+ * Checks if the supplied password hash in request matches with the stored
+ * in database.
+ *
+ * @param $requestInstance A requestable class instance
+ * @return $matches Wether the supplied password hash matches
+ */
+ public function ifPasswordHashMatches (Requestable $requestInstance) {
+ // By default nothing matches... ;)
+ $matches = false;
+
+ // Get a UserDatabaseWrapper instance
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+
+ // Create a search criteria
+ $criteriaInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add the username as a criteria and set limit to one entry
+ $criteriaInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $criteriaInstance->setLimit(1);
+
+ // Get a search resultInstance
+ $this->setResultInstance($wrapperInstance->doSelectByCriteria($criteriaInstance));
+
+ // Search for it
+ if ($this->getResultInstance()->next()) {
+ // Get the current entry (can only be one!)
+ $entry = $this->getResultInstance()->current();
+
+ // So does the hashes match?
+ //* DEBUG: */ echo $requestInstance->getRequestElement('pass_hash')."/".$entry['pass_hash'];
+ $matches = ($requestInstance->getRequestElement('pass_hash') === $entry['pass_hash']);
+ } // END - if
+
+ // Return the status
+ return $matches;
+ }
+
+ /**
+ * "Getter" for user's password hash
+ *
+ * @return $passHash User's password hash from database result
+ */
+ public final function getPasswordHash () {
+ // Default is missing password hash
+ $passHash = null;
+
+ // Get a database entry
+ $entry = $this->getDatabaseEntry();
+
+ // Is the password hash there?
+ if (isset($entry['pass_hash'])) {
+ // Get it
+ $passHash = $entry['pass_hash'];
+ } // END - if
+
+ // And return the hash
+ return $passHash;
+ }
+
+ /**
+ * Getter for primary key value
+ *
+ * @return $primaryValue Value of the primary key based on database type
+ */
+ public final function getPrimaryKey () {
+ // Get a user database wrapper
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+
+ // Get the primary key back from the wrapper
+ $primaryKey = $wrapperInstance->getPrimaryKeyValue();
+
+ // Get that field
+ $primaryValue = $this->getField($primaryKey);
+
+ // Return the value
+ return $primaryValue;
+ }
+
+ /**
+ * Updates a given field with new value
+ *
+ * @param $fieldName Field to update
+ * @param $fieldValue New value to store
+ * @return void
+ * @throws DatabaseUpdateSupportException If this class does not support database updates
+ */
+ public function updateDatabaseField ($fieldName, $fieldValue) {
+ // Is updating database fields allowed by interface?
+ if (!$this instanceof Updateable) {
+ // Update not supported!
+ throw new DatabaseUpdateSupportException($this, self::EXCEPTION_DATABASE_UPDATED_NOT_ALLOWED);
+ } // END - if
+
+ // Get a critieria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add search criteria
+ $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $searchInstance->setLimit(1);
+
+ // Now get another criteria
+ $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
+
+ // And add our both entries
+ $updateInstance->addCriteria($fieldName, $fieldValue);
+
+ // Add the search criteria for searching for the right entry
+ $updateInstance->setSearchInstance($searchInstance);
+
+ // Remember the update in database result
+ $this->getResultInstance()->add2UpdateQueue($updateInstance);
+ }
+}
+
+// [EOF]
+?>
// Call parent constructor
parent::__construct($class);
- // Set part description
- $this->setObjectDescription("Generic user class");
-
- // Create unique ID number
- $this->generateUniqueId();
-
// Clean up a little
$this->removeNumberFormaters();
$this->removeSystemArray();
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A generic class for handling guests
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Guest extends BaseUser implements ManageableGuest, Registerable {
+ // Exceptions
+ const EXCEPTION_USERNAME_NOT_FOUND = 0x170;
+ const EXCEPTION_USER_EMAIL_NOT_FOUND = 0x171;
+ const EXCEPTION_USER_PASS_MISMATCH = 0x172;
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Creates an instance of this user class by a provided username. This
+ * factory method will check if the username is already taken and if not
+ * so it will throw an exception.
+ *
+ * @param $userName Username we need a class instance for
+ * @return $userInstance An instance of this user class
+ * @throws UsernameMissingException If the username does not exist
+ */
+ public final static function createGuestByUsername ($userName) {
+ // Get a new instance
+ $userInstance = new Guest();
+
+ // Set the username
+ $userInstance->setUserName($userName);
+
+ // Check if the username exists
+ if (!$userInstance->ifUsernameExists()) {
+ // Throw an exception here
+ throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
+ }
+
+ // Return the instance
+ return $userInstance;
+ }
+
+ /**
+ * Creates an instance of this user class by a provided email address. This
+ * factory method will not check if the email address is there.
+ *
+ * @param $email Email address of the user
+ * @return $userInstance An instance of this user class
+ */
+ public final static function createGuestByEmail ($email) {
+ // Get a new instance
+ $userInstance = new Guest();
+
+ // Set the username
+ $userInstance->setEmail($email);
+
+ // Return the instance
+ return $userInstance;
+ }
+
+ /**
+ * Updates the last activity timestamp and last performed action in the
+ * database result. You should call flushPendingUpdates() to flush these updates
+ * to the database layer.
+ *
+ * @param $requestInstance A requestable class instance
+ * @return void
+ */
+ public function updateLastActivity (Requestable $requestInstance) {
+ // No activity will be logged for guest accounts
+ }
+
+ /**
+ * Flushs all pending updates to the database layer
+ *
+ * @return void
+ */
+ public function flushPendingUpdates () {
+ // No updates will be flushed to database!
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * A generic class for handling users
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class Member extends BaseUser implements ManageableMember, Registerable, Updateable {
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+ }
+
+ /**
+ * Destructor to always flush updates
+ *
+ * @return void
+ */
+ public function __destruct () {
+ // Flush any updated entries to the database
+ $this->flushPendingUpdates();
+
+ // Call parent destructor
+ parent::__destruct();
+ }
+
+ /**
+ * Creates an instance of this user class by a provided username. This
+ * factory method will check if the username is already taken and if not
+ * so it will throw an exception.
+ *
+ * @param $userName Username we need a class instance for
+ * @return $userInstance An instance of this user class
+ * @throws UsernameMissingException If the username does not exist
+ */
+ public final static function createMemberByUsername ($userName) {
+ // Get a new instance
+ $userInstance = new Member();
+
+ // Set the username
+ $userInstance->setUserName($userName);
+
+ // Check if the username exists
+ if (!$userInstance->ifUsernameExists()) {
+ // Throw an exception here
+ throw new UsernameMissingException(array($userInstance, $userName), self::EXCEPTION_USERNAME_NOT_FOUND);
+ }
+
+ // Return the instance
+ return $userInstance;
+ }
+
+ /**
+ * Creates an instance of this user class by a provided email address. This
+ * factory method will not check if the email address is there.
+ *
+ * @param $email Email address of the user
+ * @return $userInstance An instance of this user class
+ */
+ public final static function createMemberByEmail ($email) {
+ // Get a new instance
+ $userInstance = new Member();
+
+ // Set the username
+ $userInstance->setEmail($email);
+
+ // Return the instance
+ return $userInstance;
+ }
+
+ /**
+ * Creates a user by a given request instance
+ *
+ * @param $requestInstance An instance of a Requestable class
+ * @return $userInstance An instance of this user class
+ */
+ public final static function createMemberByRequest (Requestable $requestInstance) {
+ // Determine if by email or username
+ if (!is_null($requestInstance->getRequestElement('username'))) {
+ // Username supplied
+ $userInstance = self::createMemberByUserName($requestInstance->getRequestElement('username'));
+ } elseif (!is_null($requestInstance->getRequestElement('email'))) {
+ // Email supplied
+ $userInstance = self::createMemberByEmail($requestInstance->getRequestElement('email'));
+ } else {
+ // Unsupported mode
+ $userInstance = new Member();
+ $userInstance->partialStub("We need to add more ways of creating user classes here.");
+ $userInstance->debugBackTrace();
+ exit();
+ }
+
+ // Return the prepared instance
+ return $userInstance;
+ }
+
+ /**
+ * Updates the last activity timestamp and last performed action in the
+ * database result. You should call flushPendingUpdates() to flush these updates
+ * to the database layer.
+ *
+ * @param $requestInstance A requestable class instance
+ * @return void
+ */
+ public function updateLastActivity (Requestable $requestInstance) {
+ // Set last action
+ $lastAction = $requestInstance->getRequestElement('action');
+
+ // If there is no action use the default on
+ if (is_null($lastAction)) {
+ $lastAction = $this->getConfigInstance()->readConfig('login_default_action');
+ } // END - if
+
+ // Get a critieria instance
+ $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
+
+ // Add search criteria
+ $searchInstance->addCriteria(UserDatabaseWrapper::DB_COLUMN_USERNAME, $this->getUserName());
+ $searchInstance->setLimit(1);
+
+ // Now get another criteria
+ $updateInstance = ObjectFactory::createObjectByConfiguredName('update_criteria_class');
+
+ // And add our both entries
+ $updateInstance->addCriteria('last_activity', date("Y-m-d H:i:s", time()));
+ $updateInstance->addCriteria('last_action', $lastAction);
+
+ // Add the search criteria for searching for the right entry
+ $updateInstance->setSearchInstance($searchInstance);
+
+ // Remember the update in database result
+ $this->getResultInstance()->add2UpdateQueue($updateInstance);
+ }
+
+ /**
+ * Flushs all pending updates to the database layer
+ *
+ * @return void
+ */
+ public function flushPendingUpdates () {
+ // Do we have data to update?
+ if ($this->getResultInstance()->ifDataNeedsFlush()) {
+ // Get a database wrapper
+ $wrapperInstance = ObjectFactory::createObjectByConfiguredName('user_db_wrapper_class');
+
+ // Yes, then send the whole result to the database layer
+ $wrapperInstance->doUpdateByResult($this->getResultInstance());
+ } // END - if
+ }
+}
+
+// [EOF]
+?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseMiddleware extends BaseFrameworkSystem {
/**
* Protected constructor
*
+ * @param $className Name of the class
* @return void
*/
- protected function __construct ($class) {
+ protected function __construct ($className) {
// Call parent constructor
- parent::__construct($class);
+ parent::__construct($className);
// Clean up a little
$this->removeNumberFormaters();
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
protected function __construct () {
// Call parent constructor!
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Komprimierungshandler");
-
- // Create an unique ID
- $this->generateUniqueId();
}
/**
// Get the compressor's name. That's why you must name
// your files like your classes and also that's why you
// must keep on class in one file.
- $class = substr($dir, 6, -4);
+ $className = substr($dir, 6, -4);
// Get an instance from our object factory
- $tempInstance = ObjectFactory::createObjectByName($class);
+ $tempInstance = ObjectFactory::createObjectByName($className);
// Set the compressor
$cInstance->setCompressor($tempInstance);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DatabaseConnection extends BaseMiddleware implements DatabaseConnector, Registerable {
/**
protected function __construct() {
// Call parent constructor
parent::__construct(__CLASS__);
-
- // Set description
- $this->setObjectDescription("Datenbank-Mittelschicht");
-
- // Create an unique ID
- $this->generateUniqueId();
}
// Create new database connection layer
// Ask the database layer
$this->dbLayer->queryInsertDataSet($dataSetInstance);
}
+
+ /**
+ * "Updates" a data set instance with a database layer
+ *
+ * @param $dataSetInstance A storeable data set
+ * @return void
+ */
+ public function queryUpdateDataSet (StoreableCriteria $dataSetInstance) {
+ // Connect to the database
+ $this->dbLayer->connectToDatabase();
+
+ // Ask the database layer
+ $this->dbLayer->queryUpdateDataSet($dataSetInstance);
+ }
+
+ /**
+ * Getter for primary key column of specified table name
+ *
+ * @param $tableName Name of table we need the primary key column from
+ * @return $primaryKey Primary key column of requested table
+ */
+ public function getPrimaryKeyOfTable ($tableName) {
+ // Connect to the database
+ $this->dbLayer->connectToDatabase();
+
+ // Ask the database layer
+ $primaryKey = $this->dbLayer->getPrimaryKeyOfTable($tableName);
+
+ // Return the value
+ return $primaryKey;
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DebugMiddleware extends BaseMiddleware implements Registerable {
/**
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Debug-Ausgabe-Instance");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Set own instance
self::$thisInstance = $this;
}
* @return void
*/
public final function output ($outStream) {
- // Check if the output instance is valid
- if (is_null($this->outputInstance)) {
- // Debug output instance was not set
- throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_object($this->outputInstance)) {
- // The debug output instance is not an object
- throw new NoObjectException($this->ouputInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($this->outputInstance, 'outputStream')) {
- // The required method outputStream() is missing
- throw new MissingMethodException(array($this->outputInstance, 'outputStream'), self::EXCEPTION_MISSING_METHOD);
- }
-
// Is the output stream set
if (empty($outStream)) {
// Initialization phase
return;
- }
+ } // END - if
// Use the output instance
$this->outputInstance->outputStream($outStream);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// Call parent constructor
parent::__construct(__CLASS__);
- // Set description
- $this->setObjectDescription("Datei-Ein-/Ausgabe-Handler");
-
- // Create an unique ID
- $this->generateUniqueId();
-
// Set own instance
self::$thisInstance = $this;
}
* Creates an instance of this class and prepares the IO system. This is
* being done by setting the default file IO class
*
- * @return $ioInstance A prepared instance of FilIOHandler
+ * @return $ioInstance A prepared instance of FilIOHandler
*/
public final static function createFileIoHandler () {
// Get instance
/**
* Setter for the *real* file input instance
*
- * @param $inputStream The *real* file-input class
+ * @param $inputStream The *real* file-input class
+ * @return void
*/
public final function setInputStream (FileInputStreamer $inputStream) {
$this->inputStream = $inputStream;
/**
* Setter for the *real* file output instance
*
- * @param $outputStream The *real* file-output class
+ * @param $outputStream The *real* file-output class
+ * @return void
*/
public final function setOutputStream (FileOutputStreamer $outputStream) {
$this->outputStream = $outputStream;
/**
* Saves a file with data by using the current output stream
*
- * @see FileOutputStreamer
+ * @param $fileName Name of the file
+ * @param $dataArray Array with file contents
+ * @return void
+ * @see FileOutputStreamer
*/
public function saveFile ($fileName, $dataArray) {
// Get output stream
$outInstance = $this->getOutputStream();
- // Is it a valid stream?
- if (is_null($outInstance)) {
- // No class returned
- throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_object($outInstance)) {
- // Not an object! ;-(
- throw new NoObjectException($outInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($outInstance, 'saveFile')) {
- // Nope, so throw exception
- throw new MissingMethodException(array($outInstance, 'saveFile'), self::EXCEPTION_MISSING_METHOD);
- }
-
// Send the fileName and dataArray to the output handler
$outInstance->saveFile($fileName, $dataArray);
}
/** Loads data from a file over the input handler
*
- * @see FileInputStreamer
+ * @return $array Array with the file contents
+ * @see FileInputStreamer
*/
public function loadFileContents ($fqfn) {
- // Initialize the array
- $array = array();
-
// Get output stream
$inInstance = $this->getInputStream();
- // Is it a valid stream?
- if (is_null($inInstance)) {
- // No class returned
- throw new NullPointerException($this, self::EXCEPTION_IS_NULL_POINTER);
- } elseif (!is_object($inInstance)) {
- // Not an object! ;-(
- throw new NoObjectException($inInstance, self::EXCEPTION_IS_NO_OBJECT);
- } elseif (!method_exists($inInstance, 'loadFileContents')) {
- // Nope, so throw exception
- throw new MissingMethodException(array($inInstance, 'loadFileContents'), self::EXCEPTION_MISSING_METHOD);
- }
-
// Read from the input handler
return $inInstance->loadFileContents($fqfn);
}
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * PrimusInterface
+ * -------------------------------------------
+ * Mit dieser Klasse ist ein einfacher Primeratransfer von Ihrem Account
+ * zu dem Account eines bei Primusportal.de registrierten Mitglieds möglich.
+ *
+ *------------------ Aenderungen durch Roland Haeder 09.08.2008 ----------------
+ * Klasse umbenannt nach PrimeraApi, damit sie in das Framework besser passt.
+ * Zudem sind alle oeffentlichen Attribute nun privat, der Konstruktor hat den
+ * neuen "magischen" Namen __construct() und "normale" Konstanten sind nach
+ * Klassenkonstanten umbenannt. Unsinnige else-Bloecke sind noch umgewandelt.
+ * Methodennamen fangen nun immer mit einem kleinen Buchstaben an. Zudem sind
+ * die Methoden Pay,Query und Parse umbenannt.
+ *------------------ Aenderungen durch Roland Haeder 09.08.2008 ----------------
+ *
+ * Die Einbindung des Interfaces geschieht folgendermaßen:
+ * 1. Einbindung der Klasse in Ihr PHP-Auszahlungsskript:
+ * CODE:
+ * require_once( "PFAD/ZU/DER/KLASSE/PrimusInterface.class.php" );
+ * $PPUsername = "username"; // Ihr Username bei Primusportal
+ * $PPPassword = "passwort"; // Ihr Passwort bei Primusportal
+ *
+ * $Interface = new PrimusInterface($PPUsername, $PPPassword);
+ * 2. Durchführen einer Auszahlung:
+ * CODE:
+ * $Status = $Interface->payPrimera($PayReceiver, $PayAmount, $PayDescription);
+ *
+ * Wobei $PayReicer der Username des Empfängers bei
+ * Primusportal.de ist. $PayAmount ist der gerundete( !! ) Betrag an Primera,
+ * die der Empfänger erhalten soll. $PayDescription ist eine von Ihnen
+ * festgelegte kurze Beschreibung. Die Länge dieses Textes darf 100 Zeichen
+ * nicht überschreiten. Beispiel:
+ * $status = $Interface->payPrimera("garbage", 10000, "Auszahlung IhreSeite.de - ID: 12345");
+ * 3. Überprüfung des Status (Rückgabecode):
+ * CODE:
+ * if (!$status) {
+ * // Ein Fehler ist aufgetreten
+ * // Fehlerbehandlung hier einfügen...
+ * }else {
+ * // Auszahlung erfolgreich durchgeführt
+ * // Führen Sie hier Ihre Datenbankabfragen durch, um die Auszahlung zu
+ * // bestätigen...
+ * }
+ *
+ * Die komplette Rückgabe des Interfaces wird als assoziatives Array in der Klassen-
+ * variable __data gespeichert:
+ * __data => array("status" => Rückgabecode (PI_DONE, PI_SENDER_ERROR, ...),
+ * "statustext" => Status in Worten (z.B.: "Transaktion erfolgreich durchgeführt"),
+ * ")
+ *
+ *
+ * @author Andreas Schmidt <xxgarbagexx@web.de>
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 1.0 - beta
+ * @copyright (c) 2007 by Primusportal.de
+ * @copyright (c) 2008 by Roland Haeder
+ */
+class PrimeraApi {
+ /**
+ * Fehler - Interfacebenutzer
+ */
+ const PI_ERROR = -1;
+
+ /**
+ * Statuscode für erfolgreich ausgeführte Transaktion
+ */
+ const PI_DONE = 200;
+
+ /**
+ * Fehler - User existiert nicht oder ist gesperrt
+ */
+ const PI_RECEIVER_ERROR = 301;
+
+ /**
+ * Sender-Account Fehler (User nicht existent, gesperrt, ...)
+ */
+ const PI_SENDER_ERROR = 401;
+
+ /**
+ * Betrag fehler
+ */
+ const PI_AMOUNT_ERROR = 501;
+
+ /**
+ * Zu wenig Primera
+ */
+ const PI_TOO_LESS_PRIMERA = 502;
+
+ /**
+ * User nicht aktiv oder existiert nicht
+ */
+ const PI_USER_CHECK_ERROR = 601;
+
+ /**
+ * User aktiv
+ */
+ const PI_USER_CHECK_OK = 602;
+
+ /**
+ * Primerastand erfolgreich geholt
+ */
+ const PI_GET_PRIMERA_DONE = 701;
+
+ /**
+ * URL für das Interface auf dem Primusserver:
+ */
+ private $host = "www.primusportal.de";
+ private $path = "/transfer.interface.2.0.php";
+
+ private $errno = 0;
+ private $err = "";
+
+ private $seperator = ":";
+
+ private $username = "";
+ private $password = "";
+
+ private $data = array();
+
+ /**
+ * Konstruktor
+ */
+ public function __construct ($PPUsername, $PPPassword) {
+ // Call parent constructor
+ parent::__construct();
+
+ // Clean up a little
+ $this->removeSystemArray();
+ $this->removeNumberFormaters();
+
+ // Set data (DEPRECATED!)
+ $this->username = $PPUsername;
+ $this->password = $PPPassword;
+ }
+
+ /**
+ * Anfrage senden und Rückgabecode in Variable speichern
+ */
+ function queryApi ( $data = array() ) {
+ $fp = fsockopen($this->host, 80, $this->errno, $this->_err);
+ if (!$fp) return false;
+
+ $data["PrimusInterface_Username"] = base64_encode($this->username);
+ $data["PrimusInterface_Password"] = base64_encode(md5($this->password));
+
+ // POST-Daten übermitteln:
+ $data = http_build_query($data, '', '&');
+
+ fputs($fp, "POST {$this->path}HTTP/1.1\r\n");
+ fputs($fp, "Host: {$this->host}\r\n");
+ fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
+ fputs($fp, "Content-length: ". strlen($data) ."\r\n");
+ fputs($fp, "Connection: close\r\n\r\n");
+ fputs($fp, $data);
+
+ $return = "";
+ while (!feof($fp)) {
+ $return.=fgets($fp,128);
+ }
+
+ $content = explode("<!-- return-start -->", $return);
+ return $content[1];
+ }
+
+ /**
+ * Funktion parst die Rückgabe vom Transferskript:
+ */
+ function parseContent ( $content ) {
+ $x = explode("\n", $content);
+ $return = array();
+ foreach($x as $currentLine) {
+ $line_exploded = explode(":", $currentLine,2);
+ if (count($line_exploded) > 1) {
+ $return[$line_exploded[0]] = $line_exploded[1];
+ }
+ }
+ return $return;
+ }
+
+ /**
+ * @param int/string $Receiver UserID / Username des Empfängers
+ * @param int$Amount Betrag in ganzzahligen Primera
+ * @param string $Description Beschreibung (Sichtbar in Einzelauflistung)
+ */
+ public function payPrimera ($Receiver, $Amount, $Description = "") {
+ $valid = false;
+ $PostData = array("PrimusInterface_Action" => "Pay",
+ "PrimusInterface_Receiver" => base64_encode($Receiver),
+ "PrimusInterface_Amount" => base64_encode($Amount),
+ "PrimusInterface_Description" => base64_encode($Description) );
+
+ $PostReturn = $this->parseContent( $this->queryApi($PostData) );
+
+ $this->data = $PostReturn;
+ if ($PostReturn["status"] == "200") {
+ $valid = true;
+ }
+ return $valid;
+ }
+
+ /**
+ * Überprüft den Status eines Primus-Users
+ * - existiert der User
+ * - ist er aktiv
+ * @param string/int $User Userid / Username
+ */
+ function CheckPrimusUser($User) {
+ $valid = false;
+ $PostData = array("PrimusInterface_Action"=> "CheckPrimusUser",
+ "PrimusInterface_CheckPrimusUser" => $User);
+
+ $PostReturn = $this->parseContent( $this->queryApi($PostData) );
+
+ $this->data = $PostReturn;
+
+ if ($PostReturn["status"] == self::PI_USER_CHECK_OK) {
+ $valid = true;
+ }
+ return $valid;
+ }
+
+ /**
+ * Die Funktion liefer den aktuellen Primerastand
+ */
+ function getPrimera() {
+ $primera = false;
+ $PostData = array( "PrimusInterface_Action" => "GetPrimera" );
+ $PostReturn = $this->parseContent( $this->queryApi($PostData) );
+
+ $this->data = $PostReturn;
+ if ($PostReturn["status"] == self::PI_GET_PRIMERA_DONE) {
+ $primera = $PostReturn["primera"];
+ }
+ return $primera;
+ }
+}
+
+// [EOF]
+?>
\ No newline at end of file
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * Class for connecting to the Wernis-Portal at http://www.wds66.com
+ *
+ * @author Roland Haeder <webmaster@ship-simu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class WernisApi extends BaseFrameworkSystem {
+ /**
+ * Static base API URL
+ */
+ private static $apiUrl = "http://www.wds66.com/api/";
+
+ /**
+ * API Wernis amount
+ */
+ private $wernis_amount = 0;
+
+ /**
+ * API username
+ */
+ private $w_id = 0;
+
+ /**
+ * API Wernis password (not account password!)
+ */
+ private $w_md5 = "";
+
+ /**
+ * Nickname of the user
+ */
+ private $w_nick = "";
+
+ /**
+ * Wernis amount of the user
+ */
+ private $w_amount = 0;
+
+ /**
+ * Array with status informations
+ */
+ private $statusArray = array();
+
+ /**
+ * Protected constructor
+ *
+ * @return void
+ */
+ protected function __construct () {
+ // Call parent constructor
+ parent::__construct(__CLASS__);
+
+ // Clean up a little
+ $this->removeNumberFormaters();
+ $this->removeSystemArray();
+ }
+
+ /**
+ * Creates an instance of this API class
+ *
+ * @param $cfg Configuration array
+ * @return $apiInstance An instance of this API class
+ */
+ public final static function createWernisApi (array $cfg) {
+ // Create a new instance
+ $apiInstance = new WernisApi();
+
+ // Fix missing
+ if (!isset($cfg['api_url'])) $cfg['api_url'] = self::$apiUrl;
+
+ // Konfiguration uebertragen
+ $apiInstance->setCoonfigArray($cfg);
+
+ // Return the instance
+ return $apiInstance;
+ }
+
+ /**
+ * Setter for gamer data
+ *
+ * @param $w_id Username (id) of the gamer
+ * @param $w_pwd Clear password of the gamer
+ * @return void
+ */
+ public function setUser ($w_id, $w_pwd) {
+ // Set username (id)
+ $this->w_id = $w_id;
+
+ // Hash clear password and set it
+ $this->w_md5 = md5($w_pwd);
+ }
+
+ /************************************************
+ * The following methods are not yet rewritten! *
+ ************************************************/
+
+ public function einziehen ($amount) {
+ // amount auf Gueltigkeit pruefen
+ $amount = isset($amount) ? $amount+0 : 0;
+
+ if ($amount < $this->config['mineinsatz']) {
+ $this->setStatusMessage('low_stakes', sprintf("Dein Einsatz muss mindestens %d Wernis betragen.", $this->config['mineinsatz']));
+ return false;
+ }
+
+ // Abfrage senden
+ return $this->executeWithdraw($amount);
+ }
+
+ public function verschicken ($amount) {
+ // amount auf Gueltigkeit pruefen
+ $amount = isset($amount) ? $amount+0 : 0;
+
+ if ($amount < $this->config['mineinsatz']) {
+ $this->setStatusMessage('low_stakes', sprintf("Dein Einsatz muss mindestens %d Wernis betragen.", $this->config['mineinsatz']));
+ return false;
+ }
+
+ // Abfrage senden
+ return $this->executePayout($amount);
+ }
+
+ // Script abbrechen mit Zurueck-Buttom
+ public function ende () {
+ global $_CONFIG;
+ include "templates/zurueck.html";
+ include "templates/fuss.html";
+ die();
+ }
+
+ // Fehlermeldung ausgeben und beenden
+ public function error () {
+ print "<div class=\"fehler\">Fehler im Spiel: ".$this->getErrorMessage()."<div><br />\n";
+ $this->ende();
+ }
+
+ // Sets a status message and code
+ public function setStatusMessage ($msg, $status) {
+ $this->statusArray['message'] = $msg;
+ $this->statusArray['status'] = $status;
+ }
+
+ // Get the status message
+ public function getErrorMessage () {
+ if (isset($this->statusArray['message'])) {
+ // Use raw message
+ return $this->statusArray['message'];
+ } else {
+ // Fall-back to status
+ return sprintf("Fehler-Code <u>%s</u> ist keiner Nachricht zugewiesen.", $this->getErrorCode());
+ }
+ }
+
+ // Get the status code
+ public function getErrorCode () {
+ if (isset($this->statusArray['status'])) {
+ // Use raw message
+ return $this->statusArray['status'];
+ } else {
+ // Something bad happend
+ return 'unknown';
+ }
+ }
+
+ // Sends out a request to the API and returns it's result
+ private function sendRequest ($scriptName, array $requestData = array()) {
+ // Is the requestData an array?
+ if (!is_array($requestData)) {
+ // Then abort here!
+ return array(
+ 'status' => "failed_general",
+ 'message' => "API-Daten in <strong>config</strong> sind ungültig!"
+ );
+ }
+
+ // Is the API id and MD5 hash there?
+ if ((empty($this->config['wernis_api_id'])) || (empty($this->config['wernis_api_key']))) {
+ // Abort here...
+ return array(
+ 'status' => "failed_general",
+ 'message' => "API-Daten in config.php sind leer!"
+ );
+ }
+
+ // Construct the request string
+ $requestString = $this->config['api_url'] . $scriptName."?api_id=".$this->config['wernis_api_id']."&api_key=".$this->config['wernis_api_key'];
+ foreach ($requestData as $key=>$value) {
+ $requestString .= "&".$key."=".$value;
+ }
+
+ // Get the raw response from the lower function
+ $response = $this->sendRawRequest($requestString);
+
+ // Check the response header if all is fine
+ if (strpos($response[0], "200") === false) {
+ // Something bad happend... :(
+ return array(
+ 'status' => "request_error",
+ 'message' => sprintf("Servermeldung <u>%s</u> von WDS66-API erhalten.", $response[0])
+ );
+ }
+
+ // All (maybe) fine so remove the response header from server
+ $response = $response[(count($response) - 1)];
+
+ // Prepare the returning result for higher functions
+ if (substr($response, 0, 1) == "&") {
+ // Remove the leading & (which can be used in Flash)
+ $response = substr($response, 1);
+ }
+
+ // Bring back the response
+ $data = explode("=", $response);
+
+ // Default return array (should not stay empty)
+ $return = array();
+
+ // We use only the first two entries (which shall be fine)
+ if ($data[0] === "error") {
+ // The request has failed... :(
+ switch ($data[1]) {
+ case "404": // Invalid API ID
+ case "AUTH": // Authorization has failed
+ $return = array(
+ 'status' => "auth_failed",
+ 'message' => "API-Daten scheinen nicht zu stimmen! (Access Denied)"
+ );
+ break;
+
+ case "LOCKED": // User account is locked!
+ case "PASS": // Bad passphrase entered
+ case "USER": // Missing account or invalid password
+ $return = array(
+ 'status' => "user_failed",
+ 'message' => "Dein eingegebener WDS66-Username stimmt nicht, ist gesperrt oder du hast ein falsches Passwort eingegeben."
+ );
+ break;
+
+ case "OWN": // Transfer to own account
+ $return = array(
+ 'status' => "own_failed",
+ 'message' => "Du darfst dein eigenes Spiel leider nicht spielen."
+ );
+ break;
+
+ case "AMOUNT": // Amount is depleted
+ $return = array(
+ 'status' => "amount_failed",
+ 'message' => "Dein Guthaben reicht nicht aus, um das Spiel zu spielen."
+ );
+ break;
+
+ case "AMOUNT-SEND": // API amount is depleted
+ $return = array(
+ 'status' => "api_amount_failed",
+ 'message' => "Nicht genügend Guthaben auf dem API-Account."
+ );
+ break;
+
+ default: // Unknown error (maybe new?)
+ $return = array(
+ 'status' => "request_failed",
+ 'message' => sprintf("Unbekannter Fehler <u>%s</u> von API erhalten.", $data[1])
+ );
+ break;
+ }
+ } else {
+ // All fine here
+ $return = array(
+ 'status' => "OK",
+ 'response' => $response
+ );
+ }
+
+ // Return the result
+ return $return;
+ }
+
+ // Widthdraw this amount
+ private function executeWithdraw ($amount) {
+ // First all fails...
+ $result = false;
+
+ // Prepare the purpose
+ $purpose = "\"Bube oder Dame\"-Einsatz gesetzt.";
+
+ // Prepare the request data
+ $requestData = array(
+ 'sub_request' => "receive",
+ 't_uid' => $this->w_id,
+ 't_md5' => $this->w_md5,
+ 'r_uid' => (int)$this->config['wernis_refid'],
+ 'amount' => (int)$amount,
+ 'purpose' => urlencode(base64_encode($purpose))
+ );
+
+ // Return the result from the lower functions
+ $return = $this->sendRequest("book.php", $requestData);
+
+ if ($return['status'] == "OK") {
+ // All fine!
+ $result = true;
+ } else {
+ // Status failture text
+ $this->setStatusMessage($return['message'], $return['status']);
+ }
+
+ // Return result
+ return $result;
+ }
+
+ // Payout this amount
+ private function executePayout ($amount) {
+ // First all fails...
+ $result = false;
+
+ // Prepare the purpose
+ $purpose = "\"Bube oder Dame\"-Gewinn erhalten.";
+
+ // Prepare the request data
+ $requestData = array(
+ 'sub_request' => "send",
+ 't_uid' => $this->w_id,
+ 't_md5' => $this->w_md5,
+ 'r_uid' => (int)$this->config['wernis_refid'],
+ 'amount' => (int)$amount,
+ 'purpose' => urlencode(base64_encode($purpose))
+ );
+
+ // Return the result from the lower functions
+ $return = $this->sendRequest("book.php", $requestData);
+
+ if ($return['status'] == "OK") {
+ // All fine!
+ $result = true;
+ } else {
+ // Status failture text
+ $this->setStatusMessage($return['message'], $return['status']);
+ }
+
+ // Return result
+ return $result;
+ }
+
+ // Send raw GET request
+ private function sendRawRequest ($script) {
+ // Use the hostname from script URL as new hostname
+ $url = substr($script, 7);
+ $extract = explode("/", $url);
+
+ // Done extracting the URL :)
+ $url = $extract[0];
+
+ // Extract host name
+ $host = str_replace("http://", "", $url);
+ if (ereg("/", $host)) $host = substr($host, 0, strpos($host, "/"));
+
+ // Generate relative URL
+ $script = substr($script, (strlen($url) + 7));
+ if (substr($script, 0, 1) == "/") $script = substr($script, 1);
+
+ // Open connection
+ $fp = @fsockopen($host, 80, $errno, $errdesc, 30);
+ if (!$fp) {
+ // Failed!
+ return array("", "", "");
+ }
+
+ // Generate request header
+ $request = "GET /".trim($script)." HTTP/1.0\r\n";
+ $request .= "Host: ".$host."\r\n";
+ $request .= sprintf("User-Agent: Bube oder Dame / 1.0 by Quix0r [Spieler: %d]\r\n\r\n", $this->w_id);
+
+ // Initialize array
+ $response = array();
+
+ // Write request
+ fputs($fp, $request);
+
+ // Read response
+ while(!feof($fp)) {
+ $response[] = trim(fgets($fp, 1024));
+ }
+
+ // Close socket
+ fclose($fp);
+
+ // Was the request successfull?
+ if ((!ereg("200 OK", $response[0])) && (empty($response[0]))) {
+ // Not found / access forbidden
+ $response = array("", "", "");
+ }
+
+ // Return response
+ return $response;
+ }
+}
+
+// [EOF]
+?>
--- /dev/null
+Deny from all
--- /dev/null
+/*******************************************************************\r
+* The http://phpmailer.codeworxtech.com/ website now carries a few *\r
+* advertisements through the Google Adsense network. Please visit *\r
+* the advertiser sites and help us offset some of our costs. *\r
+* Thanks .... *\r
+********************************************************************/\r
+\r
+ChangeLog\r
+\r
+NOTE: THIS VERSION OF PHPMAILER IS DESIGNED FOR PHP5. IT WILL NOT WORK WITH PHP4.\r
+\r
+Version 2.1 (Wed, June 04 2008)\r
+\r
+** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.\r
+ IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE\r
+ APPRECIATED.\r
+\r
+* added S/MIME functionality (ability to digitally sign emails)\r
+ BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.\r
+ The "Signed Emails" functionality adds the Sign method to pass the private key\r
+ filename and the password to read it, and then email will be sent with\r
+ content-type multipart/signed and with the digital signature attached.\r
+* fully compatible with E_STRICT error level\r
+ - Please note:\r
+ In about half the test environments this development version was subjected\r
+ to, an error was thrown for the date() functions used (line 1565 and 1569).\r
+ This is NOT a PHPMailer error, it is the result of an incorrectly configured\r
+ PHP5 installation. The fix is to modify your 'php.ini' file and include the\r
+ date.timezone = America/New York\r
+ directive, to your own server timezone\r
+ - If you do get this error, and are unable to access your php.ini file:\r
+ In your PHP script, add\r
+ date_default_timezone_set('America/Toronto');\r
+ - do not try to use\r
+ $myVar = date_default_timezone_get();\r
+ as a test, it will throw an error.\r
+* added ability to define path (mainly for embedded images)\r
+ function MsgHTML($message,$basedir='') ... where:\r
+ $basedir is the fully qualified path\r
+* fixed MsgHTML() function:\r
+ - Embedded Images where images are specified by <protocol>:// will not be altered or embedded\r
+* fixed the return value of SMTP exit code ( pclose )\r
+* addressed issue of multibyte characters in subject line and truncating\r
+* added ability to have user specified Message ID\r
+ (default is still that PHPMailer create a unique Message ID)\r
+* corrected unidentified message type to 'application/octet-stream'\r
+* fixed chunk_split() multibyte issue (thanks to Colin Brown, et al).\r
+* added check for added attachments\r
+* enhanced conversion of HTML to text in MsgHTML (thanks to "brunny")\r
+\r
+Version 2.1.0beta2 (Sun, Dec 02 2007)\r
+* implemented updated EncodeQP (thanks to coolbru, aka Marcus Bointon)\r
+* finished all testing, all known bugs corrected, enhancements tested\r
+- note: will NOT work with PHP4.\r
+\r
+please note, this is BETA software\r
+** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS\r
+INTENDED STRICTLY FOR TESTING\r
+\r
+Version 2.1.0beta1\r
+please note, this is BETA software\r
+** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS\r
+INTENDED STRICTLY FOR TESTING\r
+\r
+Version 2.0.0 rc2 (Fri, Nov 16 2007), interim release\r
+* implements new property to control VERP in class.smtp.php\r
+ example (requires instantiating class.smtp.php):\r
+ $mail->do_verp = true;\r
+* POP-before-SMTP functionality included, thanks to Richard Davey\r
+ (see class.pop3.php & pop3_before_smtp_test.php for examples)\r
+* included example showing how to use PHPMailer with GMAIL\r
+* fixed the missing Cc in SendMail() and Mail()\r
+\r
+******************\r
+A note on sending bulk emails:\r
+\r
+If the email you are sending is not personalized, consider using the\r
+"undisclosed-recipient:;" strategy. That is, put all of your recipients\r
+in the Bcc field and set the To field to "undisclosed-recipients:;".\r
+It's a lot faster (only one send) and saves quite a bit on resources.\r
+Contrary to some opinions, this will not get you listed in spam engines -\r
+it's a legitimate way for you to send emails.\r
+\r
+A partial example for use with PHPMailer:\r
+\r
+$mail->AddAddress("undisclosed-recipients:;");\r
+$mail->AddBCC("email1@anydomain.com,email2@anyotherdomain.com,email3@anyalternatedomain.com");\r
+\r
+Many email service providers restrict the number of emails that can be sent\r
+in any given time period. Often that is between 50 - 60 emails maximum\r
+per hour or per send session.\r
+\r
+If that's the case, then break up your Bcc lists into chunks that are one\r
+less than your limit, and put a pause in your script.\r
+*******************\r
+\r
+Version 2.0.0 rc1 (Thu, Nov 08 2007), interim release\r
+* dramatically simplified using inline graphics ... it's fully automated and requires no user input\r
+* added automatic document type detection for attachments and pictures\r
+* added MsgHTML() function to replace Body tag for HTML emails\r
+* fixed the SendMail security issues (input validation vulnerability)\r
+* enhanced the AddAddresses functionality so that the "Name" portion is used in the email address\r
+* removed the need to use the AltBody method (set from the HTML, or default text used)\r
+* set the PHP Mail() function as the default (still support SendMail, SMTP Mail)\r
+* removed the need to set the IsHTML property (set automatically)\r
+* added Estonian language file by Indrek Päri\r
+* added header injection patch\r
+* added "set" method to permit users to create their own pseudo-properties like 'X-Headers', etc.\r
+ example of use:\r
+ $mail->set('X-Priority', '3');\r
+ $mail->set('X-MSMail-Priority', 'Normal');\r
+* fixed warning message in SMTP get_lines method\r
+* added TLS/SSL SMTP support\r
+ example of use:\r
+ $mail = new PHPMailer();\r
+ $mail->Mailer = "smtp";\r
+ $mail->Host = "smtp.example.com";\r
+ $mail->SMTPSecure = "tls"; // option\r
+ //$mail->SMTPSecure = "ssl"; // option\r
+ ...\r
+ $mail->Send();\r
+* PHPMailer has been tested with PHP4 (4.4.7) and PHP5 (5.2.7)\r
+* Works with PHP installed as a module or as CGI-PHP\r
+- NOTE: will NOT work with PHP5 in E_STRICT error mode\r
+\r
+Version 1.73 (Sun, Jun 10 2005)\r
+* Fixed denial of service bug: http://www.cybsec.com/vuln/PHPMailer-DOS.pdf\r
+* Now has a total of 20 translations\r
+* Fixed alt attachments bug: http://tinyurl.com/98u9k\r
+\r
+Version 1.72 (Wed, May 25 2004)\r
+* Added Dutch, Swedish, Czech, Norwegian, and Turkish translations.\r
+* Received: Removed this method because spam filter programs like\r
+SpamAssassin reject this header.\r
+* Fixed error count bug.\r
+* SetLanguage default is now "language/".\r
+* Fixed magic_quotes_runtime bug.\r
+\r
+Version 1.71 (Tue, Jul 28 2003)\r
+* Made several speed enhancements\r
+* Added German and Italian translation files\r
+* Fixed HELO/AUTH bugs on keep-alive connects\r
+* Now provides an error message if language file does not load\r
+* Fixed attachment EOL bug\r
+* Updated some unclear documentation\r
+* Added additional tests and improved others\r
+\r
+Version 1.70 (Mon, Jun 20 2003)\r
+* Added SMTP keep-alive support\r
+* Added IsError method for error detection\r
+* Added error message translation support (SetLanguage)\r
+* Refactored many methods to increase library performance\r
+* Hello now sends the newer EHLO message before HELO as per RFC 2821\r
+* Removed the boundary class and replaced it with GetBoundary\r
+* Removed queue support methods\r
+* New $Hostname variable\r
+* New Message-ID header\r
+* Received header reformat\r
+* Helo variable default changed to $Hostname\r
+* Removed extra spaces in Content-Type definition (#667182)\r
+* Return-Path should be set to Sender when set\r
+* Adds Q or B encoding to headers when necessary\r
+* quoted-encoding should now encode NULs \000\r
+* Fixed encoding of body/AltBody (#553370)\r
+* Adds "To: undisclosed-recipients:;" when all recipients are hidden (BCC)\r
+* Multiple bug fixes\r
+\r
+Version 1.65 (Fri, Aug 09 2002)\r
+* Fixed non-visible attachment bug (#585097) for Outlook\r
+* SMTP connections are now closed after each transaction\r
+* Fixed SMTP::Expand return value\r
+* Converted SMTP class documentation to phpDocumentor format\r
+\r
+Version 1.62 (Wed, Jun 26 2002)\r
+* Fixed multi-attach bug\r
+* Set proper word wrapping\r
+* Reduced memory use with attachments\r
+* Added more debugging\r
+* Changed documentation to phpDocumentor format\r
+\r
+Version 1.60 (Sat, Mar 30 2002)\r
+* Sendmail pipe and address patch (Christian Holtje)\r
+* Added embedded image and read confirmation support (A. Ognio)\r
+* Added unit tests\r
+* Added SMTP timeout support (*nix only)\r
+* Added possibly temporary PluginDir variable for SMTP class\r
+* Added LE message line ending variable\r
+* Refactored boundary and attachment code\r
+* Eliminated SMTP class warnings\r
+* Added SendToQueue method for future queuing support\r
+\r
+Version 1.54 (Wed, Dec 19 2001)\r
+* Add some queuing support code\r
+* Fixed a pesky multi/alt bug\r
+* Messages are no longer forced to have "To" addresses\r
+\r
+Version 1.50 (Thu, Nov 08 2001)\r
+* Fix extra lines when not using SMTP mailer\r
+* Set WordWrap variable to int with a zero default\r
+\r
+Version 1.47 (Tue, Oct 16 2001)\r
+* Fixed Received header code format\r
+* Fixed AltBody order error\r
+* Fixed alternate port warning\r
+\r
+Version 1.45 (Tue, Sep 25 2001)\r
+* Added enhanced SMTP debug support\r
+* Added support for multiple ports on SMTP\r
+* Added Received header for tracing\r
+* Fixed AddStringAttachment encoding\r
+* Fixed possible header name quote bug\r
+* Fixed wordwrap() trim bug\r
+* Couple other small bug fixes\r
+\r
+Version 1.41 (Wed, Aug 22 2001)\r
+* Fixed AltBody bug w/o attachments\r
+* Fixed rfc_date() for certain mail servers\r
+\r
+Version 1.40 (Sun, Aug 12 2001)\r
+* Added multipart/alternative support (AltBody)\r
+* Documentation update\r
+* Fixed bug in Mercury MTA\r
+\r
+Version 1.29 (Fri, Aug 03 2001)\r
+* Added AddStringAttachment() method\r
+* Added SMTP authentication support\r
+\r
+Version 1.28 (Mon, Jul 30 2001)\r
+* Fixed a typo in SMTP class\r
+* Fixed header issue with Imail (win32) SMTP server\r
+* Made fopen() calls for attachments use "rb" to fix win32 error\r
+\r
+Version 1.25 (Mon, Jul 02 2001)\r
+* Added RFC 822 date fix (Patrice)\r
+* Added improved error handling by adding a $ErrorInfo variable\r
+* Removed MailerDebug variable (obsolete with new error handler)\r
+\r
+Version 1.20 (Mon, Jun 25 2001)\r
+* Added quoted-printable encoding (Patrice)\r
+* Set Version as public and removed PrintVersion()\r
+* Changed phpdoc to only display public variables and methods\r
+\r
+Version 1.19 (Thu, Jun 21 2001)\r
+* Fixed MS Mail header bug\r
+* Added fix for Bcc problem with mail(). *Does not work on Win32*\r
+ (See PHP bug report: http://www.php.net/bugs.php?id=11616)\r
+* mail() no longer passes a fifth parameter when not needed\r
+\r
+Version 1.15 (Fri, Jun 15 2001)\r
+[Note: these changes contributed by Patrice Fournier]\r
+* Changed all remaining \n to \r\n\r
+* Bcc: header no longer writen to message except\r
+when sent directly to sendmail\r
+* Added a small message to non-MIME compliant mail reader\r
+* Added Sender variable to change the Sender email\r
+used in -f for sendmail/mail and in 'MAIL FROM' for smtp mode\r
+* Changed boundary setting to a place it will be set only once\r
+* Removed transfer encoding for whole message when using multipart\r
+* Message body now uses Encoding in multipart messages\r
+* Can set encoding and type to attachments 7bit, 8bit\r
+and binary attachment are sent as is, base64 are encoded\r
+* Can set Encoding to base64 to send 8 bits body\r
+through 7 bits servers\r
+\r
+Version 1.10 (Tue, Jun 12 2001)\r
+* Fixed win32 mail header bug (printed out headers in message body)\r
+\r
+Version 1.09 (Fri, Jun 08 2001)\r
+* Changed date header to work with Netscape mail programs\r
+* Altered phpdoc documentation\r
+\r
+Version 1.08 (Tue, Jun 05 2001)\r
+* Added enhanced error-checking\r
+* Added phpdoc documentation to source\r
+\r
+Version 1.06 (Fri, Jun 01 2001)\r
+* Added optional name for file attachments\r
+\r
+Version 1.05 (Tue, May 29 2001)\r
+* Code cleanup\r
+* Eliminated sendmail header warning message\r
+* Fixed possible SMTP error\r
+\r
+Version 1.03 (Thu, May 24 2001)\r
+* Fixed problem where qmail sends out duplicate messages\r
+\r
+Version 1.02 (Wed, May 23 2001)\r
+* Added multiple recipient and attachment Clear* methods\r
+* Added Sendmail public variable\r
+* Fixed problem with loading SMTP library multiple times\r
+\r
+Version 0.98 (Tue, May 22 2001)\r
+* Fixed problem with redundant mail hosts sending out multiple messages\r
+* Added additional error handler code\r
+* Added AddCustomHeader() function\r
+* Added support for Microsoft mail client headers (affects priority)\r
+* Fixed small bug with Mailer variable\r
+* Added PrintVersion() function\r
+\r
+Version 0.92 (Tue, May 15 2001)\r
+* Changed file names to class.phpmailer.php and class.smtp.php to match\r
+ current PHP class trend.\r
+* Fixed problem where body not being printed when a message is attached\r
+* Several small bug fixes\r
+\r
+Version 0.90 (Tue, April 17 2001)\r
+* Intial public release\r
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE\r
+ Version 2.1, February 1999\r
+\r
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.\r
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+ Everyone is permitted to copy and distribute verbatim copies\r
+ of this license document, but changing it is not allowed.\r
+\r
+[This is the first released version of the Lesser GPL. It also counts\r
+ as the successor of the GNU Library Public License, version 2, hence\r
+ the version number 2.1.]\r
+\r
+ Preamble\r
+\r
+ The licenses for most software are designed to take away your\r
+freedom to share and change it. By contrast, the GNU General Public\r
+Licenses are intended to guarantee your freedom to share and change\r
+free software--to make sure the software is free for all its users.\r
+\r
+ This license, the Lesser General Public License, applies to some\r
+specially designated software packages--typically libraries--of the\r
+Free Software Foundation and other authors who decide to use it. You\r
+can use it too, but we suggest you first think carefully about whether\r
+this license or the ordinary General Public License is the better\r
+strategy to use in any particular case, based on the explanations below.\r
+\r
+ When we speak of free software, we are referring to freedom of use,\r
+not price. Our General Public Licenses are designed to make sure that\r
+you have the freedom to distribute copies of free software (and charge\r
+for this service if you wish); that you receive source code or can get\r
+it if you want it; that you can change the software and use pieces of\r
+it in new free programs; and that you are informed that you can do\r
+these things.\r
+\r
+ To protect your rights, we need to make restrictions that forbid\r
+distributors to deny you these rights or to ask you to surrender these\r
+rights. These restrictions translate to certain responsibilities for\r
+you if you distribute copies of the library or if you modify it.\r
+\r
+ For example, if you distribute copies of the library, whether gratis\r
+or for a fee, you must give the recipients all the rights that we gave\r
+you. You must make sure that they, too, receive or can get the source\r
+code. If you link other code with the library, you must provide\r
+complete object files to the recipients, so that they can relink them\r
+with the library after making changes to the library and recompiling\r
+it. And you must show them these terms so they know their rights.\r
+\r
+ We protect your rights with a two-step method: (1) we copyright the\r
+library, and (2) we offer you this license, which gives you legal\r
+permission to copy, distribute and/or modify the library.\r
+\r
+ To protect each distributor, we want to make it very clear that\r
+there is no warranty for the free library. Also, if the library is\r
+modified by someone else and passed on, the recipients should know\r
+that what they have is not the original version, so that the original\r
+author's reputation will not be affected by problems that might be\r
+introduced by others.\r
+\r
+ Finally, software patents pose a constant threat to the existence of\r
+any free program. We wish to make sure that a company cannot\r
+effectively restrict the users of a free program by obtaining a\r
+restrictive license from a patent holder. Therefore, we insist that\r
+any patent license obtained for a version of the library must be\r
+consistent with the full freedom of use specified in this license.\r
+\r
+ Most GNU software, including some libraries, is covered by the\r
+ordinary GNU General Public License. This license, the GNU Lesser\r
+General Public License, applies to certain designated libraries, and\r
+is quite different from the ordinary General Public License. We use\r
+this license for certain libraries in order to permit linking those\r
+libraries into non-free programs.\r
+\r
+ When a program is linked with a library, whether statically or using\r
+a shared library, the combination of the two is legally speaking a\r
+combined work, a derivative of the original library. The ordinary\r
+General Public License therefore permits such linking only if the\r
+entire combination fits its criteria of freedom. The Lesser General\r
+Public License permits more lax criteria for linking other code with\r
+the library.\r
+\r
+ We call this license the "Lesser" General Public License because it\r
+does Less to protect the user's freedom than the ordinary General\r
+Public License. It also provides other free software developers Less\r
+of an advantage over competing non-free programs. These disadvantages\r
+are the reason we use the ordinary General Public License for many\r
+libraries. However, the Lesser license provides advantages in certain\r
+special circumstances.\r
+\r
+ For example, on rare occasions, there may be a special need to\r
+encourage the widest possible use of a certain library, so that it becomes\r
+a de-facto standard. To achieve this, non-free programs must be\r
+allowed to use the library. A more frequent case is that a free\r
+library does the same job as widely used non-free libraries. In this\r
+case, there is little to gain by limiting the free library to free\r
+software only, so we use the Lesser General Public License.\r
+\r
+ In other cases, permission to use a particular library in non-free\r
+programs enables a greater number of people to use a large body of\r
+free software. For example, permission to use the GNU C Library in\r
+non-free programs enables many more people to use the whole GNU\r
+operating system, as well as its variant, the GNU/Linux operating\r
+system.\r
+\r
+ Although the Lesser General Public License is Less protective of the\r
+users' freedom, it does ensure that the user of a program that is\r
+linked with the Library has the freedom and the wherewithal to run\r
+that program using a modified version of the Library.\r
+\r
+ The precise terms and conditions for copying, distribution and\r
+modification follow. Pay close attention to the difference between a\r
+"work based on the library" and a "work that uses the library". The\r
+former contains code derived from the library, whereas the latter must\r
+be combined with the library in order to run.\r
+\r
+ GNU LESSER GENERAL PUBLIC LICENSE\r
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\r
+\r
+ 0. This License Agreement applies to any software library or other\r
+program which contains a notice placed by the copyright holder or\r
+other authorized party saying it may be distributed under the terms of\r
+this Lesser General Public License (also called "this License").\r
+Each licensee is addressed as "you".\r
+\r
+ A "library" means a collection of software functions and/or data\r
+prepared so as to be conveniently linked with application programs\r
+(which use some of those functions and data) to form executables.\r
+\r
+ The "Library", below, refers to any such software library or work\r
+which has been distributed under these terms. A "work based on the\r
+Library" means either the Library or any derivative work under\r
+copyright law: that is to say, a work containing the Library or a\r
+portion of it, either verbatim or with modifications and/or translated\r
+straightforwardly into another language. (Hereinafter, translation is\r
+included without limitation in the term "modification".)\r
+\r
+ "Source code" for a work means the preferred form of the work for\r
+making modifications to it. For a library, complete source code means\r
+all the source code for all modules it contains, plus any associated\r
+interface definition files, plus the scripts used to control compilation\r
+and installation of the library.\r
+\r
+ Activities other than copying, distribution and modification are not\r
+covered by this License; they are outside its scope. The act of\r
+running a program using the Library is not restricted, and output from\r
+such a program is covered only if its contents constitute a work based\r
+on the Library (independent of the use of the Library in a tool for\r
+writing it). Whether that is true depends on what the Library does\r
+and what the program that uses the Library does.\r
+ \r
+ 1. You may copy and distribute verbatim copies of the Library's\r
+complete source code as you receive it, in any medium, provided that\r
+you conspicuously and appropriately publish on each copy an\r
+appropriate copyright notice and disclaimer of warranty; keep intact\r
+all the notices that refer to this License and to the absence of any\r
+warranty; and distribute a copy of this License along with the\r
+Library.\r
+\r
+ You may charge a fee for the physical act of transferring a copy,\r
+and you may at your option offer warranty protection in exchange for a\r
+fee.\r
+\r
+ 2. You may modify your copy or copies of the Library or any portion\r
+of it, thus forming a work based on the Library, and copy and\r
+distribute such modifications or work under the terms of Section 1\r
+above, provided that you also meet all of these conditions:\r
+\r
+ a) The modified work must itself be a software library.\r
+\r
+ b) You must cause the files modified to carry prominent notices\r
+ stating that you changed the files and the date of any change.\r
+\r
+ c) You must cause the whole of the work to be licensed at no\r
+ charge to all third parties under the terms of this License.\r
+\r
+ d) If a facility in the modified Library refers to a function or a\r
+ table of data to be supplied by an application program that uses\r
+ the facility, other than as an argument passed when the facility\r
+ is invoked, then you must make a good faith effort to ensure that,\r
+ in the event an application does not supply such function or\r
+ table, the facility still operates, and performs whatever part of\r
+ its purpose remains meaningful.\r
+\r
+ (For example, a function in a library to compute square roots has\r
+ a purpose that is entirely well-defined independent of the\r
+ application. Therefore, Subsection 2d requires that any\r
+ application-supplied function or table used by this function must\r
+ be optional: if the application does not supply it, the square\r
+ root function must still compute square roots.)\r
+\r
+These requirements apply to the modified work as a whole. If\r
+identifiable sections of that work are not derived from the Library,\r
+and can be reasonably considered independent and separate works in\r
+themselves, then this License, and its terms, do not apply to those\r
+sections when you distribute them as separate works. But when you\r
+distribute the same sections as part of a whole which is a work based\r
+on the Library, the distribution of the whole must be on the terms of\r
+this License, whose permissions for other licensees extend to the\r
+entire whole, and thus to each and every part regardless of who wrote\r
+it.\r
+\r
+Thus, it is not the intent of this section to claim rights or contest\r
+your rights to work written entirely by you; rather, the intent is to\r
+exercise the right to control the distribution of derivative or\r
+collective works based on the Library.\r
+\r
+In addition, mere aggregation of another work not based on the Library\r
+with the Library (or with a work based on the Library) on a volume of\r
+a storage or distribution medium does not bring the other work under\r
+the scope of this License.\r
+\r
+ 3. You may opt to apply the terms of the ordinary GNU General Public\r
+License instead of this License to a given copy of the Library. To do\r
+this, you must alter all the notices that refer to this License, so\r
+that they refer to the ordinary GNU General Public License, version 2,\r
+instead of to this License. (If a newer version than version 2 of the\r
+ordinary GNU General Public License has appeared, then you can specify\r
+that version instead if you wish.) Do not make any other change in\r
+these notices.\r
+\r
+ Once this change is made in a given copy, it is irreversible for\r
+that copy, so the ordinary GNU General Public License applies to all\r
+subsequent copies and derivative works made from that copy.\r
+\r
+ This option is useful when you wish to copy part of the code of\r
+the Library into a program that is not a library.\r
+\r
+ 4. You may copy and distribute the Library (or a portion or\r
+derivative of it, under Section 2) in object code or executable form\r
+under the terms of Sections 1 and 2 above provided that you accompany\r
+it with the complete corresponding machine-readable source code, which\r
+must be distributed under the terms of Sections 1 and 2 above on a\r
+medium customarily used for software interchange.\r
+\r
+ If distribution of object code is made by offering access to copy\r
+from a designated place, then offering equivalent access to copy the\r
+source code from the same place satisfies the requirement to\r
+distribute the source code, even though third parties are not\r
+compelled to copy the source along with the object code.\r
+\r
+ 5. A program that contains no derivative of any portion of the\r
+Library, but is designed to work with the Library by being compiled or\r
+linked with it, is called a "work that uses the Library". Such a\r
+work, in isolation, is not a derivative work of the Library, and\r
+therefore falls outside the scope of this License.\r
+\r
+ However, linking a "work that uses the Library" with the Library\r
+creates an executable that is a derivative of the Library (because it\r
+contains portions of the Library), rather than a "work that uses the\r
+library". The executable is therefore covered by this License.\r
+Section 6 states terms for distribution of such executables.\r
+\r
+ When a "work that uses the Library" uses material from a header file\r
+that is part of the Library, the object code for the work may be a\r
+derivative work of the Library even though the source code is not.\r
+Whether this is true is especially significant if the work can be\r
+linked without the Library, or if the work is itself a library. The\r
+threshold for this to be true is not precisely defined by law.\r
+\r
+ If such an object file uses only numerical parameters, data\r
+structure layouts and accessors, and small macros and small inline\r
+functions (ten lines or less in length), then the use of the object\r
+file is unrestricted, regardless of whether it is legally a derivative\r
+work. (Executables containing this object code plus portions of the\r
+Library will still fall under Section 6.)\r
+\r
+ Otherwise, if the work is a derivative of the Library, you may\r
+distribute the object code for the work under the terms of Section 6.\r
+Any executables containing that work also fall under Section 6,\r
+whether or not they are linked directly with the Library itself.\r
+\r
+ 6. As an exception to the Sections above, you may also combine or\r
+link a "work that uses the Library" with the Library to produce a\r
+work containing portions of the Library, and distribute that work\r
+under terms of your choice, provided that the terms permit\r
+modification of the work for the customer's own use and reverse\r
+engineering for debugging such modifications.\r
+\r
+ You must give prominent notice with each copy of the work that the\r
+Library is used in it and that the Library and its use are covered by\r
+this License. You must supply a copy of this License. If the work\r
+during execution displays copyright notices, you must include the\r
+copyright notice for the Library among them, as well as a reference\r
+directing the user to the copy of this License. Also, you must do one\r
+of these things:\r
+\r
+ a) Accompany the work with the complete corresponding\r
+ machine-readable source code for the Library including whatever\r
+ changes were used in the work (which must be distributed under\r
+ Sections 1 and 2 above); and, if the work is an executable linked\r
+ with the Library, with the complete machine-readable "work that\r
+ uses the Library", as object code and/or source code, so that the\r
+ user can modify the Library and then relink to produce a modified\r
+ executable containing the modified Library. (It is understood\r
+ that the user who changes the contents of definitions files in the\r
+ Library will not necessarily be able to recompile the application\r
+ to use the modified definitions.)\r
+\r
+ b) Use a suitable shared library mechanism for linking with the\r
+ Library. A suitable mechanism is one that (1) uses at run time a\r
+ copy of the library already present on the user's computer system,\r
+ rather than copying library functions into the executable, and (2)\r
+ will operate properly with a modified version of the library, if\r
+ the user installs one, as long as the modified version is\r
+ interface-compatible with the version that the work was made with.\r
+\r
+ c) Accompany the work with a written offer, valid for at\r
+ least three years, to give the same user the materials\r
+ specified in Subsection 6a, above, for a charge no more\r
+ than the cost of performing this distribution.\r
+\r
+ d) If distribution of the work is made by offering access to copy\r
+ from a designated place, offer equivalent access to copy the above\r
+ specified materials from the same place.\r
+\r
+ e) Verify that the user has already received a copy of these\r
+ materials or that you have already sent this user a copy.\r
+\r
+ For an executable, the required form of the "work that uses the\r
+Library" must include any data and utility programs needed for\r
+reproducing the executable from it. However, as a special exception,\r
+the materials to be distributed need not include anything that is\r
+normally distributed (in either source or binary form) with the major\r
+components (compiler, kernel, and so on) of the operating system on\r
+which the executable runs, unless that component itself accompanies\r
+the executable.\r
+\r
+ It may happen that this requirement contradicts the license\r
+restrictions of other proprietary libraries that do not normally\r
+accompany the operating system. Such a contradiction means you cannot\r
+use both them and the Library together in an executable that you\r
+distribute.\r
+\r
+ 7. You may place library facilities that are a work based on the\r
+Library side-by-side in a single library together with other library\r
+facilities not covered by this License, and distribute such a combined\r
+library, provided that the separate distribution of the work based on\r
+the Library and of the other library facilities is otherwise\r
+permitted, and provided that you do these two things:\r
+\r
+ a) Accompany the combined library with a copy of the same work\r
+ based on the Library, uncombined with any other library\r
+ facilities. This must be distributed under the terms of the\r
+ Sections above.\r
+\r
+ b) Give prominent notice with the combined library of the fact\r
+ that part of it is a work based on the Library, and explaining\r
+ where to find the accompanying uncombined form of the same work.\r
+\r
+ 8. You may not copy, modify, sublicense, link with, or distribute\r
+the Library except as expressly provided under this License. Any\r
+attempt otherwise to copy, modify, sublicense, link with, or\r
+distribute the Library is void, and will automatically terminate your\r
+rights under this License. However, parties who have received copies,\r
+or rights, from you under this License will not have their licenses\r
+terminated so long as such parties remain in full compliance.\r
+\r
+ 9. You are not required to accept this License, since you have not\r
+signed it. However, nothing else grants you permission to modify or\r
+distribute the Library or its derivative works. These actions are\r
+prohibited by law if you do not accept this License. Therefore, by\r
+modifying or distributing the Library (or any work based on the\r
+Library), you indicate your acceptance of this License to do so, and\r
+all its terms and conditions for copying, distributing or modifying\r
+the Library or works based on it.\r
+\r
+ 10. Each time you redistribute the Library (or any work based on the\r
+Library), the recipient automatically receives a license from the\r
+original licensor to copy, distribute, link with or modify the Library\r
+subject to these terms and conditions. You may not impose any further\r
+restrictions on the recipients' exercise of the rights granted herein.\r
+You are not responsible for enforcing compliance by third parties with\r
+this License.\r
+\r
+ 11. If, as a consequence of a court judgment or allegation of patent\r
+infringement or for any other reason (not limited to patent issues),\r
+conditions are imposed on you (whether by court order, agreement or\r
+otherwise) that contradict the conditions of this License, they do not\r
+excuse you from the conditions of this License. If you cannot\r
+distribute so as to satisfy simultaneously your obligations under this\r
+License and any other pertinent obligations, then as a consequence you\r
+may not distribute the Library at all. For example, if a patent\r
+license would not permit royalty-free redistribution of the Library by\r
+all those who receive copies directly or indirectly through you, then\r
+the only way you could satisfy both it and this License would be to\r
+refrain entirely from distribution of the Library.\r
+\r
+If any portion of this section is held invalid or unenforceable under any\r
+particular circumstance, the balance of the section is intended to apply,\r
+and the section as a whole is intended to apply in other circumstances.\r
+\r
+It is not the purpose of this section to induce you to infringe any\r
+patents or other property right claims or to contest validity of any\r
+such claims; this section has the sole purpose of protecting the\r
+integrity of the free software distribution system which is\r
+implemented by public license practices. Many people have made\r
+generous contributions to the wide range of software distributed\r
+through that system in reliance on consistent application of that\r
+system; it is up to the author/donor to decide if he or she is willing\r
+to distribute software through any other system and a licensee cannot\r
+impose that choice.\r
+\r
+This section is intended to make thoroughly clear what is believed to\r
+be a consequence of the rest of this License.\r
+\r
+ 12. If the distribution and/or use of the Library is restricted in\r
+certain countries either by patents or by copyrighted interfaces, the\r
+original copyright holder who places the Library under this License may add\r
+an explicit geographical distribution limitation excluding those countries,\r
+so that distribution is permitted only in or among countries not thus\r
+excluded. In such case, this License incorporates the limitation as if\r
+written in the body of this License.\r
+\r
+ 13. The Free Software Foundation may publish revised and/or new\r
+versions of the Lesser General Public License from time to time.\r
+Such new versions will be similar in spirit to the present version,\r
+but may differ in detail to address new problems or concerns.\r
+\r
+Each version is given a distinguishing version number. If the Library\r
+specifies a version number of this License which applies to it and\r
+"any later version", you have the option of following the terms and\r
+conditions either of that version or of any later version published by\r
+the Free Software Foundation. If the Library does not specify a\r
+license version number, you may choose any version ever published by\r
+the Free Software Foundation.\r
+\r
+ 14. If you wish to incorporate parts of the Library into other free\r
+programs whose distribution conditions are incompatible with these,\r
+write to the author to ask for permission. For software which is\r
+copyrighted by the Free Software Foundation, write to the Free\r
+Software Foundation; we sometimes make exceptions for this. Our\r
+decision will be guided by the two goals of preserving the free status\r
+of all derivatives of our free software and of promoting the sharing\r
+and reuse of software generally.\r
+\r
+ NO WARRANTY\r
+\r
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO\r
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.\r
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR\r
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY\r
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE\r
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\r
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE\r
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME\r
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.\r
+\r
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN\r
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY\r
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU\r
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR\r
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE\r
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING\r
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A\r
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF\r
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\r
+DAMAGES.\r
+\r
+ END OF TERMS AND CONDITIONS\r
+\r
+ How to Apply These Terms to Your New Libraries\r
+\r
+ If you develop a new library, and you want it to be of the greatest\r
+possible use to the public, we recommend making it free software that\r
+everyone can redistribute and change. You can do so by permitting\r
+redistribution under these terms (or, alternatively, under the terms of the\r
+ordinary General Public License).\r
+\r
+ To apply these terms, attach the following notices to the library. It is\r
+safest to attach them to the start of each source file to most effectively\r
+convey the exclusion of warranty; and each file should have at least the\r
+"copyright" line and a pointer to where the full notice is found.\r
+\r
+ <one line to give the library's name and a brief idea of what it does.>\r
+ Copyright (C) <year> <name of author>\r
+\r
+ This library is free software; you can redistribute it and/or\r
+ modify it under the terms of the GNU Lesser General Public\r
+ License as published by the Free Software Foundation; either\r
+ version 2.1 of the License, or (at your option) any later version.\r
+\r
+ This library is distributed in the hope that it will be useful,\r
+ but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+ Lesser General Public License for more details.\r
+\r
+ You should have received a copy of the GNU Lesser General Public\r
+ License along with this library; if not, write to the Free Software\r
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+\r
+Also add information on how to contact you by electronic and paper mail.\r
+\r
+You should also get your employer (if you work as a programmer) or your\r
+school, if any, to sign a "copyright disclaimer" for the library, if\r
+necessary. Here is a sample; alter the names:\r
+\r
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the\r
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.\r
+\r
+ <signature of Ty Coon>, 1 April 1990\r
+ Ty Coon, President of Vice\r
+\r
+That's all there is to it!\r
+\r
+\r
--- /dev/null
+/*******************************************************************\r
+* The http://phpmailer.codeworxtech.com/ website now carries a few *\r
+* advertisements through the Google Adsense network. Please visit *\r
+* the advertiser sites and help us offset some of our costs. *\r
+* Thanks .... *\r
+********************************************************************/\r
+\r
+PHPMailer\r
+Full Featured Email Transfer Class for PHP\r
+==========================================\r
+\r
+Version 2.1 (June 04 2008)\r
+\r
+With this release, we are announcing that the development of PHPMailer for PHP5\r
+will be our focus from this date on. We have implemented all the enhancements\r
+and fixes from the latest release of PHPMailer for PHP4.\r
+\r
+Far more important, though, is that this release of PHPMailer (v2.1) is\r
+fully tested with E_STRICT error checking enabled.\r
+\r
+** NOTE: WE HAVE A NEW LANGUAGE VARIABLE FOR DIGITALLY SIGNED S/MIME EMAILS.\r
+ IF YOU CAN HELP WITH LANGUAGES OTHER THAN ENGLISH AND SPANISH, IT WOULD BE\r
+ APPRECIATED.\r
+\r
+We have now added S/MIME functionality (ability to digitally sign emails).\r
+BIG THANKS TO "sergiocambra" for posting this patch back in November 2007.\r
+The "Signed Emails" functionality adds the Sign method to pass the private key\r
+filename and the password to read it, and then email will be sent with\r
+content-type multipart/signed and with the digital signature attached.\r
+\r
+A quick note on E_STRICT:\r
+\r
+- In about half the test environments the development version was subjected\r
+ to, an error was thrown for the date() functions (used at line 1565 and 1569).\r
+ This is NOT a PHPMailer error, it is the result of an incorrectly configured\r
+ PHP5 installation. The fix is to modify your 'php.ini' file and include the\r
+ date.timezone = America/New York\r
+ directive, (for your own server timezone)\r
+- If you do get this error, and are unable to access your php.ini file, there is\r
+ a workaround. In your PHP script, add\r
+ date_default_timezone_set('America/Toronto');\r
+\r
+ * do NOT try to use\r
+ $myVar = date_default_timezone_get();\r
+ as a test, it will throw an error.\r
+\r
+We have also included more example files to show the use of "sendmail", "mail()",\r
+"smtp", and "gmail".\r
+\r
+We are also looking for more programmers to join the volunteer development team.\r
+If you have an interest in this, please let us know.\r
+\r
+Enjoy!\r
+\r
+\r
+Version 2.1.0beta1 & beta2\r
+\r
+please note, this is BETA software\r
+** DO NOT USE THIS IN PRODUCTION OR LIVE PROJECTS\r
+INTENDED STRICTLY FOR TESTING\r
+\r
+** NOTE:\r
+\r
+As of November 2007, PHPMailer has a new project team headed by industry\r
+veteran Andy Prevost (codeworxtech). The first release in more than two\r
+years will focus on fixes, adding ease-of-use enhancements, provide\r
+basic compatibility with PHP4 and PHP5 using PHP5 backwards compatibility\r
+features. A new release is planned before year-end 2007 that will provide\r
+full compatiblity with PHP4 and PHP5, as well as more bug fixes.\r
+\r
+We are looking for project developers to assist in restoring PHPMailer to\r
+its leadership position. Our goals are to simplify use of PHPMailer, provide\r
+good documentation and examples, and retain backward compatibility to level\r
+1.7.3 standards.\r
+\r
+If you are interested in helping out, visit http://sourceforge.net/phpmailer\r
+and indicate your interest.\r
+\r
+**\r
+\r
+http://phpmailer.sourceforge.net/\r
+\r
+This software is licenced under the LGPL. Please read LICENSE for information on the\r
+software availability and distribution.\r
+\r
+Class Features:\r
+- Send emails with multiple TOs, CCs, BCCs and REPLY-TOs\r
+- Redundant SMTP servers\r
+- Multipart/alternative emails for mail clients that do not read HTML email\r
+- Support for 8bit, base64, binary, and quoted-printable encoding\r
+- Uses the same methods as the very popular AspEmail active server (COM) component\r
+- SMTP authentication\r
+- Native language support\r
+- Word wrap, and more!\r
+\r
+Why you might need it:\r
+\r
+Many PHP developers utilize email in their code. The only PHP function\r
+that supports this is the mail() function. However, it does not expose\r
+any of the popular features that many email clients use nowadays like\r
+HTML-based emails and attachments. There are two proprietary\r
+development tools out there that have all the functionality built into\r
+easy to use classes: AspEmail(tm) and AspMail. Both of these\r
+programs are COM components only available on Windows. They are also a\r
+little pricey for smaller projects.\r
+\r
+Since I do Linux development I\92ve missed these tools for my PHP coding.\r
+So I built a version myself that implements the same methods (object\r
+calls) that the Windows-based components do. It is open source and the\r
+LGPL license allows you to place the class in your proprietary PHP\r
+projects.\r
+\r
+\r
+Installation:\r
+\r
+Copy class.phpmailer.php into your php.ini include_path. If you are\r
+using the SMTP mailer then place class.smtp.php in your path as well.\r
+In the language directory you will find several files like\r
+phpmailer.lang-en.php. If you look right before the .php extension\r
+that there are two letters. These represent the language type of the\r
+translation file. For instance "en" is the English file and "br" is\r
+the Portuguese file. Chose the file that best fits with your language\r
+and place it in the PHP include path. If your language is English\r
+then you have nothing more to do. If it is a different language then\r
+you must point PHPMailer to the correct translation. To do this, call\r
+the PHPMailer SetLanguage method like so:\r
+\r
+// To load the Portuguese version\r
+$mail->SetLanguage("br", "/optional/path/to/language/directory/");\r
+\r
+That's it. You should now be ready to use PHPMailer!\r
+\r
+\r
+A Simple Example:\r
+\r
+<?php\r
+require("class.phpmailer.php");\r
+\r
+$mail = new PHPMailer();\r
+\r
+$mail->IsSMTP(); // set mailer to use SMTP\r
+$mail->Host = "smtp1.example.com;smtp2.example.com"; // specify main and backup server\r
+$mail->SMTPAuth = true; // turn on SMTP authentication\r
+$mail->Username = "jswan"; // SMTP username\r
+$mail->Password = "secret"; // SMTP password\r
+\r
+$mail->From = "from@example.com";\r
+$mail->FromName = "Mailer";\r
+$mail->AddAddress("josh@example.net", "Josh Adams");\r
+$mail->AddAddress("ellen@example.com"); // name is optional\r
+$mail->AddReplyTo("info@example.com", "Information");\r
+\r
+$mail->WordWrap = 50; // set word wrap to 50 characters\r
+$mail->AddAttachment("/var/tmp/file.tar.gz"); // add attachments\r
+$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name\r
+$mail->IsHTML(true); // set email format to HTML\r
+\r
+$mail->Subject = "Here is the subject";\r
+$mail->Body = "This is the HTML message body <b>in bold!</b>";\r
+$mail->AltBody = "This is the body in plain text for non-HTML mail clients";\r
+\r
+if(!$mail->Send())\r
+{\r
+ echo "Message could not be sent. <p>";\r
+ echo "Mailer Error: " . $mail->ErrorInfo;\r
+ exit;\r
+}\r
+\r
+echo "Message has been sent";\r
+?>\r
+\r
+CHANGELOG\r
+\r
+See ChangeLog.txt\r
+\r
+Download: http://sourceforge.net/project/showfiles.php?group_id=26031\r
+\r
+Andy Prevost\r
--- /dev/null
+<?php
+/*~ class.phpmailer.php
+.---------------------------------------------------------------------------.
+| Software: PHPMailer - PHP email class |
+| Version: 2.1 |
+| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
+| Info: http://phpmailer.sourceforge.net |
+| Support: http://sourceforge.net/projects/phpmailer/ |
+| ------------------------------------------------------------------------- |
+| Author: Andy Prevost (project admininistrator) |
+| Author: Brent R. Matzelle (original founder) |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
+| Copyright (c) 2001-2003, Brent R. Matzelle |
+| ------------------------------------------------------------------------- |
+| License: Distributed under the Lesser General Public License (LGPL) |
+| http://www.gnu.org/copyleft/lesser.html |
+| This program is distributed in the hope that it will be useful - WITHOUT |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
+| FITNESS FOR A PARTICULAR PURPOSE. |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com): |
+| - Web Hosting on highly optimized fast and secure servers |
+| - Technology Consulting |
+| - Oursourcing (highly qualified programmers and graphic designers) |
+'---------------------------------------------------------------------------'
+
+/**
+ * PHPMailer - PHP email transport class
+ * NOTE: Designed for use with PHP version 5 and up
+ * @package PHPMailer
+ * @author Andy Prevost
+ * @copyright 2004 - 2008 Andy Prevost
+ */
+
+class PHPMailer {
+
+ /////////////////////////////////////////////////
+ // PROPERTIES, PUBLIC
+ /////////////////////////////////////////////////
+
+ /**
+ * Email priority (1 = High, 3 = Normal, 5 = low).
+ * @var int
+ */
+ public $Priority = 3;
+
+ /**
+ * Sets the CharSet of the message.
+ * @var string
+ */
+ public $CharSet = 'iso-8859-1';
+
+ /**
+ * Sets the Content-type of the message.
+ * @var string
+ */
+ public $ContentType = 'text/plain';
+
+ /**
+ * Sets the Encoding of the message. Options for this are "8bit",
+ * "7bit", "binary", "base64", and "quoted-printable".
+ * @var string
+ */
+ public $Encoding = '8bit';
+
+ /**
+ * Holds the most recent mailer error message.
+ * @var string
+ */
+ public $ErrorInfo = '';
+
+ /**
+ * Sets the From email address for the message.
+ * @var string
+ */
+ public $From = 'root@localhost';
+
+ /**
+ * Sets the From name of the message.
+ * @var string
+ */
+ public $FromName = 'Root User';
+
+ /**
+ * Sets the Sender email (Return-Path) of the message. If not empty,
+ * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
+ * @var string
+ */
+ public $Sender = '';
+
+ /**
+ * Sets the Subject of the message.
+ * @var string
+ */
+ public $Subject = '';
+
+ /**
+ * Sets the Body of the message. This can be either an HTML or text body.
+ * If HTML then run IsHTML(true).
+ * @var string
+ */
+ public $Body = '';
+
+ /**
+ * Sets the text-only body of the message. This automatically sets the
+ * email to multipart/alternative. This body can be read by mail
+ * clients that do not have HTML email capability such as mutt. Clients
+ * that can read HTML will view the normal Body.
+ * @var string
+ */
+ public $AltBody = '';
+
+ /**
+ * Sets word wrapping on the body of the message to a given number of
+ * characters.
+ * @var int
+ */
+ public $WordWrap = 0;
+
+ /**
+ * Method to send mail: ("mail", "sendmail", or "smtp").
+ * @var string
+ */
+ public $Mailer = 'mail';
+
+ /**
+ * Sets the path of the sendmail program.
+ * @var string
+ */
+ public $Sendmail = '/usr/sbin/sendmail';
+
+ /**
+ * Path to PHPMailer plugins. This is now only useful if the SMTP class
+ * is in a different directory than the PHP include path.
+ * @var string
+ */
+ public $PluginDir = '';
+
+ /**
+ * Holds PHPMailer version.
+ * @var string
+ */
+ public $Version = "2.1";
+
+ /**
+ * Sets the email address that a reading confirmation will be sent.
+ * @var string
+ */
+ public $ConfirmReadingTo = '';
+
+ /**
+ * Sets the hostname to use in Message-Id and Received headers
+ * and as default HELO string. If empty, the value returned
+ * by SERVER_NAME is used or 'localhost.localdomain'.
+ * @var string
+ */
+ public $Hostname = '';
+
+ /**
+ * Sets the message ID to be used in the Message-Id header.
+ * If empty, a unique id will be generated.
+ * @var string
+ */
+ public $MessageID = '';
+
+ /////////////////////////////////////////////////
+ // PROPERTIES FOR SMTP
+ /////////////////////////////////////////////////
+
+ /**
+ * Sets the SMTP hosts. All hosts must be separated by a
+ * semicolon. You can also specify a different port
+ * for each host by using this format: [hostname:port]
+ * (e.g. "smtp1.example.com:25;smtp2.example.com").
+ * Hosts will be tried in order.
+ * @var string
+ */
+ public $Host = 'localhost';
+
+ /**
+ * Sets the default SMTP server port.
+ * @var int
+ */
+ public $Port = 25;
+
+ /**
+ * Sets the SMTP HELO of the message (Default is $Hostname).
+ * @var string
+ */
+ public $Helo = '';
+
+ /**
+ * Sets connection prefix.
+ * Options are "", "ssl" or "tls"
+ * @var string
+ */
+ public $SMTPSecure = "";
+
+ /**
+ * Sets SMTP authentication. Utilizes the Username and Password variables.
+ * @var bool
+ */
+ public $SMTPAuth = false;
+
+ /**
+ * Sets SMTP username.
+ * @var string
+ */
+ public $Username = '';
+
+ /**
+ * Sets SMTP password.
+ * @var string
+ */
+ public $Password = '';
+
+ /**
+ * Sets the SMTP server timeout in seconds. This function will not
+ * work with the win32 version.
+ * @var int
+ */
+ public $Timeout = 10;
+
+ /**
+ * Sets SMTP class debugging on or off.
+ * @var bool
+ */
+ public $SMTPDebug = false;
+
+ /**
+ * Prevents the SMTP connection from being closed after each mail
+ * sending. If this is set to true then to close the connection
+ * requires an explicit call to SmtpClose().
+ * @var bool
+ */
+ public $SMTPKeepAlive = false;
+
+ /**
+ * Provides the ability to have the TO field process individual
+ * emails, instead of sending to entire TO addresses
+ * @var bool
+ */
+ public $SingleTo = false;
+
+ /////////////////////////////////////////////////
+ // PROPERTIES, PRIVATE
+ /////////////////////////////////////////////////
+
+ private $smtp = NULL;
+ private $to = array();
+ private $cc = array();
+ private $bcc = array();
+ private $ReplyTo = array();
+ private $attachment = array();
+ private $CustomHeader = array();
+ private $message_type = '';
+ private $boundary = array();
+ private $language = array();
+ private $error_count = 0;
+ private $LE = "\n";
+ private $sign_key_file = "";
+ private $sign_key_pass = "";
+
+ /////////////////////////////////////////////////
+ // METHODS, VARIABLES
+ /////////////////////////////////////////////////
+
+ /**
+ * Sets message type to HTML.
+ * @param bool $bool
+ * @return void
+ */
+ public function IsHTML($bool) {
+ if($bool == true) {
+ $this->ContentType = 'text/html';
+ } else {
+ $this->ContentType = 'text/plain';
+ }
+ }
+
+ /**
+ * Sets Mailer to send message using SMTP.
+ * @return void
+ */
+ public function IsSMTP() {
+ $this->Mailer = 'smtp';
+ }
+
+ /**
+ * Sets Mailer to send message using PHP mail() function.
+ * @return void
+ */
+ public function IsMail() {
+ $this->Mailer = 'mail';
+ }
+
+ /**
+ * Sets Mailer to send message using the $Sendmail program.
+ * @return void
+ */
+ public function IsSendmail() {
+ $this->Mailer = 'sendmail';
+ }
+
+ /**
+ * Sets Mailer to send message using the qmail MTA.
+ * @return void
+ */
+ public function IsQmail() {
+ $this->Sendmail = '/var/qmail/bin/sendmail';
+ $this->Mailer = 'sendmail';
+ }
+
+ /////////////////////////////////////////////////
+ // METHODS, RECIPIENTS
+ /////////////////////////////////////////////////
+
+ /**
+ * Adds a "To" address.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ public function AddAddress($address, $name = '') {
+ $cur = count($this->to);
+ $this->to[$cur][0] = trim($address);
+ $this->to[$cur][1] = $name;
+ }
+
+ /**
+ * Adds a "Cc" address. Note: this function works
+ * with the SMTP mailer on win32, not with the "mail"
+ * mailer.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ public function AddCC($address, $name = '') {
+ $cur = count($this->cc);
+ $this->cc[$cur][0] = trim($address);
+ $this->cc[$cur][1] = $name;
+ }
+
+ /**
+ * Adds a "Bcc" address. Note: this function works
+ * with the SMTP mailer on win32, not with the "mail"
+ * mailer.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ public function AddBCC($address, $name = '') {
+ $cur = count($this->bcc);
+ $this->bcc[$cur][0] = trim($address);
+ $this->bcc[$cur][1] = $name;
+ }
+
+ /**
+ * Adds a "Reply-to" address.
+ * @param string $address
+ * @param string $name
+ * @return void
+ */
+ public function AddReplyTo($address, $name = '') {
+ $cur = count($this->ReplyTo);
+ $this->ReplyTo[$cur][0] = trim($address);
+ $this->ReplyTo[$cur][1] = $name;
+ }
+
+ /////////////////////////////////////////////////
+ // METHODS, MAIL SENDING
+ /////////////////////////////////////////////////
+
+ /**
+ * Creates message and assigns Mailer. If the message is
+ * not sent successfully then it returns false. Use the ErrorInfo
+ * variable to view description of the error.
+ * @return bool
+ */
+ public function Send() {
+ $header = '';
+ $body = '';
+ $result = true;
+
+ if((count($this->to) + count($this->cc) + count($this->bcc)) < 1) {
+ $this->SetError($this->Lang('provide_address'));
+ return false;
+ }
+
+ /* Set whether the message is multipart/alternative */
+ if(!empty($this->AltBody)) {
+ $this->ContentType = 'multipart/alternative';
+ }
+
+ $this->error_count = 0; // reset errors
+ $this->SetMessageType();
+ $header .= $this->CreateHeader();
+ $body = $this->CreateBody();
+
+ if($body == '') {
+ return false;
+ }
+
+ /* Choose the mailer */
+ switch($this->Mailer) {
+ case 'sendmail':
+ $result = $this->SendmailSend($header, $body);
+ break;
+ case 'smtp':
+ $result = $this->SmtpSend($header, $body);
+ break;
+ case 'mail':
+ $result = $this->MailSend($header, $body);
+ break;
+ default:
+ $result = $this->MailSend($header, $body);
+ break;
+ //$this->SetError($this->Mailer . $this->Lang('mailer_not_supported'));
+ //$result = false;
+ //break;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Sends mail using the $Sendmail program.
+ * @access public
+ * @return bool
+ */
+ public function SendmailSend($header, $body) {
+ if ($this->Sender != '') {
+ $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
+ } else {
+ $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
+ }
+
+ if(!@$mail = popen($sendmail, 'w')) {
+ $this->SetError($this->Lang('execute') . $this->Sendmail);
+ return false;
+ }
+
+ fputs($mail, $header);
+ fputs($mail, $body);
+
+ $result = pclose($mail);
+ if (version_compare(phpversion(), '4.2.3') == -1) {
+ $result = $result >> 8 & 0xFF;
+ }
+ if($result != 0) {
+ $this->SetError($this->Lang('execute') . $this->Sendmail);
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sends mail using the PHP mail() function.
+ * @access public
+ * @return bool
+ */
+ public function MailSend($header, $body) {
+
+ $to = '';
+ for($i = 0; $i < count($this->to); $i++) {
+ if($i != 0) { $to .= ', '; }
+ $to .= $this->AddrFormat($this->to[$i]);
+ }
+
+ $toArr = split(',', $to);
+
+ $params = sprintf("-oi -f %s", $this->Sender);
+ if ($this->Sender != '' && strlen(ini_get('safe_mode'))< 1) {
+ $old_from = ini_get('sendmail_from');
+ ini_set('sendmail_from', $this->Sender);
+ if ($this->SingleTo === true && count($toArr) > 1) {
+ foreach ($toArr as $key => $val) {
+ $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+ }
+ } else {
+ $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+ }
+ } else {
+ if ($this->SingleTo === true && count($toArr) > 1) {
+ foreach ($toArr as $key => $val) {
+ $rt = @mail($val, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header, $params);
+ }
+ } else {
+ $rt = @mail($to, $this->EncodeHeader($this->SecureHeader($this->Subject)), $body, $header);
+ }
+ }
+
+ if (isset($old_from)) {
+ ini_set('sendmail_from', $old_from);
+ }
+
+ if(!$rt) {
+ $this->SetError($this->Lang('instantiate'));
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sends mail via SMTP using PhpSMTP (Author:
+ * Chris Ryan). Returns bool. Returns false if there is a
+ * bad MAIL FROM, RCPT, or DATA input.
+ * @access public
+ * @return bool
+ */
+ public function SmtpSend($header, $body) {
+ include_once($this->PluginDir . 'class.smtp.php');
+ $error = '';
+ $bad_rcpt = array();
+
+ if(!$this->SmtpConnect()) {
+ return false;
+ }
+
+ $smtp_from = ($this->Sender == '') ? $this->From : $this->Sender;
+ if(!$this->smtp->Mail($smtp_from)) {
+ $error = $this->Lang('from_failed') . $smtp_from;
+ $this->SetError($error);
+ $this->smtp->Reset();
+ return false;
+ }
+
+ /* Attempt to send attach all recipients */
+ for($i = 0; $i < count($this->to); $i++) {
+ if(!$this->smtp->Recipient($this->to[$i][0])) {
+ $bad_rcpt[] = $this->to[$i][0];
+ }
+ }
+ for($i = 0; $i < count($this->cc); $i++) {
+ if(!$this->smtp->Recipient($this->cc[$i][0])) {
+ $bad_rcpt[] = $this->cc[$i][0];
+ }
+ }
+ for($i = 0; $i < count($this->bcc); $i++) {
+ if(!$this->smtp->Recipient($this->bcc[$i][0])) {
+ $bad_rcpt[] = $this->bcc[$i][0];
+ }
+ }
+
+ if(count($bad_rcpt) > 0) { // Create error message
+ for($i = 0; $i < count($bad_rcpt); $i++) {
+ if($i != 0) {
+ $error .= ', ';
+ }
+ $error .= $bad_rcpt[$i];
+ }
+ $error = $this->Lang('recipients_failed') . $error;
+ $this->SetError($error);
+ $this->smtp->Reset();
+ return false;
+ }
+
+ if(!$this->smtp->Data($header . $body)) {
+ $this->SetError($this->Lang('data_not_accepted'));
+ $this->smtp->Reset();
+ return false;
+ }
+ if($this->SMTPKeepAlive == true) {
+ $this->smtp->Reset();
+ } else {
+ $this->SmtpClose();
+ }
+
+ return true;
+ }
+
+ /**
+ * Initiates a connection to an SMTP server. Returns false if the
+ * operation failed.
+ * @access public
+ * @return bool
+ */
+ public function SmtpConnect() {
+ if($this->smtp == NULL) {
+ $this->smtp = new SMTP();
+ }
+
+ $this->smtp->do_debug = $this->SMTPDebug;
+ $hosts = explode(';', $this->Host);
+ $index = 0;
+ $connection = ($this->smtp->Connected());
+
+ /* Retry while there is no connection */
+ while($index < count($hosts) && $connection == false) {
+ $hostinfo = array();
+ if(eregi('^(.+):([0-9]+)$', $hosts[$index], $hostinfo)) {
+ $host = $hostinfo[1];
+ $port = $hostinfo[2];
+ } else {
+ $host = $hosts[$index];
+ $port = $this->Port;
+ }
+
+ $tls = ($this->SMTPSecure == 'tls');
+ $ssl = ($this->SMTPSecure == 'ssl');
+
+ if($this->smtp->Connect(($ssl ? 'ssl://':'').$host, $port, $this->Timeout)) {
+
+ $hello = ($this->Helo != '' ? $this->Hello : $this->ServerHostname());
+ $this->smtp->Hello($hello);
+
+ if($tls) {
+ if(!$this->smtp->StartTLS()) {
+ $this->SetError($this->Lang("tls"));
+ $this->smtp->Reset();
+ $connection = false;
+ }
+
+ //We must resend HELLO after tls negociation
+ $this->smtp->Hello($hello);
+ }
+
+ $connection = true;
+ if($this->SMTPAuth) {
+ if(!$this->smtp->Authenticate($this->Username, $this->Password)) {
+ $this->SetError($this->Lang('authenticate'));
+ $this->smtp->Reset();
+ $connection = false;
+ }
+ }
+ }
+ $index++;
+ }
+ if(!$connection) {
+ $this->SetError($this->Lang('connect_host'));
+ }
+
+ return $connection;
+ }
+
+ /**
+ * Closes the active SMTP session if one exists.
+ * @return void
+ */
+ public function SmtpClose() {
+ if($this->smtp != NULL) {
+ if($this->smtp->Connected()) {
+ $this->smtp->Quit();
+ $this->smtp->Close();
+ }
+ }
+ }
+
+ /**
+ * Sets the language for all class error messages. Returns false
+ * if it cannot load the language file. The default language type
+ * is English.
+ * @param string $lang_type Type of language (e.g. Portuguese: "br")
+ * @param string $lang_path Path to the language file directory
+ * @access public
+ * @return bool
+ */
+ function SetLanguage($lang_type = 'en', $lang_path = 'language/') {
+ if( !(@include $lang_path.'phpmailer.lang-'.$lang_type.'.php') ) {
+ $this->SetError('Could not load language file');
+ return false;
+ }
+ $this->language = $PHPMAILER_LANG;
+ return true;
+ }
+
+ /////////////////////////////////////////////////
+ // METHODS, MESSAGE CREATION
+ /////////////////////////////////////////////////
+
+ /**
+ * Creates recipient headers.
+ * @access public
+ * @return string
+ */
+ public function AddrAppend($type, $addr) {
+ $addr_str = $type . ': ';
+ $addr_str .= $this->AddrFormat($addr[0]);
+ if(count($addr) > 1) {
+ for($i = 1; $i < count($addr); $i++) {
+ $addr_str .= ', ' . $this->AddrFormat($addr[$i]);
+ }
+ }
+ $addr_str .= $this->LE;
+
+ return $addr_str;
+ }
+
+ /**
+ * Formats an address correctly.
+ * @access public
+ * @return string
+ */
+ public function AddrFormat($addr) {
+ if(empty($addr[1])) {
+ $formatted = $this->SecureHeader($addr[0]);
+ } else {
+ $formatted = $this->EncodeHeader($this->SecureHeader($addr[1]), 'phrase') . " <" . $this->SecureHeader($addr[0]) . ">";
+ }
+
+ return $formatted;
+ }
+
+ /**
+ * Wraps message for use with mailers that do not
+ * automatically perform wrapping and for quoted-printable.
+ * Original written by philippe.
+ * @access public
+ * @return string
+ */
+ public function WrapText($message, $length, $qp_mode = false) {
+ $soft_break = ($qp_mode) ? sprintf(" =%s", $this->LE) : $this->LE;
+ // If utf-8 encoding is used, we will need to make sure we don't
+ // split multibyte characters when we wrap
+ $is_utf8 = (strtolower($this->CharSet) == "utf-8");
+
+ $message = $this->FixEOL($message);
+ if (substr($message, -1) == $this->LE) {
+ $message = substr($message, 0, -1);
+ }
+
+ $line = explode($this->LE, $message);
+ $message = '';
+ for ($i=0 ;$i < count($line); $i++) {
+ $line_part = explode(' ', $line[$i]);
+ $buf = '';
+ for ($e = 0; $e<count($line_part); $e++) {
+ $word = $line_part[$e];
+ if ($qp_mode and (strlen($word) > $length)) {
+ $space_left = $length - strlen($buf) - 1;
+ if ($e != 0) {
+ if ($space_left > 20) {
+ $len = $space_left;
+ if ($is_utf8) {
+ $len = $this->UTF8CharBoundary($word, $len);
+ } elseif (substr($word, $len - 1, 1) == "=") {
+ $len--;
+ } elseif (substr($word, $len - 2, 1) == "=") {
+ $len -= 2;
+ }
+ $part = substr($word, 0, $len);
+ $word = substr($word, $len);
+ $buf .= ' ' . $part;
+ $message .= $buf . sprintf("=%s", $this->LE);
+ } else {
+ $message .= $buf . $soft_break;
+ }
+ $buf = '';
+ }
+ while (strlen($word) > 0) {
+ $len = $length;
+ if ($is_utf8) {
+ $len = $this->UTF8CharBoundary($word, $len);
+ } elseif (substr($word, $len - 1, 1) == "=") {
+ $len--;
+ } elseif (substr($word, $len - 2, 1) == "=") {
+ $len -= 2;
+ }
+ $part = substr($word, 0, $len);
+ $word = substr($word, $len);
+
+ if (strlen($word) > 0) {
+ $message .= $part . sprintf("=%s", $this->LE);
+ } else {
+ $buf = $part;
+ }
+ }
+ } else {
+ $buf_o = $buf;
+ $buf .= ($e == 0) ? $word : (' ' . $word);
+
+ if (strlen($buf) > $length and $buf_o != '') {
+ $message .= $buf_o . $soft_break;
+ $buf = $word;
+ }
+ }
+ }
+ $message .= $buf . $this->LE;
+ }
+
+ return $message;
+ }
+
+ /**
+ * Finds last character boundary prior to maxLength in a utf-8
+ * quoted (printable) encoded string.
+ * Original written by Colin Brown.
+ * @access public
+ * @param string $encodedText utf-8 QP text
+ * @param int $maxLength find last character boundary prior to this length
+ * @return int
+ */
+ public function UTF8CharBoundary($encodedText, $maxLength) {
+ $foundSplitPos = false;
+ $lookBack = 3;
+ while (!$foundSplitPos) {
+ $lastChunk = substr($encodedText, $maxLength - $lookBack, $lookBack);
+ $encodedCharPos = strpos($lastChunk, "=");
+ if ($encodedCharPos !== false) {
+ // Found start of encoded character byte within $lookBack block.
+ // Check the encoded byte value (the 2 chars after the '=')
+ $hex = substr($encodedText, $maxLength - $lookBack + $encodedCharPos + 1, 2);
+ $dec = hexdec($hex);
+ if ($dec < 128) { // Single byte character.
+ // If the encoded char was found at pos 0, it will fit
+ // otherwise reduce maxLength to start of the encoded char
+ $maxLength = ($encodedCharPos == 0) ? $maxLength :
+ $maxLength - ($lookBack - $encodedCharPos);
+ $foundSplitPos = true;
+ } elseif ($dec >= 192) { // First byte of a multi byte character
+ // Reduce maxLength to split at start of character
+ $maxLength = $maxLength - ($lookBack - $encodedCharPos);
+ $foundSplitPos = true;
+ } elseif ($dec < 192) { // Middle byte of a multi byte character, look further back
+ $lookBack += 3;
+ }
+ } else {
+ // No encoded character found
+ $foundSplitPos = true;
+ }
+ }
+ return $maxLength;
+ }
+
+
+ /**
+ * Set the body wrapping.
+ * @access public
+ * @return void
+ */
+ public function SetWordWrap() {
+ if($this->WordWrap < 1) {
+ return;
+ }
+
+ switch($this->message_type) {
+ case 'alt':
+ /* fall through */
+ case 'alt_attachments':
+ $this->AltBody = $this->WrapText($this->AltBody, $this->WordWrap);
+ break;
+ default:
+ $this->Body = $this->WrapText($this->Body, $this->WordWrap);
+ break;
+ }
+ }
+
+ /**
+ * Assembles message header.
+ * @access public
+ * @return string
+ */
+ public function CreateHeader() {
+ $result = '';
+
+ /* Set the boundaries */
+ $uniq_id = md5(uniqid(time()));
+ $this->boundary[1] = 'b1_' . $uniq_id;
+ $this->boundary[2] = 'b2_' . $uniq_id;
+
+ $result .= $this->HeaderLine('Date', $this->RFCDate());
+ if($this->Sender == '') {
+ $result .= $this->HeaderLine('Return-Path', trim($this->From));
+ } else {
+ $result .= $this->HeaderLine('Return-Path', trim($this->Sender));
+ }
+
+ /* To be created automatically by mail() */
+ if($this->Mailer != 'mail') {
+ if(count($this->to) > 0) {
+ $result .= $this->AddrAppend('To', $this->to);
+ } elseif (count($this->cc) == 0) {
+ $result .= $this->HeaderLine('To', 'undisclosed-recipients:;');
+ }
+ if(count($this->cc) > 0) {
+ $result .= $this->AddrAppend('Cc', $this->cc);
+ }
+ }
+
+ $from = array();
+ $from[0][0] = trim($this->From);
+ $from[0][1] = $this->FromName;
+ $result .= $this->AddrAppend('From', $from);
+
+ /* sendmail and mail() extract Cc from the header before sending */
+ if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->cc) > 0)) {
+ $result .= $this->AddrAppend('Cc', $this->cc);
+ }
+
+ /* sendmail and mail() extract Bcc from the header before sending */
+ if((($this->Mailer == 'sendmail') || ($this->Mailer == 'mail')) && (count($this->bcc) > 0)) {
+ $result .= $this->AddrAppend('Bcc', $this->bcc);
+ }
+
+ if(count($this->ReplyTo) > 0) {
+ $result .= $this->AddrAppend('Reply-to', $this->ReplyTo);
+ }
+
+ /* mail() sets the subject itself */
+ if($this->Mailer != 'mail') {
+ $result .= $this->HeaderLine('Subject', $this->EncodeHeader($this->SecureHeader($this->Subject)));
+ }
+
+ if($this->MessageID != '') {
+ $result .= $this->HeaderLine('Message-ID',$this->MessageID);
+ } else {
+ $result .= sprintf("Message-ID: <%s@%s>%s", $uniq_id, $this->ServerHostname(), $this->LE);
+ }
+ $result .= $this->HeaderLine('X-Priority', $this->Priority);
+ $result .= $this->HeaderLine('X-Mailer', 'PHPMailer (phpmailer.codeworxtech.com) [version ' . $this->Version . ']');
+
+ if($this->ConfirmReadingTo != '') {
+ $result .= $this->HeaderLine('Disposition-Notification-To', '<' . trim($this->ConfirmReadingTo) . '>');
+ }
+
+ // Add custom headers
+ for($index = 0; $index < count($this->CustomHeader); $index++) {
+ $result .= $this->HeaderLine(trim($this->CustomHeader[$index][0]), $this->EncodeHeader(trim($this->CustomHeader[$index][1])));
+ }
+ //$result .= $this->HeaderLine('MIME-Version', '1.0');
+ if (!$this->sign_key_file) {
+ $result .= $this->HeaderLine('MIME-Version', '1.0');
+ $result .= $this->GetMailMIME();
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns the message MIME.
+ * @access public
+ * @return string
+ */
+ public function GetMailMIME() {
+ $result = '';
+ switch($this->message_type) {
+ case 'plain':
+ $result .= $this->HeaderLine('Content-Transfer-Encoding', $this->Encoding);
+ $result .= sprintf("Content-Type: %s; charset=\"%s\"", $this->ContentType, $this->CharSet);
+ break;
+ case 'attachments':
+ /* fall through */
+ case 'alt_attachments':
+ if($this->InlineImageExists()){
+ $result .= sprintf("Content-Type: %s;%s\ttype=\"text/html\";%s\tboundary=\"%s\"%s", 'multipart/related', $this->LE, $this->LE, $this->boundary[1], $this->LE);
+ } else {
+ $result .= $this->HeaderLine('Content-Type', 'multipart/mixed;');
+ $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+ }
+ break;
+ case 'alt':
+ $result .= $this->HeaderLine('Content-Type', 'multipart/alternative;');
+ $result .= $this->TextLine("\tboundary=\"" . $this->boundary[1] . '"');
+ break;
+ }
+
+ if($this->Mailer != 'mail') {
+ $result .= $this->LE.$this->LE;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Assembles the message body. Returns an empty string on failure.
+ * @access public
+ * @return string
+ */
+ public function CreateBody() {
+ $result = '';
+
+ if ($this->sign_key_file) {
+ $result .= $this->GetMailMIME();
+ }
+
+ $this->SetWordWrap();
+
+ switch($this->message_type) {
+ case 'alt':
+ $result .= $this->GetBoundary($this->boundary[1], '', 'text/plain', '');
+ $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->GetBoundary($this->boundary[1], '', 'text/html', '');
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->EndBoundary($this->boundary[1]);
+ break;
+ case 'plain':
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ break;
+ case 'attachments':
+ $result .= $this->GetBoundary($this->boundary[1], '', '', '');
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ $result .= $this->LE;
+ $result .= $this->AttachAll();
+ break;
+ case 'alt_attachments':
+ $result .= sprintf("--%s%s", $this->boundary[1], $this->LE);
+ $result .= sprintf("Content-Type: %s;%s" . "\tboundary=\"%s\"%s", 'multipart/alternative', $this->LE, $this->boundary[2], $this->LE.$this->LE);
+ $result .= $this->GetBoundary($this->boundary[2], '', 'text/plain', '') . $this->LE; // Create text body
+ $result .= $this->EncodeString($this->AltBody, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->GetBoundary($this->boundary[2], '', 'text/html', '') . $this->LE; // Create the HTML body
+ $result .= $this->EncodeString($this->Body, $this->Encoding);
+ $result .= $this->LE.$this->LE;
+ $result .= $this->EndBoundary($this->boundary[2]);
+ $result .= $this->AttachAll();
+ break;
+ }
+
+ if($this->IsError()) {
+ $result = '';
+ } else if ($this->sign_key_file) {
+ $file = tempnam("", "mail");
+ $fp = fopen($file, "w");
+ fwrite($fp, $result);
+ fclose($fp);
+ $signed = tempnam("", "signed");
+
+ if (@openssl_pkcs7_sign($file, $signed, "file://".$this->sign_key_file, array("file://".$this->sign_key_file, $this->sign_key_pass), null)) {
+ $fp = fopen($signed, "r");
+ $result = fread($fp, filesize($this->sign_key_file));
+ fclose($fp);
+ } else {
+ $this->SetError($this->Lang("signing").openssl_error_string());
+ $result = '';
+ }
+
+ unlink($file);
+ unlink($signed);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns the start of a message boundary.
+ * @access public
+ */
+ public function GetBoundary($boundary, $charSet, $contentType, $encoding) {
+ $result = '';
+ if($charSet == '') {
+ $charSet = $this->CharSet;
+ }
+ if($contentType == '') {
+ $contentType = $this->ContentType;
+ }
+ if($encoding == '') {
+ $encoding = $this->Encoding;
+ }
+ $result .= $this->TextLine('--' . $boundary);
+ $result .= sprintf("Content-Type: %s; charset = \"%s\"", $contentType, $charSet);
+ $result .= $this->LE;
+ $result .= $this->HeaderLine('Content-Transfer-Encoding', $encoding);
+ $result .= $this->LE;
+
+ return $result;
+ }
+
+ /**
+ * Returns the end of a message boundary.
+ * @access public
+ */
+ public function EndBoundary($boundary) {
+ return $this->LE . '--' . $boundary . '--' . $this->LE;
+ }
+
+ /**
+ * Sets the message type.
+ * @access public
+ * @return void
+ */
+ public function SetMessageType() {
+ if(count($this->attachment) < 1 && strlen($this->AltBody) < 1) {
+ $this->message_type = 'plain';
+ } else {
+ if(count($this->attachment) > 0) {
+ $this->message_type = 'attachments';
+ }
+ if(strlen($this->AltBody) > 0 && count($this->attachment) < 1) {
+ $this->message_type = 'alt';
+ }
+ if(strlen($this->AltBody) > 0 && count($this->attachment) > 0) {
+ $this->message_type = 'alt_attachments';
+ }
+ }
+ }
+
+ /* Returns a formatted header line.
+ * @access public
+ * @return string
+ */
+ public function HeaderLine($name, $value) {
+ return $name . ': ' . $value . $this->LE;
+ }
+
+ /**
+ * Returns a formatted mail line.
+ * @access public
+ * @return string
+ */
+ public function TextLine($value) {
+ return $value . $this->LE;
+ }
+
+ /////////////////////////////////////////////////
+ // CLASS METHODS, ATTACHMENTS
+ /////////////////////////////////////////////////
+
+ /**
+ * Adds an attachment from a path on the filesystem.
+ * Returns false if the file could not be found
+ * or accessed.
+ * @param string $path Path to the attachment.
+ * @param string $name Overrides the attachment name.
+ * @param string $encoding File encoding (see $Encoding).
+ * @param string $type File extension (MIME) type.
+ * @return bool
+ */
+ public function AddAttachment($path, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+ if(!@is_file($path)) {
+ $this->SetError($this->Lang('file_access') . $path);
+ return false;
+ }
+
+ $filename = basename($path);
+ if($name == '') {
+ $name = $filename;
+ }
+
+ $cur = count($this->attachment);
+ $this->attachment[$cur][0] = $path;
+ $this->attachment[$cur][1] = $filename;
+ $this->attachment[$cur][2] = $name;
+ $this->attachment[$cur][3] = $encoding;
+ $this->attachment[$cur][4] = $type;
+ $this->attachment[$cur][5] = false; // isStringAttachment
+ $this->attachment[$cur][6] = 'attachment';
+ $this->attachment[$cur][7] = 0;
+
+ return true;
+ }
+
+ /**
+ * Attaches all fs, string, and binary attachments to the message.
+ * Returns an empty string on failure.
+ * @access public
+ * @return string
+ */
+ public function AttachAll() {
+ /* Return text of body */
+ $mime = array();
+
+ /* Add all attachments */
+ for($i = 0; $i < count($this->attachment); $i++) {
+ /* Check for string attachment */
+ $bString = $this->attachment[$i][5];
+ if ($bString) {
+ $string = $this->attachment[$i][0];
+ } else {
+ $path = $this->attachment[$i][0];
+ }
+
+ $filename = $this->attachment[$i][1];
+ $name = $this->attachment[$i][2];
+ $encoding = $this->attachment[$i][3];
+ $type = $this->attachment[$i][4];
+ $disposition = $this->attachment[$i][6];
+ $cid = $this->attachment[$i][7];
+
+ $mime[] = sprintf("--%s%s", $this->boundary[1], $this->LE);
+ $mime[] = sprintf("Content-Type: %s; name=\"%s\"%s", $type, $name, $this->LE);
+ $mime[] = sprintf("Content-Transfer-Encoding: %s%s", $encoding, $this->LE);
+
+ if($disposition == 'inline') {
+ $mime[] = sprintf("Content-ID: <%s>%s", $cid, $this->LE);
+ }
+
+ $mime[] = sprintf("Content-Disposition: %s; filename=\"%s\"%s", $disposition, $name, $this->LE.$this->LE);
+
+ /* Encode as string attachment */
+ if($bString) {
+ $mime[] = $this->EncodeString($string, $encoding);
+ if($this->IsError()) {
+ return '';
+ }
+ $mime[] = $this->LE.$this->LE;
+ } else {
+ $mime[] = $this->EncodeFile($path, $encoding);
+ if($this->IsError()) {
+ return '';
+ }
+ $mime[] = $this->LE.$this->LE;
+ }
+ }
+
+ $mime[] = sprintf("--%s--%s", $this->boundary[1], $this->LE);
+
+ return join('', $mime);
+ }
+
+ /**
+ * Encodes attachment in requested format. Returns an
+ * empty string on failure.
+ * @access public
+ * @return string
+ */
+ public function EncodeFile ($path, $encoding = 'base64') {
+ if(!@$fd = fopen($path, 'rb')) {
+ $this->SetError($this->Lang('file_open') . $path);
+ return '';
+ }
+ $magic_quotes = get_magic_quotes_runtime();
+ set_magic_quotes_runtime(0);
+ $file_buffer = file_get_contents($path);
+ $file_buffer = $this->EncodeString($file_buffer, $encoding);
+ fclose($fd);
+ set_magic_quotes_runtime($magic_quotes);
+
+ return $file_buffer;
+ }
+
+ /**
+ * Encodes string to requested format. Returns an
+ * empty string on failure.
+ * @access public
+ * @return string
+ */
+ public function EncodeString ($str, $encoding = 'base64') {
+ $encoded = '';
+ switch(strtolower($encoding)) {
+ case 'base64':
+ $encoded = chunk_split(base64_encode($str), 76, $this->LE);
+ break;
+ case '7bit':
+ case '8bit':
+ $encoded = $this->FixEOL($str);
+ if (substr($encoded, -(strlen($this->LE))) != $this->LE)
+ $encoded .= $this->LE;
+ break;
+ case 'binary':
+ $encoded = $str;
+ break;
+ case 'quoted-printable':
+ $encoded = $this->EncodeQP($str);
+ break;
+ default:
+ $this->SetError($this->Lang('encoding') . $encoding);
+ break;
+ }
+ return $encoded;
+ }
+
+ /**
+ * Encode a header string to best of Q, B, quoted or none.
+ * @access public
+ * @return string
+ */
+ public function EncodeHeader ($str, $position = 'text') {
+ $x = 0;
+
+ switch (strtolower($position)) {
+ case 'phrase':
+ if (!preg_match('/[\200-\377]/', $str)) {
+ /* Can't use addslashes as we don't know what value has magic_quotes_sybase. */
+ $encoded = addcslashes($str, "\0..\37\177\\\"");
+ if (($str == $encoded) && !preg_match('/[^A-Za-z0-9!#$%&\'*+\/=?^_`{|}~ -]/', $str)) {
+ return ($encoded);
+ } else {
+ return ("\"$encoded\"");
+ }
+ }
+ $x = preg_match_all('/[^\040\041\043-\133\135-\176]/', $str, $matches);
+ break;
+ case 'comment':
+ $x = preg_match_all('/[()"]/', $str, $matches);
+ /* Fall-through */
+ case 'text':
+ default:
+ $x += preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
+ break;
+ }
+
+ if ($x == 0) {
+ return ($str);
+ }
+
+ $maxlen = 75 - 7 - strlen($this->CharSet);
+ /* Try to select the encoding which should produce the shortest output */
+ if (strlen($str)/3 < $x) {
+ $encoding = 'B';
+ if (function_exists('mb_strlen') && $this->HasMultiBytes($str)) {
+ // Use a custom function which correctly encodes and wraps long
+ // multibyte strings without breaking lines within a character
+ $encoded = $this->Base64EncodeWrapMB($str);
+ } else {
+ $encoded = base64_encode($str);
+ $maxlen -= $maxlen % 4;
+ $encoded = trim(chunk_split($encoded, $maxlen, "\n"));
+ }
+ } else {
+ $encoding = 'Q';
+ $encoded = $this->EncodeQ($str, $position);
+ $encoded = $this->WrapText($encoded, $maxlen, true);
+ $encoded = str_replace('='.$this->LE, "\n", trim($encoded));
+ }
+
+ $encoded = preg_replace('/^(.*)$/m', " =?".$this->CharSet."?$encoding?\\1?=", $encoded);
+ $encoded = trim(str_replace("\n", $this->LE, $encoded));
+
+ return $encoded;
+ }
+
+ /**
+ * Checks if a string contains multibyte characters.
+ * @access public
+ * @param string $str multi-byte text to wrap encode
+ * @return bool
+ */
+ public function HasMultiBytes($str) {
+ if (function_exists('mb_strlen')) {
+ return (strlen($str) > mb_strlen($str, $this->CharSet));
+ } else { // Assume no multibytes (we can't handle without mbstring functions anyway)
+ return False;
+ }
+ }
+
+ /**
+ * Correctly encodes and wraps long multibyte strings for mail headers
+ * without breaking lines within a character.
+ * Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
+ * @access public
+ * @param string $str multi-byte text to wrap encode
+ * @return string
+ */
+ public function Base64EncodeWrapMB($str) {
+ $start = "=?".$this->CharSet."?B?";
+ $end = "?=";
+ $encoded = "";
+
+ $mb_length = mb_strlen($str, $this->CharSet);
+ // Each line must have length <= 75, including $start and $end
+ $length = 75 - strlen($start) - strlen($end);
+ // Average multi-byte ratio
+ $ratio = $mb_length / strlen($str);
+ // Base64 has a 4:3 ratio
+ $offset = $avgLength = floor($length * $ratio * .75);
+
+ for ($i = 0; $i < $mb_length; $i += $offset) {
+ $lookBack = 0;
+
+ do {
+ $offset = $avgLength - $lookBack;
+ $chunk = mb_substr($str, $i, $offset, $this->CharSet);
+ $chunk = base64_encode($chunk);
+ $lookBack++;
+ }
+ while (strlen($chunk) > $length);
+
+ $encoded .= $chunk . $this->LE;
+ }
+
+ // Chomp the last linefeed
+ $encoded = substr($encoded, 0, -strlen($this->LE));
+ return $encoded;
+ }
+
+ /**
+ * Encode string to quoted-printable.
+ * @access public
+ * @param string $string the text to encode
+ * @param integer $line_max Number of chars allowed on a line before wrapping
+ * @return string
+ */
+ public function EncodeQP( $input = '', $line_max = 76, $space_conv = false ) {
+ $hex = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
+ $lines = preg_split('/(?:\r\n|\r|\n)/', $input);
+ $eol = "\r\n";
+ $escape = '=';
+ $output = '';
+ while( list(, $line) = each($lines) ) {
+ $linlen = strlen($line);
+ $newline = '';
+ for($i = 0; $i < $linlen; $i++) {
+ $c = substr( $line, $i, 1 );
+ $dec = ord( $c );
+ if ( ( $i == 0 ) && ( $dec == 46 ) ) { // convert first point in the line into =2E
+ $c = '=2E';
+ }
+ if ( $dec == 32 ) {
+ if ( $i == ( $linlen - 1 ) ) { // convert space at eol only
+ $c = '=20';
+ } else if ( $space_conv ) {
+ $c = '=20';
+ }
+ } elseif ( ($dec == 61) || ($dec < 32 ) || ($dec > 126) ) { // always encode "\t", which is *not* required
+ $h2 = floor($dec/16);
+ $h1 = floor($dec%16);
+ $c = $escape.$hex[$h2].$hex[$h1];
+ }
+ if ( (strlen($newline) + strlen($c)) >= $line_max ) { // CRLF is not counted
+ $output .= $newline.$escape.$eol; // soft line break; " =\r\n" is okay
+ $newline = '';
+ // check if newline first character will be point or not
+ if ( $dec == 46 ) {
+ $c = '=2E';
+ }
+ }
+ $newline .= $c;
+ } // end of for
+ $output .= $newline.$eol;
+ } // end of while
+ return trim($output);
+ }
+
+ /**
+ * Encode string to q encoding.
+ * @access public
+ * @return string
+ */
+ public function EncodeQ ($str, $position = 'text') {
+ /* There should not be any EOL in the string */
+ $encoded = preg_replace("[\r\n]", '', $str);
+
+ switch (strtolower($position)) {
+ case 'phrase':
+ $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+ break;
+ case 'comment':
+ $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
+ case 'text':
+ default:
+ /* Replace every high ascii, control =, ? and _ characters */
+ $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
+ "'='.sprintf('%02X', ord('\\1'))", $encoded);
+ break;
+ }
+
+ /* Replace every spaces to _ (more readable than =20) */
+ $encoded = str_replace(' ', '_', $encoded);
+
+ return $encoded;
+ }
+
+ /**
+ * Adds a string or binary attachment (non-filesystem) to the list.
+ * This method can be used to attach ascii or binary data,
+ * such as a BLOB record from a database.
+ * @param string $string String attachment data.
+ * @param string $filename Name of the attachment.
+ * @param string $encoding File encoding (see $Encoding).
+ * @param string $type File extension (MIME) type.
+ * @return void
+ */
+ public function AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream') {
+ /* Append to $attachment array */
+ $cur = count($this->attachment);
+ $this->attachment[$cur][0] = $string;
+ $this->attachment[$cur][1] = $filename;
+ $this->attachment[$cur][2] = $filename;
+ $this->attachment[$cur][3] = $encoding;
+ $this->attachment[$cur][4] = $type;
+ $this->attachment[$cur][5] = true; // isString
+ $this->attachment[$cur][6] = 'attachment';
+ $this->attachment[$cur][7] = 0;
+ }
+
+ /**
+ * Adds an embedded attachment. This can include images, sounds, and
+ * just about any other document. Make sure to set the $type to an
+ * image type. For JPEG images use "image/jpeg" and for GIF images
+ * use "image/gif".
+ * @param string $path Path to the attachment.
+ * @param string $cid Content ID of the attachment. Use this to identify
+ * the Id for accessing the image in an HTML form.
+ * @param string $name Overrides the attachment name.
+ * @param string $encoding File encoding (see $Encoding).
+ * @param string $type File extension (MIME) type.
+ * @return bool
+ */
+ public function AddEmbeddedImage($path, $cid, $name = '', $encoding = 'base64', $type = 'application/octet-stream') {
+
+ if(!@is_file($path)) {
+ $this->SetError($this->Lang('file_access') . $path);
+ return false;
+ }
+
+ $filename = basename($path);
+ if($name == '') {
+ $name = $filename;
+ }
+
+ /* Append to $attachment array */
+ $cur = count($this->attachment);
+ $this->attachment[$cur][0] = $path;
+ $this->attachment[$cur][1] = $filename;
+ $this->attachment[$cur][2] = $name;
+ $this->attachment[$cur][3] = $encoding;
+ $this->attachment[$cur][4] = $type;
+ $this->attachment[$cur][5] = false;
+ $this->attachment[$cur][6] = 'inline';
+ $this->attachment[$cur][7] = $cid;
+
+ return true;
+ }
+
+ /**
+ * Returns true if an inline attachment is present.
+ * @access public
+ * @return bool
+ */
+ public function InlineImageExists() {
+ $result = false;
+ for($i = 0; $i < count($this->attachment); $i++) {
+ if($this->attachment[$i][6] == 'inline') {
+ $result = true;
+ break;
+ }
+ }
+
+ return $result;
+ }
+
+ /////////////////////////////////////////////////
+ // CLASS METHODS, MESSAGE RESET
+ /////////////////////////////////////////////////
+
+ /**
+ * Clears all recipients assigned in the TO array. Returns void.
+ * @return void
+ */
+ public function ClearAddresses() {
+ $this->to = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the CC array. Returns void.
+ * @return void
+ */
+ public function ClearCCs() {
+ $this->cc = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the BCC array. Returns void.
+ * @return void
+ */
+ public function ClearBCCs() {
+ $this->bcc = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the ReplyTo array. Returns void.
+ * @return void
+ */
+ public function ClearReplyTos() {
+ $this->ReplyTo = array();
+ }
+
+ /**
+ * Clears all recipients assigned in the TO, CC and BCC
+ * array. Returns void.
+ * @return void
+ */
+ public function ClearAllRecipients() {
+ $this->to = array();
+ $this->cc = array();
+ $this->bcc = array();
+ }
+
+ /**
+ * Clears all previously set filesystem, string, and binary
+ * attachments. Returns void.
+ * @return void
+ */
+ public function ClearAttachments() {
+ $this->attachment = array();
+ }
+
+ /**
+ * Clears all custom headers. Returns void.
+ * @return void
+ */
+ public function ClearCustomHeaders() {
+ $this->CustomHeader = array();
+ }
+
+ /////////////////////////////////////////////////
+ // CLASS METHODS, MISCELLANEOUS
+ /////////////////////////////////////////////////
+
+ /**
+ * Adds the error message to the error container.
+ * Returns void.
+ * @access private
+ * @return void
+ */
+ private function SetError($msg) {
+ $this->error_count++;
+ $this->ErrorInfo = $msg;
+ }
+
+ /**
+ * Returns the proper RFC 822 formatted date.
+ * @access private
+ * @return string
+ */
+ private static function RFCDate() {
+ $tz = date('Z');
+ $tzs = ($tz < 0) ? '-' : '+';
+ $tz = abs($tz);
+ $tz = (int)($tz/3600)*100 + ($tz%3600)/60;
+ $result = sprintf("%s %s%04d", date('D, j M Y H:i:s'), $tzs, $tz);
+
+ return $result;
+ }
+
+ /**
+ * Returns the server hostname or 'localhost.localdomain' if unknown.
+ * @access private
+ * @return string
+ */
+ private function ServerHostname() {
+ if (!empty($this->Hostname)) {
+ $result = $this->Hostname;
+ } elseif (isset($_SERVER['SERVER_NAME'])) {
+ $result = $_SERVER['SERVER_NAME'];
+ } else {
+ $result = "localhost.localdomain";
+ }
+
+ return $result;
+ }
+
+ /**
+ * Returns a message in the appropriate language.
+ * @access private
+ * @return string
+ */
+ private function Lang($key) {
+ if(count($this->language) < 1) {
+ $this->SetLanguage('en'); // set the default language
+ }
+
+ if(isset($this->language[$key])) {
+ return $this->language[$key];
+ } else {
+ return 'Language string failed to load: ' . $key;
+ }
+ }
+
+ /**
+ * Returns true if an error occurred.
+ * @access public
+ * @return bool
+ */
+ public function IsError() {
+ return ($this->error_count > 0);
+ }
+
+ /**
+ * Changes every end of line from CR or LF to CRLF.
+ * @access private
+ * @return string
+ */
+ private function FixEOL($str) {
+ $str = str_replace("\r\n", "\n", $str);
+ $str = str_replace("\r", "\n", $str);
+ $str = str_replace("\n", $this->LE, $str);
+ return $str;
+ }
+
+ /**
+ * Adds a custom header.
+ * @access public
+ * @return void
+ */
+ public function AddCustomHeader($custom_header) {
+ $this->CustomHeader[] = explode(':', $custom_header, 2);
+ }
+
+ /**
+ * Evaluates the message and returns modifications for inline images and backgrounds
+ * @access public
+ * @return $message
+ */
+ public function MsgHTML($message,$basedir='') {
+ preg_match_all("/(src|background)=\"(.*)\"/Ui", $message, $images);
+ if(isset($images[2])) {
+ foreach($images[2] as $i => $url) {
+ // do not change urls for absolute images (thanks to corvuscorax)
+ if (!preg_match('/^[A-z][A-z]*:\/\//',$url)) {
+ $filename = basename($url);
+ $directory = dirname($url);
+ ($directory == '.')?$directory='':'';
+ $cid = 'cid:' . md5($filename);
+ $fileParts = split("\.", $filename);
+ $ext = $fileParts[1];
+ $mimeType = $this->_mime_types($ext);
+ if ( strlen($basedir) > 1 && substr($basedir,-1) != '/') { $basedir .= '/'; }
+ if ( strlen($directory) > 1 && substr($basedir,-1) != '/') { $directory .= '/'; }
+ $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64', $mimeType);
+ if ( $this->AddEmbeddedImage($basedir.$directory.$filename, md5($filename), $filename, 'base64',$mimeType) ) {
+ $message = preg_replace("/".$images[1][$i]."=\"".preg_quote($url, '/')."\"/Ui", $images[1][$i]."=\"".$cid."\"", $message);
+ }
+ }
+ }
+ }
+ $this->IsHTML(true);
+ $this->Body = $message;
+ $textMsg = trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/s','',$message)));
+ if ( !empty($textMsg) && empty($this->AltBody) ) {
+ $this->AltBody = $textMsg;
+ }
+ if ( empty($this->AltBody) ) {
+ $this->AltBody = 'To view this email message, open the email in with HTML compatibility!' . "\n\n";
+ }
+ }
+
+ /**
+ * Gets the mime type of the embedded or inline image
+ * @access public
+ * @return mime type of ext
+ */
+ public function _mime_types($ext = '') {
+ $mimes = array(
+ 'hqx' => 'application/mac-binhex40',
+ 'cpt' => 'application/mac-compactpro',
+ 'doc' => 'application/msword',
+ 'bin' => 'application/macbinary',
+ 'dms' => 'application/octet-stream',
+ 'lha' => 'application/octet-stream',
+ 'lzh' => 'application/octet-stream',
+ 'exe' => 'application/octet-stream',
+ 'class' => 'application/octet-stream',
+ 'psd' => 'application/octet-stream',
+ 'so' => 'application/octet-stream',
+ 'sea' => 'application/octet-stream',
+ 'dll' => 'application/octet-stream',
+ 'oda' => 'application/oda',
+ 'pdf' => 'application/pdf',
+ 'ai' => 'application/postscript',
+ 'eps' => 'application/postscript',
+ 'ps' => 'application/postscript',
+ 'smi' => 'application/smil',
+ 'smil' => 'application/smil',
+ 'mif' => 'application/vnd.mif',
+ 'xls' => 'application/vnd.ms-excel',
+ 'ppt' => 'application/vnd.ms-powerpoint',
+ 'wbxml' => 'application/vnd.wap.wbxml',
+ 'wmlc' => 'application/vnd.wap.wmlc',
+ 'dcr' => 'application/x-director',
+ 'dir' => 'application/x-director',
+ 'dxr' => 'application/x-director',
+ 'dvi' => 'application/x-dvi',
+ 'gtar' => 'application/x-gtar',
+ 'php' => 'application/x-httpd-php',
+ 'php4' => 'application/x-httpd-php',
+ 'php3' => 'application/x-httpd-php',
+ 'phtml' => 'application/x-httpd-php',
+ 'phps' => 'application/x-httpd-php-source',
+ 'js' => 'application/x-javascript',
+ 'swf' => 'application/x-shockwave-flash',
+ 'sit' => 'application/x-stuffit',
+ 'tar' => 'application/x-tar',
+ 'tgz' => 'application/x-tar',
+ 'xhtml' => 'application/xhtml+xml',
+ 'xht' => 'application/xhtml+xml',
+ 'zip' => 'application/zip',
+ 'mid' => 'audio/midi',
+ 'midi' => 'audio/midi',
+ 'mpga' => 'audio/mpeg',
+ 'mp2' => 'audio/mpeg',
+ 'mp3' => 'audio/mpeg',
+ 'aif' => 'audio/x-aiff',
+ 'aiff' => 'audio/x-aiff',
+ 'aifc' => 'audio/x-aiff',
+ 'ram' => 'audio/x-pn-realaudio',
+ 'rm' => 'audio/x-pn-realaudio',
+ 'rpm' => 'audio/x-pn-realaudio-plugin',
+ 'ra' => 'audio/x-realaudio',
+ 'rv' => 'video/vnd.rn-realvideo',
+ 'wav' => 'audio/x-wav',
+ 'bmp' => 'image/bmp',
+ 'gif' => 'image/gif',
+ 'jpeg' => 'image/jpeg',
+ 'jpg' => 'image/jpeg',
+ 'jpe' => 'image/jpeg',
+ 'png' => 'image/png',
+ 'tiff' => 'image/tiff',
+ 'tif' => 'image/tiff',
+ 'css' => 'text/css',
+ 'html' => 'text/html',
+ 'htm' => 'text/html',
+ 'shtml' => 'text/html',
+ 'txt' => 'text/plain',
+ 'text' => 'text/plain',
+ 'log' => 'text/plain',
+ 'rtx' => 'text/richtext',
+ 'rtf' => 'text/rtf',
+ 'xml' => 'text/xml',
+ 'xsl' => 'text/xml',
+ 'mpeg' => 'video/mpeg',
+ 'mpg' => 'video/mpeg',
+ 'mpe' => 'video/mpeg',
+ 'qt' => 'video/quicktime',
+ 'mov' => 'video/quicktime',
+ 'avi' => 'video/x-msvideo',
+ 'movie' => 'video/x-sgi-movie',
+ 'doc' => 'application/msword',
+ 'word' => 'application/msword',
+ 'xl' => 'application/excel',
+ 'eml' => 'message/rfc822'
+ );
+ return ( ! isset($mimes[strtolower($ext)])) ? 'application/octet-stream' : $mimes[strtolower($ext)];
+ }
+
+ /**
+ * Set (or reset) Class Objects (variables)
+ *
+ * Usage Example:
+ * $page->set('X-Priority', '3');
+ *
+ * @access public
+ * @param string $name Parameter Name
+ * @param mixed $value Parameter Value
+ * NOTE: will not work with arrays, there are no arrays to set/reset
+ */
+ public function set ( $name, $value = '' ) {
+ if ( isset($this->$name) ) {
+ $this->$name = $value;
+ } else {
+ $this->SetError('Cannot set or reset variable ' . $name);
+ return false;
+ }
+ }
+
+ /**
+ * Read a file from a supplied filename and return it.
+ *
+ * @access public
+ * @param string $filename Parameter File Name
+ */
+ public function getFile($filename) {
+ $return = '';
+ if ($fp = fopen($filename, 'rb')) {
+ while (!feof($fp)) {
+ $return .= fread($fp, 1024);
+ }
+ fclose($fp);
+ return $return;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Strips newlines to prevent header injection.
+ * @access public
+ * @param string $str String
+ * @return string
+ */
+ public function SecureHeader($str) {
+ $str = trim($str);
+ $str = str_replace("\r", "", $str);
+ $str = str_replace("\n", "", $str);
+ return $str;
+ }
+
+ /**
+ * Set the private key file and password to sign the message.
+ *
+ * @access public
+ * @param string $key_filename Parameter File Name
+ * @param string $key_pass Password for private key
+ */
+ public function Sign($key_filename, $key_pass) {
+ $this->sign_key_file = $key_filename;
+ $this->sign_key_pass = $key_pass;
+ }
+
+}
+
+?>
--- /dev/null
+<?php
+/*~ class.pop3.php
+.---------------------------------------------------------------------------.
+| Software: PHPMailer - PHP email class |
+| Version: 2.1 |
+| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
+| Info: http://phpmailer.sourceforge.net |
+| Support: http://sourceforge.net/projects/phpmailer/ |
+| ------------------------------------------------------------------------- |
+| Author: Andy Prevost (project admininistrator) |
+| Author: Brent R. Matzelle (original founder) |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
+| Copyright (c) 2001-2003, Brent R. Matzelle |
+| ------------------------------------------------------------------------- |
+| License: Distributed under the Lesser General Public License (LGPL) |
+| http://www.gnu.org/copyleft/lesser.html |
+| This program is distributed in the hope that it will be useful - WITHOUT |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
+| FITNESS FOR A PARTICULAR PURPOSE. |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com): |
+| - Web Hosting on highly optimized fast and secure servers |
+| - Technology Consulting |
+| - Oursourcing (highly qualified programmers and graphic designers) |
+'---------------------------------------------------------------------------'
+
+/**
+ * POP Before SMTP Authentication Class
+ * Version 2.1
+ *
+ * Author: Richard Davey (rich@corephp.co.uk)
+ * Modifications: Andy Prevost
+ * License: LGPL, see PHPMailer License
+ *
+ * Specifically for PHPMailer to allow POP before SMTP authentication.
+ * Does not yet work with APOP - if you have an APOP account, contact me
+ * and we can test changes to this script.
+ *
+ * This class is based on the structure of the SMTP class by Chris Ryan
+ *
+ * This class is rfc 1939 compliant and implements all the commands
+ * required for POP3 connection, authentication and disconnection.
+ *
+ * @package PHPMailer
+ * @author Richard Davey
+ */
+
+class POP3 {
+ /**
+ * Default POP3 port
+ * @var int
+ */
+ public $POP3_PORT = 110;
+
+ /**
+ * Default Timeout
+ * @var int
+ */
+ public $POP3_TIMEOUT = 30;
+
+ /**
+ * POP3 Carriage Return + Line Feed
+ * @var string
+ */
+ public $CRLF = "\r\n";
+
+ /**
+ * Displaying Debug warnings? (0 = now, 1+ = yes)
+ * @var int
+ */
+ public $do_debug = 2;
+
+ /**
+ * POP3 Mail Server
+ * @var string
+ */
+ public $host;
+
+ /**
+ * POP3 Port
+ * @var int
+ */
+ public $port;
+
+ /**
+ * POP3 Timeout Value
+ * @var int
+ */
+ public $tval;
+
+ /**
+ * POP3 Username
+ * @var string
+ */
+ public $username;
+
+ /**
+ * POP3 Password
+ * @var string
+ */
+ public $password;
+
+ /**#@+
+ * @access private
+ */
+ private $pop_conn;
+ private $connected;
+ private $error; // Error log array
+ /**#@-*/
+
+ /**
+ * Constructor, sets the initial values
+ * @access public
+ * @return POP3
+ */
+ public function __construct() {
+ $this->pop_conn = 0;
+ $this->connected = false;
+ $this->error = null;
+ }
+
+ /**
+ * Combination of public events - connect, login, disconnect
+ * @access public
+ * @param string $host
+ * @param integer $port
+ * @param integer $tval
+ * @param string $username
+ * @param string $password
+ */
+ public function Authorise ($host, $port = false, $tval = false, $username, $password, $debug_level = 0) {
+ $this->host = $host;
+
+ // If no port value is passed, retrieve it
+ if ($port == false) {
+ $this->port = $this->POP3_PORT;
+ } else {
+ $this->port = $port;
+ }
+
+ // If no port value is passed, retrieve it
+ if ($tval == false) {
+ $this->tval = $this->POP3_TIMEOUT;
+ } else {
+ $this->tval = $tval;
+ }
+
+ $this->do_debug = $debug_level;
+ $this->username = $username;
+ $this->password = $password;
+
+ // Refresh the error log
+ $this->error = null;
+
+ // Connect
+ $result = $this->Connect($this->host, $this->port, $this->tval);
+
+ if ($result) {
+ $login_result = $this->Login($this->username, $this->password);
+
+ if ($login_result) {
+ $this->Disconnect();
+
+ return true;
+ }
+
+ }
+
+ // We need to disconnect regardless if the login succeeded
+ $this->Disconnect();
+
+ return false;
+ }
+
+ /**
+ * Connect to the POP3 server
+ * @access public
+ * @param string $host
+ * @param integer $port
+ * @param integer $tval
+ * @return boolean
+ */
+ public function Connect ($host, $port = false, $tval = 30) {
+ // Are we already connected?
+ if ($this->connected) {
+ return true;
+ }
+
+ /*
+ On Windows this will raise a PHP Warning error if the hostname doesn't exist.
+ Rather than supress it with @fsockopen, let's capture it cleanly instead
+ */
+
+ set_error_handler(array(&$this, 'catchWarning'));
+
+ // Connect to the POP3 server
+ $this->pop_conn = fsockopen($host, // POP3 Host
+ $port, // Port #
+ $errno, // Error Number
+ $errstr, // Error Message
+ $tval); // Timeout (seconds)
+
+ // Restore the error handler
+ restore_error_handler();
+
+ // Does the Error Log now contain anything?
+ if ($this->error && $this->do_debug >= 1) {
+ $this->displayErrors();
+ }
+
+ // Did we connect?
+ if ($this->pop_conn == false) {
+ // It would appear not...
+ $this->error = array(
+ 'error' => "Failed to connect to server $host on port $port",
+ 'errno' => $errno,
+ 'errstr' => $errstr
+ );
+
+ if ($this->do_debug >= 1) {
+ $this->displayErrors();
+ }
+
+ return false;
+ }
+
+ // Increase the stream time-out
+
+ // Check for PHP 4.3.0 or later
+ if (version_compare(phpversion(), '4.3.0', 'ge')) {
+ stream_set_timeout($this->pop_conn, $tval, 0);
+ } else {
+ // Does not work on Windows
+ if (substr(PHP_OS, 0, 3) !== 'WIN') {
+ socket_set_timeout($this->pop_conn, $tval, 0);
+ }
+ }
+
+ // Get the POP3 server response
+ $pop3_response = $this->getResponse();
+
+ // Check for the +OK
+ if ($this->checkResponse($pop3_response)) {
+ // The connection is established and the POP3 server is talking
+ $this->connected = true;
+ return true;
+ }
+
+ }
+
+ /**
+ * Login to the POP3 server (does not support APOP yet)
+ * @access public
+ * @param string $username
+ * @param string $password
+ * @return boolean
+ */
+ public function Login ($username = '', $password = '') {
+ if ($this->connected == false) {
+ $this->error = 'Not connected to POP3 server';
+
+ if ($this->do_debug >= 1) {
+ $this->displayErrors();
+ }
+ }
+
+ if (empty($username)) {
+ $username = $this->username;
+ }
+
+ if (empty($password)) {
+ $password = $this->password;
+ }
+
+ $pop_username = "USER $username" . $this->CRLF;
+ $pop_password = "PASS $password" . $this->CRLF;
+
+ // Send the Username
+ $this->sendString($pop_username);
+ $pop3_response = $this->getResponse();
+
+ if ($this->checkResponse($pop3_response)) {
+ // Send the Password
+ $this->sendString($pop_password);
+ $pop3_response = $this->getResponse();
+
+ if ($this->checkResponse($pop3_response)) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Disconnect from the POP3 server
+ * @access public
+ */
+ public function Disconnect () {
+ $this->sendString('QUIT');
+
+ fclose($this->pop_conn);
+ }
+
+ /////////////////////////////////////////////////
+ // Private Methods
+ /////////////////////////////////////////////////
+
+ /**
+ * Get the socket response back.
+ * $size is the maximum number of bytes to retrieve
+ * @access private
+ * @param integer $size
+ * @return string
+ */
+ private public function getResponse ($size = 128) {
+ $pop3_response = fgets($this->pop_conn, $size);
+
+ return $pop3_response;
+ }
+
+ /**
+ * Send a string down the open socket connection to the POP3 server
+ * @access private
+ * @param string $string
+ * @return integer
+ */
+ private function sendString ($string) {
+ $bytes_sent = fwrite($this->pop_conn, $string, strlen($string));
+
+ return $bytes_sent;
+ }
+
+ /**
+ * Checks the POP3 server response for +OK or -ERR
+ * @access private
+ * @param string $string
+ * @return boolean
+ */
+ private function checkResponse ($string) {
+ if (substr($string, 0, 3) !== '+OK') {
+ $this->error = array(
+ 'error' => "Server reported an error: $string",
+ 'errno' => 0,
+ 'errstr' => ''
+ );
+
+ if ($this->do_debug >= 1) {
+ $this->displayErrors();
+ }
+
+ return false;
+ } else {
+ return true;
+ }
+
+ }
+
+ /**
+ * If debug is enabled, display the error message array
+ * @access private
+ */
+ private function displayErrors () {
+ echo '<pre>';
+
+ foreach ($this->error as $single_error) {
+ print_r($single_error);
+ }
+
+ echo '</pre>';
+ }
+
+ /**
+ * Takes over from PHP for the socket warning handler
+ * @access private
+ * @param integer $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param integer $errline
+ */
+ private function catchWarning ($errno, $errstr, $errfile, $errline) {
+ $this->error[] = array(
+ 'error' => "Connecting to the POP3 server raised a PHP warning: ",
+ 'errno' => $errno,
+ 'errstr' => $errstr
+ );
+ }
+
+ // End of class
+}
+?>
--- /dev/null
+<?php
+/*~ class.smtp.php
+.---------------------------------------------------------------------------.
+| Software: PHPMailer - PHP email class |
+| Version: 2.1 |
+| Contact: via sourceforge.net support pages (also www.codeworxtech.com) |
+| Info: http://phpmailer.sourceforge.net |
+| Support: http://sourceforge.net/projects/phpmailer/ |
+| ------------------------------------------------------------------------- |
+| Author: Andy Prevost (project admininistrator) |
+| Author: Brent R. Matzelle (original founder) |
+| Copyright (c) 2004-2007, Andy Prevost. All Rights Reserved. |
+| Copyright (c) 2001-2003, Brent R. Matzelle |
+| ------------------------------------------------------------------------- |
+| License: Distributed under the Lesser General Public License (LGPL) |
+| http://www.gnu.org/copyleft/lesser.html |
+| This program is distributed in the hope that it will be useful - WITHOUT |
+| ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
+| FITNESS FOR A PARTICULAR PURPOSE. |
+| ------------------------------------------------------------------------- |
+| We offer a number of paid services (www.codeworxtech.com): |
+| - Web Hosting on highly optimized fast and secure servers |
+| - Technology Consulting |
+| - Oursourcing (highly qualified programmers and graphic designers) |
+'---------------------------------------------------------------------------'
+
+/**
+ * SMTP is rfc 821 compliant and implements all the rfc 821 SMTP
+ * commands except TURN which will always return a not implemented
+ * error. SMTP also provides some utility methods for sending mail
+ * to an SMTP server.
+ * @package PHPMailer
+ * @author Chris Ryan
+ */
+
+class SMTP {
+ /**
+ * SMTP server port
+ * @var int
+ */
+ public $SMTP_PORT = 25;
+
+ /**
+ * SMTP reply line ending
+ * @var string
+ */
+ public $CRLF = "\r\n";
+
+ /**
+ * Sets whether debugging is turned on
+ * @var bool
+ */
+ public $do_debug; // the level of debug to perform
+
+ /**
+ * Sets VERP use on/off (default is off)
+ * @var bool
+ */
+ public $do_verp = false;
+
+ /**#@+
+ * @access private
+ */
+ private $smtp_conn; // the socket to the server
+ private $error; // error if any on the last call
+ private $helo_rply; // the reply the server sent to us for HELO
+ /**#@-*/
+
+ /**
+ * Initialize the class so that the data is in a known state.
+ * @access public
+ * @return void
+ */
+ public function __construct() {
+ $this->smtp_conn = 0;
+ $this->error = null;
+ $this->helo_rply = null;
+
+ $this->do_debug = 0;
+ }
+
+ /*************************************************************
+ * CONNECTION FUNCTIONS *
+ ***********************************************************/
+
+ /**
+ * Connect to the server specified on the port specified.
+ * If the port is not specified use the default SMTP_PORT.
+ * If tval is specified then a connection will try and be
+ * established with the server for that number of seconds.
+ * If tval is not specified the default is 30 seconds to
+ * try on the connection.
+ *
+ * SMTP CODE SUCCESS: 220
+ * SMTP CODE FAILURE: 421
+ * @access public
+ * @return bool
+ */
+ public function Connect($host,$port=0,$tval=30) {
+ /* set the error val to null so there is no confusion */
+ $this->error = null;
+
+ /* make sure we are __not__ connected */
+ if($this->connected()) {
+ /* ok we are connected! what should we do?
+ * for now we will just give an error saying we
+ * are already connected
+ */
+ $this->error = array("error" => "Already connected to a server");
+ return false;
+ }
+
+ if(empty($port)) {
+ $port = $this->SMTP_PORT;
+ }
+
+ /* connect to the smtp server */
+ $this->smtp_conn = fsockopen($host, // the host of the server
+ $port, // the port to use
+ $errno, // error number if any
+ $errstr, // error message if any
+ $tval); // give up after ? secs
+ /* verify we connected properly */
+ if(empty($this->smtp_conn)) {
+ $this->error = array("error" => "Failed to connect to server",
+ "errno" => $errno,
+ "errstr" => $errstr);
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": $errstr ($errno)" . $this->CRLF;
+ }
+ return false;
+ }
+
+ /* sometimes the SMTP server takes a little longer to respond
+ * so we will give it a longer timeout for the first read
+ * - Windows still does not have support for this timeout function
+ */
+ if(substr(PHP_OS, 0, 3) != "WIN")
+ socket_set_timeout($this->smtp_conn, $tval, 0);
+
+ /* get any announcement stuff */
+ $announce = $this->get_lines();
+
+ /* set the timeout of any socket functions at 1/10 of a second */
+ //if(function_exists("socket_set_timeout"))
+ // socket_set_timeout($this->smtp_conn, 0, 100000);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $announce;
+ }
+
+ return true;
+ }
+
+ /**
+ * Initiate a TSL communication with the server.
+ *
+ * SMTP CODE 220 Ready to start TLS
+ * SMTP CODE 501 Syntax error (no parameters allowed)
+ * SMTP CODE 454 TLS not available due to temporary reason
+ * @access public
+ * @return bool success
+ */
+ public function StartTLS() {
+ $this->error = null; # to avoid confusion
+
+ if(!$this->connected()) {
+ $this->error = array("error" => "Called StartTLS() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"STARTTLS" . $extra . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 220) {
+ $this->error =
+ array("error" => "STARTTLS not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] . ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ //Begin encrypted connection
+ if(!stream_socket_enable_crypto($this->smtp_conn, true, STREAM_CRYPTO_METHOD_TLS_CLIENT)) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Performs SMTP authentication. Must be run after running the
+ * Hello() method. Returns true if successfully authenticated.
+ * @access public
+ * @return bool
+ */
+ public function Authenticate($username, $password) {
+ // Start authentication
+ fputs($this->smtp_conn,"AUTH LOGIN" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 334) {
+ $this->error =
+ array("error" => "AUTH not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ // Send encoded username
+ fputs($this->smtp_conn, base64_encode($username) . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 334) {
+ $this->error =
+ array("error" => "Username not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ // Send encoded password
+ fputs($this->smtp_conn, base64_encode($password) . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($code != 235) {
+ $this->error =
+ array("error" => "Password not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Returns true if connected to a server otherwise false
+ * @access public
+ * @return bool
+ */
+ public function Connected() {
+ if(!empty($this->smtp_conn)) {
+ $sock_status = socket_get_status($this->smtp_conn);
+ if($sock_status["eof"]) {
+ // hmm this is an odd situation... the socket is
+ // valid but we are not connected anymore
+ if($this->do_debug >= 1) {
+ echo "SMTP -> NOTICE:" . $this->CRLF .
+ "EOF caught while checking if connected";
+ }
+ $this->Close();
+ return false;
+ }
+ return true; // everything looks good
+ }
+ return false;
+ }
+
+ /**
+ * Closes the socket and cleans up the state of the class.
+ * It is not considered good to use this function without
+ * first trying to use QUIT.
+ * @access public
+ * @return void
+ */
+ public function Close() {
+ $this->error = null; // so there is no confusion
+ $this->helo_rply = null;
+ if(!empty($this->smtp_conn)) {
+ // close the connection and cleanup
+ fclose($this->smtp_conn);
+ $this->smtp_conn = 0;
+ }
+ }
+
+ /***************************************************************
+ * SMTP COMMANDS *
+ *************************************************************/
+
+ /**
+ * Issues a data command and sends the msg_data to the server
+ * finializing the mail transaction. $msg_data is the message
+ * that is to be send with the headers. Each header needs to be
+ * on a single line followed by a <CRLF> with the message headers
+ * and the message body being seperated by and additional <CRLF>.
+ *
+ * Implements rfc 821: DATA <CRLF>
+ *
+ * SMTP CODE INTERMEDIATE: 354
+ * [data]
+ * <CRLF>.<CRLF>
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 552,554,451,452
+ * SMTP CODE FAILURE: 451,554
+ * SMTP CODE ERROR : 500,501,503,421
+ * @access public
+ * @return bool
+ */
+ public function Data($msg_data) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Data() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"DATA" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 354) {
+ $this->error =
+ array("error" => "DATA command not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ /* the server is ready to accept data!
+ * according to rfc 821 we should not send more than 1000
+ * including the CRLF
+ * characters on a single line so we will break the data up
+ * into lines by \r and/or \n then if needed we will break
+ * each of those into smaller lines to fit within the limit.
+ * in addition we will be looking for lines that start with
+ * a period '.' and append and additional period '.' to that
+ * line. NOTE: this does not count towards are limit.
+ */
+
+ // normalize the line breaks so we know the explode works
+ $msg_data = str_replace("\r\n","\n",$msg_data);
+ $msg_data = str_replace("\r","\n",$msg_data);
+ $lines = explode("\n",$msg_data);
+
+ /* we need to find a good way to determine is headers are
+ * in the msg_data or if it is a straight msg body
+ * currently I am assuming rfc 822 definitions of msg headers
+ * and if the first field of the first line (':' sperated)
+ * does not contain a space then it _should_ be a header
+ * and we can process all lines before a blank "" line as
+ * headers.
+ */
+ $field = substr($lines[0],0,strpos($lines[0],":"));
+ $in_headers = false;
+ if(!empty($field) && !strstr($field," ")) {
+ $in_headers = true;
+ }
+
+ $max_line_length = 998; // used below; set here for ease in change
+
+ while(list(,$line) = @each($lines)) {
+ $lines_out = null;
+ if($line == "" && $in_headers) {
+ $in_headers = false;
+ }
+ // ok we need to break this line up into several smaller lines
+ while(strlen($line) > $max_line_length) {
+ $pos = strrpos(substr($line,0,$max_line_length)," ");
+
+ // Patch to fix DOS attack
+ if(!$pos) {
+ $pos = $max_line_length - 1;
+ $lines_out[] = substr($line,0,$pos);
+ $line = substr($line,$pos);
+ } else {
+ $lines_out[] = substr($line,0,$pos);
+ $line = substr($line,$pos + 1);
+ }
+
+ /* if we are processing headers we need to
+ * add a LWSP-char to the front of the new line
+ * rfc 822 on long msg headers
+ */
+ if($in_headers) {
+ $line = "\t" . $line;
+ }
+ }
+ $lines_out[] = $line;
+
+ // now send the lines to the server
+ while(list(,$line_out) = @each($lines_out)) {
+ if(strlen($line_out) > 0)
+ {
+ if(substr($line_out, 0, 1) == ".") {
+ $line_out = "." . $line_out;
+ }
+ }
+ fputs($this->smtp_conn,$line_out . $this->CRLF);
+ }
+ }
+
+ // ok all the message data has been sent so lets get this
+ // over with aleady
+ fputs($this->smtp_conn, $this->CRLF . "." . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "DATA not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Expand takes the name and asks the server to list all the
+ * people who are members of the _list_. Expand will return
+ * back and array of the result or false if an error occurs.
+ * Each value in the array returned has the format of:
+ * [ <full-name> <sp> ] <path>
+ * The definition of <path> is defined in rfc 821
+ *
+ * Implements rfc 821: EXPN <SP> <string> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 550
+ * SMTP CODE ERROR : 500,501,502,504,421
+ * @access public
+ * @return string array
+ */
+ public function Expand($name) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Expand() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"EXPN " . $name . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "EXPN not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ // parse the reply and place in our array to return to user
+ $entries = explode($this->CRLF,$rply);
+ while(list(,$l) = @each($entries)) {
+ $list[] = substr($l,4);
+ }
+
+ return $list;
+ }
+
+ /**
+ * Sends the HELO command to the smtp server.
+ * This makes sure that we and the server are in
+ * the same known state.
+ *
+ * Implements from rfc 821: HELO <SP> <domain> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500, 501, 504, 421
+ * @access public
+ * @return bool
+ */
+ public function Hello($host="") {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Hello() without being connected");
+ return false;
+ }
+
+ // if a hostname for the HELO was not specified determine
+ //a suitable one to send
+ if(empty($host)) {
+ // we need to determine some sort of appopiate default
+ // to send to the server
+ $host = "localhost";
+ }
+
+ // Send extended hello first (RFC 2821)
+ if(!$this->SendHello("EHLO", $host))
+ {
+ if(!$this->SendHello("HELO", $host))
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Sends a HELO/EHLO command.
+ * @access private
+ * @return bool
+ */
+ private function SendHello($hello, $host) {
+ fputs($this->smtp_conn, $hello . " " . $host . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER: " . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => $hello . " not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ $this->helo_rply = $rply;
+
+ return true;
+ }
+
+ /**
+ * Gets help information on the keyword specified. If the keyword
+ * is not specified then returns generic help, ussually contianing
+ * A list of keywords that help is available on. This function
+ * returns the results back to the user. It is up to the user to
+ * handle the returned data. If an error occurs then false is
+ * returned with $this->error set appropiately.
+ *
+ * Implements rfc 821: HELP [ <SP> <string> ] <CRLF>
+ *
+ * SMTP CODE SUCCESS: 211,214
+ * SMTP CODE ERROR : 500,501,502,504,421
+ * @access public
+ * @return string
+ */
+ public function Help($keyword="") {
+ $this->error = null; // to avoid confusion
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Help() without being connected");
+ return false;
+ }
+
+ $extra = "";
+ if(!empty($keyword)) {
+ $extra = " " . $keyword;
+ }
+
+ fputs($this->smtp_conn,"HELP" . $extra . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 211 && $code != 214) {
+ $this->error =
+ array("error" => "HELP not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ return $rply;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command.
+ *
+ * Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,421
+ * @access public
+ * @return bool
+ */
+ public function Mail($from) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Mail() without being connected");
+ return false;
+ }
+
+ $useVerp = ($this->do_verp ? "XVERP" : "");
+ fputs($this->smtp_conn,"MAIL FROM:<" . $from . ">" . $useVerp . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "MAIL not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the command NOOP to the SMTP server.
+ *
+ * Implements from rfc 821: NOOP <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500, 421
+ * @access public
+ * @return bool
+ */
+ public function Noop() {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Noop() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"NOOP" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "NOOP not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the quit command to the server and then closes the socket
+ * if there is no error or the $close_on_error argument is true.
+ *
+ * Implements from rfc 821: QUIT <CRLF>
+ *
+ * SMTP CODE SUCCESS: 221
+ * SMTP CODE ERROR : 500
+ * @access public
+ * @return bool
+ */
+ public function Quit($close_on_error=true) {
+ $this->error = null; // so there is no confusion
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Quit() without being connected");
+ return false;
+ }
+
+ // send the quit command to the server
+ fputs($this->smtp_conn,"quit" . $this->CRLF);
+
+ // get any good-bye messages
+ $byemsg = $this->get_lines();
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $byemsg;
+ }
+
+ $rval = true;
+ $e = null;
+
+ $code = substr($byemsg,0,3);
+ if($code != 221) {
+ // use e as a tmp var cause Close will overwrite $this->error
+ $e = array("error" => "SMTP server rejected quit command",
+ "smtp_code" => $code,
+ "smtp_rply" => substr($byemsg,4));
+ $rval = false;
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $e["error"] . ": " .
+ $byemsg . $this->CRLF;
+ }
+ }
+
+ if(empty($e) || $close_on_error) {
+ $this->Close();
+ }
+
+ return $rval;
+ }
+
+ /**
+ * Sends the command RCPT to the SMTP server with the TO: argument of $to.
+ * Returns true if the recipient was accepted false if it was rejected.
+ *
+ * Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250,251
+ * SMTP CODE FAILURE: 550,551,552,553,450,451,452
+ * SMTP CODE ERROR : 500,501,503,421
+ * @access public
+ * @return bool
+ */
+ public function Recipient($to) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Recipient() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"RCPT TO:<" . $to . ">" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250 && $code != 251) {
+ $this->error =
+ array("error" => "RCPT not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Sends the RSET command to abort and transaction that is
+ * currently in progress. Returns true if successful false
+ * otherwise.
+ *
+ * Implements rfc 821: RSET <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE ERROR : 500,501,504,421
+ * @access public
+ * @return bool
+ */
+ public function Reset() {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Reset() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"RSET" . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "RSET failed",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command. This command
+ * will send the message to the users terminal if they are logged
+ * in.
+ *
+ * Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ public function Send($from) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Send() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SEND FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SEND not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command. This command
+ * will send the message to the users terminal if they are logged
+ * in and send them an email.
+ *
+ * Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ public function SendAndMail($from) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called SendAndMail() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SAML FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SAML not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Starts a mail transaction from the email address specified in
+ * $from. Returns true if successful or false otherwise. If True
+ * the mail transaction is started and then one or more Recipient
+ * commands may be called followed by a Data command. This command
+ * will send the message to the users terminal if they are logged
+ * in or mail it to them if they are not.
+ *
+ * Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE SUCCESS: 552,451,452
+ * SMTP CODE SUCCESS: 500,501,502,421
+ * @access public
+ * @return bool
+ */
+ public function SendOrMail($from) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called SendOrMail() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"SOML FROM:" . $from . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250) {
+ $this->error =
+ array("error" => "SOML not accepted from server",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * This is an optional command for SMTP that this class does not
+ * support. This method is here to make the RFC821 Definition
+ * complete for this class and __may__ be implimented in the future
+ *
+ * Implements from rfc 821: TURN <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250
+ * SMTP CODE FAILURE: 502
+ * SMTP CODE ERROR : 500, 503
+ * @access public
+ * @return bool
+ */
+ public function Turn() {
+ $this->error = array("error" => "This method, TURN, of the SMTP ".
+ "is not implemented");
+ if($this->do_debug >= 1) {
+ echo "SMTP -> NOTICE: " . $this->error["error"] . $this->CRLF;
+ }
+ return false;
+ }
+
+ /**
+ * Verifies that the name is recognized by the server.
+ * Returns false if the name could not be verified otherwise
+ * the response from the server is returned.
+ *
+ * Implements rfc 821: VRFY <SP> <string> <CRLF>
+ *
+ * SMTP CODE SUCCESS: 250,251
+ * SMTP CODE FAILURE: 550,551,553
+ * SMTP CODE ERROR : 500,501,502,421
+ * @access public
+ * @return int
+ */
+ public function Verify($name) {
+ $this->error = null; // so no confusion is caused
+
+ if(!$this->connected()) {
+ $this->error = array(
+ "error" => "Called Verify() without being connected");
+ return false;
+ }
+
+ fputs($this->smtp_conn,"VRFY " . $name . $this->CRLF);
+
+ $rply = $this->get_lines();
+ $code = substr($rply,0,3);
+
+ if($this->do_debug >= 2) {
+ echo "SMTP -> FROM SERVER:" . $this->CRLF . $rply;
+ }
+
+ if($code != 250 && $code != 251) {
+ $this->error =
+ array("error" => "VRFY failed on name '$name'",
+ "smtp_code" => $code,
+ "smtp_msg" => substr($rply,4));
+ if($this->do_debug >= 1) {
+ echo "SMTP -> ERROR: " . $this->error["error"] .
+ ": " . $rply . $this->CRLF;
+ }
+ return false;
+ }
+ return $rply;
+ }
+
+ /*******************************************************************
+ * INTERNAL FUNCTIONS *
+ ******************************************************************/
+
+ /**
+ * Read in as many lines as possible
+ * either before eof or socket timeout occurs on the operation.
+ * With SMTP we can tell if we have more lines to read if the
+ * 4th character is '-' symbol. If it is a space then we don't
+ * need to read anything else.
+ * @access private
+ * @return string
+ */
+ private function get_lines() {
+ $data = "";
+ while($str = @fgets($this->smtp_conn,515)) {
+ if($this->do_debug >= 4) {
+ echo "SMTP -> get_lines(): \$data was \"$data\"" .
+ $this->CRLF;
+ echo "SMTP -> get_lines(): \$str is \"$str\"" .
+ $this->CRLF;
+ }
+ $data .= $str;
+ if($this->do_debug >= 4) {
+ echo "SMTP -> get_lines(): \$data is \"$data\"" . $this->CRLF;
+ }
+ // if the 4th character is a space then we are done reading
+ // so just break the loop
+ if(substr($str,3,1) == " ") { break; }
+ }
+ return $data;
+ }
+
+}
+
+
+ ?>
--- /dev/null
+<html>\r
+<head>\r
+<title>Examples using phpmailer</title>\r
+</head>\r
+\r
+<body bgcolor="#FFFFFF">\r
+\r
+<h2>Examples using phpmailer</h2>\r
+\r
+<h3>1. Advanced Example</h3>\r
+<p>\r
+\r
+This demonstrates sending out multiple email messages with binary attachments\r
+from a MySQL database with multipart/alternative support.<p>\r
+<table cellpadding="4" border="1" width="80%">\r
+<tr>\r
+<td bgcolor="#CCCCCC">\r
+<pre>\r
+require("class.phpmailer.php");\r
+\r
+$mail = new phpmailer();\r
+\r
+$mail->From = "list@example.com";\r
+$mail->FromName = "List manager";\r
+$mail->Host = "smtp1.example.com;smtp2.example.com";\r
+$mail->Mailer = "smtp";\r
+\r
+@MYSQL_CONNECT("localhost","root","password");\r
+@mysql_select_db("my_company");\r
+$query = "SELECT full_name, email, photo FROM employee WHERE id=$id";\r
+$result = @MYSQL_QUERY($query);\r
+\r
+while ($row = mysql_fetch_array ($result))\r
+{\r
+ // HTML body\r
+ $body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";\r
+ $body .= "<i>Your</i> personal photograph to this message.<p>";\r
+ $body .= "Sincerely, <br>";\r
+ $body .= "phpmailer List manager";\r
+\r
+ // Plain text body (for mail clients that cannot read HTML)\r
+ $text_body = "Hello " . $row["full_name"] . ", \n\n";\r
+ $text_body .= "Your personal photograph to this message.\n\n";\r
+ $text_body .= "Sincerely, \n";\r
+ $text_body .= "phpmailer List manager";\r
+\r
+ $mail->Body = $body;\r
+ $mail->AltBody = $text_body;\r
+ $mail->AddAddress($row["email"], $row["full_name"]);\r
+ $mail->AddStringAttachment($row["photo"], "YourPhoto.jpg");\r
+\r
+ if(!$mail->Send())\r
+ echo "There has been a mail error sending to " . $row["email"] . "<br>";\r
+\r
+ // Clear all addresses and attachments for next loop\r
+ $mail->ClearAddresses();\r
+ $mail->ClearAttachments();\r
+}\r
+</pre>\r
+</td>\r
+</tr>\r
+</table>\r
+<p>\r
+\r
+<h3>2. Extending phpmailer</h3>\r
+<p>\r
+\r
+Extending classes with inheritance is one of the most\r
+powerful features of object-oriented\r
+programming. It allows you to make changes to the\r
+original class for your\r
+own personal use without hacking the original\r
+classes. Plus, it is very\r
+easy to do. I've provided an example:\r
+\r
+<p>\r
+Here's a class that extends the phpmailer class and sets the defaults\r
+for the particular site:<br>\r
+PHP include file: <b>mail.inc.php</b>\r
+<p>\r
+\r
+<table cellpadding="4" border="1" width="80%">\r
+<tr>\r
+<td bgcolor="#CCCCCC">\r
+<pre>\r
+require("class.phpmailer.php");\r
+\r
+class my_phpmailer extends phpmailer {\r
+ // Set default variables for all new objects\r
+ var $From = "from@example.com";\r
+ var $FromName = "Mailer";\r
+ var $Host = "smtp1.example.com;smtp2.example.com";\r
+ var $Mailer = "smtp"; // Alternative to IsSMTP()\r
+ var $WordWrap = 75;\r
+\r
+ // Replace the default error_handler\r
+ function error_handler($msg) {\r
+ print("My Site Error");\r
+ print("Description:");\r
+ printf("%s", $msg);\r
+ exit;\r
+ }\r
+\r
+ // Create an additional function\r
+ function do_something($something) {\r
+ // Place your new code here\r
+ }\r
+}\r
+</td>\r
+</tr>\r
+</table>\r
+<br>\r
+\r
+Now here's a normal PHP page in the site, which will have all the defaults set\r
+above:<br>\r
+Normal PHP file: <b>mail_test.php</b>\r
+<p>\r
+\r
+<table cellpadding="4" border="1" width="80%">\r
+<tr>\r
+<td bgcolor="#CCCCCC">\r
+<pre>\r
+require("mail.inc.php");\r
+\r
+// Instantiate your new class\r
+$mail = new my_phpmailer;\r
+\r
+// Now you only need to add the necessary stuff\r
+$mail->AddAddress("josh@example.com", "Josh Adams");\r
+$mail->Subject = "Here is the subject";\r
+$mail->Body = "This is the message body";\r
+$mail->AddAttachment("c:/temp/11-10-00.zip", "new_name.zip"); // optional name\r
+\r
+if(!$mail->Send())\r
+{\r
+ echo "There was an error sending the message";\r
+ exit;\r
+}\r
+\r
+echo "Message was sent successfully";\r
+</pre>\r
+</td>\r
+</tr>\r
+</table>\r
+</p>\r
+\r
+</body>\r
+</html>\r
--- /dev/null
+<html>\r
+<head>\r
+<title>PHPMailer FAQ</title>\r
+<style>\r
+body, p {\r
+ font-family: Arial, Helvetica, sans-serif;\r
+ font-size: 12px;\r
+}\r
+div.width {\r
+ width: 500px;\r
+ text-align: left;\r
+}\r
+</style>\r
+</head>\r
+<body bgcolor="#FFFFFF">\r
+<center>\r
+<div class="width">\r
+<h2>PHPMailer FAQ</h2>\r
+<ul>\r
+\r
+ <li><b style="background-color: #FFFF00">Q:</b> <b>I'm using the SMTP mailer and I keep on getting a timeout message\r
+ well before the X seconds I set it for. What gives?</b><br />\r
+ <b style="background-color: #FFFF00">A:</b> PHP versions 4.0.4pl1 and earlier have a bug in which sockets timeout\r
+ early. You can fix this by re-compiling PHP 4.0.4pl1 with this fix:\r
+ <a href="timeoutfix.diff">timeoutfix.diff</a>. Otherwise you can wait for the new PHP release.<br /><br /></li>\r
+\r
+ <li><b style="background-color: #FFFF00">Q:</b> <b>I am concerned that using include files will take up too much\r
+ processing time on my computer. How can I make it run faster?</b><br />\r
+ <b style="background-color: #FFFF00">A:</b> PHP by itself is very fast. Much faster than ASP or JSP running on\r
+ the same type of server. This is because it has very little overhead compared\r
+ to its competitors and it pre-compiles all of\r
+ its code before it runs each script (in PHP4). However, all of\r
+ this compiling and re-compiling can take up a lot of valuable\r
+ computer resources. However, there are programs out there that compile\r
+ PHP code and store it in memory (or on mmaped files) to reduce the\r
+ processing immensely. Two of these: <a href="http://apc.communityconnect.com">APC\r
+ (Alternative PHP Cache)</a> and <a href="http://bwcache.bware.it/index.htm">Afterburner</a>\r
+ (<a href="http://www.mm4.de/php4win/mod_php4_win32/">Win32 download</a>)\r
+ are excellent free tools that do just this. If you have the money\r
+ you might also try <a href="http://www.zend.com">Zend Cache</a>, it is\r
+ even faster than the open source varieties. All of these tools make your\r
+ scripts run faster while also reducing the load on your server. I have tried\r
+ them myself and they are quite stable too.<br /><br /></li>\r
+\r
+ <li><b style="background-color: #FFFF00">Q:</b> <b>What mailer gives me the best performance?</b><br />\r
+ <b style="background-color: #FFFF00">A:</b> On a single machine the <b>sendmail (or Qmail)</b> is fastest overall.\r
+ Next fastest is mail() to give you the best performance. Both do not have the overhead of SMTP.\r
+ If you have you have your mail server on a another machine then\r
+ SMTP is your only option, but you do get the benefit of redundant mail servers.<br />\r
+ If you are running a mailing list with thousands of names, the fastest mailers in order are: SMTP, sendmail (or Qmail), mail().<br /><br /></li>\r
+\r
+ <li><b style="background-color: #FFFF00">Q:</b> <b>When I try to attach a file with on my server I get a\r
+ "Could not find {file} on filesystem error". Why is this?</b><br />\r
+ <b style="background-color: #FFFF00">A:</b> If you are using a Unix machine this is probably because the user\r
+ running your web server does not have read access to the directory in question. If you are using Windows,\r
+ then the problem probably is that you have used single backslashes to denote directories (\).\r
+ A single backslash has a special meaning to PHP so these are not\r
+ valid. Instead use double backslashes ("\\") or a single forward\r
+ slash ("/").<br /><br /></li>\r
+\r
+</ul>\r
+\r
+</div>\r
+</center>\r
+\r
+</body>\r
+</html>\r
--- /dev/null
+This is built for PHP Mailer 1.72 and was not tested with any previous version. It was developed under PHP 4.3.11 (E_ALL). It works under PHP 5 and 5.1 with E_ALL, but not in Strict mode due to var deprecation (but then neither does PHP Mailer either!). It follows the RFC 1939 standard explicitly and is fully commented.\r
+\r
+With that noted, here is how to implement it:\r
+Install the class file\r
+\r
+I didn't want to modify the PHP Mailer classes at all, so you will have to include/require this class along with the base one. It can sit quite happily in the phpmailer-1.72 directory:\r
+[geshi lang=php] require 'phpmailer-1.72/class.phpmailer.php'; require 'phpmailer-1.72/class.pop3.php'; [/geshi]\r
+When you need it, create your POP3 object\r
+\r
+Right before I invoke PHP Mailer I activate the POP3 authorisation. POP3 before SMTP is a process whereby you login to your web hosts POP3 mail server BEFORE sending out any emails via SMTP. The POP3 logon 'verifies' your ability to send email by SMTP, which typically otherwise blocks you. On my web host (Pair Networks) a single POP3 logon is enough to 'verify' you for 90 minutes. Here is some sample PHP code that activates the POP3 logon and then sends an email via PHP Mailer:\r
+[geshi lang=php] Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1); $mail = new PHPMailer(); $mail->SMTPDebug = 2; $mail->IsSMTP(); $mail->IsHTML(false); $mail->Host = 'relay.example.com'; $mail->From = 'mailer@example.com'; $mail->FromName = 'Example Mailer'; $mail->Subject = 'My subject'; $mail->Body = 'Hello world'; $mail->AddAddress('rich@corephp.co.uk', 'Richard Davey'); if (!$mail->Send()) { echo $mail->ErrorInfo; } ?> [/geshi]\r
+\r
+The PHP Mailer parts of this code should be obvious to anyone who has used PHP Mailer before. One thing to note - you almost certainly will not need to use SMTP Authentication *and* POP3 before SMTP together. The Authorisation method is a proxy method to all of the others within that class. There are Connect, Logon and Disconnect methods available, but I wrapped them in the single Authorisation one to make things easier.\r
+The Parameters\r
+\r
+The Authorise parameters are as follows:\r
+[geshi lang=php]$pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);[/geshi]\r
+\r
+ 1. pop3.example.com - The POP3 Mail Server Name (hostname or IP address)\r
+ 2. 110 - The POP3 Port on which to connect (default is usually 110, but check with your host)\r
+ 3. 30 - A connection time-out value (in seconds)\r
+ 4. mailer - The POP3 Username required to logon\r
+ 5. password - The POP3 Password required to logon\r
+ 6. 1 - The class debug level (0 = off, 1+ = debug output is echoed to the browser)\r
+\r
+Final Comments + the Download\r
+\r
+1) This class does not support APOP connections. This is only because I did not have an APOP server to test with, but if you'd like to see that added just contact me.\r
+\r
+2) Opening and closing lots of POP3 connections can be quite a resource/network drain. If you need to send a whole batch of emails then just perform the authentication once at the start, and then loop through your mail sending script. Providing this process doesn't take longer than the verification period lasts on your POP3 server, you should be fine. With my host that period is 90 minutes, i.e. plenty of time.\r
+\r
+3) If you have heavy requirements for this script (i.e. send a LOT of email on a frequent basis) then I would advise seeking out an alternative sending method (direct SMTP ideally). If this isn't possible then you could modify this class so the 'last authorised' date is recorded somewhere (MySQL, Flat file, etc) meaning you only open a new connection if the old one has expired, saving you precious overhead.\r
+\r
+4) There are lots of other POP3 classes for PHP available. However most of them implement the full POP3 command set, where-as this one is purely for authentication, and much lighter as a result. However using any of the other POP3 classes to just logon to your server would have the same net result. At the end of the day, use whatever method you feel most comfortable with.\r
+Download\r
+\r
+Here is the full class file plus my test script: POP_before_SMTP_PHPMailer.zip (4 KB) - Please note that it does not include PHPMailer itself.\r
+\r
+My thanks to Chris Ryan for the inspiration (even if indirectly, via his SMTP class)\r
--- /dev/null
+<?php\r
+\r
+// example on using PHPMailer with GMAIL\r
+\r
+include("class.phpmailer.php");\r
+include("class.smtp.php"); // note, this is optional - gets called from main class if not already loaded\r
+\r
+$mail = new PHPMailer();\r
+\r
+$body = $mail->getFile('contents.html');\r
+$body = eregi_replace("[\]",'',$body);\r
+\r
+$mail->IsSMTP();\r
+$mail->SMTPAuth = true; // enable SMTP authentication\r
+$mail->SMTPSecure = "ssl"; // sets the prefix to the servier\r
+$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server\r
+$mail->Port = 465; // set the SMTP port\r
+\r
+$mail->Username = "yourname@gmail.com"; // GMAIL username\r
+$mail->Password = "password"; // GMAIL password\r
+\r
+$mail->From = "replyto@yourdomain.com";\r
+$mail->FromName = "Webmaster";\r
+$mail->Subject = "This is the subject";\r
+$mail->AltBody = "This is the body when user views in plain text format"; //Text Body\r
+$mail->WordWrap = 50; // set word wrap\r
+\r
+$mail->MsgHTML($body);\r
+\r
+$mail->AddReplyTo("replyto@yourdomain.com","Webmaster");\r
+\r
+$mail->AddAttachment("/path/to/file.zip"); // attachment\r
+$mail->AddAttachment("/path/to/image.jpg", "new.jpg"); // attachment\r
+\r
+$mail->AddAddress("username@domain.com","First Last");\r
+\r
+$mail->IsHTML(true); // send as HTML\r
+\r
+if(!$mail->Send()) {\r
+ echo "Mailer Error: " . $mail->ErrorInfo;\r
+} else {\r
+ echo "Message has been sent";\r
+}\r
+\r
+?>\r
--- /dev/null
+<body background="images/bkgrnd.gif" style="margin: 0px;">\r
+<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;">\r
+<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br>\r
+<br>\r
+ This is a test of PHPMailer v2.0.0 rc1.<br>\r
+<br>\r
+This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br>\r
+styles.<br>\r
+<br>\r
+Also note the use of the PHPMailer at the top with no specific code to handle\r
+including it in the body of the email.</div>\r
+</body>\r
--- /dev/null
+<p>The example file "test_mail.php" contents include:</p>\r
+<div style="width: 600px; background-color: #CCCCCC;">\r
+<code>\r
+<?php<br>\r
+<br>\r
+include_once('../class.phpmailer.php');<br>\r
+<br>\r
+$mail = new PHPMailer();<br>\r
+<br>\r
+$body = $mail->getFile('contents.html');<br>\r
+<br>\r
+$body = eregi_replace("[\]",'',$body);<br>\r
+$subject = eregi_replace("[\]",'',$subject);<br>\r
+<br>\r
+$mail->From = "name@yourdomain.com";<br>\r
+$mail->FromName = "First Last";<br>\r
+<br>\r
+$mail->Subject = "PHPMailer Test Subject";<br>\r
+<br>\r
+$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test<br>\r
+<br>\r
+$mail->MsgHTML($body);<br>\r
+<br>\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");<br>\r
+<br>\r
+if(!$mail->Send()) {<br>\r
+ echo 'Failed to send mail';<br>\r
+} else {<br>\r
+ echo 'Mail sent';<br>\r
+}<br>\r
+<br>\r
+?>\r
+</code>\r
+</div>\r
+<br>\r
+Although you could use full compabitility with PHPMailer 1.7.3, this example\r
+shows how to use the new features. If you view 'contents.html', you will note\r
+that there is a background image used in the <body tag as well as an image used\r
+with a regular <img tag. Here's what the HTML file looks like:<br>\r
+<br>\r
+<div style="width: 600px; background-color: #CCCCCC;">\r
+<code>\r
+<body background="images/bkgrnd.gif" style="margin: 0px;"><br>\r
+<div style="width: 640px; font-family: Arial, Helvetica, sans-serif; font-size: 11px;"><br>\r
+<div align="center"><img src="images/phpmailer.gif" style="height: 90px; width: 340px"></div><br><br>\r
+<br><br>\r
+ This is a test of PHPMailer v2.0.0 rc1.<br><br>\r
+<br><br>\r
+This particular example uses <strong>HTML</strong>, with a <div> tag and inline<br><br>\r
+styles.<br><br>\r
+<br><br>\r
+Also note the use of the PHPMailer at the top with no specific code to handle<br>\r
+including it in the body of the email.</div><br>\r
+</body><br>\r
+</code>\r
+</div>\r
+<br>\r
+A few things to notice in the PHP script that generates the email:\r
+<ul>\r
+ <li>the use of $mail->AltBody is completely optional. If not used, PHPMailer\r
+ will use the HTML text with htmlentities().</li>\r
+ <li>the background= and <img src= images were processed without any directives\r
+ or methods from the PHP script</li>\r
+ <li>there is no specific code to define the image type ... that is handled\r
+ automatically by PHPMailer when it parses the images</li>\r
+ <li>we are using a new class method '$mail->MsgHTML($body)' ... that is what will handle the parsing of the images and creating the AltBody text</li>\r
+</ul>\r
+<p>Of course, you can still use PHPMailer the same way you have in the past.\r
+That provides full compatibility with all existing scripts, while new scripts\r
+can take advantage of the new features.</p>\r
+<p>Modify test_mail.php now with your own email address and try it out.</p>\r
+To see what the email SHOULD look like in your HTML compatible email viewer: <a href="contents.html">click here</a><br>\r
+\r
--- /dev/null
+<html>\r
+<head>\r
+<title>POP before SMTP Test</title>\r
+</head>\r
+\r
+<body>\r
+\r
+<pre>\r
+<?php\r
+ require 'class.phpmailer.php';\r
+ require 'class.pop3.php';\r
+\r
+ $pop = new POP3();\r
+ $pop->Authorise('pop3.example.com', 110, 30, 'mailer', 'password', 1);\r
+\r
+ $mail = new PHPMailer();\r
+\r
+ $mail->IsSMTP();\r
+ $mail->SMTPDebug = 2;\r
+ $mail->IsHTML(false);\r
+\r
+ $mail->Host = 'relay.example.com';\r
+\r
+ $mail->From = 'mailer@example.com';\r
+ $mail->FromName = 'Example Mailer';\r
+\r
+ $mail->Subject = 'My subject';\r
+ $mail->Body = 'Hello world';\r
+ $mail->AddAddress('name@anydomain.com', 'First Last');\r
+\r
+ if (!$mail->Send())\r
+ {\r
+ echo $mail->ErrorInfo;\r
+ }\r
+?>\r
+</pre>\r
+\r
+</body>\r
+</html>\r
--- /dev/null
+<?php\r
+\r
+//error_reporting(E_ALL);\r
+error_reporting(E_STRICT);\r
+\r
+date_default_timezone_set('America/Toronto');\r
+\r
+include("class.phpmailer.php");\r
+//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded\r
+\r
+$mail = new PHPMailer();\r
+\r
+$body = $mail->getFile('contents.html');\r
+$body = eregi_replace("[\]",'',$body);\r
+\r
+$mail->IsSMTP();\r
+$mail->SMTPAuth = true; // enable SMTP authentication\r
+$mail->SMTPSecure = "ssl"; // sets the prefix to the servier\r
+$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server\r
+$mail->Port = 465; // set the SMTP port for the GMAIL server\r
+\r
+$mail->Username = "yourusername@gmail.com"; // GMAIL username\r
+$mail->Password = "yourpassword"; // GMAIL password\r
+\r
+$mail->AddReplyTo("yourusername@gmail.com","First Last");\r
+\r
+$mail->From = "name@yourdomain.com";\r
+$mail->FromName = "First Last";\r
+\r
+$mail->Subject = "PHPMailer Test Subject via gmail";\r
+\r
+//$mail->Body = "Hi,<br>This is the HTML BODY<br>"; //HTML Body\r
+$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
+$mail->WordWrap = 50; // set word wrap\r
+\r
+$mail->MsgHTML($body);\r
+\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
+\r
+$mail->AddAttachment("images/phpmailer.gif"); // attachment\r
+\r
+$mail->IsHTML(true); // send as HTML\r
+\r
+if(!$mail->Send()) {\r
+ echo "Mailer Error: " . $mail->ErrorInfo;\r
+} else {\r
+ echo "Message sent!";\r
+}\r
+\r
+?>\r
--- /dev/null
+<?php\r
+\r
+include_once('../class.phpmailer.php');\r
+\r
+$mail = new PHPMailer(); // defaults to using php "mail()"\r
+\r
+$body = $mail->getFile('contents.html');\r
+$body = eregi_replace("[\]",'',$body);\r
+\r
+$mail->From = "name@yourdomain.com";\r
+$mail->FromName = "First Last";\r
+\r
+$mail->Subject = "PHPMailer Test Subject via mail()";\r
+\r
+$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
+\r
+$mail->MsgHTML($body);\r
+\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
+\r
+$mail->AddAttachment("images/phpmailer.gif"); // attachment\r
+\r
+if(!$mail->Send()) {\r
+ echo "Mailer Error: " . $mail->ErrorInfo;\r
+} else {\r
+ echo "Message sent!";\r
+}\r
+\r
+?>\r
--- /dev/null
+<?php\r
+\r
+//error_reporting(E_ALL);\r
+error_reporting(E_STRICT);\r
+\r
+\r
+date_default_timezone_set('America/Toronto');\r
+//date_default_timezone_set(date_default_timezone_get());\r
+\r
+include_once('class.phpmailer.php');\r
+\r
+$mail = new PHPMailer();\r
+$body = $mail->getFile('contents.html');\r
+$body = eregi_replace("[\]",'',$body);\r
+\r
+$mail->IsSendmail(); // telling the class to use SendMail transport\r
+\r
+$mail->From = "name@yourdomain.com";\r
+$mail->FromName = "First Last";\r
+\r
+$mail->Subject = "PHPMailer Test Subject via smtp";\r
+\r
+$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
+\r
+$mail->MsgHTML($body);\r
+\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
+\r
+$mail->AddAttachment("images/phpmailer.gif"); // attachment\r
+\r
+if(!$mail->Send()) {\r
+ echo "Mailer Error: " . $mail->ErrorInfo;\r
+} else {\r
+ echo "Message sent!";\r
+}\r
+\r
+?>\r
--- /dev/null
+<?php\r
+\r
+//error_reporting(E_ALL);\r
+error_reporting(E_STRICT);\r
+\r
+date_default_timezone_set('America/Toronto');\r
+//date_default_timezone_set(date_default_timezone_get());\r
+\r
+include_once('class.phpmailer.php');\r
+//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded\r
+\r
+$mail = new PHPMailer();\r
+\r
+$body = $mail->getFile('contents.html');\r
+$body = eregi_replace("[\]",'',$body);\r
+\r
+$mail->IsSMTP(); // telling the class to use SMTP\r
+$mail->Host = "mail.worxteam.com"; // SMTP server\r
+\r
+$mail->From = "name@yourdomain.com";\r
+$mail->FromName = "First Last";\r
+\r
+$mail->Subject = "PHPMailer Test Subject via smtp";\r
+\r
+$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test\r
+\r
+$mail->MsgHTML($body);\r
+\r
+$mail->AddAddress("whoto@otherdomain.com", "John Doe");\r
+\r
+$mail->AddAttachment("images/phpmailer.gif"); // attachment\r
+\r
+if(!$mail->Send()) {\r
+ echo "Mailer Error: " . $mail->ErrorInfo;\r
+} else {\r
+ echo "Message sent!";\r
+}\r
+\r
+?>\r
--- /dev/null
+Deny from all
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Portuguese Version
+ * By Paulo Henrique Garcia - paulo@controllerweb.com.br
+ */
+
+$PHPMAILER_LANG = array();
+$PHPMAILER_LANG["provide_address"] = 'Você deve fornecer pelo menos um endereço de destinatário de email.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer não suportado.';
+$PHPMAILER_LANG["execute"] = 'Não foi possível executar: ';
+$PHPMAILER_LANG["instantiate"] = 'Não foi possível instanciar a função mail.';
+$PHPMAILER_LANG["authenticate"] = 'Erro de SMTP: Não foi possível autenticar.';
+$PHPMAILER_LANG["from_failed"] = 'Os endereços de rementente a seguir falharam: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Erro de SMTP: Os endereços de destinatário a seguir falharam: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Erro de SMTP: Dados não aceitos.';
+$PHPMAILER_LANG["connect_host"] = 'Erro de SMTP: Não foi possível conectar com o servidor SMTP.';
+$PHPMAILER_LANG["file_access"] = 'Não foi possível acessar o arquivo: ';
+$PHPMAILER_LANG["file_open"] = 'Erro de Arquivo: Não foi possível abrir o arquivo: ';
+$PHPMAILER_LANG["encoding"] = 'Codificação desconhecida: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
+
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Catalan Version
+ * By Ivan: web AT microstudi DOT com
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'S\'ha de proveir almenys una adreça d\'email com a destinatari.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer no està suportat';
+$PHPMAILER_LANG["execute"] = 'No es pot executar: ';
+$PHPMAILER_LANG["instantiate"] = 'No s\'ha pogut crear una instància de la funció Mail.';
+$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No s\'hapogut autenticar.';
+$PHPMAILER_LANG["from_failed"] = 'La(s) següent(s) adreces de remitent han fallat: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Els següents destinataris han fallat: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Dades no acceptades.';
+$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No es pot connectar al servidor SMTP.';
+$PHPMAILER_LANG["file_access"] = 'No es pot accedir a l\'arxiu: ';
+$PHPMAILER_LANG["file_open"] = 'Error d\'Arxiu: No es pot obrir l\'arxiu: ';
+$PHPMAILER_LANG["encoding"] = 'Codificació desconeguda: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Czech Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Musíte zadat alespoò jednu ' .
+ 'emailovou adresu pøíjemce.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailový klient není podporován.';
+$PHPMAILER_LANG["execute"] = 'Nelze provést: ';
+$PHPMAILER_LANG["instantiate"] = 'Nelze vytvoøit instanci emailové funkce.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Chyba autentikace.';
+$PHPMAILER_LANG["from_failed"] = 'Následující adresa From je nesprávná: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: Adresy pøíjemcù ' .
+ 'nejsou správné ' .
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data nebyla pøijata';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Nelze navázat spojení se ' .
+ ' SMTP serverem.';
+$PHPMAILER_LANG["file_access"] = 'Soubor nenalezen: ';
+$PHPMAILER_LANG["file_open"] = 'File Error: Nelze otevøít soubor pro ètení: ';
+$PHPMAILER_LANG["encoding"] = 'Neznámé kódování: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * German Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Bitte geben Sie mindestens eine ' .
+ 'Empfänger Emailadresse an.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wird nicht unterstützt.';
+$PHPMAILER_LANG["execute"] = 'Konnte folgenden Befehl nicht ausführen: ';
+$PHPMAILER_LANG["instantiate"] = 'Mail Funktion konnte nicht initialisiert werden.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Fehler: Authentifizierung fehlgeschlagen.';
+$PHPMAILER_LANG["from_failed"] = 'Die folgende Absenderadresse ist nicht korrekt: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fehler: Die folgenden ' .
+ 'Empfänger sind nicht korrekt: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fehler: Daten werden nicht akzeptiert.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Fehler: Konnte keine Verbindung zum SMTP-Host herstellen.';
+$PHPMAILER_LANG["file_access"] = 'Zugriff auf folgende Datei fehlgeschlagen: ';
+$PHPMAILER_LANG["file_open"] = 'Datei Fehler: konnte folgende Datei nicht öffnen: ';
+$PHPMAILER_LANG["encoding"] = 'Unbekanntes Encoding-Format: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
+
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Danish Version
+ * Author: Mikael Stokkebro <info@stokkebro.dk>
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Du skal indtaste mindst en ' .
+ 'modtagers emailadresse.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer understøttes ikke.';
+$PHPMAILER_LANG["execute"] = 'Kunne ikke køre: ';
+$PHPMAILER_LANG["instantiate"] = 'Kunne ikke initialisere email funktionen.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP fejl: Kunne ikke logge på.';
+$PHPMAILER_LANG["from_failed"] = 'Følgende afsenderadresse er forkert: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP fejl: Følgende' .
+ 'modtagere er forkerte: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fejl: Data kunne ikke accepteres.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.';
+$PHPMAILER_LANG["file_access"] = 'Ingen adgang til fil: ';
+$PHPMAILER_LANG["file_open"] = 'Fil fejl: Kunne ikke åbne filen: ';
+$PHPMAILER_LANG["encoding"] = 'Ukendt encode-format: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * English Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'You must provide at least one ' .
+ 'recipient email address.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer is not supported.';
+$PHPMAILER_LANG["execute"] = 'Could not execute: ';
+$PHPMAILER_LANG["instantiate"] = 'Could not instantiate mail function.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Could not authenticate.';
+$PHPMAILER_LANG["from_failed"] = 'The following From address failed: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: The following ' .
+ 'recipients failed: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data not accepted.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Could not connect to SMTP host.';
+$PHPMAILER_LANG["file_access"] = 'Could not access file: ';
+$PHPMAILER_LANG["file_open"] = 'File Error: Could not open file: ';
+$PHPMAILER_LANG["encoding"] = 'Unknown encoding: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Versión en español
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Debe proveer al menos una ' .
+ 'dirección de email como destinatario.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer no está soportado.';
+$PHPMAILER_LANG["execute"] = 'No puedo ejecutar: ';
+$PHPMAILER_LANG["instantiate"] = 'No pude crear una instancia de la función Mail.';
+$PHPMAILER_LANG["authenticate"] = 'Error SMTP: No se pudo autentificar.';
+$PHPMAILER_LANG["from_failed"] = 'La(s) siguiente(s) direcciones de remitente fallaron: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Error SMTP: Los siguientes ' .
+ 'destinatarios fallaron: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Error SMTP: Datos no aceptados.';
+$PHPMAILER_LANG["connect_host"] = 'Error SMTP: No puedo conectar al servidor SMTP.';
+$PHPMAILER_LANG["file_access"] = 'No puedo acceder al archivo: ';
+$PHPMAILER_LANG["file_open"] = 'Error de Archivo: No puede abrir el archivo: ';
+$PHPMAILER_LANG["encoding"] = 'Codificación desconocida: ';
+$PHPMAILER_LANG["signing"] = 'Error al firmar: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Estonian Version
+ * By Indrek Päri
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' maileri tugi puudub.';
+$PHPMAILER_LANG["execute"] = 'Tegevus ebaõnnestus: ';
+$PHPMAILER_LANG["instantiate"] = 'mail funktiooni käivitamine ebaõnnestus.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Viga: Autoriseerimise viga.';
+$PHPMAILER_LANG["from_failed"] = 'Järgnev saatja e-posti aadress on vigane: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Viga: Vigased andmed.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.';
+$PHPMAILER_LANG["file_access"] = 'Pole piisavalt õiguseid järgneva faili avamiseks: ';
+$PHPMAILER_LANG["file_open"] = 'Faili Viga: Faili avamine ebaõnnestus: ';
+$PHPMAILER_LANG["encoding"] = 'Tundmatu Unknown kodeering: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Finnish Version
+ * By Jyry Kuukanen
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Aseta vähintään yksi vastaanottajan ' .
+ 'sähköpostiosoite.';
+$PHPMAILER_LANG["mailer_not_supported"] = 'postivälitintyyppiä ei tueta.';
+$PHPMAILER_LANG["execute"] = 'Suoritus epäonnistui: ';
+$PHPMAILER_LANG["instantiate"] = 'mail-funktion luonti epäonnistui.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP-virhe: käyttäjätunnistus epäonnistui.';
+$PHPMAILER_LANG["from_failed"] = 'Seuraava lähettäjän osoite on virheellinen: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP-virhe: data on virheellinen.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP-virhe: yhteys palvelimeen ei onnistu.';
+$PHPMAILER_LANG["file_access"] = 'Seuraavaan tiedostoon ei ole oikeuksia: ';
+$PHPMAILER_LANG["file_open"] = 'Tiedostovirhe: Ei voida avata tiedostoa: ';
+$PHPMAILER_LANG["encoding"] = 'Tuntematon koodaustyyppi: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Faroese Version [language of the Faroe Islands, a Danish dominion]
+ * This file created: 11-06-2004
+ * Supplied by Dávur Sørensen [www.profo-webdesign.dk]
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Tú skal uppgeva minst ' .
+ 'móttakara-emailadressu(r).';
+$PHPMAILER_LANG["mailer_not_supported"] = ' er ikki supporterað.';
+$PHPMAILER_LANG["execute"] = 'Kundi ikki útføra: ';
+$PHPMAILER_LANG["instantiate"] = 'Kuni ikki instantiera mail funktión.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP feilur: Kundi ikki góðkenna.';
+$PHPMAILER_LANG["from_failed"] = 'fylgjandi Frá/From adressa miseydnaðist: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feilur: Fylgjandi ' .
+ 'móttakarar miseydnaðust: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP feilur: Data ikki góðkent.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.';
+$PHPMAILER_LANG["file_access"] = 'Kundi ikki tilganga fílu: ';
+$PHPMAILER_LANG["file_open"] = 'Fílu feilur: Kundi ikki opna fílu: ';
+$PHPMAILER_LANG["encoding"] = 'Ókend encoding: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * French Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Vous devez fournir au moins une ' .
+ 'adresse de destinataire.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' client de messagerie non supporté.';
+$PHPMAILER_LANG["execute"] = 'Impossible de lancer l\'exécution : ';
+$PHPMAILER_LANG["instantiate"] = 'Impossible d\'instancier la fonction mail.';
+$PHPMAILER_LANG["authenticate"] = 'Erreur SMTP : Echec de l\'authentification.';
+$PHPMAILER_LANG["from_failed"] = 'L\'adresse d\'expéditeur suivante a échouée : ';
+$PHPMAILER_LANG["recipients_failed"] = 'Erreur SMTP : Les destinataires ' .
+ 'suivants sont en erreur : ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Erreur SMTP : Données incorrects.';
+$PHPMAILER_LANG["connect_host"] = 'Erreur SMTP : Impossible de se connecter au serveur SMTP.';
+$PHPMAILER_LANG["file_access"] = 'Impossible d\'accéder au fichier : ';
+$PHPMAILER_LANG["file_open"] = 'Erreur Fichier : ouverture impossible : ';
+$PHPMAILER_LANG["encoding"] = 'Encodage inconnu : ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
+
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Hungarian Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Meg kell adnod legalább egy ' .
+ 'címzett email címet.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' levelezõ nem támogatott.';
+$PHPMAILER_LANG["execute"] = 'Nem tudtam végrehajtani: ';
+$PHPMAILER_LANG["instantiate"] = 'Nem sikerült példányosítani a mail funkciót.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Hiba: Sikertelen autentikáció.';
+$PHPMAILER_LANG["from_failed"] = 'Az alábbi Feladó cím hibás: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Hiba: Az alábbi ' .
+ 'címzettek hibásak: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Hiba: Nem elfogadható adat.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Hiba: Nem tudtam csatlakozni az SMTP host-hoz.';
+$PHPMAILER_LANG["file_access"] = 'Nem sikerült elérni a következõ fájlt: ';
+$PHPMAILER_LANG["file_open"] = 'Fájl Hiba: Nem sikerült megnyitni a következõ fájlt: ';
+$PHPMAILER_LANG["encoding"] = 'Ismeretlen kódolás: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+* PHPMailer language file.
+* Italian version
+* @package PHPMailer
+* @author Ilias Bartolini <brain79@inwind.it>
+*/
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Deve essere fornito almeno un'.
+ ' indirizzo ricevente';
+$PHPMAILER_LANG["mailer_not_supported"] = 'Mailer non supportato';
+$PHPMAILER_LANG["execute"] = "Impossibile eseguire l'operazione: ";
+$PHPMAILER_LANG["instantiate"] = 'Impossibile istanziare la funzione mail';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Error: Impossibile autenticarsi.';
+$PHPMAILER_LANG["from_failed"] = 'I seguenti indirizzi mittenti hanno'.
+ ' generato errore: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Error: I seguenti indirizzi'.
+ 'destinatari hanno generato errore: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Error: Data non accettati dal'.
+ 'server.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Error: Impossibile connettersi'.
+ ' all\'host SMTP.';
+$PHPMAILER_LANG["file_access"] = 'Impossibile accedere al file: ';
+$PHPMAILER_LANG["file_open"] = 'File Error: Impossibile aprire il file: ';
+$PHPMAILER_LANG["encoding"] = 'Encoding set dei caratteri sconosciuto: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Dutch Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Er moet tenmiste één ' .
+ 'ontvanger emailadres opgegeven worden.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer wordt niet ondersteund.';
+$PHPMAILER_LANG["execute"] = 'Kon niet uitvoeren: ';
+$PHPMAILER_LANG["instantiate"] = 'Kon mail functie niet initialiseren.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Fout: authenticatie mislukt.';
+$PHPMAILER_LANG["from_failed"] = 'De volgende afzender adressen zijn mislukt: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Fout: De volgende ' .
+ 'ontvangers zijn mislukt: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Fout: Data niet geaccepteerd.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Fout: Kon niet verbinden met SMTP host.';
+$PHPMAILER_LANG["file_access"] = 'Kreeg geen toegang tot bestand: ';
+$PHPMAILER_LANG["file_open"] = 'Bestandsfout: Kon bestand niet openen: ';
+$PHPMAILER_LANG["encoding"] = 'Onbekende codering: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Norwegian Version
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Du må ha med minst en' .
+ 'mottager adresse.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer er ikke supportert.';
+$PHPMAILER_LANG["execute"] = 'Kunne ikke utføre: ';
+$PHPMAILER_LANG["instantiate"] = 'Kunne ikke instantiate mail funksjonen.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Feil: Kunne ikke authentisere.';
+$PHPMAILER_LANG["from_failed"] = 'Følgende Fra feilet: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Feil: Følgende' .
+ 'mottagere feilet: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Feil: Data ble ikke akseptert.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Feil: Kunne ikke koble til SMTP host.';
+$PHPMAILER_LANG["file_access"] = 'Kunne ikke få tilgang til filen: ';
+$PHPMAILER_LANG["file_open"] = 'Fil feil: Kunne ikke åpne filen: ';
+$PHPMAILER_LANG["encoding"] = 'Ukjent encoding: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Polish Version, encoding: windows-1250
+ * translated from english lang file ver. 1.72
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Nale¿y podaæ prawid³owy adres email Odbiorcy.';
+$PHPMAILER_LANG["mailer_not_supported"] = 'Wybrana metoda wysy³ki wiadomoœci nie jest obs³ugiwana.';
+$PHPMAILER_LANG["execute"] = 'Nie mo¿na uruchomiæ: ';
+$PHPMAILER_LANG["instantiate"] = 'Nie mo¿na wywo³aæ funkcji mail(). SprawdŸ konfiguracjê serwera.';
+$PHPMAILER_LANG["authenticate"] = 'B³¹d SMTP: Nie mo¿na przeprowadziæ autentykacji.';
+$PHPMAILER_LANG["from_failed"] = 'Nastêpuj¹cy adres Nadawcy jest jest nieprawid³owy: ';
+$PHPMAILER_LANG["recipients_failed"] = 'B³¹d SMTP: Nastêpuj¹cy ' .
+ 'odbiorcy s¹ nieprawid³owi: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'B³¹d SMTP: Dane nie zosta³y przyjête.';
+$PHPMAILER_LANG["connect_host"] = 'B³¹d SMTP: Nie mo¿na po³¹czyæ siê z wybranym hostem.';
+$PHPMAILER_LANG["file_access"] = 'Brak dostêpu do pliku: ';
+$PHPMAILER_LANG["file_open"] = 'Nie mo¿na otworzyæ pliku: ';
+$PHPMAILER_LANG["encoding"] = 'Nieznany sposób kodowania znaków: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Romanian Version
+ * @package PHPMailer
+ * @author Catalin Constantin <catalin@dazoot.ro>
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Trebuie sa adaugati cel putin un recipient (adresa de mail).';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer nu este suportat.';
+$PHPMAILER_LANG["execute"] = 'Nu pot executa: ';
+$PHPMAILER_LANG["instantiate"] = 'Nu am putut instantia functia mail.';
+$PHPMAILER_LANG["authenticate"] = 'Eroare SMTP: Nu a functionat autentificarea.';
+$PHPMAILER_LANG["from_failed"] = 'Urmatoarele adrese From au dat eroare: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Eroare SMTP: Urmatoarele adrese de mail au dat eroare: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Eroare SMTP: Continutul mailului nu a fost acceptat.';
+$PHPMAILER_LANG["connect_host"] = 'Eroare SMTP: Nu m-am putut conecta la adresa SMTP.';
+$PHPMAILER_LANG["file_access"] = 'Nu pot accesa fisierul: ';
+$PHPMAILER_LANG["file_open"] = 'Eroare de fisier: Nu pot deschide fisierul: ';
+$PHPMAILER_LANG["encoding"] = 'Encodare necunoscuta: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Russian Version by Alexey Chumakov <alex@chumakov.ru>
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Ïîæàëóéñòà, ââåäèòå õîòÿ áû îäèí àäðåñ e-mail ' .
+ 'ïîëó÷àòåëÿ.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' - ïî÷òîâûé ñåðâåð íå ïîääåðæèâàåòñÿ.';
+$PHPMAILER_LANG["execute"] = 'Íåâîçìîæíî âûïîëíèòü êîìàíäó: ';
+$PHPMAILER_LANG["instantiate"] = 'Íåâîçìîæíî çàïóñòèòü ôóíêöèþ mail.';
+$PHPMAILER_LANG["authenticate"] = 'Îøèáêà SMTP: îøèáêà àâòîðèçàöèè.';
+$PHPMAILER_LANG["from_failed"] = 'Íåâåðíûé àäðåñ îòïðàâèòåëÿ: ';
+$PHPMAILER_LANG["recipients_failed"] = 'Îøèáêà SMTP: îòïðàâêà ïî ñëåäóþùèì ' .
+ 'àäðåñàì ïîëó÷àòåëåé íå óäàëàñü: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'Îøèáêà SMTP: äàííûå íå ïðèíÿòû.';
+$PHPMAILER_LANG["connect_host"] = 'Îøèáêà SMTP: íå óäàåòñÿ ïîäêëþ÷èòüñÿ ê ñåðâåðó SMTP.';
+$PHPMAILER_LANG["file_access"] = 'Íåò äîñòóïà ê ôàéëó: ';
+$PHPMAILER_LANG["file_open"] = 'Ôàéëîâàÿ îøèáêà: íå óäàåòñÿ îòêðûòü ôàéë: ';
+$PHPMAILER_LANG["encoding"] = 'Íåèçâåñòíûé âèä êîäèðîâêè: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
+
--- /dev/null
+<?php
+/**
+ * PHPMailer language file.
+ * Swedish Version
+ * Author: Johan Linnér <johan@linner.biz>
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'Du måste ange minst en ' .
+ 'mottagares e-postadress.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailer stöds inte.';
+$PHPMAILER_LANG["execute"] = 'Kunde inte köra: ';
+$PHPMAILER_LANG["instantiate"] = 'Kunde inte initiera e-postfunktion.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP fel: Kunde inte autentisera.';
+$PHPMAILER_LANG["from_failed"] = 'Följande avsändaradress är felaktig: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP fel: Följande ' .
+ 'mottagare är felaktig: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP fel: Data accepterades inte.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP fel: Kunde inte ansluta till SMTP-server.';
+$PHPMAILER_LANG["file_access"] = 'Ingen åtkomst till fil: ';
+$PHPMAILER_LANG["file_open"] = 'Fil fel: Kunde inte öppna fil: ';
+$PHPMAILER_LANG["encoding"] = 'Okänt encode-format: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?php
+/**
+ * PHPMailer dil dosyasý.
+ * Türkçe Versiyonu
+ * ÝZYAZILIM - Elçin Özel - Can Yýlmaz - Mehmet Benlioðlu
+ */
+
+$PHPMAILER_LANG = array();
+
+$PHPMAILER_LANG["provide_address"] = 'En az bir tane mail adresi belirtmek zorundasýnýz ' .
+ 'alýcýnýn email adresi.';
+$PHPMAILER_LANG["mailer_not_supported"] = ' mailler desteklenmemektedir.';
+$PHPMAILER_LANG["execute"] = 'Çalýþtýrýlamýyor: ';
+$PHPMAILER_LANG["instantiate"] = 'Örnek mail fonksiyonu yaratýlamadý.';
+$PHPMAILER_LANG["authenticate"] = 'SMTP Hatasý: Doðrulanamýyor.';
+$PHPMAILER_LANG["from_failed"] = 'Baþarýsýz olan gönderici adresi: ';
+$PHPMAILER_LANG["recipients_failed"] = 'SMTP Hatasý: ' .
+ 'alýcýlara ulaþmadý: ';
+$PHPMAILER_LANG["data_not_accepted"] = 'SMTP Hatasý: Veri kabul edilmedi.';
+$PHPMAILER_LANG["connect_host"] = 'SMTP Hatasý: SMTP hosta baðlanýlamýyor.';
+$PHPMAILER_LANG["file_access"] = 'Dosyaya eriþilemiyor: ';
+$PHPMAILER_LANG["file_open"] = 'Dosya Hatasý: Dosya açýlamýyor: ';
+$PHPMAILER_LANG["encoding"] = 'Bilinmeyen þifreleme: ';
+$PHPMAILER_LANG["signing"] = 'Signing Error: ';
+
+?>
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title>Docs For Class PHPMailer</title>
+ <link rel="stylesheet" href="../media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <div class="page-body">
+<h2 class="class-name">Class PHPMailer</h2>
+
+<a name="sec-description"></a>
+<div class="info-box">
+ <div class="info-box-title">Description</div>
+ <div class="nav-bar">
+ <span class="disabled">Description</span> |
+ <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
+ | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
+
+ </div>
+ <div class="info-box-body">
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">PHPMailer - PHP email transport class</p>
+ <ul class="tags">
+ <li><span class="field">copyright:</span> <p>2001 - 2003 Brent R. Matzelle</p></li>
+ <li><span class="field">author:</span> <p>Brent R. Matzelle</p></li>
+ </ul>
+ <p class="notes">
+ Located in <a class="field" href="_class_phpmailer_php.html">Program_Root/class.phpmailer.php</a> (line <span class="field">20</span>)
+ </p>
+
+
+ <pre></pre>
+
+ </div>
+</div>
+
+
+ <a name="sec-var-summary"></a>
+ <div class="info-box">
+ <div class="info-box-title">Variable Summary</span></div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
+ |
+ <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
+
+ </div>
+ <div class="info-box-body">
+ <div class="var-summary">
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$AltBody" title="details" class="var-name">$AltBody</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Body" title="details" class="var-name">$Body</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$CharSet" title="details" class="var-name">$CharSet</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$ConfirmReadingTo" title="details" class="var-name">$ConfirmReadingTo</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$ContentType" title="details" class="var-name">$ContentType</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Encoding" title="details" class="var-name">$Encoding</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$ErrorInfo" title="details" class="var-name">$ErrorInfo</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$From" title="details" class="var-name">$From</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$FromName" title="details" class="var-name">$FromName</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Helo" title="details" class="var-name">$Helo</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Host" title="details" class="var-name">$Host</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Hostname" title="details" class="var-name">$Hostname</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Mailer" title="details" class="var-name">$Mailer</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Password" title="details" class="var-name">$Password</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$PluginDir" title="details" class="var-name">$PluginDir</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">int</span>
+ <a href="#$Port" title="details" class="var-name">$Port</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">int</span>
+ <a href="#$Priority" title="details" class="var-name">$Priority</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Sender" title="details" class="var-name">$Sender</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Sendmail" title="details" class="var-name">$Sendmail</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">bool</span>
+ <a href="#$SMTPAuth" title="details" class="var-name">$SMTPAuth</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">bool</span>
+ <a href="#$SMTPDebug" title="details" class="var-name">$SMTPDebug</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">bool</span>
+ <a href="#$SMTPKeepAlive" title="details" class="var-name">$SMTPKeepAlive</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Subject" title="details" class="var-name">$Subject</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">int</span>
+ <a href="#$Timeout" title="details" class="var-name">$Timeout</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Username" title="details" class="var-name">$Username</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$Version" title="details" class="var-name">$Version</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">int</span>
+ <a href="#$WordWrap" title="details" class="var-name">$WordWrap</a>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <a name="sec-method-summary"></a>
+ <div class="info-box">
+ <div class="info-box-title">Method Summary</span></div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
+
+ |
+ <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
+ </div>
+ <div class="info-box-body">
+ <div class="method-summary">
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#AddAddress" title="details" class="method-name">AddAddress</a>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#AddAttachment" title="details" class="method-name">AddAttachment</a>
+ (<span class="var-type">string</span> <span class="var-name">$path</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>], [<span class="var-type">string</span> <span class="var-name">$encoding</span> = <span class="var-default">"base64"</span>], [<span class="var-type">string</span> <span class="var-name">$type</span> = <span class="var-default">"application/octet-stream"</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#AddBCC" title="details" class="method-name">AddBCC</a>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#AddCC" title="details" class="method-name">AddCC</a>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#AddCustomHeader" title="details" class="method-name">AddCustomHeader</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$custom_header</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#AddEmbeddedImage" title="details" class="method-name">AddEmbeddedImage</a>
+ (<span class="var-type">string</span> <span class="var-name">$path</span>, <span class="var-type">string</span> <span class="var-name">$cid</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>], [<span class="var-type">string</span> <span class="var-name">$encoding</span> = <span class="var-default">"base64"</span>], [<span class="var-type">string</span> <span class="var-name">$type</span> = <span class="var-default">"application/octet-stream"</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#AddReplyTo" title="details" class="method-name">AddReplyTo</a>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#AddStringAttachment" title="details" class="method-name">AddStringAttachment</a>
+ (<span class="var-type">string</span> <span class="var-name">$string</span>, <span class="var-type">string</span> <span class="var-name">$filename</span>, [<span class="var-type">string</span> <span class="var-name">$encoding</span> = <span class="var-default">"base64"</span>], [<span class="var-type">string</span> <span class="var-name">$type</span> = <span class="var-default">"application/octet-stream"</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearAddresses" title="details" class="method-name">ClearAddresses</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearAllRecipients" title="details" class="method-name">ClearAllRecipients</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearAttachments" title="details" class="method-name">ClearAttachments</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearBCCs" title="details" class="method-name">ClearBCCs</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearCCs" title="details" class="method-name">ClearCCs</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearCustomHeaders" title="details" class="method-name">ClearCustomHeaders</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#ClearReplyTos" title="details" class="method-name">ClearReplyTos</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#IsError" title="details" class="method-name">IsError</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#IsHTML" title="details" class="method-name">IsHTML</a>
+ (<span class="var-type">bool</span> <span class="var-name">$bool</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#IsMail" title="details" class="method-name">IsMail</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#IsQmail" title="details" class="method-name">IsQmail</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#IsSendmail" title="details" class="method-name">IsSendmail</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#IsSMTP" title="details" class="method-name">IsSMTP</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Send" title="details" class="method-name">Send</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#SetLanguage" title="details" class="method-name">SetLanguage</a>
+ (<span class="var-type">string</span> <span class="var-name">$lang_type</span>, [<span class="var-type">string</span> <span class="var-name">$lang_path</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#SmtpClose" title="details" class="method-name">SmtpClose</a>
+ ()
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <a name="sec-vars"></a>
+ <div class="info-box">
+ <div class="info-box-title">Variables</div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
+
+
+ |
+ <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
+
+ </div>
+ <div class="info-box-body">
+ <a name="var$AltBody" id="$AltBody"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$AltBody</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">96</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.</p>
+
+
+
+
+
+</div>
+<a name="var$Body" id="$Body"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Body</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">87</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the Body of the message. This can be either an HTML or text body.</p>
+<p class="description"><p>If HTML then run IsHTML(true).</p></p>
+
+
+
+
+
+</div>
+<a name="var$CharSet" id="$CharSet"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$CharSet</span>
+ = <span class="var-default"> "iso-8859-1"</span> (line <span class="line-number">36</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the CharSet of the message.</p>
+
+
+
+
+
+</div>
+<a name="var$ConfirmReadingTo" id="$ConfirmReadingTo"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$ConfirmReadingTo</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">134</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the email address that a reading confirmation will be sent.</p>
+
+
+
+
+
+</div>
+<a name="var$ContentType" id="$ContentType"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$ContentType</span>
+ = <span class="var-default"> "text/plain"</span> (line <span class="line-number">42</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the Content-type of the message.</p>
+
+
+
+
+
+</div>
+<a name="var$Encoding" id="$Encoding"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Encoding</span>
+ = <span class="var-default"> "8bit"</span> (line <span class="line-number">49</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".</p>
+
+
+
+
+
+</div>
+<a name="var$ErrorInfo" id="$ErrorInfo"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$ErrorInfo</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">55</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Holds the most recent mailer error message.</p>
+
+
+
+
+
+</div>
+<a name="var$From" id="$From"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$From</span>
+ = <span class="var-default"> "root@localhost"</span> (line <span class="line-number">61</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the From email address for the message.</p>
+
+
+
+
+
+</div>
+<a name="var$FromName" id="$FromName"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$FromName</span>
+ = <span class="var-default"> "Root User"</span> (line <span class="line-number">67</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the From name of the message.</p>
+
+
+
+
+
+</div>
+<a name="var$Helo" id="$Helo"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Helo</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">169</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the SMTP HELO of the message (Default is $Hostname).</p>
+
+
+
+
+
+</div>
+<a name="var$Host" id="$Host"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Host</span>
+ = <span class="var-default"> "localhost"</span> (line <span class="line-number">157</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").</p>
+<p class="description"><p>Hosts will be tried in order.</p></p>
+
+
+
+
+
+</div>
+<a name="var$Hostname" id="$Hostname"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Hostname</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">142</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.</p>
+
+
+
+
+
+</div>
+<a name="var$Mailer" id="$Mailer"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Mailer</span>
+ = <span class="var-default"> "mail"</span> (line <span class="line-number">109</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Method to send mail: ("mail", "sendmail", or "smtp").</p>
+
+
+
+
+
+</div>
+<a name="var$Password" id="$Password"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Password</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">187</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets SMTP password.</p>
+
+
+
+
+
+</div>
+<a name="var$PluginDir" id="$PluginDir"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$PluginDir</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">122</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.</p>
+
+
+
+
+
+</div>
+<a name="var$Port" id="$Port"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">int</span>
+ <span class="var-name">$Port</span>
+ = <span class="var-default"> 25</span> (line <span class="line-number">163</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the default SMTP server port.</p>
+
+
+
+
+
+</div>
+<a name="var$Priority" id="$Priority"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">int</span>
+ <span class="var-name">$Priority</span>
+ = <span class="var-default"> 3</span> (line <span class="line-number">30</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Email priority (1 = High, 3 = Normal, 5 = low).</p>
+
+
+
+
+
+</div>
+<a name="var$Sender" id="$Sender"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Sender</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">74</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.</p>
+
+
+
+
+
+</div>
+<a name="var$Sendmail" id="$Sendmail"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Sendmail</span>
+ = <span class="var-default"> "/usr/sbin/sendmail"</span> (line <span class="line-number">115</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the path of the sendmail program.</p>
+
+
+
+
+
+</div>
+<a name="var$SMTPAuth" id="$SMTPAuth"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">bool</span>
+ <span class="var-name">$SMTPAuth</span>
+ = <span class="var-default"> false</span> (line <span class="line-number">175</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets SMTP authentication. Utilizes the Username and Password variables.</p>
+
+
+
+
+
+</div>
+<a name="var$SMTPDebug" id="$SMTPDebug"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">bool</span>
+ <span class="var-name">$SMTPDebug</span>
+ = <span class="var-default"> false</span> (line <span class="line-number">200</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets SMTP class debugging on or off.</p>
+
+
+
+
+
+</div>
+<a name="var$SMTPKeepAlive" id="$SMTPKeepAlive"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">bool</span>
+ <span class="var-name">$SMTPKeepAlive</span>
+ = <span class="var-default"> false</span> (line <span class="line-number">208</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().</p>
+
+
+
+
+
+</div>
+<a name="var$Subject" id="$Subject"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Subject</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">80</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the Subject of the message.</p>
+
+
+
+
+
+</div>
+<a name="var$Timeout" id="$Timeout"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">int</span>
+ <span class="var-name">$Timeout</span>
+ = <span class="var-default"> 10</span> (line <span class="line-number">194</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the SMTP server timeout in seconds. This function will not work with the win32 version.</p>
+
+
+
+
+
+</div>
+<a name="var$Username" id="$Username"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Username</span>
+ = <span class="var-default"> ""</span> (line <span class="line-number">181</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets SMTP username.</p>
+
+
+
+
+
+</div>
+<a name="var$Version" id="$Version"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$Version</span>
+ = <span class="var-default"> "1.71"</span> (line <span class="line-number">128</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Holds PHPMailer version.</p>
+
+
+
+
+
+</div>
+<a name="var$WordWrap" id="$WordWrap"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">int</span>
+ <span class="var-name">$WordWrap</span>
+ = <span class="var-default"> 0</span> (line <span class="line-number">103</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets word wrapping on the body of the message to a given number of characters.</p>
+
+
+
+
+
+</div>
+
+ </div>
+ </div>
+
+ <a name="sec-methods"></a>
+ <div class="info-box">
+ <div class="info-box-title">Methods</div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
+ <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
+
+ </div>
+ <div class="info-box-body">
+ <A NAME='method_detail'></A>
+<a name="methodAddAddress" id="AddAddress"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">AddAddress</span> (line <span class="line-number">287</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds a "To" address.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ AddAddress
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$address</span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$name</span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodAddAttachment" id="AddAttachment"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">AddAttachment</span> (line <span class="line-number">1000</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds an attachment from a path on the filesystem.</p>
+<p class="description"><p>Returns false if the file could not be found or accessed.</p></p>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ AddAttachment
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$path</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>], [<span class="var-type">string</span> <span class="var-name">$encoding</span> = <span class="var-default">"base64"</span>], [<span class="var-type">string</span> <span class="var-name">$type</span> = <span class="var-default">"application/octet-stream"</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$path</span><span class="var-description">: <p>Path to the attachment.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$name</span><span class="var-description">: <p>Overrides the attachment name.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$encoding</span><span class="var-description">: <p>File encoding (see $Encoding).</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$type</span><span class="var-description">: <p>File extension (MIME) type.</p></span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodAddBCC" id="AddBCC"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">AddBCC</span> (line <span class="line-number">315</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ AddBCC
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$address</span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$name</span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodAddCC" id="AddCC"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">AddCC</span> (line <span class="line-number">301</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ AddCC
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$address</span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$name</span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodAddCustomHeader" id="AddCustomHeader"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">AddCustomHeader</span> (line <span class="line-number">1525</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds a custom header.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ AddCustomHeader
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$custom_header</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodAddEmbeddedImage" id="AddEmbeddedImage"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">AddEmbeddedImage</span> (line <span class="line-number">1275</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".</p>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ AddEmbeddedImage
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$path</span>, <span class="var-type">string</span> <span class="var-name">$cid</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>], [<span class="var-type">string</span> <span class="var-name">$encoding</span> = <span class="var-default">"base64"</span>], [<span class="var-type">string</span> <span class="var-name">$type</span> = <span class="var-default">"application/octet-stream"</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$path</span><span class="var-description">: <p>Path to the attachment.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$cid</span><span class="var-description">: <p>Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$name</span><span class="var-description">: <p>Overrides the attachment name.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$encoding</span><span class="var-description">: <p>File encoding (see $Encoding).</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$type</span><span class="var-description">: <p>File extension (MIME) type.</p></span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodAddReplyTo" id="AddReplyTo"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">AddReplyTo</span> (line <span class="line-number">327</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds a "Reply-to" address.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ AddReplyTo
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$address</span>, [<span class="var-type">string</span> <span class="var-name">$name</span> = <span class="var-default">""</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$address</span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$name</span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodAddStringAttachment" id="AddStringAttachment"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">AddStringAttachment</span> (line <span class="line-number">1248</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Adds a string or binary attachment (non-filesystem) to the list.</p>
+<p class="description"><p>This method can be used to attach ascii or binary data, such as a BLOB record from a database.</p></p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ AddStringAttachment
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$string</span>, <span class="var-type">string</span> <span class="var-name">$filename</span>, [<span class="var-type">string</span> <span class="var-name">$encoding</span> = <span class="var-default">"base64"</span>], [<span class="var-type">string</span> <span class="var-name">$type</span> = <span class="var-default">"application/octet-stream"</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$string</span><span class="var-description">: <p>String attachment data.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$filename</span><span class="var-description">: <p>Name of the attachment.</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$encoding</span><span class="var-description">: <p>File encoding (see $Encoding).</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$type</span><span class="var-description">: <p>File extension (MIME) type.</p></span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodClearAddresses" id="ClearAddresses"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearAddresses</span> (line <span class="line-number">1329</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all recipients assigned in the TO array. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearAddresses
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodClearAllRecipients" id="ClearAllRecipients"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearAllRecipients</span> (line <span class="line-number">1362</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all recipients assigned in the TO, CC and BCC array. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearAllRecipients
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodClearAttachments" id="ClearAttachments"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearAttachments</span> (line <span class="line-number">1373</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all previously set filesystem, string, and binary attachments. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearAttachments
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodClearBCCs" id="ClearBCCs"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearBCCs</span> (line <span class="line-number">1345</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all recipients assigned in the BCC array. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearBCCs
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodClearCCs" id="ClearCCs"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearCCs</span> (line <span class="line-number">1337</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all recipients assigned in the CC array. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearCCs
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodClearCustomHeaders" id="ClearCustomHeaders"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearCustomHeaders</span> (line <span class="line-number">1381</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all custom headers. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearCustomHeaders
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodClearReplyTos" id="ClearReplyTos"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">ClearReplyTos</span> (line <span class="line-number">1353</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Clears all recipients assigned in the ReplyTo array. Returns void.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ ClearReplyTos
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodIsError" id="IsError"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">IsError</span> (line <span class="line-number">1505</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Returns true if an error occurred.</p>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ IsError
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodIsHTML" id="IsHTML"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">IsHTML</span> (line <span class="line-number">236</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets message type to HTML.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ IsHTML
+ </span>
+ (<span class="var-type">bool</span> <span class="var-name">$bool</span>)
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">bool</span>
+ <span class="var-name">$bool</span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodIsMail" id="IsMail"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">IsMail</span> (line <span class="line-number">255</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets Mailer to send message using PHP mail() function.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ IsMail
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodIsQmail" id="IsQmail"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">IsQmail</span> (line <span class="line-number">271</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets Mailer to send message using the qmail MTA.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ IsQmail
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodIsSendmail" id="IsSendmail"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">IsSendmail</span> (line <span class="line-number">263</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets Mailer to send message using the $Sendmail program.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ IsSendmail
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodIsSMTP" id="IsSMTP"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">IsSMTP</span> (line <span class="line-number">247</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets Mailer to send message using SMTP.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ IsSMTP
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodSend" id="Send"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Send</span> (line <span class="line-number">344</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.</p>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Send
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodSetLanguage" id="SetLanguage"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">SetLanguage</span> (line <span class="line-number">599</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.</p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ SetLanguage
+ </span>
+ (<span class="var-type">string</span> <span class="var-name">$lang_type</span>, [<span class="var-type">string</span> <span class="var-name">$lang_path</span> = <span class="var-default">""</span>])
+ </div>
+
+ <ul class="parameters">
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$lang_type</span><span class="var-description">: <p>Type of language (e.g. Portuguese: "br")</p></span> </li>
+ <li>
+ <span class="var-type">string</span>
+ <span class="var-name">$lang_path</span><span class="var-description">: <p>Path to the language file directory</p></span> </li>
+ </ul>
+
+
+ </div>
+<a name="methodSmtpClose" id="SmtpClose"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">SmtpClose</span> (line <span class="line-number">579</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Closes the active SMTP session if one exists.</p>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ SmtpClose
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+
+ </div>
+ </div>
+
+ <p class="notes" id="credit">
+ Documention generated on Mon, 28 Jul 2003 23:25:49 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>
+ </p>
+ </div></body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title>Docs For Class SMTP</title>
+ <link rel="stylesheet" href="../media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <div class="page-body">
+<h2 class="class-name">Class SMTP</h2>
+
+<a name="sec-description"></a>
+<div class="info-box">
+ <div class="info-box-title">Description</div>
+ <div class="nav-bar">
+ <span class="disabled">Description</span> |
+ <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
+ | <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
+
+ </div>
+ <div class="info-box-body">
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.</p>
+ <ul class="tags">
+ <li><span class="field">author:</span> <p>Chris Ryan</p></li>
+ </ul>
+ <p class="notes">
+ Located in <a class="field" href="_class_smtp_php.html">Program_Root/class.smtp.php</a> (line <span class="field">24</span>)
+ </p>
+
+
+ <pre></pre>
+
+ </div>
+</div>
+
+
+ <a name="sec-var-summary"></a>
+ <div class="info-box">
+ <div class="info-box-title">Variable Summary</span></div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
+ |
+ <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
+
+ </div>
+ <div class="info-box-body">
+ <div class="var-summary">
+ <div class="var-title">
+ <span class="var-type">string</span>
+ <a href="#$CRLF" title="details" class="var-name">$CRLF</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">bool</span>
+ <a href="#$do_debug" title="details" class="var-name">$do_debug</a>
+ </div>
+ <div class="var-title">
+ <span class="var-type">int</span>
+ <a href="#$SMTP_PORT" title="details" class="var-name">$SMTP_PORT</a>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <a name="sec-method-summary"></a>
+ <div class="info-box">
+ <div class="info-box-title">Method Summary</span></div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
+
+ |
+ <span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
+ </div>
+ <div class="info-box-body">
+ <div class="method-summary">
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#SMTP" title="details" class="method-name">SMTP</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Authenticate" title="details" class="method-name">Authenticate</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$username</span>, <span class="var-type">mixed</span> <span class="var-name">$password</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">void</span>
+ <a href="#Close" title="details" class="method-name">Close</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Connect" title="details" class="method-name">Connect</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$host</span>, <span class="var-type">mixed</span> <span class="var-name">$port</span>, [<span class="var-type">mixed</span> <span class="var-name">$tval</span> = <span class="var-default">30</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Data" title="details" class="method-name">Data</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$msg_data</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">string</span>
+ <a href="#Expand" title="details" class="method-name">Expand</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Hello" title="details" class="method-name">Hello</a>
+ ([<span class="var-type">mixed</span> <span class="var-name">$host</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">string</span>
+ <a href="#Help" title="details" class="method-name">Help</a>
+ ([<span class="var-type">mixed</span> <span class="var-name">$keyword</span> = <span class="var-default">""</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Mail" title="details" class="method-name">Mail</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Noop" title="details" class="method-name">Noop</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Quit" title="details" class="method-name">Quit</a>
+ ([<span class="var-type">mixed</span> <span class="var-name">$close_on_error</span> = <span class="var-default">true</span>])
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Recipient" title="details" class="method-name">Recipient</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$to</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Reset" title="details" class="method-name">Reset</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Send" title="details" class="method-name">Send</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#SendAndMail" title="details" class="method-name">SendAndMail</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#SendOrMail" title="details" class="method-name">SendOrMail</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">bool</span>
+ <a href="#Turn" title="details" class="method-name">Turn</a>
+ ()
+ </div>
+
+ <div class="method-definition">
+ <span class="method-result">int</span>
+ <a href="#Verify" title="details" class="method-name">Verify</a>
+ (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <a name="sec-vars"></a>
+ <div class="info-box">
+ <div class="info-box-title">Variables</div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
+
+
+ |
+ <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
+
+ </div>
+ <div class="info-box-body">
+ <a name="var$CRLF" id="$CRLF"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">string</span>
+ <span class="var-name">$CRLF</span>
+ = <span class="var-default"> "\r\n"</span> (line <span class="line-number">36</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">SMTP reply line ending</p>
+
+
+
+
+
+</div>
+<a name="var$do_debug" id="$do_debug"><!-- --></A>
+<div class="evenrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">bool</span>
+ <span class="var-name">$do_debug</span>
+ (line <span class="line-number">42</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sets whether debugging is turned on</p>
+
+
+
+
+
+</div>
+<a name="var$SMTP_PORT" id="$SMTP_PORT"><!-- --></A>
+<div class="oddrow">
+
+ <div class="var-header">
+ <span class="var-title">
+ <span class="var-type">int</span>
+ <span class="var-name">$SMTP_PORT</span>
+ = <span class="var-default"> 25</span> (line <span class="line-number">30</span>)
+ </span>
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">SMTP server port</p>
+
+
+
+
+
+</div>
+
+ </div>
+ </div>
+
+ <a name="sec-methods"></a>
+ <div class="info-box">
+ <div class="info-box-title">Methods</div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
+ <a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
+
+ </div>
+ <div class="info-box-body">
+ <A NAME='method_detail'></A>
+<a name="methodSMTP" id="SMTP"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Constructor SMTP</span> (line <span class="line-number">57</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Initialize the class so that the data is in a known state.</p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ SMTP
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodAuthenticate" id="Authenticate"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Authenticate</span> (line <span class="line-number">144</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated.</p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Authenticate
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$username</span>, <span class="var-type">mixed</span> <span class="var-name">$password</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodClose" id="Close"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Close</span> (line <span class="line-number">232</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Closes the socket and cleans up the state of the class.</p>
+<p class="description"><p>It is not considered good to use this function without first trying to use QUIT.</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">void</span>
+ <span class="method-name">
+ Close
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodConnect" id="Connect"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Connect</span> (line <span class="line-number">82</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Connect to the server specified on the port specified.</p>
+<p class="description"><p>If the port is not specified use the default SMTP_PORT. If tval is specified then a connection will try and be established with the server for that number of seconds. If tval is not specified the default is 30 seconds to try on the connection.</p><p>SMTP CODE SUCCESS: 220 SMTP CODE FAILURE: 421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Connect
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$host</span>, <span class="var-type">mixed</span> <span class="var-name">$port</span>, [<span class="var-type">mixed</span> <span class="var-name">$tval</span> = <span class="var-default">30</span>])
+ </div>
+
+
+
+ </div>
+<a name="methodData" id="Data"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Data</span> (line <span class="line-number">266</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Issues a data command and sends the msg_data to the server</p>
+<p class="description"><p>finializing the mail transaction. $msg_data is the message that is to be send with the headers. Each header needs to be on a single line followed by a <CRLF> with the message headers and the message body being seperated by and additional <CRLF>.</p><p>Implements rfc 821: DATA <CRLF></p><p>SMTP CODE INTERMEDIATE: 354 [data] <CRLF>.<CRLF> SMTP CODE SUCCESS: 250 SMTP CODE FAILURE: 552,554,451,452 SMTP CODE FAILURE: 451,554 SMTP CODE ERROR : 500,501,503,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Data
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$msg_data</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodExpand" id="Expand"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Expand</span> (line <span class="line-number">399</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Expand takes the name and asks the server to list all the people who are members of the _list_. Expand will return back and array of the result or false if an error occurs.</p>
+<p class="description"><p>Each value in the array returned has the format of: [ <full-name> <sp> ] <path> The definition of <path> is defined in rfc 821</p><p>Implements rfc 821: EXPN <SP> <string> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE FAILURE: 550 SMTP CODE ERROR : 500,501,502,504,421</p></p>
+ <ul class="tags">
+ <li><span class="field">return:</span> <p>array</p></li>
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">string</span>
+ <span class="method-name">
+ Expand
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodHello" id="Hello"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Hello</span> (line <span class="line-number">450</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sends the HELO command to the smtp server.</p>
+<p class="description"><p>This makes sure that we and the server are in the same known state.</p><p>Implements from rfc 821: HELO <SP> <domain> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500, 501, 504, 421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Hello
+ </span>
+ ([<span class="var-type">mixed</span> <span class="var-name">$host</span> = <span class="var-default">""</span>])
+ </div>
+
+
+
+ </div>
+<a name="methodHelp" id="Help"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Help</span> (line <span class="line-number">524</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Gets help information on the keyword specified. If the keyword</p>
+<p class="description"><p>is not specified then returns generic help, ussually contianing A list of keywords that help is available on. This function returns the results back to the user. It is up to the user to handle the returned data. If an error occurs then false is returned with $this->error set appropiately.</p><p>Implements rfc 821: HELP [ <SP> <string> ] <CRLF></p><p>SMTP CODE SUCCESS: 211,214 SMTP CODE ERROR : 500,501,502,504,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">string</span>
+ <span class="method-name">
+ Help
+ </span>
+ ([<span class="var-type">mixed</span> <span class="var-name">$keyword</span> = <span class="var-default">""</span>])
+ </div>
+
+
+
+ </div>
+<a name="methodMail" id="Mail"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Mail</span> (line <span class="line-number">576</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command.</p>
+<p class="description"><p>Implements rfc 821: MAIL <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Mail
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodNoop" id="Noop"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Noop</span> (line <span class="line-number">618</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sends the command NOOP to the SMTP server.</p>
+<p class="description"><p>Implements from rfc 821: NOOP <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500, 421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Noop
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodQuit" id="Quit"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Quit</span> (line <span class="line-number">661</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sends the quit command to the server and then closes the socket if there is no error or the $close_on_error argument is true.</p>
+<p class="description"><p>Implements from rfc 821: QUIT <CRLF></p><p>SMTP CODE SUCCESS: 221 SMTP CODE ERROR : 500</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Quit
+ </span>
+ ([<span class="var-type">mixed</span> <span class="var-name">$close_on_error</span> = <span class="var-default">true</span>])
+ </div>
+
+
+
+ </div>
+<a name="methodRecipient" id="Recipient"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Recipient</span> (line <span class="line-number">715</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sends the command RCPT to the SMTP server with the TO: argument of $to.</p>
+<p class="description"><p>Returns true if the recipient was accepted false if it was rejected.</p><p>Implements from rfc 821: RCPT <SP> TO:<forward-path> <CRLF></p><p>SMTP CODE SUCCESS: 250,251 SMTP CODE FAILURE: 550,551,552,553,450,451,452 SMTP CODE ERROR : 500,501,503,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Recipient
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$to</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodReset" id="Reset"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Reset</span> (line <span class="line-number">759</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.</p>
+<p class="description"><p>Implements rfc 821: RSET <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE ERROR : 500,501,504,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Reset
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodSend" id="Send"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Send</span> (line <span class="line-number">808</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Starts a mail transaction from the email address specified in</p>
+<p class="description"><p>$from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in.</p><p>Implements rfc 821: SEND <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Send
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodSendAndMail" id="SendAndMail"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">SendAndMail</span> (line <span class="line-number">856</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Starts a mail transaction from the email address specified in</p>
+<p class="description"><p>$from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in and send them an email.</p><p>Implements rfc 821: SAML <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ SendAndMail
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodSendOrMail" id="SendOrMail"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">SendOrMail</span> (line <span class="line-number">904</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Starts a mail transaction from the email address specified in</p>
+<p class="description"><p>$from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command. This command will send the message to the users terminal if they are logged in or mail it to them if they are not.</p><p>Implements rfc 821: SOML <SP> FROM:<reverse-path> <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE SUCCESS: 552,451,452 SMTP CODE SUCCESS: 500,501,502,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ SendOrMail
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$from</span>)
+ </div>
+
+
+
+ </div>
+<a name="methodTurn" id="Turn"><!-- --></a>
+<div class="evenrow">
+
+ <div class="method-header">
+ <span class="method-title">Turn</span> (line <span class="line-number">949</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">This is an optional command for SMTP that this class does not support. This method is here to make the RFC821 Definition complete for this class and __may__ be implimented in the future</p>
+<p class="description"><p>Implements from rfc 821: TURN <CRLF></p><p>SMTP CODE SUCCESS: 250 SMTP CODE FAILURE: 502 SMTP CODE ERROR : 500, 503</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">bool</span>
+ <span class="method-name">
+ Turn
+ </span>
+ ()
+ </div>
+
+
+
+ </div>
+<a name="methodVerify" id="Verify"><!-- --></a>
+<div class="oddrow">
+
+ <div class="method-header">
+ <span class="method-title">Verify</span> (line <span class="line-number">971</span>)
+ </div>
+
+ <!-- ========== Info from phpDoc block ========= -->
+<p class="short-description">Verifies that the name is recognized by the server.</p>
+<p class="description"><p>Returns false if the name could not be verified otherwise the response from the server is returned.</p><p>Implements rfc 821: VRFY <SP> <string> <CRLF></p><p>SMTP CODE SUCCESS: 250,251 SMTP CODE FAILURE: 550,551,553 SMTP CODE ERROR : 500,501,502,421</p></p>
+ <ul class="tags">
+ <li><span class="field">access:</span> public</li>
+ </ul>
+
+ <div class="method-signature">
+ <span class="method-result">int</span>
+ <span class="method-name">
+ Verify
+ </span>
+ (<span class="var-type">mixed</span> <span class="var-name">$name</span>)
+ </div>
+
+
+
+ </div>
+
+ </div>
+ </div>
+
+ <p class="notes" id="credit">
+ Documention generated on Mon, 28 Jul 2003 23:25:50 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>
+ </p>
+ </div></body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title>Docs for page class.phpmailer.php</title>
+ <link rel="stylesheet" href="../media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <div class="page-body">
+<h2 class="file-name">Program_Root/class.phpmailer.php</h2>
+
+<a name="sec-description"></a>
+<div class="info-box">
+ <div class="info-box-title">Description</div>
+ <div class="nav-bar">
+ <span class="disabled">Description</span> |
+ <a href="#sec-classes">Classes</a>
+ </div>
+ <div class="info-box-body">
+ <!-- ========== Info from phpDoc block ========= -->
+
+ </div>
+</div>
+
+ <a name="sec-classes"></a>
+ <div class="info-box">
+ <div class="info-box-title">Classes</div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <span class="disabled">Classes</span>
+ </div>
+ <div class="info-box-body">
+ <table cellpadding="2" cellspacing="0" class="class-table">
+ <tr>
+ <th class="class-table-header">Class</th>
+ <th class="class-table-header">Description</th>
+ </tr>
+ <tr>
+ <td style="padding-right: 2em; vertical-align: top">
+ <a href="../PHPMailer/PHPMailer.html">PHPMailer</a>
+ </td>
+ <td>
+ PHPMailer - PHP email transport class
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+
+
+ <p class="notes" id="credit">
+ Documention generated on Mon, 28 Jul 2003 23:25:49 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>
+ </p>
+ </div></body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title>Docs for page class.smtp.php</title>
+ <link rel="stylesheet" href="../media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <div class="page-body">
+<h2 class="file-name">Program_Root/class.smtp.php</h2>
+
+<a name="sec-description"></a>
+<div class="info-box">
+ <div class="info-box-title">Description</div>
+ <div class="nav-bar">
+ <span class="disabled">Description</span> |
+ <a href="#sec-classes">Classes</a>
+ </div>
+ <div class="info-box-body">
+ <!-- ========== Info from phpDoc block ========= -->
+
+ </div>
+</div>
+
+ <a name="sec-classes"></a>
+ <div class="info-box">
+ <div class="info-box-title">Classes</div>
+ <div class="nav-bar">
+ <a href="#sec-description">Description</a> |
+ <span class="disabled">Classes</span>
+ </div>
+ <div class="info-box-body">
+ <table cellpadding="2" cellspacing="0" class="class-table">
+ <tr>
+ <th class="class-table-header">Class</th>
+ <th class="class-table-header">Description</th>
+ </tr>
+ <tr>
+ <td style="padding-right: 2em; vertical-align: top">
+ <a href="../PHPMailer/SMTP.html">SMTP</a>
+ </td>
+ <td>
+ SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+
+
+ <p class="notes" id="credit">
+ Documention generated on Mon, 28 Jul 2003 23:25:50 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>
+ </p>
+ </div></body>
+</html>
\ No newline at end of file
--- /dev/null
+<html>
+<head>
+ <title>Generated Documentation</title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+</head>
+<body>
+<div align="center"><h1>Generated Documentation</h1></div>
+<b>Welcome to default!</b><br />
+<br />
+This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.2.0</a><br />
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title></title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+
+<!-- Start of Class Data -->
+<H2>
+
+</H2>
+<h2>Root class PHPMailer</h2>
+<ul>
+<li><a href="PHPMailer/PHPMailer.html">PHPMailer</a></li></ul>
+
+<h2>Root class SMTP</h2>
+<ul>
+<li><a href="PHPMailer/SMTP.html">SMTP</a></li></ul>
+
+ <p class="notes" id="credit">
+ Documention generated on Mon, 28 Jul 2003 23:25:49 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>
+ </p>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title></title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <a name="top"></a>
+<h2>Full index</h2>
+<h3>Package indexes</h3>
+<ul>
+ <li><a href="elementindex_PHPMailer.html">PHPMailer</a></li>
+</ul>
+<br />
+<div class="index-letter-menu">
+ <a class="index-letter" href="elementindex.html#a">a</a>
+ <a class="index-letter" href="elementindex.html#b">b</a>
+ <a class="index-letter" href="elementindex.html#c">c</a>
+ <a class="index-letter" href="elementindex.html#d">d</a>
+ <a class="index-letter" href="elementindex.html#e">e</a>
+ <a class="index-letter" href="elementindex.html#f">f</a>
+ <a class="index-letter" href="elementindex.html#h">h</a>
+ <a class="index-letter" href="elementindex.html#i">i</a>
+ <a class="index-letter" href="elementindex.html#m">m</a>
+ <a class="index-letter" href="elementindex.html#n">n</a>
+ <a class="index-letter" href="elementindex.html#p">p</a>
+ <a class="index-letter" href="elementindex.html#q">q</a>
+ <a class="index-letter" href="elementindex.html#r">r</a>
+ <a class="index-letter" href="elementindex.html#s">s</a>
+ <a class="index-letter" href="elementindex.html#t">t</a>
+ <a class="index-letter" href="elementindex.html#u">u</a>
+ <a class="index-letter" href="elementindex.html#v">v</a>
+ <a class="index-letter" href="elementindex.html#w">w</a>
+</div>
+
+ <a name="a"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">a</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$AltBody</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$AltBody">PHPMailer::$AltBody</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddAddress</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddAddress">PHPMailer::AddAddress()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "To" address.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddAttachment</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddAttachment">PHPMailer::AddAttachment()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds an attachment from a path on the filesystem.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddBCC</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddBCC">PHPMailer::AddBCC()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddCC</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddCC">PHPMailer::AddCC()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddCustomHeader</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddCustomHeader">PHPMailer::AddCustomHeader()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a custom header.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddEmbeddedImage</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddEmbeddedImage">PHPMailer::AddEmbeddedImage()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddReplyTo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddReplyTo">PHPMailer::AddReplyTo()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "Reply-to" address.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddStringAttachment</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddStringAttachment">PHPMailer::AddStringAttachment()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a string or binary attachment (non-filesystem) to the list.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Authenticate</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodAuthenticate">SMTP::Authenticate()</a> in class.smtp.php</div>
+ <div class="index-item-description">Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated.</div>
+ </dd>
+ </dl>
+ <a name="b"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">b</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Body</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Body">PHPMailer::$Body</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Body of the message. This can be either an HTML or text body.</div>
+ </dd>
+ </dl>
+ <a name="c"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">c</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$CharSet</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$CharSet">PHPMailer::$CharSet</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the CharSet of the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$ConfirmReadingTo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$ConfirmReadingTo">PHPMailer::$ConfirmReadingTo</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the email address that a reading confirmation will be sent.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$ContentType</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$ContentType">PHPMailer::$ContentType</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Content-type of the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$CRLF</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#var$CRLF">SMTP::$CRLF</a> in class.smtp.php</div>
+ <div class="index-item-description">SMTP reply line ending</div>
+ </dd>
+ <dt class="field">
+ <span class="include-title">class.phpmailer.php</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/_class_phpmailer_php.html">class.phpmailer.php</a> in class.phpmailer.php</div>
+ </dd>
+ <dt class="field">
+ <span class="include-title">class.smtp.php</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/_class_smtp_php.html">class.smtp.php</a> in class.smtp.php</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearAddresses</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearAddresses">PHPMailer::ClearAddresses()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the TO array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearAllRecipients</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearAllRecipients">PHPMailer::ClearAllRecipients()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the TO, CC and BCC array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearAttachments</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearAttachments">PHPMailer::ClearAttachments()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all previously set filesystem, string, and binary attachments. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearBCCs</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearBCCs">PHPMailer::ClearBCCs()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the BCC array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearCCs</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearCCs">PHPMailer::ClearCCs()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the CC array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearCustomHeaders</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearCustomHeaders">PHPMailer::ClearCustomHeaders()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all custom headers. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearReplyTos</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearReplyTos">PHPMailer::ClearReplyTos()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the ReplyTo array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Close</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodClose">SMTP::Close()</a> in class.smtp.php</div>
+ <div class="index-item-description">Closes the socket and cleans up the state of the class.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Connect</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodConnect">SMTP::Connect()</a> in class.smtp.php</div>
+ <div class="index-item-description">Connect to the server specified on the port specified.</div>
+ </dd>
+ </dl>
+ <a name="d"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">d</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$do_debug</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#var$do_debug">SMTP::$do_debug</a> in class.smtp.php</div>
+ <div class="index-item-description">Sets whether debugging is turned on</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Data</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodData">SMTP::Data()</a> in class.smtp.php</div>
+ <div class="index-item-description">Issues a data command and sends the msg_data to the server</div>
+ </dd>
+ </dl>
+ <a name="e"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">e</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Encoding</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Encoding">PHPMailer::$Encoding</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$ErrorInfo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$ErrorInfo">PHPMailer::$ErrorInfo</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Holds the most recent mailer error message.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Expand</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodExpand">SMTP::Expand()</a> in class.smtp.php</div>
+ <div class="index-item-description">Expand takes the name and asks the server to list all the people who are members of the _list_. Expand will return back and array of the result or false if an error occurs.</div>
+ </dd>
+ </dl>
+ <a name="f"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">f</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$From</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$From">PHPMailer::$From</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the From email address for the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$FromName</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$FromName">PHPMailer::$FromName</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the From name of the message.</div>
+ </dd>
+ </dl>
+ <a name="h"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">h</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Helo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Helo">PHPMailer::$Helo</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the SMTP HELO of the message (Default is $Hostname).</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Host</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Host">PHPMailer::$Host</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Hostname</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Hostname">PHPMailer::$Hostname</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Hello</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodHello">SMTP::Hello()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the HELO command to the smtp server.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Help</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodHelp">SMTP::Help()</a> in class.smtp.php</div>
+ <div class="index-item-description">Gets help information on the keyword specified. If the keyword</div>
+ </dd>
+ </dl>
+ <a name="i"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">i</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">IsError</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsError">PHPMailer::IsError()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Returns true if an error occurred.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsHTML</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsHTML">PHPMailer::IsHTML()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets message type to HTML.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsMail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsMail">PHPMailer::IsMail()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using PHP mail() function.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsQmail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsQmail">PHPMailer::IsQmail()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using the qmail MTA.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsSendmail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsSendmail">PHPMailer::IsSendmail()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using the $Sendmail program.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsSMTP</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsSMTP">PHPMailer::IsSMTP()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using SMTP.</div>
+ </dd>
+ </dl>
+ <a name="m"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">m</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Mailer</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Mailer">PHPMailer::$Mailer</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Method to send mail: ("mail", "sendmail", or "smtp").</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Mail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodMail">SMTP::Mail()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command.</div>
+ </dd>
+ </dl>
+ <a name="n"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">n</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">Noop</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodNoop">SMTP::Noop()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the command NOOP to the SMTP server.</div>
+ </dd>
+ </dl>
+ <a name="p"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">p</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Password</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Password">PHPMailer::$Password</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP password.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$PluginDir</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$PluginDir">PHPMailer::$PluginDir</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Port</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Port">PHPMailer::$Port</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the default SMTP server port.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Priority</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Priority">PHPMailer::$Priority</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Email priority (1 = High, 3 = Normal, 5 = low).</div>
+ </dd>
+ <dt class="field">
+ PHPMailer
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html">PHPMailer</a> in class.phpmailer.php</div>
+ <div class="index-item-description">PHPMailer - PHP email transport class</div>
+ </dd>
+ </dl>
+ <a name="q"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">q</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">Quit</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodQuit">SMTP::Quit()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the quit command to the server and then closes the socket if there is no error or the $close_on_error argument is true.</div>
+ </dd>
+ </dl>
+ <a name="r"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">r</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">Recipient</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodRecipient">SMTP::Recipient()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the command RCPT to the SMTP server with the TO: argument of $to.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Reset</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodReset">SMTP::Reset()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.</div>
+ </dd>
+ </dl>
+ <a name="s"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">s</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Sender</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Sender">PHPMailer::$Sender</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Sendmail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Sendmail">PHPMailer::$Sendmail</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the path of the sendmail program.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTPAuth</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$SMTPAuth">PHPMailer::$SMTPAuth</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP authentication. Utilizes the Username and Password variables.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTPDebug</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$SMTPDebug">PHPMailer::$SMTPDebug</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP class debugging on or off.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTPKeepAlive</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$SMTPKeepAlive">PHPMailer::$SMTPKeepAlive</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTP_PORT</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#var$SMTP_PORT">SMTP::$SMTP_PORT</a> in class.smtp.php</div>
+ <div class="index-item-description">SMTP server port</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Subject</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Subject">PHPMailer::$Subject</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Subject of the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Send</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSend">SMTP::Send()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Send</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodSend">PHPMailer::Send()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SendAndMail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSendAndMail">SMTP::SendAndMail()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SendOrMail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSendOrMail">SMTP::SendOrMail()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SetLanguage</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodSetLanguage">PHPMailer::SetLanguage()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SMTP</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSMTP">SMTP::SMTP()</a> in class.smtp.php</div>
+ <div class="index-item-description">Initialize the class so that the data is in a known state.</div>
+ </dd>
+ <dt class="field">
+ SMTP
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html">SMTP</a> in class.smtp.php</div>
+ <div class="index-item-description">SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SmtpClose</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodSmtpClose">PHPMailer::SmtpClose()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Closes the active SMTP session if one exists.</div>
+ </dd>
+ </dl>
+ <a name="t"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">t</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Timeout</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Timeout">PHPMailer::$Timeout</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the SMTP server timeout in seconds. This function will not work with the win32 version.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Turn</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodTurn">SMTP::Turn()</a> in class.smtp.php</div>
+ <div class="index-item-description">This is an optional command for SMTP that this class does not support. This method is here to make the RFC821 Definition complete for this class and __may__ be implimented in the future</div>
+ </dd>
+ </dl>
+ <a name="u"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">u</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Username</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Username">PHPMailer::$Username</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP username.</div>
+ </dd>
+ </dl>
+ <a name="v"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">v</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Version</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Version">PHPMailer::$Version</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Holds PHPMailer version.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Verify</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodVerify">SMTP::Verify()</a> in class.smtp.php</div>
+ <div class="index-item-description">Verifies that the name is recognized by the server.</div>
+ </dd>
+ </dl>
+ <a name="w"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">w</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$WordWrap</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$WordWrap">PHPMailer::$WordWrap</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets word wrapping on the body of the message to a given number of characters.</div>
+ </dd>
+ </dl>
+
+<div class="index-letter-menu">
+ <a class="index-letter" href="elementindex.html#a">a</a>
+ <a class="index-letter" href="elementindex.html#b">b</a>
+ <a class="index-letter" href="elementindex.html#c">c</a>
+ <a class="index-letter" href="elementindex.html#d">d</a>
+ <a class="index-letter" href="elementindex.html#e">e</a>
+ <a class="index-letter" href="elementindex.html#f">f</a>
+ <a class="index-letter" href="elementindex.html#h">h</a>
+ <a class="index-letter" href="elementindex.html#i">i</a>
+ <a class="index-letter" href="elementindex.html#m">m</a>
+ <a class="index-letter" href="elementindex.html#n">n</a>
+ <a class="index-letter" href="elementindex.html#p">p</a>
+ <a class="index-letter" href="elementindex.html#q">q</a>
+ <a class="index-letter" href="elementindex.html#r">r</a>
+ <a class="index-letter" href="elementindex.html#s">s</a>
+ <a class="index-letter" href="elementindex.html#t">t</a>
+ <a class="index-letter" href="elementindex.html#u">u</a>
+ <a class="index-letter" href="elementindex.html#v">v</a>
+ <a class="index-letter" href="elementindex.html#w">w</a>
+</div> </body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title></title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <a name="top"></a>
+<h2>[PHPMailer] element index</h2>
+<a href="elementindex.html">All elements</a>
+<br />
+<div class="index-letter-menu">
+ <a class="index-letter" href="elementindex_PHPMailer.html#a">a</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#b">b</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#c">c</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#d">d</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#e">e</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#f">f</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#h">h</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#i">i</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#m">m</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#n">n</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#p">p</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#q">q</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#r">r</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#s">s</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#t">t</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#u">u</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#v">v</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#w">w</a>
+</div>
+
+ <a name="a"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">a</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$AltBody</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$AltBody">PHPMailer::$AltBody</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddAddress</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddAddress">PHPMailer::AddAddress()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "To" address.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddAttachment</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddAttachment">PHPMailer::AddAttachment()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds an attachment from a path on the filesystem.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddBCC</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddBCC">PHPMailer::AddBCC()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddCC</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddCC">PHPMailer::AddCC()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddCustomHeader</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddCustomHeader">PHPMailer::AddCustomHeader()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a custom header.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddEmbeddedImage</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddEmbeddedImage">PHPMailer::AddEmbeddedImage()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddReplyTo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddReplyTo">PHPMailer::AddReplyTo()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a "Reply-to" address.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">AddStringAttachment</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodAddStringAttachment">PHPMailer::AddStringAttachment()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Adds a string or binary attachment (non-filesystem) to the list.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Authenticate</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodAuthenticate">SMTP::Authenticate()</a> in class.smtp.php</div>
+ <div class="index-item-description">Performs SMTP authentication. Must be run after running the Hello() method. Returns true if successfully authenticated.</div>
+ </dd>
+ </dl>
+ <a name="b"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">b</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Body</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Body">PHPMailer::$Body</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Body of the message. This can be either an HTML or text body.</div>
+ </dd>
+ </dl>
+ <a name="c"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">c</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$CharSet</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$CharSet">PHPMailer::$CharSet</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the CharSet of the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$ConfirmReadingTo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$ConfirmReadingTo">PHPMailer::$ConfirmReadingTo</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the email address that a reading confirmation will be sent.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$ContentType</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$ContentType">PHPMailer::$ContentType</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Content-type of the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$CRLF</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#var$CRLF">SMTP::$CRLF</a> in class.smtp.php</div>
+ <div class="index-item-description">SMTP reply line ending</div>
+ </dd>
+ <dt class="field">
+ <span class="include-title">class.phpmailer.php</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/_class_phpmailer_php.html">class.phpmailer.php</a> in class.phpmailer.php</div>
+ </dd>
+ <dt class="field">
+ <span class="include-title">class.smtp.php</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/_class_smtp_php.html">class.smtp.php</a> in class.smtp.php</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearAddresses</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearAddresses">PHPMailer::ClearAddresses()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the TO array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearAllRecipients</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearAllRecipients">PHPMailer::ClearAllRecipients()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the TO, CC and BCC array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearAttachments</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearAttachments">PHPMailer::ClearAttachments()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all previously set filesystem, string, and binary attachments. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearBCCs</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearBCCs">PHPMailer::ClearBCCs()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the BCC array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearCCs</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearCCs">PHPMailer::ClearCCs()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the CC array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearCustomHeaders</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearCustomHeaders">PHPMailer::ClearCustomHeaders()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all custom headers. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">ClearReplyTos</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodClearReplyTos">PHPMailer::ClearReplyTos()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Clears all recipients assigned in the ReplyTo array. Returns void.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Close</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodClose">SMTP::Close()</a> in class.smtp.php</div>
+ <div class="index-item-description">Closes the socket and cleans up the state of the class.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Connect</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodConnect">SMTP::Connect()</a> in class.smtp.php</div>
+ <div class="index-item-description">Connect to the server specified on the port specified.</div>
+ </dd>
+ </dl>
+ <a name="d"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">d</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$do_debug</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#var$do_debug">SMTP::$do_debug</a> in class.smtp.php</div>
+ <div class="index-item-description">Sets whether debugging is turned on</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Data</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodData">SMTP::Data()</a> in class.smtp.php</div>
+ <div class="index-item-description">Issues a data command and sends the msg_data to the server</div>
+ </dd>
+ </dl>
+ <a name="e"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">e</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Encoding</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Encoding">PHPMailer::$Encoding</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$ErrorInfo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$ErrorInfo">PHPMailer::$ErrorInfo</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Holds the most recent mailer error message.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Expand</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodExpand">SMTP::Expand()</a> in class.smtp.php</div>
+ <div class="index-item-description">Expand takes the name and asks the server to list all the people who are members of the _list_. Expand will return back and array of the result or false if an error occurs.</div>
+ </dd>
+ </dl>
+ <a name="f"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">f</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$From</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$From">PHPMailer::$From</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the From email address for the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$FromName</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$FromName">PHPMailer::$FromName</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the From name of the message.</div>
+ </dd>
+ </dl>
+ <a name="h"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">h</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Helo</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Helo">PHPMailer::$Helo</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the SMTP HELO of the message (Default is $Hostname).</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Host</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Host">PHPMailer::$Host</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Hostname</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Hostname">PHPMailer::$Hostname</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Hello</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodHello">SMTP::Hello()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the HELO command to the smtp server.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Help</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodHelp">SMTP::Help()</a> in class.smtp.php</div>
+ <div class="index-item-description">Gets help information on the keyword specified. If the keyword</div>
+ </dd>
+ </dl>
+ <a name="i"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">i</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">IsError</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsError">PHPMailer::IsError()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Returns true if an error occurred.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsHTML</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsHTML">PHPMailer::IsHTML()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets message type to HTML.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsMail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsMail">PHPMailer::IsMail()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using PHP mail() function.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsQmail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsQmail">PHPMailer::IsQmail()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using the qmail MTA.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsSendmail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsSendmail">PHPMailer::IsSendmail()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using the $Sendmail program.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">IsSMTP</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodIsSMTP">PHPMailer::IsSMTP()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets Mailer to send message using SMTP.</div>
+ </dd>
+ </dl>
+ <a name="m"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">m</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Mailer</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Mailer">PHPMailer::$Mailer</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Method to send mail: ("mail", "sendmail", or "smtp").</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Mail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodMail">SMTP::Mail()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in $from. Returns true if successful or false otherwise. If True the mail transaction is started and then one or more Recipient commands may be called followed by a Data command.</div>
+ </dd>
+ </dl>
+ <a name="n"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">n</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">Noop</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodNoop">SMTP::Noop()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the command NOOP to the SMTP server.</div>
+ </dd>
+ </dl>
+ <a name="p"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">p</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Password</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Password">PHPMailer::$Password</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP password.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$PluginDir</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$PluginDir">PHPMailer::$PluginDir</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Port</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Port">PHPMailer::$Port</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the default SMTP server port.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Priority</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Priority">PHPMailer::$Priority</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Email priority (1 = High, 3 = Normal, 5 = low).</div>
+ </dd>
+ <dt class="field">
+ PHPMailer
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html">PHPMailer</a> in class.phpmailer.php</div>
+ <div class="index-item-description">PHPMailer - PHP email transport class</div>
+ </dd>
+ </dl>
+ <a name="q"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">q</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">Quit</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodQuit">SMTP::Quit()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the quit command to the server and then closes the socket if there is no error or the $close_on_error argument is true.</div>
+ </dd>
+ </dl>
+ <a name="r"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">r</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="method-title">Recipient</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodRecipient">SMTP::Recipient()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the command RCPT to the SMTP server with the TO: argument of $to.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Reset</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodReset">SMTP::Reset()</a> in class.smtp.php</div>
+ <div class="index-item-description">Sends the RSET command to abort and transaction that is currently in progress. Returns true if successful false otherwise.</div>
+ </dd>
+ </dl>
+ <a name="s"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">s</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Sender</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Sender">PHPMailer::$Sender</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Sendmail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Sendmail">PHPMailer::$Sendmail</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the path of the sendmail program.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTPAuth</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$SMTPAuth">PHPMailer::$SMTPAuth</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP authentication. Utilizes the Username and Password variables.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTPDebug</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$SMTPDebug">PHPMailer::$SMTPDebug</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP class debugging on or off.</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTPKeepAlive</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$SMTPKeepAlive">PHPMailer::$SMTPKeepAlive</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$SMTP_PORT</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#var$SMTP_PORT">SMTP::$SMTP_PORT</a> in class.smtp.php</div>
+ <div class="index-item-description">SMTP server port</div>
+ </dd>
+ <dt class="field">
+ <span class="var-title">$Subject</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Subject">PHPMailer::$Subject</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the Subject of the message.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Send</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSend">SMTP::Send()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Send</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodSend">PHPMailer::Send()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SendAndMail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSendAndMail">SMTP::SendAndMail()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SendOrMail</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSendOrMail">SMTP::SendOrMail()</a> in class.smtp.php</div>
+ <div class="index-item-description">Starts a mail transaction from the email address specified in</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SetLanguage</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodSetLanguage">PHPMailer::SetLanguage()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SMTP</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodSMTP">SMTP::SMTP()</a> in class.smtp.php</div>
+ <div class="index-item-description">Initialize the class so that the data is in a known state.</div>
+ </dd>
+ <dt class="field">
+ SMTP
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html">SMTP</a> in class.smtp.php</div>
+ <div class="index-item-description">SMTP is rfc 821 compliant and implements all the rfc 821 SMTP commands except TURN which will always return a not implemented error. SMTP also provides some utility methods for sending mail to an SMTP server.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">SmtpClose</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#methodSmtpClose">PHPMailer::SmtpClose()</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Closes the active SMTP session if one exists.</div>
+ </dd>
+ </dl>
+ <a name="t"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">t</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Timeout</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Timeout">PHPMailer::$Timeout</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets the SMTP server timeout in seconds. This function will not work with the win32 version.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Turn</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodTurn">SMTP::Turn()</a> in class.smtp.php</div>
+ <div class="index-item-description">This is an optional command for SMTP that this class does not support. This method is here to make the RFC821 Definition complete for this class and __may__ be implimented in the future</div>
+ </dd>
+ </dl>
+ <a name="u"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">u</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Username</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Username">PHPMailer::$Username</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets SMTP username.</div>
+ </dd>
+ </dl>
+ <a name="v"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">v</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$Version</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$Version">PHPMailer::$Version</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Holds PHPMailer version.</div>
+ </dd>
+ <dt class="field">
+ <span class="method-title">Verify</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/SMTP.html#methodVerify">SMTP::Verify()</a> in class.smtp.php</div>
+ <div class="index-item-description">Verifies that the name is recognized by the server.</div>
+ </dd>
+ </dl>
+ <a name="w"></a>
+ <div class="index-letter-section">
+ <div style="float: left" class="index-letter-title">w</div>
+ <div style="float: right"><a href="#top">top</a></div>
+ <div style="clear: both"></div>
+ </div>
+ <dl>
+ <dt class="field">
+ <span class="var-title">$WordWrap</span>
+ </dt>
+ <dd class="index-item-body">
+ <div class="index-item-details"><a href="PHPMailer/PHPMailer.html#var$WordWrap">PHPMailer::$WordWrap</a> in class.phpmailer.php</div>
+ <div class="index-item-description">Sets word wrapping on the body of the message to a given number of characters.</div>
+ </dd>
+ </dl>
+
+<div class="index-letter-menu">
+ <a class="index-letter" href="elementindex_PHPMailer.html#a">a</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#b">b</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#c">c</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#d">d</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#e">e</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#f">f</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#h">h</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#i">i</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#m">m</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#n">n</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#p">p</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#q">q</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#r">r</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#s">s</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#t">t</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#u">u</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#v">v</a>
+ <a class="index-letter" href="elementindex_PHPMailer.html#w">w</a>
+</div> </body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title>phpDocumentor Parser Errors and Warnings</title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <a href="#Post-parsing">Post-parsing</a><br>
+<a href="#class.smtp.php">class.smtp.php</a><br>
+<h1>class.phpmailer.php</h1>
+<h2>Warnings:</h2><br>
+<b>Warning on line 1530</b> - no @package tag was used in a DocBlock for file C:\dev\phpDocumentor-1.2.0\Classes\class.phpmailer.php<br>
+<h1>class.smtp.php</h1>
+<h2>Warnings:</h2><br>
+<b>Warning on line 1039</b> - no @package tag was used in a DocBlock for file C:\dev\phpDocumentor-1.2.0\Classes\class.smtp.php<br>
+ <p class="notes" id="credit">
+ Documention generated on Mon, 28 Jul 2003 23:25:50 -0400 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.0</a>
+ </p>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//FR"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <!-- Generated by phpDocumentor on Mon, 28 Jul 2003 23:25:49 -0400 -->
+ <title>Generated Documentation</title>
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+</head>
+
+<FRAMESET rows='100,*'>
+ <FRAME src='packages.html' name='left_top' frameborder="1" bordercolor="#999999">
+ <FRAMESET cols='25%,*'>
+ <FRAME src='li_PHPMailer.html' name='left_bottom' frameborder="1" bordercolor="#999999">
+ <FRAME src='blank.html' name='right' frameborder="1" bordercolor="#999999">
+ </FRAMESET>
+ <NOFRAMES>
+ <H2>Frame Alert</H2>
+ <P>This document is designed to be viewed using the frames feature.
+ If you see this message, you are using a non-frame-capable web client.</P>
+ </NOFRAMES>
+</FRAMESET>
+</HTML>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title></title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <div class="package-title">PHPMailer</div>
+<div class="package-details">
+
+ <dl class="tree">
+
+ <dt class="folder-title">Description</dt>
+ <dd>
+ <a href='classtrees_PHPMailer.html' target='right'>Class trees</a><br />
+ <a href='elementindex_PHPMailer.html' target='right'>Index of elements</a><br />
+ </dd>
+
+
+
+ <dt class="folder-title">Classes</dt>
+ <dd><a href='PHPMailer/PHPMailer.html' target='right'>PHPMailer</a></dd>
+ <dd><a href='PHPMailer/SMTP.html' target='right'>SMTP</a></dd>
+ <dt class="folder-title">Files</dt>
+ <dd><a href='PHPMailer/_class_phpmailer_php.html' target='right'>class.phpmailer.php</a></dd>
+ <dd><a href='PHPMailer/_class_smtp_php.html' target='right'>class.smtp.php</a></dd>
+
+
+ </dl>
+</div>
+<p class="notes"><a href="http://www.phpdoc.org" target="_blank">phpDocumentor v <span class="field">1.2.0</span></a></p>
+</BODY>
+</HTML>
\ No newline at end of file
--- /dev/null
+body
+{
+ background-color: #CCCCFF;
+ margin: 0px;
+ padding: 0px;
+}
+
+/* Banner (top bar) classes */
+
+.banner { }
+
+.banner-menu
+{
+ clear: both;
+ padding: .5em;
+ border-top: 2px solid #6666AA;
+}
+
+.banner-title
+{
+ text-align: right;
+ font-size: 20pt;
+ font-weight: bold;
+ margin: .2em;
+}
+
+.package-selector
+{
+ background-color: #AAAADD;
+ border: 1px solid black;
+ color: yellow;
+}
--- /dev/null
+a { color: #336699; text-decoration: none; }
+a:hover { color: #6699CC; text-decoration: underline; }
+a:active { color: #6699CC; text-decoration: underline; }
+
+body, table { font-family: Georgia, Times New Roman, Times, serif; font-size: 10pt }
+p, li { line-height: 140% }
+a img { border: 0px; }
+dd { margin-left: 0px; padding-left: 1em; }
+
+/* Page layout/boxes */
+
+.info-box {}
+.info-box-title { margin: 1em 0em 0em 0em; padding: .25em; font-weight: normal; font-size: 14pt; border: 2px solid #999999; background-color: #CCCCFF }
+.info-box-body { border: 1px solid #999999; padding: .5em; }
+.nav-bar { font-size: 8pt; white-space: nowrap; text-align: right; padding: .2em; margin: 0em 0em 1em 0em; }
+
+.oddrow { background-color: #F8F8F8; border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
+.evenrow { border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
+
+.page-body { max-width: 800px; margin: auto; }
+.tree dl { margin: 0px }
+
+/* Index formatting classes */
+
+.index-item-body { margin-top: .5em; margin-bottom: .5em}
+.index-item-description { margin-top: .25em }
+.index-item-details { font-weight: normal; font-style: italic; font-size: 8pt }
+.index-letter-section { background-color: #EEEEEE; border: 1px dotted #999999; padding: .5em; margin-bottom: 1em}
+.index-letter-title { font-size: 12pt; font-weight: bold }
+.index-letter-menu { text-align: center; margin: 1em }
+.index-letter { font-size: 12pt }
+
+/* Docbook classes */
+
+.description {}
+.short-description { font-weight: bold; color: #666666; }
+.tags { padding-left: 0em; margin-left: 3em; color: #666666; list-style-type: square; }
+.parameters { padding-left: 0em; margin-left: 3em; font-style: italic; list-style-type: square; }
+.redefinitions { font-size: 8pt; padding-left: 0em; margin-left: 2em; }
+.package { }
+.package-title { font-weight: bold; font-size: 14pt; border-bottom: 1px solid black }
+.package-details { font-size: 85%; }
+.sub-package { font-weight: bold; font-size: 120% }
+.tutorial { border-width: thin; border-color: #0066ff }
+.tutorial-nav-box { width: 100%; border: 1px solid #999999; background-color: #F8F8F8; }
+.nav-button-disabled { color: #999999; }
+.nav-button:active,
+.nav-button:focus,
+.nav-button:hover { background-color: #DDDDDD; outline: 1px solid #999999; text-decoration: none }
+.folder-title { font-style: italic }
+
+/* Generic formatting */
+
+.field { font-weight: bold; }
+.detail { font-size: 8pt; }
+.notes { font-style: italic; font-size: 8pt; }
+.separator { background-color: #999999; height: 2px; }
+.warning { color: #FF6600; }
+.disabled { font-style: italic; color: #999999; }
+
+/* Code elements */
+
+.line-number { }
+
+.class-table { width: 100%; }
+.class-table-header { border-bottom: 1px dotted #666666; text-align: left}
+.class-name { color: #000000; font-weight: bold; }
+
+.method-summary { padding-left: 1em; font-size: 8pt }
+.method-header { }
+.method-definition { margin-bottom: .3em }
+.method-title { font-weight: bold; }
+.method-name { font-weight: bold; }
+.method-signature { font-size: 85%; color: #666666; margin: .5em 0em }
+.method-result { font-style: italic; }
+
+.var-summary { padding-left: 1em; font-size: 8pt; }
+.var-header { }
+.var-title { margin-bottom: .3em }
+.var-type { font-style: italic; }
+.var-name { font-weight: bold; }
+.var-default {}
+.var-description { font-weight: normal; color: #000000; }
+
+.include-title { }
+.include-type { font-style: italic; }
+.include-name { font-weight: bold; }
+
+.const-title { }
+.const-name { font-weight: bold; }
+
+/* Syntax highlighting */
+
+.src-code { border: 1px solid #336699; padding: 1em; background-color: #EEEEEE; }
+
+.src-comm { color: green; }
+.src-id { }
+.src-inc { color: #0000FF; }
+.src-key { color: #0000FF; }
+.src-num { color: #CC0000; }
+.src-str { color: #66cccc; }
+.src-sym { font-weight: bold; }
+.src-var { }
+
+.src-php { font-weight: bold; }
+
+.src-doc { color: #009999 }
+.src-doc-close-template { color: #0000FF }
+.src-doc-coretag { color: #0099FF; font-weight: bold }
+.src-doc-inlinetag { color: #0099FF }
+.src-doc-internal { color: #6699cc }
+.src-doc-tag { color: #0080CC }
+.src-doc-template { color: #0000FF }
+.src-doc-type { font-style: italic }
+.src-doc-var { font-style: italic }
+
+/* tutorial */
+
+.authors { }
+.author { font-style: italic; font-weight: bold }
+.author-blurb { margin: .5em 0em .5em 2em; font-size: 85%; font-weight: normal; font-style: normal }
+.example { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em }
+.listing { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; white-space: nowrap }
+.release-info { font-size: 85%; font-style: italic; margin: 1em 0em }
+.ref-title-box { }
+.ref-title { }
+.ref-purpose { font-style: italic; color: #666666 }
+.ref-synopsis { }
+.title { font-weight: bold; margin: 1em 0em 0em 0em; padding: .25em; border: 2px solid #999999; background-color: #CCCCFF }
+.cmd-synopsis { margin: 1em 0em }
+.cmd-title { font-weight: bold }
+.toc { margin-left: 2em; padding-left: 0em }
+
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <!-- template designed by Marco Von Ballmoos -->
+ <title></title>
+ <link rel="stylesheet" href="media/stylesheet.css" />
+ <link rel="stylesheet" href="media/banner.css" />
+ <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
+ </head>
+ <body>
+ <div class="banner">
+ <div class="banner-title">PHPMailer</div>
+ <div class="banner-menu">
+ <table cellpadding="0" cellspacing="0" style="width: 100%">
+ <tr>
+ <td>
+ </td>
+ <td style="width: 2em"> </td>
+ <td style="text-align: right">
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </body>
+ </html>
\ No newline at end of file
--- /dev/null
+<?php\r
+/*******************\r
+ Unit Test\r
+ Type: phpmailer class\r
+********************/\r
+\r
+$INCLUDE_DIR = "../";\r
+\r
+require("phpunit.php");\r
+require($INCLUDE_DIR . "class.phpmailer.php");\r
+error_reporting(E_ALL);\r
+\r
+/**\r
+ * Performs authentication tests\r
+ */\r
+class phpmailerTest extends TestCase\r
+{\r
+ /**\r
+ * Holds the default phpmailer instance.\r
+ * @private\r
+ * @type object\r
+ */\r
+ var $Mail = false;\r
+\r
+ /**\r
+ * Holds the SMTP mail host.\r
+ * @public\r
+ * @type string\r
+ */\r
+ var $Host = "";\r
+ \r
+ /**\r
+ * Holds the change log.\r
+ * @private\r
+ * @type string array\r
+ */\r
+ var $ChangeLog = array();\r
+ \r
+ /**\r
+ * Holds the note log.\r
+ * @private\r
+ * @type string array\r
+ */\r
+ var $NoteLog = array(); \r
+\r
+ /**\r
+ * Class constuctor.\r
+ */\r
+ function phpmailerTest($name) {\r
+ /* must define this constructor */\r
+ $this->TestCase( $name );\r
+ }\r
+ \r
+ /**\r
+ * Run before each test is started.\r
+ */\r
+ function setUp() {\r
+ global $global_vars;\r
+ global $INCLUDE_DIR;\r
+\r
+ $this->Mail = new PHPMailer();\r
+\r
+ $this->Mail->Priority = 3;\r
+ $this->Mail->Encoding = "8bit";\r
+ $this->Mail->CharSet = "iso-8859-1";\r
+ $this->Mail->From = "unit_test@phpmailer.sf.net";\r
+ $this->Mail->FromName = "Unit Tester";\r
+ $this->Mail->Sender = "";\r
+ $this->Mail->Subject = "Unit Test";\r
+ $this->Mail->Body = "";\r
+ $this->Mail->AltBody = "";\r
+ $this->Mail->WordWrap = 0;\r
+ $this->Mail->Host = $global_vars["mail_host"];\r
+ $this->Mail->Port = 25;\r
+ $this->Mail->Helo = "localhost.localdomain";\r
+ $this->Mail->SMTPAuth = false;\r
+ $this->Mail->Username = "";\r
+ $this->Mail->Password = "";\r
+ $this->Mail->PluginDir = $INCLUDE_DIR;\r
+ $this->Mail->AddReplyTo("no_reply@phpmailer.sf.net", "Reply Guy");\r
+ $this->Mail->Sender = "unit_test@phpmailer.sf.net";\r
+\r
+ if(strlen($this->Mail->Host) > 0)\r
+ $this->Mail->Mailer = "smtp";\r
+ else\r
+ {\r
+ $this->Mail->Mailer = "mail";\r
+ $this->Sender = "unit_test@phpmailer.sf.net";\r
+ }\r
+ \r
+ global $global_vars;\r
+ $this->SetAddress($global_vars["mail_to"], "Test User");\r
+ if(strlen($global_vars["mail_cc"]) > 0)\r
+ $this->SetAddress($global_vars["mail_cc"], "Carbon User", "cc");\r
+ } \r
+\r
+ /**\r
+ * Run after each test is completed.\r
+ */\r
+ function tearDown() {\r
+ // Clean global variables\r
+ $this->Mail = NULL;\r
+ $this->ChangeLog = array();\r
+ $this->NoteLog = array();\r
+ }\r
+\r
+\r
+ /**\r
+ * Build the body of the message in the appropriate format.\r
+ * @private\r
+ * @returns void\r
+ */\r
+ function BuildBody() {\r
+ $this->CheckChanges();\r
+ \r
+ // Determine line endings for message \r
+ if($this->Mail->ContentType == "text/html" || strlen($this->Mail->AltBody) > 0)\r
+ {\r
+ $eol = "<br/>";\r
+ $bullet = "<li>";\r
+ $bullet_start = "<ul>";\r
+ $bullet_end = "</ul>";\r
+ }\r
+ else\r
+ {\r
+ $eol = "\n";\r
+ $bullet = " - ";\r
+ $bullet_start = "";\r
+ $bullet_end = "";\r
+ }\r
+ \r
+ $ReportBody = "";\r
+ \r
+ $ReportBody .= "---------------------" . $eol;\r
+ $ReportBody .= "Unit Test Information" . $eol;\r
+ $ReportBody .= "---------------------" . $eol;\r
+ $ReportBody .= "phpmailer version: " . $this->Mail->Version . $eol;\r
+ $ReportBody .= "Content Type: " . $this->Mail->ContentType . $eol;\r
+ \r
+ if(strlen($this->Mail->Host) > 0)\r
+ $ReportBody .= "Host: " . $this->Mail->Host . $eol;\r
+ \r
+ // If attachments then create an attachment list\r
+ if(count($this->Mail->attachment) > 0)\r
+ {\r
+ $ReportBody .= "Attachments:" . $eol;\r
+ $ReportBody .= $bullet_start;\r
+ for($i = 0; $i < count($this->Mail->attachment); $i++)\r
+ {\r
+ $ReportBody .= $bullet . "Name: " . $this->Mail->attachment[$i][1] . ", ";\r
+ $ReportBody .= "Encoding: " . $this->Mail->attachment[$i][3] . ", ";\r
+ $ReportBody .= "Type: " . $this->Mail->attachment[$i][4] . $eol;\r
+ }\r
+ $ReportBody .= $bullet_end . $eol;\r
+ }\r
+ \r
+ // If there are changes then list them\r
+ if(count($this->ChangeLog) > 0)\r
+ {\r
+ $ReportBody .= "Changes" . $eol;\r
+ $ReportBody .= "-------" . $eol;\r
+\r
+ $ReportBody .= $bullet_start;\r
+ for($i = 0; $i < count($this->ChangeLog); $i++)\r
+ {\r
+ $ReportBody .= $bullet . $this->ChangeLog[$i][0] . " was changed to [" . \r
+ $this->ChangeLog[$i][1] . "]" . $eol;\r
+ }\r
+ $ReportBody .= $bullet_end . $eol . $eol;\r
+ }\r
+ \r
+ // If there are notes then list them\r
+ if(count($this->NoteLog) > 0)\r
+ {\r
+ $ReportBody .= "Notes" . $eol;\r
+ $ReportBody .= "-----" . $eol;\r
+\r
+ $ReportBody .= $bullet_start;\r
+ for($i = 0; $i < count($this->NoteLog); $i++)\r
+ {\r
+ $ReportBody .= $bullet . $this->NoteLog[$i] . $eol;\r
+ }\r
+ $ReportBody .= $bullet_end;\r
+ }\r
+ \r
+ // Re-attach the original body\r
+ $this->Mail->Body .= $eol . $eol . $ReportBody;\r
+ }\r
+ \r
+ /**\r
+ * Check which default settings have been changed for the report.\r
+ * @private\r
+ * @returns void\r
+ */\r
+ function CheckChanges() {\r
+ if($this->Mail->Priority != 3)\r
+ $this->AddChange("Priority", $this->Mail->Priority);\r
+ if($this->Mail->Encoding != "8bit")\r
+ $this->AddChange("Encoding", $this->Mail->Encoding);\r
+ if($this->Mail->CharSet != "iso-8859-1")\r
+ $this->AddChange("CharSet", $this->Mail->CharSet);\r
+ if($this->Mail->Sender != "")\r
+ $this->AddChange("Sender", $this->Mail->Sender);\r
+ if($this->Mail->WordWrap != 0)\r
+ $this->AddChange("WordWrap", $this->Mail->WordWrap);\r
+ if($this->Mail->Mailer != "mail")\r
+ $this->AddChange("Mailer", $this->Mail->Mailer);\r
+ if($this->Mail->Port != 25)\r
+ $this->AddChange("Port", $this->Mail->Port);\r
+ if($this->Mail->Helo != "localhost.localdomain")\r
+ $this->AddChange("Helo", $this->Mail->Helo);\r
+ if($this->Mail->SMTPAuth)\r
+ $this->AddChange("SMTPAuth", "true");\r
+ }\r
+ \r
+ /**\r
+ * Adds a change entry.\r
+ * @private\r
+ * @returns void\r
+ */\r
+ function AddChange($sName, $sNewValue) {\r
+ $cur = count($this->ChangeLog);\r
+ $this->ChangeLog[$cur][0] = $sName;\r
+ $this->ChangeLog[$cur][1] = $sNewValue;\r
+ }\r
+ \r
+ /**\r
+ * Adds a simple note to the message.\r
+ * @public\r
+ * @returns void\r
+ */\r
+ function AddNote($sValue) {\r
+ $this->NoteLog[] = $sValue;\r
+ }\r
+\r
+ /**\r
+ * Adds all of the addresses\r
+ * @public\r
+ * @returns void\r
+ */\r
+ function SetAddress($sAddress, $sName = "", $sType = "to") {\r
+ switch($sType)\r
+ {\r
+ case "to":\r
+ $this->Mail->AddAddress($sAddress, $sName);\r
+ break;\r
+ case "cc":\r
+ $this->Mail->AddCC($sAddress, $sName);\r
+ break;\r
+ case "bcc":\r
+ $this->Mail->AddBCC($sAddress, $sName);\r
+ break;\r
+ }\r
+ }\r
+\r
+ /////////////////////////////////////////////////\r
+ // UNIT TESTS\r
+ /////////////////////////////////////////////////\r
+\r
+ /**\r
+ * Try a plain message.\r
+ */\r
+ function test_WordWrap() {\r
+\r
+ $this->Mail->WordWrap = 40;\r
+ $my_body = "Here is the main body of this message. It should " .\r
+ "be quite a few lines. It should be wrapped at the " .\r
+ "40 characters. Make sure that it is.";\r
+ $nBodyLen = strlen($my_body);\r
+ $my_body .= "\n\nThis is the above body length: " . $nBodyLen;\r
+\r
+ $this->Mail->Body = $my_body;\r
+ $this->Mail->Subject .= ": Wordwrap";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Try a plain message.\r
+ */\r
+ function test_Low_Priority() {\r
+ \r
+ $this->Mail->Priority = 5;\r
+ $this->Mail->Body = "Here is the main body. There should be " .\r
+ "a reply to address in this message.";\r
+ $this->Mail->Subject .= ": Low Priority";\r
+ $this->Mail->AddReplyTo("nobody@nobody.com", "Nobody (Unit Test)");\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple plain file attachment test.\r
+ */\r
+ function test_Multiple_Plain_FileAttachment() {\r
+\r
+ $this->Mail->Body = "Here is the text body";\r
+ $this->Mail->Subject .= ": Plain + Multiple FileAttachments";\r
+\r
+ if(!$this->Mail->AddAttachment("test.png"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple plain string attachment test.\r
+ */\r
+ function test_Plain_StringAttachment() {\r
+\r
+ $this->Mail->Body = "Here is the text body";\r
+ $this->Mail->Subject .= ": Plain + StringAttachment";\r
+ \r
+ $sAttachment = "These characters are the content of the " .\r
+ "string attachment.\nThis might be taken from a ".\r
+ "database or some other such thing. ";\r
+ \r
+ $this->Mail->AddStringAttachment($sAttachment, "string_attach.txt");\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Plain quoted-printable message.\r
+ */\r
+ function test_Quoted_Printable() {\r
+\r
+ $this->Mail->Body = "Here is the main body";\r
+ $this->Mail->Subject .= ": Plain + Quoted-printable";\r
+ $this->Mail->Encoding = "quoted-printable";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Try a plain message.\r
+ */\r
+ function test_Html() {\r
+ \r
+ $this->Mail->IsHTML(true);\r
+ $this->Mail->Subject .= ": HTML only";\r
+ \r
+ $this->Mail->Body = "This is a <b>test message</b> written in HTML. </br>" .\r
+ "Go to <a href=\"http://phpmailer.sourceforge.net/\">" .\r
+ "http://phpmailer.sourceforge.net/</a> for new versions of " .\r
+ "phpmailer. <p/> Thank you!";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple HTML and attachment test\r
+ */\r
+ function test_HTML_Attachment() {\r
+\r
+ $this->Mail->Body = "This is the <b>HTML</b> part of the email.";\r
+ $this->Mail->Subject .= ": HTML + Attachment";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * An embedded attachment test.\r
+ */\r
+ function test_Embedded_Image() {\r
+\r
+ $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .\r
+ "Here is an image!</a>";\r
+ $this->Mail->Subject .= ": Embedded Image";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",\r
+ "base64", "image/png"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * An embedded attachment test.\r
+ */\r
+ function test_Multi_Embedded_Image() {\r
+\r
+ $this->Mail->Body = "Embedded Image: <img alt=\"phpmailer\" src=\"cid:my-attach\">" .\r
+ "Here is an image!</a>";\r
+ $this->Mail->Subject .= ": Embedded Image + Attachment";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddEmbeddedImage("test.png", "my-attach", "test.png",\r
+ "base64", "image/png"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+ \r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple multipart/alternative test.\r
+ */\r
+ function test_AltBody() {\r
+\r
+ $this->Mail->Body = "This is the <b>HTML</b> part of the email.";\r
+ $this->Mail->AltBody = "Here is the text body of this message. " .\r
+ "It should be quite a few lines. It should be wrapped at the " .\r
+ "40 characters. Make sure that it is.";\r
+ $this->Mail->WordWrap = 40;\r
+ $this->AddNote("This is a mulipart alternative email");\r
+ $this->Mail->Subject .= ": AltBody + Word Wrap";\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ /**\r
+ * Simple HTML and attachment test\r
+ */\r
+ function test_AltBody_Attachment() {\r
+\r
+ $this->Mail->Body = "This is the <b>HTML</b> part of the email.";\r
+ $this->Mail->AltBody = "This is the text part of the email.";\r
+ $this->Mail->Subject .= ": AltBody + Attachment";\r
+ $this->Mail->IsHTML(true);\r
+ \r
+ if(!$this->Mail->AddAttachment("phpmailer_test.php", "test_attach.txt"))\r
+ {\r
+ $this->assert(false, $this->Mail->ErrorInfo);\r
+ return;\r
+ }\r
+\r
+ $this->BuildBody();\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+\r
+ $fp = fopen("message.txt", "w");\r
+ fwrite($fp, $this->Mail->CreateHeader() . $this->Mail->CreateBody());\r
+ fclose($fp);\r
+ } \r
+\r
+ function test_MultipleSend() {\r
+ $this->Mail->Body = "Sending two messages without keepalive";\r
+ $this->BuildBody();\r
+ $subject = $this->Mail->Subject;\r
+\r
+ $this->Mail->Subject = $subject . ": SMTP 1";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ \r
+ $this->Mail->Subject = $subject . ": SMTP 2";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+\r
+ function test_SmtpKeepAlive() {\r
+ $this->Mail->Body = "This was done using the SMTP keep-alive.";\r
+ $this->BuildBody();\r
+ $subject = $this->Mail->Subject;\r
+\r
+ $this->Mail->SMTPKeepAlive = true;\r
+ $this->Mail->Subject = $subject . ": SMTP keep-alive 1";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ \r
+ $this->Mail->Subject = $subject . ": SMTP keep-alive 2";\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ $this->Mail->SmtpClose();\r
+ }\r
+ \r
+ /**\r
+ * Tests this denial of service attack: \r
+ * http://www.cybsec.com/vuln/PHPMailer-DOS.pdf\r
+ */\r
+ function test_DenialOfServiceAttack() {\r
+ $this->Mail->Body = "This should no longer cause a denial of service.";\r
+ $this->BuildBody();\r
+ \r
+ $this->Mail->Subject = str_repeat("A", 998);\r
+ $this->assert($this->Mail->Send(), $this->Mail->ErrorInfo);\r
+ }\r
+ \r
+ function test_Error() {\r
+ $this->Mail->Subject .= ": This should be sent"; \r
+ $this->BuildBody();\r
+ $this->Mail->ClearAllRecipients(); // no addresses should cause an error\r
+ $this->assert($this->Mail->IsError() == false, "Error found");\r
+ $this->assert($this->Mail->Send() == false, "Send succeeded");\r
+ $this->assert($this->Mail->IsError(), "No error found");\r
+ $this->assertEquals('You must provide at least one ' .\r
+ 'recipient email address.', $this->Mail->ErrorInfo);\r
+ $this->Mail->AddAddress(get("mail_to"));\r
+ $this->assert($this->Mail->Send(), "Send failed");\r
+ }\r
+} \r
+ \r
+/**\r
+ * Create and run test instance.\r
+ */\r
+ \r
+if(isset($HTTP_GET_VARS))\r
+ $global_vars = $HTTP_GET_VARS;\r
+else\r
+ $global_vars = $_REQUEST;\r
+\r
+if(isset($global_vars["submitted"]))\r
+{\r
+ echo "Test results:<br>";\r
+ $suite = new TestSuite( "phpmailerTest" );\r
+ \r
+ $testRunner = new TestRunner;\r
+ $testRunner->run($suite);\r
+ echo "<hr noshade/>";\r
+}\r
+\r
+function get($sName) {\r
+ global $global_vars;\r
+ if(isset($global_vars[$sName]))\r
+ return $global_vars[$sName];\r
+ else\r
+ return "";\r
+}\r
+\r
+?>\r
+\r
+<html>\r
+<body>\r
+<h3>phpmailer Unit Test</h3>\r
+By entering a SMTP hostname it will automatically perform tests with SMTP.\r
+\r
+<form name="phpmailer_unit" action="phpmailer_test.php" method="get">\r
+<input type="hidden" name="submitted" value="1"/>\r
+To Address: <input type="text" size="50" name="mail_to" value="<?php echo get("mail_to"); ?>"/>\r
+<br/>\r
+Cc Address: <input type="text" size="50" name="mail_cc" value="<?php echo get("mail_cc"); ?>"/>\r
+<br/>\r
+SMTP Hostname: <input type="text" size="50" name="mail_host" value="<?php echo get("mail_host"); ?>"/>\r
+<p/>\r
+<input type="submit" value="Run Test"/>\r
+\r
+</form>\r
+</body>\r
+</html>\r
--- /dev/null
+<?php\r
+//\r
+// PHP framework for testing, based on the design of "JUnit".\r
+//\r
+// Written by Fred Yankowski <fred@ontosys.com>\r
+// OntoSys, Inc <http://www.OntoSys.com>\r
+//\r
+// $Id: phpunit.php,v 1.1 2002/03/30 19:32:17 bmatzelle Exp $\r
+\r
+// Copyright (c) 2000 Fred Yankowski\r
+\r
+// Permission is hereby granted, free of charge, to any person\r
+// obtaining a copy of this software and associated documentation\r
+// files (the "Software"), to deal in the Software without\r
+// restriction, including without limitation the rights to use, copy,\r
+// modify, merge, publish, distribute, sublicense, and/or sell copies\r
+// of the Software, and to permit persons to whom the Software is\r
+// furnished to do so, subject to the following conditions:\r
+//\r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+//\r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\r
+// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\r
+// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
+// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\r
+// SOFTWARE.\r
+//\r
+error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE |\r
+ E_CORE_ERROR | E_CORE_WARNING);\r
+\r
+/*\r
+interface Test {\r
+ function run(&$aTestResult);\r
+ function countTestCases();\r
+}\r
+*/\r
+\r
+function trace($msg) {\r
+ return;\r
+ print($msg);\r
+ flush();\r
+}\r
+\r
+\r
+class Exception {\r
+ /* Emulate a Java exception, sort of... */\r
+ var $message;\r
+ function Exception($message) {\r
+ $this->message = $message;\r
+ }\r
+ function getMessage() {\r
+ return $this->message;\r
+ }\r
+}\r
+\r
+class Assert {\r
+ function assert($boolean, $message=0) {\r
+ if (! $boolean)\r
+ $this->fail($message);\r
+ }\r
+\r
+ function assertEquals($expected, $actual, $message=0) {\r
+ if ($expected != $actual) {\r
+ $this->failNotEquals($expected, $actual, "expected", $message);\r
+ }\r
+ }\r
+\r
+ function assertRegexp($regexp, $actual, $message=false) {\r
+ if (! preg_match($regexp, $actual)) {\r
+ $this->failNotEquals($regexp, $actual, "pattern", $message);\r
+ }\r
+ }\r
+\r
+ function failNotEquals($expected, $actual, $expected_label, $message=0) {\r
+ // Private function for reporting failure to match.\r
+ $str = $message ? ($message . ' ') : '';\r
+ $str .= "($expected_label/actual)<br>";\r
+ $htmlExpected = htmlspecialchars($expected);\r
+ $htmlActual = htmlspecialchars($actual);\r
+ $str .= sprintf("<pre>%s\n--------\n%s</pre>",\r
+ $htmlExpected, $htmlActual);\r
+ $this->fail($str);\r
+ }\r
+}\r
+\r
+class TestCase extends Assert /* implements Test */ {\r
+ /* Defines context for running tests. Specific context -- such as\r
+ instance variables, global variables, global state -- is defined\r
+ by creating a subclass that specializes the setUp() and\r
+ tearDown() methods. A specific test is defined by a subclass\r
+ that specializes the runTest() method. */\r
+ var $fName;\r
+ var $fResult;\r
+ var $fExceptions = array();\r
+\r
+ function TestCase($name) {\r
+ $this->fName = $name;\r
+ }\r
+\r
+ function run($testResult=0) {\r
+ /* Run this single test, by calling the run() method of the\r
+ TestResult object which will in turn call the runBare() method\r
+ of this object. That complication allows the TestResult object\r
+ to do various kinds of progress reporting as it invokes each\r
+ test. Create/obtain a TestResult object if none was passed in.\r
+ Note that if a TestResult object was passed in, it must be by\r
+ reference. */\r
+ if (! $testResult)\r
+ $testResult = $this->_createResult();\r
+ $this->fResult = $testResult;\r
+ $testResult->run(&$this);\r
+ $this->fResult = 0;\r
+ return $testResult;\r
+ }\r
+\r
+ function countTestCases() {\r
+ return 1;\r
+ }\r
+\r
+ function runTest() {\r
+ $name = $this->name();\r
+ // Since isset($this->$name) is false, no way to run defensive checks\r
+ $this->$name();\r
+ }\r
+\r
+ function setUp() /* expect override */ {\r
+ //print("TestCase::setUp()<br>\n");\r
+ }\r
+\r
+ function tearDown() /* possible override */ {\r
+ //print("TestCase::tearDown()<br>\n");\r
+ }\r
+\r
+ ////////////////////////////////////////////////////////////////\r
+\r
+\r
+ function _createResult() /* protected */ {\r
+ /* override this to use specialized subclass of TestResult */\r
+ return new TestResult;\r
+ }\r
+\r
+ function fail($message=0) {\r
+ //printf("TestCase::fail(%s)<br>\n", ($message) ? $message : '');\r
+ /* JUnit throws AssertionFailedError here. We just record the\r
+ failure and carry on */\r
+ $this->fExceptions[] = new Exception(&$message);\r
+ }\r
+\r
+ function error($message) {\r
+ /* report error that requires correction in the test script\r
+ itself, or (heaven forbid) in this testing infrastructure */\r
+ printf('<b>ERROR: ' . $message . '</b><br>');\r
+ $this->fResult->stop();\r
+ }\r
+\r
+ function failed() {\r
+ return count($this->fExceptions);\r
+ }\r
+\r
+ function getExceptions() {\r
+ return $this->fExceptions;\r
+ }\r
+\r
+ function name() {\r
+ return $this->fName;\r
+ }\r
+\r
+ function runBare() {\r
+ $this->setup();\r
+ $this->runTest();\r
+ $this->tearDown();\r
+ }\r
+}\r
+\r
+\r
+class TestSuite /* implements Test */ {\r
+ /* Compose a set of Tests (instances of TestCase or TestSuite), and\r
+ run them all. */\r
+ var $fTests = array();\r
+\r
+ function TestSuite($classname=false) {\r
+ if ($classname) {\r
+ // Find all methods of the given class whose name starts with\r
+ // "test" and add them to the test suite. We are just _barely_\r
+ // able to do this with PHP's limited introspection... Note\r
+ // that PHP seems to store method names in lower case, and we\r
+ // have to avoid the constructor function for the TestCase class\r
+ // superclass. This will fail when $classname starts with\r
+ // "Test" since that will have a constructor method that will\r
+ // get matched below and then treated (incorrectly) as a test\r
+ // method. So don't name any TestCase subclasses as "Test..."!\r
+ if (floor(phpversion()) >= 4) {\r
+ // PHP4 introspection, submitted by Dylan Kuhn\r
+ $names = get_class_methods($classname);\r
+ while (list($key, $method) = each($names)) {\r
+ if (preg_match('/^test/', $method) && $method != "testcase") { \r
+ $this->addTest(new $classname($method));\r
+ }\r
+ }\r
+ }\r
+ else {\r
+ $dummy = new $classname("dummy");\r
+ $names = (array) $dummy;\r
+ while (list($key, $value) = each($names)) {\r
+ $type = gettype($value);\r
+ if ($type == "user function" && preg_match('/^test/', $key)\r
+ && $key != "testcase") { \r
+ $this->addTest(new $classname($key));\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ function addTest($test) {\r
+ /* Add TestCase or TestSuite to this TestSuite */\r
+ $this->fTests[] = $test;\r
+ }\r
+\r
+ function run(&$testResult) {\r
+ /* Run all TestCases and TestSuites comprising this TestSuite,\r
+ accumulating results in the given TestResult object. */\r
+ reset($this->fTests);\r
+ while (list($na, $test) = each($this->fTests)) {\r
+ if ($testResult->shouldStop())\r
+ break;\r
+ $test->run(&$testResult);\r
+ }\r
+ }\r
+\r
+ function countTestCases() {\r
+ /* Number of TestCases comprising this TestSuite (including those\r
+ in any constituent TestSuites) */\r
+ $count = 0;\r
+ reset($fTests);\r
+ while (list($na, $test_case) = each($this->fTests)) {\r
+ $count += $test_case->countTestCases();\r
+ }\r
+ return $count;\r
+ }\r
+}\r
+\r
+\r
+class TestFailure {\r
+ /* Record failure of a single TestCase, associating it with the\r
+ exception(s) that occurred */\r
+ var $fFailedTestName;\r
+ var $fExceptions;\r
+\r
+ function TestFailure(&$test, &$exceptions) {\r
+ $this->fFailedTestName = $test->name();\r
+ $this->fExceptions = $exceptions;\r
+ }\r
+\r
+ function getExceptions() {\r
+ return $this->fExceptions;\r
+ }\r
+ function getTestName() {\r
+ return $this->fFailedTestName;\r
+ }\r
+}\r
+\r
+\r
+class TestResult {\r
+ /* Collect the results of running a set of TestCases. */\r
+ var $fFailures = array();\r
+ var $fRunTests = 0;\r
+ var $fStop = false;\r
+\r
+ function TestResult() { }\r
+\r
+ function _endTest($test) /* protected */ {\r
+ /* specialize this for end-of-test action, such as progress\r
+ reports */\r
+ }\r
+\r
+ function getFailures() {\r
+ return $this->fFailures;\r
+ }\r
+\r
+ function run($test) {\r
+ /* Run a single TestCase in the context of this TestResult */\r
+ $this->_startTest($test);\r
+ $this->fRunTests++;\r
+\r
+ $test->runBare();\r
+\r
+ /* this is where JUnit would catch AssertionFailedError */\r
+ $exceptions = $test->getExceptions();\r
+ if ($exceptions)\r
+ $this->fFailures[] = new TestFailure(&$test, &$exceptions);\r
+ $this->_endTest($test);\r
+ }\r
+\r
+ function countTests() {\r
+ return $this->fRunTests;\r
+ }\r
+\r
+ function shouldStop() {\r
+ return $this->fStop;\r
+ }\r
+\r
+ function _startTest($test) /* protected */ {\r
+ /* specialize this for start-of-test actions */\r
+ }\r
+\r
+ function stop() {\r
+ /* set indication that the test sequence should halt */\r
+ $fStop = true;\r
+ }\r
+\r
+ function countFailures() {\r
+ return count($this->fFailures);\r
+ }\r
+}\r
+\r
+\r
+class TextTestResult extends TestResult {\r
+ /* Specialize TestResult to produce text/html report */\r
+ function TextTestResult() {\r
+ $this->TestResult(); // call superclass constructor\r
+ }\r
+ \r
+ function report() {\r
+ /* report result of test run */\r
+ $nRun = $this->countTests();\r
+ $nFailures = $this->countFailures();\r
+ printf("<p>%s test%s run<br>", $nRun, ($nRun == 1) ? '' : 's');\r
+ printf("%s failure%s.<br>\n", $nFailures, ($nFailures == 1) ? '' : 's');\r
+ if ($nFailures == 0)\r
+ return;\r
+\r
+ print("<ol>\n");\r
+ $failures = $this->getFailures();\r
+ while (list($i, $failure) = each($failures)) {\r
+ $failedTestName = $failure->getTestName();\r
+ printf("<li>%s\n", $failedTestName);\r
+\r
+ $exceptions = $failure->getExceptions();\r
+ print("<ul>");\r
+ while (list($na, $exception) = each($exceptions))\r
+ printf("<li>%s\n", $exception->getMessage());\r
+ print("</ul>");\r
+ }\r
+ print("</ol>\n");\r
+ }\r
+\r
+ function _startTest($test) {\r
+ printf("%s ", $test->name());\r
+ flush();\r
+ }\r
+\r
+ function _endTest($test) {\r
+ $outcome = $test->failed()\r
+ ? "<font color=\"red\">FAIL</font>"\r
+ : "<font color=\"green\">ok</font>";\r
+ printf("$outcome<br>\n");\r
+ flush();\r
+ }\r
+}\r
+\r
+\r
+class TestRunner {\r
+ /* Run a suite of tests and report results. */\r
+ function run($suite) {\r
+ $result = new TextTestResult;\r
+ $suite->run($result);\r
+ $result->report();\r
+ }\r
+}\r
+\r
+?>\r
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
$cfg->setConfigEntry('compile_output_path', "templates/_compiled/"); // DON'T MISS THE TRAILING SLASH!
// CFG: TEMPLATE-ENGINE
-$cfg->setConfigEntry('template_class', "TemplateEngine");
+$cfg->setConfigEntry('template_class', "WebTemplateEngine");
// CFG: DEBUG-ENGINE
$cfg->setConfigEntry('debug_class', "DebugWebOutput");
// CFG: DATASET-CRITERIA
$cfg->setConfigEntry('dataset_criteria_class', "DataSetCriteria");
+// CFG: UPDATE-CRITERIA
+$cfg->setConfigEntry('update_criteria_class', "UpdateCriteria");
+
// CFG: FILE-IO-HANDLER
$cfg->setConfigEntry('file_io_class', "FileIoHandler");
// CFG: USERNAME-VALIDATOR
$cfg->setConfigEntry('username_validator_class', "UserNameValidatorFilter");
+// CFG: USERNAME-IS-GUEST
+$cfg->setConfigEntry('username_is_guest_class', "UserNameIsGuestFilter");
+
// CFG: PASSWORD-VALIDATOR
$cfg->setConfigEntry('password_validator_class', "PasswordValidatorFilter");
-// CFG: RULES-ACCEPTED-FILTER
+// CFG: RULES-ACCEPTED-CLASS
$cfg->setConfigEntry('rules_accepted_class', "RulesAcceptedFilter");
-// CFG: CRYPTO-HELPER
+// CFG: USERNAME-VERIFIER-CLASS
+$cfg->setConfigEntry('username_verifier_class', "UserNameVerifierFilter");
+
+// CFG: USER-GUEST-VERIFIER-CLASS
+$cfg->setConfigEntry('user_guest_verifier_class', "UserGuestVerifierFilter");
+
+// CFG: EMAIL-VERIFIER
+$cfg->setConfigEntry('email_verifier_class', "EmailVerifierFilter");
+
+// CFG: PASSWORD-VERIFIER-CLASS
+$cfg->setConfigEntry('password_verifier_class', "PasswordVerifierFilter");
+
+// CFG: PASSWD-GUEST-VERIFIER-CLASS
+$cfg->setConfigEntry('passwd_guest_verifier_class', "PasswordGuestVerifierFilter");
+
+// CFG: EMAIL-CHANGE-CLASS
+$cfg->setConfigEntry('email_change_class', "EmailChangeFilter");
+
+// CFG: PASSWORD-CHANGE-CLASS
+$cfg->setConfigEntry('password_change_class', "PasswordChangeFilter");
+
+// CFG: ACCOUNT-PASSWORD-CLASS
+$cfg->setConfigEntry('account_password_class', "AccountPasswordVerifierFilter");
+
+// CFG: USER-STATUS-CLASS
+$cfg->setConfigEntry('user_status_class', "UserStatusVerifierFilter");
+
+// CFG: USER-UNCONFIRMED-CLASS
+$cfg->setConfigEntry('user_unconfirmed_class', "UserUnconfirmedVerifierFilter");
+
+// CFG: CRYPTO-CLASS
$cfg->setConfigEntry('crypto_class', "CryptoHelper");
// CFG: RNG-CLASS
$cfg->setConfigEntry('rng_class', "RandomNumberGenerator");
-// CFG: USER-DB-WRAPPER
+// CFG: USER-DB-WRAPPER-CLASS
$cfg->setConfigEntry('user_db_wrapper_class', "UserDatabaseWrapper");
-// CFG: WEB-CMD-RESOLVER
+// CFG: NEWS-DB-WRAPPER-CLASS
+$cfg->setConfigEntry('news_db_wrapper_class', "NewsDatabaseWrapper");
+
+// CFG: WEB-CMD-RESOLVER-CLASS
$cfg->setConfigEntry('web_cmd_resolver_class', "WebCommandResolver");
+// CFG: IMAGE-CMD-RESOLVER-CLASS
+$cfg->setConfigEntry('image_cmd_resolver_class', "ImageCommandResolver");
+
+// CFG: MAILER-CLASS
+$cfg->setConfigEntry('mailer_class', "DebugMailer");
+
// CFG: MATH-PRIME
$cfg->setConfigEntry('math_prime', 591623);
$cfg->setConfigEntry('post_registration_class', "LoginAfterRegistrationAction");
// CFG: USER-CLASS
-$cfg->setConfigEntry('user_class', "User");
+$cfg->setConfigEntry('user_class', "Member");
+
+// CFG: GUEST-CLASS
+$cfg->setConfigEntry('guest_class', "Guest");
// CFG: COOKIE-EXPIRE
$cfg->setConfigEntry('cookie_expire', (60*60*2)); // Two hours!
// CFG: COOKIE-SSL
$cfg->setConfigEntry('cookie_ssl', (isset($_SERVER['HTTPS'])));
+// CFG: CRYPT-FIXED-SALT
+$cfg->setConfigEntry('crypt_fixed_salt', "N");
+
+// CFG: DB-UPDATE-PRIMARY-FORCED
+$cfg->setConfigEntry('db_update_primary_forced', "Y");
+
+// CFG: GERMAN-DATE-TIME
+$cfg->setConfigEntry('german_date_time', "%3\$s.%2\$s.%1\$s, %4\$s:%5\$s:%6\$s");
+
// [EOF]
?>
* @see ClassLoader
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
private static $cfgInstance = null;
// Some constants for the configuration system
- const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0x040;
- const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0x041;
+ const EXCEPTION_CONFIG_ENTRY_IS_EMPTY = 0x130;
+ const EXCEPTION_CONFIG_ENTRY_WAS_NOT_FOUND = 0x131;
/**
* Protected constructor
+ *
+ * @return void
*/
protected function __construct () {
// Empty for now
/**
* "Create" a configuration instance
+ *
+ * @param $enableDebug Wether enable debug mode (default: off)
+ * @return $cfgInstance An instance of this configuration class
*/
public final static function createFrameworkConfiguration ($enableDebug = false) {
/**
* through the initial configuration.
*/
if (is_null(self::$cfgInstance)) {
- // CFG: DEBUG-LEVEL
+ // CFG: ERROR-REPORTING
@error_reporting(E_ALL | E_STRICT);
/**
// At least 5.1.0 is required for this!
if (version_compare(phpversion(), "5.1.0")) {
@date_default_timezone_set($zone);
- }
+ } // END - if
}
/**
// Is the file name really set?
if (!empty($inc)) {
+ // Base path is by default added
+ $fqfn = $inc;
+
// Base path added? (Uni* / Windows)
if ((substr($inc, 0, 1) != "/") && (substr($inc, 1, 1) != ":")) {
// Generate FQFN
$fqfn = sprintf("%s/inc/extra/%s", PATH, $inc);
- } else {
- // Base path is already added
- $fqfn = $inc;
- }
- }
+ } // END - if
+ } // END - if
// Include them all here
require($fqfn);
}
- }
+ } // END - if
}
/**
*/
public function defineDatabaseType ($type) {
// Is it defined or not?
- if (!defined('_DB_TYPE')) {
- // Cast to string
- $type = (string) $type;
-
- // Set the constant
- define('_DB_TYPE', $type);
- } else {
+ if (defined('_DB_TYPE')) {
// Already defined! But we cannot throw an exception here... :(
ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the database type only once in your application!",
__CLASS__
));
}
+
+ // Set the constant
+ define('_DB_TYPE', (string) $type);
}
/**
ApplicationEntryPoint::app_die(sprintf("[%s:] Invalid path (not found) specified. Please make sure it is created.",
__CLASS__
));
- } elseif (!defined('PATH')) {
- // Set the constant
- define('PATH', $path);
- } else {
+ } elseif (defined('PATH')) {
// Already defined! But we cannot throw an exception here... :(
ApplicationEntryPoint::app_die(sprintf("[%s:] Please define the local file path only once in your application.",
__CLASS__
));
}
+
+ // Define path here
+ define('PATH', $path);
}
/**
// Debug message
if ((defined('DEBUG_CONFIG')) || (defined('DEBUG_ALL'))) {
echo "[".__METHOD__."] Configuration entry ".$cfgEntry." requested.<br />\n";
- }
+ } // END - if
// Return the requested value
return $this->config[$cfgEntry];
if (empty($cfgEntry)) {
// Entry is empty
throw new ConfigEntryIsEmptyException($this, self::EXCEPTION_CONFIG_ENTRY_IS_EMPTY);
- }
+ } // END - if
// Set the configuration value
$this->config[$cfgEntry] = $cfgValue;
* @return $fullDomain The detected full domain
*/
public function detectDomain () {
- // Detect the full domain
- $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES);
+ // Full domain is localnet.invalid by default
+ $fullDomain = "localnet.invalid";
+
+ // Is the server name there?
+ if (isset($_SERVER['SERVER_NAME'])) {
+ // Detect the full domain
+ $fullDomain = htmlentities(strip_tags($_SERVER['SERVER_NAME']), ENT_QUOTES);
+ } // END - if
// Return it
return $fullDomain;
}
-} // END - class
+
+ /**
+ * Getter for field name
+ *
+ * @param $fieldName Field name which we shall get
+ * @return $fieldValue Field value from the user
+ */
+ function getField ($fieldName) {
+ // Dummy method!
+ }
+
+ /**
+ * Updates a given field with new value
+ *
+ * @param $fieldName Field to update
+ * @param $fieldValue New value to store
+ * @return void
+ */
+ public function updateDatabaseField ($fieldName, $fieldValue) {
+ // Dummy method!
+ }
+}
// [EOF]
?>
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
*
* This program is free software: you can redistribute it and/or modify
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
if (!defined('_DB_TYPE')) {
// Abort here
ApplicationEntryPoint::app_die("[Main:] Please define a database type first!<br />
-E.g.:<pre>$GLOBALS['cfg']->defineDatabaseType("local");</pre>
-This will choose the local-file-based database type (layer)");
+E.g.:<pre>$cfg->defineDatabaseType("local");</pre>
+This will choose the local file-based database layer.");
}
// Generate FQFN for the database layer
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
try {
$layer = LocalFileDatabase::createLocalFileDatabase(PATH . FrameworkConfiguration::getInstance()->readConfig('local_db_path'), FileIoHandler::getInstance());
} catch (SavePathIsEmptyException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (SavePathNotFoundException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (SavePathIsNoDirectoryException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (SavePathReadProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong>",
$e->getMessage()
));
} catch (SavePathWriteProtectedException $e) {
- ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong><br />\n",
+ ApplicationEntryPoint::app_die(sprintf("[Main:] Database layer could not be initialized. Reason: <strong>%s</strong>",
$e->getMessage()
));
}
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
$application = htmlentities(strip_tags($application), ENT_QUOTES);
// Secure it a little more with a reg.exp.
-$application = preg_replace('/([^a-z_-])+/i', "", $application);
+$application = preg_replace('/([^a-z0-9_-])+/i', "", $application);
// Set the application name for later usage
$cfg->setConfigEntry('app_name', $application);
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
*
* This program is free software: you can redistribute it and/or modify
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
// If the basePath is false it is invalid
if ($basePath2 === false) {
- // TODO: Do not die here.
+ /* @todo: Do not die here. */
die("Cannot read {$basePath} !");
} else {
// Set base path
// Now look it up in our index
if (isset($this->classes[$fileName])) {
// File is found so load it only once
+ //* DEBUG: */ echo "LOAD: ".$fileName." - Start<br />\n";
require($this->classes[$fileName]);
+ //* DEBUG: */ echo "LOAD: ".$fileName." - End<br />\n";
// Count this include
$this->total++;
+ // Mark this class as loaded
+ $this->loadedClasses[] = $this->classes[$fileName];
+
// Developer mode excludes caching (better debugging)
if (!defined('DEVELOPER')) {
- // Mark this class as loaded
- $this->loadedClasses[] = $this->classes[$fileName];
-
// Reset cache
$this->classesCached = false;
} // END - if
public final function getTotal () {
return $this->total;
}
+
+ /**
+ * Getter for a printable list of included classes/interfaces/exceptions
+ *
+ * @param $includeList A printable include list
+ */
+ public function getPrintableIncludeList () {
+ // Prepare the list
+ $includeList = "";
+ foreach ($this->loadedClasses as $classFile) {
+ $includeList .= basename($classFile)."<br />\n";
+ } // END - foreach
+
+ // And return it
+ return $includeList;
+ }
}
// [EOF]
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
*
* @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
* @link http://www.ship-simu.org
*
<?php
// Developer mode active? Comment out if no dev!
define('DEVELOPER', true);
-
//xdebug_start_trace();
/**
* The main class with the entry point to the whole application. This class
*
* But good little boys and girls would always initialize their variables... ;-)
*
- * @author Roland Haeder <webmaster@mxchange.org>
+ * @author Roland Haeder <webmaster@ship-simu.org>
* @version 0.0.0
- * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, this is free software
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.ship-simu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/**
* The application's emergency exit
*
- * @param $message The optional message we shall output on exit
+ * @param $message The optional message we shall output on exit
+ * @param $code Error code from exception
+ * @param $extraData Extra information from exceptions
* @return void
*/
- public static function app_die ($message = "") {
+ public static function app_die ($message = "", $code = false, $extraData = "") {
// Is this method already called?
if (defined('EMERGENCY_EXIT_CALLED')) {
// Then output the text directly
die($message);
- }
+ } // END - if
// This method shall not be called twice
define('EMERGENCY_EXIT_CALLED', true);
}
// Get some instances
- $tpl = FrameworkConfiguration::getInstance()->readConfig('tpl_engine');
+ $tpl = FrameworkConfiguration::getInstance()->readConfig('template_class');
$lang = LanguageSystem::getInstance();
$io = FileIoHandler::getInstance();
+ // Get response instance
+ $responseInstance = ApplicationHelper::getInstance()->getResponseInstance();
+
// Is the template engine loaded?
if ((class_exists($tpl)) && (is_object($lang)) && (is_object($io))) {
// Use the template engine for putting out (nicer look) the message
try {
// Get the template instance from our object factory
- $tplEngine = ObjectFactory::createObjectByConfiguredName('tpl_engine', array(FrameworkConfiguration::getInstance()->readConfig('tpl_base_path'), $lang, $io));
- } catch (BasePathIsEmptyException $e) {
- die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
- $e->getMessage()
- ));
- } catch (InvalidBasePathStringException $e) {
- die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
- $e->getMessage()
- ));
- } catch (BasePathIsNoDirectoryException $e) {
- die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
- $e->getMessage()
- ));
- } catch (BasePathReadProtectedException $e) {
- die(sprintf("[Main:] Could not initialize template engine for this reason: <strong>%s</strong>",
+ $templateInstance = ObjectFactory::createObjectByName($tpl, array(FrameworkConfiguration::getInstance()->readConfig('tpl_base_path'), $lang, $io));
+ } catch (FrameworkException $e) {
+ die(sprintf("[Main:] Could not initialize template engine for reason: <strong>%s</strong>",
$e->getMessage()
));
}
- // Backtrace holen und aufbereiten
+ // Get and prepare backtrace for output
$backtraceArray = debug_backtrace();
$backtrace = "";
foreach ($backtraceArray as $key=>$trace) {
if (!isset($trace['file'])) $trace['file'] = __FILE__;
- if (!isset($trace['line'])) $trace['line'] = 5;
+ if (!isset($trace['line'])) $trace['line'] = __LINE__;
if (!isset($trace['args'])) $trace['args'] = array();
$backtrace .= "<span class=\"backtrace_file\">".basename($trace['file'])."</span>:".$trace['line'].", <span class=\"backtrace_function\">".$trace['function']."(".count($trace['args']).")</span><br />";
- }
+ } // END - foreach
// Assign variables
- $tplEngine->assignVariable('message', $message);
- $tplEngine->assignVariable('backtrace', $backtrace);
- $tplEngine->assignVariable('total_objects', ObjectFactory::getTotal());
+ $templateInstance->assignVariable('message', $message);
+ $templateInstance->assignVariable('code', $code);
+ $templateInstance->assignVariable('extra', $extraData);
+ $templateInstance->assignVariable('backtrace', $backtrace);
+ $templateInstance->assignVariable('total_includes', ClassLoader::getInstance()->getTotal());
+ $templateInstance->assignVariable('total_objects', ObjectFactory::getTotal());
+ $templateInstance->assignVariable('title', $lang->getMessage('emergency_exit_title'));
// Load the template
- $tplEngine->loadCodeTemplate('emergency_exit');
+ $templateInstance->loadCodeTemplate('emergency_exit');
// Compile the template
- $tplEngine->compileTemplate();
+ $templateInstance->compileTemplate();
// Compile all variables
- $tplEngine->compileVariables();
+ $templateInstance->compileVariables();
+
+ // Transfer data to response
+ $templateInstance->transferToResponse($responseInstance);
- // Output all
- $tplEngine->output();
+ // Flush the response
+ $responseInstance->flushBuffer();
// Good bye...
exit();
// Include the application selector
require(PATH . 'inc/selector.php');
-
} // END - main()
} // END - class
--- /dev/null
+#!/bin/sh
+
+sh ./clear-cache.sh
+
+echo -n "$0: Packaging... "
+zip -9 shipsimu-hub_dev.zip docs/* Doxyfile *.php *.sh > /dev/null 2>&1
+echo -n "."
+zip -9r shipsimu-hub_dev.zip application/ db/ devel/ Doxyfile inc/ templates/ tests/ > /dev/null 2>&1
+echo -n "."
+zip -d shipsimu-hub_dev.zip docs/warn.log db/*/*.serialized > /dev/null 2>&1
+echo ". done"
+
+echo "$0: Renaming..."
+mv shipsimu-hub_dev.zip shipsimu-hub_dev_`date +%Y%m%d_%H%M%S`.zip
+
+echo "$0: All done."
--- /dev/null
+#!/bin/sh
+
+if ! test -e `which pdepend`; then
+ echo "$0: This script needs PHP_Depend. See URL"
+ echo "$0: http://www.manuel-pichler.de/pages/pdepend.html for details."
+fi
+
+pdepend --bad-documentation --ignore=db,docs,ship-simu.org \
+ --jdepend-chart=test.png --overview-pyramid=pyramid.png \
+ --summary-xml=summary.xml --jdepend-xml=jdepend.xml .