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


PHP DBLayer::selectWithParameter方法代码示例

本文整理汇总了PHP中DBLayer::selectWithParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP DBLayer::selectWithParameter方法的具体用法?PHP DBLayer::selectWithParameter怎么用?PHP DBLayer::selectWithParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DBLayer的用法示例。


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

示例1: delete_plugin

/**
 * This function is used in deleting plugins.
 * It removes the plugin from the codebase as well as
 * from the Database. When user request to delete a plugin
 * id of that plugin is sent in $_GET global variable.
 *
 * @author Shubham Meena, mentored by Matthew Lagoe
 */
function delete_plugin()
{
    // if logged in
    if (WebUsers::isLoggedIn()) {
        if (isset($_GET['id'])) {
            // id of plugin to delete after filtering
            $id = filter_var($_GET['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
            $db = new DBLayer('lib');
            $sth = $db->selectWithParameter("FileName", "plugins", array('id' => $id), "Id=:id");
            $name = $sth->fetch();
            if (is_dir("{$name['FileName']}")) {
                // removing plugin directory from the code base
                if (Plugincache::rrmdir("{$name['FileName']}")) {
                    $db->delete('plugins', array('id' => $id), "Id=:id");
                    //if result	successfull redirect and show success message
                    header("Cache-Control: max-age=1");
                    header("Location: index.php?page=plugins&result=2");
                    throw new SystemExit();
                } else {
                    // if result unsuccessfull redirect and show error message
                    header("Cache-Control: max-age=1");
                    header("Location: index.php?page=plugins&result=0");
                    throw new SystemExit();
                }
            }
        } else {
            // if result unsuccessfull redirect and show error message
            header("Cache-Control: max-age=1");
            header("Location: index.php?page=plugins&result=0");
            throw new SystemExit();
        }
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:41,代码来源:delete_plugin.php

示例2: createPermissions

 /**
  * creates permissions in the shard db for a user.
  * incase the shard is offline it will place it in the ams_querycache.
  * @param $pvalues with username
  */
 public static function createPermissions($pvalues)
 {
     try {
         $values = array('username' => $pvalues[0]);
         $dbs = new DBLayer("shard");
         $sth = $dbs->selectWithParameter("UId", "user", $values, "Login= :username");
         $result = $sth->fetchAll();
         $dbl = new DBLayer("lib");
         $UId = $result['0']['UId'];
         $statement = $dbl->execute("SELECT * FROM `settings` WHERE `Setting` = :setting", array('setting' => 'Domain_Auto_Add'));
         $json = $statement->fetch();
         $json = json_decode($json['Value'], true);
         $db = new DBLayer('shard');
         // get all domains
         $statement = $db->executeWithoutParams("SELECT * FROM domain");
         $rows = $statement->fetchAll();
         //error_log(print_r($rows,true));
         //error_log(print_r($result,true));
         //error_log(print_r($json,true));
         foreach ($json as $key => $value) {
             //error_log(print_r($key,true));
             //error_log(print_r($value,true));
             $ins_values = array('UId' => $UId, 'DomainId' => $key, 'AccessPrivilege' => $value['1']);
             error_log(print_r($ins_values, true));
             $dbs = new DBLayer("shard");
             $dbs->insert("permission", $ins_values);
         }
     } catch (PDOException $e) {
         //oh noooz, the shard is offline! Put it in query queue at ams_lib db!
         $dbl = new DBLayer("lib");
         $dbl->insert("ams_querycache", array("type" => "createPermissions", "query" => json_encode(array($pvalues[0])), "db" => "shard"));
     }
     return true;
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:39,代码来源:users.php

示例3: PluginUpdateExists

/**
 * Function to check for the update of a plugin already exists
 *
 * @param  $pluginId id of the plugin for which update is available
 * @param  $updatePath path of the new update
 * @return boolean True if update already exists else False
 *
 */
function PluginUpdateExists($pluginId, $updatePath)
{
    $db = new DBLayer('lib');
    $sth = $db->selectWithParameter("UpdatePath", "updates", array('pluginid' => $pluginId), "PluginId=:pluginid");
    $row = $sth->fetch();
    if ($updatePath == $row['UpdatePath']) {
        return true;
    } else {
        rmdir($row['UpdatePath']);
        return false;
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:20,代码来源:install_plugin.php

示例4: api_key_management_hook_load_db

/**
 * Global Hook to load the data from db and set it
 * into the global array to return it to the template
 */
function api_key_management_hook_load_db()
{
    global $var_set;
    global $API_key_management_return_set;
    $dbl = new DBLayer("lib");
    if (isset($_SESSION['user'])) {
        // returns the registered keys
        $sth = $dbl->select('ams_api_keys', array('user' => $_SESSION['user']), 'User = :user');
        $row = $sth->fetchAll();
        $API_key_management_return_set['api_keys'] = $row;
        // fetch the character from the array to compare
        $com = array_column($API_key_management_return_set['api_keys'], 'UserCharacter');
        // returns the characters with respect to the user id in the ring_tool->characters
        try {
            $dbl = new DBLayer('ring');
            $sth = $dbl->selectWithParameter('char_name', 'characters', array(), '1');
            $row = $sth->fetch();
            // loop through the character list and remove the character if already have an api key
            $API_key_management_return_set['characters'] = array_diff($row, $com);
        } catch (PDOException $e) {
            error_log($e->getMessage());
        }
    }
}
开发者ID:ryzom,项目名称:ryzomcore,代码行数:28,代码来源:API_key_management.php

示例5: activePlugins

 /**
  * Function provides list of active plugins
  *
  * @return  list of active plugins
  */
 public static function activePlugins()
 {
     $db = new DBLayer('lib');
     $sth = $db->selectWithParameter('Id', 'plugins', array('status' => 1), 'Status=:status');
     $row = $sth->fetchAll();
     return $row;
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:12,代码来源:plugincache.php

示例6: syncdata

 /**
  * performs the actions listed in the querycache.
  * All entries in the querycache will be read and performed depending on their type.
  * This is done because the shard could have been offline and we want changes made on the website (which is still online) to eventually hit the shard.
  * These changes are: createPermissions, createUser, change_pass, change_mail
  */
 public static function syncdata($display = false)
 {
     if (function_exists('pcntl_fork')) {
         $pid = pcntl_fork();
     }
     global $AMS_TMPDIR;
     $pidfile = $AMS_TMPDIR . '/ams_cron_pid';
     if (isset($pid) and function_exists('pcntl_fork')) {
         // We're the main process.
     } else {
         $pid = getmypid();
         if (Sync::check_for_pid(@file_get_contents($pidfile))) {
             $file = fopen($pidfile, 'w+');
             if (!$file) {
                 echo $pidfile . ' is not writeable.';
                 error_log($pidfile . ' is not writeable.');
                 throw new SystemExit();
             }
             fwrite($file, $pid);
             fclose($file);
             try {
                 $dbl = new DBLayer("lib");
                 $statement = $dbl->executeWithoutParams("SELECT * FROM ams_querycache");
                 $rows = $statement->fetchAll();
                 foreach ($rows as $record) {
                     $db = new DBLayer($record['db']);
                     switch ($record['type']) {
                         case 'createPermissions':
                             $decode = json_decode($record['query']);
                             $values = array('username' => $decode[0]);
                             //make connection with and put into shard db & delete from the lib
                             $sth = $db->selectWithParameter("UId", "user", $values, "Login= :username");
                             $result = $sth->fetchAll();
                             /*foreach ($result as $UId) {
                                   $ins_values = array('UId' => $UId['UId']);
                                   $ins_values['ClientApplication'] = "r2";
                                   $ins_values['AccessPrivilege'] = "OPEN";
                                   $db->insert("permission", $ins_values);
                                   $ins_values['ClientApplication'] = 'ryzom_open';
                                   $db->insert("permission",$ins_values);
                               }*/
                             // FIXME: GARBAGE
                             break;
                         case 'change_pass':
                             $decode = json_decode($record['query']);
                             $values = array('Password' => $decode[1]);
                             //make connection with and put into shard db & delete from the lib
                             $db->update("user", $values, "Login = '{$decode['0']}'");
                             break;
                         case 'change_mail':
                             $decode = json_decode($record['query']);
                             $values = array('Email' => $decode[1]);
                             //make connection with and put into shard db & delete from the lib
                             $db->update("user", $values, "Login = '{$decode['0']}'");
                             break;
                         case 'createUser':
                             $decode = json_decode($record['query']);
                             $values = array('Login' => $decode[0], 'Password' => $decode[1], 'Email' => $decode[2]);
                             //make connection with and put into shard db & delete from the lib
                             $db->insert("user", $values);
                             break;
                     }
                     $dbl->delete("ams_querycache", array('SID' => $record['SID']), "SID=:SID");
                 }
                 if ($display == true) {
                     print 'Syncing completed';
                 }
             } catch (PDOException $e) {
                 if ($display == true) {
                     print 'Something went wrong! The shard is probably still offline!';
                     print_r($e);
                 }
             }
             unlink($pidfile);
         }
     }
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:83,代码来源:sync.php

示例7: achievements_hook_get_db

/**
 * Global Hook to return global variables which contains
 * the content to use in the smarty templates extracted from 
 * the database
 * 
 * @return $achievements_return_set global array returns the template data
 */
function achievements_hook_get_db()
{
    global $achievements_return_set;
    if (isset($_SESSION['user'])) {
        $db = new DBLayer('lib');
        // getting content for selecting characters
        $sth = $db->selectWithParameter('UserCharacter', 'ams_api_keys', array('User' => $_SESSION['user']), 'User = :User');
        $row = $sth->fetch();
        $achievements_return_set['Character'] = $row;
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:18,代码来源:Achievements.php


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