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


PHP DBObject::glob方法代码示例

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


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

示例1: calculate

 public function calculate()
 {
     parent::calculate();
     // load records .. see $this->firstRecord, $this->perPage
     $limitSql = sprintf(' LIMIT %s,%s', $this->firstRecord, $this->perPage);
     $this->records = array_values(DBObject::glob($this->itemClass, $this->pageSql . $limitSql));
 }
开发者ID:hanigamal,项目名称:planetz,代码行数:7,代码来源:class.dbpager.php

示例2: Serial

        $s = new Serial();
        $s->app_id = $app->id;
        $s->dt = dater();
        $s->guid = $_POST['guid'];
        $s->serial = $_POST['serial'];
        $s->insert();
        redirect('pirates.php?id=' . $app->id);
    }
}
$db = Database::getDatabase();
$pirates = $db->getRows("SELECT * FROM pirates WHERE app_id = '{$app->id}' ORDER BY dt DESC");
$serial_count = $db->getValue("SELECT COUNT(*) from pirated_serials WHERE app_id = '{$app->id}'");
$serial_date = $db->getValue("SELECT dt FROM pirated_serials WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 1");
$serial_date = $serial_date ? time2str($serial_date) : 'never';
if (isset($_GET['feed']) && $_GET['feed'] == 'json') {
    $serials = DBObject::glob('Serial', "SELECT * from pirated_serials WHERE app_id = '{$app->id}'");
    $arr = array();
    foreach ($serials as $s) {
        $arr[] = array('dt' => $s->dt, 'guid' => $s->guid, 'serial' => $s->serial);
    }
    die(json_encode($arr));
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Shine</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
    <link rel="stylesheet" href="http://yui.yahooapis.com/2.7.0/build/reset-fonts-grids/reset-fonts-grids.css" type="text/css">
    <link rel="stylesheet" href="css/yuiapp.css" type="text/css">
开发者ID:jschilli,项目名称:Shine,代码行数:31,代码来源:pirates.php

示例3: Application

require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$db = Database::getDatabase();
$nav = 'applications';
// Create a new application if needed
if (isset($_POST['btnNewApp']) && strlen($_POST['name'])) {
    $a = new Application();
    $a->name = $_POST['name'];
    $a->insert();
    redirect('application.php?id=' . $a->id);
}
// Get a list of our apps
$apps = DBObject::glob('Application', 'SELECT * FROM shine_applications WHERE hidden = 0 ORDER BY name');
// Get our recent orders
$orders = DBObject::glob('Order', 'SELECT * FROM shine_orders ORDER BY dt DESC LIMIT 10');
// Downloads in last 24 hours
$sel = "TIME_FORMAT(dt, '%Y%m%d%H')";
$order_totals = $db->getRows("SELECT {$sel} as dtstr, COUNT(*) FROM shine_downloads WHERE  DATE_ADD(dt, INTERVAL 24 HOUR) > NOW() GROUP BY dtstr ORDER BY {$sel} ASC");
$opw24 = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary');
$opw24->showGrid = 1;
$opw24->dimensions = '280x100';
$opw24->setLabelsMinMax(4, 'left');
$opw24_fb = clone $opw24;
$opw24_fb->dimensions = '640x400';
// Downloads in last 30 days
$sel = "TO_DAYS(dt)";
$order_totals = $db->getRows("SELECT {$sel} as dtstr, COUNT(*) FROM shine_downloads WHERE DATE_ADD(dt, INTERVAL 30 DAY) > NOW() GROUP BY {$sel} ORDER BY {$sel} ASC");
$opw30 = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary');
$opw30->showGrid = 1;
$opw30->dimensions = '280x100';
开发者ID:yuantw,项目名称:Shine,代码行数:30,代码来源:index.php

示例4: listAllServices

 public function listAllServices()
 {
     $this->requireGet('hostname');
     $db = Database::getDatabase();
     $machine_id = $db->getValue('SELECT id FROM hw_cpus WHERE hostname = ' . $db->quote($_GET['hostname']) . ' AND user_id = ' . $this->user->id);
     if ($machine_id === false) {
         $this->error('machine does not exist');
     } else {
         $arr = array('services' => array());
         $services = DBObject::glob('Service', 'SELECT * FROM hw_services WHERE cpu_id = ' . $machine_id);
         foreach ($services as $s) {
             $arr['services'][] = array('type' => $s->type, 'name' => $s->name, 'txt_record' => $s->txt_record, 'port' => $s->port);
         }
         $this->out($arr);
     }
 }
开发者ID:rayleyva,项目名称:Highwire,代码行数:16,代码来源:class.api.php

示例5: AND

<?php

require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$db = Database::getDatabase();
if (isset($_GET['q'])) {
    $q = $_GET['q'];
    $_q = $db->escape($q);
    $search_sql = " AND (username LIKE '%{$_q}%' OR email LIKE '%{$_q}%') ";
} else {
    $q = '';
    $search_sql = '';
}
$users = DBObject::glob('User', "SELECT * FROM shine_users WHERE 1 = 1 {$search_sql} ORDER BY username");
include 'inc/header.inc.php';
?>

        <div id="bd">
            <div id="yui-main">
                <div class="yui-b"><div class="yui-g">


                    <div class="block tabs spaces">
                        <div class="hd">
                            <ul>
                                <li class="active"><a href="users.php">Users</a></li>
                                <li><a href="user-new.php">Create new user</a></li>
                            </ul>
                            <div class="clear"></div>
                        </div>
                        <div class="bd">
开发者ID:yuantw,项目名称:Shine,代码行数:31,代码来源:users.php

示例6: Application

require 'includes/master.inc.php';
$app = new Application($_GET['id']);
if (!$app->ok()) {
    die('Application not found');
}
$db = Database::getDatabase();
// This table format is crap, but it future proofs us against Sparkle format changes
$ip = $_SERVER['REMOTE_ADDR'];
$dt = date("Y-m-d H:i:s");
$db->query("INSERT INTO sparkle_reports (ip, dt) VALUES (:ip, :dt)", array('ip' => $ip, 'dt' => $dt));
$id = $db->insertId();
foreach ($_GET as $k => $v) {
    $db->query("INSERT INTO sparkle_data (sparkle_id, `key`, data) VALUES (:id, :k, :v)", array('id' => $id, 'k' => $k, 'v' => $v));
}
$versions = DBObject::glob('Version', "SELECT * FROM versions WHERE app_id = '{$app->id}' ORDER BY dt DESC LIMIT 10");
header("Content-type: application/xml");
echo '<';
?>
?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle"  xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title><?php 
echo $app->name;
?>
 Changelog</title>
		<link><?php 
echo $app->link;
?>
</link>
		<description>Most recent changes with links to updates.</description>
开发者ID:holtwick,项目名称:Shine,代码行数:30,代码来源:appcast.php

示例7: DISTINCT

<?php

require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$applications = DBObject::glob('Application', 'SELECT * FROM applications ORDER BY name');
$db = Database::getDatabase();
$keys = $db->getValues("SELECT DISTINCT(`key`) FROM sparkle_data");
$charts = array();
foreach ($keys as $k) {
    $data = array();
    $rows = $db->getRows("SELECT COUNT(*) as num, `data` FROM sparkle_data WHERE `key` = '{$k}' GROUP BY `data` ORDER BY num DESC");
    $count = 0;
    $total = 0;
    foreach ($rows as $row) {
        if ($count++ < 5) {
            $data[$row['data']] = $row['num'];
            $total += $row['num'];
        }
    }
    $charts[$k] = $data;
}
unset($charts['id']);
unset($charts['appName']);
unset($charts['appVersion']);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Shine</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
开发者ID:nterbogt,项目名称:Shine,代码行数:31,代码来源:stats.php

示例8: AND

    $search_sql = " AND (first_name LIKE '%{$_q}%' OR last_name LIKE '%{$_q}%' OR payer_email LIKE '%{$_q}%') ";
} else {
    $q = '';
    $search_sql = '';
}
if (isset($_GET['id'])) {
    $app_id = intval($_GET['id']);
    $total_num_orders = $db->getValue("SELECT COUNT(*) FROM shine_orders WHERE app_id = {$app_id} {$search_sql} ORDER BY dt DESC");
    $pager = new Pager(@$_GET['page'], 50, $total_num_orders);
    $orders = DBObject::glob('Order', "SELECT * FROM shine_orders WHERE app_id = {$app_id} {$search_sql} ORDER BY dt DESC LIMIT {$pager->firstRecord}, {$pager->perPage}");
    $where = " AND app_id = {$app_id} ";
    $app_name = $applications[$app_id]->name;
} else {
    $total_num_orders = $db->getValue("SELECT COUNT(*) FROM shine_orders WHERE 1 = 1 {$search_sql} ");
    $pager = new Pager(@$_GET['page'], 50, $total_num_orders);
    $orders = DBObject::glob('Order', "SELECT * FROM shine_orders WHERE 1 = 1 {$search_sql} ORDER BY dt DESC LIMIT {$pager->firstRecord}, {$pager->perPage}");
    $where = '';
    $app_name = 'All';
}
// Orders Per Month
$order_totals = $db->getRows("SELECT DATE_FORMAT(dt, '%b') as dtstr, COUNT(*) FROM shine_orders WHERE type = 'PayPal' {$where} GROUP BY CONCAT(YEAR(dt), '-', MONTH(dt)) ORDER BY YEAR(dt) ASC, MONTH(dt) ASC");
$opm = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary');
$opm->showGrid = 1;
$opm->dimensions = '280x100';
$opm->setLabelsMinMax(4, 'left');
$opm_fb = clone $opm;
$opm_fb->dimensions = '640x400';
// Orders Per Week
$order_totals = $db->getRows("SELECT WEEK(dt) as dtstr, COUNT(*) FROM shine_orders WHERE type = 'PayPal' {$where} GROUP BY CONCAT(YEAR(dt), WEEK(dt)) ORDER BY YEAR(dt) ASC, WEEK(dt) ASC");
$opw = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary');
$opw->showGrid = 1;
开发者ID:jsjohnst,项目名称:Shine,代码行数:31,代码来源:orders.php

