本文整理汇总了PHP中error::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP error::addError方法的具体用法?PHP error::addError怎么用?PHP error::addError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类error
的用法示例。
在下文中一共展示了error::addError方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($infos = false)
{
$displayErrors = false;
if (!self::$pdoS) {
if (empty($infos)) {
require ROOT . 'config/bdd.php';
$infos = $BDD['mysql'];
}
$displayErrors = @$infos['displayErrors'];
try {
self::$pdoS = new PDO('mysql:host=' . $infos['host'] . ';dbname=' . $infos['database'] . '', $infos['login'], $infos['password'], array(PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\''));
self::$pdoS->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->wake_up();
return true;
} catch (PDOException $erreur) {
$error = new error();
if ($displayErrors) {
$error->addError('Error : ' . $erreur->getMessage(), ERROR_PAGE);
} else {
$error->addError('We can\'t display the page you asked for.', ERROR_PAGE);
}
return false;
}
}
$this->wake_up();
}
示例2: captcha
function captcha($sourceFolder, $moduleFolder, $uploadFolder, $urlRequestRoot, $cmsFolder, $length = 5)
{
$this->sourceFolder = $sourceFolder;
$this->moduleFolder = $moduleFolder;
$this->uploadFolder = $uploadFolder;
$this->urlRequestRoot = $urlRequestRoot;
$this->cmsFolder = $cmsFolder;
// header('Content-type: image/png');
$this->Length = $length;
//$this->fontpath = dirname($_SERVER['SCRIPT_FILENAME']) . '/fonts/';
global $sourceFolder, $moduleFolder;
$this->fontpath = "{$sourceFolder}/{$moduleFolder}/form/captcha/fonts/";
$this->fonts = $this->getFonts();
$errormgr = new error();
if ($this->fonts == FALSE) {
//$errormgr = new error;
$errormgr->addError('No fonts available!');
$errormgr->displayError();
// die();
}
if (function_exists('imagettftext') == FALSE) {
$errormgr->addError('');
$errormgr->displayError();
// die();
}
$this->stringGen();
$this->makeCaptcha();
}
示例3: captcha
function captcha($length = 6)
{
header('Content-type: image/png');
$this->Length = $length;
$this->fontpath = 'images/';
$this->fonts = $this->getFonts();
$errormgr = new error();
if ($this->fonts == FALSE) {
//$errormgr = new error;
$errormgr->addError('No fonts available!');
$errormgr->displayError();
die;
}
if (function_exists('imagettftext') == FALSE) {
$errormgr->addError('');
$errormgr->displayError();
die;
}
$this->stringGen();
$this->makeCaptcha();
}
示例4: captcha
function captcha()
{
$this->fontpath = JPATH_COMPONENT . DS . 'fonts' . DS;
$this->fonts = $this->getFonts();
$errormgr = new error();
if ($this->imagetype == 'FREETYPE') {
if ($this->fonts == FALSE) {
$errormgr->addError('No fonts available!');
$errormgr->displayError();
die;
}
if (function_exists('imagettftext') == FALSE) {
$errormgr->addError('the function imagettftext does not exist.');
$errormgr->displayError();
die;
}
}
header('Content-type: image/png');
ob_clean();
$this->stringGenerate();
$this->makeCaptcha();
//exit;
}
示例5: captcha
function captcha($length = 6)
{
global $settings;
header('Content-type: image/png');
$this->Length = $length;
//$this->fontpath = dirname($_SERVER['SCRIPT_FILENAME']) . '/fonts/';
$this->fontpath = "theme/{$settings['theme']}/font/";
$this->fonts = $this->getFonts();
$errormgr = new error();
if ($this->fonts == FALSE) {
//$errormgr = new error;
$errormgr->addError('No fonts available!');
$errormgr->displayError();
die;
}
if (function_exists('imagettftext') == FALSE) {
$errormgr->addError('');
$errormgr->displayError();
die;
}
$this->stringGen();
$this->makeCaptcha();
}
示例6: makeCaptcha
function makeCaptcha()
{
global $cString, $_CONF, $_TABLES, $LANG_CP00;
if ($this->session_id != 0) {
$sql = "UPDATE {$_TABLES['cp_sessions']} SET validation='" . $this->getCaptchaString() . "' WHERE session_id='" . DB_escapeString($this->session_id) . "'";
DB_query($sql);
} else {
CAPTCHA_errorLog("CAPTCHA: No valid session id passed");
exit;
}
switch ($this->driver) {
case 0:
case 1:
if ($this->gfxformat != 'png' && $this->gfxformat != 'jpg') {
header('Content-type: image/gif');
COM_errorLog("CAPTCHA: No valid gfxFormat specified");
$errormgr = new error();
$errormgr->addError('');
$errormgr->displayError();
die;
}
$header = 'Content-type: image/' . $this->gfxformat;
header($header);
if ($this->driver == 0) {
$imagelength = $this->Length * 25 + 16;
$imageheight = 75;
$image = imagecreate($imagelength, $imageheight);
$bgcolor = imagecolorallocate($image, 255, 255, 255);
$stringcolor = imagecolorallocate($image, 0, 0, 0);
$filter = new filters();
$filter->signs($image, $this->getRandFont());
for ($i = 0; $i < strlen($this->CaptchaString); $i++) {
imagettftext($image, 25, mt_rand(-15, 15), $i * 25 + 10, mt_rand(30, 70), $stringcolor, $this->getRandFont(), $this->CaptchaString[$i]);
}
switch ($this->gfxformat) {
case 'png':
imagepng($image);
break;
case 'jpg':
imagejpeg($image);
break;
}
imagedestroy($image);
} else {
// ImageMagick code originally written by
// Thom Skrtich (email : bisohpthom@supertwist.net)
// used in SecureImage a CAPTCHA plugin for WordPress.
$gravity = 'Center';
# modify the image according to the generated settings
$size = rand($this->sizemin, $this->sizemax);
$blur = rand($this->blurmin, $this->blurmax);
$angle = rand($this->anglemin, $this->anglemax);
$swirl = rand($this->swirlmin, $this->swirlmax);
$wave = rand($this->wavemin, $this->wavemax);
$cString = $this->CaptchaString;
$i = strlen($cString);
$newString = '';
for ($x = 0; $x < $i; $x++) {
$newString .= $cString[$x];
$newString .= ' ';
}
# prepare our image magick command
$cmd = '"' . $this->convertpath . '"';
$cmd .= ' -font "' . $this->getRandFont() . '"';
$cmd .= ' -pointsize ' . $size;
$cmd .= ' -gravity "' . $gravity . '"';
$cmd .= ' -annotate 0 "' . $newString . '"';
$cmd .= ' -blur ' . $blur;
$cmd .= ' -rotate ' . $angle;
$cmd .= ' -swirl ' . $swirl;
$cmd .= ' -wave ' . $wave . 'x80';
$cmd .= ' ' . $this->getRandBackground() . ' - ';
if (PHP_OS == "WINNT") {
$pcmd = 'cmd /c " ' . $cmd . '"';
} else {
$pcmd = $cmd;
}
if ($this->debug) {
COM_errorLog("CAPTCHA cmd: " . $pcmd);
}
passthru($pcmd);
}
break;
case 2:
header('Content-type: image/jpeg');
$filename = $cString[$this->CaptchaString] . '.jpg';
$fp = fopen($_CONF['path'] . 'plugins/captcha/images/static/' . $this->imageset . '/' . $filename, 'rb');
if ($fp != NULL) {
while (!feof($fp)) {
$buf = fgets($fp, 8192);
echo $buf;
}
fclose($fp);
} else {
COM_errorLog("CAPTCHA: Unable to open static image file");
}
break;
case 3:
case 4:
case 5:
//.........这里部分代码省略.........
示例7: bdd
$host = $_POST['host'];
$loginBDD = $_POST['login'];
$passwordBDD = $_POST['password'];
$databaseBDD = $_POST['database'];
$prefixeBDD = $_POST['prefix'];
$bdd = new bdd(array('host' => $host, 'login' => $loginBDD, 'database' => $databaseBDD, 'password' => $passwordBDD, 'displayErrors' => true));
if (empty($bdd->pdo)) {
$error = new error();
$error->addError('Les informations données sur la base de données ne sont pas correctes, le lien n\'a pas pu être établi. Réessayez.', ERROR_PAGE, 'install.php', __LINE__);
$step = 1;
} else {
$_SESSION['__install'][1] = array('hostBDD' => $host, 'loginBDD' => $loginBDD, 'databaseBDD' => $databaseBDD, 'passwordBDD' => $passwordBDD, 'root' => $root, 'rootUrl' => $rooturl, 'prefixeBDD' => $prefixeBDD);
}
} else {
$error = new error();
$error->addError('Toutes les informations n\'ont pas été données.', ERROR_PAGE, 'install.php', __LINE__);
$step = 1;
}
if ($step == 2) {
$dirLangs = glob('../lang/*', GLOB_ONLYDIR);
foreach ($dirLangs as $k => $langs) {
$dirLangs[$k] = str_replace('../lang/', '', $langs);
}
$dirDesigns = glob('../designs/*', GLOB_ONLYDIR);
foreach ($dirDesigns as $k => $designs) {
$dirDesigns[$k] = str_replace('../designs/', '', $designs);
}
$dirModules = glob('../modules/*', GLOB_ONLYDIR);
foreach ($dirModules as $k => $modules) {
$dirModules[$k] = str_replace('../modules/', '', $modules);
}
示例8: captcha
function captcha($length = 4)
{
global $mainframe;
if (!function_exists('imagecreate')) {
header('Location:uploads/nogd.gif');
}
//die('GD Library not found!');
header('Content-type: image/png');
//$mainframe->registerEvent( 'onAfterInitialise', 'pngHeader' );
$this->Length = $length;
//$this->fontpath = dirname($_SERVER['SCRIPT_FILENAME']) . '/fonts/';
$this->fontpath = JPATH_SITE . DS . 'components' . DS . 'com_forme' . DS . 'fonts' . DS;
//echo $this->fontpath;die();
$this->fonts = $this->getFonts();
$errormgr = new error();
if ($this->fonts == FALSE) {
//$errormgr = new error;
$errormgr->addError('No fonts available!');
$errormgr->displayError();
die;
}
if (function_exists('imagettftext') == FALSE) {
$errormgr->addError('Function imagettftext does not exist');
$errormgr->displayError();
die;
}
$this->stringGenerate();
$this->makeCaptcha();
}