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


PHP Database::pexecute方法代码示例

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


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

示例1: initAccount

 public function initAccount($certrow)
 {
     // Let's see if we have the private accountkey
     $this->accountKey = $certrow['leprivatekey'];
     if (!$this->accountKey || $this->accountKey == 'unset' || Settings::Get('system.letsencryptca') != 'production') {
         // generate and save new private key for account
         // ---------------------------------------------
         $this->log('Starting new account registration');
         $keys = $this->generateKey();
         // Only store the accountkey in production, in staging always generate a new key
         if (Settings::Get('system.letsencryptca') == 'production') {
             $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `lepublickey` = :public, `leprivatekey` = :private " . "WHERE `customerid` = :customerid;");
             Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid']));
         }
         $this->accountKey = $keys['private'];
         $response = $this->postNewReg();
         if ($this->client->getLastCode() != 201) {
             throw new \RuntimeException("Account not initialized, probably due to rate limiting. Whole response: " . $response);
         }
         $this->postNewReg();
         $this->log('New account certificate registered');
     } else {
         $this->log('Account already registered. Continuing.');
     }
 }
开发者ID:asemen,项目名称:Froxlor,代码行数:25,代码来源:class.lescript.php

示例2: storeDefaultIndex

/**
 * store the default index-file in a given destination folder
 * 
 * @param string  $loginname   customers loginname
 * @param string  $destination path where to create the file
 * @param object  $logger      FroxlorLogger object
 * @param boolean $force       force creation whatever the settings say (needed for task #2, create new user)
 * 
 * @return null
 */
function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false)
{
    if ($force || (int) Settings::Get('system.store_index_file_subs') == 1) {
        $result_stmt = Database::prepare("\n\t\t\tSELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login`\n\t\t\tFROM `" . TABLE_PANEL_CUSTOMERS . "` AS `c` INNER JOIN `" . TABLE_PANEL_ADMINS . "` AS `a`\n\t\t\tON `c`.`adminid` = `a`.`adminid`\n\t\t\tINNER JOIN `" . TABLE_PANEL_TEMPLATES . "` AS `t`\n\t\t\tON `a`.`adminid` = `t`.`adminid`\n\t\t\tWHERE `varname` = 'index_html' AND `c`.`loginname` = :loginname");
        Database::pexecute($result_stmt, array('loginname' => $loginname));
        if (Database::num_rows() > 0) {
            $template = $result_stmt->fetch(PDO::FETCH_ASSOC);
            $replace_arr = array('SERVERNAME' => Settings::Get('system.hostname'), 'CUSTOMER' => $template['customer_login'], 'ADMIN' => $template['admin_login'], 'CUSTOMER_EMAIL' => $template['customer_email'], 'ADMIN_EMAIL' => $template['admin_email']);
            $htmlcontent = replace_variables($template['value'], $replace_arr);
            $indexhtmlpath = makeCorrectFile($destination . '/index.' . Settings::Get('system.index_file_extension'));
            $index_html_handler = fopen($indexhtmlpath, 'w');
            fwrite($index_html_handler, $htmlcontent);
            fclose($index_html_handler);
            if ($logger !== null) {
                $logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . Settings::Get('system.index_file_extension') . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath));
            }
        } else {
            $destination = makeCorrectDir($destination);
            if ($logger !== null) {
                $logger->logAction(CRON_ACTION, LOG_NOTICE, 'Running: cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
            }
            safe_exec('cp -a ' . FROXLOR_INSTALL_DIR . '/templates/misc/standardcustomer/* ' . escapeshellarg($destination));
        }
    }
    return;
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:36,代码来源:function.storeDefaultIndex.php

示例3: storeSettingWebserverFcgidFpmUser

/**
 * Whenever the webserver- / FCGID- or FPM-user gets updated
 * we need to update ftp_groups accordingly
 */
