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


PHP pwg_db_num_rows函数代码示例

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


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


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