• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP pwg_db_num_rows函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: ws_images_addFlickr

function ws_images_addFlickr($photo, &$service)
{
    if (!is_admin()) {
        return new PwgError(403, 'Forbidden');
    }
    global $conf;
    if (empty($conf['flickr2piwigo']['api_key']) or empty($conf['flickr2piwigo']['secret_key'])) {
        return new PwgError(null, l10n('Please fill your API keys on the configuration tab'));
    }
    include_once PHPWG_ROOT_PATH . 'admin/include/functions.php';
    include_once PHPWG_ROOT_PATH . 'admin/include/functions_upload.inc.php';
    include_once FLICKR_PATH . 'include/functions.inc.php';
    if (test_remote_download() === false) {
        return new PwgError(null, l10n('No download method available'));
    }
    // init flickr API
    include_once FLICKR_PATH . 'include/phpFlickr/phpFlickr.php';
    $flickr = new phpFlickr($conf['flickr2piwigo']['api_key'], $conf['flickr2piwigo']['secret_key']);
    $flickr->enableCache('fs', FLICKR_FS_CACHE);
    // user
    $u = $flickr->test_login();
    if ($u === false or empty($_SESSION['phpFlickr_auth_token'])) {
        return new PwgError(403, l10n('API not authenticated'));
    }
    // photos infos
    $photo_f = $flickr->photos_getInfo($photo['id']);
    $photo = array_merge($photo, $photo_f['photo']);
    $photo['url'] = $flickr->get_biggest_size($photo['id'], 'original');
    $photo['path'] = FLICKR_FS_CACHE . 'flickr-' . $u['username'] . '-' . $photo['id'] . '.' . get_extension($photo['url']);
    // copy file
    if (download_remote_file($photo['url'], $photo['path']) == false) {
        return new PwgError(null, l10n('Can\'t download file'));
    }
    // category
    if (!preg_match('#^[0-9]+$#', $photo['category'])) {
        $categories_names = explode(',', $photo['category']);
        $photo['category'] = array();
        foreach ($categories_names as $category_name) {
            $query = '
SELECT id FROM ' . CATEGORIES_TABLE . '
  WHERE LOWER(name) = "' . strtolower($category_name) . '"
;';
            $result = pwg_query($query);
            if (pwg_db_num_rows($result)) {
                list($cat_id) = pwg_db_fetch_row($result);
                $photo['category'][] = $cat_id;
            } else {
                $cat = create_virtual_category($category_name);
                $photo['category'][] = $cat['id'];
            }
        }
    } else {
        $photo['category'] = array($photo['category']);
    }
    // add photo
    $photo['image_id'] = add_uploaded_file($photo['path'], basename($photo['path']), $photo['category']);
    // do some updates
    if (!empty($photo['fills'])) {
        $photo['fills'] = rtrim($photo['fills'], ',');
        $photo['fills'] = explode(',', $photo['fills']);
        $updates = array();
        if (in_array('fill_name', $photo['fills'])) {
            $updates['name'] = pwg_db_real_escape_string($photo['title']);
        }
        if (in_array('fill_posted', $photo['fills'])) {
            $updates['date_available'] = date('Y-m-d H:i:s', $photo['dates']['posted']);
        }
        if (in_array('fill_taken', $photo['fills'])) {
            $updates['date_creation'] = $photo['dates']['taken'];
        }
        if (in_array('fill_author', $photo['fills'])) {
            $updates['author'] = pwg_db_real_escape_string($photo['owner']['username']);
        }
        if (in_array('fill_description', $photo['fills'])) {
            $updates['comment'] = pwg_db_real_escape_string(@$photo['description']);
        }
        if (in_array('fill_geotag', $photo['fills']) and !empty($photo['location'])) {
            $updates['latitude'] = pwg_db_real_escape_string($photo['location']['latitude']);
            $updates['longitude'] = pwg_db_real_escape_string($photo['location']['longitude']);
        }
        if (in_array('level', $photo['fills']) && !$photo['visibility']['ispublic']) {
            $updates['level'] = 8;
            if ($photo['visibility']['isfamily']) {
                $updates['level'] = 4;
            }
            if ($photo['visibility']['isfriend']) {
                $updates['level'] = 2;
            }
        }
        if (count($updates)) {
            single_update(IMAGES_TABLE, $updates, array('id' => $photo['image_id']));
        }
        if (!empty($photo['tags']['tag']) and in_array('fill_tags', $photo['fills'])) {
            $raw_tags = array_map(create_function('$t', 'return $t["_content"];'), $photo['tags']['tag']);
            $raw_tags = implode(',', $raw_tags);
            set_tags(get_tag_ids($raw_tags), $photo['image_id']);
        }
    }
    return l10n('Photo "%s" imported', $photo['title']);
}
开发者ID:biffhero,项目名称:Flickr2Piwigo,代码行数:100,代码来源:ws_functions.inc.php