示例9: redirect

    $t->new = 0;
    $t->update();
    redirect("http://twitter.com/home?status=@{$t->username}%20&in_reply_to={$t->tweet_id}");
}
$sql = '';
$app_id = '';
if (isset($_GET['id'])) {
    $sql = 'AND app_id = ' . intval($_GET['id']);
    $app_id = intval($_GET['id']);
}
if (isset($_GET['read'])) {
    $db = Database::getDatabase();
    $db->query("UPDATE tweets SET new = 0 WHERE 1 = 1 {$sql}");
    redirect("tweets.php?id={$app_id}");
}
$tweets = DBObject::glob('Tweet', "SELECT * FROM tweets WHERE deleted = 0 {$sql} ORDER BY dt DESC");
function twitterfy($str)
{
    // Via http://www.snipe.net/2009/09/php-twitter-clickable-links/
    $str = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $str);
    $str = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $str);
    $str = preg_replace("/@(\\w+)/", "<a href=\"http://www.twitter.com/\\1\" target=\"_blank\">@\\1</a>", $str);
    $str = preg_replace("/#(\\w+)/", "<a href=\"http://search.twitter.com/search?q=\\1\" target=\"_blank\">#\\1</a>", $str);
    return $str;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
 "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Shine</title>
开发者ID:jschilli,项目名称:Shine,代码行数:31,代码来源:tweets.php

