当前位置: 首页>>代码示例>>PHP>>正文


PHP zp_error函数代码示例

本文整理汇总了PHP中zp_error函数的典型用法代码示例。如果您正苦于以下问题:PHP zp_error函数的具体用法?PHP zp_error怎么用?PHP zp_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zp_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: db_connect

/**
 * Connect to the database server and select the database.
 * @param array $config the db configuration parameters
 * @param bool $errorstop set to false to omit error messages
 * @return true if successful connection
 */
function db_connect($config, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_details;
    $_zp_DB_details = unserialize(DB_NOT_CONNECTED);
    if (function_exists('mysqli_connect')) {
        $_zp_DB_connection = @mysqli_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']);
    } else {
        $_zp_DB_connection = NULL;
    }
    if (!$_zp_DB_connection) {
        if ($errorstop) {
            zp_error(gettext('MySQLi Error: Zenphoto could not instantiate a connection.'));
        }
        return false;
    }
    $_zp_DB_details['mysql_host'] = $config['mysql_host'];
    if (!$_zp_DB_connection->select_db($config['mysql_database'])) {
        if ($errorstop) {
            zp_error(sprintf(gettext('MySQLi Error: MySQLi returned the error %1$s when Zenphoto tried to select the database %2$s.'), $_zp_DB_connection->error, $config['mysql_database']));
        }
        return false;
    }
    $_zp_DB_details = $config;
    if (array_key_exists('UTF-8', $config) && $config['UTF-8']) {
        $_zp_DB_connection->set_charset("utf8");
    }
    // set the sql_mode to relaxed (if possible)
    @$_zp_DB_connection->query('SET SESSION sql_mode="";');
    return $_zp_DB_connection;
}
开发者ID:JoniWeiss,项目名称:JoniWebGirl,代码行数:36,代码来源:functions-db-MySQLi.php

示例2: db_connect

/**
 * Connect to the database server and select the database.
 * @param array $config the db configuration parameters
 * @param bool $errorstop set to false to omit error messages
 * @return true if successful connection
 */
function db_connect($config, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_details;
    $_zp_DB_details = unserialize(DB_NOT_CONNECTED);
    if (function_exists('mysql_connect')) {
        $_zp_DB_connection = @mysql_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']);
    } else {
        $_zp_DB_connection = NULL;
    }
    if (!$_zp_DB_connection) {
        if ($errorstop) {
            zp_error(sprintf(gettext('MySQL Error: ZenPhoto20 received the error %s when connecting to the database server.'), mysql_error()));
        }
        return false;
    }
    $_zp_DB_details['mysql_host'] = $config['mysql_host'];
    if (!@mysql_select_db($config['mysql_database'])) {
        if ($errorstop) {
            zp_error(sprintf(gettext('MySQL Error: MySQL returned the error %1$s when ZenPhoto20 tried to select the database %2$s.'), mysql_error(), $config['mysql_database']));
        }
        return false;
    }
    $_zp_DB_details = $config;
    if (array_key_exists('UTF-8', $config) && $config['UTF-8']) {
        mysql_set_charset('utf8', $_zp_DB_connection);
    }
    // set the sql_mode to relaxed (if possible)
    @mysql_query('SET SESSION sql_mode="";');
    return $_zp_DB_connection;
}
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:36,代码来源:functions-db-MySQL.php

示例3: db_connect

/**
 * Connect to the database server and select the database.
 * @param array $config the db configuration parameters
 * @param bool $errorstop set to false to omit error messages
 * @return true if successful connection
 */
