本文整理汇总了PHP中pwg_query函数的典型用法代码示例。如果您正苦于以下问题:PHP pwg_query函数的具体用法?PHP pwg_query怎么用?PHP pwg_query使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pwg_query函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute_sqlfile
/**
* Loads a SQL file and executes all queries.
* Before executing a query, $replaced is... replaced by $replacing. This is
* useful when the SQL file contains generic words. Drop table queries are
* not executed.
*
* @param string $filepath
* @param string $replaced
* @param string $replacing
*/
function execute_sqlfile($filepath, $replaced, $replacing, $dblayer)
{
$sql_lines = file($filepath);
$query = '';
foreach ($sql_lines as $sql_line) {
$sql_line = trim($sql_line);
if (preg_match('/(^--|^$)/', $sql_line)) {
continue;
}
$query .= ' ' . $sql_line;
// if we reached the end of query, we execute it and reinitialize the
// variable "query"
if (preg_match('/;$/', $sql_line)) {
$query = trim($query);
$query = str_replace($replaced, $replacing, $query);
// we don't execute "DROP TABLE" queries
if (!preg_match('/^DROP TABLE/i', $query)) {
if ('mysql' == $dblayer) {
if (preg_match('/^(CREATE TABLE .*)[\\s]*;[\\s]*/im', $query, $matches)) {
$query = $matches[1] . ' DEFAULT CHARACTER SET utf8' . ';';
}
}
pwg_query($query);
}
$query = '';
}
}
}
示例2: upgrade_250_255
function upgrade_250_255()
{
global $conf;
// Add new field in Register_FluxBB ID links table
$query = 'ALTER TABLE ' . Register_FluxBB_ID_TABLE . ' ADD PwdSynch VARCHAR(3) NULL DEFAULT NULL;';
pwg_query($query);
}
示例3: upgrade65_change_table_to_charset
function upgrade65_change_table_to_charset($table, $field_definitions, $db_charset)
{
$changes = array();
foreach ($field_definitions as $row) {
if (!isset($row['Collation']) or $row['Collation'] == 'NULL') {
continue;
}
$query = $row['Field'] . ' ' . $row['Type'];
$query .= ' CHARACTER SET ' . $db_charset;
if (strpos($row['Collation'], '_bin') !== false) {
$query .= ' BINARY';
}
if ($row['Null'] != 'YES') {
$query .= ' NOT NULL';
if (isset($row['Default'])) {
$query .= ' DEFAULT "' . addslashes($row['Default']) . '"';
}
} else {
if (!isset($row['Default'])) {
$query .= ' DEFAULT NULL';
} else {
$query .= ' DEFAULT "' . addslashes($row['Default']) . '"';
}
}
if ($row['Extra'] == 'auto_increment') {
$query .= ' auto_increment';
}
$changes[] = 'MODIFY COLUMN ' . $query;
}
if (count($changes)) {
$query = 'ALTER TABLE `' . $table . '` ' . implode(', ', $changes);
pwg_query($query);
}
}
示例4: uninstall
function uninstall()
{
global $conf;
conf_delete_param('forecast_conf');
$q = 'DROP VIEW forecast;';
pwg_query($q);
}
示例5: vjs_begin_delete_elements
function vjs_begin_delete_elements($ids)
{
if (count($ids) == 0) {
return 0;
}
$vjs_extensions = array('ogg', 'ogv', 'mp4', 'm4v', 'webm', 'webmv');
$files_ext = array_merge(array(), $vjs_extensions, array_map('strtoupper', $vjs_extensions));
// Find details base on ID and if supported video files
$query = '
SELECT
id,
path,
representative_ext
FROM ' . IMAGES_TABLE . '
WHERE id IN (' . implode(',', $ids) . ') AND ' . SQL_VIDEOS . '
;';
$result = pwg_query($query);
while ($row = pwg_db_fetch_assoc($result)) {
if (url_is_remote($row['path'])) {
continue;
}
$files = array();
$files[] = get_element_path($row);
$ok = true;
if (!isset($conf['never_delete_originals'])) {
foreach ($files as $path) {
// Don't delete the actual video or representative
// It is done by PWG core
// Delete any other video source format
$file_wo_ext = pathinfo($path);
$file_dir = dirname($path);
foreach ($files_ext as $file_ext) {
$path_ext = $file_dir . "/pwg_representative/" . $file_wo_ext['filename'] . "." . $file_ext;
if (is_file($path_ext) and !unlink($path_ext)) {
$ok = false;
trigger_error('"' . $path_ext . '" cannot be removed', E_USER_WARNING);
break;
}
}
// Delete video thumbnails
$filematch = $file_dir . "/pwg_representative/" . $file_wo_ext['filename'] . "-th_*";
$matches = glob($filematch);
if (is_array($matches)) {
foreach ($matches as $filename) {
if (is_file($filename) and !unlink($filename)) {
$ok = false;
trigger_error('"' . $filename . '" cannot be removed', E_USER_WARNING);
break;
}
}
}
// End videos thumbnails
}
// End for each files
}
// End IF
}
// End While
}
示例6: uninstall
function uninstall()
{
global $prefixeTable;
$query = 'ALTER TABLE ' . IMAGES_TABLE . ' DROP pqv_validated;';
pwg_query($query);
$query = 'DROP TABLE ' . GROUPS_TABLE . ' DROP pqv_enabled;';
pwg_query($query);
}
示例7: plugin_uninstall
function plugin_uninstall()
{
$query = '
DELETE FROM ' . CONFIG_TABLE . '
WHERE param=\'eml\'
;';
pwg_query($query);
}
示例8: uninstall
function uninstall()
{
global $prefixeTable;
pwg_query('DROP TABLE ' . $prefixeTable . 'pshare_keys;');
pwg_query('DROP TABLE ' . $prefixeTable . 'pshare_log;');
$query = 'DROP TABLE ' . GROUPS_TABLE . ' DROP pshare_enabled;';
pwg_query($query);
}
示例9: plugin_uninstall
function plugin_uninstall()
{
if (is_dir(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'GThumb')) {
gtdeltree(PHPWG_ROOT_PATH . PWG_LOCAL_DIR . 'GThumb');
}
$query = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param="GThumb" LIMIT 1;';
pwg_query($query);
}
示例10: plugin_uninstall
function plugin_uninstall()
{
global $prefixeTable;
$query = '
DROP TABLE ' . $prefixeTable . 'stereo
;';
pwg_query($query);
}
示例11: get_summary
function get_summary($year = null, $month = null, $day = null)
{
$query = '
SELECT
year,
month,
day,
hour,
nb_pages
FROM ' . HISTORY_SUMMARY_TABLE;
if (isset($day)) {
$query .= '
WHERE year = ' . $year . '
AND month = ' . $month . '
AND day = ' . $day . '
AND hour IS NOT NULL
ORDER BY
year ASC,
month ASC,
day ASC,
hour ASC
;';
} elseif (isset($month)) {
$query .= '
WHERE year = ' . $year . '
AND month = ' . $month . '
AND day IS NOT NULL
AND hour IS NULL
ORDER BY
year ASC,
month ASC,
day ASC
;';
} elseif (isset($year)) {
$query .= '
WHERE year = ' . $year . '
AND month IS NOT NULL
AND day IS NULL
ORDER BY
year ASC,
month ASC
;';
} else {
$query .= '
WHERE year IS NOT NULL
AND month IS NULL
ORDER BY
year ASC
;';
}
$result = pwg_query($query);
$output = array();
while ($row = pwg_db_fetch_assoc($result)) {
$output[] = $row;
}
return $output;
}
示例12: plugin_uninstall
function plugin_uninstall()
{
$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param = "jplayer_skin";';
pwg_query($q);
$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param = "jplayer_autoplay";';
pwg_query($q);
$q = 'DELETE FROM ' . CONFIG_TABLE . ' WHERE param = "jplayer_jplayer_representative_as_poster";';
pwg_query($q);
// TODO : Do we need to purge the videos from the images table?
}
示例13: uninstall
function uninstall()
{
global $prefixeTable;
$query = 'DROP TABLE ' . $prefixeTable . 'pfemail_mailboxes;';
pwg_query($query);
$query = 'DROP TABLE ' . $prefixeTable . 'pfemail_pendings;';
pwg_query($query);
// delete configuration
pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param IN ("pfemail_last_check");');
}
示例14: plugin_uninstall
function plugin_uninstall()
{
global $conf;
if (isset($conf['PruneHistory'])) {
$q = '
DELETE FROM ' . CONFIG_TABLE . '
WHERE param="PruneHistory"
;';
pwg_query($q);
}
}
示例15: get_site_url
function get_site_url($category_id)
{
global $page;
$query = '
SELECT galleries_url
FROM ' . SITES_TABLE . ' AS s,' . CATEGORIES_TABLE . ' AS c
WHERE s.id = c.site_id
AND c.id = ' . $category_id . '
;';
$row = pwg_db_fetch_assoc(pwg_query($query));
return $row['galleries_url'];
}