示例10: array

}
// Get related orders
$db = Database::getDatabase();
$email = $db->quote($f->email);
$orders = DBObject::glob('Order', 'SELECT * FROM shine_orders WHERE payer_email = ' . $email . ' ORDER BY dt DESC');
// Get related feedbacks
$email = $db->quote($f->email);
$feedbacks = DBObject::glob('Feedback', 'SELECT * FROM shine_feedback WHERE email = ' . $email . ' AND id <> ' . $f->id . ' ORDER BY dt DESC');
// Get related activations
$order_ids = array(-1);
// -1 prevents sql error when no orders are added to the array
foreach ($orders as $o) {
    $order_ids[] = $o->id;
}
$order_ids = implode(',', $order_ids);
$activations = DBObject::glob('Activation', "SELECT * FROM shine_activations WHERE (order_id IN ({$order_ids})) OR (ip = '{$f->ip}') ORDER BY dt DESC");
include 'inc/header.inc.php';
?>

        <div id="bd">
            <div id="yui-main">
                <div class="yui-b"><div class="yui-g">

                    <div class="block tabs spaces">
                        <div class="hd">
                            <h2>Orders</h2>
							<ul>
								<li><a href="feedback.php">All Feedback</a></li>
								<li><a href="feedback.php?type=support">Support Questions</a></li>
								<li><a href="feedback.php?type=bug">Bug Reports</a></li>
								<li><a href="feedback.php?type=feature">Feature Requests</a></li>