function db_connect($config, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_details;
    $_zp_DB_details = unserialize(DB_NOT_CONNECTED);
    $_zp_DB_connection = NULL;
    if ($errorstop) {
        zp_error(gettext('MySQLi Error: Zenphoto could not instantiate a connection.'));
    }
    return false;
    return $_zp_DB_connection;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:17,代码来源:functions-db_NULL.php

示例4: query

/**
 * The main query function. Runs the SQL on the connection and handles errors.
 * @param string $sql sql code
 * @param bool $noerrmsg set to false to supress the error message
 * @return results of the sql statements
 * @since 0.6
 */
function query($sql, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_conf_vars;
    if (is_null($_zp_DB_connection)) {
        db_connect();
    }
    // Changed this to mysql_query - *never* call query functions recursively...
    $result = mysql_query($sql, $_zp_DB_connection);
    if (!$result) {
        if ($errorstop) {
            $sql = html_encode($sql);
            zp_error(sprintf(gettext('MySQL Query ( <em>%1$s</em> ) failed. MySQL returned the error <em>%2$s</em>'), $sql, mysql_error()));
        }
        return false;
    }
    return $result;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:24,代码来源:functions-db-MySQL.php

示例5: __construct

 function __construct()
 {
     global $_configMutex, $_zp_conf_vars;
     $_configMutex->lock();
     $zp_cfg = file_get_contents(SERVERPATH . '/' . DATA_FOLDER . '/' . CONFIGFILE);
     $i = strpos($zp_cfg, "\$conf['special_pages']");
     $j = strpos($zp_cfg, '//', $i);
     if ($i === false || $j === false) {
         $conf = array('special_pages' => array());
         $this->conf_vars = $conf['special_pages'];
         $i = strpos($zp_cfg, '/** Do not edit below this line. **/');
         if ($i === false) {
             zp_error(gettext('The Zenphoto configuration file is corrupt. You will need to restore it from a backup.'));
         }
         $this->zp_cfg_a = substr($zp_cfg, 0, $i);
         $this->zp_cfg_b = "//\n" . substr($zp_cfg, $i);
     } else {
         $this->zp_cfg_a = substr($zp_cfg, 0, $i);
         $this->zp_cfg_b = substr($zp_cfg, $j);
         eval(substr($zp_cfg, $i, $j - $i));
         $this->conf_vars = $conf['special_pages'];
         foreach ($_zp_conf_vars['special_pages'] as $page => $element) {
             if (isset($element['option'])) {
                 $this->plugin_vars[$page] = $element;
             }
         }
     }
     if (OFFSET_PATH == 2) {
         $old = array_keys($conf['special_pages']);
         $zp_cfg = file_get_contents(SERVERPATH . '/' . ZENFOLDER . '/zenphoto_cfg.txt');
         $i = strpos($zp_cfg, "\$conf['special_pages']");
         $j = strpos($zp_cfg, '//', $i);
         eval(substr($zp_cfg, $i, $j - $i));
         $new = array_keys($conf['special_pages']);
         if ($old != $new) {
             //Things have changed, need to reset to defaults;
             setOption('rewriteTokens_restore', 1);
             $this->handleOptionSave(NULL, NULL);
             setupLog(gettext('rewriteTokens restored to default'), true);
         }
     } else {
         enableExtension('rewriteTokens', 97 | ADMIN_PLUGIN);
         //	plugin must be enabled for saving options
     }
 }
开发者ID:rb26,项目名称:zenphoto,代码行数:45,代码来源:rewriteTokens.php

示例6: query

/**
 * The main query function. Runs the SQL on the connection and handles errors.
 * @param string $sql sql code
 * @param bool $noerrmsg set to false to supress the error message
 * @return results of the sql statements
 * @since 0.6
 */
function query($sql, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_last_result, $_zp_conf_vars;
    if ($_zp_DB_connection == null) {
        db_connect();
    }
    $_zp_DB_last_result = false;
    try {
        $_zp_DB_last_result = $_zp_DB_connection->query($sql);
        return $_zp_DB_last_result;
    } catch (PDOException $e) {
        $_zp_DB_last_result = $e;
        if (true || $noerrmsg) {
            zp_error(sprintf(gettext('%1$s Error: Zenphoto received the error <em>%2$s</em> from the database server.'), DATABASE_SOFTWARE, $e->getMessage()));
        }
        return false;
    }
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:25,代码来源:functions-PDO.php

示例7: db_connect

/**
 * Connect to the database server and select the database.
 * @param array $config the db configuration parameters
 * @param bool $errorstop set to false to omit error messages
 * @return true if successful connection
 */
function db_connect($config, $errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_details, $_zp_DB_last_result;
    $_zp_DB_details = unserialize(DB_NOT_CONNECTED);
    $_zp_DB_connection = $_zp_DB_last_result = NULL;
    if (array_key_exists('UTF-8', $config) && $config['UTF-8']) {
        $utf8 = ';charset=utf8';
    } else {
        $utf8 = false;
    }
    try {
        $db = $config['mysql_database'];
        $hostname = $config['mysql_host'];
        $username = $config['mysql_user'];
        $password = $config['mysql_pass'];
        if (class_exists('PDO')) {
            $_zp_DB_connection = new PDO("mysql:host={$hostname};dbname={$db}{$utf8}", $username, $password);
        }
    } catch (PDOException $e) {
        $_zp_DB_last_result = $e;
        if ($errorstop) {
            zp_error(sprintf(gettext('MySql Error: Zenphoto received the error %s when connecting to the database server.'), $e->getMessage()));
        }
        $_zp_DB_connection = NULL;
        return false;
    }
    $_zp_DB_details = $config;
    if ($utf8 && version_compare(PHP_VERSION, '5.3.6', '<')) {
        try {
            $_zp_DB_connection->query("SET NAMES 'utf8'");
        } catch (PDOException $e) {
            //	:(
        }
    }
    // set the sql_mode to relaxed (if possible)
    try {
        $_zp_DB_connection->query('SET SESSION sql_mode="";');
    } catch (PDOException $e) {
        //	What can we do :(
    }
    return $_zp_DB_connection;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:48,代码来源:functions-db-PDO_MySQL.php

示例8: updateConfigItem

/**
 * Updates an item in the configuration file
 * @param unknown_type $item
 * @param unknown_type $value
 * @param unknown_type $quote
 */
function updateConfigItem($item, $value, $zp_cfg, $quote = true)
{
    if ($quote) {
        $value = '"' . $value . '"';
    }
    $i = strpos($zp_cfg, $item);
    if ($i === false) {
        $parts = preg_split('~\\/\\*.*Do not edit below this line.*\\*\\/~', $zp_cfg);
        if (isset($parts[1])) {
            $zp_cfg = $parts[0] . "\$conf['" . $item . "'] = " . $value . ";\n/** Do not edit below this line. **/" . $parts[1];
        } else {
            zp_error(gettext('The Zenphoto configuration file is corrupt. You will need to restore it from a backup.'));
        }
    } else {
        $i = strpos($zp_cfg, '=', $i);
        $j = strpos($zp_cfg, "\n", $i);
        $zp_cfg = substr($zp_cfg, 0, $i) . '= ' . $value . ';' . substr($zp_cfg, $j);
    }
    return $zp_cfg;
}
开发者ID:rb26,项目名称:zenphoto,代码行数:26,代码来源:functions-config.php

示例9: __construct

 /**
  * Constructor for class-video
  *
  * @param object &$album the owning album
  * @param sting $filename the filename of the image
  * @return Image
  */
 function __construct($album, $filename, $quiet = false)
 {
     global $_zp_supported_images;
     $msg = false;
     if (!is_object($album) || !$album->exists) {
         $msg = gettext('Invalid video instantiation: Album does not exist');
     } else {
         if (!$this->classSetup($album, $filename) || !file_exists($this->localpath) || is_dir($this->localpath)) {
             $msg = gettext('Invalid video instantiation: file does not exist.');
         }
     }
     if ($msg) {
         $this->exists = false;
         if (!$quiet) {
             zp_error($msg, E_USER_WARNING);
         }
         return;
     }
     $alts = explode(',', extensionEnabled('class-video_videoalt'));
     foreach ($alts as $alt) {
         $this->videoalt[] = trim(strtolower($alt));
     }
     $this->sidecars = $_zp_supported_images;
     $this->video = true;
     $this->objectsThumb = checkObjectsThumb($this->localpath);
     // This is where the magic happens...
     $album_name = $album->name;
     $this->updateDimensions();
     $new = $this->instantiate('images', array('filename' => $filename, 'albumid' => $this->album->getID()), 'filename', true, empty($album_name));
     if ($new || $this->filemtime != $this->get('mtime')) {
         if ($new) {
             $this->setTitle($this->displayname);
         }
         $this->updateMetaData();
         $this->set('mtime', $this->filemtime);
         $this->save();
         if ($new) {
             zp_apply_filter('new_image', $this);
         }
     }
 }
开发者ID:ariep,项目名称:ZenPhoto20-DEV,代码行数:48,代码来源:class-video.php

示例10: db_connect

/**
 * Connect to the database server and select the database.
 * @param bool $errorstop set to false to omit error messages
 * @return true if successful connection
 */
function db_connect($errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_last_result, $_zp_conf_vars;
    $_zp_DB_last_result = NULL;
    $db = $_zp_conf_vars['mysql_database'];
    if (!is_array($_zp_conf_vars)) {
        if ($errorstop) {
            zp_error(gettext('The <code>$_zp_conf_vars</code> variable is not an array. Zenphoto has not been instantiated correctly.'));
        }
        return false;
    }
    try {
        $hostname = $_zp_conf_vars['mysql_host'];
        $username = $_zp_conf_vars['mysql_user'];
        $password = $_zp_conf_vars['mysql_pass'];
        $_zp_DB_connection = new PDO("mysql:host={$hostname};dbname={$db}", $username, $password);
    } catch (PDOException $e) {
        $_zp_DB_last_result = $e;
        if ($errorstop) {
            zp_error(sprintf(gettext('MySql Error: Zenphoto received the error <em>%s</em> when connecting to the database server.'), $e->getMessage()));
        }
        return false;
    }
    if (array_key_exists('UTF-8', $_zp_conf_vars) && $_zp_conf_vars['UTF-8']) {
        try {
            $_zp_DB_connection->query("SET NAMES 'utf8'");
        } catch (PDOException $e) {
            //	:(
        }
    }
    // set the sql_mode to relaxed (if possible)
    try {
        $_zp_DB_connection->query('SET SESSION sql_mode="";');
    } catch (PDOException $e) {
        //	What can we do :(
    }
    return $_zp_DB_connection;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:43,代码来源:functions-db-PDO_MySQL.php

示例11: db_connect

/**
 * Connect to the database server and select the database.
 * @param bool $errorstop set to false to omit error messages
 * @return true if successful connection
 */
function db_connect($errorstop = true)
{
    global $_zp_DB_connection, $_zp_DB_last_result, $_zp_conf_vars;
    $_zp_DB_last_result = NULL;
    $db = $_zp_conf_vars['mysql_database'];
    if (!is_array($_zp_conf_vars)) {
        if ($errorstop) {
            zp_error(gettext('The <code>$_zp_conf_vars</code> variable is not an array. Zenphoto has not been instantiated correctly.'));
        }
        return false;
    }
    if (empty($folder) || $folder == 'localhost') {
        $folder = dirname(dirname(__FILE__)) . '/zp-data/';
    } else {
        $folder = str_replace($_zp_conf_vars['mysql_host'], '\\', '/');
        if (substr($folder, -1, 1) != '/') {
            $folder .= '/';
        }
    }
    try {
        $_zp_DB_connection = new PDO('sqlite:' . $folder . $_zp_conf_vars['mysql_database']);
    } catch (PDOException $e) {
        $_zp_DB_last_result = $e;
        if ($errorstop) {
            zp_error(sprintf(gettext('SQLite Error: Zenphoto received the error <em>%s</em> when connecting to the database server.'), $e->getMessage()));
        }
        return false;
    }
    try {
        $_zp_DB_connection->query('PRAGMA encoding = "UTF-8"');
    } catch (PDOException $e) {
        if (true || $noerrmsg) {
            zp_error(sprintf(gettext('%1$s Error: Zenphoto received the error <em>%2$s</em> from the database server.'), DATABASE_SOFTWARE, $e->getMessage()));
        }
        return false;
    }
    return $_zp_DB_connection;
}
开发者ID:hatone,项目名称:zenphoto-1.4.1.4,代码行数:43,代码来源:functions-db-PDO_SQLite.php

示例12: query

/**
 * The main query function. Runs the SQL on the connection and handles errors.
 * @param string $sql sql code
 * @param bool $noerrmsg set to true to supress the error message
 * @return results of the sql statements
 * @since 0.6
 */
function query($sql, $noerrmsg = false)
{
    global $mysql_connection, $_zp_query_count, $_zp_conf_vars;
    if ($mysql_connection == null) {
        db_connect();
    }
    $result = mysql_query($sql, $mysql_connection);
    if (!$result) {
        if ($noerrmsg) {
            return false;
        } else {
            $sql = sanitize($sql, 3);
            $error = sprintf(gettext('MySQL Query ( <em>%1$s</em> ) failed. Error: %2$s'), $sql, mysql_error());
            // Changed this to mysql_query - *never* call query functions recursively...
            if (!mysql_query("SELECT 1 FROM " . prefix('albums') . " LIMIT 0", $mysql_connection)) {
                $error .= "<br />" . gettext("It looks like your zenphoto tables haven't been created.") . ' ' . sprintf(gettext('You may need to run <a href="%s/%s/setup.php">the setup script.</a>'), WEBPATH, ZENFOLDER);
            }
            zp_error($error);
            return false;
        }
    }
    $_zp_query_count++;
    return $result;
}
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:functions-db.php

示例13: array

<?php 
echo "\n</head>";
?>


<body>

	<?php 
$checkarray_images = array(gettext('*Bulk actions*') => 'noaction', gettext('Delete') => 'deleteall', gettext('Set to published') => 'showall', gettext('Set to unpublished') => 'hideall', gettext('Add tags') => 'addtags', gettext('Clear tags') => 'cleartags', gettext('Disable comments') => 'commentsoff', gettext('Enable comments') => 'commentson', gettext('Change owner') => 'changeowner');
if (extensionEnabled('hitcounter')) {
    $checkarray_images['Reset hitcounter'] = 'resethitcounter';
}
$checkarray_images = zp_apply_filter('bulk_image_actions', $checkarray_images);
// Create our album
if (!isset($_GET['album'])) {
    zp_error(gettext("No album provided to sort."));
} else {
    // Layout the page
    printLogoAndLinks();
    ?>

		<div id="main">
			<?php 
    printTabs();
    ?>
			<div id="content">
				<?php 
    zp_apply_filter('admin_note', 'albums', 'sort');
    if ($album->getParent()) {
        $link = getAlbumBreadcrumbAdmin($album);
    } else {
开发者ID:rauldobrota,项目名称:zenphoto,代码行数:31,代码来源:admin-albumsort.php

示例14: preg_replace

        $query['albumzip'] = 'true';
        if ($fromcache) {
            $query['fromcache'] = 'true';
        }
        $link = FULLWEBPATH . '/' . preg_replace('~^' . WEBPATH . '/~', '', $request['path']) . '?' . http_build_query($query);
        echo '<a href="' . html_encode($link) . '" rel="nofollow" class="downloadlist_link">' . html_encode($file) . '</a>' . $filesize;
    }
}
/**
 * Process any download requests
 */
if (isset($_GET['download'])) {
    $item = sanitize($_GET['download']);
    if (empty($item) || !extensionEnabled('downloadList')) {
        if (TEST_RELEASE) {
            zp_error(gettext('Forbidden'));
        } else {
            header("HTTP/1.0 403 " . gettext("Forbidden"));
            header("Status: 403 " . gettext("Forbidden"));
            exitZP();
            //	terminate the script with no output
        }
    }
    $hash = getOption('downloadList_password');
    if (GALLERY_SECURITY != 'public' || $hash) {
        //	credentials required to download
        if (!zp_loggedin(getOption('downloadList_rights') ? FILES_RIGHTS : ALL_RIGHTS)) {
            $user = getOption('downloadList_user');
            zp_handle_password('download_auth', $hash, $user);
            if (!empty($hash) && zp_getCookie('download_auth') != $hash) {
                $show = $user ? true : NULL;
开发者ID:rb26,项目名称:zenphoto,代码行数:31,代码来源:downloadList.php

示例15: mkdir

     mkdir($uploaddir, CHMOD_VALUE);
 }
 @chmod($uploaddir, CHMOD_VALUE);
 $album = new Album($gallery, $folder);
 if ($album->exists) {
     if (!isset($_POST['publishalbum'])) {
         $album->setShow(false);
     }
     $title = sanitize($_POST['albumtitle'], 2);
     if (!empty($title) && $newAlbum) {
         $album->setTitle($title);
     }
     $album->save();
 } else {
     $AlbumDirName = str_replace(SERVERPATH, '', $gallery->albumdir);
     zp_error(gettext("The album couldn't be created in the 'albums' folder. This is usually a permissions problem. Try setting the permissions on the albums and cache folders to be world-writable using a shell:") . " <code>chmod 777 " . $AlbumDirName . CACHEFOLDER . "</code>, " . gettext("or use your FTP program to give everyone write permissions to those folders."));
 }
 $error = false;
 foreach ($_FILES['files']['error'] as $key => $error) {
     if ($_FILES['files']['name'][$key] == "") {
         continue;
     }
     if ($error == UPLOAD_ERR_OK) {
         $tmp_name = $_FILES['files']['tmp_name'][$key];
         $name = $_FILES['files']['name'][$key];
         $soename = UTF8toFilesystem(seoFriendlyURL($name));
         if (is_valid_image($name) || is_valid_other_type($name)) {
             $uploadfile = $uploaddir . '/' . $soename;
             move_uploaded_file($tmp_name, $uploadfile);
             @chmod($uploadfile, 0666 & CHMOD_VALUE);
             $image = newImage($album, $soename);
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:31,代码来源:admin-upload.php


注:本文中的zp_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。