function storeSettingWebserverFcgidFpmUser($fieldname, $fielddata, $newfieldvalue)
{
    if (is_array($fielddata) && isset($fielddata['settinggroup']) && isset($fielddata['varname'])) {
        $update_user = null;
        // webserver
        if ($fielddata['settinggroup'] == 'system' && $fielddata['varname'] == 'httpuser') {
            $update_user = Settings::Get('system.httpuser');
        }
        // fcgid
        if ($fielddata['settinggroup'] == 'system' && $fielddata['varname'] == 'mod_fcgid_httpuser') {
            $update_user = Settings::Get('system.mod_fcgid_httpuser');
        }
        // webserver
        if ($fielddata['settinggroup'] == 'phpfpm' && $fielddata['varname'] == 'vhost_httpuser') {
            $update_user = Settings::Get('phpfpm.vhost_httpuser');
        }
        $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
        if ($returnvalue !== false) {
            /**
             * only update if anything changed
             */
            if ($update_user != null && $newfieldvalue != $update_user) {
                $upd_stmt = Database::prepare("UPDATE `" . TABLE_FTP_GROUPS . "` SET `members` = REPLACE(`members`, :olduser, :newuser)");
                Database::pexecute($upd_stmt, array('olduser' => $update_user, 'newuser' => $newfieldvalue));
            }
        }
    }
    return $returnvalue;
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:33,代码来源:function.storeSettingWebserverFcgidFpmUser.php

示例4: storeSettingDefaultIp

/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <flo@syscp.org> (2003-2009)
 * @author     Froxlor team <team@froxlor.org> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function storeSettingDefaultIp($fieldname, $fielddata, $newfieldvalue)
{
    $defaultips_old = Settings::Get('system.defaultip');
    $returnvalue = storeSettingField($fieldname, $fielddata, $newfieldvalue);
    if ($returnvalue !== false && is_array($fielddata) && isset($fielddata['settinggroup']) && $fielddata['settinggroup'] == 'system' && isset($fielddata['varname']) && $fielddata['varname'] == 'defaultip') {
        $customerstddomains_result_stmt = Database::prepare("\n\t\t\tSELECT `standardsubdomain` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `standardsubdomain` <> '0'\n\t\t");
        Database::pexecute($customerstddomains_result_stmt);
        $ids = array();
        while ($customerstddomains_row = $customerstddomains_result_stmt->fetch(PDO::FETCH_ASSOC)) {
            $ids[] = (int) $customerstddomains_row['standardsubdomain'];
        }
        if (count($ids) > 0) {
            $defaultips_new = explode(',', $newfieldvalue);
            // Delete the existing mappings linking to default IPs
            $del_stmt = Database::prepare("\n\t\t\t\t\tDELETE FROM `" . TABLE_DOMAINTOIP . "`\n\t\t\t\t\tWHERE `id_domain` IN (" . implode(', ', $ids) . ")\n\t\t\t\t\tAND `id_ipandports` IN (" . $defaultips_old . ", " . $newfieldvalue . ")\n\t\t\t");
            Database::pexecute($del_stmt);
            // Insert the new mappings
            $ins_stmt = Database::prepare("\n\t\t\t\tINSERT INTO `" . TABLE_DOMAINTOIP . "`\n\t\t\t\tSET `id_domain` = :domainid, `id_ipandports` = :ipandportid\n\t\t\t");
            foreach ($ids as $id) {
                foreach ($defaultips_new as $defaultip_new) {
                    Database::pexecute($ins_stmt, array('domainid' => $id, 'ipandportid' => $defaultip_new));
                }
            }
        }
    }
    return $returnvalue;
}
开发者ID:asemen,项目名称:Froxlor,代码行数:43,代码来源:function.storeSettingDefaultIp.php

示例5: __construct

 /**
  * constructor
  * @param string logFile
  * @param int startTime
  * @param string logFileExim
  */
 public function __construct($startTime = 0)
 {
     $this->startTime = $startTime;
     // Get all domains from Database
     $stmt = Database::prepare("SELECT domain FROM `" . TABLE_PANEL_DOMAINS . "`");
     Database::pexecute($stmt, array());
     while ($domain_row = $stmt->fetch(PDO::FETCH_ASSOC)) {
         $this->myDomains[] = $domain_row["domain"];
     }
     // Parse MTA traffic
     if (Settings::Get("system.mtaserver") == "postfix") {
         $this->_parsePostfixLog(Settings::Get("system.mtalog"));
         $this->_parsePostfixLog(Settings::Get("system.mtalog") . ".1");
     } elseif (Settings::Get("system.mtaserver") == "exim4") {
         $this->_parseExim4Log(Settings::Get("system.mtalog"));
     }
     // Parse MDA traffic
     if (Settings::Get("system.mdaserver") == "dovecot") {
         $this->_parseDovecotLog(Settings::Get("system.mdalog"));
         $this->_parsePostfixLog(Settings::Get("system.mdalog") . ".1");
     } elseif (Settings::Get("system.mdaserver") == "courier") {
         $this->_parseCourierLog(Settings::Get("system.mdalog"));
         $this->_parsePostfixLog(Settings::Get("system.mdalog") . ".1");
     }
 }
开发者ID:cobrafast,项目名称:Froxlor,代码行数:31,代码来源:class.mailLogParser.php

示例6: getIpPortCombinations

/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2003-2009 the SysCP Team (see authors).
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Florian Lippert <flo@syscp.org> (2003-2009)
 * @author     Froxlor team <team@froxlor.org> (2010-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function getIpPortCombinations($ssl = false)
{
    global $userinfo;
    $additional_conditions_params = array();
    $additional_conditions_array = array();
    if ($userinfo['ip'] != '-1') {
        $admin_ip_stmt = Database::prepare("\n\t\t\tSELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` WHERE `id` = :ipid\n\t\t");
        $admin_ip = Database::pexecute_first($admin_ip_stmt, array('ipid' => $userinfo['ip']));
        $additional_conditions_array[] = "`ip` = :adminip";
        $additional_conditions_params['adminip'] = $admin_ip['ip'];
        $admin_ip = null;
    }
    if ($ssl !== null) {
        $additional_conditions_array[] = "`ssl` = :ssl";
        $additional_conditions_params['ssl'] = $ssl === true ? '1' : '0';
    }
    $additional_conditions = '';
    if (count($additional_conditions_array) > 0) {
        $additional_conditions = " WHERE " . implode(" AND ", $additional_conditions_array) . " ";
    }
    $result_stmt = Database::prepare("\n\t\tSELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` " . $additional_conditions . " ORDER BY `ip` ASC, `port` ASC\n\t");
    Database::pexecute($result_stmt, $additional_conditions_params);
    $system_ipaddress_array = array();
    while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
        if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
            $row['ip'] = '[' . $row['ip'] . ']';
        }
        $system_ipaddress_array[$row['id']] = $row['ip'] . ':' . $row['port'];
    }
    return $system_ipaddress_array;
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:47,代码来源:function.getIpPortCombinations.php

示例7: validatePasswordLogin

/**
 * Function validatePasswordLogin
 *
 * compare user password-hash with given user-password
 * and check if they are the same
 * additionally it updates the hash if the system settings changed
 * or if the very old md5() sum is used
 *
 * @param array $userinfo user-data from table
 * @param string $password the password to validate
 * @param string $table either panel_customers or panel_admins
 * @param string $uid user-id-field in $table
 *
 * @return boolean
 */
function validatePasswordLogin($userinfo = null, $password = null, $table = 'panel_customers', $uid = 'customerid')
{
    $systype = 3;
    // SHA256
    if (Settings::Get('system.passwordcryptfunc') !== null) {
        $systype = (int) Settings::Get('system.passwordcryptfunc');
    }
    $pwd_hash = $userinfo['password'];
    $update_hash = false;
    // check for good'ole md5
    if (strlen($pwd_hash) == 32 && ctype_xdigit($pwd_hash)) {
        $pwd_check = md5($password);
        $update_hash = true;
    } else {
        // cut out the salt from the hash
        $pwd_salt = str_replace(substr(strrchr($pwd_hash, "\$"), 1), "", $pwd_hash);
        // create same hash to compare
        $pwd_check = crypt($password, $pwd_salt);
        // check whether the hash needs to be updated
        $hash_type_chk = substr($pwd_hash, 0, 3);
        if ($systype == 1 && $hash_type_chk != '$1$' || $systype == 2 && $hash_type_chk != '$2$' || $systype == 3 && $hash_type_chk != '$5$' || $systype == 4 && $hash_type_chk != '$6$') {
            $update_hash = true;
        }
    }
    if ($pwd_hash == $pwd_check) {
        // check for update of hash
        if ($update_hash) {
            $upd_stmt = Database::prepare("\n\t\t\t\tUPDATE " . $table . " SET `password` = :newpasswd WHERE `" . $uid . "` = :uid\n\t\t\t");
            $params = array('newpasswd' => makeCryptPassword($password), 'uid' => $userinfo[$uid]);
            Database::pexecute($upd_stmt, $params);
        }
        return true;
    }
    return false;
}
开发者ID:mowamed,项目名称:Froxlor,代码行数:50,代码来源:function.validatePasswordLogin.php

示例8: initAccount

 public function initAccount($certrow, $isFroxlorVhost = false)
 {
     // Let's see if we have the private accountkey
     $this->accountKey = $certrow['leprivatekey'];
     if (!$this->accountKey || $this->accountKey == 'unset' || Settings::Get('system.letsencryptca') != 'production') {
         // generate and save new private key for account
         // ---------------------------------------------
         $this->log('Starting new account registration');
         $keys = $this->generateKey();
         // Only store the accountkey in production, in staging always generate a new key
         if (Settings::Get('system.letsencryptca') == 'production') {
             if ($isFroxlorVhost) {
                 Settings::Set('system.lepublickey', $keys['public']);
                 Settings::Set('system.leprivatekey', $keys['private']);
             } else {
                 $upd_stmt = Database::prepare("UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET `lepublickey` = :public, `leprivatekey` = :private " . "WHERE `customerid` = :customerid;");
                 Database::pexecute($upd_stmt, array('public' => $keys['public'], 'private' => $keys['private'], 'customerid' => $certrow['customerid']));
             }
         }
         $this->accountKey = $keys['private'];
         $response = $this->postNewReg();
         if ($this->client->getLastCode() != 201) {
             throw new \RuntimeException("Account not initialized, probably due to rate limiting. Whole response: " . json_encode($response));
         }
         $this->license = $this->client->getAgreementURL();
         // Terms of Servce are optional according to ACME specs; if no ToS are presented, no need to update registration
         if (!empty($this->license)) {
             $this->postRegAgreement(parse_url($this->client->getLastLocation(), PHP_URL_PATH));
         }
         $this->log('New account certificate registered');
     } else {
         $this->log('Account already registered. Continuing.');
     }
 }
开发者ID:hypernics,项目名称:Froxlor,代码行数:34,代码来源:class.lescript.php

示例9: toggleCronStatus

function toggleCronStatus($module = null, $isactive = 0)
{
    if ($isactive != 1) {
        $isactive = 0;
    }
    $upd_stmt = Database::prepare("\n\t\tUPDATE `" . TABLE_PANEL_CRONRUNS . "` SET `isactive` = :active WHERE `module` = :module");
    Database::pexecute($upd_stmt, array('active' => $isactive, 'module' => $module));
}
开发者ID:asemen,项目名称:Froxlor,代码行数:8,代码来源:function.CronjobFunctions.php

示例10: triggerLetsEncryptCSRForAliasDestinationDomain

/**
 * This file is part of the Froxlor project.
 * Copyright (c) 2010 the Froxlor Team (see authors).
 *
 * For the full copyright and license information, please view the COPYING
 * file that was distributed with this source code. You can also view the
 * COPYING file online at http://files.froxlor.org/misc/COPYING.txt
 *
 * @copyright  (c) the authors
 * @author     Daniel Reichelt <hacking@nachtgeist.net> (2016-)
 * @license    GPLv2 http://files.froxlor.org/misc/COPYING.txt
 * @package    Functions
 *
 */
function triggerLetsEncryptCSRForAliasDestinationDomain($aliasDestinationDomainID, $log)
{
    if (isset($aliasDestinationDomainID) && $aliasDestinationDomainID > 0) {
        $log->logAction(ADM_ACTION, LOG_INFO, "LetsEncrypt CSR triggered for domain ID " . $aliasDestinationDomainID);
        $upd_stmt = Database::prepare("UPDATE\n\t\t\t\t\t`" . TABLE_PANEL_DOMAIN_SSL_SETTINGS . "`\n\t\t\t\tSET\n\t\t\t\t\t`expirationdate` = null\n\t\t\t\tWHERE\n\t\t\t\t\tdomainid = :domainid\n\t\t\t");
        Database::pexecute($upd_stmt, array('domainid' => $aliasDestinationDomainID));
    }
}
开发者ID:asemen,项目名称:Froxlor,代码行数:22,代码来源:function.triggerLetsEncryptCSRForAliasDestinationDomain.php

示例11: domainMainToSubExists

/**
 * check whether a subof-domain exists
 * #329
 * 
 *  @param int $id subof-domain-id
 *  
 *  @return boolean
 */
function domainMainToSubExists($id = 0)
{
    $result_stmt = Database::prepare("\n\t\tSELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` WHERE `id` = :id");
    Database::pexecute($result_stmt, array('id' => $id));
    $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
    if (isset($result['id']) && $result['id'] > 0) {
        return true;
    }
    return false;
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:18,代码来源:function.domainHasMainSubDomains.php

示例12: updateToVersion

/**
 * Function updateToVersion
 *
 * updates the panel.version field
 * to the given value (no checks here!)
 *
 * @param string $new_version new-version
 *
 * @return bool true on success, else false
 */
function updateToVersion($new_version = null)
{
    if ($new_version !== null && $new_version != '') {
        $upd_stmt = Database::prepare("\n\t\t\t\tUPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :newversion\n\t\t\t\tWHERE `settinggroup` = 'panel' AND `varname` = 'version'");
        Database::pexecute($upd_stmt, array('newversion' => $new_version));
        Settings::Set('panel.version', $new_version);
        return true;
    }
    return false;
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:20,代码来源:function.updateFunctions.php

示例13: domainHasSslIpPort

/**
 * Check whether a given domain has an ssl-ip/port assigned
 *
 * @param int $domainid
 *
 * @return boolean
 */
function domainHasSslIpPort($domainid = 0)
{
    $result_stmt = Database::prepare("\n\t\t\tSELECT `dt`.* FROM `" . TABLE_DOMAINTOIP . "` `dt`, `" . TABLE_PANEL_IPSANDPORTS . "` `iap`\n\t\t\tWHERE `dt`.`id_ipandports` = `iap`.`id` AND `iap`.`ssl` = '1' AND `dt`.`id_domain` = :domainid;");
    Database::pexecute($result_stmt, array('domainid' => $domainid));
    $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
    if (is_array($result) && isset($result['id_ipandports'])) {
        return true;
    }
    return false;
}
开发者ID:fritz-net,项目名称:Froxlor,代码行数:17,代码来源:function.domainHasSslIpPort.php

示例14: checkDomainIPConfigured

/**
 * Function checkDomainIPConfigured
 *
 * Checks whether a domain has at least one ipandport which is actually
 * configured on any interface of the current host
 *
 * @param int $domainid domain id
 *
 * @return true if ip is configured, false otherwise
 */
function checkDomainIPConfigured($domainid)
{
    $result_stmt = Database::prepare("SELECT `ipp`.`ip` FROM `" . TABLE_DOMAINTOIP . "` `dip`\n\t\t\tLEFT JOIN `" . TABLE_PANEL_IPSANDPORTS . "` `ipp` ON (`dip`.`id_ipandports` = `ipp`.`id`)\n\t\t\t   WHERE `dip`.`id_domain` = :domainid;");
    Database::pexecute($result_stmt, array('domainid' => (int) $domainid));
    while ($result = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
        if (checkIPConfigured($result['ip'])) {
            return true;
        }
    }
    return false;
}
开发者ID:greybyte,项目名称:froxlor-mn,代码行数:21,代码来源:function.checkIPConfigured.php

示例15: customerHasPerlEnabled

/**
 * Function customerHasPerlEnabled
 *
 * returns true or false whether perl is
 * enabled for the given customer
 *
 * @param int customer-id
 *
 * @return boolean
 */
function customerHasPerlEnabled($cid = 0)
{
    if ($cid > 0) {
        $result_stmt = Database::prepare("\n\t\t\t\tSELECT `perlenabled` FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid` = :cid");
        Database::pexecute($result_stmt, array('cid' => $cid));
        $result = $result_stmt->fetch(PDO::FETCH_ASSOC);
        if (is_array($result) && isset($result['perlenabled'])) {
            return $result['perlenabled'] == '1' ? true : false;
        }
    }
    return false;
}
开发者ID:cobrafast,项目名称:Froxlor,代码行数:22,代码来源:function.customerHasPerlEnabled.php


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