开发者ID:yuantw,项目名称:Shine,代码行数:31,代码来源:feedback-view.php

示例11: getHasMany

 protected function getHasMany($key)
 {
     $db = Database::getDatabase();
     $data = ORMObject::$_data[$this->className][strtolower($key)];
     $tmp_obj = new $data['fc']();
     if ($data['joined']) {
         $join_table = $this->joinTable($this->tableName, $tmp_obj->tableName);
         $data_b = ORMObject::$_data[$tmp_obj->className][strtolower($this->className . 's')];
         $sql = "SELECT b.* FROM `{$join_table}` ab LEFT JOIN `{$tmp_obj->tableName}` b ON ab.{$data_b['fk']} = b.{$data_b['pk']} WHERE ab.{$data['fk']} = " . $db->quote($this->{$data['pk']});
         return DBObject::glob($data['fc'], $sql);
     } else {
         if (isset($data['sort'])) {
             $sorter = " SORT BY `{$data['sort']}` ";
         } else {
             $sorter = '';
         }
         $sql = "SELECT * FROM `{$tmp_obj->tableName}` WHERE `{$data['fk']}` = " . $db->quote($this->id) . $sorter;
         return DBObject::glob($data['fc'], $sql);
     }
 }
开发者ID:sbazemore,项目名称:simple-php-framework,代码行数:20,代码来源:class.ormobject.php

示例12: nl

$padding = 3;
for ($i = 1; $i <= $Pager->numPages; $i++) {
    $min = $Pager->page - $padding;
    $max = $Pager->page + $padding;
    if ($i == 1) {
        $paging .= '<li><a href="?page=' . $i . $searchAppend . '">&laquo;</a></li>' . nl();
    }
    if ($i == $Pager->page) {
        $paging .= '<li class="active"><a href="#">' . $i . '</a></li>' . nl();
    } else {
        if ($i >= $max xor $i > $min) {
            $paging .= '<li><a href="?page=' . $i . $searchAppend . '">' . $i . '</a></li>' . nl();
        }
    }
    if ($i == $Pager->numPages) {
        $paging .= '<li><a href="?page=' . $Pager->numPages . $searchAppend . '">&raquo;</a></li>' . nl();
    }
}
$paging .= '</ul></div>' . nl();
// Build the paging
// Build the user list array and pass it into the template
$Users = DBObject::glob('Users', 'SELECT * FROM users ' . $search . ' ORDER By username ASC' . $Pager->limits);
foreach ($Users as $User) {
    $userList[$User->id]['email'] = $User->email;
    $userList[$User->id]['username'] = $User->username;
    $userList[$User->id]['group'] = $User->level;
}
// Build the user list
Template::setBaseDir('./assets/tmpl');
$html = Template::loadTemplate('layout', array('header' => Template::loadTemplate('header', array('title' => $title, 'user' => $user, 'admin' => $isadmin, 'msg' => $msg, 'selected' => 'users')), 'content' => Template::loadTemplate('users', array('users' => $userList, 'pager' => $paging, 'search' => $searchValue, 'total' => $Pager->numRecords, 'user' => $user, 'admin' => $isadmin, 'page' => $Pager->page, 'update' => $update)), 'footer' => Template::loadTemplate('footer', array('time_start' => $time_start))));
echo $html;
开发者ID:repsycle,项目名称:baseline,代码行数:31,代码来源:users.php

