diff --git a/public/font/OT_TT_Install_E.txt b/public/font/OT_TT_Install_E.txt new file mode 100644 index 0000000..102634b --- /dev/null +++ b/public/font/OT_TT_Install_E.txt @@ -0,0 +1,70 @@ +OpenType TT Font Installation + +- OpenType TrueType (OT/TT) consists of one file with TTF extension. +- OpenType fonts can be installed and used in any version of Windows and on Mac OS X system. +- You may install OpenType fonts by the means of operating system or with the help of font management utilities. + +Installing OpenType fonts for common operating systems: + +- - - - - - +Windows 95/98/NT/ME + +You may install about 800 fonts maximum in Windows ME, 98, or 95. +You may install OpenType/TT fonts by the means of operating system or with the help of font management utilities. +Installing OpenType/TT fonts on Windows by means of operating system: +Click on Start button and select Settings > Control Panel (or Open My Computer then Control Panel) +Open (Double-click) the Fonts folder. +Select File - Install New Font. +Use the Folders and Drives windows to move to the folder on your hard drive, a floppy disk, or CD where +your new fonts are located. (Make sure you have unzipped the files). +If you are installing fonts from a floppy or CD be sure the 'Copy fonts to folder' box is checked; otherwise, +fonts may not be available to use if the floppy or CD is not in the drive at all times. +Highlight the font to install from the List of fonts window. To select more than one font, hold down the +CTRL key and click each font. Click OK. +After installation, you may need to restart an application or reselect a printer in your application to make +the new fonts appear in the font list. + +- - - - - - - +Windows 2000/XP/Vista/Windows 7 + +These Windows versions have built-in support for OpenType fonts. Installation procedure is identical for +all formats. +Open Control Panel. +In Windows 2000 double-click on My Computer. Then double-click on the Control Panel icon. +In Windows XP and later click on Start button and then on Control Panel. +Double-click on the Fonts icon in Control Panel window. +In the Fonts window, select the File menu, and choose Install New Font. +Navigate to the folder that contains fonts you want to install. +Select fonts you want to install. You can click to select one font, Control-click to select several fonts, or Shift-click +to select a contiguous group of fonts. +Press the "OK" button to install the fonts. +Close the Fonts control panel. +After installation, you may need to restart an application or reselect a printer in your application to make the new fonts +appear in the font list. + +- - - - - - +Mac OS 7.x-9.x + +DOES NOT SUPPORT OT/TT. + +- - - - - - +Mac OS X + +An OpenType font consists of one Suitcase file. +You may install fonts by means of operating system or with the help of font management utilities. To install with a font +management applications like Adobe Type Manager, Suitcase or Font Reserve, please consult the product manual. +Font installation on Mac is a simple drag and drop operation. +Close any open applications before installing fonts. New fonts do not appear in the font menu in some applications, +if you install them while an application is open. +Open the folder with fonts to install. +Make sure you are selecting fonts themselves, not a folder containing fonts. +Drag the selection to the Fonts folder inside the Library folder (see details below) on Mac OS X disk. +If you want fonts to be available to applications running in Classic mode, you must also install the fonts into the +Fonts folder inside the Classic System Folder. + +- - - - - - +Read more about OpenType fonts installation on our website: +http://www.paratype.com/help/finst/ + +OpenType Overview +http://www.paratype.com/help/formats/opentype.asp \ No newline at end of file diff --git a/public/font/OT_TT_Install_R.txt b/public/font/OT_TT_Install_R.txt new file mode 100644 index 0000000..0a39005 --- /dev/null +++ b/public/font/OT_TT_Install_R.txt @@ -0,0 +1,55 @@ + OpenType TT. + +- OpenType TrueType (OT/TT) TTF. +- OpenType Windows, Mac OS 10.x. +- OpenType + Adobe Type Manager. + + : +- - - - - - +Windows 95/98/NT/ME + + - 800. + , . + OpenType TT Windows : + - - . + . + - . + , . +ٸ . , + CTRL . . + , + . +- - - - - - - +Windows 2000/XP/Vista/Windows 7 + + Windows OpenType . + - - . + . + - . + , . +ٸ . , + CTRL . . + , + . +- - - - - - +Mac OS 7.x-9.x + + OT/TT. +- - - - - - +Mac OS X + +OpenType "". + OpenType +Adobe Type Manager. Mac - . + . , + . . +, , . + Library, Mac OS X. +- - - - - - + + OpenType : +http://www.paratype.com/help/finst/ + + OpenType: +http://www.paratype.com/help/formats/opentype.asp \ No newline at end of file diff --git a/public/font/PT Free Font License_eng_1.2.txt b/public/font/PT Free Font License_eng_1.2.txt new file mode 100644 index 0000000..b5023af --- /dev/null +++ b/public/font/PT Free Font License_eng_1.2.txt @@ -0,0 +1,44 @@ +Copyright (c) 2009, ParaType Ltd. All Rights Reserved. + +LICENSING AGREEMENT +for the fonts with Original Name: PT Sans, PT Serif +Version 1.2 - December 23, 2010 + +GRANT OF LICENSE +ParaType Ltd grants you the right to use, copy, modify the fonts and distribute +modified and unmodified copies of the fonts by any means, including placing +on Web servers for free downloading, embedding in documents and Web pages, +bundling with commercial and non commercial products, if it does not conflict +with the conditions listed below: + +- You may bundle the font with commercial software, but you may not sell the +fonts by themselves. They are free. + +- You may distribute the fonts in modified or unmodified version only together +with this Licensing Agreement and with above copyright notice. You have no +right to modify the text of Licensing Agreement. It can be placed in a separate +text file or inserted into the font file, but it must be easily viewed by users. + +- You may not distribute modified version of the font under the Original name +or combination of Original name with any other words without explicit written +permission from ParaType. + +TERMINATION & TERRITORY +This license has no limits on time and territory, but it becomes null and void +if any of the above conditions are not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, +OR OTHER RIGHT. IN NO EVENT SHALL PARATYPE BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, +INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT +OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER +DEALINGS IN THE FONT SOFTWARE. + +ParaType Ltd +http://www.paratype.ru + diff --git a/public/font/PT Free Font License_rus_1.2.txt b/public/font/PT Free Font License_rus_1.2.txt new file mode 100644 index 0000000..fc7b8d3 Binary files /dev/null and b/public/font/PT Free Font License_rus_1.2.txt differ diff --git a/public/font/PTF55F.ttf b/public/font/PTF55F.ttf new file mode 100644 index 0000000..dca445f Binary files /dev/null and b/public/font/PTF55F.ttf differ diff --git a/public/font/PTF56F.ttf b/public/font/PTF56F.ttf new file mode 100644 index 0000000..21f488e Binary files /dev/null and b/public/font/PTF56F.ttf differ diff --git a/public/font/PTF75F.ttf b/public/font/PTF75F.ttf new file mode 100644 index 0000000..f6048f3 Binary files /dev/null and b/public/font/PTF75F.ttf differ diff --git a/public/font/PTF76F.ttf b/public/font/PTF76F.ttf new file mode 100644 index 0000000..600a5c0 Binary files /dev/null and b/public/font/PTF76F.ttf differ diff --git a/public/font/PTZ55F.ttf b/public/font/PTZ55F.ttf new file mode 100644 index 0000000..3ac0ca3 Binary files /dev/null and b/public/font/PTZ55F.ttf differ diff --git a/public/font/PTZ56F.ttf b/public/font/PTZ56F.ttf new file mode 100644 index 0000000..0bdec67 Binary files /dev/null and b/public/font/PTZ56F.ttf differ diff --git a/public/image/CAPTCHA_0.png b/public/image/CAPTCHA_0.png new file mode 100644 index 0000000..0858eff Binary files /dev/null and b/public/image/CAPTCHA_0.png differ diff --git a/public/image/CAPTCHA_1.png b/public/image/CAPTCHA_1.png new file mode 100644 index 0000000..83ea88e Binary files /dev/null and b/public/image/CAPTCHA_1.png differ diff --git a/public/image/CAPTCHA_2.png b/public/image/CAPTCHA_2.png new file mode 100644 index 0000000..b5f8124 Binary files /dev/null and b/public/image/CAPTCHA_2.png differ diff --git a/public/image/CAPTCHA_3.png b/public/image/CAPTCHA_3.png new file mode 100644 index 0000000..003ef08 Binary files /dev/null and b/public/image/CAPTCHA_3.png differ diff --git a/public/image/CAPTCHA_4.png b/public/image/CAPTCHA_4.png new file mode 100644 index 0000000..1d6ef47 Binary files /dev/null and b/public/image/CAPTCHA_4.png differ diff --git a/src/C/CAPTCHAController.php b/src/C/CAPTCHAController.php index d091678..ca89a05 100644 --- a/src/C/CAPTCHAController.php +++ b/src/C/CAPTCHAController.php @@ -7,11 +7,21 @@ */ namespace PTEST\C; +use PFRM\Controller; +use PFRM\View as View; +use PTEST\M\CAPTCHAModel as Model; -class CAPTCHAController { +class CAPTCHAController extends Controller{ public function indexAction() { - + $view = new View('CAPTCHA'); + $view->setHTTPHeader('Content-Type: image/png'); + $view->setHTTPHeader('Cache-Control: max-age=0, no-cache, no-store'); + $view->setHTTPHeader('Pragma: no-cache'); + $model = new Model(); + $view->image = $model->getImage(); + $_SESSION['CAPTCHA'] = $model->code; + $view->render(); } } \ No newline at end of file diff --git a/src/M/AdModel.php b/src/M/AdModel.php index b2503b5..d8deacf 100644 --- a/src/M/AdModel.php +++ b/src/M/AdModel.php @@ -6,7 +6,7 @@ * Time: 00:20 */ -namespace PTEST\Model; +namespace PTEST\M; class AdModel { diff --git a/src/M/CAPTCHAModel.php b/src/M/CAPTCHAModel.php new file mode 100644 index 0000000..b7d7fe3 --- /dev/null +++ b/src/M/CAPTCHAModel.php @@ -0,0 +1,65 @@ +config->public_dir . 'font/PTF55F.ttf', + $app->config->public_dir . 'font/PTF56F.ttf', + $app->config->public_dir . 'font/PTF75F.ttf', + $app->config->public_dir . 'font/PTF76F.ttf', + $app->config->public_dir . 'font/PTZ55F.ttf', + $app->config->public_dir . 'font/PTZ56F.ttf', + ]; + $fontsize_base = 36;// размер текста + + $image = imagecreatefrompng($app->config->public_dir . 'image/CAPTCHA_' . rand(0,4) .'.png'); + + $captcha = ''; + + for ($i = 0; $i < $length; $i++) + { + $fontsize = rand($fontsize_base - 2, $fontsize_base + 2) ; + $captcha .= $letters[ rand(0, strlen($letters)-1) ]; + $x = ($i + 1) * ($fontsize + 5 ); + $x = rand($x, $x+6); + $y = $height - ( ($height - $fontsize) / 2 ) + rand(-8,16); + $curcolor = imagecolorallocate( $image, rand(50, 127), rand(0, 127), rand(0, 127) ); + + //шум + imageellipse($image, rand($x - 32 ,$x + 32), $y, rand(16,32), rand(16,52), $curcolor); + imageellipse($image, $x, rand($y - 16 ,$y + 16), rand(16,52), rand(16,32), $curcolor); + + $angle = rand(-25, 25); + + imagettftext($image, $fontsize, $angle, $x, $y, $curcolor, $fonts_arr[rand(0,5)], $captcha[$i]); + } + + + ob_start(); + imagepng($image); + $image_data = ob_get_contents(); + ob_end_clean(); + + $this->code = $captcha; + + return $image_data; + } +} \ No newline at end of file diff --git a/src/V/CAPTCHA.php b/src/V/CAPTCHA.php new file mode 100644 index 0000000..cb48966 --- /dev/null +++ b/src/V/CAPTCHA.php @@ -0,0 +1,2 @@ +image; \ No newline at end of file diff --git a/src/start.php b/src/start.php index 624abd2..5ec0aa6 100644 --- a/src/start.php +++ b/src/start.php @@ -27,7 +27,7 @@ $app->config = (object) [ "site_name" => "Доска объявлений" ]; -$app->setRoute( '/^\/CAPTCHA.png$/', 'CAPTCHA' ); +$app->setRoute( '/^\/CAPTCHA.png\?*\d*$/', 'CAPTCHA' ); $app->setRoute( '|^/page/(?\d+)/$|', 'Index', 'page'); $app->setRoute( '/^.*$/', 'error404' );