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


PHP DBLayer::executeWithoutParams方法代码示例

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


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

示例1: load_With_SID

 /**
  * loads the object's attributes.
  */
 public function load_With_SID()
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->executeWithoutParams("SELECT * FROM plugins");
     $row = $statement->fetch();
     $this->set($row);
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:10,代码来源:plugincache.php

示例2: settings

/**
* This function is beign used to load info that's needed for the settings page.
* check if the person who wants to view this page is a mod/admin or the user to whom te settings belong himself, if this is not the case, he will be redirected to an error page.
* it will return a lot of information of that user, that's being used for loading the template.
* @author Daan Janssens, mentored by Matthew Lagoe
*/
function settings()
{
    if (WebUsers::isLoggedIn()) {
        //in case id-GET param set it's value as target_id, if no id-param is given, ue the session id.
        if (isset($_GET['id'])) {
            if ($_GET['id'] != $_SESSION['id'] && !Ticket_User::isMod(unserialize($_SESSION['ticket_user']))) {
                //ERROR: No access!
                $_SESSION['error_code'] = "403";
                header("Cache-Control: max-age=1");
                header("Location: index.php?page=error");
                throw new SystemExit();
            } else {
                $webUser = new Webusers($_GET['id']);
                $result = $webUser->getInfo();
                if (Ticket_User::isMod(unserialize($_SESSION['ticket_user'])) && $_GET['id'] != $_SESSION['id']) {
                    $result['changesOther'] = "TRUE";
                }
                $result['target_id'] = $_GET['id'];
                $result['current_mail'] = $webUser->getEmail();
                $result['target_username'] = $webUser->getUsername();
            }
        } else {
            $webUser = new Webusers($_SESSION['id']);
            $result = $webUser->getInfo();
            $result['target_id'] = $_SESSION['id'];
            $result['current_mail'] = $webUser->getEmail();
            $result['target_username'] = $webUser->getUsername();
        }
        //Sanitize Data
        $result['current_mail'] = filter_var($result['current_mail'], FILTER_SANITIZE_EMAIL);
        $result['target_username'] = filter_var($result['target_username'], FILTER_SANITIZE_STRING);
        $result['FirstName'] = filter_var($result['FirstName'], FILTER_SANITIZE_STRING);
        $result['LastName'] = filter_var($result['LastName'], FILTER_SANITIZE_STRING);
        $result['Country'] = filter_var($result['Country'], FILTER_SANITIZE_STRING);
        $result['Gender'] = filter_var($result['Gender'], FILTER_SANITIZE_NUMBER_INT);
        $result['ReceiveMail'] = filter_var($result['ReceiveMail'], FILTER_SANITIZE_NUMBER_INT);
        $result['country_array'] = getCountryArray();
        global $INGAME_WEBPATH;
        $result['ingame_webpath'] = $INGAME_WEBPATH;
        $dbl = new DBLayer("lib");
        $statement = $dbl->executeWithoutParams("SELECT * FROM settings");
        $rows = $statement->fetchAll();
        foreach ($rows as &$value) {
            $result[$value['Setting']] = $value['Value'];
        }
        return $result;
    } else {
        //ERROR: not logged in!
        header("Location: index.php");
        header("Cache-Control: max-age=1");
        throw new SystemExit();
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:59,代码来源:settings.php

示例3: update_plugin

/**
 * This function is used in installing updates for plugins.
 * It takes id of the plugin whose update is available using
 * $_GET global variable and then extract the update details
 * from db and then install it in the plugin.
 *
 * @author Shubham Meena, mentored by Matthew Lagoe
 */
function update_plugin()
{
    // if logged in
    if (WebUsers::isLoggedIn()) {
        if (isset($_GET['id'])) {
            // id of plugin to update
            $id = filter_var($_GET['id'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
            $db = new DBLayer('lib');
            $sth = $db->executeWithoutParams("SELECT * FROM plugins INNER JOIN updates ON plugins.Id=updates.PluginId Where plugins.Id={$id}");
            $row = $sth->fetch();
            // replacing update in the  database
            Plugincache::rrmdir($row['FileName']);
            Plugincache::zipExtraction($row['UpdatePath'], rtrim($row['FileName'], strtolower($row['Name'])));
            $db->update("plugins", array('Info' => $row['UpdateInfo']), "Id={$row['Id']}");
            // deleting the previous update
            $db->delete("updates", array('id' => $row['s.no']), "s.no=:id");
            // if update is installed succesffully redirect to show success message
            header("Cache-Control: max-age=1");
            header("Location: index.php?page=plugins&result=8");
            throw new SystemExit();
        }
    }
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:31,代码来源:update_plugin.php

示例4: loadTemplate

 /**
  * workhorse of the website, it loads the template and shows it or returns th html.
  * it uses smarty to load the $template, but before displaying the template it will pass the $vars to smarty. Also based on your language settings a matching
  * array of words & sentences for that page will be loaded. In case the $returnHTML parameter is set to true, it will return the html instead of displaying the template.
  *
  * @param  $template the name of the template(page) that we want to load.
  * @param  $vars an array of variables that should be loaded by smarty before displaying or returning the html.
  * @param  $returnHTML (default=false) if set to true, the html that should have been displayed, will be returned.
  * @return in case $returnHTML=true, it returns the html of the template being loaded.
  */
 public static function loadTemplate($template, $vars = array(), $returnHTML = false)
 {
     //error_log(print_r($_GET,true));
     //error_log(print_r($_POST,true));
     global $AMS_LIB;
     global $SITEBASE;
     global $AMS_TRANS;
     global $INGAME_LAYOUT;
     global $AMS_CACHEDIR;
     global $AMS_PLUGINS;
     // define('SMARTY_SPL_AUTOLOAD',1);
     require_once $AMS_LIB . '/smarty/libs/Smarty.class.php';
     spl_autoload_register('__autoload');
     $smarty = new Smarty();
     $smarty->setCompileDir($SITEBASE . '/templates_c/');
     $smarty->setCacheDir($AMS_CACHEDIR);
     $smarty->setConfigDir($SITEBASE . '/configs/');
     // turn smarty debugging on/off
     $smarty->debugging = false;
     // caching must be disabled for multi-language support
     $smarty->caching = false;
     $smarty->cache_lifetime = 300;
     $smarty->addPluginsDir($AMS_PLUGINS);
     if (function_exists('apc_cache_info')) {
         // production
         //$smarty->caching = true;
         //$smarty->setCachingType("apc");
         //$smarty->compile_check = false;
     }
     // needed by smarty.
     helpers::create_folders();
     global $FORCE_INGAME;
     // if ingame, then use the ingame templates
     if (helpers::check_if_game_client() or $FORCE_INGAME) {
         $smarty->template_dir = $AMS_LIB . '/ingame_templates/';
         $smarty->setConfigDir($AMS_LIB . '/configs');
         $variables = parse_ini_file($AMS_LIB . '/configs/ingame_layout.ini', true);
         foreach ($variables[$INGAME_LAYOUT] as $key => $value) {
             $smarty->assign($key, $value);
         }
     } else {
         $smarty->template_dir = $SITEBASE . '/templates/';
         $smarty->setConfigDir($SITEBASE . '/configs');
     }
     foreach ($vars as $key => $value) {
         $smarty->assign($key, $value);
     }
     // load page specific variables that are language dependent
     $variables = Helpers::handle_language();
     if ($template != 'layout_plugin') {
         foreach ($variables[$template] as $key => $value) {
             $smarty->assign($key, $value);
         }
     }
     // load ams content variables that are language dependent
     foreach ($variables['ams_content'] as $key => $value) {
         $smarty->assign($key, $value);
     }
     //load ams content variables that are language dependent
     foreach ($variables['ams_content'] as $key => $value) {
         $smarty->assign($key, $value);
     }
     $id = session_id();
     $smarty->assign("sessionid", $id);
     $dbl = new DBLayer("lib");
     $statement = $dbl->executeWithoutParams("SELECT * FROM settings");
     $rows = $statement->fetchAll();
     foreach ($rows as &$value) {
         $smarty->assign($value['Setting'], $value['Value']);
     }
     // smarty inheritance for loading the matching wrapper layout (with the matching menu bar)
     if (isset($vars['permission']) && $vars['permission'] == 3) {
         $inherited = "extends:layout_admin.tpl|";
     } else {
         if (isset($vars['permission']) && $vars['permission'] == 2) {
             $inherited = "extends:layout_mod.tpl|";
         } else {
             if (isset($vars['permission']) && $vars['permission'] == 1) {
                 $inherited = "extends:layout_user.tpl|";
             } else {
                 $inherited = "";
             }
         }
     }
     // if $returnHTML is set to true, return the html by fetching the template else display the template.
     if ($returnHTML == true) {
         return $smarty->fetch($inherited . $template . '.tpl');
     } else {
         $smarty->display($inherited . $template . '.tpl');
     }
//.........这里部分代码省略.........
开发者ID:ryzom,项目名称:ryzomcore,代码行数:101,代码来源:helpers.php

示例5: api_key_management_hook_activate

function api_key_management_hook_activate()
{
    $dbl = new DBLayer("lib");
    $sql = "INSERT INTO `settings` (Setting) \n            SELECT 'Domain_Auto_Add' FROM DUAL\n            WHERE NOT EXISTS \n            (SELECT Setting FROM settings WHERE Setting='Domain_Auto_Add');";
    $dbl->executeWithoutParams($sql);
}
开发者ID:ryzom,项目名称:ryzomcore,代码行数:6,代码来源:Domain_Management.php

示例6: 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

示例7: DBLayer

/**
 * This script will import all users of the nel db and add a matching ticket_user an ams_user entry for them.
 * @author Daan Janssens, mentored by Matthew Lagoe
 */
//require the pages that are being needed.
require '../../config.php';
require '../../../ams_lib/libinclude.php';
ini_set("display_errors", true);
error_reporting(E_ALL);
//var used to access the DB;
global $cfg;
try {
    //SETUP THE WWW DB
    $dbs = new DBLayer("shard");
    $sql = "SELECT * FROM user";
    $statement = $dbs->executeWithoutParams($sql);
    $users = $statement->fetchAll();
    foreach ($users as $user) {
        //add user to web
        $dbw = new DBLayer("web");
        if (!$dbw->execute("SELECT * FROM ams_user WHERE Login = :name", array('name' => $user['Login']))->rowCount()) {
            $query = "INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)";
            global $DEFAULT_LANGUAGE;
            $vars = array('name' => $user['Login'], 'pass' => $user['Password'], 'mail' => $user['Email'], 'lang' => $DEFAULT_LANGUAGE);
            $id = $dbw->executeReturnId($query, $vars);
            $dbl = new DBLayer("lib");
            $query = "INSERT INTO `ticket_user` (Permission, ExternId) VALUES (1, :id)";
            $vars = array('id' => $id);
            $dbl->execute($query, $vars);
        }
    }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:31,代码来源:importusers.php

示例8: api_key_management_hook_activate

/**
 * Global Hook to create table of the API_key_management
 * if not created.
 * Contains the sql code
 */
function api_key_management_hook_activate()
{
    $dbl = new DBLayer("lib");
    $sql = "\n                        --\n                        -- Database: `ryzom_ams_lib`\n                        --\n\n                        -- --------------------------------------------------------\n\n                        --\n                        -- Table structure for table `ams_api_keys`\n                        --\n\n                        CREATE TABLE IF NOT EXISTS `ams_api_keys` (\n                          `SNo` int(10) NOT NULL AUTO_INCREMENT,\n                          `User` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n                          `FrName` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n                          `UserType` varchar(10) COLLATE utf8_unicode_ci DEFAULT NULL,\n                          `UserCharacter` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL,\n                          `ExpiryDate` date DEFAULT NULL,\n                          `AccessToken` text COLLATE utf8_unicode_ci DEFAULT NULL,\n                          `AddedOn` datetime DEFAULT NULL,\n                          `Items` text COLLATE utf8_unicode_ci,\n                          PRIMARY KEY (`SNo`),\n                          KEY `User` (`User`)\n                        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1 ;\n\n                        --\n                        -- Constraints for table `ams_api_keys`\n                        --\n                        ALTER TABLE `ams_api_keys`\n                          ADD CONSTRAINT `ams_api_keys_ibfk_1` FOREIGN KEY (`User`) REFERENCES `ryzom_ams`.`ams_user` (`Login`);";
    $dbl->executeWithoutParams($sql);
}
开发者ID:ryzom,项目名称:ryzomcore,代码行数:11,代码来源:API_key_management.php

示例9: getNewestTicket

 /**
  * get the ticket object of the latest added ticket.
  */
 public static function getNewestTicket()
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->executeWithoutParams("SELECT * FROM `ticket` ORDER BY `TId` DESC LIMIT 1 ");
     $ticket = new Ticket();
     $ticket->set($statement->fetch());
     return $ticket;
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:11,代码来源:ticket_queue_handler.php

示例10: getUsers

 /**
  * return all users.
  * @return return an array of users
  */
 public function getUsers()
 {
     $dbl = new DBLayer("web");
     $data = $dbl->executeWithoutParams("SELECT * FROM ams_user");
     return $data;
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:10,代码来源:webusers.php

示例11: 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

示例12: getAllSupportGroups

 /**
  * return all support_group objects.
  * @return an array containing all support_group objects.
  * @deprecated should be removed in the future, because getGroups does the same.
  */
 public static function getAllSupportGroups()
 {
     $dbl = new DBLayer("lib");
     $statement = $dbl->executeWithoutParams("SELECT * FROM `support_group`");
     $row = $statement->fetchAll();
     $result = array();
     foreach ($row as $group) {
         $instance = new self();
         $instance->set($group);
         $result[] = $instance;
     }
     return $result;
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:18,代码来源:support_group.php


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