示例2: plugin_install

function plugin_install($id, $version, &$errors)
{
    global $conf;
    /* ****************************************************************** */
    /* **************** BEGIN - Data preparation in vars **************** */
    /* ****************************************************************** */
    $defaultPH = array();
    // Set current plugin version in config table
    $plugin = PHInfos(PH_PATH);
    $version = $plugin['version'];
    // Default global parameters for Prune History conf
    // -------------------------------------------------
    $defaultPH = array('PHVersion' => $version, 'AUTOPRUNE' => 'false', 'RANGEVALUE' => '0', 'RANGE' => '0');
    // Create Prune History conf if not already exists
    // ------------------------------------------------
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "PruneHistory"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        $q = '
INSERT INTO ' . CONFIG_TABLE . ' (param, value, comment)
VALUES ("PruneHistory","' . pwg_db_real_escape_string(serialize($defaultPH)) . '","Prune History parameters")
  ;';
        pwg_query($q);
    }
}
开发者ID:Eric-Piwigo,项目名称:Prune_History,代码行数:29,代码来源:maintain.inc.php


示例3: install

    function install($plugin_version, &$errors = array())
    {
        global $conf, $prefixeTable;
        $query = '
CREATE TABLE IF NOT EXISTS ' . $prefixeTable . 'pfemail_mailboxes (
  id int(11) NOT NULL AUTO_INCREMENT,
  path varchar(255) NOT NULL,
  login varchar(255) NOT NULL,
  password varchar(255) NOT NULL,
  category_id smallint(5) unsigned DEFAULT NULL,
  moderated enum(\'true\',\'false\') NOT NULL DEFAULT \'true\',
  PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
;';
        pwg_query($query);
        $query = '
CREATE TABLE IF NOT EXISTS ' . $prefixeTable . 'pfemail_pendings (
  image_id mediumint(8) unsigned NOT NULL,
  state varchar(255) NOT NULL,
  added_on datetime NOT NULL,
  validated_by mediumint(8) unsigned DEFAULT NULL,
  from_name varchar(255) DEFAULT NULL,
  from_address varchar(255) DEFAULT NULL,
  subject varchar(255) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8
;';
        pwg_query($query);
        $result = pwg_query('SHOW COLUMNS FROM `' . GROUPS_TABLE . '` LIKE "pfemail_notify";');
        if (!pwg_db_num_rows($result)) {
            pwg_query('ALTER TABLE ' . GROUPS_TABLE . ' ADD pfemail_notify enum(\'true\', \'false\') DEFAULT \'false\';');
        }
        $this->installed = true;
    }
开发者ID:plegall,项目名称:Piwigo-photo_from_email,代码行数:33,代码来源:maintain.class.php


示例4: NBMS_Save_Profile

function NBMS_Save_Profile()
{
    global $conf, $user;
    include_once PHPWG_ROOT_PATH . 'admin/include/functions_notification_by_mail.inc.php';
    $query = '
SELECT *
FROM ' . USER_MAIL_NOTIFICATION_TABLE . '
WHERE user_id = \'' . $user['id'] . '\'
';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        $inserts = array();
        $check_key_list = array();
        // Calculate key
        $nbm_user['check_key'] = find_available_check_key();
        // Save key
        array_push($check_key_list, $nbm_user['check_key']);
        // Insert new nbm_users
        array_push($inserts, array('user_id' => $user['id'], 'check_key' => $nbm_user['check_key'], 'enabled' => $_POST['NBM_Subscription']));
        mass_inserts(USER_MAIL_NOTIFICATION_TABLE, array('user_id', 'check_key', 'enabled'), $inserts);
    } elseif ($count != 0 and !empty($_POST['NBM_Subscription']) && in_array($_POST['NBM_Subscription'], array('true', 'false'))) {
        $query = '
UPDATE ' . USER_MAIL_NOTIFICATION_TABLE . '
  SET enabled = \'' . $_POST['NBM_Subscription'] . '\'
  WHERE user_id = \'' . $user['id'] . '\';';
        pwg_query($query);
    }
}
开发者ID:Eric-Piwigo,项目名称:NBM_Subscriber,代码行数:28,代码来源:main.inc.php


示例5: install

 function install($plugin_version, &$errors = array())
 {
     // create categories.downloadable (true/false)
     $result = pwg_query('SHOW COLUMNS FROM `' . CATEGORIES_TABLE . '` LIKE "external_reference";');
     if (!pwg_db_num_rows($result)) {
         pwg_query('ALTER TABLE `' . CATEGORIES_TABLE . '` ADD `external_reference` varchar(255) DEFAULT NULL;');
     }
     $this->installed = true;
 }
开发者ID:plegall,项目名称:Piwigo-external_reference,代码行数:9,代码来源:maintain.class.php


示例6: osm_items_have_latlon

function osm_items_have_latlon($items)
{
    $query = '
SELECT id FROM ' . IMAGES_TABLE . '
WHERE latitude IS NOT NULL
  AND id IN (' . implode(',', $items) . ')
ORDER BY NULL
LIMIT 0,1';
    if (pwg_db_num_rows(pwg_query($query)) > 0) {
        return true;
    }
    return false;
}
开发者ID:lcorbasson,项目名称:piwigo-openstreetmap,代码行数:13,代码来源:functions.php


示例7: install

 function install($plugin_version, &$errors = array())
 {
     global $conf, $prefixeTable;
     $result = pwg_query('SHOW COLUMNS FROM `' . IMAGES_TABLE . '` LIKE "pqv_validated";');
     if (!pwg_db_num_rows($result)) {
         pwg_query('ALTER TABLE ' . IMAGES_TABLE . ' ADD pqv_validated enum(\'true\', \'false\') DEFAULT NULL;');
     }
     $result = pwg_query('SHOW COLUMNS FROM `' . GROUPS_TABLE . '` LIKE "pqv_enabled";');
     if (!pwg_db_num_rows($result)) {
         pwg_query('ALTER TABLE ' . GROUPS_TABLE . ' ADD pqv_enabled enum(\'true\', \'false\') DEFAULT \'false\';');
     }
     $this->installed = true;
 }
开发者ID:plegall,项目名称:Piwigo-photo_quick_validation,代码行数:13,代码来源:maintain.class.php


示例8: get_oauth_id

function get_oauth_id($user_id)
{
    $query = '
SELECT oauth_id FROM ' . USER_INFOS_TABLE . '
  WHERE user_id = ' . $user_id . '
  AND oauth_id != ""
;';
    $result = pwg_query($query);
    if (!pwg_db_num_rows($result)) {
        return null;
    } else {
        list($oauth_id) = pwg_db_fetch_row($result);
        return $oauth_id;
    }
}
开发者ID:lcorbasson,项目名称:Piwigo-Social-Connect,代码行数:15,代码来源:functions.inc.php


示例9: delete_cat_permalink

/** deletes the permalink associated with a category
 * returns true on success
 * @param int cat_id the target category id
 * @param boolean save if true, the current category-permalink association
 * is saved in the old permalinks table in case external links hit it
 */
function delete_cat_permalink($cat_id, $save)
{
    global $page, $cache;
    $query = '
SELECT permalink
  FROM ' . CATEGORIES_TABLE . '
  WHERE id=\'' . $cat_id . '\'
;';
    $result = pwg_query($query);
    if (pwg_db_num_rows($result)) {
        list($permalink) = pwg_db_fetch_row($result);
    }
    if (!isset($permalink)) {
        // no permalink; nothing to do
        return true;
    }
    if ($save) {
        $old_cat_id = get_cat_id_from_old_permalink($permalink);
        if (isset($old_cat_id) and $old_cat_id != $cat_id) {
            $page['errors'][] = sprintf(l10n('Permalink %s has been previously used by album %s. Delete from the permalink history first'), $permalink, $old_cat_id);
            return false;
        }
    }
    $query = '
UPDATE ' . CATEGORIES_TABLE . '
  SET permalink=NULL
  WHERE id=' . $cat_id . '
  LIMIT 1';
    pwg_query($query);
    unset($cache['cat_names']);
    //force regeneration
    if ($save) {
        if (isset($old_cat_id)) {
            $query = '
UPDATE ' . OLD_PERMALINKS_TABLE . '
  SET date_deleted=NOW()
  WHERE cat_id=' . $cat_id . ' AND permalink=\'' . $permalink . '\'';
        } else {
            $query = '
INSERT INTO ' . OLD_PERMALINKS_TABLE . '
  (permalink, cat_id, date_deleted)
VALUES
  ( \'' . $permalink . '\',' . $cat_id . ',NOW() )';
        }
        pwg_query($query);
    }
    return true;
}
开发者ID:donseba,项目名称:Piwigo,代码行数:54,代码来源:functions_permalinks.php


示例10: vjs_add_tab

function vjs_add_tab($sheets, $id)
{
    if ($id == 'photo') {
        $query = "SELECT id FROM " . IMAGES_TABLE . " WHERE " . SQL_VIDEOS . " AND id = " . $_GET['image_id'] . ";";
        $result = pwg_query($query);
        if (!pwg_db_num_rows($result)) {
            return $sheets;
        }
        $sheets['videojs'] = array('caption' => 'VideoJS', 'url' => get_root_url() . 'admin.php?page=plugin&section=piwigo-videojs/admin/admin_photo.php&image_id=' . $_GET['image_id']);
        unset($sheets['coi'], $sheets['update']);
        unset($sheets['rotate'], $sheets['update']);
        /* Replace the RotateImage by a our own */
        $sheets['rotate'] = array('caption' => 'Rotate', 'url' => get_root_url() . 'admin.php?page=plugin&section=piwigo-videojs/admin/admin_rotate.php&image_id=' . $_GET['image_id']);
    }
    return $sheets;
}
开发者ID:naryoss,项目名称:piwigo-videojs,代码行数:16,代码来源:admin_boot.php


示例11: install

    function install($plugin_version, &$errors = array())
    {
        global $conf;
        if (empty($conf['oauth'])) {
            conf_update_param('oauth', $this->default_conf, true);
        } else {
            $conf['oauth'] = safe_unserialize($conf['oauth']);
            if (!isset($conf['oauth']['allow_merge_accounts'])) {
                $conf['oauth']['allow_merge_accounts'] = true;
                conf_update_param('oauth', $conf['oauth']);
            }
        }
        $result = pwg_query('SHOW COLUMNS FROM `' . USER_INFOS_TABLE . '` LIKE "oauth_id";');
        if (!pwg_db_num_rows($result)) {
            pwg_query('ALTER TABLE `' . USER_INFOS_TABLE . '` ADD `oauth_id` VARCHAR(255) DEFAULT NULL;');
        }
        // move field from users table to user_infos
        $result = pwg_query('SHOW COLUMNS FROM `' . USERS_TABLE . '` LIKE "oauth_id";');
        if (pwg_db_num_rows($result)) {
            $query = '
UPDATE `' . USER_INFOS_TABLE . '` AS i
  SET oauth_id = (
    SELECT oauth_id
      FROM `' . USERS_TABLE . '` AS u
      WHERE u.' . $conf['user_fields']['id'] . ' = i.user_id
    )
;';
            pwg_query($query);
            pwg_query('ALTER TABLE `' . USERS_TABLE . '` DROP `oauth_id`;');
        }
        // add 'total' and 'enabled' fields in hybridauth conf file
        if (file_exists($this->file)) {
            $hybridauth_conf = (include $this->file);
            if (!isset($hybridauth_conf['total'])) {
                $enabled = array_filter($hybridauth_conf['providers'], create_function('$p', 'return $p["enabled"];'));
                $hybridauth_conf['total'] = count($hybridauth_conf['providers']);
                $hybridauth_conf['enabled'] = count($enabled);
                $content = "<?php\ndefined('PHPWG_ROOT_PATH') or die('Hacking attempt!');\n\nreturn ";
                $content .= var_export($hybridauth_conf, true);
                $content .= ";\n?>";
                file_put_contents($this->file, $content);
            }
        }
    }
开发者ID:lcorbasson,项目名称:Piwigo-Social-Connect,代码行数:44,代码来源:maintain.class.php


示例12: install

 function install($plugin_version, &$errors = array())
 {
     global $conf;
     // add a new column to existing table
     $result = pwg_query('SHOW COLUMNS FROM `' . CATEGORIES_TABLE . '` LIKE "polaroid_active";');
     if (!pwg_db_num_rows($result)) {
         pwg_query('ALTER TABLE `' . CATEGORIES_TABLE . '` ADD `polaroid_active` enum(\'true\', \'false\') default \'false\';');
     }
     $config = array('apply_to_albums' => 'all');
     // load existing config parameters
     if (!empty($conf['polaroid'])) {
         $conf['polaroid'] = safe_unserialize($conf['polaroid']);
         foreach ($conf['polaroid'] as $key => $value) {
             $config[$key] = $value;
         }
     }
     conf_update_param('polaroid', $config, true);
     $this->installed = true;
 }
开发者ID:plegall,项目名称:Piwigo-polaroid,代码行数:19,代码来源:maintain.class.php


示例13: install

    function install($plugin_version, &$errors = array())
    {
        global $conf, $prefixeTable;
        $query = '
CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'pshare_keys` (
  `pshare_key_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) NOT NULL,
  `user_id` mediumint(8) unsigned NOT NULL,
  `image_id` mediumint(8) unsigned NOT NULL,
  `sent_to` varchar(255) NOT NULL,
  `created_on` datetime NOT NULL,
  `duration` int(10) unsigned DEFAULT NULL,
  `expire_on` datetime NOT NULL,
  `is_valid` enum(\'true\',\'false\') NOT NULL DEFAULT \'true\',
  PRIMARY KEY (`pshare_key_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
;';
        pwg_query($query);
        $query = '
CREATE TABLE IF NOT EXISTS `' . $prefixeTable . 'pshare_log` (
  `pshare_log_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `pshare_key_idx` int(10) unsigned NOT NULL,
  `occured_on` datetime NOT NULL,
  `type` enum(\'download\',\'visit\') NOT NULL DEFAULT \'visit\',
  `ip_address` varchar(15) NOT NULL DEFAULT \'\',
  `user_id` mediumint(8) unsigned NOT NULL,
  `format_id` int(11) unsigned default NULL,
  PRIMARY KEY (`pshare_log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
;';
        pwg_query($query);
        $result = pwg_query('SHOW COLUMNS FROM `' . GROUPS_TABLE . '` LIKE "pshare_enabled";');
        if (!pwg_db_num_rows($result)) {
            pwg_query('ALTER TABLE ' . GROUPS_TABLE . ' ADD pshare_enabled enum(\'true\', \'false\') DEFAULT \'false\';');
        }
        $result = pwg_query('SHOW COLUMNS FROM `' . $prefixeTable . 'pshare_log` LIKE "format_id";');
        if (!pwg_db_num_rows($result)) {
            pwg_query('ALTER TABLE ' . $prefixeTable . 'pshare_log ADD format_id int(11) DEFAULT NULL;');
        }
        $this->installed = true;
    }
开发者ID:plegall,项目名称:Piwigo-private_share,代码行数:41,代码来源:maintain.class.php


示例14: plugin_install

function plugin_install($id, $version, &$errors)
{
    global $conf;
    // Set current plugin version in config table
    $plugin = CM_Infos(CM_PATH);
    $version = $plugin['version'];
    $default = array('CMVersion' => $version, 'CM_No_Comment_Anonymous' => 'false', 'CM_GROUPCOMM' => 'false', 'CM_ALLOWCOMM_GROUP' => -1, 'CM_GROUPVALID1' => 'false', 'CM_VALIDCOMM1_GROUP' => -1, 'CM_GROUPVALID2' => 'false', 'CM_VALIDCOMM2_GROUP' => -1);
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "CommentsManager"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        $q = '
INSERT INTO ' . CONFIG_TABLE . ' (param, value, comment)
VALUES ("CommentsManager","' . pwg_db_real_escape_string(serialize($default)) . '","Comments Access Manager parameters")
  ;';
        pwg_query($q);
    }
}
开发者ID:Eric-Piwigo,项目名称:Comments_Access_Manager,代码行数:21,代码来源:maintain.inc.php


示例15: oauth_try_log_user

/**
 * interrupt normal login if corresponding to an oauth user
 */
function oauth_try_log_user($success, $username)
{
    global $conf, $redirect_to;
    $query = '
SELECT oauth_id
  FROM ' . USER_INFOS_TABLE . ' AS i
    INNER JOIN ' . USERS_TABLE . ' AS u
    ON i.user_id = u.' . $conf['user_fields']['id'] . '
  WHERE ' . $conf['user_fields']['username'] . ' = "' . pwg_db_real_escape_string($username) . '"
  AND oauth_id != ""
;';
    $result = pwg_query($query);
    if (pwg_db_num_rows($result)) {
        list($oauth_id) = pwg_db_fetch_row($result);
        list($provider) = explode('---', $oauth_id, 2);
        $_SESSION['page_errors'][] = l10n('You registered with a %s account, please sign in with the same account.', $provider);
        $redirect_to = get_root_url() . 'identification.php';
        // variable used by identification.php
        return true;
    }
    return false;
}
开发者ID:lcorbasson,项目名称:Piwigo-Social-Connect,代码行数:25,代码来源:public_events.inc.php


示例16: plugin_activate

function plugin_activate($id, $version, &$errors)
{
    global $conf;
    include_once HIPE_PATH . 'include/dbupgrade.inc.php';
    /* Check for upgrade from 2.0.0 to 2.0.1 */
    /* *************************************** */
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "nbc_HistoryIPExcluder"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 1) {
        /* upgrade from version 2.0.0 to 2.0.1  */
        /* ************************************ */
        upgrade_200();
    }
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "HistoryIPConfig"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        /* upgrade from version 2.1.0 to 2.1.1  */
        /* ************************************ */
        upgrade_210();
    }
    /* upgrade from version 2.1.1 to 2.2.0 */
    /* *********************************** */
    $HIPE_Config = unserialize($conf['HistoryIPConfig']);
    if ($HIPE_Config['Version'] == '2.1.1') {
        upgrade_211();
    }
    /* Global version number upgrade */
    /* ***************************** */
    global_version_update();
}
开发者ID:Eric-Piwigo,项目名称:HistoryIPExcluder,代码行数:38,代码来源:maintain.inc.php


示例17: plugin_install

function plugin_install($id, $version, &$errors)
{
    global $prefixeTable, $conf;
    // Set current plugin version in config table
    $plugin = RegFluxBB_Infos(REGFLUXBB_PATH);
    $version = $plugin['version'];
    // Default global parameters for RegisterFluxBB conf
    // -------------------------------------------------
    $defaultRegFluxBB = array('REGFLUXBB_VERSION' => $version, 'FLUXBB_PREFIX' => '', 'FLUXBB_ADMIN' => '', 'FLUXBB_GUEST' => '', 'FLUXBB_DEL_PT' => 'false', 'FLUXBB_CONFIRM' => 'false', 'FLUXBB_DETAIL' => 'false', 'FLUXBB_UAM_LINK' => 'false', 'FLUXBB_GROUP' => '');
    // Create RegisterFluxBB conf if not already exists
    // ------------------------------------------------
    $query = '
SELECT param
  FROM ' . CONFIG_TABLE . '
WHERE param = "Register_FluxBB"
;';
    $count = pwg_db_num_rows(pwg_query($query));
    if ($count == 0) {
        $q = '
INSERT INTO ' . CONFIG_TABLE . ' (param, value, comment)
VALUES ("Register_FluxBB","' . pwg_db_real_escape_string(serialize($defaultRegFluxBB)) . '","Register_FluxBB parameters")
  ;';
        pwg_query($q);
    }
    // Create relation table between FluxBB and Piwigo
    // -----------------------------------------------
    $q = '
CREATE TABLE IF NOT EXISTS ' . Register_FluxBB_ID_TABLE . ' (
  id_user_pwg smallint(5) NOT NULL default "0",
  id_user_FluxBB int(10) NOT NULL default "0",
  PwdSynch varchar(3) default NULL,
PRIMARY KEY  (id_user_pwg),
  KEY id_user_pwg (id_user_pwg, id_user_FluxBB, PwdSynch)
)
;';
    pwg_query($q);
}
开发者ID:Eric-Piwigo,项目名称:Register_FluxBB,代码行数:37,代码来源:maintain.inc.php


示例18: die

if (!defined('PHPWG_ROOT_PATH')) {
    die('Hacking attempt!');
}
$upgrade_description = 'add "latitude" and "longitude" fields';
// add fields
$query = '
ALTER TABLE ' . IMAGES_TABLE . '
  ADD `latitude` DOUBLE(8, 6) DEFAULT NULL,
  ADD `longitude` DOUBLE(9, 6) DEFAULT NULL
;';
pwg_query($query);
// add index
$query = '
ALTER TABLE ' . IMAGES_TABLE . '
  ADD INDEX `images_i6` (`latitude`) 
;';
pwg_query($query);
// search for old "lat" field
$query = 'SHOW COLUMNS FROM ' . IMAGES_TABLE . ' LIKE "lat";';
if (pwg_db_num_rows(pwg_query($query))) {
    // duplicate non-null values
    $query = '
UPDATE ' . IMAGES_TABLE . '
  SET latitude = lat,
    longitude = lon
  WHERE lat IS NOT NULL
    AND lon IS NOT NULL
;';
    pwg_query($query);
}
echo "\n" . $upgrade_description . "\n";
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:139-database.php


示例19: elseif

    } elseif ($conf['allow_random_representative']) {
        // searching a random representant among elements in sub-categories
        $image_id = get_random_image_in_category($row);
    } elseif ($row['count_categories'] > 0 and $row['count_images'] > 0) {
        // searching a random representant among representant of sub-categories
        $query = '
SELECT representative_picture_id
  FROM ' . CATEGORIES_TABLE . ' INNER JOIN ' . USER_CACHE_CATEGORIES_TABLE . '
  ON id = cat_id and user_id = ' . $user['id'] . '
  WHERE uppercats LIKE \'' . $row['uppercats'] . ',%\'
    AND representative_picture_id IS NOT NULL' . get_sql_condition_FandF(array('visible_categories' => 'id'), "\n  AND") . '
  ORDER BY ' . DB_RANDOM_FUNCTION . '()
  LIMIT 1
;';
        $subresult = pwg_query($query);
        if (pwg_db_num_rows($subresult) > 0) {
            list($image_id) = pwg_db_fetch_row($subresult);
        }
    }
    if (isset($image_id)) {
        if ($conf['representative_cache_on_subcats'] and $row['user_representative_picture_id'] != $image_id) {
            $user_representative_updates_for[$row['id']] = $image_id;
        }
        $row['representative_picture_id'] = $image_id;
        $image_ids[] = $image_id;
        $categories[] = $row;
        $category_ids[] = $row['id'];
    }
    unset($image_id);
}
if ($conf['display_fromto']) {
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:31,代码来源:category_cats.inc.php


示例20: ROUND

     , ROUND(AVG(rate),2) AS average
  FROM ' . RATE_TABLE . '
  WHERE element_id = ' . $picture['current']['id'] . '
;';
        list($rate_summary['count'], $rate_summary['average']) = pwg_db_fetch_row(pwg_query($query));
    }
    $template->assign('rate_summary', $rate_summary);
    $user_rate = null;
    if ($conf['rate_anonymous'] or is_autorize_status(ACCESS_CLASSIC)) {
        if ($rate_summary['count'] > 0) {
            $query = 'SELECT rate
      FROM ' . RATE_TABLE . '
      WHERE element_id = ' . $page['image_id'] . '
      AND user_id = ' . $user['id'];
            if (!is_autorize_status(ACCESS_CLASSIC)) {
                $ip_components = explode('.', $_SERVER['REMOTE_ADDR']);
                if (count($ip_components) > 3) {
                    array_pop($ip_components);
                }
                $anonymous_id = implode('.', $ip_components);
                $query .= ' AND anonymous_id = \'' . $anonymous_id . '\'';
            }
            $result = pwg_query($query);
            if (pwg_db_num_rows($result) > 0) {
                $row = pwg_db_fetch_assoc($result);
                $user_rate = $row['rate'];
            }
        }
        $template->assign('rating', array('F_ACTION' => add_url_params($url_self, array('action' => 'rate')), 'USER_RATE' => $user_rate, 'marks' => $conf['rate_items']));
    }
}
开发者ID:donseba,项目名称:Piwigo,代码行数:31,代码来源:picture_rate.inc.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP pwg_db_real_escape_string函数代码示例发布时间:2022-05-15
下一篇:
PHP pwg_db_fetch_row函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap