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


PHP POD::dbms方法代码示例

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


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

示例1: replace

 public function replace($option = null)
 {
     $this->id = null;
     if (empty($this->table)) {
         return false;
     }
     $attributes = array_merge($this->_qualifiers, $this->_attributes);
     if (empty($attributes)) {
         return false;
     }
     $pairs = $attributes;
     foreach ($pairs as $key => $value) {
         if (is_null($value)) {
             $pairs[$key] = 'NULL';
         }
     }
     $attributeFields = $this->_capsulateFields(array_keys($attributes));
     if (in_array(POD::dbms(), array('MySQL', 'MySQLi', 'SQLite3'))) {
         // Those supports 'REPLACE'
         $this->_query = 'REPLACE INTO ' . $this->table . ' (' . implode(',', $attributeFields) . ') VALUES(' . implode(',', $pairs) . ')';
         if ($option == 'count') {
             return POD::queryCount($this->_query);
         }
         if (POD::query($this->_query)) {
             $this->id = POD::insertId();
             return true;
         }
         return false;
     } else {
         $this->_query = 'SELECT * FROM ' . $this->table . $this->_makeWhereClause() . ' LIMIT 1';
         if (POD::queryExistence($this->_query)) {
             return $this->update($option);
         } else {
             return $this->insert($option);
         }
     }
 }
开发者ID:ragi79,项目名称:Textcube,代码行数:37,代码来源:DBModel.php

示例2: _t

    echo _t('테이블 이름');
    ?>
</span></th>
										<th class="delete"><span class="text"><?php 
    echo _t('삭제');
    ?>
</span></th>
									</tr>
								</thead>
								<tbody>