示例13: scandir

    $sparkle_key = $app->sparkle_key;
    $sparkle_pkey = $app->sparkle_pkey;
    $ap_key = $app->ap_key;
    $ap_pkey = $app->ap_pkey;
    $custom_salt = $app->custom_salt;
    $from_email = $app->from_email;
    $email_subject = $app->email_subject;
    $email_body = $app->email_body;
    $license_filename = $app->license_filename;
    $return_url = $app->return_url;
    $fs_security_key = $app->fs_security_key;
    $tweet_terms = $app->tweet_terms;
    $upgrade_app_id = $app->upgrade_app_id;
    $engine_class_name = $app->engine_class_name;
}
$upgrade_apps = DBObject::glob('Application', "SELECT * FROM shine_applications WHERE id <> '{$app->id}' ORDER BY name");
$includes_path = DOC_ROOT . '/includes/';
$files = scandir($includes_path);
$available_engines = array();
foreach ($files as $fn) {
    $engine_name = match('/^class\\.engine(..*?)\\.php/', $fn, 1);
    if ($engine_name !== false) {
        $available_engines[] = $engine_name;
    }
}
$available_engines = implode(', ', $available_engines);
include 'inc/header.inc.php';
?>

        <div id="bd">
            <div id="yui-main">
开发者ID:yuantw,项目名称:Shine,代码行数:31,代码来源:application.php

示例14:

<?php

// This is just a helper script you can use on your website to track
// downloads of each version of your app. Set the $app_id variable below,
// and this will automatically redirect the user to download the most
// recent version of your app. The downloads will be counted and reported
// in Shine.
require 'includes/master.inc.php';
if (isset($_GET['id'])) {
    $app_id = $_GET['id'];
} else {
    // So that functionality mirrors what it was before you could specify an app_id
    $app_id = 1;
}
$v = DBObject::glob('Version', "SELECT * FROM versions WHERE app_id = {$app_id} ORDER BY dt DESC LIMIT 1");
$v = array_pop($v);
$v->downloads++;
$v->update();
Download::track();
header('Location: ' . $v->url);
开发者ID:jschilli,项目名称:Shine,代码行数:20,代码来源:download.php

示例15: mysql_real_escape_string

<?php

require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');
$nav = 'feedback';
if (isset($_GET['type'])) {
    $db = Database::getDatabase();
    $type = mysql_real_escape_string($_GET['type'], $db->db);
    $feedback = DBObject::glob('Feedback', "SELECT * FROM shine_feedback WHERE type = '{$type}' ORDER BY dt DESC");
} else {
    $feedback = DBObject::glob('Feedback', "SELECT * FROM shine_feedback ORDER BY dt DESC");
}
include 'inc/header.inc.php';
?>

        <div id="bd">
            <div id="yui-main">
                <div class="yui-b"><div class="yui-g">
                    <div class="block tabs spaces">
                        <div class="hd">
                            <h2>Feedback</h2>
							<ul>
								<li <?php 
if (@$_GET['type'] == '') {
    ?>
 class="active"<?php 
}
?>
><a href="feedback.php">All Feedback</a></li>
								<li <?php 
if (@$_GET['type'] == 'support') {
开发者ID:yuantw,项目名称:Shine,代码行数:31,代码来源:feedback.php


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