<?php 
    //$likeEscape = array ( '/_/' , '/%/' );
    //$likeReplace = array ( '\\_' , '\\%' );
    //$escapename = preg_replace($likeEscape, $likeReplace, $database['prefix']);
    $dbtables = POD::tableList($database['prefix']);
    if (in_array(POD::dbms(), array('MySQL', 'MySQLi'))) {
        $result = POD::queryRow("SHOW VARIABLES LIKE 'lower_case_table_names'");
        $dbCaseInsensitive = $result['Value'] == 1 ? true : false;
    } else {
        $dbCaseInsensitive = true;
    }
    requireModel('common.setting');
    $definedTables = getDefinedTableNames();
    $dbtables = array_values(array_diff($dbtables, $definedTables));
    if ($dbCaseInsensitive == true) {
        $tempTables = $definedTables;
        $definedTables = array();
        foreach ($tempTables as $table) {
            $table = strtolower($table);
            array_push($definedTables, $table);
        }
开发者ID:ragi79,项目名称:Textcube,代码行数:31,代码来源:index.php

示例3: getCalendar

function getCalendar($blogid, $period)
{
    global $database;
    $calendar = array('days' => array());
    if ($period === true || !checkPeriod($period)) {
        $period = Timestamp::getYearMonth();
    }
    $calendar['period'] = $period;
    $calendar['year'] = substr($period, 0, 4);
    $calendar['month'] = substr($period, 4, 2);
    $visibility = doesHaveOwnership() ? '' : 'AND e.visibility > 0' . getPrivateCategoryExclusionQuery($blogid);
    switch (POD::dbms()) {
        case 'Cubrid':
            $result = POD::queryAllWithDBCache("SELECT DISTINCT TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'DD')\n\t\t\t\tFROM {$database['prefix']}Entries e\n\t\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND\n\t\t\t\t\tTO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'YYYY') = '{$calendar['year']}' AND\n\t\t\t\t\tTO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'MM') = '{$calendar['month']}'", 'entry');
            break;
        case 'MySQL':
        case 'MySQLi':
        case 'PostgreSQL':
        default:
            $result = POD::queryAllWithDBCache("SELECT DISTINCT DAYOFMONTH(FROM_UNIXTIME(e.published)) \n\t\t\t\tFROM {$database['prefix']}Entries e\n\t\t\t\tWHERE e.blogid = {$blogid} AND e.draft = 0 {$visibility} AND e.category >= 0 AND YEAR(FROM_UNIXTIME(e.published)) = {$calendar['year']} AND MONTH(FROM_UNIXTIME(e.published)) = {$calendar['month']}", 'entry');
            break;
    }
    if ($result) {
        foreach ($result as $dayArray) {
            list($day) = $dayArray;
            array_push($calendar['days'], $day);
        }
    }
    $calendar['days'] = array_flip($calendar['days']);
    return $calendar;
}
开发者ID:hinablue,项目名称:TextCube,代码行数:31,代码来源:blog.archive.php

示例4: checkStep

function checkStep($step, $check = true)
{
    global $root, $path;
    $error = 0;
    if ($step == 1) {
        if ($check) {
            return true;
        }
    } else {
        if ($step == 2) {
            if ($check) {
                if (!empty($_POST['mode'])) {
                    switch ($_POST['mode']) {
                        case 'install':
                        case 'setup':
                        case 'uninstall':
                            return true;
                    }
                }
            }
            ?>
  <input type="hidden" name="step" value="2" />
  <input id="setupMode" type="hidden" name="mode" value="" />
  <div id="inner">
    <h2><span class="step"><?php 
            echo _f('%1단계', 2);
            ?>
</span> : <?php 
            echo _t('작업 유형을 선택해 주십시오.');
            ?>
</h2>
    <div style="text-align:center">
      <div style="width:100%; padding:40px 0px 40px 0px">
        <div style="margin:20px;"><input type="button" value="<?php 
            echo _t('새로운 텍스트큐브를 설정합니다');
            ?>
" style="width:100%; height:40px; font-size:14px" onclick="next('install');return false;" /></div>
        <div style="margin:20px;"><input type="button" value="<?php 
            echo _t('텍스트큐브를 다시 설정합니다');
            ?>
" style="width:100%; height:40px; font-size:14px" onclick="next('setup');return false;" /></div>
        <div style="margin:20px;"><input type="button" value="<?php 
            echo _t('텍스트큐브 테이블을 삭제합니다');
            ?>
" style="width:100%; height:40px; font-size:14px" onclick="next('uninstall');return false;" /></div>
      </div>
    </div>
  </div>
<?php 
        } else {
            if ($step == 3) {
                if ($check) {
                    switch ($_POST['mode']) {
                        case 'install':
                        case 'setup':
                            if (!empty($_POST['dbServer']) && !empty($_POST['dbName']) && !empty($_POST['dbUser']) && isset($_POST['dbPassword']) && isset($_POST['dbPrefix'])) {
                                $dbTemp = array('server' => $_POST['dbServer'], 'username' => $_POST['dbUser'], 'password' => $_POST['dbPassword'], 'port' => $_POST['dbPort']);
                                if (!empty($_POST['dbName'])) {
                                    $dbTemp['database'] = $_POST['dbName'];
                                }
                                global $dbms;
                                $dbms = $_POST['dbms'];
                                if (!POD::bind($dbTemp)) {
                                    $error = 1;
                                } else {
                                    if (!empty($_POST['dbPrefix']) && !preg_match('/^[a-zA-Z0-9_]+$/', $_POST['dbPrefix'])) {
                                        $error = 3;
                                    } else {
                                        return true;
                                    }
                                }
                            }
                            break;
                        case 'uninstall':
                            if (!empty($_POST['dbServer']) && !empty($_POST['dbName']) && !empty($_POST['dbUser']) && isset($_POST['dbPassword']) && !empty($_POST['dbPort'])) {
                                $dbTemp = array('server' => $_POST['dbServer'], 'username' => $_POST['dbUser'], 'password' => $_POST['dbPassword'], 'port' => $_POST['dbPort']);
                                if (!empty($_POST['dbName'])) {
                                    $dbTemp['database'] = $_POST['dbName'];
                                }
                                global $dbms;
                                $dbms = $_POST['dbms'];
                                if (!POD::bind($dbTemp)) {
                                    $error = 1;
                                } else {
                                    return true;
                                }
                            }
                            break;
                    }
                }
                ?>
  <input type="hidden" name="step" value="3" />
  <input type="hidden" name="mode" value="<?php 
                echo $_POST['mode'];
                ?>
" />
  <script type="text/javascript">
    //<![CDATA[
     function suggestDefaultPort(db) {
		switch(db) {
//.........这里部分代码省略.........
开发者ID:hoksi,项目名称:Textcube,代码行数:101,代码来源:setup.php

示例5: _text

					</ul>

<?php 
}
?>
					<h3><?php 
echo _text('변경 중');
?>
</h3>

					<ul id="processList">
<?php 
$changed = false;
global $succeed;
$succeed = true;
if ($currentVersion != TEXTCUBE_VERSION && in_array(POD::dbms(), array('MySQL', 'MySQLi'))) {
    $pool = DBModel::getInstance();
    /* From Textcube 1.9 */
    if (version_compare($currentVersion, '1.9.1', '<')) {
        $changed = true;
        echo '<li>', _text('기본 에디터를 변경합니다.'), ': ';
        $pool->reset('BlogSettings');
        $pool->setQualifier('name', 'equals', 'defaultEditor', true);
        $pool->setQualifier('value', 'equals', 'modern', true);
        $pool->setAttribute('value', 'tinyMCE', true);
        if ($pool->update()) {
            showCheckupMessage(true);
        } else {
            showCheckupMessage(false);
        }
    }
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:checkup.php

示例6: __tcSqlLogDump


//.........这里部分代码省略.........
            $trclass .= ' debugSystem';
            $count_label = '';
            $backtrace = '';
        }
        $elapsed_total_db += $log['elapsed'];
        $elapsed_total = $log['endtime'];
        $progress_bar = $log['percent'] / 2;
        //Max 50px;
        if (!$commentBlosk) {
            $log['sql'] = htmlspecialchars($log['sql']);
            $log['percent'] = "<div style='background:#f00;line-height:10px;width:{$progress_bar}px'>&nbsp;</div>";
            print <<<TBODY
\t\t<tr class="debugSQLLine{$trclass}">
\t\t\t<th>{$count_label}</th>
\t\t\t<td class="code"><code>{$log['sql']}</code></td>
\t\t\t<td class="elapsed">{$log['elapsed']}</td>
\t\t\t<td class="elapsedSum">{$log['endtime']}</td>
\t\t\t<td class="elapsedSum">{$log['percent']}</td>
\t\t\t<td class="rows">{$log['rows']}</td>
\t\t\t<td class="error">{$error}</td>
\t\t\t<td class="backtrace"><pre>{$backtrace}</pre></td>
\t\t</tr>
TBODY;
        } else {
            $log['sql'] = str_replace('-->', '-- >', $log['sql']);
            print <<<TBODY

===============================================================================================
{$count_label}:{$log['sql']}
Elapsed:{$log['elapsed']} ms/End time:{$log['endtime']}/Percent:{$log['percent']}/Rows:{$log['rows']} rows
{$error}
{$backtrace}
TBODY;
        }
        if ($log['cached'] < 2) {
            $count++;
        }
    }
    $count--;
    $real_query_count = $count - $cached_count;
    if (!$commentBlosk) {
        print '</tbody>';
        print <<<TFOOT
<tfoot>
\t<tr>
\t\t<td colspan='8'>
\t\t{$count} ({$real_query_count}+{$cached_count} cache) Queries <br />
\t\t{$elapsed_total_db} ms elapsed in db query, overall {$elapsed_total} ms elapsed
\t\t</td>
\t</tr>
</tfoot>
TFOOT;
        print '</table>';
    }
    global $service, $URLInfo, $suri;
    print '<div class="debugTable">' . CRLF;
    print '<h4>Current Database Management System :</h4>' . CRLF . '<p>' . POD::dbms() . ' ' . POD::version() . '</p>' . CRLF;
    print '<h4>SSL support : </h4>' . CRLF;
    if (isset($service['useSSL']) && $service['useSSL'] == true) {
        print '<p>Enabled</p>' . CRLF;
    } else {
        print '<p>Disabled</p>' . CRLF;
    }
    print '<h4>Cache system :</h4>' . CRLF;
    if (isset($service['pagecache']) && $service['pagecache'] == true) {
        print '<p>Page cache Enabled</p>' . CRLF;
    } else {
        print '<p>Page cache Disabled</p>' . CRLF;
    }
    if (isset($service['skincache']) && $service['skincache'] == true) {
        print '<p>Skin cache Enabled</p>' . CRLF;
    } else {
        print '<p>Skin cache Disabled</p>' . CRLF;
    }
    if (isset($service['memcached']) && $service['memcached'] == true) {
        print '<p>Memcached module Enabled</p>' . CRLF;
    } else {
        print '<p>Memcached module Disabled</p>' . CRLF;
    }
    if (!empty($service['debug_session_dump'])) {
        print '<h4>Session Information</h4>' . CRLF;
        print '<pre>session_id = ' . session_id() . CRLF;
        print '$_SESSION = ';
        print_r($_SESSION);
        print '$_COOKIE = ';
        print_r($_COOKIE);
        print '</pre>';
    }
    if (!empty($service['debug_rewrite_module'])) {
        print '<h4>Path parse result</h4>' . CRLF;
        print '<pre>' . CRLF;
        print_r($URLInfo);
        print_r($suri);
        print '</pre>';
    }
    print '</div>' . CRLF;
    if ($commentBlosk == true) {
        echo '-->';
    }
}
开发者ID:Avantians,项目名称:Textcube,代码行数:101,代码来源:Debug.php

示例7: getCalendar

function getCalendar($blogid, $period)
{
    global $database;
    $skinSetting = Setting::getSkinSettings($blogid);
    $pool = DBModel::getInstance();
    $pool->init("Entries");
    $pool->setAlias("Entries", "e");
    $pool->setQualifier("e.blogid", "eq", $blogid);
    $pool->setQualifier("e.draft", "eq", 0);
    $pool->setQualifier("e.category", ">=", 0);
    if (!doesHaveOwnership()) {
        $pool->setQualifier("e.visibility", ">", 0);
        $pool = getPrivateCategoryExclusionQualifier($pool, $blogid);
    }
    $calendar = array('days' => array());
    if ($period === true || !checkPeriod($period)) {
        $period = Timestamp::getYearMonth();
    }
    $calendar['period'] = $period;
    $calendar['year'] = substr($period, 0, 4);
    $calendar['month'] = substr($period, 4, 2);
    switch (POD::dbms()) {
        case 'Cubrid':
            $pool->setQualifier("TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'YYYY')", "eq", $calendar['year'], true);
            $pool->setQualifier("TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'MM')", "eq", $calendar['month'], true);
            $result = $pool->getAll("TO_CHAR(to_timestamp('09:00:00 AM 01/01/1970')+e.published, 'DD')", array('filter' => 'distinct', 'usedbcache' => true, 'cacheprefix' => 'entry'));
            break;
        case 'SQLite3':
            $pool->setQualifier("strftime('%Y',e.published,'unixepoch')", "eq", $calendar['year'], true);
            $pool->setQualifier("strftime('%m',e.published,'unixepoch')", "eq", $calendar['month'], true);
            $result = $pool->getAll("strftime('%d',e.published,'unixepoch')", array('filter' => 'distinct', 'usedbcache' => true, 'cacheprefix' => 'entry'));
            break;
        case 'MySQL':
        case 'MySQLi':
        case 'PostgreSQL':
        default:
            $pool->setQualifier("YEAR(FROM_UNIXTIME(e.published))", "eq", $calendar['year'], true);
            $pool->setQualifier("MONTH(FROM_UNIXTIME(e.published))", "eq", $calendar['month'], true);
            $result = $pool->getAll("DAYOFMONTH(FROM_UNIXTIME(e.published))", array('filter' => 'distinct', 'usedbcache' => true, 'cacheprefix' => 'entry'));
            break;
    }
    if ($result) {
        foreach ($result as $dayArray) {
            list($day) = $dayArray;
            array_push($calendar['days'], $day);
        }
    }
    $calendar['days'] = array_flip($calendar['days']);
    return $calendar;
}
开发者ID:Avantians,项目名称:Textcube,代码行数:50,代码来源:archive.php

示例8: replace

 public function replace($option = null)
 {
     $this->id = null;
     if (empty($this->table)) {
         return false;
     }
     $this->_called = true;
     // Use first qualifiers when multiple conditions exist.
     $qualifiers = array();
     if (!empty($this->_qualifiers)) {
         foreach ($this->_qualifiers as $key => $index) {
             $qualifiers[$key] = reset($index);
         }
     }
     $attributes = array_merge($qualifiers, $this->_attributes);
     if (empty($attributes)) {
         return false;
     }
     $pairs = $attributes;
     foreach ($pairs as $key => $value) {
         if (is_null($value)) {
             $pairs[$key] = 'NULL';
         }
     }
     $attributeFields = $this->_capsulateFields(array_keys($attributes));
     if (in_array(POD::dbms(), array('MySQLnd', 'MySQLi', 'SQLite3'))) {
         // Those supports 'REPLACE'
         $this->_query = 'REPLACE INTO ' . $this->_getTableName() . ' (' . implode(',', $attributeFields) . ') VALUES(' . implode(',', $pairs) . ')';
         if ($option == 'count') {
             return POD::queryCount($this->_query);
         }
         $result = POD::query($this->_query);
         if ($result) {
             $this->id = POD::insertId();
             $this->_manage_pool_stack();
             return true;
         }
         return false;
     } else {
         $this->_query = 'SELECT * FROM ' . $this->_getTableName() . $this->_makeWhereClause() . ' LIMIT 1';
         $result = POD::queryExistence($this->_query);
         if ($result) {
             return $this->update($option);
         } else {
             return $this->insert($option);
         }
     }
 }
开发者ID:Avantians,项目名称:Textcube,代码行数:48,代码来源:DBModel.php

示例9: requirePrivilege

require ROOT . '/interface/common/control/header.php';
requirePrivilege('group.creators');
function getSymbolByQuantity($bytes)
{
    $symbols = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
    $exp = floor(log($bytes) / log(1024));
    return sprintf('%.2f ' . $symbols[$exp], $bytes / pow(1024, floor($exp)));
}
$context = Model_Context::getInstance();
/* Current time */
$serverTime = strftime("Server Time: %Y-%m-%d %H:%M:%S %z (%Z)", time());
/* Database version */
$dbVersion = '';
//if( $service['dbms'] == 'mysql' ) {
$dbVersion = POD::version();
$dbVersion = POD::dbms() . ": " . $dbVersion;
$dbStat = preg_replace("/\\s{2,}/", "<br />", POD::stat());
//}
/* Webserver information */
$webServer = "Unknown";
if (function_exists('apache_get_version')) {
    $webServer = apache_get_version();
}
/* OS version */
$osVersion = "Unknown";
if (function_exists('php_uname')) {
    $osVersion = php_uname();
}
/* Disk space */
$totalSpace = getSymbolByQuantity(disk_total_space(dirname(__FILE__)));
$freeSpace = getSymbolByQuantity(disk_free_space(dirname(__FILE__)));
开发者ID:Avantians,项目名称:Textcube,代码行数:31,代码来源:index.php


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